diff --git a/.github/workflows/sitesmith.yml b/.github/workflows/sitesmith.yml new file mode 100644 index 0000000..465d982 --- /dev/null +++ b/.github/workflows/sitesmith.yml @@ -0,0 +1,56 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + env: + MDBOOK_VERSION: 0.1.3 + steps: + - uses: actions/checkout@v4 + - name: Install sitesmith + run: | + curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh + rustup update + cargo install --version ${MDBOOK_VERSION} sitesmith + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build with sitesmith + run: sitesmith --projects ./gen/projects.json --work ./gen/work.json --template ./gen/template.html --output index.html + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./ + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index c971f62..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "dlss"] - path = dlss - url = https://github.com/BuyMyMojo/dlss-versions diff --git a/README.md b/README.md index a587a4e..e85fc48 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ -[![CodeFactor](https://www.codefactor.io/repository/github/buymymojo/buymymojo.net/badge/master)](https://www.codefactor.io/repository/github/buymymojo/buymymojo.net/overview/master) # buymymojo.net -my personal website's code and files + +Just my personal website. + +Made with [Braden Everson](https://bradeneverson.github.io/)'s website generation tool, [SiteSmith](https://github.com/bradeneverson/sitesmith). diff --git a/about.html b/about.html deleted file mode 100644 index f2eab90..0000000 --- a/about.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - about - - - - - - - - - - - - - - - - - - - - - -
-

home - about - DLSS

-
-

About


-

- This website is just for whatever I need it for :)
- Not much is planned at the time of writing this. (02/07/2021, 6:14:53 pm)
- I am working on the dlss repo at the moment
- and I'll try to find the differences between the versions but it might not
- be possibile for each minor version. -


-

- Thanks for visint my website!
- if you need to contect me feel free to find me on discord: BuyMyMojo#0308 -

-
-
- - \ No newline at end of file diff --git a/android-chrome-192x192.png b/android-chrome-192x192.png index 93f698c..bb20dd4 100644 Binary files a/android-chrome-192x192.png and b/android-chrome-192x192.png differ diff --git a/android-chrome-512x512.png b/android-chrome-512x512.png index 8eb64ea..dd10263 100644 Binary files a/android-chrome-512x512.png and b/android-chrome-512x512.png differ diff --git a/apple-touch-icon.png b/apple-touch-icon.png index 740626c..b148a2e 100644 Binary files a/apple-touch-icon.png and b/apple-touch-icon.png differ diff --git a/bmm.css b/bmm.css deleted file mode 100644 index 747ceb3..0000000 --- a/bmm.css +++ /dev/null @@ -1,12 +0,0 @@ -html, body { - height: 99.5%; - } - -.full-page { - width: 99.5%; - height: 100%; -} - -.center-text { - text-align: center; -} \ No newline at end of file diff --git a/dlss b/dlss deleted file mode 160000 index 95f36ab..0000000 --- a/dlss +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 95f36abaa117d6860a662eb432f488496aafd5eb diff --git a/dlss.html b/dlss.html deleted file mode 100644 index 8669a2d..0000000 --- a/dlss.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - DLSS repo - - - - - - - - - - - - - - - - - - - - - -
-

home - about - DLSS

-
-

DLSS

- - - - Cyberpunk 2077 screenshot - -
-

- There are a lot of versions of dlss out in the wild.
- I'm going to compile as many versions of dlss here as I can,
- it's fun to compare them and see a timeline of the evolution of this tech. -


-

- Bellow is a bunch of buttons that will let you download the nvngx_dlss.dll file
- for each version of dlss I have. To use them just replace the dll file in your game
- files with the same name and it will work right away. -


-
-

Downloads:


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

UE4 plugin

R6S

Doom Eternal

No Man's Sky

Cyberpunk/Ghostrunner

3D mark

Death stranding

Minecraft win10

3D mark

- -
-
-
- - \ No newline at end of file diff --git a/favicon-16x16.png b/favicon-16x16.png index a43c9a8..b6570a0 100644 Binary files a/favicon-16x16.png and b/favicon-16x16.png differ diff --git a/favicon-32x32.png b/favicon-32x32.png index 9b6c59e..1cf396f 100644 Binary files a/favicon-32x32.png and b/favicon-32x32.png differ diff --git a/favicon.ico b/favicon.ico index df6b2cf..50a3032 100644 Binary files a/favicon.ico and b/favicon.ico differ diff --git a/files/OwenQuinlanCV2024-09.pdf b/files/OwenQuinlanCV2024-09.pdf new file mode 100755 index 0000000..119a94f Binary files /dev/null and b/files/OwenQuinlanCV2024-09.pdf differ diff --git a/files/me.jxl b/files/me.jxl new file mode 100644 index 0000000..8134760 Binary files /dev/null and b/files/me.jxl differ diff --git a/files/me.png b/files/me.png new file mode 100755 index 0000000..eaf3847 Binary files /dev/null and b/files/me.png differ diff --git a/files/me.webp b/files/me.webp new file mode 100644 index 0000000..d3d8362 Binary files /dev/null and b/files/me.webp differ diff --git a/gen/projects.json b/gen/projects.json new file mode 100644 index 0000000..e15fec0 --- /dev/null +++ b/gen/projects.json @@ -0,0 +1,69 @@ +[ + { + "name": "📍pinned project
Soul Abscence", + "descr": [ + "I worked together with a small group to make my first proper game jam game! This was for Godot Wild Jam #80", + "Soul Abscence is a resource managment simulation game inpired by 911 operator.", + "Adding 113 commits totalling around 12K lines of formatted code(unformatted number is most likely smaller!) I worked on things like level loading, A⭐ path finding, Menus and Options.", + "It was made over the course of about 9 days and I'm super happy with the work we've all put in! There is of coure a lot of things I'd do differently if we made the game again but that's just how it is when you make effectively a \"prototype\" game." + ], + "extra": [ + "", + "Game jam entry + rating page", + "Godot Wild Jam #80", + "Check out 911 Operator on steam!" + ] + }, + { + "name": "pinned project
Open FBT", + "descr": [ + "Open sourced version of a large scale discord bot for user managment.", + "Built in Rust and uses the Redis database to store user data.", + "In over 400 servers at time of writing(september 2024)", + "Origionally written in Python then converted to Rust to improve ease of deployment and improve performance significantly." + ], + "extra": [ + "View OpenFBT on GitHub.", + "Made in tandum with discord chat partser written in python and then Go for user moderation." + ] + }, + { + "name": "Mojo Kitchen Chaos - An overcooked-like game made in Unity following an online course", + "descr": [ + "Made over the course of a week following a course by Code Monkey." + ], + "extra": [ + "GitHub Repo", + "Itch.io page" + ] + }, + { + "name": "RedisFS - A pointless file storage solution written in Rust", + "descr": [ + "Sores files up to 500mb in a Redis database." + ], + "extra": [ + "GitHub Repo" + ] + }, + { + "name": "Video FPS overlay", + "descr": [ + "Origionally made to take FPS data from a csv file generated with Nvidia FrameView and display it in a Digital Foundry like graph.", + "Never reached a fully functioning state but it was a fun old project.", + "Written in Python" + ], + "extra": [ + "GitHub Repo" + ] + }, + { + "name": "This website!", + "descr": [ + "Made with Braden Everson's SiteSmith tool." + ], + "extra": [ + "GitHub Repo" + ] + } +] \ No newline at end of file diff --git a/gen/template.html b/gen/template.html new file mode 100644 index 0000000..8c5c2fc --- /dev/null +++ b/gen/template.html @@ -0,0 +1,108 @@ + + + + + + + Owen Quinlan (BuyMyMojo) :) + + + + +
+
+
+ + + + Artistic rendering of me! + + +
+

Owen Quinlan (BuyMyMojo) ☕

+ +
+ +
+

Summary

+
+

+ Dedicated Game Development Student. Strong background in Rust, Python, C#, with a focus on interactive + mediums that make an impact on users. Passionate about roles involving game development, + software development, and leveraging Rust for high-performance, thread-safe applications. + Actively seeking opportunities that align with career goals of contributing to impactful, engaging + media in game devlopment fields. +

+
+
+ +
+

Work Experience

+ {work} +
+ +
+

Projects

+ {projects} +
+ +
+ + + \ No newline at end of file diff --git a/gen/work.json b/gen/work.json new file mode 100644 index 0000000..41eca35 --- /dev/null +++ b/gen/work.json @@ -0,0 +1,21 @@ +[ + { + "name": "Jr Software Developer & Server Administrator", + "timespan": "2018 - 2022", + "location": "Mammoth Esports Australaia", + "descr": [ + "Designed and created a Discord bot for user managment used in over 400 Discord servers managing thousands of users and requests daily.", + "Handled the backend of our game server renting system" + ], + "extra": ["The company is now defunct but it was a good introduction to an industry I want to work in."] + }, + { + "name": "Phone Repair Technician", + "timespan": "Jan 2024 - Present", + "location": "Cohuna Phone Repairs", + "descr": [ + "Experince in data recovery, repair of phones and computers and general electronics repairs." + ], + "extra": [] + } +] \ No newline at end of file diff --git a/images/jpegXL/format_example.jxl b/images/jpegXL/format_example.jxl deleted file mode 100644 index fcf53df..0000000 Binary files a/images/jpegXL/format_example.jxl and /dev/null differ diff --git a/images/jpegXL/nvidia-rtx.jxl b/images/jpegXL/nvidia-rtx.jxl deleted file mode 100644 index a117f44..0000000 Binary files a/images/jpegXL/nvidia-rtx.jxl and /dev/null differ diff --git a/images/png/format_example.png b/images/png/format_example.png deleted file mode 100644 index c82a719..0000000 Binary files a/images/png/format_example.png and /dev/null differ diff --git a/images/png/nvidia-rtx.png b/images/png/nvidia-rtx.png deleted file mode 100644 index 896c925..0000000 Binary files a/images/png/nvidia-rtx.png and /dev/null differ diff --git a/images/webp/format_example.webp b/images/webp/format_example.webp deleted file mode 100644 index 914bf9b..0000000 Binary files a/images/webp/format_example.webp and /dev/null differ diff --git a/images/webp/nvidia-rtx.webp b/images/webp/nvidia-rtx.webp deleted file mode 100644 index 7b68d41..0000000 Binary files a/images/webp/nvidia-rtx.webp and /dev/null differ diff --git a/images/webp2/format_example.wp2 b/images/webp2/format_example.wp2 deleted file mode 100644 index 77b54f3..0000000 Binary files a/images/webp2/format_example.wp2 and /dev/null differ diff --git a/index.html b/index.html index 8a6beab..70a81fc 100644 --- a/index.html +++ b/index.html @@ -1,65 +1,108 @@ + - - - - - BuyMyMojo - - - - - - - - - - - - - + + Owen Quinlan (BuyMyMojo) :) + - - - - - - -
-

home - about - DLSS

-

BuyMyMojo

-
-

Yes another redesign...


-

Yeah I designed to redesign my website again to it's old style.
- I wanted more controll on images so I can start using Jpeg XL
- before it's supported in website builder software. -


-

example:

-
- - - - - Cyberpunk 2077 screenshot -
+ +
+
+
+ + + + Artistic rendering of me! + + +
+

Owen Quinlan (BuyMyMojo) ☕

+ +
+ +
+

Summary

+
+

+ Dedicated Game Development Student. Strong background in Rust, Python, C#, with a focus on interactive + mediums that make an impact on users. Passionate about roles involving game development, + software development, and leveraging Rust for high-performance, thread-safe applications. + Actively seeking opportunities that align with career goals of contributing to impactful, engaging + media in game devlopment fields. +

-
-

- The image above is most likely displaying in .webp format but if the browser
- doesnt support that(like old browsers) it will show a .png image and if your
- browser supports jpegXL then it will show a .jxl image. -


-

- Pretty simple reason but it's the sort of control I want. -


-
+ + +
+

Work Experience

+

Jr Software Developer & Server Administrator

Mammoth Esports Australaia | 2018 - 2022

  • Designed and created a Discord bot for user managment used in over 400 Discord servers managing thousands of users and requests daily.
  • Handled the backend of our game server renting system
The company is now defunct but it was a good introduction to an industry I want to work in.

Phone Repair Technician

Cohuna Phone Repairs | Jan 2024 - Present

  • Experince in data recovery, repair of phones and computers and general electronics repairs.
+
+ +
+

Projects

+

📍pinned project
Soul Abscence

  • I worked together with a small group to make my first proper game jam game! This was for Godot Wild Jam #80
  • Soul Abscence is a resource managment simulation game inpired by 911 operator.
  • Adding 113 commits totalling around 12K lines of formatted code(unformatted number is most likely smaller!) I worked on things like level loading, A⭐ path finding, Menus and Options.
  • It was made over the course of about 9 days and I'm super happy with the work we've all put in! There is of coure a lot of things I'd do differently if we made the game again but that's just how it is when you make effectively a "prototype" game.

Game jam entry + rating page
Godot Wild Jam #80
Check out 911 Operator on steam!

pinned project
Open FBT

  • Open sourced version of a large scale discord bot for user managment.
  • Built in Rust and uses the Redis database to store user data.
  • In over 400 servers at time of writing(september 2024)
  • Origionally written in Python then converted to Rust to improve ease of deployment and improve performance significantly.
View OpenFBT on GitHub.
Made in tandum with discord chat partser written in python and then Go for user moderation.

Mojo Kitchen Chaos - An overcooked-like game made in Unity following an online course

  • Made over the course of a week following a course by Code Monkey.
GitHub Repo
Itch.io page

RedisFS - A pointless file storage solution written in Rust

  • Sores files up to 500mb in a Redis database.
GitHub Repo

Video FPS overlay

  • Origionally made to take FPS data from a csv file generated with Nvidia FrameView and display it in a Digital Foundry like graph.
  • Never reached a fully functioning state but it was a fun old project.
  • Written in Python
GitHub Repo

This website!

GitHub Repo
+
+
+

© 2025 Owen Quinlan (BuyMyMojo) :)

+
+ \ No newline at end of file diff --git a/node_modules/.bin/mpd-to-m3u8-json b/node_modules/.bin/mpd-to-m3u8-json deleted file mode 100644 index 2dbcfcc..0000000 --- a/node_modules/.bin/mpd-to-m3u8-json +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../mpd-parser/bin/parse.js" "$@" - ret=$? -else - node "$basedir/../mpd-parser/bin/parse.js" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/mpd-to-m3u8-json.cmd b/node_modules/.bin/mpd-to-m3u8-json.cmd deleted file mode 100644 index 0a61d64..0000000 --- a/node_modules/.bin/mpd-to-m3u8-json.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -"%_prog%" "%dp0%\..\mpd-parser\bin\parse.js" %* -ENDLOCAL -EXIT /b %errorlevel% -:find_dp0 -SET dp0=%~dp0 -EXIT /b diff --git a/node_modules/.bin/mpd-to-m3u8-json.ps1 b/node_modules/.bin/mpd-to-m3u8-json.ps1 deleted file mode 100644 index d3522c5..0000000 --- a/node_modules/.bin/mpd-to-m3u8-json.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - & "$basedir/node$exe" "$basedir/../mpd-parser/bin/parse.js" $args - $ret=$LASTEXITCODE -} else { - & "node$exe" "$basedir/../mpd-parser/bin/parse.js" $args - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/muxjs-transmux b/node_modules/.bin/muxjs-transmux deleted file mode 100644 index 521c12a..0000000 --- a/node_modules/.bin/muxjs-transmux +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../mux.js/bin/transmux.js" "$@" - ret=$? -else - node "$basedir/../mux.js/bin/transmux.js" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/muxjs-transmux.cmd b/node_modules/.bin/muxjs-transmux.cmd deleted file mode 100644 index e473a86..0000000 --- a/node_modules/.bin/muxjs-transmux.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -"%_prog%" "%dp0%\..\mux.js\bin\transmux.js" %* -ENDLOCAL -EXIT /b %errorlevel% -:find_dp0 -SET dp0=%~dp0 -EXIT /b diff --git a/node_modules/.bin/muxjs-transmux.ps1 b/node_modules/.bin/muxjs-transmux.ps1 deleted file mode 100644 index fd19b84..0000000 --- a/node_modules/.bin/muxjs-transmux.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - & "$basedir/node$exe" "$basedir/../mux.js/bin/transmux.js" $args - $ret=$LASTEXITCODE -} else { - & "node$exe" "$basedir/../mux.js/bin/transmux.js" $args - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/pkcs7 b/node_modules/.bin/pkcs7 deleted file mode 100644 index 3db3ebe..0000000 --- a/node_modules/.bin/pkcs7 +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../pkcs7/bin/cli.js" "$@" - ret=$? -else - node "$basedir/../pkcs7/bin/cli.js" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/pkcs7.cmd b/node_modules/.bin/pkcs7.cmd deleted file mode 100644 index f81b501..0000000 --- a/node_modules/.bin/pkcs7.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -"%_prog%" "%dp0%\..\pkcs7\bin\cli.js" %* -ENDLOCAL -EXIT /b %errorlevel% -:find_dp0 -SET dp0=%~dp0 -EXIT /b diff --git a/node_modules/.bin/pkcs7.ps1 b/node_modules/.bin/pkcs7.ps1 deleted file mode 100644 index 4fb8a14..0000000 --- a/node_modules/.bin/pkcs7.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - & "$basedir/node$exe" "$basedir/../pkcs7/bin/cli.js" $args - $ret=$LASTEXITCODE -} else { - & "node$exe" "$basedir/../pkcs7/bin/cli.js" $args - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/@babel/runtime/LICENSE b/node_modules/@babel/runtime/LICENSE deleted file mode 100644 index f31575e..0000000 --- a/node_modules/@babel/runtime/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS 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. diff --git a/node_modules/@babel/runtime/README.md b/node_modules/@babel/runtime/README.md deleted file mode 100644 index 119c99d..0000000 --- a/node_modules/@babel/runtime/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/runtime - -> babel's modular runtime helpers - -See our website [@babel/runtime](https://babeljs.io/docs/en/babel-runtime) for more information. - -## Install - -Using npm: - -```sh -npm install --save @babel/runtime -``` - -or using yarn: - -```sh -yarn add @babel/runtime -``` diff --git a/node_modules/@babel/runtime/helpers/AsyncGenerator.js b/node_modules/@babel/runtime/helpers/AsyncGenerator.js deleted file mode 100644 index cdca7f5..0000000 --- a/node_modules/@babel/runtime/helpers/AsyncGenerator.js +++ /dev/null @@ -1,99 +0,0 @@ -var AwaitValue = require("./AwaitValue.js"); - -function AsyncGenerator(gen) { - var front, back; - - function send(key, arg) { - return new Promise(function (resolve, reject) { - var request = { - key: key, - arg: arg, - resolve: resolve, - reject: reject, - next: null - }; - - if (back) { - back = back.next = request; - } else { - front = back = request; - resume(key, arg); - } - }); - } - - function resume(key, arg) { - try { - var result = gen[key](arg); - var value = result.value; - var wrappedAwait = value instanceof AwaitValue; - Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { - if (wrappedAwait) { - resume(key === "return" ? "return" : "next", arg); - return; - } - - settle(result.done ? "return" : "normal", arg); - }, function (err) { - resume("throw", err); - }); - } catch (err) { - settle("throw", err); - } - } - - function settle(type, value) { - switch (type) { - case "return": - front.resolve({ - value: value, - done: true - }); - break; - - case "throw": - front.reject(value); - break; - - default: - front.resolve({ - value: value, - done: false - }); - break; - } - - front = front.next; - - if (front) { - resume(front.key, front.arg); - } else { - back = null; - } - } - - this._invoke = send; - - if (typeof gen["return"] !== "function") { - this["return"] = undefined; - } -} - -AsyncGenerator.prototype[typeof Symbol === "function" && Symbol.asyncIterator || "@@asyncIterator"] = function () { - return this; -}; - -AsyncGenerator.prototype.next = function (arg) { - return this._invoke("next", arg); -}; - -AsyncGenerator.prototype["throw"] = function (arg) { - return this._invoke("throw", arg); -}; - -AsyncGenerator.prototype["return"] = function (arg) { - return this._invoke("return", arg); -}; - -module.exports = AsyncGenerator; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/AwaitValue.js b/node_modules/@babel/runtime/helpers/AwaitValue.js deleted file mode 100644 index d36df6e..0000000 --- a/node_modules/@babel/runtime/helpers/AwaitValue.js +++ /dev/null @@ -1,6 +0,0 @@ -function _AwaitValue(value) { - this.wrapped = value; -} - -module.exports = _AwaitValue; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js b/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js deleted file mode 100644 index feaeab8..0000000 --- a/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +++ /dev/null @@ -1,31 +0,0 @@ -function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { - var desc = {}; - Object.keys(descriptor).forEach(function (key) { - desc[key] = descriptor[key]; - }); - desc.enumerable = !!desc.enumerable; - desc.configurable = !!desc.configurable; - - if ('value' in desc || desc.initializer) { - desc.writable = true; - } - - desc = decorators.slice().reverse().reduce(function (desc, decorator) { - return decorator(target, property, desc) || desc; - }, desc); - - if (context && desc.initializer !== void 0) { - desc.value = desc.initializer ? desc.initializer.call(context) : void 0; - desc.initializer = undefined; - } - - if (desc.initializer === void 0) { - Object.defineProperty(target, property, desc); - desc = null; - } - - return desc; -} - -module.exports = _applyDecoratedDescriptor; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/arrayLikeToArray.js b/node_modules/@babel/runtime/helpers/arrayLikeToArray.js deleted file mode 100644 index a459c8e..0000000 --- a/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +++ /dev/null @@ -1,12 +0,0 @@ -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - - for (var i = 0, arr2 = new Array(len); i < len; i++) { - arr2[i] = arr[i]; - } - - return arr2; -} - -module.exports = _arrayLikeToArray; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/arrayWithHoles.js b/node_modules/@babel/runtime/helpers/arrayWithHoles.js deleted file mode 100644 index 9a36e2a..0000000 --- a/node_modules/@babel/runtime/helpers/arrayWithHoles.js +++ /dev/null @@ -1,6 +0,0 @@ -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} - -module.exports = _arrayWithHoles; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js b/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js deleted file mode 100644 index aac913f..0000000 --- a/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +++ /dev/null @@ -1,8 +0,0 @@ -var arrayLikeToArray = require("./arrayLikeToArray.js"); - -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return arrayLikeToArray(arr); -} - -module.exports = _arrayWithoutHoles; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/assertThisInitialized.js b/node_modules/@babel/runtime/helpers/assertThisInitialized.js deleted file mode 100644 index 352e1e6..0000000 --- a/node_modules/@babel/runtime/helpers/assertThisInitialized.js +++ /dev/null @@ -1,10 +0,0 @@ -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; -} - -module.exports = _assertThisInitialized; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js b/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js deleted file mode 100644 index 91f6d61..0000000 --- a/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +++ /dev/null @@ -1,57 +0,0 @@ -function _asyncGeneratorDelegate(inner, awaitWrap) { - var iter = {}, - waiting = false; - - function pump(key, value) { - waiting = true; - value = new Promise(function (resolve) { - resolve(inner[key](value)); - }); - return { - done: false, - value: awaitWrap(value) - }; - } - - ; - - iter[typeof Symbol !== "undefined" && Symbol.iterator || "@@iterator"] = function () { - return this; - }; - - iter.next = function (value) { - if (waiting) { - waiting = false; - return value; - } - - return pump("next", value); - }; - - if (typeof inner["throw"] === "function") { - iter["throw"] = function (value) { - if (waiting) { - waiting = false; - throw value; - } - - return pump("throw", value); - }; - } - - if (typeof inner["return"] === "function") { - iter["return"] = function (value) { - if (waiting) { - waiting = false; - return value; - } - - return pump("return", value); - }; - } - - return iter; -} - -module.exports = _asyncGeneratorDelegate; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/asyncIterator.js b/node_modules/@babel/runtime/helpers/asyncIterator.js deleted file mode 100644 index d59aa99..0000000 --- a/node_modules/@babel/runtime/helpers/asyncIterator.js +++ /dev/null @@ -1,16 +0,0 @@ -function _asyncIterator(iterable) { - var method; - - if (typeof Symbol !== "undefined") { - if (Symbol.asyncIterator) method = iterable[Symbol.asyncIterator]; - if (method == null && Symbol.iterator) method = iterable[Symbol.iterator]; - } - - if (method == null) method = iterable["@@asyncIterator"]; - if (method == null) method = iterable["@@iterator"]; - if (method == null) throw new TypeError("Object is not async iterable"); - return method.call(iterable); -} - -module.exports = _asyncIterator; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/asyncToGenerator.js b/node_modules/@babel/runtime/helpers/asyncToGenerator.js deleted file mode 100644 index ec5daa8..0000000 --- a/node_modules/@babel/runtime/helpers/asyncToGenerator.js +++ /dev/null @@ -1,38 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } -} - -function _asyncToGenerator(fn) { - return function () { - var self = this, - args = arguments; - return new Promise(function (resolve, reject) { - var gen = fn.apply(self, args); - - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - - _next(undefined); - }); - }; -} - -module.exports = _asyncToGenerator; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js b/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js deleted file mode 100644 index c338fee..0000000 --- a/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +++ /dev/null @@ -1,8 +0,0 @@ -var AwaitValue = require("./AwaitValue.js"); - -function _awaitAsyncGenerator(value) { - return new AwaitValue(value); -} - -module.exports = _awaitAsyncGenerator; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js b/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js deleted file mode 100644 index 521c1e0..0000000 --- a/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +++ /dev/null @@ -1,23 +0,0 @@ -function _classApplyDescriptorDestructureSet(receiver, descriptor) { - if (descriptor.set) { - if (!("__destrObj" in descriptor)) { - descriptor.__destrObj = { - set value(v) { - descriptor.set.call(receiver, v); - } - - }; - } - - return descriptor.__destrObj; - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - - return descriptor; - } -} - -module.exports = _classApplyDescriptorDestructureSet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js b/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js deleted file mode 100644 index f750596..0000000 --- a/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +++ /dev/null @@ -1,10 +0,0 @@ -function _classApplyDescriptorGet(receiver, descriptor) { - if (descriptor.get) { - return descriptor.get.call(receiver); - } - - return descriptor.value; -} - -module.exports = _classApplyDescriptorGet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js b/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js deleted file mode 100644 index 997b264..0000000 --- a/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +++ /dev/null @@ -1,14 +0,0 @@ -function _classApplyDescriptorSet(receiver, descriptor, value) { - if (descriptor.set) { - descriptor.set.call(receiver, value); - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - - descriptor.value = value; - } -} - -module.exports = _classApplyDescriptorSet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classCallCheck.js b/node_modules/@babel/runtime/helpers/classCallCheck.js deleted file mode 100644 index 026da41..0000000 --- a/node_modules/@babel/runtime/helpers/classCallCheck.js +++ /dev/null @@ -1,8 +0,0 @@ -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} - -module.exports = _classCallCheck; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js b/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js deleted file mode 100644 index 67373aa..0000000 --- a/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +++ /dev/null @@ -1,8 +0,0 @@ -function _classCheckPrivateStaticAccess(receiver, classConstructor) { - if (receiver !== classConstructor) { - throw new TypeError("Private static access of wrong provenance"); - } -} - -module.exports = _classCheckPrivateStaticAccess; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js b/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js deleted file mode 100644 index 3b93472..0000000 --- a/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +++ /dev/null @@ -1,8 +0,0 @@ -function _classCheckPrivateStaticFieldDescriptor(descriptor, action) { - if (descriptor === undefined) { - throw new TypeError("attempted to " + action + " private static field before its declaration"); - } -} - -module.exports = _classCheckPrivateStaticFieldDescriptor; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js b/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js deleted file mode 100644 index aaaac8c..0000000 --- a/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +++ /dev/null @@ -1,10 +0,0 @@ -function _classExtractFieldDescriptor(receiver, privateMap, action) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to " + action + " private field on non-instance"); - } - - return privateMap.get(receiver); -} - -module.exports = _classExtractFieldDescriptor; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classNameTDZError.js b/node_modules/@babel/runtime/helpers/classNameTDZError.js deleted file mode 100644 index bf740fa..0000000 --- a/node_modules/@babel/runtime/helpers/classNameTDZError.js +++ /dev/null @@ -1,6 +0,0 @@ -function _classNameTDZError(name) { - throw new Error("Class \"" + name + "\" cannot be referenced in computed property keys."); -} - -module.exports = _classNameTDZError; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js b/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js deleted file mode 100644 index 50b9fb0..0000000 --- a/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +++ /dev/null @@ -1,11 +0,0 @@ -var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js"); - -var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js"); - -function _classPrivateFieldDestructureSet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} - -module.exports = _classPrivateFieldDestructureSet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js b/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js deleted file mode 100644 index df55969..0000000 --- a/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +++ /dev/null @@ -1,11 +0,0 @@ -var classApplyDescriptorGet = require("./classApplyDescriptorGet.js"); - -var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js"); - -function _classPrivateFieldGet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} - -module.exports = _classPrivateFieldGet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js b/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js deleted file mode 100644 index 3acdb7b..0000000 --- a/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +++ /dev/null @@ -1,10 +0,0 @@ -function _classPrivateFieldBase(receiver, privateKey) { - if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { - throw new TypeError("attempted to use private field on non-instance"); - } - - return receiver; -} - -module.exports = _classPrivateFieldBase; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js b/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js deleted file mode 100644 index 3c0c552..0000000 --- a/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +++ /dev/null @@ -1,8 +0,0 @@ -var id = 0; - -function _classPrivateFieldKey(name) { - return "__private_" + id++ + "_" + name; -} - -module.exports = _classPrivateFieldKey; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js b/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js deleted file mode 100644 index d4a59b0..0000000 --- a/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +++ /dev/null @@ -1,12 +0,0 @@ -var classApplyDescriptorSet = require("./classApplyDescriptorSet.js"); - -var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js"); - -function _classPrivateFieldSet(receiver, privateMap, value) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} - -module.exports = _classPrivateFieldSet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js b/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js deleted file mode 100644 index d2f8ab1..0000000 --- a/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +++ /dev/null @@ -1,10 +0,0 @@ -function _classPrivateMethodGet(receiver, privateSet, fn) { - if (!privateSet.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - - return fn; -} - -module.exports = _classPrivateMethodGet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js b/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js deleted file mode 100644 index f500d16..0000000 --- a/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +++ /dev/null @@ -1,6 +0,0 @@ -function _classPrivateMethodSet() { - throw new TypeError("attempted to reassign private method"); -} - -module.exports = _classPrivateMethodSet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js b/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js deleted file mode 100644 index 57e2c7f..0000000 --- a/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +++ /dev/null @@ -1,14 +0,0 @@ -var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js"); - -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); - -var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); - -function _classStaticPrivateFieldDestructureSet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} - -module.exports = _classStaticPrivateFieldDestructureSet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js b/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js deleted file mode 100644 index 136c1f6..0000000 --- a/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +++ /dev/null @@ -1,14 +0,0 @@ -var classApplyDescriptorGet = require("./classApplyDescriptorGet.js"); - -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); - -var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); - -function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} - -module.exports = _classStaticPrivateFieldSpecGet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js b/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js deleted file mode 100644 index e6ecfa4..0000000 --- a/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +++ /dev/null @@ -1,15 +0,0 @@ -var classApplyDescriptorSet = require("./classApplyDescriptorSet.js"); - -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); - -var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); - -function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} - -module.exports = _classStaticPrivateFieldSpecSet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js b/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js deleted file mode 100644 index 5bc41fc..0000000 --- a/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +++ /dev/null @@ -1,9 +0,0 @@ -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); - -function _classStaticPrivateMethodGet(receiver, classConstructor, method) { - classCheckPrivateStaticAccess(receiver, classConstructor); - return method; -} - -module.exports = _classStaticPrivateMethodGet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js b/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js deleted file mode 100644 index 06cfcc1..0000000 --- a/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +++ /dev/null @@ -1,6 +0,0 @@ -function _classStaticPrivateMethodSet() { - throw new TypeError("attempted to set read only static private field"); -} - -module.exports = _classStaticPrivateMethodSet; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/construct.js b/node_modules/@babel/runtime/helpers/construct.js deleted file mode 100644 index 108b39a..0000000 --- a/node_modules/@babel/runtime/helpers/construct.js +++ /dev/null @@ -1,26 +0,0 @@ -var setPrototypeOf = require("./setPrototypeOf.js"); - -var isNativeReflectConstruct = require("./isNativeReflectConstruct.js"); - -function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - module.exports = _construct = Reflect.construct; - module.exports["default"] = module.exports, module.exports.__esModule = true; - } else { - module.exports = _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) setPrototypeOf(instance, Class.prototype); - return instance; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - } - - return _construct.apply(null, arguments); -} - -module.exports = _construct; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/createClass.js b/node_modules/@babel/runtime/helpers/createClass.js deleted file mode 100644 index 293bd61..0000000 --- a/node_modules/@babel/runtime/helpers/createClass.js +++ /dev/null @@ -1,18 +0,0 @@ -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -module.exports = _createClass; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js b/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js deleted file mode 100644 index 9098865..0000000 --- a/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +++ /dev/null @@ -1,61 +0,0 @@ -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); - -function _createForOfIteratorHelper(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - - if (!it) { - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - - var F = function F() {}; - - return { - s: F, - n: function n() { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }, - e: function e(_e) { - throw _e; - }, - f: F - }; - } - - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - - var normalCompletion = true, - didErr = false, - err; - return { - s: function s() { - it = it.call(o); - }, - n: function n() { - var step = it.next(); - normalCompletion = step.done; - return step; - }, - e: function e(_e2) { - didErr = true; - err = _e2; - }, - f: function f() { - try { - if (!normalCompletion && it["return"] != null) it["return"](); - } finally { - if (didErr) throw err; - } - } - }; -} - -module.exports = _createForOfIteratorHelper; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js b/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js deleted file mode 100644 index 2dedbc9..0000000 --- a/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +++ /dev/null @@ -1,25 +0,0 @@ -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); - -function _createForOfIteratorHelperLoose(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (it) return (it = it.call(o)).next.bind(it); - - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - return function () { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }; - } - - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} - -module.exports = _createForOfIteratorHelperLoose; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/createSuper.js b/node_modules/@babel/runtime/helpers/createSuper.js deleted file mode 100644 index 0acdd51..0000000 --- a/node_modules/@babel/runtime/helpers/createSuper.js +++ /dev/null @@ -1,25 +0,0 @@ -var getPrototypeOf = require("./getPrototypeOf.js"); - -var isNativeReflectConstruct = require("./isNativeReflectConstruct.js"); - -var possibleConstructorReturn = require("./possibleConstructorReturn.js"); - -function _createSuper(Derived) { - var hasNativeReflectConstruct = isNativeReflectConstruct(); - return function _createSuperInternal() { - var Super = getPrototypeOf(Derived), - result; - - if (hasNativeReflectConstruct) { - var NewTarget = getPrototypeOf(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - - return possibleConstructorReturn(this, result); - }; -} - -module.exports = _createSuper; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/decorate.js b/node_modules/@babel/runtime/helpers/decorate.js deleted file mode 100644 index 80d1751..0000000 --- a/node_modules/@babel/runtime/helpers/decorate.js +++ /dev/null @@ -1,401 +0,0 @@ -var toArray = require("./toArray.js"); - -var toPropertyKey = require("./toPropertyKey.js"); - -function _decorate(decorators, factory, superClass, mixins) { - var api = _getDecoratorsApi(); - - if (mixins) { - for (var i = 0; i < mixins.length; i++) { - api = mixins[i](api); - } - } - - var r = factory(function initialize(O) { - api.initializeInstanceElements(O, decorated.elements); - }, superClass); - var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); - api.initializeClassElements(r.F, decorated.elements); - return api.runClassFinishers(r.F, decorated.finishers); -} - -function _getDecoratorsApi() { - _getDecoratorsApi = function _getDecoratorsApi() { - return api; - }; - - var api = { - elementsDefinitionOrder: [["method"], ["field"]], - initializeInstanceElements: function initializeInstanceElements(O, elements) { - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - if (element.kind === kind && element.placement === "own") { - this.defineClassElement(O, element); - } - }, this); - }, this); - }, - initializeClassElements: function initializeClassElements(F, elements) { - var proto = F.prototype; - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - var placement = element.placement; - - if (element.kind === kind && (placement === "static" || placement === "prototype")) { - var receiver = placement === "static" ? F : proto; - this.defineClassElement(receiver, element); - } - }, this); - }, this); - }, - defineClassElement: function defineClassElement(receiver, element) { - var descriptor = element.descriptor; - - if (element.kind === "field") { - var initializer = element.initializer; - descriptor = { - enumerable: descriptor.enumerable, - writable: descriptor.writable, - configurable: descriptor.configurable, - value: initializer === void 0 ? void 0 : initializer.call(receiver) - }; - } - - Object.defineProperty(receiver, element.key, descriptor); - }, - decorateClass: function decorateClass(elements, decorators) { - var newElements = []; - var finishers = []; - var placements = { - "static": [], - prototype: [], - own: [] - }; - elements.forEach(function (element) { - this.addElementPlacement(element, placements); - }, this); - elements.forEach(function (element) { - if (!_hasDecorators(element)) return newElements.push(element); - var elementFinishersExtras = this.decorateElement(element, placements); - newElements.push(elementFinishersExtras.element); - newElements.push.apply(newElements, elementFinishersExtras.extras); - finishers.push.apply(finishers, elementFinishersExtras.finishers); - }, this); - - if (!decorators) { - return { - elements: newElements, - finishers: finishers - }; - } - - var result = this.decorateConstructor(newElements, decorators); - finishers.push.apply(finishers, result.finishers); - result.finishers = finishers; - return result; - }, - addElementPlacement: function addElementPlacement(element, placements, silent) { - var keys = placements[element.placement]; - - if (!silent && keys.indexOf(element.key) !== -1) { - throw new TypeError("Duplicated element (" + element.key + ")"); - } - - keys.push(element.key); - }, - decorateElement: function decorateElement(element, placements) { - var extras = []; - var finishers = []; - - for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { - var keys = placements[element.placement]; - keys.splice(keys.indexOf(element.key), 1); - var elementObject = this.fromElementDescriptor(element); - var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); - element = elementFinisherExtras.element; - this.addElementPlacement(element, placements); - - if (elementFinisherExtras.finisher) { - finishers.push(elementFinisherExtras.finisher); - } - - var newExtras = elementFinisherExtras.extras; - - if (newExtras) { - for (var j = 0; j < newExtras.length; j++) { - this.addElementPlacement(newExtras[j], placements); - } - - extras.push.apply(extras, newExtras); - } - } - - return { - element: element, - finishers: finishers, - extras: extras - }; - }, - decorateConstructor: function decorateConstructor(elements, decorators) { - var finishers = []; - - for (var i = decorators.length - 1; i >= 0; i--) { - var obj = this.fromClassDescriptor(elements); - var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj); - - if (elementsAndFinisher.finisher !== undefined) { - finishers.push(elementsAndFinisher.finisher); - } - - if (elementsAndFinisher.elements !== undefined) { - elements = elementsAndFinisher.elements; - - for (var j = 0; j < elements.length - 1; j++) { - for (var k = j + 1; k < elements.length; k++) { - if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { - throw new TypeError("Duplicated element (" + elements[j].key + ")"); - } - } - } - } - } - - return { - elements: elements, - finishers: finishers - }; - }, - fromElementDescriptor: function fromElementDescriptor(element) { - var obj = { - kind: element.kind, - key: element.key, - placement: element.placement, - descriptor: element.descriptor - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - if (element.kind === "field") obj.initializer = element.initializer; - return obj; - }, - toElementDescriptors: function toElementDescriptors(elementObjects) { - if (elementObjects === undefined) return; - return toArray(elementObjects).map(function (elementObject) { - var element = this.toElementDescriptor(elementObject); - this.disallowProperty(elementObject, "finisher", "An element descriptor"); - this.disallowProperty(elementObject, "extras", "An element descriptor"); - return element; - }, this); - }, - toElementDescriptor: function toElementDescriptor(elementObject) { - var kind = String(elementObject.kind); - - if (kind !== "method" && kind !== "field") { - throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); - } - - var key = toPropertyKey(elementObject.key); - var placement = String(elementObject.placement); - - if (placement !== "static" && placement !== "prototype" && placement !== "own") { - throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); - } - - var descriptor = elementObject.descriptor; - this.disallowProperty(elementObject, "elements", "An element descriptor"); - var element = { - kind: kind, - key: key, - placement: placement, - descriptor: Object.assign({}, descriptor) - }; - - if (kind !== "field") { - this.disallowProperty(elementObject, "initializer", "A method descriptor"); - } else { - this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); - element.initializer = elementObject.initializer; - } - - return element; - }, - toElementFinisherExtras: function toElementFinisherExtras(elementObject) { - var element = this.toElementDescriptor(elementObject); - - var finisher = _optionalCallableProperty(elementObject, "finisher"); - - var extras = this.toElementDescriptors(elementObject.extras); - return { - element: element, - finisher: finisher, - extras: extras - }; - }, - fromClassDescriptor: function fromClassDescriptor(elements) { - var obj = { - kind: "class", - elements: elements.map(this.fromElementDescriptor, this) - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - return obj; - }, - toClassDescriptor: function toClassDescriptor(obj) { - var kind = String(obj.kind); - - if (kind !== "class") { - throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); - } - - this.disallowProperty(obj, "key", "A class descriptor"); - this.disallowProperty(obj, "placement", "A class descriptor"); - this.disallowProperty(obj, "descriptor", "A class descriptor"); - this.disallowProperty(obj, "initializer", "A class descriptor"); - this.disallowProperty(obj, "extras", "A class descriptor"); - - var finisher = _optionalCallableProperty(obj, "finisher"); - - var elements = this.toElementDescriptors(obj.elements); - return { - elements: elements, - finisher: finisher - }; - }, - runClassFinishers: function runClassFinishers(constructor, finishers) { - for (var i = 0; i < finishers.length; i++) { - var newConstructor = (0, finishers[i])(constructor); - - if (newConstructor !== undefined) { - if (typeof newConstructor !== "function") { - throw new TypeError("Finishers must return a constructor."); - } - - constructor = newConstructor; - } - } - - return constructor; - }, - disallowProperty: function disallowProperty(obj, name, objectType) { - if (obj[name] !== undefined) { - throw new TypeError(objectType + " can't have a ." + name + " property."); - } - } - }; - return api; -} - -function _createElementDescriptor(def) { - var key = toPropertyKey(def.key); - var descriptor; - - if (def.kind === "method") { - descriptor = { - value: def.value, - writable: true, - configurable: true, - enumerable: false - }; - } else if (def.kind === "get") { - descriptor = { - get: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "set") { - descriptor = { - set: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "field") { - descriptor = { - configurable: true, - writable: true, - enumerable: true - }; - } - - var element = { - kind: def.kind === "field" ? "field" : "method", - key: key, - placement: def["static"] ? "static" : def.kind === "field" ? "own" : "prototype", - descriptor: descriptor - }; - if (def.decorators) element.decorators = def.decorators; - if (def.kind === "field") element.initializer = def.value; - return element; -} - -function _coalesceGetterSetter(element, other) { - if (element.descriptor.get !== undefined) { - other.descriptor.get = element.descriptor.get; - } else { - other.descriptor.set = element.descriptor.set; - } -} - -function _coalesceClassElements(elements) { - var newElements = []; - - var isSameElement = function isSameElement(other) { - return other.kind === "method" && other.key === element.key && other.placement === element.placement; - }; - - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - var other; - - if (element.kind === "method" && (other = newElements.find(isSameElement))) { - if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { - if (_hasDecorators(element) || _hasDecorators(other)) { - throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); - } - - other.descriptor = element.descriptor; - } else { - if (_hasDecorators(element)) { - if (_hasDecorators(other)) { - throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); - } - - other.decorators = element.decorators; - } - - _coalesceGetterSetter(element, other); - } - } else { - newElements.push(element); - } - } - - return newElements; -} - -function _hasDecorators(element) { - return element.decorators && element.decorators.length; -} - -function _isDataDescriptor(desc) { - return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); -} - -function _optionalCallableProperty(obj, name) { - var value = obj[name]; - - if (value !== undefined && typeof value !== "function") { - throw new TypeError("Expected '" + name + "' to be a function"); - } - - return value; -} - -module.exports = _decorate; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/defaults.js b/node_modules/@babel/runtime/helpers/defaults.js deleted file mode 100644 index 576c5a4..0000000 --- a/node_modules/@babel/runtime/helpers/defaults.js +++ /dev/null @@ -1,17 +0,0 @@ -function _defaults(obj, defaults) { - var keys = Object.getOwnPropertyNames(defaults); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = Object.getOwnPropertyDescriptor(defaults, key); - - if (value && value.configurable && obj[key] === undefined) { - Object.defineProperty(obj, key, value); - } - } - - return obj; -} - -module.exports = _defaults; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js b/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js deleted file mode 100644 index 4fe90c3..0000000 --- a/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +++ /dev/null @@ -1,25 +0,0 @@ -function _defineEnumerableProperties(obj, descs) { - for (var key in descs) { - var desc = descs[key]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, key, desc); - } - - if (Object.getOwnPropertySymbols) { - var objectSymbols = Object.getOwnPropertySymbols(descs); - - for (var i = 0; i < objectSymbols.length; i++) { - var sym = objectSymbols[i]; - var desc = descs[sym]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, sym, desc); - } - } - - return obj; -} - -module.exports = _defineEnumerableProperties; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/defineProperty.js b/node_modules/@babel/runtime/helpers/defineProperty.js deleted file mode 100644 index 1cd65ac..0000000 --- a/node_modules/@babel/runtime/helpers/defineProperty.js +++ /dev/null @@ -1,17 +0,0 @@ -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} - -module.exports = _defineProperty; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js b/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js deleted file mode 100644 index 919aab8..0000000 --- a/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js +++ /dev/null @@ -1,95 +0,0 @@ -import AwaitValue from "./AwaitValue.js"; -export default function AsyncGenerator(gen) { - var front, back; - - function send(key, arg) { - return new Promise(function (resolve, reject) { - var request = { - key: key, - arg: arg, - resolve: resolve, - reject: reject, - next: null - }; - - if (back) { - back = back.next = request; - } else { - front = back = request; - resume(key, arg); - } - }); - } - - function resume(key, arg) { - try { - var result = gen[key](arg); - var value = result.value; - var wrappedAwait = value instanceof AwaitValue; - Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { - if (wrappedAwait) { - resume(key === "return" ? "return" : "next", arg); - return; - } - - settle(result.done ? "return" : "normal", arg); - }, function (err) { - resume("throw", err); - }); - } catch (err) { - settle("throw", err); - } - } - - function settle(type, value) { - switch (type) { - case "return": - front.resolve({ - value: value, - done: true - }); - break; - - case "throw": - front.reject(value); - break; - - default: - front.resolve({ - value: value, - done: false - }); - break; - } - - front = front.next; - - if (front) { - resume(front.key, front.arg); - } else { - back = null; - } - } - - this._invoke = send; - - if (typeof gen["return"] !== "function") { - this["return"] = undefined; - } -} - -AsyncGenerator.prototype[typeof Symbol === "function" && Symbol.asyncIterator || "@@asyncIterator"] = function () { - return this; -}; - -AsyncGenerator.prototype.next = function (arg) { - return this._invoke("next", arg); -}; - -AsyncGenerator.prototype["throw"] = function (arg) { - return this._invoke("throw", arg); -}; - -AsyncGenerator.prototype["return"] = function (arg) { - return this._invoke("return", arg); -}; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/AwaitValue.js b/node_modules/@babel/runtime/helpers/esm/AwaitValue.js deleted file mode 100644 index 5237e18..0000000 --- a/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _AwaitValue(value) { - this.wrapped = value; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js b/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js deleted file mode 100644 index 84b5961..0000000 --- a/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +++ /dev/null @@ -1,28 +0,0 @@ -export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { - var desc = {}; - Object.keys(descriptor).forEach(function (key) { - desc[key] = descriptor[key]; - }); - desc.enumerable = !!desc.enumerable; - desc.configurable = !!desc.configurable; - - if ('value' in desc || desc.initializer) { - desc.writable = true; - } - - desc = decorators.slice().reverse().reduce(function (desc, decorator) { - return decorator(target, property, desc) || desc; - }, desc); - - if (context && desc.initializer !== void 0) { - desc.value = desc.initializer ? desc.initializer.call(context) : void 0; - desc.initializer = undefined; - } - - if (desc.initializer === void 0) { - Object.defineProperty(target, property, desc); - desc = null; - } - - return desc; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js b/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js deleted file mode 100644 index edbeb8e..0000000 --- a/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - - for (var i = 0, arr2 = new Array(len); i < len; i++) { - arr2[i] = arr[i]; - } - - return arr2; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js b/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js deleted file mode 100644 index be734fc..0000000 --- a/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js b/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js deleted file mode 100644 index f7d8dc7..0000000 --- a/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +++ /dev/null @@ -1,4 +0,0 @@ -import arrayLikeToArray from "./arrayLikeToArray.js"; -export default function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return arrayLikeToArray(arr); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js b/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js deleted file mode 100644 index bbf849c..0000000 --- a/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js b/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js deleted file mode 100644 index a7ccd67..0000000 --- a/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +++ /dev/null @@ -1,54 +0,0 @@ -export default function _asyncGeneratorDelegate(inner, awaitWrap) { - var iter = {}, - waiting = false; - - function pump(key, value) { - waiting = true; - value = new Promise(function (resolve) { - resolve(inner[key](value)); - }); - return { - done: false, - value: awaitWrap(value) - }; - } - - ; - - iter[typeof Symbol !== "undefined" && Symbol.iterator || "@@iterator"] = function () { - return this; - }; - - iter.next = function (value) { - if (waiting) { - waiting = false; - return value; - } - - return pump("next", value); - }; - - if (typeof inner["throw"] === "function") { - iter["throw"] = function (value) { - if (waiting) { - waiting = false; - throw value; - } - - return pump("throw", value); - }; - } - - if (typeof inner["return"] === "function") { - iter["return"] = function (value) { - if (waiting) { - waiting = false; - return value; - } - - return pump("return", value); - }; - } - - return iter; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/asyncIterator.js b/node_modules/@babel/runtime/helpers/esm/asyncIterator.js deleted file mode 100644 index 91ddb42..0000000 --- a/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +++ /dev/null @@ -1,13 +0,0 @@ -export default function _asyncIterator(iterable) { - var method; - - if (typeof Symbol !== "undefined") { - if (Symbol.asyncIterator) method = iterable[Symbol.asyncIterator]; - if (method == null && Symbol.iterator) method = iterable[Symbol.iterator]; - } - - if (method == null) method = iterable["@@asyncIterator"]; - if (method == null) method = iterable["@@iterator"]; - if (method == null) throw new TypeError("Object is not async iterable"); - return method.call(iterable); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js b/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js deleted file mode 100644 index 2a25f54..0000000 --- a/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +++ /dev/null @@ -1,35 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } -} - -export default function _asyncToGenerator(fn) { - return function () { - var self = this, - args = arguments; - return new Promise(function (resolve, reject) { - var gen = fn.apply(self, args); - - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - - _next(undefined); - }); - }; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js b/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js deleted file mode 100644 index ccca65e..0000000 --- a/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +++ /dev/null @@ -1,4 +0,0 @@ -import AwaitValue from "./AwaitValue.js"; -export default function _awaitAsyncGenerator(value) { - return new AwaitValue(value); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js b/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js deleted file mode 100644 index 4472adc..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +++ /dev/null @@ -1,20 +0,0 @@ -export default function _classApplyDescriptorDestructureSet(receiver, descriptor) { - if (descriptor.set) { - if (!("__destrObj" in descriptor)) { - descriptor.__destrObj = { - set value(v) { - descriptor.set.call(receiver, v); - } - - }; - } - - return descriptor.__destrObj; - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - - return descriptor; - } -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js b/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js deleted file mode 100644 index 0fad169..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _classApplyDescriptorGet(receiver, descriptor) { - if (descriptor.get) { - return descriptor.get.call(receiver); - } - - return descriptor.value; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js b/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js deleted file mode 100644 index f295f3e..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +++ /dev/null @@ -1,11 +0,0 @@ -export default function _classApplyDescriptorSet(receiver, descriptor, value) { - if (descriptor.set) { - descriptor.set.call(receiver, value); - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - - descriptor.value = value; - } -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classCallCheck.js b/node_modules/@babel/runtime/helpers/esm/classCallCheck.js deleted file mode 100644 index 2f1738a..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js b/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js deleted file mode 100644 index 098ed30..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _classCheckPrivateStaticAccess(receiver, classConstructor) { - if (receiver !== classConstructor) { - throw new TypeError("Private static access of wrong provenance"); - } -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js b/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js deleted file mode 100644 index 0ef34b8..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _classCheckPrivateStaticFieldDescriptor(descriptor, action) { - if (descriptor === undefined) { - throw new TypeError("attempted to " + action + " private static field before its declaration"); - } -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js b/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js deleted file mode 100644 index 8dabe9a..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _classExtractFieldDescriptor(receiver, privateMap, action) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to " + action + " private field on non-instance"); - } - - return privateMap.get(receiver); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js b/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js deleted file mode 100644 index f7b6dd5..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _classNameTDZError(name) { - throw new Error("Class \"" + name + "\" cannot be referenced in computed property keys."); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js deleted file mode 100644 index fb58833..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +++ /dev/null @@ -1,6 +0,0 @@ -import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet.js"; -import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js"; -export default function _classPrivateFieldDestructureSet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js deleted file mode 100644 index 53cd137..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +++ /dev/null @@ -1,6 +0,0 @@ -import classApplyDescriptorGet from "./classApplyDescriptorGet.js"; -import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js"; -export default function _classPrivateFieldGet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js deleted file mode 100644 index 5b10916..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _classPrivateFieldBase(receiver, privateKey) { - if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { - throw new TypeError("attempted to use private field on non-instance"); - } - - return receiver; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js deleted file mode 100644 index 5b7e5ac..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +++ /dev/null @@ -1,4 +0,0 @@ -var id = 0; -export default function _classPrivateFieldKey(name) { - return "__private_" + id++ + "_" + name; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js deleted file mode 100644 index ad91be4..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +++ /dev/null @@ -1,7 +0,0 @@ -import classApplyDescriptorSet from "./classApplyDescriptorSet.js"; -import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js"; -export default function _classPrivateFieldSet(receiver, privateMap, value) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js b/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js deleted file mode 100644 index 38b9d58..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _classPrivateMethodGet(receiver, privateSet, fn) { - if (!privateSet.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - - return fn; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js b/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js deleted file mode 100644 index 2bbaf3a..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _classPrivateMethodSet() { - throw new TypeError("attempted to reassign private method"); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js deleted file mode 100644 index 77afcfb..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +++ /dev/null @@ -1,8 +0,0 @@ -import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet.js"; -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; -export default function _classStaticPrivateFieldDestructureSet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js deleted file mode 100644 index d253d31..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +++ /dev/null @@ -1,8 +0,0 @@ -import classApplyDescriptorGet from "./classApplyDescriptorGet.js"; -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; -export default function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js deleted file mode 100644 index b0b0cc6..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +++ /dev/null @@ -1,9 +0,0 @@ -import classApplyDescriptorSet from "./classApplyDescriptorSet.js"; -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; -export default function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js deleted file mode 100644 index fddc7b2..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +++ /dev/null @@ -1,5 +0,0 @@ -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -export default function _classStaticPrivateMethodGet(receiver, classConstructor, method) { - classCheckPrivateStaticAccess(receiver, classConstructor); - return method; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js deleted file mode 100644 index d5ab60a..0000000 --- a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _classStaticPrivateMethodSet() { - throw new TypeError("attempted to set read only static private field"); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/construct.js b/node_modules/@babel/runtime/helpers/esm/construct.js deleted file mode 100644 index 0c39835..0000000 --- a/node_modules/@babel/runtime/helpers/esm/construct.js +++ /dev/null @@ -1,18 +0,0 @@ -import setPrototypeOf from "./setPrototypeOf.js"; -import isNativeReflectConstruct from "./isNativeReflectConstruct.js"; -export default function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - _construct = Reflect.construct; - } else { - _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) setPrototypeOf(instance, Class.prototype); - return instance; - }; - } - - return _construct.apply(null, arguments); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/createClass.js b/node_modules/@babel/runtime/helpers/esm/createClass.js deleted file mode 100644 index d6cf412..0000000 --- a/node_modules/@babel/runtime/helpers/esm/createClass.js +++ /dev/null @@ -1,15 +0,0 @@ -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -export default function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js b/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js deleted file mode 100644 index a7a2a50..0000000 --- a/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +++ /dev/null @@ -1,57 +0,0 @@ -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -export default function _createForOfIteratorHelper(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - - if (!it) { - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - - var F = function F() {}; - - return { - s: F, - n: function n() { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }, - e: function e(_e) { - throw _e; - }, - f: F - }; - } - - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - - var normalCompletion = true, - didErr = false, - err; - return { - s: function s() { - it = it.call(o); - }, - n: function n() { - var step = it.next(); - normalCompletion = step.done; - return step; - }, - e: function e(_e2) { - didErr = true; - err = _e2; - }, - f: function f() { - try { - if (!normalCompletion && it["return"] != null) it["return"](); - } finally { - if (didErr) throw err; - } - } - }; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js b/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js deleted file mode 100644 index 640ec68..0000000 --- a/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +++ /dev/null @@ -1,21 +0,0 @@ -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -export default function _createForOfIteratorHelperLoose(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (it) return (it = it.call(o)).next.bind(it); - - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - return function () { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }; - } - - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/createSuper.js b/node_modules/@babel/runtime/helpers/esm/createSuper.js deleted file mode 100644 index ea5ea99..0000000 --- a/node_modules/@babel/runtime/helpers/esm/createSuper.js +++ /dev/null @@ -1,19 +0,0 @@ -import getPrototypeOf from "./getPrototypeOf.js"; -import isNativeReflectConstruct from "./isNativeReflectConstruct.js"; -import possibleConstructorReturn from "./possibleConstructorReturn.js"; -export default function _createSuper(Derived) { - var hasNativeReflectConstruct = isNativeReflectConstruct(); - return function _createSuperInternal() { - var Super = getPrototypeOf(Derived), - result; - - if (hasNativeReflectConstruct) { - var NewTarget = getPrototypeOf(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - - return possibleConstructorReturn(this, result); - }; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/decorate.js b/node_modules/@babel/runtime/helpers/esm/decorate.js deleted file mode 100644 index daf56da..0000000 --- a/node_modules/@babel/runtime/helpers/esm/decorate.js +++ /dev/null @@ -1,396 +0,0 @@ -import toArray from "./toArray.js"; -import toPropertyKey from "./toPropertyKey.js"; -export default function _decorate(decorators, factory, superClass, mixins) { - var api = _getDecoratorsApi(); - - if (mixins) { - for (var i = 0; i < mixins.length; i++) { - api = mixins[i](api); - } - } - - var r = factory(function initialize(O) { - api.initializeInstanceElements(O, decorated.elements); - }, superClass); - var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); - api.initializeClassElements(r.F, decorated.elements); - return api.runClassFinishers(r.F, decorated.finishers); -} - -function _getDecoratorsApi() { - _getDecoratorsApi = function _getDecoratorsApi() { - return api; - }; - - var api = { - elementsDefinitionOrder: [["method"], ["field"]], - initializeInstanceElements: function initializeInstanceElements(O, elements) { - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - if (element.kind === kind && element.placement === "own") { - this.defineClassElement(O, element); - } - }, this); - }, this); - }, - initializeClassElements: function initializeClassElements(F, elements) { - var proto = F.prototype; - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - var placement = element.placement; - - if (element.kind === kind && (placement === "static" || placement === "prototype")) { - var receiver = placement === "static" ? F : proto; - this.defineClassElement(receiver, element); - } - }, this); - }, this); - }, - defineClassElement: function defineClassElement(receiver, element) { - var descriptor = element.descriptor; - - if (element.kind === "field") { - var initializer = element.initializer; - descriptor = { - enumerable: descriptor.enumerable, - writable: descriptor.writable, - configurable: descriptor.configurable, - value: initializer === void 0 ? void 0 : initializer.call(receiver) - }; - } - - Object.defineProperty(receiver, element.key, descriptor); - }, - decorateClass: function decorateClass(elements, decorators) { - var newElements = []; - var finishers = []; - var placements = { - "static": [], - prototype: [], - own: [] - }; - elements.forEach(function (element) { - this.addElementPlacement(element, placements); - }, this); - elements.forEach(function (element) { - if (!_hasDecorators(element)) return newElements.push(element); - var elementFinishersExtras = this.decorateElement(element, placements); - newElements.push(elementFinishersExtras.element); - newElements.push.apply(newElements, elementFinishersExtras.extras); - finishers.push.apply(finishers, elementFinishersExtras.finishers); - }, this); - - if (!decorators) { - return { - elements: newElements, - finishers: finishers - }; - } - - var result = this.decorateConstructor(newElements, decorators); - finishers.push.apply(finishers, result.finishers); - result.finishers = finishers; - return result; - }, - addElementPlacement: function addElementPlacement(element, placements, silent) { - var keys = placements[element.placement]; - - if (!silent && keys.indexOf(element.key) !== -1) { - throw new TypeError("Duplicated element (" + element.key + ")"); - } - - keys.push(element.key); - }, - decorateElement: function decorateElement(element, placements) { - var extras = []; - var finishers = []; - - for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { - var keys = placements[element.placement]; - keys.splice(keys.indexOf(element.key), 1); - var elementObject = this.fromElementDescriptor(element); - var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); - element = elementFinisherExtras.element; - this.addElementPlacement(element, placements); - - if (elementFinisherExtras.finisher) { - finishers.push(elementFinisherExtras.finisher); - } - - var newExtras = elementFinisherExtras.extras; - - if (newExtras) { - for (var j = 0; j < newExtras.length; j++) { - this.addElementPlacement(newExtras[j], placements); - } - - extras.push.apply(extras, newExtras); - } - } - - return { - element: element, - finishers: finishers, - extras: extras - }; - }, - decorateConstructor: function decorateConstructor(elements, decorators) { - var finishers = []; - - for (var i = decorators.length - 1; i >= 0; i--) { - var obj = this.fromClassDescriptor(elements); - var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj); - - if (elementsAndFinisher.finisher !== undefined) { - finishers.push(elementsAndFinisher.finisher); - } - - if (elementsAndFinisher.elements !== undefined) { - elements = elementsAndFinisher.elements; - - for (var j = 0; j < elements.length - 1; j++) { - for (var k = j + 1; k < elements.length; k++) { - if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { - throw new TypeError("Duplicated element (" + elements[j].key + ")"); - } - } - } - } - } - - return { - elements: elements, - finishers: finishers - }; - }, - fromElementDescriptor: function fromElementDescriptor(element) { - var obj = { - kind: element.kind, - key: element.key, - placement: element.placement, - descriptor: element.descriptor - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - if (element.kind === "field") obj.initializer = element.initializer; - return obj; - }, - toElementDescriptors: function toElementDescriptors(elementObjects) { - if (elementObjects === undefined) return; - return toArray(elementObjects).map(function (elementObject) { - var element = this.toElementDescriptor(elementObject); - this.disallowProperty(elementObject, "finisher", "An element descriptor"); - this.disallowProperty(elementObject, "extras", "An element descriptor"); - return element; - }, this); - }, - toElementDescriptor: function toElementDescriptor(elementObject) { - var kind = String(elementObject.kind); - - if (kind !== "method" && kind !== "field") { - throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); - } - - var key = toPropertyKey(elementObject.key); - var placement = String(elementObject.placement); - - if (placement !== "static" && placement !== "prototype" && placement !== "own") { - throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); - } - - var descriptor = elementObject.descriptor; - this.disallowProperty(elementObject, "elements", "An element descriptor"); - var element = { - kind: kind, - key: key, - placement: placement, - descriptor: Object.assign({}, descriptor) - }; - - if (kind !== "field") { - this.disallowProperty(elementObject, "initializer", "A method descriptor"); - } else { - this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); - element.initializer = elementObject.initializer; - } - - return element; - }, - toElementFinisherExtras: function toElementFinisherExtras(elementObject) { - var element = this.toElementDescriptor(elementObject); - - var finisher = _optionalCallableProperty(elementObject, "finisher"); - - var extras = this.toElementDescriptors(elementObject.extras); - return { - element: element, - finisher: finisher, - extras: extras - }; - }, - fromClassDescriptor: function fromClassDescriptor(elements) { - var obj = { - kind: "class", - elements: elements.map(this.fromElementDescriptor, this) - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - return obj; - }, - toClassDescriptor: function toClassDescriptor(obj) { - var kind = String(obj.kind); - - if (kind !== "class") { - throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); - } - - this.disallowProperty(obj, "key", "A class descriptor"); - this.disallowProperty(obj, "placement", "A class descriptor"); - this.disallowProperty(obj, "descriptor", "A class descriptor"); - this.disallowProperty(obj, "initializer", "A class descriptor"); - this.disallowProperty(obj, "extras", "A class descriptor"); - - var finisher = _optionalCallableProperty(obj, "finisher"); - - var elements = this.toElementDescriptors(obj.elements); - return { - elements: elements, - finisher: finisher - }; - }, - runClassFinishers: function runClassFinishers(constructor, finishers) { - for (var i = 0; i < finishers.length; i++) { - var newConstructor = (0, finishers[i])(constructor); - - if (newConstructor !== undefined) { - if (typeof newConstructor !== "function") { - throw new TypeError("Finishers must return a constructor."); - } - - constructor = newConstructor; - } - } - - return constructor; - }, - disallowProperty: function disallowProperty(obj, name, objectType) { - if (obj[name] !== undefined) { - throw new TypeError(objectType + " can't have a ." + name + " property."); - } - } - }; - return api; -} - -function _createElementDescriptor(def) { - var key = toPropertyKey(def.key); - var descriptor; - - if (def.kind === "method") { - descriptor = { - value: def.value, - writable: true, - configurable: true, - enumerable: false - }; - } else if (def.kind === "get") { - descriptor = { - get: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "set") { - descriptor = { - set: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "field") { - descriptor = { - configurable: true, - writable: true, - enumerable: true - }; - } - - var element = { - kind: def.kind === "field" ? "field" : "method", - key: key, - placement: def["static"] ? "static" : def.kind === "field" ? "own" : "prototype", - descriptor: descriptor - }; - if (def.decorators) element.decorators = def.decorators; - if (def.kind === "field") element.initializer = def.value; - return element; -} - -function _coalesceGetterSetter(element, other) { - if (element.descriptor.get !== undefined) { - other.descriptor.get = element.descriptor.get; - } else { - other.descriptor.set = element.descriptor.set; - } -} - -function _coalesceClassElements(elements) { - var newElements = []; - - var isSameElement = function isSameElement(other) { - return other.kind === "method" && other.key === element.key && other.placement === element.placement; - }; - - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - var other; - - if (element.kind === "method" && (other = newElements.find(isSameElement))) { - if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { - if (_hasDecorators(element) || _hasDecorators(other)) { - throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); - } - - other.descriptor = element.descriptor; - } else { - if (_hasDecorators(element)) { - if (_hasDecorators(other)) { - throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); - } - - other.decorators = element.decorators; - } - - _coalesceGetterSetter(element, other); - } - } else { - newElements.push(element); - } - } - - return newElements; -} - -function _hasDecorators(element) { - return element.decorators && element.decorators.length; -} - -function _isDataDescriptor(desc) { - return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); -} - -function _optionalCallableProperty(obj, name) { - var value = obj[name]; - - if (value !== undefined && typeof value !== "function") { - throw new TypeError("Expected '" + name + "' to be a function"); - } - - return value; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/defaults.js b/node_modules/@babel/runtime/helpers/esm/defaults.js deleted file mode 100644 index 3de1d8e..0000000 --- a/node_modules/@babel/runtime/helpers/esm/defaults.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function _defaults(obj, defaults) { - var keys = Object.getOwnPropertyNames(defaults); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = Object.getOwnPropertyDescriptor(defaults, key); - - if (value && value.configurable && obj[key] === undefined) { - Object.defineProperty(obj, key, value); - } - } - - return obj; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js b/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js deleted file mode 100644 index 7981acd..0000000 --- a/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +++ /dev/null @@ -1,22 +0,0 @@ -export default function _defineEnumerableProperties(obj, descs) { - for (var key in descs) { - var desc = descs[key]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, key, desc); - } - - if (Object.getOwnPropertySymbols) { - var objectSymbols = Object.getOwnPropertySymbols(descs); - - for (var i = 0; i < objectSymbols.length; i++) { - var sym = objectSymbols[i]; - var desc = descs[sym]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, sym, desc); - } - } - - return obj; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/defineProperty.js b/node_modules/@babel/runtime/helpers/esm/defineProperty.js deleted file mode 100644 index 7cf6e59..0000000 --- a/node_modules/@babel/runtime/helpers/esm/defineProperty.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/extends.js b/node_modules/@babel/runtime/helpers/esm/extends.js deleted file mode 100644 index b9b138d..0000000 --- a/node_modules/@babel/runtime/helpers/esm/extends.js +++ /dev/null @@ -1,17 +0,0 @@ -export default function _extends() { - _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - return _extends.apply(this, arguments); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/get.js b/node_modules/@babel/runtime/helpers/esm/get.js deleted file mode 100644 index 1bce020..0000000 --- a/node_modules/@babel/runtime/helpers/esm/get.js +++ /dev/null @@ -1,20 +0,0 @@ -import superPropBase from "./superPropBase.js"; -export default function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get; - } else { - _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; - }; - } - - return _get(target, property, receiver || target); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js b/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js deleted file mode 100644 index 5abafe3..0000000 --- a/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/inherits.js b/node_modules/@babel/runtime/helpers/esm/inherits.js deleted file mode 100644 index aee0f10..0000000 --- a/node_modules/@babel/runtime/helpers/esm/inherits.js +++ /dev/null @@ -1,15 +0,0 @@ -import setPrototypeOf from "./setPrototypeOf.js"; -export default function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) setPrototypeOf(subClass, superClass); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js b/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js deleted file mode 100644 index 90bb796..0000000 --- a/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +++ /dev/null @@ -1,6 +0,0 @@ -import setPrototypeOf from "./setPrototypeOf.js"; -export default function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js b/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js deleted file mode 100644 index 26fdea0..0000000 --- a/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function _initializerDefineProperty(target, property, descriptor, context) { - if (!descriptor) return; - Object.defineProperty(target, property, { - enumerable: descriptor.enumerable, - configurable: descriptor.configurable, - writable: descriptor.writable, - value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 - }); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js b/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js deleted file mode 100644 index 30d518c..0000000 --- a/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _initializerWarningHelper(descriptor, context) { - throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/instanceof.js b/node_modules/@babel/runtime/helpers/esm/instanceof.js deleted file mode 100644 index 8c43b71..0000000 --- a/node_modules/@babel/runtime/helpers/esm/instanceof.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _instanceof(left, right) { - if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { - return !!right[Symbol.hasInstance](left); - } else { - return left instanceof right; - } -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js b/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js deleted file mode 100644 index c2df7b6..0000000 --- a/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { - "default": obj - }; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js b/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js deleted file mode 100644 index 662ff7e..0000000 --- a/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +++ /dev/null @@ -1,51 +0,0 @@ -import _typeof from "@babel/runtime/helpers/typeof"; - -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== "function") return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} - -export default function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - - if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { - return { - "default": obj - }; - } - - var cache = _getRequireWildcardCache(nodeInterop); - - if (cache && cache.has(obj)) { - return cache.get(obj); - } - - var newObj = {}; - var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; - - for (var key in obj) { - if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; - - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - - newObj["default"] = obj; - - if (cache) { - cache.set(obj, newObj); - } - - return newObj; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js b/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js deleted file mode 100644 index 7b1bc82..0000000 --- a/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js b/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js deleted file mode 100644 index 0da1624..0000000 --- a/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +++ /dev/null @@ -1,12 +0,0 @@ -export default function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/iterableToArray.js b/node_modules/@babel/runtime/helpers/esm/iterableToArray.js deleted file mode 100644 index cfe9fbd..0000000 --- a/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js b/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js deleted file mode 100644 index c72ca94..0000000 --- a/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +++ /dev/null @@ -1,29 +0,0 @@ -export default function _iterableToArrayLimit(arr, i) { - var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; - - if (_i == null) return; - var _arr = []; - var _n = true; - var _d = false; - - var _s, _e; - - try { - for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js b/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js deleted file mode 100644 index 27c15e0..0000000 --- a/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function _iterableToArrayLimitLoose(arr, i) { - var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); - - if (_i == null) return; - var _arr = []; - - for (_i = _i.call(arr), _step; !(_step = _i.next()).done;) { - _arr.push(_step.value); - - if (i && _arr.length === i) break; - } - - return _arr; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/jsx.js b/node_modules/@babel/runtime/helpers/esm/jsx.js deleted file mode 100644 index 328fadf..0000000 --- a/node_modules/@babel/runtime/helpers/esm/jsx.js +++ /dev/null @@ -1,46 +0,0 @@ -var REACT_ELEMENT_TYPE; -export default function _createRawReactElement(type, props, key, children) { - if (!REACT_ELEMENT_TYPE) { - REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7; - } - - var defaultProps = type && type.defaultProps; - var childrenLength = arguments.length - 3; - - if (!props && childrenLength !== 0) { - props = { - children: void 0 - }; - } - - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = new Array(childrenLength); - - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 3]; - } - - props.children = childArray; - } - - if (props && defaultProps) { - for (var propName in defaultProps) { - if (props[propName] === void 0) { - props[propName] = defaultProps[propName]; - } - } - } else if (!props) { - props = defaultProps || {}; - } - - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key === undefined ? null : "" + key, - ref: null, - props: props, - _owner: null - }; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js b/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js deleted file mode 100644 index f687959..0000000 --- a/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +++ /dev/null @@ -1,9 +0,0 @@ -import arrayLikeToArray from "./arrayLikeToArray.js"; -export default function _maybeArrayLike(next, arr, i) { - if (arr && !Array.isArray(arr) && typeof arr.length === "number") { - var len = arr.length; - return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len); - } - - return next(arr, i); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js b/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js deleted file mode 100644 index d6cd864..0000000 --- a/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _newArrowCheck(innerThis, boundThis) { - if (innerThis !== boundThis) { - throw new TypeError("Cannot instantiate an arrow function"); - } -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js b/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js deleted file mode 100644 index b349d00..0000000 --- a/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js b/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js deleted file mode 100644 index 82d8296..0000000 --- a/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js b/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js deleted file mode 100644 index 82b67d2..0000000 --- a/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _objectDestructuringEmpty(obj) { - if (obj == null) throw new TypeError("Cannot destructure undefined"); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/objectSpread.js b/node_modules/@babel/runtime/helpers/esm/objectSpread.js deleted file mode 100644 index 8c38ca7..0000000 --- a/node_modules/@babel/runtime/helpers/esm/objectSpread.js +++ /dev/null @@ -1,19 +0,0 @@ -import defineProperty from "./defineProperty.js"; -export default function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? Object(arguments[i]) : {}; - var ownKeys = Object.keys(source); - - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - - ownKeys.forEach(function (key) { - defineProperty(target, key, source[key]); - }); - } - - return target; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/objectSpread2.js b/node_modules/@babel/runtime/helpers/esm/objectSpread2.js deleted file mode 100644 index be42b4d..0000000 --- a/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +++ /dev/null @@ -1,39 +0,0 @@ -import defineProperty from "./defineProperty.js"; - -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - - if (enumerableOnly) { - symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - } - - keys.push.apply(keys, symbols); - } - - return keys; -} - -export default function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js b/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js deleted file mode 100644 index 0fef321..0000000 --- a/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +++ /dev/null @@ -1,19 +0,0 @@ -import objectWithoutPropertiesLoose from "./objectWithoutPropertiesLoose.js"; -export default function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = objectWithoutPropertiesLoose(source, excluded); - var key, i; - - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - - return target; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js b/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js deleted file mode 100644 index c36815c..0000000 --- a/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - - return target; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/package.json b/node_modules/@babel/runtime/helpers/esm/package.json deleted file mode 100644 index aead43d..0000000 --- a/node_modules/@babel/runtime/helpers/esm/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js b/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js deleted file mode 100644 index 0ae22f4..0000000 --- a/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +++ /dev/null @@ -1,9 +0,0 @@ -import _typeof from "@babel/runtime/helpers/typeof"; -import assertThisInitialized from "./assertThisInitialized.js"; -export default function _possibleConstructorReturn(self, call) { - if (call && (_typeof(call) === "object" || typeof call === "function")) { - return call; - } - - return assertThisInitialized(self); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/readOnlyError.js b/node_modules/@babel/runtime/helpers/esm/readOnlyError.js deleted file mode 100644 index 166e40e..0000000 --- a/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _readOnlyError(name) { - throw new TypeError("\"" + name + "\" is read-only"); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/set.js b/node_modules/@babel/runtime/helpers/esm/set.js deleted file mode 100644 index 9c54773..0000000 --- a/node_modules/@babel/runtime/helpers/esm/set.js +++ /dev/null @@ -1,51 +0,0 @@ -import superPropBase from "./superPropBase.js"; -import defineProperty from "./defineProperty.js"; - -function set(target, property, value, receiver) { - if (typeof Reflect !== "undefined" && Reflect.set) { - set = Reflect.set; - } else { - set = function set(target, property, value, receiver) { - var base = superPropBase(target, property); - var desc; - - if (base) { - desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.set) { - desc.set.call(receiver, value); - return true; - } else if (!desc.writable) { - return false; - } - } - - desc = Object.getOwnPropertyDescriptor(receiver, property); - - if (desc) { - if (!desc.writable) { - return false; - } - - desc.value = value; - Object.defineProperty(receiver, property, desc); - } else { - defineProperty(receiver, property, value); - } - - return true; - }; - } - - return set(target, property, value, receiver); -} - -export default function _set(target, property, value, receiver, isStrict) { - var s = set(target, property, value, receiver || target); - - if (!s && isStrict) { - throw new Error('failed to set property'); - } - - return value; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js b/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js deleted file mode 100644 index e6ef03e..0000000 --- a/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +++ /dev/null @@ -1,8 +0,0 @@ -export default function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js b/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js deleted file mode 100644 index cadd9bb..0000000 --- a/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _skipFirstGeneratorNext(fn) { - return function () { - var it = fn.apply(this, arguments); - it.next(); - return it; - }; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/slicedToArray.js b/node_modules/@babel/runtime/helpers/esm/slicedToArray.js deleted file mode 100644 index 618200b..0000000 --- a/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithHoles from "./arrayWithHoles.js"; -import iterableToArrayLimit from "./iterableToArrayLimit.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableRest from "./nonIterableRest.js"; -export default function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js b/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js deleted file mode 100644 index efc7429..0000000 --- a/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithHoles from "./arrayWithHoles.js"; -import iterableToArrayLimitLoose from "./iterableToArrayLimitLoose.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableRest from "./nonIterableRest.js"; -export default function _slicedToArrayLoose(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/superPropBase.js b/node_modules/@babel/runtime/helpers/esm/superPropBase.js deleted file mode 100644 index feffe6f..0000000 --- a/node_modules/@babel/runtime/helpers/esm/superPropBase.js +++ /dev/null @@ -1,9 +0,0 @@ -import getPrototypeOf from "./getPrototypeOf.js"; -export default function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - - return object; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js b/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js deleted file mode 100644 index 421f18a..0000000 --- a/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +++ /dev/null @@ -1,11 +0,0 @@ -export default function _taggedTemplateLiteral(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - - return Object.freeze(Object.defineProperties(strings, { - raw: { - value: Object.freeze(raw) - } - })); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js b/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js deleted file mode 100644 index c8f081e..0000000 --- a/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +++ /dev/null @@ -1,8 +0,0 @@ -export default function _taggedTemplateLiteralLoose(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - - strings.raw = raw; - return strings; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/tdz.js b/node_modules/@babel/runtime/helpers/esm/tdz.js deleted file mode 100644 index d5d0adc..0000000 --- a/node_modules/@babel/runtime/helpers/esm/tdz.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _tdzError(name) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/temporalRef.js b/node_modules/@babel/runtime/helpers/esm/temporalRef.js deleted file mode 100644 index b25f7c4..0000000 --- a/node_modules/@babel/runtime/helpers/esm/temporalRef.js +++ /dev/null @@ -1,5 +0,0 @@ -import undef from "./temporalUndefined.js"; -import err from "./tdz.js"; -export default function _temporalRef(val, name) { - return val === undef ? err(name) : val; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js b/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js deleted file mode 100644 index 1a35717..0000000 --- a/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +++ /dev/null @@ -1 +0,0 @@ -export default function _temporalUndefined() {} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/toArray.js b/node_modules/@babel/runtime/helpers/esm/toArray.js deleted file mode 100644 index ad7c871..0000000 --- a/node_modules/@babel/runtime/helpers/esm/toArray.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithHoles from "./arrayWithHoles.js"; -import iterableToArray from "./iterableToArray.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableRest from "./nonIterableRest.js"; -export default function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js b/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js deleted file mode 100644 index bd91285..0000000 --- a/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithoutHoles from "./arrayWithoutHoles.js"; -import iterableToArray from "./iterableToArray.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableSpread from "./nonIterableSpread.js"; -export default function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/toPrimitive.js b/node_modules/@babel/runtime/helpers/esm/toPrimitive.js deleted file mode 100644 index 4cb70a5..0000000 --- a/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +++ /dev/null @@ -1,13 +0,0 @@ -import _typeof from "@babel/runtime/helpers/typeof"; -export default function _toPrimitive(input, hint) { - if (_typeof(input) !== "object" || input === null) return input; - var prim = input[Symbol.toPrimitive]; - - if (prim !== undefined) { - var res = prim.call(input, hint || "default"); - if (_typeof(res) !== "object") return res; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - - return (hint === "string" ? String : Number)(input); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js b/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js deleted file mode 100644 index f1ba8a2..0000000 --- a/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +++ /dev/null @@ -1,6 +0,0 @@ -import _typeof from "@babel/runtime/helpers/typeof"; -import toPrimitive from "./toPrimitive.js"; -export default function _toPropertyKey(arg) { - var key = toPrimitive(arg, "string"); - return _typeof(key) === "symbol" ? key : String(key); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/typeof.js b/node_modules/@babel/runtime/helpers/esm/typeof.js deleted file mode 100644 index eb444f7..0000000 --- a/node_modules/@babel/runtime/helpers/esm/typeof.js +++ /dev/null @@ -1,15 +0,0 @@ -export default function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function _typeof(obj) { - return typeof obj; - }; - } else { - _typeof = function _typeof(obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js b/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js deleted file mode 100644 index c0f63bd..0000000 --- a/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +++ /dev/null @@ -1,9 +0,0 @@ -import arrayLikeToArray from "./arrayLikeToArray.js"; -export default function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js b/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js deleted file mode 100644 index 723b2dd..0000000 --- a/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +++ /dev/null @@ -1,6 +0,0 @@ -import AsyncGenerator from "./AsyncGenerator.js"; -export default function _wrapAsyncGenerator(fn) { - return function () { - return new AsyncGenerator(fn.apply(this, arguments)); - }; -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js b/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js deleted file mode 100644 index 512630d..0000000 --- a/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +++ /dev/null @@ -1,37 +0,0 @@ -import getPrototypeOf from "./getPrototypeOf.js"; -import setPrototypeOf from "./setPrototypeOf.js"; -import isNativeFunction from "./isNativeFunction.js"; -import construct from "./construct.js"; -export default function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - - _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !isNativeFunction(Class)) return Class; - - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - - _cache.set(Class, Wrapper); - } - - function Wrapper() { - return construct(Class, arguments, getPrototypeOf(this).constructor); - } - - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return setPrototypeOf(Wrapper, Class); - }; - - return _wrapNativeSuper(Class); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js b/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js deleted file mode 100644 index 4d65336..0000000 --- a/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +++ /dev/null @@ -1,65 +0,0 @@ -import _typeof from "@babel/runtime/helpers/typeof"; -import setPrototypeOf from "./setPrototypeOf.js"; -import inherits from "./inherits.js"; -export default function _wrapRegExp() { - _wrapRegExp = function _wrapRegExp(re, groups) { - return new BabelRegExp(re, undefined, groups); - }; - - var _super = RegExp.prototype; - - var _groups = new WeakMap(); - - function BabelRegExp(re, flags, groups) { - var _this = new RegExp(re, flags); - - _groups.set(_this, groups || _groups.get(re)); - - return setPrototypeOf(_this, BabelRegExp.prototype); - } - - inherits(BabelRegExp, RegExp); - - BabelRegExp.prototype.exec = function (str) { - var result = _super.exec.call(this, str); - - if (result) result.groups = buildGroups(result, this); - return result; - }; - - BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { - if (typeof substitution === "string") { - var groups = _groups.get(this); - - return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { - return "$" + groups[name]; - })); - } else if (typeof substitution === "function") { - var _this = this; - - return _super[Symbol.replace].call(this, str, function () { - var args = arguments; - - if (_typeof(args[args.length - 1]) !== "object") { - args = [].slice.call(args); - args.push(buildGroups(args, _this)); - } - - return substitution.apply(this, args); - }); - } else { - return _super[Symbol.replace].call(this, str, substitution); - } - }; - - function buildGroups(result, re) { - var g = _groups.get(re); - - return Object.keys(g).reduce(function (groups, name) { - groups[name] = result[g[name]]; - return groups; - }, Object.create(null)); - } - - return _wrapRegExp.apply(this, arguments); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js b/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js deleted file mode 100644 index 9170bd4..0000000 --- a/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _writeOnlyError(name) { - throw new TypeError("\"" + name + "\" is write-only"); -} \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/extends.js b/node_modules/@babel/runtime/helpers/extends.js deleted file mode 100644 index eaf9547..0000000 --- a/node_modules/@babel/runtime/helpers/extends.js +++ /dev/null @@ -1,21 +0,0 @@ -function _extends() { - module.exports = _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _extends.apply(this, arguments); -} - -module.exports = _extends; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/get.js b/node_modules/@babel/runtime/helpers/get.js deleted file mode 100644 index 3ed600f..0000000 --- a/node_modules/@babel/runtime/helpers/get.js +++ /dev/null @@ -1,27 +0,0 @@ -var superPropBase = require("./superPropBase.js"); - -function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - module.exports = _get = Reflect.get; - module.exports["default"] = module.exports, module.exports.__esModule = true; - } else { - module.exports = _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - } - - return _get(target, property, receiver || target); -} - -module.exports = _get; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/getPrototypeOf.js b/node_modules/@babel/runtime/helpers/getPrototypeOf.js deleted file mode 100644 index a6916eb..0000000 --- a/node_modules/@babel/runtime/helpers/getPrototypeOf.js +++ /dev/null @@ -1,10 +0,0 @@ -function _getPrototypeOf(o) { - module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _getPrototypeOf(o); -} - -module.exports = _getPrototypeOf; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/inherits.js b/node_modules/@babel/runtime/helpers/inherits.js deleted file mode 100644 index 3003e01..0000000 --- a/node_modules/@babel/runtime/helpers/inherits.js +++ /dev/null @@ -1,19 +0,0 @@ -var setPrototypeOf = require("./setPrototypeOf.js"); - -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) setPrototypeOf(subClass, superClass); -} - -module.exports = _inherits; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/inheritsLoose.js b/node_modules/@babel/runtime/helpers/inheritsLoose.js deleted file mode 100644 index 93e4305..0000000 --- a/node_modules/@babel/runtime/helpers/inheritsLoose.js +++ /dev/null @@ -1,10 +0,0 @@ -var setPrototypeOf = require("./setPrototypeOf.js"); - -function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); -} - -module.exports = _inheritsLoose; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/initializerDefineProperty.js b/node_modules/@babel/runtime/helpers/initializerDefineProperty.js deleted file mode 100644 index 6b1069e..0000000 --- a/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +++ /dev/null @@ -1,12 +0,0 @@ -function _initializerDefineProperty(target, property, descriptor, context) { - if (!descriptor) return; - Object.defineProperty(target, property, { - enumerable: descriptor.enumerable, - configurable: descriptor.configurable, - writable: descriptor.writable, - value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 - }); -} - -module.exports = _initializerDefineProperty; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/initializerWarningHelper.js b/node_modules/@babel/runtime/helpers/initializerWarningHelper.js deleted file mode 100644 index 9d02886..0000000 --- a/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +++ /dev/null @@ -1,6 +0,0 @@ -function _initializerWarningHelper(descriptor, context) { - throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); -} - -module.exports = _initializerWarningHelper; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/instanceof.js b/node_modules/@babel/runtime/helpers/instanceof.js deleted file mode 100644 index 654ebc8..0000000 --- a/node_modules/@babel/runtime/helpers/instanceof.js +++ /dev/null @@ -1,10 +0,0 @@ -function _instanceof(left, right) { - if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { - return !!right[Symbol.hasInstance](left); - } else { - return left instanceof right; - } -} - -module.exports = _instanceof; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/interopRequireDefault.js b/node_modules/@babel/runtime/helpers/interopRequireDefault.js deleted file mode 100644 index 6a21368..0000000 --- a/node_modules/@babel/runtime/helpers/interopRequireDefault.js +++ /dev/null @@ -1,8 +0,0 @@ -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { - "default": obj - }; -} - -module.exports = _interopRequireDefault; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/interopRequireWildcard.js b/node_modules/@babel/runtime/helpers/interopRequireWildcard.js deleted file mode 100644 index 635f8bb..0000000 --- a/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +++ /dev/null @@ -1,54 +0,0 @@ -var _typeof = require("@babel/runtime/helpers/typeof")["default"]; - -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== "function") return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} - -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - - if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { - return { - "default": obj - }; - } - - var cache = _getRequireWildcardCache(nodeInterop); - - if (cache && cache.has(obj)) { - return cache.get(obj); - } - - var newObj = {}; - var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; - - for (var key in obj) { - if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; - - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - - newObj["default"] = obj; - - if (cache) { - cache.set(obj, newObj); - } - - return newObj; -} - -module.exports = _interopRequireWildcard; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/isNativeFunction.js b/node_modules/@babel/runtime/helpers/isNativeFunction.js deleted file mode 100644 index 50eb8f5..0000000 --- a/node_modules/@babel/runtime/helpers/isNativeFunction.js +++ /dev/null @@ -1,6 +0,0 @@ -function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; -} - -module.exports = _isNativeFunction; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js b/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js deleted file mode 100644 index 3a201a6..0000000 --- a/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +++ /dev/null @@ -1,15 +0,0 @@ -function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } -} - -module.exports = _isNativeReflectConstruct; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/iterableToArray.js b/node_modules/@babel/runtime/helpers/iterableToArray.js deleted file mode 100644 index 03f955d..0000000 --- a/node_modules/@babel/runtime/helpers/iterableToArray.js +++ /dev/null @@ -1,6 +0,0 @@ -function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); -} - -module.exports = _iterableToArray; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js b/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js deleted file mode 100644 index da9cee0..0000000 --- a/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +++ /dev/null @@ -1,32 +0,0 @@ -function _iterableToArrayLimit(arr, i) { - var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; - - if (_i == null) return; - var _arr = []; - var _n = true; - var _d = false; - - var _s, _e; - - try { - for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; -} - -module.exports = _iterableToArrayLimit; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js b/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js deleted file mode 100644 index fb05b12..0000000 --- a/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js +++ /dev/null @@ -1,17 +0,0 @@ -function _iterableToArrayLimitLoose(arr, i) { - var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); - - if (_i == null) return; - var _arr = []; - - for (_i = _i.call(arr), _step; !(_step = _i.next()).done;) { - _arr.push(_step.value); - - if (i && _arr.length === i) break; - } - - return _arr; -} - -module.exports = _iterableToArrayLimitLoose; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/jsx.js b/node_modules/@babel/runtime/helpers/jsx.js deleted file mode 100644 index 21ac847..0000000 --- a/node_modules/@babel/runtime/helpers/jsx.js +++ /dev/null @@ -1,50 +0,0 @@ -var REACT_ELEMENT_TYPE; - -function _createRawReactElement(type, props, key, children) { - if (!REACT_ELEMENT_TYPE) { - REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7; - } - - var defaultProps = type && type.defaultProps; - var childrenLength = arguments.length - 3; - - if (!props && childrenLength !== 0) { - props = { - children: void 0 - }; - } - - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = new Array(childrenLength); - - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 3]; - } - - props.children = childArray; - } - - if (props && defaultProps) { - for (var propName in defaultProps) { - if (props[propName] === void 0) { - props[propName] = defaultProps[propName]; - } - } - } else if (!props) { - props = defaultProps || {}; - } - - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key === undefined ? null : "" + key, - ref: null, - props: props, - _owner: null - }; -} - -module.exports = _createRawReactElement; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/maybeArrayLike.js b/node_modules/@babel/runtime/helpers/maybeArrayLike.js deleted file mode 100644 index 3ab618b..0000000 --- a/node_modules/@babel/runtime/helpers/maybeArrayLike.js +++ /dev/null @@ -1,13 +0,0 @@ -var arrayLikeToArray = require("./arrayLikeToArray.js"); - -function _maybeArrayLike(next, arr, i) { - if (arr && !Array.isArray(arr) && typeof arr.length === "number") { - var len = arr.length; - return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len); - } - - return next(arr, i); -} - -module.exports = _maybeArrayLike; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/newArrowCheck.js b/node_modules/@babel/runtime/helpers/newArrowCheck.js deleted file mode 100644 index 8d7570b..0000000 --- a/node_modules/@babel/runtime/helpers/newArrowCheck.js +++ /dev/null @@ -1,8 +0,0 @@ -function _newArrowCheck(innerThis, boundThis) { - if (innerThis !== boundThis) { - throw new TypeError("Cannot instantiate an arrow function"); - } -} - -module.exports = _newArrowCheck; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/nonIterableRest.js b/node_modules/@babel/runtime/helpers/nonIterableRest.js deleted file mode 100644 index 22be4f5..0000000 --- a/node_modules/@babel/runtime/helpers/nonIterableRest.js +++ /dev/null @@ -1,6 +0,0 @@ -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} - -module.exports = _nonIterableRest; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/nonIterableSpread.js b/node_modules/@babel/runtime/helpers/nonIterableSpread.js deleted file mode 100644 index 4ba722d..0000000 --- a/node_modules/@babel/runtime/helpers/nonIterableSpread.js +++ /dev/null @@ -1,6 +0,0 @@ -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} - -module.exports = _nonIterableSpread; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js b/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js deleted file mode 100644 index 1bb88ac..0000000 --- a/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +++ /dev/null @@ -1,6 +0,0 @@ -function _objectDestructuringEmpty(obj) { - if (obj == null) throw new TypeError("Cannot destructure undefined"); -} - -module.exports = _objectDestructuringEmpty; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/objectSpread.js b/node_modules/@babel/runtime/helpers/objectSpread.js deleted file mode 100644 index 00af209..0000000 --- a/node_modules/@babel/runtime/helpers/objectSpread.js +++ /dev/null @@ -1,23 +0,0 @@ -var defineProperty = require("./defineProperty.js"); - -function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? Object(arguments[i]) : {}; - var ownKeys = Object.keys(source); - - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - - ownKeys.forEach(function (key) { - defineProperty(target, key, source[key]); - }); - } - - return target; -} - -module.exports = _objectSpread; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/objectSpread2.js b/node_modules/@babel/runtime/helpers/objectSpread2.js deleted file mode 100644 index 337d30e..0000000 --- a/node_modules/@babel/runtime/helpers/objectSpread2.js +++ /dev/null @@ -1,42 +0,0 @@ -var defineProperty = require("./defineProperty.js"); - -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - - if (enumerableOnly) { - symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - } - - keys.push.apply(keys, symbols); - } - - return keys; -} - -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; -} - -module.exports = _objectSpread2; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/objectWithoutProperties.js b/node_modules/@babel/runtime/helpers/objectWithoutProperties.js deleted file mode 100644 index c000db7..0000000 --- a/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +++ /dev/null @@ -1,23 +0,0 @@ -var objectWithoutPropertiesLoose = require("./objectWithoutPropertiesLoose.js"); - -function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = objectWithoutPropertiesLoose(source, excluded); - var key, i; - - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - - return target; -} - -module.exports = _objectWithoutProperties; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js b/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js deleted file mode 100644 index d9a73de..0000000 --- a/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +++ /dev/null @@ -1,17 +0,0 @@ -function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - - return target; -} - -module.exports = _objectWithoutPropertiesLoose; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js b/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js deleted file mode 100644 index 259ea2b..0000000 --- a/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +++ /dev/null @@ -1,14 +0,0 @@ -var _typeof = require("@babel/runtime/helpers/typeof")["default"]; - -var assertThisInitialized = require("./assertThisInitialized.js"); - -function _possibleConstructorReturn(self, call) { - if (call && (_typeof(call) === "object" || typeof call === "function")) { - return call; - } - - return assertThisInitialized(self); -} - -module.exports = _possibleConstructorReturn; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/readOnlyError.js b/node_modules/@babel/runtime/helpers/readOnlyError.js deleted file mode 100644 index e805f89..0000000 --- a/node_modules/@babel/runtime/helpers/readOnlyError.js +++ /dev/null @@ -1,6 +0,0 @@ -function _readOnlyError(name) { - throw new TypeError("\"" + name + "\" is read-only"); -} - -module.exports = _readOnlyError; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/set.js b/node_modules/@babel/runtime/helpers/set.js deleted file mode 100644 index b7d184d..0000000 --- a/node_modules/@babel/runtime/helpers/set.js +++ /dev/null @@ -1,55 +0,0 @@ -var superPropBase = require("./superPropBase.js"); - -var defineProperty = require("./defineProperty.js"); - -function set(target, property, value, receiver) { - if (typeof Reflect !== "undefined" && Reflect.set) { - set = Reflect.set; - } else { - set = function set(target, property, value, receiver) { - var base = superPropBase(target, property); - var desc; - - if (base) { - desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.set) { - desc.set.call(receiver, value); - return true; - } else if (!desc.writable) { - return false; - } - } - - desc = Object.getOwnPropertyDescriptor(receiver, property); - - if (desc) { - if (!desc.writable) { - return false; - } - - desc.value = value; - Object.defineProperty(receiver, property, desc); - } else { - defineProperty(receiver, property, value); - } - - return true; - }; - } - - return set(target, property, value, receiver); -} - -function _set(target, property, value, receiver, isStrict) { - var s = set(target, property, value, receiver || target); - - if (!s && isStrict) { - throw new Error('failed to set property'); - } - - return value; -} - -module.exports = _set; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/setPrototypeOf.js b/node_modules/@babel/runtime/helpers/setPrototypeOf.js deleted file mode 100644 index 415797b..0000000 --- a/node_modules/@babel/runtime/helpers/setPrototypeOf.js +++ /dev/null @@ -1,12 +0,0 @@ -function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _setPrototypeOf(o, p); -} - -module.exports = _setPrototypeOf; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js b/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js deleted file mode 100644 index ed60585..0000000 --- a/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +++ /dev/null @@ -1,10 +0,0 @@ -function _skipFirstGeneratorNext(fn) { - return function () { - var it = fn.apply(this, arguments); - it.next(); - return it; - }; -} - -module.exports = _skipFirstGeneratorNext; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/slicedToArray.js b/node_modules/@babel/runtime/helpers/slicedToArray.js deleted file mode 100644 index 101f404..0000000 --- a/node_modules/@babel/runtime/helpers/slicedToArray.js +++ /dev/null @@ -1,14 +0,0 @@ -var arrayWithHoles = require("./arrayWithHoles.js"); - -var iterableToArrayLimit = require("./iterableToArrayLimit.js"); - -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); - -var nonIterableRest = require("./nonIterableRest.js"); - -function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} - -module.exports = _slicedToArray; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js b/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js deleted file mode 100644 index 188db63..0000000 --- a/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js +++ /dev/null @@ -1,14 +0,0 @@ -var arrayWithHoles = require("./arrayWithHoles.js"); - -var iterableToArrayLimitLoose = require("./iterableToArrayLimitLoose.js"); - -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); - -var nonIterableRest = require("./nonIterableRest.js"); - -function _slicedToArrayLoose(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} - -module.exports = _slicedToArrayLoose; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/superPropBase.js b/node_modules/@babel/runtime/helpers/superPropBase.js deleted file mode 100644 index ce12a88..0000000 --- a/node_modules/@babel/runtime/helpers/superPropBase.js +++ /dev/null @@ -1,13 +0,0 @@ -var getPrototypeOf = require("./getPrototypeOf.js"); - -function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - - return object; -} - -module.exports = _superPropBase; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js b/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js deleted file mode 100644 index 1a524b3..0000000 --- a/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +++ /dev/null @@ -1,14 +0,0 @@ -function _taggedTemplateLiteral(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - - return Object.freeze(Object.defineProperties(strings, { - raw: { - value: Object.freeze(raw) - } - })); -} - -module.exports = _taggedTemplateLiteral; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js b/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js deleted file mode 100644 index ab78e62..0000000 --- a/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +++ /dev/null @@ -1,11 +0,0 @@ -function _taggedTemplateLiteralLoose(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - - strings.raw = raw; - return strings; -} - -module.exports = _taggedTemplateLiteralLoose; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/tdz.js b/node_modules/@babel/runtime/helpers/tdz.js deleted file mode 100644 index a5b35a6..0000000 --- a/node_modules/@babel/runtime/helpers/tdz.js +++ /dev/null @@ -1,6 +0,0 @@ -function _tdzError(name) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); -} - -module.exports = _tdzError; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/temporalRef.js b/node_modules/@babel/runtime/helpers/temporalRef.js deleted file mode 100644 index d4e9460..0000000 --- a/node_modules/@babel/runtime/helpers/temporalRef.js +++ /dev/null @@ -1,10 +0,0 @@ -var temporalUndefined = require("./temporalUndefined.js"); - -var tdz = require("./tdz.js"); - -function _temporalRef(val, name) { - return val === temporalUndefined ? tdz(name) : val; -} - -module.exports = _temporalRef; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/temporalUndefined.js b/node_modules/@babel/runtime/helpers/temporalUndefined.js deleted file mode 100644 index aeae645..0000000 --- a/node_modules/@babel/runtime/helpers/temporalUndefined.js +++ /dev/null @@ -1,4 +0,0 @@ -function _temporalUndefined() {} - -module.exports = _temporalUndefined; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/toArray.js b/node_modules/@babel/runtime/helpers/toArray.js deleted file mode 100644 index 3b911bd..0000000 --- a/node_modules/@babel/runtime/helpers/toArray.js +++ /dev/null @@ -1,14 +0,0 @@ -var arrayWithHoles = require("./arrayWithHoles.js"); - -var iterableToArray = require("./iterableToArray.js"); - -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); - -var nonIterableRest = require("./nonIterableRest.js"); - -function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); -} - -module.exports = _toArray; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/toConsumableArray.js b/node_modules/@babel/runtime/helpers/toConsumableArray.js deleted file mode 100644 index f084cd1..0000000 --- a/node_modules/@babel/runtime/helpers/toConsumableArray.js +++ /dev/null @@ -1,14 +0,0 @@ -var arrayWithoutHoles = require("./arrayWithoutHoles.js"); - -var iterableToArray = require("./iterableToArray.js"); - -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); - -var nonIterableSpread = require("./nonIterableSpread.js"); - -function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); -} - -module.exports = _toConsumableArray; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/toPrimitive.js b/node_modules/@babel/runtime/helpers/toPrimitive.js deleted file mode 100644 index ac40338..0000000 --- a/node_modules/@babel/runtime/helpers/toPrimitive.js +++ /dev/null @@ -1,17 +0,0 @@ -var _typeof = require("@babel/runtime/helpers/typeof")["default"]; - -function _toPrimitive(input, hint) { - if (_typeof(input) !== "object" || input === null) return input; - var prim = input[Symbol.toPrimitive]; - - if (prim !== undefined) { - var res = prim.call(input, hint || "default"); - if (_typeof(res) !== "object") return res; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - - return (hint === "string" ? String : Number)(input); -} - -module.exports = _toPrimitive; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/toPropertyKey.js b/node_modules/@babel/runtime/helpers/toPropertyKey.js deleted file mode 100644 index 066b3f2..0000000 --- a/node_modules/@babel/runtime/helpers/toPropertyKey.js +++ /dev/null @@ -1,11 +0,0 @@ -var _typeof = require("@babel/runtime/helpers/typeof")["default"]; - -var toPrimitive = require("./toPrimitive.js"); - -function _toPropertyKey(arg) { - var key = toPrimitive(arg, "string"); - return _typeof(key) === "symbol" ? key : String(key); -} - -module.exports = _toPropertyKey; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/typeof.js b/node_modules/@babel/runtime/helpers/typeof.js deleted file mode 100644 index 02a5d8a..0000000 --- a/node_modules/@babel/runtime/helpers/typeof.js +++ /dev/null @@ -1,22 +0,0 @@ -function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - module.exports = _typeof = function _typeof(obj) { - return typeof obj; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - } else { - module.exports = _typeof = function _typeof(obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - } - - return _typeof(obj); -} - -module.exports = _typeof; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js b/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js deleted file mode 100644 index 11bca7b..0000000 --- a/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +++ /dev/null @@ -1,13 +0,0 @@ -var arrayLikeToArray = require("./arrayLikeToArray.js"); - -function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); -} - -module.exports = _unsupportedIterableToArray; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js b/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js deleted file mode 100644 index 057cd19..0000000 --- a/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +++ /dev/null @@ -1,10 +0,0 @@ -var AsyncGenerator = require("./AsyncGenerator.js"); - -function _wrapAsyncGenerator(fn) { - return function () { - return new AsyncGenerator(fn.apply(this, arguments)); - }; -} - -module.exports = _wrapAsyncGenerator; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/wrapNativeSuper.js b/node_modules/@babel/runtime/helpers/wrapNativeSuper.js deleted file mode 100644 index 981c8dd..0000000 --- a/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +++ /dev/null @@ -1,45 +0,0 @@ -var getPrototypeOf = require("./getPrototypeOf.js"); - -var setPrototypeOf = require("./setPrototypeOf.js"); - -var isNativeFunction = require("./isNativeFunction.js"); - -var construct = require("./construct.js"); - -function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - - module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !isNativeFunction(Class)) return Class; - - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - - _cache.set(Class, Wrapper); - } - - function Wrapper() { - return construct(Class, arguments, getPrototypeOf(this).constructor); - } - - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return setPrototypeOf(Wrapper, Class); - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _wrapNativeSuper(Class); -} - -module.exports = _wrapNativeSuper; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/wrapRegExp.js b/node_modules/@babel/runtime/helpers/wrapRegExp.js deleted file mode 100644 index e80a8b6..0000000 --- a/node_modules/@babel/runtime/helpers/wrapRegExp.js +++ /dev/null @@ -1,72 +0,0 @@ -var _typeof = require("@babel/runtime/helpers/typeof")["default"]; - -var setPrototypeOf = require("./setPrototypeOf.js"); - -var inherits = require("./inherits.js"); - -function _wrapRegExp() { - module.exports = _wrapRegExp = function _wrapRegExp(re, groups) { - return new BabelRegExp(re, undefined, groups); - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - var _super = RegExp.prototype; - - var _groups = new WeakMap(); - - function BabelRegExp(re, flags, groups) { - var _this = new RegExp(re, flags); - - _groups.set(_this, groups || _groups.get(re)); - - return setPrototypeOf(_this, BabelRegExp.prototype); - } - - inherits(BabelRegExp, RegExp); - - BabelRegExp.prototype.exec = function (str) { - var result = _super.exec.call(this, str); - - if (result) result.groups = buildGroups(result, this); - return result; - }; - - BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { - if (typeof substitution === "string") { - var groups = _groups.get(this); - - return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { - return "$" + groups[name]; - })); - } else if (typeof substitution === "function") { - var _this = this; - - return _super[Symbol.replace].call(this, str, function () { - var args = arguments; - - if (_typeof(args[args.length - 1]) !== "object") { - args = [].slice.call(args); - args.push(buildGroups(args, _this)); - } - - return substitution.apply(this, args); - }); - } else { - return _super[Symbol.replace].call(this, str, substitution); - } - }; - - function buildGroups(result, re) { - var g = _groups.get(re); - - return Object.keys(g).reduce(function (groups, name) { - groups[name] = result[g[name]]; - return groups; - }, Object.create(null)); - } - - return _wrapRegExp.apply(this, arguments); -} - -module.exports = _wrapRegExp; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/writeOnlyError.js b/node_modules/@babel/runtime/helpers/writeOnlyError.js deleted file mode 100644 index 6751a74..0000000 --- a/node_modules/@babel/runtime/helpers/writeOnlyError.js +++ /dev/null @@ -1,6 +0,0 @@ -function _writeOnlyError(name) { - throw new TypeError("\"" + name + "\" is write-only"); -} - -module.exports = _writeOnlyError; -module.exports["default"] = module.exports, module.exports.__esModule = true; \ No newline at end of file diff --git a/node_modules/@babel/runtime/package.json b/node_modules/@babel/runtime/package.json deleted file mode 100644 index 8433f5a..0000000 --- a/node_modules/@babel/runtime/package.json +++ /dev/null @@ -1,861 +0,0 @@ -{ - "_from": "@babel/runtime@^7.12.5", - "_id": "@babel/runtime@7.14.6", - "_inBundle": false, - "_integrity": "sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==", - "_location": "/@babel/runtime", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@babel/runtime@^7.12.5", - "name": "@babel/runtime", - "escapedName": "@babel%2fruntime", - "scope": "@babel", - "rawSpec": "^7.12.5", - "saveSpec": null, - "fetchSpec": "^7.12.5" - }, - "_requiredBy": [ - "/@videojs/http-streaming", - "/@videojs/vhs-utils", - "/@videojs/xhr", - "/aes-decrypter", - "/m3u8-parser", - "/mpd-parser", - "/mux.js", - "/pkcs7", - "/video.js" - ], - "_resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.6.tgz", - "_shasum": "535203bc0892efc7dec60bdc27b2ecf6e409062d", - "_spec": "@babel/runtime@^7.12.5", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js", - "author": { - "name": "The Babel Team", - "url": "https://babel.dev/team" - }, - "bugs": { - "url": "https://github.com/babel/babel/issues" - }, - "bundleDependencies": false, - "dependencies": { - "regenerator-runtime": "^0.13.4" - }, - "deprecated": false, - "description": "babel's modular runtime helpers", - "engines": { - "node": ">=6.9.0" - }, - "exports": { - "./helpers/jsx": [ - { - "node": "./helpers/jsx.js", - "import": "./helpers/esm/jsx.js", - "default": "./helpers/jsx.js" - }, - "./helpers/jsx.js" - ], - "./helpers/esm/jsx": "./helpers/esm/jsx.js", - "./helpers/objectSpread2": [ - { - "node": "./helpers/objectSpread2.js", - "import": "./helpers/esm/objectSpread2.js", - "default": "./helpers/objectSpread2.js" - }, - "./helpers/objectSpread2.js" - ], - "./helpers/esm/objectSpread2": "./helpers/esm/objectSpread2.js", - "./helpers/typeof": [ - { - "node": "./helpers/typeof.js", - "import": "./helpers/esm/typeof.js", - "default": "./helpers/typeof.js" - }, - "./helpers/typeof.js" - ], - "./helpers/esm/typeof": "./helpers/esm/typeof.js", - "./helpers/wrapRegExp": [ - { - "node": "./helpers/wrapRegExp.js", - "import": "./helpers/esm/wrapRegExp.js", - "default": "./helpers/wrapRegExp.js" - }, - "./helpers/wrapRegExp.js" - ], - "./helpers/esm/wrapRegExp": "./helpers/esm/wrapRegExp.js", - "./helpers/asyncIterator": [ - { - "node": "./helpers/asyncIterator.js", - "import": "./helpers/esm/asyncIterator.js", - "default": "./helpers/asyncIterator.js" - }, - "./helpers/asyncIterator.js" - ], - "./helpers/esm/asyncIterator": "./helpers/esm/asyncIterator.js", - "./helpers/AwaitValue": [ - { - "node": "./helpers/AwaitValue.js", - "import": "./helpers/esm/AwaitValue.js", - "default": "./helpers/AwaitValue.js" - }, - "./helpers/AwaitValue.js" - ], - "./helpers/esm/AwaitValue": "./helpers/esm/AwaitValue.js", - "./helpers/AsyncGenerator": [ - { - "node": "./helpers/AsyncGenerator.js", - "import": "./helpers/esm/AsyncGenerator.js", - "default": "./helpers/AsyncGenerator.js" - }, - "./helpers/AsyncGenerator.js" - ], - "./helpers/esm/AsyncGenerator": "./helpers/esm/AsyncGenerator.js", - "./helpers/wrapAsyncGenerator": [ - { - "node": "./helpers/wrapAsyncGenerator.js", - "import": "./helpers/esm/wrapAsyncGenerator.js", - "default": "./helpers/wrapAsyncGenerator.js" - }, - "./helpers/wrapAsyncGenerator.js" - ], - "./helpers/esm/wrapAsyncGenerator": "./helpers/esm/wrapAsyncGenerator.js", - "./helpers/awaitAsyncGenerator": [ - { - "node": "./helpers/awaitAsyncGenerator.js", - "import": "./helpers/esm/awaitAsyncGenerator.js", - "default": "./helpers/awaitAsyncGenerator.js" - }, - "./helpers/awaitAsyncGenerator.js" - ], - "./helpers/esm/awaitAsyncGenerator": "./helpers/esm/awaitAsyncGenerator.js", - "./helpers/asyncGeneratorDelegate": [ - { - "node": "./helpers/asyncGeneratorDelegate.js", - "import": "./helpers/esm/asyncGeneratorDelegate.js", - "default": "./helpers/asyncGeneratorDelegate.js" - }, - "./helpers/asyncGeneratorDelegate.js" - ], - "./helpers/esm/asyncGeneratorDelegate": "./helpers/esm/asyncGeneratorDelegate.js", - "./helpers/asyncToGenerator": [ - { - "node": "./helpers/asyncToGenerator.js", - "import": "./helpers/esm/asyncToGenerator.js", - "default": "./helpers/asyncToGenerator.js" - }, - "./helpers/asyncToGenerator.js" - ], - "./helpers/esm/asyncToGenerator": "./helpers/esm/asyncToGenerator.js", - "./helpers/classCallCheck": [ - { - "node": "./helpers/classCallCheck.js", - "import": "./helpers/esm/classCallCheck.js", - "default": "./helpers/classCallCheck.js" - }, - "./helpers/classCallCheck.js" - ], - "./helpers/esm/classCallCheck": "./helpers/esm/classCallCheck.js", - "./helpers/createClass": [ - { - "node": "./helpers/createClass.js", - "import": "./helpers/esm/createClass.js", - "default": "./helpers/createClass.js" - }, - "./helpers/createClass.js" - ], - "./helpers/esm/createClass": "./helpers/esm/createClass.js", - "./helpers/defineEnumerableProperties": [ - { - "node": "./helpers/defineEnumerableProperties.js", - "import": "./helpers/esm/defineEnumerableProperties.js", - "default": "./helpers/defineEnumerableProperties.js" - }, - "./helpers/defineEnumerableProperties.js" - ], - "./helpers/esm/defineEnumerableProperties": "./helpers/esm/defineEnumerableProperties.js", - "./helpers/defaults": [ - { - "node": "./helpers/defaults.js", - "import": "./helpers/esm/defaults.js", - "default": "./helpers/defaults.js" - }, - "./helpers/defaults.js" - ], - "./helpers/esm/defaults": "./helpers/esm/defaults.js", - "./helpers/defineProperty": [ - { - "node": "./helpers/defineProperty.js", - "import": "./helpers/esm/defineProperty.js", - "default": "./helpers/defineProperty.js" - }, - "./helpers/defineProperty.js" - ], - "./helpers/esm/defineProperty": "./helpers/esm/defineProperty.js", - "./helpers/extends": [ - { - "node": "./helpers/extends.js", - "import": "./helpers/esm/extends.js", - "default": "./helpers/extends.js" - }, - "./helpers/extends.js" - ], - "./helpers/esm/extends": "./helpers/esm/extends.js", - "./helpers/objectSpread": [ - { - "node": "./helpers/objectSpread.js", - "import": "./helpers/esm/objectSpread.js", - "default": "./helpers/objectSpread.js" - }, - "./helpers/objectSpread.js" - ], - "./helpers/esm/objectSpread": "./helpers/esm/objectSpread.js", - "./helpers/inherits": [ - { - "node": "./helpers/inherits.js", - "import": "./helpers/esm/inherits.js", - "default": "./helpers/inherits.js" - }, - "./helpers/inherits.js" - ], - "./helpers/esm/inherits": "./helpers/esm/inherits.js", - "./helpers/inheritsLoose": [ - { - "node": "./helpers/inheritsLoose.js", - "import": "./helpers/esm/inheritsLoose.js", - "default": "./helpers/inheritsLoose.js" - }, - "./helpers/inheritsLoose.js" - ], - "./helpers/esm/inheritsLoose": "./helpers/esm/inheritsLoose.js", - "./helpers/getPrototypeOf": [ - { - "node": "./helpers/getPrototypeOf.js", - "import": "./helpers/esm/getPrototypeOf.js", - "default": "./helpers/getPrototypeOf.js" - }, - "./helpers/getPrototypeOf.js" - ], - "./helpers/esm/getPrototypeOf": "./helpers/esm/getPrototypeOf.js", - "./helpers/setPrototypeOf": [ - { - "node": "./helpers/setPrototypeOf.js", - "import": "./helpers/esm/setPrototypeOf.js", - "default": "./helpers/setPrototypeOf.js" - }, - "./helpers/setPrototypeOf.js" - ], - "./helpers/esm/setPrototypeOf": "./helpers/esm/setPrototypeOf.js", - "./helpers/isNativeReflectConstruct": [ - { - "node": "./helpers/isNativeReflectConstruct.js", - "import": "./helpers/esm/isNativeReflectConstruct.js", - "default": "./helpers/isNativeReflectConstruct.js" - }, - "./helpers/isNativeReflectConstruct.js" - ], - "./helpers/esm/isNativeReflectConstruct": "./helpers/esm/isNativeReflectConstruct.js", - "./helpers/construct": [ - { - "node": "./helpers/construct.js", - "import": "./helpers/esm/construct.js", - "default": "./helpers/construct.js" - }, - "./helpers/construct.js" - ], - "./helpers/esm/construct": "./helpers/esm/construct.js", - "./helpers/isNativeFunction": [ - { - "node": "./helpers/isNativeFunction.js", - "import": "./helpers/esm/isNativeFunction.js", - "default": "./helpers/isNativeFunction.js" - }, - "./helpers/isNativeFunction.js" - ], - "./helpers/esm/isNativeFunction": "./helpers/esm/isNativeFunction.js", - "./helpers/wrapNativeSuper": [ - { - "node": "./helpers/wrapNativeSuper.js", - "import": "./helpers/esm/wrapNativeSuper.js", - "default": "./helpers/wrapNativeSuper.js" - }, - "./helpers/wrapNativeSuper.js" - ], - "./helpers/esm/wrapNativeSuper": "./helpers/esm/wrapNativeSuper.js", - "./helpers/instanceof": [ - { - "node": "./helpers/instanceof.js", - "import": "./helpers/esm/instanceof.js", - "default": "./helpers/instanceof.js" - }, - "./helpers/instanceof.js" - ], - "./helpers/esm/instanceof": "./helpers/esm/instanceof.js", - "./helpers/interopRequireDefault": [ - { - "node": "./helpers/interopRequireDefault.js", - "import": "./helpers/esm/interopRequireDefault.js", - "default": "./helpers/interopRequireDefault.js" - }, - "./helpers/interopRequireDefault.js" - ], - "./helpers/esm/interopRequireDefault": "./helpers/esm/interopRequireDefault.js", - "./helpers/interopRequireWildcard": [ - { - "node": "./helpers/interopRequireWildcard.js", - "import": "./helpers/esm/interopRequireWildcard.js", - "default": "./helpers/interopRequireWildcard.js" - }, - "./helpers/interopRequireWildcard.js" - ], - "./helpers/esm/interopRequireWildcard": "./helpers/esm/interopRequireWildcard.js", - "./helpers/newArrowCheck": [ - { - "node": "./helpers/newArrowCheck.js", - "import": "./helpers/esm/newArrowCheck.js", - "default": "./helpers/newArrowCheck.js" - }, - "./helpers/newArrowCheck.js" - ], - "./helpers/esm/newArrowCheck": "./helpers/esm/newArrowCheck.js", - "./helpers/objectDestructuringEmpty": [ - { - "node": "./helpers/objectDestructuringEmpty.js", - "import": "./helpers/esm/objectDestructuringEmpty.js", - "default": "./helpers/objectDestructuringEmpty.js" - }, - "./helpers/objectDestructuringEmpty.js" - ], - "./helpers/esm/objectDestructuringEmpty": "./helpers/esm/objectDestructuringEmpty.js", - "./helpers/objectWithoutPropertiesLoose": [ - { - "node": "./helpers/objectWithoutPropertiesLoose.js", - "import": "./helpers/esm/objectWithoutPropertiesLoose.js", - "default": "./helpers/objectWithoutPropertiesLoose.js" - }, - "./helpers/objectWithoutPropertiesLoose.js" - ], - "./helpers/esm/objectWithoutPropertiesLoose": "./helpers/esm/objectWithoutPropertiesLoose.js", - "./helpers/objectWithoutProperties": [ - { - "node": "./helpers/objectWithoutProperties.js", - "import": "./helpers/esm/objectWithoutProperties.js", - "default": "./helpers/objectWithoutProperties.js" - }, - "./helpers/objectWithoutProperties.js" - ], - "./helpers/esm/objectWithoutProperties": "./helpers/esm/objectWithoutProperties.js", - "./helpers/assertThisInitialized": [ - { - "node": "./helpers/assertThisInitialized.js", - "import": "./helpers/esm/assertThisInitialized.js", - "default": "./helpers/assertThisInitialized.js" - }, - "./helpers/assertThisInitialized.js" - ], - "./helpers/esm/assertThisInitialized": "./helpers/esm/assertThisInitialized.js", - "./helpers/possibleConstructorReturn": [ - { - "node": "./helpers/possibleConstructorReturn.js", - "import": "./helpers/esm/possibleConstructorReturn.js", - "default": "./helpers/possibleConstructorReturn.js" - }, - "./helpers/possibleConstructorReturn.js" - ], - "./helpers/esm/possibleConstructorReturn": "./helpers/esm/possibleConstructorReturn.js", - "./helpers/createSuper": [ - { - "node": "./helpers/createSuper.js", - "import": "./helpers/esm/createSuper.js", - "default": "./helpers/createSuper.js" - }, - "./helpers/createSuper.js" - ], - "./helpers/esm/createSuper": "./helpers/esm/createSuper.js", - "./helpers/superPropBase": [ - { - "node": "./helpers/superPropBase.js", - "import": "./helpers/esm/superPropBase.js", - "default": "./helpers/superPropBase.js" - }, - "./helpers/superPropBase.js" - ], - "./helpers/esm/superPropBase": "./helpers/esm/superPropBase.js", - "./helpers/get": [ - { - "node": "./helpers/get.js", - "import": "./helpers/esm/get.js", - "default": "./helpers/get.js" - }, - "./helpers/get.js" - ], - "./helpers/esm/get": "./helpers/esm/get.js", - "./helpers/set": [ - { - "node": "./helpers/set.js", - "import": "./helpers/esm/set.js", - "default": "./helpers/set.js" - }, - "./helpers/set.js" - ], - "./helpers/esm/set": "./helpers/esm/set.js", - "./helpers/taggedTemplateLiteral": [ - { - "node": "./helpers/taggedTemplateLiteral.js", - "import": "./helpers/esm/taggedTemplateLiteral.js", - "default": "./helpers/taggedTemplateLiteral.js" - }, - "./helpers/taggedTemplateLiteral.js" - ], - "./helpers/esm/taggedTemplateLiteral": "./helpers/esm/taggedTemplateLiteral.js", - "./helpers/taggedTemplateLiteralLoose": [ - { - "node": "./helpers/taggedTemplateLiteralLoose.js", - "import": "./helpers/esm/taggedTemplateLiteralLoose.js", - "default": "./helpers/taggedTemplateLiteralLoose.js" - }, - "./helpers/taggedTemplateLiteralLoose.js" - ], - "./helpers/esm/taggedTemplateLiteralLoose": "./helpers/esm/taggedTemplateLiteralLoose.js", - "./helpers/readOnlyError": [ - { - "node": "./helpers/readOnlyError.js", - "import": "./helpers/esm/readOnlyError.js", - "default": "./helpers/readOnlyError.js" - }, - "./helpers/readOnlyError.js" - ], - "./helpers/esm/readOnlyError": "./helpers/esm/readOnlyError.js", - "./helpers/writeOnlyError": [ - { - "node": "./helpers/writeOnlyError.js", - "import": "./helpers/esm/writeOnlyError.js", - "default": "./helpers/writeOnlyError.js" - }, - "./helpers/writeOnlyError.js" - ], - "./helpers/esm/writeOnlyError": "./helpers/esm/writeOnlyError.js", - "./helpers/classNameTDZError": [ - { - "node": "./helpers/classNameTDZError.js", - "import": "./helpers/esm/classNameTDZError.js", - "default": "./helpers/classNameTDZError.js" - }, - "./helpers/classNameTDZError.js" - ], - "./helpers/esm/classNameTDZError": "./helpers/esm/classNameTDZError.js", - "./helpers/temporalUndefined": [ - { - "node": "./helpers/temporalUndefined.js", - "import": "./helpers/esm/temporalUndefined.js", - "default": "./helpers/temporalUndefined.js" - }, - "./helpers/temporalUndefined.js" - ], - "./helpers/esm/temporalUndefined": "./helpers/esm/temporalUndefined.js", - "./helpers/tdz": [ - { - "node": "./helpers/tdz.js", - "import": "./helpers/esm/tdz.js", - "default": "./helpers/tdz.js" - }, - "./helpers/tdz.js" - ], - "./helpers/esm/tdz": "./helpers/esm/tdz.js", - "./helpers/temporalRef": [ - { - "node": "./helpers/temporalRef.js", - "import": "./helpers/esm/temporalRef.js", - "default": "./helpers/temporalRef.js" - }, - "./helpers/temporalRef.js" - ], - "./helpers/esm/temporalRef": "./helpers/esm/temporalRef.js", - "./helpers/slicedToArray": [ - { - "node": "./helpers/slicedToArray.js", - "import": "./helpers/esm/slicedToArray.js", - "default": "./helpers/slicedToArray.js" - }, - "./helpers/slicedToArray.js" - ], - "./helpers/esm/slicedToArray": "./helpers/esm/slicedToArray.js", - "./helpers/slicedToArrayLoose": [ - { - "node": "./helpers/slicedToArrayLoose.js", - "import": "./helpers/esm/slicedToArrayLoose.js", - "default": "./helpers/slicedToArrayLoose.js" - }, - "./helpers/slicedToArrayLoose.js" - ], - "./helpers/esm/slicedToArrayLoose": "./helpers/esm/slicedToArrayLoose.js", - "./helpers/toArray": [ - { - "node": "./helpers/toArray.js", - "import": "./helpers/esm/toArray.js", - "default": "./helpers/toArray.js" - }, - "./helpers/toArray.js" - ], - "./helpers/esm/toArray": "./helpers/esm/toArray.js", - "./helpers/toConsumableArray": [ - { - "node": "./helpers/toConsumableArray.js", - "import": "./helpers/esm/toConsumableArray.js", - "default": "./helpers/toConsumableArray.js" - }, - "./helpers/toConsumableArray.js" - ], - "./helpers/esm/toConsumableArray": "./helpers/esm/toConsumableArray.js", - "./helpers/arrayWithoutHoles": [ - { - "node": "./helpers/arrayWithoutHoles.js", - "import": "./helpers/esm/arrayWithoutHoles.js", - "default": "./helpers/arrayWithoutHoles.js" - }, - "./helpers/arrayWithoutHoles.js" - ], - "./helpers/esm/arrayWithoutHoles": "./helpers/esm/arrayWithoutHoles.js", - "./helpers/arrayWithHoles": [ - { - "node": "./helpers/arrayWithHoles.js", - "import": "./helpers/esm/arrayWithHoles.js", - "default": "./helpers/arrayWithHoles.js" - }, - "./helpers/arrayWithHoles.js" - ], - "./helpers/esm/arrayWithHoles": "./helpers/esm/arrayWithHoles.js", - "./helpers/maybeArrayLike": [ - { - "node": "./helpers/maybeArrayLike.js", - "import": "./helpers/esm/maybeArrayLike.js", - "default": "./helpers/maybeArrayLike.js" - }, - "./helpers/maybeArrayLike.js" - ], - "./helpers/esm/maybeArrayLike": "./helpers/esm/maybeArrayLike.js", - "./helpers/iterableToArray": [ - { - "node": "./helpers/iterableToArray.js", - "import": "./helpers/esm/iterableToArray.js", - "default": "./helpers/iterableToArray.js" - }, - "./helpers/iterableToArray.js" - ], - "./helpers/esm/iterableToArray": "./helpers/esm/iterableToArray.js", - "./helpers/iterableToArrayLimit": [ - { - "node": "./helpers/iterableToArrayLimit.js", - "import": "./helpers/esm/iterableToArrayLimit.js", - "default": "./helpers/iterableToArrayLimit.js" - }, - "./helpers/iterableToArrayLimit.js" - ], - "./helpers/esm/iterableToArrayLimit": "./helpers/esm/iterableToArrayLimit.js", - "./helpers/iterableToArrayLimitLoose": [ - { - "node": "./helpers/iterableToArrayLimitLoose.js", - "import": "./helpers/esm/iterableToArrayLimitLoose.js", - "default": "./helpers/iterableToArrayLimitLoose.js" - }, - "./helpers/iterableToArrayLimitLoose.js" - ], - "./helpers/esm/iterableToArrayLimitLoose": "./helpers/esm/iterableToArrayLimitLoose.js", - "./helpers/unsupportedIterableToArray": [ - { - "node": "./helpers/unsupportedIterableToArray.js", - "import": "./helpers/esm/unsupportedIterableToArray.js", - "default": "./helpers/unsupportedIterableToArray.js" - }, - "./helpers/unsupportedIterableToArray.js" - ], - "./helpers/esm/unsupportedIterableToArray": "./helpers/esm/unsupportedIterableToArray.js", - "./helpers/arrayLikeToArray": [ - { - "node": "./helpers/arrayLikeToArray.js", - "import": "./helpers/esm/arrayLikeToArray.js", - "default": "./helpers/arrayLikeToArray.js" - }, - "./helpers/arrayLikeToArray.js" - ], - "./helpers/esm/arrayLikeToArray": "./helpers/esm/arrayLikeToArray.js", - "./helpers/nonIterableSpread": [ - { - "node": "./helpers/nonIterableSpread.js", - "import": "./helpers/esm/nonIterableSpread.js", - "default": "./helpers/nonIterableSpread.js" - }, - "./helpers/nonIterableSpread.js" - ], - "./helpers/esm/nonIterableSpread": "./helpers/esm/nonIterableSpread.js", - "./helpers/nonIterableRest": [ - { - "node": "./helpers/nonIterableRest.js", - "import": "./helpers/esm/nonIterableRest.js", - "default": "./helpers/nonIterableRest.js" - }, - "./helpers/nonIterableRest.js" - ], - "./helpers/esm/nonIterableRest": "./helpers/esm/nonIterableRest.js", - "./helpers/createForOfIteratorHelper": [ - { - "node": "./helpers/createForOfIteratorHelper.js", - "import": "./helpers/esm/createForOfIteratorHelper.js", - "default": "./helpers/createForOfIteratorHelper.js" - }, - "./helpers/createForOfIteratorHelper.js" - ], - "./helpers/esm/createForOfIteratorHelper": "./helpers/esm/createForOfIteratorHelper.js", - "./helpers/createForOfIteratorHelperLoose": [ - { - "node": "./helpers/createForOfIteratorHelperLoose.js", - "import": "./helpers/esm/createForOfIteratorHelperLoose.js", - "default": "./helpers/createForOfIteratorHelperLoose.js" - }, - "./helpers/createForOfIteratorHelperLoose.js" - ], - "./helpers/esm/createForOfIteratorHelperLoose": "./helpers/esm/createForOfIteratorHelperLoose.js", - "./helpers/skipFirstGeneratorNext": [ - { - "node": "./helpers/skipFirstGeneratorNext.js", - "import": "./helpers/esm/skipFirstGeneratorNext.js", - "default": "./helpers/skipFirstGeneratorNext.js" - }, - "./helpers/skipFirstGeneratorNext.js" - ], - "./helpers/esm/skipFirstGeneratorNext": "./helpers/esm/skipFirstGeneratorNext.js", - "./helpers/toPrimitive": [ - { - "node": "./helpers/toPrimitive.js", - "import": "./helpers/esm/toPrimitive.js", - "default": "./helpers/toPrimitive.js" - }, - "./helpers/toPrimitive.js" - ], - "./helpers/esm/toPrimitive": "./helpers/esm/toPrimitive.js", - "./helpers/toPropertyKey": [ - { - "node": "./helpers/toPropertyKey.js", - "import": "./helpers/esm/toPropertyKey.js", - "default": "./helpers/toPropertyKey.js" - }, - "./helpers/toPropertyKey.js" - ], - "./helpers/esm/toPropertyKey": "./helpers/esm/toPropertyKey.js", - "./helpers/initializerWarningHelper": [ - { - "node": "./helpers/initializerWarningHelper.js", - "import": "./helpers/esm/initializerWarningHelper.js", - "default": "./helpers/initializerWarningHelper.js" - }, - "./helpers/initializerWarningHelper.js" - ], - "./helpers/esm/initializerWarningHelper": "./helpers/esm/initializerWarningHelper.js", - "./helpers/initializerDefineProperty": [ - { - "node": "./helpers/initializerDefineProperty.js", - "import": "./helpers/esm/initializerDefineProperty.js", - "default": "./helpers/initializerDefineProperty.js" - }, - "./helpers/initializerDefineProperty.js" - ], - "./helpers/esm/initializerDefineProperty": "./helpers/esm/initializerDefineProperty.js", - "./helpers/applyDecoratedDescriptor": [ - { - "node": "./helpers/applyDecoratedDescriptor.js", - "import": "./helpers/esm/applyDecoratedDescriptor.js", - "default": "./helpers/applyDecoratedDescriptor.js" - }, - "./helpers/applyDecoratedDescriptor.js" - ], - "./helpers/esm/applyDecoratedDescriptor": "./helpers/esm/applyDecoratedDescriptor.js", - "./helpers/classPrivateFieldLooseKey": [ - { - "node": "./helpers/classPrivateFieldLooseKey.js", - "import": "./helpers/esm/classPrivateFieldLooseKey.js", - "default": "./helpers/classPrivateFieldLooseKey.js" - }, - "./helpers/classPrivateFieldLooseKey.js" - ], - "./helpers/esm/classPrivateFieldLooseKey": "./helpers/esm/classPrivateFieldLooseKey.js", - "./helpers/classPrivateFieldLooseBase": [ - { - "node": "./helpers/classPrivateFieldLooseBase.js", - "import": "./helpers/esm/classPrivateFieldLooseBase.js", - "default": "./helpers/classPrivateFieldLooseBase.js" - }, - "./helpers/classPrivateFieldLooseBase.js" - ], - "./helpers/esm/classPrivateFieldLooseBase": "./helpers/esm/classPrivateFieldLooseBase.js", - "./helpers/classPrivateFieldGet": [ - { - "node": "./helpers/classPrivateFieldGet.js", - "import": "./helpers/esm/classPrivateFieldGet.js", - "default": "./helpers/classPrivateFieldGet.js" - }, - "./helpers/classPrivateFieldGet.js" - ], - "./helpers/esm/classPrivateFieldGet": "./helpers/esm/classPrivateFieldGet.js", - "./helpers/classPrivateFieldSet": [ - { - "node": "./helpers/classPrivateFieldSet.js", - "import": "./helpers/esm/classPrivateFieldSet.js", - "default": "./helpers/classPrivateFieldSet.js" - }, - "./helpers/classPrivateFieldSet.js" - ], - "./helpers/esm/classPrivateFieldSet": "./helpers/esm/classPrivateFieldSet.js", - "./helpers/classPrivateFieldDestructureSet": [ - { - "node": "./helpers/classPrivateFieldDestructureSet.js", - "import": "./helpers/esm/classPrivateFieldDestructureSet.js", - "default": "./helpers/classPrivateFieldDestructureSet.js" - }, - "./helpers/classPrivateFieldDestructureSet.js" - ], - "./helpers/esm/classPrivateFieldDestructureSet": "./helpers/esm/classPrivateFieldDestructureSet.js", - "./helpers/classExtractFieldDescriptor": [ - { - "node": "./helpers/classExtractFieldDescriptor.js", - "import": "./helpers/esm/classExtractFieldDescriptor.js", - "default": "./helpers/classExtractFieldDescriptor.js" - }, - "./helpers/classExtractFieldDescriptor.js" - ], - "./helpers/esm/classExtractFieldDescriptor": "./helpers/esm/classExtractFieldDescriptor.js", - "./helpers/classStaticPrivateFieldSpecGet": [ - { - "node": "./helpers/classStaticPrivateFieldSpecGet.js", - "import": "./helpers/esm/classStaticPrivateFieldSpecGet.js", - "default": "./helpers/classStaticPrivateFieldSpecGet.js" - }, - "./helpers/classStaticPrivateFieldSpecGet.js" - ], - "./helpers/esm/classStaticPrivateFieldSpecGet": "./helpers/esm/classStaticPrivateFieldSpecGet.js", - "./helpers/classStaticPrivateFieldSpecSet": [ - { - "node": "./helpers/classStaticPrivateFieldSpecSet.js", - "import": "./helpers/esm/classStaticPrivateFieldSpecSet.js", - "default": "./helpers/classStaticPrivateFieldSpecSet.js" - }, - "./helpers/classStaticPrivateFieldSpecSet.js" - ], - "./helpers/esm/classStaticPrivateFieldSpecSet": "./helpers/esm/classStaticPrivateFieldSpecSet.js", - "./helpers/classStaticPrivateMethodGet": [ - { - "node": "./helpers/classStaticPrivateMethodGet.js", - "import": "./helpers/esm/classStaticPrivateMethodGet.js", - "default": "./helpers/classStaticPrivateMethodGet.js" - }, - "./helpers/classStaticPrivateMethodGet.js" - ], - "./helpers/esm/classStaticPrivateMethodGet": "./helpers/esm/classStaticPrivateMethodGet.js", - "./helpers/classStaticPrivateMethodSet": [ - { - "node": "./helpers/classStaticPrivateMethodSet.js", - "import": "./helpers/esm/classStaticPrivateMethodSet.js", - "default": "./helpers/classStaticPrivateMethodSet.js" - }, - "./helpers/classStaticPrivateMethodSet.js" - ], - "./helpers/esm/classStaticPrivateMethodSet": "./helpers/esm/classStaticPrivateMethodSet.js", - "./helpers/classApplyDescriptorGet": [ - { - "node": "./helpers/classApplyDescriptorGet.js", - "import": "./helpers/esm/classApplyDescriptorGet.js", - "default": "./helpers/classApplyDescriptorGet.js" - }, - "./helpers/classApplyDescriptorGet.js" - ], - "./helpers/esm/classApplyDescriptorGet": "./helpers/esm/classApplyDescriptorGet.js", - "./helpers/classApplyDescriptorSet": [ - { - "node": "./helpers/classApplyDescriptorSet.js", - "import": "./helpers/esm/classApplyDescriptorSet.js", - "default": "./helpers/classApplyDescriptorSet.js" - }, - "./helpers/classApplyDescriptorSet.js" - ], - "./helpers/esm/classApplyDescriptorSet": "./helpers/esm/classApplyDescriptorSet.js", - "./helpers/classApplyDescriptorDestructureSet": [ - { - "node": "./helpers/classApplyDescriptorDestructureSet.js", - "import": "./helpers/esm/classApplyDescriptorDestructureSet.js", - "default": "./helpers/classApplyDescriptorDestructureSet.js" - }, - "./helpers/classApplyDescriptorDestructureSet.js" - ], - "./helpers/esm/classApplyDescriptorDestructureSet": "./helpers/esm/classApplyDescriptorDestructureSet.js", - "./helpers/classStaticPrivateFieldDestructureSet": [ - { - "node": "./helpers/classStaticPrivateFieldDestructureSet.js", - "import": "./helpers/esm/classStaticPrivateFieldDestructureSet.js", - "default": "./helpers/classStaticPrivateFieldDestructureSet.js" - }, - "./helpers/classStaticPrivateFieldDestructureSet.js" - ], - "./helpers/esm/classStaticPrivateFieldDestructureSet": "./helpers/esm/classStaticPrivateFieldDestructureSet.js", - "./helpers/classCheckPrivateStaticAccess": [ - { - "node": "./helpers/classCheckPrivateStaticAccess.js", - "import": "./helpers/esm/classCheckPrivateStaticAccess.js", - "default": "./helpers/classCheckPrivateStaticAccess.js" - }, - "./helpers/classCheckPrivateStaticAccess.js" - ], - "./helpers/esm/classCheckPrivateStaticAccess": "./helpers/esm/classCheckPrivateStaticAccess.js", - "./helpers/classCheckPrivateStaticFieldDescriptor": [ - { - "node": "./helpers/classCheckPrivateStaticFieldDescriptor.js", - "import": "./helpers/esm/classCheckPrivateStaticFieldDescriptor.js", - "default": "./helpers/classCheckPrivateStaticFieldDescriptor.js" - }, - "./helpers/classCheckPrivateStaticFieldDescriptor.js" - ], - "./helpers/esm/classCheckPrivateStaticFieldDescriptor": "./helpers/esm/classCheckPrivateStaticFieldDescriptor.js", - "./helpers/decorate": [ - { - "node": "./helpers/decorate.js", - "import": "./helpers/esm/decorate.js", - "default": "./helpers/decorate.js" - }, - "./helpers/decorate.js" - ], - "./helpers/esm/decorate": "./helpers/esm/decorate.js", - "./helpers/classPrivateMethodGet": [ - { - "node": "./helpers/classPrivateMethodGet.js", - "import": "./helpers/esm/classPrivateMethodGet.js", - "default": "./helpers/classPrivateMethodGet.js" - }, - "./helpers/classPrivateMethodGet.js" - ], - "./helpers/esm/classPrivateMethodGet": "./helpers/esm/classPrivateMethodGet.js", - "./helpers/classPrivateMethodSet": [ - { - "node": "./helpers/classPrivateMethodSet.js", - "import": "./helpers/esm/classPrivateMethodSet.js", - "default": "./helpers/classPrivateMethodSet.js" - }, - "./helpers/classPrivateMethodSet.js" - ], - "./helpers/esm/classPrivateMethodSet": "./helpers/esm/classPrivateMethodSet.js", - "./package": "./package.json", - "./package.json": "./package.json", - "./regenerator": "./regenerator/index.js", - "./regenerator/*.js": "./regenerator/*.js", - "./regenerator/": "./regenerator/" - }, - "homepage": "https://babel.dev/docs/en/next/babel-runtime", - "license": "MIT", - "name": "@babel/runtime", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/babel/babel.git", - "directory": "packages/babel-runtime" - }, - "version": "7.14.6" -} diff --git a/node_modules/@babel/runtime/regenerator/index.js b/node_modules/@babel/runtime/regenerator/index.js deleted file mode 100644 index 9fd4158..0000000 --- a/node_modules/@babel/runtime/regenerator/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("regenerator-runtime"); diff --git a/node_modules/@videojs/http-streaming/CHANGELOG.md b/node_modules/@videojs/http-streaming/CHANGELOG.md deleted file mode 100644 index 8de917b..0000000 --- a/node_modules/@videojs/http-streaming/CHANGELOG.md +++ /dev/null @@ -1,782 +0,0 @@ - -## [2.9.1](https://github.com/videojs/http-streaming/compare/v2.9.0...v2.9.1) (2021-06-22) - -### Bug Fixes - -* actually default maxPlaylistRetries to Infinity ([#1142](https://github.com/videojs/http-streaming/issues/1142)) ([4428e3a](https://github.com/videojs/http-streaming/commit/4428e3a)), closes [#1098](https://github.com/videojs/http-streaming/issues/1098) -* don't decay average bandwidth value if system bandwidth did not change ([#1137](https://github.com/videojs/http-streaming/issues/1137)) ([c22749b](https://github.com/videojs/http-streaming/commit/c22749b)) -* ts segments that don't define all streams in the first pmt ([#1144](https://github.com/videojs/http-streaming/issues/1144)) ([36a8be4](https://github.com/videojs/http-streaming/commit/36a8be4)) - -### Tests - -* moving average should not decay without new data ([#1141](https://github.com/videojs/http-streaming/issues/1141)) ([55726af](https://github.com/videojs/http-streaming/commit/55726af)), closes [#1137](https://github.com/videojs/http-streaming/issues/1137) - - -# [2.9.0](https://github.com/videojs/http-streaming/compare/v2.8.2...v2.9.0) (2021-06-11) - -### Features - -* Add support for encrypted init segments ([#1132](https://github.com/videojs/http-streaming/issues/1132)) ([4449ed5](https://github.com/videojs/http-streaming/commit/4449ed5)) -* allow clients to limit the number of times a playlist attempts to reload following an error ([#1098](https://github.com/videojs/http-streaming/issues/1098)) ([44905d4](https://github.com/videojs/http-streaming/commit/44905d4)) -* Caption services (608/708) metadata ([#1138](https://github.com/videojs/http-streaming/issues/1138)) ([39782c6](https://github.com/videojs/http-streaming/commit/39782c6)), closes [/datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-08#section-4](https://github.com//datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-08/issues/section-4) [videojs/mpd-parser#131](https://github.com/videojs/mpd-parser/issues/131) -* do fast rendition changes on fullscreen changes and user actions ([#1074](https://github.com/videojs/http-streaming/issues/1074)) ([5405c18](https://github.com/videojs/http-streaming/commit/5405c18)) -* stats for timeToLoadedData, appendsToLoadedData, mainAppendsToLoadedData, audioAppendsToLoadedData, and mediaAppends ([#1106](https://github.com/videojs/http-streaming/issues/1106)) ([3124fbc](https://github.com/videojs/http-streaming/commit/3124fbc)) -* Use ll-hls query directives: segment skipping and requesting a specific segment/part ([#1079](https://github.com/videojs/http-streaming/issues/1079)) ([458be2c](https://github.com/videojs/http-streaming/commit/458be2c)) - -### Bug Fixes - -* add part level sync points, fix LL hls sync issues, add part timing info ([#1125](https://github.com/videojs/http-streaming/issues/1125)) ([ee5841d](https://github.com/videojs/http-streaming/commit/ee5841d)) -* Append valid syncRequests, better sync request choice, less getMediaInfoForTime rounding ([#1127](https://github.com/videojs/http-streaming/issues/1127)) ([ce03f66](https://github.com/videojs/http-streaming/commit/ce03f66)) - -### Chores - -* fix coverage ci run ([#1135](https://github.com/videojs/http-streaming/issues/1135)) ([82b6781](https://github.com/videojs/http-streaming/commit/82b6781)) - - -## [2.8.2](https://github.com/videojs/http-streaming/compare/v2.8.1...v2.8.2) (2021-05-20) - -### Bug Fixes - -* add tests for data uri, fix data uri in demo page ([#1133](https://github.com/videojs/http-streaming/issues/1133)) ([0be51eb](https://github.com/videojs/http-streaming/commit/0be51eb)) - - -## [2.8.1](https://github.com/videojs/http-streaming/compare/v2.8.0...v2.8.1) (2021-05-19) - -### Bug Fixes - -* add master referenced id/uri for audio playlists. Add playlists to hls media groups ([#1124](https://github.com/videojs/http-streaming/issues/1124)) ([740d2ee](https://github.com/videojs/http-streaming/commit/740d2ee)) -* m3u8-parser/eme updates ([#1131](https://github.com/videojs/http-streaming/issues/1131)) ([29ece75](https://github.com/videojs/http-streaming/commit/29ece75)) -* only append/request init segments when they change ([#1128](https://github.com/videojs/http-streaming/issues/1128)) ([a4af004](https://github.com/videojs/http-streaming/commit/a4af004)) -* set audio status on loaders when setting up media groups ([#1126](https://github.com/videojs/http-streaming/issues/1126)) ([a44f984](https://github.com/videojs/http-streaming/commit/a44f984)) - -### Chores - -* update vhs utils to 3.0.1 ([#1123](https://github.com/videojs/http-streaming/issues/1123)) ([552b012](https://github.com/videojs/http-streaming/commit/552b012)) - - -# [2.8.0](https://github.com/videojs/http-streaming/compare/v2.7.1...v2.8.0) (2021-04-28) - -### Features - -* add initialBandwidth option at the tech level ([#1122](https://github.com/videojs/http-streaming/issues/1122)) ([2071008](https://github.com/videojs/http-streaming/commit/2071008)) - -### Bug Fixes - -* don't clear DASH minimum update period timeout on pause of a media loader ([#1118](https://github.com/videojs/http-streaming/issues/1118)) ([82ff4f5](https://github.com/videojs/http-streaming/commit/82ff4f5)) -* null check sidx on sidxmapping, check that end > start on remove ([#1121](https://github.com/videojs/http-streaming/issues/1121)) ([92f1333](https://github.com/videojs/http-streaming/commit/92f1333)) - -### Code Refactoring - -* drop support for the partial muxer and handlePartial ([#1119](https://github.com/videojs/http-streaming/issues/1119)) ([ab305f8](https://github.com/videojs/http-streaming/commit/ab305f8)) -* offload mp4/ts probe to the web worker ([#1117](https://github.com/videojs/http-streaming/issues/1117)) ([3c9f721](https://github.com/videojs/http-streaming/commit/3c9f721)) -* segment/part choice and add more logging around the choice ([#1097](https://github.com/videojs/http-streaming/issues/1097)) ([b8a5aa5](https://github.com/videojs/http-streaming/commit/b8a5aa5)) - - -## [2.7.1](https://github.com/videojs/http-streaming/compare/v2.7.0...v2.7.1) (2021-04-09) - -### Bug Fixes - -* experimentalLLHLS option should always be passed ([#1114](https://github.com/videojs/http-streaming/issues/1114)) ([684fd08](https://github.com/videojs/http-streaming/commit/684fd08)) - -### Chores - -* dont run tests on chromium ([#1116](https://github.com/videojs/http-streaming/issues/1116)) ([c2154d7](https://github.com/videojs/http-streaming/commit/c2154d7)) - - -# [2.7.0](https://github.com/videojs/http-streaming/compare/v2.6.4...v2.7.0) (2021-04-06) - -### Features - -* Add EXT-X-PART support behind a flag for LL-HLS ([#1055](https://github.com/videojs/http-streaming/issues/1055)) ([b33e109](https://github.com/videojs/http-streaming/commit/b33e109)) -* mark Video.js as a peer dependency ([#1111](https://github.com/videojs/http-streaming/issues/1111)) ([99480d5](https://github.com/videojs/http-streaming/commit/99480d5)) -* support serverControl and preloadSegment behind experimentalLLHLS flag ([#1078](https://github.com/videojs/http-streaming/issues/1078)) ([fa1b6b5](https://github.com/videojs/http-streaming/commit/fa1b6b5)) -* usage and logging on rendition change with reasons ([#1088](https://github.com/videojs/http-streaming/issues/1088)) ([1b990f1](https://github.com/videojs/http-streaming/commit/1b990f1)) - -### Bug Fixes - -* audio only media group playlists, audio group playlists, and audio switches for audio only ([#1100](https://github.com/videojs/http-streaming/issues/1100)) ([6d83de3](https://github.com/videojs/http-streaming/commit/6d83de3)) -* better time to first frame for live playlists ([#1105](https://github.com/videojs/http-streaming/issues/1105)) ([1e94680](https://github.com/videojs/http-streaming/commit/1e94680)) -* catch remove errors, remove all data on QUOTA_EXCEEDED ([#1101](https://github.com/videojs/http-streaming/issues/1101)) ([86f77fe](https://github.com/videojs/http-streaming/commit/86f77fe)) -* Only add sidxMapping on successful sidx request and parse. ([#1099](https://github.com/videojs/http-streaming/issues/1099)) ([de0b55b](https://github.com/videojs/http-streaming/commit/de0b55b)), closes [#1107](https://github.com/videojs/http-streaming/issues/1107) -* support automatic configuration of audio and video only DRM sources ([#1090](https://github.com/videojs/http-streaming/issues/1090)) ([9b116ce](https://github.com/videojs/http-streaming/commit/9b116ce)) - -### Chores - -* never skip main ci runs ([#1108](https://github.com/videojs/http-streaming/issues/1108)) ([b2d2c91](https://github.com/videojs/http-streaming/commit/b2d2c91)) -* turn checkWatch back on for rollup ([87947fc](https://github.com/videojs/http-streaming/commit/87947fc)) -* update to mux.js[@5](https://github.com/5).11.0 ([#1109](https://github.com/videojs/http-streaming/issues/1109)) ([af5841c](https://github.com/videojs/http-streaming/commit/af5841c)) - - -## [2.6.4](https://github.com/videojs/http-streaming/compare/v2.6.3...v2.6.4) (2021-03-12) - -### Bug Fixes - -* Monitor playback for stalls due to gaps in the beginning of stream when a new source is loaded ([#1087](https://github.com/videojs/http-streaming/issues/1087)) ([64a1f35](https://github.com/videojs/http-streaming/commit/64a1f35)) -* retry appends on QUOTA_EXCEEDED_ERR ([#1093](https://github.com/videojs/http-streaming/issues/1093)) ([008aeaf](https://github.com/videojs/http-streaming/commit/008aeaf)) - -### Chores - -* Get test coverage working again with mock/sync worker ([#1094](https://github.com/videojs/http-streaming/issues/1094)) ([035e8c0](https://github.com/videojs/http-streaming/commit/035e8c0)) -* pin CI to ubuntu 18.04 ([#1091](https://github.com/videojs/http-streaming/issues/1091)) ([01ca182](https://github.com/videojs/http-streaming/commit/01ca182)) - - -## [2.6.3](https://github.com/videojs/http-streaming/compare/v2.6.2...v2.6.3) (2021-03-05) - -### Bug Fixes - -* **playback-watcher:** Skip over playback gaps that occur in the beginning of streams ([#1085](https://github.com/videojs/http-streaming/issues/1085)) ([ccd9352](https://github.com/videojs/http-streaming/commit/ccd9352)) -* Add exclude reason and skip duplicate playlist-unchanged ([#1082](https://github.com/videojs/http-streaming/issues/1082)) ([0dceb5b](https://github.com/videojs/http-streaming/commit/0dceb5b)) -* prevent changing undefined baseStartTime to NaN ([#1086](https://github.com/videojs/http-streaming/issues/1086)) ([43aa69a](https://github.com/videojs/http-streaming/commit/43aa69a)) -* update to mux.js 5.10.0 ([#1089](https://github.com/videojs/http-streaming/issues/1089)) ([1cfdab6](https://github.com/videojs/http-streaming/commit/1cfdab6)) - -### Chores - -* ie 11 demo fixes ([0760d45](https://github.com/videojs/http-streaming/commit/0760d45)) -* use deferred scripts for faster demo startup ([#1083](https://github.com/videojs/http-streaming/issues/1083)) ([c348174](https://github.com/videojs/http-streaming/commit/c348174)) - - -## [2.6.2](https://github.com/videojs/http-streaming/compare/v2.6.1...v2.6.2) (2021-02-24) - -### Bug Fixes - -* update to mux.js[@5](https://github.com/5).9.2 and mpd-parser[@0](https://github.com/0).15.4 ([#1081](https://github.com/videojs/http-streaming/issues/1081)) ([f5c060f](https://github.com/videojs/http-streaming/commit/f5c060f)) - -### Tests - -* add playback-min as a unit test type ([#1077](https://github.com/videojs/http-streaming/issues/1077)) ([327a572](https://github.com/videojs/http-streaming/commit/327a572)) - - -## [2.6.1](https://github.com/videojs/http-streaming/compare/v2.6.0...v2.6.1) (2021-02-19) - -### Bug Fixes - -* allow buffer removes when there's no current media info in loader ([#1070](https://github.com/videojs/http-streaming/issues/1070)) ([97ab712](https://github.com/videojs/http-streaming/commit/97ab712)) -* live dash segment changes should be considered a playlist update ([#1065](https://github.com/videojs/http-streaming/issues/1065)) ([1ce7838](https://github.com/videojs/http-streaming/commit/1ce7838)) -* sometimes subtitlesTrack_.cues is null ([#1073](https://github.com/videojs/http-streaming/issues/1073)) ([6778ca1](https://github.com/videojs/http-streaming/commit/6778ca1)) -* unbreak the minified build by updating rollup-plugin-worker-factory ([#1072](https://github.com/videojs/http-streaming/issues/1072)) ([e583b26](https://github.com/videojs/http-streaming/commit/e583b26)) - -### Chores - -* mirror player.src on the demo page using sourceset ([#1071](https://github.com/videojs/http-streaming/issues/1071)) ([fee7309](https://github.com/videojs/http-streaming/commit/fee7309)) - -### Documentation - -* **README:** fix useBandwidthFromLocalStorage and limitRenditionByPlayerDimensions ([#1075](https://github.com/videojs/http-streaming/issues/1075)) ([cf2efcb](https://github.com/videojs/http-streaming/commit/cf2efcb)) - - -# [2.6.0](https://github.com/videojs/http-streaming/compare/v2.5.0...v2.6.0) (2021-02-11) - -### Features - -* allow xhr override globally, for super advanced use cases only ([#1059](https://github.com/videojs/http-streaming/issues/1059)) ([6279675](https://github.com/videojs/http-streaming/commit/6279675)) -* expose m3u8-parser logging in debug log ([#1048](https://github.com/videojs/http-streaming/issues/1048)) ([0e8bd4b](https://github.com/videojs/http-streaming/commit/0e8bd4b)) - -### Bug Fixes - -* do not request manifests until play when preload is none ([#1060](https://github.com/videojs/http-streaming/issues/1060)) ([49249d5](https://github.com/videojs/http-streaming/commit/49249d5)), closes [#126](https://github.com/videojs/http-streaming/issues/126) -* store `transmuxQueue` and `currentTransmux` on `transmuxer` instead of globally ([#1045](https://github.com/videojs/http-streaming/issues/1045)) ([a34b4da](https://github.com/videojs/http-streaming/commit/a34b4da)) -* use a separate ProgramDateTime mapping to player time per timeline ([#1063](https://github.com/videojs/http-streaming/issues/1063)) ([5e9b4f1](https://github.com/videojs/http-streaming/commit/5e9b4f1)) -* wait for endedtimeline event from transmuxer when reaching the end of a timeline ([#1058](https://github.com/videojs/http-streaming/issues/1058)) ([b01ab72](https://github.com/videojs/http-streaming/commit/b01ab72)) - -### Chores - -* add legacy avc source ([#1050](https://github.com/videojs/http-streaming/issues/1050)) ([b34a770](https://github.com/videojs/http-streaming/commit/b34a770)) -* add pdt test sources ([#1067](https://github.com/videojs/http-streaming/issues/1067)) ([112148b](https://github.com/videojs/http-streaming/commit/112148b)) -* better worker build and synchronous web worker ([#1033](https://github.com/videojs/http-streaming/issues/1033)) ([f0732af](https://github.com/videojs/http-streaming/commit/f0732af)) - -### Documentation - -* sample-aes encryption isn't currently supported ([#923](https://github.com/videojs/http-streaming/issues/923)) ([30f9b14](https://github.com/videojs/http-streaming/commit/30f9b14)) - -### Tests - -* for IE11, add colon to timezone in Date strings of PDT mapping tests ([#1068](https://github.com/videojs/http-streaming/issues/1068)) ([f81c5a9](https://github.com/videojs/http-streaming/commit/f81c5a9)) - - -# [2.5.0](https://github.com/videojs/http-streaming/compare/v2.4.2...v2.5.0) (2021-01-20) - -### Features - -* add flag to turn off 708 captions ([#1047](https://github.com/videojs/http-streaming/issues/1047)) ([ab5b4dc](https://github.com/videojs/http-streaming/commit/ab5b4dc)) - -### Chores - -* update [@videojs](https://github.com/videojs)/vhs-utils to v3.0.0 ([#1036](https://github.com/videojs/http-streaming/issues/1036)) ([b072c93](https://github.com/videojs/http-streaming/commit/b072c93)) - -### Tests - -* clear segment transmuxer in media segment request tests ([#1043](https://github.com/videojs/http-streaming/issues/1043)) ([83057a8](https://github.com/videojs/http-streaming/commit/83057a8)) -* don't show QUnit UI in regular test runs ([#1044](https://github.com/videojs/http-streaming/issues/1044)) ([25c7f64](https://github.com/videojs/http-streaming/commit/25c7f64)) - - -## [2.4.2](https://github.com/videojs/http-streaming/compare/v2.4.1...v2.4.2) (2021-01-07) - -### Bug Fixes - -* handle rollover and don't set wrong timing info for segments with high PTS/DTS values ([#1040](https://github.com/videojs/http-streaming/issues/1040)) ([9919b85](https://github.com/videojs/http-streaming/commit/9919b85)) - - -## [2.4.1](https://github.com/videojs/http-streaming/compare/v2.4.0...v2.4.1) (2020-12-22) - -### Bug Fixes - -* if a playlist was last requested less than half target duration, delay retry ([#1038](https://github.com/videojs/http-streaming/issues/1038)) ([2e237ee](https://github.com/videojs/http-streaming/commit/2e237ee)) -* programmatically create Config getters/setters ([8454da5](https://github.com/videojs/http-streaming/commit/8454da5)) - -### Chores - -* **demo:** clear type on manual source change ([#1030](https://github.com/videojs/http-streaming/issues/1030)) ([d39276d](https://github.com/videojs/http-streaming/commit/d39276d)) -* mark many more sources as working ([#1035](https://github.com/videojs/http-streaming/issues/1035)) ([904153f](https://github.com/videojs/http-streaming/commit/904153f)) -* move playback tests to a separate ci run ([#1028](https://github.com/videojs/http-streaming/issues/1028)) ([f1d9f6e](https://github.com/videojs/http-streaming/commit/f1d9f6e)) -* remove replace and update packages ([#1031](https://github.com/videojs/http-streaming/issues/1031)) ([0976212](https://github.com/videojs/http-streaming/commit/0976212)) - - -# [2.4.0](https://github.com/videojs/http-streaming/compare/v2.3.0...v2.4.0) (2020-12-07) - -### Features - -* **playback watcher:** Configurable live seekable window ([#997](https://github.com/videojs/http-streaming/issues/997)) ([ad5c270](https://github.com/videojs/http-streaming/commit/ad5c270)) -* log on mislabeled segment durations for HLS ([#1010](https://github.com/videojs/http-streaming/issues/1010)) ([4109a7f](https://github.com/videojs/http-streaming/commit/4109a7f)) -* update to mux.js 5.7.0 ([#1014](https://github.com/videojs/http-streaming/issues/1014)) ([5f14909](https://github.com/videojs/http-streaming/commit/5f14909)), closes [#1001](https://github.com/videojs/http-streaming/issues/1001) [#909](https://github.com/videojs/http-streaming/issues/909) - -### Bug Fixes - -* abort all loaders on earlyabort ([#965](https://github.com/videojs/http-streaming/issues/965)) ([e7cb63a](https://github.com/videojs/http-streaming/commit/e7cb63a)) -* don't save bandwidth and throughput for really small segments ([#1024](https://github.com/videojs/http-streaming/issues/1024)) ([a29e241](https://github.com/videojs/http-streaming/commit/a29e241)) -* filter out unsupported subtitles for dash ([#962](https://github.com/videojs/http-streaming/issues/962)) ([124834a](https://github.com/videojs/http-streaming/commit/124834a)) -* keep running the minimumUpdatePeriod unless cancelled or changed ([#1016](https://github.com/videojs/http-streaming/issues/1016)) ([f7b528c](https://github.com/videojs/http-streaming/commit/f7b528c)) -* prevent double source buffer ready on IE11 ([#1015](https://github.com/videojs/http-streaming/issues/1015)) ([b1c2969](https://github.com/videojs/http-streaming/commit/b1c2969)) -* remove duplicate cues with same time interval and text ([#1005](https://github.com/videojs/http-streaming/issues/1005)) ([6db2b6a](https://github.com/videojs/http-streaming/commit/6db2b6a)) -* support tracks with id 0 for fmp4 playlists ([#1018](https://github.com/videojs/http-streaming/issues/1018)) ([bf63692](https://github.com/videojs/http-streaming/commit/bf63692)) -* Wait for EME initialization before appending content ([#1002](https://github.com/videojs/http-streaming/issues/1002)) ([93132b7](https://github.com/videojs/http-streaming/commit/93132b7)) -* when changing renditions over a discontinuity, don't use buffered end as segment start ([#1023](https://github.com/videojs/http-streaming/issues/1023)) ([40caa45](https://github.com/videojs/http-streaming/commit/40caa45)) -* **experimentalBufferBasedABR:** start ABR timer on main playlist load ([#1026](https://github.com/videojs/http-streaming/issues/1026)) ([27de9a5](https://github.com/videojs/http-streaming/commit/27de9a5)), closes [#1025](https://github.com/videojs/http-streaming/issues/1025) - -### Chores - -* add multiple soon-to-work sources ([#1007](https://github.com/videojs/http-streaming/issues/1007)) ([030469f](https://github.com/videojs/http-streaming/commit/030469f)) -* don't run tests on release ([#1006](https://github.com/videojs/http-streaming/issues/1006)) ([d13b737](https://github.com/videojs/http-streaming/commit/d13b737)) -* skip duplicate ci workflows ([#1021](https://github.com/videojs/http-streaming/issues/1021)) ([20cc4a3](https://github.com/videojs/http-streaming/commit/20cc4a3)) -* switch from travis to github actions for ci ([#989](https://github.com/videojs/http-streaming/issues/989)) ([c9b195b](https://github.com/videojs/http-streaming/commit/c9b195b)) -* **demo page:** add an overrideNative button (default on) ([#1027](https://github.com/videojs/http-streaming/issues/1027)) ([197daab](https://github.com/videojs/http-streaming/commit/197daab)) - -### Code Refactoring - -* Add a better distinction between master and child dash loaders ([#992](https://github.com/videojs/http-streaming/issues/992)) ([56592bc](https://github.com/videojs/http-streaming/commit/56592bc)) -* add sidx segments to playlist object instead of re-parsing xml ([#994](https://github.com/videojs/http-streaming/issues/994)) ([e41f856](https://github.com/videojs/http-streaming/commit/e41f856)) -* unify sidx/master/error request logic ([#998](https://github.com/videojs/http-streaming/issues/998)) ([fe57e60](https://github.com/videojs/http-streaming/commit/fe57e60)) - -### Tests - -* fix tests on firefox 83 ([#1004](https://github.com/videojs/http-streaming/issues/1004)) ([00d9b1d](https://github.com/videojs/http-streaming/commit/00d9b1d)) - - -# [2.3.0](https://github.com/videojs/http-streaming/compare/v2.2.0...v2.3.0) (2020-11-05) - -### Features - -* add experimental buffer based ABR ([#886](https://github.com/videojs/http-streaming/issues/886)) ([a05d032](https://github.com/videojs/http-streaming/commit/a05d032)) - -### Bug Fixes - -* appendsdone abort and handle multiple id3 sections. ([#971](https://github.com/videojs/http-streaming/issues/971)) ([329d50a](https://github.com/videojs/http-streaming/commit/329d50a)) -* check tech error before pause loaders ([#969](https://github.com/videojs/http-streaming/issues/969)) ([0c7b2cb](https://github.com/videojs/http-streaming/commit/0c7b2cb)) -* inline json version ([#967](https://github.com/videojs/http-streaming/issues/967)) ([326ce1c](https://github.com/videojs/http-streaming/commit/326ce1c)) -* **experimentalBufferBasedABR:** call selectPlaylist and change media on an interval ([#978](https://github.com/videojs/http-streaming/issues/978)) ([200c87b](https://github.com/videojs/http-streaming/commit/200c87b)), closes [#886](https://github.com/videojs/http-streaming/issues/886) [#966](https://github.com/videojs/http-streaming/issues/966) [#964](https://github.com/videojs/http-streaming/issues/964) -* only prevent audio group creation if no other playlists are using it ([#981](https://github.com/videojs/http-streaming/issues/981)) ([645e979](https://github.com/videojs/http-streaming/commit/645e979)) -* **playback-watcher:** ignore subtitles ([#980](https://github.com/videojs/http-streaming/issues/980)) ([ca7655e](https://github.com/videojs/http-streaming/commit/ca7655e)) - -### Chores - -* **package:** update aes-decrypter, m3u8 and mpd parser for vhs-utils ([#988](https://github.com/videojs/http-streaming/issues/988)) ([c31dee2](https://github.com/videojs/http-streaming/commit/c31dee2)) - -### Tests - -* **playback-watcher:** subtitle test refactor ([#986](https://github.com/videojs/http-streaming/issues/986)) ([0f66d8e](https://github.com/videojs/http-streaming/commit/0f66d8e)), closes [#980](https://github.com/videojs/http-streaming/issues/980) - - -# [2.2.0](https://github.com/videojs/http-streaming/compare/v2.1.0...v2.2.0) (2020-09-25) - -### Features - -* default handleManfiestRedirect to true ([#927](https://github.com/videojs/http-streaming/issues/927)) ([556321f](https://github.com/videojs/http-streaming/commit/556321f)) -* support MPD.Location ([#926](https://github.com/videojs/http-streaming/issues/926)) ([c4a43d7](https://github.com/videojs/http-streaming/commit/c4a43d7)) -* Update minimumUpdatePeriod handling ([#942](https://github.com/videojs/http-streaming/issues/942)) ([8648e76](https://github.com/videojs/http-streaming/commit/8648e76)) - -### Bug Fixes - -* audio groups with the same uri as media do not count ([#952](https://github.com/videojs/http-streaming/issues/952)) ([3927c0c](https://github.com/videojs/http-streaming/commit/3927c0c)) -* dash manifest not refreshed if only some playlists are updated ([#949](https://github.com/videojs/http-streaming/issues/949)) ([31d3441](https://github.com/videojs/http-streaming/commit/31d3441)) -* detect demuxed video underflow gaps ([#948](https://github.com/videojs/http-streaming/issues/948)) ([d0ef298](https://github.com/videojs/http-streaming/commit/d0ef298)) -* MPD not refreshed if minimumUpdatePeriod is 0 ([#954](https://github.com/videojs/http-streaming/issues/954)) ([3a0682f](https://github.com/videojs/http-streaming/commit/3a0682f)), closes [#942](https://github.com/videojs/http-streaming/issues/942) -* noop vtt segment loader handle data ([#959](https://github.com/videojs/http-streaming/issues/959)) ([d1dcd7b](https://github.com/videojs/http-streaming/commit/d1dcd7b)) -* report the correct buffered regardless of playlist change ([#950](https://github.com/videojs/http-streaming/issues/950)) ([043ccc6](https://github.com/videojs/http-streaming/commit/043ccc6)) -* Throw a player error when trying to play DRM content without eme ([#938](https://github.com/videojs/http-streaming/issues/938)) ([ce4d6fd](https://github.com/videojs/http-streaming/commit/ce4d6fd)) -* use playlist NAME when available as its ID ([#929](https://github.com/videojs/http-streaming/issues/929)) ([2269464](https://github.com/videojs/http-streaming/commit/2269464)) -* use TIME_FUDGE_FACTOR rather than rounding by decimal digits ([#881](https://github.com/videojs/http-streaming/issues/881)) ([7eb112d](https://github.com/videojs/http-streaming/commit/7eb112d)) - -### Chores - -* **package:** remove engine check in pkcs7 ([#947](https://github.com/videojs/http-streaming/issues/947)) ([89392fa](https://github.com/videojs/http-streaming/commit/89392fa)) -* mark angel one dash subs as broken ([#956](https://github.com/videojs/http-streaming/issues/956)) ([56a0970](https://github.com/videojs/http-streaming/commit/56a0970)) -* mediaConfig_ -> staringMediaInfo_, startingMedia_ -> currentMediaInfo_ ([#953](https://github.com/videojs/http-streaming/issues/953)) ([8801d1c](https://github.com/videojs/http-streaming/commit/8801d1c)) -* playlist selector logging ([#921](https://github.com/videojs/http-streaming/issues/921)) ([ccdbaef](https://github.com/videojs/http-streaming/commit/ccdbaef)) -* update m3u8-parser to v4.4.3 ([#928](https://github.com/videojs/http-streaming/issues/928)) ([af5b4ee](https://github.com/videojs/http-streaming/commit/af5b4ee)) - -### Reverts - -* fix: use playlist NAME when available as its ID ([#929](https://github.com/videojs/http-streaming/issues/929)) ([#957](https://github.com/videojs/http-streaming/issues/957)) ([fe8376b](https://github.com/videojs/http-streaming/commit/fe8376b)) - - -# [2.1.0](https://github.com/videojs/http-streaming/compare/v2.0.0...v2.1.0) (2020-07-28) - -### Features - -* Easier manual playlist switching, add codecs to renditions ([#850](https://github.com/videojs/http-streaming/issues/850)) ([f60fa1f](https://github.com/videojs/http-streaming/commit/f60fa1f)) -* exclude all incompatable browser/muxer codecs ([#903](https://github.com/videojs/http-streaming/issues/903)) ([2d0f0d7](https://github.com/videojs/http-streaming/commit/2d0f0d7)) -* expose canChangeType on the VHS property ([#911](https://github.com/videojs/http-streaming/issues/911)) ([a4ab285](https://github.com/videojs/http-streaming/commit/a4ab285)) -* let back buffer be configurable ([8c96e6c](https://github.com/videojs/http-streaming/commit/8c96e6c)) -* Support codecs switching when possible via sourceBuffer.changeType ([#841](https://github.com/videojs/http-streaming/issues/841)) ([267cc34](https://github.com/videojs/http-streaming/commit/267cc34)) - -### Bug Fixes - -* always append init segment after trackinfo change ([#913](https://github.com/videojs/http-streaming/issues/913)) ([ea3650a](https://github.com/videojs/http-streaming/commit/ea3650a)) -* cleanup mediasource listeners on dispose ([#871](https://github.com/videojs/http-streaming/issues/871)) ([e50f4c9](https://github.com/videojs/http-streaming/commit/e50f4c9)) -* do not try to use unsupported audio ([#896](https://github.com/videojs/http-streaming/issues/896)) ([7711b26](https://github.com/videojs/http-streaming/commit/7711b26)) -* do not use remove source buffer on ie 11 ([#904](https://github.com/videojs/http-streaming/issues/904)) ([1ab0f07](https://github.com/videojs/http-streaming/commit/1ab0f07)) -* do not wait for audio appends for muxed segments ([#894](https://github.com/videojs/http-streaming/issues/894)) ([406cbcd](https://github.com/videojs/http-streaming/commit/406cbcd)) -* Fixed issue with MPEG-Dash MPD Playlist Finalisation during Live Play. ([#874](https://github.com/videojs/http-streaming/issues/874)) ([c807930](https://github.com/videojs/http-streaming/commit/c807930)) -* handle null return value from CaptionParser.parse ([#890](https://github.com/videojs/http-streaming/issues/890)) ([7b8fff2](https://github.com/videojs/http-streaming/commit/7b8fff2)), closes [#863](https://github.com/videojs/http-streaming/issues/863) -* have reloadSourceOnError get src from player ([#893](https://github.com/videojs/http-streaming/issues/893)) ([1e50bc5](https://github.com/videojs/http-streaming/commit/1e50bc5)), closes [videojs/video.js#6744](https://github.com/videojs/video.js/issues/6744) -* initialize EME for all playlists and PSSH values ([#872](https://github.com/videojs/http-streaming/issues/872)) ([e0e497f](https://github.com/videojs/http-streaming/commit/e0e497f)) -* more conservative stalled download check, better logging ([#884](https://github.com/videojs/http-streaming/issues/884)) ([615e77f](https://github.com/videojs/http-streaming/commit/615e77f)) -* pause/abort loaders before an exclude, preventing bad appends ([#902](https://github.com/videojs/http-streaming/issues/902)) ([c9126e1](https://github.com/videojs/http-streaming/commit/c9126e1)) -* stop alt loaders on main mediachanging to prevent append race ([#895](https://github.com/videojs/http-streaming/issues/895)) ([8690c78](https://github.com/videojs/http-streaming/commit/8690c78)) -* Support aac data with or without id3 tags by using mux.js[@5](https://github.com/5).6.6 ([#899](https://github.com/videojs/http-streaming/issues/899)) ([9c742ce](https://github.com/videojs/http-streaming/commit/9c742ce)) -* Use revokeObjectURL dispose for created MSE blob urls ([#849](https://github.com/videojs/http-streaming/issues/849)) ([ca73cac](https://github.com/videojs/http-streaming/commit/ca73cac)) -* Wait for sourceBuffer creation so drm setup uses valid codecs ([#878](https://github.com/videojs/http-streaming/issues/878)) ([f879563](https://github.com/videojs/http-streaming/commit/f879563)) - -### Chores - -* Add vhs & mpc (vhs.masterPlaylistController_) to window of index.html ([#875](https://github.com/videojs/http-streaming/issues/875)) ([bab61d6](https://github.com/videojs/http-streaming/commit/bab61d6)) -* **demo:** add a representations selector to the demo page ([#901](https://github.com/videojs/http-streaming/issues/901)) ([0a54ae2](https://github.com/videojs/http-streaming/commit/0a54ae2)) -* fix tears of steal playready on the demo page ([#915](https://github.com/videojs/http-streaming/issues/915)) ([29a10d0](https://github.com/videojs/http-streaming/commit/29a10d0)) -* keep window vhs/mpc up to date on source switch ([#883](https://github.com/videojs/http-streaming/issues/883)) ([3ba85fd](https://github.com/videojs/http-streaming/commit/3ba85fd)) -* update DASH stream urls ([#918](https://github.com/videojs/http-streaming/issues/918)) ([902c2a5](https://github.com/videojs/http-streaming/commit/902c2a5)) -* update local video.js ([#876](https://github.com/videojs/http-streaming/issues/876)) ([c2cc9aa](https://github.com/videojs/http-streaming/commit/c2cc9aa)) -* use playready license server ([#916](https://github.com/videojs/http-streaming/issues/916)) ([6728837](https://github.com/videojs/http-streaming/commit/6728837)) - -### Code Refactoring - -* remove duplicate bufferIntersection code in util/buffer.js ([#880](https://github.com/videojs/http-streaming/issues/880)) ([0ca43bd](https://github.com/videojs/http-streaming/commit/0ca43bd)) -* simplify setupEmeOptions and add tests ([#869](https://github.com/videojs/http-streaming/issues/869)) ([e3921ed](https://github.com/videojs/http-streaming/commit/e3921ed)) - - -# [2.0.0](https://github.com/videojs/http-streaming/compare/v2.0.0-rc.2...v2.0.0) (2020-06-16) - -### Features - -* add external vhs properties and deprecate hls and dash references ([#859](https://github.com/videojs/http-streaming/issues/859)) ([22af0b2](https://github.com/videojs/http-streaming/commit/22af0b2)) -* Use VHS playback on any non-Safari browser ([#843](https://github.com/videojs/http-streaming/issues/843)) ([225d127](https://github.com/videojs/http-streaming/commit/225d127)) - -### Chores - -* fix demo page on firefox, always use vhs on safari ([#851](https://github.com/videojs/http-streaming/issues/851)) ([d567b7d](https://github.com/videojs/http-streaming/commit/d567b7d)) -* **stats:** update vhs usage in the stats page ([#867](https://github.com/videojs/http-streaming/issues/867)) ([4dda42a](https://github.com/videojs/http-streaming/commit/4dda42a)) - -### Code Refactoring - -* Move caption parser to webworker, saving 5732b offloading work ([#863](https://github.com/videojs/http-streaming/issues/863)) ([491d194](https://github.com/videojs/http-streaming/commit/491d194)) -* remove aes-decrypter objects from Hls saving 1415gz bytes ([#860](https://github.com/videojs/http-streaming/issues/860)) ([a4f8302](https://github.com/videojs/http-streaming/commit/a4f8302)) - -### Documentation - -* add supported features doc ([#848](https://github.com/videojs/http-streaming/issues/848)) ([38f5860](https://github.com/videojs/http-streaming/commit/38f5860)) - -### Reverts - -* "fix: Use middleware and a wrapped function for seeking instead of relying on unreliable 'seeking' events ([#161](https://github.com/videojs/http-streaming/issues/161))"([#856](https://github.com/videojs/http-streaming/issues/856)) ([1165f8e](https://github.com/videojs/http-streaming/commit/1165f8e)) - - -### BREAKING CHANGES - -* The Hls object which was exposed on videojs no longer has Decrypter, AsyncStream, and decrypt from aes-decrypter. - - -## [1.10.2](https://github.com/videojs/http-streaming/compare/v1.10.1...v1.10.2) (2019-05-13) - -### Bug Fixes - -* clear the blacklist for other playlists if final rendition errors ([#479](https://github.com/videojs/http-streaming/issues/479)) ([fe3b378](https://github.com/videojs/http-streaming/commit/fe3b378)), closes [#396](https://github.com/videojs/http-streaming/issues/396) [#471](https://github.com/videojs/http-streaming/issues/471) -* **development:** rollup watch, via `npm run watch`, should work for es/cjs ([#484](https://github.com/videojs/http-streaming/issues/484)) ([ad6f292](https://github.com/videojs/http-streaming/commit/ad6f292)) -* **HLSe:** slice keys properly on IE11 ([#506](https://github.com/videojs/http-streaming/issues/506)) ([681cd6f](https://github.com/videojs/http-streaming/commit/681cd6f)) -* **package:** update mpd-parser to version 0.8.1 🚀 ([#490](https://github.com/videojs/http-streaming/issues/490)) ([a49ad3a](https://github.com/videojs/http-streaming/commit/a49ad3a)) -* **package:** update mux.js to version 5.1.2 🚀 ([#477](https://github.com/videojs/http-streaming/issues/477)) ([57a38e9](https://github.com/videojs/http-streaming/commit/57a38e9)), closes [#503](https://github.com/videojs/http-streaming/issues/503) [#504](https://github.com/videojs/http-streaming/issues/504) -* **source-updater:** run callbacks after setting timestampOffset ([#480](https://github.com/videojs/http-streaming/issues/480)) ([6ecf859](https://github.com/videojs/http-streaming/commit/6ecf859)) -* livestream timeout issues ([#469](https://github.com/videojs/http-streaming/issues/469)) ([cf3fafc](https://github.com/videojs/http-streaming/commit/cf3fafc)), closes [segment#16](https://github.com/segment/issues/16) [segment#15](https://github.com/segment/issues/15) [segment#16](https://github.com/segment/issues/16) [segment#15](https://github.com/segment/issues/15) [segment#16](https://github.com/segment/issues/16) -* remove both vttjs listeners to prevent leaking one of them ([#495](https://github.com/videojs/http-streaming/issues/495)) ([1db1e72](https://github.com/videojs/http-streaming/commit/1db1e72)) - -### Performance Improvements - -* don't enable captionParser for audio or subtitle loaders ([#487](https://github.com/videojs/http-streaming/issues/487)) ([358877f](https://github.com/videojs/http-streaming/commit/358877f)) - - -## [1.10.1](https://github.com/videojs/http-streaming/compare/v1.10.0...v1.10.1) (2019-04-16) - -### Bug Fixes - -* **dash-playlist-loader:** clear out timers on dispose ([#472](https://github.com/videojs/http-streaming/issues/472)) ([2f1c222](https://github.com/videojs/http-streaming/commit/2f1c222)) - -### Reverts - -* "fix: clear the blacklist for other playlists if final rendition errors ([#396](https://github.com/videojs/http-streaming/issues/396))" ([#471](https://github.com/videojs/http-streaming/issues/471)) ([dd55028](https://github.com/videojs/http-streaming/commit/dd55028)) - - -# [1.10.0](https://github.com/videojs/http-streaming/compare/v1.9.3...v1.10.0) (2019-04-12) - -### Features - -* add option to cache encrpytion keys in the player ([#446](https://github.com/videojs/http-streaming/issues/446)) ([599b94d](https://github.com/videojs/http-streaming/commit/599b94d)), closes [#140](https://github.com/videojs/http-streaming/issues/140) -* add support for dash manifests describing sidx boxes ([#455](https://github.com/videojs/http-streaming/issues/455)) ([80dde16](https://github.com/videojs/http-streaming/commit/80dde16)) - -### Bug Fixes - -* clear the blacklist for other playlists if final rendition errors ([#396](https://github.com/videojs/http-streaming/issues/396)) ([6e6c8c2](https://github.com/videojs/http-streaming/commit/6e6c8c2)) -* on dispose, don't call abort on SourceBuffer until after remove() has finished ([3806750](https://github.com/videojs/http-streaming/commit/3806750)) - -### Documentation - -* **README:** update broken link to full docs ([#440](https://github.com/videojs/http-streaming/issues/440)) ([fbd615c](https://github.com/videojs/http-streaming/commit/fbd615c)) - - -## [1.9.3](https://github.com/videojs/http-streaming/compare/v1.9.2...v1.9.3) (2019-03-21) - -### Bug Fixes - -* **id3:** ignore unsupported id3 frames ([#437](https://github.com/videojs/http-streaming/issues/437)) ([7040b7d](https://github.com/videojs/http-streaming/commit/7040b7d)), closes [videojs/video.js#5823](https://github.com/videojs/video.js/issues/5823) - -### Documentation - -* add diagrams for playlist loaders ([#426](https://github.com/videojs/http-streaming/issues/426)) ([52201f9](https://github.com/videojs/http-streaming/commit/52201f9)) - - -## [1.9.2](https://github.com/videojs/http-streaming/compare/v1.9.1...v1.9.2) (2019-03-14) - -### Bug Fixes - -* expose `custom` segment property in the segment metadata track ([#429](https://github.com/videojs/http-streaming/issues/429)) ([17510da](https://github.com/videojs/http-streaming/commit/17510da)) - - -## [1.9.1](https://github.com/videojs/http-streaming/compare/v1.9.0...v1.9.1) (2019-03-05) - -### Bug Fixes - -* fix for streams that would occasionally never fire an `ended` event ([fc09926](https://github.com/videojs/http-streaming/commit/fc09926)) -* Fix video playback freezes caused by not using absolute current time ([#401](https://github.com/videojs/http-streaming/issues/401)) ([957ecfd](https://github.com/videojs/http-streaming/commit/957ecfd)) -* only fire seekablechange when values of seekable ranges actually change ([#415](https://github.com/videojs/http-streaming/issues/415)) ([a4c056e](https://github.com/videojs/http-streaming/commit/a4c056e)) -* Prevent infinite buffering at the start of looped video on edge ([#392](https://github.com/videojs/http-streaming/issues/392)) ([b6d1b97](https://github.com/videojs/http-streaming/commit/b6d1b97)) - -### Code Refactoring - -* align DashPlaylistLoader closer to PlaylistLoader states ([#386](https://github.com/videojs/http-streaming/issues/386)) ([5d80fe7](https://github.com/videojs/http-streaming/commit/5d80fe7)) - - -# [1.9.0](https://github.com/videojs/http-streaming/compare/v1.8.0...v1.9.0) (2019-02-07) - -### Features - -* Use exposed transmuxer time modifications for more accurate conversion between program and player times ([#371](https://github.com/videojs/http-streaming/issues/371)) ([41df5c0](https://github.com/videojs/http-streaming/commit/41df5c0)) - -### Bug Fixes - -* m3u8 playlist is not updating when only endList changes ([#373](https://github.com/videojs/http-streaming/issues/373)) ([c7d1306](https://github.com/videojs/http-streaming/commit/c7d1306)) -* Prevent exceptions from being thrown by the MediaSource ([#389](https://github.com/videojs/http-streaming/issues/389)) ([8c06366](https://github.com/videojs/http-streaming/commit/8c06366)) - -### Chores - -* Update mux.js to the latest version 🚀 ([#397](https://github.com/videojs/http-streaming/issues/397)) ([38ec2a5](https://github.com/videojs/http-streaming/commit/38ec2a5)) - -### Tests - -* added test for playlist not updating when only endList changes ([#394](https://github.com/videojs/http-streaming/issues/394)) ([39d0be2](https://github.com/videojs/http-streaming/commit/39d0be2)) - - -# [1.8.0](https://github.com/videojs/http-streaming/compare/v1.7.0...v1.8.0) (2019-01-10) - -### Features - -* expose custom M3U8 mapper API ([#325](https://github.com/videojs/http-streaming/issues/325)) ([609beb3](https://github.com/videojs/http-streaming/commit/609beb3)) - -### Bug Fixes - -* **id3:** cuechange event not being triggered on audio-only HLS streams ([#334](https://github.com/videojs/http-streaming/issues/334)) ([bab70fd](https://github.com/videojs/http-streaming/commit/bab70fd)), closes [#130](https://github.com/videojs/http-streaming/issues/130) - - -# [1.7.0](https://github.com/videojs/http-streaming/compare/v1.6.0...v1.7.0) (2019-01-04) - -### Features - -* expose custom M3U8 parser API ([#331](https://github.com/videojs/http-streaming/issues/331)) ([b0643a4](https://github.com/videojs/http-streaming/commit/b0643a4)) - - -# [1.6.0](https://github.com/videojs/http-streaming/compare/v1.5.1...v1.6.0) (2018-12-21) - -### Features - -* Add allowSeeksWithinUnsafeLiveWindow property ([#320](https://github.com/videojs/http-streaming/issues/320)) ([74b28e8](https://github.com/videojs/http-streaming/commit/74b28e8)) - -### Chores - -* add clock.ticks to now async operations in tests ([#315](https://github.com/videojs/http-streaming/issues/315)) ([895c86a](https://github.com/videojs/http-streaming/commit/895c86a)) - -### Documentation - -* Add README entry on DRM and videojs-contrib-eme ([#307](https://github.com/videojs/http-streaming/issues/307)) ([93b6167](https://github.com/videojs/http-streaming/commit/93b6167)) - - -## [1.5.1](https://github.com/videojs/http-streaming/compare/v1.5.0...v1.5.1) (2018-12-06) - -### Bug Fixes - -* added missing manifest information on to segments (EXT-X-PROGRAM-DATE-TIME) ([#236](https://github.com/videojs/http-streaming/issues/236)) ([a35dd09](https://github.com/videojs/http-streaming/commit/a35dd09)) -* remove player props on dispose to stop middleware ([#229](https://github.com/videojs/http-streaming/issues/229)) ([cd13f9f](https://github.com/videojs/http-streaming/commit/cd13f9f)) - -### Documentation - -* add dash to package.json description ([#267](https://github.com/videojs/http-streaming/issues/267)) ([3296c68](https://github.com/videojs/http-streaming/commit/3296c68)) -* add documentation for reloadSourceOnError ([#266](https://github.com/videojs/http-streaming/issues/266)) ([7448b37](https://github.com/videojs/http-streaming/commit/7448b37)) - - -# [1.5.0](https://github.com/videojs/http-streaming/compare/v1.4.2...v1.5.0) (2018-11-13) - -### Features - -* Add useBandwidthFromLocalStorage option ([#275](https://github.com/videojs/http-streaming/issues/275)) ([60c88ae](https://github.com/videojs/http-streaming/commit/60c88ae)) - -### Bug Fixes - -* don't wait for requests to finish when encountering an error in media-segment-request ([#286](https://github.com/videojs/http-streaming/issues/286)) ([970e3ce](https://github.com/videojs/http-streaming/commit/970e3ce)) -* throttle final playlist reloads when using DASH ([#277](https://github.com/videojs/http-streaming/issues/277)) ([1c2887a](https://github.com/videojs/http-streaming/commit/1c2887a)) - - -## [1.4.2](https://github.com/videojs/http-streaming/compare/v1.4.1...v1.4.2) (2018-11-01) - -### Chores - -* pin to node 8 for now ([#279](https://github.com/videojs/http-streaming/issues/279)) ([f900dc4](https://github.com/videojs/http-streaming/commit/f900dc4)) -* update mux.js to 5.0.1 ([#282](https://github.com/videojs/http-streaming/issues/282)) ([af6ee4f](https://github.com/videojs/http-streaming/commit/af6ee4f)) - - -## [1.4.1](https://github.com/videojs/http-streaming/compare/v1.4.0...v1.4.1) (2018-10-25) - -### Bug Fixes - -* **subtitles:** set default property if default and autoselect are both enabled ([#239](https://github.com/videojs/http-streaming/issues/239)) ([ee594e5](https://github.com/videojs/http-streaming/commit/ee594e5)) - - -# [1.4.0](https://github.com/videojs/http-streaming/compare/v1.3.1...v1.4.0) (2018-10-24) - -### Features - -* limited experimental DASH multiperiod support ([#268](https://github.com/videojs/http-streaming/issues/268)) ([a213807](https://github.com/videojs/http-streaming/commit/a213807)) -* smoothQualityChange flag ([#235](https://github.com/videojs/http-streaming/issues/235)) ([0e4fdf9](https://github.com/videojs/http-streaming/commit/0e4fdf9)) - -### Bug Fixes - -* immediately setup EME if available ([#263](https://github.com/videojs/http-streaming/issues/263)) ([7577e90](https://github.com/videojs/http-streaming/commit/7577e90)) - - -## [1.3.1](https://github.com/videojs/http-streaming/compare/v1.3.0...v1.3.1) (2018-10-15) - -### Bug Fixes - -* ensure content loops ([#259](https://github.com/videojs/http-streaming/issues/259)) ([26300df](https://github.com/videojs/http-streaming/commit/26300df)) - - -# [1.3.0](https://github.com/videojs/http-streaming/compare/v1.2.6...v1.3.0) (2018-10-05) - -### Features - -* add an option to ignore player size in selection logic ([#238](https://github.com/videojs/http-streaming/issues/238)) ([7ae42b1](https://github.com/videojs/http-streaming/commit/7ae42b1)) - -### Documentation - -* Update CONTRIBUTING.md ([#242](https://github.com/videojs/http-streaming/issues/242)) ([9d83e9d](https://github.com/videojs/http-streaming/commit/9d83e9d)) - - -## [1.2.6](https://github.com/videojs/http-streaming/compare/v1.2.5...v1.2.6) (2018-09-21) - -### Bug Fixes - -* stutter after fast quality change in IE/Edge ([#213](https://github.com/videojs/http-streaming/issues/213)) ([2c0d9b2](https://github.com/videojs/http-streaming/commit/2c0d9b2)) - -### Documentation - -* update issue template to link to the troubleshooting guide ([#215](https://github.com/videojs/http-streaming/issues/215)) ([413f0e8](https://github.com/videojs/http-streaming/commit/413f0e8)) -* update README notes for video.js 7 ([#200](https://github.com/videojs/http-streaming/issues/200)) ([d68ce0c](https://github.com/videojs/http-streaming/commit/d68ce0c)) -* update troubleshooting guide for Edge/mobile Chrome ([#216](https://github.com/videojs/http-streaming/issues/216)) ([21e5335](https://github.com/videojs/http-streaming/commit/21e5335)) - - -## [1.2.5](https://github.com/videojs/http-streaming/compare/v1.2.4...v1.2.5) (2018-08-24) - -### Bug Fixes - -* fix replay functionality ([#204](https://github.com/videojs/http-streaming/issues/204)) ([fd6be83](https://github.com/videojs/http-streaming/commit/fd6be83)) - - -## [1.2.4](https://github.com/videojs/http-streaming/compare/v1.2.3...v1.2.4) (2018-08-13) - -### Bug Fixes - -* Remove buffered data on fast quality switches ([#113](https://github.com/videojs/http-streaming/issues/113)) ([bc94fbb](https://github.com/videojs/http-streaming/commit/bc94fbb)) - - -## [1.2.3](https://github.com/videojs/http-streaming/compare/v1.2.2...v1.2.3) (2018-08-09) - -### Chores - -* link to minified example in main page ([#189](https://github.com/videojs/http-streaming/issues/189)) ([15a7f92](https://github.com/videojs/http-streaming/commit/15a7f92)) -* use netlify for easier testing ([#188](https://github.com/videojs/http-streaming/issues/188)) ([d2e0d35](https://github.com/videojs/http-streaming/commit/d2e0d35)) - - -## [1.2.2](https://github.com/videojs/http-streaming/compare/v1.2.1...v1.2.2) (2018-08-07) - -### Bug Fixes - -* typeof minification ([#182](https://github.com/videojs/http-streaming/issues/182)) ([7c68335](https://github.com/videojs/http-streaming/commit/7c68335)) -* Use middleware and a wrapped function for seeking instead of relying on unreliable 'seeking' events ([#161](https://github.com/videojs/http-streaming/issues/161)) ([6c68761](https://github.com/videojs/http-streaming/commit/6c68761)) - -### Chores - -* add logo ([#184](https://github.com/videojs/http-streaming/issues/184)) ([a55626c](https://github.com/videojs/http-streaming/commit/a55626c)) - -### Documentation - -* add note for Safari captions error ([#174](https://github.com/videojs/http-streaming/issues/174)) ([7b03530](https://github.com/videojs/http-streaming/commit/7b03530)) - -### Tests - -* add support for real segments in tests ([#178](https://github.com/videojs/http-streaming/issues/178)) ([2b07fca](https://github.com/videojs/http-streaming/commit/2b07fca)) - - -## [1.2.1](https://github.com/videojs/http-streaming/compare/v1.2.0...v1.2.1) (2018-07-17) - -### Bug Fixes - -* convert non-latin characters in IE ([#157](https://github.com/videojs/http-streaming/issues/157)) ([17678fb](https://github.com/videojs/http-streaming/commit/17678fb)) - - -# [1.2.0](https://github.com/videojs/http-streaming/compare/v1.1.0...v1.2.0) (2018-07-16) - -### Features - -* **captions:** write in-band captions from DASH fmp4 segments to the textTrack API ([#108](https://github.com/videojs/http-streaming/issues/108)) ([7c11911](https://github.com/videojs/http-streaming/commit/7c11911)) - -### Chores - -* add welcome bot config from video.js ([#150](https://github.com/videojs/http-streaming/issues/150)) ([922cfee](https://github.com/videojs/http-streaming/commit/922cfee)) - - -# [1.1.0](https://github.com/videojs/http-streaming/compare/v1.0.2...v1.1.0) (2018-06-06) - -### Features - -* Utilize option to override native on tech ([#76](https://github.com/videojs/http-streaming/issues/76)) ([5c7ab4c](https://github.com/videojs/http-streaming/commit/5c7ab4c)) - -### Chores - -* update tests and pages for video.js 7 ([#102](https://github.com/videojs/http-streaming/issues/102)) ([d6f5005](https://github.com/videojs/http-streaming/commit/d6f5005)) - - -## [1.0.2](https://github.com/videojs/http-streaming/compare/v1.0.1...v1.0.2) (2018-05-17) - -### Bug Fixes - -* make project Video.js 7 ready ([#92](https://github.com/videojs/http-streaming/issues/92)) ([decad87](https://github.com/videojs/http-streaming/commit/decad87)) -* make sure that es build is babelified ([#97](https://github.com/videojs/http-streaming/issues/97)) ([5f0428d](https://github.com/videojs/http-streaming/commit/5f0428d)) - -### Documentation - -* update documentation with a glossary and intro page, added DASH background ([#94](https://github.com/videojs/http-streaming/issues/94)) ([4b0fde9](https://github.com/videojs/http-streaming/commit/4b0fde9)) - - -## [1.0.1](https://github.com/videojs/http-streaming/compare/v1.0.0...v1.0.1) (2018-04-12) - -### Bug Fixes - -* minified build ([#84](https://github.com/videojs/http-streaming/issues/84)) ([2402ac6](https://github.com/videojs/http-streaming/commit/2402ac6)) - - -# [1.0.0](https://github.com/videojs/http-streaming/compare/v0.9.0...v1.0.0) (2018-04-10) - -### Chores - -* sync videojs-contrib-hls updates ([#75](https://github.com/videojs/http-streaming/issues/75)) ([9223588](https://github.com/videojs/http-streaming/commit/9223588)) -* update the aes-decrypter ([#71](https://github.com/videojs/http-streaming/issues/71)) ([27ed914](https://github.com/videojs/http-streaming/commit/27ed914)) - -### Documentation - -* update docs for overrideNative ([#77](https://github.com/videojs/http-streaming/issues/77)) ([98ca6d3](https://github.com/videojs/http-streaming/commit/98ca6d3)) -* update known issues for fmp4 captions ([#79](https://github.com/videojs/http-streaming/issues/79)) ([c418301](https://github.com/videojs/http-streaming/commit/c418301)) - - -# [0.9.0](https://github.com/videojs/http-streaming/compare/v0.8.0...v0.9.0) (2018-03-30) - -### Features - -* support in-manifest DRM data ([#60](https://github.com/videojs/http-streaming/issues/60)) ([a1cad82](https://github.com/videojs/http-streaming/commit/a1cad82)) - - -# [0.8.0](https://github.com/videojs/http-streaming/compare/v0.7.2...v0.8.0) (2018-03-30) - -### Code Refactoring - -* export corrections ([#68](https://github.com/videojs/http-streaming/issues/68)) ([aab3b90](https://github.com/videojs/http-streaming/commit/aab3b90)) -* use rollup for build ([#69](https://github.com/videojs/http-streaming/issues/69)) ([c28c25c](https://github.com/videojs/http-streaming/commit/c28c25c)) - -# 0.7.0 -* feat: Live support for DASH - -# 0.6.1 -* use webwackify for webworkers to support webpack bundle ([#50](https://github.com/videojs/http-streaming/pull/45)) - -# 0.5.3 -* fix: program date time handling ([#45](https://github.com/videojs/http-streaming/pull/45)) - * update m3u8-parser to v4.2.0 - * use segment program date time info -* feat: Adding support for segments in Period and Representation ([#47](https://github.com/videojs/http-streaming/pull/47)) -* wait for both main and audio loaders for endOfStream if main starting media unknown ([#44](https://github.com/videojs/http-streaming/pull/44)) - -# 0.5.2 -* add debug logging statement for seekable updates ([#40](https://github.com/videojs/http-streaming/pull/40)) - -# 0.5.1 -* Fix audio only streams with EXT-X-MEDIA tags ([#34](https://github.com/videojs/http-streaming/pull/34)) -* Merge videojs-contrib-hls master into http-streaming master ([#35](https://github.com/videojs/http-streaming/pull/35)) - * Update sinon to 1.10.3= - * Update videojs-contrib-quality-levels to ^2.0.4 - * Fix test for event handler cleanup on dispose by calling event handling methods -* fix: Don't reset eme options ([#32](https://github.com/videojs/http-streaming/pull/32)) - -# 0.5.0 -* update mpd-parser to support more segment list types ([#27](https://github.com/videojs/http-streaming/issues/27)) - -# 0.4.0 -* Removed Flash support ([#15](https://github.com/videojs/http-streaming/issues/15)) -* Blacklist playlists not supported by browser media source before initial selection ([#17](https://github.com/videojs/http-streaming/issues/17)) - -# 0.3.1 -* Skip flash-based source handler with DASH sources ([#14](https://github.com/videojs/http-streaming/issues/14)) - -# 0.3.0 -* Added additional properties to the stats object ([#10](https://github.com/videojs/http-streaming/issues/10)) - -# 0.2.1 -* Updated the mpd-parser to fix IE11 DASH support ([#12](https://github.com/videojs/http-streaming/issues/12)) - -# 0.2.0 -* Initial DASH Support ([#8](https://github.com/videojs/http-streaming/issues/8)) - -# 0.1.0 -* Initial release, based on [videojs-contrib-hls 5.12.2](https://github.com/videojs/videojs-contrib-hls) - diff --git a/node_modules/@videojs/http-streaming/CONTRIBUTING.md b/node_modules/@videojs/http-streaming/CONTRIBUTING.md deleted file mode 100644 index 175d976..0000000 --- a/node_modules/@videojs/http-streaming/CONTRIBUTING.md +++ /dev/null @@ -1,30 +0,0 @@ -# CONTRIBUTING - -We welcome contributions from everyone! - -## Getting Started - -Make sure you have Node.js 8 or higher and npm installed. - -1. Fork this repository and clone your fork -1. Install dependencies: `npm install` -1. Run a development server: `npm start` - -### Making Changes - -Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship. - -When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository. - -### Running Tests - -Testing is a crucial part of any software project. For all but the most trivial changes (typos, etc) test cases are expected. Tests are run in actual browsers using [Karma][karma]. - -- In all available and supported browsers: `npm test` -- In a specific browser: `npm run test:chrome`, `npm run test:firefox`, etc. -- While development server is running (`npm start`), navigate to [`http://localhost:9999/test/`][local] - - -[karma]: http://karma-runner.github.io/ -[local]: http://localhost:9999/test/ -[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md diff --git a/node_modules/@videojs/http-streaming/LICENSE b/node_modules/@videojs/http-streaming/LICENSE deleted file mode 100644 index ae93385..0000000 --- a/node_modules/@videojs/http-streaming/LICENSE +++ /dev/null @@ -1,49 +0,0 @@ -Copyright Brightcove, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -The AES decryption implementation in this project is derived from the -Stanford Javascript Cryptography Library -(http://bitwiseshiftleft.github.io/sjcl/). That work is covered by the -following copyright and permission notice: - -Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. 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. - -THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 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. - -The views and conclusions contained in the software and documentation -are those of the authors and should not be interpreted as representing -official policies, either expressed or implied, of the authors. diff --git a/node_modules/@videojs/http-streaming/README.md b/node_modules/@videojs/http-streaming/README.md deleted file mode 100644 index e42829a..0000000 --- a/node_modules/@videojs/http-streaming/README.md +++ /dev/null @@ -1,1000 +0,0 @@ -VHS Logo consisting of a VHS tape, the Video.js logo and the words VHS - -# videojs-http-streaming (VHS) - -[![Build Status][travis-icon]][travis-link] -[![Slack Status][slack-icon]][slack-link] -[![Greenkeeper badge][greenkeeper-icon]][greenkeeper-link] - -Play HLS, DASH, and future HTTP streaming protocols with video.js, even where they're not -natively supported. - -Included in video.js 7 by default! See the [video.js 7 blog post](https://blog.videojs.com/video-js-7-is-here/) - -Maintenance Status: Stable - -Video.js Compatibility: 6.0, 7.0 - - - - - -- [Installation](#installation) - - [NPM](#npm) - - [CDN](#cdn) - - [Releases](#releases) - - [Manual Build](#manual-build) -- [Contributing](#contributing) -- [Troubleshooting](#troubleshooting) -- [Talk to us](#talk-to-us) -- [Getting Started](#getting-started) -- [Compatibility](#compatibility) - - [Browsers which support MSE](#browsers-which-support-mse) - - [Native only](#native-only) - - [Flash Support](#flash-support) - - [DRM](#drm) -- [Documentation](#documentation) - - [Options](#options) - - [How to use](#how-to-use) - - [Initialization](#initialization) - - [Source](#source) - - [List](#list) - - [withCredentials](#withcredentials) - - [handleManifestRedirects](#handlemanifestredirects) - - [useCueTags](#usecuetags) - - [parse708captions](#parse708captions) - - [overrideNative](#overridenative) - - [blacklistDuration](#blacklistduration) - - [maxPlaylistRetries](#maxplaylistretries) - - [bandwidth](#bandwidth) - - [useBandwidthFromLocalStorage](#usebandwidthfromlocalstorage) - - [enableLowInitialPlaylist](#enablelowinitialplaylist) - - [limitRenditionByPlayerDimensions](#limitrenditionbyplayerdimensions) - - [useDevicePixelRatio](#usedevicepixelratio) - - [smoothQualityChange](#smoothqualitychange) - - [allowSeeksWithinUnsafeLiveWindow](#allowseekswithinunsafelivewindow) - - [customTagParsers](#customtagparsers) - - [customTagMappers](#customtagmappers) - - [cacheEncryptionKeys](#cacheencryptionkeys) - - [handlePartialData](#handlepartialdata) - - [liveRangeSafeTimeDelta](#liverangesafetimedelta) - - [captionServices](#captionservices) - - [Format](#format) - - [Example](#example) - - [Runtime Properties](#runtime-properties) - - [vhs.playlists.master](#vhsplaylistsmaster) - - [vhs.playlists.media](#vhsplaylistsmedia) - - [vhs.systemBandwidth](#vhssystembandwidth) - - [vhs.bandwidth](#vhsbandwidth) - - [vhs.throughput](#vhsthroughput) - - [vhs.selectPlaylist](#vhsselectplaylist) - - [vhs.representations](#vhsrepresentations) - - [vhs.xhr](#vhsxhr) - - [vhs.stats](#vhsstats) - - [Events](#events) - - [loadedmetadata](#loadedmetadata) - - [VHS Usage Events](#vhs-usage-events) - - [Presence Stats](#presence-stats) - - [Use Stats](#use-stats) - - [In-Band Metadata](#in-band-metadata) - - [Segment Metadata](#segment-metadata) - - [Object as Source](#object-as-source) -- [Hosting Considerations](#hosting-considerations) -- [Known Issues and Workarounds](#known-issues-and-workarounds) - - [Fragmented MP4 Support](#fragmented-mp4-support) - - [Assets with an Audio-Only Rate Get Stuck in Audio-Only](#assets-with-an-audio-only-rate-get-stuck-in-audio-only) - - [DASH Assets with `$Time` Interpolation and `SegmentTimeline`s with No `t`](#dash-assets-with-time-interpolation-and-segmenttimelines-with-no-t) -- [Testing](#testing) -- [Debugging](#debugging) -- [Release History](#release-history) -- [Building](#building) -- [Development](#development) - - [Tools](#tools) - - [Commands](#commands) - - - -## Installation -### NPM -To install `videojs-http-streaming` with npm run - -```bash -npm install --save @videojs/http-streaming -``` - -### CDN -Select a version of VHS from the [CDN](https://unpkg.com/@videojs/http-streaming/dist/) - -### Releases -Download a release of [videojs-http-streaming](https://github.com/videojs/http-streaming/releases) - -### Manual Build -Download a copy of this git repository and then follow the steps in [Building](#building) - -## Contributing -See [CONTRIBUTING.md](/CONTRIBUTING.md) - -## Troubleshooting -See [our troubleshooting guide](/docs/troubleshooting.md) - -## Talk to us -Drop by our slack channel (#playback) on the [Video.js slack][slack-link]. - -## Getting Started -This library is included in video.js 7 by default, if you are using an older version of video.js then -get a copy of [videojs-http-streaming](#installation) and include it in your page along with video.js: - -```html - - - - - - -``` - -Check out our [live example](https://jsbin.com/gejugat/edit?html,output) if you're having trouble. - -Is it recommended to use the `` element or load a source with `player.src(sourceObject)` in order to prevent the video element from playing the source natively where HLS is supported. - -## Compatibility - -The [Media Source Extensions](http://caniuse.com/#feat=mediasource) API is required for http-streaming to play HLS or MPEG-DASH. - -### Browsers which support MSE - -- Chrome -- Firefox -- Internet Explorer 11 Windows 10 or 8.1 - -These browsers have some level of native HLS support, which will be used unless the [overrideNative](#overridenative) option is used: - -- Chrome Android -- Firefox Android -- Edge - -### Native only - -- Mac Safari -- iOS Safari - -Mac Safari does have MSE support, but native HLS is recommended - -### Flash Support -This plugin does not support Flash playback. Instead, it is recommended that users use the [videojs-flashls-source-handler](https://github.com/brightcove/videojs-flashls-source-handler) plugin as a fallback option for browsers that don't have a native -[HLS](https://caniuse.com/#feat=http-live-streaming)/[DASH](https://caniuse.com/#feat=mpeg-dash) player or support for [Media Source Extensions](http://caniuse.com/#feat=mediasource). - -### DRM - -DRM is supported through [videojs-contrib-eme](https://github.com/videojs/videojs-contrib-eme). In order to use DRM, include the videojs-contrib-eme plug, [initialize it](https://github.com/videojs/videojs-contrib-eme#initialization), and add options to either the [plugin](https://github.com/videojs/videojs-contrib-eme#plugin-options) or the [source](https://github.com/videojs/videojs-contrib-eme#source-options). - -Detailed option information can be found in the [videojs-contrib-eme README](https://github.com/videojs/videojs-contrib-eme/blob/master/README.md). - -## Documentation -[HTTP Live Streaming](https://developer.apple.com/streaming/) (HLS) has -become a de-facto standard for streaming video on mobile devices -thanks to its native support on iOS and Android. There are a number of -reasons independent of platform to recommend the format, though: - -- Supports (client-driven) adaptive bitrate selection -- Delivered over standard HTTP ports -- Simple, text-based manifest format -- No proprietary streaming servers required - -Unfortunately, all the major desktop browsers except for Safari are -missing HLS support. That leaves web developers in the unfortunate -position of having to maintain alternate renditions of the same video -and potentially having to forego HTML-based video entirely to provide -the best desktop viewing experience. - -This project addresses that situation by providing a polyfill for HLS -on browsers that have support for [Media Source -Extensions](http://caniuse.com/#feat=mediasource). -You can deploy a single HLS stream, code against the -regular HTML5 video APIs, and create a fast, high-quality video -experience across all the big web device categories. - -Check out the [full documentation](docs/README.md) for details on how HLS works -and advanced configuration. A description of the [adaptive switching -behavior](docs/bitrate-switching.md) is available, too. - -videojs-http-streaming supports a bunch of HLS features. Here -are some highlights: - -- video-on-demand and live playback modes -- backup or redundant streams -- mid-segment quality switching -- AES-128 segment encryption -- CEA-608 captions are automatically translated into standard HTML5 - [caption text tracks][0] -- In-Manifest WebVTT subtitles are automatically translated into standard HTML5 - subtitle tracks -- Timed ID3 Metadata is automatically translated into HTML5 metedata - text tracks -- Highly customizable adaptive bitrate selection -- Automatic bandwidth tracking -- Cross-domain credentials support with CORS -- Tight integration with video.js and a philosophy of exposing as much - as possible with standard HTML APIs -- Stream with multiple audio tracks and switching to those audio tracks - (see the docs folder) for info -- Media content in - [fragmented MP4s](https://developer.apple.com/videos/play/wwdc2016/504/) - instead of the MPEG2-TS container format. - -[0]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track - -For a more complete list of supported and missing features, refer to -[this doc](docs/supported-features.md). - -### Options -#### How to use - -##### Initialization -You may pass in an options object to the hls source handler at player -initialization. You can pass in options just like you would for other -parts of video.js: - -```javascript -// html5 for html hls -videojs(video, { - html5: { - vhs: { - withCredentials: true - } - } -}); -``` - -##### Source -Some options, such as `withCredentials` can be passed in to vhs during -`player.src` - -```javascript - -var player = videojs('some-video-id'); - -player.src({ - src: 'https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8', - type: 'application/x-mpegURL', - withCredentials: true -}); -``` - -#### List -##### withCredentials -* Type: `boolean` -* can be used as a source option -* can be used as an initialization option - -When the `withCredentials` property is set to `true`, all XHR requests for -manifests and segments would have `withCredentials` set to `true` as well. This -enables storing and passing cookies from the server that the manifests and -segments live on. This has some implications on CORS because when set, the -`Access-Control-Allow-Origin` header cannot be set to `*`, also, the response -headers require the addition of `Access-Control-Allow-Credentials` header which -is set to `true`. -See html5rocks's [article](http://www.html5rocks.com/en/tutorials/cors/) -for more info. - -##### handleManifestRedirects -* Type: `boolean` -* Default: `false` -* can be used as a source option -* can be used as an initialization option - -When the `handleManifestRedirects` property is set to `true`, manifest requests -which are redirected will have their URL updated to the new URL for future -requests. - -##### useCueTags -* Type: `boolean` -* can be used as an initialization option - -When the `useCueTags` property is set to `true,` a text track is created with -label 'ad-cues' and kind 'metadata'. The track is then added to -`player.textTracks()`. Changes in active cue may be -tracked by following the Video.js cue points API for text tracks. For example: - -```javascript -let textTracks = player.textTracks(); -let cuesTrack; - -for (let i = 0; i < textTracks.length; i++) { -  if (textTracks[i].label === 'ad-cues') { -    cuesTrack = textTracks[i]; -  } -} - -cuesTrack.addEventListener('cuechange', function() { - let activeCues = cuesTrack.activeCues; - -  for (let i = 0; i < activeCues.length; i++) { - let activeCue = activeCues[i]; - -    console.log('Cue runs from ' + activeCue.startTime + - ' to ' + activeCue.endTime); -  } -}); -``` - -##### parse708captions -* Type: `boolean` -* Default: `true` -* can be used as an initialization option - -When set to `false`, 708 captions in the stream are not parsed and will not show up in text track lists or the captions menu. - -##### overrideNative -* Type: `boolean` -* can be used as an initialization option - -Try to use videojs-http-streaming even on platforms that provide some -level of HLS support natively. There are a number of platforms that -*technically* play back HLS content but aren't very reliable or are -missing features like CEA-608 captions support. When `overrideNative` -is true, if the platform supports Media Source Extensions -videojs-http-streaming will take over HLS playback to provide a more -consistent experience. - -```javascript -// via the constructor -var player = videojs('playerId', { - html5: { - vhs: { - overrideNative: true - }, - nativeAudioTracks: false, - nativeVideoTracks: false - } -}); -``` - -Since MSE playback may be desirable on all browsers with some native support other than Safari, `overrideNative: !videojs.browser.IS_SAFARI` could be used. - -##### blacklistDuration -* Type: `number` -* can be used as an initialization option - -When the `blacklistDuration` property is set to a time duration in seconds, -if a playlist is blacklisted, it will be blacklisted for a period of that -customized duration. This enables the blacklist duration to be configured -by the user. - -#### maxPlaylistRetries -* Type: `number` -* Default: `Infinity` -* can be used as an initialization option - -The max number of times that a playlist will retry loading following an error -before being indefinitely excluded from the rendition selection algorithm. Note: the number of retry attempts needs to _exceed_ this value before a playlist will be excluded. - -##### bandwidth -* Type: `number` -* can be used as an initialization option - -When the `bandwidth` property is set (bits per second), it will be used in -the calculation for initial playlist selection, before more bandwidth -information is seen by the player. - -##### useBandwidthFromLocalStorage -* Type: `boolean` -* can be used as an initialization option - -If true, `bandwidth` and `throughput` values are stored in and retrieved from local -storage on startup (for initial rendition selection). This setting is `false` by default. - -##### enableLowInitialPlaylist -* Type: `boolean` -* can be used as an initialization option - -When `enableLowInitialPlaylist` is set to true, it will be used to select -the lowest bitrate playlist initially. This helps to decrease playback start time. -This setting is `false` by default. - -##### limitRenditionByPlayerDimensions -* Type: `boolean` -* can be used as an initialization option - -When `limitRenditionByPlayerDimensions` is set to true, rendition -selection logic will take into account the player size and rendition -resolutions when making a decision. -This setting is `true` by default. - -##### useDevicePixelRatio -* Type: `boolean` -* can be used as an initialization option. - -If true, this will take the device pixel ratio into account when doing rendition switching. This means that if you have a player with the width of `540px` in a high density display with a device pixel ratio of 2, a rendition of `1080p` will be allowed. -This setting is `false` by default. - -##### smoothQualityChange -* NOTE: DEPRECATED -* Type: `boolean` -* can be used as a source option -* can be used as an initialization option - -smoothQualityChange is deprecated and will be removed in the next major version of VHS. - -Instead of its prior behavior, smoothQualityChange will now call fastQualityChange, which -clears the buffer, chooses a new rendition, and starts loading content from the current -playhead position. - -##### allowSeeksWithinUnsafeLiveWindow -* Type: `boolean` -* can be used as a source option - -When `allowSeeksWithinUnsafeLiveWindow` is set to `true`, if the active playlist is live -and a seek is made to a time between the safe live point (end of manifest minus three -times the target duration, -see [the hls spec](https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-6.3.3) -for details) and the end of the playlist, the seek is allowed, rather than corrected to -the safe live point. - -This option can help in instances where the live stream's target duration is greater than -the segment durations, playback ends up in the unsafe live window, and there are gaps in -the content. In this case the player will attempt to seek past the gaps but end up seeking -inside of the unsafe range, leading to a correction and seek back into a previously played -content. - -The property defaults to `false`. - -##### customTagParsers -* Type: `Array` -* can be used as a source option - -With `customTagParsers` you can pass an array of custom m3u8 tag parser objects. See https://github.com/videojs/m3u8-parser#custom-parsers - -##### customTagMappers -* Type: `Array` -* can be used as a source option - -Similar to `customTagParsers`, with `customTagMappers` you can pass an array of custom m3u8 tag mapper objects. See https://github.com/videojs/m3u8-parser#custom-parsers - -##### cacheEncryptionKeys -* Type: `boolean` -* can be used as a source option -* can be used as an initialization option - -This option forces the player to cache AES-128 encryption keys internally instead of requesting the key alongside every segment request. -This option defaults to `false`. - -##### handlePartialData -* Type: `boolean`, -* Default: `false` -* Use partial appends in the transmuxer and segment loader - -##### liveRangeSafeTimeDelta -* Type: `number`, -* Default: [`SAFE_TIME_DELTA`](https://github.com/videojs/http-streaming/blob/e7cb63af010779108336eddb5c8fd138d6390e95/src/ranges.js#L17) -* Allow to re-define length (in seconds) of time delta when you compare current time and the end of the buffered range. - -##### captionServices -* Type: `object` -* Default: undefined -* Provide extra information, like a label or a language, for instream (608 and 708) captions. - -The captionServices options object has properties that map to the caption services. Each property is an object itself that includes several properties, like a label or language. - -For 608 captions, the service names are `CC1`, `CC2`, `CC3`, and `CC4`. For 708 captions, the service names are `SERVICEn` where `n` is a digit between `1` and `63`. -###### Format -```js -{ - vhs: { - captionServices: { - [serviceName]: { - language: String, // optional - label: String, // optional - default: boolean // optional - } - } - } -} -``` -###### Example -```js -{ - vhs: { - captionServices: { - CC1: { - language: 'en', - label: 'English' - }, - SERVICE1: { - langauge: 'kr', - label: 'Korean', - default: true - } - } - } -} -``` - -### Runtime Properties -Runtime properties are attached to the tech object when HLS is in -use. You can get a reference to the VHS source handler like this: - -```javascript -var vhs = player.tech().vhs; -``` - -If you *were* thinking about modifying runtime properties in a -video.js plugin, we'd recommend you avoid it. Your plugin won't work -with videos that don't use videojs-http-streaming and the best plugins -work across all the media types that video.js supports. If you're -deploying videojs-http-streaming on your own website and want to make a -couple tweaks though, go for it! - -#### vhs.playlists.master -Type: `object` - -An object representing the parsed master playlist. If a media playlist -is loaded directly, a master playlist with only one entry will be -created. - -#### vhs.playlists.media -Type: `function` - -A function that can be used to retrieve or modify the currently active -media playlist. The active media playlist is referred to when -additional video data needs to be downloaded. Calling this function -with no arguments returns the parsed playlist object for the active -media playlist. Calling this function with a playlist object from the -master playlist or a URI string as specified in the master playlist -will kick off an asynchronous load of the specified media -playlist. Once it has been retreived, it will become the active media -playlist. - -#### vhs.systemBandwidth -Type: `number` - -`systemBandwidth` is a combination of two serial processes' bitrates. The first -is the network bitrate provided by `bandwidth` and the second is the bitrate of -the entire process after that (decryption, transmuxing, and appending) provided -by `throughput`. This value is used by the default implementation of `selectPlaylist` -to select an appropriate bitrate to play. - -Since the two process are serial, the overall system bandwidth is given by: -`systemBandwidth = 1 / (1 / bandwidth + 1 / throughput)` - -#### vhs.bandwidth -Type: `number` - -The number of bits downloaded per second in the last segment download. - -Before the first video segment has been downloaded, it's hard to -estimate bandwidth accurately. The HLS tech uses a starting value of 4194304 or 0.5 MB/s. If you -have a more accurate source of bandwidth information, you can override -this value as soon as the HLS tech has loaded to provide an initial -bandwidth estimate. - -#### vhs.throughput -Type: `number` - -The number of bits decrypted, transmuxed, and appended per second as a cumulative average across active processing time. - -#### vhs.selectPlaylist -Type: `function` - -A function that returns the media playlist object to use to download -the next segment. It is invoked by the tech immediately before a new -segment is downloaded. You can override this function to provide your -adaptive streaming logic. You must, however, be sure to return a valid -media playlist object that is present in `player.tech().vhs.master`. - -Overridding this function with your own is very powerful but is overkill -for many purposes. Most of the time, you should use the much simpler -function below to selectively enable or disable a playlist from the -adaptive streaming logic. - -#### vhs.representations -Type: `function` - -It is recommended to include the [videojs-contrib-quality-levels](https://github.com/videojs/videojs-contrib-quality-levels) plugin to your page so that videojs-http-streaming will automatically populate the QualityLevelList exposed on the player by the plugin. You can access this list by calling `player.qualityLevels()`. See the [videojs-contrib-quality-levels project page](https://github.com/videojs/videojs-contrib-quality-levels) for more information on how to use the api. - -Example, only enabling representations with a width greater than or equal to 720: - -```javascript -var qualityLevels = player.qualityLevels(); - -for (var i = 0; i < qualityLevels.length; i++) { - var quality = qualityLevels[i]; - if (quality.width >= 720) { - quality.enabled = true; - } else { - quality.enabled = false; - } -} -``` - -If including [videojs-contrib-quality-levels](https://github.com/videojs/videojs-contrib-quality-levels) is not an option, you can use the representations api. To get all of the available representations, call the `representations()` method on `player.tech().vhs`. This will return a list of plain objects, each with `width`, `height`, `bandwidth`, and `id` properties, and an `enabled()` method. - -```javascript -player.tech().vhs.representations(); -``` - -To see whether the representation is enabled or disabled, call its `enabled()` method with no arguments. To set whether it is enabled/disabled, call its `enabled()` method and pass in a boolean value. Calling `.enabled(true)` will allow the adaptive bitrate algorithm to select the representation while calling `.enabled(false)` will disallow any selection of that representation. - -Example, only enabling representations with a width greater than or equal to 720: - -```javascript -player.tech().vhs.representations().forEach(function(rep) { - if (rep.width >= 720) { - rep.enabled(true); - } else { - rep.enabled(false); - } -}); -``` - -#### vhs.xhr -Type: `function` - -The xhr function that is used by HLS internally is exposed on the per- -player `vhs` object. While it is possible, we do not recommend replacing -the function with your own implementation. Instead, the `xhr` provides -the ability to specify a `beforeRequest` function that will be called -with an object containing the options that will be used to create the -xhr request. - -Example: -```javascript -player.tech().vhs.xhr.beforeRequest = function(options) { - options.uri = options.uri.replace('example.com', 'foo.com'); - - return options; -}; -``` - -The global `videojs.Vhs` also exposes an `xhr` property. Specifying a -`beforeRequest` function on that will allow you to intercept the options -for *all* requests in every player on a page. For consistency across -browsers the video source should be set at runtime once the video player -is ready. - -Example -```javascript -videojs.Vhs.xhr.beforeRequest = function(options) { - /* - * Modifications to requests that will affect every player. - */ - - return options; -}; - -var player = videojs('video-player-id'); -player.ready(function() { - this.src({ - src: 'https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8', - type: 'application/x-mpegURL', - }); -}); -``` - -For information on the type of options that you can modify see the -documentation at [https://github.com/Raynos/xhr](https://github.com/Raynos/xhr). - -#### vhs.stats -Type: `object` - -This object contains a summary of HLS and player related stats. - -| Property Name | Type | Description | -| --------------------- | ------ | ----------- | -| bandwidth | number | Rate of the last segment download in bits/second | -| mediaRequests | number | Total number of media segment requests | -| mediaRequestsAborted | number | Total number of aborted media segment requests | -| mediaRequestsTimedout | number | Total number of timedout media segment requests | -| mediaRequestsErrored | number | Total number of errored media segment requests | -| mediaTransferDuration | number | Total time spent downloading media segments in milliseconds | -| mediaBytesTransferred | number | Total number of content bytes downloaded | -| mediaSecondsLoaded | number | Total number of content seconds downloaded | -| buffered | array | List of time ranges of content that are in the SourceBuffer | -| currentTime | number | The current position of the player | -| currentSource | object | The source object. Has the structure `{src: 'url', type: 'mimetype'}` | -| currentTech | string | The name of the tech in use | -| duration | number | Duration of the video in seconds | -| master | object | The [master playlist object](#vhsplaylistsmaster) | -| playerDimensions | object | Contains the width and height of the player | -| seekable | array | List of time ranges that the player can seek to | -| timestamp | number | Timestamp of when `vhs.stats` was accessed | -| videoPlaybackQuality | object | Media playback quality metrics as specified by the [W3C's Media Playback Quality API](https://wicg.github.io/media-playback-quality/) | - - -### Events -Standard HTML video events are handled by video.js automatically and -are triggered on the player object. - -#### loadedmetadata - -Fired after the first segment is downloaded for a playlist. This will not happen -until playback if video.js's `metadata` setting is `none` - -### VHS Usage Events - -Usage tracking events are fired when we detect a certain HLS feature, encoding setting, -or API is used. These can be helpful for analytics, and to pinpoint the cause of HLS errors. -For instance, if errors are being fired in tandem with a usage event indicating that the -player was playing an AES encrypted stream, then we have a possible avenue to explore when -debugging the error. - -Note that although these usage events are listed below, they may change at any time without -a major version change. - -VHS usage events are triggered on the tech with the exception of the 3 vhs-reload-error -events, which are triggered on the player. - -To listen for usage events triggered on the tech, listen for the event type of `'usage'`: - -```javascript -player.on('ready', () => { - player.tech().on('usage', (e) => { - console.log(e.name); - }); -}); -``` - -Note that these events are triggered as soon as a case is encountered, and often only -once. For example, the `vhs-demuxed` usage event will be triggered as soon as the master -manifest is downloaded and parsed, and will not be triggered again. - -#### Presence Stats - -Each of the following usage events are fired once per source if (and when) detected: - -| Name | Description | -| ------------- | ------------- | -| vhs-webvtt | master manifest has at least one segmented WebVTT playlist | -| vhs-aes | a playlist is AES encrypted | -| vhs-fmp4 | a playlist used fMP4 segments | -| vhs-demuxed | audio and video are demuxed by default | -| vhs-alternate-audio | alternate audio available in the master manifest | -| vhs-playlist-cue-tags | a playlist used cue tags (see useCueTags(#usecuetags) for details) | -| vhs-bandwidth-from-local-storage | starting bandwidth was retrieved from local storage (see useBandwidthFromLocalStorage(#useBandwidthFromLocalStorage) for details) | -| vhs-throughput-from-local-storage | starting throughput was retrieved from local storage (see useBandwidthFromLocalStorage(#useBandwidthFromLocalStorage) for details) | - -#### Use Stats - -Each of the following usage events are fired per use: - -| Name | Description | -| ------------- | ------------- | -| vhs-gap-skip | player skipped a gap in the buffer | -| vhs-player-access | player.vhs was accessed | -| vhs-audio-change | a user selected an alternate audio stream | -| vhs-rendition-disabled | a rendition was disabled | -| vhs-rendition-enabled | a rendition was enabled | -| vhs-rendition-blacklisted | a rendition was blacklisted | -| vhs-timestamp-offset | a timestamp offset was set in HLS (can identify discontinuities) | -| vhs-unknown-waiting | the player stopped for an unknown reason and we seeked to current time try to address it | -| vhs-live-resync | playback fell off the back of a live playlist and we resynced to the live point | -| vhs-video-underflow | we seeked to current time to address video underflow | -| vhs-error-reload-initialized | the reloadSourceOnError plugin was initialized | -| vhs-error-reload | the reloadSourceOnError plugin reloaded a source | -| vhs-error-reload-canceled | an error occurred too soon after the last reload, so we didn't reload again (to prevent error loops) | - - -### In-Band Metadata -The HLS tech supports [timed -metadata](https://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/HTTP_Live_Streaming_Metadata_Spec/Introduction/Introduction.html) -embedded as [ID3 tags](http://id3.org/id3v2.3.0). When a stream is -encountered with embedded metadata, an [in-band metadata text -track](https://html.spec.whatwg.org/multipage/embedded-content.html#text-track-in-band-metadata-track-dispatch-type) -will automatically be created and populated with cues as they are -encountered in the stream. UTF-8 encoded -[TXXX](http://id3.org/id3v2.3.0#User_defined_text_information_frame) -and [WXXX](http://id3.org/id3v2.3.0#User_defined_URL_link_frame) ID3 -frames are mapped to cue points and their values set as the cue -text. Cues are created for all other frame types and the data is -attached to the generated cue: - -```javascript -cue.value.data -``` - -There are lots of guides and references to using text tracks [around -the web](http://www.html5rocks.com/en/tutorials/track/basics/). - -### Segment Metadata -You can get metadata about the segments currently in the buffer by using the `segment-metadata` -text track. You can get the metadata of the currently rendered segment by looking at the -track's `activeCues` array. The metadata will be attached to the `cue.value` property and -will have this structure - -```javascript -cue.value = { - byteLength, // The size of the segment in bytes - bandwidth, // The peak bitrate reported by the segment's playlist - resolution, // The resolution reported by the segment's playlist - codecs, // The codecs reported by the segment's playlist - uri, // The Segment uri - timeline, // Timeline of the segment for detecting discontinuities - playlist, // The Playlist uri - start, // Segment start time - end // Segment end time -}; -``` - -Example: -Detect when a change in quality is rendered on screen -```javascript -let tracks = player.textTracks(); -let segmentMetadataTrack; - -for (let i = 0; i < tracks.length; i++) { - if (tracks[i].label === 'segment-metadata') { - segmentMetadataTrack = tracks[i]; - } -} - -let previousPlaylist; - -if (segmentMetadataTrack) { - segmentMetadataTrack.on('cuechange', function() { - let activeCue = segmentMetadataTrack.activeCues[0]; - - if (activeCue) { - if (previousPlaylist !== activeCue.value.playlist) { - console.log('Switched from rendition ' + previousPlaylist + - ' to rendition ' + activeCue.value.playlist); - } - previousPlaylist = activeCue.value.playlist; - } - }); -} -``` - -### Object as Source - -*Note* that this is an advanced use-case, and may be more fragile for production -environments, as the schema for a VHS object and how it's used internally are not set in -stone and may change in future releases. - -In normal use, VHS accepts a URL as the source of the video. But VHS also has the ability -to accept a JSON object as the source. - -Passing a JSON object as the source has many uses. A couple of examples include: -* The manifest has already been downloaded, so there's no need to make another request -* You want to change some aspect of the manifest, e.g., add a segment, without modifying - the manifest itself - -In order to pass a JSON object as the source, provide a parsed manifest object in via a -[data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs), -and using the "vnd.videojs.vhs+json" media type when setting the source type. For instance: - -``` -var player = videojs('some-video-id'); -const parser = new M3u8Parser(); - -parser.push(manifestString); -parser.end(); - -player.src({ - src: `data:application/vnd.videojs.vhs+json,${JSON.stringify(parser.manifest)}`, - type: 'application/vnd.videojs.vhs+json' -}); -``` - -The manifest object should follow the "VHS manifest object schema" (a somewhat flexible -and informally documented structure) provided in the README of -[m3u8-parser](https://github.com/videojs/m3u8-parser) and -[mpd-parser](https://github.com/videojs/mpd-parser). This may be referred to in the -project as `vhs-json`. - -## Hosting Considerations -Unlike a native HLS implementation, the HLS tech has to comply with -the browser's security policies. That means that all the files that -make up the stream must be served from the same domain as the page -hosting the video player or from a server that has appropriate [CORS -headers](https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS) -configured. Easy [instructions are -available](http://enable-cors.org/server.html) for popular webservers -and most CDNs should have no trouble turning CORS on for your account. - - -## Known Issues and Workarounds -Issues that are currenty known. If you want to -help find a solution that would be appreciated! - -### Fragmented MP4 Support -Edge has native support for HLS but only in the MPEG2-TS container. If -you attempt to play an HLS stream with fragmented MP4 segments (without -[overriding native playback](#overridenative)), Edge will stall. -Fragmented MP4s are only supported on browsers that have -[Media Source Extensions](http://caniuse.com/#feat=mediasource) available. - -### Assets with an Audio-Only Rate Get Stuck in Audio-Only -Some assets which have an audio-only rate and the lowest-bandwidth -audio + video rate isn't that low get stuck in audio-only mode. This is -because the initial bandwidth calculation thinks it there's insufficient -bandwidth for selecting the lowest-quality audio+video playlist, so it picks -the only-audio one, which unfortunately locks it to being audio-only forever, -preventing a switch to the audio+video playlist when it gets a better -estimation of bandwidth. - -Until we've implemented a full fix, it is recommended to set the -[`enableLowInitialPlaylist` option](#enablelowinitialplaylist) for any assets -that include an audio-only rate; it should always select the lowest-bandwidth -audio+video playlist for its first playlist. - -It's also worth mentioning that Apple no longer requires having an audio-only -rate; instead, they require a 192kbps audio+video rate (see Apple's current -[HLS Authoring Specification][]). Removing the audio-only rate would of course -eliminate this problem since there would be only audio+video playlists to -choose from. - -Follow progress on this in issue [#175](https://github.com/videojs/http-streaming/issues/175). - -[HLS Authoring Specification]: https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices - -### DASH Assets with `$Time` Interpolation and `SegmentTimeline`s with No `t` - -DASH assets which use `$Time` in a `SegmentTemplate`, and also have a -`SegmentTimeline` where only the first `S` has a `t` and the rest only have a -`d`, do not load currently. - -There is currently no workaround for this, but you can track progress on this -in issue [#256](https://github.com/videojs/http-streaming/issues/256). - -## Testing - -For testing, you run `npm run test`. You will need Chrome and Firefox for running the tests. - -_videojs-http-streaming uses [BrowserStack](https://browserstack.com) for compatibility testing._ - -## Debugging - -videojs-http-streaming makes use of `videojs.log` for debug logging. You can enable these logs -by setting the log level to `debug` using `videojs.log.level('debug')`. You can access a complete -history of the logs using `videojs.log.history()`. This history is maintained even when the -log level is not set to `debug`. - -`vhs.stats` can also be helpful when debugging. Accessing this object will give you -a snapshot summary of various HLS and player stats. See [vhs.stats](#vhsstats) for details -about what this object contains. - -__NOTE__: The `debug` level is only available in video.js v6.6.0+. With earlier versions of -video.js, no debug messages will be logged to console. - -## Release History -Check out the [changelog](CHANGELOG.md) for a summary of each release. - -## Building -To build a copy of videojs-http-streaming run the following commands - -```bash -git clone https://github.com/videojs/http-streaming -cd http-streaming -npm i -npm run build -``` - -videojs-http-streaming will have created all of the files for using it in a dist folder - -## Development - -### Tools -* Download stream locally with the [HLS Fetcher](https://github.com/videojs/hls-fetcher) -* Simulate errors with [Murphy](https://github.com/videojs/murphy) -* Inspect content with [Thumbcoil](http://thumb.co.il) - -### Commands -All commands for development are listed in the `package.json` file and are run using -```bash -npm run -``` - -[slack-icon]: http://slack.videojs.com/badge.svg -[slack-link]: http://slack.videojs.com -[travis-icon]: https://travis-ci.org/videojs/http-streaming.svg?branch=main -[travis-link]: https://travis-ci.org/videojs/http-streaming -[issue-stats-link]: http://issuestats.com/github/videojs/http-streaming -[issue-stats-pr-icon]: http://issuestats.com/github/videojs/http-streaming/badge/pr -[issue-stats-issues-icon]: http://issuestats.com/github/videojs/http-streaming/badge/issue -[greenkeeper-icon]: https://badges.greenkeeper.io/videojs/http-streaming.svg -[greenkeeper-link]: https://greenkeeper.io/ diff --git a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming-sync-workers.js b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming-sync-workers.js deleted file mode 100644 index e0baef8..0000000 --- a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming-sync-workers.js +++ /dev/null @@ -1,30919 +0,0 @@ -/*! @name @videojs/http-streaming @version 2.9.1 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('global/document'), require('global/window'), require('video.js'), require('xmldom')) : - typeof define === 'function' && define.amd ? define(['exports', 'global/document', 'global/window', 'video.js', 'xmldom'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.httpStreaming = {}, global.document, global.window, global.videojs, global.window)); -}(this, (function (exports, document, window, videojs, xmldom) { 'use strict'; - - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - - var document__default = /*#__PURE__*/_interopDefaultLegacy(document); - var window__default = /*#__PURE__*/_interopDefaultLegacy(window); - var videojs__default = /*#__PURE__*/_interopDefaultLegacy(videojs); - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function (path, base) { - return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var assertThisInitialized = createCommonjsModule(function (module) { - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; - } - - module.exports = _assertThisInitialized; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - - var setPrototypeOf = createCommonjsModule(function (module) { - function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _setPrototypeOf(o, p); - } - - module.exports = _setPrototypeOf; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - - var inheritsLoose = createCommonjsModule(function (module) { - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); - } - - module.exports = _inheritsLoose; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - - var urlToolkit = createCommonjsModule(function (module, exports) { - // see https://tools.ietf.org/html/rfc1808 - (function (root) { - var URL_REGEX = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/; - var FIRST_SEGMENT_REGEX = /^([^\/?#]*)(.*)$/; - var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g; - var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g; - var URLToolkit = { - // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or // - // E.g - // With opts.alwaysNormalize = false (default, spec compliant) - // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g - // With opts.alwaysNormalize = true (not spec compliant) - // http://a.com/b/cd + /e/f/../g => http://a.com/e/g - buildAbsoluteURL: function buildAbsoluteURL(baseURL, relativeURL, opts) { - opts = opts || {}; // remove any remaining space and CRLF - - baseURL = baseURL.trim(); - relativeURL = relativeURL.trim(); - - if (!relativeURL) { - // 2a) If the embedded URL is entirely empty, it inherits the - // entire base URL (i.e., is set equal to the base URL) - // and we are done. - if (!opts.alwaysNormalize) { - return baseURL; - } - - var basePartsForNormalise = URLToolkit.parseURL(baseURL); - - if (!basePartsForNormalise) { - throw new Error('Error trying to parse base URL.'); - } - - basePartsForNormalise.path = URLToolkit.normalizePath(basePartsForNormalise.path); - return URLToolkit.buildURLFromParts(basePartsForNormalise); - } - - var relativeParts = URLToolkit.parseURL(relativeURL); - - if (!relativeParts) { - throw new Error('Error trying to parse relative URL.'); - } - - if (relativeParts.scheme) { - // 2b) If the embedded URL starts with a scheme name, it is - // interpreted as an absolute URL and we are done. - if (!opts.alwaysNormalize) { - return relativeURL; - } - - relativeParts.path = URLToolkit.normalizePath(relativeParts.path); - return URLToolkit.buildURLFromParts(relativeParts); - } - - var baseParts = URLToolkit.parseURL(baseURL); - - if (!baseParts) { - throw new Error('Error trying to parse base URL.'); - } - - if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') { - // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc - // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a' - var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path); - baseParts.netLoc = pathParts[1]; - baseParts.path = pathParts[2]; - } - - if (baseParts.netLoc && !baseParts.path) { - baseParts.path = '/'; - } - - var builtParts = { - // 2c) Otherwise, the embedded URL inherits the scheme of - // the base URL. - scheme: baseParts.scheme, - netLoc: relativeParts.netLoc, - path: null, - params: relativeParts.params, - query: relativeParts.query, - fragment: relativeParts.fragment - }; - - if (!relativeParts.netLoc) { - // 3) If the embedded URL's is non-empty, we skip to - // Step 7. Otherwise, the embedded URL inherits the - // (if any) of the base URL. - builtParts.netLoc = baseParts.netLoc; // 4) If the embedded URL path is preceded by a slash "/", the - // path is not relative and we skip to Step 7. - - if (relativeParts.path[0] !== '/') { - if (!relativeParts.path) { - // 5) If the embedded URL path is empty (and not preceded by a - // slash), then the embedded URL inherits the base URL path - builtParts.path = baseParts.path; // 5a) if the embedded URL's is non-empty, we skip to - // step 7; otherwise, it inherits the of the base - // URL (if any) and - - if (!relativeParts.params) { - builtParts.params = baseParts.params; // 5b) if the embedded URL's is non-empty, we skip to - // step 7; otherwise, it inherits the of the base - // URL (if any) and we skip to step 7. - - if (!relativeParts.query) { - builtParts.query = baseParts.query; - } - } - } else { - // 6) The last segment of the base URL's path (anything - // following the rightmost slash "/", or the entire path if no - // slash is present) is removed and the embedded URL's path is - // appended in its place. - var baseURLPath = baseParts.path; - var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + relativeParts.path; - builtParts.path = URLToolkit.normalizePath(newPath); - } - } - } - - if (builtParts.path === null) { - builtParts.path = opts.alwaysNormalize ? URLToolkit.normalizePath(relativeParts.path) : relativeParts.path; - } - - return URLToolkit.buildURLFromParts(builtParts); - }, - parseURL: function parseURL(url) { - var parts = URL_REGEX.exec(url); - - if (!parts) { - return null; - } - - return { - scheme: parts[1] || '', - netLoc: parts[2] || '', - path: parts[3] || '', - params: parts[4] || '', - query: parts[5] || '', - fragment: parts[6] || '' - }; - }, - normalizePath: function normalizePath(path) { - // The following operations are - // then applied, in order, to the new path: - // 6a) All occurrences of "./", where "." is a complete path - // segment, are removed. - // 6b) If the path ends with "." as a complete path segment, - // that "." is removed. - path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, ''); // 6c) All occurrences of "/../", where is a - // complete path segment not equal to "..", are removed. - // Removal of these path segments is performed iteratively, - // removing the leftmost matching pattern on each iteration, - // until no matching pattern remains. - // 6d) If the path ends with "/..", where is a - // complete path segment not equal to "..", that - // "/.." is removed. - - while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length) {} - - return path.split('').reverse().join(''); - }, - buildURLFromParts: function buildURLFromParts(parts) { - return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment; - } - }; - module.exports = URLToolkit; - })(); - }); - - var DEFAULT_LOCATION = 'http://example.com'; - - var resolveUrl$1 = function resolveUrl(baseUrl, relativeUrl) { - // return early if we don't need to resolve - if (/^[a-z]+:/i.test(relativeUrl)) { - return relativeUrl; - } // if baseUrl is a data URI, ignore it and resolve everything relative to window.location - - - if (/^data:/.test(baseUrl)) { - baseUrl = window__default['default'].location && window__default['default'].location.href || ''; - } // IE11 supports URL but not the URL constructor - // feature detect the behavior we want - - - var nativeURL = typeof window__default['default'].URL === 'function'; - var protocolLess = /^\/\//.test(baseUrl); // remove location if window.location isn't available (i.e. we're in node) - // and if baseUrl isn't an absolute url - - var removeLocation = !window__default['default'].location && !/\/\//i.test(baseUrl); // if the base URL is relative then combine with the current location - - if (nativeURL) { - baseUrl = new window__default['default'].URL(baseUrl, window__default['default'].location || DEFAULT_LOCATION); - } else if (!/\/\//i.test(baseUrl)) { - baseUrl = urlToolkit.buildAbsoluteURL(window__default['default'].location && window__default['default'].location.href || '', baseUrl); - } - - if (nativeURL) { - var newUrl = new URL(relativeUrl, baseUrl); // if we're a protocol-less url, remove the protocol - // and if we're location-less, remove the location - // otherwise, return the url unmodified - - if (removeLocation) { - return newUrl.href.slice(DEFAULT_LOCATION.length); - } else if (protocolLess) { - return newUrl.href.slice(newUrl.protocol.length); - } - - return newUrl.href; - } - - return urlToolkit.buildAbsoluteURL(baseUrl, relativeUrl); - }; - - /** - * @file resolve-url.js - Handling how URLs are resolved and manipulated - */ - var resolveUrl = resolveUrl$1; - /** - * Checks whether xhr request was redirected and returns correct url depending - * on `handleManifestRedirects` option - * - * @api private - * - * @param {string} url - an url being requested - * @param {XMLHttpRequest} req - xhr request result - * - * @return {string} - */ - - var resolveManifestRedirect = function resolveManifestRedirect(handleManifestRedirect, url, req) { - // To understand how the responseURL below is set and generated: - // - https://fetch.spec.whatwg.org/#concept-response-url - // - https://fetch.spec.whatwg.org/#atomic-http-redirect-handling - if (handleManifestRedirect && req && req.responseURL && url !== req.responseURL) { - return req.responseURL; - } - - return url; - }; - - var logger = function logger(source) { - if (videojs__default['default'].log.debug) { - return videojs__default['default'].log.debug.bind(videojs__default['default'], 'VHS:', source + " >"); - } - - return function () {}; - }; - - var _extends_1 = createCommonjsModule(function (module) { - function _extends() { - module.exports = _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _extends.apply(this, arguments); - } - - module.exports = _extends; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - - /** - * @file stream.js - */ - - /** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ - var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; - }(); - - var atob = function atob(s) { - return window__default['default'].atob ? window__default['default'].atob(s) : Buffer.from(s, 'base64').toString('binary'); - }; - - function decodeB64ToUint8Array(b64Text) { - var decodedString = atob(b64Text); - var array = new Uint8Array(decodedString.length); - - for (var i = 0; i < decodedString.length; i++) { - array[i] = decodedString.charCodeAt(i); - } - - return array; - } - - /*! @name m3u8-parser @version 4.7.0 @license Apache-2.0 */ - /** - * A stream that buffers string input and generates a `data` event for each - * line. - * - * @class LineStream - * @extends Stream - */ - - var LineStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(LineStream, _Stream); - - function LineStream() { - var _this; - - _this = _Stream.call(this) || this; - _this.buffer = ''; - return _this; - } - /** - * Add new data to be parsed. - * - * @param {string} data the text to process - */ - - - var _proto = LineStream.prototype; - - _proto.push = function push(data) { - var nextNewline; - this.buffer += data; - nextNewline = this.buffer.indexOf('\n'); - - for (; nextNewline > -1; nextNewline = this.buffer.indexOf('\n')) { - this.trigger('data', this.buffer.substring(0, nextNewline)); - this.buffer = this.buffer.substring(nextNewline + 1); - } - }; - - return LineStream; - }(Stream); - - var TAB = String.fromCharCode(0x09); - - var parseByterange = function parseByterange(byterangeString) { - // optionally match and capture 0+ digits before `@` - // optionally match and capture 0+ digits after `@` - var match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || ''); - var result = {}; - - if (match[1]) { - result.length = parseInt(match[1], 10); - } - - if (match[2]) { - result.offset = parseInt(match[2], 10); - } - - return result; - }; - /** - * "forgiving" attribute list psuedo-grammar: - * attributes -> keyvalue (',' keyvalue)* - * keyvalue -> key '=' value - * key -> [^=]* - * value -> '"' [^"]* '"' | [^,]* - */ - - - var attributeSeparator = function attributeSeparator() { - var key = '[^=]*'; - var value = '"[^"]*"|[^,]*'; - var keyvalue = '(?:' + key + ')=(?:' + value + ')'; - return new RegExp('(?:^|,)(' + keyvalue + ')'); - }; - /** - * Parse attributes from a line given the separator - * - * @param {string} attributes the attribute line to parse - */ - - - var parseAttributes$1 = function parseAttributes(attributes) { - // split the string using attributes as the separator - var attrs = attributes.split(attributeSeparator()); - var result = {}; - var i = attrs.length; - var attr; - - while (i--) { - // filter out unmatched portions of the string - if (attrs[i] === '') { - continue; - } // split the key and value - - - attr = /([^=]*)=(.*)/.exec(attrs[i]).slice(1); // trim whitespace and remove optional quotes around the value - - attr[0] = attr[0].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^['"](.*)['"]$/g, '$1'); - result[attr[0]] = attr[1]; - } - - return result; - }; - /** - * A line-level M3U8 parser event stream. It expects to receive input one - * line at a time and performs a context-free parse of its contents. A stream - * interpretation of a manifest can be useful if the manifest is expected to - * be too large to fit comfortably into memory or the entirety of the input - * is not immediately available. Otherwise, it's probably much easier to work - * with a regular `Parser` object. - * - * Produces `data` events with an object that captures the parser's - * interpretation of the input. That object has a property `tag` that is one - * of `uri`, `comment`, or `tag`. URIs only have a single additional - * property, `line`, which captures the entirety of the input without - * interpretation. Comments similarly have a single additional property - * `text` which is the input without the leading `#`. - * - * Tags always have a property `tagType` which is the lower-cased version of - * the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance, - * `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized - * tags are given the tag type `unknown` and a single additional property - * `data` with the remainder of the input. - * - * @class ParseStream - * @extends Stream - */ - - - var ParseStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(ParseStream, _Stream); - - function ParseStream() { - var _this; - - _this = _Stream.call(this) || this; - _this.customParsers = []; - _this.tagMappers = []; - return _this; - } - /** - * Parses an additional line of input. - * - * @param {string} line a single line of an M3U8 file to parse - */ - - - var _proto = ParseStream.prototype; - - _proto.push = function push(line) { - var _this2 = this; - - var match; - var event; // strip whitespace - - line = line.trim(); - - if (line.length === 0) { - // ignore empty lines - return; - } // URIs - - - if (line[0] !== '#') { - this.trigger('data', { - type: 'uri', - uri: line - }); - return; - } // map tags - - - var newLines = this.tagMappers.reduce(function (acc, mapper) { - var mappedLine = mapper(line); // skip if unchanged - - if (mappedLine === line) { - return acc; - } - - return acc.concat([mappedLine]); - }, [line]); - newLines.forEach(function (newLine) { - for (var i = 0; i < _this2.customParsers.length; i++) { - if (_this2.customParsers[i].call(_this2, newLine)) { - return; - } - } // Comments - - - if (newLine.indexOf('#EXT') !== 0) { - _this2.trigger('data', { - type: 'comment', - text: newLine.slice(1) - }); - - return; - } // strip off any carriage returns here so the regex matching - // doesn't have to account for them. - - - newLine = newLine.replace('\r', ''); // Tags - - match = /^#EXTM3U/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'm3u' - }); - - return; - } - - match = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'inf' - }; - - if (match[1]) { - event.duration = parseFloat(match[1]); - } - - if (match[2]) { - event.title = match[2]; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'targetduration' - }; - - if (match[1]) { - event.duration = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'version' - }; - - if (match[1]) { - event.version = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'media-sequence' - }; - - if (match[1]) { - event.number = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'discontinuity-sequence' - }; - - if (match[1]) { - event.number = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'playlist-type' - }; - - if (match[1]) { - event.playlistType = match[1]; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-BYTERANGE:?(.*)?$/.exec(newLine); - - if (match) { - event = _extends_1(parseByterange(match[1]), { - type: 'tag', - tagType: 'byterange' - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'allow-cache' - }; - - if (match[1]) { - event.allowed = !/NO/.test(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MAP:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'map' - }; - - if (match[1]) { - var attributes = parseAttributes$1(match[1]); - - if (attributes.URI) { - event.uri = attributes.URI; - } - - if (attributes.BYTERANGE) { - event.byterange = parseByterange(attributes.BYTERANGE); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'stream-inf' - }; - - if (match[1]) { - event.attributes = parseAttributes$1(match[1]); - - if (event.attributes.RESOLUTION) { - var split = event.attributes.RESOLUTION.split('x'); - var resolution = {}; - - if (split[0]) { - resolution.width = parseInt(split[0], 10); - } - - if (split[1]) { - resolution.height = parseInt(split[1], 10); - } - - event.attributes.RESOLUTION = resolution; - } - - if (event.attributes.BANDWIDTH) { - event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10); - } - - if (event.attributes['PROGRAM-ID']) { - event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MEDIA:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'media' - }; - - if (match[1]) { - event.attributes = parseAttributes$1(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-ENDLIST/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'endlist' - }); - - return; - } - - match = /^#EXT-X-DISCONTINUITY/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'discontinuity' - }); - - return; - } - - match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'program-date-time' - }; - - if (match[1]) { - event.dateTimeString = match[1]; - event.dateTimeObject = new Date(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-KEY:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'key' - }; - - if (match[1]) { - event.attributes = parseAttributes$1(match[1]); // parse the IV string into a Uint32Array - - if (event.attributes.IV) { - if (event.attributes.IV.substring(0, 2).toLowerCase() === '0x') { - event.attributes.IV = event.attributes.IV.substring(2); - } - - event.attributes.IV = event.attributes.IV.match(/.{8}/g); - event.attributes.IV[0] = parseInt(event.attributes.IV[0], 16); - event.attributes.IV[1] = parseInt(event.attributes.IV[1], 16); - event.attributes.IV[2] = parseInt(event.attributes.IV[2], 16); - event.attributes.IV[3] = parseInt(event.attributes.IV[3], 16); - event.attributes.IV = new Uint32Array(event.attributes.IV); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-START:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'start' - }; - - if (match[1]) { - event.attributes = parseAttributes$1(match[1]); - event.attributes['TIME-OFFSET'] = parseFloat(event.attributes['TIME-OFFSET']); - event.attributes.PRECISE = /YES/.test(event.attributes.PRECISE); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-out-cont' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-out' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-in' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-SKIP:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'skip' - }; - event.attributes = parseAttributes$1(match[1]); - - if (event.attributes.hasOwnProperty('SKIPPED-SEGMENTS')) { - event.attributes['SKIPPED-SEGMENTS'] = parseInt(event.attributes['SKIPPED-SEGMENTS'], 10); - } - - if (event.attributes.hasOwnProperty('RECENTLY-REMOVED-DATERANGES')) { - event.attributes['RECENTLY-REMOVED-DATERANGES'] = event.attributes['RECENTLY-REMOVED-DATERANGES'].split(TAB); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PART:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part' - }; - event.attributes = parseAttributes$1(match[1]); - ['DURATION'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - ['INDEPENDENT', 'GAP'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = /YES/.test(event.attributes[key]); - } - }); - - if (event.attributes.hasOwnProperty('BYTERANGE')) { - event.attributes.byterange = parseByterange(event.attributes.BYTERANGE); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'server-control' - }; - event.attributes = parseAttributes$1(match[1]); - ['CAN-SKIP-UNTIL', 'PART-HOLD-BACK', 'HOLD-BACK'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - ['CAN-SKIP-DATERANGES', 'CAN-BLOCK-RELOAD'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = /YES/.test(event.attributes[key]); - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part-inf' - }; - event.attributes = parseAttributes$1(match[1]); - ['PART-TARGET'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'preload-hint' - }; - event.attributes = parseAttributes$1(match[1]); - ['BYTERANGE-START', 'BYTERANGE-LENGTH'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - var subkey = key === 'BYTERANGE-LENGTH' ? 'length' : 'offset'; - event.attributes.byterange = event.attributes.byterange || {}; - event.attributes.byterange[subkey] = event.attributes[key]; // only keep the parsed byterange object. - - delete event.attributes[key]; - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'rendition-report' - }; - event.attributes = parseAttributes$1(match[1]); - ['LAST-MSN', 'LAST-PART'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - } - }); - - _this2.trigger('data', event); - - return; - } // unknown tag type - - - _this2.trigger('data', { - type: 'tag', - data: newLine.slice(4) - }); - }); - } - /** - * Add a parser for custom headers - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.customType the custom type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - ; - - _proto.addParser = function addParser(_ref) { - var _this3 = this; - - var expression = _ref.expression, - customType = _ref.customType, - dataParser = _ref.dataParser, - segment = _ref.segment; - - if (typeof dataParser !== 'function') { - dataParser = function dataParser(line) { - return line; - }; - } - - this.customParsers.push(function (line) { - var match = expression.exec(line); - - if (match) { - _this3.trigger('data', { - type: 'custom', - data: dataParser(line), - customType: customType, - segment: segment - }); - - return true; - } - }); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - ; - - _proto.addTagMapper = function addTagMapper(_ref2) { - var expression = _ref2.expression, - map = _ref2.map; - - var mapFn = function mapFn(line) { - if (expression.test(line)) { - return map(line); - } - - return line; - }; - - this.tagMappers.push(mapFn); - }; - - return ParseStream; - }(Stream); - - var camelCase = function camelCase(str) { - return str.toLowerCase().replace(/-(\w)/g, function (a) { - return a[1].toUpperCase(); - }); - }; - - var camelCaseKeys = function camelCaseKeys(attributes) { - var result = {}; - Object.keys(attributes).forEach(function (key) { - result[camelCase(key)] = attributes[key]; - }); - return result; - }; // set SERVER-CONTROL hold back based upon targetDuration and partTargetDuration - // we need this helper because defaults are based upon targetDuration and - // partTargetDuration being set, but they may not be if SERVER-CONTROL appears before - // target durations are set. - - - var setHoldBack = function setHoldBack(manifest) { - var serverControl = manifest.serverControl, - targetDuration = manifest.targetDuration, - partTargetDuration = manifest.partTargetDuration; - - if (!serverControl) { - return; - } - - var tag = '#EXT-X-SERVER-CONTROL'; - var hb = 'holdBack'; - var phb = 'partHoldBack'; - var minTargetDuration = targetDuration && targetDuration * 3; - var minPartDuration = partTargetDuration && partTargetDuration * 2; - - if (targetDuration && !serverControl.hasOwnProperty(hb)) { - serverControl[hb] = minTargetDuration; - this.trigger('info', { - message: tag + " defaulting HOLD-BACK to targetDuration * 3 (" + minTargetDuration + ")." - }); - } - - if (minTargetDuration && serverControl[hb] < minTargetDuration) { - this.trigger('warn', { - message: tag + " clamping HOLD-BACK (" + serverControl[hb] + ") to targetDuration * 3 (" + minTargetDuration + ")" - }); - serverControl[hb] = minTargetDuration; - } // default no part hold back to part target duration * 3 - - - if (partTargetDuration && !serverControl.hasOwnProperty(phb)) { - serverControl[phb] = partTargetDuration * 3; - this.trigger('info', { - message: tag + " defaulting PART-HOLD-BACK to partTargetDuration * 3 (" + serverControl[phb] + ")." - }); - } // if part hold back is too small default it to part target duration * 2 - - - if (partTargetDuration && serverControl[phb] < minPartDuration) { - this.trigger('warn', { - message: tag + " clamping PART-HOLD-BACK (" + serverControl[phb] + ") to partTargetDuration * 2 (" + minPartDuration + ")." - }); - serverControl[phb] = minPartDuration; - } - }; - /** - * A parser for M3U8 files. The current interpretation of the input is - * exposed as a property `manifest` on parser objects. It's just two lines to - * create and parse a manifest once you have the contents available as a string: - * - * ```js - * var parser = new m3u8.Parser(); - * parser.push(xhr.responseText); - * ``` - * - * New input can later be applied to update the manifest object by calling - * `push` again. - * - * The parser attempts to create a usable manifest object even if the - * underlying input is somewhat nonsensical. It emits `info` and `warning` - * events during the parse if it encounters input that seems invalid or - * requires some property of the manifest object to be defaulted. - * - * @class Parser - * @extends Stream - */ - - - var Parser = /*#__PURE__*/function (_Stream) { - inheritsLoose(Parser, _Stream); - - function Parser() { - var _this; - - _this = _Stream.call(this) || this; - _this.lineStream = new LineStream(); - _this.parseStream = new ParseStream(); - - _this.lineStream.pipe(_this.parseStream); - /* eslint-disable consistent-this */ - - - var self = assertThisInitialized(_this); - /* eslint-enable consistent-this */ - - - var uris = []; - var currentUri = {}; // if specified, the active EXT-X-MAP definition - - var currentMap; // if specified, the active decryption key - - var _key; - - var hasParts = false; - - var noop = function noop() {}; - - var defaultMediaGroups = { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }; // This is the Widevine UUID from DASH IF IOP. The same exact string is - // used in MPDs with Widevine encrypted streams. - - var widevineUuid = 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'; // group segments into numbered timelines delineated by discontinuities - - var currentTimeline = 0; // the manifest is empty until the parse stream begins delivering data - - _this.manifest = { - allowCache: true, - discontinuityStarts: [], - segments: [] - }; // keep track of the last seen segment's byte range end, as segments are not required - // to provide the offset, in which case it defaults to the next byte after the - // previous segment - - var lastByterangeEnd = 0; // keep track of the last seen part's byte range end. - - var lastPartByterangeEnd = 0; - - _this.on('end', function () { - // only add preloadSegment if we don't yet have a uri for it. - // and we actually have parts/preloadHints - if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) { - return; - } - - if (!currentUri.map && currentMap) { - currentUri.map = currentMap; - } - - if (!currentUri.key && _key) { - currentUri.key = _key; - } - - if (!currentUri.timeline && typeof currentTimeline === 'number') { - currentUri.timeline = currentTimeline; - } - - _this.manifest.preloadSegment = currentUri; - }); // update the manifest with the m3u8 entry from the parse stream - - - _this.parseStream.on('data', function (entry) { - var mediaGroup; - var rendition; - ({ - tag: function tag() { - // switch based on the tag type - (({ - version: function version() { - if (entry.version) { - this.manifest.version = entry.version; - } - }, - 'allow-cache': function allowCache() { - this.manifest.allowCache = entry.allowed; - - if (!('allowed' in entry)) { - this.trigger('info', { - message: 'defaulting allowCache to YES' - }); - this.manifest.allowCache = true; - } - }, - byterange: function byterange() { - var byterange = {}; - - if ('length' in entry) { - currentUri.byterange = byterange; - byterange.length = entry.length; - - if (!('offset' in entry)) { - /* - * From the latest spec (as of this writing): - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.2 - * - * Same text since EXT-X-BYTERANGE's introduction in draft 7: - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-07#section-3.3.1) - * - * "If o [offset] is not present, the sub-range begins at the next byte - * following the sub-range of the previous media segment." - */ - entry.offset = lastByterangeEnd; - } - } - - if ('offset' in entry) { - currentUri.byterange = byterange; - byterange.offset = entry.offset; - } - - lastByterangeEnd = byterange.offset + byterange.length; - }, - endlist: function endlist() { - this.manifest.endList = true; - }, - inf: function inf() { - if (!('mediaSequence' in this.manifest)) { - this.manifest.mediaSequence = 0; - this.trigger('info', { - message: 'defaulting media sequence to zero' - }); - } - - if (!('discontinuitySequence' in this.manifest)) { - this.manifest.discontinuitySequence = 0; - this.trigger('info', { - message: 'defaulting discontinuity sequence to zero' - }); - } - - if (entry.duration > 0) { - currentUri.duration = entry.duration; - } - - if (entry.duration === 0) { - currentUri.duration = 0.01; - this.trigger('info', { - message: 'updating zero segment duration to a small value' - }); - } - - this.manifest.segments = uris; - }, - key: function key() { - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring key declaration without attribute list' - }); - return; - } // clear the active encryption key - - - if (entry.attributes.METHOD === 'NONE') { - _key = null; - return; - } - - if (!entry.attributes.URI) { - this.trigger('warn', { - message: 'ignoring key declaration without URI' - }); - return; - } - - if (entry.attributes.KEYFORMAT === 'com.apple.streamingkeydelivery') { - this.manifest.contentProtection = this.manifest.contentProtection || {}; // TODO: add full support for this. - - this.manifest.contentProtection['com.apple.fps.1_0'] = { - attributes: entry.attributes - }; - return; - } // check if the content is encrypted for Widevine - // Widevine/HLS spec: https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf - - - if (entry.attributes.KEYFORMAT === widevineUuid) { - var VALID_METHODS = ['SAMPLE-AES', 'SAMPLE-AES-CTR', 'SAMPLE-AES-CENC']; - - if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) { - this.trigger('warn', { - message: 'invalid key method provided for Widevine' - }); - return; - } - - if (entry.attributes.METHOD === 'SAMPLE-AES-CENC') { - this.trigger('warn', { - message: 'SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead' - }); - } - - if (entry.attributes.URI.substring(0, 23) !== 'data:text/plain;base64,') { - this.trigger('warn', { - message: 'invalid key URI provided for Widevine' - }); - return; - } - - if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === '0x')) { - this.trigger('warn', { - message: 'invalid key ID provided for Widevine' - }); - return; - } // if Widevine key attributes are valid, store them as `contentProtection` - // on the manifest to emulate Widevine tag structure in a DASH mpd - - - this.manifest.contentProtection = this.manifest.contentProtection || {}; - this.manifest.contentProtection['com.widevine.alpha'] = { - attributes: { - schemeIdUri: entry.attributes.KEYFORMAT, - // remove '0x' from the key id string - keyId: entry.attributes.KEYID.substring(2) - }, - // decode the base64-encoded PSSH box - pssh: decodeB64ToUint8Array(entry.attributes.URI.split(',')[1]) - }; - return; - } - - if (!entry.attributes.METHOD) { - this.trigger('warn', { - message: 'defaulting key method to AES-128' - }); - } // setup an encryption key for upcoming segments - - - _key = { - method: entry.attributes.METHOD || 'AES-128', - uri: entry.attributes.URI - }; - - if (typeof entry.attributes.IV !== 'undefined') { - _key.iv = entry.attributes.IV; - } - }, - 'media-sequence': function mediaSequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid media sequence: ' + entry.number - }); - return; - } - - this.manifest.mediaSequence = entry.number; - }, - 'discontinuity-sequence': function discontinuitySequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid discontinuity sequence: ' + entry.number - }); - return; - } - - this.manifest.discontinuitySequence = entry.number; - currentTimeline = entry.number; - }, - 'playlist-type': function playlistType() { - if (!/VOD|EVENT/.test(entry.playlistType)) { - this.trigger('warn', { - message: 'ignoring unknown playlist type: ' + entry.playlist - }); - return; - } - - this.manifest.playlistType = entry.playlistType; - }, - map: function map() { - currentMap = {}; - - if (entry.uri) { - currentMap.uri = entry.uri; - } - - if (entry.byterange) { - currentMap.byterange = entry.byterange; - } - - if (_key) { - currentMap.key = _key; - } - }, - 'stream-inf': function streamInf() { - this.manifest.playlists = uris; - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring empty stream-inf attributes' - }); - return; - } - - if (!currentUri.attributes) { - currentUri.attributes = {}; - } - - _extends_1(currentUri.attributes, entry.attributes); - }, - media: function media() { - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!(entry.attributes && entry.attributes.TYPE && entry.attributes['GROUP-ID'] && entry.attributes.NAME)) { - this.trigger('warn', { - message: 'ignoring incomplete or missing media group' - }); - return; - } // find the media group, creating defaults as necessary - - - var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE]; - mediaGroupType[entry.attributes['GROUP-ID']] = mediaGroupType[entry.attributes['GROUP-ID']] || {}; - mediaGroup = mediaGroupType[entry.attributes['GROUP-ID']]; // collect the rendition metadata - - rendition = { - default: /yes/i.test(entry.attributes.DEFAULT) - }; - - if (rendition.default) { - rendition.autoselect = true; - } else { - rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT); - } - - if (entry.attributes.LANGUAGE) { - rendition.language = entry.attributes.LANGUAGE; - } - - if (entry.attributes.URI) { - rendition.uri = entry.attributes.URI; - } - - if (entry.attributes['INSTREAM-ID']) { - rendition.instreamId = entry.attributes['INSTREAM-ID']; - } - - if (entry.attributes.CHARACTERISTICS) { - rendition.characteristics = entry.attributes.CHARACTERISTICS; - } - - if (entry.attributes.FORCED) { - rendition.forced = /yes/i.test(entry.attributes.FORCED); - } // insert the new rendition - - - mediaGroup[entry.attributes.NAME] = rendition; - }, - discontinuity: function discontinuity() { - currentTimeline += 1; - currentUri.discontinuity = true; - this.manifest.discontinuityStarts.push(uris.length); - }, - 'program-date-time': function programDateTime() { - if (typeof this.manifest.dateTimeString === 'undefined') { - // PROGRAM-DATE-TIME is a media-segment tag, but for backwards - // compatibility, we add the first occurence of the PROGRAM-DATE-TIME tag - // to the manifest object - // TODO: Consider removing this in future major version - this.manifest.dateTimeString = entry.dateTimeString; - this.manifest.dateTimeObject = entry.dateTimeObject; - } - - currentUri.dateTimeString = entry.dateTimeString; - currentUri.dateTimeObject = entry.dateTimeObject; - }, - targetduration: function targetduration() { - if (!isFinite(entry.duration) || entry.duration < 0) { - this.trigger('warn', { - message: 'ignoring invalid target duration: ' + entry.duration - }); - return; - } - - this.manifest.targetDuration = entry.duration; - setHoldBack.call(this, this.manifest); - }, - start: function start() { - if (!entry.attributes || isNaN(entry.attributes['TIME-OFFSET'])) { - this.trigger('warn', { - message: 'ignoring start declaration without appropriate attribute list' - }); - return; - } - - this.manifest.start = { - timeOffset: entry.attributes['TIME-OFFSET'], - precise: entry.attributes.PRECISE - }; - }, - 'cue-out': function cueOut() { - currentUri.cueOut = entry.data; - }, - 'cue-out-cont': function cueOutCont() { - currentUri.cueOutCont = entry.data; - }, - 'cue-in': function cueIn() { - currentUri.cueIn = entry.data; - }, - 'skip': function skip() { - this.manifest.skip = camelCaseKeys(entry.attributes); - this.warnOnMissingAttributes_('#EXT-X-SKIP', entry.attributes, ['SKIPPED-SEGMENTS']); - }, - 'part': function part() { - var _this2 = this; - - hasParts = true; // parts are always specifed before a segment - - var segmentIndex = this.manifest.segments.length; - var part = camelCaseKeys(entry.attributes); - currentUri.parts = currentUri.parts || []; - currentUri.parts.push(part); - - if (part.byterange) { - if (!part.byterange.hasOwnProperty('offset')) { - part.byterange.offset = lastPartByterangeEnd; - } - - lastPartByterangeEnd = part.byterange.offset + part.byterange.length; - } - - var partIndex = currentUri.parts.length - 1; - this.warnOnMissingAttributes_("#EXT-X-PART #" + partIndex + " for segment #" + segmentIndex, entry.attributes, ['URI', 'DURATION']); - - if (this.manifest.renditionReports) { - this.manifest.renditionReports.forEach(function (r, i) { - if (!r.hasOwnProperty('lastPart')) { - _this2.trigger('warn', { - message: "#EXT-X-RENDITION-REPORT #" + i + " lacks required attribute(s): LAST-PART" - }); - } - }); - } - }, - 'server-control': function serverControl() { - var attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes); - - if (!attrs.hasOwnProperty('canBlockReload')) { - attrs.canBlockReload = false; - this.trigger('info', { - message: '#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false' - }); - } - - setHoldBack.call(this, this.manifest); - - if (attrs.canSkipDateranges && !attrs.hasOwnProperty('canSkipUntil')) { - this.trigger('warn', { - message: '#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set' - }); - } - }, - 'preload-hint': function preloadHint() { - // parts are always specifed before a segment - var segmentIndex = this.manifest.segments.length; - var hint = camelCaseKeys(entry.attributes); - var isPart = hint.type && hint.type === 'PART'; - currentUri.preloadHints = currentUri.preloadHints || []; - currentUri.preloadHints.push(hint); - - if (hint.byterange) { - if (!hint.byterange.hasOwnProperty('offset')) { - // use last part byterange end or zero if not a part. - hint.byterange.offset = isPart ? lastPartByterangeEnd : 0; - - if (isPart) { - lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length; - } - } - } - - var index = currentUri.preloadHints.length - 1; - this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #" + index + " for segment #" + segmentIndex, entry.attributes, ['TYPE', 'URI']); - - if (!hint.type) { - return; - } // search through all preload hints except for the current one for - // a duplicate type. - - - for (var i = 0; i < currentUri.preloadHints.length - 1; i++) { - var otherHint = currentUri.preloadHints[i]; - - if (!otherHint.type) { - continue; - } - - if (otherHint.type === hint.type) { - this.trigger('warn', { - message: "#EXT-X-PRELOAD-HINT #" + index + " for segment #" + segmentIndex + " has the same TYPE " + hint.type + " as preload hint #" + i - }); - } - } - }, - 'rendition-report': function renditionReport() { - var report = camelCaseKeys(entry.attributes); - this.manifest.renditionReports = this.manifest.renditionReports || []; - this.manifest.renditionReports.push(report); - var index = this.manifest.renditionReports.length - 1; - var required = ['LAST-MSN', 'URI']; - - if (hasParts) { - required.push('LAST-PART'); - } - - this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #" + index, entry.attributes, required); - }, - 'part-inf': function partInf() { - this.manifest.partInf = camelCaseKeys(entry.attributes); - this.warnOnMissingAttributes_('#EXT-X-PART-INF', entry.attributes, ['PART-TARGET']); - - if (this.manifest.partInf.partTarget) { - this.manifest.partTargetDuration = this.manifest.partInf.partTarget; - } - - setHoldBack.call(this, this.manifest); - } - })[entry.tagType] || noop).call(self); - }, - uri: function uri() { - currentUri.uri = entry.uri; - uris.push(currentUri); // if no explicit duration was declared, use the target duration - - if (this.manifest.targetDuration && !('duration' in currentUri)) { - this.trigger('warn', { - message: 'defaulting segment duration to the target duration' - }); - currentUri.duration = this.manifest.targetDuration; - } // annotate with encryption information, if necessary - - - if (_key) { - currentUri.key = _key; - } - - currentUri.timeline = currentTimeline; // annotate with initialization segment information, if necessary - - if (currentMap) { - currentUri.map = currentMap; - } // reset the last byterange end as it needs to be 0 between parts - - - lastPartByterangeEnd = 0; // prepare for the next URI - - currentUri = {}; - }, - comment: function comment() {// comments are not important for playback - }, - custom: function custom() { - // if this is segment-level data attach the output to the segment - if (entry.segment) { - currentUri.custom = currentUri.custom || {}; - currentUri.custom[entry.customType] = entry.data; // if this is manifest-level data attach to the top level manifest object - } else { - this.manifest.custom = this.manifest.custom || {}; - this.manifest.custom[entry.customType] = entry.data; - } - } - })[entry.type].call(self); - }); - - return _this; - } - - var _proto = Parser.prototype; - - _proto.warnOnMissingAttributes_ = function warnOnMissingAttributes_(identifier, attributes, required) { - var missing = []; - required.forEach(function (key) { - if (!attributes.hasOwnProperty(key)) { - missing.push(key); - } - }); - - if (missing.length) { - this.trigger('warn', { - message: identifier + " lacks required attribute(s): " + missing.join(', ') - }); - } - } - /** - * Parse the input string and update the manifest object. - * - * @param {string} chunk a potentially incomplete portion of the manifest - */ - ; - - _proto.push = function push(chunk) { - this.lineStream.push(chunk); - } - /** - * Flush any remaining input. This can be handy if the last line of an M3U8 - * manifest did not contain a trailing newline but the file has been - * completely received. - */ - ; - - _proto.end = function end() { - // flush any buffered input - this.lineStream.push('\n'); - this.trigger('end'); - } - /** - * Add an additional parser for non-standard tags - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.type the type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - ; - - _proto.addParser = function addParser(options) { - this.parseStream.addParser(options); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - ; - - _proto.addTagMapper = function addTagMapper(options) { - this.parseStream.addTagMapper(options); - }; - - return Parser; - }(Stream); - - var regexs = { - // to determine mime types - mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/, - webm: /^(vp0?[89]|av0?1|opus|vorbis)/, - ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/, - // to determine if a codec is audio or video - video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/, - audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/, - text: /^(stpp.ttml.im1t)/, - // mux.js support regex - muxerVideo: /^(avc0?1)/, - muxerAudio: /^(mp4a)/, - // match nothing as muxer does not support text right now. - // there cannot never be a character before the start of a string - // so this matches nothing. - muxerText: /a^/ - }; - var mediaTypes = ['video', 'audio', 'text']; - var upperMediaTypes = ['Video', 'Audio', 'Text']; - /** - * Replace the old apple-style `avc1.
.
` codec string with the standard - * `avc1.` - * - * @param {string} codec - * Codec string to translate - * @return {string} - * The translated codec string - */ - - var translateLegacyCodec = function translateLegacyCodec(codec) { - if (!codec) { - return codec; - } - - return codec.replace(/avc1\.(\d+)\.(\d+)/i, function (orig, profile, avcLevel) { - var profileHex = ('00' + Number(profile).toString(16)).slice(-2); - var avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2); - return 'avc1.' + profileHex + '00' + avcLevelHex; - }); - }; - /** - * @typedef {Object} ParsedCodecInfo - * @property {number} codecCount - * Number of codecs parsed - * @property {string} [videoCodec] - * Parsed video codec (if found) - * @property {string} [videoObjectTypeIndicator] - * Video object type indicator (if found) - * @property {string|null} audioProfile - * Audio profile - */ - - /** - * Parses a codec string to retrieve the number of codecs specified, the video codec and - * object type indicator, and the audio profile. - * - * @param {string} [codecString] - * The codec string to parse - * @return {ParsedCodecInfo} - * Parsed codec info - */ - - var parseCodecs = function parseCodecs(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - var codecs = codecString.split(','); - var result = []; - codecs.forEach(function (codec) { - codec = codec.trim(); - var codecType; - mediaTypes.forEach(function (name) { - var match = regexs[name].exec(codec.toLowerCase()); - - if (!match || match.length <= 1) { - return; - } - - codecType = name; // maintain codec case - - var type = codec.substring(0, match[1].length); - var details = codec.replace(type, ''); - result.push({ - type: type, - details: details, - mediaType: name - }); - }); - - if (!codecType) { - result.push({ - type: codec, - details: '', - mediaType: 'unknown' - }); - } - }); - return result; - }; - /** - * Returns a ParsedCodecInfo object for the default alternate audio playlist if there is - * a default alternate audio playlist for the provided audio group. - * - * @param {Object} master - * The master playlist - * @param {string} audioGroupId - * ID of the audio group for which to find the default codec info - * @return {ParsedCodecInfo} - * Parsed codec info - */ - - var codecsFromDefault = function codecsFromDefault(master, audioGroupId) { - if (!master.mediaGroups.AUDIO || !audioGroupId) { - return null; - } - - var audioGroup = master.mediaGroups.AUDIO[audioGroupId]; - - if (!audioGroup) { - return null; - } - - for (var name in audioGroup) { - var audioType = audioGroup[name]; - - if (audioType.default && audioType.playlists) { - // codec should be the same for all playlists within the audio type - return parseCodecs(audioType.playlists[0].attributes.CODECS); - } - } - - return null; - }; - var isAudioCodec = function isAudioCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.audio.test(codec.trim().toLowerCase()); - }; - var isTextCodec = function isTextCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.text.test(codec.trim().toLowerCase()); - }; - var getMimeForCodec = function getMimeForCodec(codecString) { - if (!codecString || typeof codecString !== 'string') { - return; - } - - var codecs = codecString.toLowerCase().split(',').map(function (c) { - return translateLegacyCodec(c.trim()); - }); // default to video type - - var type = 'video'; // only change to audio type if the only codec we have is - // audio - - if (codecs.length === 1 && isAudioCodec(codecs[0])) { - type = 'audio'; - } else if (codecs.length === 1 && isTextCodec(codecs[0])) { - // text uses application/ for now - type = 'application'; - } // default the container to mp4 - - - var container = 'mp4'; // every codec must be able to go into the container - // for that container to be the correct one - - if (codecs.every(function (c) { - return regexs.mp4.test(c); - })) { - container = 'mp4'; - } else if (codecs.every(function (c) { - return regexs.webm.test(c); - })) { - container = 'webm'; - } else if (codecs.every(function (c) { - return regexs.ogg.test(c); - })) { - container = 'ogg'; - } - - return type + "/" + container + ";codecs=\"" + codecString + "\""; - }; - var browserSupportsCodec = function browserSupportsCodec(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - return window__default['default'].MediaSource && window__default['default'].MediaSource.isTypeSupported && window__default['default'].MediaSource.isTypeSupported(getMimeForCodec(codecString)) || false; - }; - var muxerSupportsCodec = function muxerSupportsCodec(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - return codecString.toLowerCase().split(',').every(function (codec) { - codec = codec.trim(); // any match is supported. - - for (var i = 0; i < upperMediaTypes.length; i++) { - var type = upperMediaTypes[i]; - - if (regexs["muxer" + type].test(codec)) { - return true; - } - } - - return false; - }); - }; - var DEFAULT_AUDIO_CODEC = 'mp4a.40.2'; - var DEFAULT_VIDEO_CODEC = 'avc1.4d400d'; - - /** - * ranges - * - * Utilities for working with TimeRanges. - * - */ - - var TIME_FUDGE_FACTOR = 1 / 30; // Comparisons between time values such as current time and the end of the buffered range - // can be misleading because of precision differences or when the current media has poorly - // aligned audio and video, which can cause values to be slightly off from what you would - // expect. This value is what we consider to be safe to use in such comparisons to account - // for these scenarios. - - var SAFE_TIME_DELTA = TIME_FUDGE_FACTOR * 3; - - var filterRanges = function filterRanges(timeRanges, predicate) { - var results = []; - var i; - - if (timeRanges && timeRanges.length) { - // Search for ranges that match the predicate - for (i = 0; i < timeRanges.length; i++) { - if (predicate(timeRanges.start(i), timeRanges.end(i))) { - results.push([timeRanges.start(i), timeRanges.end(i)]); - } - } - } - - return videojs__default['default'].createTimeRanges(results); - }; - /** - * Attempts to find the buffered TimeRange that contains the specified - * time. - * - * @param {TimeRanges} buffered - the TimeRanges object to query - * @param {number} time - the time to filter on. - * @return {TimeRanges} a new TimeRanges object - */ - - - var findRange = function findRange(buffered, time) { - return filterRanges(buffered, function (start, end) { - return start - SAFE_TIME_DELTA <= time && end + SAFE_TIME_DELTA >= time; - }); - }; - /** - * Returns the TimeRanges that begin later than the specified time. - * - * @param {TimeRanges} timeRanges - the TimeRanges object to query - * @param {number} time - the time to filter on. - * @return {TimeRanges} a new TimeRanges object. - */ - - var findNextRange = function findNextRange(timeRanges, time) { - return filterRanges(timeRanges, function (start) { - return start - TIME_FUDGE_FACTOR >= time; - }); - }; - /** - * Returns gaps within a list of TimeRanges - * - * @param {TimeRanges} buffered - the TimeRanges object - * @return {TimeRanges} a TimeRanges object of gaps - */ - - var findGaps = function findGaps(buffered) { - if (buffered.length < 2) { - return videojs__default['default'].createTimeRanges(); - } - - var ranges = []; - - for (var i = 1; i < buffered.length; i++) { - var start = buffered.end(i - 1); - var end = buffered.start(i); - ranges.push([start, end]); - } - - return videojs__default['default'].createTimeRanges(ranges); - }; - /** - * Calculate the intersection of two TimeRanges - * - * @param {TimeRanges} bufferA - * @param {TimeRanges} bufferB - * @return {TimeRanges} The interesection of `bufferA` with `bufferB` - */ - - var bufferIntersection = function bufferIntersection(bufferA, bufferB) { - var start = null; - var end = null; - var arity = 0; - var extents = []; - var ranges = []; - - if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) { - return videojs__default['default'].createTimeRange(); - } // Handle the case where we have both buffers and create an - // intersection of the two - - - var count = bufferA.length; // A) Gather up all start and end times - - while (count--) { - extents.push({ - time: bufferA.start(count), - type: 'start' - }); - extents.push({ - time: bufferA.end(count), - type: 'end' - }); - } - - count = bufferB.length; - - while (count--) { - extents.push({ - time: bufferB.start(count), - type: 'start' - }); - extents.push({ - time: bufferB.end(count), - type: 'end' - }); - } // B) Sort them by time - - - extents.sort(function (a, b) { - return a.time - b.time; - }); // C) Go along one by one incrementing arity for start and decrementing - // arity for ends - - for (count = 0; count < extents.length; count++) { - if (extents[count].type === 'start') { - arity++; // D) If arity is ever incremented to 2 we are entering an - // overlapping range - - if (arity === 2) { - start = extents[count].time; - } - } else if (extents[count].type === 'end') { - arity--; // E) If arity is ever decremented to 1 we leaving an - // overlapping range - - if (arity === 1) { - end = extents[count].time; - } - } // F) Record overlapping ranges - - - if (start !== null && end !== null) { - ranges.push([start, end]); - start = null; - end = null; - } - } - - return videojs__default['default'].createTimeRanges(ranges); - }; - /** - * Gets a human readable string for a TimeRange - * - * @param {TimeRange} range - * @return {string} a human readable string - */ - - var printableRange = function printableRange(range) { - var strArr = []; - - if (!range || !range.length) { - return ''; - } - - for (var i = 0; i < range.length; i++) { - strArr.push(range.start(i) + ' => ' + range.end(i)); - } - - return strArr.join(', '); - }; - /** - * Calculates the amount of time left in seconds until the player hits the end of the - * buffer and causes a rebuffer - * - * @param {TimeRange} buffered - * The state of the buffer - * @param {Numnber} currentTime - * The current time of the player - * @param {number} playbackRate - * The current playback rate of the player. Defaults to 1. - * @return {number} - * Time until the player has to start rebuffering in seconds. - * @function timeUntilRebuffer - */ - - var timeUntilRebuffer = function timeUntilRebuffer(buffered, currentTime, playbackRate) { - if (playbackRate === void 0) { - playbackRate = 1; - } - - var bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0; - return (bufferedEnd - currentTime) / playbackRate; - }; - /** - * Converts a TimeRanges object into an array representation - * - * @param {TimeRanges} timeRanges - * @return {Array} - */ - - var timeRangesToArray = function timeRangesToArray(timeRanges) { - var timeRangesList = []; - - for (var i = 0; i < timeRanges.length; i++) { - timeRangesList.push({ - start: timeRanges.start(i), - end: timeRanges.end(i) - }); - } - - return timeRangesList; - }; - /** - * Determines if two time range objects are different. - * - * @param {TimeRange} a - * the first time range object to check - * - * @param {TimeRange} b - * the second time range object to check - * - * @return {Boolean} - * Whether the time range objects differ - */ - - var isRangeDifferent = function isRangeDifferent(a, b) { - // same object - if (a === b) { - return false; - } // one or the other is undefined - - - if (!a && b || !b && a) { - return true; - } // length is different - - - if (a.length !== b.length) { - return true; - } // see if any start/end pair is different - - - for (var i = 0; i < a.length; i++) { - if (a.start(i) !== b.start(i) || a.end(i) !== b.end(i)) { - return true; - } - } // if the length and every pair is the same - // this is the same time range - - - return false; - }; - var lastBufferedEnd = function lastBufferedEnd(a) { - if (!a || !a.length || !a.end) { - return; - } - - return a.end(a.length - 1); - }; - - /** - * @file playlist.js - * - * Playlist related utilities. - */ - var createTimeRange = videojs__default['default'].createTimeRange; - /** - * A function to get a combined list of parts and segments with durations - * and indexes. - * - * @param {Playlist} playlist the playlist to get the list for. - * - * @return {Array} The part/segment list. - */ - - var getPartsAndSegments = function getPartsAndSegments(playlist) { - return (playlist.segments || []).reduce(function (acc, segment, si) { - if (segment.parts) { - segment.parts.forEach(function (part, pi) { - acc.push({ - duration: part.duration, - segmentIndex: si, - partIndex: pi, - part: part, - segment: segment - }); - }); - } else { - acc.push({ - duration: segment.duration, - segmentIndex: si, - partIndex: null, - segment: segment, - part: null - }); - } - - return acc; - }, []); - }; - var getLastParts = function getLastParts(media) { - var lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1]; - return lastSegment && lastSegment.parts || []; - }; - var getKnownPartCount = function getKnownPartCount(_ref) { - var preloadSegment = _ref.preloadSegment; - - if (!preloadSegment) { - return; - } - - var parts = preloadSegment.parts, - preloadHints = preloadSegment.preloadHints; - var partCount = (preloadHints || []).reduce(function (count, hint) { - return count + (hint.type === 'PART' ? 1 : 0); - }, 0); - partCount += parts && parts.length ? parts.length : 0; - return partCount; - }; - /** - * Get the number of seconds to delay from the end of a - * live playlist. - * - * @param {Playlist} master the master playlist - * @param {Playlist} media the media playlist - * @return {number} the hold back in seconds. - */ - - var liveEdgeDelay = function liveEdgeDelay(master, media) { - if (media.endList) { - return 0; - } // dash suggestedPresentationDelay trumps everything - - - if (master && master.suggestedPresentationDelay) { - return master.suggestedPresentationDelay; - } - - var hasParts = getLastParts(media).length > 0; // look for "part" delays from ll-hls first - - if (hasParts && media.serverControl && media.serverControl.partHoldBack) { - return media.serverControl.partHoldBack; - } else if (hasParts && media.partTargetDuration) { - return media.partTargetDuration * 3; // finally look for full segment delays - } else if (media.serverControl && media.serverControl.holdBack) { - return media.serverControl.holdBack; - } else if (media.targetDuration) { - return media.targetDuration * 3; - } - - return 0; - }; - /** - * walk backward until we find a duration we can use - * or return a failure - * - * @param {Playlist} playlist the playlist to walk through - * @param {Number} endSequence the mediaSequence to stop walking on - */ - - var backwardDuration = function backwardDuration(playlist, endSequence) { - var result = 0; - var i = endSequence - playlist.mediaSequence; // if a start time is available for segment immediately following - // the interval, use it - - var segment = playlist.segments[i]; // Walk backward until we find the latest segment with timeline - // information that is earlier than endSequence - - if (segment) { - if (typeof segment.start !== 'undefined') { - return { - result: segment.start, - precise: true - }; - } - - if (typeof segment.end !== 'undefined') { - return { - result: segment.end - segment.duration, - precise: true - }; - } - } - - while (i--) { - segment = playlist.segments[i]; - - if (typeof segment.end !== 'undefined') { - return { - result: result + segment.end, - precise: true - }; - } - - result += segment.duration; - - if (typeof segment.start !== 'undefined') { - return { - result: result + segment.start, - precise: true - }; - } - } - - return { - result: result, - precise: false - }; - }; - /** - * walk forward until we find a duration we can use - * or return a failure - * - * @param {Playlist} playlist the playlist to walk through - * @param {number} endSequence the mediaSequence to stop walking on - */ - - - var forwardDuration = function forwardDuration(playlist, endSequence) { - var result = 0; - var segment; - var i = endSequence - playlist.mediaSequence; // Walk forward until we find the earliest segment with timeline - // information - - for (; i < playlist.segments.length; i++) { - segment = playlist.segments[i]; - - if (typeof segment.start !== 'undefined') { - return { - result: segment.start - result, - precise: true - }; - } - - result += segment.duration; - - if (typeof segment.end !== 'undefined') { - return { - result: segment.end - result, - precise: true - }; - } - } // indicate we didn't find a useful duration estimate - - - return { - result: -1, - precise: false - }; - }; - /** - * Calculate the media duration from the segments associated with a - * playlist. The duration of a subinterval of the available segments - * may be calculated by specifying an end index. - * - * @param {Object} playlist a media playlist object - * @param {number=} endSequence an exclusive upper boundary - * for the playlist. Defaults to playlist length. - * @param {number} expired the amount of time that has dropped - * off the front of the playlist in a live scenario - * @return {number} the duration between the first available segment - * and end index. - */ - - - var intervalDuration = function intervalDuration(playlist, endSequence, expired) { - if (typeof endSequence === 'undefined') { - endSequence = playlist.mediaSequence + playlist.segments.length; - } - - if (endSequence < playlist.mediaSequence) { - return 0; - } // do a backward walk to estimate the duration - - - var backward = backwardDuration(playlist, endSequence); - - if (backward.precise) { - // if we were able to base our duration estimate on timing - // information provided directly from the Media Source, return - // it - return backward.result; - } // walk forward to see if a precise duration estimate can be made - // that way - - - var forward = forwardDuration(playlist, endSequence); - - if (forward.precise) { - // we found a segment that has been buffered and so it's - // position is known precisely - return forward.result; - } // return the less-precise, playlist-based duration estimate - - - return backward.result + expired; - }; - /** - * Calculates the duration of a playlist. If a start and end index - * are specified, the duration will be for the subset of the media - * timeline between those two indices. The total duration for live - * playlists is always Infinity. - * - * @param {Object} playlist a media playlist object - * @param {number=} endSequence an exclusive upper - * boundary for the playlist. Defaults to the playlist media - * sequence number plus its length. - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @return {number} the duration between the start index and end - * index. - */ - - - var duration = function duration(playlist, endSequence, expired) { - if (!playlist) { - return 0; - } - - if (typeof expired !== 'number') { - expired = 0; - } // if a slice of the total duration is not requested, use - // playlist-level duration indicators when they're present - - - if (typeof endSequence === 'undefined') { - // if present, use the duration specified in the playlist - if (playlist.totalDuration) { - return playlist.totalDuration; - } // duration should be Infinity for live playlists - - - if (!playlist.endList) { - return window__default['default'].Infinity; - } - } // calculate the total duration based on the segment durations - - - return intervalDuration(playlist, endSequence, expired); - }; - /** - * Calculate the time between two indexes in the current playlist - * neight the start- nor the end-index need to be within the current - * playlist in which case, the targetDuration of the playlist is used - * to approximate the durations of the segments - * - * @param {Array} options.durationList list to iterate over for durations. - * @param {number} options.defaultDuration duration to use for elements before or after the durationList - * @param {number} options.startIndex partsAndSegments index to start - * @param {number} options.endIndex partsAndSegments index to end. - * @return {number} the number of seconds between startIndex and endIndex - */ - - var sumDurations = function sumDurations(_ref2) { - var defaultDuration = _ref2.defaultDuration, - durationList = _ref2.durationList, - startIndex = _ref2.startIndex, - endIndex = _ref2.endIndex; - var durations = 0; - - if (startIndex > endIndex) { - var _ref3 = [endIndex, startIndex]; - startIndex = _ref3[0]; - endIndex = _ref3[1]; - } - - if (startIndex < 0) { - for (var i = startIndex; i < Math.min(0, endIndex); i++) { - durations += defaultDuration; - } - - startIndex = 0; - } - - for (var _i = startIndex; _i < endIndex; _i++) { - durations += durationList[_i].duration; - } - - return durations; - }; - /** - * Calculates the playlist end time - * - * @param {Object} playlist a media playlist object - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @param {boolean|false} useSafeLiveEnd a boolean value indicating whether or not the - * playlist end calculation should consider the safe live end - * (truncate the playlist end by three segments). This is normally - * used for calculating the end of the playlist's seekable range. - * This takes into account the value of liveEdgePadding. - * Setting liveEdgePadding to 0 is equivalent to setting this to false. - * @param {number} liveEdgePadding a number indicating how far from the end of the playlist we should be in seconds. - * If this is provided, it is used in the safe live end calculation. - * Setting useSafeLiveEnd=false or liveEdgePadding=0 are equivalent. - * Corresponds to suggestedPresentationDelay in DASH manifests. - * @return {number} the end time of playlist - * @function playlistEnd - */ - - var playlistEnd = function playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding) { - if (!playlist || !playlist.segments) { - return null; - } - - if (playlist.endList) { - return duration(playlist); - } - - if (expired === null) { - return null; - } - - expired = expired || 0; - var lastSegmentTime = intervalDuration(playlist, playlist.mediaSequence + playlist.segments.length, expired); - - if (useSafeLiveEnd) { - liveEdgePadding = typeof liveEdgePadding === 'number' ? liveEdgePadding : liveEdgeDelay(null, playlist); - lastSegmentTime -= liveEdgePadding; - } // don't return a time less than zero - - - return Math.max(0, lastSegmentTime); - }; - /** - * Calculates the interval of time that is currently seekable in a - * playlist. The returned time ranges are relative to the earliest - * moment in the specified playlist that is still available. A full - * seekable implementation for live streams would need to offset - * these values by the duration of content that has expired from the - * stream. - * - * @param {Object} playlist a media playlist object - * dropped off the front of the playlist in a live scenario - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @param {number} liveEdgePadding how far from the end of the playlist we should be in seconds. - * Corresponds to suggestedPresentationDelay in DASH manifests. - * @return {TimeRanges} the periods of time that are valid targets - * for seeking - */ - - var seekable = function seekable(playlist, expired, liveEdgePadding) { - var useSafeLiveEnd = true; - var seekableStart = expired || 0; - var seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); - - if (seekableEnd === null) { - return createTimeRange(); - } - - return createTimeRange(seekableStart, seekableEnd); - }; - /** - * Determine the index and estimated starting time of the segment that - * contains a specified playback position in a media playlist. - * - * @param {Object} options.playlist the media playlist to query - * @param {number} options.currentTime The number of seconds since the earliest - * possible position to determine the containing segment for - * @param {number} options.startTime the time when the segment/part starts - * @param {number} options.startingSegmentIndex the segment index to start looking at. - * @param {number?} [options.startingPartIndex] the part index to look at within the segment. - * - * @return {Object} an object with partIndex, segmentIndex, and startTime. - */ - - var getMediaInfoForTime = function getMediaInfoForTime(_ref4) { - var playlist = _ref4.playlist, - currentTime = _ref4.currentTime, - startingSegmentIndex = _ref4.startingSegmentIndex, - startingPartIndex = _ref4.startingPartIndex, - startTime = _ref4.startTime; - var time = currentTime - startTime; - var partsAndSegments = getPartsAndSegments(playlist); - var startIndex = 0; - - for (var i = 0; i < partsAndSegments.length; i++) { - var partAndSegment = partsAndSegments[i]; - - if (startingSegmentIndex !== partAndSegment.segmentIndex) { - continue; - } // skip this if part index does not match. - - - if (typeof startingPartIndex === 'number' && typeof partAndSegment.partIndex === 'number' && startingPartIndex !== partAndSegment.partIndex) { - continue; - } - - startIndex = i; - break; - } - - if (time < 0) { - // Walk backward from startIndex in the playlist, adding durations - // until we find a segment that contains `time` and return it - if (startIndex > 0) { - for (var _i2 = startIndex - 1; _i2 >= 0; _i2--) { - var _partAndSegment = partsAndSegments[_i2]; - time += _partAndSegment.duration; // TODO: consider not using TIME_FUDGE_FACTOR at all here - - if (time + TIME_FUDGE_FACTOR > 0) { - return { - partIndex: _partAndSegment.partIndex, - segmentIndex: _partAndSegment.segmentIndex, - startTime: startTime - sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: partsAndSegments, - startIndex: startIndex, - endIndex: _i2 - }) - }; - } - } - } // We were unable to find a good segment within the playlist - // so select the first segment - - - return { - partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null, - segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0, - startTime: currentTime - }; - } // When startIndex is negative, we first walk forward to first segment - // adding target durations. If we "run out of time" before getting to - // the first segment, return the first segment - - - if (startIndex < 0) { - for (var _i3 = startIndex; _i3 < 0; _i3++) { - time -= playlist.targetDuration; - - if (time < 0) { - return { - partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null, - segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0, - startTime: currentTime - }; - } - } - - startIndex = 0; - } // Walk forward from startIndex in the playlist, subtracting durations - // until we find a segment that contains `time` and return it - - - for (var _i4 = startIndex; _i4 < partsAndSegments.length; _i4++) { - var _partAndSegment2 = partsAndSegments[_i4]; - time -= _partAndSegment2.duration; // TODO: consider not using TIME_FUDGE_FACTOR at all here - - if (time - TIME_FUDGE_FACTOR < 0) { - return { - partIndex: _partAndSegment2.partIndex, - segmentIndex: _partAndSegment2.segmentIndex, - startTime: startTime + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: partsAndSegments, - startIndex: startIndex, - endIndex: _i4 - }) - }; - } - } // We are out of possible candidates so load the last one... - - - return { - segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex, - partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex, - startTime: currentTime - }; - }; - /** - * Check whether the playlist is blacklisted or not. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is blacklisted or not - * @function isBlacklisted - */ - - var isBlacklisted = function isBlacklisted(playlist) { - return playlist.excludeUntil && playlist.excludeUntil > Date.now(); - }; - /** - * Check whether the playlist is compatible with current playback configuration or has - * been blacklisted permanently for being incompatible. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is incompatible or not - * @function isIncompatible - */ - - var isIncompatible = function isIncompatible(playlist) { - return playlist.excludeUntil && playlist.excludeUntil === Infinity; - }; - /** - * Check whether the playlist is enabled or not. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is enabled or not - * @function isEnabled - */ - - var isEnabled = function isEnabled(playlist) { - var blacklisted = isBlacklisted(playlist); - return !playlist.disabled && !blacklisted; - }; - /** - * Check whether the playlist has been manually disabled through the representations api. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is disabled manually or not - * @function isDisabled - */ - - var isDisabled = function isDisabled(playlist) { - return playlist.disabled; - }; - /** - * Returns whether the current playlist is an AES encrypted HLS stream - * - * @return {boolean} true if it's an AES encrypted HLS stream - */ - - var isAes = function isAes(media) { - for (var i = 0; i < media.segments.length; i++) { - if (media.segments[i].key) { - return true; - } - } - - return false; - }; - /** - * Checks if the playlist has a value for the specified attribute - * - * @param {string} attr - * Attribute to check for - * @param {Object} playlist - * The media playlist object - * @return {boolean} - * Whether the playlist contains a value for the attribute or not - * @function hasAttribute - */ - - var hasAttribute = function hasAttribute(attr, playlist) { - return playlist.attributes && playlist.attributes[attr]; - }; - /** - * Estimates the time required to complete a segment download from the specified playlist - * - * @param {number} segmentDuration - * Duration of requested segment - * @param {number} bandwidth - * Current measured bandwidth of the player - * @param {Object} playlist - * The media playlist object - * @param {number=} bytesReceived - * Number of bytes already received for the request. Defaults to 0 - * @return {number|NaN} - * The estimated time to request the segment. NaN if bandwidth information for - * the given playlist is unavailable - * @function estimateSegmentRequestTime - */ - - var estimateSegmentRequestTime = function estimateSegmentRequestTime(segmentDuration, bandwidth, playlist, bytesReceived) { - if (bytesReceived === void 0) { - bytesReceived = 0; - } - - if (!hasAttribute('BANDWIDTH', playlist)) { - return NaN; - } - - var size = segmentDuration * playlist.attributes.BANDWIDTH; - return (size - bytesReceived * 8) / bandwidth; - }; - /* - * Returns whether the current playlist is the lowest rendition - * - * @return {Boolean} true if on lowest rendition - */ - - var isLowestEnabledRendition = function isLowestEnabledRendition(master, media) { - if (master.playlists.length === 1) { - return true; - } - - var currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE; - return master.playlists.filter(function (playlist) { - if (!isEnabled(playlist)) { - return false; - } - - return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth; - }).length === 0; - }; - var playlistMatch = function playlistMatch(a, b) { - // both playlits are null - // or only one playlist is non-null - // no match - if (!a && !b || !a && b || a && !b) { - return false; - } // playlist objects are the same, match - - - if (a === b) { - return true; - } // first try to use id as it should be the most - // accurate - - - if (a.id && b.id && a.id === b.id) { - return true; - } // next try to use reslovedUri as it should be the - // second most accurate. - - - if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) { - return true; - } // finally try to use uri as it should be accurate - // but might miss a few cases for relative uris - - - if (a.uri && b.uri && a.uri === b.uri) { - return true; - } - - return false; - }; - - var someAudioVariant = function someAudioVariant(master, callback) { - var AUDIO = master && master.mediaGroups && master.mediaGroups.AUDIO || {}; - var found = false; - - for (var groupName in AUDIO) { - for (var label in AUDIO[groupName]) { - found = callback(AUDIO[groupName][label]); - - if (found) { - break; - } - } - - if (found) { - break; - } - } - - return !!found; - }; - - var isAudioOnly = function isAudioOnly(master) { - // we are audio only if we have no main playlists but do - // have media group playlists. - if (!master || !master.playlists || !master.playlists.length) { - // without audio variants or playlists this - // is not an audio only master. - var found = someAudioVariant(master, function (variant) { - return variant.playlists && variant.playlists.length || variant.uri; - }); - return found; - } // if every playlist has only an audio codec it is audio only - - - var _loop = function _loop(i) { - var playlist = master.playlists[i]; - var CODECS = playlist.attributes && playlist.attributes.CODECS; // all codecs are audio, this is an audio playlist. - - if (CODECS && CODECS.split(',').every(function (c) { - return isAudioCodec(c); - })) { - return "continue"; - } // playlist is in an audio group it is audio only - - - var found = someAudioVariant(master, function (variant) { - return playlistMatch(playlist, variant); - }); - - if (found) { - return "continue"; - } // if we make it here this playlist isn't audio and we - // are not audio only - - - return { - v: false - }; - }; - - for (var i = 0; i < master.playlists.length; i++) { - var _ret = _loop(i); - - if (_ret === "continue") continue; - if (typeof _ret === "object") return _ret.v; - } // if we make it past every playlist without returning, then - // this is an audio only playlist. - - - return true; - }; // exports - - var Playlist = { - liveEdgeDelay: liveEdgeDelay, - duration: duration, - seekable: seekable, - getMediaInfoForTime: getMediaInfoForTime, - isEnabled: isEnabled, - isDisabled: isDisabled, - isBlacklisted: isBlacklisted, - isIncompatible: isIncompatible, - playlistEnd: playlistEnd, - isAes: isAes, - hasAttribute: hasAttribute, - estimateSegmentRequestTime: estimateSegmentRequestTime, - isLowestEnabledRendition: isLowestEnabledRendition, - isAudioOnly: isAudioOnly, - playlistMatch: playlistMatch - }; - - var log = videojs__default['default'].log; - var createPlaylistID = function createPlaylistID(index, uri) { - return index + "-" + uri; - }; - /** - * Parses a given m3u8 playlist - * - * @param {Function} [onwarn] - * a function to call when the parser triggers a warning event. - * @param {Function} [oninfo] - * a function to call when the parser triggers an info event. - * @param {string} manifestString - * The downloaded manifest string - * @param {Object[]} [customTagParsers] - * An array of custom tag parsers for the m3u8-parser instance - * @param {Object[]} [customTagMappers] - * An array of custom tag mappers for the m3u8-parser instance - * @param {boolean} [experimentalLLHLS=false] - * Whether to keep ll-hls features in the manifest after parsing. - * @return {Object} - * The manifest object - */ - - var parseManifest = function parseManifest(_ref) { - var onwarn = _ref.onwarn, - oninfo = _ref.oninfo, - manifestString = _ref.manifestString, - _ref$customTagParsers = _ref.customTagParsers, - customTagParsers = _ref$customTagParsers === void 0 ? [] : _ref$customTagParsers, - _ref$customTagMappers = _ref.customTagMappers, - customTagMappers = _ref$customTagMappers === void 0 ? [] : _ref$customTagMappers, - experimentalLLHLS = _ref.experimentalLLHLS; - var parser = new Parser(); - - if (onwarn) { - parser.on('warn', onwarn); - } - - if (oninfo) { - parser.on('info', oninfo); - } - - customTagParsers.forEach(function (customParser) { - return parser.addParser(customParser); - }); - customTagMappers.forEach(function (mapper) { - return parser.addTagMapper(mapper); - }); - parser.push(manifestString); - parser.end(); - var manifest = parser.manifest; // remove llhls features from the parsed manifest - // if we don't want llhls support. - - if (!experimentalLLHLS) { - ['preloadSegment', 'skip', 'serverControl', 'renditionReports', 'partInf', 'partTargetDuration'].forEach(function (k) { - if (manifest.hasOwnProperty(k)) { - delete manifest[k]; - } - }); - - if (manifest.segments) { - manifest.segments.forEach(function (segment) { - ['parts', 'preloadHints'].forEach(function (k) { - if (segment.hasOwnProperty(k)) { - delete segment[k]; - } - }); - }); - } - } - - if (!manifest.targetDuration) { - var targetDuration = 10; - - if (manifest.segments && manifest.segments.length) { - targetDuration = manifest.segments.reduce(function (acc, s) { - return Math.max(acc, s.duration); - }, 0); - } - - if (onwarn) { - onwarn("manifest has no targetDuration defaulting to " + targetDuration); - } - - manifest.targetDuration = targetDuration; - } - - var parts = getLastParts(manifest); - - if (parts.length && !manifest.partTargetDuration) { - var partTargetDuration = parts.reduce(function (acc, p) { - return Math.max(acc, p.duration); - }, 0); - - if (onwarn) { - onwarn("manifest has no partTargetDuration defaulting to " + partTargetDuration); - log.error('LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.'); - } - - manifest.partTargetDuration = partTargetDuration; - } - - return manifest; - }; - /** - * Loops through all supported media groups in master and calls the provided - * callback for each group - * - * @param {Object} master - * The parsed master manifest object - * @param {Function} callback - * Callback to call for each media group - */ - - var forEachMediaGroup = function forEachMediaGroup(master, callback) { - if (!master.mediaGroups) { - return; - } - - ['AUDIO', 'SUBTITLES'].forEach(function (mediaType) { - if (!master.mediaGroups[mediaType]) { - return; - } - - for (var groupKey in master.mediaGroups[mediaType]) { - for (var labelKey in master.mediaGroups[mediaType][groupKey]) { - var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey]; - callback(mediaProperties, mediaType, groupKey, labelKey); - } - } - }); - }; - /** - * Adds properties and attributes to the playlist to keep consistent functionality for - * playlists throughout VHS. - * - * @param {Object} config - * Arguments object - * @param {Object} config.playlist - * The media playlist - * @param {string} [config.uri] - * The uri to the media playlist (if media playlist is not from within a master - * playlist) - * @param {string} id - * ID to use for the playlist - */ - - var setupMediaPlaylist = function setupMediaPlaylist(_ref2) { - var playlist = _ref2.playlist, - uri = _ref2.uri, - id = _ref2.id; - playlist.id = id; - playlist.playlistErrors_ = 0; - - if (uri) { - // For media playlists, m3u8-parser does not have access to a URI, as HLS media - // playlists do not contain their own source URI, but one is needed for consistency in - // VHS. - playlist.uri = uri; - } // For HLS master playlists, even though certain attributes MUST be defined, the - // stream may still be played without them. - // For HLS media playlists, m3u8-parser does not attach an attributes object to the - // manifest. - // - // To avoid undefined reference errors through the project, and make the code easier - // to write/read, add an empty attributes object for these cases. - - - playlist.attributes = playlist.attributes || {}; - }; - /** - * Adds ID, resolvedUri, and attributes properties to each playlist of the master, where - * necessary. In addition, creates playlist IDs for each playlist and adds playlist ID to - * playlist references to the playlists array. - * - * @param {Object} master - * The master playlist - */ - - var setupMediaPlaylists = function setupMediaPlaylists(master) { - var i = master.playlists.length; - - while (i--) { - var playlist = master.playlists[i]; - setupMediaPlaylist({ - playlist: playlist, - id: createPlaylistID(i, playlist.uri) - }); - playlist.resolvedUri = resolveUrl(master.uri, playlist.uri); - master.playlists[playlist.id] = playlist; // URI reference added for backwards compatibility - - master.playlists[playlist.uri] = playlist; // Although the spec states an #EXT-X-STREAM-INF tag MUST have a BANDWIDTH attribute, - // the stream can be played without it. Although an attributes property may have been - // added to the playlist to prevent undefined references, issue a warning to fix the - // manifest. - - if (!playlist.attributes.BANDWIDTH) { - log.warn('Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.'); - } - } - }; - /** - * Adds resolvedUri properties to each media group. - * - * @param {Object} master - * The master playlist - */ - - var resolveMediaGroupUris = function resolveMediaGroupUris(master) { - forEachMediaGroup(master, function (properties) { - if (properties.uri) { - properties.resolvedUri = resolveUrl(master.uri, properties.uri); - } - }); - }; - /** - * Creates a master playlist wrapper to insert a sole media playlist into. - * - * @param {Object} media - * Media playlist - * @param {string} uri - * The media URI - * - * @return {Object} - * Master playlist - */ - - var masterForMedia = function masterForMedia(media, uri) { - var id = createPlaylistID(0, uri); - var master = { - mediaGroups: { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - uri: window__default['default'].location.href, - resolvedUri: window__default['default'].location.href, - playlists: [{ - uri: uri, - id: id, - resolvedUri: uri, - // m3u8-parser does not attach an attributes property to media playlists so make - // sure that the property is attached to avoid undefined reference errors - attributes: {} - }] - }; // set up ID reference - - master.playlists[id] = master.playlists[0]; // URI reference added for backwards compatibility - - master.playlists[uri] = master.playlists[0]; - return master; - }; - /** - * Does an in-place update of the master manifest to add updated playlist URI references - * as well as other properties needed by VHS that aren't included by the parser. - * - * @param {Object} master - * Master manifest object - * @param {string} uri - * The source URI - */ - - var addPropertiesToMaster = function addPropertiesToMaster(master, uri) { - master.uri = uri; - - for (var i = 0; i < master.playlists.length; i++) { - if (!master.playlists[i].uri) { - // Set up phony URIs for the playlists since playlists are referenced by their URIs - // throughout VHS, but some formats (e.g., DASH) don't have external URIs - // TODO: consider adding dummy URIs in mpd-parser - var phonyUri = "placeholder-uri-" + i; - master.playlists[i].uri = phonyUri; - } - } - - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - var groupId = "placeholder-uri-" + mediaType + "-" + groupKey + "-" + labelKey; - - if (!properties.playlists || !properties.playlists.length) { - properties.playlists = [_extends_1({}, properties)]; - } - - properties.playlists.forEach(function (p, i) { - var id = createPlaylistID(i, groupId); - - if (p.uri) { - p.resolvedUri = p.resolvedUri || resolveUrl(master.uri, p.uri); - } else { - // DEPRECATED, this has been added to prevent a breaking change. - // previously we only ever had a single media group playlist, so - // we mark the first playlist uri without prepending the index as we used to - // ideally we would do all of the playlists the same way. - p.uri = i === 0 ? groupId : id; // don't resolve a placeholder uri to an absolute url, just use - // the placeholder again - - p.resolvedUri = p.uri; - } - - p.id = p.id || id; // add an empty attributes object, all playlists are - // expected to have this. - - p.attributes = p.attributes || {}; // setup ID and URI references (URI for backwards compatibility) - - master.playlists[p.id] = p; - master.playlists[p.uri] = p; - }); - }); - setupMediaPlaylists(master); - resolveMediaGroupUris(master); - }; - - var mergeOptions$2 = videojs__default['default'].mergeOptions, - EventTarget$1 = videojs__default['default'].EventTarget; - - var addLLHLSQueryDirectives = function addLLHLSQueryDirectives(uri, media) { - if (media.endList) { - return uri; - } - - var query = []; - - if (media.serverControl && media.serverControl.canBlockReload) { - var preloadSegment = media.preloadSegment; // next msn is a zero based value, length is not. - - var nextMSN = media.mediaSequence + media.segments.length; // If preload segment has parts then it is likely - // that we are going to request a part of that preload segment. - // the logic below is used to determine that. - - if (preloadSegment) { - var parts = preloadSegment.parts || []; // _HLS_part is a zero based index - - var nextPart = getKnownPartCount(media) - 1; // if nextPart is > -1 and not equal to just the - // length of parts, then we know we had part preload hints - // and we need to add the _HLS_part= query - - if (nextPart > -1 && nextPart !== parts.length - 1) { - // add existing parts to our preload hints - query.push("_HLS_part=" + nextPart); - } // this if statement makes sure that we request the msn - // of the preload segment if: - // 1. the preload segment had parts (and was not yet a full segment) - // but was added to our segments array - // 2. the preload segment had preload hints for parts that are not in - // the manifest yet. - // in all other cases we want the segment after the preload segment - // which will be given by using media.segments.length because it is 1 based - // rather than 0 based. - - - if (nextPart > -1 || parts.length) { - nextMSN--; - } - } // add _HLS_msn= in front of any _HLS_part query - - - query.unshift("_HLS_msn=" + nextMSN); - } - - if (media.serverControl && media.serverControl.canSkipUntil) { - // add _HLS_skip= infront of all other queries. - query.unshift('_HLS_skip=' + (media.serverControl.canSkipDateranges ? 'v2' : 'YES')); - } - - query.forEach(function (str, i) { - var symbol = i === 0 ? '?' : '&'; - uri += "" + symbol + str; - }); - return uri; - }; - /** - * Returns a new segment object with properties and - * the parts array merged. - * - * @param {Object} a the old segment - * @param {Object} b the new segment - * - * @return {Object} the merged segment - */ - - - var updateSegment = function updateSegment(a, b) { - if (!a) { - return b; - } - - var result = mergeOptions$2(a, b); // if only the old segment has preload hints - // and the new one does not, remove preload hints. - - if (a.preloadHints && !b.preloadHints) { - delete result.preloadHints; - } // if only the old segment has parts - // then the parts are no longer valid - - - if (a.parts && !b.parts) { - delete result.parts; // if both segments have parts - // copy part propeties from the old segment - // to the new one. - } else if (a.parts && b.parts) { - for (var i = 0; i < b.parts.length; i++) { - if (a.parts && a.parts[i]) { - result.parts[i] = mergeOptions$2(a.parts[i], b.parts[i]); - } - } - } // set skipped to false for segments that have - // have had information merged from the old segment. - - - if (!a.skipped && b.skipped) { - result.skipped = false; - } // set preload to false for segments that have - // had information added in the new segment. - - - if (a.preload && !b.preload) { - result.preload = false; - } - - return result; - }; - /** - * Returns a new array of segments that is the result of merging - * properties from an older list of segments onto an updated - * list. No properties on the updated playlist will be ovewritten. - * - * @param {Array} original the outdated list of segments - * @param {Array} update the updated list of segments - * @param {number=} offset the index of the first update - * segment in the original segment list. For non-live playlists, - * this should always be zero and does not need to be - * specified. For live playlists, it should be the difference - * between the media sequence numbers in the original and updated - * playlists. - * @return {Array} a list of merged segment objects - */ - - var updateSegments = function updateSegments(original, update, offset) { - var oldSegments = original.slice(); - var newSegments = update.slice(); - offset = offset || 0; - var result = []; - var currentMap; - - for (var newIndex = 0; newIndex < newSegments.length; newIndex++) { - var oldSegment = oldSegments[newIndex + offset]; - var newSegment = newSegments[newIndex]; - - if (oldSegment) { - currentMap = oldSegment.map || currentMap; - result.push(updateSegment(oldSegment, newSegment)); - } else { - // carry over map to new segment if it is missing - if (currentMap && !newSegment.map) { - newSegment.map = currentMap; - } - - result.push(newSegment); - } - } - - return result; - }; - var resolveSegmentUris = function resolveSegmentUris(segment, baseUri) { - // preloadSegment will not have a uri at all - // as the segment isn't actually in the manifest yet, only parts - if (!segment.resolvedUri && segment.uri) { - segment.resolvedUri = resolveUrl(baseUri, segment.uri); - } - - if (segment.key && !segment.key.resolvedUri) { - segment.key.resolvedUri = resolveUrl(baseUri, segment.key.uri); - } - - if (segment.map && !segment.map.resolvedUri) { - segment.map.resolvedUri = resolveUrl(baseUri, segment.map.uri); - } - - if (segment.map && segment.map.key && !segment.map.key.resolvedUri) { - segment.map.key.resolvedUri = resolveUrl(baseUri, segment.map.key.uri); - } - - if (segment.parts && segment.parts.length) { - segment.parts.forEach(function (p) { - if (p.resolvedUri) { - return; - } - - p.resolvedUri = resolveUrl(baseUri, p.uri); - }); - } - - if (segment.preloadHints && segment.preloadHints.length) { - segment.preloadHints.forEach(function (p) { - if (p.resolvedUri) { - return; - } - - p.resolvedUri = resolveUrl(baseUri, p.uri); - }); - } - }; - - var getAllSegments = function getAllSegments(media) { - var segments = media.segments || []; - var preloadSegment = media.preloadSegment; // a preloadSegment with only preloadHints is not currently - // a usable segment, only include a preloadSegment that has - // parts. - - if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) { - // if preloadHints has a MAP that means that the - // init segment is going to change. We cannot use any of the parts - // from this preload segment. - if (preloadSegment.preloadHints) { - for (var i = 0; i < preloadSegment.preloadHints.length; i++) { - if (preloadSegment.preloadHints[i].type === 'MAP') { - return segments; - } - } - } // set the duration for our preload segment to target duration. - - - preloadSegment.duration = media.targetDuration; - preloadSegment.preload = true; - segments.push(preloadSegment); - } - - return segments; - }; // consider the playlist unchanged if the playlist object is the same or - // the number of segments is equal, the media sequence number is unchanged, - // and this playlist hasn't become the end of the playlist - - - var isPlaylistUnchanged = function isPlaylistUnchanged(a, b) { - return a === b || a.segments && b.segments && a.segments.length === b.segments.length && a.endList === b.endList && a.mediaSequence === b.mediaSequence; - }; - /** - * Returns a new master playlist that is the result of merging an - * updated media playlist into the original version. If the - * updated media playlist does not match any of the playlist - * entries in the original master playlist, null is returned. - * - * @param {Object} master a parsed master M3U8 object - * @param {Object} media a parsed media M3U8 object - * @return {Object} a new object that represents the original - * master playlist with the updated media playlist merged in, or - * null if the merge produced no change. - */ - - var updateMaster$1 = function updateMaster(master, newMedia, unchangedCheck) { - if (unchangedCheck === void 0) { - unchangedCheck = isPlaylistUnchanged; - } - - var result = mergeOptions$2(master, {}); - var oldMedia = result.playlists[newMedia.id]; - - if (!oldMedia) { - return null; - } - - if (unchangedCheck(oldMedia, newMedia)) { - return null; - } - - newMedia.segments = getAllSegments(newMedia); - var mergedPlaylist = mergeOptions$2(oldMedia, newMedia); // always use the new media's preload segment - - if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) { - delete mergedPlaylist.preloadSegment; - } // if the update could overlap existing segment information, merge the two segment lists - - - if (oldMedia.segments) { - if (newMedia.skip) { - newMedia.segments = newMedia.segments || []; // add back in objects for skipped segments, so that we merge - // old properties into the new segments - - for (var i = 0; i < newMedia.skip.skippedSegments; i++) { - newMedia.segments.unshift({ - skipped: true - }); - } - } - - mergedPlaylist.segments = updateSegments(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence); - } // resolve any segment URIs to prevent us from having to do it later - - - mergedPlaylist.segments.forEach(function (segment) { - resolveSegmentUris(segment, mergedPlaylist.resolvedUri); - }); // TODO Right now in the playlists array there are two references to each playlist, one - // that is referenced by index, and one by URI. The index reference may no longer be - // necessary. - - for (var _i = 0; _i < result.playlists.length; _i++) { - if (result.playlists[_i].id === newMedia.id) { - result.playlists[_i] = mergedPlaylist; - } - } - - result.playlists[newMedia.id] = mergedPlaylist; // URI reference added for backwards compatibility - - result.playlists[newMedia.uri] = mergedPlaylist; // update media group playlist references. - - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - if (!properties.playlists) { - return; - } - - for (var _i2 = 0; _i2 < properties.playlists.length; _i2++) { - if (newMedia.id === properties.playlists[_i2].id) { - properties.playlists[_i2] = newMedia; - } - } - }); - return result; - }; - /** - * Calculates the time to wait before refreshing a live playlist - * - * @param {Object} media - * The current media - * @param {boolean} update - * True if there were any updates from the last refresh, false otherwise - * @return {number} - * The time in ms to wait before refreshing the live playlist - */ - - var refreshDelay = function refreshDelay(media, update) { - var lastSegment = media.segments[media.segments.length - 1]; - var lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1]; - var lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration; - - if (update && lastDuration) { - return lastDuration * 1000; - } // if the playlist is unchanged since the last reload or last segment duration - // cannot be determined, try again after half the target duration - - - return (media.partTargetDuration || media.targetDuration || 10) * 500; - }; - /** - * Load a playlist from a remote location - * - * @class PlaylistLoader - * @extends Stream - * @param {string|Object} src url or object of manifest - * @param {boolean} withCredentials the withCredentials xhr option - * @class - */ - - var PlaylistLoader = /*#__PURE__*/function (_EventTarget) { - inheritsLoose(PlaylistLoader, _EventTarget); - - function PlaylistLoader(src, vhs, options) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _EventTarget.call(this) || this; - - if (!src) { - throw new Error('A non-empty playlist URL or object is required'); - } - - _this.logger_ = logger('PlaylistLoader'); - var _options = options, - _options$withCredenti = _options.withCredentials, - withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, - _options$handleManife = _options.handleManifestRedirects, - handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife; - _this.src = src; - _this.vhs_ = vhs; - _this.withCredentials = withCredentials; - _this.handleManifestRedirects = handleManifestRedirects; - var vhsOptions = vhs.options_; - _this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || []; - _this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || []; - _this.experimentalLLHLS = vhsOptions && vhsOptions.experimentalLLHLS || false; // initialize the loader state - - _this.state = 'HAVE_NOTHING'; // live playlist staleness timeout - - _this.handleMediaupdatetimeout_ = _this.handleMediaupdatetimeout_.bind(assertThisInitialized(_this)); - - _this.on('mediaupdatetimeout', _this.handleMediaupdatetimeout_); - - return _this; - } - - var _proto = PlaylistLoader.prototype; - - _proto.handleMediaupdatetimeout_ = function handleMediaupdatetimeout_() { - var _this2 = this; - - if (this.state !== 'HAVE_METADATA') { - // only refresh the media playlist if no other activity is going on - return; - } - - var media = this.media(); - var uri = resolveUrl(this.master.uri, media.uri); - - if (this.experimentalLLHLS) { - uri = addLLHLSQueryDirectives(uri, media); - } - - this.state = 'HAVE_CURRENT_METADATA'; - this.request = this.vhs_.xhr({ - uri: uri, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this2.request) { - return; - } - - if (error) { - return _this2.playlistRequestError(_this2.request, _this2.media(), 'HAVE_METADATA'); - } - - _this2.haveMetadata({ - playlistString: _this2.request.responseText, - url: _this2.media().uri, - id: _this2.media().id - }); - }); - }; - - _proto.playlistRequestError = function playlistRequestError(xhr, playlist, startingState) { - var uri = playlist.uri, - id = playlist.id; // any in-flight request is now finished - - this.request = null; - - if (startingState) { - this.state = startingState; - } - - this.error = { - playlist: this.master.playlists[id], - status: xhr.status, - message: "HLS playlist request error at URL: " + uri + ".", - responseText: xhr.responseText, - code: xhr.status >= 500 ? 4 : 2 - }; - this.trigger('error'); - }; - - _proto.parseManifest_ = function parseManifest_(_ref) { - var _this3 = this; - - var url = _ref.url, - manifestString = _ref.manifestString; - return parseManifest({ - onwarn: function onwarn(_ref2) { - var message = _ref2.message; - return _this3.logger_("m3u8-parser warn for " + url + ": " + message); - }, - oninfo: function oninfo(_ref3) { - var message = _ref3.message; - return _this3.logger_("m3u8-parser info for " + url + ": " + message); - }, - manifestString: manifestString, - customTagParsers: this.customTagParsers, - customTagMappers: this.customTagMappers, - experimentalLLHLS: this.experimentalLLHLS - }); - } - /** - * Update the playlist loader's state in response to a new or updated playlist. - * - * @param {string} [playlistString] - * Playlist string (if playlistObject is not provided) - * @param {Object} [playlistObject] - * Playlist object (if playlistString is not provided) - * @param {string} url - * URL of playlist - * @param {string} id - * ID to use for playlist - */ - ; - - _proto.haveMetadata = function haveMetadata(_ref4) { - var _this4 = this; - - var playlistString = _ref4.playlistString, - playlistObject = _ref4.playlistObject, - url = _ref4.url, - id = _ref4.id; - // any in-flight request is now finished - this.request = null; - this.state = 'HAVE_METADATA'; - var playlist = playlistObject || this.parseManifest_({ - url: url, - manifestString: playlistString - }); - playlist.lastRequest = Date.now(); - setupMediaPlaylist({ - playlist: playlist, - uri: url, - id: id - }); // merge this playlist into the master - - var update = updateMaster$1(this.master, playlist); - this.targetDuration = playlist.partTargetDuration || playlist.targetDuration; - - if (update) { - this.master = update; - this.media_ = this.master.playlists[id]; - } else { - this.trigger('playlistunchanged'); - } // refresh live playlists after a target duration passes - - - if (!this.media().endList) { - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - _this4.trigger('mediaupdatetimeout'); - }, refreshDelay(this.media(), !!update)); - } - - this.trigger('loadedplaylist'); - } - /** - * Abort any outstanding work and clean up. - */ - ; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.stopRequest(); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - window__default['default'].clearTimeout(this.finalRenditionTimeout); - this.off(); - }; - - _proto.stopRequest = function stopRequest() { - if (this.request) { - var oldRequest = this.request; - this.request = null; - oldRequest.onreadystatechange = null; - oldRequest.abort(); - } - } - /** - * When called without any arguments, returns the currently - * active media playlist. When called with a single argument, - * triggers the playlist loader to asynchronously switch to the - * specified media playlist. Calling this method while the - * loader is in the HAVE_NOTHING causes an error to be emitted - * but otherwise has no effect. - * - * @param {Object=} playlist the parsed media playlist - * object to switch to - * @param {boolean=} shouldDelay whether we should delay the request by half target duration - * - * @return {Playlist} the current loaded media - */ - ; - - _proto.media = function media(playlist, shouldDelay) { - var _this5 = this; - - // getter - if (!playlist) { - return this.media_; - } // setter - - - if (this.state === 'HAVE_NOTHING') { - throw new Error('Cannot switch media playlist from ' + this.state); - } // find the playlist object if the target playlist has been - // specified by URI - - - if (typeof playlist === 'string') { - if (!this.master.playlists[playlist]) { - throw new Error('Unknown playlist URI: ' + playlist); - } - - playlist = this.master.playlists[playlist]; - } - - window__default['default'].clearTimeout(this.finalRenditionTimeout); - - if (shouldDelay) { - var delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1000 || 5 * 1000; - this.finalRenditionTimeout = window__default['default'].setTimeout(this.media.bind(this, playlist, false), delay); - return; - } - - var startingState = this.state; - var mediaChange = !this.media_ || playlist.id !== this.media_.id; - var masterPlaylistRef = this.master.playlists[playlist.id]; // switch to fully loaded playlists immediately - - if (masterPlaylistRef && masterPlaylistRef.endList || // handle the case of a playlist object (e.g., if using vhs-json with a resolved - // media playlist or, for the case of demuxed audio, a resolved audio media group) - playlist.endList && playlist.segments.length) { - // abort outstanding playlist requests - if (this.request) { - this.request.onreadystatechange = null; - this.request.abort(); - this.request = null; - } - - this.state = 'HAVE_METADATA'; - this.media_ = playlist; // trigger media change if the active media has been updated - - if (mediaChange) { - this.trigger('mediachanging'); - - if (startingState === 'HAVE_MASTER') { - // The initial playlist was a master manifest, and the first media selected was - // also provided (in the form of a resolved playlist object) as part of the - // source object (rather than just a URL). Therefore, since the media playlist - // doesn't need to be requested, loadedmetadata won't trigger as part of the - // normal flow, and needs an explicit trigger here. - this.trigger('loadedmetadata'); - } else { - this.trigger('mediachange'); - } - } - - return; - } // switching to the active playlist is a no-op - - - if (!mediaChange) { - return; - } - - this.state = 'SWITCHING_MEDIA'; // there is already an outstanding playlist request - - if (this.request) { - if (playlist.resolvedUri === this.request.url) { - // requesting to switch to the same playlist multiple times - // has no effect after the first - return; - } - - this.request.onreadystatechange = null; - this.request.abort(); - this.request = null; - } // request the new playlist - - - if (this.media_) { - this.trigger('mediachanging'); - } - - this.request = this.vhs_.xhr({ - uri: playlist.resolvedUri, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this5.request) { - return; - } - - playlist.lastRequest = Date.now(); - playlist.resolvedUri = resolveManifestRedirect(_this5.handleManifestRedirects, playlist.resolvedUri, req); - - if (error) { - return _this5.playlistRequestError(_this5.request, playlist, startingState); - } - - _this5.haveMetadata({ - playlistString: req.responseText, - url: playlist.uri, - id: playlist.id - }); // fire loadedmetadata the first time a media playlist is loaded - - - if (startingState === 'HAVE_MASTER') { - _this5.trigger('loadedmetadata'); - } else { - _this5.trigger('mediachange'); - } - }); - } - /** - * pause loading of the playlist - */ - ; - - _proto.pause = function pause() { - this.stopRequest(); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - - if (this.state === 'HAVE_NOTHING') { - // If we pause the loader before any data has been retrieved, its as if we never - // started, so reset to an unstarted state. - this.started = false; - } // Need to restore state now that no activity is happening - - - if (this.state === 'SWITCHING_MEDIA') { - // if the loader was in the process of switching media, it should either return to - // HAVE_MASTER or HAVE_METADATA depending on if the loader has loaded a media - // playlist yet. This is determined by the existence of loader.media_ - if (this.media_) { - this.state = 'HAVE_METADATA'; - } else { - this.state = 'HAVE_MASTER'; - } - } else if (this.state === 'HAVE_CURRENT_METADATA') { - this.state = 'HAVE_METADATA'; - } - } - /** - * start loading of the playlist - */ - ; - - _proto.load = function load(shouldDelay) { - var _this6 = this; - - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - var media = this.media(); - - if (shouldDelay) { - var delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1000 : 5 * 1000; - this.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - return _this6.load(); - }, delay); - return; - } - - if (!this.started) { - this.start(); - return; - } - - if (media && !media.endList) { - this.trigger('mediaupdatetimeout'); - } else { - this.trigger('loadedplaylist'); - } - } - /** - * start loading of the playlist - */ - ; - - _proto.start = function start() { - var _this7 = this; - - this.started = true; - - if (typeof this.src === 'object') { - // in the case of an entirely constructed manifest object (meaning there's no actual - // manifest on a server), default the uri to the page's href - if (!this.src.uri) { - this.src.uri = window__default['default'].location.href; - } // resolvedUri is added on internally after the initial request. Since there's no - // request for pre-resolved manifests, add on resolvedUri here. - - - this.src.resolvedUri = this.src.uri; // Since a manifest object was passed in as the source (instead of a URL), the first - // request can be skipped (since the top level of the manifest, at a minimum, is - // already available as a parsed manifest object). However, if the manifest object - // represents a master playlist, some media playlists may need to be resolved before - // the starting segment list is available. Therefore, go directly to setup of the - // initial playlist, and let the normal flow continue from there. - // - // Note that the call to setup is asynchronous, as other sections of VHS may assume - // that the first request is asynchronous. - - setTimeout(function () { - _this7.setupInitialPlaylist(_this7.src); - }, 0); - return; - } // request the specified URL - - - this.request = this.vhs_.xhr({ - uri: this.src, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this7.request) { - return; - } // clear the loader's request reference - - - _this7.request = null; - - if (error) { - _this7.error = { - status: req.status, - message: "HLS playlist request error at URL: " + _this7.src + ".", - responseText: req.responseText, - // MEDIA_ERR_NETWORK - code: 2 - }; - - if (_this7.state === 'HAVE_NOTHING') { - _this7.started = false; - } - - return _this7.trigger('error'); - } - - _this7.src = resolveManifestRedirect(_this7.handleManifestRedirects, _this7.src, req); - - var manifest = _this7.parseManifest_({ - manifestString: req.responseText, - url: _this7.src - }); - - _this7.setupInitialPlaylist(manifest); - }); - }; - - _proto.srcUri = function srcUri() { - return typeof this.src === 'string' ? this.src : this.src.uri; - } - /** - * Given a manifest object that's either a master or media playlist, trigger the proper - * events and set the state of the playlist loader. - * - * If the manifest object represents a master playlist, `loadedplaylist` will be - * triggered to allow listeners to select a playlist. If none is selected, the loader - * will default to the first one in the playlists array. - * - * If the manifest object represents a media playlist, `loadedplaylist` will be - * triggered followed by `loadedmetadata`, as the only available playlist is loaded. - * - * In the case of a media playlist, a master playlist object wrapper with one playlist - * will be created so that all logic can handle playlists in the same fashion (as an - * assumed manifest object schema). - * - * @param {Object} manifest - * The parsed manifest object - */ - ; - - _proto.setupInitialPlaylist = function setupInitialPlaylist(manifest) { - this.state = 'HAVE_MASTER'; - - if (manifest.playlists) { - this.master = manifest; - addPropertiesToMaster(this.master, this.srcUri()); // If the initial master playlist has playlists wtih segments already resolved, - // then resolve URIs in advance, as they are usually done after a playlist request, - // which may not happen if the playlist is resolved. - - manifest.playlists.forEach(function (playlist) { - playlist.segments = getAllSegments(playlist); - playlist.segments.forEach(function (segment) { - resolveSegmentUris(segment, playlist.resolvedUri); - }); - }); - this.trigger('loadedplaylist'); - - if (!this.request) { - // no media playlist was specifically selected so start - // from the first listed one - this.media(this.master.playlists[0]); - } - - return; - } // In order to support media playlists passed in as vhs-json, the case where the uri - // is not provided as part of the manifest should be considered, and an appropriate - // default used. - - - var uri = this.srcUri() || window__default['default'].location.href; - this.master = masterForMedia(manifest, uri); - this.haveMetadata({ - playlistObject: manifest, - url: uri, - id: this.master.playlists[0].id - }); - this.trigger('loadedmetadata'); - }; - - return PlaylistLoader; - }(EventTarget$1); - - /** - * @file xhr.js - */ - var videojsXHR = videojs__default['default'].xhr, - mergeOptions$1 = videojs__default['default'].mergeOptions; - - var callbackWrapper = function callbackWrapper(request, error, response, callback) { - var reqResponse = request.responseType === 'arraybuffer' ? request.response : request.responseText; - - if (!error && reqResponse) { - request.responseTime = Date.now(); - request.roundTripTime = request.responseTime - request.requestTime; - request.bytesReceived = reqResponse.byteLength || reqResponse.length; - - if (!request.bandwidth) { - request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1000); - } - } - - if (response.headers) { - request.responseHeaders = response.headers; - } // videojs.xhr now uses a specific code on the error - // object to signal that a request has timed out instead - // of setting a boolean on the request object - - - if (error && error.code === 'ETIMEDOUT') { - request.timedout = true; - } // videojs.xhr no longer considers status codes outside of 200 and 0 - // (for file uris) to be errors, but the old XHR did, so emulate that - // behavior. Status 206 may be used in response to byterange requests. - - - if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) { - error = new Error('XHR Failed with a response of: ' + (request && (reqResponse || request.responseText))); - } - - callback(error, request); - }; - - var xhrFactory = function xhrFactory() { - var xhr = function XhrFunction(options, callback) { - // Add a default timeout - options = mergeOptions$1({ - timeout: 45e3 - }, options); // Allow an optional user-specified function to modify the option - // object before we construct the xhr request - - var beforeRequest = XhrFunction.beforeRequest || videojs__default['default'].Vhs.xhr.beforeRequest; - - if (beforeRequest && typeof beforeRequest === 'function') { - var newOptions = beforeRequest(options); - - if (newOptions) { - options = newOptions; - } - } // Use the standard videojs.xhr() method unless `videojs.Vhs.xhr` has been overriden - // TODO: switch back to videojs.Vhs.xhr.name === 'XhrFunction' when we drop IE11 - - - var xhrMethod = videojs__default['default'].Vhs.xhr.original === true ? videojsXHR : videojs__default['default'].Vhs.xhr; - var request = xhrMethod(options, function (error, response) { - return callbackWrapper(request, error, response, callback); - }); - var originalAbort = request.abort; - - request.abort = function () { - request.aborted = true; - return originalAbort.apply(request, arguments); - }; - - request.uri = options.uri; - request.requestTime = Date.now(); - return request; - }; - - xhr.original = true; - return xhr; - }; - /** - * Turns segment byterange into a string suitable for use in - * HTTP Range requests - * - * @param {Object} byterange - an object with two values defining the start and end - * of a byte-range - */ - - - var byterangeStr = function byterangeStr(byterange) { - // `byterangeEnd` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - var byterangeEnd = byterange.offset + byterange.length - 1; - var byterangeStart = byterange.offset; - return 'bytes=' + byterangeStart + '-' + byterangeEnd; - }; - /** - * Defines headers for use in the xhr request for a particular segment. - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - */ - - - var segmentXhrHeaders = function segmentXhrHeaders(segment) { - var headers = {}; - - if (segment.byterange) { - headers.Range = byterangeStr(segment.byterange); - } - - return headers; - }; - - var MPEGURL_REGEX = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i; - var DASH_REGEX = /^application\/dash\+xml/i; - /** - * Returns a string that describes the type of source based on a video source object's - * media type. - * - * @see {@link https://dev.w3.org/html5/pf-summary/video.html#dom-source-type|Source Type} - * - * @param {string} type - * Video source object media type - * @return {('hls'|'dash'|'vhs-json'|null)} - * VHS source type string - */ - - var simpleTypeFromSourceType = function simpleTypeFromSourceType(type) { - if (MPEGURL_REGEX.test(type)) { - return 'hls'; - } - - if (DASH_REGEX.test(type)) { - return 'dash'; - } // Denotes the special case of a manifest object passed to http-streaming instead of a - // source URL. - // - // See https://en.wikipedia.org/wiki/Media_type for details on specifying media types. - // - // In this case, vnd stands for vendor, video.js for the organization, VHS for this - // project, and the +json suffix identifies the structure of the media type. - - - if (type === 'application/vnd.videojs.vhs+json') { - return 'vhs-json'; - } - - return null; - }; - - /** - * @file bin-utils.js - */ - - /** - * convert a TimeRange to text - * - * @param {TimeRange} range the timerange to use for conversion - * @param {number} i the iterator on the range to convert - * @return {string} the range in string format - */ - var textRange = function textRange(range, i) { - return range.start(i) + '-' + range.end(i); - }; - /** - * format a number as hex string - * - * @param {number} e The number - * @param {number} i the iterator - * @return {string} the hex formatted number as a string - */ - - - var formatHexString = function formatHexString(e, i) { - var value = e.toString(16); - return '00'.substring(0, 2 - value.length) + value + (i % 2 ? ' ' : ''); - }; - - var formatAsciiString = function formatAsciiString(e) { - if (e >= 0x20 && e < 0x7e) { - return String.fromCharCode(e); - } - - return '.'; - }; - /** - * Creates an object for sending to a web worker modifying properties that are TypedArrays - * into a new object with seperated properties for the buffer, byteOffset, and byteLength. - * - * @param {Object} message - * Object of properties and values to send to the web worker - * @return {Object} - * Modified message with TypedArray values expanded - * @function createTransferableMessage - */ - - - var createTransferableMessage = function createTransferableMessage(message) { - var transferable = {}; - Object.keys(message).forEach(function (key) { - var value = message[key]; - - if (ArrayBuffer.isView(value)) { - transferable[key] = { - bytes: value.buffer, - byteOffset: value.byteOffset, - byteLength: value.byteLength - }; - } else { - transferable[key] = value; - } - }); - return transferable; - }; - /** - * Returns a unique string identifier for a media initialization - * segment. - * - * @param {Object} initSegment - * the init segment object. - * - * @return {string} the generated init segment id - */ - - var initSegmentId = function initSegmentId(initSegment) { - var byterange = initSegment.byterange || { - length: Infinity, - offset: 0 - }; - return [byterange.length, byterange.offset, initSegment.resolvedUri].join(','); - }; - /** - * Returns a unique string identifier for a media segment key. - * - * @param {Object} key the encryption key - * @return {string} the unique id for the media segment key. - */ - - var segmentKeyId = function segmentKeyId(key) { - return key.resolvedUri; - }; - /** - * utils to help dump binary data to the console - * - * @param {Array|TypedArray} data - * data to dump to a string - * - * @return {string} the data as a hex string. - */ - - var hexDump = function hexDump(data) { - var bytes = Array.prototype.slice.call(data); - var step = 16; - var result = ''; - var hex; - var ascii; - - for (var j = 0; j < bytes.length / step; j++) { - hex = bytes.slice(j * step, j * step + step).map(formatHexString).join(''); - ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join(''); - result += hex + ' ' + ascii + '\n'; - } - - return result; - }; - var tagDump = function tagDump(_ref) { - var bytes = _ref.bytes; - return hexDump(bytes); - }; - var textRanges = function textRanges(ranges) { - var result = ''; - var i; - - for (i = 0; i < ranges.length; i++) { - result += textRange(ranges, i) + ' '; - } - - return result; - }; - - var utils = /*#__PURE__*/Object.freeze({ - __proto__: null, - createTransferableMessage: createTransferableMessage, - initSegmentId: initSegmentId, - segmentKeyId: segmentKeyId, - hexDump: hexDump, - tagDump: tagDump, - textRanges: textRanges - }); - - // TODO handle fmp4 case where the timing info is accurate and doesn't involve transmux - // 25% was arbitrarily chosen, and may need to be refined over time. - - var SEGMENT_END_FUDGE_PERCENT = 0.25; - /** - * Converts a player time (any time that can be gotten/set from player.currentTime(), - * e.g., any time within player.seekable().start(0) to player.seekable().end(0)) to a - * program time (any time referencing the real world (e.g., EXT-X-PROGRAM-DATE-TIME)). - * - * The containing segment is required as the EXT-X-PROGRAM-DATE-TIME serves as an "anchor - * point" (a point where we have a mapping from program time to player time, with player - * time being the post transmux start of the segment). - * - * For more details, see [this doc](../../docs/program-time-from-player-time.md). - * - * @param {number} playerTime the player time - * @param {Object} segment the segment which contains the player time - * @return {Date} program time - */ - - var playerTimeToProgramTime = function playerTimeToProgramTime(playerTime, segment) { - if (!segment.dateTimeObject) { - // Can't convert without an "anchor point" for the program time (i.e., a time that can - // be used to map the start of a segment with a real world time). - return null; - } - - var transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds; - var transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart; // get the start of the content from before old content is prepended - - var startOfSegment = transmuxedStart + transmuxerPrependedSeconds; - var offsetFromSegmentStart = playerTime - startOfSegment; - return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1000); - }; - var originalSegmentVideoDuration = function originalSegmentVideoDuration(videoTimingInfo) { - return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds; - }; - /** - * Finds a segment that contains the time requested given as an ISO-8601 string. The - * returned segment might be an estimate or an accurate match. - * - * @param {string} programTime The ISO-8601 programTime to find a match for - * @param {Object} playlist A playlist object to search within - */ - - var findSegmentForProgramTime = function findSegmentForProgramTime(programTime, playlist) { - // Assumptions: - // - verifyProgramDateTimeTags has already been run - // - live streams have been started - var dateTimeObject; - - try { - dateTimeObject = new Date(programTime); - } catch (e) { - return null; - } - - if (!playlist || !playlist.segments || playlist.segments.length === 0) { - return null; - } - - var segment = playlist.segments[0]; - - if (dateTimeObject < segment.dateTimeObject) { - // Requested time is before stream start. - return null; - } - - for (var i = 0; i < playlist.segments.length - 1; i++) { - segment = playlist.segments[i]; - var nextSegmentStart = playlist.segments[i + 1].dateTimeObject; - - if (dateTimeObject < nextSegmentStart) { - break; - } - } - - var lastSegment = playlist.segments[playlist.segments.length - 1]; - var lastSegmentStart = lastSegment.dateTimeObject; - var lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT; - var lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1000); - - if (dateTimeObject > lastSegmentEnd) { - // Beyond the end of the stream, or our best guess of the end of the stream. - return null; - } - - if (dateTimeObject > lastSegmentStart) { - segment = lastSegment; - } - - return { - segment: segment, - estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)), - // Although, given that all segments have accurate date time objects, the segment - // selected should be accurate, unless the video has been transmuxed at some point - // (determined by the presence of the videoTimingInfo object), the segment's "player - // time" (the start time in the player) can't be considered accurate. - type: segment.videoTimingInfo ? 'accurate' : 'estimate' - }; - }; - /** - * Finds a segment that contains the given player time(in seconds). - * - * @param {number} time The player time to find a match for - * @param {Object} playlist A playlist object to search within - */ - - var findSegmentForPlayerTime = function findSegmentForPlayerTime(time, playlist) { - // Assumptions: - // - there will always be a segment.duration - // - we can start from zero - // - segments are in time order - if (!playlist || !playlist.segments || playlist.segments.length === 0) { - return null; - } - - var segmentEnd = 0; - var segment; - - for (var i = 0; i < playlist.segments.length; i++) { - segment = playlist.segments[i]; // videoTimingInfo is set after the segment is downloaded and transmuxed, and - // should contain the most accurate values we have for the segment's player times. - // - // Use the accurate transmuxedPresentationEnd value if it is available, otherwise fall - // back to an estimate based on the manifest derived (inaccurate) segment.duration, to - // calculate an end value. - - segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration; - - if (time <= segmentEnd) { - break; - } - } - - var lastSegment = playlist.segments[playlist.segments.length - 1]; - - if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) { - // The time requested is beyond the stream end. - return null; - } - - if (time > segmentEnd) { - // The time is within or beyond the last segment. - // - // Check to see if the time is beyond a reasonable guess of the end of the stream. - if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT) { - // Technically, because the duration value is only an estimate, the time may still - // exist in the last segment, however, there isn't enough information to make even - // a reasonable estimate. - return null; - } - - segment = lastSegment; - } - - return { - segment: segment, - estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration, - // Because videoTimingInfo is only set after transmux, it is the only way to get - // accurate timing values. - type: segment.videoTimingInfo ? 'accurate' : 'estimate' - }; - }; - /** - * Gives the offset of the comparisonTimestamp from the programTime timestamp in seconds. - * If the offset returned is positive, the programTime occurs after the - * comparisonTimestamp. - * If the offset is negative, the programTime occurs before the comparisonTimestamp. - * - * @param {string} comparisonTimeStamp An ISO-8601 timestamp to compare against - * @param {string} programTime The programTime as an ISO-8601 string - * @return {number} offset - */ - - var getOffsetFromTimestamp = function getOffsetFromTimestamp(comparisonTimeStamp, programTime) { - var segmentDateTime; - var programDateTime; - - try { - segmentDateTime = new Date(comparisonTimeStamp); - programDateTime = new Date(programTime); - } catch (e) {// TODO handle error - } - - var segmentTimeEpoch = segmentDateTime.getTime(); - var programTimeEpoch = programDateTime.getTime(); - return (programTimeEpoch - segmentTimeEpoch) / 1000; - }; - /** - * Checks that all segments in this playlist have programDateTime tags. - * - * @param {Object} playlist A playlist object - */ - - var verifyProgramDateTimeTags = function verifyProgramDateTimeTags(playlist) { - if (!playlist.segments || playlist.segments.length === 0) { - return false; - } - - for (var i = 0; i < playlist.segments.length; i++) { - var segment = playlist.segments[i]; - - if (!segment.dateTimeObject) { - return false; - } - } - - return true; - }; - /** - * Returns the programTime of the media given a playlist and a playerTime. - * The playlist must have programDateTime tags for a programDateTime tag to be returned. - * If the segments containing the time requested have not been buffered yet, an estimate - * may be returned to the callback. - * - * @param {Object} args - * @param {Object} args.playlist A playlist object to search within - * @param {number} time A playerTime in seconds - * @param {Function} callback(err, programTime) - * @return {string} err.message A detailed error message - * @return {Object} programTime - * @return {number} programTime.mediaSeconds The streamTime in seconds - * @return {string} programTime.programDateTime The programTime as an ISO-8601 String - */ - - var getProgramTime = function getProgramTime(_ref) { - var playlist = _ref.playlist, - _ref$time = _ref.time, - time = _ref$time === void 0 ? undefined : _ref$time, - callback = _ref.callback; - - if (!callback) { - throw new Error('getProgramTime: callback must be provided'); - } - - if (!playlist || time === undefined) { - return callback({ - message: 'getProgramTime: playlist and time must be provided' - }); - } - - var matchedSegment = findSegmentForPlayerTime(time, playlist); - - if (!matchedSegment) { - return callback({ - message: 'valid programTime was not found' - }); - } - - if (matchedSegment.type === 'estimate') { - return callback({ - message: 'Accurate programTime could not be determined.' + ' Please seek to e.seekTime and try again', - seekTime: matchedSegment.estimatedStart - }); - } - - var programTimeObject = { - mediaSeconds: time - }; - var programTime = playerTimeToProgramTime(time, matchedSegment.segment); - - if (programTime) { - programTimeObject.programDateTime = programTime.toISOString(); - } - - return callback(null, programTimeObject); - }; - /** - * Seeks in the player to a time that matches the given programTime ISO-8601 string. - * - * @param {Object} args - * @param {string} args.programTime A programTime to seek to as an ISO-8601 String - * @param {Object} args.playlist A playlist to look within - * @param {number} args.retryCount The number of times to try for an accurate seek. Default is 2. - * @param {Function} args.seekTo A method to perform a seek - * @param {boolean} args.pauseAfterSeek Whether to end in a paused state after seeking. Default is true. - * @param {Object} args.tech The tech to seek on - * @param {Function} args.callback(err, newTime) A callback to return the new time to - * @return {string} err.message A detailed error message - * @return {number} newTime The exact time that was seeked to in seconds - */ - - var seekToProgramTime = function seekToProgramTime(_ref2) { - var programTime = _ref2.programTime, - playlist = _ref2.playlist, - _ref2$retryCount = _ref2.retryCount, - retryCount = _ref2$retryCount === void 0 ? 2 : _ref2$retryCount, - seekTo = _ref2.seekTo, - _ref2$pauseAfterSeek = _ref2.pauseAfterSeek, - pauseAfterSeek = _ref2$pauseAfterSeek === void 0 ? true : _ref2$pauseAfterSeek, - tech = _ref2.tech, - callback = _ref2.callback; - - if (!callback) { - throw new Error('seekToProgramTime: callback must be provided'); - } - - if (typeof programTime === 'undefined' || !playlist || !seekTo) { - return callback({ - message: 'seekToProgramTime: programTime, seekTo and playlist must be provided' - }); - } - - if (!playlist.endList && !tech.hasStarted_) { - return callback({ - message: 'player must be playing a live stream to start buffering' - }); - } - - if (!verifyProgramDateTimeTags(playlist)) { - return callback({ - message: 'programDateTime tags must be provided in the manifest ' + playlist.resolvedUri - }); - } - - var matchedSegment = findSegmentForProgramTime(programTime, playlist); // no match - - if (!matchedSegment) { - return callback({ - message: programTime + " was not found in the stream" - }); - } - - var segment = matchedSegment.segment; - var mediaOffset = getOffsetFromTimestamp(segment.dateTimeObject, programTime); - - if (matchedSegment.type === 'estimate') { - // we've run out of retries - if (retryCount === 0) { - return callback({ - message: programTime + " is not buffered yet. Try again" - }); - } - - seekTo(matchedSegment.estimatedStart + mediaOffset); - tech.one('seeked', function () { - seekToProgramTime({ - programTime: programTime, - playlist: playlist, - retryCount: retryCount - 1, - seekTo: seekTo, - pauseAfterSeek: pauseAfterSeek, - tech: tech, - callback: callback - }); - }); - return; - } // Since the segment.start value is determined from the buffered end or ending time - // of the prior segment, the seekToTime doesn't need to account for any transmuxer - // modifications. - - - var seekToTime = segment.start + mediaOffset; - - var seekedCallback = function seekedCallback() { - return callback(null, tech.currentTime()); - }; // listen for seeked event - - - tech.one('seeked', seekedCallback); // pause before seeking as video.js will restore this state - - if (pauseAfterSeek) { - tech.pause(); - } - - seekTo(seekToTime); - }; - - /*! @name mpd-parser @version 0.17.0 @license Apache-2.0 */ - - var isObject = function isObject(obj) { - return !!obj && typeof obj === 'object'; - }; - - var merge = function merge() { - for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) { - objects[_key] = arguments[_key]; - } - - return objects.reduce(function (result, source) { - if (typeof source !== 'object') { - return result; - } - - Object.keys(source).forEach(function (key) { - if (Array.isArray(result[key]) && Array.isArray(source[key])) { - result[key] = result[key].concat(source[key]); - } else if (isObject(result[key]) && isObject(source[key])) { - result[key] = merge(result[key], source[key]); - } else { - result[key] = source[key]; - } - }); - return result; - }, {}); - }; - - var values = function values(o) { - return Object.keys(o).map(function (k) { - return o[k]; - }); - }; - - var range = function range(start, end) { - var result = []; - - for (var i = start; i < end; i++) { - result.push(i); - } - - return result; - }; - - var flatten = function flatten(lists) { - return lists.reduce(function (x, y) { - return x.concat(y); - }, []); - }; - - var from = function from(list) { - if (!list.length) { - return []; - } - - var result = []; - - for (var i = 0; i < list.length; i++) { - result.push(list[i]); - } - - return result; - }; - - var findIndexes = function findIndexes(l, key) { - return l.reduce(function (a, e, i) { - if (e[key]) { - a.push(i); - } - - return a; - }, []); - }; - - var errors = { - INVALID_NUMBER_OF_PERIOD: 'INVALID_NUMBER_OF_PERIOD', - DASH_EMPTY_MANIFEST: 'DASH_EMPTY_MANIFEST', - DASH_INVALID_XML: 'DASH_INVALID_XML', - NO_BASE_URL: 'NO_BASE_URL', - MISSING_SEGMENT_INFORMATION: 'MISSING_SEGMENT_INFORMATION', - SEGMENT_TIME_UNSPECIFIED: 'SEGMENT_TIME_UNSPECIFIED', - UNSUPPORTED_UTC_TIMING_SCHEME: 'UNSUPPORTED_UTC_TIMING_SCHEME' - }; - /** - * @typedef {Object} SingleUri - * @property {string} uri - relative location of segment - * @property {string} resolvedUri - resolved location of segment - * @property {Object} byterange - Object containing information on how to make byte range - * requests following byte-range-spec per RFC2616. - * @property {String} byterange.length - length of range request - * @property {String} byterange.offset - byte offset of range request - * - * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 - */ - - /** - * Converts a URLType node (5.3.9.2.3 Table 13) to a segment object - * that conforms to how m3u8-parser is structured - * - * @see https://github.com/videojs/m3u8-parser - * - * @param {string} baseUrl - baseUrl provided by nodes - * @param {string} source - source url for segment - * @param {string} range - optional range used for range calls, - * follows RFC 2616, Clause 14.35.1 - * @return {SingleUri} full segment information transformed into a format similar - * to m3u8-parser - */ - - var urlTypeToSegment = function urlTypeToSegment(_ref) { - var _ref$baseUrl = _ref.baseUrl, - baseUrl = _ref$baseUrl === void 0 ? '' : _ref$baseUrl, - _ref$source = _ref.source, - source = _ref$source === void 0 ? '' : _ref$source, - _ref$range = _ref.range, - range = _ref$range === void 0 ? '' : _ref$range, - _ref$indexRange = _ref.indexRange, - indexRange = _ref$indexRange === void 0 ? '' : _ref$indexRange; - var segment = { - uri: source, - resolvedUri: resolveUrl$1(baseUrl || '', source) - }; - - if (range || indexRange) { - var rangeStr = range ? range : indexRange; - var ranges = rangeStr.split('-'); - var startRange = parseInt(ranges[0], 10); - var endRange = parseInt(ranges[1], 10); // byterange should be inclusive according to - // RFC 2616, Clause 14.35.1 - - segment.byterange = { - length: endRange - startRange + 1, - offset: startRange - }; - } - - return segment; - }; - - var byteRangeToString = function byteRangeToString(byterange) { - // `endRange` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - var endRange = byterange.offset + byterange.length - 1; - return byterange.offset + "-" + endRange; - }; - /** - * parse the end number attribue that can be a string - * number, or undefined. - * - * @param {string|number|undefined} endNumber - * The end number attribute. - * - * @return {number|null} - * The result of parsing the end number. - */ - - - var parseEndNumber = function parseEndNumber(endNumber) { - if (endNumber && typeof endNumber !== 'number') { - endNumber = parseInt(endNumber, 10); - } - - if (isNaN(endNumber)) { - return null; - } - - return endNumber; - }; - /** - * Functions for calculating the range of available segments in static and dynamic - * manifests. - */ - - - var segmentRange = { - /** - * Returns the entire range of available segments for a static MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - static: function _static(attributes) { - var duration = attributes.duration, - _attributes$timescale = attributes.timescale, - timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale, - sourceDuration = attributes.sourceDuration; - var endNumber = parseEndNumber(attributes.endNumber); - return { - start: 0, - end: typeof endNumber === 'number' ? endNumber : Math.ceil(sourceDuration / (duration / timescale)) - }; - }, - - /** - * Returns the current live window range of available segments for a dynamic MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - dynamic: function dynamic(attributes) { - var NOW = attributes.NOW, - clientOffset = attributes.clientOffset, - availabilityStartTime = attributes.availabilityStartTime, - _attributes$timescale2 = attributes.timescale, - timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, - duration = attributes.duration, - _attributes$start = attributes.start, - start = _attributes$start === void 0 ? 0 : _attributes$start, - _attributes$minimumUp = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp, - _attributes$timeShift = attributes.timeShiftBufferDepth, - timeShiftBufferDepth = _attributes$timeShift === void 0 ? Infinity : _attributes$timeShift; - var endNumber = parseEndNumber(attributes.endNumber); - var now = (NOW + clientOffset) / 1000; - var periodStartWC = availabilityStartTime + start; - var periodEndWC = now + minimumUpdatePeriod; - var periodDuration = periodEndWC - periodStartWC; - var segmentCount = Math.ceil(periodDuration * timescale / duration); - var availableStart = Math.floor((now - periodStartWC - timeShiftBufferDepth) * timescale / duration); - var availableEnd = Math.floor((now - periodStartWC) * timescale / duration); - return { - start: Math.max(0, availableStart), - end: typeof endNumber === 'number' ? endNumber : Math.min(segmentCount, availableEnd) - }; - } - }; - /** - * Maps a range of numbers to objects with information needed to build the corresponding - * segment list - * - * @name toSegmentsCallback - * @function - * @param {number} number - * Number of the segment - * @param {number} index - * Index of the number in the range list - * @return {{ number: Number, duration: Number, timeline: Number, time: Number }} - * Object with segment timing and duration info - */ - - /** - * Returns a callback for Array.prototype.map for mapping a range of numbers to - * information needed to build the segment list. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {toSegmentsCallback} - * Callback map function - */ - - var toSegments = function toSegments(attributes) { - return function (number, index) { - var duration = attributes.duration, - _attributes$timescale3 = attributes.timescale, - timescale = _attributes$timescale3 === void 0 ? 1 : _attributes$timescale3, - periodIndex = attributes.periodIndex, - _attributes$startNumb = attributes.startNumber, - startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb; - return { - number: startNumber + number, - duration: duration / timescale, - timeline: periodIndex, - time: index * duration - }; - }; - }; - /** - * Returns a list of objects containing segment timing and duration info used for - * building the list of segments. This uses the @duration attribute specified - * in the MPD manifest to derive the range of segments. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - - var parseByDuration = function parseByDuration(attributes) { - var _attributes$type = attributes.type, - type = _attributes$type === void 0 ? 'static' : _attributes$type, - duration = attributes.duration, - _attributes$timescale4 = attributes.timescale, - timescale = _attributes$timescale4 === void 0 ? 1 : _attributes$timescale4, - sourceDuration = attributes.sourceDuration; - - var _segmentRange$type = segmentRange[type](attributes), - start = _segmentRange$type.start, - end = _segmentRange$type.end; - - var segments = range(start, end).map(toSegments(attributes)); - - if (type === 'static') { - var index = segments.length - 1; // final segment may be less than full segment duration - - segments[index].duration = sourceDuration - duration / timescale * index; - } - - return segments; - }; - /** - * Translates SegmentBase into a set of segments. - * (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @return {Object.} list of segments - */ - - - var segmentsFromBase = function segmentsFromBase(attributes) { - var baseUrl = attributes.baseUrl, - _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ, - sourceDuration = attributes.sourceDuration, - _attributes$indexRang = attributes.indexRange, - indexRange = _attributes$indexRang === void 0 ? '' : _attributes$indexRang, - duration = attributes.duration; // base url is required for SegmentBase to work, per spec (Section 5.3.9.2.1) - - if (!baseUrl) { - throw new Error(errors.NO_BASE_URL); - } - - var initSegment = urlTypeToSegment({ - baseUrl: baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - var segment = urlTypeToSegment({ - baseUrl: baseUrl, - source: baseUrl, - indexRange: indexRange - }); - segment.map = initSegment; // If there is a duration, use it, otherwise use the given duration of the source - // (since SegmentBase is only for one total segment) - - if (duration) { - var segmentTimeInfo = parseByDuration(attributes); - - if (segmentTimeInfo.length) { - segment.duration = segmentTimeInfo[0].duration; - segment.timeline = segmentTimeInfo[0].timeline; - } - } else if (sourceDuration) { - segment.duration = sourceDuration; - segment.timeline = 0; - } // This is used for mediaSequence - - - segment.number = 0; - return [segment]; - }; - /** - * Given a playlist, a sidx box, and a baseUrl, update the segment list of the playlist - * according to the sidx information given. - * - * playlist.sidx has metadadata about the sidx where-as the sidx param - * is the parsed sidx box itself. - * - * @param {Object} playlist the playlist to update the sidx information for - * @param {Object} sidx the parsed sidx box - * @return {Object} the playlist object with the updated sidx information - */ - - - var addSidxSegmentsToPlaylist = function addSidxSegmentsToPlaylist(playlist, sidx, baseUrl) { - // Retain init segment information - var initSegment = playlist.sidx.map ? playlist.sidx.map : null; // Retain source duration from initial master manifest parsing - - var sourceDuration = playlist.sidx.duration; // Retain source timeline - - var timeline = playlist.timeline || 0; - var sidxByteRange = playlist.sidx.byterange; - var sidxEnd = sidxByteRange.offset + sidxByteRange.length; // Retain timescale of the parsed sidx - - var timescale = sidx.timescale; // referenceType 1 refers to other sidx boxes - - var mediaReferences = sidx.references.filter(function (r) { - return r.referenceType !== 1; - }); - var segments = []; // firstOffset is the offset from the end of the sidx box - - var startIndex = sidxEnd + sidx.firstOffset; - - for (var i = 0; i < mediaReferences.length; i++) { - var reference = sidx.references[i]; // size of the referenced (sub)segment - - var size = reference.referencedSize; // duration of the referenced (sub)segment, in the timescale - // this will be converted to seconds when generating segments - - var duration = reference.subsegmentDuration; // should be an inclusive range - - var endIndex = startIndex + size - 1; - var indexRange = startIndex + "-" + endIndex; - var attributes = { - baseUrl: baseUrl, - timescale: timescale, - timeline: timeline, - // this is used in parseByDuration - periodIndex: timeline, - duration: duration, - sourceDuration: sourceDuration, - indexRange: indexRange - }; - var segment = segmentsFromBase(attributes)[0]; - - if (initSegment) { - segment.map = initSegment; - } - - segments.push(segment); - startIndex += size; - } - - playlist.segments = segments; - return playlist; - }; - - var generateSidxKey = function generateSidxKey(sidx) { - return sidx && sidx.uri + '-' + byteRangeToString(sidx.byterange); - }; - - var mergeDiscontiguousPlaylists = function mergeDiscontiguousPlaylists(playlists) { - var mergedPlaylists = values(playlists.reduce(function (acc, playlist) { - // assuming playlist IDs are the same across periods - // TODO: handle multiperiod where representation sets are not the same - // across periods - var name = playlist.attributes.id + (playlist.attributes.lang || ''); // Periods after first - - if (acc[name]) { - var _acc$name$segments; // first segment of subsequent periods signal a discontinuity - - - if (playlist.segments[0]) { - playlist.segments[0].discontinuity = true; - } - - (_acc$name$segments = acc[name].segments).push.apply(_acc$name$segments, playlist.segments); // bubble up contentProtection, this assumes all DRM content - // has the same contentProtection - - - if (playlist.attributes.contentProtection) { - acc[name].attributes.contentProtection = playlist.attributes.contentProtection; - } - } else { - // first Period - acc[name] = playlist; - } - - return acc; - }, {})); - return mergedPlaylists.map(function (playlist) { - playlist.discontinuityStarts = findIndexes(playlist.segments, 'discontinuity'); - return playlist; - }); - }; - - var addSidxSegmentsToPlaylist$1 = function addSidxSegmentsToPlaylist$1(playlist, sidxMapping) { - var sidxKey = generateSidxKey(playlist.sidx); - var sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx; - - if (sidxMatch) { - addSidxSegmentsToPlaylist(playlist, sidxMatch, playlist.sidx.resolvedUri); - } - - return playlist; - }; - - var addSidxSegmentsToPlaylists = function addSidxSegmentsToPlaylists(playlists, sidxMapping) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (!Object.keys(sidxMapping).length) { - return playlists; - } - - for (var i in playlists) { - playlists[i] = addSidxSegmentsToPlaylist$1(playlists[i], sidxMapping); - } - - return playlists; - }; - - var formatAudioPlaylist = function formatAudioPlaylist(_ref, isAudioOnly) { - var _attributes; - - var attributes = _ref.attributes, - segments = _ref.segments, - sidx = _ref.sidx; - var playlist = { - attributes: (_attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth, - CODECS: attributes.codecs - }, _attributes['PROGRAM-ID'] = 1, _attributes), - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - if (isAudioOnly) { - playlist.attributes.AUDIO = 'audio'; - playlist.attributes.SUBTITLES = 'subs'; - } - - return playlist; - }; - - var formatVttPlaylist = function formatVttPlaylist(_ref2) { - var _m3u8Attributes; - - var attributes = _ref2.attributes, - segments = _ref2.segments; - - if (typeof segments === 'undefined') { - // vtt tracks may use single file in BaseURL - segments = [{ - uri: attributes.baseUrl, - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - duration: attributes.sourceDuration, - number: 0 - }]; // targetDuration should be the same duration as the only segment - - attributes.duration = attributes.sourceDuration; - } - - var m3u8Attributes = (_m3u8Attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth - }, _m3u8Attributes['PROGRAM-ID'] = 1, _m3u8Attributes); - - if (attributes.codecs) { - m3u8Attributes.CODECS = attributes.codecs; - } - - return { - attributes: m3u8Attributes, - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - }; - - var organizeAudioPlaylists = function organizeAudioPlaylists(playlists, sidxMapping, isAudioOnly) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (isAudioOnly === void 0) { - isAudioOnly = false; - } - - var mainPlaylist; - var formattedPlaylists = playlists.reduce(function (a, playlist) { - var role = playlist.attributes.role && playlist.attributes.role.value || ''; - var language = playlist.attributes.lang || ''; - var label = playlist.attributes.label || 'main'; - - if (language && !playlist.attributes.label) { - var roleLabel = role ? " (" + role + ")" : ''; - label = "" + playlist.attributes.lang + roleLabel; - } - - if (!a[label]) { - a[label] = { - language: language, - autoselect: true, - default: role === 'main', - playlists: [], - uri: '' - }; - } - - var formatted = addSidxSegmentsToPlaylist$1(formatAudioPlaylist(playlist, isAudioOnly), sidxMapping); - a[label].playlists.push(formatted); - - if (typeof mainPlaylist === 'undefined' && role === 'main') { - mainPlaylist = playlist; - mainPlaylist.default = true; - } - - return a; - }, {}); // if no playlists have role "main", mark the first as main - - if (!mainPlaylist) { - var firstLabel = Object.keys(formattedPlaylists)[0]; - formattedPlaylists[firstLabel].default = true; - } - - return formattedPlaylists; - }; - - var organizeVttPlaylists = function organizeVttPlaylists(playlists, sidxMapping) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - return playlists.reduce(function (a, playlist) { - var label = playlist.attributes.lang || 'text'; - - if (!a[label]) { - a[label] = { - language: label, - default: false, - autoselect: false, - playlists: [], - uri: '' - }; - } - - a[label].playlists.push(addSidxSegmentsToPlaylist$1(formatVttPlaylist(playlist), sidxMapping)); - return a; - }, {}); - }; - - var organizeCaptionServices = function organizeCaptionServices(captionServices) { - return captionServices.reduce(function (svcObj, svc) { - if (!svc) { - return svcObj; - } - - svc.forEach(function (service) { - var channel = service.channel, - language = service.language; - svcObj[language] = { - autoselect: false, - default: false, - instreamId: channel, - language: language - }; - - if (service.hasOwnProperty('aspectRatio')) { - svcObj[language].aspectRatio = service.aspectRatio; - } - - if (service.hasOwnProperty('easyReader')) { - svcObj[language].easyReader = service.easyReader; - } - - if (service.hasOwnProperty('3D')) { - svcObj[language]['3D'] = service['3D']; - } - }); - return svcObj; - }, {}); - }; - - var formatVideoPlaylist = function formatVideoPlaylist(_ref3) { - var _attributes2; - - var attributes = _ref3.attributes, - segments = _ref3.segments, - sidx = _ref3.sidx; - var playlist = { - attributes: (_attributes2 = { - NAME: attributes.id, - AUDIO: 'audio', - SUBTITLES: 'subs', - RESOLUTION: { - width: attributes.width, - height: attributes.height - }, - CODECS: attributes.codecs, - BANDWIDTH: attributes.bandwidth - }, _attributes2['PROGRAM-ID'] = 1, _attributes2), - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - return playlist; - }; - - var videoOnly = function videoOnly(_ref4) { - var attributes = _ref4.attributes; - return attributes.mimeType === 'video/mp4' || attributes.mimeType === 'video/webm' || attributes.contentType === 'video'; - }; - - var audioOnly = function audioOnly(_ref5) { - var attributes = _ref5.attributes; - return attributes.mimeType === 'audio/mp4' || attributes.mimeType === 'audio/webm' || attributes.contentType === 'audio'; - }; - - var vttOnly = function vttOnly(_ref6) { - var attributes = _ref6.attributes; - return attributes.mimeType === 'text/vtt' || attributes.contentType === 'text'; - }; - - var toM3u8 = function toM3u8(dashPlaylists, locations, sidxMapping) { - var _mediaGroups; - - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (!dashPlaylists.length) { - return {}; - } // grab all master attributes - - - var _dashPlaylists$0$attr = dashPlaylists[0].attributes, - duration = _dashPlaylists$0$attr.sourceDuration, - _dashPlaylists$0$attr2 = _dashPlaylists$0$attr.type, - type = _dashPlaylists$0$attr2 === void 0 ? 'static' : _dashPlaylists$0$attr2, - suggestedPresentationDelay = _dashPlaylists$0$attr.suggestedPresentationDelay, - minimumUpdatePeriod = _dashPlaylists$0$attr.minimumUpdatePeriod; - var videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist); - var audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly)); - var vttPlaylists = dashPlaylists.filter(vttOnly); - var captions = dashPlaylists.map(function (playlist) { - return playlist.attributes.captionServices; - }).filter(Boolean); - var master = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: (_mediaGroups = { - AUDIO: {}, - VIDEO: {} - }, _mediaGroups['CLOSED-CAPTIONS'] = {}, _mediaGroups.SUBTITLES = {}, _mediaGroups), - uri: '', - duration: duration, - playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping) - }; - - if (minimumUpdatePeriod >= 0) { - master.minimumUpdatePeriod = minimumUpdatePeriod * 1000; - } - - if (locations) { - master.locations = locations; - } - - if (type === 'dynamic') { - master.suggestedPresentationDelay = suggestedPresentationDelay; - } - - var isAudioOnly = master.playlists.length === 0; - - if (audioPlaylists.length) { - master.mediaGroups.AUDIO.audio = organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly); - } - - if (vttPlaylists.length) { - master.mediaGroups.SUBTITLES.subs = organizeVttPlaylists(vttPlaylists, sidxMapping); - } - - if (captions.length) { - master.mediaGroups['CLOSED-CAPTIONS'].cc = organizeCaptionServices(captions); - } - - return master; - }; - /** - * Calculates the R (repetition) value for a live stream (for the final segment - * in a manifest where the r value is negative 1) - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {number} time - * current time (typically the total time up until the final segment) - * @param {number} duration - * duration property for the given - * - * @return {number} - * R value to reach the end of the given period - */ - - - var getLiveRValue = function getLiveRValue(attributes, time, duration) { - var NOW = attributes.NOW, - clientOffset = attributes.clientOffset, - availabilityStartTime = attributes.availabilityStartTime, - _attributes$timescale = attributes.timescale, - timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale, - _attributes$start = attributes.start, - start = _attributes$start === void 0 ? 0 : _attributes$start, - _attributes$minimumUp = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp; - var now = (NOW + clientOffset) / 1000; - var periodStartWC = availabilityStartTime + start; - var periodEndWC = now + minimumUpdatePeriod; - var periodDuration = periodEndWC - periodStartWC; - return Math.ceil((periodDuration * timescale - time) / duration); - }; - /** - * Uses information provided by SegmentTemplate.SegmentTimeline to determine segment - * timing and duration - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]} segmentTimeline - * List of objects representing the attributes of each S element contained within - * - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - - var parseByTimeline = function parseByTimeline(attributes, segmentTimeline) { - var _attributes$type = attributes.type, - type = _attributes$type === void 0 ? 'static' : _attributes$type, - _attributes$minimumUp2 = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp2 === void 0 ? 0 : _attributes$minimumUp2, - _attributes$media = attributes.media, - media = _attributes$media === void 0 ? '' : _attributes$media, - sourceDuration = attributes.sourceDuration, - _attributes$timescale2 = attributes.timescale, - timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, - _attributes$startNumb = attributes.startNumber, - startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb, - timeline = attributes.periodIndex; - var segments = []; - var time = -1; - - for (var sIndex = 0; sIndex < segmentTimeline.length; sIndex++) { - var S = segmentTimeline[sIndex]; - var duration = S.d; - var repeat = S.r || 0; - var segmentTime = S.t || 0; - - if (time < 0) { - // first segment - time = segmentTime; - } - - if (segmentTime && segmentTime > time) { - // discontinuity - // TODO: How to handle this type of discontinuity - // timeline++ here would treat it like HLS discontuity and content would - // get appended without gap - // E.G. - // - // - // - // - // would have $Time$ values of [0, 1, 2, 5] - // should this be appened at time positions [0, 1, 2, 3],(#EXT-X-DISCONTINUITY) - // or [0, 1, 2, gap, gap, 5]? (#EXT-X-GAP) - // does the value of sourceDuration consider this when calculating arbitrary - // negative @r repeat value? - // E.G. Same elements as above with this added at the end - // - // with a sourceDuration of 10 - // Would the 2 gaps be included in the time duration calculations resulting in - // 8 segments with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9] or 10 segments - // with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9, 10, 11] ? - time = segmentTime; - } - - var count = void 0; - - if (repeat < 0) { - var nextS = sIndex + 1; - - if (nextS === segmentTimeline.length) { - // last segment - if (type === 'dynamic' && minimumUpdatePeriod > 0 && media.indexOf('$Number$') > 0) { - count = getLiveRValue(attributes, time, duration); - } else { - // TODO: This may be incorrect depending on conclusion of TODO above - count = (sourceDuration * timescale - time) / duration; - } - } else { - count = (segmentTimeline[nextS].t - time) / duration; - } - } else { - count = repeat + 1; - } - - var end = startNumber + segments.length + count; - var number = startNumber + segments.length; - - while (number < end) { - segments.push({ - number: number, - duration: duration / timescale, - time: time, - timeline: timeline - }); - time += duration; - number++; - } - } - - return segments; - }; - - var identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g; - /** - * Replaces template identifiers with corresponding values. To be used as the callback - * for String.prototype.replace - * - * @name replaceCallback - * @function - * @param {string} match - * Entire match of identifier - * @param {string} identifier - * Name of matched identifier - * @param {string} format - * Format tag string. Its presence indicates that padding is expected - * @param {string} width - * Desired length of the replaced value. Values less than this width shall be left - * zero padded - * @return {string} - * Replacement for the matched identifier - */ - - /** - * Returns a function to be used as a callback for String.prototype.replace to replace - * template identifiers - * - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {replaceCallback} - * Callback to be used with String.prototype.replace to replace identifiers - */ - - var identifierReplacement = function identifierReplacement(values) { - return function (match, identifier, format, width) { - if (match === '$$') { - // escape sequence - return '$'; - } - - if (typeof values[identifier] === 'undefined') { - return match; - } - - var value = '' + values[identifier]; - - if (identifier === 'RepresentationID') { - // Format tag shall not be present with RepresentationID - return value; - } - - if (!format) { - width = 1; - } else { - width = parseInt(width, 10); - } - - if (value.length >= width) { - return value; - } - - return "" + new Array(width - value.length + 1).join('0') + value; - }; - }; - /** - * Constructs a segment url from a template string - * - * @param {string} url - * Template string to construct url from - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {string} - * Segment url with identifiers replaced - */ - - - var constructTemplateUrl = function constructTemplateUrl(url, values) { - return url.replace(identifierPattern, identifierReplacement(values)); - }; - /** - * Generates a list of objects containing timing and duration information about each - * segment needed to generate segment uris and the complete segment object - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - - var parseTemplateInfo = function parseTemplateInfo(attributes, segmentTimeline) { - if (!attributes.duration && !segmentTimeline) { - // if neither @duration or SegmentTimeline are present, then there shall be exactly - // one media segment - return [{ - number: attributes.startNumber || 1, - duration: attributes.sourceDuration, - time: 0, - timeline: attributes.periodIndex - }]; - } - - if (attributes.duration) { - return parseByDuration(attributes); - } - - return parseByTimeline(attributes, segmentTimeline); - }; - /** - * Generates a list of segments using information provided by the SegmentTemplate element - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object[]} - * List of segment objects - */ - - - var segmentsFromTemplate = function segmentsFromTemplate(attributes, segmentTimeline) { - var templateValues = { - RepresentationID: attributes.id, - Bandwidth: attributes.bandwidth || 0 - }; - var _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? { - sourceURL: '', - range: '' - } : _attributes$initializ; - var mapSegment = urlTypeToSegment({ - baseUrl: attributes.baseUrl, - source: constructTemplateUrl(initialization.sourceURL, templateValues), - range: initialization.range - }); - var segments = parseTemplateInfo(attributes, segmentTimeline); - return segments.map(function (segment) { - templateValues.Number = segment.number; - templateValues.Time = segment.time; - var uri = constructTemplateUrl(attributes.media || '', templateValues); - var map = { - uri: uri, - timeline: segment.timeline, - duration: segment.duration, - resolvedUri: resolveUrl$1(attributes.baseUrl || '', uri), - map: mapSegment, - number: segment.number - }; - - if (attributes.presentationTimeOffset) { - map.presentationTimeOffset = attributes.presentationTimeOffset; - } - - return map; - }); - }; - /** - * Converts a (of type URLType from the DASH spec 5.3.9.2 Table 14) - * to an object that matches the output of a segment in videojs/mpd-parser - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object} segmentUrl - * node to translate into a segment object - * @return {Object} translated segment object - */ - - - var SegmentURLToSegmentObject = function SegmentURLToSegmentObject(attributes, segmentUrl) { - var baseUrl = attributes.baseUrl, - _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ; - var initSegment = urlTypeToSegment({ - baseUrl: baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - var segment = urlTypeToSegment({ - baseUrl: baseUrl, - source: segmentUrl.media, - range: segmentUrl.mediaRange - }); - segment.map = initSegment; - return segment; - }; - /** - * Generates a list of segments using information provided by the SegmentList element - * SegmentList (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object.} list of segments - */ - - - var segmentsFromList = function segmentsFromList(attributes, segmentTimeline) { - var duration = attributes.duration, - _attributes$segmentUr = attributes.segmentUrls, - segmentUrls = _attributes$segmentUr === void 0 ? [] : _attributes$segmentUr; // Per spec (5.3.9.2.1) no way to determine segment duration OR - // if both SegmentTimeline and @duration are defined, it is outside of spec. - - if (!duration && !segmentTimeline || duration && segmentTimeline) { - throw new Error(errors.SEGMENT_TIME_UNSPECIFIED); - } - - var segmentUrlMap = segmentUrls.map(function (segmentUrlObject) { - return SegmentURLToSegmentObject(attributes, segmentUrlObject); - }); - var segmentTimeInfo; - - if (duration) { - segmentTimeInfo = parseByDuration(attributes); - } - - if (segmentTimeline) { - segmentTimeInfo = parseByTimeline(attributes, segmentTimeline); - } - - var segments = segmentTimeInfo.map(function (segmentTime, index) { - if (segmentUrlMap[index]) { - var segment = segmentUrlMap[index]; - segment.timeline = segmentTime.timeline; - segment.duration = segmentTime.duration; - segment.number = segmentTime.number; - return segment; - } // Since we're mapping we should get rid of any blank segments (in case - // the given SegmentTimeline is handling for more elements than we have - // SegmentURLs for). - - }).filter(function (segment) { - return segment; - }); - return segments; - }; - - var generateSegments = function generateSegments(_ref) { - var attributes = _ref.attributes, - segmentInfo = _ref.segmentInfo; - var segmentAttributes; - var segmentsFn; - - if (segmentInfo.template) { - segmentsFn = segmentsFromTemplate; - segmentAttributes = merge(attributes, segmentInfo.template); - - if (segmentInfo.template.presentationTimeOffset) { - segmentAttributes.presentationTimeOffset = segmentInfo.template.presentationTimeOffset / segmentInfo.template.timescale; - } - } else if (segmentInfo.base) { - segmentsFn = segmentsFromBase; - segmentAttributes = merge(attributes, segmentInfo.base); - } else if (segmentInfo.list) { - segmentsFn = segmentsFromList; - segmentAttributes = merge(attributes, segmentInfo.list); - } - - var segmentsInfo = { - attributes: attributes - }; - - if (!segmentsFn) { - return segmentsInfo; - } - - var segments = segmentsFn(segmentAttributes, segmentInfo.timeline); // The @duration attribute will be used to determin the playlist's targetDuration which - // must be in seconds. Since we've generated the segment list, we no longer need - // @duration to be in @timescale units, so we can convert it here. - - if (segmentAttributes.duration) { - var _segmentAttributes = segmentAttributes, - duration = _segmentAttributes.duration, - _segmentAttributes$ti = _segmentAttributes.timescale, - timescale = _segmentAttributes$ti === void 0 ? 1 : _segmentAttributes$ti; - segmentAttributes.duration = duration / timescale; - } else if (segments.length) { - // if there is no @duration attribute, use the largest segment duration as - // as target duration - segmentAttributes.duration = segments.reduce(function (max, segment) { - return Math.max(max, Math.ceil(segment.duration)); - }, 0); - } else { - segmentAttributes.duration = 0; - } - - segmentsInfo.attributes = segmentAttributes; - segmentsInfo.segments = segments; // This is a sidx box without actual segment information - - if (segmentInfo.base && segmentAttributes.indexRange) { - segmentsInfo.sidx = segments[0]; - segmentsInfo.segments = []; - } - - return segmentsInfo; - }; - - var toPlaylists = function toPlaylists(representations) { - return representations.map(generateSegments); - }; - - var findChildren = function findChildren(element, name) { - return from(element.childNodes).filter(function (_ref) { - var tagName = _ref.tagName; - return tagName === name; - }); - }; - - var getContent = function getContent(element) { - return element.textContent.trim(); - }; - - var parseDuration = function parseDuration(str) { - var SECONDS_IN_YEAR = 365 * 24 * 60 * 60; - var SECONDS_IN_MONTH = 30 * 24 * 60 * 60; - var SECONDS_IN_DAY = 24 * 60 * 60; - var SECONDS_IN_HOUR = 60 * 60; - var SECONDS_IN_MIN = 60; // P10Y10M10DT10H10M10.1S - - var durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/; - var match = durationRegex.exec(str); - - if (!match) { - return 0; - } - - var _match$slice = match.slice(1), - year = _match$slice[0], - month = _match$slice[1], - day = _match$slice[2], - hour = _match$slice[3], - minute = _match$slice[4], - second = _match$slice[5]; - - return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0); - }; - - var parseDate = function parseDate(str) { - // Date format without timezone according to ISO 8601 - // YYY-MM-DDThh:mm:ss.ssssss - var dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/; // If the date string does not specifiy a timezone, we must specifiy UTC. This is - // expressed by ending with 'Z' - - if (dateRegex.test(str)) { - str += 'Z'; - } - - return Date.parse(str); - }; - - var parsers = { - /** - * Specifies the duration of the entire Media Presentation. Format is a duration string - * as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - mediaPresentationDuration: function mediaPresentationDuration(value) { - return parseDuration(value); - }, - - /** - * Specifies the Segment availability start time for all Segments referred to in this - * MPD. For a dynamic manifest, it specifies the anchor for the earliest availability - * time. Format is a date string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The date as seconds from unix epoch - */ - availabilityStartTime: function availabilityStartTime(value) { - return parseDate(value) / 1000; - }, - - /** - * Specifies the smallest period between potential changes to the MPD. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - minimumUpdatePeriod: function minimumUpdatePeriod(value) { - return parseDuration(value); - }, - - /** - * Specifies the suggested presentation delay. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - suggestedPresentationDelay: function suggestedPresentationDelay(value) { - return parseDuration(value); - }, - - /** - * specifices the type of mpd. Can be either "static" or "dynamic" - * - * @param {string} value - * value of attribute as a string - * - * @return {string} - * The type as a string - */ - type: function type(value) { - return value; - }, - - /** - * Specifies the duration of the smallest time shifting buffer for any Representation - * in the MPD. Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - timeShiftBufferDepth: function timeShiftBufferDepth(value) { - return parseDuration(value); - }, - - /** - * Specifies the PeriodStart time of the Period relative to the availabilityStarttime. - * Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - start: function start(value) { - return parseDuration(value); - }, - - /** - * Specifies the width of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed width - */ - width: function width(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the height of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed height - */ - height: function height(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the bitrate of the representation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed bandwidth - */ - bandwidth: function bandwidth(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the number of the first Media Segment in this Representation in the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - startNumber: function startNumber(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the timescale in units per seconds - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed timescale - */ - timescale: function timescale(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the presentationTimeOffset. - * - * @param {string} value - * value of the attribute as a string - * - * @return {number} - * The parsed presentationTimeOffset - */ - presentationTimeOffset: function presentationTimeOffset(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the constant approximate Segment duration - * NOTE: The element also contains an @duration attribute. This duration - * specifies the duration of the Period. This attribute is currently not - * supported by the rest of the parser, however we still check for it to prevent - * errors. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - duration: function duration(value) { - var parsedValue = parseInt(value, 10); - - if (isNaN(parsedValue)) { - return parseDuration(value); - } - - return parsedValue; - }, - - /** - * Specifies the Segment duration, in units of the value of the @timescale. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - d: function d(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the MPD start time, in @timescale units, the first Segment in the series - * starts relative to the beginning of the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed time - */ - t: function t(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the repeat count of the number of following contiguous Segments with the - * same duration expressed by the value of @d - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - r: function r(value) { - return parseInt(value, 10); - }, - - /** - * Default parser for all other attributes. Acts as a no-op and just returns the value - * as a string - * - * @param {string} value - * value of attribute as a string - * @return {string} - * Unparsed value - */ - DEFAULT: function DEFAULT(value) { - return value; - } - }; - /** - * Gets all the attributes and values of the provided node, parses attributes with known - * types, and returns an object with attribute names mapped to values. - * - * @param {Node} el - * The node to parse attributes from - * @return {Object} - * Object with all attributes of el parsed - */ - - var parseAttributes = function parseAttributes(el) { - if (!(el && el.attributes)) { - return {}; - } - - return from(el.attributes).reduce(function (a, e) { - var parseFn = parsers[e.name] || parsers.DEFAULT; - a[e.name] = parseFn(e.value); - return a; - }, {}); - }; - - var keySystemsMap = { - 'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b': 'org.w3.clearkey', - 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed': 'com.widevine.alpha', - 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95': 'com.microsoft.playready', - 'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime' - }; - /** - * Builds a list of urls that is the product of the reference urls and BaseURL values - * - * @param {string[]} referenceUrls - * List of reference urls to resolve to - * @param {Node[]} baseUrlElements - * List of BaseURL nodes from the mpd - * @return {string[]} - * List of resolved urls - */ - - var buildBaseUrls = function buildBaseUrls(referenceUrls, baseUrlElements) { - if (!baseUrlElements.length) { - return referenceUrls; - } - - return flatten(referenceUrls.map(function (reference) { - return baseUrlElements.map(function (baseUrlElement) { - return resolveUrl$1(reference, getContent(baseUrlElement)); - }); - })); - }; - /** - * Contains all Segment information for its containing AdaptationSet - * - * @typedef {Object} SegmentInformation - * @property {Object|undefined} template - * Contains the attributes for the SegmentTemplate node - * @property {Object[]|undefined} timeline - * Contains a list of atrributes for each S node within the SegmentTimeline node - * @property {Object|undefined} list - * Contains the attributes for the SegmentList node - * @property {Object|undefined} base - * Contains the attributes for the SegmentBase node - */ - - /** - * Returns all available Segment information contained within the AdaptationSet node - * - * @param {Node} adaptationSet - * The AdaptationSet node to get Segment information from - * @return {SegmentInformation} - * The Segment information contained within the provided AdaptationSet - */ - - - var getSegmentInformation = function getSegmentInformation(adaptationSet) { - var segmentTemplate = findChildren(adaptationSet, 'SegmentTemplate')[0]; - var segmentList = findChildren(adaptationSet, 'SegmentList')[0]; - var segmentUrls = segmentList && findChildren(segmentList, 'SegmentURL').map(function (s) { - return merge({ - tag: 'SegmentURL' - }, parseAttributes(s)); - }); - var segmentBase = findChildren(adaptationSet, 'SegmentBase')[0]; - var segmentTimelineParentNode = segmentList || segmentTemplate; - var segmentTimeline = segmentTimelineParentNode && findChildren(segmentTimelineParentNode, 'SegmentTimeline')[0]; - var segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate; - var segmentInitialization = segmentInitializationParentNode && findChildren(segmentInitializationParentNode, 'Initialization')[0]; // SegmentTemplate is handled slightly differently, since it can have both - // @initialization and an node. @initialization can be templated, - // while the node can have a url and range specified. If the has - // both @initialization and an subelement we opt to override with - // the node, as this interaction is not defined in the spec. - - var template = segmentTemplate && parseAttributes(segmentTemplate); - - if (template && segmentInitialization) { - template.initialization = segmentInitialization && parseAttributes(segmentInitialization); - } else if (template && template.initialization) { - // If it is @initialization we convert it to an object since this is the format that - // later functions will rely on for the initialization segment. This is only valid - // for - template.initialization = { - sourceURL: template.initialization - }; - } - - var segmentInfo = { - template: template, - timeline: segmentTimeline && findChildren(segmentTimeline, 'S').map(function (s) { - return parseAttributes(s); - }), - list: segmentList && merge(parseAttributes(segmentList), { - segmentUrls: segmentUrls, - initialization: parseAttributes(segmentInitialization) - }), - base: segmentBase && merge(parseAttributes(segmentBase), { - initialization: parseAttributes(segmentInitialization) - }) - }; - Object.keys(segmentInfo).forEach(function (key) { - if (!segmentInfo[key]) { - delete segmentInfo[key]; - } - }); - return segmentInfo; - }; - /** - * Contains Segment information and attributes needed to construct a Playlist object - * from a Representation - * - * @typedef {Object} RepresentationInformation - * @property {SegmentInformation} segmentInfo - * Segment information for this Representation - * @property {Object} attributes - * Inherited attributes for this Representation - */ - - /** - * Maps a Representation node to an object containing Segment information and attributes - * - * @name inheritBaseUrlsCallback - * @function - * @param {Node} representation - * Representation node from the mpd - * @return {RepresentationInformation} - * Representation information needed to construct a Playlist object - */ - - /** - * Returns a callback for Array.prototype.map for mapping Representation nodes to - * Segment information and attributes using inherited BaseURL nodes. - * - * @param {Object} adaptationSetAttributes - * Contains attributes inherited by the AdaptationSet - * @param {string[]} adaptationSetBaseUrls - * Contains list of resolved base urls inherited by the AdaptationSet - * @param {SegmentInformation} adaptationSetSegmentInfo - * Contains Segment information for the AdaptationSet - * @return {inheritBaseUrlsCallback} - * Callback map function - */ - - - var inheritBaseUrls = function inheritBaseUrls(adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) { - return function (representation) { - var repBaseUrlElements = findChildren(representation, 'BaseURL'); - var repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements); - var attributes = merge(adaptationSetAttributes, parseAttributes(representation)); - var representationSegmentInfo = getSegmentInformation(representation); - return repBaseUrls.map(function (baseUrl) { - return { - segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo), - attributes: merge(attributes, { - baseUrl: baseUrl - }) - }; - }); - }; - }; - /** - * Tranforms a series of content protection nodes to - * an object containing pssh data by key system - * - * @param {Node[]} contentProtectionNodes - * Content protection nodes - * @return {Object} - * Object containing pssh data by key system - */ - - - var generateKeySystemInformation = function generateKeySystemInformation(contentProtectionNodes) { - return contentProtectionNodes.reduce(function (acc, node) { - var attributes = parseAttributes(node); - var keySystem = keySystemsMap[attributes.schemeIdUri]; - - if (keySystem) { - acc[keySystem] = { - attributes: attributes - }; - var psshNode = findChildren(node, 'cenc:pssh')[0]; - - if (psshNode) { - var pssh = getContent(psshNode); - var psshBuffer = pssh && decodeB64ToUint8Array(pssh); - acc[keySystem].pssh = psshBuffer; - } - } - - return acc; - }, {}); - }; // defined in ANSI_SCTE 214-1 2016 - - - var parseCaptionServiceMetadata = function parseCaptionServiceMetadata(service) { - // 608 captions - if (service.schemeIdUri === 'urn:scte:dash:cc:cea-608:2015') { - var values = service.value.split(';'); - return values.map(function (value) { - var channel; - var language; // default language to value - - language = value; - - if (/^CC\d=/.test(value)) { - var _value$split = value.split('='); - - channel = _value$split[0]; - language = _value$split[1]; - } else if (/^CC\d$/.test(value)) { - channel = value; - } - - return { - channel: channel, - language: language - }; - }); - } else if (service.schemeIdUri === 'urn:scte:dash:cc:cea-708:2015') { - var _values = service.value.split(';'); - - return _values.map(function (value) { - var flags = { - // service or channel number 1-63 - 'channel': undefined, - // language is a 3ALPHA per ISO 639.2/B - // field is required - 'language': undefined, - // BIT 1/0 or ? - // default value is 1, meaning 16:9 aspect ratio, 0 is 4:3, ? is unknown - 'aspectRatio': 1, - // BIT 1/0 - // easy reader flag indicated the text is tailed to the needs of beginning readers - // default 0, or off - 'easyReader': 0, - // BIT 1/0 - // If 3d metadata is present (CEA-708.1) then 1 - // default 0 - '3D': 0 - }; - - if (/=/.test(value)) { - var _value$split2 = value.split('='), - channel = _value$split2[0], - _value$split2$ = _value$split2[1], - opts = _value$split2$ === void 0 ? '' : _value$split2$; - - flags.channel = channel; - flags.language = value; - opts.split(',').forEach(function (opt) { - var _opt$split = opt.split(':'), - name = _opt$split[0], - val = _opt$split[1]; - - if (name === 'lang') { - flags.language = val; // er for easyReadery - } else if (name === 'er') { - flags.easyReader = Number(val); // war for wide aspect ratio - } else if (name === 'war') { - flags.aspectRatio = Number(val); - } else if (name === '3D') { - flags['3D'] = Number(val); - } - }); - } else { - flags.language = value; - } - - if (flags.channel) { - flags.channel = 'SERVICE' + flags.channel; - } - - return flags; - }); - } - }; - /** - * Maps an AdaptationSet node to a list of Representation information objects - * - * @name toRepresentationsCallback - * @function - * @param {Node} adaptationSet - * AdaptationSet node from the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - - /** - * Returns a callback for Array.prototype.map for mapping AdaptationSet nodes to a list of - * Representation information objects - * - * @param {Object} periodAttributes - * Contains attributes inherited by the Period - * @param {string[]} periodBaseUrls - * Contains list of resolved base urls inherited by the Period - * @param {string[]} periodSegmentInfo - * Contains Segment Information at the period level - * @return {toRepresentationsCallback} - * Callback map function - */ - - - var toRepresentations = function toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo) { - return function (adaptationSet) { - var adaptationSetAttributes = parseAttributes(adaptationSet); - var adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls, findChildren(adaptationSet, 'BaseURL')); - var role = findChildren(adaptationSet, 'Role')[0]; - var roleAttributes = { - role: parseAttributes(role) - }; - var attrs = merge(periodAttributes, adaptationSetAttributes, roleAttributes); - var accessibility = findChildren(adaptationSet, 'Accessibility')[0]; - var captionServices = parseCaptionServiceMetadata(parseAttributes(accessibility)); - - if (captionServices) { - attrs = merge(attrs, { - captionServices: captionServices - }); - } - - var label = findChildren(adaptationSet, 'Label')[0]; - - if (label && label.childNodes.length) { - var labelVal = label.childNodes[0].nodeValue.trim(); - attrs = merge(attrs, { - label: labelVal - }); - } - - var contentProtection = generateKeySystemInformation(findChildren(adaptationSet, 'ContentProtection')); - - if (Object.keys(contentProtection).length) { - attrs = merge(attrs, { - contentProtection: contentProtection - }); - } - - var segmentInfo = getSegmentInformation(adaptationSet); - var representations = findChildren(adaptationSet, 'Representation'); - var adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo); - return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo))); - }; - }; - /** - * Maps an Period node to a list of Representation inforamtion objects for all - * AdaptationSet nodes contained within the Period - * - * @name toAdaptationSetsCallback - * @function - * @param {Node} period - * Period node from the mpd - * @param {number} periodIndex - * Index of the Period within the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - - /** - * Returns a callback for Array.prototype.map for mapping Period nodes to a list of - * Representation information objects - * - * @param {Object} mpdAttributes - * Contains attributes inherited by the mpd - * @param {string[]} mpdBaseUrls - * Contains list of resolved base urls inherited by the mpd - * @return {toAdaptationSetsCallback} - * Callback map function - */ - - - var toAdaptationSets = function toAdaptationSets(mpdAttributes, mpdBaseUrls) { - return function (period, index) { - var periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period, 'BaseURL')); - var periodAtt = parseAttributes(period); - var parsedPeriodId = parseInt(periodAtt.id, 10); // fallback to mapping index if Period@id is not a number - - var periodIndex = window__default['default'].isNaN(parsedPeriodId) ? index : parsedPeriodId; - var periodAttributes = merge(mpdAttributes, { - periodIndex: periodIndex - }); - var adaptationSets = findChildren(period, 'AdaptationSet'); - var periodSegmentInfo = getSegmentInformation(period); - return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo))); - }; - }; - /** - * Traverses the mpd xml tree to generate a list of Representation information objects - * that have inherited attributes from parent nodes - * - * @param {Node} mpd - * The root node of the mpd - * @param {Object} options - * Available options for inheritAttributes - * @param {string} options.manifestUri - * The uri source of the mpd - * @param {number} options.NOW - * Current time per DASH IOP. Default is current time in ms since epoch - * @param {number} options.clientOffset - * Client time difference from NOW (in milliseconds) - * @return {RepresentationInformation[]} - * List of objects containing Representation information - */ - - - var inheritAttributes = function inheritAttributes(mpd, options) { - if (options === void 0) { - options = {}; - } - - var _options = options, - _options$manifestUri = _options.manifestUri, - manifestUri = _options$manifestUri === void 0 ? '' : _options$manifestUri, - _options$NOW = _options.NOW, - NOW = _options$NOW === void 0 ? Date.now() : _options$NOW, - _options$clientOffset = _options.clientOffset, - clientOffset = _options$clientOffset === void 0 ? 0 : _options$clientOffset; - var periods = findChildren(mpd, 'Period'); - - if (!periods.length) { - throw new Error(errors.INVALID_NUMBER_OF_PERIOD); - } - - var locations = findChildren(mpd, 'Location'); - var mpdAttributes = parseAttributes(mpd); - var mpdBaseUrls = buildBaseUrls([manifestUri], findChildren(mpd, 'BaseURL')); - mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0; - mpdAttributes.NOW = NOW; - mpdAttributes.clientOffset = clientOffset; - - if (locations.length) { - mpdAttributes.locations = locations.map(getContent); - } - - return { - locations: mpdAttributes.locations, - representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls))) - }; - }; - - var stringToMpdXml = function stringToMpdXml(manifestString) { - if (manifestString === '') { - throw new Error(errors.DASH_EMPTY_MANIFEST); - } - - var parser = new xmldom.DOMParser(); - var xml; - var mpd; - - try { - xml = parser.parseFromString(manifestString, 'application/xml'); - mpd = xml && xml.documentElement.tagName === 'MPD' ? xml.documentElement : null; - } catch (e) {// ie 11 throwsw on invalid xml - } - - if (!mpd || mpd && mpd.getElementsByTagName('parsererror').length > 0) { - throw new Error(errors.DASH_INVALID_XML); - } - - return mpd; - }; - /** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} mpd - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ - - - var parseUTCTimingScheme = function parseUTCTimingScheme(mpd) { - var UTCTimingNode = findChildren(mpd, 'UTCTiming')[0]; - - if (!UTCTimingNode) { - return null; - } - - var attributes = parseAttributes(UTCTimingNode); - - switch (attributes.schemeIdUri) { - case 'urn:mpeg:dash:utc:http-head:2014': - case 'urn:mpeg:dash:utc:http-head:2012': - attributes.method = 'HEAD'; - break; - - case 'urn:mpeg:dash:utc:http-xsdate:2014': - case 'urn:mpeg:dash:utc:http-iso:2014': - case 'urn:mpeg:dash:utc:http-xsdate:2012': - case 'urn:mpeg:dash:utc:http-iso:2012': - attributes.method = 'GET'; - break; - - case 'urn:mpeg:dash:utc:direct:2014': - case 'urn:mpeg:dash:utc:direct:2012': - attributes.method = 'DIRECT'; - attributes.value = Date.parse(attributes.value); - break; - - case 'urn:mpeg:dash:utc:http-ntp:2014': - case 'urn:mpeg:dash:utc:ntp:2014': - case 'urn:mpeg:dash:utc:sntp:2014': - default: - throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME); - } - - return attributes; - }; - - var parse = function parse(manifestString, options) { - if (options === void 0) { - options = {}; - } - - var parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options); - var playlists = toPlaylists(parsedManifestInfo.representationInfo); - return toM3u8(playlists, parsedManifestInfo.locations, options.sidxMapping); - }; - /** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} manifestString - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ - - - var parseUTCTiming = function parseUTCTiming(manifestString) { - return parseUTCTimingScheme(stringToMpdXml(manifestString)); - }; - - var MAX_UINT32 = Math.pow(2, 32); - - var parseSidx = function parseSidx(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - references: [], - referenceId: view.getUint32(4), - timescale: view.getUint32(8) - }, - i = 12; - - if (result.version === 0) { - result.earliestPresentationTime = view.getUint32(i); - result.firstOffset = view.getUint32(i + 4); - i += 8; - } else { - // read 64 bits - result.earliestPresentationTime = view.getUint32(i) * MAX_UINT32 + view.getUint32(i + 4); - result.firstOffset = view.getUint32(i + 8) * MAX_UINT32 + view.getUint32(i + 12); - i += 16; - } - - i += 2; // reserved - - var referenceCount = view.getUint16(i); - i += 2; // start of references - - for (; referenceCount > 0; i += 12, referenceCount--) { - result.references.push({ - referenceType: (data[i] & 0x80) >>> 7, - referencedSize: view.getUint32(i) & 0x7FFFFFFF, - subsegmentDuration: view.getUint32(i + 4), - startsWithSap: !!(data[i + 8] & 0x80), - sapType: (data[i + 8] & 0x70) >>> 4, - sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF - }); - } - - return result; - }; - - var parseSidx_1 = parseSidx; - - // we used to do this with log2 but BigInt does not support builtin math - // Math.ceil(log2(x)); - - - var countBits = function countBits(x) { - return x.toString(2).length; - }; // count the number of whole bytes it would take to represent a number - - var countBytes = function countBytes(x) { - return Math.ceil(countBits(x) / 8); - }; - var isTypedArray = function isTypedArray(obj) { - return ArrayBuffer.isView(obj); - }; - var toUint8 = function toUint8(bytes) { - if (bytes instanceof Uint8Array) { - return bytes; - } - - if (!Array.isArray(bytes) && !isTypedArray(bytes) && !(bytes instanceof ArrayBuffer)) { - // any non-number or NaN leads to empty uint8array - // eslint-disable-next-line - if (typeof bytes !== 'number' || typeof bytes === 'number' && bytes !== bytes) { - bytes = 0; - } else { - bytes = [bytes]; - } - } - - return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0); - }; - var BigInt = window__default['default'].BigInt || Number; - var BYTE_TABLE = [BigInt('0x1'), BigInt('0x100'), BigInt('0x10000'), BigInt('0x1000000'), BigInt('0x100000000'), BigInt('0x10000000000'), BigInt('0x1000000000000'), BigInt('0x100000000000000'), BigInt('0x10000000000000000')]; - var bytesToNumber = function bytesToNumber(bytes, _temp) { - var _ref = _temp === void 0 ? {} : _temp, - _ref$signed = _ref.signed, - signed = _ref$signed === void 0 ? false : _ref$signed, - _ref$le = _ref.le, - le = _ref$le === void 0 ? false : _ref$le; - - bytes = toUint8(bytes); - var fn = le ? 'reduce' : 'reduceRight'; - var obj = bytes[fn] ? bytes[fn] : Array.prototype[fn]; - var number = obj.call(bytes, function (total, byte, i) { - var exponent = le ? i : Math.abs(i + 1 - bytes.length); - return total + BigInt(byte) * BYTE_TABLE[exponent]; - }, BigInt(0)); - - if (signed) { - var max = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1); - number = BigInt(number); - - if (number > max) { - number -= max; - number -= max; - number -= BigInt(2); - } - } - - return Number(number); - }; - var numberToBytes = function numberToBytes(number, _temp2) { - var _ref2 = _temp2 === void 0 ? {} : _temp2, - _ref2$le = _ref2.le, - le = _ref2$le === void 0 ? false : _ref2$le; // eslint-disable-next-line - - - if (typeof number !== 'bigint' && typeof number !== 'number' || typeof number === 'number' && number !== number) { - number = 0; - } - - number = BigInt(number); - var byteCount = countBytes(number); - var bytes = new Uint8Array(new ArrayBuffer(byteCount)); - - for (var i = 0; i < byteCount; i++) { - var byteIndex = le ? i : Math.abs(i + 1 - bytes.length); - bytes[byteIndex] = Number(number / BYTE_TABLE[i] & BigInt(0xFF)); - - if (number < 0) { - bytes[byteIndex] = Math.abs(~bytes[byteIndex]); - bytes[byteIndex] -= i === 0 ? 1 : 2; - } - } - - return bytes; - }; - var stringToBytes = function stringToBytes(string, stringIsBytes) { - if (typeof string !== 'string' && string && typeof string.toString === 'function') { - string = string.toString(); - } - - if (typeof string !== 'string') { - return new Uint8Array(); - } // If the string already is bytes, we don't have to do this - // otherwise we do this so that we split multi length characters - // into individual bytes - - - if (!stringIsBytes) { - string = unescape(encodeURIComponent(string)); - } - - var view = new Uint8Array(string.length); - - for (var i = 0; i < string.length; i++) { - view[i] = string.charCodeAt(i); - } - - return view; - }; - var concatTypedArrays = function concatTypedArrays() { - for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) { - buffers[_key] = arguments[_key]; - } - - buffers = buffers.filter(function (b) { - return b && (b.byteLength || b.length) && typeof b !== 'string'; - }); - - if (buffers.length <= 1) { - // for 0 length we will return empty uint8 - // for 1 length we return the first uint8 - return toUint8(buffers[0]); - } - - var totalLen = buffers.reduce(function (total, buf, i) { - return total + (buf.byteLength || buf.length); - }, 0); - var tempBuffer = new Uint8Array(totalLen); - var offset = 0; - buffers.forEach(function (buf) { - buf = toUint8(buf); - tempBuffer.set(buf, offset); - offset += buf.byteLength; - }); - return tempBuffer; - }; - /** - * Check if the bytes "b" are contained within bytes "a". - * - * @param {Uint8Array|Array} a - * Bytes to check in - * - * @param {Uint8Array|Array} b - * Bytes to check for - * - * @param {Object} options - * options - * - * @param {Array|Uint8Array} [offset=0] - * offset to use when looking at bytes in a - * - * @param {Array|Uint8Array} [mask=[]] - * mask to use on bytes before comparison. - * - * @return {boolean} - * If all bytes in b are inside of a, taking into account - * bit masks. - */ - - var bytesMatch = function bytesMatch(a, b, _temp3) { - var _ref3 = _temp3 === void 0 ? {} : _temp3, - _ref3$offset = _ref3.offset, - offset = _ref3$offset === void 0 ? 0 : _ref3$offset, - _ref3$mask = _ref3.mask, - mask = _ref3$mask === void 0 ? [] : _ref3$mask; - - a = toUint8(a); - b = toUint8(b); // ie 11 does not support uint8 every - - var fn = b.every ? b.every : Array.prototype.every; - return b.length && a.length - offset >= b.length && // ie 11 doesn't support every on uin8 - fn.call(b, function (bByte, i) { - var aByte = mask[i] ? mask[i] & a[offset + i] : a[offset + i]; - return bByte === aByte; - }); - }; - - var ID3 = toUint8([0x49, 0x44, 0x33]); - var getId3Size = function getId3Size(bytes, offset) { - if (offset === void 0) { - offset = 0; - } - - bytes = toUint8(bytes); - var flags = bytes[offset + 5]; - var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9]; - var footerPresent = (flags & 16) >> 4; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - var getId3Offset = function getId3Offset(bytes, offset) { - if (offset === void 0) { - offset = 0; - } - - bytes = toUint8(bytes); - - if (bytes.length - offset < 10 || !bytesMatch(bytes, ID3, { - offset: offset - })) { - return offset; - } - - offset += getId3Size(bytes, offset); // recursive check for id3 tags as some files - // have multiple ID3 tag sections even though - // they should not. - - return getId3Offset(bytes, offset); - }; - - var normalizePath$1 = function normalizePath(path) { - if (typeof path === 'string') { - return stringToBytes(path); - } - - if (typeof path === 'number') { - return path; - } - - return path; - }; - - var normalizePaths$1 = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath$1(paths)]; - } - - return paths.map(function (p) { - return normalizePath$1(p); - }); - }; - /** - * find any number of boxes by name given a path to it in an iso bmff - * such as mp4. - * - * @param {TypedArray} bytes - * bytes for the iso bmff to search for boxes in - * - * @param {Uint8Array[]|string[]|string|Uint8Array} name - * An array of paths or a single path representing the name - * of boxes to search through in bytes. Paths may be - * uint8 (character codes) or strings. - * - * @param {boolean} [complete=false] - * Should we search only for complete boxes on the final path. - * This is very useful when you do not want to get back partial boxes - * in the case of streaming files. - * - * @return {Uint8Array[]} - * An array of the end paths that we found. - */ - - var findBox = function findBox(bytes, paths, complete) { - if (complete === void 0) { - complete = false; - } - - paths = normalizePaths$1(paths); - bytes = toUint8(bytes); - var results = []; - - if (!paths.length) { - // short-circuit the search for empty paths - return results; - } - - var i = 0; - - while (i < bytes.length) { - var size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0; - var type = bytes.subarray(i + 4, i + 8); // invalid box format. - - if (size === 0) { - break; - } - - var end = i + size; - - if (end > bytes.length) { - // this box is bigger than the number of bytes we have - // and complete is set, we cannot find any more boxes. - if (complete) { - break; - } - - end = bytes.length; - } - - var data = bytes.subarray(i + 8, end); - - if (bytesMatch(type, paths[0])) { - if (paths.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data); - } else { - // recursively search for the next box along the path - results.push.apply(results, findBox(data, paths.slice(1), complete)); - } - } - - i = end; - } // we've finished searching all of bytes - - - return results; - }; - - // https://matroska-org.github.io/libebml/specs.html - // https://www.matroska.org/technical/elements.html - // https://www.webmproject.org/docs/container/ - - var EBML_TAGS = { - EBML: toUint8([0x1A, 0x45, 0xDF, 0xA3]), - DocType: toUint8([0x42, 0x82]), - Segment: toUint8([0x18, 0x53, 0x80, 0x67]), - SegmentInfo: toUint8([0x15, 0x49, 0xA9, 0x66]), - Tracks: toUint8([0x16, 0x54, 0xAE, 0x6B]), - Track: toUint8([0xAE]), - TrackNumber: toUint8([0xd7]), - DefaultDuration: toUint8([0x23, 0xe3, 0x83]), - TrackEntry: toUint8([0xAE]), - TrackType: toUint8([0x83]), - FlagDefault: toUint8([0x88]), - CodecID: toUint8([0x86]), - CodecPrivate: toUint8([0x63, 0xA2]), - VideoTrack: toUint8([0xe0]), - AudioTrack: toUint8([0xe1]), - // Not used yet, but will be used for live webm/mkv - // see https://www.matroska.org/technical/basics.html#block-structure - // see https://www.matroska.org/technical/basics.html#simpleblock-structure - Cluster: toUint8([0x1F, 0x43, 0xB6, 0x75]), - Timestamp: toUint8([0xE7]), - TimestampScale: toUint8([0x2A, 0xD7, 0xB1]), - BlockGroup: toUint8([0xA0]), - BlockDuration: toUint8([0x9B]), - Block: toUint8([0xA1]), - SimpleBlock: toUint8([0xA3]) - }; - /** - * This is a simple table to determine the length - * of things in ebml. The length is one based (starts at 1, - * rather than zero) and for every zero bit before a one bit - * we add one to length. We also need this table because in some - * case we have to xor all the length bits from another value. - */ - - var LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1]; - - var getLength = function getLength(byte) { - var len = 1; - - for (var i = 0; i < LENGTH_TABLE.length; i++) { - if (byte & LENGTH_TABLE[i]) { - break; - } - - len++; - } - - return len; - }; // length in ebml is stored in the first 4 to 8 bits - // of the first byte. 4 for the id length and 8 for the - // data size length. Length is measured by converting the number to binary - // then 1 + the number of zeros before a 1 is encountered starting - // from the left. - - - var getvint = function getvint(bytes, offset, removeLength, signed) { - if (removeLength === void 0) { - removeLength = true; - } - - if (signed === void 0) { - signed = false; - } - - var length = getLength(bytes[offset]); - var valueBytes = bytes.subarray(offset, offset + length); // NOTE that we do **not** subarray here because we need to copy these bytes - // as they will be modified below to remove the dataSizeLen bits and we do not - // want to modify the original data. normally we could just call slice on - // uint8array but ie 11 does not support that... - - if (removeLength) { - valueBytes = Array.prototype.slice.call(bytes, offset, offset + length); - valueBytes[0] ^= LENGTH_TABLE[length - 1]; - } - - return { - length: length, - value: bytesToNumber(valueBytes, { - signed: signed - }), - bytes: valueBytes - }; - }; - - var normalizePath = function normalizePath(path) { - if (typeof path === 'string') { - return path.match(/.{1,2}/g).map(function (p) { - return normalizePath(p); - }); - } - - if (typeof path === 'number') { - return numberToBytes(path); - } - - return path; - }; - - var normalizePaths = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map(function (p) { - return normalizePath(p); - }); - }; - - var getInfinityDataSize = function getInfinityDataSize(id, bytes, offset) { - if (offset >= bytes.length) { - return bytes.length; - } - - var innerid = getvint(bytes, offset, false); - - if (bytesMatch(id.bytes, innerid.bytes)) { - return offset; - } - - var dataHeader = getvint(bytes, offset + innerid.length); - return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length); - }; - /** - * Notes on the EBLM format. - * - * EBLM uses "vints" tags. Every vint tag contains - * two parts - * - * 1. The length from the first byte. You get this by - * converting the byte to binary and counting the zeros - * before a 1. Then you add 1 to that. Examples - * 00011111 = length 4 because there are 3 zeros before a 1. - * 00100000 = length 3 because there are 2 zeros before a 1. - * 00000011 = length 7 because there are 6 zeros before a 1. - * - * 2. The bits used for length are removed from the first byte - * Then all the bytes are merged into a value. NOTE: this - * is not the case for id ebml tags as there id includes - * length bits. - * - */ - - - var findEbml = function findEbml(bytes, paths) { - paths = normalizePaths(paths); - bytes = toUint8(bytes); - var results = []; - - if (!paths.length) { - return results; - } - - var i = 0; - - while (i < bytes.length) { - var id = getvint(bytes, i, false); - var dataHeader = getvint(bytes, i + id.length); - var dataStart = i + id.length + dataHeader.length; // dataSize is unknown or this is a live stream - - if (dataHeader.value === 0x7f) { - dataHeader.value = getInfinityDataSize(id, bytes, dataStart); - - if (dataHeader.value !== bytes.length) { - dataHeader.value -= dataStart; - } - } - - var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value; - var data = bytes.subarray(dataStart, dataEnd); - - if (bytesMatch(paths[0], id.bytes)) { - if (paths.length === 1) { - // this is the end of the paths and we've found the tag we were - // looking for - results.push(data); - } else { - // recursively search for the next tag inside of the data - // of this one - results = results.concat(findEbml(data, paths.slice(1))); - } - } - - var totalLength = id.length + dataHeader.length + data.length; // move past this tag entirely, we are not looking for it - - i += totalLength; - } - - return results; - }; // see https://www.matroska.org/technical/basics.html#block-structure - - var NAL_TYPE_ONE = toUint8([0x00, 0x00, 0x00, 0x01]); - var NAL_TYPE_TWO = toUint8([0x00, 0x00, 0x01]); - var EMULATION_PREVENTION = toUint8([0x00, 0x00, 0x03]); - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(bytes) { - var positions = []; - var i = 1; // Find all `Emulation Prevention Bytes` - - while (i < bytes.length - 2) { - if (bytesMatch(bytes.subarray(i, i + 3), EMULATION_PREVENTION)) { - positions.push(i + 2); - i++; - } - - i++; - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (positions.length === 0) { - return bytes; - } // Create a new array to hold the NAL unit data - - - var newLength = bytes.length - positions.length; - var newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === positions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - positions.shift(); - } - - newData[i] = bytes[sourceIndex]; - } - - return newData; - }; - var findNal = function findNal(bytes, dataType, types, nalLimit) { - if (nalLimit === void 0) { - nalLimit = Infinity; - } - - bytes = toUint8(bytes); - types = [].concat(types); - var i = 0; - var nalStart; - var nalsFound = 0; // keep searching until: - // we reach the end of bytes - // we reach the maximum number of nals they want to seach - // NOTE: that we disregard nalLimit when we have found the start - // of the nal we want so that we can find the end of the nal we want. - - while (i < bytes.length && (nalsFound < nalLimit || nalStart)) { - var nalOffset = void 0; - - if (bytesMatch(bytes.subarray(i), NAL_TYPE_ONE)) { - nalOffset = 4; - } else if (bytesMatch(bytes.subarray(i), NAL_TYPE_TWO)) { - nalOffset = 3; - } // we are unsynced, - // find the next nal unit - - - if (!nalOffset) { - i++; - continue; - } - - nalsFound++; - - if (nalStart) { - return discardEmulationPreventionBytes(bytes.subarray(nalStart, i)); - } - - var nalType = void 0; - - if (dataType === 'h264') { - nalType = bytes[i + nalOffset] & 0x1f; - } else if (dataType === 'h265') { - nalType = bytes[i + nalOffset] >> 1 & 0x3f; - } - - if (types.indexOf(nalType) !== -1) { - nalStart = i + nalOffset; - } // nal header is 1 length for h264, and 2 for h265 - - - i += nalOffset + (dataType === 'h264' ? 1 : 2); - } - - return bytes.subarray(0, 0); - }; - var findH264Nal = function findH264Nal(bytes, type, nalLimit) { - return findNal(bytes, 'h264', type, nalLimit); - }; - var findH265Nal = function findH265Nal(bytes, type, nalLimit) { - return findNal(bytes, 'h265', type, nalLimit); - }; - - var CONSTANTS = { - // "webm" string literal in hex - 'webm': toUint8([0x77, 0x65, 0x62, 0x6d]), - // "matroska" string literal in hex - 'matroska': toUint8([0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61]), - // "fLaC" string literal in hex - 'flac': toUint8([0x66, 0x4c, 0x61, 0x43]), - // "OggS" string literal in hex - 'ogg': toUint8([0x4f, 0x67, 0x67, 0x53]), - // ac-3 sync byte, also works for ec-3 as that is simply a codec - // of ac-3 - 'ac3': toUint8([0x0b, 0x77]), - // "RIFF" string literal in hex used for wav and avi - 'riff': toUint8([0x52, 0x49, 0x46, 0x46]), - // "AVI" string literal in hex - 'avi': toUint8([0x41, 0x56, 0x49]), - // "WAVE" string literal in hex - 'wav': toUint8([0x57, 0x41, 0x56, 0x45]), - // "ftyp3g" string literal in hex - '3gp': toUint8([0x66, 0x74, 0x79, 0x70, 0x33, 0x67]), - // "ftyp" string literal in hex - 'mp4': toUint8([0x66, 0x74, 0x79, 0x70]), - // "styp" string literal in hex - 'fmp4': toUint8([0x73, 0x74, 0x79, 0x70]), - // "ftyp" string literal in hex - 'mov': toUint8([0x66, 0x74, 0x79, 0x70, 0x71, 0x74]) - }; - var _isLikely = { - aac: function aac(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, [0xFF, 0x10], { - offset: offset, - mask: [0xFF, 0x16] - }); - }, - mp3: function mp3(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, [0xFF, 0x02], { - offset: offset, - mask: [0xFF, 0x06] - }); - }, - webm: function webm(bytes) { - var docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is webm - - return bytesMatch(docType, CONSTANTS.webm); - }, - mkv: function mkv(bytes) { - var docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is matroska - - return bytesMatch(docType, CONSTANTS.matroska); - }, - mp4: function mp4(bytes) { - return !_isLikely['3gp'](bytes) && !_isLikely.mov(bytes) && (bytesMatch(bytes, CONSTANTS.mp4, { - offset: 4 - }) || bytesMatch(bytes, CONSTANTS.fmp4, { - offset: 4 - })); - }, - mov: function mov(bytes) { - return bytesMatch(bytes, CONSTANTS.mov, { - offset: 4 - }); - }, - '3gp': function gp(bytes) { - return bytesMatch(bytes, CONSTANTS['3gp'], { - offset: 4 - }); - }, - ac3: function ac3(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, CONSTANTS.ac3, { - offset: offset - }); - }, - ts: function ts(bytes) { - if (bytes.length < 189 && bytes.length >= 1) { - return bytes[0] === 0x47; - } - - var i = 0; // check the first 376 bytes for two matching sync bytes - - while (i + 188 < bytes.length && i < 188) { - if (bytes[i] === 0x47 && bytes[i + 188] === 0x47) { - return true; - } - - i += 1; - } - - return false; - }, - flac: function flac(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, CONSTANTS.flac, { - offset: offset - }); - }, - ogg: function ogg(bytes) { - return bytesMatch(bytes, CONSTANTS.ogg); - }, - avi: function avi(bytes) { - return bytesMatch(bytes, CONSTANTS.riff) && bytesMatch(bytes, CONSTANTS.avi, { - offset: 8 - }); - }, - wav: function wav(bytes) { - return bytesMatch(bytes, CONSTANTS.riff) && bytesMatch(bytes, CONSTANTS.wav, { - offset: 8 - }); - }, - 'h264': function h264(bytes) { - // find seq_parameter_set_rbsp - return findH264Nal(bytes, 7, 3).length; - }, - 'h265': function h265(bytes) { - // find video_parameter_set_rbsp or seq_parameter_set_rbsp - return findH265Nal(bytes, [32, 33], 3).length; - } - }; // get all the isLikely functions - // but make sure 'ts' is above h264 and h265 - // but below everything else as it is the least specific - - var isLikelyTypes = Object.keys(_isLikely) // remove ts, h264, h265 - .filter(function (t) { - return t !== 'ts' && t !== 'h264' && t !== 'h265'; - }) // add it back to the bottom - .concat(['ts', 'h264', 'h265']); // make sure we are dealing with uint8 data. - - isLikelyTypes.forEach(function (type) { - var isLikelyFn = _isLikely[type]; - - _isLikely[type] = function (bytes) { - return isLikelyFn(toUint8(bytes)); - }; - }); // export after wrapping - - var isLikely = _isLikely; // A useful list of file signatures can be found here - // https://en.wikipedia.org/wiki/List_of_file_signatures - - var detectContainerForBytes = function detectContainerForBytes(bytes) { - bytes = toUint8(bytes); - - for (var i = 0; i < isLikelyTypes.length; i++) { - var type = isLikelyTypes[i]; - - if (isLikely[type](bytes)) { - return type; - } - } - - return ''; - }; // fmp4 is not a container - - var isLikelyFmp4MediaSegment = function isLikelyFmp4MediaSegment(bytes) { - return findBox(bytes, ['moof']).length > 0; - }; - - // which will only happen if the request is complete. - - var callbackOnCompleted = function callbackOnCompleted(request, cb) { - if (request.readyState === 4) { - return cb(); - } - - return; - }; - - var containerRequest = function containerRequest(uri, xhr, cb) { - var bytes = []; - var id3Offset; - var finished = false; - - var endRequestAndCallback = function endRequestAndCallback(err, req, type, _bytes) { - req.abort(); - finished = true; - return cb(err, req, type, _bytes); - }; - - var progressListener = function progressListener(error, request) { - if (finished) { - return; - } - - if (error) { - return endRequestAndCallback(error, request, '', bytes); - } // grap the new part of content that was just downloaded - - - var newPart = request.responseText.substring(bytes && bytes.byteLength || 0, request.responseText.length); // add that onto bytes - - bytes = concatTypedArrays(bytes, stringToBytes(newPart, true)); - id3Offset = id3Offset || getId3Offset(bytes); // we need at least 10 bytes to determine a type - // or we need at least two bytes after an id3Offset - - if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } - - var type = detectContainerForBytes(bytes); // if this looks like a ts segment but we don't have enough data - // to see the second sync byte, wait until we have enough data - // before declaring it ts - - if (type === 'ts' && bytes.length < 188) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } // this may be an unsynced ts segment - // wait for 376 bytes before detecting no container - - - if (!type && bytes.length < 376) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } - - return endRequestAndCallback(null, request, type, bytes); - }; - - var options = { - uri: uri, - beforeSend: function beforeSend(request) { - // this forces the browser to pass the bytes to us unprocessed - request.overrideMimeType('text/plain; charset=x-user-defined'); - request.addEventListener('progress', function (_ref) { - _ref.total; - _ref.loaded; - return callbackWrapper(request, null, { - statusCode: request.status - }, progressListener); - }); - } - }; - var request = xhr(options, function (error, response) { - return callbackWrapper(request, error, response, progressListener); - }); - return request; - }; - - var EventTarget = videojs__default['default'].EventTarget, - mergeOptions = videojs__default['default'].mergeOptions; - - var dashPlaylistUnchanged = function dashPlaylistUnchanged(a, b) { - if (!isPlaylistUnchanged(a, b)) { - return false; - } // for dash the above check will often return true in scenarios where - // the playlist actually has changed because mediaSequence isn't a - // dash thing, and we often set it to 1. So if the playlists have the same amount - // of segments we return true. - // So for dash we need to make sure that the underlying segments are different. - // if sidx changed then the playlists are different. - - - if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) { - return false; - } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) { - return false; - } // one or the other does not have segments - // there was a change. - - - if (a.segments && !b.segments || !a.segments && b.segments) { - return false; - } // neither has segments nothing changed - - - if (!a.segments && !b.segments) { - return true; - } // check segments themselves - - - for (var i = 0; i < a.segments.length; i++) { - var aSegment = a.segments[i]; - var bSegment = b.segments[i]; // if uris are different between segments there was a change - - if (aSegment.uri !== bSegment.uri) { - return false; - } // neither segment has a byterange, there will be no byterange change. - - - if (!aSegment.byterange && !bSegment.byterange) { - continue; - } - - var aByterange = aSegment.byterange; - var bByterange = bSegment.byterange; // if byterange only exists on one of the segments, there was a change. - - if (aByterange && !bByterange || !aByterange && bByterange) { - return false; - } // if both segments have byterange with different offsets, there was a change. - - - if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) { - return false; - } - } // if everything was the same with segments, this is the same playlist. - - - return true; - }; - /** - * Parses the master XML string and updates playlist URI references. - * - * @param {Object} config - * Object of arguments - * @param {string} config.masterXml - * The mpd XML - * @param {string} config.srcUrl - * The mpd URL - * @param {Date} config.clientOffset - * A time difference between server and client - * @param {Object} config.sidxMapping - * SIDX mappings for moof/mdat URIs and byte ranges - * @return {Object} - * The parsed mpd manifest object - */ - - - var parseMasterXml = function parseMasterXml(_ref) { - var masterXml = _ref.masterXml, - srcUrl = _ref.srcUrl, - clientOffset = _ref.clientOffset, - sidxMapping = _ref.sidxMapping; - var master = parse(masterXml, { - manifestUri: srcUrl, - clientOffset: clientOffset, - sidxMapping: sidxMapping - }); - addPropertiesToMaster(master, srcUrl); - return master; - }; - /** - * Returns a new master manifest that is the result of merging an updated master manifest - * into the original version. - * - * @param {Object} oldMaster - * The old parsed mpd object - * @param {Object} newMaster - * The updated parsed mpd object - * @return {Object} - * A new object representing the original master manifest with the updated media - * playlists merged in - */ - - var updateMaster = function updateMaster(oldMaster, newMaster, sidxMapping) { - var noChanges = true; - var update = mergeOptions(oldMaster, { - // These are top level properties that can be updated - duration: newMaster.duration, - minimumUpdatePeriod: newMaster.minimumUpdatePeriod - }); // First update the playlists in playlist list - - for (var i = 0; i < newMaster.playlists.length; i++) { - var playlist = newMaster.playlists[i]; - - if (playlist.sidx) { - var sidxKey = generateSidxKey(playlist.sidx); // add sidx segments to the playlist if we have all the sidx info already - - if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) { - addSidxSegmentsToPlaylist(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri); - } - } - - var playlistUpdate = updateMaster$1(update, playlist, dashPlaylistUnchanged); - - if (playlistUpdate) { - update = playlistUpdate; - noChanges = false; - } - } // Then update media group playlists - - - forEachMediaGroup(newMaster, function (properties, type, group, label) { - if (properties.playlists && properties.playlists.length) { - var id = properties.playlists[0].id; - - var _playlistUpdate = updateMaster$1(update, properties.playlists[0], dashPlaylistUnchanged); - - if (_playlistUpdate) { - update = _playlistUpdate; // update the playlist reference within media groups - - update.mediaGroups[type][group][label].playlists[0] = update.playlists[id]; - noChanges = false; - } - } - }); - - if (newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) { - noChanges = false; - } - - if (noChanges) { - return null; - } - - return update; - }; // SIDX should be equivalent if the URI and byteranges of the SIDX match. - // If the SIDXs have maps, the two maps should match, - // both `a` and `b` missing SIDXs is considered matching. - // If `a` or `b` but not both have a map, they aren't matching. - - var equivalentSidx = function equivalentSidx(a, b) { - var neitherMap = Boolean(!a.map && !b.map); - var equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length); - return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length; - }; // exported for testing - - - var compareSidxEntry = function compareSidxEntry(playlists, oldSidxMapping) { - var newSidxMapping = {}; - - for (var id in playlists) { - var playlist = playlists[id]; - var currentSidxInfo = playlist.sidx; - - if (currentSidxInfo) { - var key = generateSidxKey(currentSidxInfo); - - if (!oldSidxMapping[key]) { - break; - } - - var savedSidxInfo = oldSidxMapping[key].sidxInfo; - - if (equivalentSidx(savedSidxInfo, currentSidxInfo)) { - newSidxMapping[key] = oldSidxMapping[key]; - } - } - } - - return newSidxMapping; - }; - /** - * A function that filters out changed items as they need to be requested separately. - * - * The method is exported for testing - * - * @param {Object} master the parsed mpd XML returned via mpd-parser - * @param {Object} oldSidxMapping the SIDX to compare against - */ - - var filterChangedSidxMappings = function filterChangedSidxMappings(master, oldSidxMapping) { - var videoSidx = compareSidxEntry(master.playlists, oldSidxMapping); - var mediaGroupSidx = videoSidx; - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - if (properties.playlists && properties.playlists.length) { - var playlists = properties.playlists; - mediaGroupSidx = mergeOptions(mediaGroupSidx, compareSidxEntry(playlists, oldSidxMapping)); - } - }); - return mediaGroupSidx; - }; - - var DashPlaylistLoader = /*#__PURE__*/function (_EventTarget) { - inheritsLoose(DashPlaylistLoader, _EventTarget); - - // DashPlaylistLoader must accept either a src url or a playlist because subsequent - // playlist loader setups from media groups will expect to be able to pass a playlist - // (since there aren't external URLs to media playlists with DASH) - function DashPlaylistLoader(srcUrlOrPlaylist, vhs, options, masterPlaylistLoader) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _EventTarget.call(this) || this; - _this.masterPlaylistLoader_ = masterPlaylistLoader || assertThisInitialized(_this); - - if (!masterPlaylistLoader) { - _this.isMaster_ = true; - } - - var _options = options, - _options$withCredenti = _options.withCredentials, - withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, - _options$handleManife = _options.handleManifestRedirects, - handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife; - _this.vhs_ = vhs; - _this.withCredentials = withCredentials; - _this.handleManifestRedirects = handleManifestRedirects; - - if (!srcUrlOrPlaylist) { - throw new Error('A non-empty playlist URL or object is required'); - } // event naming? - - - _this.on('minimumUpdatePeriod', function () { - _this.refreshXml_(); - }); // live playlist staleness timeout - - - _this.on('mediaupdatetimeout', function () { - _this.refreshMedia_(_this.media().id); - }); - - _this.state = 'HAVE_NOTHING'; - _this.loadedPlaylists_ = {}; - _this.logger_ = logger('DashPlaylistLoader'); // initialize the loader state - // The masterPlaylistLoader will be created with a string - - if (_this.isMaster_) { - _this.masterPlaylistLoader_.srcUrl = srcUrlOrPlaylist; // TODO: reset sidxMapping between period changes - // once multi-period is refactored - - _this.masterPlaylistLoader_.sidxMapping_ = {}; - } else { - _this.childPlaylist_ = srcUrlOrPlaylist; - } - - return _this; - } - - var _proto = DashPlaylistLoader.prototype; - - _proto.requestErrored_ = function requestErrored_(err, request, startingState) { - // disposed - if (!this.request) { - return true; - } // pending request is cleared - - - this.request = null; - - if (err) { - // use the provided error object or create one - // based on the request/response - this.error = typeof err === 'object' && !(err instanceof Error) ? err : { - status: request.status, - message: 'DASH request error at URL: ' + request.uri, - response: request.response, - // MEDIA_ERR_NETWORK - code: 2 - }; - - if (startingState) { - this.state = startingState; - } - - this.trigger('error'); - return true; - } - } - /** - * Verify that the container of the sidx segment can be parsed - * and if it can, get and parse that segment. - */ - ; - - _proto.addSidxSegments_ = function addSidxSegments_(playlist, startingState, cb) { - var _this2 = this; - - var sidxKey = playlist.sidx && generateSidxKey(playlist.sidx); // playlist lacks sidx or sidx segments were added to this playlist already. - - if (!playlist.sidx || !sidxKey || this.masterPlaylistLoader_.sidxMapping_[sidxKey]) { - // keep this function async - this.mediaRequest_ = window__default['default'].setTimeout(function () { - return cb(false); - }, 0); - return; - } // resolve the segment URL relative to the playlist - - - var uri = resolveManifestRedirect(this.handleManifestRedirects, playlist.sidx.resolvedUri); - - var fin = function fin(err, request) { - if (_this2.requestErrored_(err, request, startingState)) { - return; - } - - var sidxMapping = _this2.masterPlaylistLoader_.sidxMapping_; - var sidx; - - try { - sidx = parseSidx_1(toUint8(request.response).subarray(8)); - } catch (e) { - // sidx parsing failed. - _this2.requestErrored_(e, request, startingState); - - return; - } - - sidxMapping[sidxKey] = { - sidxInfo: playlist.sidx, - sidx: sidx - }; - addSidxSegmentsToPlaylist(playlist, sidx, playlist.sidx.resolvedUri); - return cb(true); - }; - - this.request = containerRequest(uri, this.vhs_.xhr, function (err, request, container, bytes) { - if (err) { - return fin(err, request); - } - - if (!container || container !== 'mp4') { - return fin({ - status: request.status, - message: "Unsupported " + (container || 'unknown') + " container type for sidx segment at URL: " + uri, - // response is just bytes in this case - // but we really don't want to return that. - response: '', - playlist: playlist, - internal: true, - blacklistDuration: Infinity, - // MEDIA_ERR_NETWORK - code: 2 - }, request); - } // if we already downloaded the sidx bytes in the container request, use them - - - var _playlist$sidx$bytera = playlist.sidx.byterange, - offset = _playlist$sidx$bytera.offset, - length = _playlist$sidx$bytera.length; - - if (bytes.length >= length + offset) { - return fin(err, { - response: bytes.subarray(offset, offset + length), - status: request.status, - uri: request.uri - }); - } // otherwise request sidx bytes - - - _this2.request = _this2.vhs_.xhr({ - uri: uri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders({ - byterange: playlist.sidx.byterange - }) - }, fin); - }); - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.stopRequest(); - this.loadedPlaylists_ = {}; - window__default['default'].clearTimeout(this.minimumUpdatePeriodTimeout_); - window__default['default'].clearTimeout(this.mediaRequest_); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - this.mediaRequest_ = null; - this.minimumUpdatePeriodTimeout_ = null; - - if (this.masterPlaylistLoader_.createMupOnMedia_) { - this.off('loadedmetadata', this.masterPlaylistLoader_.createMupOnMedia_); - this.masterPlaylistLoader_.createMupOnMedia_ = null; - } - - this.off(); - }; - - _proto.hasPendingRequest = function hasPendingRequest() { - return this.request || this.mediaRequest_; - }; - - _proto.stopRequest = function stopRequest() { - if (this.request) { - var oldRequest = this.request; - this.request = null; - oldRequest.onreadystatechange = null; - oldRequest.abort(); - } - }; - - _proto.media = function media(playlist) { - var _this3 = this; - - // getter - if (!playlist) { - return this.media_; - } // setter - - - if (this.state === 'HAVE_NOTHING') { - throw new Error('Cannot switch media playlist from ' + this.state); - } - - var startingState = this.state; // find the playlist object if the target playlist has been specified by URI - - if (typeof playlist === 'string') { - if (!this.masterPlaylistLoader_.master.playlists[playlist]) { - throw new Error('Unknown playlist URI: ' + playlist); - } - - playlist = this.masterPlaylistLoader_.master.playlists[playlist]; - } - - var mediaChange = !this.media_ || playlist.id !== this.media_.id; // switch to previously loaded playlists immediately - - if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) { - this.state = 'HAVE_METADATA'; - this.media_ = playlist; // trigger media change if the active media has been updated - - if (mediaChange) { - this.trigger('mediachanging'); - this.trigger('mediachange'); - } - - return; - } // switching to the active playlist is a no-op - - - if (!mediaChange) { - return; - } // switching from an already loaded playlist - - - if (this.media_) { - this.trigger('mediachanging'); - } - - this.addSidxSegments_(playlist, startingState, function (sidxChanged) { - // everything is ready just continue to haveMetadata - _this3.haveMetadata({ - startingState: startingState, - playlist: playlist - }); - }); - }; - - _proto.haveMetadata = function haveMetadata(_ref2) { - var startingState = _ref2.startingState, - playlist = _ref2.playlist; - this.state = 'HAVE_METADATA'; - this.loadedPlaylists_[playlist.id] = playlist; - this.mediaRequest_ = null; // This will trigger loadedplaylist - - this.refreshMedia_(playlist.id); // fire loadedmetadata the first time a media playlist is loaded - // to resolve setup of media groups - - if (startingState === 'HAVE_MASTER') { - this.trigger('loadedmetadata'); - } else { - // trigger media change if the active media has been updated - this.trigger('mediachange'); - } - }; - - _proto.pause = function pause() { - if (this.masterPlaylistLoader_.createMupOnMedia_) { - this.off('loadedmetadata', this.masterPlaylistLoader_.createMupOnMedia_); - this.masterPlaylistLoader_.createMupOnMedia_ = null; - } - - this.stopRequest(); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - - if (this.isMaster_) { - window__default['default'].clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_); - this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_ = null; - } - - if (this.state === 'HAVE_NOTHING') { - // If we pause the loader before any data has been retrieved, its as if we never - // started, so reset to an unstarted state. - this.started = false; - } - }; - - _proto.load = function load(isFinalRendition) { - var _this4 = this; - - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - var media = this.media(); - - if (isFinalRendition) { - var delay = media ? media.targetDuration / 2 * 1000 : 5 * 1000; - this.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - return _this4.load(); - }, delay); - return; - } // because the playlists are internal to the manifest, load should either load the - // main manifest, or do nothing but trigger an event - - - if (!this.started) { - this.start(); - return; - } - - if (media && !media.endList) { - // Check to see if this is the master loader and the MUP was cleared (this happens - // when the loader was paused). `media` should be set at this point since one is always - // set during `start()`. - if (this.isMaster_ && !this.minimumUpdatePeriodTimeout_) { - // Trigger minimumUpdatePeriod to refresh the master manifest - this.trigger('minimumUpdatePeriod'); // Since there was no prior minimumUpdatePeriodTimeout it should be recreated - - this.updateMinimumUpdatePeriodTimeout_(); - } - - this.trigger('mediaupdatetimeout'); - } else { - this.trigger('loadedplaylist'); - } - }; - - _proto.start = function start() { - var _this5 = this; - - this.started = true; // We don't need to request the master manifest again - // Call this asynchronously to match the xhr request behavior below - - if (!this.isMaster_) { - this.mediaRequest_ = window__default['default'].setTimeout(function () { - return _this5.haveMaster_(); - }, 0); - return; - } - - this.requestMaster_(function (req, masterChanged) { - _this5.haveMaster_(); - - if (!_this5.hasPendingRequest() && !_this5.media_) { - _this5.media(_this5.masterPlaylistLoader_.master.playlists[0]); - } - }); - }; - - _proto.requestMaster_ = function requestMaster_(cb) { - var _this6 = this; - - this.request = this.vhs_.xhr({ - uri: this.masterPlaylistLoader_.srcUrl, - withCredentials: this.withCredentials - }, function (error, req) { - if (_this6.requestErrored_(error, req)) { - if (_this6.state === 'HAVE_NOTHING') { - _this6.started = false; - } - - return; - } - - var masterChanged = req.responseText !== _this6.masterPlaylistLoader_.masterXml_; - _this6.masterPlaylistLoader_.masterXml_ = req.responseText; - - if (req.responseHeaders && req.responseHeaders.date) { - _this6.masterLoaded_ = Date.parse(req.responseHeaders.date); - } else { - _this6.masterLoaded_ = Date.now(); - } - - _this6.masterPlaylistLoader_.srcUrl = resolveManifestRedirect(_this6.handleManifestRedirects, _this6.masterPlaylistLoader_.srcUrl, req); - - if (masterChanged) { - _this6.handleMaster_(); - - _this6.syncClientServerClock_(function () { - return cb(req, masterChanged); - }); - - return; - } - - return cb(req, masterChanged); - }); - } - /** - * Parses the master xml for UTCTiming node to sync the client clock to the server - * clock. If the UTCTiming node requires a HEAD or GET request, that request is made. - * - * @param {Function} done - * Function to call when clock sync has completed - */ - ; - - _proto.syncClientServerClock_ = function syncClientServerClock_(done) { - var _this7 = this; - - var utcTiming = parseUTCTiming(this.masterPlaylistLoader_.masterXml_); // No UTCTiming element found in the mpd. Use Date header from mpd request as the - // server clock - - if (utcTiming === null) { - this.masterPlaylistLoader_.clientOffset_ = this.masterLoaded_ - Date.now(); - return done(); - } - - if (utcTiming.method === 'DIRECT') { - this.masterPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now(); - return done(); - } - - this.request = this.vhs_.xhr({ - uri: resolveUrl(this.masterPlaylistLoader_.srcUrl, utcTiming.value), - method: utcTiming.method, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this7.request) { - return; - } - - if (error) { - // sync request failed, fall back to using date header from mpd - // TODO: log warning - _this7.masterPlaylistLoader_.clientOffset_ = _this7.masterLoaded_ - Date.now(); - return done(); - } - - var serverTime; - - if (utcTiming.method === 'HEAD') { - if (!req.responseHeaders || !req.responseHeaders.date) { - // expected date header not preset, fall back to using date header from mpd - // TODO: log warning - serverTime = _this7.masterLoaded_; - } else { - serverTime = Date.parse(req.responseHeaders.date); - } - } else { - serverTime = Date.parse(req.responseText); - } - - _this7.masterPlaylistLoader_.clientOffset_ = serverTime - Date.now(); - done(); - }); - }; - - _proto.haveMaster_ = function haveMaster_() { - this.state = 'HAVE_MASTER'; - - if (this.isMaster_) { - // We have the master playlist at this point, so - // trigger this to allow MasterPlaylistController - // to make an initial playlist selection - this.trigger('loadedplaylist'); - } else if (!this.media_) { - // no media playlist was specifically selected so select - // the one the child playlist loader was created with - this.media(this.childPlaylist_); - } - }; - - _proto.handleMaster_ = function handleMaster_() { - // clear media request - this.mediaRequest_ = null; - var newMaster = parseMasterXml({ - masterXml: this.masterPlaylistLoader_.masterXml_, - srcUrl: this.masterPlaylistLoader_.srcUrl, - clientOffset: this.masterPlaylistLoader_.clientOffset_, - sidxMapping: this.masterPlaylistLoader_.sidxMapping_ - }); - var oldMaster = this.masterPlaylistLoader_.master; // if we have an old master to compare the new master against - - if (oldMaster) { - newMaster = updateMaster(oldMaster, newMaster, this.masterPlaylistLoader_.sidxMapping_); - } // only update master if we have a new master - - - this.masterPlaylistLoader_.master = newMaster ? newMaster : oldMaster; - var location = this.masterPlaylistLoader_.master.locations && this.masterPlaylistLoader_.master.locations[0]; - - if (location && location !== this.masterPlaylistLoader_.srcUrl) { - this.masterPlaylistLoader_.srcUrl = location; - } - - if (!oldMaster || newMaster && newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) { - this.updateMinimumUpdatePeriodTimeout_(); - } - - return Boolean(newMaster); - }; - - _proto.updateMinimumUpdatePeriodTimeout_ = function updateMinimumUpdatePeriodTimeout_() { - var mpl = this.masterPlaylistLoader_; // cancel any pending creation of mup on media - // a new one will be added if needed. - - if (mpl.createMupOnMedia_) { - mpl.off('loadedmetadata', mpl.createMupOnMedia_); - mpl.createMupOnMedia_ = null; - } // clear any pending timeouts - - - if (mpl.minimumUpdatePeriodTimeout_) { - window__default['default'].clearTimeout(mpl.minimumUpdatePeriodTimeout_); - mpl.minimumUpdatePeriodTimeout_ = null; - } - - var mup = mpl.master && mpl.master.minimumUpdatePeriod; // If the minimumUpdatePeriod has a value of 0, that indicates that the current - // MPD has no future validity, so a new one will need to be acquired when new - // media segments are to be made available. Thus, we use the target duration - // in this case - - if (mup === 0) { - if (mpl.media()) { - mup = mpl.media().targetDuration * 1000; - } else { - mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_; - mpl.one('loadedmetadata', mpl.createMupOnMedia_); - } - } // if minimumUpdatePeriod is invalid or <= zero, which - // can happen when a live video becomes VOD. skip timeout - // creation. - - - if (typeof mup !== 'number' || mup <= 0) { - if (mup < 0) { - this.logger_("found invalid minimumUpdatePeriod of " + mup + ", not setting a timeout"); - } - - return; - } - - this.createMUPTimeout_(mup); - }; - - _proto.createMUPTimeout_ = function createMUPTimeout_(mup) { - var mpl = this.masterPlaylistLoader_; - mpl.minimumUpdatePeriodTimeout_ = window__default['default'].setTimeout(function () { - mpl.minimumUpdatePeriodTimeout_ = null; - mpl.trigger('minimumUpdatePeriod'); - mpl.createMUPTimeout_(mup); - }, mup); - } - /** - * Sends request to refresh the master xml and updates the parsed master manifest - */ - ; - - _proto.refreshXml_ = function refreshXml_() { - var _this8 = this; - - this.requestMaster_(function (req, masterChanged) { - if (!masterChanged) { - return; - } - - if (_this8.media_) { - _this8.media_ = _this8.masterPlaylistLoader_.master.playlists[_this8.media_.id]; - } // This will filter out updated sidx info from the mapping - - - _this8.masterPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings(_this8.masterPlaylistLoader_.master, _this8.masterPlaylistLoader_.sidxMapping_); - - _this8.addSidxSegments_(_this8.media(), _this8.state, function (sidxChanged) { - // TODO: do we need to reload the current playlist? - _this8.refreshMedia_(_this8.media().id); - }); - }); - } - /** - * Refreshes the media playlist by re-parsing the master xml and updating playlist - * references. If this is an alternate loader, the updated parsed manifest is retrieved - * from the master loader. - */ - ; - - _proto.refreshMedia_ = function refreshMedia_(mediaID) { - var _this9 = this; - - if (!mediaID) { - throw new Error('refreshMedia_ must take a media id'); - } // for master we have to reparse the master xml - // to re-create segments based on current timing values - // which may change media. We only skip updating master - // if this is the first time this.media_ is being set. - // as master was just parsed in that case. - - - if (this.media_ && this.isMaster_) { - this.handleMaster_(); - } - - var playlists = this.masterPlaylistLoader_.master.playlists; - var mediaChanged = !this.media_ || this.media_ !== playlists[mediaID]; - - if (mediaChanged) { - this.media_ = playlists[mediaID]; - } else { - this.trigger('playlistunchanged'); - } - - if (!this.mediaUpdateTimeout) { - var createMediaUpdateTimeout = function createMediaUpdateTimeout() { - if (_this9.media().endList) { - return; - } - - _this9.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - _this9.trigger('mediaupdatetimeout'); - - createMediaUpdateTimeout(); - }, refreshDelay(_this9.media(), Boolean(mediaChanged))); - }; - - createMediaUpdateTimeout(); - } - - this.trigger('loadedplaylist'); - }; - - return DashPlaylistLoader; - }(EventTarget); - - var Config = { - GOAL_BUFFER_LENGTH: 30, - MAX_GOAL_BUFFER_LENGTH: 60, - BACK_BUFFER_LENGTH: 30, - GOAL_BUFFER_LENGTH_RATE: 1, - // 0.5 MB/s - INITIAL_BANDWIDTH: 4194304, - // A fudge factor to apply to advertised playlist bitrates to account for - // temporary flucations in client bandwidth - BANDWIDTH_VARIANCE: 1.2, - // How much of the buffer must be filled before we consider upswitching - BUFFER_LOW_WATER_LINE: 0, - MAX_BUFFER_LOW_WATER_LINE: 30, - // TODO: Remove this when experimentalBufferBasedABR is removed - EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16, - BUFFER_LOW_WATER_LINE_RATE: 1, - // If the buffer is greater than the high water line, we won't switch down - BUFFER_HIGH_WATER_LINE: 30 - }; - - var stringToArrayBuffer = function stringToArrayBuffer(string) { - var view = new Uint8Array(new ArrayBuffer(string.length)); - - for (var i = 0; i < string.length; i++) { - view[i] = string.charCodeAt(i); - } - - return view.buffer; - }; - - var MockWorker = /*#__PURE__*/function () { - function MockWorker() { - this.listeners_ = []; - this.remote_ = null; - } - - var _proto = MockWorker.prototype; - - _proto.addEventListener = function addEventListener(type, fn) { - if (type !== 'message') { - return; - } - - this.listeners_.push(fn); - }; - - _proto.removeEventListener = function removeEventListener(type, fn) { - if (type !== 'message') { - return; - } - - var i = this.listeners_.indexOf(fn); - - if (i === -1) { - return; - } - - this.listeners_.splice(i, 1); - }; - - _proto.dispatchEvent = function dispatchEvent(event) { - if (!event || event.type !== 'message') { - return; - } - - this.listeners_.forEach(function (fn) { - fn(event); - }); - }; - - _proto.postMessage = function postMessage(data) { - if (this.remote_) { - this.remote_.recv_(data); - } - }; - - _proto.recv_ = function recv_(data) { - // the browser puts the actual message under - var message = { - data: data - }; - - if (this.onmessage) { - this.onmessage(message); - } - - this.listeners_.forEach(function (fn) { - fn(message); - }); - }; - - _proto.terminate = function terminate() { - if (this.remote_) { - this.remote_.remote_ = null; - this.remote_.terminate(); - this.remote_ = null; - } - - this.onmessage = null; - this.listeners_.length = 0; - }; - - return MockWorker; - }(); - - MockWorker.prototype.on = MockWorker.prototype.addEventListener; - MockWorker.prototype.off = MockWorker.prototype.removeEventListener; - var factory = function factory(fn) { - return function () { - var client = new MockWorker(); - var worker = new MockWorker(); - client.remote_ = worker; - worker.remote_ = client; - fn(worker); - return client; - }; - }; - var transform = function transform(fn) { - // eslint-disable-next-line - return fn; - }; - - /* rollup-plugin-worker-factory start for worker!/Users/gkatsevman/p/http-streaming-release/src/transmuxer-worker.js */ - var workerCode$1 = transform(function (self) { - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ - - var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; - }; - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - - Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; - }; // Default stream functions that are expected to be overridden to perform - // actual work. These are provided by the prototype as a sort of no-op - // implementation so that we don't have to check for their existence in the - // `pipe` function above. - - - Stream.prototype.push = function (data) { - this.trigger('data', data); - }; - - Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); - }; - - Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); - }; - - Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); - }; - - Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); - }; - - var stream = Stream; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ - - var UINT32_MAX = Math.pow(2, 32) - 1; - var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - - (function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); - })(); - - box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; - }; - - dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); - }; - - esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); - }; - - ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); - }; - - hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); - }; - - mdat = function mdat(data) { - return box(types.mdat, data); - }; - - mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); - }; - - mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); - }; - - mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); - }; - - minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); - }; - - moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); - }; - /** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - - moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); - }; - - mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); - }; - - mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); - }; - - sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); - }; - - stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); - }; - - (function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; - })(); - - tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); - }; - /** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - - traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (UINT32_MAX + 1)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (UINT32_MAX + 1)); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun$1(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); - }; - /** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - - trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); - }; - - trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); - }; - - (function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun$1 = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; - })(); - - var mp4Generator = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - // Convert an array of nal units into an array of frames with each frame being - // composed of the nal units that make up that frame - // Also keep track of cummulative data about the frame from the nal units such - // as the frame duration, starting pts, etc. - - var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; - }; // Convert an array of frames into an array of Gop with each Gop being composed - // of the frames that make up that Gop - // Also keep track of cummulative data about the Gop from the frames such as the - // Gop duration, starting pts, etc. - - - var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; - }; - /* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - - var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; - }; - /** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - - var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; - }; - /* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - - var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; - }; // generate the track's sample table from an array of gops - - - var generateSampleTable$1 = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; - }; // generate the track's raw mdat data from an array of gops - - - var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; - }; // generate the track's sample table from a frame - - - var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; - }; // generate the track's raw mdat data from a frame - - - var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; - }; - - var frameUtils = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable$1, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var highPrefix = [33, 16, 5, 32, 164, 27]; - var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - - var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; - }; - - var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); - }; - - var silence; - - var silence_1 = function silence_1() { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]], - 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - - var ONE_SECOND_IN_TS$4 = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS$4; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS$4; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - /** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; - }; // Possibly pad (prefix) the audio track with silence if appending this track - // would lead to the introduction of a gap in the audio buffer - - - var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = silence_1()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; - }; // If the audio segment extends before the earliest allowed dts - // value, remove AAC frames until starts at or after the earliest - // allowed DTS so that we don't end up with a negative baseMedia- - // DecodeTime for the audio track - - - var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); - }; // generate the track's raw mdat data from an array of frames - - - var generateSampleTable = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; - }; // generate the track's sample table from an array of frames - - - var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; - }; - - var audioFrameUtils = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS; - /** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } - }; - /** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - - var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; - }; - /** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS$3; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; - }; - - var trackDecodeInfo = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - // payload type field to indicate how they are to be - // interpreted. CEAS-708 caption content is always transmitted with - // payload type 0x04. - - var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - /** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - - var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; - }; // see ANSI/SCTE 128-1 (2013), section 8.1 - - - var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); - }; // see CEA-708-D, section 4.4 - - - var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; - }; - - var discardEmulationPreventionBytes$1 = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; // exports - - - var captionPacketParser = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes$1, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 - }; // Link To Transport - // ----------------- - - var CaptionStream$1 = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream(); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - }; - - CaptionStream$1.prototype = new stream(); - - CaptionStream$1.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; - }; - - CaptionStream$1.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); - }; - - CaptionStream$1.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); - }; - - CaptionStream$1.prototype.flush = function () { - return this.flushStream('flush'); - }; // Only called if handling partial data - - - CaptionStream$1.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); - }; - - CaptionStream$1.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); - }; // From the CEA-608 spec: - - /* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. - */ - // With that in mind, we ignore any data between an XDS control code and a - // subsequent closed-captioning control code. - - - CaptionStream$1.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); - }; - - CaptionStream$1.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; - }; - - CaptionStream$1.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; - }; - - CaptionStream$1.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; - }; - - CaptionStream$1.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } - }; // ---------------------- - // Session to Application - // ---------------------- - // This hash maps special and extended character codes to their - // proper Unicode equivalent. The first one-byte key is just a - // non-standard character code. The two-byte keys that follow are - // the extended CEA708 character codes, along with the preceding - // 0x10 extended character byte to distinguish these codes from - // non-extended character codes. Every CEA708 character code that - // is not in this object maps directly to a standard unicode - // character code. - // The transparent space and non-breaking transparent space are - // technically not fully supported since there is no code to - // make them transparent, so they have normal non-transparent - // stand-ins. - // The special closed caption (CC) character isn't a standard - // unicode character, so a fairly similar unicode character was - // chosen in it's place. - - - var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - - }; - - var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); - }; - - var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; - }; - - var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); - }; - - Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; - }; - - Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); - }; - - Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; - }; - - Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } - }; - - Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; - }; - - Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; - }; - - Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } - }; - - var Cea708Service = function Cea708Service(serviceNum) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - }; - /** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - - Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } - }; - /** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - - Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; - }; - - var Cea708Stream = function Cea708Stream() { - Cea708Stream.prototype.init.call(this); - var self = this; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; - }; - - Cea708Stream.prototype = new stream(); - /** - * Push current 708 packet, create new 708 packet. - */ - - Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; - }; - /** - * Add pts and both bytes from packet into current 708 packet. - */ - - - Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); - }; - /** - * Parse completed 708 packet into service blocks and push each service block. - */ - - - Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } - }; - /** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - - Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else ; - } - }; - /** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, true); - } - - return i; - }; - /** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - - Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; - }; - /** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - - Cea708Stream.prototype.initService = function (serviceNum, i) { - var self = this; - this.services[serviceNum] = new Cea708Service(serviceNum); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; - }; - /** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.handleText = function (i, service, isExtended) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var extended = isExtended ? 0x1000 : 0x0000; - var char = get708CharFromCode(extended | b); - var win = service.currentWindow; - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; - }; - /** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; - }; - /** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; - }; - /** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; - }; - /** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; - }; - /** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } - }; - /** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; - }; - /** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; - }; - /** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; - }; - /** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; - }; - /** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; - }; - /** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; - }; - /** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; - }; - /** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; - }; - /** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - - Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); - }; // This hash maps non-ASCII, special, and extended character codes to their - // proper Unicode equivalent. The first keys that are only a single byte - // are the non-standard ASCII characters, which simply map the CEA608 byte - // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 - // character codes, but have their MSB bitmasked with 0x03 so that a lookup - // can be performed regardless of the field and data channel on which the - // character code was received. - - - var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - - }; - - var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); - }; // the index of the last row in a CEA-608 display buffer - - - var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of - // getting it through bit logic. - - var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character - // cells. The "bottom" row is the last element in the outer array. - - var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push(''); - } - - return result; - }; - - var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; - }; - - Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the - // display buffer - - Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - // eslint-disable-next-line no-console - console.error('Skipping malformed caption.'); - return ''; - } - }) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content, - stream: this.name_ - }); - } - }; - /** - * Zero out the data, used for startup and on seek - */ - - - Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; - }; - /** - * Sets up control code and related constants for this instance - */ - - - Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; - }; - /** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - - Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - - Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - - Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; - }; - /** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - - Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; - }; - /** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - - Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; - }; - /** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - - Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; - }; - /** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - - Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; - }; - /** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - - Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; - }; // Adds the opening HTML tag for the passed character to the caption text, - // and keeps track of it for later closing - - - Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); - }; // Adds HTML closing tags for current formatting to caption text and - // clears remembered formatting - - - Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); - }; // Mode Implementations - - - Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = ''; - }; - - Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; // exports - - - var captionStream = { - CaptionStream: CaptionStream$1, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var streamTypes = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 - }; - var MAX_TS = 8589934592; - var RO_THRESH = 4294967296; - var TYPE_SHARED = 'shared'; - - var handleRollover$1 = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; - }; - - var TimestampRolloverStream$1 = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover$1(data.dts, referenceDTS); - data.pts = handleRollover$1(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; - }; - - TimestampRolloverStream$1.prototype = new stream(); - var timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream$1, - handleRollover: handleRollover$1 - }; - - var percentEncode$1 = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode$1(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591$1 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode$1(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger$1 = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }, - tagParsers = { - TXXX: function TXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); // do not include the null terminator in the tag value - - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - - tag.data = tag.value; - }, - WXXX: function WXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function PRIV(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591$1(tag.data, 0, i); - break; - } - } - - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } - }, - _MetadataStream; - - _MetadataStream = function MetadataStream(options) { - var settings = { - debug: !!(options && options.debug), - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger$1(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger$1(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseSyncSafeInteger$1(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger$1(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; - }; - - _MetadataStream.prototype = new stream(); - var metadataStream = _MetadataStream; - var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream; // object types - - var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - - var MP2T_PACKET_LENGTH$1 = 188, - // bytes - SYNC_BYTE$1 = 0x47; - /** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - - _TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH$1, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH$1; - endIndex += MP2T_PACKET_LENGTH$1; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; - }; - - _TransportPacketStream.prototype = new stream(); - /** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - - _TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === streamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = streamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = streamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; - }; - - _TransportParseStream.prototype = new stream(); - _TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f - }; - /** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - - _ElementaryStream = function ElementaryStream() { - var self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case streamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case streamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case streamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - this.flushStreams_(); - this.trigger('done'); - }; - }; - - _ElementaryStream.prototype = new stream(); - var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, - MetadataStream: metadataStream - }; - - for (var type in streamTypes) { - if (streamTypes.hasOwnProperty(type)) { - m2ts[type] = streamTypes[type]; - } - } - - var m2ts_1 = m2ts; - var ONE_SECOND_IN_TS$2 = clock.ONE_SECOND_IN_TS; - - var _AdtsStream; - - var ADTS_SAMPLING_FREQUENCIES$1 = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - /* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - - _AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - while (i + 5 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2]; - frameEnd = i + frameLength; // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - - if (buffer.byteLength < frameEnd) { - return; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - frameNum++; // If the buffer is empty, clear it and return - - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } // Remove the finished frame from the buffer and start the process again - - - buffer = buffer.subarray(frameEnd); - } - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; - }; - - _AdtsStream.prototype = new stream(); - var adts = _AdtsStream; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ExpGolomb; - /** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - - ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); - }; - - var expGolomb = ExpGolomb; - - var _H264Stream, _NalByteStream; - - var PROFILES_WITH_OPTIONAL_SPS_DATA; - /** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - - _NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - }; - - _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS - // see Recommendation ITU-T H.264 (4/2013), - // 7.3.2.1.1 Sequence parameter set data syntax - - PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true - }; - /** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - - _H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - expGolombDecoder = new expGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - sarRatio: sarRatio - }; - }; - }; - - _H264Stream.prototype = new stream(); - var h264 = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ - - var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - - var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - - var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); - }; // TODO: use vhs-utils - - - var isLikelyAacData$1 = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; - }; - - var parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }; // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - - - var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }; // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - - - var parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }; - - var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; - }; - - var parseType$2 = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; - }; - - var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; - }; - - var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; - }; - - var utils = { - isLikelyAacData: isLikelyAacData$1, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType$2, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp - }; - - var _AacStream; - /** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - - _AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = utils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = utils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; - }; - - _AacStream.prototype = new stream(); - var aac = _AacStream; // constants - - var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; - var audioProperties = AUDIO_PROPERTIES; - var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; - var videoProperties = VIDEO_PROPERTIES; - var H264Stream = h264.H264Stream; - var isLikelyAacData = utils.isLikelyAacData; - var ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS; // object types - - var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; - /** - * Compare two arrays (even typed) for same-ness - */ - - - var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; - }; - - var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; - }; - /** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - _AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - audioProperties.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4Generator.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS$1 * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; - }; - - _AudioSegmentStream.prototype = new stream(); - /** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - _VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - videoProperties.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4Generator.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4Generator.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; - }; - - _VideoSegmentStream.prototype = new stream(); - /** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - - _CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; - }; - - _CoalesceStream.prototype = new stream(); - - _CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - videoProperties.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - audioProperties.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4Generator.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - }; - - _CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; - }; - /** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - - _Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new aac(); - pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new adts(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts_1.TransportPacketStream(); - pipeline.parseStream = new m2ts_1.TransportParseStream(); - pipeline.elementaryStream = new m2ts_1.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream(); - pipeline.adtsStream = new adts(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts_1.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; - }; - - _Transmuxer.prototype = new stream(); - var transmuxer = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: audioProperties, - VIDEO_PROPERTIES: videoProperties, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var toUnsigned$3 = function toUnsigned(value) { - return value >>> 0; - }; - - var toHexString$1 = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); - }; - - var bin = { - toUnsigned: toUnsigned$3, - toHexString: toHexString$1 - }; - - var parseType$1 = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; - }; - - var parseType_1 = parseType$1; - var toUnsigned$2 = bin.toUnsigned; - - var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType_1(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; - }; - - var findBox_1 = findBox; - var toUnsigned$1 = bin.toUnsigned; - - var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - baseMediaDecodeTime: toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime *= Math.pow(2, 32); - result.baseMediaDecodeTime += toUnsigned$1(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11]); - } - - return result; - }; - - var parseTfdt = tfdt; - - var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; - }; - - var parseSampleFlags_1 = parseSampleFlags; - - var trun = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags_1(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; - }; - - var parseTrun = trun; - - var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; - }; - - var parseTfhd = tfhd; - var discardEmulationPreventionBytes = captionPacketParser.discardEmulationPreventionBytes; - var CaptionStream = captionStream.CaptionStream; - /** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; - }; - /** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - - var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - // eslint-disable-next-line no-console - console.log("We've encountered a nal unit without data. See mux.js#233."); - break; - } - - result.push(seiNal); - break; - } - } - - return result; - }; - /** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - - var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; - }; - /** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - - var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox_1(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox_1(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox_1(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox_1(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox_1(traf, ['trun']); - var samples; - var seiNals; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - seiNals = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = []; - } - - captionNals[trackId] = captionNals[trackId].concat(seiNals); - } - }); - return captionNals; - }; - /** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption - **/ - - - var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var seiNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - seiNals = parseCaptionNals(segment, trackId); - return { - seiNals: seiNals[trackId], - timescale: timescale - }; - }; - /** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - - var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData === null || !parsedData.seiNals) { - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {} - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); - }; - - var captionParser = CaptionParser; - var toUnsigned = bin.toUnsigned; - var toHexString = bin.toHexString; - var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader; - /** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - - timescale = function timescale(init) { - var result = {}, - traks = findBox_1(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox_1(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); - }; - /** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - - startTime = function startTime(timescale, fragment) { - var trafs, baseTimes, result; // we need info from two childrend of each track fragment box - - trafs = findBox_1(fragment, ['moof', 'traf']); // determine the start times for each track - - baseTimes = [].concat.apply([], trafs.map(function (traf) { - return findBox_1(traf, ['tfhd']).map(function (tfhd) { - var id, scale, baseTime; // get the track id from the tfhd - - id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - baseTime = findBox_1(traf, ['tfdt']).map(function (tfdt) { - var version, result; - version = tfdt[0]; - result = toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]); - - if (version === 1) { - result *= Math.pow(2, 32); - result += toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11]); - } - - return result; - })[0]; - baseTime = typeof baseTime === 'number' && !isNaN(baseTime) ? baseTime : Infinity; // convert base time to seconds - - return baseTime / scale; - }); - })); // return the minimum - - result = Math.min.apply(null, baseTimes); - return isFinite(result) ? result : 0; - }; - /** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - - compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox_1(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox_1(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox_1(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox_1(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - return (baseMediaDecodeTime + compositionTimeOffset) / timescale; - }; - /** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - - getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox_1(trak, ['mdia', 'hdlr']); - var tkhds = findBox_1(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType_1(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; - }; - - getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - }; - /** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - - getTracks = function getTracks(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox_1(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox_1(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType_1(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox_1(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType_1(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox_1(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[a-z]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString(codecConfig[10]); // level idc - - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; - }; - - var probe$2 = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox_1, - parseType: parseType_1, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader - }; - - var parsePid = function parsePid(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; - }; - - var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) { - return !!(packet[1] & 0x40); - }; - - var parseAdaptionField = function parseAdaptionField(packet) { - var offset = 0; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[4] + 1; - } - - return offset; - }; - - var parseType = function parseType(packet, pmtPid) { - var pid = parsePid(packet); - - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - - return null; - }; - - var parsePat = function parsePat(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; - }; - - var parsePmt = function parsePmt(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section - - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table - - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type - - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry - // skip past the elementary stream descriptors, if present - - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - - return programMapTable; - }; - - var parsePesType = function parsePesType(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - return 'video'; - - case streamTypes.ADTS_STREAM_TYPE: - return 'audio'; - - case streamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - - default: - return null; - } - }; - - var parsePesTime = function parsePesTime(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - pes = {}; // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - - pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - - return pes; - }; - - var parseNalUnitType = function parseNalUnitType(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - - case 0x06: - return 'sei_rbsp'; - - case 0x07: - return 'seq_parameter_set_rbsp'; - - case 0x08: - return 'pic_parameter_set_rbsp'; - - case 0x09: - return 'access_unit_delimiter_rbsp'; - - default: - return null; - } - }; - - var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; // advance the sync point to a NAL start, if necessary - - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } // drop trailing zeroes - - - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; // parse the final nal - - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; - }; - - var probe$1 = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame - }; - var handleRollover = timestampRolloverStream.handleRollover; - var probe = {}; - probe.ts = probe$1; - probe.aac = utils; - var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS; - var MP2T_PACKET_LENGTH = 188, - // bytes - SYNC_BYTE = 0x47; - /** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ - - var parsePsi_ = function parsePsi_(bytes, pmt) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - - case 'pmt': - var table = probe.ts.parsePmt(packet); - pmt.table = pmt.table || {}; - Object.keys(table).forEach(function (key) { - pmt.table[key] = table[key]; - }); - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ - - - var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed; - var endLoop = false; // Start walking from start of segment to get first audio packet - - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last audio packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ - - - var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed, - frame, - i, - pes; - var endLoop = false; - var currentFrame = { - data: [], - size: 0 - }; // Start walking from start of segment to get first video packet - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn('Failed to extract PTS/DTS from PES at first keyframe. ' + 'This could be an unusual TS segment, or else mux.js did not ' + 'parse your TS segment correctly. If you know your TS ' + 'segments do contain PTS/DTS on keyframes please file a bug ' + 'report! You can try ffprobe to double check for yourself.'); - } - } - - currentFrame.size = 0; - } - } - - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last video packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ - - - var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - - segmentInfo.audio.forEach(function (info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - - segmentInfo.video.forEach(function (info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds - - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } - }; - /** - * inspects the aac data stream for start and end time information - */ - - - var inspectAac_ = function inspectAac_(bytes) { - var endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - - byteIndex += frameSize; - break; - - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - - audioCount++; - byteIndex += frameSize; - break; - - default: - byteIndex++; - break; - } - - if (endLoop) { - return null; - } - } - - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - var result = { - audio: [{ - type: 'audio', - dts: timestamp, - pts: timestamp - }, { - type: 'audio', - dts: timestamp + audioCount * 1024 * audioTimescale, - pts: timestamp + audioCount * 1024 * audioTimescale - }] - }; - return result; - }; - /** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ - - - var inspectTs_ = function inspectTs_(bytes) { - var pmt = { - pid: null, - table: null - }; - var result = {}; - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - - if (result.video.length === 0) { - delete result.video; - } - - break; - - case streamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - - if (result.audio.length === 0) { - delete result.audio; - } - - break; - } - } - } - - return result; - }; - /** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ - - - var inspect = function inspect(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || !result.audio && !result.video) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - return result; - }; - - var tsInspector = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ - }; - /* global self */ - - /** - * Re-emits transmuxer events by converting them into messages to the - * world outside the worker. - * - * @param {Object} transmuxer the transmuxer to wire events on - * @private - */ - - var wireTransmuxerEvents = function wireTransmuxerEvents(self, transmuxer) { - transmuxer.on('data', function (segment) { - // transfer ownership of the underlying ArrayBuffer - // instead of doing a copy to save memory - // ArrayBuffers are transferable but generic TypedArrays are not - // @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects) - var initArray = segment.initSegment; - segment.initSegment = { - data: initArray.buffer, - byteOffset: initArray.byteOffset, - byteLength: initArray.byteLength - }; - var typedArray = segment.data; - segment.data = typedArray.buffer; - self.postMessage({ - action: 'data', - segment: segment, - byteOffset: typedArray.byteOffset, - byteLength: typedArray.byteLength - }, [segment.data]); - }); - transmuxer.on('done', function (data) { - self.postMessage({ - action: 'done' - }); - }); - transmuxer.on('gopInfo', function (gopInfo) { - self.postMessage({ - action: 'gopInfo', - gopInfo: gopInfo - }); - }); - transmuxer.on('videoSegmentTimingInfo', function (timingInfo) { - var videoSegmentTimingInfo = { - start: { - decode: clock.videoTsToSeconds(timingInfo.start.dts), - presentation: clock.videoTsToSeconds(timingInfo.start.pts) - }, - end: { - decode: clock.videoTsToSeconds(timingInfo.end.dts), - presentation: clock.videoTsToSeconds(timingInfo.end.pts) - }, - baseMediaDecodeTime: clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime) - }; - - if (timingInfo.prependedContentDuration) { - videoSegmentTimingInfo.prependedContentDuration = clock.videoTsToSeconds(timingInfo.prependedContentDuration); - } - - self.postMessage({ - action: 'videoSegmentTimingInfo', - videoSegmentTimingInfo: videoSegmentTimingInfo - }); - }); - transmuxer.on('audioSegmentTimingInfo', function (timingInfo) { - // Note that all times for [audio/video]SegmentTimingInfo events are in video clock - var audioSegmentTimingInfo = { - start: { - decode: clock.videoTsToSeconds(timingInfo.start.dts), - presentation: clock.videoTsToSeconds(timingInfo.start.pts) - }, - end: { - decode: clock.videoTsToSeconds(timingInfo.end.dts), - presentation: clock.videoTsToSeconds(timingInfo.end.pts) - }, - baseMediaDecodeTime: clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime) - }; - - if (timingInfo.prependedContentDuration) { - audioSegmentTimingInfo.prependedContentDuration = clock.videoTsToSeconds(timingInfo.prependedContentDuration); - } - - self.postMessage({ - action: 'audioSegmentTimingInfo', - audioSegmentTimingInfo: audioSegmentTimingInfo - }); - }); - transmuxer.on('id3Frame', function (id3Frame) { - self.postMessage({ - action: 'id3Frame', - id3Frame: id3Frame - }); - }); - transmuxer.on('caption', function (caption) { - self.postMessage({ - action: 'caption', - caption: caption - }); - }); - transmuxer.on('trackinfo', function (trackInfo) { - self.postMessage({ - action: 'trackinfo', - trackInfo: trackInfo - }); - }); - transmuxer.on('audioTimingInfo', function (audioTimingInfo) { - // convert to video TS since we prioritize video time over audio - self.postMessage({ - action: 'audioTimingInfo', - audioTimingInfo: { - start: clock.videoTsToSeconds(audioTimingInfo.start), - end: clock.videoTsToSeconds(audioTimingInfo.end) - } - }); - }); - transmuxer.on('videoTimingInfo', function (videoTimingInfo) { - self.postMessage({ - action: 'videoTimingInfo', - videoTimingInfo: { - start: clock.videoTsToSeconds(videoTimingInfo.start), - end: clock.videoTsToSeconds(videoTimingInfo.end) - } - }); - }); - }; - /** - * All incoming messages route through this hash. If no function exists - * to handle an incoming message, then we ignore the message. - * - * @class MessageHandlers - * @param {Object} options the options to initialize with - */ - - - var MessageHandlers = /*#__PURE__*/function () { - function MessageHandlers(self, options) { - this.options = options || {}; - this.self = self; - this.init(); - } - /** - * initialize our web worker and wire all the events. - */ - - - var _proto = MessageHandlers.prototype; - - _proto.init = function init() { - if (this.transmuxer) { - this.transmuxer.dispose(); - } - - this.transmuxer = new transmuxer.Transmuxer(this.options); - wireTransmuxerEvents(this.self, this.transmuxer); - }; - - _proto.pushMp4Captions = function pushMp4Captions(data) { - if (!this.captionParser) { - this.captionParser = new captionParser(); - this.captionParser.init(); - } - - var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength); - var parsed = this.captionParser.parse(segment, data.trackIds, data.timescales); - this.self.postMessage({ - action: 'mp4Captions', - captions: parsed && parsed.captions || [], - data: segment.buffer - }, [segment.buffer]); - }; - - _proto.probeMp4StartTime = function probeMp4StartTime(_ref) { - var timescales = _ref.timescales, - data = _ref.data; - var startTime = probe$2.startTime(timescales, data); - this.self.postMessage({ - action: 'probeMp4StartTime', - startTime: startTime, - data: data - }, [data.buffer]); - }; - - _proto.probeMp4Tracks = function probeMp4Tracks(_ref2) { - var data = _ref2.data; - var tracks = probe$2.tracks(data); - this.self.postMessage({ - action: 'probeMp4Tracks', - tracks: tracks, - data: data - }, [data.buffer]); - } - /** - * Probe an mpeg2-ts segment to determine the start time of the segment in it's - * internal "media time," as well as whether it contains video and/or audio. - * - * @private - * @param {Uint8Array} bytes - segment bytes - * @param {number} baseStartTime - * Relative reference timestamp used when adjusting frame timestamps for rollover. - * This value should be in seconds, as it's converted to a 90khz clock within the - * function body. - * @return {Object} The start time of the current segment in "media time" as well as - * whether it contains video and/or audio - */ - ; - - _proto.probeTs = function probeTs(_ref3) { - var data = _ref3.data, - baseStartTime = _ref3.baseStartTime; - var tsStartTime = typeof baseStartTime === 'number' && !isNaN(baseStartTime) ? baseStartTime * clock.ONE_SECOND_IN_TS : void 0; - var timeInfo = tsInspector.inspect(data, tsStartTime); - var result = null; - - if (timeInfo) { - result = { - // each type's time info comes back as an array of 2 times, start and end - hasVideo: timeInfo.video && timeInfo.video.length === 2 || false, - hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false - }; - - if (result.hasVideo) { - result.videoStart = timeInfo.video[0].ptsTime; - } - - if (result.hasAudio) { - result.audioStart = timeInfo.audio[0].ptsTime; - } - } - - this.self.postMessage({ - action: 'probeTs', - result: result, - data: data - }, [data.buffer]); - }; - - _proto.clearAllMp4Captions = function clearAllMp4Captions() { - if (this.captionParser) { - this.captionParser.clearAllCaptions(); - } - }; - - _proto.clearParsedMp4Captions = function clearParsedMp4Captions() { - if (this.captionParser) { - this.captionParser.clearParsedCaptions(); - } - } - /** - * Adds data (a ts segment) to the start of the transmuxer pipeline for - * processing. - * - * @param {ArrayBuffer} data data to push into the muxer - */ - ; - - _proto.push = function push(data) { - // Cast array buffer to correct type for transmuxer - var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength); - this.transmuxer.push(segment); - } - /** - * Recreate the transmuxer so that the next segment added via `push` - * start with a fresh transmuxer. - */ - ; - - _proto.reset = function reset() { - this.transmuxer.reset(); - } - /** - * Set the value that will be used as the `baseMediaDecodeTime` time for the - * next segment pushed in. Subsequent segments will have their `baseMediaDecodeTime` - * set relative to the first based on the PTS values. - * - * @param {Object} data used to set the timestamp offset in the muxer - */ - ; - - _proto.setTimestampOffset = function setTimestampOffset(data) { - var timestampOffset = data.timestampOffset || 0; - this.transmuxer.setBaseMediaDecodeTime(Math.round(clock.secondsToVideoTs(timestampOffset))); - }; - - _proto.setAudioAppendStart = function setAudioAppendStart(data) { - this.transmuxer.setAudioAppendStart(Math.ceil(clock.secondsToVideoTs(data.appendStart))); - }; - - _proto.setRemux = function setRemux(data) { - this.transmuxer.setRemux(data.remux); - } - /** - * Forces the pipeline to finish processing the last segment and emit it's - * results. - * - * @param {Object} data event data, not really used - */ - ; - - _proto.flush = function flush(data) { - this.transmuxer.flush(); // transmuxed done action is fired after both audio/video pipelines are flushed - - self.postMessage({ - action: 'done', - type: 'transmuxed' - }); - }; - - _proto.endTimeline = function endTimeline() { - this.transmuxer.endTimeline(); // transmuxed endedtimeline action is fired after both audio/video pipelines end their - // timelines - - self.postMessage({ - action: 'endedtimeline', - type: 'transmuxed' - }); - }; - - _proto.alignGopsWith = function alignGopsWith(data) { - this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice()); - }; - - return MessageHandlers; - }(); - /** - * Our web worker interface so that things can talk to mux.js - * that will be running in a web worker. the scope is passed to this by - * webworkify. - * - * @param {Object} self the scope for the web worker - */ - - - self.onmessage = function (event) { - if (event.data.action === 'init' && event.data.options) { - this.messageHandlers = new MessageHandlers(self, event.data.options); - return; - } - - if (!this.messageHandlers) { - this.messageHandlers = new MessageHandlers(self); - } - - if (event.data && event.data.action && event.data.action !== 'init') { - if (this.messageHandlers[event.data.action]) { - this.messageHandlers[event.data.action](event.data); - } - } - }; - }); - var TransmuxWorker = factory(workerCode$1); - /* rollup-plugin-worker-factory end for worker!/Users/gkatsevman/p/http-streaming-release/src/transmuxer-worker.js */ - - var handleData_ = function handleData_(event, transmuxedData, callback) { - var _event$data$segment = event.data.segment, - type = _event$data$segment.type, - initSegment = _event$data$segment.initSegment, - captions = _event$data$segment.captions, - captionStreams = _event$data$segment.captionStreams, - metadata = _event$data$segment.metadata, - videoFrameDtsTime = _event$data$segment.videoFrameDtsTime, - videoFramePtsTime = _event$data$segment.videoFramePtsTime; - transmuxedData.buffer.push({ - captions: captions, - captionStreams: captionStreams, - metadata: metadata - }); - var boxes = event.data.segment.boxes || { - data: event.data.segment.data - }; - var result = { - type: type, - // cast ArrayBuffer to TypedArray - data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength), - initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength) - }; - - if (typeof videoFrameDtsTime !== 'undefined') { - result.videoFrameDtsTime = videoFrameDtsTime; - } - - if (typeof videoFramePtsTime !== 'undefined') { - result.videoFramePtsTime = videoFramePtsTime; - } - - callback(result); - }; - var handleDone_ = function handleDone_(_ref) { - var transmuxedData = _ref.transmuxedData, - callback = _ref.callback; - // Previously we only returned data on data events, - // not on done events. Clear out the buffer to keep that consistent. - transmuxedData.buffer = []; // all buffers should have been flushed from the muxer, so start processing anything we - // have received - - callback(transmuxedData); - }; - var handleGopInfo_ = function handleGopInfo_(event, transmuxedData) { - transmuxedData.gopInfo = event.data.gopInfo; - }; - var processTransmux = function processTransmux(options) { - var transmuxer = options.transmuxer, - bytes = options.bytes, - audioAppendStart = options.audioAppendStart, - gopsToAlignWith = options.gopsToAlignWith, - remux = options.remux, - onData = options.onData, - onTrackInfo = options.onTrackInfo, - onAudioTimingInfo = options.onAudioTimingInfo, - onVideoTimingInfo = options.onVideoTimingInfo, - onVideoSegmentTimingInfo = options.onVideoSegmentTimingInfo, - onAudioSegmentTimingInfo = options.onAudioSegmentTimingInfo, - onId3 = options.onId3, - onCaptions = options.onCaptions, - onDone = options.onDone, - onEndedTimeline = options.onEndedTimeline, - isEndOfTimeline = options.isEndOfTimeline; - var transmuxedData = { - buffer: [] - }; - var waitForEndedTimelineEvent = isEndOfTimeline; - - var handleMessage = function handleMessage(event) { - if (transmuxer.currentTransmux !== options) { - // disposed - return; - } - - if (event.data.action === 'data') { - handleData_(event, transmuxedData, onData); - } - - if (event.data.action === 'trackinfo') { - onTrackInfo(event.data.trackInfo); - } - - if (event.data.action === 'gopInfo') { - handleGopInfo_(event, transmuxedData); - } - - if (event.data.action === 'audioTimingInfo') { - onAudioTimingInfo(event.data.audioTimingInfo); - } - - if (event.data.action === 'videoTimingInfo') { - onVideoTimingInfo(event.data.videoTimingInfo); - } - - if (event.data.action === 'videoSegmentTimingInfo') { - onVideoSegmentTimingInfo(event.data.videoSegmentTimingInfo); - } - - if (event.data.action === 'audioSegmentTimingInfo') { - onAudioSegmentTimingInfo(event.data.audioSegmentTimingInfo); - } - - if (event.data.action === 'id3Frame') { - onId3([event.data.id3Frame], event.data.id3Frame.dispatchType); - } - - if (event.data.action === 'caption') { - onCaptions(event.data.caption); - } - - if (event.data.action === 'endedtimeline') { - waitForEndedTimelineEvent = false; - onEndedTimeline(); - } // wait for the transmuxed event since we may have audio and video - - - if (event.data.type !== 'transmuxed') { - return; - } // If the "endedtimeline" event has not yet fired, and this segment represents the end - // of a timeline, that means there may still be data events before the segment - // processing can be considerred complete. In that case, the final event should be - // an "endedtimeline" event with the type "transmuxed." - - - if (waitForEndedTimelineEvent) { - return; - } - - transmuxer.onmessage = null; - handleDone_({ - transmuxedData: transmuxedData, - callback: onDone - }); - /* eslint-disable no-use-before-define */ - - dequeue(transmuxer); - /* eslint-enable */ - }; - - transmuxer.onmessage = handleMessage; - - if (audioAppendStart) { - transmuxer.postMessage({ - action: 'setAudioAppendStart', - appendStart: audioAppendStart - }); - } // allow empty arrays to be passed to clear out GOPs - - - if (Array.isArray(gopsToAlignWith)) { - transmuxer.postMessage({ - action: 'alignGopsWith', - gopsToAlignWith: gopsToAlignWith - }); - } - - if (typeof remux !== 'undefined') { - transmuxer.postMessage({ - action: 'setRemux', - remux: remux - }); - } - - if (bytes.byteLength) { - var buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer; - var byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset; - transmuxer.postMessage({ - action: 'push', - // Send the typed-array of data as an ArrayBuffer so that - // it can be sent as a "Transferable" and avoid the costly - // memory copy - data: buffer, - // To recreate the original typed-array, we need information - // about what portion of the ArrayBuffer it was a view into - byteOffset: byteOffset, - byteLength: bytes.byteLength - }, [buffer]); - } - - if (isEndOfTimeline) { - transmuxer.postMessage({ - action: 'endTimeline' - }); - } // even if we didn't push any bytes, we have to make sure we flush in case we reached - // the end of the segment - - - transmuxer.postMessage({ - action: 'flush' - }); - }; - var dequeue = function dequeue(transmuxer) { - transmuxer.currentTransmux = null; - - if (transmuxer.transmuxQueue.length) { - transmuxer.currentTransmux = transmuxer.transmuxQueue.shift(); - - if (typeof transmuxer.currentTransmux === 'function') { - transmuxer.currentTransmux(); - } else { - processTransmux(transmuxer.currentTransmux); - } - } - }; - var processAction = function processAction(transmuxer, action) { - transmuxer.postMessage({ - action: action - }); - dequeue(transmuxer); - }; - var enqueueAction = function enqueueAction(action, transmuxer) { - if (!transmuxer.currentTransmux) { - transmuxer.currentTransmux = action; - processAction(transmuxer, action); - return; - } - - transmuxer.transmuxQueue.push(processAction.bind(null, transmuxer, action)); - }; - var reset = function reset(transmuxer) { - enqueueAction('reset', transmuxer); - }; - var endTimeline = function endTimeline(transmuxer) { - enqueueAction('endTimeline', transmuxer); - }; - var transmux = function transmux(options) { - if (!options.transmuxer.currentTransmux) { - options.transmuxer.currentTransmux = options; - processTransmux(options); - return; - } - - options.transmuxer.transmuxQueue.push(options); - }; - var createTransmuxer = function createTransmuxer(options) { - var transmuxer = new TransmuxWorker(); - transmuxer.currentTransmux = null; - transmuxer.transmuxQueue = []; - var term = transmuxer.terminate; - - transmuxer.terminate = function () { - transmuxer.currentTransmux = null; - transmuxer.transmuxQueue.length = 0; - return term.call(transmuxer); - }; - - transmuxer.postMessage({ - action: 'init', - options: options - }); - return transmuxer; - }; - var segmentTransmuxer = { - reset: reset, - endTimeline: endTimeline, - transmux: transmux, - createTransmuxer: createTransmuxer - }; - - var workerCallback = function workerCallback(options) { - var transmuxer = options.transmuxer; - var endAction = options.endAction || options.action; - var callback = options.callback; - - var message = _extends_1({}, options, { - endAction: null, - transmuxer: null, - callback: null - }); - - var listenForEndEvent = function listenForEndEvent(event) { - if (event.data.action !== endAction) { - return; - } - - transmuxer.removeEventListener('message', listenForEndEvent); // transfer ownership of bytes back to us. - - if (event.data.data) { - event.data.data = new Uint8Array(event.data.data, options.byteOffset || 0, options.byteLength || event.data.data.byteLength); - - if (options.data) { - options.data = event.data.data; - } - } - - callback(event.data); - }; - - transmuxer.addEventListener('message', listenForEndEvent); - - if (options.data) { - var isArrayBuffer = options.data instanceof ArrayBuffer; - message.byteOffset = isArrayBuffer ? 0 : options.data.byteOffset; - message.byteLength = options.data.byteLength; - var transfers = [isArrayBuffer ? options.data : options.data.buffer]; - transmuxer.postMessage(message, transfers); - } else { - transmuxer.postMessage(message); - } - }; - - var REQUEST_ERRORS = { - FAILURE: 2, - TIMEOUT: -101, - ABORTED: -102 - }; - /** - * Abort all requests - * - * @param {Object} activeXhrs - an object that tracks all XHR requests - */ - - var abortAll = function abortAll(activeXhrs) { - activeXhrs.forEach(function (xhr) { - xhr.abort(); - }); - }; - /** - * Gather important bandwidth stats once a request has completed - * - * @param {Object} request - the XHR request from which to gather stats - */ - - - var getRequestStats = function getRequestStats(request) { - return { - bandwidth: request.bandwidth, - bytesReceived: request.bytesReceived || 0, - roundTripTime: request.roundTripTime || 0 - }; - }; - /** - * If possible gather bandwidth stats as a request is in - * progress - * - * @param {Event} progressEvent - an event object from an XHR's progress event - */ - - - var getProgressStats = function getProgressStats(progressEvent) { - var request = progressEvent.target; - var roundTripTime = Date.now() - request.requestTime; - var stats = { - bandwidth: Infinity, - bytesReceived: 0, - roundTripTime: roundTripTime || 0 - }; - stats.bytesReceived = progressEvent.loaded; // This can result in Infinity if stats.roundTripTime is 0 but that is ok - // because we should only use bandwidth stats on progress to determine when - // abort a request early due to insufficient bandwidth - - stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1000); - return stats; - }; - /** - * Handle all error conditions in one place and return an object - * with all the information - * - * @param {Error|null} error - if non-null signals an error occured with the XHR - * @param {Object} request - the XHR request that possibly generated the error - */ - - - var handleErrors = function handleErrors(error, request) { - if (request.timedout) { - return { - status: request.status, - message: 'HLS request timed-out at URL: ' + request.uri, - code: REQUEST_ERRORS.TIMEOUT, - xhr: request - }; - } - - if (request.aborted) { - return { - status: request.status, - message: 'HLS request aborted at URL: ' + request.uri, - code: REQUEST_ERRORS.ABORTED, - xhr: request - }; - } - - if (error) { - return { - status: request.status, - message: 'HLS request errored at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }; - } - - if (request.responseType === 'arraybuffer' && request.response.byteLength === 0) { - return { - status: request.status, - message: 'Empty HLS response at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }; - } - - return null; - }; - /** - * Handle responses for key data and convert the key data to the correct format - * for the decryption step later - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Array} objects - objects to add the key bytes to. - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - - var handleKeyResponse = function handleKeyResponse(segment, objects, finishProcessingFn) { - return function (error, request) { - var response = request.response; - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - if (response.byteLength !== 16) { - return finishProcessingFn({ - status: request.status, - message: 'Invalid HLS key at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }, segment); - } - - var view = new DataView(response); - var bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]); - - for (var i = 0; i < objects.length; i++) { - objects[i].bytes = bytes; - } - - return finishProcessingFn(null, segment); - }; - }; - - var parseInitSegment = function parseInitSegment(segment, _callback) { - var type = detectContainerForBytes(segment.map.bytes); // TODO: We should also handle ts init segments here, but we - // only know how to parse mp4 init segments at the moment - - if (type !== 'mp4') { - var uri = segment.map.resolvedUri || segment.map.uri; - return _callback({ - internal: true, - message: "Found unsupported " + (type || 'unknown') + " container for initialization segment at URL: " + uri, - code: REQUEST_ERRORS.FAILURE - }); - } - - workerCallback({ - action: 'probeMp4Tracks', - data: segment.map.bytes, - transmuxer: segment.transmuxer, - callback: function callback(_ref) { - var tracks = _ref.tracks, - data = _ref.data; - // transfer bytes back to us - segment.map.bytes = data; - tracks.forEach(function (track) { - segment.map.tracks = segment.map.tracks || {}; // only support one track of each type for now - - if (segment.map.tracks[track.type]) { - return; - } - - segment.map.tracks[track.type] = track; - - if (typeof track.id === 'number' && track.timescale) { - segment.map.timescales = segment.map.timescales || {}; - segment.map.timescales[track.id] = track.timescale; - } - }); - return _callback(null); - } - }); - }; - /** - * Handle init-segment responses - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - - var handleInitSegmentResponse = function handleInitSegmentResponse(_ref2) { - var segment = _ref2.segment, - finishProcessingFn = _ref2.finishProcessingFn; - return function (error, request) { - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - var bytes = new Uint8Array(request.response); // init segment is encypted, we will have to wait - // until the key request is done to decrypt. - - if (segment.map.key) { - segment.map.encryptedBytes = bytes; - return finishProcessingFn(null, segment); - } - - segment.map.bytes = bytes; - parseInitSegment(segment, function (parseError) { - if (parseError) { - parseError.xhr = request; - parseError.status = request.status; - return finishProcessingFn(parseError, segment); - } - - finishProcessingFn(null, segment); - }); - }; - }; - /** - * Response handler for segment-requests being sure to set the correct - * property depending on whether the segment is encryped or not - * Also records and keeps track of stats that are used for ABR purposes - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - - var handleSegmentResponse = function handleSegmentResponse(_ref3) { - var segment = _ref3.segment, - finishProcessingFn = _ref3.finishProcessingFn, - responseType = _ref3.responseType; - return function (error, request) { - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - var newBytes = // although responseText "should" exist, this guard serves to prevent an error being - // thrown for two primary cases: - // 1. the mime type override stops working, or is not implemented for a specific - // browser - // 2. when using mock XHR libraries like sinon that do not allow the override behavior - responseType === 'arraybuffer' || !request.responseText ? request.response : stringToArrayBuffer(request.responseText.substring(segment.lastReachedChar || 0)); - segment.stats = getRequestStats(request); - - if (segment.key) { - segment.encryptedBytes = new Uint8Array(newBytes); - } else { - segment.bytes = new Uint8Array(newBytes); - } - - return finishProcessingFn(null, segment); - }; - }; - - var transmuxAndNotify = function transmuxAndNotify(_ref4) { - var segment = _ref4.segment, - bytes = _ref4.bytes, - trackInfoFn = _ref4.trackInfoFn, - timingInfoFn = _ref4.timingInfoFn, - videoSegmentTimingInfoFn = _ref4.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref4.audioSegmentTimingInfoFn, - id3Fn = _ref4.id3Fn, - captionsFn = _ref4.captionsFn, - isEndOfTimeline = _ref4.isEndOfTimeline, - endedTimelineFn = _ref4.endedTimelineFn, - dataFn = _ref4.dataFn, - doneFn = _ref4.doneFn; - var fmp4Tracks = segment.map && segment.map.tracks || {}; - var isMuxed = Boolean(fmp4Tracks.audio && fmp4Tracks.video); // Keep references to each function so we can null them out after we're done with them. - // One reason for this is that in the case of full segments, we want to trust start - // times from the probe, rather than the transmuxer. - - var audioStartFn = timingInfoFn.bind(null, segment, 'audio', 'start'); - var audioEndFn = timingInfoFn.bind(null, segment, 'audio', 'end'); - var videoStartFn = timingInfoFn.bind(null, segment, 'video', 'start'); - var videoEndFn = timingInfoFn.bind(null, segment, 'video', 'end'); - - var finish = function finish() { - return transmux({ - bytes: bytes, - transmuxer: segment.transmuxer, - audioAppendStart: segment.audioAppendStart, - gopsToAlignWith: segment.gopsToAlignWith, - remux: isMuxed, - onData: function onData(result) { - result.type = result.type === 'combined' ? 'video' : result.type; - dataFn(segment, result); - }, - onTrackInfo: function onTrackInfo(trackInfo) { - if (trackInfoFn) { - if (isMuxed) { - trackInfo.isMuxed = true; - } - - trackInfoFn(segment, trackInfo); - } - }, - onAudioTimingInfo: function onAudioTimingInfo(audioTimingInfo) { - // we only want the first start value we encounter - if (audioStartFn && typeof audioTimingInfo.start !== 'undefined') { - audioStartFn(audioTimingInfo.start); - audioStartFn = null; - } // we want to continually update the end time - - - if (audioEndFn && typeof audioTimingInfo.end !== 'undefined') { - audioEndFn(audioTimingInfo.end); - } - }, - onVideoTimingInfo: function onVideoTimingInfo(videoTimingInfo) { - // we only want the first start value we encounter - if (videoStartFn && typeof videoTimingInfo.start !== 'undefined') { - videoStartFn(videoTimingInfo.start); - videoStartFn = null; - } // we want to continually update the end time - - - if (videoEndFn && typeof videoTimingInfo.end !== 'undefined') { - videoEndFn(videoTimingInfo.end); - } - }, - onVideoSegmentTimingInfo: function onVideoSegmentTimingInfo(videoSegmentTimingInfo) { - videoSegmentTimingInfoFn(videoSegmentTimingInfo); - }, - onAudioSegmentTimingInfo: function onAudioSegmentTimingInfo(audioSegmentTimingInfo) { - audioSegmentTimingInfoFn(audioSegmentTimingInfo); - }, - onId3: function onId3(id3Frames, dispatchType) { - id3Fn(segment, id3Frames, dispatchType); - }, - onCaptions: function onCaptions(captions) { - captionsFn(segment, [captions]); - }, - isEndOfTimeline: isEndOfTimeline, - onEndedTimeline: function onEndedTimeline() { - endedTimelineFn(); - }, - onDone: function onDone(result) { - if (!doneFn) { - return; - } - - result.type = result.type === 'combined' ? 'video' : result.type; - doneFn(null, segment, result); - } - }); - }; // In the transmuxer, we don't yet have the ability to extract a "proper" start time. - // Meaning cached frame data may corrupt our notion of where this segment - // really starts. To get around this, probe for the info needed. - - - workerCallback({ - action: 'probeTs', - transmuxer: segment.transmuxer, - data: bytes, - baseStartTime: segment.baseStartTime, - callback: function callback(data) { - segment.bytes = bytes = data.data; - var probeResult = data.result; - - if (probeResult) { - trackInfoFn(segment, { - hasAudio: probeResult.hasAudio, - hasVideo: probeResult.hasVideo, - isMuxed: isMuxed - }); - trackInfoFn = null; - - if (probeResult.hasAudio && !isMuxed) { - audioStartFn(probeResult.audioStart); - } - - if (probeResult.hasVideo) { - videoStartFn(probeResult.videoStart); - } - - audioStartFn = null; - videoStartFn = null; - } - - finish(); - } - }); - }; - - var handleSegmentBytes = function handleSegmentBytes(_ref5) { - var segment = _ref5.segment, - bytes = _ref5.bytes, - trackInfoFn = _ref5.trackInfoFn, - timingInfoFn = _ref5.timingInfoFn, - videoSegmentTimingInfoFn = _ref5.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref5.audioSegmentTimingInfoFn, - id3Fn = _ref5.id3Fn, - captionsFn = _ref5.captionsFn, - isEndOfTimeline = _ref5.isEndOfTimeline, - endedTimelineFn = _ref5.endedTimelineFn, - dataFn = _ref5.dataFn, - doneFn = _ref5.doneFn; - var bytesAsUint8Array = new Uint8Array(bytes); // TODO: - // We should have a handler that fetches the number of bytes required - // to check if something is fmp4. This will allow us to save bandwidth - // because we can only blacklist a playlist and abort requests - // by codec after trackinfo triggers. - - if (isLikelyFmp4MediaSegment(bytesAsUint8Array)) { - segment.isFmp4 = true; - var tracks = segment.map.tracks; - var trackInfo = { - isFmp4: true, - hasVideo: !!tracks.video, - hasAudio: !!tracks.audio - }; // if we have a audio track, with a codec that is not set to - // encrypted audio - - if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== 'enca') { - trackInfo.audioCodec = tracks.audio.codec; - } // if we have a video track, with a codec that is not set to - // encrypted video - - - if (tracks.video && tracks.video.codec && tracks.video.codec !== 'encv') { - trackInfo.videoCodec = tracks.video.codec; - } - - if (tracks.video && tracks.audio) { - trackInfo.isMuxed = true; - } // since we don't support appending fmp4 data on progress, we know we have the full - // segment here - - - trackInfoFn(segment, trackInfo); // The probe doesn't provide the segment end time, so only callback with the start - // time. The end time can be roughly calculated by the receiver using the duration. - // - // Note that the start time returned by the probe reflects the baseMediaDecodeTime, as - // that is the true start of the segment (where the playback engine should begin - // decoding). - - var finishLoading = function finishLoading(captions) { - // if the track still has audio at this point it is only possible - // for it to be audio only. See `tracks.video && tracks.audio` if statement - // above. - // we make sure to use segment.bytes here as that - dataFn(segment, { - data: bytesAsUint8Array, - type: trackInfo.hasAudio && !trackInfo.isMuxed ? 'audio' : 'video' - }); - - if (captions && captions.length) { - captionsFn(segment, captions); - } - - doneFn(null, segment, {}); - }; - - workerCallback({ - action: 'probeMp4StartTime', - timescales: segment.map.timescales, - data: bytesAsUint8Array, - transmuxer: segment.transmuxer, - callback: function callback(_ref6) { - var data = _ref6.data, - startTime = _ref6.startTime; - // transfer bytes back to us - bytes = data.buffer; - segment.bytes = bytesAsUint8Array = data; - - if (trackInfo.hasAudio && !trackInfo.isMuxed) { - timingInfoFn(segment, 'audio', 'start', startTime); - } - - if (trackInfo.hasVideo) { - timingInfoFn(segment, 'video', 'start', startTime); - } // Run through the CaptionParser in case there are captions. - // Initialize CaptionParser if it hasn't been yet - - - if (!tracks.video || !data.byteLength || !segment.transmuxer) { - finishLoading(); - return; - } - - workerCallback({ - action: 'pushMp4Captions', - endAction: 'mp4Captions', - transmuxer: segment.transmuxer, - data: bytesAsUint8Array, - timescales: segment.map.timescales, - trackIds: [tracks.video.id], - callback: function callback(message) { - // transfer bytes back to us - bytes = message.data.buffer; - segment.bytes = bytesAsUint8Array = message.data; - finishLoading(message.captions); - } - }); - } - }); - return; - } // VTT or other segments that don't need processing - - - if (!segment.transmuxer) { - doneFn(null, segment, {}); - return; - } - - if (typeof segment.container === 'undefined') { - segment.container = detectContainerForBytes(bytesAsUint8Array); - } - - if (segment.container !== 'ts' && segment.container !== 'aac') { - trackInfoFn(segment, { - hasAudio: false, - hasVideo: false - }); - doneFn(null, segment, {}); - return; - } // ts or aac - - - transmuxAndNotify({ - segment: segment, - bytes: bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - }; - - var decrypt = function decrypt(_ref7, callback) { - var id = _ref7.id, - key = _ref7.key, - encryptedBytes = _ref7.encryptedBytes, - decryptionWorker = _ref7.decryptionWorker; - - var decryptionHandler = function decryptionHandler(event) { - if (event.data.source === id) { - decryptionWorker.removeEventListener('message', decryptionHandler); - var decrypted = event.data.decrypted; - callback(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength)); - } - }; - - decryptionWorker.addEventListener('message', decryptionHandler); - var keyBytes; - - if (key.bytes.slice) { - keyBytes = key.bytes.slice(); - } else { - keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes)); - } // incrementally decrypt the bytes - - - decryptionWorker.postMessage(createTransferableMessage({ - source: id, - encrypted: encryptedBytes, - key: keyBytes, - iv: key.iv - }), [encryptedBytes.buffer, keyBytes.buffer]); - }; - /** - * Decrypt the segment via the decryption web worker - * - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption - * routines - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Function} doneFn - a callback that is executed after decryption has completed - */ - - - var decryptSegment = function decryptSegment(_ref8) { - var decryptionWorker = _ref8.decryptionWorker, - segment = _ref8.segment, - trackInfoFn = _ref8.trackInfoFn, - timingInfoFn = _ref8.timingInfoFn, - videoSegmentTimingInfoFn = _ref8.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref8.audioSegmentTimingInfoFn, - id3Fn = _ref8.id3Fn, - captionsFn = _ref8.captionsFn, - isEndOfTimeline = _ref8.isEndOfTimeline, - endedTimelineFn = _ref8.endedTimelineFn, - dataFn = _ref8.dataFn, - doneFn = _ref8.doneFn; - decrypt({ - id: segment.requestId, - key: segment.key, - encryptedBytes: segment.encryptedBytes, - decryptionWorker: decryptionWorker - }, function (decryptedBytes) { - segment.bytes = decryptedBytes; - handleSegmentBytes({ - segment: segment, - bytes: segment.bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - }); - }; - /** - * This function waits for all XHRs to finish (with either success or failure) - * before continueing processing via it's callback. The function gathers errors - * from each request into a single errors array so that the error status for - * each request can be examined later. - * - * @param {Object} activeXhrs - an object that tracks all XHR requests - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption - * routines - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} id3Fn - a callback that receives ID3 metadata - * @param {Function} captionsFn - a callback that receives captions - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Function} doneFn - a callback that is executed after all resources have been - * downloaded and any decryption completed - */ - - - var waitForCompletion = function waitForCompletion(_ref9) { - var activeXhrs = _ref9.activeXhrs, - decryptionWorker = _ref9.decryptionWorker, - trackInfoFn = _ref9.trackInfoFn, - timingInfoFn = _ref9.timingInfoFn, - videoSegmentTimingInfoFn = _ref9.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref9.audioSegmentTimingInfoFn, - id3Fn = _ref9.id3Fn, - captionsFn = _ref9.captionsFn, - isEndOfTimeline = _ref9.isEndOfTimeline, - endedTimelineFn = _ref9.endedTimelineFn, - dataFn = _ref9.dataFn, - doneFn = _ref9.doneFn; - var count = 0; - var didError = false; - return function (error, segment) { - if (didError) { - return; - } - - if (error) { - didError = true; // If there are errors, we have to abort any outstanding requests - - abortAll(activeXhrs); // Even though the requests above are aborted, and in theory we could wait until we - // handle the aborted events from those requests, there are some cases where we may - // never get an aborted event. For instance, if the network connection is lost and - // there were two requests, the first may have triggered an error immediately, while - // the second request remains unsent. In that case, the aborted algorithm will not - // trigger an abort: see https://xhr.spec.whatwg.org/#the-abort()-method - // - // We also can't rely on the ready state of the XHR, since the request that - // triggered the connection error may also show as a ready state of 0 (unsent). - // Therefore, we have to finish this group of requests immediately after the first - // seen error. - - return doneFn(error, segment); - } - - count += 1; - - if (count === activeXhrs.length) { - var segmentFinish = function segmentFinish() { - if (segment.encryptedBytes) { - return decryptSegment({ - decryptionWorker: decryptionWorker, - segment: segment, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - } // Otherwise, everything is ready just continue - - - handleSegmentBytes({ - segment: segment, - bytes: segment.bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - }; // Keep track of when *all* of the requests have completed - - - segment.endOfAllRequests = Date.now(); - - if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) { - return decrypt({ - decryptionWorker: decryptionWorker, - // add -init to the "id" to differentiate between segment - // and init segment decryption, just in case they happen - // at the same time at some point in the future. - id: segment.requestId + '-init', - encryptedBytes: segment.map.encryptedBytes, - key: segment.map.key - }, function (decryptedBytes) { - segment.map.bytes = decryptedBytes; - parseInitSegment(segment, function (parseError) { - if (parseError) { - abortAll(activeXhrs); - return doneFn(parseError, segment); - } - - segmentFinish(); - }); - }); - } - - segmentFinish(); - } - }; - }; - /** - * Calls the abort callback if any request within the batch was aborted. Will only call - * the callback once per batch of requests, even if multiple were aborted. - * - * @param {Object} loadendState - state to check to see if the abort function was called - * @param {Function} abortFn - callback to call for abort - */ - - - var handleLoadEnd = function handleLoadEnd(_ref10) { - var loadendState = _ref10.loadendState, - abortFn = _ref10.abortFn; - return function (event) { - var request = event.target; - - if (request.aborted && abortFn && !loadendState.calledAbortFn) { - abortFn(); - loadendState.calledAbortFn = true; - } - }; - }; - /** - * Simple progress event callback handler that gathers some stats before - * executing a provided callback with the `segment` object - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} progressFn - a callback that is executed each time a progress event - * is received - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Event} event - the progress event object from XMLHttpRequest - */ - - - var handleProgress = function handleProgress(_ref11) { - var segment = _ref11.segment, - progressFn = _ref11.progressFn; - _ref11.trackInfoFn; - _ref11.timingInfoFn; - _ref11.videoSegmentTimingInfoFn; - _ref11.audioSegmentTimingInfoFn; - _ref11.id3Fn; - _ref11.captionsFn; - _ref11.isEndOfTimeline; - _ref11.endedTimelineFn; - _ref11.dataFn; - return function (event) { - var request = event.target; - - if (request.aborted) { - return; - } - - segment.stats = videojs__default['default'].mergeOptions(segment.stats, getProgressStats(event)); // record the time that we receive the first byte of data - - if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) { - segment.stats.firstBytesReceivedAt = Date.now(); - } - - return progressFn(event, segment); - }; - }; - /** - * Load all resources and does any processing necessary for a media-segment - * - * Features: - * decrypts the media-segment if it has a key uri and an iv - * aborts *all* requests if *any* one request fails - * - * The segment object, at minimum, has the following format: - * { - * resolvedUri: String, - * [transmuxer]: Object, - * [byterange]: { - * offset: Number, - * length: Number - * }, - * [key]: { - * resolvedUri: String - * [byterange]: { - * offset: Number, - * length: Number - * }, - * iv: { - * bytes: Uint32Array - * } - * }, - * [map]: { - * resolvedUri: String, - * [byterange]: { - * offset: Number, - * length: Number - * }, - * [bytes]: Uint8Array - * } - * } - * ...where [name] denotes optional properties - * - * @param {Function} xhr - an instance of the xhr wrapper in xhr.js - * @param {Object} xhrOptions - the base options to provide to all xhr requests - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 - * decryption routines - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} abortFn - a callback called (only once) if any piece of a request was - * aborted - * @param {Function} progressFn - a callback that receives progress events from the main - * segment's xhr request - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} id3Fn - a callback that receives ID3 metadata - * @param {Function} captionsFn - a callback that receives captions - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that receives data from the main segment's xhr - * request, transmuxed if needed - * @param {Function} doneFn - a callback that is executed only once all requests have - * succeeded or failed - * @return {Function} a function that, when invoked, immediately aborts all - * outstanding requests - */ - - - var mediaSegmentRequest = function mediaSegmentRequest(_ref12) { - var xhr = _ref12.xhr, - xhrOptions = _ref12.xhrOptions, - decryptionWorker = _ref12.decryptionWorker, - segment = _ref12.segment, - abortFn = _ref12.abortFn, - progressFn = _ref12.progressFn, - trackInfoFn = _ref12.trackInfoFn, - timingInfoFn = _ref12.timingInfoFn, - videoSegmentTimingInfoFn = _ref12.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref12.audioSegmentTimingInfoFn, - id3Fn = _ref12.id3Fn, - captionsFn = _ref12.captionsFn, - isEndOfTimeline = _ref12.isEndOfTimeline, - endedTimelineFn = _ref12.endedTimelineFn, - dataFn = _ref12.dataFn, - doneFn = _ref12.doneFn; - var activeXhrs = []; - var finishProcessingFn = waitForCompletion({ - activeXhrs: activeXhrs, - decryptionWorker: decryptionWorker, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); // optionally, request the decryption key - - if (segment.key && !segment.key.bytes) { - var objects = [segment.key]; - - if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) { - objects.push(segment.map.key); - } - - var keyRequestOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.key.resolvedUri, - responseType: 'arraybuffer' - }); - var keyRequestCallback = handleKeyResponse(segment, objects, finishProcessingFn); - var keyXhr = xhr(keyRequestOptions, keyRequestCallback); - activeXhrs.push(keyXhr); - } // optionally, request the associated media init segment - - - if (segment.map && !segment.map.bytes) { - var differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri); - - if (differentMapKey) { - var mapKeyRequestOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.map.key.resolvedUri, - responseType: 'arraybuffer' - }); - var mapKeyRequestCallback = handleKeyResponse(segment, [segment.map.key], finishProcessingFn); - var mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback); - activeXhrs.push(mapKeyXhr); - } - - var initSegmentOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.map.resolvedUri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment.map) - }); - var initSegmentRequestCallback = handleInitSegmentResponse({ - segment: segment, - finishProcessingFn: finishProcessingFn - }); - var initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback); - activeXhrs.push(initSegmentXhr); - } - - var segmentRequestOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.part && segment.part.resolvedUri || segment.resolvedUri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment) - }); - var segmentRequestCallback = handleSegmentResponse({ - segment: segment, - finishProcessingFn: finishProcessingFn, - responseType: segmentRequestOptions.responseType - }); - var segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback); - segmentXhr.addEventListener('progress', handleProgress({ - segment: segment, - progressFn: progressFn, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn - })); - activeXhrs.push(segmentXhr); // since all parts of the request must be considered, but should not make callbacks - // multiple times, provide a shared state object - - var loadendState = {}; - activeXhrs.forEach(function (activeXhr) { - activeXhr.addEventListener('loadend', handleLoadEnd({ - loadendState: loadendState, - abortFn: abortFn - })); - }); - return function () { - return abortAll(activeXhrs); - }; - }; - - /** - * @file - codecs.js - Handles tasks regarding codec strings such as translating them to - * codec strings, or translating codec strings into objects that can be examined. - */ - var logFn$1 = logger('CodecUtils'); - /** - * Returns a set of codec strings parsed from the playlist or the default - * codec strings if no codecs were specified in the playlist - * - * @param {Playlist} media the current media playlist - * @return {Object} an object with the video and audio codecs - */ - - var getCodecs = function getCodecs(media) { - // if the codecs were explicitly specified, use them instead of the - // defaults - var mediaAttributes = media.attributes || {}; - - if (mediaAttributes.CODECS) { - return parseCodecs(mediaAttributes.CODECS); - } - }; - - var isMaat = function isMaat(master, media) { - var mediaAttributes = media.attributes || {}; - return master && master.mediaGroups && master.mediaGroups.AUDIO && mediaAttributes.AUDIO && master.mediaGroups.AUDIO[mediaAttributes.AUDIO]; - }; - var isMuxed = function isMuxed(master, media) { - if (!isMaat(master, media)) { - return true; - } - - var mediaAttributes = media.attributes || {}; - var audioGroup = master.mediaGroups.AUDIO[mediaAttributes.AUDIO]; - - for (var groupId in audioGroup) { - // If an audio group has a URI (the case for HLS, as HLS will use external playlists), - // or there are listed playlists (the case for DASH, as the manifest will have already - // provided all of the details necessary to generate the audio playlist, as opposed to - // HLS' externally requested playlists), then the content is demuxed. - if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) { - return true; - } - } - - return false; - }; - var unwrapCodecList = function unwrapCodecList(codecList) { - var codecs = {}; - codecList.forEach(function (_ref) { - var mediaType = _ref.mediaType, - type = _ref.type, - details = _ref.details; - codecs[mediaType] = codecs[mediaType] || []; - codecs[mediaType].push(translateLegacyCodec("" + type + details)); - }); - Object.keys(codecs).forEach(function (mediaType) { - if (codecs[mediaType].length > 1) { - logFn$1("multiple " + mediaType + " codecs found as attributes: " + codecs[mediaType].join(', ') + ". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."); - codecs[mediaType] = null; - return; - } - - codecs[mediaType] = codecs[mediaType][0]; - }); - return codecs; - }; - var codecCount = function codecCount(codecObj) { - var count = 0; - - if (codecObj.audio) { - count++; - } - - if (codecObj.video) { - count++; - } - - return count; - }; - /** - * Calculates the codec strings for a working configuration of - * SourceBuffers to play variant streams in a master playlist. If - * there is no possible working configuration, an empty object will be - * returned. - * - * @param master {Object} the m3u8 object for the master playlist - * @param media {Object} the m3u8 object for the variant playlist - * @return {Object} the codec strings. - * - * @private - */ - - var codecsForPlaylist = function codecsForPlaylist(master, media) { - var mediaAttributes = media.attributes || {}; - var codecInfo = unwrapCodecList(getCodecs(media) || []); // HLS with multiple-audio tracks must always get an audio codec. - // Put another way, there is no way to have a video-only multiple-audio HLS! - - if (isMaat(master, media) && !codecInfo.audio) { - if (!isMuxed(master, media)) { - // It is possible for codecs to be specified on the audio media group playlist but - // not on the rendition playlist. This is mostly the case for DASH, where audio and - // video are always separate (and separately specified). - var defaultCodecs = unwrapCodecList(codecsFromDefault(master, mediaAttributes.AUDIO) || []); - - if (defaultCodecs.audio) { - codecInfo.audio = defaultCodecs.audio; - } - } - } - - return codecInfo; - }; - - var logFn = logger('PlaylistSelector'); - - var representationToString = function representationToString(representation) { - if (!representation || !representation.playlist) { - return; - } - - var playlist = representation.playlist; - return JSON.stringify({ - id: playlist.id, - bandwidth: representation.bandwidth, - width: representation.width, - height: representation.height, - codecs: playlist.attributes && playlist.attributes.CODECS || '' - }); - }; // Utilities - - /** - * Returns the CSS value for the specified property on an element - * using `getComputedStyle`. Firefox has a long-standing issue where - * getComputedStyle() may return null when running in an iframe with - * `display: none`. - * - * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - * @param {HTMLElement} el the htmlelement to work on - * @param {string} the proprety to get the style for - */ - - - var safeGetComputedStyle = function safeGetComputedStyle(el, property) { - if (!el) { - return ''; - } - - var result = window__default['default'].getComputedStyle(el); - - if (!result) { - return ''; - } - - return result[property]; - }; - /** - * Resuable stable sort function - * - * @param {Playlists} array - * @param {Function} sortFn Different comparators - * @function stableSort - */ - - - var stableSort = function stableSort(array, sortFn) { - var newArray = array.slice(); - array.sort(function (left, right) { - var cmp = sortFn(left, right); - - if (cmp === 0) { - return newArray.indexOf(left) - newArray.indexOf(right); - } - - return cmp; - }); - }; - /** - * A comparator function to sort two playlist object by bandwidth. - * - * @param {Object} left a media playlist object - * @param {Object} right a media playlist object - * @return {number} Greater than zero if the bandwidth attribute of - * left is greater than the corresponding attribute of right. Less - * than zero if the bandwidth of right is greater than left and - * exactly zero if the two are equal. - */ - - - var comparePlaylistBandwidth = function comparePlaylistBandwidth(left, right) { - var leftBandwidth; - var rightBandwidth; - - if (left.attributes.BANDWIDTH) { - leftBandwidth = left.attributes.BANDWIDTH; - } - - leftBandwidth = leftBandwidth || window__default['default'].Number.MAX_VALUE; - - if (right.attributes.BANDWIDTH) { - rightBandwidth = right.attributes.BANDWIDTH; - } - - rightBandwidth = rightBandwidth || window__default['default'].Number.MAX_VALUE; - return leftBandwidth - rightBandwidth; - }; - /** - * A comparator function to sort two playlist object by resolution (width). - * - * @param {Object} left a media playlist object - * @param {Object} right a media playlist object - * @return {number} Greater than zero if the resolution.width attribute of - * left is greater than the corresponding attribute of right. Less - * than zero if the resolution.width of right is greater than left and - * exactly zero if the two are equal. - */ - - var comparePlaylistResolution = function comparePlaylistResolution(left, right) { - var leftWidth; - var rightWidth; - - if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) { - leftWidth = left.attributes.RESOLUTION.width; - } - - leftWidth = leftWidth || window__default['default'].Number.MAX_VALUE; - - if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) { - rightWidth = right.attributes.RESOLUTION.width; - } - - rightWidth = rightWidth || window__default['default'].Number.MAX_VALUE; // NOTE - Fallback to bandwidth sort as appropriate in cases where multiple renditions - // have the same media dimensions/ resolution - - if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) { - return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH; - } - - return leftWidth - rightWidth; - }; - /** - * Chooses the appropriate media playlist based on bandwidth and player size - * - * @param {Object} master - * Object representation of the master manifest - * @param {number} playerBandwidth - * Current calculated bandwidth of the player - * @param {number} playerWidth - * Current width of the player element (should account for the device pixel ratio) - * @param {number} playerHeight - * Current height of the player element (should account for the device pixel ratio) - * @param {boolean} limitRenditionByPlayerDimensions - * True if the player width and height should be used during the selection, false otherwise - * @param {Object} masterPlaylistController - * the current masterPlaylistController object - * @return {Playlist} the highest bitrate playlist less than the - * currently detected bandwidth, accounting for some amount of - * bandwidth variance - */ - - var simpleSelector = function simpleSelector(master, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, masterPlaylistController) { - // If we end up getting called before `master` is available, exit early - if (!master) { - return; - } - - var options = { - bandwidth: playerBandwidth, - width: playerWidth, - height: playerHeight, - limitRenditionByPlayerDimensions: limitRenditionByPlayerDimensions - }; - var playlists = master.playlists; // if playlist is audio only, select between currently active audio group playlists. - - if (Playlist.isAudioOnly(master)) { - playlists = masterPlaylistController.getAudioTrackPlaylists_(); // add audioOnly to options so that we log audioOnly: true - // at the buttom of this function for debugging. - - options.audioOnly = true; - } // convert the playlists to an intermediary representation to make comparisons easier - - - var sortedPlaylistReps = playlists.map(function (playlist) { - var bandwidth; - var width = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width; - var height = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height; - bandwidth = playlist.attributes && playlist.attributes.BANDWIDTH; - bandwidth = bandwidth || window__default['default'].Number.MAX_VALUE; - return { - bandwidth: bandwidth, - width: width, - height: height, - playlist: playlist - }; - }); - stableSort(sortedPlaylistReps, function (left, right) { - return left.bandwidth - right.bandwidth; - }); // filter out any playlists that have been excluded due to - // incompatible configurations - - sortedPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return !Playlist.isIncompatible(rep.playlist); - }); // filter out any playlists that have been disabled manually through the representations - // api or blacklisted temporarily due to playback errors. - - var enabledPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return Playlist.isEnabled(rep.playlist); - }); - - if (!enabledPlaylistReps.length) { - // if there are no enabled playlists, then they have all been blacklisted or disabled - // by the user through the representations api. In this case, ignore blacklisting and - // fallback to what the user wants by using playlists the user has not disabled. - enabledPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return !Playlist.isDisabled(rep.playlist); - }); - } // filter out any variant that has greater effective bitrate - // than the current estimated bandwidth - - - var bandwidthPlaylistReps = enabledPlaylistReps.filter(function (rep) { - return rep.bandwidth * Config.BANDWIDTH_VARIANCE < playerBandwidth; - }); - var highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1]; // get all of the renditions with the same (highest) bandwidth - // and then taking the very first element - - var bandwidthBestRep = bandwidthPlaylistReps.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; // if we're not going to limit renditions by player size, make an early decision. - - if (limitRenditionByPlayerDimensions === false) { - var _chosenRep = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0]; - - if (_chosenRep && _chosenRep.playlist) { - var type = 'sortedPlaylistReps'; - - if (bandwidthBestRep) { - type = 'bandwidthBestRep'; - } - - if (enabledPlaylistReps[0]) { - type = 'enabledPlaylistReps'; - } - - logFn("choosing " + representationToString(_chosenRep) + " using " + type + " with options", options); - return _chosenRep.playlist; - } - - logFn('could not choose a playlist with options', options); - return null; - } // filter out playlists without resolution information - - - var haveResolution = bandwidthPlaylistReps.filter(function (rep) { - return rep.width && rep.height; - }); // sort variants by resolution - - stableSort(haveResolution, function (left, right) { - return left.width - right.width; - }); // if we have the exact resolution as the player use it - - var resolutionBestRepList = haveResolution.filter(function (rep) { - return rep.width === playerWidth && rep.height === playerHeight; - }); - highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1]; // ensure that we pick the highest bandwidth variant that have exact resolution - - var resolutionBestRep = resolutionBestRepList.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - var resolutionPlusOneList; - var resolutionPlusOneSmallest; - var resolutionPlusOneRep; // find the smallest variant that is larger than the player - // if there is no match of exact resolution - - if (!resolutionBestRep) { - resolutionPlusOneList = haveResolution.filter(function (rep) { - return rep.width > playerWidth || rep.height > playerHeight; - }); // find all the variants have the same smallest resolution - - resolutionPlusOneSmallest = resolutionPlusOneList.filter(function (rep) { - return rep.width === resolutionPlusOneList[0].width && rep.height === resolutionPlusOneList[0].height; - }); // ensure that we also pick the highest bandwidth variant that - // is just-larger-than the video player - - highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1]; - resolutionPlusOneRep = resolutionPlusOneSmallest.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - } // fallback chain of variants - - - var chosenRep = resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0]; - - if (chosenRep && chosenRep.playlist) { - var _type = 'sortedPlaylistReps'; - - if (resolutionPlusOneRep) { - _type = 'resolutionPlusOneRep'; - } else if (resolutionBestRep) { - _type = 'resolutionBestRep'; - } else if (bandwidthBestRep) { - _type = 'bandwidthBestRep'; - } else if (enabledPlaylistReps[0]) { - _type = 'enabledPlaylistReps'; - } - - logFn("choosing " + representationToString(chosenRep) + " using " + _type + " with options", options); - return chosenRep.playlist; - } - - logFn('could not choose a playlist with options', options); - return null; - }; - - /** - * Chooses the appropriate media playlist based on the most recent - * bandwidth estimate and the player size. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @return {Playlist} the highest bitrate playlist less than the - * currently detected bandwidth, accounting for some amount of - * bandwidth variance - */ - - var lastBandwidthSelector = function lastBandwidthSelector() { - var pixelRatio = this.useDevicePixelRatio ? window__default['default'].devicePixelRatio || 1 : 1; - return simpleSelector(this.playlists.master, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); - }; - /** - * Chooses the appropriate media playlist based on an - * exponential-weighted moving average of the bandwidth after - * filtering for player size. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @param {number} decay - a number between 0 and 1. Higher values of - * this parameter will cause previous bandwidth estimates to lose - * significance more quickly. - * @return {Function} a function which can be invoked to create a new - * playlist selector function. - * @see https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average - */ - - var movingAverageBandwidthSelector = function movingAverageBandwidthSelector(decay) { - var average = -1; - var lastSystemBandwidth = -1; - - if (decay < 0 || decay > 1) { - throw new Error('Moving average bandwidth decay must be between 0 and 1.'); - } - - return function () { - var pixelRatio = this.useDevicePixelRatio ? window__default['default'].devicePixelRatio || 1 : 1; - - if (average < 0) { - average = this.systemBandwidth; - lastSystemBandwidth = this.systemBandwidth; - } // stop the average value from decaying for every 250ms - // when the systemBandwidth is constant - // and - // stop average from setting to a very low value when the - // systemBandwidth becomes 0 in case of chunk cancellation - - - if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) { - average = decay * this.systemBandwidth + (1 - decay) * average; - lastSystemBandwidth = this.systemBandwidth; - } - - return simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); - }; - }; - /** - * Chooses the appropriate media playlist based on the potential to rebuffer - * - * @param {Object} settings - * Object of information required to use this selector - * @param {Object} settings.master - * Object representation of the master manifest - * @param {number} settings.currentTime - * The current time of the player - * @param {number} settings.bandwidth - * Current measured bandwidth - * @param {number} settings.duration - * Duration of the media - * @param {number} settings.segmentDuration - * Segment duration to be used in round trip time calculations - * @param {number} settings.timeUntilRebuffer - * Time left in seconds until the player has to rebuffer - * @param {number} settings.currentTimeline - * The current timeline segments are being loaded from - * @param {SyncController} settings.syncController - * SyncController for determining if we have a sync point for a given playlist - * @return {Object|null} - * {Object} return.playlist - * The highest bandwidth playlist with the least amount of rebuffering - * {Number} return.rebufferingImpact - * The amount of time in seconds switching to this playlist will rebuffer. A - * negative value means that switching will cause zero rebuffering. - */ - - var minRebufferMaxBandwidthSelector = function minRebufferMaxBandwidthSelector(settings) { - var master = settings.master, - currentTime = settings.currentTime, - bandwidth = settings.bandwidth, - duration = settings.duration, - segmentDuration = settings.segmentDuration, - timeUntilRebuffer = settings.timeUntilRebuffer, - currentTimeline = settings.currentTimeline, - syncController = settings.syncController; // filter out any playlists that have been excluded due to - // incompatible configurations - - var compatiblePlaylists = master.playlists.filter(function (playlist) { - return !Playlist.isIncompatible(playlist); - }); // filter out any playlists that have been disabled manually through the representations - // api or blacklisted temporarily due to playback errors. - - var enabledPlaylists = compatiblePlaylists.filter(Playlist.isEnabled); - - if (!enabledPlaylists.length) { - // if there are no enabled playlists, then they have all been blacklisted or disabled - // by the user through the representations api. In this case, ignore blacklisting and - // fallback to what the user wants by using playlists the user has not disabled. - enabledPlaylists = compatiblePlaylists.filter(function (playlist) { - return !Playlist.isDisabled(playlist); - }); - } - - var bandwidthPlaylists = enabledPlaylists.filter(Playlist.hasAttribute.bind(null, 'BANDWIDTH')); - var rebufferingEstimates = bandwidthPlaylists.map(function (playlist) { - var syncPoint = syncController.getSyncPoint(playlist, duration, currentTimeline, currentTime); // If there is no sync point for this playlist, switching to it will require a - // sync request first. This will double the request time - - var numRequests = syncPoint ? 1 : 2; - var requestTimeEstimate = Playlist.estimateSegmentRequestTime(segmentDuration, bandwidth, playlist); - var rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer; - return { - playlist: playlist, - rebufferingImpact: rebufferingImpact - }; - }); - var noRebufferingPlaylists = rebufferingEstimates.filter(function (estimate) { - return estimate.rebufferingImpact <= 0; - }); // Sort by bandwidth DESC - - stableSort(noRebufferingPlaylists, function (a, b) { - return comparePlaylistBandwidth(b.playlist, a.playlist); - }); - - if (noRebufferingPlaylists.length) { - return noRebufferingPlaylists[0]; - } - - stableSort(rebufferingEstimates, function (a, b) { - return a.rebufferingImpact - b.rebufferingImpact; - }); - return rebufferingEstimates[0] || null; - }; - /** - * Chooses the appropriate media playlist, which in this case is the lowest bitrate - * one with video. If no renditions with video exist, return the lowest audio rendition. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @return {Object|null} - * {Object} return.playlist - * The lowest bitrate playlist that contains a video codec. If no such rendition - * exists pick the lowest audio rendition. - */ - - var lowestBitrateCompatibleVariantSelector = function lowestBitrateCompatibleVariantSelector() { - var _this = this; - - // filter out any playlists that have been excluded due to - // incompatible configurations or playback errors - var playlists = this.playlists.master.playlists.filter(Playlist.isEnabled); // Sort ascending by bitrate - - stableSort(playlists, function (a, b) { - return comparePlaylistBandwidth(a, b); - }); // Parse and assume that playlists with no video codec have no video - // (this is not necessarily true, although it is generally true). - // - // If an entire manifest has no valid videos everything will get filtered - // out. - - var playlistsWithVideo = playlists.filter(function (playlist) { - return !!codecsForPlaylist(_this.playlists.master, playlist).video; - }); - return playlistsWithVideo[0] || null; - }; - - /** - * Combine all segments into a single Uint8Array - * - * @param {Object} segmentObj - * @return {Uint8Array} concatenated bytes - * @private - */ - var concatSegments = function concatSegments(segmentObj) { - var offset = 0; - var tempBuffer; - - if (segmentObj.bytes) { - tempBuffer = new Uint8Array(segmentObj.bytes); // combine the individual segments into one large typed-array - - segmentObj.segments.forEach(function (segment) { - tempBuffer.set(segment, offset); - offset += segment.byteLength; - }); - } - - return tempBuffer; - }; - - /** - * @file text-tracks.js - */ - /** - * Create captions text tracks on video.js if they do not exist - * - * @param {Object} inbandTextTracks a reference to current inbandTextTracks - * @param {Object} tech the video.js tech - * @param {Object} captionStream the caption stream to create - * @private - */ - - var createCaptionsTrackIfNotExists = function createCaptionsTrackIfNotExists(inbandTextTracks, tech, captionStream) { - if (!inbandTextTracks[captionStream]) { - tech.trigger({ - type: 'usage', - name: 'vhs-608' - }); - tech.trigger({ - type: 'usage', - name: 'hls-608' - }); - var instreamId = captionStream; // we need to translate SERVICEn for 708 to how mux.js currently labels them - - if (/^cc708_/.test(captionStream)) { - instreamId = 'SERVICE' + captionStream.split('_')[1]; - } - - var track = tech.textTracks().getTrackById(instreamId); - - if (track) { - // Resuse an existing track with a CC# id because this was - // very likely created by videojs-contrib-hls from information - // in the m3u8 for us to use - inbandTextTracks[captionStream] = track; - } else { - // This section gets called when we have caption services that aren't specified in the manifest. - // Manifest level caption services are handled in media-groups.js under CLOSED-CAPTIONS. - var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {}; - var label = captionStream; - var language = captionStream; - var def = false; - var captionService = captionServices[instreamId]; - - if (captionService) { - label = captionService.label; - language = captionService.language; - def = captionService.default; - } // Otherwise, create a track with the default `CC#` label and - // without a language - - - inbandTextTracks[captionStream] = tech.addRemoteTextTrack({ - kind: 'captions', - id: instreamId, - // TODO: investigate why this doesn't seem to turn the caption on by default - default: def, - label: label, - language: language - }, false).track; - } - } - }; - /** - * Add caption text track data to a source handler given an array of captions - * - * @param {Object} - * @param {Object} inbandTextTracks the inband text tracks - * @param {number} timestampOffset the timestamp offset of the source buffer - * @param {Array} captionArray an array of caption data - * @private - */ - - var addCaptionData = function addCaptionData(_ref) { - var inbandTextTracks = _ref.inbandTextTracks, - captionArray = _ref.captionArray, - timestampOffset = _ref.timestampOffset; - - if (!captionArray) { - return; - } - - var Cue = window__default['default'].WebKitDataCue || window__default['default'].VTTCue; - captionArray.forEach(function (caption) { - var track = caption.stream; - inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset, caption.endTime + timestampOffset, caption.text)); - }); - }; - /** - * Define properties on a cue for backwards compatability, - * but warn the user that the way that they are using it - * is depricated and will be removed at a later date. - * - * @param {Cue} cue the cue to add the properties on - * @private - */ - - var deprecateOldCue = function deprecateOldCue(cue) { - Object.defineProperties(cue.frame, { - id: { - get: function get() { - videojs__default['default'].log.warn('cue.frame.id is deprecated. Use cue.value.key instead.'); - return cue.value.key; - } - }, - value: { - get: function get() { - videojs__default['default'].log.warn('cue.frame.value is deprecated. Use cue.value.data instead.'); - return cue.value.data; - } - }, - privateData: { - get: function get() { - videojs__default['default'].log.warn('cue.frame.privateData is deprecated. Use cue.value.data instead.'); - return cue.value.data; - } - } - }); - }; - /** - * Add metadata text track data to a source handler given an array of metadata - * - * @param {Object} - * @param {Object} inbandTextTracks the inband text tracks - * @param {Array} metadataArray an array of meta data - * @param {number} timestampOffset the timestamp offset of the source buffer - * @param {number} videoDuration the duration of the video - * @private - */ - - - var addMetadata = function addMetadata(_ref2) { - var inbandTextTracks = _ref2.inbandTextTracks, - metadataArray = _ref2.metadataArray, - timestampOffset = _ref2.timestampOffset, - videoDuration = _ref2.videoDuration; - - if (!metadataArray) { - return; - } - - var Cue = window__default['default'].WebKitDataCue || window__default['default'].VTTCue; - var metadataTrack = inbandTextTracks.metadataTrack_; - - if (!metadataTrack) { - return; - } - - metadataArray.forEach(function (metadata) { - var time = metadata.cueTime + timestampOffset; // if time isn't a finite number between 0 and Infinity, like NaN, - // ignore this bit of metadata. - // This likely occurs when you have an non-timed ID3 tag like TIT2, - // which is the "Title/Songname/Content description" frame - - if (typeof time !== 'number' || window__default['default'].isNaN(time) || time < 0 || !(time < Infinity)) { - return; - } - - metadata.frames.forEach(function (frame) { - var cue = new Cue(time, time, frame.value || frame.url || frame.data || ''); - cue.frame = frame; - cue.value = frame; - deprecateOldCue(cue); - metadataTrack.addCue(cue); - }); - }); - - if (!metadataTrack.cues || !metadataTrack.cues.length) { - return; - } // Updating the metadeta cues so that - // the endTime of each cue is the startTime of the next cue - // the endTime of last cue is the duration of the video - - - var cues = metadataTrack.cues; - var cuesArray = []; // Create a copy of the TextTrackCueList... - // ...disregarding cues with a falsey value - - for (var i = 0; i < cues.length; i++) { - if (cues[i]) { - cuesArray.push(cues[i]); - } - } // Group cues by their startTime value - - - var cuesGroupedByStartTime = cuesArray.reduce(function (obj, cue) { - var timeSlot = obj[cue.startTime] || []; - timeSlot.push(cue); - obj[cue.startTime] = timeSlot; - return obj; - }, {}); // Sort startTimes by ascending order - - var sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort(function (a, b) { - return Number(a) - Number(b); - }); // Map each cue group's endTime to the next group's startTime - - sortedStartTimes.forEach(function (startTime, idx) { - var cueGroup = cuesGroupedByStartTime[startTime]; - var nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration; // Map each cue's endTime the next group's startTime - - cueGroup.forEach(function (cue) { - cue.endTime = nextTime; - }); - }); - }; - /** - * Create metadata text track on video.js if it does not exist - * - * @param {Object} inbandTextTracks a reference to current inbandTextTracks - * @param {string} dispatchType the inband metadata track dispatch type - * @param {Object} tech the video.js tech - * @private - */ - - var createMetadataTrackIfNotExists = function createMetadataTrackIfNotExists(inbandTextTracks, dispatchType, tech) { - if (inbandTextTracks.metadataTrack_) { - return; - } - - inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({ - kind: 'metadata', - label: 'Timed Metadata' - }, false).track; - inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType; - }; - /** - * Remove cues from a track on video.js. - * - * @param {Double} start start of where we should remove the cue - * @param {Double} end end of where the we should remove the cue - * @param {Object} track the text track to remove the cues from - * @private - */ - - var removeCuesFromTrack = function removeCuesFromTrack(start, end, track) { - var i; - var cue; - - if (!track) { - return; - } - - if (!track.cues) { - return; - } - - i = track.cues.length; - - while (i--) { - cue = track.cues[i]; // Remove any cue within the provided start and end time - - if (cue.startTime >= start && cue.endTime <= end) { - track.removeCue(cue); - } - } - }; - /** - * Remove duplicate cues from a track on video.js (a cue is considered a - * duplicate if it has the same time interval and text as another) - * - * @param {Object} track the text track to remove the duplicate cues from - * @private - */ - - var removeDuplicateCuesFromTrack = function removeDuplicateCuesFromTrack(track) { - var cues = track.cues; - - if (!cues) { - return; - } - - for (var i = 0; i < cues.length; i++) { - var duplicates = []; - var occurrences = 0; - - for (var j = 0; j < cues.length; j++) { - if (cues[i].startTime === cues[j].startTime && cues[i].endTime === cues[j].endTime && cues[i].text === cues[j].text) { - occurrences++; - - if (occurrences > 1) { - duplicates.push(cues[j]); - } - } - } - - if (duplicates.length) { - duplicates.forEach(function (dupe) { - return track.removeCue(dupe); - }); - } - } - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var ONE_SECOND_IN_TS = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - - /** - * Returns a list of gops in the buffer that have a pts value of 3 seconds or more in - * front of current time. - * - * @param {Array} buffer - * The current buffer of gop information - * @param {number} currentTime - * The current time - * @param {Double} mapping - * Offset to map display time to stream presentation time - * @return {Array} - * List of gops considered safe to append over - */ - - var gopsSafeToAlignWith = function gopsSafeToAlignWith(buffer, currentTime, mapping) { - if (typeof currentTime === 'undefined' || currentTime === null || !buffer.length) { - return []; - } // pts value for current time + 3 seconds to give a bit more wiggle room - - - var currentTimePts = Math.ceil((currentTime - mapping + 3) * clock.ONE_SECOND_IN_TS); - var i; - - for (i = 0; i < buffer.length; i++) { - if (buffer[i].pts > currentTimePts) { - break; - } - } - - return buffer.slice(i); - }; - /** - * Appends gop information (timing and byteLength) received by the transmuxer for the - * gops appended in the last call to appendBuffer - * - * @param {Array} buffer - * The current buffer of gop information - * @param {Array} gops - * List of new gop information - * @param {boolean} replace - * If true, replace the buffer with the new gop information. If false, append the - * new gop information to the buffer in the right location of time. - * @return {Array} - * Updated list of gop information - */ - - var updateGopBuffer = function updateGopBuffer(buffer, gops, replace) { - if (!gops.length) { - return buffer; - } - - if (replace) { - // If we are in safe append mode, then completely overwrite the gop buffer - // with the most recent appeneded data. This will make sure that when appending - // future segments, we only try to align with gops that are both ahead of current - // time and in the last segment appended. - return gops.slice(); - } - - var start = gops[0].pts; - var i = 0; - - for (i; i < buffer.length; i++) { - if (buffer[i].pts >= start) { - break; - } - } - - return buffer.slice(0, i).concat(gops); - }; - /** - * Removes gop information in buffer that overlaps with provided start and end - * - * @param {Array} buffer - * The current buffer of gop information - * @param {Double} start - * position to start the remove at - * @param {Double} end - * position to end the remove at - * @param {Double} mapping - * Offset to map display time to stream presentation time - */ - - var removeGopBuffer = function removeGopBuffer(buffer, start, end, mapping) { - var startPts = Math.ceil((start - mapping) * clock.ONE_SECOND_IN_TS); - var endPts = Math.ceil((end - mapping) * clock.ONE_SECOND_IN_TS); - var updatedBuffer = buffer.slice(); - var i = buffer.length; - - while (i--) { - if (buffer[i].pts <= endPts) { - break; - } - } - - if (i === -1) { - // no removal because end of remove range is before start of buffer - return updatedBuffer; - } - - var j = i + 1; - - while (j--) { - if (buffer[j].pts <= startPts) { - break; - } - } // clamp remove range start to 0 index - - - j = Math.max(j, 0); - updatedBuffer.splice(j, i - j + 1); - return updatedBuffer; - }; - - var shallowEqual = function shallowEqual(a, b) { - // if both are undefined - // or one or the other is undefined - // they are not equal - if (!a && !b || !a && b || a && !b) { - return false; - } // they are the same object and thus, equal - - - if (a === b) { - return true; - } // sort keys so we can make sure they have - // all the same keys later. - - - var akeys = Object.keys(a).sort(); - var bkeys = Object.keys(b).sort(); // different number of keys, not equal - - if (akeys.length !== bkeys.length) { - return false; - } - - for (var i = 0; i < akeys.length; i++) { - var key = akeys[i]; // different sorted keys, not equal - - if (key !== bkeys[i]) { - return false; - } // different values, not equal - - - if (a[key] !== b[key]) { - return false; - } - } - - return true; - }; - - // https://www.w3.org/TR/WebIDL-1/#quotaexceedederror - var QUOTA_EXCEEDED_ERR = 22; - - /** - * The segment loader has no recourse except to fetch a segment in the - * current playlist and use the internal timestamps in that segment to - * generate a syncPoint. This function returns a good candidate index - * for that process. - * - * @param {Array} segments - the segments array from a playlist. - * @return {number} An index of a segment from the playlist to load - */ - - var getSyncSegmentCandidate = function getSyncSegmentCandidate(currentTimeline, segments, targetTime) { - segments = segments || []; - var timelineSegments = []; - var time = 0; - - for (var i = 0; i < segments.length; i++) { - var segment = segments[i]; - - if (currentTimeline === segment.timeline) { - timelineSegments.push(i); - time += segment.duration; - - if (time > targetTime) { - return i; - } - } - } - - if (timelineSegments.length === 0) { - return 0; - } // default to the last timeline segment - - - return timelineSegments[timelineSegments.length - 1]; - }; // In the event of a quota exceeded error, keep at least one second of back buffer. This - // number was arbitrarily chosen and may be updated in the future, but seemed reasonable - // as a start to prevent any potential issues with removing content too close to the - // playhead. - - var MIN_BACK_BUFFER = 1; // in ms - - var CHECK_BUFFER_DELAY = 500; - - var finite = function finite(num) { - return typeof num === 'number' && isFinite(num); - }; // With most content hovering around 30fps, if a segment has a duration less than a half - // frame at 30fps or one frame at 60fps, the bandwidth and throughput calculations will - // not accurately reflect the rest of the content. - - - var MIN_SEGMENT_DURATION_TO_SAVE_STATS = 1 / 60; - var illegalMediaSwitch = function illegalMediaSwitch(loaderType, startingMedia, trackInfo) { - // Although these checks should most likely cover non 'main' types, for now it narrows - // the scope of our checks. - if (loaderType !== 'main' || !startingMedia || !trackInfo) { - return null; - } - - if (!trackInfo.hasAudio && !trackInfo.hasVideo) { - return 'Neither audio nor video found in segment.'; - } - - if (startingMedia.hasVideo && !trackInfo.hasVideo) { - return 'Only audio found in segment when we expected video.' + ' We can\'t switch to audio only from a stream that had video.' + ' To get rid of this message, please add codec information to the manifest.'; - } - - if (!startingMedia.hasVideo && trackInfo.hasVideo) { - return 'Video found in segment when we expected only audio.' + ' We can\'t switch to a stream with video from an audio only stream.' + ' To get rid of this message, please add codec information to the manifest.'; - } - - return null; - }; - /** - * Calculates a time value that is safe to remove from the back buffer without interrupting - * playback. - * - * @param {TimeRange} seekable - * The current seekable range - * @param {number} currentTime - * The current time of the player - * @param {number} targetDuration - * The target duration of the current playlist - * @return {number} - * Time that is safe to remove from the back buffer without interrupting playback - */ - - var safeBackBufferTrimTime = function safeBackBufferTrimTime(seekable, currentTime, targetDuration) { - // 30 seconds before the playhead provides a safe default for trimming. - // - // Choosing a reasonable default is particularly important for high bitrate content and - // VOD videos/live streams with large windows, as the buffer may end up overfilled and - // throw an APPEND_BUFFER_ERR. - var trimTime = currentTime - Config.BACK_BUFFER_LENGTH; - - if (seekable.length) { - // Some live playlists may have a shorter window of content than the full allowed back - // buffer. For these playlists, don't save content that's no longer within the window. - trimTime = Math.max(trimTime, seekable.start(0)); - } // Don't remove within target duration of the current time to avoid the possibility of - // removing the GOP currently being played, as removing it can cause playback stalls. - - - var maxTrimTime = currentTime - targetDuration; - return Math.min(maxTrimTime, trimTime); - }; - - var segmentInfoString = function segmentInfoString(segmentInfo) { - var startOfSegment = segmentInfo.startOfSegment, - duration = segmentInfo.duration, - segment = segmentInfo.segment, - part = segmentInfo.part, - _segmentInfo$playlist = segmentInfo.playlist, - seq = _segmentInfo$playlist.mediaSequence, - id = _segmentInfo$playlist.id, - _segmentInfo$playlist2 = _segmentInfo$playlist.segments, - segments = _segmentInfo$playlist2 === void 0 ? [] : _segmentInfo$playlist2, - index = segmentInfo.mediaIndex, - partIndex = segmentInfo.partIndex, - timeline = segmentInfo.timeline; - var segmentLen = segments.length - 1; - var selection = 'mediaIndex/partIndex increment'; - - if (segmentInfo.getMediaInfoForTime) { - selection = "getMediaInfoForTime (" + segmentInfo.getMediaInfoForTime + ")"; - } else if (segmentInfo.isSyncRequest) { - selection = 'getSyncSegmentCandidate (isSyncRequest)'; - } - - var hasPartIndex = typeof partIndex === 'number'; - var name = segmentInfo.segment.uri ? 'segment' : 'pre-segment'; - var zeroBasedPartCount = hasPartIndex ? getKnownPartCount({ - preloadSegment: segment - }) - 1 : 0; - return name + " [" + (seq + index) + "/" + (seq + segmentLen) + "]" + (hasPartIndex ? " part [" + partIndex + "/" + zeroBasedPartCount + "]" : '') + (" segment start/end [" + segment.start + " => " + segment.end + "]") + (hasPartIndex ? " part start/end [" + part.start + " => " + part.end + "]" : '') + (" startOfSegment [" + startOfSegment + "]") + (" duration [" + duration + "]") + (" timeline [" + timeline + "]") + (" selected by [" + selection + "]") + (" playlist [" + id + "]"); - }; - - var timingInfoPropertyForMedia = function timingInfoPropertyForMedia(mediaType) { - return mediaType + "TimingInfo"; - }; - /** - * Returns the timestamp offset to use for the segment. - * - * @param {number} segmentTimeline - * The timeline of the segment - * @param {number} currentTimeline - * The timeline currently being followed by the loader - * @param {number} startOfSegment - * The estimated segment start - * @param {TimeRange[]} buffered - * The loader's buffer - * @param {boolean} overrideCheck - * If true, no checks are made to see if the timestamp offset value should be set, - * but sets it directly to a value. - * - * @return {number|null} - * Either a number representing a new timestamp offset, or null if the segment is - * part of the same timeline - */ - - - var timestampOffsetForSegment = function timestampOffsetForSegment(_ref) { - var segmentTimeline = _ref.segmentTimeline, - currentTimeline = _ref.currentTimeline, - startOfSegment = _ref.startOfSegment, - buffered = _ref.buffered, - overrideCheck = _ref.overrideCheck; - - // Check to see if we are crossing a discontinuity to see if we need to set the - // timestamp offset on the transmuxer and source buffer. - // - // Previously, we changed the timestampOffset if the start of this segment was less than - // the currently set timestampOffset, but this isn't desirable as it can produce bad - // behavior, especially around long running live streams. - if (!overrideCheck && segmentTimeline === currentTimeline) { - return null; - } // When changing renditions, it's possible to request a segment on an older timeline. For - // instance, given two renditions with the following: - // - // #EXTINF:10 - // segment1 - // #EXT-X-DISCONTINUITY - // #EXTINF:10 - // segment2 - // #EXTINF:10 - // segment3 - // - // And the current player state: - // - // current time: 8 - // buffer: 0 => 20 - // - // The next segment on the current rendition would be segment3, filling the buffer from - // 20s onwards. However, if a rendition switch happens after segment2 was requested, - // then the next segment to be requested will be segment1 from the new rendition in - // order to fill time 8 and onwards. Using the buffered end would result in repeated - // content (since it would position segment1 of the new rendition starting at 20s). This - // case can be identified when the new segment's timeline is a prior value. Instead of - // using the buffered end, the startOfSegment can be used, which, hopefully, will be - // more accurate to the actual start time of the segment. - - - if (segmentTimeline < currentTimeline) { - return startOfSegment; - } // segmentInfo.startOfSegment used to be used as the timestamp offset, however, that - // value uses the end of the last segment if it is available. While this value - // should often be correct, it's better to rely on the buffered end, as the new - // content post discontinuity should line up with the buffered end as if it were - // time 0 for the new content. - - - return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment; - }; - /** - * Returns whether or not the loader should wait for a timeline change from the timeline - * change controller before processing the segment. - * - * Primary timing in VHS goes by video. This is different from most media players, as - * audio is more often used as the primary timing source. For the foreseeable future, VHS - * will continue to use video as the primary timing source, due to the current logic and - * expectations built around it. - - * Since the timing follows video, in order to maintain sync, the video loader is - * responsible for setting both audio and video source buffer timestamp offsets. - * - * Setting different values for audio and video source buffers could lead to - * desyncing. The following examples demonstrate some of the situations where this - * distinction is important. Note that all of these cases involve demuxed content. When - * content is muxed, the audio and video are packaged together, therefore syncing - * separate media playlists is not an issue. - * - * CASE 1: Audio prepares to load a new timeline before video: - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, the audio loader is preparing to load the 6th segment, the first - * after a discontinuity, while the video loader is still loading the 5th segment, before - * the discontinuity. - * - * If the audio loader goes ahead and loads and appends the 6th segment before the video - * loader crosses the discontinuity, then when appended, the 6th audio segment will use - * the timestamp offset from timeline 0. This will likely lead to desyncing. In addition, - * the audio loader must provide the audioAppendStart value to trim the content in the - * transmuxer, and that value relies on the audio timestamp offset. Since the audio - * timestamp offset is set by the video (main) loader, the audio loader shouldn't load the - * segment until that value is provided. - * - * CASE 2: Video prepares to load a new timeline before audio: - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, the video loader is preparing to load the 6th segment, the first - * after a discontinuity, while the audio loader is still loading the 5th segment, before - * the discontinuity. - * - * If the video loader goes ahead and loads and appends the 6th segment, then once the - * segment is loaded and processed, both the video and audio timestamp offsets will be - * set, since video is used as the primary timing source. This is to ensure content lines - * up appropriately, as any modifications to the video timing are reflected by audio when - * the video loader sets the audio and video timestamp offsets to the same value. However, - * setting the timestamp offset for audio before audio has had a chance to change - * timelines will likely lead to desyncing, as the audio loader will append segment 5 with - * a timestamp intended to apply to segments from timeline 1 rather than timeline 0. - * - * CASE 3: When seeking, audio prepares to load a new timeline before video - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, both audio and video loaders are loading segments from timeline - * 0, but imagine that the seek originated from timeline 1. - * - * When seeking to a new timeline, the timestamp offset will be set based on the expected - * segment start of the loaded video segment. In order to maintain sync, the audio loader - * must wait for the video loader to load its segment and update both the audio and video - * timestamp offsets before it may load and append its own segment. This is the case - * whether the seek results in a mismatched segment request (e.g., the audio loader - * chooses to load segment 3 and the video loader chooses to load segment 4) or the - * loaders choose to load the same segment index from each playlist, as the segments may - * not be aligned perfectly, even for matching segment indexes. - * - * @param {Object} timelinechangeController - * @param {number} currentTimeline - * The timeline currently being followed by the loader - * @param {number} segmentTimeline - * The timeline of the segment being loaded - * @param {('main'|'audio')} loaderType - * The loader type - * @param {boolean} audioDisabled - * Whether the audio is disabled for the loader. This should only be true when the - * loader may have muxed audio in its segment, but should not append it, e.g., for - * the main loader when an alternate audio playlist is active. - * - * @return {boolean} - * Whether the loader should wait for a timeline change from the timeline change - * controller before processing the segment - */ - - var shouldWaitForTimelineChange = function shouldWaitForTimelineChange(_ref2) { - var timelineChangeController = _ref2.timelineChangeController, - currentTimeline = _ref2.currentTimeline, - segmentTimeline = _ref2.segmentTimeline, - loaderType = _ref2.loaderType, - audioDisabled = _ref2.audioDisabled; - - if (currentTimeline === segmentTimeline) { - return false; - } - - if (loaderType === 'audio') { - var lastMainTimelineChange = timelineChangeController.lastTimelineChange({ - type: 'main' - }); // Audio loader should wait if: - // - // * main hasn't had a timeline change yet (thus has not loaded its first segment) - // * main hasn't yet changed to the timeline audio is looking to load - - return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline; - } // The main loader only needs to wait for timeline changes if there's demuxed audio. - // Otherwise, there's nothing to wait for, since audio would be muxed into the main - // loader's segments (or the content is audio/video only and handled by the main - // loader). - - - if (loaderType === 'main' && audioDisabled) { - var pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({ - type: 'audio' - }); // Main loader should wait for the audio loader if audio is not pending a timeline - // change to the current timeline. - // - // Since the main loader is responsible for setting the timestamp offset for both - // audio and video, the main loader must wait for audio to be about to change to its - // timeline before setting the offset, otherwise, if audio is behind in loading, - // segments from the previous timeline would be adjusted by the new timestamp offset. - // - // This requirement means that video will not cross a timeline until the audio is - // about to cross to it, so that way audio and video will always cross the timeline - // together. - // - // In addition to normal timeline changes, these rules also apply to the start of a - // stream (going from a non-existent timeline, -1, to timeline 0). It's important - // that these rules apply to the first timeline change because if they did not, it's - // possible that the main loader will cross two timelines before the audio loader has - // crossed one. Logic may be implemented to handle the startup as a special case, but - // it's easier to simply treat all timeline changes the same. - - if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) { - return false; - } - - return true; - } - - return false; - }; - var mediaDuration = function mediaDuration(audioTimingInfo, videoTimingInfo) { - var audioDuration = audioTimingInfo && typeof audioTimingInfo.start === 'number' && typeof audioTimingInfo.end === 'number' ? audioTimingInfo.end - audioTimingInfo.start : 0; - var videoDuration = videoTimingInfo && typeof videoTimingInfo.start === 'number' && typeof videoTimingInfo.end === 'number' ? videoTimingInfo.end - videoTimingInfo.start : 0; - return Math.max(audioDuration, videoDuration); - }; - var segmentTooLong = function segmentTooLong(_ref3) { - var segmentDuration = _ref3.segmentDuration, - maxDuration = _ref3.maxDuration; - - // 0 duration segments are most likely due to metadata only segments or a lack of - // information. - if (!segmentDuration) { - return false; - } // For HLS: - // - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1 - // The EXTINF duration of each Media Segment in the Playlist - // file, when rounded to the nearest integer, MUST be less than or equal - // to the target duration; longer segments can trigger playback stalls - // or other errors. - // - // For DASH, the mpd-parser uses the largest reported segment duration as the target - // duration. Although that reported duration is occasionally approximate (i.e., not - // exact), a strict check may report that a segment is too long more often in DASH. - - - return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR; - }; - var getTroublesomeSegmentDurationMessage = function getTroublesomeSegmentDurationMessage(segmentInfo, sourceType) { - // Right now we aren't following DASH's timing model exactly, so only perform - // this check for HLS content. - if (sourceType !== 'hls') { - return null; - } - - var segmentDuration = mediaDuration(segmentInfo.audioTimingInfo, segmentInfo.videoTimingInfo); // Don't report if we lack information. - // - // If the segment has a duration of 0 it is either a lack of information or a - // metadata only segment and shouldn't be reported here. - - if (!segmentDuration) { - return null; - } - - var targetDuration = segmentInfo.playlist.targetDuration; - var isSegmentWayTooLong = segmentTooLong({ - segmentDuration: segmentDuration, - maxDuration: targetDuration * 2 - }); - var isSegmentSlightlyTooLong = segmentTooLong({ - segmentDuration: segmentDuration, - maxDuration: targetDuration - }); - var segmentTooLongMessage = "Segment with index " + segmentInfo.mediaIndex + " " + ("from playlist " + segmentInfo.playlist.id + " ") + ("has a duration of " + segmentDuration + " ") + ("when the reported duration is " + segmentInfo.duration + " ") + ("and the target duration is " + targetDuration + ". ") + 'For HLS content, a duration in excess of the target duration may result in ' + 'playback issues. See the HLS specification section on EXT-X-TARGETDURATION for ' + 'more details: ' + 'https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1'; - - if (isSegmentWayTooLong || isSegmentSlightlyTooLong) { - return { - severity: isSegmentWayTooLong ? 'warn' : 'info', - message: segmentTooLongMessage - }; - } - - return null; - }; - /** - * An object that manages segment loading and appending. - * - * @class SegmentLoader - * @param {Object} options required and optional options - * @extends videojs.EventTarget - */ - - var SegmentLoader = /*#__PURE__*/function (_videojs$EventTarget) { - inheritsLoose(SegmentLoader, _videojs$EventTarget); - - function SegmentLoader(settings, options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; // check pre-conditions - - if (!settings) { - throw new TypeError('Initialization settings are required'); - } - - if (typeof settings.currentTime !== 'function') { - throw new TypeError('No currentTime getter specified'); - } - - if (!settings.mediaSource) { - throw new TypeError('No MediaSource specified'); - } // public properties - - - _this.bandwidth = settings.bandwidth; - _this.throughput = { - rate: 0, - count: 0 - }; - _this.roundTrip = NaN; - - _this.resetStats_(); - - _this.mediaIndex = null; - _this.partIndex = null; // private settings - - _this.hasPlayed_ = settings.hasPlayed; - _this.currentTime_ = settings.currentTime; - _this.seekable_ = settings.seekable; - _this.seeking_ = settings.seeking; - _this.duration_ = settings.duration; - _this.mediaSource_ = settings.mediaSource; - _this.vhs_ = settings.vhs; - _this.loaderType_ = settings.loaderType; - _this.currentMediaInfo_ = void 0; - _this.startingMediaInfo_ = void 0; - _this.segmentMetadataTrack_ = settings.segmentMetadataTrack; - _this.goalBufferLength_ = settings.goalBufferLength; - _this.sourceType_ = settings.sourceType; - _this.sourceUpdater_ = settings.sourceUpdater; - _this.inbandTextTracks_ = settings.inbandTextTracks; - _this.state_ = 'INIT'; - _this.timelineChangeController_ = settings.timelineChangeController; - _this.shouldSaveSegmentTimingInfo_ = true; - _this.parse708captions_ = settings.parse708captions; // private instance variables - - _this.checkBufferTimeout_ = null; - _this.error_ = void 0; - _this.currentTimeline_ = -1; - _this.pendingSegment_ = null; - _this.xhrOptions_ = null; - _this.pendingSegments_ = []; - _this.audioDisabled_ = false; - _this.isPendingTimestampOffset_ = false; // TODO possibly move gopBuffer and timeMapping info to a separate controller - - _this.gopBuffer_ = []; - _this.timeMapping_ = 0; - _this.safeAppend_ = videojs__default['default'].browser.IE_VERSION >= 11; - _this.appendInitSegment_ = { - audio: true, - video: true - }; - _this.playlistOfLastInitSegment_ = { - audio: null, - video: null - }; - _this.callQueue_ = []; // If the segment loader prepares to load a segment, but does not have enough - // information yet to start the loading process (e.g., if the audio loader wants to - // load a segment from the next timeline but the main loader hasn't yet crossed that - // timeline), then the load call will be added to the queue until it is ready to be - // processed. - - _this.loadQueue_ = []; - _this.metadataQueue_ = { - id3: [], - caption: [] - }; - _this.waitingOnRemove_ = false; - _this.quotaExceededErrorRetryTimeout_ = null; // Fragmented mp4 playback - - _this.activeInitSegmentId_ = null; - _this.initSegments_ = {}; // HLSe playback - - _this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys; - _this.keyCache_ = {}; - _this.decrypter_ = settings.decrypter; // Manages the tracking and generation of sync-points, mappings - // between a time in the display time and a segment index within - // a playlist - - _this.syncController_ = settings.syncController; - _this.syncPoint_ = { - segmentIndex: 0, - time: 0 - }; - _this.transmuxer_ = _this.createTransmuxer_(); - - _this.triggerSyncInfoUpdate_ = function () { - return _this.trigger('syncinfoupdate'); - }; - - _this.syncController_.on('syncinfoupdate', _this.triggerSyncInfoUpdate_); - - _this.mediaSource_.addEventListener('sourceopen', function () { - if (!_this.isEndOfStream_()) { - _this.ended_ = false; - } - }); // ...for determining the fetch location - - - _this.fetchAtBuffer_ = false; - _this.logger_ = logger("SegmentLoader[" + _this.loaderType_ + "]"); - Object.defineProperty(assertThisInitialized(_this), 'state', { - get: function get() { - return this.state_; - }, - set: function set(newState) { - if (newState !== this.state_) { - this.logger_(this.state_ + " -> " + newState); - this.state_ = newState; - this.trigger('statechange'); - } - } - }); - - _this.sourceUpdater_.on('ready', function () { - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); // Only the main loader needs to listen for pending timeline changes, as the main - // loader should wait for audio to be ready to change its timeline so that both main - // and audio timelines change together. For more details, see the - // shouldWaitForTimelineChange function. - - - if (_this.loaderType_ === 'main') { - _this.timelineChangeController_.on('pendingtimelinechange', function () { - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); - } // The main loader only listens on pending timeline changes, but the audio loader, - // since its loads follow main, needs to listen on timeline changes. For more details, - // see the shouldWaitForTimelineChange function. - - - if (_this.loaderType_ === 'audio') { - _this.timelineChangeController_.on('timelinechange', function () { - if (_this.hasEnoughInfoToLoad_()) { - _this.processLoadQueue_(); - } - - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); - } - - return _this; - } - - var _proto = SegmentLoader.prototype; - - _proto.createTransmuxer_ = function createTransmuxer_() { - return segmentTransmuxer.createTransmuxer({ - remux: false, - alignGopsAtEnd: this.safeAppend_, - keepOriginalTimestamps: true, - parse708captions: this.parse708captions_ - }); - } - /** - * reset all of our media stats - * - * @private - */ - ; - - _proto.resetStats_ = function resetStats_() { - this.mediaBytesTransferred = 0; - this.mediaRequests = 0; - this.mediaRequestsAborted = 0; - this.mediaRequestsTimedout = 0; - this.mediaRequestsErrored = 0; - this.mediaTransferDuration = 0; - this.mediaSecondsLoaded = 0; - this.mediaAppends = 0; - } - /** - * dispose of the SegmentLoader and reset to the default state - */ - ; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.state = 'DISPOSED'; - this.pause(); - this.abort_(); - - if (this.transmuxer_) { - this.transmuxer_.terminate(); - } - - this.resetStats_(); - - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - } - - if (this.syncController_ && this.triggerSyncInfoUpdate_) { - this.syncController_.off('syncinfoupdate', this.triggerSyncInfoUpdate_); - } - - this.off(); - }; - - _proto.setAudio = function setAudio(enable) { - this.audioDisabled_ = !enable; - - if (enable) { - this.appendInitSegment_.audio = true; - } else { - // remove current track audio if it gets disabled - this.sourceUpdater_.removeAudio(0, this.duration_()); - } - } - /** - * abort anything that is currently doing on with the SegmentLoader - * and reset to a default state - */ - ; - - _proto.abort = function abort() { - if (this.state !== 'WAITING') { - if (this.pendingSegment_) { - this.pendingSegment_ = null; - } - - return; - } - - this.abort_(); // We aborted the requests we were waiting on, so reset the loader's state to READY - // since we are no longer "waiting" on any requests. XHR callback is not always run - // when the request is aborted. This will prevent the loader from being stuck in the - // WAITING state indefinitely. - - this.state = 'READY'; // don't wait for buffer check timeouts to begin fetching the - // next segment - - if (!this.paused()) { - this.monitorBuffer_(); - } - } - /** - * abort all pending xhr requests and null any pending segements - * - * @private - */ - ; - - _proto.abort_ = function abort_() { - if (this.pendingSegment_ && this.pendingSegment_.abortRequests) { - this.pendingSegment_.abortRequests(); - } // clear out the segment being processed - - - this.pendingSegment_ = null; - this.callQueue_ = []; - this.loadQueue_ = []; - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_); - this.waitingOnRemove_ = false; - window__default['default'].clearTimeout(this.quotaExceededErrorRetryTimeout_); - this.quotaExceededErrorRetryTimeout_ = null; - }; - - _proto.checkForAbort_ = function checkForAbort_(requestId) { - // If the state is APPENDING, then aborts will not modify the state, meaning the first - // callback that happens should reset the state to READY so that loading can continue. - if (this.state === 'APPENDING' && !this.pendingSegment_) { - this.state = 'READY'; - return true; - } - - if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) { - return true; - } - - return false; - } - /** - * set an error on the segment loader and null out any pending segements - * - * @param {Error} error the error to set on the SegmentLoader - * @return {Error} the error that was set or that is currently set - */ - ; - - _proto.error = function error(_error) { - if (typeof _error !== 'undefined') { - this.logger_('error occurred:', _error); - this.error_ = _error; - } - - this.pendingSegment_ = null; - return this.error_; - }; - - _proto.endOfStream = function endOfStream() { - this.ended_ = true; - - if (this.transmuxer_) { - // need to clear out any cached data to prepare for the new segment - segmentTransmuxer.reset(this.transmuxer_); - } - - this.gopBuffer_.length = 0; - this.pause(); - this.trigger('ended'); - } - /** - * Indicates which time ranges are buffered - * - * @return {TimeRange} - * TimeRange object representing the current buffered ranges - */ - ; - - _proto.buffered_ = function buffered_() { - if (!this.sourceUpdater_ || !this.startingMediaInfo_) { - return videojs__default['default'].createTimeRanges(); - } - - if (this.loaderType_ === 'main') { - var _this$startingMediaIn = this.startingMediaInfo_, - hasAudio = _this$startingMediaIn.hasAudio, - hasVideo = _this$startingMediaIn.hasVideo, - isMuxed = _this$startingMediaIn.isMuxed; - - if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed) { - return this.sourceUpdater_.buffered(); - } - - if (hasVideo) { - return this.sourceUpdater_.videoBuffered(); - } - } // One case that can be ignored for now is audio only with alt audio, - // as we don't yet have proper support for that. - - - return this.sourceUpdater_.audioBuffered(); - } - /** - * Gets and sets init segment for the provided map - * - * @param {Object} map - * The map object representing the init segment to get or set - * @param {boolean=} set - * If true, the init segment for the provided map should be saved - * @return {Object} - * map object for desired init segment - */ - ; - - _proto.initSegmentForMap = function initSegmentForMap(map, set) { - if (set === void 0) { - set = false; - } - - if (!map) { - return null; - } - - var id = initSegmentId(map); - var storedMap = this.initSegments_[id]; - - if (set && !storedMap && map.bytes) { - this.initSegments_[id] = storedMap = { - resolvedUri: map.resolvedUri, - byterange: map.byterange, - bytes: map.bytes, - tracks: map.tracks, - timescales: map.timescales - }; - } - - return storedMap || map; - } - /** - * Gets and sets key for the provided key - * - * @param {Object} key - * The key object representing the key to get or set - * @param {boolean=} set - * If true, the key for the provided key should be saved - * @return {Object} - * Key object for desired key - */ - ; - - _proto.segmentKey = function segmentKey(key, set) { - if (set === void 0) { - set = false; - } - - if (!key) { - return null; - } - - var id = segmentKeyId(key); - var storedKey = this.keyCache_[id]; // TODO: We should use the HTTP Expires header to invalidate our cache per - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-6.2.3 - - if (this.cacheEncryptionKeys_ && set && !storedKey && key.bytes) { - this.keyCache_[id] = storedKey = { - resolvedUri: key.resolvedUri, - bytes: key.bytes - }; - } - - var result = { - resolvedUri: (storedKey || key).resolvedUri - }; - - if (storedKey) { - result.bytes = storedKey.bytes; - } - - return result; - } - /** - * Returns true if all configuration required for loading is present, otherwise false. - * - * @return {boolean} True if the all configuration is ready for loading - * @private - */ - ; - - _proto.couldBeginLoading_ = function couldBeginLoading_() { - return this.playlist_ && !this.paused(); - } - /** - * load a playlist and start to fill the buffer - */ - ; - - _proto.load = function load() { - // un-pause - this.monitorBuffer_(); // if we don't have a playlist yet, keep waiting for one to be - // specified - - if (!this.playlist_) { - return; - } // if all the configuration is ready, initialize and begin loading - - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - return this.init_(); - } // if we're in the middle of processing a segment already, don't - // kick off an additional segment request - - - if (!this.couldBeginLoading_() || this.state !== 'READY' && this.state !== 'INIT') { - return; - } - - this.state = 'READY'; - } - /** - * Once all the starting parameters have been specified, begin - * operation. This method should only be invoked from the INIT - * state. - * - * @private - */ - ; - - _proto.init_ = function init_() { - this.state = 'READY'; // if this is the audio segment loader, and it hasn't been inited before, then any old - // audio data from the muxed content should be removed - - this.resetEverything(); - return this.monitorBuffer_(); - } - /** - * set a playlist on the segment loader - * - * @param {PlaylistLoader} media the playlist to set on the segment loader - */ - ; - - _proto.playlist = function playlist(newPlaylist, options) { - if (options === void 0) { - options = {}; - } - - if (!newPlaylist) { - return; - } - - var oldPlaylist = this.playlist_; - var segmentInfo = this.pendingSegment_; - this.playlist_ = newPlaylist; - this.xhrOptions_ = options; // when we haven't started playing yet, the start of a live playlist - // is always our zero-time so force a sync update each time the playlist - // is refreshed from the server - // - // Use the INIT state to determine if playback has started, as the playlist sync info - // should be fixed once requests begin (as sync points are generated based on sync - // info), but not before then. - - if (this.state === 'INIT') { - newPlaylist.syncInfo = { - mediaSequence: newPlaylist.mediaSequence, - time: 0 - }; // Setting the date time mapping means mapping the program date time (if available) - // to time 0 on the player's timeline. The playlist's syncInfo serves a similar - // purpose, mapping the initial mediaSequence to time zero. Since the syncInfo can - // be updated as the playlist is refreshed before the loader starts loading, the - // program date time mapping needs to be updated as well. - // - // This mapping is only done for the main loader because a program date time should - // map equivalently between playlists. - - if (this.loaderType_ === 'main') { - this.syncController_.setDateTimeMappingForStart(newPlaylist); - } - } - - var oldId = null; - - if (oldPlaylist) { - if (oldPlaylist.id) { - oldId = oldPlaylist.id; - } else if (oldPlaylist.uri) { - oldId = oldPlaylist.uri; - } - } - - this.logger_("playlist update [" + oldId + " => " + (newPlaylist.id || newPlaylist.uri) + "]"); // in VOD, this is always a rendition switch (or we updated our syncInfo above) - // in LIVE, we always want to update with new playlists (including refreshes) - - this.trigger('syncinfoupdate'); // if we were unpaused but waiting for a playlist, start - // buffering now - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - return this.init_(); - } - - if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) { - if (this.mediaIndex !== null) { - // we must "resync" the segment loader when we switch renditions and - // the segment loader is already synced to the previous rendition - this.resyncLoader(); - } - - this.currentMediaInfo_ = void 0; - this.trigger('playlistupdate'); // the rest of this function depends on `oldPlaylist` being defined - - return; - } // we reloaded the same playlist so we are in a live scenario - // and we will likely need to adjust the mediaIndex - - - var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; - this.logger_("live window shift [" + mediaSequenceDiff + "]"); // update the mediaIndex on the SegmentLoader - // this is important because we can abort a request and this value must be - // equal to the last appended mediaIndex - - if (this.mediaIndex !== null) { - this.mediaIndex -= mediaSequenceDiff; // this can happen if we are going to load the first segment, but get a playlist - // update during that. mediaIndex would go from 0 to -1 if mediaSequence in the - // new playlist was incremented by 1. - - if (this.mediaIndex < 0) { - this.mediaIndex = null; - this.partIndex = null; - } else { - var segment = this.playlist_.segments[this.mediaIndex]; // partIndex should remain the same for the same segment - // unless parts fell off of the playlist for this segment. - // In that case we need to reset partIndex and resync - - if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) { - var mediaIndex = this.mediaIndex; - this.logger_("currently processing part (index " + this.partIndex + ") no longer exists."); - this.resetLoader(); // We want to throw away the partIndex and the data associated with it, - // as the part was dropped from our current playlists segment. - // The mediaIndex will still be valid so keep that around. - - this.mediaIndex = mediaIndex; - } - } - } // update the mediaIndex on the SegmentInfo object - // this is important because we will update this.mediaIndex with this value - // in `handleAppendsDone_` after the segment has been successfully appended - - - if (segmentInfo) { - segmentInfo.mediaIndex -= mediaSequenceDiff; - - if (segmentInfo.mediaIndex < 0) { - segmentInfo.mediaIndex = null; - segmentInfo.partIndex = null; - } else { - // we need to update the referenced segment so that timing information is - // saved for the new playlist's segment, however, if the segment fell off the - // playlist, we can leave the old reference and just lose the timing info - if (segmentInfo.mediaIndex >= 0) { - segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex]; - } - - if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) { - segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex]; - } - } - } - - this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist); - } - /** - * Prevent the loader from fetching additional segments. If there - * is a segment request outstanding, it will finish processing - * before the loader halts. A segment loader can be unpaused by - * calling load(). - */ - ; - - _proto.pause = function pause() { - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - this.checkBufferTimeout_ = null; - } - } - /** - * Returns whether the segment loader is fetching additional - * segments when given the opportunity. This property can be - * modified through calls to pause() and load(). - */ - ; - - _proto.paused = function paused() { - return this.checkBufferTimeout_ === null; - } - /** - * Delete all the buffered data and reset the SegmentLoader - * - * @param {Function} [done] an optional callback to be executed when the remove - * operation is complete - */ - ; - - _proto.resetEverything = function resetEverything(done) { - this.ended_ = false; - this.appendInitSegment_ = { - audio: true, - video: true - }; - this.resetLoader(); // remove from 0, the earliest point, to Infinity, to signify removal of everything. - // VTT Segment Loader doesn't need to do anything but in the regular SegmentLoader, - // we then clamp the value to duration if necessary. - - this.remove(0, Infinity, done); // clears fmp4 captions - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearAllMp4Captions' - }); - } - } - /** - * Force the SegmentLoader to resync and start loading around the currentTime instead - * of starting at the end of the buffer - * - * Useful for fast quality changes - */ - ; - - _proto.resetLoader = function resetLoader() { - this.fetchAtBuffer_ = false; - this.resyncLoader(); - } - /** - * Force the SegmentLoader to restart synchronization and make a conservative guess - * before returning to the simple walk-forward method - */ - ; - - _proto.resyncLoader = function resyncLoader() { - if (this.transmuxer_) { - // need to clear out any cached data to prepare for the new segment - segmentTransmuxer.reset(this.transmuxer_); - } - - this.mediaIndex = null; - this.partIndex = null; - this.syncPoint_ = null; - this.isPendingTimestampOffset_ = false; - this.callQueue_ = []; - this.loadQueue_ = []; - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - this.abort(); - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearParsedMp4Captions' - }); - } - } - /** - * Remove any data in the source buffer between start and end times - * - * @param {number} start - the start time of the region to remove from the buffer - * @param {number} end - the end time of the region to remove from the buffer - * @param {Function} [done] - an optional callback to be executed when the remove - * @param {boolean} force - force all remove operations to happen - * operation is complete - */ - ; - - _proto.remove = function remove(start, end, done, force) { - if (done === void 0) { - done = function done() {}; - } - - if (force === void 0) { - force = false; - } - - // clamp end to duration if we need to remove everything. - // This is due to a browser bug that causes issues if we remove to Infinity. - // videojs/videojs-contrib-hls#1225 - if (end === Infinity) { - end = this.duration_(); - } // skip removes that would throw an error - // commonly happens during a rendition switch at the start of a video - // from start 0 to end 0 - - - if (end <= start) { - this.logger_('skipping remove because end ${end} is <= start ${start}'); - return; - } - - if (!this.sourceUpdater_ || !this.startingMediaInfo_) { - this.logger_('skipping remove because no source updater or starting media info'); // nothing to remove if we haven't processed any media - - return; - } // set it to one to complete this function's removes - - - var removesRemaining = 1; - - var removeFinished = function removeFinished() { - removesRemaining--; - - if (removesRemaining === 0) { - done(); - } - }; - - if (force || !this.audioDisabled_) { - removesRemaining++; - this.sourceUpdater_.removeAudio(start, end, removeFinished); - } // While it would be better to only remove video if the main loader has video, this - // should be safe with audio only as removeVideo will call back even if there's no - // video buffer. - // - // In theory we can check to see if there's video before calling the remove, but in - // the event that we're switching between renditions and from video to audio only - // (when we add support for that), we may need to clear the video contents despite - // what the new media will contain. - - - if (force || this.loaderType_ === 'main') { - this.gopBuffer_ = removeGopBuffer(this.gopBuffer_, start, end, this.timeMapping_); - removesRemaining++; - this.sourceUpdater_.removeVideo(start, end, removeFinished); - } // remove any captions and ID3 tags - - - for (var track in this.inbandTextTracks_) { - removeCuesFromTrack(start, end, this.inbandTextTracks_[track]); - } - - removeCuesFromTrack(start, end, this.segmentMetadataTrack_); // finished this function's removes - - removeFinished(); - } - /** - * (re-)schedule monitorBufferTick_ to run as soon as possible - * - * @private - */ - ; - - _proto.monitorBuffer_ = function monitorBuffer_() { - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - } - - this.checkBufferTimeout_ = window__default['default'].setTimeout(this.monitorBufferTick_.bind(this), 1); - } - /** - * As long as the SegmentLoader is in the READY state, periodically - * invoke fillBuffer_(). - * - * @private - */ - ; - - _proto.monitorBufferTick_ = function monitorBufferTick_() { - if (this.state === 'READY') { - this.fillBuffer_(); - } - - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - } - - this.checkBufferTimeout_ = window__default['default'].setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY); - } - /** - * fill the buffer with segements unless the sourceBuffers are - * currently updating - * - * Note: this function should only ever be called by monitorBuffer_ - * and never directly - * - * @private - */ - ; - - _proto.fillBuffer_ = function fillBuffer_() { - // TODO since the source buffer maintains a queue, and we shouldn't call this function - // except when we're ready for the next segment, this check can most likely be removed - if (this.sourceUpdater_.updating()) { - return; - } // see if we need to begin loading immediately - - - var segmentInfo = this.chooseNextRequest_(); - - if (!segmentInfo) { - return; - } - - if (typeof segmentInfo.timestampOffset === 'number') { - this.isPendingTimestampOffset_ = false; - this.timelineChangeController_.pendingTimelineChange({ - type: this.loaderType_, - from: this.currentTimeline_, - to: segmentInfo.timeline - }); - } - - this.loadSegment_(segmentInfo); - } - /** - * Determines if we should call endOfStream on the media source based - * on the state of the buffer or if appened segment was the final - * segment in the playlist. - * - * @param {number} [mediaIndex] the media index of segment we last appended - * @param {Object} [playlist] a media playlist object - * @return {boolean} do we need to call endOfStream on the MediaSource - */ - ; - - _proto.isEndOfStream_ = function isEndOfStream_(mediaIndex, playlist, partIndex) { - if (mediaIndex === void 0) { - mediaIndex = this.mediaIndex; - } - - if (playlist === void 0) { - playlist = this.playlist_; - } - - if (partIndex === void 0) { - partIndex = this.partIndex; - } - - if (!playlist || !this.mediaSource_) { - return false; - } - - var segment = typeof mediaIndex === 'number' && playlist.segments[mediaIndex]; // mediaIndex is zero based but length is 1 based - - var appendedLastSegment = mediaIndex + 1 === playlist.segments.length; // true if there are no parts, or this is the last part. - - var appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length; // if we've buffered to the end of the video, we need to call endOfStream - // so that MediaSources can trigger the `ended` event when it runs out of - // buffered data instead of waiting for me - - return playlist.endList && this.mediaSource_.readyState === 'open' && appendedLastSegment && appendedLastPart; - } - /** - * Determines what request should be made given current segment loader state. - * - * @return {Object} a request object that describes the segment/part to load - */ - ; - - _proto.chooseNextRequest_ = function chooseNextRequest_() { - var bufferedEnd = lastBufferedEnd(this.buffered_()) || 0; - var bufferedTime = Math.max(0, bufferedEnd - this.currentTime_()); - var preloaded = !this.hasPlayed_() && bufferedTime >= 1; - var haveEnoughBuffer = bufferedTime >= this.goalBufferLength_(); - var segments = this.playlist_.segments; // return no segment if: - // 1. we don't have segments - // 2. The video has not yet played and we already downloaded a segment - // 3. we already have enough buffered time - - if (!segments.length || preloaded || haveEnoughBuffer) { - return null; - } - - this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_()); - var next = { - partIndex: null, - mediaIndex: null, - startOfSegment: null, - playlist: this.playlist_, - isSyncRequest: Boolean(!this.syncPoint_) - }; - - if (next.isSyncRequest) { - next.mediaIndex = getSyncSegmentCandidate(this.currentTimeline_, segments, bufferedEnd); - } else if (this.mediaIndex !== null) { - var segment = segments[this.mediaIndex]; - var partIndex = typeof this.partIndex === 'number' ? this.partIndex : -1; - next.startOfSegment = segment.end ? segment.end : bufferedEnd; - - if (segment.parts && segment.parts[partIndex + 1]) { - next.mediaIndex = this.mediaIndex; - next.partIndex = partIndex + 1; - } else { - next.mediaIndex = this.mediaIndex + 1; - } - } else { - // Find the segment containing the end of the buffer or current time. - var _Playlist$getMediaInf = Playlist.getMediaInfoForTime({ - playlist: this.playlist_, - currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(), - startingPartIndex: this.syncPoint_.partIndex, - startingSegmentIndex: this.syncPoint_.segmentIndex, - startTime: this.syncPoint_.time - }), - segmentIndex = _Playlist$getMediaInf.segmentIndex, - startTime = _Playlist$getMediaInf.startTime, - _partIndex = _Playlist$getMediaInf.partIndex; - - next.getMediaInfoForTime = this.fetchAtBuffer_ ? 'bufferedEnd' : 'currentTime'; - next.mediaIndex = segmentIndex; - next.startOfSegment = startTime; - next.partIndex = _partIndex; - } - - var nextSegment = segments[next.mediaIndex]; - var nextPart = nextSegment && typeof next.partIndex === 'number' && nextSegment.parts && nextSegment.parts[next.partIndex]; // if the next segment index is invalid or - // the next partIndex is invalid do not choose a next segment. - - if (!nextSegment || typeof next.partIndex === 'number' && !nextPart) { - return null; - } // if the next segment has parts, and we don't have a partIndex. - // Set partIndex to 0 - - - if (typeof next.partIndex !== 'number' && nextSegment.parts) { - next.partIndex = 0; - } - - var ended = this.mediaSource_ && this.mediaSource_.readyState === 'ended'; // do not choose a next segment if all of the following: - // 1. this is the last segment in the playlist - // 2. end of stream has been called on the media source already - // 3. the player is not seeking - - if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) { - return null; - } - - return this.generateSegmentInfo_(next); - }; - - _proto.generateSegmentInfo_ = function generateSegmentInfo_(options) { - var playlist = options.playlist, - mediaIndex = options.mediaIndex, - startOfSegment = options.startOfSegment, - isSyncRequest = options.isSyncRequest, - partIndex = options.partIndex, - forceTimestampOffset = options.forceTimestampOffset, - getMediaInfoForTime = options.getMediaInfoForTime; - var segment = playlist.segments[mediaIndex]; - var part = typeof partIndex === 'number' && segment.parts[partIndex]; - var segmentInfo = { - requestId: 'segment-loader-' + Math.random(), - // resolve the segment URL relative to the playlist - uri: part && part.resolvedUri || segment.resolvedUri, - // the segment's mediaIndex at the time it was requested - mediaIndex: mediaIndex, - partIndex: part ? partIndex : null, - // whether or not to update the SegmentLoader's state with this - // segment's mediaIndex - isSyncRequest: isSyncRequest, - startOfSegment: startOfSegment, - // the segment's playlist - playlist: playlist, - // unencrypted bytes of the segment - bytes: null, - // when a key is defined for this segment, the encrypted bytes - encryptedBytes: null, - // The target timestampOffset for this segment when we append it - // to the source buffer - timestampOffset: null, - // The timeline that the segment is in - timeline: segment.timeline, - // The expected duration of the segment in seconds - duration: part && part.duration || segment.duration, - // retain the segment in case the playlist updates while doing an async process - segment: segment, - part: part, - byteLength: 0, - transmuxer: this.transmuxer_, - // type of getMediaInfoForTime that was used to get this segment - getMediaInfoForTime: getMediaInfoForTime - }; - var overrideCheck = typeof forceTimestampOffset !== 'undefined' ? forceTimestampOffset : this.isPendingTimestampOffset_; - segmentInfo.timestampOffset = this.timestampOffsetForSegment_({ - segmentTimeline: segment.timeline, - currentTimeline: this.currentTimeline_, - startOfSegment: startOfSegment, - buffered: this.buffered_(), - overrideCheck: overrideCheck - }); - var audioBufferedEnd = lastBufferedEnd(this.sourceUpdater_.audioBuffered()); - - if (typeof audioBufferedEnd === 'number') { - // since the transmuxer is using the actual timing values, but the buffer is - // adjusted by the timestamp offset, we must adjust the value here - segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset(); - } - - if (this.sourceUpdater_.videoBuffered().length) { - segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(this.gopBuffer_, // since the transmuxer is using the actual timing values, but the time is - // adjusted by the timestmap offset, we must adjust the value here - this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(), this.timeMapping_); - } - - return segmentInfo; - } // get the timestampoffset for a segment, - // added so that vtt segment loader can override and prevent - // adding timestamp offsets. - ; - - _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_(options) { - return timestampOffsetForSegment(options); - } - /** - * Determines if the network has enough bandwidth to complete the current segment - * request in a timely manner. If not, the request will be aborted early and bandwidth - * updated to trigger a playlist switch. - * - * @param {Object} stats - * Object containing stats about the request timing and size - * @private - */ - ; - - _proto.earlyAbortWhenNeeded_ = function earlyAbortWhenNeeded_(stats) { - if (this.vhs_.tech_.paused() || // Don't abort if the current playlist is on the lowestEnabledRendition - // TODO: Replace using timeout with a boolean indicating whether this playlist is - // the lowestEnabledRendition. - !this.xhrOptions_.timeout || // Don't abort if we have no bandwidth information to estimate segment sizes - !this.playlist_.attributes.BANDWIDTH) { - return; - } // Wait at least 1 second since the first byte of data has been received before - // using the calculated bandwidth from the progress event to allow the bitrate - // to stabilize - - - if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1000) { - return; - } - - var currentTime = this.currentTime_(); - var measuredBandwidth = stats.bandwidth; - var segmentDuration = this.pendingSegment_.duration; - var requestTimeRemaining = Playlist.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived); // Subtract 1 from the timeUntilRebuffer so we still consider an early abort - // if we are only left with less than 1 second when the request completes. - // A negative timeUntilRebuffering indicates we are already rebuffering - - var timeUntilRebuffer$1 = timeUntilRebuffer(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1; // Only consider aborting early if the estimated time to finish the download - // is larger than the estimated time until the player runs out of forward buffer - - if (requestTimeRemaining <= timeUntilRebuffer$1) { - return; - } - - var switchCandidate = minRebufferMaxBandwidthSelector({ - master: this.vhs_.playlists.master, - currentTime: currentTime, - bandwidth: measuredBandwidth, - duration: this.duration_(), - segmentDuration: segmentDuration, - timeUntilRebuffer: timeUntilRebuffer$1, - currentTimeline: this.currentTimeline_, - syncController: this.syncController_ - }); - - if (!switchCandidate) { - return; - } - - var rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$1; - var timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact; - var minimumTimeSaving = 0.5; // If we are already rebuffering, increase the amount of variance we add to the - // potential round trip time of the new request so that we are not too aggressive - // with switching to a playlist that might save us a fraction of a second. - - if (timeUntilRebuffer$1 <= TIME_FUDGE_FACTOR) { - minimumTimeSaving = 1; - } - - if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) { - return; - } // set the bandwidth to that of the desired playlist being sure to scale by - // BANDWIDTH_VARIANCE and add one so the playlist selector does not exclude it - // don't trigger a bandwidthupdate as the bandwidth is artifial - - - this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config.BANDWIDTH_VARIANCE + 1; - this.trigger('earlyabort'); - }; - - _proto.handleAbort_ = function handleAbort_(segmentInfo) { - this.logger_("Aborting " + segmentInfoString(segmentInfo)); - this.mediaRequestsAborted += 1; - } - /** - * XHR `progress` event handler - * - * @param {Event} - * The XHR `progress` event - * @param {Object} simpleSegment - * A simplified segment object copy - * @private - */ - ; - - _proto.handleProgress_ = function handleProgress_(event, simpleSegment) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - this.trigger('progress'); - }; - - _proto.handleTrackInfo_ = function handleTrackInfo_(simpleSegment, trackInfo) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - if (this.checkForIllegalMediaSwitch(trackInfo)) { - return; - } - - trackInfo = trackInfo || {}; // When we have track info, determine what media types this loader is dealing with. - // Guard against cases where we're not getting track info at all until we are - // certain that all streams will provide it. - - if (!shallowEqual(this.currentMediaInfo_, trackInfo)) { - this.appendInitSegment_ = { - audio: true, - video: true - }; - this.startingMediaInfo_ = trackInfo; - this.currentMediaInfo_ = trackInfo; - this.logger_('trackinfo update', trackInfo); - this.trigger('trackinfo'); - } // trackinfo may cause an abort if the trackinfo - // causes a codec change to an unsupported codec. - - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // set trackinfo on the pending segment so that - // it can append. - - - this.pendingSegment_.trackInfo = trackInfo; // check if any calls were waiting on the track info - - if (this.hasEnoughInfoToAppend_()) { - this.processCallQueue_(); - } - }; - - _proto.handleTimingInfo_ = function handleTimingInfo_(simpleSegment, mediaType, timeType, time) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - var segmentInfo = this.pendingSegment_; - var timingInfoProperty = timingInfoPropertyForMedia(mediaType); - segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {}; - segmentInfo[timingInfoProperty][timeType] = time; - this.logger_("timinginfo: " + mediaType + " - " + timeType + " - " + time); // check if any calls were waiting on the timing info - - if (this.hasEnoughInfoToAppend_()) { - this.processCallQueue_(); - } - }; - - _proto.handleCaptions_ = function handleCaptions_(simpleSegment, captionData) { - var _this2 = this; - - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // This could only happen with fmp4 segments, but - // should still not happen in general - - - if (captionData.length === 0) { - this.logger_('SegmentLoader received no captions from a caption event'); - return; - } - - var segmentInfo = this.pendingSegment_; // Wait until we have some video data so that caption timing - // can be adjusted by the timestamp offset - - if (!segmentInfo.hasAppendedData_) { - this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData)); - return; - } - - var timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset(); - var captionTracks = {}; // get total start/end and captions for each track/stream - - captionData.forEach(function (caption) { - // caption.stream is actually a track name... - // set to the existing values in tracks or default values - captionTracks[caption.stream] = captionTracks[caption.stream] || { - // Infinity, as any other value will be less than this - startTime: Infinity, - captions: [], - // 0 as an other value will be more than this - endTime: 0 - }; - var captionTrack = captionTracks[caption.stream]; - captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset); - captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset); - captionTrack.captions.push(caption); - }); - Object.keys(captionTracks).forEach(function (trackName) { - var _captionTracks$trackN = captionTracks[trackName], - startTime = _captionTracks$trackN.startTime, - endTime = _captionTracks$trackN.endTime, - captions = _captionTracks$trackN.captions; - var inbandTextTracks = _this2.inbandTextTracks_; - - _this2.logger_("adding cues from " + startTime + " -> " + endTime + " for " + trackName); - - createCaptionsTrackIfNotExists(inbandTextTracks, _this2.vhs_.tech_, trackName); // clear out any cues that start and end at the same time period for the same track. - // We do this because a rendition change that also changes the timescale for captions - // will result in captions being re-parsed for certain segments. If we add them again - // without clearing we will have two of the same captions visible. - - removeCuesFromTrack(startTime, endTime, inbandTextTracks[trackName]); - addCaptionData({ - captionArray: captions, - inbandTextTracks: inbandTextTracks, - timestampOffset: timestampOffset - }); - }); // Reset stored captions since we added parsed - // captions to a text track at this point - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearParsedMp4Captions' - }); - } - }; - - _proto.handleId3_ = function handleId3_(simpleSegment, id3Frames, dispatchType) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - var segmentInfo = this.pendingSegment_; // we need to have appended data in order for the timestamp offset to be set - - if (!segmentInfo.hasAppendedData_) { - this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType)); - return; - } - - var timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset(); // There's potentially an issue where we could double add metadata if there's a muxed - // audio/video source with a metadata track, and an alt audio with a metadata track. - // However, this probably won't happen, and if it does it can be handled then. - - createMetadataTrackIfNotExists(this.inbandTextTracks_, dispatchType, this.vhs_.tech_); - addMetadata({ - inbandTextTracks: this.inbandTextTracks_, - metadataArray: id3Frames, - timestampOffset: timestampOffset, - videoDuration: this.duration_() - }); - }; - - _proto.processMetadataQueue_ = function processMetadataQueue_() { - this.metadataQueue_.id3.forEach(function (fn) { - return fn(); - }); - this.metadataQueue_.caption.forEach(function (fn) { - return fn(); - }); - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - }; - - _proto.processCallQueue_ = function processCallQueue_() { - var callQueue = this.callQueue_; // Clear out the queue before the queued functions are run, since some of the - // functions may check the length of the load queue and default to pushing themselves - // back onto the queue. - - this.callQueue_ = []; - callQueue.forEach(function (fun) { - return fun(); - }); - }; - - _proto.processLoadQueue_ = function processLoadQueue_() { - var loadQueue = this.loadQueue_; // Clear out the queue before the queued functions are run, since some of the - // functions may check the length of the load queue and default to pushing themselves - // back onto the queue. - - this.loadQueue_ = []; - loadQueue.forEach(function (fun) { - return fun(); - }); - } - /** - * Determines whether the loader has enough info to load the next segment. - * - * @return {boolean} - * Whether or not the loader has enough info to load the next segment - */ - ; - - _proto.hasEnoughInfoToLoad_ = function hasEnoughInfoToLoad_() { - // Since primary timing goes by video, only the audio loader potentially needs to wait - // to load. - if (this.loaderType_ !== 'audio') { - return true; - } - - var segmentInfo = this.pendingSegment_; // A fill buffer must have already run to establish a pending segment before there's - // enough info to load. - - if (!segmentInfo) { - return false; - } // The first segment can and should be loaded immediately so that source buffers are - // created together (before appending). Source buffer creation uses the presence of - // audio and video data to determine whether to create audio/video source buffers, and - // uses processed (transmuxed or parsed) media to determine the types required. - - - if (!this.currentMediaInfo_) { - return true; - } - - if ( // Technically, instead of waiting to load a segment on timeline changes, a segment - // can be requested and downloaded and only wait before it is transmuxed or parsed. - // But in practice, there are a few reasons why it is better to wait until a loader - // is ready to append that segment before requesting and downloading: - // - // 1. Because audio and main loaders cross discontinuities together, if this loader - // is waiting for the other to catch up, then instead of requesting another - // segment and using up more bandwidth, by not yet loading, more bandwidth is - // allotted to the loader currently behind. - // 2. media-segment-request doesn't have to have logic to consider whether a segment - // is ready to be processed or not, isolating the queueing behavior to the loader. - // 3. The audio loader bases some of its segment properties on timing information - // provided by the main loader, meaning that, if the logic for waiting on - // processing was in media-segment-request, then it would also need to know how - // to re-generate the segment information after the main loader caught up. - shouldWaitForTimelineChange({ - timelineChangeController: this.timelineChangeController_, - currentTimeline: this.currentTimeline_, - segmentTimeline: segmentInfo.timeline, - loaderType: this.loaderType_, - audioDisabled: this.audioDisabled_ - })) { - return false; - } - - return true; - }; - - _proto.hasEnoughInfoToAppend_ = function hasEnoughInfoToAppend_() { - if (!this.sourceUpdater_.ready()) { - return false; - } // If content needs to be removed or the loader is waiting on an append reattempt, - // then no additional content should be appended until the prior append is resolved. - - - if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) { - return false; - } - - var segmentInfo = this.pendingSegment_; // no segment to append any data for or - // we do not have information on this specific - // segment yet - - if (!segmentInfo || !segmentInfo.trackInfo) { - return false; - } - - var _this$currentMediaInf = this.currentMediaInfo_, - hasAudio = _this$currentMediaInf.hasAudio, - hasVideo = _this$currentMediaInf.hasVideo, - isMuxed = _this$currentMediaInf.isMuxed; - - if (hasVideo && !segmentInfo.videoTimingInfo) { - return false; - } // muxed content only relies on video timing information for now. - - - if (hasAudio && !this.audioDisabled_ && !isMuxed && !segmentInfo.audioTimingInfo) { - return false; - } - - if (shouldWaitForTimelineChange({ - timelineChangeController: this.timelineChangeController_, - currentTimeline: this.currentTimeline_, - segmentTimeline: segmentInfo.timeline, - loaderType: this.loaderType_, - audioDisabled: this.audioDisabled_ - })) { - return false; - } - - return true; - }; - - _proto.handleData_ = function handleData_(simpleSegment, result) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // If there's anything in the call queue, then this data came later and should be - // executed after the calls currently queued. - - - if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) { - this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result)); - return; - } - - var segmentInfo = this.pendingSegment_; // update the time mapping so we can translate from display time to media time - - this.setTimeMapping_(segmentInfo.timeline); // for tracking overall stats - - this.updateMediaSecondsLoaded_(segmentInfo.segment); // Note that the state isn't changed from loading to appending. This is because abort - // logic may change behavior depending on the state, and changing state too early may - // inflate our estimates of bandwidth. In the future this should be re-examined to - // note more granular states. - // don't process and append data if the mediaSource is closed - - if (this.mediaSource_.readyState === 'closed') { - return; - } // if this request included an initialization segment, save that data - // to the initSegment cache - - - if (simpleSegment.map) { - simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true); // move over init segment properties to media request - - segmentInfo.segment.map = simpleSegment.map; - } // if this request included a segment key, save that data in the cache - - - if (simpleSegment.key) { - this.segmentKey(simpleSegment.key, true); - } - - segmentInfo.isFmp4 = simpleSegment.isFmp4; - segmentInfo.timingInfo = segmentInfo.timingInfo || {}; - - if (segmentInfo.isFmp4) { - this.trigger('fmp4'); - segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia(result.type)].start; - } else { - var useVideoTimingInfo = this.loaderType_ === 'main' && this.currentMediaInfo_.hasVideo; - var firstVideoFrameTimeForData; - - if (useVideoTimingInfo) { - firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start; - } // Segment loader knows more about segment timing than the transmuxer (in certain - // aspects), so make any changes required for a more accurate start time. - // Don't set the end time yet, as the segment may not be finished processing. - - - segmentInfo.timingInfo.start = this.trueSegmentStart_({ - currentStart: segmentInfo.timingInfo.start, - playlist: segmentInfo.playlist, - mediaIndex: segmentInfo.mediaIndex, - currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(), - useVideoTimingInfo: useVideoTimingInfo, - firstVideoFrameTimeForData: firstVideoFrameTimeForData, - videoTimingInfo: segmentInfo.videoTimingInfo, - audioTimingInfo: segmentInfo.audioTimingInfo - }); - } // Init segments for audio and video only need to be appended in certain cases. Now - // that data is about to be appended, we can check the final cases to determine - // whether we should append an init segment. - - - this.updateAppendInitSegmentStatus(segmentInfo, result.type); // Timestamp offset should be updated once we get new data and have its timing info, - // as we use the start of the segment to offset the best guess (playlist provided) - // timestamp offset. - - this.updateSourceBufferTimestampOffset_(segmentInfo); // if this is a sync request we need to determine whether it should - // be appended or not. - - if (segmentInfo.isSyncRequest) { - // first save/update our timing info for this segment. - // this is what allows us to choose an accurate segment - // and the main reason we make a sync request. - this.updateTimingInfoEnd_(segmentInfo); - this.syncController_.saveSegmentTimingInfo({ - segmentInfo: segmentInfo, - shouldSaveTimelineMapping: this.loaderType_ === 'main' - }); - var next = this.chooseNextRequest_(); // If the sync request isn't the segment that would be requested next - // after taking into account its timing info, do not append it. - - if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) { - this.logger_('sync segment was incorrect, not appending'); - return; - } // otherwise append it like any other segment as our guess was correct. - - - this.logger_('sync segment was correct, appending'); - } // Save some state so that in the future anything waiting on first append (and/or - // timestamp offset(s)) can process immediately. While the extra state isn't optimal, - // we need some notion of whether the timestamp offset or other relevant information - // has had a chance to be set. - - - segmentInfo.hasAppendedData_ = true; // Now that the timestamp offset should be set, we can append any waiting ID3 tags. - - this.processMetadataQueue_(); - this.appendData_(segmentInfo, result); - }; - - _proto.updateAppendInitSegmentStatus = function updateAppendInitSegmentStatus(segmentInfo, type) { - // alt audio doesn't manage timestamp offset - if (this.loaderType_ === 'main' && typeof segmentInfo.timestampOffset === 'number' && // in the case that we're handling partial data, we don't want to append an init - // segment for each chunk - !segmentInfo.changedTimestampOffset) { - // if the timestamp offset changed, the timeline may have changed, so we have to re- - // append init segments - this.appendInitSegment_ = { - audio: true, - video: true - }; - } - - if (this.playlistOfLastInitSegment_[type] !== segmentInfo.playlist) { - // make sure we append init segment on playlist changes, in case the media config - // changed - this.appendInitSegment_[type] = true; - } - }; - - _proto.getInitSegmentAndUpdateState_ = function getInitSegmentAndUpdateState_(_ref4) { - var type = _ref4.type, - initSegment = _ref4.initSegment, - map = _ref4.map, - playlist = _ref4.playlist; - - // "The EXT-X-MAP tag specifies how to obtain the Media Initialization Section - // (Section 3) required to parse the applicable Media Segments. It applies to every - // Media Segment that appears after it in the Playlist until the next EXT-X-MAP tag - // or until the end of the playlist." - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.5 - if (map) { - var id = initSegmentId(map); - - if (this.activeInitSegmentId_ === id) { - // don't need to re-append the init segment if the ID matches - return null; - } // a map-specified init segment takes priority over any transmuxed (or otherwise - // obtained) init segment - // - // this also caches the init segment for later use - - - initSegment = this.initSegmentForMap(map, true).bytes; - this.activeInitSegmentId_ = id; - } // We used to always prepend init segments for video, however, that shouldn't be - // necessary. Instead, we should only append on changes, similar to what we've always - // done for audio. This is more important (though may not be that important) for - // frame-by-frame appending for LHLS, simply because of the increased quantity of - // appends. - - - if (initSegment && this.appendInitSegment_[type]) { - // Make sure we track the playlist that we last used for the init segment, so that - // we can re-append the init segment in the event that we get data from a new - // playlist. Discontinuities and track changes are handled in other sections. - this.playlistOfLastInitSegment_[type] = playlist; // Disable future init segment appends for this type. Until a change is necessary. - - this.appendInitSegment_[type] = false; // we need to clear out the fmp4 active init segment id, since - // we are appending the muxer init segment - - this.activeInitSegmentId_ = null; - return initSegment; - } - - return null; - }; - - _proto.handleQuotaExceededError_ = function handleQuotaExceededError_(_ref5, error) { - var _this3 = this; - - var segmentInfo = _ref5.segmentInfo, - type = _ref5.type, - bytes = _ref5.bytes; - var audioBuffered = this.sourceUpdater_.audioBuffered(); - var videoBuffered = this.sourceUpdater_.videoBuffered(); // For now we're ignoring any notion of gaps in the buffer, but they, in theory, - // should be cleared out during the buffer removals. However, log in case it helps - // debug. - - if (audioBuffered.length > 1) { - this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: ' + timeRangesToArray(audioBuffered).join(', ')); - } - - if (videoBuffered.length > 1) { - this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: ' + timeRangesToArray(videoBuffered).join(', ')); - } - - var audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0; - var audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0; - var videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0; - var videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0; - - if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER) { - // Can't remove enough buffer to make room for new segment (or the browser doesn't - // allow for appends of segments this size). In the future, it may be possible to - // split up the segment and append in pieces, but for now, error out this playlist - // in an attempt to switch to a more manageable rendition. - this.logger_('On QUOTA_EXCEEDED_ERR, single segment too large to append to ' + 'buffer, triggering an error. ' + ("Appended byte length: " + bytes.byteLength + ", ") + ("audio buffer: " + timeRangesToArray(audioBuffered).join(', ') + ", ") + ("video buffer: " + timeRangesToArray(videoBuffered).join(', ') + ", ")); - this.error({ - message: 'Quota exceeded error with append of a single segment of content', - excludeUntil: Infinity - }); - this.trigger('error'); - return; - } // To try to resolve the quota exceeded error, clear back buffer and retry. This means - // that the segment-loader should block on future events until this one is handled, so - // that it doesn't keep moving onto further segments. Adding the call to the call - // queue will prevent further appends until waitingOnRemove_ and - // quotaExceededErrorRetryTimeout_ are cleared. - // - // Note that this will only block the current loader. In the case of demuxed content, - // the other load may keep filling as fast as possible. In practice, this should be - // OK, as it is a rare case when either audio has a high enough bitrate to fill up a - // source buffer, or video fills without enough room for audio to append (and without - // the availability of clearing out seconds of back buffer to make room for audio). - // But it might still be good to handle this case in the future as a TODO. - - - this.waitingOnRemove_ = true; - this.callQueue_.push(this.appendToSourceBuffer_.bind(this, { - segmentInfo: segmentInfo, - type: type, - bytes: bytes - })); - var currentTime = this.currentTime_(); // Try to remove as much audio and video as possible to make room for new content - // before retrying. - - var timeToRemoveUntil = currentTime - MIN_BACK_BUFFER; - this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to " + timeToRemoveUntil); - this.remove(0, timeToRemoveUntil, function () { - _this3.logger_("On QUOTA_EXCEEDED_ERR, retrying append in " + MIN_BACK_BUFFER + "s"); - - _this3.waitingOnRemove_ = false; // wait the length of time alotted in the back buffer to prevent wasted - // attempts (since we can't clear less than the minimum) - - _this3.quotaExceededErrorRetryTimeout_ = window__default['default'].setTimeout(function () { - _this3.logger_('On QUOTA_EXCEEDED_ERR, re-processing call queue'); - - _this3.quotaExceededErrorRetryTimeout_ = null; - - _this3.processCallQueue_(); - }, MIN_BACK_BUFFER * 1000); - }, true); - }; - - _proto.handleAppendError_ = function handleAppendError_(_ref6, error) { - var segmentInfo = _ref6.segmentInfo, - type = _ref6.type, - bytes = _ref6.bytes; - - // if there's no error, nothing to do - if (!error) { - return; - } - - if (error.code === QUOTA_EXCEEDED_ERR) { - this.handleQuotaExceededError_({ - segmentInfo: segmentInfo, - type: type, - bytes: bytes - }); // A quota exceeded error should be recoverable with a future re-append, so no need - // to trigger an append error. - - return; - } - - this.logger_('Received non QUOTA_EXCEEDED_ERR on append', error); - this.error(type + " append of " + bytes.length + "b failed for segment " + ("#" + segmentInfo.mediaIndex + " in playlist " + segmentInfo.playlist.id)); // If an append errors, we often can't recover. - // (see https://w3c.github.io/media-source/#sourcebuffer-append-error). - // - // Trigger a special error so that it can be handled separately from normal, - // recoverable errors. - - this.trigger('appenderror'); - }; - - _proto.appendToSourceBuffer_ = function appendToSourceBuffer_(_ref7) { - var segmentInfo = _ref7.segmentInfo, - type = _ref7.type, - initSegment = _ref7.initSegment, - data = _ref7.data, - bytes = _ref7.bytes; - - // If this is a re-append, bytes were already created and don't need to be recreated - if (!bytes) { - var segments = [data]; - var byteLength = data.byteLength; - - if (initSegment) { - // if the media initialization segment is changing, append it before the content - // segment - segments.unshift(initSegment); - byteLength += initSegment.byteLength; - } // Technically we should be OK appending the init segment separately, however, we - // haven't yet tested that, and prepending is how we have always done things. - - - bytes = concatSegments({ - bytes: byteLength, - segments: segments - }); - } - - this.sourceUpdater_.appendBuffer({ - segmentInfo: segmentInfo, - type: type, - bytes: bytes - }, this.handleAppendError_.bind(this, { - segmentInfo: segmentInfo, - type: type, - bytes: bytes - })); - }; - - _proto.handleSegmentTimingInfo_ = function handleSegmentTimingInfo_(type, requestId, segmentTimingInfo) { - if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) { - return; - } - - var segment = this.pendingSegment_.segment; - var timingInfoProperty = type + "TimingInfo"; - - if (!segment[timingInfoProperty]) { - segment[timingInfoProperty] = {}; - } - - segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0; - segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation; - segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode; - segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation; - segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode; // mainly used as a reference for debugging - - segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime; - }; - - _proto.appendData_ = function appendData_(segmentInfo, result) { - var type = result.type, - data = result.data; - - if (!data || !data.byteLength) { - return; - } - - if (type === 'audio' && this.audioDisabled_) { - return; - } - - var initSegment = this.getInitSegmentAndUpdateState_({ - type: type, - initSegment: result.initSegment, - playlist: segmentInfo.playlist, - map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null - }); - this.appendToSourceBuffer_({ - segmentInfo: segmentInfo, - type: type, - initSegment: initSegment, - data: data - }); - } - /** - * load a specific segment from a request into the buffer - * - * @private - */ - ; - - _proto.loadSegment_ = function loadSegment_(segmentInfo) { - var _this4 = this; - - this.state = 'WAITING'; - this.pendingSegment_ = segmentInfo; - this.trimBackBuffer_(segmentInfo); - - if (typeof segmentInfo.timestampOffset === 'number') { - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearAllMp4Captions' - }); - } - } - - if (!this.hasEnoughInfoToLoad_()) { - this.loadQueue_.push(function () { - // regenerate the audioAppendStart, timestampOffset, etc as they - // may have changed since this function was added to the queue. - var options = _extends_1({}, segmentInfo, { - forceTimestampOffset: true - }); - - _extends_1(segmentInfo, _this4.generateSegmentInfo_(options)); - - _this4.isPendingTimestampOffset_ = false; - - _this4.updateTransmuxerAndRequestSegment_(segmentInfo); - }); - return; - } - - this.updateTransmuxerAndRequestSegment_(segmentInfo); - }; - - _proto.updateTransmuxerAndRequestSegment_ = function updateTransmuxerAndRequestSegment_(segmentInfo) { - var _this5 = this; - - // We'll update the source buffer's timestamp offset once we have transmuxed data, but - // the transmuxer still needs to be updated before then. - // - // Even though keepOriginalTimestamps is set to true for the transmuxer, timestamp - // offset must be passed to the transmuxer for stream correcting adjustments. - if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) { - this.gopBuffer_.length = 0; // gopsToAlignWith was set before the GOP buffer was cleared - - segmentInfo.gopsToAlignWith = []; - this.timeMapping_ = 0; // reset values in the transmuxer since a discontinuity should start fresh - - this.transmuxer_.postMessage({ - action: 'reset' - }); - this.transmuxer_.postMessage({ - action: 'setTimestampOffset', - timestampOffset: segmentInfo.timestampOffset - }); - } - - var simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo); - var isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex); - var isWalkingForward = this.mediaIndex !== null; - var isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && // currentTimeline starts at -1, so we shouldn't end the timeline switching to 0, - // the first timeline - segmentInfo.timeline > 0; - var isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity; - this.logger_("Requesting " + segmentInfoString(segmentInfo)); // If there's an init segment associated with this segment, but it is not cached (identified by a lack of bytes), - // then this init segment has never been seen before and should be appended. - // - // At this point the content type (audio/video or both) is not yet known, but it should be safe to set - // both to true and leave the decision of whether to append the init segment to append time. - - if (simpleSegment.map && !simpleSegment.map.bytes) { - this.logger_('going to request init segment.'); - this.appendInitSegment_ = { - video: true, - audio: true - }; - } - - segmentInfo.abortRequests = mediaSegmentRequest({ - xhr: this.vhs_.xhr, - xhrOptions: this.xhrOptions_, - decryptionWorker: this.decrypter_, - segment: simpleSegment, - abortFn: this.handleAbort_.bind(this, segmentInfo), - progressFn: this.handleProgress_.bind(this), - trackInfoFn: this.handleTrackInfo_.bind(this), - timingInfoFn: this.handleTimingInfo_.bind(this), - videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'video', segmentInfo.requestId), - audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'audio', segmentInfo.requestId), - captionsFn: this.handleCaptions_.bind(this), - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: function endedTimelineFn() { - _this5.logger_('received endedtimeline callback'); - }, - id3Fn: this.handleId3_.bind(this), - dataFn: this.handleData_.bind(this), - doneFn: this.segmentRequestFinished_.bind(this) - }); - } - /** - * trim the back buffer so that we don't have too much data - * in the source buffer - * - * @private - * - * @param {Object} segmentInfo - the current segment - */ - ; - - _proto.trimBackBuffer_ = function trimBackBuffer_(segmentInfo) { - var removeToTime = safeBackBufferTrimTime(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10); // Chrome has a hard limit of 150MB of - // buffer and a very conservative "garbage collector" - // We manually clear out the old buffer to ensure - // we don't trigger the QuotaExceeded error - // on the source buffer during subsequent appends - - if (removeToTime > 0) { - this.remove(0, removeToTime); - } - } - /** - * created a simplified copy of the segment object with just the - * information necessary to perform the XHR and decryption - * - * @private - * - * @param {Object} segmentInfo - the current segment - * @return {Object} a simplified segment object copy - */ - ; - - _proto.createSimplifiedSegmentObj_ = function createSimplifiedSegmentObj_(segmentInfo) { - var segment = segmentInfo.segment; - var part = segmentInfo.part; - var simpleSegment = { - resolvedUri: part ? part.resolvedUri : segment.resolvedUri, - byterange: part ? part.byterange : segment.byterange, - requestId: segmentInfo.requestId, - transmuxer: segmentInfo.transmuxer, - audioAppendStart: segmentInfo.audioAppendStart, - gopsToAlignWith: segmentInfo.gopsToAlignWith, - part: segmentInfo.part - }; - var previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1]; - - if (previousSegment && previousSegment.timeline === segment.timeline) { - // The baseStartTime of a segment is used to handle rollover when probing the TS - // segment to retrieve timing information. Since the probe only looks at the media's - // times (e.g., PTS and DTS values of the segment), and doesn't consider the - // player's time (e.g., player.currentTime()), baseStartTime should reflect the - // media time as well. transmuxedDecodeEnd represents the end time of a segment, in - // seconds of media time, so should be used here. The previous segment is used since - // the end of the previous segment should represent the beginning of the current - // segment, so long as they are on the same timeline. - if (previousSegment.videoTimingInfo) { - simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd; - } else if (previousSegment.audioTimingInfo) { - simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd; - } - } - - if (segment.key) { - // if the media sequence is greater than 2^32, the IV will be incorrect - // assuming 10s segments, that would be about 1300 years - var iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]); - simpleSegment.key = this.segmentKey(segment.key); - simpleSegment.key.iv = iv; - } - - if (segment.map) { - simpleSegment.map = this.initSegmentForMap(segment.map); - } - - return simpleSegment; - }; - - _proto.saveTransferStats_ = function saveTransferStats_(stats) { - // every request counts as a media request even if it has been aborted - // or canceled due to a timeout - this.mediaRequests += 1; - - if (stats) { - this.mediaBytesTransferred += stats.bytesReceived; - this.mediaTransferDuration += stats.roundTripTime; - } - }; - - _proto.saveBandwidthRelatedStats_ = function saveBandwidthRelatedStats_(duration, stats) { - // byteLength will be used for throughput, and should be based on bytes receieved, - // which we only know at the end of the request and should reflect total bytes - // downloaded rather than just bytes processed from components of the segment - this.pendingSegment_.byteLength = stats.bytesReceived; - - if (duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) { - this.logger_("Ignoring segment's bandwidth because its duration of " + duration + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS)); - return; - } - - this.bandwidth = stats.bandwidth; - this.roundTrip = stats.roundTripTime; - }; - - _proto.handleTimeout_ = function handleTimeout_() { - // although the VTT segment loader bandwidth isn't really used, it's good to - // maintain functinality between segment loaders - this.mediaRequestsTimedout += 1; - this.bandwidth = 1; - this.roundTrip = NaN; - this.trigger('bandwidthupdate'); - } - /** - * Handle the callback from the segmentRequest function and set the - * associated SegmentLoader state and errors if necessary - * - * @private - */ - ; - - _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) { - // TODO handle special cases, e.g., muxed audio/video but only audio in the segment - // check the call queue directly since this function doesn't need to deal with any - // data, and can continue even if the source buffers are not set up and we didn't get - // any data from the segment - if (this.callQueue_.length) { - this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result)); - return; - } - - this.saveTransferStats_(simpleSegment.stats); // The request was aborted and the SegmentLoader has already been reset - - if (!this.pendingSegment_) { - return; - } // the request was aborted and the SegmentLoader has already started - // another request. this can happen when the timeout for an aborted - // request triggers due to a limitation in the XHR library - // do not count this as any sort of request or we risk double-counting - - - if (simpleSegment.requestId !== this.pendingSegment_.requestId) { - return; - } // an error occurred from the active pendingSegment_ so reset everything - - - if (error) { - this.pendingSegment_ = null; - this.state = 'READY'; // aborts are not a true error condition and nothing corrective needs to be done - - if (error.code === REQUEST_ERRORS.ABORTED) { - return; - } - - this.pause(); // the error is really just that at least one of the requests timed-out - // set the bandwidth to a very low value and trigger an ABR switch to - // take emergency action - - if (error.code === REQUEST_ERRORS.TIMEOUT) { - this.handleTimeout_(); - return; - } // if control-flow has arrived here, then the error is real - // emit an error event to blacklist the current playlist - - - this.mediaRequestsErrored += 1; - this.error(error); - this.trigger('error'); - return; - } - - var segmentInfo = this.pendingSegment_; // the response was a success so set any bandwidth stats the request - // generated for ABR purposes - - this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats); - segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests; - - if (result.gopInfo) { - this.gopBuffer_ = updateGopBuffer(this.gopBuffer_, result.gopInfo, this.safeAppend_); - } // Although we may have already started appending on progress, we shouldn't switch the - // state away from loading until we are officially done loading the segment data. - - - this.state = 'APPENDING'; // used for testing - - this.trigger('appending'); - this.waitForAppendsToComplete_(segmentInfo); - }; - - _proto.setTimeMapping_ = function setTimeMapping_(timeline) { - var timelineMapping = this.syncController_.mappingForTimeline(timeline); - - if (timelineMapping !== null) { - this.timeMapping_ = timelineMapping; - } - }; - - _proto.updateMediaSecondsLoaded_ = function updateMediaSecondsLoaded_(segment) { - if (typeof segment.start === 'number' && typeof segment.end === 'number') { - this.mediaSecondsLoaded += segment.end - segment.start; - } else { - this.mediaSecondsLoaded += segment.duration; - } - }; - - _proto.shouldUpdateTransmuxerTimestampOffset_ = function shouldUpdateTransmuxerTimestampOffset_(timestampOffset) { - if (timestampOffset === null) { - return false; - } // note that we're potentially using the same timestamp offset for both video and - // audio - - - if (this.loaderType_ === 'main' && timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) { - return true; - } - - if (!this.audioDisabled_ && timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) { - return true; - } - - return false; - }; - - _proto.trueSegmentStart_ = function trueSegmentStart_(_ref8) { - var currentStart = _ref8.currentStart, - playlist = _ref8.playlist, - mediaIndex = _ref8.mediaIndex, - firstVideoFrameTimeForData = _ref8.firstVideoFrameTimeForData, - currentVideoTimestampOffset = _ref8.currentVideoTimestampOffset, - useVideoTimingInfo = _ref8.useVideoTimingInfo, - videoTimingInfo = _ref8.videoTimingInfo, - audioTimingInfo = _ref8.audioTimingInfo; - - if (typeof currentStart !== 'undefined') { - // if start was set once, keep using it - return currentStart; - } - - if (!useVideoTimingInfo) { - return audioTimingInfo.start; - } - - var previousSegment = playlist.segments[mediaIndex - 1]; // The start of a segment should be the start of the first full frame contained - // within that segment. Since the transmuxer maintains a cache of incomplete data - // from and/or the last frame seen, the start time may reflect a frame that starts - // in the previous segment. Check for that case and ensure the start time is - // accurate for the segment. - - if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === 'undefined' || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) { - return firstVideoFrameTimeForData; - } - - return videoTimingInfo.start; - }; - - _proto.waitForAppendsToComplete_ = function waitForAppendsToComplete_(segmentInfo) { - if (!this.currentMediaInfo_) { - this.error({ - message: 'No starting media returned, likely due to an unsupported media format.', - blacklistDuration: Infinity - }); - this.trigger('error'); - return; - } // Although transmuxing is done, appends may not yet be finished. Throw a marker - // on each queue this loader is responsible for to ensure that the appends are - // complete. - - - var _this$currentMediaInf2 = this.currentMediaInfo_, - hasAudio = _this$currentMediaInf2.hasAudio, - hasVideo = _this$currentMediaInf2.hasVideo, - isMuxed = _this$currentMediaInf2.isMuxed; - var waitForVideo = this.loaderType_ === 'main' && hasVideo; - var waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed; - segmentInfo.waitingOnAppends = 0; // segments with no data - - if (!segmentInfo.hasAppendedData_) { - if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === 'number') { - // When there's no audio or video data in the segment, there's no audio or video - // timing information. - // - // If there's no audio or video timing information, then the timestamp offset - // can't be adjusted to the appropriate value for the transmuxer and source - // buffers. - // - // Therefore, the next segment should be used to set the timestamp offset. - this.isPendingTimestampOffset_ = true; - } // override settings for metadata only segments - - - segmentInfo.timingInfo = { - start: 0 - }; - segmentInfo.waitingOnAppends++; - - if (!this.isPendingTimestampOffset_) { - // update the timestampoffset - this.updateSourceBufferTimestampOffset_(segmentInfo); // make sure the metadata queue is processed even though we have - // no video/audio data. - - this.processMetadataQueue_(); - } // append is "done" instantly with no data. - - - this.checkAppendsDone_(segmentInfo); - return; - } // Since source updater could call back synchronously, do the increments first. - - - if (waitForVideo) { - segmentInfo.waitingOnAppends++; - } - - if (waitForAudio) { - segmentInfo.waitingOnAppends++; - } - - if (waitForVideo) { - this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo)); - } - - if (waitForAudio) { - this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo)); - } - }; - - _proto.checkAppendsDone_ = function checkAppendsDone_(segmentInfo) { - if (this.checkForAbort_(segmentInfo.requestId)) { - return; - } - - segmentInfo.waitingOnAppends--; - - if (segmentInfo.waitingOnAppends === 0) { - this.handleAppendsDone_(); - } - }; - - _proto.checkForIllegalMediaSwitch = function checkForIllegalMediaSwitch(trackInfo) { - var illegalMediaSwitchError = illegalMediaSwitch(this.loaderType_, this.currentMediaInfo_, trackInfo); - - if (illegalMediaSwitchError) { - this.error({ - message: illegalMediaSwitchError, - blacklistDuration: Infinity - }); - this.trigger('error'); - return true; - } - - return false; - }; - - _proto.updateSourceBufferTimestampOffset_ = function updateSourceBufferTimestampOffset_(segmentInfo) { - if (segmentInfo.timestampOffset === null || // we don't yet have the start for whatever media type (video or audio) has - // priority, timing-wise, so we must wait - typeof segmentInfo.timingInfo.start !== 'number' || // already updated the timestamp offset for this segment - segmentInfo.changedTimestampOffset || // the alt audio loader should not be responsible for setting the timestamp offset - this.loaderType_ !== 'main') { - return; - } - - var didChange = false; // Primary timing goes by video, and audio is trimmed in the transmuxer, meaning that - // the timing info here comes from video. In the event that the audio is longer than - // the video, this will trim the start of the audio. - // This also trims any offset from 0 at the beginning of the media - - segmentInfo.timestampOffset -= segmentInfo.timingInfo.start; // In the event that there are part segment downloads, each will try to update the - // timestamp offset. Retaining this bit of state prevents us from updating in the - // future (within the same segment), however, there may be a better way to handle it. - - segmentInfo.changedTimestampOffset = true; - - if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) { - this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset); - didChange = true; - } - - if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) { - this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset); - didChange = true; - } - - if (didChange) { - this.trigger('timestampoffset'); - } - }; - - _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_(segmentInfo) { - segmentInfo.timingInfo = segmentInfo.timingInfo || {}; - var useVideoTimingInfo = this.loaderType_ === 'main' && this.currentMediaInfo_.hasVideo; - var prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo; - - if (!prioritizedTimingInfo) { - return; - } - - segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === 'number' ? // End time may not exist in a case where we aren't parsing the full segment (one - // current example is the case of fmp4), so use the rough duration to calculate an - // end time. - prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration; - } - /** - * callback to run when appendBuffer is finished. detects if we are - * in a good state to do things with the data we got, or if we need - * to wait for more - * - * @private - */ - ; - - _proto.handleAppendsDone_ = function handleAppendsDone_() { - // appendsdone can cause an abort - if (this.pendingSegment_) { - this.trigger('appendsdone'); - } - - if (!this.pendingSegment_) { - this.state = 'READY'; // TODO should this move into this.checkForAbort to speed up requests post abort in - // all appending cases? - - if (!this.paused()) { - this.monitorBuffer_(); - } - - return; - } - - var segmentInfo = this.pendingSegment_; // Now that the end of the segment has been reached, we can set the end time. It's - // best to wait until all appends are done so we're sure that the primary media is - // finished (and we have its end time). - - this.updateTimingInfoEnd_(segmentInfo); - - if (this.shouldSaveSegmentTimingInfo_) { - // Timeline mappings should only be saved for the main loader. This is for multiple - // reasons: - // - // 1) Only one mapping is saved per timeline, meaning that if both the audio loader - // and the main loader try to save the timeline mapping, whichever comes later - // will overwrite the first. In theory this is OK, as the mappings should be the - // same, however, it breaks for (2) - // 2) In the event of a live stream, the initial live point will make for a somewhat - // arbitrary mapping. If audio and video streams are not perfectly in-sync, then - // the mapping will be off for one of the streams, dependent on which one was - // first saved (see (1)). - // 3) Primary timing goes by video in VHS, so the mapping should be video. - // - // Since the audio loader will wait for the main loader to load the first segment, - // the main loader will save the first timeline mapping, and ensure that there won't - // be a case where audio loads two segments without saving a mapping (thus leading - // to missing segment timing info). - this.syncController_.saveSegmentTimingInfo({ - segmentInfo: segmentInfo, - shouldSaveTimelineMapping: this.loaderType_ === 'main' - }); - } - - var segmentDurationMessage = getTroublesomeSegmentDurationMessage(segmentInfo, this.sourceType_); - - if (segmentDurationMessage) { - if (segmentDurationMessage.severity === 'warn') { - videojs__default['default'].log.warn(segmentDurationMessage.message); - } else { - this.logger_(segmentDurationMessage.message); - } - } - - this.recordThroughput_(segmentInfo); - this.pendingSegment_ = null; - this.state = 'READY'; - - if (segmentInfo.isSyncRequest) { - this.trigger('syncinfoupdate'); // if the sync request was not appended - // then it was not the correct segment. - // throw it away and use the data it gave us - // to get the correct one. - - if (!segmentInfo.hasAppendedData_) { - this.logger_("Throwing away un-appended sync request " + segmentInfoString(segmentInfo)); - return; - } - } - - this.logger_("Appended " + segmentInfoString(segmentInfo)); - this.addSegmentMetadataCue_(segmentInfo); - this.fetchAtBuffer_ = true; - - if (this.currentTimeline_ !== segmentInfo.timeline) { - this.timelineChangeController_.lastTimelineChange({ - type: this.loaderType_, - from: this.currentTimeline_, - to: segmentInfo.timeline - }); // If audio is not disabled, the main segment loader is responsible for updating - // the audio timeline as well. If the content is video only, this won't have any - // impact. - - if (this.loaderType_ === 'main' && !this.audioDisabled_) { - this.timelineChangeController_.lastTimelineChange({ - type: 'audio', - from: this.currentTimeline_, - to: segmentInfo.timeline - }); - } - } - - this.currentTimeline_ = segmentInfo.timeline; // We must update the syncinfo to recalculate the seekable range before - // the following conditional otherwise it may consider this a bad "guess" - // and attempt to resync when the post-update seekable window and live - // point would mean that this was the perfect segment to fetch - - this.trigger('syncinfoupdate'); - var segment = segmentInfo.segment; // If we previously appended a segment that ends more than 3 targetDurations before - // the currentTime_ that means that our conservative guess was too conservative. - // In that case, reset the loader state so that we try to use any information gained - // from the previous request to create a new, more accurate, sync-point. - - if (segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3) { - this.resetEverything(); - return; - } - - var isWalkingForward = this.mediaIndex !== null; // Don't do a rendition switch unless we have enough time to get a sync segment - // and conservatively guess - - if (isWalkingForward) { - this.trigger('bandwidthupdate'); - } - - this.trigger('progress'); - this.mediaIndex = segmentInfo.mediaIndex; - this.partIndex = segmentInfo.partIndex; // any time an update finishes and the last segment is in the - // buffer, end the stream. this ensures the "ended" event will - // fire if playback reaches that point. - - if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) { - this.endOfStream(); - } // used for testing - - - this.trigger('appended'); - - if (segmentInfo.hasAppendedData_) { - this.mediaAppends++; - } - - if (!this.paused()) { - this.monitorBuffer_(); - } - } - /** - * Records the current throughput of the decrypt, transmux, and append - * portion of the semgment pipeline. `throughput.rate` is a the cumulative - * moving average of the throughput. `throughput.count` is the number of - * data points in the average. - * - * @private - * @param {Object} segmentInfo the object returned by loadSegment - */ - ; - - _proto.recordThroughput_ = function recordThroughput_(segmentInfo) { - if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) { - this.logger_("Ignoring segment's throughput because its duration of " + segmentInfo.duration + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS)); - return; - } - - var rate = this.throughput.rate; // Add one to the time to ensure that we don't accidentally attempt to divide - // by zero in the case where the throughput is ridiculously high - - var segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1; // Multiply by 8000 to convert from bytes/millisecond to bits/second - - var segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1000); // This is just a cumulative moving average calculation: - // newAvg = oldAvg + (sample - oldAvg) / (sampleCount + 1) - - this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count; - } - /** - * Adds a cue to the segment-metadata track with some metadata information about the - * segment - * - * @private - * @param {Object} segmentInfo - * the object returned by loadSegment - * @method addSegmentMetadataCue_ - */ - ; - - _proto.addSegmentMetadataCue_ = function addSegmentMetadataCue_(segmentInfo) { - if (!this.segmentMetadataTrack_) { - return; - } - - var segment = segmentInfo.segment; - var start = segment.start; - var end = segment.end; // Do not try adding the cue if the start and end times are invalid. - - if (!finite(start) || !finite(end)) { - return; - } - - removeCuesFromTrack(start, end, this.segmentMetadataTrack_); - var Cue = window__default['default'].WebKitDataCue || window__default['default'].VTTCue; - var value = { - custom: segment.custom, - dateTimeObject: segment.dateTimeObject, - dateTimeString: segment.dateTimeString, - bandwidth: segmentInfo.playlist.attributes.BANDWIDTH, - resolution: segmentInfo.playlist.attributes.RESOLUTION, - codecs: segmentInfo.playlist.attributes.CODECS, - byteLength: segmentInfo.byteLength, - uri: segmentInfo.uri, - timeline: segmentInfo.timeline, - playlist: segmentInfo.playlist.id, - start: start, - end: end - }; - var data = JSON.stringify(value); - var cue = new Cue(start, end, data); // Attach the metadata to the value property of the cue to keep consistency between - // the differences of WebKitDataCue in safari and VTTCue in other browsers - - cue.value = value; - this.segmentMetadataTrack_.addCue(cue); - }; - - return SegmentLoader; - }(videojs__default['default'].EventTarget); - - function noop() {} - - var toTitleCase = function toTitleCase(string) { - if (typeof string !== 'string') { - return string; - } - - return string.replace(/./, function (w) { - return w.toUpperCase(); - }); - }; - - var bufferTypes = ['video', 'audio']; - - var _updating = function updating(type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type]; - }; - - var nextQueueIndexOfType = function nextQueueIndexOfType(type, queue) { - for (var i = 0; i < queue.length; i++) { - var queueEntry = queue[i]; - - if (queueEntry.type === 'mediaSource') { - // If the next entry is a media source entry (uses multiple source buffers), block - // processing to allow it to go through first. - return null; - } - - if (queueEntry.type === type) { - return i; - } - } - - return null; - }; - - var shiftQueue = function shiftQueue(type, sourceUpdater) { - if (sourceUpdater.queue.length === 0) { - return; - } - - var queueIndex = 0; - var queueEntry = sourceUpdater.queue[queueIndex]; - - if (queueEntry.type === 'mediaSource') { - if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== 'closed') { - sourceUpdater.queue.shift(); - queueEntry.action(sourceUpdater); - - if (queueEntry.doneFn) { - queueEntry.doneFn(); - } // Only specific source buffer actions must wait for async updateend events. Media - // Source actions process synchronously. Therefore, both audio and video source - // buffers are now clear to process the next queue entries. - - - shiftQueue('audio', sourceUpdater); - shiftQueue('video', sourceUpdater); - } // Media Source actions require both source buffers, so if the media source action - // couldn't process yet (because one or both source buffers are busy), block other - // queue actions until both are available and the media source action can process. - - - return; - } - - if (type === 'mediaSource') { - // If the queue was shifted by a media source action (this happens when pushing a - // media source action onto the queue), then it wasn't from an updateend event from an - // audio or video source buffer, so there's no change from previous state, and no - // processing should be done. - return; - } // Media source queue entries don't need to consider whether the source updater is - // started (i.e., source buffers are created) as they don't need the source buffers, but - // source buffer queue entries do. - - - if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === 'closed' || _updating(type, sourceUpdater)) { - return; - } - - if (queueEntry.type !== type) { - queueIndex = nextQueueIndexOfType(type, sourceUpdater.queue); - - if (queueIndex === null) { - // Either there's no queue entry that uses this source buffer type in the queue, or - // there's a media source queue entry before the next entry of this type, in which - // case wait for that action to process first. - return; - } - - queueEntry = sourceUpdater.queue[queueIndex]; - } - - sourceUpdater.queue.splice(queueIndex, 1); // Keep a record that this source buffer type is in use. - // - // The queue pending operation must be set before the action is performed in the event - // that the action results in a synchronous event that is acted upon. For instance, if - // an exception is thrown that can be handled, it's possible that new actions will be - // appended to an empty queue and immediately executed, but would not have the correct - // pending information if this property was set after the action was performed. - - sourceUpdater.queuePending[type] = queueEntry; - queueEntry.action(type, sourceUpdater); - - if (!queueEntry.doneFn) { - // synchronous operation, process next entry - sourceUpdater.queuePending[type] = null; - shiftQueue(type, sourceUpdater); - return; - } - }; - - var cleanupBuffer = function cleanupBuffer(type, sourceUpdater) { - var buffer = sourceUpdater[type + "Buffer"]; - var titleType = toTitleCase(type); - - if (!buffer) { - return; - } - - buffer.removeEventListener('updateend', sourceUpdater["on" + titleType + "UpdateEnd_"]); - buffer.removeEventListener('error', sourceUpdater["on" + titleType + "Error_"]); - sourceUpdater.codecs[type] = null; - sourceUpdater[type + "Buffer"] = null; - }; - - var inSourceBuffers = function inSourceBuffers(mediaSource, sourceBuffer) { - return mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1; - }; - - var actions = { - appendBuffer: function appendBuffer(bytes, segmentInfo, onError) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Appending segment " + segmentInfo.mediaIndex + "'s " + bytes.length + " bytes to " + type + "Buffer"); - - try { - sourceBuffer.appendBuffer(bytes); - } catch (e) { - sourceUpdater.logger_("Error with code " + e.code + " " + (e.code === QUOTA_EXCEEDED_ERR ? '(QUOTA_EXCEEDED_ERR) ' : '') + ("when appending segment " + segmentInfo.mediaIndex + " to " + type + "Buffer")); - sourceUpdater.queuePending[type] = null; - onError(e); - } - }; - }, - remove: function remove(start, end) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Removing " + start + " to " + end + " from " + type + "Buffer"); - - try { - sourceBuffer.remove(start, end); - } catch (e) { - sourceUpdater.logger_("Remove " + start + " to " + end + " from " + type + "Buffer failed"); - } - }; - }, - timestampOffset: function timestampOffset(offset) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Setting " + type + "timestampOffset to " + offset); - sourceBuffer.timestampOffset = offset; - }; - }, - callback: function callback(_callback) { - return function (type, sourceUpdater) { - _callback(); - }; - }, - endOfStream: function endOfStream(error) { - return function (sourceUpdater) { - if (sourceUpdater.mediaSource.readyState !== 'open') { - return; - } - - sourceUpdater.logger_("Calling mediaSource endOfStream(" + (error || '') + ")"); - - try { - sourceUpdater.mediaSource.endOfStream(error); - } catch (e) { - videojs__default['default'].log.warn('Failed to call media source endOfStream', e); - } - }; - }, - duration: function duration(_duration) { - return function (sourceUpdater) { - sourceUpdater.logger_("Setting mediaSource duration to " + _duration); - - try { - sourceUpdater.mediaSource.duration = _duration; - } catch (e) { - videojs__default['default'].log.warn('Failed to set media source duration', e); - } - }; - }, - abort: function abort() { - return function (type, sourceUpdater) { - if (sourceUpdater.mediaSource.readyState !== 'open') { - return; - } - - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("calling abort on " + type + "Buffer"); - - try { - sourceBuffer.abort(); - } catch (e) { - videojs__default['default'].log.warn("Failed to abort on " + type + "Buffer", e); - } - }; - }, - addSourceBuffer: function addSourceBuffer(type, codec) { - return function (sourceUpdater) { - var titleType = toTitleCase(type); - var mime = getMimeForCodec(codec); - sourceUpdater.logger_("Adding " + type + "Buffer with codec " + codec + " to mediaSource"); - var sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime); - sourceBuffer.addEventListener('updateend', sourceUpdater["on" + titleType + "UpdateEnd_"]); - sourceBuffer.addEventListener('error', sourceUpdater["on" + titleType + "Error_"]); - sourceUpdater.codecs[type] = codec; - sourceUpdater[type + "Buffer"] = sourceBuffer; - }; - }, - removeSourceBuffer: function removeSourceBuffer(type) { - return function (sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - cleanupBuffer(type, sourceUpdater); // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Removing " + type + "Buffer with codec " + sourceUpdater.codecs[type] + " from mediaSource"); - - try { - sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer); - } catch (e) { - videojs__default['default'].log.warn("Failed to removeSourceBuffer " + type + "Buffer", e); - } - }; - }, - changeType: function changeType(codec) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - var mime = getMimeForCodec(codec); // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } // do not update codec if we don't need to. - - - if (sourceUpdater.codecs[type] === codec) { - return; - } - - sourceUpdater.logger_("changing " + type + "Buffer codec from " + sourceUpdater.codecs[type] + " to " + codec); - sourceBuffer.changeType(mime); - sourceUpdater.codecs[type] = codec; - }; - } - }; - - var pushQueue = function pushQueue(_ref) { - var type = _ref.type, - sourceUpdater = _ref.sourceUpdater, - action = _ref.action, - doneFn = _ref.doneFn, - name = _ref.name; - sourceUpdater.queue.push({ - type: type, - action: action, - doneFn: doneFn, - name: name - }); - shiftQueue(type, sourceUpdater); - }; - - var onUpdateend = function onUpdateend(type, sourceUpdater) { - return function (e) { - // Although there should, in theory, be a pending action for any updateend receieved, - // there are some actions that may trigger updateend events without set definitions in - // the w3c spec. For instance, setting the duration on the media source may trigger - // updateend events on source buffers. This does not appear to be in the spec. As such, - // if we encounter an updateend without a corresponding pending action from our queue - // for that source buffer type, process the next action. - if (sourceUpdater.queuePending[type]) { - var doneFn = sourceUpdater.queuePending[type].doneFn; - sourceUpdater.queuePending[type] = null; - - if (doneFn) { - // if there's an error, report it - doneFn(sourceUpdater[type + "Error_"]); - } - } - - shiftQueue(type, sourceUpdater); - }; - }; - /** - * A queue of callbacks to be serialized and applied when a - * MediaSource and its associated SourceBuffers are not in the - * updating state. It is used by the segment loader to update the - * underlying SourceBuffers when new data is loaded, for instance. - * - * @class SourceUpdater - * @param {MediaSource} mediaSource the MediaSource to create the SourceBuffer from - * @param {string} mimeType the desired MIME type of the underlying SourceBuffer - */ - - - var SourceUpdater = /*#__PURE__*/function (_videojs$EventTarget) { - inheritsLoose(SourceUpdater, _videojs$EventTarget); - - function SourceUpdater(mediaSource) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - _this.mediaSource = mediaSource; - - _this.sourceopenListener_ = function () { - return shiftQueue('mediaSource', assertThisInitialized(_this)); - }; - - _this.mediaSource.addEventListener('sourceopen', _this.sourceopenListener_); - - _this.logger_ = logger('SourceUpdater'); // initial timestamp offset is 0 - - _this.audioTimestampOffset_ = 0; - _this.videoTimestampOffset_ = 0; - _this.queue = []; - _this.queuePending = { - audio: null, - video: null - }; - _this.delayedAudioAppendQueue_ = []; - _this.videoAppendQueued_ = false; - _this.codecs = {}; - _this.onVideoUpdateEnd_ = onUpdateend('video', assertThisInitialized(_this)); - _this.onAudioUpdateEnd_ = onUpdateend('audio', assertThisInitialized(_this)); - - _this.onVideoError_ = function (e) { - // used for debugging - _this.videoError_ = e; - }; - - _this.onAudioError_ = function (e) { - // used for debugging - _this.audioError_ = e; - }; - - _this.createdSourceBuffers_ = false; - _this.initializedEme_ = false; - _this.triggeredReady_ = false; - return _this; - } - - var _proto = SourceUpdater.prototype; - - _proto.initializedEme = function initializedEme() { - this.initializedEme_ = true; - this.triggerReady(); - }; - - _proto.hasCreatedSourceBuffers = function hasCreatedSourceBuffers() { - // if false, likely waiting on one of the segment loaders to get enough data to create - // source buffers - return this.createdSourceBuffers_; - }; - - _proto.hasInitializedAnyEme = function hasInitializedAnyEme() { - return this.initializedEme_; - }; - - _proto.ready = function ready() { - return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme(); - }; - - _proto.createSourceBuffers = function createSourceBuffers(codecs) { - if (this.hasCreatedSourceBuffers()) { - // already created them before - return; - } // the intial addOrChangeSourceBuffers will always be - // two add buffers. - - - this.addOrChangeSourceBuffers(codecs); - this.createdSourceBuffers_ = true; - this.trigger('createdsourcebuffers'); - this.triggerReady(); - }; - - _proto.triggerReady = function triggerReady() { - // only allow ready to be triggered once, this prevents the case - // where: - // 1. we trigger createdsourcebuffers - // 2. ie 11 synchronously initializates eme - // 3. the synchronous initialization causes us to trigger ready - // 4. We go back to the ready check in createSourceBuffers and ready is triggered again. - if (this.ready() && !this.triggeredReady_) { - this.triggeredReady_ = true; - this.trigger('ready'); - } - } - /** - * Add a type of source buffer to the media source. - * - * @param {string} type - * The type of source buffer to add. - * - * @param {string} codec - * The codec to add the source buffer with. - */ - ; - - _proto.addSourceBuffer = function addSourceBuffer(type, codec) { - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.addSourceBuffer(type, codec), - name: 'addSourceBuffer' - }); - } - /** - * call abort on a source buffer. - * - * @param {string} type - * The type of source buffer to call abort on. - */ - ; - - _proto.abort = function abort(type) { - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.abort(type), - name: 'abort' - }); - } - /** - * Call removeSourceBuffer and remove a specific type - * of source buffer on the mediaSource. - * - * @param {string} type - * The type of source buffer to remove. - */ - ; - - _proto.removeSourceBuffer = function removeSourceBuffer(type) { - if (!this.canRemoveSourceBuffer()) { - videojs__default['default'].log.error('removeSourceBuffer is not supported!'); - return; - } - - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.removeSourceBuffer(type), - name: 'removeSourceBuffer' - }); - } - /** - * Whether or not the removeSourceBuffer function is supported - * on the mediaSource. - * - * @return {boolean} - * if removeSourceBuffer can be called. - */ - ; - - _proto.canRemoveSourceBuffer = function canRemoveSourceBuffer() { - // IE reports that it supports removeSourceBuffer, but often throws - // errors when attempting to use the function. So we report that it - // does not support removeSourceBuffer. As of Firefox 83 removeSourceBuffer - // throws errors, so we report that it does not support this as well. - return !videojs__default['default'].browser.IE_VERSION && !videojs__default['default'].browser.IS_FIREFOX && window__default['default'].MediaSource && window__default['default'].MediaSource.prototype && typeof window__default['default'].MediaSource.prototype.removeSourceBuffer === 'function'; - } - /** - * Whether or not the changeType function is supported - * on our SourceBuffers. - * - * @return {boolean} - * if changeType can be called. - */ - ; - - SourceUpdater.canChangeType = function canChangeType() { - return window__default['default'].SourceBuffer && window__default['default'].SourceBuffer.prototype && typeof window__default['default'].SourceBuffer.prototype.changeType === 'function'; - } - /** - * Whether or not the changeType function is supported - * on our SourceBuffers. - * - * @return {boolean} - * if changeType can be called. - */ - ; - - _proto.canChangeType = function canChangeType() { - return this.constructor.canChangeType(); - } - /** - * Call the changeType function on a source buffer, given the code and type. - * - * @param {string} type - * The type of source buffer to call changeType on. - * - * @param {string} codec - * The codec string to change type with on the source buffer. - */ - ; - - _proto.changeType = function changeType(type, codec) { - if (!this.canChangeType()) { - videojs__default['default'].log.error('changeType is not supported!'); - return; - } - - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.changeType(codec), - name: 'changeType' - }); - } - /** - * Add source buffers with a codec or, if they are already created, - * call changeType on source buffers using changeType. - * - * @param {Object} codecs - * Codecs to switch to - */ - ; - - _proto.addOrChangeSourceBuffers = function addOrChangeSourceBuffers(codecs) { - var _this2 = this; - - if (!codecs || typeof codecs !== 'object' || Object.keys(codecs).length === 0) { - throw new Error('Cannot addOrChangeSourceBuffers to undefined codecs'); - } - - Object.keys(codecs).forEach(function (type) { - var codec = codecs[type]; - - if (!_this2.hasCreatedSourceBuffers()) { - return _this2.addSourceBuffer(type, codec); - } - - if (_this2.canChangeType()) { - _this2.changeType(type, codec); - } - }); - } - /** - * Queue an update to append an ArrayBuffer. - * - * @param {MediaObject} object containing audioBytes and/or videoBytes - * @param {Function} done the function to call when done - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-appendBuffer-void-ArrayBuffer-data - */ - ; - - _proto.appendBuffer = function appendBuffer(options, doneFn) { - var _this3 = this; - - var segmentInfo = options.segmentInfo, - type = options.type, - bytes = options.bytes; - this.processedAppend_ = true; - - if (type === 'audio' && this.videoBuffer && !this.videoAppendQueued_) { - this.delayedAudioAppendQueue_.push([options, doneFn]); - this.logger_("delayed audio append of " + bytes.length + " until video append"); - return; - } // In the case of certain errors, for instance, QUOTA_EXCEEDED_ERR, updateend will - // not be fired. This means that the queue will be blocked until the next action - // taken by the segment-loader. Provide a mechanism for segment-loader to handle - // these errors by calling the doneFn with the specific error. - - - var onError = doneFn; - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.appendBuffer(bytes, segmentInfo || { - mediaIndex: -1 - }, onError), - doneFn: doneFn, - name: 'appendBuffer' - }); - - if (type === 'video') { - this.videoAppendQueued_ = true; - - if (!this.delayedAudioAppendQueue_.length) { - return; - } - - var queue = this.delayedAudioAppendQueue_.slice(); - this.logger_("queuing delayed audio " + queue.length + " appendBuffers"); - this.delayedAudioAppendQueue_.length = 0; - queue.forEach(function (que) { - _this3.appendBuffer.apply(_this3, que); - }); - } - } - /** - * Get the audio buffer's buffered timerange. - * - * @return {TimeRange} - * The audio buffer's buffered time range - */ - ; - - _proto.audioBuffered = function audioBuffered() { - // no media source/source buffer or it isn't in the media sources - // source buffer list - if (!inSourceBuffers(this.mediaSource, this.audioBuffer)) { - return videojs__default['default'].createTimeRange(); - } - - return this.audioBuffer.buffered ? this.audioBuffer.buffered : videojs__default['default'].createTimeRange(); - } - /** - * Get the video buffer's buffered timerange. - * - * @return {TimeRange} - * The video buffer's buffered time range - */ - ; - - _proto.videoBuffered = function videoBuffered() { - // no media source/source buffer or it isn't in the media sources - // source buffer list - if (!inSourceBuffers(this.mediaSource, this.videoBuffer)) { - return videojs__default['default'].createTimeRange(); - } - - return this.videoBuffer.buffered ? this.videoBuffer.buffered : videojs__default['default'].createTimeRange(); - } - /** - * Get a combined video/audio buffer's buffered timerange. - * - * @return {TimeRange} - * the combined time range - */ - ; - - _proto.buffered = function buffered() { - var video = inSourceBuffers(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null; - var audio = inSourceBuffers(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null; - - if (audio && !video) { - return this.audioBuffered(); - } - - if (video && !audio) { - return this.videoBuffered(); - } - - return bufferIntersection(this.audioBuffered(), this.videoBuffered()); - } - /** - * Add a callback to the queue that will set duration on the mediaSource. - * - * @param {number} duration - * The duration to set - * - * @param {Function} [doneFn] - * function to run after duration has been set. - */ - ; - - _proto.setDuration = function setDuration(duration, doneFn) { - if (doneFn === void 0) { - doneFn = noop; - } - - // In order to set the duration on the media source, it's necessary to wait for all - // source buffers to no longer be updating. "If the updating attribute equals true on - // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and - // abort these steps." (source: https://www.w3.org/TR/media-source/#attributes). - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.duration(duration), - name: 'duration', - doneFn: doneFn - }); - } - /** - * Add a mediaSource endOfStream call to the queue - * - * @param {Error} [error] - * Call endOfStream with an error - * - * @param {Function} [doneFn] - * A function that should be called when the - * endOfStream call has finished. - */ - ; - - _proto.endOfStream = function endOfStream(error, doneFn) { - if (error === void 0) { - error = null; - } - - if (doneFn === void 0) { - doneFn = noop; - } - - if (typeof error !== 'string') { - error = undefined; - } // In order to set the duration on the media source, it's necessary to wait for all - // source buffers to no longer be updating. "If the updating attribute equals true on - // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and - // abort these steps." (source: https://www.w3.org/TR/media-source/#attributes). - - - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.endOfStream(error), - name: 'endOfStream', - doneFn: doneFn - }); - } - /** - * Queue an update to remove a time range from the buffer. - * - * @param {number} start where to start the removal - * @param {number} end where to end the removal - * @param {Function} [done=noop] optional callback to be executed when the remove - * operation is complete - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end - */ - ; - - _proto.removeAudio = function removeAudio(start, end, done) { - if (done === void 0) { - done = noop; - } - - if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) { - done(); - return; - } - - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.remove(start, end), - doneFn: done, - name: 'remove' - }); - } - /** - * Queue an update to remove a time range from the buffer. - * - * @param {number} start where to start the removal - * @param {number} end where to end the removal - * @param {Function} [done=noop] optional callback to be executed when the remove - * operation is complete - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end - */ - ; - - _proto.removeVideo = function removeVideo(start, end, done) { - if (done === void 0) { - done = noop; - } - - if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) { - done(); - return; - } - - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.remove(start, end), - doneFn: done, - name: 'remove' - }); - } - /** - * Whether the underlying sourceBuffer is updating or not - * - * @return {boolean} the updating status of the SourceBuffer - */ - ; - - _proto.updating = function updating() { - // the audio/video source buffer is updating - if (_updating('audio', this) || _updating('video', this)) { - return true; - } - - return false; - } - /** - * Set/get the timestampoffset on the audio SourceBuffer - * - * @return {number} the timestamp offset - */ - ; - - _proto.audioTimestampOffset = function audioTimestampOffset(offset) { - if (typeof offset !== 'undefined' && this.audioBuffer && // no point in updating if it's the same - this.audioTimestampOffset_ !== offset) { - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.timestampOffset(offset), - name: 'timestampOffset' - }); - this.audioTimestampOffset_ = offset; - } - - return this.audioTimestampOffset_; - } - /** - * Set/get the timestampoffset on the video SourceBuffer - * - * @return {number} the timestamp offset - */ - ; - - _proto.videoTimestampOffset = function videoTimestampOffset(offset) { - if (typeof offset !== 'undefined' && this.videoBuffer && // no point in updating if it's the same - this.videoTimestampOffset !== offset) { - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.timestampOffset(offset), - name: 'timestampOffset' - }); - this.videoTimestampOffset_ = offset; - } - - return this.videoTimestampOffset_; - } - /** - * Add a function to the queue that will be called - * when it is its turn to run in the audio queue. - * - * @param {Function} callback - * The callback to queue. - */ - ; - - _proto.audioQueueCallback = function audioQueueCallback(callback) { - if (!this.audioBuffer) { - return; - } - - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.callback(callback), - name: 'callback' - }); - } - /** - * Add a function to the queue that will be called - * when it is its turn to run in the video queue. - * - * @param {Function} callback - * The callback to queue. - */ - ; - - _proto.videoQueueCallback = function videoQueueCallback(callback) { - if (!this.videoBuffer) { - return; - } - - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.callback(callback), - name: 'callback' - }); - } - /** - * dispose of the source updater and the underlying sourceBuffer - */ - ; - - _proto.dispose = function dispose() { - var _this4 = this; - - this.trigger('dispose'); - bufferTypes.forEach(function (type) { - _this4.abort(type); - - if (_this4.canRemoveSourceBuffer()) { - _this4.removeSourceBuffer(type); - } else { - _this4[type + "QueueCallback"](function () { - return cleanupBuffer(type, _this4); - }); - } - }); - this.videoAppendQueued_ = false; - this.delayedAudioAppendQueue_.length = 0; - - if (this.sourceopenListener_) { - this.mediaSource.removeEventListener('sourceopen', this.sourceopenListener_); - } - - this.off(); - }; - - return SourceUpdater; - }(videojs__default['default'].EventTarget); - - var uint8ToUtf8 = function uint8ToUtf8(uintArray) { - return decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray))); - }; - - var VTT_LINE_TERMINATORS = new Uint8Array('\n\n'.split('').map(function (char) { - return char.charCodeAt(0); - })); - /** - * An object that manages segment loading and appending. - * - * @class VTTSegmentLoader - * @param {Object} options required and optional options - * @extends videojs.EventTarget - */ - - var VTTSegmentLoader = /*#__PURE__*/function (_SegmentLoader) { - inheritsLoose(VTTSegmentLoader, _SegmentLoader); - - function VTTSegmentLoader(settings, options) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _SegmentLoader.call(this, settings, options) || this; // SegmentLoader requires a MediaSource be specified or it will throw an error; - // however, VTTSegmentLoader has no need of a media source, so delete the reference - - _this.mediaSource_ = null; - _this.subtitlesTrack_ = null; - _this.loaderType_ = 'subtitle'; - _this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks; // The VTT segment will have its own time mappings. Saving VTT segment timing info in - // the sync controller leads to improper behavior. - - _this.shouldSaveSegmentTimingInfo_ = false; - return _this; - } - - var _proto = VTTSegmentLoader.prototype; - - _proto.createTransmuxer_ = function createTransmuxer_() { - // don't need to transmux any subtitles - return null; - } - /** - * Indicates which time ranges are buffered - * - * @return {TimeRange} - * TimeRange object representing the current buffered ranges - */ - ; - - _proto.buffered_ = function buffered_() { - if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) { - return videojs__default['default'].createTimeRanges(); - } - - var cues = this.subtitlesTrack_.cues; - var start = cues[0].startTime; - var end = cues[cues.length - 1].startTime; - return videojs__default['default'].createTimeRanges([[start, end]]); - } - /** - * Gets and sets init segment for the provided map - * - * @param {Object} map - * The map object representing the init segment to get or set - * @param {boolean=} set - * If true, the init segment for the provided map should be saved - * @return {Object} - * map object for desired init segment - */ - ; - - _proto.initSegmentForMap = function initSegmentForMap(map, set) { - if (set === void 0) { - set = false; - } - - if (!map) { - return null; - } - - var id = initSegmentId(map); - var storedMap = this.initSegments_[id]; - - if (set && !storedMap && map.bytes) { - // append WebVTT line terminators to the media initialization segment if it exists - // to follow the WebVTT spec (https://w3c.github.io/webvtt/#file-structure) that - // requires two or more WebVTT line terminators between the WebVTT header and the - // rest of the file - var combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength; - var combinedSegment = new Uint8Array(combinedByteLength); - combinedSegment.set(map.bytes); - combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength); - this.initSegments_[id] = storedMap = { - resolvedUri: map.resolvedUri, - byterange: map.byterange, - bytes: combinedSegment - }; - } - - return storedMap || map; - } - /** - * Returns true if all configuration required for loading is present, otherwise false. - * - * @return {boolean} True if the all configuration is ready for loading - * @private - */ - ; - - _proto.couldBeginLoading_ = function couldBeginLoading_() { - return this.playlist_ && this.subtitlesTrack_ && !this.paused(); - } - /** - * Once all the starting parameters have been specified, begin - * operation. This method should only be invoked from the INIT - * state. - * - * @private - */ - ; - - _proto.init_ = function init_() { - this.state = 'READY'; - this.resetEverything(); - return this.monitorBuffer_(); - } - /** - * Set a subtitle track on the segment loader to add subtitles to - * - * @param {TextTrack=} track - * The text track to add loaded subtitles to - * @return {TextTrack} - * Returns the subtitles track - */ - ; - - _proto.track = function track(_track) { - if (typeof _track === 'undefined') { - return this.subtitlesTrack_; - } - - this.subtitlesTrack_ = _track; // if we were unpaused but waiting for a sourceUpdater, start - // buffering now - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - this.init_(); - } - - return this.subtitlesTrack_; - } - /** - * Remove any data in the source buffer between start and end times - * - * @param {number} start - the start time of the region to remove from the buffer - * @param {number} end - the end time of the region to remove from the buffer - */ - ; - - _proto.remove = function remove(start, end) { - removeCuesFromTrack(start, end, this.subtitlesTrack_); - } - /** - * fill the buffer with segements unless the sourceBuffers are - * currently updating - * - * Note: this function should only ever be called by monitorBuffer_ - * and never directly - * - * @private - */ - ; - - _proto.fillBuffer_ = function fillBuffer_() { - var _this2 = this; - - // see if we need to begin loading immediately - var segmentInfo = this.chooseNextRequest_(); - - if (!segmentInfo) { - return; - } - - if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) { - // We don't have the timestamp offset that we need to sync subtitles. - // Rerun on a timestamp offset or user interaction. - var checkTimestampOffset = function checkTimestampOffset() { - _this2.state = 'READY'; - - if (!_this2.paused()) { - // if not paused, queue a buffer check as soon as possible - _this2.monitorBuffer_(); - } - }; - - this.syncController_.one('timestampoffset', checkTimestampOffset); - this.state = 'WAITING_ON_TIMELINE'; - return; - } - - this.loadSegment_(segmentInfo); - } // never set a timestamp offset for vtt segments. - ; - - _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_() { - return null; - }; - - _proto.chooseNextRequest_ = function chooseNextRequest_() { - return this.skipEmptySegments_(_SegmentLoader.prototype.chooseNextRequest_.call(this)); - } - /** - * Prevents the segment loader from requesting segments we know contain no subtitles - * by walking forward until we find the next segment that we don't know whether it is - * empty or not. - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @return {Object} - * a segment info object that describes the current segment - */ - ; - - _proto.skipEmptySegments_ = function skipEmptySegments_(segmentInfo) { - while (segmentInfo && segmentInfo.segment.empty) { - // stop at the last possible segmentInfo - if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) { - segmentInfo = null; - break; - } - - segmentInfo = this.generateSegmentInfo_({ - playlist: segmentInfo.playlist, - mediaIndex: segmentInfo.mediaIndex + 1, - startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration, - isSyncRequest: segmentInfo.isSyncRequest - }); - } - - return segmentInfo; - }; - - _proto.stopForError = function stopForError(error) { - this.error(error); - this.state = 'READY'; - this.pause(); - this.trigger('error'); - } - /** - * append a decrypted segement to the SourceBuffer through a SourceUpdater - * - * @private - */ - ; - - _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) { - var _this3 = this; - - if (!this.subtitlesTrack_) { - this.state = 'READY'; - return; - } - - this.saveTransferStats_(simpleSegment.stats); // the request was aborted - - if (!this.pendingSegment_) { - this.state = 'READY'; - this.mediaRequestsAborted += 1; - return; - } - - if (error) { - if (error.code === REQUEST_ERRORS.TIMEOUT) { - this.handleTimeout_(); - } - - if (error.code === REQUEST_ERRORS.ABORTED) { - this.mediaRequestsAborted += 1; - } else { - this.mediaRequestsErrored += 1; - } - - this.stopForError(error); - return; - } - - var segmentInfo = this.pendingSegment_; // although the VTT segment loader bandwidth isn't really used, it's good to - // maintain functionality between segment loaders - - this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats); - this.state = 'APPENDING'; // used for tests - - this.trigger('appending'); - var segment = segmentInfo.segment; - - if (segment.map) { - segment.map.bytes = simpleSegment.map.bytes; - } - - segmentInfo.bytes = simpleSegment.bytes; // Make sure that vttjs has loaded, otherwise, wait till it finished loading - - if (typeof window__default['default'].WebVTT !== 'function' && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) { - var loadHandler; - - var errorHandler = function errorHandler() { - _this3.subtitlesTrack_.tech_.off('vttjsloaded', loadHandler); - - _this3.stopForError({ - message: 'Error loading vtt.js' - }); - - return; - }; - - loadHandler = function loadHandler() { - _this3.subtitlesTrack_.tech_.off('vttjserror', errorHandler); - - _this3.segmentRequestFinished_(error, simpleSegment, result); - }; - - this.state = 'WAITING_ON_VTTJS'; - this.subtitlesTrack_.tech_.one('vttjsloaded', loadHandler); - this.subtitlesTrack_.tech_.one('vttjserror', errorHandler); - return; - } - - segment.requested = true; - - try { - this.parseVTTCues_(segmentInfo); - } catch (e) { - this.stopForError({ - message: e.message - }); - return; - } - - this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_); - - if (segmentInfo.cues.length) { - segmentInfo.timingInfo = { - start: segmentInfo.cues[0].startTime, - end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime - }; - } else { - segmentInfo.timingInfo = { - start: segmentInfo.startOfSegment, - end: segmentInfo.startOfSegment + segmentInfo.duration - }; - } - - if (segmentInfo.isSyncRequest) { - this.trigger('syncinfoupdate'); - this.pendingSegment_ = null; - this.state = 'READY'; - return; - } - - segmentInfo.byteLength = segmentInfo.bytes.byteLength; - this.mediaSecondsLoaded += segment.duration; // Create VTTCue instances for each cue in the new segment and add them to - // the subtitle track - - segmentInfo.cues.forEach(function (cue) { - _this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_ ? new window__default['default'].VTTCue(cue.startTime, cue.endTime, cue.text) : cue); - }); // Remove any duplicate cues from the subtitle track. The WebVTT spec allows - // cues to have identical time-intervals, but if the text is also identical - // we can safely assume it is a duplicate that can be removed (ex. when a cue - // "overlaps" VTT segments) - - removeDuplicateCuesFromTrack(this.subtitlesTrack_); - this.handleAppendsDone_(); - }; - - _proto.handleData_ = function handleData_() {// noop as we shouldn't be getting video/audio data captions - // that we do not support here. - }; - - _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_() {// noop - } - /** - * Uses the WebVTT parser to parse the segment response - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @private - */ - ; - - _proto.parseVTTCues_ = function parseVTTCues_(segmentInfo) { - var decoder; - var decodeBytesToString = false; - - if (typeof window__default['default'].TextDecoder === 'function') { - decoder = new window__default['default'].TextDecoder('utf8'); - } else { - decoder = window__default['default'].WebVTT.StringDecoder(); - decodeBytesToString = true; - } - - var parser = new window__default['default'].WebVTT.Parser(window__default['default'], window__default['default'].vttjs, decoder); - segmentInfo.cues = []; - segmentInfo.timestampmap = { - MPEGTS: 0, - LOCAL: 0 - }; - parser.oncue = segmentInfo.cues.push.bind(segmentInfo.cues); - - parser.ontimestampmap = function (map) { - segmentInfo.timestampmap = map; - }; - - parser.onparsingerror = function (error) { - videojs__default['default'].log.warn('Error encountered when parsing cues: ' + error.message); - }; - - if (segmentInfo.segment.map) { - var mapData = segmentInfo.segment.map.bytes; - - if (decodeBytesToString) { - mapData = uint8ToUtf8(mapData); - } - - parser.parse(mapData); - } - - var segmentData = segmentInfo.bytes; - - if (decodeBytesToString) { - segmentData = uint8ToUtf8(segmentData); - } - - parser.parse(segmentData); - parser.flush(); - } - /** - * Updates the start and end times of any cues parsed by the WebVTT parser using - * the information parsed from the X-TIMESTAMP-MAP header and a TS to media time mapping - * from the SyncController - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @param {Object} mappingObj - * object containing a mapping from TS to media time - * @param {Object} playlist - * the playlist object containing the segment - * @private - */ - ; - - _proto.updateTimeMapping_ = function updateTimeMapping_(segmentInfo, mappingObj, playlist) { - var segment = segmentInfo.segment; - - if (!mappingObj) { - // If the sync controller does not have a mapping of TS to Media Time for the - // timeline, then we don't have enough information to update the cue - // start/end times - return; - } - - if (!segmentInfo.cues.length) { - // If there are no cues, we also do not have enough information to figure out - // segment timing. Mark that the segment contains no cues so we don't re-request - // an empty segment. - segment.empty = true; - return; - } - - var timestampmap = segmentInfo.timestampmap; - var diff = timestampmap.MPEGTS / clock.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping; - segmentInfo.cues.forEach(function (cue) { - // First convert cue time to TS time using the timestamp-map provided within the vtt - cue.startTime += diff; - cue.endTime += diff; - }); - - if (!playlist.syncInfo) { - var firstStart = segmentInfo.cues[0].startTime; - var lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime; - playlist.syncInfo = { - mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex, - time: Math.min(firstStart, lastStart - segment.duration) - }; - } - }; - - return VTTSegmentLoader; - }(SegmentLoader); - - /** - * @file ad-cue-tags.js - */ - /** - * Searches for an ad cue that overlaps with the given mediaTime - * - * @param {Object} track - * the track to find the cue for - * - * @param {number} mediaTime - * the time to find the cue at - * - * @return {Object|null} - * the found cue or null - */ - - var findAdCue = function findAdCue(track, mediaTime) { - var cues = track.cues; - - for (var i = 0; i < cues.length; i++) { - var cue = cues[i]; - - if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) { - return cue; - } - } - - return null; - }; - var updateAdCues = function updateAdCues(media, track, offset) { - if (offset === void 0) { - offset = 0; - } - - if (!media.segments) { - return; - } - - var mediaTime = offset; - var cue; - - for (var i = 0; i < media.segments.length; i++) { - var segment = media.segments[i]; - - if (!cue) { - // Since the cues will span for at least the segment duration, adding a fudge - // factor of half segment duration will prevent duplicate cues from being - // created when timing info is not exact (e.g. cue start time initialized - // at 10.006677, but next call mediaTime is 10.003332 ) - cue = findAdCue(track, mediaTime + segment.duration / 2); - } - - if (cue) { - if ('cueIn' in segment) { - // Found a CUE-IN so end the cue - cue.endTime = mediaTime; - cue.adEndTime = mediaTime; - mediaTime += segment.duration; - cue = null; - continue; - } - - if (mediaTime < cue.endTime) { - // Already processed this mediaTime for this cue - mediaTime += segment.duration; - continue; - } // otherwise extend cue until a CUE-IN is found - - - cue.endTime += segment.duration; - } else { - if ('cueOut' in segment) { - cue = new window__default['default'].VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut); - cue.adStartTime = mediaTime; // Assumes tag format to be - // #EXT-X-CUE-OUT:30 - - cue.adEndTime = mediaTime + parseFloat(segment.cueOut); - track.addCue(cue); - } - - if ('cueOutCont' in segment) { - // Entered into the middle of an ad cue - // Assumes tag formate to be - // #EXT-X-CUE-OUT-CONT:10/30 - var _segment$cueOutCont$s = segment.cueOutCont.split('/').map(parseFloat), - adOffset = _segment$cueOutCont$s[0], - adTotal = _segment$cueOutCont$s[1]; - - cue = new window__default['default'].VTTCue(mediaTime, mediaTime + segment.duration, ''); - cue.adStartTime = mediaTime - adOffset; - cue.adEndTime = cue.adStartTime + adTotal; - track.addCue(cue); - } - } - - mediaTime += segment.duration; - } - }; - - var syncPointStrategies = [// Stategy "VOD": Handle the VOD-case where the sync-point is *always* - // the equivalence display-time 0 === segment-index 0 - { - name: 'VOD', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (duration !== Infinity) { - var syncPoint = { - time: 0, - segmentIndex: 0, - partIndex: null - }; - return syncPoint; - } - - return null; - } - }, // Stategy "ProgramDateTime": We have a program-date-time tag in this playlist - { - name: 'ProgramDateTime', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (!Object.keys(syncController.timelineToDatetimeMappings).length) { - return null; - } - - var syncPoint = null; - var lastDistance = null; - var partsAndSegments = getPartsAndSegments(playlist); - currentTime = currentTime || 0; - - for (var i = 0; i < partsAndSegments.length; i++) { - // start from the end and loop backwards for live - // or start from the front and loop forwards for non-live - var index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1); - var partAndSegment = partsAndSegments[index]; - var segment = partAndSegment.segment; - var datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline]; - - if (!datetimeMapping) { - continue; - } - - if (segment.dateTimeObject) { - var segmentTime = segment.dateTimeObject.getTime() / 1000; - var start = segmentTime + datetimeMapping; // take part duration into account. - - if (segment.parts && typeof partAndSegment.partIndex === 'number') { - for (var z = 0; z < partAndSegment.partIndex; z++) { - start += segment.parts[z].duration; - } - } - - var distance = Math.abs(currentTime - start); // Once the distance begins to increase, or if distance is 0, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && (distance === 0 || lastDistance < distance)) { - break; - } - - lastDistance = distance; - syncPoint = { - time: start, - segmentIndex: partAndSegment.segmentIndex, - partIndex: partAndSegment.partIndex - }; - } - } - - return syncPoint; - } - }, // Stategy "Segment": We have a known time mapping for a timeline and a - // segment in the current timeline with timing data - { - name: 'Segment', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - var syncPoint = null; - var lastDistance = null; - currentTime = currentTime || 0; - var partsAndSegments = getPartsAndSegments(playlist); - - for (var i = 0; i < partsAndSegments.length; i++) { - // start from the end and loop backwards for live - // or start from the front and loop forwards for non-live - var index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1); - var partAndSegment = partsAndSegments[index]; - var segment = partAndSegment.segment; - var start = partAndSegment.part && partAndSegment.part.start || segment && segment.start; - - if (segment.timeline === currentTimeline && typeof start !== 'undefined') { - var distance = Math.abs(currentTime - start); // Once the distance begins to increase, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && lastDistance < distance) { - break; - } - - if (!syncPoint || lastDistance === null || lastDistance >= distance) { - lastDistance = distance; - syncPoint = { - time: start, - segmentIndex: partAndSegment.segmentIndex, - partIndex: partAndSegment.partIndex - }; - } - } - } - - return syncPoint; - } - }, // Stategy "Discontinuity": We have a discontinuity with a known - // display-time - { - name: 'Discontinuity', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - var syncPoint = null; - currentTime = currentTime || 0; - - if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) { - var lastDistance = null; - - for (var i = 0; i < playlist.discontinuityStarts.length; i++) { - var segmentIndex = playlist.discontinuityStarts[i]; - var discontinuity = playlist.discontinuitySequence + i + 1; - var discontinuitySync = syncController.discontinuities[discontinuity]; - - if (discontinuitySync) { - var distance = Math.abs(currentTime - discontinuitySync.time); // Once the distance begins to increase, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && lastDistance < distance) { - break; - } - - if (!syncPoint || lastDistance === null || lastDistance >= distance) { - lastDistance = distance; - syncPoint = { - time: discontinuitySync.time, - segmentIndex: segmentIndex, - partIndex: null - }; - } - } - } - } - - return syncPoint; - } - }, // Stategy "Playlist": We have a playlist with a known mapping of - // segment index to display time - { - name: 'Playlist', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (playlist.syncInfo) { - var syncPoint = { - time: playlist.syncInfo.time, - segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence, - partIndex: null - }; - return syncPoint; - } - - return null; - } - }]; - - var SyncController = /*#__PURE__*/function (_videojs$EventTarget) { - inheritsLoose(SyncController, _videojs$EventTarget); - - function SyncController(options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; // ...for synching across variants - - _this.timelines = []; - _this.discontinuities = []; - _this.timelineToDatetimeMappings = {}; - _this.logger_ = logger('SyncController'); - return _this; - } - /** - * Find a sync-point for the playlist specified - * - * A sync-point is defined as a known mapping from display-time to - * a segment-index in the current playlist. - * - * @param {Playlist} playlist - * The playlist that needs a sync-point - * @param {number} duration - * Duration of the MediaSource (Infinite if playing a live source) - * @param {number} currentTimeline - * The last timeline from which a segment was loaded - * @return {Object} - * A sync-point object - */ - - - var _proto = SyncController.prototype; - - _proto.getSyncPoint = function getSyncPoint(playlist, duration, currentTimeline, currentTime) { - var syncPoints = this.runStrategies_(playlist, duration, currentTimeline, currentTime); - - if (!syncPoints.length) { - // Signal that we need to attempt to get a sync-point manually - // by fetching a segment in the playlist and constructing - // a sync-point from that information - return null; - } // Now find the sync-point that is closest to the currentTime because - // that should result in the most accurate guess about which segment - // to fetch - - - return this.selectSyncPoint_(syncPoints, { - key: 'time', - value: currentTime - }); - } - /** - * Calculate the amount of time that has expired off the playlist during playback - * - * @param {Playlist} playlist - * Playlist object to calculate expired from - * @param {number} duration - * Duration of the MediaSource (Infinity if playling a live source) - * @return {number|null} - * The amount of time that has expired off the playlist during playback. Null - * if no sync-points for the playlist can be found. - */ - ; - - _proto.getExpiredTime = function getExpiredTime(playlist, duration) { - if (!playlist || !playlist.segments) { - return null; - } - - var syncPoints = this.runStrategies_(playlist, duration, playlist.discontinuitySequence, 0); // Without sync-points, there is not enough information to determine the expired time - - if (!syncPoints.length) { - return null; - } - - var syncPoint = this.selectSyncPoint_(syncPoints, { - key: 'segmentIndex', - value: 0 - }); // If the sync-point is beyond the start of the playlist, we want to subtract the - // duration from index 0 to syncPoint.segmentIndex instead of adding. - - if (syncPoint.segmentIndex > 0) { - syncPoint.time *= -1; - } - - return Math.abs(syncPoint.time + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: syncPoint.segmentIndex, - endIndex: 0 - })); - } - /** - * Runs each sync-point strategy and returns a list of sync-points returned by the - * strategies - * - * @private - * @param {Playlist} playlist - * The playlist that needs a sync-point - * @param {number} duration - * Duration of the MediaSource (Infinity if playing a live source) - * @param {number} currentTimeline - * The last timeline from which a segment was loaded - * @return {Array} - * A list of sync-point objects - */ - ; - - _proto.runStrategies_ = function runStrategies_(playlist, duration, currentTimeline, currentTime) { - var syncPoints = []; // Try to find a sync-point in by utilizing various strategies... - - for (var i = 0; i < syncPointStrategies.length; i++) { - var strategy = syncPointStrategies[i]; - var syncPoint = strategy.run(this, playlist, duration, currentTimeline, currentTime); - - if (syncPoint) { - syncPoint.strategy = strategy.name; - syncPoints.push({ - strategy: strategy.name, - syncPoint: syncPoint - }); - } - } - - return syncPoints; - } - /** - * Selects the sync-point nearest the specified target - * - * @private - * @param {Array} syncPoints - * List of sync-points to select from - * @param {Object} target - * Object specifying the property and value we are targeting - * @param {string} target.key - * Specifies the property to target. Must be either 'time' or 'segmentIndex' - * @param {number} target.value - * The value to target for the specified key. - * @return {Object} - * The sync-point nearest the target - */ - ; - - _proto.selectSyncPoint_ = function selectSyncPoint_(syncPoints, target) { - var bestSyncPoint = syncPoints[0].syncPoint; - var bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value); - var bestStrategy = syncPoints[0].strategy; - - for (var i = 1; i < syncPoints.length; i++) { - var newDistance = Math.abs(syncPoints[i].syncPoint[target.key] - target.value); - - if (newDistance < bestDistance) { - bestDistance = newDistance; - bestSyncPoint = syncPoints[i].syncPoint; - bestStrategy = syncPoints[i].strategy; - } - } - - this.logger_("syncPoint for [" + target.key + ": " + target.value + "] chosen with strategy" + (" [" + bestStrategy + "]: [time:" + bestSyncPoint.time + ",") + (" segmentIndex:" + bestSyncPoint.segmentIndex) + (typeof bestSyncPoint.partIndex === 'number' ? ",partIndex:" + bestSyncPoint.partIndex : '') + ']'); - return bestSyncPoint; - } - /** - * Save any meta-data present on the segments when segments leave - * the live window to the playlist to allow for synchronization at the - * playlist level later. - * - * @param {Playlist} oldPlaylist - The previous active playlist - * @param {Playlist} newPlaylist - The updated and most current playlist - */ - ; - - _proto.saveExpiredSegmentInfo = function saveExpiredSegmentInfo(oldPlaylist, newPlaylist) { - var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; // When a segment expires from the playlist and it has a start time - // save that information as a possible sync-point reference in future - - for (var i = mediaSequenceDiff - 1; i >= 0; i--) { - var lastRemovedSegment = oldPlaylist.segments[i]; - - if (lastRemovedSegment && typeof lastRemovedSegment.start !== 'undefined') { - newPlaylist.syncInfo = { - mediaSequence: oldPlaylist.mediaSequence + i, - time: lastRemovedSegment.start - }; - this.logger_("playlist refresh sync: [time:" + newPlaylist.syncInfo.time + "," + (" mediaSequence: " + newPlaylist.syncInfo.mediaSequence + "]")); - this.trigger('syncinfoupdate'); - break; - } - } - } - /** - * Save the mapping from playlist's ProgramDateTime to display. This should only happen - * before segments start to load. - * - * @param {Playlist} playlist - The currently active playlist - */ - ; - - _proto.setDateTimeMappingForStart = function setDateTimeMappingForStart(playlist) { - // It's possible for the playlist to be updated before playback starts, meaning time - // zero is not yet set. If, during these playlist refreshes, a discontinuity is - // crossed, then the old time zero mapping (for the prior timeline) would be retained - // unless the mappings are cleared. - this.timelineToDatetimeMappings = {}; - - if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) { - var firstSegment = playlist.segments[0]; - var playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1000; - this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp; - } - } - /** - * Calculates and saves timeline mappings, playlist sync info, and segment timing values - * based on the latest timing information. - * - * @param {Object} options - * Options object - * @param {SegmentInfo} options.segmentInfo - * The current active request information - * @param {boolean} options.shouldSaveTimelineMapping - * If there's a timeline change, determines if the timeline mapping should be - * saved for timeline mapping and program date time mappings. - */ - ; - - _proto.saveSegmentTimingInfo = function saveSegmentTimingInfo(_ref) { - var segmentInfo = _ref.segmentInfo, - shouldSaveTimelineMapping = _ref.shouldSaveTimelineMapping; - var didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping); - var segment = segmentInfo.segment; - - if (didCalculateSegmentTimeMapping) { - this.saveDiscontinuitySyncInfo_(segmentInfo); // If the playlist does not have sync information yet, record that information - // now with segment timing information - - if (!segmentInfo.playlist.syncInfo) { - segmentInfo.playlist.syncInfo = { - mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex, - time: segment.start - }; - } - } - - var dateTime = segment.dateTimeObject; - - if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) { - this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1000); - } - }; - - _proto.timestampOffsetForTimeline = function timestampOffsetForTimeline(timeline) { - if (typeof this.timelines[timeline] === 'undefined') { - return null; - } - - return this.timelines[timeline].time; - }; - - _proto.mappingForTimeline = function mappingForTimeline(timeline) { - if (typeof this.timelines[timeline] === 'undefined') { - return null; - } - - return this.timelines[timeline].mapping; - } - /** - * Use the "media time" for a segment to generate a mapping to "display time" and - * save that display time to the segment. - * - * @private - * @param {SegmentInfo} segmentInfo - * The current active request information - * @param {Object} timingInfo - * The start and end time of the current segment in "media time" - * @param {boolean} shouldSaveTimelineMapping - * If there's a timeline change, determines if the timeline mapping should be - * saved in timelines. - * @return {boolean} - * Returns false if segment time mapping could not be calculated - */ - ; - - _proto.calculateSegmentTimeMapping_ = function calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) { - // TODO: remove side effects - var segment = segmentInfo.segment; - var part = segmentInfo.part; - var mappingObj = this.timelines[segmentInfo.timeline]; - var start; - var end; - - if (typeof segmentInfo.timestampOffset === 'number') { - mappingObj = { - time: segmentInfo.startOfSegment, - mapping: segmentInfo.startOfSegment - timingInfo.start - }; - - if (shouldSaveTimelineMapping) { - this.timelines[segmentInfo.timeline] = mappingObj; - this.trigger('timestampoffset'); - this.logger_("time mapping for timeline " + segmentInfo.timeline + ": " + ("[time: " + mappingObj.time + "] [mapping: " + mappingObj.mapping + "]")); - } - - start = segmentInfo.startOfSegment; - end = timingInfo.end + mappingObj.mapping; - } else if (mappingObj) { - start = timingInfo.start + mappingObj.mapping; - end = timingInfo.end + mappingObj.mapping; - } else { - return false; - } - - if (part) { - part.start = start; - part.end = end; - } // If we don't have a segment start yet or the start value we got - // is less than our current segment.start value, save a new start value. - // We have to do this because parts will have segment timing info saved - // multiple times and we want segment start to be the earliest part start - // value for that segment. - - - if (!segment.start || start < segment.start) { - segment.start = start; - } - - segment.end = end; - return true; - } - /** - * Each time we have discontinuity in the playlist, attempt to calculate the location - * in display of the start of the discontinuity and save that. We also save an accuracy - * value so that we save values with the most accuracy (closest to 0.) - * - * @private - * @param {SegmentInfo} segmentInfo - The current active request information - */ - ; - - _proto.saveDiscontinuitySyncInfo_ = function saveDiscontinuitySyncInfo_(segmentInfo) { - var playlist = segmentInfo.playlist; - var segment = segmentInfo.segment; // If the current segment is a discontinuity then we know exactly where - // the start of the range and it's accuracy is 0 (greater accuracy values - // mean more approximation) - - if (segment.discontinuity) { - this.discontinuities[segment.timeline] = { - time: segment.start, - accuracy: 0 - }; - } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) { - // Search for future discontinuities that we can provide better timing - // information for and save that information for sync purposes - for (var i = 0; i < playlist.discontinuityStarts.length; i++) { - var segmentIndex = playlist.discontinuityStarts[i]; - var discontinuity = playlist.discontinuitySequence + i + 1; - var mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex; - var accuracy = Math.abs(mediaIndexDiff); - - if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) { - var time = void 0; - - if (mediaIndexDiff < 0) { - time = segment.start - sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: segmentInfo.mediaIndex, - endIndex: segmentIndex - }); - } else { - time = segment.end + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: segmentInfo.mediaIndex + 1, - endIndex: segmentIndex - }); - } - - this.discontinuities[discontinuity] = { - time: time, - accuracy: accuracy - }; - } - } - } - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.off(); - }; - - return SyncController; - }(videojs__default['default'].EventTarget); - - /** - * The TimelineChangeController acts as a source for segment loaders to listen for and - * keep track of latest and pending timeline changes. This is useful to ensure proper - * sync, as each loader may need to make a consideration for what timeline the other - * loader is on before making changes which could impact the other loader's media. - * - * @class TimelineChangeController - * @extends videojs.EventTarget - */ - - var TimelineChangeController = /*#__PURE__*/function (_videojs$EventTarget) { - inheritsLoose(TimelineChangeController, _videojs$EventTarget); - - function TimelineChangeController() { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - _this.pendingTimelineChanges_ = {}; - _this.lastTimelineChanges_ = {}; - return _this; - } - - var _proto = TimelineChangeController.prototype; - - _proto.clearPendingTimelineChange = function clearPendingTimelineChange(type) { - this.pendingTimelineChanges_[type] = null; - this.trigger('pendingtimelinechange'); - }; - - _proto.pendingTimelineChange = function pendingTimelineChange(_ref) { - var type = _ref.type, - from = _ref.from, - to = _ref.to; - - if (typeof from === 'number' && typeof to === 'number') { - this.pendingTimelineChanges_[type] = { - type: type, - from: from, - to: to - }; - this.trigger('pendingtimelinechange'); - } - - return this.pendingTimelineChanges_[type]; - }; - - _proto.lastTimelineChange = function lastTimelineChange(_ref2) { - var type = _ref2.type, - from = _ref2.from, - to = _ref2.to; - - if (typeof from === 'number' && typeof to === 'number') { - this.lastTimelineChanges_[type] = { - type: type, - from: from, - to: to - }; - delete this.pendingTimelineChanges_[type]; - this.trigger('timelinechange'); - } - - return this.lastTimelineChanges_[type]; - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.pendingTimelineChanges_ = {}; - this.lastTimelineChanges_ = {}; - this.off(); - }; - - return TimelineChangeController; - }(videojs__default['default'].EventTarget); - - /* rollup-plugin-worker-factory start for worker!/Users/gkatsevman/p/http-streaming-release/src/decrypter-worker.js */ - var workerCode = transform(function (self) { - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function require(path, base) { - return commonjsRequire(path, base === undefined || base === null ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire() { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var createClass = createCommonjsModule(function (module) { - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - module.exports = _createClass; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - var setPrototypeOf = createCommonjsModule(function (module) { - function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _setPrototypeOf(o, p); - } - - module.exports = _setPrototypeOf; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - var inheritsLoose = createCommonjsModule(function (module) { - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); - } - - module.exports = _inheritsLoose; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - /** - * @file stream.js - */ - - /** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ - - var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; - }(); - /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ - - /** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - - - function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); - } - /*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */ - - /** - * @file aes.js - * - * This file contains an adaptation of the AES decryption algorithm - * from the Standford Javascript Cryptography Library. That work is - * covered by the following copyright and permissions notice: - * - * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 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. - * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing - * official policies, either expressed or implied, of the authors. - */ - - /** - * Expand the S-box tables. - * - * @private - */ - - - var precompute = function precompute() { - var tables = [[[], [], [], [], []], [[], [], [], [], []]]; - var encTable = tables[0]; - var decTable = tables[1]; - var sbox = encTable[4]; - var sboxInv = decTable[4]; - var i; - var x; - var xInv; - var d = []; - var th = []; - var x2; - var x4; - var x8; - var s; - var tEnc; - var tDec; // Compute double and third tables - - for (i = 0; i < 256; i++) { - th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i; - } - - for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) { - // Compute sbox - s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4; - s = s >> 8 ^ s & 255 ^ 99; - sbox[x] = s; - sboxInv[s] = x; // Compute MixColumns - - x8 = d[x4 = d[x2 = d[x]]]; - tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - tEnc = d[s] * 0x101 ^ s * 0x1010100; - - for (i = 0; i < 4; i++) { - encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8; - decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8; - } - } // Compactify. Considerable speedup on Firefox. - - - for (i = 0; i < 5; i++) { - encTable[i] = encTable[i].slice(0); - decTable[i] = decTable[i].slice(0); - } - - return tables; - }; - - var aesTables = null; - /** - * Schedule out an AES key for both encryption and decryption. This - * is a low-level class. Use a cipher mode to do bulk encryption. - * - * @class AES - * @param key {Array} The key as an array of 4, 6 or 8 words. - */ - - var AES = /*#__PURE__*/function () { - function AES(key) { - /** - * The expanded S-box and inverse S-box tables. These will be computed - * on the client so that we don't have to send them down the wire. - * - * There are two tables, _tables[0] is for encryption and - * _tables[1] is for decryption. - * - * The first 4 sub-tables are the expanded S-box with MixColumns. The - * last (_tables[01][4]) is the S-box itself. - * - * @private - */ - // if we have yet to precompute the S-box tables - // do so now - if (!aesTables) { - aesTables = precompute(); - } // then make a copy of that object for use - - - this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]]; - var i; - var j; - var tmp; - var sbox = this._tables[0][4]; - var decTable = this._tables[1]; - var keyLen = key.length; - var rcon = 1; - - if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) { - throw new Error('Invalid aes key size'); - } - - var encKey = key.slice(0); - var decKey = []; - this._key = [encKey, decKey]; // schedule encryption keys - - for (i = keyLen; i < 4 * keyLen + 28; i++) { - tmp = encKey[i - 1]; // apply sbox - - if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) { - tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; // shift rows and add rcon - - if (i % keyLen === 0) { - tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24; - rcon = rcon << 1 ^ (rcon >> 7) * 283; - } - } - - encKey[i] = encKey[i - keyLen] ^ tmp; - } // schedule decryption keys - - - for (j = 0; i; j++, i--) { - tmp = encKey[j & 3 ? i : i - 4]; - - if (i <= 4 || j < 4) { - decKey[j] = tmp; - } else { - decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]]; - } - } - } - /** - * Decrypt 16 bytes, specified as four 32-bit words. - * - * @param {number} encrypted0 the first word to decrypt - * @param {number} encrypted1 the second word to decrypt - * @param {number} encrypted2 the third word to decrypt - * @param {number} encrypted3 the fourth word to decrypt - * @param {Int32Array} out the array to write the decrypted words - * into - * @param {number} offset the offset into the output array to start - * writing results - * @return {Array} The plaintext. - */ - - - var _proto = AES.prototype; - - _proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) { - var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data - - var a = encrypted0 ^ key[0]; - var b = encrypted3 ^ key[1]; - var c = encrypted2 ^ key[2]; - var d = encrypted1 ^ key[3]; - var a2; - var b2; - var c2; // key.length === 2 ? - - var nInnerRounds = key.length / 4 - 2; - var i; - var kIndex = 4; - var table = this._tables[1]; // load up the tables - - var table0 = table[0]; - var table1 = table[1]; - var table2 = table[2]; - var table3 = table[3]; - var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL. - - for (i = 0; i < nInnerRounds; i++) { - a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex]; - b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1]; - c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2]; - d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3]; - kIndex += 4; - a = a2; - b = b2; - c = c2; - } // Last round. - - - for (i = 0; i < 4; i++) { - out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++]; - a2 = a; - a = b; - b = c; - c = d; - d = a2; - } - }; - - return AES; - }(); - /** - * A wrapper around the Stream class to use setTimeout - * and run stream "jobs" Asynchronously - * - * @class AsyncStream - * @extends Stream - */ - - - var AsyncStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(AsyncStream, _Stream); - - function AsyncStream() { - var _this; - - _this = _Stream.call(this, Stream) || this; - _this.jobs = []; - _this.delay = 1; - _this.timeout_ = null; - return _this; - } - /** - * process an async job - * - * @private - */ - - - var _proto = AsyncStream.prototype; - - _proto.processJob_ = function processJob_() { - this.jobs.shift()(); - - if (this.jobs.length) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } else { - this.timeout_ = null; - } - } - /** - * push a job into the stream - * - * @param {Function} job the job to push into the stream - */ - ; - - _proto.push = function push(job) { - this.jobs.push(job); - - if (!this.timeout_) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } - }; - - return AsyncStream; - }(Stream); - /** - * Convert network-order (big-endian) bytes into their little-endian - * representation. - */ - - - var ntoh = function ntoh(word) { - return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24; - }; - /** - * Decrypt bytes using AES-128 with CBC and PKCS#7 padding. - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * use for the first round of CBC. - * @return {Uint8Array} the decrypted bytes - * - * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard - * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29 - * @see https://tools.ietf.org/html/rfc2315 - */ - - - var decrypt = function decrypt(encrypted, key, initVector) { - // word-level access to the encrypted bytes - var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2); - var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output - - var decrypted = new Uint8Array(encrypted.byteLength); - var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and - // decrypted data - - var init0; - var init1; - var init2; - var init3; - var encrypted0; - var encrypted1; - var encrypted2; - var encrypted3; // iteration variable - - var wordIx; // pull out the words of the IV to ensure we don't modify the - // passed-in reference and easier access - - init0 = initVector[0]; - init1 = initVector[1]; - init2 = initVector[2]; - init3 = initVector[3]; // decrypt four word sequences, applying cipher-block chaining (CBC) - // to each decrypted block - - for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { - // convert big-endian (network order) words into little-endian - // (javascript order) - encrypted0 = ntoh(encrypted32[wordIx]); - encrypted1 = ntoh(encrypted32[wordIx + 1]); - encrypted2 = ntoh(encrypted32[wordIx + 2]); - encrypted3 = ntoh(encrypted32[wordIx + 3]); // decrypt the block - - decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); // XOR with the IV, and restore network byte-order to obtain the - // plaintext - - decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0); - decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1); - decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2); - decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); // setup the IV for the next round - - init0 = encrypted0; - init1 = encrypted1; - init2 = encrypted2; - init3 = encrypted3; - } - - return decrypted; - }; - /** - * The `Decrypter` class that manages decryption of AES - * data through `AsyncStream` objects and the `decrypt` - * function - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * @param {Function} done the function to run when done - * @class Decrypter - */ - - - var Decrypter = /*#__PURE__*/function () { - function Decrypter(encrypted, key, initVector, done) { - var step = Decrypter.STEP; - var encrypted32 = new Int32Array(encrypted.buffer); - var decrypted = new Uint8Array(encrypted.byteLength); - var i = 0; - this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously - - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - - for (i = step; i < encrypted32.length; i += step) { - initVector = new Uint32Array([ntoh(encrypted32[i - 4]), ntoh(encrypted32[i - 3]), ntoh(encrypted32[i - 2]), ntoh(encrypted32[i - 1])]); - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - } // invoke the done() callback when everything is finished - - - this.asyncStream_.push(function () { - // remove pkcs#7 padding from the decrypted bytes - done(null, unpad(decrypted)); - }); - } - /** - * a getter for step the maximum number of bytes to process at one time - * - * @return {number} the value of step 32000 - */ - - - var _proto = Decrypter.prototype; - /** - * @private - */ - - _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) { - return function () { - var bytes = decrypt(encrypted, key, initVector); - decrypted.set(bytes, encrypted.byteOffset); - }; - }; - - createClass(Decrypter, null, [{ - key: "STEP", - get: function get() { - // 4 * 8000; - return 32000; - } - }]); - return Decrypter; - }(); - /** - * @file bin-utils.js - */ - - /** - * Creates an object for sending to a web worker modifying properties that are TypedArrays - * into a new object with seperated properties for the buffer, byteOffset, and byteLength. - * - * @param {Object} message - * Object of properties and values to send to the web worker - * @return {Object} - * Modified message with TypedArray values expanded - * @function createTransferableMessage - */ - - - var createTransferableMessage = function createTransferableMessage(message) { - var transferable = {}; - Object.keys(message).forEach(function (key) { - var value = message[key]; - - if (ArrayBuffer.isView(value)) { - transferable[key] = { - bytes: value.buffer, - byteOffset: value.byteOffset, - byteLength: value.byteLength - }; - } else { - transferable[key] = value; - } - }); - return transferable; - }; - /* global self */ - - /** - * Our web worker interface so that things can talk to aes-decrypter - * that will be running in a web worker. the scope is passed to this by - * webworkify. - */ - - - self.onmessage = function (event) { - var data = event.data; - var encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength); - var key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4); - var iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4); - /* eslint-disable no-new, handle-callback-err */ - - new Decrypter(encrypted, key, iv, function (err, bytes) { - self.postMessage(createTransferableMessage({ - source: data.source, - decrypted: bytes - }), [bytes.buffer]); - }); - /* eslint-enable */ - }; - }); - var Decrypter = factory(workerCode); - /* rollup-plugin-worker-factory end for worker!/Users/gkatsevman/p/http-streaming-release/src/decrypter-worker.js */ - - /** - * Convert the properties of an HLS track into an audioTrackKind. - * - * @private - */ - - var audioTrackKind_ = function audioTrackKind_(properties) { - var kind = properties.default ? 'main' : 'alternative'; - - if (properties.characteristics && properties.characteristics.indexOf('public.accessibility.describes-video') >= 0) { - kind = 'main-desc'; - } - - return kind; - }; - /** - * Pause provided segment loader and playlist loader if active - * - * @param {SegmentLoader} segmentLoader - * SegmentLoader to pause - * @param {Object} mediaType - * Active media type - * @function stopLoaders - */ - - - var stopLoaders = function stopLoaders(segmentLoader, mediaType) { - segmentLoader.abort(); - segmentLoader.pause(); - - if (mediaType && mediaType.activePlaylistLoader) { - mediaType.activePlaylistLoader.pause(); - mediaType.activePlaylistLoader = null; - } - }; - /** - * Start loading provided segment loader and playlist loader - * - * @param {PlaylistLoader} playlistLoader - * PlaylistLoader to start loading - * @param {Object} mediaType - * Active media type - * @function startLoaders - */ - - var startLoaders = function startLoaders(playlistLoader, mediaType) { - // Segment loader will be started after `loadedmetadata` or `loadedplaylist` from the - // playlist loader - mediaType.activePlaylistLoader = playlistLoader; - playlistLoader.load(); - }; - /** - * Returns a function to be called when the media group changes. It performs a - * non-destructive (preserve the buffer) resync of the SegmentLoader. This is because a - * change of group is merely a rendition switch of the same content at another encoding, - * rather than a change of content, such as switching audio from English to Spanish. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Handler for a non-destructive resync of SegmentLoader when the active media - * group changes. - * @function onGroupChanged - */ - - var onGroupChanged = function onGroupChanged(type, settings) { - return function () { - var _settings$segmentLoad = settings.segmentLoaders, - segmentLoader = _settings$segmentLoad[type], - mainSegmentLoader = _settings$segmentLoad.main, - mediaType = settings.mediaTypes[type]; - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.getActiveGroup(); - var previousActiveLoader = mediaType.activePlaylistLoader; - var lastGroup = mediaType.lastGroup_; // the group did not change do nothing - - if (activeGroup && lastGroup && activeGroup.id === lastGroup.id) { - return; - } - - mediaType.lastGroup_ = activeGroup; - mediaType.lastTrack_ = activeTrack; - stopLoaders(segmentLoader, mediaType); - - if (!activeGroup || activeGroup.isMasterPlaylist) { - // there is no group active or active group is a main playlist and won't change - return; - } - - if (!activeGroup.playlistLoader) { - if (previousActiveLoader) { - // The previous group had a playlist loader but the new active group does not - // this means we are switching from demuxed to muxed audio. In this case we want to - // do a destructive reset of the main segment loader and not restart the audio - // loaders. - mainSegmentLoader.resetEverything(); - } - - return; - } // Non-destructive resync - - - segmentLoader.resyncLoader(); - startLoaders(activeGroup.playlistLoader, mediaType); - }; - }; - var onGroupChanging = function onGroupChanging(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - mediaType.lastGroup_ = null; - segmentLoader.abort(); - segmentLoader.pause(); - }; - }; - /** - * Returns a function to be called when the media track changes. It performs a - * destructive reset of the SegmentLoader to ensure we start loading as close to - * currentTime as possible. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Handler for a destructive reset of SegmentLoader when the active media - * track changes. - * @function onTrackChanged - */ - - var onTrackChanged = function onTrackChanged(type, settings) { - return function () { - var masterPlaylistLoader = settings.masterPlaylistLoader, - _settings$segmentLoad2 = settings.segmentLoaders, - segmentLoader = _settings$segmentLoad2[type], - mainSegmentLoader = _settings$segmentLoad2.main, - mediaType = settings.mediaTypes[type]; - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.getActiveGroup(); - var previousActiveLoader = mediaType.activePlaylistLoader; - var lastTrack = mediaType.lastTrack_; // track did not change, do nothing - - if (lastTrack && activeTrack && lastTrack.id === activeTrack.id) { - return; - } - - mediaType.lastGroup_ = activeGroup; - mediaType.lastTrack_ = activeTrack; - stopLoaders(segmentLoader, mediaType); - - if (!activeGroup) { - // there is no group active so we do not want to restart loaders - return; - } - - if (activeGroup.isMasterPlaylist) { - // track did not change, do nothing - if (!activeTrack || !lastTrack || activeTrack.id === lastTrack.id) { - return; - } - - var mpc = settings.vhs.masterPlaylistController_; - var newPlaylist = mpc.selectPlaylist(); // media will not change do nothing - - if (mpc.media() === newPlaylist) { - return; - } - - mediaType.logger_("track change. Switching master audio from " + lastTrack.id + " to " + activeTrack.id); - masterPlaylistLoader.pause(); - mainSegmentLoader.resetEverything(); - mpc.fastQualityChange_(newPlaylist); - return; - } - - if (type === 'AUDIO') { - if (!activeGroup.playlistLoader) { - // when switching from demuxed audio/video to muxed audio/video (noted by no - // playlist loader for the audio group), we want to do a destructive reset of the - // main segment loader and not restart the audio loaders - mainSegmentLoader.setAudio(true); // don't have to worry about disabling the audio of the audio segment loader since - // it should be stopped - - mainSegmentLoader.resetEverything(); - return; - } // although the segment loader is an audio segment loader, call the setAudio - // function to ensure it is prepared to re-append the init segment (or handle other - // config changes) - - - segmentLoader.setAudio(true); - mainSegmentLoader.setAudio(false); - } - - if (previousActiveLoader === activeGroup.playlistLoader) { - // Nothing has actually changed. This can happen because track change events can fire - // multiple times for a "single" change. One for enabling the new active track, and - // one for disabling the track that was active - startLoaders(activeGroup.playlistLoader, mediaType); - return; - } - - if (segmentLoader.track) { - // For WebVTT, set the new text track in the segmentloader - segmentLoader.track(activeTrack); - } // destructive reset - - - segmentLoader.resetEverything(); - startLoaders(activeGroup.playlistLoader, mediaType); - }; - }; - var onError = { - /** - * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters - * an error. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Error handler. Logs warning (or error if the playlist is blacklisted) to - * console and switches back to default audio track. - * @function onError.AUDIO - */ - AUDIO: function AUDIO(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type], - blacklistCurrentPlaylist = settings.blacklistCurrentPlaylist; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track - - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.activeGroup(); - var id = (activeGroup.filter(function (group) { - return group.default; - })[0] || activeGroup[0]).id; - var defaultTrack = mediaType.tracks[id]; - - if (activeTrack === defaultTrack) { - // Default track encountered an error. All we can do now is blacklist the current - // rendition and hope another will switch audio groups - blacklistCurrentPlaylist({ - message: 'Problem encountered loading the default audio track.' - }); - return; - } - - videojs__default['default'].log.warn('Problem encountered loading the alternate audio track.' + 'Switching back to default.'); - - for (var trackId in mediaType.tracks) { - mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack; - } - - mediaType.onTrackChanged(); - }; - }, - - /** - * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters - * an error. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Error handler. Logs warning to console and disables the active subtitle track - * @function onError.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - videojs__default['default'].log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); - var track = mediaType.activeTrack(); - - if (track) { - track.mode = 'disabled'; - } - - mediaType.onTrackChanged(); - }; - } - }; - var setupListeners = { - /** - * Setup event listeners for audio playlist loader - * - * @param {string} type - * MediaGroup type - * @param {PlaylistLoader|null} playlistLoader - * PlaylistLoader to register listeners on - * @param {Object} settings - * Object containing required information for media groups - * @function setupListeners.AUDIO - */ - AUDIO: function AUDIO(type, playlistLoader, settings) { - if (!playlistLoader) { - // no playlist loader means audio will be muxed with the video - return; - } - - var tech = settings.tech, - requestOptions = settings.requestOptions, - segmentLoader = settings.segmentLoaders[type]; - playlistLoader.on('loadedmetadata', function () { - var media = playlistLoader.media(); - segmentLoader.playlist(media, requestOptions); // if the video is already playing, or if this isn't a live video and preload - // permits, start downloading segments - - if (!tech.paused() || media.endList && tech.preload() !== 'none') { - segmentLoader.load(); - } - }); - playlistLoader.on('loadedplaylist', function () { - segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running - - if (!tech.paused()) { - segmentLoader.load(); - } - }); - playlistLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup event listeners for subtitle playlist loader - * - * @param {string} type - * MediaGroup type - * @param {PlaylistLoader|null} playlistLoader - * PlaylistLoader to register listeners on - * @param {Object} settings - * Object containing required information for media groups - * @function setupListeners.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, playlistLoader, settings) { - var tech = settings.tech, - requestOptions = settings.requestOptions, - segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - playlistLoader.on('loadedmetadata', function () { - var media = playlistLoader.media(); - segmentLoader.playlist(media, requestOptions); - segmentLoader.track(mediaType.activeTrack()); // if the video is already playing, or if this isn't a live video and preload - // permits, start downloading segments - - if (!tech.paused() || media.endList && tech.preload() !== 'none') { - segmentLoader.load(); - } - }); - playlistLoader.on('loadedplaylist', function () { - segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running - - if (!tech.paused()) { - segmentLoader.load(); - } - }); - playlistLoader.on('error', onError[type](type, settings)); - } - }; - var initialize = { - /** - * Setup PlaylistLoaders and AudioTracks for the audio groups - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize.AUDIO - */ - 'AUDIO': function AUDIO(type, settings) { - var vhs = settings.vhs, - sourceType = settings.sourceType, - segmentLoader = settings.segmentLoaders[type], - requestOptions = settings.requestOptions, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$ = settings.mediaTypes[type], - groups = _settings$mediaTypes$.groups, - tracks = _settings$mediaTypes$.tracks, - logger_ = _settings$mediaTypes$.logger_, - masterPlaylistLoader = settings.masterPlaylistLoader; - var audioOnlyMaster = isAudioOnly(masterPlaylistLoader.master); // force a default if we have none - - if (!mediaGroups[type] || Object.keys(mediaGroups[type]).length === 0) { - mediaGroups[type] = { - main: { - default: { - default: true - } - } - }; - } - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - var properties = mediaGroups[type][groupId][variantLabel]; - var playlistLoader = void 0; - - if (audioOnlyMaster) { - logger_("AUDIO group '" + groupId + "' label '" + variantLabel + "' is a master playlist"); - properties.isMasterPlaylist = true; - playlistLoader = null; // if vhs-json was provided as the source, and the media playlist was resolved, - // use the resolved media playlist object - } else if (sourceType === 'vhs-json' && properties.playlists) { - playlistLoader = new PlaylistLoader(properties.playlists[0], vhs, requestOptions); - } else if (properties.resolvedUri) { - playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions); // TODO: dash isn't the only type with properties.playlists - // should we even have properties.playlists in this check. - } else if (properties.playlists && sourceType === 'dash') { - playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader); - } else { - // no resolvedUri means the audio is muxed with the video when using this - // audio track - playlistLoader = null; - } - - properties = videojs__default['default'].mergeOptions({ - id: variantLabel, - playlistLoader: playlistLoader - }, properties); - setupListeners[type](type, properties.playlistLoader, settings); - groups[groupId].push(properties); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = new videojs__default['default'].AudioTrack({ - id: variantLabel, - kind: audioTrackKind_(properties), - enabled: false, - language: properties.language, - default: properties.default, - label: variantLabel - }); - tracks[variantLabel] = track; - } - } - } // setup single error event handler for the segment loader - - - segmentLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup PlaylistLoaders and TextTracks for the subtitle groups - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize.SUBTITLES - */ - 'SUBTITLES': function SUBTITLES(type, settings) { - var tech = settings.tech, - vhs = settings.vhs, - sourceType = settings.sourceType, - segmentLoader = settings.segmentLoaders[type], - requestOptions = settings.requestOptions, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$2 = settings.mediaTypes[type], - groups = _settings$mediaTypes$2.groups, - tracks = _settings$mediaTypes$2.tracks, - masterPlaylistLoader = settings.masterPlaylistLoader; - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - if (mediaGroups[type][groupId][variantLabel].forced) { - // Subtitle playlists with the forced attribute are not selectable in Safari. - // According to Apple's HLS Authoring Specification: - // If content has forced subtitles and regular subtitles in a given language, - // the regular subtitles track in that language MUST contain both the forced - // subtitles and the regular subtitles for that language. - // Because of this requirement and that Safari does not add forced subtitles, - // forced subtitles are skipped here to maintain consistent experience across - // all platforms - continue; - } - - var properties = mediaGroups[type][groupId][variantLabel]; - var playlistLoader = void 0; - - if (sourceType === 'hls') { - playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions); - } else if (sourceType === 'dash') { - var playlists = properties.playlists.filter(function (p) { - return p.excludeUntil !== Infinity; - }); - - if (!playlists.length) { - return; - } - - playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader); - } else if (sourceType === 'vhs-json') { - playlistLoader = new PlaylistLoader( // if the vhs-json object included the media playlist, use the media playlist - // as provided, otherwise use the resolved URI to load the playlist - properties.playlists ? properties.playlists[0] : properties.resolvedUri, vhs, requestOptions); - } - - properties = videojs__default['default'].mergeOptions({ - id: variantLabel, - playlistLoader: playlistLoader - }, properties); - setupListeners[type](type, properties.playlistLoader, settings); - groups[groupId].push(properties); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = tech.addRemoteTextTrack({ - id: variantLabel, - kind: 'subtitles', - default: properties.default && properties.autoselect, - language: properties.language, - label: variantLabel - }, false).track; - tracks[variantLabel] = track; - } - } - } // setup single error event handler for the segment loader - - - segmentLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup TextTracks for the closed-caption groups - * - * @param {String} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize['CLOSED-CAPTIONS'] - */ - 'CLOSED-CAPTIONS': function CLOSEDCAPTIONS(type, settings) { - var tech = settings.tech, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$3 = settings.mediaTypes[type], - groups = _settings$mediaTypes$3.groups, - tracks = _settings$mediaTypes$3.tracks; - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - var properties = mediaGroups[type][groupId][variantLabel]; // Look for either 608 (CCn) or 708 (SERVICEn) caption services - - if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) { - continue; - } - - var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {}; - var newProps = { - label: variantLabel, - language: properties.language, - instreamId: properties.instreamId, - default: properties.default && properties.autoselect - }; - - if (captionServices[newProps.instreamId]) { - newProps = videojs__default['default'].mergeOptions(newProps, captionServices[newProps.instreamId]); - } - - if (newProps.default === undefined) { - delete newProps.default; - } // No PlaylistLoader is required for Closed-Captions because the captions are - // embedded within the video stream - - - groups[groupId].push(videojs__default['default'].mergeOptions({ - id: variantLabel - }, properties)); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = tech.addRemoteTextTrack({ - id: newProps.instreamId, - kind: 'captions', - default: newProps.default, - language: newProps.language, - label: newProps.label - }, false).track; - tracks[variantLabel] = track; - } - } - } - } - }; - - var groupMatch = function groupMatch(list, media) { - for (var i = 0; i < list.length; i++) { - if (playlistMatch(media, list[i])) { - return true; - } - - if (list[i].playlists && groupMatch(list[i].playlists, media)) { - return true; - } - } - - return false; - }; - /** - * Returns a function used to get the active group of the provided type - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media group for the provided type. Takes an - * optional parameter {TextTrack} track. If no track is provided, a list of all - * variants in the group, otherwise the variant corresponding to the provided - * track is returned. - * @function activeGroup - */ - - - var activeGroup = function activeGroup(type, settings) { - return function (track) { - var masterPlaylistLoader = settings.masterPlaylistLoader, - groups = settings.mediaTypes[type].groups; - var media = masterPlaylistLoader.media(); - - if (!media) { - return null; - } - - var variants = null; // set to variants to main media active group - - if (media.attributes[type]) { - variants = groups[media.attributes[type]]; - } - - var groupKeys = Object.keys(groups); - - if (!variants) { - // find the masterPlaylistLoader media - // that is in a media group if we are dealing - // with audio only - if (type === 'AUDIO' && groupKeys.length > 1 && isAudioOnly(settings.master)) { - for (var i = 0; i < groupKeys.length; i++) { - var groupPropertyList = groups[groupKeys[i]]; - - if (groupMatch(groupPropertyList, media)) { - variants = groupPropertyList; - break; - } - } // use the main group if it exists - - } else if (groups.main) { - variants = groups.main; // only one group, use that one - } else if (groupKeys.length === 1) { - variants = groups[groupKeys[0]]; - } - } - - if (typeof track === 'undefined') { - return variants; - } - - if (track === null || !variants) { - // An active track was specified so a corresponding group is expected. track === null - // means no track is currently active so there is no corresponding group - return null; - } - - return variants.filter(function (props) { - return props.id === track.id; - })[0] || null; - }; - }; - var activeTrack = { - /** - * Returns a function used to get the active track of type provided - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media track for the provided type. Returns - * null if no track is active - * @function activeTrack.AUDIO - */ - AUDIO: function AUDIO(type, settings) { - return function () { - var tracks = settings.mediaTypes[type].tracks; - - for (var id in tracks) { - if (tracks[id].enabled) { - return tracks[id]; - } - } - - return null; - }; - }, - - /** - * Returns a function used to get the active track of type provided - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media track for the provided type. Returns - * null if no track is active - * @function activeTrack.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, settings) { - return function () { - var tracks = settings.mediaTypes[type].tracks; - - for (var id in tracks) { - if (tracks[id].mode === 'showing' || tracks[id].mode === 'hidden') { - return tracks[id]; - } - } - - return null; - }; - } - }; - var getActiveGroup = function getActiveGroup(type, _ref) { - var mediaTypes = _ref.mediaTypes; - return function () { - var activeTrack_ = mediaTypes[type].activeTrack(); - - if (!activeTrack_) { - return null; - } - - return mediaTypes[type].activeGroup(activeTrack_); - }; - }; - /** - * Setup PlaylistLoaders and Tracks for media groups (Audio, Subtitles, - * Closed-Captions) specified in the master manifest. - * - * @param {Object} settings - * Object containing required information for setting up the media groups - * @param {Tech} settings.tech - * The tech of the player - * @param {Object} settings.requestOptions - * XHR request options used by the segment loaders - * @param {PlaylistLoader} settings.masterPlaylistLoader - * PlaylistLoader for the master source - * @param {VhsHandler} settings.vhs - * VHS SourceHandler - * @param {Object} settings.master - * The parsed master manifest - * @param {Object} settings.mediaTypes - * Object to store the loaders, tracks, and utility methods for each media type - * @param {Function} settings.blacklistCurrentPlaylist - * Blacklists the current rendition and forces a rendition switch. - * @function setupMediaGroups - */ - - var setupMediaGroups = function setupMediaGroups(settings) { - ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(function (type) { - initialize[type](type, settings); - }); - var mediaTypes = settings.mediaTypes, - masterPlaylistLoader = settings.masterPlaylistLoader, - tech = settings.tech, - vhs = settings.vhs, - _settings$segmentLoad3 = settings.segmentLoaders, - audioSegmentLoader = _settings$segmentLoad3['AUDIO'], - mainSegmentLoader = _settings$segmentLoad3.main; // setup active group and track getters and change event handlers - - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - mediaTypes[type].activeGroup = activeGroup(type, settings); - mediaTypes[type].activeTrack = activeTrack[type](type, settings); - mediaTypes[type].onGroupChanged = onGroupChanged(type, settings); - mediaTypes[type].onGroupChanging = onGroupChanging(type, settings); - mediaTypes[type].onTrackChanged = onTrackChanged(type, settings); - mediaTypes[type].getActiveGroup = getActiveGroup(type, settings); - }); // DO NOT enable the default subtitle or caption track. - // DO enable the default audio track - - var audioGroup = mediaTypes.AUDIO.activeGroup(); - - if (audioGroup) { - var groupId = (audioGroup.filter(function (group) { - return group.default; - })[0] || audioGroup[0]).id; - mediaTypes.AUDIO.tracks[groupId].enabled = true; - mediaTypes.AUDIO.onGroupChanged(); - mediaTypes.AUDIO.onTrackChanged(); - var activeAudioGroup = mediaTypes.AUDIO.getActiveGroup(); // a similar check for handling setAudio on each loader is run again each time the - // track is changed, but needs to be handled here since the track may not be considered - // changed on the first call to onTrackChanged - - if (!activeAudioGroup.playlistLoader) { - // either audio is muxed with video or the stream is audio only - mainSegmentLoader.setAudio(true); - } else { - // audio is demuxed - mainSegmentLoader.setAudio(false); - audioSegmentLoader.setAudio(true); - } - } - - masterPlaylistLoader.on('mediachange', function () { - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - return mediaTypes[type].onGroupChanged(); - }); - }); - masterPlaylistLoader.on('mediachanging', function () { - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - return mediaTypes[type].onGroupChanging(); - }); - }); // custom audio track change event handler for usage event - - var onAudioTrackChanged = function onAudioTrackChanged() { - mediaTypes.AUDIO.onTrackChanged(); - tech.trigger({ - type: 'usage', - name: 'vhs-audio-change' - }); - tech.trigger({ - type: 'usage', - name: 'hls-audio-change' - }); - }; - - tech.audioTracks().addEventListener('change', onAudioTrackChanged); - tech.remoteTextTracks().addEventListener('change', mediaTypes.SUBTITLES.onTrackChanged); - vhs.on('dispose', function () { - tech.audioTracks().removeEventListener('change', onAudioTrackChanged); - tech.remoteTextTracks().removeEventListener('change', mediaTypes.SUBTITLES.onTrackChanged); - }); // clear existing audio tracks and add the ones we just created - - tech.clearTracks('audio'); - - for (var id in mediaTypes.AUDIO.tracks) { - tech.audioTracks().addTrack(mediaTypes.AUDIO.tracks[id]); - } - }; - /** - * Creates skeleton object used to store the loaders, tracks, and utility methods for each - * media type - * - * @return {Object} - * Object to store the loaders, tracks, and utility methods for each media type - * @function createMediaTypes - */ - - var createMediaTypes = function createMediaTypes() { - var mediaTypes = {}; - ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(function (type) { - mediaTypes[type] = { - groups: {}, - tracks: {}, - activePlaylistLoader: null, - activeGroup: noop, - activeTrack: noop, - getActiveGroup: noop, - onGroupChanged: noop, - onTrackChanged: noop, - lastTrack_: null, - logger_: logger("MediaGroups[" + type + "]") - }; - }); - return mediaTypes; - }; - - var ABORT_EARLY_BLACKLIST_SECONDS = 60 * 2; - var Vhs$1; // SegmentLoader stats that need to have each loader's - // values summed to calculate the final value - - var loaderStats = ['mediaRequests', 'mediaRequestsAborted', 'mediaRequestsTimedout', 'mediaRequestsErrored', 'mediaTransferDuration', 'mediaBytesTransferred', 'mediaAppends']; - - var sumLoaderStat = function sumLoaderStat(stat) { - return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat]; - }; - - var shouldSwitchToMedia = function shouldSwitchToMedia(_ref) { - var currentPlaylist = _ref.currentPlaylist, - nextPlaylist = _ref.nextPlaylist, - forwardBuffer = _ref.forwardBuffer, - bufferLowWaterLine = _ref.bufferLowWaterLine, - bufferHighWaterLine = _ref.bufferHighWaterLine, - duration = _ref.duration, - experimentalBufferBasedABR = _ref.experimentalBufferBasedABR, - log = _ref.log; - - // we have no other playlist to switch to - if (!nextPlaylist) { - videojs__default['default'].log.warn('We received no playlist to switch to. Please check your stream.'); - return false; - } - - var sharedLogLine = "allowing switch " + (currentPlaylist && currentPlaylist.id || 'null') + " -> " + nextPlaylist.id; // If the playlist is live, then we want to not take low water line into account. - // This is because in LIVE, the player plays 3 segments from the end of the - // playlist, and if `BUFFER_LOW_WATER_LINE` is greater than the duration availble - // in those segments, a viewer will never experience a rendition upswitch. - - if (!currentPlaylist || !currentPlaylist.endList) { - log(sharedLogLine + " as current playlist " + (!currentPlaylist ? 'is not set' : 'is live')); - return true; - } // no need to switch playlist is the same - - - if (nextPlaylist.id === currentPlaylist.id) { - return false; - } - - var maxBufferLowWaterLine = experimentalBufferBasedABR ? Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config.MAX_BUFFER_LOW_WATER_LINE; // For the same reason as LIVE, we ignore the low water line when the VOD - // duration is below the max potential low water line - - if (duration < maxBufferLowWaterLine) { - log(sharedLogLine + " as duration < max low water line (" + duration + " < " + maxBufferLowWaterLine + ")"); - return true; - } - - var nextBandwidth = nextPlaylist.attributes.BANDWIDTH; - var currBandwidth = currentPlaylist.attributes.BANDWIDTH; // when switching down, if our buffer is lower than the high water line, - // we can switch down - - if (nextBandwidth < currBandwidth && (!experimentalBufferBasedABR || forwardBuffer < bufferHighWaterLine)) { - var logLine = sharedLogLine + " as next bandwidth < current bandwidth (" + nextBandwidth + " < " + currBandwidth + ")"; - - if (experimentalBufferBasedABR) { - logLine += " and forwardBuffer < bufferHighWaterLine (" + forwardBuffer + " < " + bufferHighWaterLine + ")"; - } - - log(logLine); - return true; - } // and if our buffer is higher than the low water line, - // we can switch up - - - if ((!experimentalBufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) { - var _logLine = sharedLogLine + " as forwardBuffer >= bufferLowWaterLine (" + forwardBuffer + " >= " + bufferLowWaterLine + ")"; - - if (experimentalBufferBasedABR) { - _logLine += " and next bandwidth > current bandwidth (" + nextBandwidth + " > " + currBandwidth + ")"; - } - - log(_logLine); - return true; - } - - log("not " + sharedLogLine + " as no switching criteria met"); - return false; - }; - /** - * the master playlist controller controller all interactons - * between playlists and segmentloaders. At this time this mainly - * involves a master playlist and a series of audio playlists - * if they are available - * - * @class MasterPlaylistController - * @extends videojs.EventTarget - */ - - - var MasterPlaylistController = /*#__PURE__*/function (_videojs$EventTarget) { - inheritsLoose(MasterPlaylistController, _videojs$EventTarget); - - function MasterPlaylistController(options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - var src = options.src, - handleManifestRedirects = options.handleManifestRedirects, - withCredentials = options.withCredentials, - tech = options.tech, - bandwidth = options.bandwidth, - externVhs = options.externVhs, - useCueTags = options.useCueTags, - blacklistDuration = options.blacklistDuration, - enableLowInitialPlaylist = options.enableLowInitialPlaylist, - sourceType = options.sourceType, - cacheEncryptionKeys = options.cacheEncryptionKeys, - experimentalBufferBasedABR = options.experimentalBufferBasedABR; - - if (!src) { - throw new Error('A non-empty playlist URL or JSON manifest string is required'); - } - - var maxPlaylistRetries = options.maxPlaylistRetries; - - if (maxPlaylistRetries === null || typeof maxPlaylistRetries === 'undefined') { - maxPlaylistRetries = Infinity; - } - - Vhs$1 = externVhs; - _this.experimentalBufferBasedABR = Boolean(experimentalBufferBasedABR); - _this.withCredentials = withCredentials; - _this.tech_ = tech; - _this.vhs_ = tech.vhs; - _this.sourceType_ = sourceType; - _this.useCueTags_ = useCueTags; - _this.blacklistDuration = blacklistDuration; - _this.maxPlaylistRetries = maxPlaylistRetries; - _this.enableLowInitialPlaylist = enableLowInitialPlaylist; - - if (_this.useCueTags_) { - _this.cueTagsTrack_ = _this.tech_.addTextTrack('metadata', 'ad-cues'); - _this.cueTagsTrack_.inBandMetadataTrackDispatchType = ''; - } - - _this.requestOptions_ = { - withCredentials: withCredentials, - handleManifestRedirects: handleManifestRedirects, - maxPlaylistRetries: maxPlaylistRetries, - timeout: null - }; - - _this.on('error', _this.pauseLoading); - - _this.mediaTypes_ = createMediaTypes(); - _this.mediaSource = new window__default['default'].MediaSource(); - _this.handleDurationChange_ = _this.handleDurationChange_.bind(assertThisInitialized(_this)); - _this.handleSourceOpen_ = _this.handleSourceOpen_.bind(assertThisInitialized(_this)); - _this.handleSourceEnded_ = _this.handleSourceEnded_.bind(assertThisInitialized(_this)); - - _this.mediaSource.addEventListener('durationchange', _this.handleDurationChange_); // load the media source into the player - - - _this.mediaSource.addEventListener('sourceopen', _this.handleSourceOpen_); - - _this.mediaSource.addEventListener('sourceended', _this.handleSourceEnded_); // we don't have to handle sourceclose since dispose will handle termination of - // everything, and the MediaSource should not be detached without a proper disposal - - - _this.seekable_ = videojs__default['default'].createTimeRanges(); - _this.hasPlayed_ = false; - _this.syncController_ = new SyncController(options); - _this.segmentMetadataTrack_ = tech.addRemoteTextTrack({ - kind: 'metadata', - label: 'segment-metadata' - }, false).track; - _this.decrypter_ = new Decrypter(); - _this.sourceUpdater_ = new SourceUpdater(_this.mediaSource); - _this.inbandTextTracks_ = {}; - _this.timelineChangeController_ = new TimelineChangeController(); - var segmentLoaderSettings = { - vhs: _this.vhs_, - parse708captions: options.parse708captions, - mediaSource: _this.mediaSource, - currentTime: _this.tech_.currentTime.bind(_this.tech_), - seekable: function seekable() { - return _this.seekable(); - }, - seeking: function seeking() { - return _this.tech_.seeking(); - }, - duration: function duration() { - return _this.duration(); - }, - hasPlayed: function hasPlayed() { - return _this.hasPlayed_; - }, - goalBufferLength: function goalBufferLength() { - return _this.goalBufferLength(); - }, - bandwidth: bandwidth, - syncController: _this.syncController_, - decrypter: _this.decrypter_, - sourceType: _this.sourceType_, - inbandTextTracks: _this.inbandTextTracks_, - cacheEncryptionKeys: cacheEncryptionKeys, - sourceUpdater: _this.sourceUpdater_, - timelineChangeController: _this.timelineChangeController_ - }; // The source type check not only determines whether a special DASH playlist loader - // should be used, but also covers the case where the provided src is a vhs-json - // manifest object (instead of a URL). In the case of vhs-json, the default - // PlaylistLoader should be used. - - _this.masterPlaylistLoader_ = _this.sourceType_ === 'dash' ? new DashPlaylistLoader(src, _this.vhs_, _this.requestOptions_) : new PlaylistLoader(src, _this.vhs_, _this.requestOptions_); - - _this.setupMasterPlaylistLoaderListeners_(); // setup segment loaders - // combined audio/video or just video when alternate audio track is selected - - - _this.mainSegmentLoader_ = new SegmentLoader(videojs__default['default'].mergeOptions(segmentLoaderSettings, { - segmentMetadataTrack: _this.segmentMetadataTrack_, - loaderType: 'main' - }), options); // alternate audio track - - _this.audioSegmentLoader_ = new SegmentLoader(videojs__default['default'].mergeOptions(segmentLoaderSettings, { - loaderType: 'audio' - }), options); - _this.subtitleSegmentLoader_ = new VTTSegmentLoader(videojs__default['default'].mergeOptions(segmentLoaderSettings, { - loaderType: 'vtt', - featuresNativeTextTracks: _this.tech_.featuresNativeTextTracks - }), options); - - _this.setupSegmentLoaderListeners_(); - - if (_this.experimentalBufferBasedABR) { - _this.masterPlaylistLoader_.one('loadedplaylist', function () { - return _this.startABRTimer_(); - }); - - _this.tech_.on('pause', function () { - return _this.stopABRTimer_(); - }); - - _this.tech_.on('play', function () { - return _this.startABRTimer_(); - }); - } // Create SegmentLoader stat-getters - // mediaRequests_ - // mediaRequestsAborted_ - // mediaRequestsTimedout_ - // mediaRequestsErrored_ - // mediaTransferDuration_ - // mediaBytesTransferred_ - // mediaAppends_ - - - loaderStats.forEach(function (stat) { - _this[stat + '_'] = sumLoaderStat.bind(assertThisInitialized(_this), stat); - }); - _this.logger_ = logger('MPC'); - _this.triggeredFmp4Usage = false; - - if (_this.tech_.preload() === 'none') { - _this.loadOnPlay_ = function () { - _this.loadOnPlay_ = null; - - _this.masterPlaylistLoader_.load(); - }; - - _this.tech_.one('play', _this.loadOnPlay_); - } else { - _this.masterPlaylistLoader_.load(); - } - - _this.timeToLoadedData__ = -1; - _this.mainAppendsToLoadedData__ = -1; - _this.audioAppendsToLoadedData__ = -1; - var event = _this.tech_.preload() === 'none' ? 'play' : 'loadstart'; // start the first frame timer on loadstart or play (for preload none) - - _this.tech_.one(event, function () { - var timeToLoadedDataStart = Date.now(); - - _this.tech_.one('loadeddata', function () { - _this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart; - _this.mainAppendsToLoadedData__ = _this.mainSegmentLoader_.mediaAppends; - _this.audioAppendsToLoadedData__ = _this.audioSegmentLoader_.mediaAppends; - }); - }); - - return _this; - } - - var _proto = MasterPlaylistController.prototype; - - _proto.mainAppendsToLoadedData_ = function mainAppendsToLoadedData_() { - return this.mainAppendsToLoadedData__; - }; - - _proto.audioAppendsToLoadedData_ = function audioAppendsToLoadedData_() { - return this.audioAppendsToLoadedData__; - }; - - _proto.appendsToLoadedData_ = function appendsToLoadedData_() { - var main = this.mainAppendsToLoadedData_(); - var audio = this.audioAppendsToLoadedData_(); - - if (main === -1 || audio === -1) { - return -1; - } - - return main + audio; - }; - - _proto.timeToLoadedData_ = function timeToLoadedData_() { - return this.timeToLoadedData__; - } - /** - * Run selectPlaylist and switch to the new playlist if we should - * - * @private - * - */ - ; - - _proto.checkABR_ = function checkABR_() { - var nextPlaylist = this.selectPlaylist(); - - if (this.shouldSwitchToMedia_(nextPlaylist)) { - this.switchMedia_(nextPlaylist, 'abr'); - } - }; - - _proto.switchMedia_ = function switchMedia_(playlist, cause, delay) { - var oldMedia = this.media(); - var oldId = oldMedia && (oldMedia.id || oldMedia.uri); - var newId = playlist.id || playlist.uri; - - if (oldId && oldId !== newId) { - this.logger_("switch media " + oldId + " -> " + newId + " from " + cause); - this.tech_.trigger({ - type: 'usage', - name: "vhs-rendition-change-" + cause - }); - } - - this.masterPlaylistLoader_.media(playlist, delay); - } - /** - * Start a timer that periodically calls checkABR_ - * - * @private - */ - ; - - _proto.startABRTimer_ = function startABRTimer_() { - var _this2 = this; - - this.stopABRTimer_(); - this.abrTimer_ = window__default['default'].setInterval(function () { - return _this2.checkABR_(); - }, 250); - } - /** - * Stop the timer that periodically calls checkABR_ - * - * @private - */ - ; - - _proto.stopABRTimer_ = function stopABRTimer_() { - // if we're scrubbing, we don't need to pause. - // This getter will be added to Video.js in version 7.11. - if (this.tech_.scrubbing && this.tech_.scrubbing()) { - return; - } - - window__default['default'].clearInterval(this.abrTimer_); - this.abrTimer_ = null; - } - /** - * Get a list of playlists for the currently selected audio playlist - * - * @return {Array} the array of audio playlists - */ - ; - - _proto.getAudioTrackPlaylists_ = function getAudioTrackPlaylists_() { - var master = this.master(); // if we don't have any audio groups then we can only - // assume that the audio tracks are contained in masters - // playlist array, use that or an empty array. - - if (!master || !master.mediaGroups || !master.mediaGroups.AUDIO) { - return master && master.playlists || []; - } - - var AUDIO = master.mediaGroups.AUDIO; - var groupKeys = Object.keys(AUDIO); - var track; // get the current active track - - if (Object.keys(this.mediaTypes_.AUDIO.groups).length) { - track = this.mediaTypes_.AUDIO.activeTrack(); // or get the default track from master if mediaTypes_ isn't setup yet - } else { - // default group is `main` or just the first group. - var defaultGroup = AUDIO.main || groupKeys.length && AUDIO[groupKeys[0]]; - - for (var label in defaultGroup) { - if (defaultGroup[label].default) { - track = { - label: label - }; - break; - } - } - } // no active track no playlists. - - - if (!track) { - return []; - } - - var playlists = []; // get all of the playlists that are possible for the - // active track. - - for (var group in AUDIO) { - if (AUDIO[group][track.label]) { - var properties = AUDIO[group][track.label]; - - if (properties.playlists) { - playlists.push.apply(playlists, properties.playlists); - } else { - playlists.push(properties); - } - } - } - - return playlists; - } - /** - * Register event handlers on the master playlist loader. A helper - * function for construction time. - * - * @private - */ - ; - - _proto.setupMasterPlaylistLoaderListeners_ = function setupMasterPlaylistLoaderListeners_() { - var _this3 = this; - - this.masterPlaylistLoader_.on('loadedmetadata', function () { - var media = _this3.masterPlaylistLoader_.media(); - - var requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to - // timeout the request. - - if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) { - _this3.requestOptions_.timeout = 0; - } else { - _this3.requestOptions_.timeout = requestTimeout; - } // if this isn't a live video and preload permits, start - // downloading segments - - - if (media.endList && _this3.tech_.preload() !== 'none') { - _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_); - - _this3.mainSegmentLoader_.load(); - } - - setupMediaGroups({ - sourceType: _this3.sourceType_, - segmentLoaders: { - AUDIO: _this3.audioSegmentLoader_, - SUBTITLES: _this3.subtitleSegmentLoader_, - main: _this3.mainSegmentLoader_ - }, - tech: _this3.tech_, - requestOptions: _this3.requestOptions_, - masterPlaylistLoader: _this3.masterPlaylistLoader_, - vhs: _this3.vhs_, - master: _this3.master(), - mediaTypes: _this3.mediaTypes_, - blacklistCurrentPlaylist: _this3.blacklistCurrentPlaylist.bind(_this3) - }); - - _this3.triggerPresenceUsage_(_this3.master(), media); - - _this3.setupFirstPlay(); - - if (!_this3.mediaTypes_.AUDIO.activePlaylistLoader || _this3.mediaTypes_.AUDIO.activePlaylistLoader.media()) { - _this3.trigger('selectedinitialmedia'); - } else { - // We must wait for the active audio playlist loader to - // finish setting up before triggering this event so the - // representations API and EME setup is correct - _this3.mediaTypes_.AUDIO.activePlaylistLoader.one('loadedmetadata', function () { - _this3.trigger('selectedinitialmedia'); - }); - } - }); - this.masterPlaylistLoader_.on('loadedplaylist', function () { - if (_this3.loadOnPlay_) { - _this3.tech_.off('play', _this3.loadOnPlay_); - } - - var updatedPlaylist = _this3.masterPlaylistLoader_.media(); - - if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting - // an initial media as the playlist selectors do not consider browser support - _this3.excludeUnsupportedVariants_(); - - var selectedMedia; - - if (_this3.enableLowInitialPlaylist) { - selectedMedia = _this3.selectInitialPlaylist(); - } - - if (!selectedMedia) { - selectedMedia = _this3.selectPlaylist(); - } - - if (!selectedMedia || !_this3.shouldSwitchToMedia_(selectedMedia)) { - return; - } - - _this3.initialMedia_ = selectedMedia; - - _this3.switchMedia_(_this3.initialMedia_, 'initial'); // Under the standard case where a source URL is provided, loadedplaylist will - // fire again since the playlist will be requested. In the case of vhs-json - // (where the manifest object is provided as the source), when the media - // playlist's `segments` list is already available, a media playlist won't be - // requested, and loadedplaylist won't fire again, so the playlist handler must be - // called on its own here. - - - var haveJsonSource = _this3.sourceType_ === 'vhs-json' && _this3.initialMedia_.segments; - - if (!haveJsonSource) { - return; - } - - updatedPlaylist = _this3.initialMedia_; - } - - _this3.handleUpdatedMediaPlaylist(updatedPlaylist); - }); - this.masterPlaylistLoader_.on('error', function () { - _this3.blacklistCurrentPlaylist(_this3.masterPlaylistLoader_.error); - }); - this.masterPlaylistLoader_.on('mediachanging', function () { - _this3.mainSegmentLoader_.abort(); - - _this3.mainSegmentLoader_.pause(); - }); - this.masterPlaylistLoader_.on('mediachange', function () { - var media = _this3.masterPlaylistLoader_.media(); - - var requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to - // timeout the request. - - if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) { - _this3.requestOptions_.timeout = 0; - } else { - _this3.requestOptions_.timeout = requestTimeout; - } // TODO: Create a new event on the PlaylistLoader that signals - // that the segments have changed in some way and use that to - // update the SegmentLoader instead of doing it twice here and - // on `loadedplaylist` - - - _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_); - - _this3.mainSegmentLoader_.load(); - - _this3.tech_.trigger({ - type: 'mediachange', - bubbles: true - }); - }); - this.masterPlaylistLoader_.on('playlistunchanged', function () { - var updatedPlaylist = _this3.masterPlaylistLoader_.media(); // ignore unchanged playlists that have already been - // excluded for not-changing. We likely just have a really slowly updating - // playlist. - - - if (updatedPlaylist.lastExcludeReason_ === 'playlist-unchanged') { - return; - } - - var playlistOutdated = _this3.stuckAtPlaylistEnd_(updatedPlaylist); - - if (playlistOutdated) { - // Playlist has stopped updating and we're stuck at its end. Try to - // blacklist it and switch to another playlist in the hope that that - // one is updating (and give the player a chance to re-adjust to the - // safe live point). - _this3.blacklistCurrentPlaylist({ - message: 'Playlist no longer updating.', - reason: 'playlist-unchanged' - }); // useful for monitoring QoS - - - _this3.tech_.trigger('playliststuck'); - } - }); - this.masterPlaylistLoader_.on('renditiondisabled', function () { - _this3.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-disabled' - }); - - _this3.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-disabled' - }); - }); - this.masterPlaylistLoader_.on('renditionenabled', function () { - _this3.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-enabled' - }); - - _this3.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-enabled' - }); - }); - } - /** - * Given an updated media playlist (whether it was loaded for the first time, or - * refreshed for live playlists), update any relevant properties and state to reflect - * changes in the media that should be accounted for (e.g., cues and duration). - * - * @param {Object} updatedPlaylist the updated media playlist object - * - * @private - */ - ; - - _proto.handleUpdatedMediaPlaylist = function handleUpdatedMediaPlaylist(updatedPlaylist) { - if (this.useCueTags_) { - this.updateAdCues_(updatedPlaylist); - } // TODO: Create a new event on the PlaylistLoader that signals - // that the segments have changed in some way and use that to - // update the SegmentLoader instead of doing it twice here and - // on `mediachange` - - - this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_); - this.updateDuration(!updatedPlaylist.endList); // If the player isn't paused, ensure that the segment loader is running, - // as it is possible that it was temporarily stopped while waiting for - // a playlist (e.g., in case the playlist errored and we re-requested it). - - if (!this.tech_.paused()) { - this.mainSegmentLoader_.load(); - - if (this.audioSegmentLoader_) { - this.audioSegmentLoader_.load(); - } - } - } - /** - * A helper function for triggerring presence usage events once per source - * - * @private - */ - ; - - _proto.triggerPresenceUsage_ = function triggerPresenceUsage_(master, media) { - var mediaGroups = master.mediaGroups || {}; - var defaultDemuxed = true; - var audioGroupKeys = Object.keys(mediaGroups.AUDIO); - - for (var mediaGroup in mediaGroups.AUDIO) { - for (var label in mediaGroups.AUDIO[mediaGroup]) { - var properties = mediaGroups.AUDIO[mediaGroup][label]; - - if (!properties.uri) { - defaultDemuxed = false; - } - } - } - - if (defaultDemuxed) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-demuxed' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-demuxed' - }); - } - - if (Object.keys(mediaGroups.SUBTITLES).length) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-webvtt' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-webvtt' - }); - } - - if (Vhs$1.Playlist.isAes(media)) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-aes' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-aes' - }); - } - - if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-alternate-audio' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-alternate-audio' - }); - } - - if (this.useCueTags_) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-playlist-cue-tags' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-playlist-cue-tags' - }); - } - }; - - _proto.shouldSwitchToMedia_ = function shouldSwitchToMedia_(nextPlaylist) { - var currentPlaylist = this.masterPlaylistLoader_.media(); - var buffered = this.tech_.buffered(); - var forwardBuffer = buffered.length ? buffered.end(buffered.length - 1) - this.tech_.currentTime() : 0; - var bufferLowWaterLine = this.bufferLowWaterLine(); - var bufferHighWaterLine = this.bufferHighWaterLine(); - return shouldSwitchToMedia({ - currentPlaylist: currentPlaylist, - nextPlaylist: nextPlaylist, - forwardBuffer: forwardBuffer, - bufferLowWaterLine: bufferLowWaterLine, - bufferHighWaterLine: bufferHighWaterLine, - duration: this.duration(), - experimentalBufferBasedABR: this.experimentalBufferBasedABR, - log: this.logger_ - }); - } - /** - * Register event handlers on the segment loaders. A helper function - * for construction time. - * - * @private - */ - ; - - _proto.setupSegmentLoaderListeners_ = function setupSegmentLoaderListeners_() { - var _this4 = this; - - if (!this.experimentalBufferBasedABR) { - this.mainSegmentLoader_.on('bandwidthupdate', function () { - var nextPlaylist = _this4.selectPlaylist(); - - if (_this4.shouldSwitchToMedia_(nextPlaylist)) { - _this4.switchMedia_(nextPlaylist, 'bandwidthupdate'); - } - - _this4.tech_.trigger('bandwidthupdate'); - }); - this.mainSegmentLoader_.on('progress', function () { - _this4.trigger('progress'); - }); - } - - this.mainSegmentLoader_.on('error', function () { - _this4.blacklistCurrentPlaylist(_this4.mainSegmentLoader_.error()); - }); - this.mainSegmentLoader_.on('appenderror', function () { - _this4.error = _this4.mainSegmentLoader_.error_; - - _this4.trigger('error'); - }); - this.mainSegmentLoader_.on('syncinfoupdate', function () { - _this4.onSyncInfoUpdate_(); - }); - this.mainSegmentLoader_.on('timestampoffset', function () { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-timestamp-offset' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-timestamp-offset' - }); - }); - this.audioSegmentLoader_.on('syncinfoupdate', function () { - _this4.onSyncInfoUpdate_(); - }); - this.audioSegmentLoader_.on('appenderror', function () { - _this4.error = _this4.audioSegmentLoader_.error_; - - _this4.trigger('error'); - }); - this.mainSegmentLoader_.on('ended', function () { - _this4.logger_('main segment loader ended'); - - _this4.onEndOfStream(); - }); - this.mainSegmentLoader_.on('earlyabort', function (event) { - // never try to early abort with the new ABR algorithm - if (_this4.experimentalBufferBasedABR) { - return; - } - - _this4.delegateLoaders_('all', ['abort']); - - _this4.blacklistCurrentPlaylist({ - message: 'Aborted early because there isn\'t enough bandwidth to complete the ' + 'request without rebuffering.' - }, ABORT_EARLY_BLACKLIST_SECONDS); - }); - - var updateCodecs = function updateCodecs() { - if (!_this4.sourceUpdater_.hasCreatedSourceBuffers()) { - return _this4.tryToCreateSourceBuffers_(); - } - - var codecs = _this4.getCodecsOrExclude_(); // no codecs means that the playlist was excluded - - - if (!codecs) { - return; - } - - _this4.sourceUpdater_.addOrChangeSourceBuffers(codecs); - }; - - this.mainSegmentLoader_.on('trackinfo', updateCodecs); - this.audioSegmentLoader_.on('trackinfo', updateCodecs); - this.mainSegmentLoader_.on('fmp4', function () { - if (!_this4.triggeredFmp4Usage) { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-fmp4' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-fmp4' - }); - - _this4.triggeredFmp4Usage = true; - } - }); - this.audioSegmentLoader_.on('fmp4', function () { - if (!_this4.triggeredFmp4Usage) { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-fmp4' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-fmp4' - }); - - _this4.triggeredFmp4Usage = true; - } - }); - this.audioSegmentLoader_.on('ended', function () { - _this4.logger_('audioSegmentLoader ended'); - - _this4.onEndOfStream(); - }); - }; - - _proto.mediaSecondsLoaded_ = function mediaSecondsLoaded_() { - return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded); - } - /** - * Call load on our SegmentLoaders - */ - ; - - _proto.load = function load() { - this.mainSegmentLoader_.load(); - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - this.audioSegmentLoader_.load(); - } - - if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) { - this.subtitleSegmentLoader_.load(); - } - } - /** - * Re-tune playback quality level for the current player - * conditions without performing destructive actions, like - * removing already buffered content - * - * @private - * @deprecated - */ - ; - - _proto.smoothQualityChange_ = function smoothQualityChange_(media) { - if (media === void 0) { - media = this.selectPlaylist(); - } - - this.fastQualityChange_(media); - } - /** - * Re-tune playback quality level for the current player - * conditions. This method will perform destructive actions like removing - * already buffered content in order to readjust the currently active - * playlist quickly. This is good for manual quality changes - * - * @private - */ - ; - - _proto.fastQualityChange_ = function fastQualityChange_(media) { - var _this5 = this; - - if (media === void 0) { - media = this.selectPlaylist(); - } - - if (media === this.masterPlaylistLoader_.media()) { - this.logger_('skipping fastQualityChange because new media is same as old'); - return; - } - - this.switchMedia_(media, 'fast-quality'); // Delete all buffered data to allow an immediate quality switch, then seek to give - // the browser a kick to remove any cached frames from the previous rendtion (.04 seconds - // ahead is roughly the minimum that will accomplish this across a variety of content - // in IE and Edge, but seeking in place is sufficient on all other browsers) - // Edge/IE bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14600375/ - // Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=651904 - - this.mainSegmentLoader_.resetEverything(function () { - // Since this is not a typical seek, we avoid the seekTo method which can cause segments - // from the previously enabled rendition to load before the new playlist has finished loading - if (videojs__default['default'].browser.IE_VERSION || videojs__default['default'].browser.IS_EDGE) { - _this5.tech_.setCurrentTime(_this5.tech_.currentTime() + 0.04); - } else { - _this5.tech_.setCurrentTime(_this5.tech_.currentTime()); - } - }); // don't need to reset audio as it is reset when media changes - } - /** - * Begin playback. - */ - ; - - _proto.play = function play() { - if (this.setupFirstPlay()) { - return; - } - - if (this.tech_.ended()) { - this.tech_.setCurrentTime(0); - } - - if (this.hasPlayed_) { - this.load(); - } - - var seekable = this.tech_.seekable(); // if the viewer has paused and we fell out of the live window, - // seek forward to the live point - - if (this.tech_.duration() === Infinity) { - if (this.tech_.currentTime() < seekable.start(0)) { - return this.tech_.setCurrentTime(seekable.end(seekable.length - 1)); - } - } - } - /** - * Seek to the latest media position if this is a live video and the - * player and video are loaded and initialized. - */ - ; - - _proto.setupFirstPlay = function setupFirstPlay() { - var _this6 = this; - - var media = this.masterPlaylistLoader_.media(); // Check that everything is ready to begin buffering for the first call to play - // If 1) there is no active media - // 2) the player is paused - // 3) the first play has already been setup - // then exit early - - if (!media || this.tech_.paused() || this.hasPlayed_) { - return false; - } // when the video is a live stream - - - if (!media.endList) { - var seekable = this.seekable(); - - if (!seekable.length) { - // without a seekable range, the player cannot seek to begin buffering at the live - // point - return false; - } - - if (videojs__default['default'].browser.IE_VERSION && this.tech_.readyState() === 0) { - // IE11 throws an InvalidStateError if you try to set currentTime while the - // readyState is 0, so it must be delayed until the tech fires loadedmetadata. - this.tech_.one('loadedmetadata', function () { - _this6.trigger('firstplay'); - - _this6.tech_.setCurrentTime(seekable.end(0)); - - _this6.hasPlayed_ = true; - }); - return false; - } // trigger firstplay to inform the source handler to ignore the next seek event - - - this.trigger('firstplay'); // seek to the live point - - this.tech_.setCurrentTime(seekable.end(0)); - } - - this.hasPlayed_ = true; // we can begin loading now that everything is ready - - this.load(); - return true; - } - /** - * handle the sourceopen event on the MediaSource - * - * @private - */ - ; - - _proto.handleSourceOpen_ = function handleSourceOpen_() { - // Only attempt to create the source buffer if none already exist. - // handleSourceOpen is also called when we are "re-opening" a source buffer - // after `endOfStream` has been called (in response to a seek for instance) - this.tryToCreateSourceBuffers_(); // if autoplay is enabled, begin playback. This is duplicative of - // code in video.js but is required because play() must be invoked - // *after* the media source has opened. - - if (this.tech_.autoplay()) { - var playPromise = this.tech_.play(); // Catch/silence error when a pause interrupts a play request - // on browsers which return a promise - - if (typeof playPromise !== 'undefined' && typeof playPromise.then === 'function') { - playPromise.then(null, function (e) {}); - } - } - - this.trigger('sourceopen'); - } - /** - * handle the sourceended event on the MediaSource - * - * @private - */ - ; - - _proto.handleSourceEnded_ = function handleSourceEnded_() { - if (!this.inbandTextTracks_.metadataTrack_) { - return; - } - - var cues = this.inbandTextTracks_.metadataTrack_.cues; - - if (!cues || !cues.length) { - return; - } - - var duration = this.duration(); - cues[cues.length - 1].endTime = isNaN(duration) || Math.abs(duration) === Infinity ? Number.MAX_VALUE : duration; - } - /** - * handle the durationchange event on the MediaSource - * - * @private - */ - ; - - _proto.handleDurationChange_ = function handleDurationChange_() { - this.tech_.trigger('durationchange'); - } - /** - * Calls endOfStream on the media source when all active stream types have called - * endOfStream - * - * @param {string} streamType - * Stream type of the segment loader that called endOfStream - * @private - */ - ; - - _proto.onEndOfStream = function onEndOfStream() { - var isEndOfStream = this.mainSegmentLoader_.ended_; - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - // if the audio playlist loader exists, then alternate audio is active - if (!this.mainSegmentLoader_.currentMediaInfo_ || this.mainSegmentLoader_.currentMediaInfo_.hasVideo) { - // if we do not know if the main segment loader contains video yet or if we - // definitively know the main segment loader contains video, then we need to wait - // for both main and audio segment loaders to call endOfStream - isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_; - } else { - // otherwise just rely on the audio loader - isEndOfStream = this.audioSegmentLoader_.ended_; - } - } - - if (!isEndOfStream) { - return; - } - - this.stopABRTimer_(); - this.sourceUpdater_.endOfStream(); - } - /** - * Check if a playlist has stopped being updated - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist has stopped being updated or not - */ - ; - - _proto.stuckAtPlaylistEnd_ = function stuckAtPlaylistEnd_(playlist) { - var seekable = this.seekable(); - - if (!seekable.length) { - // playlist doesn't have enough information to determine whether we are stuck - return false; - } - - var expired = this.syncController_.getExpiredTime(playlist, this.duration()); - - if (expired === null) { - return false; - } // does not use the safe live end to calculate playlist end, since we - // don't want to say we are stuck while there is still content - - - var absolutePlaylistEnd = Vhs$1.Playlist.playlistEnd(playlist, expired); - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - - if (!buffered.length) { - // return true if the playhead reached the absolute end of the playlist - return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA; - } - - var bufferedEnd = buffered.end(buffered.length - 1); // return true if there is too little buffer left and buffer has reached absolute - // end of playlist - - return bufferedEnd - currentTime <= SAFE_TIME_DELTA && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA; - } - /** - * Blacklists a playlist when an error occurs for a set amount of time - * making it unavailable for selection by the rendition selection algorithm - * and then forces a new playlist (rendition) selection. - * - * @param {Object=} error an optional error that may include the playlist - * to blacklist - * @param {number=} blacklistDuration an optional number of seconds to blacklist the - * playlist - */ - ; - - _proto.blacklistCurrentPlaylist = function blacklistCurrentPlaylist(error, blacklistDuration) { - if (error === void 0) { - error = {}; - } - - // If the `error` was generated by the playlist loader, it will contain - // the playlist we were trying to load (but failed) and that should be - // blacklisted instead of the currently selected playlist which is likely - // out-of-date in this scenario - var currentPlaylist = error.playlist || this.masterPlaylistLoader_.media(); - blacklistDuration = blacklistDuration || error.blacklistDuration || this.blacklistDuration; // If there is no current playlist, then an error occurred while we were - // trying to load the master OR while we were disposing of the tech - - if (!currentPlaylist) { - this.error = error; - - if (this.mediaSource.readyState !== 'open') { - this.trigger('error'); - } else { - this.sourceUpdater_.endOfStream('network'); - } - - return; - } - - currentPlaylist.playlistErrors_++; - var playlists = this.masterPlaylistLoader_.master.playlists; - var enabledPlaylists = playlists.filter(isEnabled); - var isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === currentPlaylist; // Don't blacklist the only playlist unless it was blacklisted - // forever - - if (playlists.length === 1 && blacklistDuration !== Infinity) { - videojs__default['default'].log.warn("Problem encountered with playlist " + currentPlaylist.id + ". " + 'Trying again since it is the only playlist.'); - this.tech_.trigger('retryplaylist'); // if this is a final rendition, we should delay - - return this.masterPlaylistLoader_.load(isFinalRendition); - } - - if (isFinalRendition) { - // Since we're on the final non-blacklisted playlist, and we're about to blacklist - // it, instead of erring the player or retrying this playlist, clear out the current - // blacklist. This allows other playlists to be attempted in case any have been - // fixed. - var reincluded = false; - playlists.forEach(function (playlist) { - // skip current playlist which is about to be blacklisted - if (playlist === currentPlaylist) { - return; - } - - var excludeUntil = playlist.excludeUntil; // a playlist cannot be reincluded if it wasn't excluded to begin with. - - if (typeof excludeUntil !== 'undefined' && excludeUntil !== Infinity) { - reincluded = true; - delete playlist.excludeUntil; - } - }); - - if (reincluded) { - videojs__default['default'].log.warn('Removing other playlists from the exclusion list because the last ' + 'rendition is about to be excluded.'); // Technically we are retrying a playlist, in that we are simply retrying a previous - // playlist. This is needed for users relying on the retryplaylist event to catch a - // case where the player might be stuck and looping through "dead" playlists. - - this.tech_.trigger('retryplaylist'); - } - } // Blacklist this playlist - - - var excludeUntil; - - if (currentPlaylist.playlistErrors_ > this.maxPlaylistRetries) { - excludeUntil = Infinity; - } else { - excludeUntil = Date.now() + blacklistDuration * 1000; - } - - currentPlaylist.excludeUntil = excludeUntil; - - if (error.reason) { - currentPlaylist.lastExcludeReason_ = error.reason; - } - - this.tech_.trigger('blacklistplaylist'); - this.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-blacklisted' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-blacklisted' - }); // TODO: should we select a new playlist if this blacklist wasn't for the currentPlaylist? - // Would be something like media().id !=== currentPlaylist.id and we would need something - // like `pendingMedia` in playlist loaders to check against that too. This will prevent us - // from loading a new playlist on any blacklist. - // Select a new playlist - - var nextPlaylist = this.selectPlaylist(); - - if (!nextPlaylist) { - this.error = 'Playback cannot continue. No available working or supported playlists.'; - this.trigger('error'); - return; - } - - var logFn = error.internal ? this.logger_ : videojs__default['default'].log.warn; - var errorMessage = error.message ? ' ' + error.message : ''; - logFn((error.internal ? 'Internal problem' : 'Problem') + " encountered with playlist " + currentPlaylist.id + "." + (errorMessage + " Switching to playlist " + nextPlaylist.id + ".")); // if audio group changed reset audio loaders - - if (nextPlaylist.attributes.AUDIO !== currentPlaylist.attributes.AUDIO) { - this.delegateLoaders_('audio', ['abort', 'pause']); - } // if subtitle group changed reset subtitle loaders - - - if (nextPlaylist.attributes.SUBTITLES !== currentPlaylist.attributes.SUBTITLES) { - this.delegateLoaders_('subtitle', ['abort', 'pause']); - } - - this.delegateLoaders_('main', ['abort', 'pause']); - var delayDuration = nextPlaylist.targetDuration / 2 * 1000 || 5 * 1000; - var shouldDelay = typeof nextPlaylist.lastRequest === 'number' && Date.now() - nextPlaylist.lastRequest <= delayDuration; // delay if it's a final rendition or if the last refresh is sooner than half targetDuration - - return this.switchMedia_(nextPlaylist, 'exclude', isFinalRendition || shouldDelay); - } - /** - * Pause all segment/playlist loaders - */ - ; - - _proto.pauseLoading = function pauseLoading() { - this.delegateLoaders_('all', ['abort', 'pause']); - this.stopABRTimer_(); - } - /** - * Call a set of functions in order on playlist loaders, segment loaders, - * or both types of loaders. - * - * @param {string} filter - * Filter loaders that should call fnNames using a string. Can be: - * * all - run on all loaders - * * audio - run on all audio loaders - * * subtitle - run on all subtitle loaders - * * main - run on the main/master loaders - * - * @param {Array|string} fnNames - * A string or array of function names to call. - */ - ; - - _proto.delegateLoaders_ = function delegateLoaders_(filter, fnNames) { - var _this7 = this; - - var loaders = []; - var dontFilterPlaylist = filter === 'all'; - - if (dontFilterPlaylist || filter === 'main') { - loaders.push(this.masterPlaylistLoader_); - } - - var mediaTypes = []; - - if (dontFilterPlaylist || filter === 'audio') { - mediaTypes.push('AUDIO'); - } - - if (dontFilterPlaylist || filter === 'subtitle') { - mediaTypes.push('CLOSED-CAPTIONS'); - mediaTypes.push('SUBTITLES'); - } - - mediaTypes.forEach(function (mediaType) { - var loader = _this7.mediaTypes_[mediaType] && _this7.mediaTypes_[mediaType].activePlaylistLoader; - - if (loader) { - loaders.push(loader); - } - }); - ['main', 'audio', 'subtitle'].forEach(function (name) { - var loader = _this7[name + "SegmentLoader_"]; - - if (loader && (filter === name || filter === 'all')) { - loaders.push(loader); - } - }); - loaders.forEach(function (loader) { - return fnNames.forEach(function (fnName) { - if (typeof loader[fnName] === 'function') { - loader[fnName](); - } - }); - }); - } - /** - * set the current time on all segment loaders - * - * @param {TimeRange} currentTime the current time to set - * @return {TimeRange} the current time - */ - ; - - _proto.setCurrentTime = function setCurrentTime(currentTime) { - var buffered = findRange(this.tech_.buffered(), currentTime); - - if (!(this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media())) { - // return immediately if the metadata is not ready yet - return 0; - } // it's clearly an edge-case but don't thrown an error if asked to - // seek within an empty playlist - - - if (!this.masterPlaylistLoader_.media().segments) { - return 0; - } // if the seek location is already buffered, continue buffering as usual - - - if (buffered && buffered.length) { - return currentTime; - } // cancel outstanding requests so we begin buffering at the new - // location - - - this.mainSegmentLoader_.resetEverything(); - this.mainSegmentLoader_.abort(); - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - this.audioSegmentLoader_.resetEverything(); - this.audioSegmentLoader_.abort(); - } - - if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) { - this.subtitleSegmentLoader_.resetEverything(); - this.subtitleSegmentLoader_.abort(); - } // start segment loader loading in case they are paused - - - this.load(); - } - /** - * get the current duration - * - * @return {TimeRange} the duration - */ - ; - - _proto.duration = function duration() { - if (!this.masterPlaylistLoader_) { - return 0; - } - - var media = this.masterPlaylistLoader_.media(); - - if (!media) { - // no playlists loaded yet, so can't determine a duration - return 0; - } // Don't rely on the media source for duration in the case of a live playlist since - // setting the native MediaSource's duration to infinity ends up with consequences to - // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details. - // - // This is resolved in the spec by https://github.com/w3c/media-source/pull/92, - // however, few browsers have support for setLiveSeekableRange() - // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange - // - // Until a time when the duration of the media source can be set to infinity, and a - // seekable range specified across browsers, just return Infinity. - - - if (!media.endList) { - return Infinity; - } // Since this is a VOD video, it is safe to rely on the media source's duration (if - // available). If it's not available, fall back to a playlist-calculated estimate. - - - if (this.mediaSource) { - return this.mediaSource.duration; - } - - return Vhs$1.Playlist.duration(media); - } - /** - * check the seekable range - * - * @return {TimeRange} the seekable range - */ - ; - - _proto.seekable = function seekable() { - return this.seekable_; - }; - - _proto.onSyncInfoUpdate_ = function onSyncInfoUpdate_() { - var audioSeekable; - - if (!this.masterPlaylistLoader_) { - return; - } - - var media = this.masterPlaylistLoader_.media(); - - if (!media) { - return; - } - - var expired = this.syncController_.getExpiredTime(media, this.duration()); - - if (expired === null) { - // not enough information to update seekable - return; - } - - var master = this.masterPlaylistLoader_.master; - var mainSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media)); - - if (mainSeekable.length === 0) { - return; - } - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - media = this.mediaTypes_.AUDIO.activePlaylistLoader.media(); - expired = this.syncController_.getExpiredTime(media, this.duration()); - - if (expired === null) { - return; - } - - audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media)); - - if (audioSeekable.length === 0) { - return; - } - } - - var oldEnd; - var oldStart; - - if (this.seekable_ && this.seekable_.length) { - oldEnd = this.seekable_.end(0); - oldStart = this.seekable_.start(0); - } - - if (!audioSeekable) { - // seekable has been calculated based on buffering video data so it - // can be returned directly - this.seekable_ = mainSeekable; - } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) { - // seekables are pretty far off, rely on main - this.seekable_ = mainSeekable; - } else { - this.seekable_ = videojs__default['default'].createTimeRanges([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]); - } // seekable is the same as last time - - - if (this.seekable_ && this.seekable_.length) { - if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) { - return; - } - } - - this.logger_("seekable updated [" + printableRange(this.seekable_) + "]"); - this.tech_.trigger('seekablechanged'); - } - /** - * Update the player duration - */ - ; - - _proto.updateDuration = function updateDuration(isLive) { - if (this.updateDuration_) { - this.mediaSource.removeEventListener('sourceopen', this.updateDuration_); - this.updateDuration_ = null; - } - - if (this.mediaSource.readyState !== 'open') { - this.updateDuration_ = this.updateDuration.bind(this, isLive); - this.mediaSource.addEventListener('sourceopen', this.updateDuration_); - return; - } - - if (isLive) { - var seekable = this.seekable(); - - if (!seekable.length) { - return; - } // Even in the case of a live playlist, the native MediaSource's duration should not - // be set to Infinity (even though this would be expected for a live playlist), since - // setting the native MediaSource's duration to infinity ends up with consequences to - // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details. - // - // This is resolved in the spec by https://github.com/w3c/media-source/pull/92, - // however, few browsers have support for setLiveSeekableRange() - // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange - // - // Until a time when the duration of the media source can be set to infinity, and a - // seekable range specified across browsers, the duration should be greater than or - // equal to the last possible seekable value. - // MediaSource duration starts as NaN - // It is possible (and probable) that this case will never be reached for many - // sources, since the MediaSource reports duration as the highest value without - // accounting for timestamp offset. For example, if the timestamp offset is -100 and - // we buffered times 0 to 100 with real times of 100 to 200, even though current - // time will be between 0 and 100, the native media source may report the duration - // as 200. However, since we report duration separate from the media source (as - // Infinity), and as long as the native media source duration value is greater than - // our reported seekable range, seeks will work as expected. The large number as - // duration for live is actually a strategy used by some players to work around the - // issue of live seekable ranges cited above. - - - if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable.end(seekable.length - 1)) { - this.sourceUpdater_.setDuration(seekable.end(seekable.length - 1)); - } - - return; - } - - var buffered = this.tech_.buffered(); - var duration = Vhs$1.Playlist.duration(this.masterPlaylistLoader_.media()); - - if (buffered.length > 0) { - duration = Math.max(duration, buffered.end(buffered.length - 1)); - } - - if (this.mediaSource.duration !== duration) { - this.sourceUpdater_.setDuration(duration); - } - } - /** - * dispose of the MasterPlaylistController and everything - * that it controls - */ - ; - - _proto.dispose = function dispose() { - var _this8 = this; - - this.trigger('dispose'); - this.decrypter_.terminate(); - this.masterPlaylistLoader_.dispose(); - this.mainSegmentLoader_.dispose(); - - if (this.loadOnPlay_) { - this.tech_.off('play', this.loadOnPlay_); - } - - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - var groups = _this8.mediaTypes_[type].groups; - - for (var id in groups) { - groups[id].forEach(function (group) { - if (group.playlistLoader) { - group.playlistLoader.dispose(); - } - }); - } - }); - this.audioSegmentLoader_.dispose(); - this.subtitleSegmentLoader_.dispose(); - this.sourceUpdater_.dispose(); - this.timelineChangeController_.dispose(); - this.stopABRTimer_(); - - if (this.updateDuration_) { - this.mediaSource.removeEventListener('sourceopen', this.updateDuration_); - } - - this.mediaSource.removeEventListener('durationchange', this.handleDurationChange_); // load the media source into the player - - this.mediaSource.removeEventListener('sourceopen', this.handleSourceOpen_); - this.mediaSource.removeEventListener('sourceended', this.handleSourceEnded_); - this.off(); - } - /** - * return the master playlist object if we have one - * - * @return {Object} the master playlist object that we parsed - */ - ; - - _proto.master = function master() { - return this.masterPlaylistLoader_.master; - } - /** - * return the currently selected playlist - * - * @return {Object} the currently selected playlist object that we parsed - */ - ; - - _proto.media = function media() { - // playlist loader will not return media if it has not been fully loaded - return this.masterPlaylistLoader_.media() || this.initialMedia_; - }; - - _proto.areMediaTypesKnown_ = function areMediaTypesKnown_() { - var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader; // one or both loaders has not loaded sufficently to get codecs - - if (!this.mainSegmentLoader_.currentMediaInfo_ || usingAudioLoader && !this.audioSegmentLoader_.currentMediaInfo_) { - return false; - } - - return true; - }; - - _proto.getCodecsOrExclude_ = function getCodecsOrExclude_() { - var _this9 = this; - - var media = { - main: this.mainSegmentLoader_.currentMediaInfo_ || {}, - audio: this.audioSegmentLoader_.currentMediaInfo_ || {} - }; // set "main" media equal to video - - media.video = media.main; - var playlistCodecs = codecsForPlaylist(this.master(), this.media()); - var codecs = {}; - var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader; - - if (media.main.hasVideo) { - codecs.video = playlistCodecs.video || media.main.videoCodec || DEFAULT_VIDEO_CODEC; - } - - if (media.main.isMuxed) { - codecs.video += "," + (playlistCodecs.audio || media.main.audioCodec || DEFAULT_AUDIO_CODEC); - } - - if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) { - codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || DEFAULT_AUDIO_CODEC; // set audio isFmp4 so we use the correct "supports" function below - - media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4; - } // no codecs, no playback. - - - if (!codecs.audio && !codecs.video) { - this.blacklistCurrentPlaylist({ - playlist: this.media(), - message: 'Could not determine codecs for playlist.', - blacklistDuration: Infinity - }); - return; - } // fmp4 relies on browser support, while ts relies on muxer support - - - var supportFunction = function supportFunction(isFmp4, codec) { - return isFmp4 ? browserSupportsCodec(codec) : muxerSupportsCodec(codec); - }; - - var unsupportedCodecs = {}; - var unsupportedAudio; - ['video', 'audio'].forEach(function (type) { - if (codecs.hasOwnProperty(type) && !supportFunction(media[type].isFmp4, codecs[type])) { - var supporter = media[type].isFmp4 ? 'browser' : 'muxer'; - unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || []; - unsupportedCodecs[supporter].push(codecs[type]); - - if (type === 'audio') { - unsupportedAudio = supporter; - } - } - }); - - if (usingAudioLoader && unsupportedAudio && this.media().attributes.AUDIO) { - var audioGroup = this.media().attributes.AUDIO; - this.master().playlists.forEach(function (variant) { - var variantAudioGroup = variant.attributes && variant.attributes.AUDIO; - - if (variantAudioGroup === audioGroup && variant !== _this9.media()) { - variant.excludeUntil = Infinity; - } - }); - this.logger_("excluding audio group " + audioGroup + " as " + unsupportedAudio + " does not support codec(s): \"" + codecs.audio + "\""); - } // if we have any unsupported codecs blacklist this playlist. - - - if (Object.keys(unsupportedCodecs).length) { - var message = Object.keys(unsupportedCodecs).reduce(function (acc, supporter) { - if (acc) { - acc += ', '; - } - - acc += supporter + " does not support codec(s): \"" + unsupportedCodecs[supporter].join(',') + "\""; - return acc; - }, '') + '.'; - this.blacklistCurrentPlaylist({ - playlist: this.media(), - internal: true, - message: message, - blacklistDuration: Infinity - }); - return; - } // check if codec switching is happening - - - if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) { - var switchMessages = []; - ['video', 'audio'].forEach(function (type) { - var newCodec = (parseCodecs(_this9.sourceUpdater_.codecs[type] || '')[0] || {}).type; - var oldCodec = (parseCodecs(codecs[type] || '')[0] || {}).type; - - if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) { - switchMessages.push("\"" + _this9.sourceUpdater_.codecs[type] + "\" -> \"" + codecs[type] + "\""); - } - }); - - if (switchMessages.length) { - this.blacklistCurrentPlaylist({ - playlist: this.media(), - message: "Codec switching not supported: " + switchMessages.join(', ') + ".", - blacklistDuration: Infinity, - internal: true - }); - return; - } - } // TODO: when using the muxer shouldn't we just return - // the codecs that the muxer outputs? - - - return codecs; - } - /** - * Create source buffers and exlude any incompatible renditions. - * - * @private - */ - ; - - _proto.tryToCreateSourceBuffers_ = function tryToCreateSourceBuffers_() { - // media source is not ready yet or sourceBuffers are already - // created. - if (this.mediaSource.readyState !== 'open' || this.sourceUpdater_.hasCreatedSourceBuffers()) { - return; - } - - if (!this.areMediaTypesKnown_()) { - return; - } - - var codecs = this.getCodecsOrExclude_(); // no codecs means that the playlist was excluded - - if (!codecs) { - return; - } - - this.sourceUpdater_.createSourceBuffers(codecs); - var codecString = [codecs.video, codecs.audio].filter(Boolean).join(','); - this.excludeIncompatibleVariants_(codecString); - } - /** - * Excludes playlists with codecs that are unsupported by the muxer and browser. - */ - ; - - _proto.excludeUnsupportedVariants_ = function excludeUnsupportedVariants_() { - var _this10 = this; - - var playlists = this.master().playlists; - var ids = []; // TODO: why don't we have a property to loop through all - // playlist? Why did we ever mix indexes and keys? - - Object.keys(playlists).forEach(function (key) { - var variant = playlists[key]; // check if we already processed this playlist. - - if (ids.indexOf(variant.id) !== -1) { - return; - } - - ids.push(variant.id); - var codecs = codecsForPlaylist(_this10.master, variant); - var unsupported = []; - - if (codecs.audio && !muxerSupportsCodec(codecs.audio) && !browserSupportsCodec(codecs.audio)) { - unsupported.push("audio codec " + codecs.audio); - } - - if (codecs.video && !muxerSupportsCodec(codecs.video) && !browserSupportsCodec(codecs.video)) { - unsupported.push("video codec " + codecs.video); - } - - if (codecs.text && codecs.text === 'stpp.ttml.im1t') { - unsupported.push("text codec " + codecs.text); - } - - if (unsupported.length) { - variant.excludeUntil = Infinity; - - _this10.logger_("excluding " + variant.id + " for unsupported: " + unsupported.join(', ')); - } - }); - } - /** - * Blacklist playlists that are known to be codec or - * stream-incompatible with the SourceBuffer configuration. For - * instance, Media Source Extensions would cause the video element to - * stall waiting for video data if you switched from a variant with - * video and audio to an audio-only one. - * - * @param {Object} media a media playlist compatible with the current - * set of SourceBuffers. Variants in the current master playlist that - * do not appear to have compatible codec or stream configurations - * will be excluded from the default playlist selection algorithm - * indefinitely. - * @private - */ - ; - - _proto.excludeIncompatibleVariants_ = function excludeIncompatibleVariants_(codecString) { - var _this11 = this; - - var ids = []; - var playlists = this.master().playlists; - var codecs = unwrapCodecList(parseCodecs(codecString)); - var codecCount_ = codecCount(codecs); - var videoDetails = codecs.video && parseCodecs(codecs.video)[0] || null; - var audioDetails = codecs.audio && parseCodecs(codecs.audio)[0] || null; - Object.keys(playlists).forEach(function (key) { - var variant = playlists[key]; // check if we already processed this playlist. - // or it if it is already excluded forever. - - if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) { - return; - } - - ids.push(variant.id); - var blacklistReasons = []; // get codecs from the playlist for this variant - - var variantCodecs = codecsForPlaylist(_this11.masterPlaylistLoader_.master, variant); - var variantCodecCount = codecCount(variantCodecs); // if no codecs are listed, we cannot determine that this - // variant is incompatible. Wait for mux.js to probe - - if (!variantCodecs.audio && !variantCodecs.video) { - return; - } // TODO: we can support this by removing the - // old media source and creating a new one, but it will take some work. - // The number of streams cannot change - - - if (variantCodecCount !== codecCount_) { - blacklistReasons.push("codec count \"" + variantCodecCount + "\" !== \"" + codecCount_ + "\""); - } // only exclude playlists by codec change, if codecs cannot switch - // during playback. - - - if (!_this11.sourceUpdater_.canChangeType()) { - var variantVideoDetails = variantCodecs.video && parseCodecs(variantCodecs.video)[0] || null; - var variantAudioDetails = variantCodecs.audio && parseCodecs(variantCodecs.audio)[0] || null; // the video codec cannot change - - if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) { - blacklistReasons.push("video codec \"" + variantVideoDetails.type + "\" !== \"" + videoDetails.type + "\""); - } // the audio codec cannot change - - - if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) { - blacklistReasons.push("audio codec \"" + variantAudioDetails.type + "\" !== \"" + audioDetails.type + "\""); - } - } - - if (blacklistReasons.length) { - variant.excludeUntil = Infinity; - - _this11.logger_("blacklisting " + variant.id + ": " + blacklistReasons.join(' && ')); - } - }); - }; - - _proto.updateAdCues_ = function updateAdCues_(media) { - var offset = 0; - var seekable = this.seekable(); - - if (seekable.length) { - offset = seekable.start(0); - } - - updateAdCues(media, this.cueTagsTrack_, offset); - } - /** - * Calculates the desired forward buffer length based on current time - * - * @return {number} Desired forward buffer length in seconds - */ - ; - - _proto.goalBufferLength = function goalBufferLength() { - var currentTime = this.tech_.currentTime(); - var initial = Config.GOAL_BUFFER_LENGTH; - var rate = Config.GOAL_BUFFER_LENGTH_RATE; - var max = Math.max(initial, Config.MAX_GOAL_BUFFER_LENGTH); - return Math.min(initial + currentTime * rate, max); - } - /** - * Calculates the desired buffer low water line based on current time - * - * @return {number} Desired buffer low water line in seconds - */ - ; - - _proto.bufferLowWaterLine = function bufferLowWaterLine() { - var currentTime = this.tech_.currentTime(); - var initial = Config.BUFFER_LOW_WATER_LINE; - var rate = Config.BUFFER_LOW_WATER_LINE_RATE; - var max = Math.max(initial, Config.MAX_BUFFER_LOW_WATER_LINE); - var newMax = Math.max(initial, Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE); - return Math.min(initial + currentTime * rate, this.experimentalBufferBasedABR ? newMax : max); - }; - - _proto.bufferHighWaterLine = function bufferHighWaterLine() { - return Config.BUFFER_HIGH_WATER_LINE; - }; - - return MasterPlaylistController; - }(videojs__default['default'].EventTarget); - - /** - * Returns a function that acts as the Enable/disable playlist function. - * - * @param {PlaylistLoader} loader - The master playlist loader - * @param {string} playlistID - id of the playlist - * @param {Function} changePlaylistFn - A function to be called after a - * playlist's enabled-state has been changed. Will NOT be called if a - * playlist's enabled-state is unchanged - * @param {boolean=} enable - Value to set the playlist enabled-state to - * or if undefined returns the current enabled-state for the playlist - * @return {Function} Function for setting/getting enabled - */ - - var enableFunction = function enableFunction(loader, playlistID, changePlaylistFn) { - return function (enable) { - var playlist = loader.master.playlists[playlistID]; - var incompatible = isIncompatible(playlist); - var currentlyEnabled = isEnabled(playlist); - - if (typeof enable === 'undefined') { - return currentlyEnabled; - } - - if (enable) { - delete playlist.disabled; - } else { - playlist.disabled = true; - } - - if (enable !== currentlyEnabled && !incompatible) { - // Ensure the outside world knows about our changes - changePlaylistFn(); - - if (enable) { - loader.trigger('renditionenabled'); - } else { - loader.trigger('renditiondisabled'); - } - } - - return enable; - }; - }; - /** - * The representation object encapsulates the publicly visible information - * in a media playlist along with a setter/getter-type function (enabled) - * for changing the enabled-state of a particular playlist entry - * - * @class Representation - */ - - - var Representation = function Representation(vhsHandler, playlist, id) { - var mpc = vhsHandler.masterPlaylistController_, - smoothQualityChange = vhsHandler.options_.smoothQualityChange; // Get a reference to a bound version of the quality change function - - var changeType = smoothQualityChange ? 'smooth' : 'fast'; - var qualityChangeFunction = mpc[changeType + "QualityChange_"].bind(mpc); // some playlist attributes are optional - - if (playlist.attributes) { - var resolution = playlist.attributes.RESOLUTION; - this.width = resolution && resolution.width; - this.height = resolution && resolution.height; - this.bandwidth = playlist.attributes.BANDWIDTH; - } - - this.codecs = codecsForPlaylist(mpc.master(), playlist); - this.playlist = playlist; // The id is simply the ordinality of the media playlist - // within the master playlist - - this.id = id; // Partially-apply the enableFunction to create a playlist- - // specific variant - - this.enabled = enableFunction(vhsHandler.playlists, playlist.id, qualityChangeFunction); - }; - /** - * A mixin function that adds the `representations` api to an instance - * of the VhsHandler class - * - * @param {VhsHandler} vhsHandler - An instance of VhsHandler to add the - * representation API into - */ - - - var renditionSelectionMixin = function renditionSelectionMixin(vhsHandler) { - // Add a single API-specific function to the VhsHandler instance - vhsHandler.representations = function () { - var master = vhsHandler.masterPlaylistController_.master(); - var playlists = isAudioOnly(master) ? vhsHandler.masterPlaylistController_.getAudioTrackPlaylists_() : master.playlists; - - if (!playlists) { - return []; - } - - return playlists.filter(function (media) { - return !isIncompatible(media); - }).map(function (e, i) { - return new Representation(vhsHandler, e, e.id); - }); - }; - }; - - /** - * @file playback-watcher.js - * - * Playback starts, and now my watch begins. It shall not end until my death. I shall - * take no wait, hold no uncleared timeouts, father no bad seeks. I shall wear no crowns - * and win no glory. I shall live and die at my post. I am the corrector of the underflow. - * I am the watcher of gaps. I am the shield that guards the realms of seekable. I pledge - * my life and honor to the Playback Watch, for this Player and all the Players to come. - */ - - var timerCancelEvents = ['seeking', 'seeked', 'pause', 'playing', 'error']; - /** - * Returns whether or not the current time should be considered close to buffered content, - * taking into consideration whether there's enough buffered content for proper playback. - * - * @param {Object} options - * Options object - * @param {TimeRange} options.buffered - * Current buffer - * @param {number} options.targetDuration - * The active playlist's target duration - * @param {number} options.currentTime - * The current time of the player - * @return {boolean} - * Whether the current time should be considered close to the buffer - */ - - var closeToBufferedContent = function closeToBufferedContent(_ref) { - var buffered = _ref.buffered, - targetDuration = _ref.targetDuration, - currentTime = _ref.currentTime; - - if (!buffered.length) { - return false; - } // At least two to three segments worth of content should be buffered before there's a - // full enough buffer to consider taking any actions. - - - if (buffered.end(0) - buffered.start(0) < targetDuration * 2) { - return false; - } // It's possible that, on seek, a remove hasn't completed and the buffered range is - // somewhere past the current time. In that event, don't consider the buffered content - // close. - - - if (currentTime > buffered.start(0)) { - return false; - } // Since target duration generally represents the max (or close to max) duration of a - // segment, if the buffer is within a segment of the current time, the gap probably - // won't be closed, and current time should be considered close to buffered content. - - - return buffered.start(0) - currentTime < targetDuration; - }; - /** - * @class PlaybackWatcher - */ - - var PlaybackWatcher = /*#__PURE__*/function () { - /** - * Represents an PlaybackWatcher object. - * - * @class - * @param {Object} options an object that includes the tech and settings - */ - function PlaybackWatcher(options) { - var _this = this; - - this.masterPlaylistController_ = options.masterPlaylistController; - this.tech_ = options.tech; - this.seekable = options.seekable; - this.allowSeeksWithinUnsafeLiveWindow = options.allowSeeksWithinUnsafeLiveWindow; - this.liveRangeSafeTimeDelta = options.liveRangeSafeTimeDelta; - this.media = options.media; - this.consecutiveUpdates = 0; - this.lastRecordedTime = null; - this.timer_ = null; - this.checkCurrentTimeTimeout_ = null; - this.logger_ = logger('PlaybackWatcher'); - this.logger_('initialize'); - - var playHandler = function playHandler() { - return _this.monitorCurrentTime_(); - }; - - var canPlayHandler = function canPlayHandler() { - return _this.monitorCurrentTime_(); - }; - - var waitingHandler = function waitingHandler() { - return _this.techWaiting_(); - }; - - var cancelTimerHandler = function cancelTimerHandler() { - return _this.cancelTimer_(); - }; - - var fixesBadSeeksHandler = function fixesBadSeeksHandler() { - return _this.fixesBadSeeks_(); - }; - - var mpc = this.masterPlaylistController_; - var loaderTypes = ['main', 'subtitle', 'audio']; - var loaderChecks = {}; - loaderTypes.forEach(function (type) { - loaderChecks[type] = { - reset: function reset() { - return _this.resetSegmentDownloads_(type); - }, - updateend: function updateend() { - return _this.checkSegmentDownloads_(type); - } - }; - mpc[type + "SegmentLoader_"].on('appendsdone', loaderChecks[type].updateend); // If a rendition switch happens during a playback stall where the buffer - // isn't changing we want to reset. We cannot assume that the new rendition - // will also be stalled, until after new appends. - - mpc[type + "SegmentLoader_"].on('playlistupdate', loaderChecks[type].reset); // Playback stalls should not be detected right after seeking. - // This prevents one segment playlists (single vtt or single segment content) - // from being detected as stalling. As the buffer will not change in those cases, since - // the buffer is the entire video duration. - - _this.tech_.on(['seeked', 'seeking'], loaderChecks[type].reset); - }); - this.tech_.on('seekablechanged', fixesBadSeeksHandler); - this.tech_.on('waiting', waitingHandler); - this.tech_.on(timerCancelEvents, cancelTimerHandler); - this.tech_.on('canplay', canPlayHandler); - /* - An edge case exists that results in gaps not being skipped when they exist at the beginning of a stream. This case - is surfaced in one of two ways: - 1) The `waiting` event is fired before the player has buffered content, making it impossible - to find or skip the gap. The `waiting` event is followed by a `play` event. On first play - we can check if playback is stalled due to a gap, and skip the gap if necessary. - 2) A source with a gap at the beginning of the stream is loaded programatically while the player - is in a playing state. To catch this case, it's important that our one-time play listener is setup - even if the player is in a playing state - */ - - this.tech_.one('play', playHandler); // Define the dispose function to clean up our events - - this.dispose = function () { - _this.logger_('dispose'); - - _this.tech_.off('seekablechanged', fixesBadSeeksHandler); - - _this.tech_.off('waiting', waitingHandler); - - _this.tech_.off(timerCancelEvents, cancelTimerHandler); - - _this.tech_.off('canplay', canPlayHandler); - - _this.tech_.off('play', playHandler); - - loaderTypes.forEach(function (type) { - mpc[type + "SegmentLoader_"].off('appendsdone', loaderChecks[type].updateend); - mpc[type + "SegmentLoader_"].off('playlistupdate', loaderChecks[type].reset); - - _this.tech_.off(['seeked', 'seeking'], loaderChecks[type].reset); - }); - - if (_this.checkCurrentTimeTimeout_) { - window__default['default'].clearTimeout(_this.checkCurrentTimeTimeout_); - } - - _this.cancelTimer_(); - }; - } - /** - * Periodically check current time to see if playback stopped - * - * @private - */ - - - var _proto = PlaybackWatcher.prototype; - - _proto.monitorCurrentTime_ = function monitorCurrentTime_() { - this.checkCurrentTime_(); - - if (this.checkCurrentTimeTimeout_) { - window__default['default'].clearTimeout(this.checkCurrentTimeTimeout_); - } // 42 = 24 fps // 250 is what Webkit uses // FF uses 15 - - - this.checkCurrentTimeTimeout_ = window__default['default'].setTimeout(this.monitorCurrentTime_.bind(this), 250); - } - /** - * Reset stalled download stats for a specific type of loader - * - * @param {string} type - * The segment loader type to check. - * - * @listens SegmentLoader#playlistupdate - * @listens Tech#seeking - * @listens Tech#seeked - */ - ; - - _proto.resetSegmentDownloads_ = function resetSegmentDownloads_(type) { - var loader = this.masterPlaylistController_[type + "SegmentLoader_"]; - - if (this[type + "StalledDownloads_"] > 0) { - this.logger_("resetting possible stalled download count for " + type + " loader"); - } - - this[type + "StalledDownloads_"] = 0; - this[type + "Buffered_"] = loader.buffered_(); - } - /** - * Checks on every segment `appendsdone` to see - * if segment appends are making progress. If they are not - * and we are still downloading bytes. We blacklist the playlist. - * - * @param {string} type - * The segment loader type to check. - * - * @listens SegmentLoader#appendsdone - */ - ; - - _proto.checkSegmentDownloads_ = function checkSegmentDownloads_(type) { - var mpc = this.masterPlaylistController_; - var loader = mpc[type + "SegmentLoader_"]; - var buffered = loader.buffered_(); - var isBufferedDifferent = isRangeDifferent(this[type + "Buffered_"], buffered); - this[type + "Buffered_"] = buffered; // if another watcher is going to fix the issue or - // the buffered value for this loader changed - // appends are working - - if (isBufferedDifferent) { - this.resetSegmentDownloads_(type); - return; - } - - this[type + "StalledDownloads_"]++; - this.logger_("found #" + this[type + "StalledDownloads_"] + " " + type + " appends that did not increase buffer (possible stalled download)", { - playlistId: loader.playlist_ && loader.playlist_.id, - buffered: timeRangesToArray(buffered) - }); // after 10 possibly stalled appends with no reset, exclude - - if (this[type + "StalledDownloads_"] < 10) { - return; - } - - this.logger_(type + " loader stalled download exclusion"); - this.resetSegmentDownloads_(type); - this.tech_.trigger({ - type: 'usage', - name: "vhs-" + type + "-download-exclusion" - }); - - if (type === 'subtitle') { - return; - } // TODO: should we exclude audio tracks rather than main tracks - // when type is audio? - - - mpc.blacklistCurrentPlaylist({ - message: "Excessive " + type + " segment downloading detected." - }, Infinity); - } - /** - * The purpose of this function is to emulate the "waiting" event on - * browsers that do not emit it when they are waiting for more - * data to continue playback - * - * @private - */ - ; - - _proto.checkCurrentTime_ = function checkCurrentTime_() { - if (this.tech_.seeking() && this.fixesBadSeeks_()) { - this.consecutiveUpdates = 0; - this.lastRecordedTime = this.tech_.currentTime(); - return; - } - - if (this.tech_.paused() || this.tech_.seeking()) { - return; - } - - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - - if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA >= buffered.end(buffered.length - 1))) { - // If current time is at the end of the final buffered region, then any playback - // stall is most likely caused by buffering in a low bandwidth environment. The tech - // should fire a `waiting` event in this scenario, but due to browser and tech - // inconsistencies. Calling `techWaiting_` here allows us to simulate - // responding to a native `waiting` event when the tech fails to emit one. - return this.techWaiting_(); - } - - if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) { - this.consecutiveUpdates++; - this.waiting_(); - } else if (currentTime === this.lastRecordedTime) { - this.consecutiveUpdates++; - } else { - this.consecutiveUpdates = 0; - this.lastRecordedTime = currentTime; - } - } - /** - * Cancels any pending timers and resets the 'timeupdate' mechanism - * designed to detect that we are stalled - * - * @private - */ - ; - - _proto.cancelTimer_ = function cancelTimer_() { - this.consecutiveUpdates = 0; - - if (this.timer_) { - this.logger_('cancelTimer_'); - clearTimeout(this.timer_); - } - - this.timer_ = null; - } - /** - * Fixes situations where there's a bad seek - * - * @return {boolean} whether an action was taken to fix the seek - * @private - */ - ; - - _proto.fixesBadSeeks_ = function fixesBadSeeks_() { - var seeking = this.tech_.seeking(); - - if (!seeking) { - return false; - } - - var seekable = this.seekable(); - var currentTime = this.tech_.currentTime(); - var isAfterSeekableRange = this.afterSeekableWindow_(seekable, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow); - var seekTo; - - if (isAfterSeekableRange) { - var seekableEnd = seekable.end(seekable.length - 1); // sync to live point (if VOD, our seekable was updated and we're simply adjusting) - - seekTo = seekableEnd; - } - - if (this.beforeSeekableWindow_(seekable, currentTime)) { - var seekableStart = seekable.start(0); // sync to the beginning of the live window - // provide a buffer of .1 seconds to handle rounding/imprecise numbers - - seekTo = seekableStart + ( // if the playlist is too short and the seekable range is an exact time (can - // happen in live with a 3 segment playlist), then don't use a time delta - seekableStart === seekable.end(0) ? 0 : SAFE_TIME_DELTA); - } - - if (typeof seekTo !== 'undefined') { - this.logger_("Trying to seek outside of seekable at time " + currentTime + " with " + ("seekable range " + printableRange(seekable) + ". Seeking to ") + (seekTo + ".")); - this.tech_.setCurrentTime(seekTo); - return true; - } - - var buffered = this.tech_.buffered(); - - if (closeToBufferedContent({ - buffered: buffered, - targetDuration: this.media().targetDuration, - currentTime: currentTime - })) { - seekTo = buffered.start(0) + SAFE_TIME_DELTA; - this.logger_("Buffered region starts (" + buffered.start(0) + ") " + (" just beyond seek point (" + currentTime + "). Seeking to " + seekTo + ".")); - this.tech_.setCurrentTime(seekTo); - return true; - } - - return false; - } - /** - * Handler for situations when we determine the player is waiting. - * - * @private - */ - ; - - _proto.waiting_ = function waiting_() { - if (this.techWaiting_()) { - return; - } // All tech waiting checks failed. Use last resort correction - - - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - var currentRange = findRange(buffered, currentTime); // Sometimes the player can stall for unknown reasons within a contiguous buffered - // region with no indication that anything is amiss (seen in Firefox). Seeking to - // currentTime is usually enough to kickstart the player. This checks that the player - // is currently within a buffered region before attempting a corrective seek. - // Chrome does not appear to continue `timeupdate` events after a `waiting` event - // until there is ~ 3 seconds of forward buffer available. PlaybackWatcher should also - // make sure there is ~3 seconds of forward buffer before taking any corrective action - // to avoid triggering an `unknownwaiting` event when the network is slow. - - if (currentRange.length && currentTime + 3 <= currentRange.end(0)) { - this.cancelTimer_(); - this.tech_.setCurrentTime(currentTime); - this.logger_("Stopped at " + currentTime + " while inside a buffered region " + ("[" + currentRange.start(0) + " -> " + currentRange.end(0) + "]. Attempting to resume ") + 'playback by seeking to the current time.'); // unknown waiting corrections may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-unknown-waiting' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-unknown-waiting' - }); - return; - } - } - /** - * Handler for situations when the tech fires a `waiting` event - * - * @return {boolean} - * True if an action (or none) was needed to correct the waiting. False if no - * checks passed - * @private - */ - ; - - _proto.techWaiting_ = function techWaiting_() { - var seekable = this.seekable(); - var currentTime = this.tech_.currentTime(); - - if (this.tech_.seeking() && this.fixesBadSeeks_()) { - // Tech is seeking or bad seek fixed, no action needed - return true; - } - - if (this.tech_.seeking() || this.timer_ !== null) { - // Tech is seeking or already waiting on another action, no action needed - return true; - } - - if (this.beforeSeekableWindow_(seekable, currentTime)) { - var livePoint = seekable.end(seekable.length - 1); - this.logger_("Fell out of live window at time " + currentTime + ". Seeking to " + ("live point (seekable end) " + livePoint)); - this.cancelTimer_(); - this.tech_.setCurrentTime(livePoint); // live window resyncs may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-live-resync' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-live-resync' - }); - return true; - } - - var sourceUpdater = this.tech_.vhs.masterPlaylistController_.sourceUpdater_; - var buffered = this.tech_.buffered(); - var videoUnderflow = this.videoUnderflow_({ - audioBuffered: sourceUpdater.audioBuffered(), - videoBuffered: sourceUpdater.videoBuffered(), - currentTime: currentTime - }); - - if (videoUnderflow) { - // Even though the video underflowed and was stuck in a gap, the audio overplayed - // the gap, leading currentTime into a buffered range. Seeking to currentTime - // allows the video to catch up to the audio position without losing any audio - // (only suffering ~3 seconds of frozen video and a pause in audio playback). - this.cancelTimer_(); - this.tech_.setCurrentTime(currentTime); // video underflow may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-video-underflow' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-video-underflow' - }); - return true; - } - - var nextRange = findNextRange(buffered, currentTime); // check for gap - - if (nextRange.length > 0) { - var difference = nextRange.start(0) - currentTime; - this.logger_("Stopped at " + currentTime + ", setting timer for " + difference + ", seeking " + ("to " + nextRange.start(0))); - this.cancelTimer_(); - this.timer_ = setTimeout(this.skipTheGap_.bind(this), difference * 1000, currentTime); - return true; - } // All checks failed. Returning false to indicate failure to correct waiting - - - return false; - }; - - _proto.afterSeekableWindow_ = function afterSeekableWindow_(seekable, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow) { - if (allowSeeksWithinUnsafeLiveWindow === void 0) { - allowSeeksWithinUnsafeLiveWindow = false; - } - - if (!seekable.length) { - // we can't make a solid case if there's no seekable, default to false - return false; - } - - var allowedEnd = seekable.end(seekable.length - 1) + SAFE_TIME_DELTA; - var isLive = !playlist.endList; - - if (isLive && allowSeeksWithinUnsafeLiveWindow) { - allowedEnd = seekable.end(seekable.length - 1) + playlist.targetDuration * 3; - } - - if (currentTime > allowedEnd) { - return true; - } - - return false; - }; - - _proto.beforeSeekableWindow_ = function beforeSeekableWindow_(seekable, currentTime) { - if (seekable.length && // can't fall before 0 and 0 seekable start identifies VOD stream - seekable.start(0) > 0 && currentTime < seekable.start(0) - this.liveRangeSafeTimeDelta) { - return true; - } - - return false; - }; - - _proto.videoUnderflow_ = function videoUnderflow_(_ref2) { - var videoBuffered = _ref2.videoBuffered, - audioBuffered = _ref2.audioBuffered, - currentTime = _ref2.currentTime; - - // audio only content will not have video underflow :) - if (!videoBuffered) { - return; - } - - var gap; // find a gap in demuxed content. - - if (videoBuffered.length && audioBuffered.length) { - // in Chrome audio will continue to play for ~3s when we run out of video - // so we have to check that the video buffer did have some buffer in the - // past. - var lastVideoRange = findRange(videoBuffered, currentTime - 3); - var videoRange = findRange(videoBuffered, currentTime); - var audioRange = findRange(audioBuffered, currentTime); - - if (audioRange.length && !videoRange.length && lastVideoRange.length) { - gap = { - start: lastVideoRange.end(0), - end: audioRange.end(0) - }; - } // find a gap in muxed content. - - } else { - var nextRange = findNextRange(videoBuffered, currentTime); // Even if there is no available next range, there is still a possibility we are - // stuck in a gap due to video underflow. - - if (!nextRange.length) { - gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime); - } - } - - if (gap) { - this.logger_("Encountered a gap in video from " + gap.start + " to " + gap.end + ". " + ("Seeking to current time " + currentTime)); - return true; - } - - return false; - } - /** - * Timer callback. If playback still has not proceeded, then we seek - * to the start of the next buffered region. - * - * @private - */ - ; - - _proto.skipTheGap_ = function skipTheGap_(scheduledCurrentTime) { - var buffered = this.tech_.buffered(); - var currentTime = this.tech_.currentTime(); - var nextRange = findNextRange(buffered, currentTime); - this.cancelTimer_(); - - if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) { - return; - } - - this.logger_('skipTheGap_:', 'currentTime:', currentTime, 'scheduled currentTime:', scheduledCurrentTime, 'nextRange start:', nextRange.start(0)); // only seek if we still have not played - - this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR); - this.tech_.trigger({ - type: 'usage', - name: 'vhs-gap-skip' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-gap-skip' - }); - }; - - _proto.gapFromVideoUnderflow_ = function gapFromVideoUnderflow_(buffered, currentTime) { - // At least in Chrome, if there is a gap in the video buffer, the audio will continue - // playing for ~3 seconds after the video gap starts. This is done to account for - // video buffer underflow/underrun (note that this is not done when there is audio - // buffer underflow/underrun -- in that case the video will stop as soon as it - // encounters the gap, as audio stalls are more noticeable/jarring to a user than - // video stalls). The player's time will reflect the playthrough of audio, so the - // time will appear as if we are in a buffered region, even if we are stuck in a - // "gap." - // - // Example: - // video buffer: 0 => 10.1, 10.2 => 20 - // audio buffer: 0 => 20 - // overall buffer: 0 => 10.1, 10.2 => 20 - // current time: 13 - // - // Chrome's video froze at 10 seconds, where the video buffer encountered the gap, - // however, the audio continued playing until it reached ~3 seconds past the gap - // (13 seconds), at which point it stops as well. Since current time is past the - // gap, findNextRange will return no ranges. - // - // To check for this issue, we see if there is a gap that starts somewhere within - // a 3 second range (3 seconds +/- 1 second) back from our current time. - var gaps = findGaps(buffered); - - for (var i = 0; i < gaps.length; i++) { - var start = gaps.start(i); - var end = gaps.end(i); // gap is starts no more than 4 seconds back - - if (currentTime - start < 4 && currentTime - start > 2) { - return { - start: start, - end: end - }; - } - } - - return null; - }; - - return PlaybackWatcher; - }(); - - var defaultOptions = { - errorInterval: 30, - getSource: function getSource(next) { - var tech = this.tech({ - IWillNotUseThisInPlugins: true - }); - var sourceObj = tech.currentSource_ || this.currentSource(); - return next(sourceObj); - } - }; - /** - * Main entry point for the plugin - * - * @param {Player} player a reference to a videojs Player instance - * @param {Object} [options] an object with plugin options - * @private - */ - - var initPlugin = function initPlugin(player, options) { - var lastCalled = 0; - var seekTo = 0; - var localOptions = videojs__default['default'].mergeOptions(defaultOptions, options); - player.ready(function () { - player.trigger({ - type: 'usage', - name: 'vhs-error-reload-initialized' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload-initialized' - }); - }); - /** - * Player modifications to perform that must wait until `loadedmetadata` - * has been triggered - * - * @private - */ - - var loadedMetadataHandler = function loadedMetadataHandler() { - if (seekTo) { - player.currentTime(seekTo); - } - }; - /** - * Set the source on the player element, play, and seek if necessary - * - * @param {Object} sourceObj An object specifying the source url and mime-type to play - * @private - */ - - - var setSource = function setSource(sourceObj) { - if (sourceObj === null || sourceObj === undefined) { - return; - } - - seekTo = player.duration() !== Infinity && player.currentTime() || 0; - player.one('loadedmetadata', loadedMetadataHandler); - player.src(sourceObj); - player.trigger({ - type: 'usage', - name: 'vhs-error-reload' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload' - }); - player.play(); - }; - /** - * Attempt to get a source from either the built-in getSource function - * or a custom function provided via the options - * - * @private - */ - - - var errorHandler = function errorHandler() { - // Do not attempt to reload the source if a source-reload occurred before - // 'errorInterval' time has elapsed since the last source-reload - if (Date.now() - lastCalled < localOptions.errorInterval * 1000) { - player.trigger({ - type: 'usage', - name: 'vhs-error-reload-canceled' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload-canceled' - }); - return; - } - - if (!localOptions.getSource || typeof localOptions.getSource !== 'function') { - videojs__default['default'].log.error('ERROR: reloadSourceOnError - The option getSource must be a function!'); - return; - } - - lastCalled = Date.now(); - return localOptions.getSource.call(player, setSource); - }; - /** - * Unbind any event handlers that were bound by the plugin - * - * @private - */ - - - var cleanupEvents = function cleanupEvents() { - player.off('loadedmetadata', loadedMetadataHandler); - player.off('error', errorHandler); - player.off('dispose', cleanupEvents); - }; - /** - * Cleanup before re-initializing the plugin - * - * @param {Object} [newOptions] an object with plugin options - * @private - */ - - - var reinitPlugin = function reinitPlugin(newOptions) { - cleanupEvents(); - initPlugin(player, newOptions); - }; - - player.on('error', errorHandler); - player.on('dispose', cleanupEvents); // Overwrite the plugin function so that we can correctly cleanup before - // initializing the plugin - - player.reloadSourceOnError = reinitPlugin; - }; - /** - * Reload the source when an error is detected as long as there - * wasn't an error previously within the last 30 seconds - * - * @param {Object} [options] an object with plugin options - */ - - - var reloadSourceOnError = function reloadSourceOnError(options) { - initPlugin(this, options); - }; - - var version$4 = "2.9.1"; - - var version$3 = "5.11.1"; - - var version$2 = "0.17.0"; - - var version$1 = "4.7.0"; - - var version = "3.1.2"; - - var Vhs = { - PlaylistLoader: PlaylistLoader, - Playlist: Playlist, - utils: utils, - STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector, - INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector, - lastBandwidthSelector: lastBandwidthSelector, - movingAverageBandwidthSelector: movingAverageBandwidthSelector, - comparePlaylistBandwidth: comparePlaylistBandwidth, - comparePlaylistResolution: comparePlaylistResolution, - xhr: xhrFactory() - }; // Define getter/setters for config properties - - Object.keys(Config).forEach(function (prop) { - Object.defineProperty(Vhs, prop, { - get: function get() { - videojs__default['default'].log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing"); - return Config[prop]; - }, - set: function set(value) { - videojs__default['default'].log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing"); - - if (typeof value !== 'number' || value < 0) { - videojs__default['default'].log.warn("value of Vhs." + prop + " must be greater than or equal to 0"); - return; - } - - Config[prop] = value; - } - }); - }); - var LOCAL_STORAGE_KEY = 'videojs-vhs'; - /** - * Updates the selectedIndex of the QualityLevelList when a mediachange happens in vhs. - * - * @param {QualityLevelList} qualityLevels The QualityLevelList to update. - * @param {PlaylistLoader} playlistLoader PlaylistLoader containing the new media info. - * @function handleVhsMediaChange - */ - - var handleVhsMediaChange = function handleVhsMediaChange(qualityLevels, playlistLoader) { - var newPlaylist = playlistLoader.media(); - var selectedIndex = -1; - - for (var i = 0; i < qualityLevels.length; i++) { - if (qualityLevels[i].id === newPlaylist.id) { - selectedIndex = i; - break; - } - } - - qualityLevels.selectedIndex_ = selectedIndex; - qualityLevels.trigger({ - selectedIndex: selectedIndex, - type: 'change' - }); - }; - /** - * Adds quality levels to list once playlist metadata is available - * - * @param {QualityLevelList} qualityLevels The QualityLevelList to attach events to. - * @param {Object} vhs Vhs object to listen to for media events. - * @function handleVhsLoadedMetadata - */ - - - var handleVhsLoadedMetadata = function handleVhsLoadedMetadata(qualityLevels, vhs) { - vhs.representations().forEach(function (rep) { - qualityLevels.addQualityLevel(rep); - }); - handleVhsMediaChange(qualityLevels, vhs.playlists); - }; // HLS is a source handler, not a tech. Make sure attempts to use it - // as one do not cause exceptions. - - - Vhs.canPlaySource = function () { - return videojs__default['default'].log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\'s techOrder.'); - }; - - var emeKeySystems = function emeKeySystems(keySystemOptions, mainPlaylist, audioPlaylist) { - if (!keySystemOptions) { - return keySystemOptions; - } - - var codecs = {}; - - if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) { - codecs = unwrapCodecList(parseCodecs(mainPlaylist.attributes.CODECS)); - } - - if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) { - codecs.audio = audioPlaylist.attributes.CODECS; - } - - var videoContentType = getMimeForCodec(codecs.video); - var audioContentType = getMimeForCodec(codecs.audio); // upsert the content types based on the selected playlist - - var keySystemContentTypes = {}; - - for (var keySystem in keySystemOptions) { - keySystemContentTypes[keySystem] = {}; - - if (audioContentType) { - keySystemContentTypes[keySystem].audioContentType = audioContentType; - } - - if (videoContentType) { - keySystemContentTypes[keySystem].videoContentType = videoContentType; - } // Default to using the video playlist's PSSH even though they may be different, as - // videojs-contrib-eme will only accept one in the options. - // - // This shouldn't be an issue for most cases as early intialization will handle all - // unique PSSH values, and if they aren't, then encrypted events should have the - // specific information needed for the unique license. - - - if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) { - keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh; - } // videojs-contrib-eme accepts the option of specifying: 'com.some.cdm': 'url' - // so we need to prevent overwriting the URL entirely - - - if (typeof keySystemOptions[keySystem] === 'string') { - keySystemContentTypes[keySystem].url = keySystemOptions[keySystem]; - } - } - - return videojs__default['default'].mergeOptions(keySystemOptions, keySystemContentTypes); - }; - /** - * @typedef {Object} KeySystems - * - * keySystems configuration for https://github.com/videojs/videojs-contrib-eme - * Note: not all options are listed here. - * - * @property {Uint8Array} [pssh] - * Protection System Specific Header - */ - - /** - * Goes through all the playlists and collects an array of KeySystems options objects - * containing each playlist's keySystems and their pssh values, if available. - * - * @param {Object[]} playlists - * The playlists to look through - * @param {string[]} keySystems - * The keySystems to collect pssh values for - * - * @return {KeySystems[]} - * An array of KeySystems objects containing available key systems and their - * pssh values - */ - - - var getAllPsshKeySystemsOptions = function getAllPsshKeySystemsOptions(playlists, keySystems) { - return playlists.reduce(function (keySystemsArr, playlist) { - if (!playlist.contentProtection) { - return keySystemsArr; - } - - var keySystemsOptions = keySystems.reduce(function (keySystemsObj, keySystem) { - var keySystemOptions = playlist.contentProtection[keySystem]; - - if (keySystemOptions && keySystemOptions.pssh) { - keySystemsObj[keySystem] = { - pssh: keySystemOptions.pssh - }; - } - - return keySystemsObj; - }, {}); - - if (Object.keys(keySystemsOptions).length) { - keySystemsArr.push(keySystemsOptions); - } - - return keySystemsArr; - }, []); - }; - /** - * Returns a promise that waits for the - * [eme plugin](https://github.com/videojs/videojs-contrib-eme) to create a key session. - * - * Works around https://bugs.chromium.org/p/chromium/issues/detail?id=895449 in non-IE11 - * browsers. - * - * As per the above ticket, this is particularly important for Chrome, where, if - * unencrypted content is appended before encrypted content and the key session has not - * been created, a MEDIA_ERR_DECODE will be thrown once the encrypted content is reached - * during playback. - * - * @param {Object} player - * The player instance - * @param {Object[]} sourceKeySystems - * The key systems options from the player source - * @param {Object} [audioMedia] - * The active audio media playlist (optional) - * @param {Object[]} mainPlaylists - * The playlists found on the master playlist object - * - * @return {Object} - * Promise that resolves when the key session has been created - */ - - - var waitForKeySessionCreation = function waitForKeySessionCreation(_ref) { - var player = _ref.player, - sourceKeySystems = _ref.sourceKeySystems, - audioMedia = _ref.audioMedia, - mainPlaylists = _ref.mainPlaylists; - - if (!player.eme.initializeMediaKeys) { - return Promise.resolve(); - } // TODO should all audio PSSH values be initialized for DRM? - // - // All unique video rendition pssh values are initialized for DRM, but here only - // the initial audio playlist license is initialized. In theory, an encrypted - // event should be fired if the user switches to an alternative audio playlist - // where a license is required, but this case hasn't yet been tested. In addition, there - // may be many alternate audio playlists unlikely to be used (e.g., multiple different - // languages). - - - var playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists; - var keySystemsOptionsArr = getAllPsshKeySystemsOptions(playlists, Object.keys(sourceKeySystems)); - var initializationFinishedPromises = []; - var keySessionCreatedPromises = []; // Since PSSH values are interpreted as initData, EME will dedupe any duplicates. The - // only place where it should not be deduped is for ms-prefixed APIs, but the early - // return for IE11 above, and the existence of modern EME APIs in addition to - // ms-prefixed APIs on Edge should prevent this from being a concern. - // initializeMediaKeys also won't use the webkit-prefixed APIs. - - keySystemsOptionsArr.forEach(function (keySystemsOptions) { - keySessionCreatedPromises.push(new Promise(function (resolve, reject) { - player.tech_.one('keysessioncreated', resolve); - })); - initializationFinishedPromises.push(new Promise(function (resolve, reject) { - player.eme.initializeMediaKeys({ - keySystems: keySystemsOptions - }, function (err) { - if (err) { - reject(err); - return; - } - - resolve(); - }); - })); - }); // The reasons Promise.race is chosen over Promise.any: - // - // * Promise.any is only available in Safari 14+. - // * None of these promises are expected to reject. If they do reject, it might be - // better here for the race to surface the rejection, rather than mask it by using - // Promise.any. - - return Promise.race([// If a session was previously created, these will all finish resolving without - // creating a new session, otherwise it will take until the end of all license - // requests, which is why the key session check is used (to make setup much faster). - Promise.all(initializationFinishedPromises), // Once a single session is created, the browser knows DRM will be used. - Promise.race(keySessionCreatedPromises)]); - }; - /** - * If the [eme](https://github.com/videojs/videojs-contrib-eme) plugin is available, and - * there are keySystems on the source, sets up source options to prepare the source for - * eme. - * - * @param {Object} player - * The player instance - * @param {Object[]} sourceKeySystems - * The key systems options from the player source - * @param {Object} media - * The active media playlist - * @param {Object} [audioMedia] - * The active audio media playlist (optional) - * - * @return {boolean} - * Whether or not options were configured and EME is available - */ - - var setupEmeOptions = function setupEmeOptions(_ref2) { - var player = _ref2.player, - sourceKeySystems = _ref2.sourceKeySystems, - media = _ref2.media, - audioMedia = _ref2.audioMedia; - var sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia); - - if (!sourceOptions) { - return false; - } - - player.currentSource().keySystems = sourceOptions; // eme handles the rest of the setup, so if it is missing - // do nothing. - - if (sourceOptions && !player.eme) { - videojs__default['default'].log.warn('DRM encrypted source cannot be decrypted without a DRM plugin'); - return false; - } - - return true; - }; - - var getVhsLocalStorage = function getVhsLocalStorage() { - if (!window__default['default'].localStorage) { - return null; - } - - var storedObject = window__default['default'].localStorage.getItem(LOCAL_STORAGE_KEY); - - if (!storedObject) { - return null; - } - - try { - return JSON.parse(storedObject); - } catch (e) { - // someone may have tampered with the value - return null; - } - }; - - var updateVhsLocalStorage = function updateVhsLocalStorage(options) { - if (!window__default['default'].localStorage) { - return false; - } - - var objectToStore = getVhsLocalStorage(); - objectToStore = objectToStore ? videojs__default['default'].mergeOptions(objectToStore, options) : options; - - try { - window__default['default'].localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore)); - } catch (e) { - // Throws if storage is full (e.g., always on iOS 5+ Safari private mode, where - // storage is set to 0). - // https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#Exceptions - // No need to perform any operation. - return false; - } - - return objectToStore; - }; - /** - * Parses VHS-supported media types from data URIs. See - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs - * for information on data URIs. - * - * @param {string} dataUri - * The data URI - * - * @return {string|Object} - * The parsed object/string, or the original string if no supported media type - * was found - */ - - - var expandDataUri = function expandDataUri(dataUri) { - if (dataUri.toLowerCase().indexOf('data:application/vnd.videojs.vhs+json,') === 0) { - return JSON.parse(dataUri.substring(dataUri.indexOf(',') + 1)); - } // no known case for this data URI, return the string as-is - - - return dataUri; - }; - /** - * Whether the browser has built-in HLS support. - */ - - - Vhs.supportsNativeHls = function () { - if (!document__default['default'] || !document__default['default'].createElement) { - return false; - } - - var video = document__default['default'].createElement('video'); // native HLS is definitely not supported if HTML5 video isn't - - if (!videojs__default['default'].getTech('Html5').isSupported()) { - return false; - } // HLS manifests can go by many mime-types - - - var canPlay = [// Apple santioned - 'application/vnd.apple.mpegurl', // Apple sanctioned for backwards compatibility - 'audio/mpegurl', // Very common - 'audio/x-mpegurl', // Very common - 'application/x-mpegurl', // Included for completeness - 'video/x-mpegurl', 'video/mpegurl', 'application/mpegurl']; - return canPlay.some(function (canItPlay) { - return /maybe|probably/i.test(video.canPlayType(canItPlay)); - }); - }(); - - Vhs.supportsNativeDash = function () { - if (!document__default['default'] || !document__default['default'].createElement || !videojs__default['default'].getTech('Html5').isSupported()) { - return false; - } - - return /maybe|probably/i.test(document__default['default'].createElement('video').canPlayType('application/dash+xml')); - }(); - - Vhs.supportsTypeNatively = function (type) { - if (type === 'hls') { - return Vhs.supportsNativeHls; - } - - if (type === 'dash') { - return Vhs.supportsNativeDash; - } - - return false; - }; - /** - * HLS is a source handler, not a tech. Make sure attempts to use it - * as one do not cause exceptions. - */ - - - Vhs.isSupported = function () { - return videojs__default['default'].log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\'s techOrder.'); - }; - - var Component = videojs__default['default'].getComponent('Component'); - /** - * The Vhs Handler object, where we orchestrate all of the parts - * of HLS to interact with video.js - * - * @class VhsHandler - * @extends videojs.Component - * @param {Object} source the soruce object - * @param {Tech} tech the parent tech object - * @param {Object} options optional and required options - */ - - var VhsHandler = /*#__PURE__*/function (_Component) { - inheritsLoose(VhsHandler, _Component); - - function VhsHandler(source, tech, options) { - var _this; - - _this = _Component.call(this, tech, videojs__default['default'].mergeOptions(options.hls, options.vhs)) || this; - - if (options.hls && Object.keys(options.hls).length) { - videojs__default['default'].log.warn('Using hls options is deprecated. Use vhs instead.'); - } // if a tech level `initialBandwidth` option was passed - // use that over the VHS level `bandwidth` option - - - if (typeof options.initialBandwidth === 'number') { - _this.options_.bandwidth = options.initialBandwidth; - } - - _this.logger_ = logger('VhsHandler'); // tech.player() is deprecated but setup a reference to HLS for - // backwards-compatibility - - if (tech.options_ && tech.options_.playerId) { - var _player = videojs__default['default'](tech.options_.playerId); - - if (!_player.hasOwnProperty('hls')) { - Object.defineProperty(_player, 'hls', { - get: function get() { - videojs__default['default'].log.warn('player.hls is deprecated. Use player.tech().vhs instead.'); - tech.trigger({ - type: 'usage', - name: 'hls-player-access' - }); - return assertThisInitialized(_this); - }, - configurable: true - }); - } - - if (!_player.hasOwnProperty('vhs')) { - Object.defineProperty(_player, 'vhs', { - get: function get() { - videojs__default['default'].log.warn('player.vhs is deprecated. Use player.tech().vhs instead.'); - tech.trigger({ - type: 'usage', - name: 'vhs-player-access' - }); - return assertThisInitialized(_this); - }, - configurable: true - }); - } - - if (!_player.hasOwnProperty('dash')) { - Object.defineProperty(_player, 'dash', { - get: function get() { - videojs__default['default'].log.warn('player.dash is deprecated. Use player.tech().vhs instead.'); - return assertThisInitialized(_this); - }, - configurable: true - }); - } - - _this.player_ = _player; - } - - _this.tech_ = tech; - _this.source_ = source; - _this.stats = {}; - _this.ignoreNextSeekingEvent_ = false; - - _this.setOptions_(); - - if (_this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) { - tech.overrideNativeAudioTracks(true); - tech.overrideNativeVideoTracks(true); - } else if (_this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) { - // overriding native HLS only works if audio tracks have been emulated - // error early if we're misconfigured - throw new Error('Overriding native HLS requires emulated tracks. ' + 'See https://git.io/vMpjB'); - } // listen for fullscreenchange events for this player so that we - // can adjust our quality selection quickly - - - _this.on(document__default['default'], ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'], function (event) { - var fullscreenElement = document__default['default'].fullscreenElement || document__default['default'].webkitFullscreenElement || document__default['default'].mozFullScreenElement || document__default['default'].msFullscreenElement; - - if (fullscreenElement && fullscreenElement.contains(_this.tech_.el())) { - _this.masterPlaylistController_.fastQualityChange_(); - } else { - // When leaving fullscreen, since the in page pixel dimensions should be smaller - // than full screen, see if there should be a rendition switch down to preserve - // bandwidth. - _this.masterPlaylistController_.checkABR_(); - } - }); - - _this.on(_this.tech_, 'seeking', function () { - if (this.ignoreNextSeekingEvent_) { - this.ignoreNextSeekingEvent_ = false; - return; - } - - this.setCurrentTime(this.tech_.currentTime()); - }); - - _this.on(_this.tech_, 'error', function () { - // verify that the error was real and we are loaded - // enough to have mpc loaded. - if (this.tech_.error() && this.masterPlaylistController_) { - this.masterPlaylistController_.pauseLoading(); - } - }); - - _this.on(_this.tech_, 'play', _this.play); - - return _this; - } - - var _proto = VhsHandler.prototype; - - _proto.setOptions_ = function setOptions_() { - var _this2 = this; - - // defaults - this.options_.withCredentials = this.options_.withCredentials || false; - this.options_.handleManifestRedirects = this.options_.handleManifestRedirects === false ? false : true; - this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true; - this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false; - this.options_.smoothQualityChange = this.options_.smoothQualityChange || false; - this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== 'undefined' ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false; - this.options_.customTagParsers = this.options_.customTagParsers || []; - this.options_.customTagMappers = this.options_.customTagMappers || []; - this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false; - - if (typeof this.options_.blacklistDuration !== 'number') { - this.options_.blacklistDuration = 5 * 60; - } - - if (typeof this.options_.bandwidth !== 'number') { - if (this.options_.useBandwidthFromLocalStorage) { - var storedObject = getVhsLocalStorage(); - - if (storedObject && storedObject.bandwidth) { - this.options_.bandwidth = storedObject.bandwidth; - this.tech_.trigger({ - type: 'usage', - name: 'vhs-bandwidth-from-local-storage' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-bandwidth-from-local-storage' - }); - } - - if (storedObject && storedObject.throughput) { - this.options_.throughput = storedObject.throughput; - this.tech_.trigger({ - type: 'usage', - name: 'vhs-throughput-from-local-storage' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-throughput-from-local-storage' - }); - } - } - } // if bandwidth was not set by options or pulled from local storage, start playlist - // selection at a reasonable bandwidth - - - if (typeof this.options_.bandwidth !== 'number') { - this.options_.bandwidth = Config.INITIAL_BANDWIDTH; - } // If the bandwidth number is unchanged from the initial setting - // then this takes precedence over the enableLowInitialPlaylist option - - - this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config.INITIAL_BANDWIDTH; // grab options passed to player.src - - ['withCredentials', 'useDevicePixelRatio', 'limitRenditionByPlayerDimensions', 'bandwidth', 'smoothQualityChange', 'customTagParsers', 'customTagMappers', 'handleManifestRedirects', 'cacheEncryptionKeys', 'playlistSelector', 'initialPlaylistSelector', 'experimentalBufferBasedABR', 'liveRangeSafeTimeDelta', 'experimentalLLHLS'].forEach(function (option) { - if (typeof _this2.source_[option] !== 'undefined') { - _this2.options_[option] = _this2.source_[option]; - } - }); - this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions; - this.useDevicePixelRatio = this.options_.useDevicePixelRatio; - } - /** - * called when player.src gets called, handle a new source - * - * @param {Object} src the source object to handle - */ - ; - - _proto.src = function src(_src, type) { - var _this3 = this; - - // do nothing if the src is falsey - if (!_src) { - return; - } - - this.setOptions_(); // add master playlist controller options - - this.options_.src = expandDataUri(this.source_.src); - this.options_.tech = this.tech_; - this.options_.externVhs = Vhs; - this.options_.sourceType = simpleTypeFromSourceType(type); // Whenever we seek internally, we should update the tech - - this.options_.seekTo = function (time) { - _this3.tech_.setCurrentTime(time); - }; - - if (this.options_.smoothQualityChange) { - videojs__default['default'].log.warn('smoothQualityChange is deprecated and will be removed in the next major version'); - } - - this.masterPlaylistController_ = new MasterPlaylistController(this.options_); - var playbackWatcherOptions = videojs__default['default'].mergeOptions({ - liveRangeSafeTimeDelta: SAFE_TIME_DELTA - }, this.options_, { - seekable: function seekable() { - return _this3.seekable(); - }, - media: function media() { - return _this3.masterPlaylistController_.media(); - }, - masterPlaylistController: this.masterPlaylistController_ - }); - this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions); - this.masterPlaylistController_.on('error', function () { - var player = videojs__default['default'].players[_this3.tech_.options_.playerId]; - var error = _this3.masterPlaylistController_.error; - - if (typeof error === 'object' && !error.code) { - error.code = 3; - } else if (typeof error === 'string') { - error = { - message: error, - code: 3 - }; - } - - player.error(error); - }); - var defaultSelector = this.options_.experimentalBufferBasedABR ? Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR; // `this` in selectPlaylist should be the VhsHandler for backwards - // compatibility with < v2 - - this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this); - this.masterPlaylistController_.selectInitialPlaylist = Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this); // re-expose some internal objects for backwards compatibility with < v2 - - this.playlists = this.masterPlaylistController_.masterPlaylistLoader_; - this.mediaSource = this.masterPlaylistController_.mediaSource; // Proxy assignment of some properties to the master playlist - // controller. Using a custom property for backwards compatibility - // with < v2 - - Object.defineProperties(this, { - selectPlaylist: { - get: function get() { - return this.masterPlaylistController_.selectPlaylist; - }, - set: function set(selectPlaylist) { - this.masterPlaylistController_.selectPlaylist = selectPlaylist.bind(this); - } - }, - throughput: { - get: function get() { - return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate; - }, - set: function set(throughput) { - this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = throughput; // By setting `count` to 1 the throughput value becomes the starting value - // for the cumulative average - - this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1; - } - }, - bandwidth: { - get: function get() { - return this.masterPlaylistController_.mainSegmentLoader_.bandwidth; - }, - set: function set(bandwidth) { - this.masterPlaylistController_.mainSegmentLoader_.bandwidth = bandwidth; // setting the bandwidth manually resets the throughput counter - // `count` is set to zero that current value of `rate` isn't included - // in the cumulative average - - this.masterPlaylistController_.mainSegmentLoader_.throughput = { - rate: 0, - count: 0 - }; - } - }, - - /** - * `systemBandwidth` is a combination of two serial processes bit-rates. The first - * is the network bitrate provided by `bandwidth` and the second is the bitrate of - * the entire process after that - decryption, transmuxing, and appending - provided - * by `throughput`. - * - * Since the two process are serial, the overall system bandwidth is given by: - * sysBandwidth = 1 / (1 / bandwidth + 1 / throughput) - */ - systemBandwidth: { - get: function get() { - var invBandwidth = 1 / (this.bandwidth || 1); - var invThroughput; - - if (this.throughput > 0) { - invThroughput = 1 / this.throughput; - } else { - invThroughput = 0; - } - - var systemBitrate = Math.floor(1 / (invBandwidth + invThroughput)); - return systemBitrate; - }, - set: function set() { - videojs__default['default'].log.error('The "systemBandwidth" property is read-only'); - } - } - }); - - if (this.options_.bandwidth) { - this.bandwidth = this.options_.bandwidth; - } - - if (this.options_.throughput) { - this.throughput = this.options_.throughput; - } - - Object.defineProperties(this.stats, { - bandwidth: { - get: function get() { - return _this3.bandwidth || 0; - }, - enumerable: true - }, - mediaRequests: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequests_() || 0; - }, - enumerable: true - }, - mediaRequestsAborted: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsAborted_() || 0; - }, - enumerable: true - }, - mediaRequestsTimedout: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsTimedout_() || 0; - }, - enumerable: true - }, - mediaRequestsErrored: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsErrored_() || 0; - }, - enumerable: true - }, - mediaTransferDuration: { - get: function get() { - return _this3.masterPlaylistController_.mediaTransferDuration_() || 0; - }, - enumerable: true - }, - mediaBytesTransferred: { - get: function get() { - return _this3.masterPlaylistController_.mediaBytesTransferred_() || 0; - }, - enumerable: true - }, - mediaSecondsLoaded: { - get: function get() { - return _this3.masterPlaylistController_.mediaSecondsLoaded_() || 0; - }, - enumerable: true - }, - mediaAppends: { - get: function get() { - return _this3.masterPlaylistController_.mediaAppends_() || 0; - }, - enumerable: true - }, - mainAppendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.mainAppendsToLoadedData_() || 0; - }, - enumerable: true - }, - audioAppendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.audioAppendsToLoadedData_() || 0; - }, - enumerable: true - }, - appendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.appendsToLoadedData_() || 0; - }, - enumerable: true - }, - timeToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.timeToLoadedData_() || 0; - }, - enumerable: true - }, - buffered: { - get: function get() { - return timeRangesToArray(_this3.tech_.buffered()); - }, - enumerable: true - }, - currentTime: { - get: function get() { - return _this3.tech_.currentTime(); - }, - enumerable: true - }, - currentSource: { - get: function get() { - return _this3.tech_.currentSource_; - }, - enumerable: true - }, - currentTech: { - get: function get() { - return _this3.tech_.name_; - }, - enumerable: true - }, - duration: { - get: function get() { - return _this3.tech_.duration(); - }, - enumerable: true - }, - master: { - get: function get() { - return _this3.playlists.master; - }, - enumerable: true - }, - playerDimensions: { - get: function get() { - return _this3.tech_.currentDimensions(); - }, - enumerable: true - }, - seekable: { - get: function get() { - return timeRangesToArray(_this3.tech_.seekable()); - }, - enumerable: true - }, - timestamp: { - get: function get() { - return Date.now(); - }, - enumerable: true - }, - videoPlaybackQuality: { - get: function get() { - return _this3.tech_.getVideoPlaybackQuality(); - }, - enumerable: true - } - }); - this.tech_.one('canplay', this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)); - this.tech_.on('bandwidthupdate', function () { - if (_this3.options_.useBandwidthFromLocalStorage) { - updateVhsLocalStorage({ - bandwidth: _this3.bandwidth, - throughput: Math.round(_this3.throughput) - }); - } - }); - this.masterPlaylistController_.on('selectedinitialmedia', function () { - // Add the manual rendition mix-in to VhsHandler - renditionSelectionMixin(_this3); - }); - this.masterPlaylistController_.sourceUpdater_.on('createdsourcebuffers', function () { - _this3.setupEme_(); - }); // the bandwidth of the primary segment loader is our best - // estimate of overall bandwidth - - this.on(this.masterPlaylistController_, 'progress', function () { - this.tech_.trigger('progress'); - }); // In the live case, we need to ignore the very first `seeking` event since - // that will be the result of the seek-to-live behavior - - this.on(this.masterPlaylistController_, 'firstplay', function () { - this.ignoreNextSeekingEvent_ = true; - }); - this.setupQualityLevels_(); // do nothing if the tech has been disposed already - // this can occur if someone sets the src in player.ready(), for instance - - if (!this.tech_.el()) { - return; - } - - this.mediaSourceUrl_ = window__default['default'].URL.createObjectURL(this.masterPlaylistController_.mediaSource); - this.tech_.src(this.mediaSourceUrl_); - } - /** - * If necessary and EME is available, sets up EME options and waits for key session - * creation. - * - * This function also updates the source updater so taht it can be used, as for some - * browsers, EME must be configured before content is appended (if appending unencrypted - * content before encrypted content). - */ - ; - - _proto.setupEme_ = function setupEme_() { - var _this4 = this; - - var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader; - var didSetupEmeOptions = setupEmeOptions({ - player: this.player_, - sourceKeySystems: this.source_.keySystems, - media: this.playlists.media(), - audioMedia: audioPlaylistLoader && audioPlaylistLoader.media() - }); // In IE11 this is too early to initialize media keys, and IE11 does not support - // promises. - - if (videojs__default['default'].browser.IE_VERSION === 11 || !didSetupEmeOptions) { - // If EME options were not set up, we've done all we could to initialize EME. - this.masterPlaylistController_.sourceUpdater_.initializedEme(); - return; - } - - this.logger_('waiting for EME key session creation'); - waitForKeySessionCreation({ - player: this.player_, - sourceKeySystems: this.source_.keySystems, - audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(), - mainPlaylists: this.playlists.master.playlists - }).then(function () { - _this4.logger_('created EME key session'); - - _this4.masterPlaylistController_.sourceUpdater_.initializedEme(); - }).catch(function (err) { - _this4.logger_('error while creating EME key session', err); - - _this4.player_.error({ - message: 'Failed to initialize media keys for EME', - code: 3 - }); - }); - } - /** - * Initializes the quality levels and sets listeners to update them. - * - * @method setupQualityLevels_ - * @private - */ - ; - - _proto.setupQualityLevels_ = function setupQualityLevels_() { - var _this5 = this; - - var player = videojs__default['default'].players[this.tech_.options_.playerId]; // if there isn't a player or there isn't a qualityLevels plugin - // or qualityLevels_ listeners have already been setup, do nothing. - - if (!player || !player.qualityLevels || this.qualityLevels_) { - return; - } - - this.qualityLevels_ = player.qualityLevels(); - this.masterPlaylistController_.on('selectedinitialmedia', function () { - handleVhsLoadedMetadata(_this5.qualityLevels_, _this5); - }); - this.playlists.on('mediachange', function () { - handleVhsMediaChange(_this5.qualityLevels_, _this5.playlists); - }); - } - /** - * return the version - */ - ; - - VhsHandler.version = function version$5() { - return { - '@videojs/http-streaming': version$4, - 'mux.js': version$3, - 'mpd-parser': version$2, - 'm3u8-parser': version$1, - 'aes-decrypter': version - }; - } - /** - * return the version - */ - ; - - _proto.version = function version() { - return this.constructor.version(); - }; - - _proto.canChangeType = function canChangeType() { - return SourceUpdater.canChangeType(); - } - /** - * Begin playing the video. - */ - ; - - _proto.play = function play() { - this.masterPlaylistController_.play(); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.setCurrentTime = function setCurrentTime(currentTime) { - this.masterPlaylistController_.setCurrentTime(currentTime); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.duration = function duration() { - return this.masterPlaylistController_.duration(); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.seekable = function seekable() { - return this.masterPlaylistController_.seekable(); - } - /** - * Abort all outstanding work and cleanup. - */ - ; - - _proto.dispose = function dispose() { - if (this.playbackWatcher_) { - this.playbackWatcher_.dispose(); - } - - if (this.masterPlaylistController_) { - this.masterPlaylistController_.dispose(); - } - - if (this.qualityLevels_) { - this.qualityLevels_.dispose(); - } - - if (this.player_) { - delete this.player_.vhs; - delete this.player_.dash; - delete this.player_.hls; - } - - if (this.tech_ && this.tech_.vhs) { - delete this.tech_.vhs; - } // don't check this.tech_.hls as it will log a deprecated warning - - - if (this.tech_) { - delete this.tech_.hls; - } - - if (this.mediaSourceUrl_ && window__default['default'].URL.revokeObjectURL) { - window__default['default'].URL.revokeObjectURL(this.mediaSourceUrl_); - this.mediaSourceUrl_ = null; - } - - _Component.prototype.dispose.call(this); - }; - - _proto.convertToProgramTime = function convertToProgramTime(time, callback) { - return getProgramTime({ - playlist: this.masterPlaylistController_.media(), - time: time, - callback: callback - }); - } // the player must be playing before calling this - ; - - _proto.seekToProgramTime = function seekToProgramTime$1(programTime, callback, pauseAfterSeek, retryCount) { - if (pauseAfterSeek === void 0) { - pauseAfterSeek = true; - } - - if (retryCount === void 0) { - retryCount = 2; - } - - return seekToProgramTime({ - programTime: programTime, - playlist: this.masterPlaylistController_.media(), - retryCount: retryCount, - pauseAfterSeek: pauseAfterSeek, - seekTo: this.options_.seekTo, - tech: this.options_.tech, - callback: callback - }); - }; - - return VhsHandler; - }(Component); - /** - * The Source Handler object, which informs video.js what additional - * MIME types are supported and sets up playback. It is registered - * automatically to the appropriate tech based on the capabilities of - * the browser it is running in. It is not necessary to use or modify - * this object in normal usage. - */ - - - var VhsSourceHandler = { - name: 'videojs-http-streaming', - VERSION: version$4, - canHandleSource: function canHandleSource(srcObj, options) { - if (options === void 0) { - options = {}; - } - - var localOptions = videojs__default['default'].mergeOptions(videojs__default['default'].options, options); - return VhsSourceHandler.canPlayType(srcObj.type, localOptions); - }, - handleSource: function handleSource(source, tech, options) { - if (options === void 0) { - options = {}; - } - - var localOptions = videojs__default['default'].mergeOptions(videojs__default['default'].options, options); - tech.vhs = new VhsHandler(source, tech, localOptions); - - if (!videojs__default['default'].hasOwnProperty('hls')) { - Object.defineProperty(tech, 'hls', { - get: function get() { - videojs__default['default'].log.warn('player.tech().hls is deprecated. Use player.tech().vhs instead.'); - return tech.vhs; - }, - configurable: true - }); - } - - tech.vhs.xhr = xhrFactory(); - tech.vhs.src(source.src, source.type); - return tech.vhs; - }, - canPlayType: function canPlayType(type, options) { - if (options === void 0) { - options = {}; - } - - var _videojs$mergeOptions = videojs__default['default'].mergeOptions(videojs__default['default'].options, options), - _videojs$mergeOptions2 = _videojs$mergeOptions.vhs.overrideNative, - overrideNative = _videojs$mergeOptions2 === void 0 ? !videojs__default['default'].browser.IS_ANY_SAFARI : _videojs$mergeOptions2; - - var supportedType = simpleTypeFromSourceType(type); - var canUseMsePlayback = supportedType && (!Vhs.supportsTypeNatively(supportedType) || overrideNative); - return canUseMsePlayback ? 'maybe' : ''; - } - }; - /** - * Check to see if the native MediaSource object exists and supports - * an MP4 container with both H.264 video and AAC-LC audio. - * - * @return {boolean} if native media sources are supported - */ - - var supportsNativeMediaSources = function supportsNativeMediaSources() { - return browserSupportsCodec('avc1.4d400d,mp4a.40.2'); - }; // register source handlers with the appropriate techs - - - if (supportsNativeMediaSources()) { - videojs__default['default'].getTech('Html5').registerSourceHandler(VhsSourceHandler, 0); - } - - videojs__default['default'].VhsHandler = VhsHandler; - Object.defineProperty(videojs__default['default'], 'HlsHandler', { - get: function get() { - videojs__default['default'].log.warn('videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead.'); - return VhsHandler; - }, - configurable: true - }); - videojs__default['default'].VhsSourceHandler = VhsSourceHandler; - Object.defineProperty(videojs__default['default'], 'HlsSourceHandler', { - get: function get() { - videojs__default['default'].log.warn('videojs.HlsSourceHandler is deprecated. ' + 'Use videojs.VhsSourceHandler instead.'); - return VhsSourceHandler; - }, - configurable: true - }); - videojs__default['default'].Vhs = Vhs; - Object.defineProperty(videojs__default['default'], 'Hls', { - get: function get() { - videojs__default['default'].log.warn('videojs.Hls is deprecated. Use videojs.Vhs instead.'); - return Vhs; - }, - configurable: true - }); - - if (!videojs__default['default'].use) { - videojs__default['default'].registerComponent('Hls', Vhs); - videojs__default['default'].registerComponent('Vhs', Vhs); - } - - videojs__default['default'].options.vhs = videojs__default['default'].options.vhs || {}; - videojs__default['default'].options.hls = videojs__default['default'].options.hls || {}; - - if (videojs__default['default'].registerPlugin) { - videojs__default['default'].registerPlugin('reloadSourceOnError', reloadSourceOnError); - } else { - videojs__default['default'].plugin('reloadSourceOnError', reloadSourceOnError); - } - - exports.LOCAL_STORAGE_KEY = LOCAL_STORAGE_KEY; - exports.Vhs = Vhs; - exports.VhsHandler = VhsHandler; - exports.VhsSourceHandler = VhsSourceHandler; - exports.emeKeySystems = emeKeySystems; - exports.expandDataUri = expandDataUri; - exports.getAllPsshKeySystemsOptions = getAllPsshKeySystemsOptions; - exports.setupEmeOptions = setupEmeOptions; - exports.simpleTypeFromSourceType = simpleTypeFromSourceType; - exports.waitForKeySessionCreation = waitForKeySessionCreation; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.cjs.js b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.cjs.js deleted file mode 100644 index e63b1a1..0000000 --- a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.cjs.js +++ /dev/null @@ -1,25720 +0,0 @@ -/*! @name @videojs/http-streaming @version 2.9.1 @license Apache-2.0 */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized'); -var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose'); -var document = require('global/document'); -var window = require('global/window'); -var _resolveUrl = require('@videojs/vhs-utils/cjs/resolve-url.js'); -var videojs = require('video.js'); -var _extends = require('@babel/runtime/helpers/extends'); -var m3u8Parser = require('m3u8-parser'); -var codecs_js = require('@videojs/vhs-utils/cjs/codecs.js'); -var mediaTypes_js = require('@videojs/vhs-utils/cjs/media-types.js'); -var mpdParser = require('mpd-parser'); -var parseSidx = require('mux.js/lib/tools/parse-sidx'); -var id3Helpers = require('@videojs/vhs-utils/cjs/id3-helpers'); -var containers = require('@videojs/vhs-utils/cjs/containers'); -var byteHelpers = require('@videojs/vhs-utils/cjs/byte-helpers'); -var clock = require('mux.js/lib/utils/clock'); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized); -var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose); -var document__default = /*#__PURE__*/_interopDefaultLegacy(document); -var window__default = /*#__PURE__*/_interopDefaultLegacy(window); -var _resolveUrl__default = /*#__PURE__*/_interopDefaultLegacy(_resolveUrl); -var videojs__default = /*#__PURE__*/_interopDefaultLegacy(videojs); -var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends); -var parseSidx__default = /*#__PURE__*/_interopDefaultLegacy(parseSidx); - -/** - * @file resolve-url.js - Handling how URLs are resolved and manipulated - */ -var resolveUrl = _resolveUrl__default['default']; -/** - * Checks whether xhr request was redirected and returns correct url depending - * on `handleManifestRedirects` option - * - * @api private - * - * @param {string} url - an url being requested - * @param {XMLHttpRequest} req - xhr request result - * - * @return {string} - */ - -var resolveManifestRedirect = function resolveManifestRedirect(handleManifestRedirect, url, req) { - // To understand how the responseURL below is set and generated: - // - https://fetch.spec.whatwg.org/#concept-response-url - // - https://fetch.spec.whatwg.org/#atomic-http-redirect-handling - if (handleManifestRedirect && req && req.responseURL && url !== req.responseURL) { - return req.responseURL; - } - - return url; -}; - -var logger = function logger(source) { - if (videojs__default['default'].log.debug) { - return videojs__default['default'].log.debug.bind(videojs__default['default'], 'VHS:', source + " >"); - } - - return function () {}; -}; - -/** - * ranges - * - * Utilities for working with TimeRanges. - * - */ - -var TIME_FUDGE_FACTOR = 1 / 30; // Comparisons between time values such as current time and the end of the buffered range -// can be misleading because of precision differences or when the current media has poorly -// aligned audio and video, which can cause values to be slightly off from what you would -// expect. This value is what we consider to be safe to use in such comparisons to account -// for these scenarios. - -var SAFE_TIME_DELTA = TIME_FUDGE_FACTOR * 3; - -var filterRanges = function filterRanges(timeRanges, predicate) { - var results = []; - var i; - - if (timeRanges && timeRanges.length) { - // Search for ranges that match the predicate - for (i = 0; i < timeRanges.length; i++) { - if (predicate(timeRanges.start(i), timeRanges.end(i))) { - results.push([timeRanges.start(i), timeRanges.end(i)]); - } - } - } - - return videojs__default['default'].createTimeRanges(results); -}; -/** - * Attempts to find the buffered TimeRange that contains the specified - * time. - * - * @param {TimeRanges} buffered - the TimeRanges object to query - * @param {number} time - the time to filter on. - * @return {TimeRanges} a new TimeRanges object - */ - - -var findRange = function findRange(buffered, time) { - return filterRanges(buffered, function (start, end) { - return start - SAFE_TIME_DELTA <= time && end + SAFE_TIME_DELTA >= time; - }); -}; -/** - * Returns the TimeRanges that begin later than the specified time. - * - * @param {TimeRanges} timeRanges - the TimeRanges object to query - * @param {number} time - the time to filter on. - * @return {TimeRanges} a new TimeRanges object. - */ - -var findNextRange = function findNextRange(timeRanges, time) { - return filterRanges(timeRanges, function (start) { - return start - TIME_FUDGE_FACTOR >= time; - }); -}; -/** - * Returns gaps within a list of TimeRanges - * - * @param {TimeRanges} buffered - the TimeRanges object - * @return {TimeRanges} a TimeRanges object of gaps - */ - -var findGaps = function findGaps(buffered) { - if (buffered.length < 2) { - return videojs__default['default'].createTimeRanges(); - } - - var ranges = []; - - for (var i = 1; i < buffered.length; i++) { - var start = buffered.end(i - 1); - var end = buffered.start(i); - ranges.push([start, end]); - } - - return videojs__default['default'].createTimeRanges(ranges); -}; -/** - * Calculate the intersection of two TimeRanges - * - * @param {TimeRanges} bufferA - * @param {TimeRanges} bufferB - * @return {TimeRanges} The interesection of `bufferA` with `bufferB` - */ - -var bufferIntersection = function bufferIntersection(bufferA, bufferB) { - var start = null; - var end = null; - var arity = 0; - var extents = []; - var ranges = []; - - if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) { - return videojs__default['default'].createTimeRange(); - } // Handle the case where we have both buffers and create an - // intersection of the two - - - var count = bufferA.length; // A) Gather up all start and end times - - while (count--) { - extents.push({ - time: bufferA.start(count), - type: 'start' - }); - extents.push({ - time: bufferA.end(count), - type: 'end' - }); - } - - count = bufferB.length; - - while (count--) { - extents.push({ - time: bufferB.start(count), - type: 'start' - }); - extents.push({ - time: bufferB.end(count), - type: 'end' - }); - } // B) Sort them by time - - - extents.sort(function (a, b) { - return a.time - b.time; - }); // C) Go along one by one incrementing arity for start and decrementing - // arity for ends - - for (count = 0; count < extents.length; count++) { - if (extents[count].type === 'start') { - arity++; // D) If arity is ever incremented to 2 we are entering an - // overlapping range - - if (arity === 2) { - start = extents[count].time; - } - } else if (extents[count].type === 'end') { - arity--; // E) If arity is ever decremented to 1 we leaving an - // overlapping range - - if (arity === 1) { - end = extents[count].time; - } - } // F) Record overlapping ranges - - - if (start !== null && end !== null) { - ranges.push([start, end]); - start = null; - end = null; - } - } - - return videojs__default['default'].createTimeRanges(ranges); -}; -/** - * Gets a human readable string for a TimeRange - * - * @param {TimeRange} range - * @return {string} a human readable string - */ - -var printableRange = function printableRange(range) { - var strArr = []; - - if (!range || !range.length) { - return ''; - } - - for (var i = 0; i < range.length; i++) { - strArr.push(range.start(i) + ' => ' + range.end(i)); - } - - return strArr.join(', '); -}; -/** - * Calculates the amount of time left in seconds until the player hits the end of the - * buffer and causes a rebuffer - * - * @param {TimeRange} buffered - * The state of the buffer - * @param {Numnber} currentTime - * The current time of the player - * @param {number} playbackRate - * The current playback rate of the player. Defaults to 1. - * @return {number} - * Time until the player has to start rebuffering in seconds. - * @function timeUntilRebuffer - */ - -var timeUntilRebuffer = function timeUntilRebuffer(buffered, currentTime, playbackRate) { - if (playbackRate === void 0) { - playbackRate = 1; - } - - var bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0; - return (bufferedEnd - currentTime) / playbackRate; -}; -/** - * Converts a TimeRanges object into an array representation - * - * @param {TimeRanges} timeRanges - * @return {Array} - */ - -var timeRangesToArray = function timeRangesToArray(timeRanges) { - var timeRangesList = []; - - for (var i = 0; i < timeRanges.length; i++) { - timeRangesList.push({ - start: timeRanges.start(i), - end: timeRanges.end(i) - }); - } - - return timeRangesList; -}; -/** - * Determines if two time range objects are different. - * - * @param {TimeRange} a - * the first time range object to check - * - * @param {TimeRange} b - * the second time range object to check - * - * @return {Boolean} - * Whether the time range objects differ - */ - -var isRangeDifferent = function isRangeDifferent(a, b) { - // same object - if (a === b) { - return false; - } // one or the other is undefined - - - if (!a && b || !b && a) { - return true; - } // length is different - - - if (a.length !== b.length) { - return true; - } // see if any start/end pair is different - - - for (var i = 0; i < a.length; i++) { - if (a.start(i) !== b.start(i) || a.end(i) !== b.end(i)) { - return true; - } - } // if the length and every pair is the same - // this is the same time range - - - return false; -}; -var lastBufferedEnd = function lastBufferedEnd(a) { - if (!a || !a.length || !a.end) { - return; - } - - return a.end(a.length - 1); -}; - -/** - * @file playlist.js - * - * Playlist related utilities. - */ -var createTimeRange = videojs__default['default'].createTimeRange; -/** - * A function to get a combined list of parts and segments with durations - * and indexes. - * - * @param {Playlist} playlist the playlist to get the list for. - * - * @return {Array} The part/segment list. - */ - -var getPartsAndSegments = function getPartsAndSegments(playlist) { - return (playlist.segments || []).reduce(function (acc, segment, si) { - if (segment.parts) { - segment.parts.forEach(function (part, pi) { - acc.push({ - duration: part.duration, - segmentIndex: si, - partIndex: pi, - part: part, - segment: segment - }); - }); - } else { - acc.push({ - duration: segment.duration, - segmentIndex: si, - partIndex: null, - segment: segment, - part: null - }); - } - - return acc; - }, []); -}; -var getLastParts = function getLastParts(media) { - var lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1]; - return lastSegment && lastSegment.parts || []; -}; -var getKnownPartCount = function getKnownPartCount(_ref) { - var preloadSegment = _ref.preloadSegment; - - if (!preloadSegment) { - return; - } - - var parts = preloadSegment.parts, - preloadHints = preloadSegment.preloadHints; - var partCount = (preloadHints || []).reduce(function (count, hint) { - return count + (hint.type === 'PART' ? 1 : 0); - }, 0); - partCount += parts && parts.length ? parts.length : 0; - return partCount; -}; -/** - * Get the number of seconds to delay from the end of a - * live playlist. - * - * @param {Playlist} master the master playlist - * @param {Playlist} media the media playlist - * @return {number} the hold back in seconds. - */ - -var liveEdgeDelay = function liveEdgeDelay(master, media) { - if (media.endList) { - return 0; - } // dash suggestedPresentationDelay trumps everything - - - if (master && master.suggestedPresentationDelay) { - return master.suggestedPresentationDelay; - } - - var hasParts = getLastParts(media).length > 0; // look for "part" delays from ll-hls first - - if (hasParts && media.serverControl && media.serverControl.partHoldBack) { - return media.serverControl.partHoldBack; - } else if (hasParts && media.partTargetDuration) { - return media.partTargetDuration * 3; // finally look for full segment delays - } else if (media.serverControl && media.serverControl.holdBack) { - return media.serverControl.holdBack; - } else if (media.targetDuration) { - return media.targetDuration * 3; - } - - return 0; -}; -/** - * walk backward until we find a duration we can use - * or return a failure - * - * @param {Playlist} playlist the playlist to walk through - * @param {Number} endSequence the mediaSequence to stop walking on - */ - -var backwardDuration = function backwardDuration(playlist, endSequence) { - var result = 0; - var i = endSequence - playlist.mediaSequence; // if a start time is available for segment immediately following - // the interval, use it - - var segment = playlist.segments[i]; // Walk backward until we find the latest segment with timeline - // information that is earlier than endSequence - - if (segment) { - if (typeof segment.start !== 'undefined') { - return { - result: segment.start, - precise: true - }; - } - - if (typeof segment.end !== 'undefined') { - return { - result: segment.end - segment.duration, - precise: true - }; - } - } - - while (i--) { - segment = playlist.segments[i]; - - if (typeof segment.end !== 'undefined') { - return { - result: result + segment.end, - precise: true - }; - } - - result += segment.duration; - - if (typeof segment.start !== 'undefined') { - return { - result: result + segment.start, - precise: true - }; - } - } - - return { - result: result, - precise: false - }; -}; -/** - * walk forward until we find a duration we can use - * or return a failure - * - * @param {Playlist} playlist the playlist to walk through - * @param {number} endSequence the mediaSequence to stop walking on - */ - - -var forwardDuration = function forwardDuration(playlist, endSequence) { - var result = 0; - var segment; - var i = endSequence - playlist.mediaSequence; // Walk forward until we find the earliest segment with timeline - // information - - for (; i < playlist.segments.length; i++) { - segment = playlist.segments[i]; - - if (typeof segment.start !== 'undefined') { - return { - result: segment.start - result, - precise: true - }; - } - - result += segment.duration; - - if (typeof segment.end !== 'undefined') { - return { - result: segment.end - result, - precise: true - }; - } - } // indicate we didn't find a useful duration estimate - - - return { - result: -1, - precise: false - }; -}; -/** - * Calculate the media duration from the segments associated with a - * playlist. The duration of a subinterval of the available segments - * may be calculated by specifying an end index. - * - * @param {Object} playlist a media playlist object - * @param {number=} endSequence an exclusive upper boundary - * for the playlist. Defaults to playlist length. - * @param {number} expired the amount of time that has dropped - * off the front of the playlist in a live scenario - * @return {number} the duration between the first available segment - * and end index. - */ - - -var intervalDuration = function intervalDuration(playlist, endSequence, expired) { - if (typeof endSequence === 'undefined') { - endSequence = playlist.mediaSequence + playlist.segments.length; - } - - if (endSequence < playlist.mediaSequence) { - return 0; - } // do a backward walk to estimate the duration - - - var backward = backwardDuration(playlist, endSequence); - - if (backward.precise) { - // if we were able to base our duration estimate on timing - // information provided directly from the Media Source, return - // it - return backward.result; - } // walk forward to see if a precise duration estimate can be made - // that way - - - var forward = forwardDuration(playlist, endSequence); - - if (forward.precise) { - // we found a segment that has been buffered and so it's - // position is known precisely - return forward.result; - } // return the less-precise, playlist-based duration estimate - - - return backward.result + expired; -}; -/** - * Calculates the duration of a playlist. If a start and end index - * are specified, the duration will be for the subset of the media - * timeline between those two indices. The total duration for live - * playlists is always Infinity. - * - * @param {Object} playlist a media playlist object - * @param {number=} endSequence an exclusive upper - * boundary for the playlist. Defaults to the playlist media - * sequence number plus its length. - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @return {number} the duration between the start index and end - * index. - */ - - -var duration = function duration(playlist, endSequence, expired) { - if (!playlist) { - return 0; - } - - if (typeof expired !== 'number') { - expired = 0; - } // if a slice of the total duration is not requested, use - // playlist-level duration indicators when they're present - - - if (typeof endSequence === 'undefined') { - // if present, use the duration specified in the playlist - if (playlist.totalDuration) { - return playlist.totalDuration; - } // duration should be Infinity for live playlists - - - if (!playlist.endList) { - return window__default['default'].Infinity; - } - } // calculate the total duration based on the segment durations - - - return intervalDuration(playlist, endSequence, expired); -}; -/** - * Calculate the time between two indexes in the current playlist - * neight the start- nor the end-index need to be within the current - * playlist in which case, the targetDuration of the playlist is used - * to approximate the durations of the segments - * - * @param {Array} options.durationList list to iterate over for durations. - * @param {number} options.defaultDuration duration to use for elements before or after the durationList - * @param {number} options.startIndex partsAndSegments index to start - * @param {number} options.endIndex partsAndSegments index to end. - * @return {number} the number of seconds between startIndex and endIndex - */ - -var sumDurations = function sumDurations(_ref2) { - var defaultDuration = _ref2.defaultDuration, - durationList = _ref2.durationList, - startIndex = _ref2.startIndex, - endIndex = _ref2.endIndex; - var durations = 0; - - if (startIndex > endIndex) { - var _ref3 = [endIndex, startIndex]; - startIndex = _ref3[0]; - endIndex = _ref3[1]; - } - - if (startIndex < 0) { - for (var i = startIndex; i < Math.min(0, endIndex); i++) { - durations += defaultDuration; - } - - startIndex = 0; - } - - for (var _i = startIndex; _i < endIndex; _i++) { - durations += durationList[_i].duration; - } - - return durations; -}; -/** - * Calculates the playlist end time - * - * @param {Object} playlist a media playlist object - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @param {boolean|false} useSafeLiveEnd a boolean value indicating whether or not the - * playlist end calculation should consider the safe live end - * (truncate the playlist end by three segments). This is normally - * used for calculating the end of the playlist's seekable range. - * This takes into account the value of liveEdgePadding. - * Setting liveEdgePadding to 0 is equivalent to setting this to false. - * @param {number} liveEdgePadding a number indicating how far from the end of the playlist we should be in seconds. - * If this is provided, it is used in the safe live end calculation. - * Setting useSafeLiveEnd=false or liveEdgePadding=0 are equivalent. - * Corresponds to suggestedPresentationDelay in DASH manifests. - * @return {number} the end time of playlist - * @function playlistEnd - */ - -var playlistEnd = function playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding) { - if (!playlist || !playlist.segments) { - return null; - } - - if (playlist.endList) { - return duration(playlist); - } - - if (expired === null) { - return null; - } - - expired = expired || 0; - var lastSegmentTime = intervalDuration(playlist, playlist.mediaSequence + playlist.segments.length, expired); - - if (useSafeLiveEnd) { - liveEdgePadding = typeof liveEdgePadding === 'number' ? liveEdgePadding : liveEdgeDelay(null, playlist); - lastSegmentTime -= liveEdgePadding; - } // don't return a time less than zero - - - return Math.max(0, lastSegmentTime); -}; -/** - * Calculates the interval of time that is currently seekable in a - * playlist. The returned time ranges are relative to the earliest - * moment in the specified playlist that is still available. A full - * seekable implementation for live streams would need to offset - * these values by the duration of content that has expired from the - * stream. - * - * @param {Object} playlist a media playlist object - * dropped off the front of the playlist in a live scenario - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @param {number} liveEdgePadding how far from the end of the playlist we should be in seconds. - * Corresponds to suggestedPresentationDelay in DASH manifests. - * @return {TimeRanges} the periods of time that are valid targets - * for seeking - */ - -var seekable = function seekable(playlist, expired, liveEdgePadding) { - var useSafeLiveEnd = true; - var seekableStart = expired || 0; - var seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); - - if (seekableEnd === null) { - return createTimeRange(); - } - - return createTimeRange(seekableStart, seekableEnd); -}; -/** - * Determine the index and estimated starting time of the segment that - * contains a specified playback position in a media playlist. - * - * @param {Object} options.playlist the media playlist to query - * @param {number} options.currentTime The number of seconds since the earliest - * possible position to determine the containing segment for - * @param {number} options.startTime the time when the segment/part starts - * @param {number} options.startingSegmentIndex the segment index to start looking at. - * @param {number?} [options.startingPartIndex] the part index to look at within the segment. - * - * @return {Object} an object with partIndex, segmentIndex, and startTime. - */ - -var getMediaInfoForTime = function getMediaInfoForTime(_ref4) { - var playlist = _ref4.playlist, - currentTime = _ref4.currentTime, - startingSegmentIndex = _ref4.startingSegmentIndex, - startingPartIndex = _ref4.startingPartIndex, - startTime = _ref4.startTime; - var time = currentTime - startTime; - var partsAndSegments = getPartsAndSegments(playlist); - var startIndex = 0; - - for (var i = 0; i < partsAndSegments.length; i++) { - var partAndSegment = partsAndSegments[i]; - - if (startingSegmentIndex !== partAndSegment.segmentIndex) { - continue; - } // skip this if part index does not match. - - - if (typeof startingPartIndex === 'number' && typeof partAndSegment.partIndex === 'number' && startingPartIndex !== partAndSegment.partIndex) { - continue; - } - - startIndex = i; - break; - } - - if (time < 0) { - // Walk backward from startIndex in the playlist, adding durations - // until we find a segment that contains `time` and return it - if (startIndex > 0) { - for (var _i2 = startIndex - 1; _i2 >= 0; _i2--) { - var _partAndSegment = partsAndSegments[_i2]; - time += _partAndSegment.duration; // TODO: consider not using TIME_FUDGE_FACTOR at all here - - if (time + TIME_FUDGE_FACTOR > 0) { - return { - partIndex: _partAndSegment.partIndex, - segmentIndex: _partAndSegment.segmentIndex, - startTime: startTime - sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: partsAndSegments, - startIndex: startIndex, - endIndex: _i2 - }) - }; - } - } - } // We were unable to find a good segment within the playlist - // so select the first segment - - - return { - partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null, - segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0, - startTime: currentTime - }; - } // When startIndex is negative, we first walk forward to first segment - // adding target durations. If we "run out of time" before getting to - // the first segment, return the first segment - - - if (startIndex < 0) { - for (var _i3 = startIndex; _i3 < 0; _i3++) { - time -= playlist.targetDuration; - - if (time < 0) { - return { - partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null, - segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0, - startTime: currentTime - }; - } - } - - startIndex = 0; - } // Walk forward from startIndex in the playlist, subtracting durations - // until we find a segment that contains `time` and return it - - - for (var _i4 = startIndex; _i4 < partsAndSegments.length; _i4++) { - var _partAndSegment2 = partsAndSegments[_i4]; - time -= _partAndSegment2.duration; // TODO: consider not using TIME_FUDGE_FACTOR at all here - - if (time - TIME_FUDGE_FACTOR < 0) { - return { - partIndex: _partAndSegment2.partIndex, - segmentIndex: _partAndSegment2.segmentIndex, - startTime: startTime + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: partsAndSegments, - startIndex: startIndex, - endIndex: _i4 - }) - }; - } - } // We are out of possible candidates so load the last one... - - - return { - segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex, - partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex, - startTime: currentTime - }; -}; -/** - * Check whether the playlist is blacklisted or not. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is blacklisted or not - * @function isBlacklisted - */ - -var isBlacklisted = function isBlacklisted(playlist) { - return playlist.excludeUntil && playlist.excludeUntil > Date.now(); -}; -/** - * Check whether the playlist is compatible with current playback configuration or has - * been blacklisted permanently for being incompatible. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is incompatible or not - * @function isIncompatible - */ - -var isIncompatible = function isIncompatible(playlist) { - return playlist.excludeUntil && playlist.excludeUntil === Infinity; -}; -/** - * Check whether the playlist is enabled or not. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is enabled or not - * @function isEnabled - */ - -var isEnabled = function isEnabled(playlist) { - var blacklisted = isBlacklisted(playlist); - return !playlist.disabled && !blacklisted; -}; -/** - * Check whether the playlist has been manually disabled through the representations api. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is disabled manually or not - * @function isDisabled - */ - -var isDisabled = function isDisabled(playlist) { - return playlist.disabled; -}; -/** - * Returns whether the current playlist is an AES encrypted HLS stream - * - * @return {boolean} true if it's an AES encrypted HLS stream - */ - -var isAes = function isAes(media) { - for (var i = 0; i < media.segments.length; i++) { - if (media.segments[i].key) { - return true; - } - } - - return false; -}; -/** - * Checks if the playlist has a value for the specified attribute - * - * @param {string} attr - * Attribute to check for - * @param {Object} playlist - * The media playlist object - * @return {boolean} - * Whether the playlist contains a value for the attribute or not - * @function hasAttribute - */ - -var hasAttribute = function hasAttribute(attr, playlist) { - return playlist.attributes && playlist.attributes[attr]; -}; -/** - * Estimates the time required to complete a segment download from the specified playlist - * - * @param {number} segmentDuration - * Duration of requested segment - * @param {number} bandwidth - * Current measured bandwidth of the player - * @param {Object} playlist - * The media playlist object - * @param {number=} bytesReceived - * Number of bytes already received for the request. Defaults to 0 - * @return {number|NaN} - * The estimated time to request the segment. NaN if bandwidth information for - * the given playlist is unavailable - * @function estimateSegmentRequestTime - */ - -var estimateSegmentRequestTime = function estimateSegmentRequestTime(segmentDuration, bandwidth, playlist, bytesReceived) { - if (bytesReceived === void 0) { - bytesReceived = 0; - } - - if (!hasAttribute('BANDWIDTH', playlist)) { - return NaN; - } - - var size = segmentDuration * playlist.attributes.BANDWIDTH; - return (size - bytesReceived * 8) / bandwidth; -}; -/* - * Returns whether the current playlist is the lowest rendition - * - * @return {Boolean} true if on lowest rendition - */ - -var isLowestEnabledRendition = function isLowestEnabledRendition(master, media) { - if (master.playlists.length === 1) { - return true; - } - - var currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE; - return master.playlists.filter(function (playlist) { - if (!isEnabled(playlist)) { - return false; - } - - return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth; - }).length === 0; -}; -var playlistMatch = function playlistMatch(a, b) { - // both playlits are null - // or only one playlist is non-null - // no match - if (!a && !b || !a && b || a && !b) { - return false; - } // playlist objects are the same, match - - - if (a === b) { - return true; - } // first try to use id as it should be the most - // accurate - - - if (a.id && b.id && a.id === b.id) { - return true; - } // next try to use reslovedUri as it should be the - // second most accurate. - - - if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) { - return true; - } // finally try to use uri as it should be accurate - // but might miss a few cases for relative uris - - - if (a.uri && b.uri && a.uri === b.uri) { - return true; - } - - return false; -}; - -var someAudioVariant = function someAudioVariant(master, callback) { - var AUDIO = master && master.mediaGroups && master.mediaGroups.AUDIO || {}; - var found = false; - - for (var groupName in AUDIO) { - for (var label in AUDIO[groupName]) { - found = callback(AUDIO[groupName][label]); - - if (found) { - break; - } - } - - if (found) { - break; - } - } - - return !!found; -}; - -var isAudioOnly = function isAudioOnly(master) { - // we are audio only if we have no main playlists but do - // have media group playlists. - if (!master || !master.playlists || !master.playlists.length) { - // without audio variants or playlists this - // is not an audio only master. - var found = someAudioVariant(master, function (variant) { - return variant.playlists && variant.playlists.length || variant.uri; - }); - return found; - } // if every playlist has only an audio codec it is audio only - - - var _loop = function _loop(i) { - var playlist = master.playlists[i]; - var CODECS = playlist.attributes && playlist.attributes.CODECS; // all codecs are audio, this is an audio playlist. - - if (CODECS && CODECS.split(',').every(function (c) { - return codecs_js.isAudioCodec(c); - })) { - return "continue"; - } // playlist is in an audio group it is audio only - - - var found = someAudioVariant(master, function (variant) { - return playlistMatch(playlist, variant); - }); - - if (found) { - return "continue"; - } // if we make it here this playlist isn't audio and we - // are not audio only - - - return { - v: false - }; - }; - - for (var i = 0; i < master.playlists.length; i++) { - var _ret = _loop(i); - - if (_ret === "continue") continue; - if (typeof _ret === "object") return _ret.v; - } // if we make it past every playlist without returning, then - // this is an audio only playlist. - - - return true; -}; // exports - -var Playlist = { - liveEdgeDelay: liveEdgeDelay, - duration: duration, - seekable: seekable, - getMediaInfoForTime: getMediaInfoForTime, - isEnabled: isEnabled, - isDisabled: isDisabled, - isBlacklisted: isBlacklisted, - isIncompatible: isIncompatible, - playlistEnd: playlistEnd, - isAes: isAes, - hasAttribute: hasAttribute, - estimateSegmentRequestTime: estimateSegmentRequestTime, - isLowestEnabledRendition: isLowestEnabledRendition, - isAudioOnly: isAudioOnly, - playlistMatch: playlistMatch -}; - -var log = videojs__default['default'].log; -var createPlaylistID = function createPlaylistID(index, uri) { - return index + "-" + uri; -}; -/** - * Parses a given m3u8 playlist - * - * @param {Function} [onwarn] - * a function to call when the parser triggers a warning event. - * @param {Function} [oninfo] - * a function to call when the parser triggers an info event. - * @param {string} manifestString - * The downloaded manifest string - * @param {Object[]} [customTagParsers] - * An array of custom tag parsers for the m3u8-parser instance - * @param {Object[]} [customTagMappers] - * An array of custom tag mappers for the m3u8-parser instance - * @param {boolean} [experimentalLLHLS=false] - * Whether to keep ll-hls features in the manifest after parsing. - * @return {Object} - * The manifest object - */ - -var parseManifest = function parseManifest(_ref) { - var onwarn = _ref.onwarn, - oninfo = _ref.oninfo, - manifestString = _ref.manifestString, - _ref$customTagParsers = _ref.customTagParsers, - customTagParsers = _ref$customTagParsers === void 0 ? [] : _ref$customTagParsers, - _ref$customTagMappers = _ref.customTagMappers, - customTagMappers = _ref$customTagMappers === void 0 ? [] : _ref$customTagMappers, - experimentalLLHLS = _ref.experimentalLLHLS; - var parser = new m3u8Parser.Parser(); - - if (onwarn) { - parser.on('warn', onwarn); - } - - if (oninfo) { - parser.on('info', oninfo); - } - - customTagParsers.forEach(function (customParser) { - return parser.addParser(customParser); - }); - customTagMappers.forEach(function (mapper) { - return parser.addTagMapper(mapper); - }); - parser.push(manifestString); - parser.end(); - var manifest = parser.manifest; // remove llhls features from the parsed manifest - // if we don't want llhls support. - - if (!experimentalLLHLS) { - ['preloadSegment', 'skip', 'serverControl', 'renditionReports', 'partInf', 'partTargetDuration'].forEach(function (k) { - if (manifest.hasOwnProperty(k)) { - delete manifest[k]; - } - }); - - if (manifest.segments) { - manifest.segments.forEach(function (segment) { - ['parts', 'preloadHints'].forEach(function (k) { - if (segment.hasOwnProperty(k)) { - delete segment[k]; - } - }); - }); - } - } - - if (!manifest.targetDuration) { - var targetDuration = 10; - - if (manifest.segments && manifest.segments.length) { - targetDuration = manifest.segments.reduce(function (acc, s) { - return Math.max(acc, s.duration); - }, 0); - } - - if (onwarn) { - onwarn("manifest has no targetDuration defaulting to " + targetDuration); - } - - manifest.targetDuration = targetDuration; - } - - var parts = getLastParts(manifest); - - if (parts.length && !manifest.partTargetDuration) { - var partTargetDuration = parts.reduce(function (acc, p) { - return Math.max(acc, p.duration); - }, 0); - - if (onwarn) { - onwarn("manifest has no partTargetDuration defaulting to " + partTargetDuration); - log.error('LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.'); - } - - manifest.partTargetDuration = partTargetDuration; - } - - return manifest; -}; -/** - * Loops through all supported media groups in master and calls the provided - * callback for each group - * - * @param {Object} master - * The parsed master manifest object - * @param {Function} callback - * Callback to call for each media group - */ - -var forEachMediaGroup = function forEachMediaGroup(master, callback) { - if (!master.mediaGroups) { - return; - } - - ['AUDIO', 'SUBTITLES'].forEach(function (mediaType) { - if (!master.mediaGroups[mediaType]) { - return; - } - - for (var groupKey in master.mediaGroups[mediaType]) { - for (var labelKey in master.mediaGroups[mediaType][groupKey]) { - var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey]; - callback(mediaProperties, mediaType, groupKey, labelKey); - } - } - }); -}; -/** - * Adds properties and attributes to the playlist to keep consistent functionality for - * playlists throughout VHS. - * - * @param {Object} config - * Arguments object - * @param {Object} config.playlist - * The media playlist - * @param {string} [config.uri] - * The uri to the media playlist (if media playlist is not from within a master - * playlist) - * @param {string} id - * ID to use for the playlist - */ - -var setupMediaPlaylist = function setupMediaPlaylist(_ref2) { - var playlist = _ref2.playlist, - uri = _ref2.uri, - id = _ref2.id; - playlist.id = id; - playlist.playlistErrors_ = 0; - - if (uri) { - // For media playlists, m3u8-parser does not have access to a URI, as HLS media - // playlists do not contain their own source URI, but one is needed for consistency in - // VHS. - playlist.uri = uri; - } // For HLS master playlists, even though certain attributes MUST be defined, the - // stream may still be played without them. - // For HLS media playlists, m3u8-parser does not attach an attributes object to the - // manifest. - // - // To avoid undefined reference errors through the project, and make the code easier - // to write/read, add an empty attributes object for these cases. - - - playlist.attributes = playlist.attributes || {}; -}; -/** - * Adds ID, resolvedUri, and attributes properties to each playlist of the master, where - * necessary. In addition, creates playlist IDs for each playlist and adds playlist ID to - * playlist references to the playlists array. - * - * @param {Object} master - * The master playlist - */ - -var setupMediaPlaylists = function setupMediaPlaylists(master) { - var i = master.playlists.length; - - while (i--) { - var playlist = master.playlists[i]; - setupMediaPlaylist({ - playlist: playlist, - id: createPlaylistID(i, playlist.uri) - }); - playlist.resolvedUri = resolveUrl(master.uri, playlist.uri); - master.playlists[playlist.id] = playlist; // URI reference added for backwards compatibility - - master.playlists[playlist.uri] = playlist; // Although the spec states an #EXT-X-STREAM-INF tag MUST have a BANDWIDTH attribute, - // the stream can be played without it. Although an attributes property may have been - // added to the playlist to prevent undefined references, issue a warning to fix the - // manifest. - - if (!playlist.attributes.BANDWIDTH) { - log.warn('Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.'); - } - } -}; -/** - * Adds resolvedUri properties to each media group. - * - * @param {Object} master - * The master playlist - */ - -var resolveMediaGroupUris = function resolveMediaGroupUris(master) { - forEachMediaGroup(master, function (properties) { - if (properties.uri) { - properties.resolvedUri = resolveUrl(master.uri, properties.uri); - } - }); -}; -/** - * Creates a master playlist wrapper to insert a sole media playlist into. - * - * @param {Object} media - * Media playlist - * @param {string} uri - * The media URI - * - * @return {Object} - * Master playlist - */ - -var masterForMedia = function masterForMedia(media, uri) { - var id = createPlaylistID(0, uri); - var master = { - mediaGroups: { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - uri: window__default['default'].location.href, - resolvedUri: window__default['default'].location.href, - playlists: [{ - uri: uri, - id: id, - resolvedUri: uri, - // m3u8-parser does not attach an attributes property to media playlists so make - // sure that the property is attached to avoid undefined reference errors - attributes: {} - }] - }; // set up ID reference - - master.playlists[id] = master.playlists[0]; // URI reference added for backwards compatibility - - master.playlists[uri] = master.playlists[0]; - return master; -}; -/** - * Does an in-place update of the master manifest to add updated playlist URI references - * as well as other properties needed by VHS that aren't included by the parser. - * - * @param {Object} master - * Master manifest object - * @param {string} uri - * The source URI - */ - -var addPropertiesToMaster = function addPropertiesToMaster(master, uri) { - master.uri = uri; - - for (var i = 0; i < master.playlists.length; i++) { - if (!master.playlists[i].uri) { - // Set up phony URIs for the playlists since playlists are referenced by their URIs - // throughout VHS, but some formats (e.g., DASH) don't have external URIs - // TODO: consider adding dummy URIs in mpd-parser - var phonyUri = "placeholder-uri-" + i; - master.playlists[i].uri = phonyUri; - } - } - - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - var groupId = "placeholder-uri-" + mediaType + "-" + groupKey + "-" + labelKey; - - if (!properties.playlists || !properties.playlists.length) { - properties.playlists = [_extends__default['default']({}, properties)]; - } - - properties.playlists.forEach(function (p, i) { - var id = createPlaylistID(i, groupId); - - if (p.uri) { - p.resolvedUri = p.resolvedUri || resolveUrl(master.uri, p.uri); - } else { - // DEPRECATED, this has been added to prevent a breaking change. - // previously we only ever had a single media group playlist, so - // we mark the first playlist uri without prepending the index as we used to - // ideally we would do all of the playlists the same way. - p.uri = i === 0 ? groupId : id; // don't resolve a placeholder uri to an absolute url, just use - // the placeholder again - - p.resolvedUri = p.uri; - } - - p.id = p.id || id; // add an empty attributes object, all playlists are - // expected to have this. - - p.attributes = p.attributes || {}; // setup ID and URI references (URI for backwards compatibility) - - master.playlists[p.id] = p; - master.playlists[p.uri] = p; - }); - }); - setupMediaPlaylists(master); - resolveMediaGroupUris(master); -}; - -var mergeOptions$2 = videojs__default['default'].mergeOptions, - EventTarget$1 = videojs__default['default'].EventTarget; - -var addLLHLSQueryDirectives = function addLLHLSQueryDirectives(uri, media) { - if (media.endList) { - return uri; - } - - var query = []; - - if (media.serverControl && media.serverControl.canBlockReload) { - var preloadSegment = media.preloadSegment; // next msn is a zero based value, length is not. - - var nextMSN = media.mediaSequence + media.segments.length; // If preload segment has parts then it is likely - // that we are going to request a part of that preload segment. - // the logic below is used to determine that. - - if (preloadSegment) { - var parts = preloadSegment.parts || []; // _HLS_part is a zero based index - - var nextPart = getKnownPartCount(media) - 1; // if nextPart is > -1 and not equal to just the - // length of parts, then we know we had part preload hints - // and we need to add the _HLS_part= query - - if (nextPart > -1 && nextPart !== parts.length - 1) { - // add existing parts to our preload hints - query.push("_HLS_part=" + nextPart); - } // this if statement makes sure that we request the msn - // of the preload segment if: - // 1. the preload segment had parts (and was not yet a full segment) - // but was added to our segments array - // 2. the preload segment had preload hints for parts that are not in - // the manifest yet. - // in all other cases we want the segment after the preload segment - // which will be given by using media.segments.length because it is 1 based - // rather than 0 based. - - - if (nextPart > -1 || parts.length) { - nextMSN--; - } - } // add _HLS_msn= in front of any _HLS_part query - - - query.unshift("_HLS_msn=" + nextMSN); - } - - if (media.serverControl && media.serverControl.canSkipUntil) { - // add _HLS_skip= infront of all other queries. - query.unshift('_HLS_skip=' + (media.serverControl.canSkipDateranges ? 'v2' : 'YES')); - } - - query.forEach(function (str, i) { - var symbol = i === 0 ? '?' : '&'; - uri += "" + symbol + str; - }); - return uri; -}; -/** - * Returns a new segment object with properties and - * the parts array merged. - * - * @param {Object} a the old segment - * @param {Object} b the new segment - * - * @return {Object} the merged segment - */ - - -var updateSegment = function updateSegment(a, b) { - if (!a) { - return b; - } - - var result = mergeOptions$2(a, b); // if only the old segment has preload hints - // and the new one does not, remove preload hints. - - if (a.preloadHints && !b.preloadHints) { - delete result.preloadHints; - } // if only the old segment has parts - // then the parts are no longer valid - - - if (a.parts && !b.parts) { - delete result.parts; // if both segments have parts - // copy part propeties from the old segment - // to the new one. - } else if (a.parts && b.parts) { - for (var i = 0; i < b.parts.length; i++) { - if (a.parts && a.parts[i]) { - result.parts[i] = mergeOptions$2(a.parts[i], b.parts[i]); - } - } - } // set skipped to false for segments that have - // have had information merged from the old segment. - - - if (!a.skipped && b.skipped) { - result.skipped = false; - } // set preload to false for segments that have - // had information added in the new segment. - - - if (a.preload && !b.preload) { - result.preload = false; - } - - return result; -}; -/** - * Returns a new array of segments that is the result of merging - * properties from an older list of segments onto an updated - * list. No properties on the updated playlist will be ovewritten. - * - * @param {Array} original the outdated list of segments - * @param {Array} update the updated list of segments - * @param {number=} offset the index of the first update - * segment in the original segment list. For non-live playlists, - * this should always be zero and does not need to be - * specified. For live playlists, it should be the difference - * between the media sequence numbers in the original and updated - * playlists. - * @return {Array} a list of merged segment objects - */ - -var updateSegments = function updateSegments(original, update, offset) { - var oldSegments = original.slice(); - var newSegments = update.slice(); - offset = offset || 0; - var result = []; - var currentMap; - - for (var newIndex = 0; newIndex < newSegments.length; newIndex++) { - var oldSegment = oldSegments[newIndex + offset]; - var newSegment = newSegments[newIndex]; - - if (oldSegment) { - currentMap = oldSegment.map || currentMap; - result.push(updateSegment(oldSegment, newSegment)); - } else { - // carry over map to new segment if it is missing - if (currentMap && !newSegment.map) { - newSegment.map = currentMap; - } - - result.push(newSegment); - } - } - - return result; -}; -var resolveSegmentUris = function resolveSegmentUris(segment, baseUri) { - // preloadSegment will not have a uri at all - // as the segment isn't actually in the manifest yet, only parts - if (!segment.resolvedUri && segment.uri) { - segment.resolvedUri = resolveUrl(baseUri, segment.uri); - } - - if (segment.key && !segment.key.resolvedUri) { - segment.key.resolvedUri = resolveUrl(baseUri, segment.key.uri); - } - - if (segment.map && !segment.map.resolvedUri) { - segment.map.resolvedUri = resolveUrl(baseUri, segment.map.uri); - } - - if (segment.map && segment.map.key && !segment.map.key.resolvedUri) { - segment.map.key.resolvedUri = resolveUrl(baseUri, segment.map.key.uri); - } - - if (segment.parts && segment.parts.length) { - segment.parts.forEach(function (p) { - if (p.resolvedUri) { - return; - } - - p.resolvedUri = resolveUrl(baseUri, p.uri); - }); - } - - if (segment.preloadHints && segment.preloadHints.length) { - segment.preloadHints.forEach(function (p) { - if (p.resolvedUri) { - return; - } - - p.resolvedUri = resolveUrl(baseUri, p.uri); - }); - } -}; - -var getAllSegments = function getAllSegments(media) { - var segments = media.segments || []; - var preloadSegment = media.preloadSegment; // a preloadSegment with only preloadHints is not currently - // a usable segment, only include a preloadSegment that has - // parts. - - if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) { - // if preloadHints has a MAP that means that the - // init segment is going to change. We cannot use any of the parts - // from this preload segment. - if (preloadSegment.preloadHints) { - for (var i = 0; i < preloadSegment.preloadHints.length; i++) { - if (preloadSegment.preloadHints[i].type === 'MAP') { - return segments; - } - } - } // set the duration for our preload segment to target duration. - - - preloadSegment.duration = media.targetDuration; - preloadSegment.preload = true; - segments.push(preloadSegment); - } - - return segments; -}; // consider the playlist unchanged if the playlist object is the same or -// the number of segments is equal, the media sequence number is unchanged, -// and this playlist hasn't become the end of the playlist - - -var isPlaylistUnchanged = function isPlaylistUnchanged(a, b) { - return a === b || a.segments && b.segments && a.segments.length === b.segments.length && a.endList === b.endList && a.mediaSequence === b.mediaSequence; -}; -/** - * Returns a new master playlist that is the result of merging an - * updated media playlist into the original version. If the - * updated media playlist does not match any of the playlist - * entries in the original master playlist, null is returned. - * - * @param {Object} master a parsed master M3U8 object - * @param {Object} media a parsed media M3U8 object - * @return {Object} a new object that represents the original - * master playlist with the updated media playlist merged in, or - * null if the merge produced no change. - */ - -var updateMaster$1 = function updateMaster(master, newMedia, unchangedCheck) { - if (unchangedCheck === void 0) { - unchangedCheck = isPlaylistUnchanged; - } - - var result = mergeOptions$2(master, {}); - var oldMedia = result.playlists[newMedia.id]; - - if (!oldMedia) { - return null; - } - - if (unchangedCheck(oldMedia, newMedia)) { - return null; - } - - newMedia.segments = getAllSegments(newMedia); - var mergedPlaylist = mergeOptions$2(oldMedia, newMedia); // always use the new media's preload segment - - if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) { - delete mergedPlaylist.preloadSegment; - } // if the update could overlap existing segment information, merge the two segment lists - - - if (oldMedia.segments) { - if (newMedia.skip) { - newMedia.segments = newMedia.segments || []; // add back in objects for skipped segments, so that we merge - // old properties into the new segments - - for (var i = 0; i < newMedia.skip.skippedSegments; i++) { - newMedia.segments.unshift({ - skipped: true - }); - } - } - - mergedPlaylist.segments = updateSegments(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence); - } // resolve any segment URIs to prevent us from having to do it later - - - mergedPlaylist.segments.forEach(function (segment) { - resolveSegmentUris(segment, mergedPlaylist.resolvedUri); - }); // TODO Right now in the playlists array there are two references to each playlist, one - // that is referenced by index, and one by URI. The index reference may no longer be - // necessary. - - for (var _i = 0; _i < result.playlists.length; _i++) { - if (result.playlists[_i].id === newMedia.id) { - result.playlists[_i] = mergedPlaylist; - } - } - - result.playlists[newMedia.id] = mergedPlaylist; // URI reference added for backwards compatibility - - result.playlists[newMedia.uri] = mergedPlaylist; // update media group playlist references. - - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - if (!properties.playlists) { - return; - } - - for (var _i2 = 0; _i2 < properties.playlists.length; _i2++) { - if (newMedia.id === properties.playlists[_i2].id) { - properties.playlists[_i2] = newMedia; - } - } - }); - return result; -}; -/** - * Calculates the time to wait before refreshing a live playlist - * - * @param {Object} media - * The current media - * @param {boolean} update - * True if there were any updates from the last refresh, false otherwise - * @return {number} - * The time in ms to wait before refreshing the live playlist - */ - -var refreshDelay = function refreshDelay(media, update) { - var lastSegment = media.segments[media.segments.length - 1]; - var lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1]; - var lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration; - - if (update && lastDuration) { - return lastDuration * 1000; - } // if the playlist is unchanged since the last reload or last segment duration - // cannot be determined, try again after half the target duration - - - return (media.partTargetDuration || media.targetDuration || 10) * 500; -}; -/** - * Load a playlist from a remote location - * - * @class PlaylistLoader - * @extends Stream - * @param {string|Object} src url or object of manifest - * @param {boolean} withCredentials the withCredentials xhr option - * @class - */ - -var PlaylistLoader = /*#__PURE__*/function (_EventTarget) { - _inheritsLoose__default['default'](PlaylistLoader, _EventTarget); - - function PlaylistLoader(src, vhs, options) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _EventTarget.call(this) || this; - - if (!src) { - throw new Error('A non-empty playlist URL or object is required'); - } - - _this.logger_ = logger('PlaylistLoader'); - var _options = options, - _options$withCredenti = _options.withCredentials, - withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, - _options$handleManife = _options.handleManifestRedirects, - handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife; - _this.src = src; - _this.vhs_ = vhs; - _this.withCredentials = withCredentials; - _this.handleManifestRedirects = handleManifestRedirects; - var vhsOptions = vhs.options_; - _this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || []; - _this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || []; - _this.experimentalLLHLS = vhsOptions && vhsOptions.experimentalLLHLS || false; // initialize the loader state - - _this.state = 'HAVE_NOTHING'; // live playlist staleness timeout - - _this.handleMediaupdatetimeout_ = _this.handleMediaupdatetimeout_.bind(_assertThisInitialized__default['default'](_this)); - - _this.on('mediaupdatetimeout', _this.handleMediaupdatetimeout_); - - return _this; - } - - var _proto = PlaylistLoader.prototype; - - _proto.handleMediaupdatetimeout_ = function handleMediaupdatetimeout_() { - var _this2 = this; - - if (this.state !== 'HAVE_METADATA') { - // only refresh the media playlist if no other activity is going on - return; - } - - var media = this.media(); - var uri = resolveUrl(this.master.uri, media.uri); - - if (this.experimentalLLHLS) { - uri = addLLHLSQueryDirectives(uri, media); - } - - this.state = 'HAVE_CURRENT_METADATA'; - this.request = this.vhs_.xhr({ - uri: uri, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this2.request) { - return; - } - - if (error) { - return _this2.playlistRequestError(_this2.request, _this2.media(), 'HAVE_METADATA'); - } - - _this2.haveMetadata({ - playlistString: _this2.request.responseText, - url: _this2.media().uri, - id: _this2.media().id - }); - }); - }; - - _proto.playlistRequestError = function playlistRequestError(xhr, playlist, startingState) { - var uri = playlist.uri, - id = playlist.id; // any in-flight request is now finished - - this.request = null; - - if (startingState) { - this.state = startingState; - } - - this.error = { - playlist: this.master.playlists[id], - status: xhr.status, - message: "HLS playlist request error at URL: " + uri + ".", - responseText: xhr.responseText, - code: xhr.status >= 500 ? 4 : 2 - }; - this.trigger('error'); - }; - - _proto.parseManifest_ = function parseManifest_(_ref) { - var _this3 = this; - - var url = _ref.url, - manifestString = _ref.manifestString; - return parseManifest({ - onwarn: function onwarn(_ref2) { - var message = _ref2.message; - return _this3.logger_("m3u8-parser warn for " + url + ": " + message); - }, - oninfo: function oninfo(_ref3) { - var message = _ref3.message; - return _this3.logger_("m3u8-parser info for " + url + ": " + message); - }, - manifestString: manifestString, - customTagParsers: this.customTagParsers, - customTagMappers: this.customTagMappers, - experimentalLLHLS: this.experimentalLLHLS - }); - } - /** - * Update the playlist loader's state in response to a new or updated playlist. - * - * @param {string} [playlistString] - * Playlist string (if playlistObject is not provided) - * @param {Object} [playlistObject] - * Playlist object (if playlistString is not provided) - * @param {string} url - * URL of playlist - * @param {string} id - * ID to use for playlist - */ - ; - - _proto.haveMetadata = function haveMetadata(_ref4) { - var _this4 = this; - - var playlistString = _ref4.playlistString, - playlistObject = _ref4.playlistObject, - url = _ref4.url, - id = _ref4.id; - // any in-flight request is now finished - this.request = null; - this.state = 'HAVE_METADATA'; - var playlist = playlistObject || this.parseManifest_({ - url: url, - manifestString: playlistString - }); - playlist.lastRequest = Date.now(); - setupMediaPlaylist({ - playlist: playlist, - uri: url, - id: id - }); // merge this playlist into the master - - var update = updateMaster$1(this.master, playlist); - this.targetDuration = playlist.partTargetDuration || playlist.targetDuration; - - if (update) { - this.master = update; - this.media_ = this.master.playlists[id]; - } else { - this.trigger('playlistunchanged'); - } // refresh live playlists after a target duration passes - - - if (!this.media().endList) { - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - _this4.trigger('mediaupdatetimeout'); - }, refreshDelay(this.media(), !!update)); - } - - this.trigger('loadedplaylist'); - } - /** - * Abort any outstanding work and clean up. - */ - ; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.stopRequest(); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - window__default['default'].clearTimeout(this.finalRenditionTimeout); - this.off(); - }; - - _proto.stopRequest = function stopRequest() { - if (this.request) { - var oldRequest = this.request; - this.request = null; - oldRequest.onreadystatechange = null; - oldRequest.abort(); - } - } - /** - * When called without any arguments, returns the currently - * active media playlist. When called with a single argument, - * triggers the playlist loader to asynchronously switch to the - * specified media playlist. Calling this method while the - * loader is in the HAVE_NOTHING causes an error to be emitted - * but otherwise has no effect. - * - * @param {Object=} playlist the parsed media playlist - * object to switch to - * @param {boolean=} shouldDelay whether we should delay the request by half target duration - * - * @return {Playlist} the current loaded media - */ - ; - - _proto.media = function media(playlist, shouldDelay) { - var _this5 = this; - - // getter - if (!playlist) { - return this.media_; - } // setter - - - if (this.state === 'HAVE_NOTHING') { - throw new Error('Cannot switch media playlist from ' + this.state); - } // find the playlist object if the target playlist has been - // specified by URI - - - if (typeof playlist === 'string') { - if (!this.master.playlists[playlist]) { - throw new Error('Unknown playlist URI: ' + playlist); - } - - playlist = this.master.playlists[playlist]; - } - - window__default['default'].clearTimeout(this.finalRenditionTimeout); - - if (shouldDelay) { - var delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1000 || 5 * 1000; - this.finalRenditionTimeout = window__default['default'].setTimeout(this.media.bind(this, playlist, false), delay); - return; - } - - var startingState = this.state; - var mediaChange = !this.media_ || playlist.id !== this.media_.id; - var masterPlaylistRef = this.master.playlists[playlist.id]; // switch to fully loaded playlists immediately - - if (masterPlaylistRef && masterPlaylistRef.endList || // handle the case of a playlist object (e.g., if using vhs-json with a resolved - // media playlist or, for the case of demuxed audio, a resolved audio media group) - playlist.endList && playlist.segments.length) { - // abort outstanding playlist requests - if (this.request) { - this.request.onreadystatechange = null; - this.request.abort(); - this.request = null; - } - - this.state = 'HAVE_METADATA'; - this.media_ = playlist; // trigger media change if the active media has been updated - - if (mediaChange) { - this.trigger('mediachanging'); - - if (startingState === 'HAVE_MASTER') { - // The initial playlist was a master manifest, and the first media selected was - // also provided (in the form of a resolved playlist object) as part of the - // source object (rather than just a URL). Therefore, since the media playlist - // doesn't need to be requested, loadedmetadata won't trigger as part of the - // normal flow, and needs an explicit trigger here. - this.trigger('loadedmetadata'); - } else { - this.trigger('mediachange'); - } - } - - return; - } // switching to the active playlist is a no-op - - - if (!mediaChange) { - return; - } - - this.state = 'SWITCHING_MEDIA'; // there is already an outstanding playlist request - - if (this.request) { - if (playlist.resolvedUri === this.request.url) { - // requesting to switch to the same playlist multiple times - // has no effect after the first - return; - } - - this.request.onreadystatechange = null; - this.request.abort(); - this.request = null; - } // request the new playlist - - - if (this.media_) { - this.trigger('mediachanging'); - } - - this.request = this.vhs_.xhr({ - uri: playlist.resolvedUri, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this5.request) { - return; - } - - playlist.lastRequest = Date.now(); - playlist.resolvedUri = resolveManifestRedirect(_this5.handleManifestRedirects, playlist.resolvedUri, req); - - if (error) { - return _this5.playlistRequestError(_this5.request, playlist, startingState); - } - - _this5.haveMetadata({ - playlistString: req.responseText, - url: playlist.uri, - id: playlist.id - }); // fire loadedmetadata the first time a media playlist is loaded - - - if (startingState === 'HAVE_MASTER') { - _this5.trigger('loadedmetadata'); - } else { - _this5.trigger('mediachange'); - } - }); - } - /** - * pause loading of the playlist - */ - ; - - _proto.pause = function pause() { - this.stopRequest(); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - - if (this.state === 'HAVE_NOTHING') { - // If we pause the loader before any data has been retrieved, its as if we never - // started, so reset to an unstarted state. - this.started = false; - } // Need to restore state now that no activity is happening - - - if (this.state === 'SWITCHING_MEDIA') { - // if the loader was in the process of switching media, it should either return to - // HAVE_MASTER or HAVE_METADATA depending on if the loader has loaded a media - // playlist yet. This is determined by the existence of loader.media_ - if (this.media_) { - this.state = 'HAVE_METADATA'; - } else { - this.state = 'HAVE_MASTER'; - } - } else if (this.state === 'HAVE_CURRENT_METADATA') { - this.state = 'HAVE_METADATA'; - } - } - /** - * start loading of the playlist - */ - ; - - _proto.load = function load(shouldDelay) { - var _this6 = this; - - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - var media = this.media(); - - if (shouldDelay) { - var delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1000 : 5 * 1000; - this.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - return _this6.load(); - }, delay); - return; - } - - if (!this.started) { - this.start(); - return; - } - - if (media && !media.endList) { - this.trigger('mediaupdatetimeout'); - } else { - this.trigger('loadedplaylist'); - } - } - /** - * start loading of the playlist - */ - ; - - _proto.start = function start() { - var _this7 = this; - - this.started = true; - - if (typeof this.src === 'object') { - // in the case of an entirely constructed manifest object (meaning there's no actual - // manifest on a server), default the uri to the page's href - if (!this.src.uri) { - this.src.uri = window__default['default'].location.href; - } // resolvedUri is added on internally after the initial request. Since there's no - // request for pre-resolved manifests, add on resolvedUri here. - - - this.src.resolvedUri = this.src.uri; // Since a manifest object was passed in as the source (instead of a URL), the first - // request can be skipped (since the top level of the manifest, at a minimum, is - // already available as a parsed manifest object). However, if the manifest object - // represents a master playlist, some media playlists may need to be resolved before - // the starting segment list is available. Therefore, go directly to setup of the - // initial playlist, and let the normal flow continue from there. - // - // Note that the call to setup is asynchronous, as other sections of VHS may assume - // that the first request is asynchronous. - - setTimeout(function () { - _this7.setupInitialPlaylist(_this7.src); - }, 0); - return; - } // request the specified URL - - - this.request = this.vhs_.xhr({ - uri: this.src, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this7.request) { - return; - } // clear the loader's request reference - - - _this7.request = null; - - if (error) { - _this7.error = { - status: req.status, - message: "HLS playlist request error at URL: " + _this7.src + ".", - responseText: req.responseText, - // MEDIA_ERR_NETWORK - code: 2 - }; - - if (_this7.state === 'HAVE_NOTHING') { - _this7.started = false; - } - - return _this7.trigger('error'); - } - - _this7.src = resolveManifestRedirect(_this7.handleManifestRedirects, _this7.src, req); - - var manifest = _this7.parseManifest_({ - manifestString: req.responseText, - url: _this7.src - }); - - _this7.setupInitialPlaylist(manifest); - }); - }; - - _proto.srcUri = function srcUri() { - return typeof this.src === 'string' ? this.src : this.src.uri; - } - /** - * Given a manifest object that's either a master or media playlist, trigger the proper - * events and set the state of the playlist loader. - * - * If the manifest object represents a master playlist, `loadedplaylist` will be - * triggered to allow listeners to select a playlist. If none is selected, the loader - * will default to the first one in the playlists array. - * - * If the manifest object represents a media playlist, `loadedplaylist` will be - * triggered followed by `loadedmetadata`, as the only available playlist is loaded. - * - * In the case of a media playlist, a master playlist object wrapper with one playlist - * will be created so that all logic can handle playlists in the same fashion (as an - * assumed manifest object schema). - * - * @param {Object} manifest - * The parsed manifest object - */ - ; - - _proto.setupInitialPlaylist = function setupInitialPlaylist(manifest) { - this.state = 'HAVE_MASTER'; - - if (manifest.playlists) { - this.master = manifest; - addPropertiesToMaster(this.master, this.srcUri()); // If the initial master playlist has playlists wtih segments already resolved, - // then resolve URIs in advance, as they are usually done after a playlist request, - // which may not happen if the playlist is resolved. - - manifest.playlists.forEach(function (playlist) { - playlist.segments = getAllSegments(playlist); - playlist.segments.forEach(function (segment) { - resolveSegmentUris(segment, playlist.resolvedUri); - }); - }); - this.trigger('loadedplaylist'); - - if (!this.request) { - // no media playlist was specifically selected so start - // from the first listed one - this.media(this.master.playlists[0]); - } - - return; - } // In order to support media playlists passed in as vhs-json, the case where the uri - // is not provided as part of the manifest should be considered, and an appropriate - // default used. - - - var uri = this.srcUri() || window__default['default'].location.href; - this.master = masterForMedia(manifest, uri); - this.haveMetadata({ - playlistObject: manifest, - url: uri, - id: this.master.playlists[0].id - }); - this.trigger('loadedmetadata'); - }; - - return PlaylistLoader; -}(EventTarget$1); - -/** - * @file xhr.js - */ -var videojsXHR = videojs__default['default'].xhr, - mergeOptions$1 = videojs__default['default'].mergeOptions; - -var callbackWrapper = function callbackWrapper(request, error, response, callback) { - var reqResponse = request.responseType === 'arraybuffer' ? request.response : request.responseText; - - if (!error && reqResponse) { - request.responseTime = Date.now(); - request.roundTripTime = request.responseTime - request.requestTime; - request.bytesReceived = reqResponse.byteLength || reqResponse.length; - - if (!request.bandwidth) { - request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1000); - } - } - - if (response.headers) { - request.responseHeaders = response.headers; - } // videojs.xhr now uses a specific code on the error - // object to signal that a request has timed out instead - // of setting a boolean on the request object - - - if (error && error.code === 'ETIMEDOUT') { - request.timedout = true; - } // videojs.xhr no longer considers status codes outside of 200 and 0 - // (for file uris) to be errors, but the old XHR did, so emulate that - // behavior. Status 206 may be used in response to byterange requests. - - - if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) { - error = new Error('XHR Failed with a response of: ' + (request && (reqResponse || request.responseText))); - } - - callback(error, request); -}; - -var xhrFactory = function xhrFactory() { - var xhr = function XhrFunction(options, callback) { - // Add a default timeout - options = mergeOptions$1({ - timeout: 45e3 - }, options); // Allow an optional user-specified function to modify the option - // object before we construct the xhr request - - var beforeRequest = XhrFunction.beforeRequest || videojs__default['default'].Vhs.xhr.beforeRequest; - - if (beforeRequest && typeof beforeRequest === 'function') { - var newOptions = beforeRequest(options); - - if (newOptions) { - options = newOptions; - } - } // Use the standard videojs.xhr() method unless `videojs.Vhs.xhr` has been overriden - // TODO: switch back to videojs.Vhs.xhr.name === 'XhrFunction' when we drop IE11 - - - var xhrMethod = videojs__default['default'].Vhs.xhr.original === true ? videojsXHR : videojs__default['default'].Vhs.xhr; - var request = xhrMethod(options, function (error, response) { - return callbackWrapper(request, error, response, callback); - }); - var originalAbort = request.abort; - - request.abort = function () { - request.aborted = true; - return originalAbort.apply(request, arguments); - }; - - request.uri = options.uri; - request.requestTime = Date.now(); - return request; - }; - - xhr.original = true; - return xhr; -}; -/** - * Turns segment byterange into a string suitable for use in - * HTTP Range requests - * - * @param {Object} byterange - an object with two values defining the start and end - * of a byte-range - */ - - -var byterangeStr = function byterangeStr(byterange) { - // `byterangeEnd` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - var byterangeEnd = byterange.offset + byterange.length - 1; - var byterangeStart = byterange.offset; - return 'bytes=' + byterangeStart + '-' + byterangeEnd; -}; -/** - * Defines headers for use in the xhr request for a particular segment. - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - */ - - -var segmentXhrHeaders = function segmentXhrHeaders(segment) { - var headers = {}; - - if (segment.byterange) { - headers.Range = byterangeStr(segment.byterange); - } - - return headers; -}; - -/** - * @file bin-utils.js - */ - -/** - * convert a TimeRange to text - * - * @param {TimeRange} range the timerange to use for conversion - * @param {number} i the iterator on the range to convert - * @return {string} the range in string format - */ -var textRange = function textRange(range, i) { - return range.start(i) + '-' + range.end(i); -}; -/** - * format a number as hex string - * - * @param {number} e The number - * @param {number} i the iterator - * @return {string} the hex formatted number as a string - */ - - -var formatHexString = function formatHexString(e, i) { - var value = e.toString(16); - return '00'.substring(0, 2 - value.length) + value + (i % 2 ? ' ' : ''); -}; - -var formatAsciiString = function formatAsciiString(e) { - if (e >= 0x20 && e < 0x7e) { - return String.fromCharCode(e); - } - - return '.'; -}; -/** - * Creates an object for sending to a web worker modifying properties that are TypedArrays - * into a new object with seperated properties for the buffer, byteOffset, and byteLength. - * - * @param {Object} message - * Object of properties and values to send to the web worker - * @return {Object} - * Modified message with TypedArray values expanded - * @function createTransferableMessage - */ - - -var createTransferableMessage = function createTransferableMessage(message) { - var transferable = {}; - Object.keys(message).forEach(function (key) { - var value = message[key]; - - if (ArrayBuffer.isView(value)) { - transferable[key] = { - bytes: value.buffer, - byteOffset: value.byteOffset, - byteLength: value.byteLength - }; - } else { - transferable[key] = value; - } - }); - return transferable; -}; -/** - * Returns a unique string identifier for a media initialization - * segment. - * - * @param {Object} initSegment - * the init segment object. - * - * @return {string} the generated init segment id - */ - -var initSegmentId = function initSegmentId(initSegment) { - var byterange = initSegment.byterange || { - length: Infinity, - offset: 0 - }; - return [byterange.length, byterange.offset, initSegment.resolvedUri].join(','); -}; -/** - * Returns a unique string identifier for a media segment key. - * - * @param {Object} key the encryption key - * @return {string} the unique id for the media segment key. - */ - -var segmentKeyId = function segmentKeyId(key) { - return key.resolvedUri; -}; -/** - * utils to help dump binary data to the console - * - * @param {Array|TypedArray} data - * data to dump to a string - * - * @return {string} the data as a hex string. - */ - -var hexDump = function hexDump(data) { - var bytes = Array.prototype.slice.call(data); - var step = 16; - var result = ''; - var hex; - var ascii; - - for (var j = 0; j < bytes.length / step; j++) { - hex = bytes.slice(j * step, j * step + step).map(formatHexString).join(''); - ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join(''); - result += hex + ' ' + ascii + '\n'; - } - - return result; -}; -var tagDump = function tagDump(_ref) { - var bytes = _ref.bytes; - return hexDump(bytes); -}; -var textRanges = function textRanges(ranges) { - var result = ''; - var i; - - for (i = 0; i < ranges.length; i++) { - result += textRange(ranges, i) + ' '; - } - - return result; -}; - -var utils = /*#__PURE__*/Object.freeze({ - __proto__: null, - createTransferableMessage: createTransferableMessage, - initSegmentId: initSegmentId, - segmentKeyId: segmentKeyId, - hexDump: hexDump, - tagDump: tagDump, - textRanges: textRanges -}); - -// TODO handle fmp4 case where the timing info is accurate and doesn't involve transmux -// 25% was arbitrarily chosen, and may need to be refined over time. - -var SEGMENT_END_FUDGE_PERCENT = 0.25; -/** - * Converts a player time (any time that can be gotten/set from player.currentTime(), - * e.g., any time within player.seekable().start(0) to player.seekable().end(0)) to a - * program time (any time referencing the real world (e.g., EXT-X-PROGRAM-DATE-TIME)). - * - * The containing segment is required as the EXT-X-PROGRAM-DATE-TIME serves as an "anchor - * point" (a point where we have a mapping from program time to player time, with player - * time being the post transmux start of the segment). - * - * For more details, see [this doc](../../docs/program-time-from-player-time.md). - * - * @param {number} playerTime the player time - * @param {Object} segment the segment which contains the player time - * @return {Date} program time - */ - -var playerTimeToProgramTime = function playerTimeToProgramTime(playerTime, segment) { - if (!segment.dateTimeObject) { - // Can't convert without an "anchor point" for the program time (i.e., a time that can - // be used to map the start of a segment with a real world time). - return null; - } - - var transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds; - var transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart; // get the start of the content from before old content is prepended - - var startOfSegment = transmuxedStart + transmuxerPrependedSeconds; - var offsetFromSegmentStart = playerTime - startOfSegment; - return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1000); -}; -var originalSegmentVideoDuration = function originalSegmentVideoDuration(videoTimingInfo) { - return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds; -}; -/** - * Finds a segment that contains the time requested given as an ISO-8601 string. The - * returned segment might be an estimate or an accurate match. - * - * @param {string} programTime The ISO-8601 programTime to find a match for - * @param {Object} playlist A playlist object to search within - */ - -var findSegmentForProgramTime = function findSegmentForProgramTime(programTime, playlist) { - // Assumptions: - // - verifyProgramDateTimeTags has already been run - // - live streams have been started - var dateTimeObject; - - try { - dateTimeObject = new Date(programTime); - } catch (e) { - return null; - } - - if (!playlist || !playlist.segments || playlist.segments.length === 0) { - return null; - } - - var segment = playlist.segments[0]; - - if (dateTimeObject < segment.dateTimeObject) { - // Requested time is before stream start. - return null; - } - - for (var i = 0; i < playlist.segments.length - 1; i++) { - segment = playlist.segments[i]; - var nextSegmentStart = playlist.segments[i + 1].dateTimeObject; - - if (dateTimeObject < nextSegmentStart) { - break; - } - } - - var lastSegment = playlist.segments[playlist.segments.length - 1]; - var lastSegmentStart = lastSegment.dateTimeObject; - var lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT; - var lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1000); - - if (dateTimeObject > lastSegmentEnd) { - // Beyond the end of the stream, or our best guess of the end of the stream. - return null; - } - - if (dateTimeObject > lastSegmentStart) { - segment = lastSegment; - } - - return { - segment: segment, - estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)), - // Although, given that all segments have accurate date time objects, the segment - // selected should be accurate, unless the video has been transmuxed at some point - // (determined by the presence of the videoTimingInfo object), the segment's "player - // time" (the start time in the player) can't be considered accurate. - type: segment.videoTimingInfo ? 'accurate' : 'estimate' - }; -}; -/** - * Finds a segment that contains the given player time(in seconds). - * - * @param {number} time The player time to find a match for - * @param {Object} playlist A playlist object to search within - */ - -var findSegmentForPlayerTime = function findSegmentForPlayerTime(time, playlist) { - // Assumptions: - // - there will always be a segment.duration - // - we can start from zero - // - segments are in time order - if (!playlist || !playlist.segments || playlist.segments.length === 0) { - return null; - } - - var segmentEnd = 0; - var segment; - - for (var i = 0; i < playlist.segments.length; i++) { - segment = playlist.segments[i]; // videoTimingInfo is set after the segment is downloaded and transmuxed, and - // should contain the most accurate values we have for the segment's player times. - // - // Use the accurate transmuxedPresentationEnd value if it is available, otherwise fall - // back to an estimate based on the manifest derived (inaccurate) segment.duration, to - // calculate an end value. - - segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration; - - if (time <= segmentEnd) { - break; - } - } - - var lastSegment = playlist.segments[playlist.segments.length - 1]; - - if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) { - // The time requested is beyond the stream end. - return null; - } - - if (time > segmentEnd) { - // The time is within or beyond the last segment. - // - // Check to see if the time is beyond a reasonable guess of the end of the stream. - if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT) { - // Technically, because the duration value is only an estimate, the time may still - // exist in the last segment, however, there isn't enough information to make even - // a reasonable estimate. - return null; - } - - segment = lastSegment; - } - - return { - segment: segment, - estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration, - // Because videoTimingInfo is only set after transmux, it is the only way to get - // accurate timing values. - type: segment.videoTimingInfo ? 'accurate' : 'estimate' - }; -}; -/** - * Gives the offset of the comparisonTimestamp from the programTime timestamp in seconds. - * If the offset returned is positive, the programTime occurs after the - * comparisonTimestamp. - * If the offset is negative, the programTime occurs before the comparisonTimestamp. - * - * @param {string} comparisonTimeStamp An ISO-8601 timestamp to compare against - * @param {string} programTime The programTime as an ISO-8601 string - * @return {number} offset - */ - -var getOffsetFromTimestamp = function getOffsetFromTimestamp(comparisonTimeStamp, programTime) { - var segmentDateTime; - var programDateTime; - - try { - segmentDateTime = new Date(comparisonTimeStamp); - programDateTime = new Date(programTime); - } catch (e) {// TODO handle error - } - - var segmentTimeEpoch = segmentDateTime.getTime(); - var programTimeEpoch = programDateTime.getTime(); - return (programTimeEpoch - segmentTimeEpoch) / 1000; -}; -/** - * Checks that all segments in this playlist have programDateTime tags. - * - * @param {Object} playlist A playlist object - */ - -var verifyProgramDateTimeTags = function verifyProgramDateTimeTags(playlist) { - if (!playlist.segments || playlist.segments.length === 0) { - return false; - } - - for (var i = 0; i < playlist.segments.length; i++) { - var segment = playlist.segments[i]; - - if (!segment.dateTimeObject) { - return false; - } - } - - return true; -}; -/** - * Returns the programTime of the media given a playlist and a playerTime. - * The playlist must have programDateTime tags for a programDateTime tag to be returned. - * If the segments containing the time requested have not been buffered yet, an estimate - * may be returned to the callback. - * - * @param {Object} args - * @param {Object} args.playlist A playlist object to search within - * @param {number} time A playerTime in seconds - * @param {Function} callback(err, programTime) - * @return {string} err.message A detailed error message - * @return {Object} programTime - * @return {number} programTime.mediaSeconds The streamTime in seconds - * @return {string} programTime.programDateTime The programTime as an ISO-8601 String - */ - -var getProgramTime = function getProgramTime(_ref) { - var playlist = _ref.playlist, - _ref$time = _ref.time, - time = _ref$time === void 0 ? undefined : _ref$time, - callback = _ref.callback; - - if (!callback) { - throw new Error('getProgramTime: callback must be provided'); - } - - if (!playlist || time === undefined) { - return callback({ - message: 'getProgramTime: playlist and time must be provided' - }); - } - - var matchedSegment = findSegmentForPlayerTime(time, playlist); - - if (!matchedSegment) { - return callback({ - message: 'valid programTime was not found' - }); - } - - if (matchedSegment.type === 'estimate') { - return callback({ - message: 'Accurate programTime could not be determined.' + ' Please seek to e.seekTime and try again', - seekTime: matchedSegment.estimatedStart - }); - } - - var programTimeObject = { - mediaSeconds: time - }; - var programTime = playerTimeToProgramTime(time, matchedSegment.segment); - - if (programTime) { - programTimeObject.programDateTime = programTime.toISOString(); - } - - return callback(null, programTimeObject); -}; -/** - * Seeks in the player to a time that matches the given programTime ISO-8601 string. - * - * @param {Object} args - * @param {string} args.programTime A programTime to seek to as an ISO-8601 String - * @param {Object} args.playlist A playlist to look within - * @param {number} args.retryCount The number of times to try for an accurate seek. Default is 2. - * @param {Function} args.seekTo A method to perform a seek - * @param {boolean} args.pauseAfterSeek Whether to end in a paused state after seeking. Default is true. - * @param {Object} args.tech The tech to seek on - * @param {Function} args.callback(err, newTime) A callback to return the new time to - * @return {string} err.message A detailed error message - * @return {number} newTime The exact time that was seeked to in seconds - */ - -var seekToProgramTime = function seekToProgramTime(_ref2) { - var programTime = _ref2.programTime, - playlist = _ref2.playlist, - _ref2$retryCount = _ref2.retryCount, - retryCount = _ref2$retryCount === void 0 ? 2 : _ref2$retryCount, - seekTo = _ref2.seekTo, - _ref2$pauseAfterSeek = _ref2.pauseAfterSeek, - pauseAfterSeek = _ref2$pauseAfterSeek === void 0 ? true : _ref2$pauseAfterSeek, - tech = _ref2.tech, - callback = _ref2.callback; - - if (!callback) { - throw new Error('seekToProgramTime: callback must be provided'); - } - - if (typeof programTime === 'undefined' || !playlist || !seekTo) { - return callback({ - message: 'seekToProgramTime: programTime, seekTo and playlist must be provided' - }); - } - - if (!playlist.endList && !tech.hasStarted_) { - return callback({ - message: 'player must be playing a live stream to start buffering' - }); - } - - if (!verifyProgramDateTimeTags(playlist)) { - return callback({ - message: 'programDateTime tags must be provided in the manifest ' + playlist.resolvedUri - }); - } - - var matchedSegment = findSegmentForProgramTime(programTime, playlist); // no match - - if (!matchedSegment) { - return callback({ - message: programTime + " was not found in the stream" - }); - } - - var segment = matchedSegment.segment; - var mediaOffset = getOffsetFromTimestamp(segment.dateTimeObject, programTime); - - if (matchedSegment.type === 'estimate') { - // we've run out of retries - if (retryCount === 0) { - return callback({ - message: programTime + " is not buffered yet. Try again" - }); - } - - seekTo(matchedSegment.estimatedStart + mediaOffset); - tech.one('seeked', function () { - seekToProgramTime({ - programTime: programTime, - playlist: playlist, - retryCount: retryCount - 1, - seekTo: seekTo, - pauseAfterSeek: pauseAfterSeek, - tech: tech, - callback: callback - }); - }); - return; - } // Since the segment.start value is determined from the buffered end or ending time - // of the prior segment, the seekToTime doesn't need to account for any transmuxer - // modifications. - - - var seekToTime = segment.start + mediaOffset; - - var seekedCallback = function seekedCallback() { - return callback(null, tech.currentTime()); - }; // listen for seeked event - - - tech.one('seeked', seekedCallback); // pause before seeking as video.js will restore this state - - if (pauseAfterSeek) { - tech.pause(); - } - - seekTo(seekToTime); -}; - -// which will only happen if the request is complete. - -var callbackOnCompleted = function callbackOnCompleted(request, cb) { - if (request.readyState === 4) { - return cb(); - } - - return; -}; - -var containerRequest = function containerRequest(uri, xhr, cb) { - var bytes = []; - var id3Offset; - var finished = false; - - var endRequestAndCallback = function endRequestAndCallback(err, req, type, _bytes) { - req.abort(); - finished = true; - return cb(err, req, type, _bytes); - }; - - var progressListener = function progressListener(error, request) { - if (finished) { - return; - } - - if (error) { - return endRequestAndCallback(error, request, '', bytes); - } // grap the new part of content that was just downloaded - - - var newPart = request.responseText.substring(bytes && bytes.byteLength || 0, request.responseText.length); // add that onto bytes - - bytes = byteHelpers.concatTypedArrays(bytes, byteHelpers.stringToBytes(newPart, true)); - id3Offset = id3Offset || id3Helpers.getId3Offset(bytes); // we need at least 10 bytes to determine a type - // or we need at least two bytes after an id3Offset - - if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } - - var type = containers.detectContainerForBytes(bytes); // if this looks like a ts segment but we don't have enough data - // to see the second sync byte, wait until we have enough data - // before declaring it ts - - if (type === 'ts' && bytes.length < 188) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } // this may be an unsynced ts segment - // wait for 376 bytes before detecting no container - - - if (!type && bytes.length < 376) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } - - return endRequestAndCallback(null, request, type, bytes); - }; - - var options = { - uri: uri, - beforeSend: function beforeSend(request) { - // this forces the browser to pass the bytes to us unprocessed - request.overrideMimeType('text/plain; charset=x-user-defined'); - request.addEventListener('progress', function (_ref) { - _ref.total; - _ref.loaded; - return callbackWrapper(request, null, { - statusCode: request.status - }, progressListener); - }); - } - }; - var request = xhr(options, function (error, response) { - return callbackWrapper(request, error, response, progressListener); - }); - return request; -}; - -var EventTarget = videojs__default['default'].EventTarget, - mergeOptions = videojs__default['default'].mergeOptions; - -var dashPlaylistUnchanged = function dashPlaylistUnchanged(a, b) { - if (!isPlaylistUnchanged(a, b)) { - return false; - } // for dash the above check will often return true in scenarios where - // the playlist actually has changed because mediaSequence isn't a - // dash thing, and we often set it to 1. So if the playlists have the same amount - // of segments we return true. - // So for dash we need to make sure that the underlying segments are different. - // if sidx changed then the playlists are different. - - - if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) { - return false; - } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) { - return false; - } // one or the other does not have segments - // there was a change. - - - if (a.segments && !b.segments || !a.segments && b.segments) { - return false; - } // neither has segments nothing changed - - - if (!a.segments && !b.segments) { - return true; - } // check segments themselves - - - for (var i = 0; i < a.segments.length; i++) { - var aSegment = a.segments[i]; - var bSegment = b.segments[i]; // if uris are different between segments there was a change - - if (aSegment.uri !== bSegment.uri) { - return false; - } // neither segment has a byterange, there will be no byterange change. - - - if (!aSegment.byterange && !bSegment.byterange) { - continue; - } - - var aByterange = aSegment.byterange; - var bByterange = bSegment.byterange; // if byterange only exists on one of the segments, there was a change. - - if (aByterange && !bByterange || !aByterange && bByterange) { - return false; - } // if both segments have byterange with different offsets, there was a change. - - - if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) { - return false; - } - } // if everything was the same with segments, this is the same playlist. - - - return true; -}; -/** - * Parses the master XML string and updates playlist URI references. - * - * @param {Object} config - * Object of arguments - * @param {string} config.masterXml - * The mpd XML - * @param {string} config.srcUrl - * The mpd URL - * @param {Date} config.clientOffset - * A time difference between server and client - * @param {Object} config.sidxMapping - * SIDX mappings for moof/mdat URIs and byte ranges - * @return {Object} - * The parsed mpd manifest object - */ - - -var parseMasterXml = function parseMasterXml(_ref) { - var masterXml = _ref.masterXml, - srcUrl = _ref.srcUrl, - clientOffset = _ref.clientOffset, - sidxMapping = _ref.sidxMapping; - var master = mpdParser.parse(masterXml, { - manifestUri: srcUrl, - clientOffset: clientOffset, - sidxMapping: sidxMapping - }); - addPropertiesToMaster(master, srcUrl); - return master; -}; -/** - * Returns a new master manifest that is the result of merging an updated master manifest - * into the original version. - * - * @param {Object} oldMaster - * The old parsed mpd object - * @param {Object} newMaster - * The updated parsed mpd object - * @return {Object} - * A new object representing the original master manifest with the updated media - * playlists merged in - */ - -var updateMaster = function updateMaster(oldMaster, newMaster, sidxMapping) { - var noChanges = true; - var update = mergeOptions(oldMaster, { - // These are top level properties that can be updated - duration: newMaster.duration, - minimumUpdatePeriod: newMaster.minimumUpdatePeriod - }); // First update the playlists in playlist list - - for (var i = 0; i < newMaster.playlists.length; i++) { - var playlist = newMaster.playlists[i]; - - if (playlist.sidx) { - var sidxKey = mpdParser.generateSidxKey(playlist.sidx); // add sidx segments to the playlist if we have all the sidx info already - - if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) { - mpdParser.addSidxSegmentsToPlaylist(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri); - } - } - - var playlistUpdate = updateMaster$1(update, playlist, dashPlaylistUnchanged); - - if (playlistUpdate) { - update = playlistUpdate; - noChanges = false; - } - } // Then update media group playlists - - - forEachMediaGroup(newMaster, function (properties, type, group, label) { - if (properties.playlists && properties.playlists.length) { - var id = properties.playlists[0].id; - - var _playlistUpdate = updateMaster$1(update, properties.playlists[0], dashPlaylistUnchanged); - - if (_playlistUpdate) { - update = _playlistUpdate; // update the playlist reference within media groups - - update.mediaGroups[type][group][label].playlists[0] = update.playlists[id]; - noChanges = false; - } - } - }); - - if (newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) { - noChanges = false; - } - - if (noChanges) { - return null; - } - - return update; -}; // SIDX should be equivalent if the URI and byteranges of the SIDX match. -// If the SIDXs have maps, the two maps should match, -// both `a` and `b` missing SIDXs is considered matching. -// If `a` or `b` but not both have a map, they aren't matching. - -var equivalentSidx = function equivalentSidx(a, b) { - var neitherMap = Boolean(!a.map && !b.map); - var equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length); - return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length; -}; // exported for testing - - -var compareSidxEntry = function compareSidxEntry(playlists, oldSidxMapping) { - var newSidxMapping = {}; - - for (var id in playlists) { - var playlist = playlists[id]; - var currentSidxInfo = playlist.sidx; - - if (currentSidxInfo) { - var key = mpdParser.generateSidxKey(currentSidxInfo); - - if (!oldSidxMapping[key]) { - break; - } - - var savedSidxInfo = oldSidxMapping[key].sidxInfo; - - if (equivalentSidx(savedSidxInfo, currentSidxInfo)) { - newSidxMapping[key] = oldSidxMapping[key]; - } - } - } - - return newSidxMapping; -}; -/** - * A function that filters out changed items as they need to be requested separately. - * - * The method is exported for testing - * - * @param {Object} master the parsed mpd XML returned via mpd-parser - * @param {Object} oldSidxMapping the SIDX to compare against - */ - -var filterChangedSidxMappings = function filterChangedSidxMappings(master, oldSidxMapping) { - var videoSidx = compareSidxEntry(master.playlists, oldSidxMapping); - var mediaGroupSidx = videoSidx; - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - if (properties.playlists && properties.playlists.length) { - var playlists = properties.playlists; - mediaGroupSidx = mergeOptions(mediaGroupSidx, compareSidxEntry(playlists, oldSidxMapping)); - } - }); - return mediaGroupSidx; -}; - -var DashPlaylistLoader = /*#__PURE__*/function (_EventTarget) { - _inheritsLoose__default['default'](DashPlaylistLoader, _EventTarget); - - // DashPlaylistLoader must accept either a src url or a playlist because subsequent - // playlist loader setups from media groups will expect to be able to pass a playlist - // (since there aren't external URLs to media playlists with DASH) - function DashPlaylistLoader(srcUrlOrPlaylist, vhs, options, masterPlaylistLoader) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _EventTarget.call(this) || this; - _this.masterPlaylistLoader_ = masterPlaylistLoader || _assertThisInitialized__default['default'](_this); - - if (!masterPlaylistLoader) { - _this.isMaster_ = true; - } - - var _options = options, - _options$withCredenti = _options.withCredentials, - withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, - _options$handleManife = _options.handleManifestRedirects, - handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife; - _this.vhs_ = vhs; - _this.withCredentials = withCredentials; - _this.handleManifestRedirects = handleManifestRedirects; - - if (!srcUrlOrPlaylist) { - throw new Error('A non-empty playlist URL or object is required'); - } // event naming? - - - _this.on('minimumUpdatePeriod', function () { - _this.refreshXml_(); - }); // live playlist staleness timeout - - - _this.on('mediaupdatetimeout', function () { - _this.refreshMedia_(_this.media().id); - }); - - _this.state = 'HAVE_NOTHING'; - _this.loadedPlaylists_ = {}; - _this.logger_ = logger('DashPlaylistLoader'); // initialize the loader state - // The masterPlaylistLoader will be created with a string - - if (_this.isMaster_) { - _this.masterPlaylistLoader_.srcUrl = srcUrlOrPlaylist; // TODO: reset sidxMapping between period changes - // once multi-period is refactored - - _this.masterPlaylistLoader_.sidxMapping_ = {}; - } else { - _this.childPlaylist_ = srcUrlOrPlaylist; - } - - return _this; - } - - var _proto = DashPlaylistLoader.prototype; - - _proto.requestErrored_ = function requestErrored_(err, request, startingState) { - // disposed - if (!this.request) { - return true; - } // pending request is cleared - - - this.request = null; - - if (err) { - // use the provided error object or create one - // based on the request/response - this.error = typeof err === 'object' && !(err instanceof Error) ? err : { - status: request.status, - message: 'DASH request error at URL: ' + request.uri, - response: request.response, - // MEDIA_ERR_NETWORK - code: 2 - }; - - if (startingState) { - this.state = startingState; - } - - this.trigger('error'); - return true; - } - } - /** - * Verify that the container of the sidx segment can be parsed - * and if it can, get and parse that segment. - */ - ; - - _proto.addSidxSegments_ = function addSidxSegments_(playlist, startingState, cb) { - var _this2 = this; - - var sidxKey = playlist.sidx && mpdParser.generateSidxKey(playlist.sidx); // playlist lacks sidx or sidx segments were added to this playlist already. - - if (!playlist.sidx || !sidxKey || this.masterPlaylistLoader_.sidxMapping_[sidxKey]) { - // keep this function async - this.mediaRequest_ = window__default['default'].setTimeout(function () { - return cb(false); - }, 0); - return; - } // resolve the segment URL relative to the playlist - - - var uri = resolveManifestRedirect(this.handleManifestRedirects, playlist.sidx.resolvedUri); - - var fin = function fin(err, request) { - if (_this2.requestErrored_(err, request, startingState)) { - return; - } - - var sidxMapping = _this2.masterPlaylistLoader_.sidxMapping_; - var sidx; - - try { - sidx = parseSidx__default['default'](byteHelpers.toUint8(request.response).subarray(8)); - } catch (e) { - // sidx parsing failed. - _this2.requestErrored_(e, request, startingState); - - return; - } - - sidxMapping[sidxKey] = { - sidxInfo: playlist.sidx, - sidx: sidx - }; - mpdParser.addSidxSegmentsToPlaylist(playlist, sidx, playlist.sidx.resolvedUri); - return cb(true); - }; - - this.request = containerRequest(uri, this.vhs_.xhr, function (err, request, container, bytes) { - if (err) { - return fin(err, request); - } - - if (!container || container !== 'mp4') { - return fin({ - status: request.status, - message: "Unsupported " + (container || 'unknown') + " container type for sidx segment at URL: " + uri, - // response is just bytes in this case - // but we really don't want to return that. - response: '', - playlist: playlist, - internal: true, - blacklistDuration: Infinity, - // MEDIA_ERR_NETWORK - code: 2 - }, request); - } // if we already downloaded the sidx bytes in the container request, use them - - - var _playlist$sidx$bytera = playlist.sidx.byterange, - offset = _playlist$sidx$bytera.offset, - length = _playlist$sidx$bytera.length; - - if (bytes.length >= length + offset) { - return fin(err, { - response: bytes.subarray(offset, offset + length), - status: request.status, - uri: request.uri - }); - } // otherwise request sidx bytes - - - _this2.request = _this2.vhs_.xhr({ - uri: uri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders({ - byterange: playlist.sidx.byterange - }) - }, fin); - }); - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.stopRequest(); - this.loadedPlaylists_ = {}; - window__default['default'].clearTimeout(this.minimumUpdatePeriodTimeout_); - window__default['default'].clearTimeout(this.mediaRequest_); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - this.mediaRequest_ = null; - this.minimumUpdatePeriodTimeout_ = null; - - if (this.masterPlaylistLoader_.createMupOnMedia_) { - this.off('loadedmetadata', this.masterPlaylistLoader_.createMupOnMedia_); - this.masterPlaylistLoader_.createMupOnMedia_ = null; - } - - this.off(); - }; - - _proto.hasPendingRequest = function hasPendingRequest() { - return this.request || this.mediaRequest_; - }; - - _proto.stopRequest = function stopRequest() { - if (this.request) { - var oldRequest = this.request; - this.request = null; - oldRequest.onreadystatechange = null; - oldRequest.abort(); - } - }; - - _proto.media = function media(playlist) { - var _this3 = this; - - // getter - if (!playlist) { - return this.media_; - } // setter - - - if (this.state === 'HAVE_NOTHING') { - throw new Error('Cannot switch media playlist from ' + this.state); - } - - var startingState = this.state; // find the playlist object if the target playlist has been specified by URI - - if (typeof playlist === 'string') { - if (!this.masterPlaylistLoader_.master.playlists[playlist]) { - throw new Error('Unknown playlist URI: ' + playlist); - } - - playlist = this.masterPlaylistLoader_.master.playlists[playlist]; - } - - var mediaChange = !this.media_ || playlist.id !== this.media_.id; // switch to previously loaded playlists immediately - - if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) { - this.state = 'HAVE_METADATA'; - this.media_ = playlist; // trigger media change if the active media has been updated - - if (mediaChange) { - this.trigger('mediachanging'); - this.trigger('mediachange'); - } - - return; - } // switching to the active playlist is a no-op - - - if (!mediaChange) { - return; - } // switching from an already loaded playlist - - - if (this.media_) { - this.trigger('mediachanging'); - } - - this.addSidxSegments_(playlist, startingState, function (sidxChanged) { - // everything is ready just continue to haveMetadata - _this3.haveMetadata({ - startingState: startingState, - playlist: playlist - }); - }); - }; - - _proto.haveMetadata = function haveMetadata(_ref2) { - var startingState = _ref2.startingState, - playlist = _ref2.playlist; - this.state = 'HAVE_METADATA'; - this.loadedPlaylists_[playlist.id] = playlist; - this.mediaRequest_ = null; // This will trigger loadedplaylist - - this.refreshMedia_(playlist.id); // fire loadedmetadata the first time a media playlist is loaded - // to resolve setup of media groups - - if (startingState === 'HAVE_MASTER') { - this.trigger('loadedmetadata'); - } else { - // trigger media change if the active media has been updated - this.trigger('mediachange'); - } - }; - - _proto.pause = function pause() { - if (this.masterPlaylistLoader_.createMupOnMedia_) { - this.off('loadedmetadata', this.masterPlaylistLoader_.createMupOnMedia_); - this.masterPlaylistLoader_.createMupOnMedia_ = null; - } - - this.stopRequest(); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - - if (this.isMaster_) { - window__default['default'].clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_); - this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_ = null; - } - - if (this.state === 'HAVE_NOTHING') { - // If we pause the loader before any data has been retrieved, its as if we never - // started, so reset to an unstarted state. - this.started = false; - } - }; - - _proto.load = function load(isFinalRendition) { - var _this4 = this; - - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - var media = this.media(); - - if (isFinalRendition) { - var delay = media ? media.targetDuration / 2 * 1000 : 5 * 1000; - this.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - return _this4.load(); - }, delay); - return; - } // because the playlists are internal to the manifest, load should either load the - // main manifest, or do nothing but trigger an event - - - if (!this.started) { - this.start(); - return; - } - - if (media && !media.endList) { - // Check to see if this is the master loader and the MUP was cleared (this happens - // when the loader was paused). `media` should be set at this point since one is always - // set during `start()`. - if (this.isMaster_ && !this.minimumUpdatePeriodTimeout_) { - // Trigger minimumUpdatePeriod to refresh the master manifest - this.trigger('minimumUpdatePeriod'); // Since there was no prior minimumUpdatePeriodTimeout it should be recreated - - this.updateMinimumUpdatePeriodTimeout_(); - } - - this.trigger('mediaupdatetimeout'); - } else { - this.trigger('loadedplaylist'); - } - }; - - _proto.start = function start() { - var _this5 = this; - - this.started = true; // We don't need to request the master manifest again - // Call this asynchronously to match the xhr request behavior below - - if (!this.isMaster_) { - this.mediaRequest_ = window__default['default'].setTimeout(function () { - return _this5.haveMaster_(); - }, 0); - return; - } - - this.requestMaster_(function (req, masterChanged) { - _this5.haveMaster_(); - - if (!_this5.hasPendingRequest() && !_this5.media_) { - _this5.media(_this5.masterPlaylistLoader_.master.playlists[0]); - } - }); - }; - - _proto.requestMaster_ = function requestMaster_(cb) { - var _this6 = this; - - this.request = this.vhs_.xhr({ - uri: this.masterPlaylistLoader_.srcUrl, - withCredentials: this.withCredentials - }, function (error, req) { - if (_this6.requestErrored_(error, req)) { - if (_this6.state === 'HAVE_NOTHING') { - _this6.started = false; - } - - return; - } - - var masterChanged = req.responseText !== _this6.masterPlaylistLoader_.masterXml_; - _this6.masterPlaylistLoader_.masterXml_ = req.responseText; - - if (req.responseHeaders && req.responseHeaders.date) { - _this6.masterLoaded_ = Date.parse(req.responseHeaders.date); - } else { - _this6.masterLoaded_ = Date.now(); - } - - _this6.masterPlaylistLoader_.srcUrl = resolveManifestRedirect(_this6.handleManifestRedirects, _this6.masterPlaylistLoader_.srcUrl, req); - - if (masterChanged) { - _this6.handleMaster_(); - - _this6.syncClientServerClock_(function () { - return cb(req, masterChanged); - }); - - return; - } - - return cb(req, masterChanged); - }); - } - /** - * Parses the master xml for UTCTiming node to sync the client clock to the server - * clock. If the UTCTiming node requires a HEAD or GET request, that request is made. - * - * @param {Function} done - * Function to call when clock sync has completed - */ - ; - - _proto.syncClientServerClock_ = function syncClientServerClock_(done) { - var _this7 = this; - - var utcTiming = mpdParser.parseUTCTiming(this.masterPlaylistLoader_.masterXml_); // No UTCTiming element found in the mpd. Use Date header from mpd request as the - // server clock - - if (utcTiming === null) { - this.masterPlaylistLoader_.clientOffset_ = this.masterLoaded_ - Date.now(); - return done(); - } - - if (utcTiming.method === 'DIRECT') { - this.masterPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now(); - return done(); - } - - this.request = this.vhs_.xhr({ - uri: resolveUrl(this.masterPlaylistLoader_.srcUrl, utcTiming.value), - method: utcTiming.method, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this7.request) { - return; - } - - if (error) { - // sync request failed, fall back to using date header from mpd - // TODO: log warning - _this7.masterPlaylistLoader_.clientOffset_ = _this7.masterLoaded_ - Date.now(); - return done(); - } - - var serverTime; - - if (utcTiming.method === 'HEAD') { - if (!req.responseHeaders || !req.responseHeaders.date) { - // expected date header not preset, fall back to using date header from mpd - // TODO: log warning - serverTime = _this7.masterLoaded_; - } else { - serverTime = Date.parse(req.responseHeaders.date); - } - } else { - serverTime = Date.parse(req.responseText); - } - - _this7.masterPlaylistLoader_.clientOffset_ = serverTime - Date.now(); - done(); - }); - }; - - _proto.haveMaster_ = function haveMaster_() { - this.state = 'HAVE_MASTER'; - - if (this.isMaster_) { - // We have the master playlist at this point, so - // trigger this to allow MasterPlaylistController - // to make an initial playlist selection - this.trigger('loadedplaylist'); - } else if (!this.media_) { - // no media playlist was specifically selected so select - // the one the child playlist loader was created with - this.media(this.childPlaylist_); - } - }; - - _proto.handleMaster_ = function handleMaster_() { - // clear media request - this.mediaRequest_ = null; - var newMaster = parseMasterXml({ - masterXml: this.masterPlaylistLoader_.masterXml_, - srcUrl: this.masterPlaylistLoader_.srcUrl, - clientOffset: this.masterPlaylistLoader_.clientOffset_, - sidxMapping: this.masterPlaylistLoader_.sidxMapping_ - }); - var oldMaster = this.masterPlaylistLoader_.master; // if we have an old master to compare the new master against - - if (oldMaster) { - newMaster = updateMaster(oldMaster, newMaster, this.masterPlaylistLoader_.sidxMapping_); - } // only update master if we have a new master - - - this.masterPlaylistLoader_.master = newMaster ? newMaster : oldMaster; - var location = this.masterPlaylistLoader_.master.locations && this.masterPlaylistLoader_.master.locations[0]; - - if (location && location !== this.masterPlaylistLoader_.srcUrl) { - this.masterPlaylistLoader_.srcUrl = location; - } - - if (!oldMaster || newMaster && newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) { - this.updateMinimumUpdatePeriodTimeout_(); - } - - return Boolean(newMaster); - }; - - _proto.updateMinimumUpdatePeriodTimeout_ = function updateMinimumUpdatePeriodTimeout_() { - var mpl = this.masterPlaylistLoader_; // cancel any pending creation of mup on media - // a new one will be added if needed. - - if (mpl.createMupOnMedia_) { - mpl.off('loadedmetadata', mpl.createMupOnMedia_); - mpl.createMupOnMedia_ = null; - } // clear any pending timeouts - - - if (mpl.minimumUpdatePeriodTimeout_) { - window__default['default'].clearTimeout(mpl.minimumUpdatePeriodTimeout_); - mpl.minimumUpdatePeriodTimeout_ = null; - } - - var mup = mpl.master && mpl.master.minimumUpdatePeriod; // If the minimumUpdatePeriod has a value of 0, that indicates that the current - // MPD has no future validity, so a new one will need to be acquired when new - // media segments are to be made available. Thus, we use the target duration - // in this case - - if (mup === 0) { - if (mpl.media()) { - mup = mpl.media().targetDuration * 1000; - } else { - mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_; - mpl.one('loadedmetadata', mpl.createMupOnMedia_); - } - } // if minimumUpdatePeriod is invalid or <= zero, which - // can happen when a live video becomes VOD. skip timeout - // creation. - - - if (typeof mup !== 'number' || mup <= 0) { - if (mup < 0) { - this.logger_("found invalid minimumUpdatePeriod of " + mup + ", not setting a timeout"); - } - - return; - } - - this.createMUPTimeout_(mup); - }; - - _proto.createMUPTimeout_ = function createMUPTimeout_(mup) { - var mpl = this.masterPlaylistLoader_; - mpl.minimumUpdatePeriodTimeout_ = window__default['default'].setTimeout(function () { - mpl.minimumUpdatePeriodTimeout_ = null; - mpl.trigger('minimumUpdatePeriod'); - mpl.createMUPTimeout_(mup); - }, mup); - } - /** - * Sends request to refresh the master xml and updates the parsed master manifest - */ - ; - - _proto.refreshXml_ = function refreshXml_() { - var _this8 = this; - - this.requestMaster_(function (req, masterChanged) { - if (!masterChanged) { - return; - } - - if (_this8.media_) { - _this8.media_ = _this8.masterPlaylistLoader_.master.playlists[_this8.media_.id]; - } // This will filter out updated sidx info from the mapping - - - _this8.masterPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings(_this8.masterPlaylistLoader_.master, _this8.masterPlaylistLoader_.sidxMapping_); - - _this8.addSidxSegments_(_this8.media(), _this8.state, function (sidxChanged) { - // TODO: do we need to reload the current playlist? - _this8.refreshMedia_(_this8.media().id); - }); - }); - } - /** - * Refreshes the media playlist by re-parsing the master xml and updating playlist - * references. If this is an alternate loader, the updated parsed manifest is retrieved - * from the master loader. - */ - ; - - _proto.refreshMedia_ = function refreshMedia_(mediaID) { - var _this9 = this; - - if (!mediaID) { - throw new Error('refreshMedia_ must take a media id'); - } // for master we have to reparse the master xml - // to re-create segments based on current timing values - // which may change media. We only skip updating master - // if this is the first time this.media_ is being set. - // as master was just parsed in that case. - - - if (this.media_ && this.isMaster_) { - this.handleMaster_(); - } - - var playlists = this.masterPlaylistLoader_.master.playlists; - var mediaChanged = !this.media_ || this.media_ !== playlists[mediaID]; - - if (mediaChanged) { - this.media_ = playlists[mediaID]; - } else { - this.trigger('playlistunchanged'); - } - - if (!this.mediaUpdateTimeout) { - var createMediaUpdateTimeout = function createMediaUpdateTimeout() { - if (_this9.media().endList) { - return; - } - - _this9.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - _this9.trigger('mediaupdatetimeout'); - - createMediaUpdateTimeout(); - }, refreshDelay(_this9.media(), Boolean(mediaChanged))); - }; - - createMediaUpdateTimeout(); - } - - this.trigger('loadedplaylist'); - }; - - return DashPlaylistLoader; -}(EventTarget); - -var Config = { - GOAL_BUFFER_LENGTH: 30, - MAX_GOAL_BUFFER_LENGTH: 60, - BACK_BUFFER_LENGTH: 30, - GOAL_BUFFER_LENGTH_RATE: 1, - // 0.5 MB/s - INITIAL_BANDWIDTH: 4194304, - // A fudge factor to apply to advertised playlist bitrates to account for - // temporary flucations in client bandwidth - BANDWIDTH_VARIANCE: 1.2, - // How much of the buffer must be filled before we consider upswitching - BUFFER_LOW_WATER_LINE: 0, - MAX_BUFFER_LOW_WATER_LINE: 30, - // TODO: Remove this when experimentalBufferBasedABR is removed - EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16, - BUFFER_LOW_WATER_LINE_RATE: 1, - // If the buffer is greater than the high water line, we won't switch down - BUFFER_HIGH_WATER_LINE: 30 -}; - -var stringToArrayBuffer = function stringToArrayBuffer(string) { - var view = new Uint8Array(new ArrayBuffer(string.length)); - - for (var i = 0; i < string.length; i++) { - view[i] = string.charCodeAt(i); - } - - return view.buffer; -}; - -/* global Blob, BlobBuilder, Worker */ -// unify worker interface -var browserWorkerPolyFill = function browserWorkerPolyFill(workerObj) { - // node only supports on/off - workerObj.on = workerObj.addEventListener; - workerObj.off = workerObj.removeEventListener; - return workerObj; -}; - -var createObjectURL = function createObjectURL(str) { - try { - return URL.createObjectURL(new Blob([str], { - type: 'application/javascript' - })); - } catch (e) { - var blob = new BlobBuilder(); - blob.append(str); - return URL.createObjectURL(blob.getBlob()); - } -}; - -var factory = function factory(code) { - return function () { - var objectUrl = createObjectURL(code); - var worker = browserWorkerPolyFill(new Worker(objectUrl)); - worker.objURL = objectUrl; - var terminate = worker.terminate; - worker.on = worker.addEventListener; - worker.off = worker.removeEventListener; - - worker.terminate = function () { - URL.revokeObjectURL(objectUrl); - return terminate.call(this); - }; - - return worker; - }; -}; -var transform = function transform(code) { - return "var browserWorkerPolyFill = " + browserWorkerPolyFill.toString() + ";\n" + 'browserWorkerPolyFill(self);\n' + code; -}; - -var getWorkerString = function getWorkerString(fn) { - return fn.toString().replace(/^function.+?{/, '').slice(0, -1); -}; - -/* rollup-plugin-worker-factory start for worker!/Users/gkatsevman/p/http-streaming-release/src/transmuxer-worker.js */ -var workerCode$1 = transform(getWorkerString(function () { - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ - - var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; - }; - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - - Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; - }; // Default stream functions that are expected to be overridden to perform - // actual work. These are provided by the prototype as a sort of no-op - // implementation so that we don't have to check for their existence in the - // `pipe` function above. - - - Stream.prototype.push = function (data) { - this.trigger('data', data); - }; - - Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); - }; - - Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); - }; - - Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); - }; - - Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); - }; - - var stream = Stream; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ - - var UINT32_MAX = Math.pow(2, 32) - 1; - var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - - (function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); - })(); - - box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; - }; - - dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); - }; - - esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); - }; - - ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); - }; - - hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); - }; - - mdat = function mdat(data) { - return box(types.mdat, data); - }; - - mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); - }; - - mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); - }; - - mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); - }; - - minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); - }; - - moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); - }; - /** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - - moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); - }; - - mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); - }; - - mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); - }; - - sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); - }; - - stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); - }; - - (function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; - })(); - - tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); - }; - /** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - - traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (UINT32_MAX + 1)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (UINT32_MAX + 1)); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun$1(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); - }; - /** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - - trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); - }; - - trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); - }; - - (function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun$1 = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; - })(); - - var mp4Generator = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - // Convert an array of nal units into an array of frames with each frame being - // composed of the nal units that make up that frame - // Also keep track of cummulative data about the frame from the nal units such - // as the frame duration, starting pts, etc. - - var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; - }; // Convert an array of frames into an array of Gop with each Gop being composed - // of the frames that make up that Gop - // Also keep track of cummulative data about the Gop from the frames such as the - // Gop duration, starting pts, etc. - - - var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; - }; - /* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - - var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; - }; - /** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - - var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; - }; - /* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - - var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; - }; // generate the track's sample table from an array of gops - - - var generateSampleTable$1 = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; - }; // generate the track's raw mdat data from an array of gops - - - var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; - }; // generate the track's sample table from a frame - - - var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; - }; // generate the track's raw mdat data from a frame - - - var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; - }; - - var frameUtils = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable$1, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var highPrefix = [33, 16, 5, 32, 164, 27]; - var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - - var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; - }; - - var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); - }; - - var silence; - - var silence_1 = function silence_1() { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]], - 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - - var ONE_SECOND_IN_TS$4 = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS$4; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS$4; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - /** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; - }; // Possibly pad (prefix) the audio track with silence if appending this track - // would lead to the introduction of a gap in the audio buffer - - - var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = silence_1()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; - }; // If the audio segment extends before the earliest allowed dts - // value, remove AAC frames until starts at or after the earliest - // allowed DTS so that we don't end up with a negative baseMedia- - // DecodeTime for the audio track - - - var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); - }; // generate the track's raw mdat data from an array of frames - - - var generateSampleTable = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; - }; // generate the track's sample table from an array of frames - - - var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; - }; - - var audioFrameUtils = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS; - /** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } - }; - /** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - - var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; - }; - /** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS$3; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; - }; - - var trackDecodeInfo = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - // payload type field to indicate how they are to be - // interpreted. CEAS-708 caption content is always transmitted with - // payload type 0x04. - - var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - /** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - - var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; - }; // see ANSI/SCTE 128-1 (2013), section 8.1 - - - var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); - }; // see CEA-708-D, section 4.4 - - - var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; - }; - - var discardEmulationPreventionBytes$1 = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; // exports - - - var captionPacketParser = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes$1, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 - }; // Link To Transport - // ----------------- - - var CaptionStream$1 = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream(); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - }; - - CaptionStream$1.prototype = new stream(); - - CaptionStream$1.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; - }; - - CaptionStream$1.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); - }; - - CaptionStream$1.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); - }; - - CaptionStream$1.prototype.flush = function () { - return this.flushStream('flush'); - }; // Only called if handling partial data - - - CaptionStream$1.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); - }; - - CaptionStream$1.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); - }; // From the CEA-608 spec: - - /* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. - */ - // With that in mind, we ignore any data between an XDS control code and a - // subsequent closed-captioning control code. - - - CaptionStream$1.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); - }; - - CaptionStream$1.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; - }; - - CaptionStream$1.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; - }; - - CaptionStream$1.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; - }; - - CaptionStream$1.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } - }; // ---------------------- - // Session to Application - // ---------------------- - // This hash maps special and extended character codes to their - // proper Unicode equivalent. The first one-byte key is just a - // non-standard character code. The two-byte keys that follow are - // the extended CEA708 character codes, along with the preceding - // 0x10 extended character byte to distinguish these codes from - // non-extended character codes. Every CEA708 character code that - // is not in this object maps directly to a standard unicode - // character code. - // The transparent space and non-breaking transparent space are - // technically not fully supported since there is no code to - // make them transparent, so they have normal non-transparent - // stand-ins. - // The special closed caption (CC) character isn't a standard - // unicode character, so a fairly similar unicode character was - // chosen in it's place. - - - var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - - }; - - var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); - }; - - var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; - }; - - var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); - }; - - Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; - }; - - Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); - }; - - Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; - }; - - Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } - }; - - Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; - }; - - Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; - }; - - Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } - }; - - var Cea708Service = function Cea708Service(serviceNum) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - }; - /** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - - Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } - }; - /** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - - Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; - }; - - var Cea708Stream = function Cea708Stream() { - Cea708Stream.prototype.init.call(this); - var self = this; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; - }; - - Cea708Stream.prototype = new stream(); - /** - * Push current 708 packet, create new 708 packet. - */ - - Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; - }; - /** - * Add pts and both bytes from packet into current 708 packet. - */ - - - Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); - }; - /** - * Parse completed 708 packet into service blocks and push each service block. - */ - - - Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } - }; - /** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - - Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else ; - } - }; - /** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, true); - } - - return i; - }; - /** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - - Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; - }; - /** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - - Cea708Stream.prototype.initService = function (serviceNum, i) { - var self = this; - this.services[serviceNum] = new Cea708Service(serviceNum); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; - }; - /** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.handleText = function (i, service, isExtended) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var extended = isExtended ? 0x1000 : 0x0000; - var char = get708CharFromCode(extended | b); - var win = service.currentWindow; - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; - }; - /** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; - }; - /** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; - }; - /** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; - }; - /** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; - }; - /** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } - }; - /** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; - }; - /** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; - }; - /** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; - }; - /** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; - }; - /** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; - }; - /** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; - }; - /** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; - }; - /** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; - }; - /** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - - Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); - }; // This hash maps non-ASCII, special, and extended character codes to their - // proper Unicode equivalent. The first keys that are only a single byte - // are the non-standard ASCII characters, which simply map the CEA608 byte - // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 - // character codes, but have their MSB bitmasked with 0x03 so that a lookup - // can be performed regardless of the field and data channel on which the - // character code was received. - - - var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - - }; - - var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); - }; // the index of the last row in a CEA-608 display buffer - - - var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of - // getting it through bit logic. - - var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character - // cells. The "bottom" row is the last element in the outer array. - - var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push(''); - } - - return result; - }; - - var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; - }; - - Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the - // display buffer - - Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - // eslint-disable-next-line no-console - console.error('Skipping malformed caption.'); - return ''; - } - }) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content, - stream: this.name_ - }); - } - }; - /** - * Zero out the data, used for startup and on seek - */ - - - Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; - }; - /** - * Sets up control code and related constants for this instance - */ - - - Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; - }; - /** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - - Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - - Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - - Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; - }; - /** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - - Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; - }; - /** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - - Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; - }; - /** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - - Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; - }; - /** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - - Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; - }; - /** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - - Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; - }; // Adds the opening HTML tag for the passed character to the caption text, - // and keeps track of it for later closing - - - Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); - }; // Adds HTML closing tags for current formatting to caption text and - // clears remembered formatting - - - Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); - }; // Mode Implementations - - - Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = ''; - }; - - Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; // exports - - - var captionStream = { - CaptionStream: CaptionStream$1, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var streamTypes = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 - }; - var MAX_TS = 8589934592; - var RO_THRESH = 4294967296; - var TYPE_SHARED = 'shared'; - - var handleRollover$1 = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; - }; - - var TimestampRolloverStream$1 = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover$1(data.dts, referenceDTS); - data.pts = handleRollover$1(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; - }; - - TimestampRolloverStream$1.prototype = new stream(); - var timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream$1, - handleRollover: handleRollover$1 - }; - - var percentEncode$1 = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode$1(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591$1 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode$1(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger$1 = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }, - tagParsers = { - TXXX: function TXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); // do not include the null terminator in the tag value - - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - - tag.data = tag.value; - }, - WXXX: function WXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function PRIV(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591$1(tag.data, 0, i); - break; - } - } - - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } - }, - _MetadataStream; - - _MetadataStream = function MetadataStream(options) { - var settings = { - debug: !!(options && options.debug), - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger$1(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger$1(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseSyncSafeInteger$1(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger$1(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; - }; - - _MetadataStream.prototype = new stream(); - var metadataStream = _MetadataStream; - var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream; // object types - - var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - - var MP2T_PACKET_LENGTH$1 = 188, - // bytes - SYNC_BYTE$1 = 0x47; - /** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - - _TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH$1, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH$1; - endIndex += MP2T_PACKET_LENGTH$1; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; - }; - - _TransportPacketStream.prototype = new stream(); - /** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - - _TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === streamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = streamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = streamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; - }; - - _TransportParseStream.prototype = new stream(); - _TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f - }; - /** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - - _ElementaryStream = function ElementaryStream() { - var self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case streamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case streamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case streamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - this.flushStreams_(); - this.trigger('done'); - }; - }; - - _ElementaryStream.prototype = new stream(); - var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, - MetadataStream: metadataStream - }; - - for (var type in streamTypes) { - if (streamTypes.hasOwnProperty(type)) { - m2ts[type] = streamTypes[type]; - } - } - - var m2ts_1 = m2ts; - var ONE_SECOND_IN_TS$2 = clock.ONE_SECOND_IN_TS; - - var _AdtsStream; - - var ADTS_SAMPLING_FREQUENCIES$1 = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - /* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - - _AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - while (i + 5 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2]; - frameEnd = i + frameLength; // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - - if (buffer.byteLength < frameEnd) { - return; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - frameNum++; // If the buffer is empty, clear it and return - - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } // Remove the finished frame from the buffer and start the process again - - - buffer = buffer.subarray(frameEnd); - } - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; - }; - - _AdtsStream.prototype = new stream(); - var adts = _AdtsStream; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ExpGolomb; - /** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - - ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); - }; - - var expGolomb = ExpGolomb; - - var _H264Stream, _NalByteStream; - - var PROFILES_WITH_OPTIONAL_SPS_DATA; - /** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - - _NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - }; - - _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS - // see Recommendation ITU-T H.264 (4/2013), - // 7.3.2.1.1 Sequence parameter set data syntax - - PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true - }; - /** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - - _H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - expGolombDecoder = new expGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - sarRatio: sarRatio - }; - }; - }; - - _H264Stream.prototype = new stream(); - var h264 = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ - - var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - - var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - - var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); - }; // TODO: use vhs-utils - - - var isLikelyAacData$1 = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; - }; - - var parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }; // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - - - var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }; // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - - - var parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }; - - var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; - }; - - var parseType$2 = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; - }; - - var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; - }; - - var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; - }; - - var utils = { - isLikelyAacData: isLikelyAacData$1, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType$2, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp - }; - - var _AacStream; - /** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - - _AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = utils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = utils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; - }; - - _AacStream.prototype = new stream(); - var aac = _AacStream; // constants - - var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; - var audioProperties = AUDIO_PROPERTIES; - var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; - var videoProperties = VIDEO_PROPERTIES; - var H264Stream = h264.H264Stream; - var isLikelyAacData = utils.isLikelyAacData; - var ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS; // object types - - var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; - /** - * Compare two arrays (even typed) for same-ness - */ - - - var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; - }; - - var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; - }; - /** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - _AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - audioProperties.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4Generator.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS$1 * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; - }; - - _AudioSegmentStream.prototype = new stream(); - /** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - _VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - videoProperties.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4Generator.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4Generator.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; - }; - - _VideoSegmentStream.prototype = new stream(); - /** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - - _CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; - }; - - _CoalesceStream.prototype = new stream(); - - _CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - videoProperties.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - audioProperties.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4Generator.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - }; - - _CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; - }; - /** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - - _Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new aac(); - pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new adts(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts_1.TransportPacketStream(); - pipeline.parseStream = new m2ts_1.TransportParseStream(); - pipeline.elementaryStream = new m2ts_1.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream(); - pipeline.adtsStream = new adts(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts_1.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; - }; - - _Transmuxer.prototype = new stream(); - var transmuxer = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: audioProperties, - VIDEO_PROPERTIES: videoProperties, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var toUnsigned$3 = function toUnsigned(value) { - return value >>> 0; - }; - - var toHexString$1 = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); - }; - - var bin = { - toUnsigned: toUnsigned$3, - toHexString: toHexString$1 - }; - - var parseType$1 = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; - }; - - var parseType_1 = parseType$1; - var toUnsigned$2 = bin.toUnsigned; - - var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType_1(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; - }; - - var findBox_1 = findBox; - var toUnsigned$1 = bin.toUnsigned; - - var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - baseMediaDecodeTime: toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime *= Math.pow(2, 32); - result.baseMediaDecodeTime += toUnsigned$1(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11]); - } - - return result; - }; - - var parseTfdt = tfdt; - - var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; - }; - - var parseSampleFlags_1 = parseSampleFlags; - - var trun = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags_1(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; - }; - - var parseTrun = trun; - - var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; - }; - - var parseTfhd = tfhd; - var discardEmulationPreventionBytes = captionPacketParser.discardEmulationPreventionBytes; - var CaptionStream = captionStream.CaptionStream; - /** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; - }; - /** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - - var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - // eslint-disable-next-line no-console - console.log("We've encountered a nal unit without data. See mux.js#233."); - break; - } - - result.push(seiNal); - break; - } - } - - return result; - }; - /** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - - var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; - }; - /** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - - var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox_1(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox_1(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox_1(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox_1(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox_1(traf, ['trun']); - var samples; - var seiNals; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - seiNals = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = []; - } - - captionNals[trackId] = captionNals[trackId].concat(seiNals); - } - }); - return captionNals; - }; - /** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption - **/ - - - var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var seiNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - seiNals = parseCaptionNals(segment, trackId); - return { - seiNals: seiNals[trackId], - timescale: timescale - }; - }; - /** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - - var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData === null || !parsedData.seiNals) { - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {} - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); - }; - - var captionParser = CaptionParser; - var toUnsigned = bin.toUnsigned; - var toHexString = bin.toHexString; - var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader; - /** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - - timescale = function timescale(init) { - var result = {}, - traks = findBox_1(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox_1(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); - }; - /** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - - startTime = function startTime(timescale, fragment) { - var trafs, baseTimes, result; // we need info from two childrend of each track fragment box - - trafs = findBox_1(fragment, ['moof', 'traf']); // determine the start times for each track - - baseTimes = [].concat.apply([], trafs.map(function (traf) { - return findBox_1(traf, ['tfhd']).map(function (tfhd) { - var id, scale, baseTime; // get the track id from the tfhd - - id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - baseTime = findBox_1(traf, ['tfdt']).map(function (tfdt) { - var version, result; - version = tfdt[0]; - result = toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]); - - if (version === 1) { - result *= Math.pow(2, 32); - result += toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11]); - } - - return result; - })[0]; - baseTime = typeof baseTime === 'number' && !isNaN(baseTime) ? baseTime : Infinity; // convert base time to seconds - - return baseTime / scale; - }); - })); // return the minimum - - result = Math.min.apply(null, baseTimes); - return isFinite(result) ? result : 0; - }; - /** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - - compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox_1(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox_1(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox_1(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox_1(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - return (baseMediaDecodeTime + compositionTimeOffset) / timescale; - }; - /** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - - getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox_1(trak, ['mdia', 'hdlr']); - var tkhds = findBox_1(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType_1(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; - }; - - getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - }; - /** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - - getTracks = function getTracks(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox_1(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox_1(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType_1(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox_1(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType_1(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox_1(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[a-z]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString(codecConfig[10]); // level idc - - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; - }; - - var probe$2 = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox_1, - parseType: parseType_1, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader - }; - - var parsePid = function parsePid(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; - }; - - var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) { - return !!(packet[1] & 0x40); - }; - - var parseAdaptionField = function parseAdaptionField(packet) { - var offset = 0; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[4] + 1; - } - - return offset; - }; - - var parseType = function parseType(packet, pmtPid) { - var pid = parsePid(packet); - - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - - return null; - }; - - var parsePat = function parsePat(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; - }; - - var parsePmt = function parsePmt(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section - - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table - - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type - - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry - // skip past the elementary stream descriptors, if present - - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - - return programMapTable; - }; - - var parsePesType = function parsePesType(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - return 'video'; - - case streamTypes.ADTS_STREAM_TYPE: - return 'audio'; - - case streamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - - default: - return null; - } - }; - - var parsePesTime = function parsePesTime(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - pes = {}; // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - - pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - - return pes; - }; - - var parseNalUnitType = function parseNalUnitType(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - - case 0x06: - return 'sei_rbsp'; - - case 0x07: - return 'seq_parameter_set_rbsp'; - - case 0x08: - return 'pic_parameter_set_rbsp'; - - case 0x09: - return 'access_unit_delimiter_rbsp'; - - default: - return null; - } - }; - - var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; // advance the sync point to a NAL start, if necessary - - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } // drop trailing zeroes - - - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; // parse the final nal - - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; - }; - - var probe$1 = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame - }; - var handleRollover = timestampRolloverStream.handleRollover; - var probe = {}; - probe.ts = probe$1; - probe.aac = utils; - var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS; - var MP2T_PACKET_LENGTH = 188, - // bytes - SYNC_BYTE = 0x47; - /** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ - - var parsePsi_ = function parsePsi_(bytes, pmt) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - - case 'pmt': - var table = probe.ts.parsePmt(packet); - pmt.table = pmt.table || {}; - Object.keys(table).forEach(function (key) { - pmt.table[key] = table[key]; - }); - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ - - - var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed; - var endLoop = false; // Start walking from start of segment to get first audio packet - - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last audio packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ - - - var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed, - frame, - i, - pes; - var endLoop = false; - var currentFrame = { - data: [], - size: 0 - }; // Start walking from start of segment to get first video packet - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn('Failed to extract PTS/DTS from PES at first keyframe. ' + 'This could be an unusual TS segment, or else mux.js did not ' + 'parse your TS segment correctly. If you know your TS ' + 'segments do contain PTS/DTS on keyframes please file a bug ' + 'report! You can try ffprobe to double check for yourself.'); - } - } - - currentFrame.size = 0; - } - } - - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last video packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ - - - var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - - segmentInfo.audio.forEach(function (info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - - segmentInfo.video.forEach(function (info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds - - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } - }; - /** - * inspects the aac data stream for start and end time information - */ - - - var inspectAac_ = function inspectAac_(bytes) { - var endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - - byteIndex += frameSize; - break; - - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - - audioCount++; - byteIndex += frameSize; - break; - - default: - byteIndex++; - break; - } - - if (endLoop) { - return null; - } - } - - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - var result = { - audio: [{ - type: 'audio', - dts: timestamp, - pts: timestamp - }, { - type: 'audio', - dts: timestamp + audioCount * 1024 * audioTimescale, - pts: timestamp + audioCount * 1024 * audioTimescale - }] - }; - return result; - }; - /** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ - - - var inspectTs_ = function inspectTs_(bytes) { - var pmt = { - pid: null, - table: null - }; - var result = {}; - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - - if (result.video.length === 0) { - delete result.video; - } - - break; - - case streamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - - if (result.audio.length === 0) { - delete result.audio; - } - - break; - } - } - } - - return result; - }; - /** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ - - - var inspect = function inspect(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || !result.audio && !result.video) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - return result; - }; - - var tsInspector = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ - }; - /* global self */ - - /** - * Re-emits transmuxer events by converting them into messages to the - * world outside the worker. - * - * @param {Object} transmuxer the transmuxer to wire events on - * @private - */ - - var wireTransmuxerEvents = function wireTransmuxerEvents(self, transmuxer) { - transmuxer.on('data', function (segment) { - // transfer ownership of the underlying ArrayBuffer - // instead of doing a copy to save memory - // ArrayBuffers are transferable but generic TypedArrays are not - // @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects) - var initArray = segment.initSegment; - segment.initSegment = { - data: initArray.buffer, - byteOffset: initArray.byteOffset, - byteLength: initArray.byteLength - }; - var typedArray = segment.data; - segment.data = typedArray.buffer; - self.postMessage({ - action: 'data', - segment: segment, - byteOffset: typedArray.byteOffset, - byteLength: typedArray.byteLength - }, [segment.data]); - }); - transmuxer.on('done', function (data) { - self.postMessage({ - action: 'done' - }); - }); - transmuxer.on('gopInfo', function (gopInfo) { - self.postMessage({ - action: 'gopInfo', - gopInfo: gopInfo - }); - }); - transmuxer.on('videoSegmentTimingInfo', function (timingInfo) { - var videoSegmentTimingInfo = { - start: { - decode: clock.videoTsToSeconds(timingInfo.start.dts), - presentation: clock.videoTsToSeconds(timingInfo.start.pts) - }, - end: { - decode: clock.videoTsToSeconds(timingInfo.end.dts), - presentation: clock.videoTsToSeconds(timingInfo.end.pts) - }, - baseMediaDecodeTime: clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime) - }; - - if (timingInfo.prependedContentDuration) { - videoSegmentTimingInfo.prependedContentDuration = clock.videoTsToSeconds(timingInfo.prependedContentDuration); - } - - self.postMessage({ - action: 'videoSegmentTimingInfo', - videoSegmentTimingInfo: videoSegmentTimingInfo - }); - }); - transmuxer.on('audioSegmentTimingInfo', function (timingInfo) { - // Note that all times for [audio/video]SegmentTimingInfo events are in video clock - var audioSegmentTimingInfo = { - start: { - decode: clock.videoTsToSeconds(timingInfo.start.dts), - presentation: clock.videoTsToSeconds(timingInfo.start.pts) - }, - end: { - decode: clock.videoTsToSeconds(timingInfo.end.dts), - presentation: clock.videoTsToSeconds(timingInfo.end.pts) - }, - baseMediaDecodeTime: clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime) - }; - - if (timingInfo.prependedContentDuration) { - audioSegmentTimingInfo.prependedContentDuration = clock.videoTsToSeconds(timingInfo.prependedContentDuration); - } - - self.postMessage({ - action: 'audioSegmentTimingInfo', - audioSegmentTimingInfo: audioSegmentTimingInfo - }); - }); - transmuxer.on('id3Frame', function (id3Frame) { - self.postMessage({ - action: 'id3Frame', - id3Frame: id3Frame - }); - }); - transmuxer.on('caption', function (caption) { - self.postMessage({ - action: 'caption', - caption: caption - }); - }); - transmuxer.on('trackinfo', function (trackInfo) { - self.postMessage({ - action: 'trackinfo', - trackInfo: trackInfo - }); - }); - transmuxer.on('audioTimingInfo', function (audioTimingInfo) { - // convert to video TS since we prioritize video time over audio - self.postMessage({ - action: 'audioTimingInfo', - audioTimingInfo: { - start: clock.videoTsToSeconds(audioTimingInfo.start), - end: clock.videoTsToSeconds(audioTimingInfo.end) - } - }); - }); - transmuxer.on('videoTimingInfo', function (videoTimingInfo) { - self.postMessage({ - action: 'videoTimingInfo', - videoTimingInfo: { - start: clock.videoTsToSeconds(videoTimingInfo.start), - end: clock.videoTsToSeconds(videoTimingInfo.end) - } - }); - }); - }; - /** - * All incoming messages route through this hash. If no function exists - * to handle an incoming message, then we ignore the message. - * - * @class MessageHandlers - * @param {Object} options the options to initialize with - */ - - - var MessageHandlers = /*#__PURE__*/function () { - function MessageHandlers(self, options) { - this.options = options || {}; - this.self = self; - this.init(); - } - /** - * initialize our web worker and wire all the events. - */ - - - var _proto = MessageHandlers.prototype; - - _proto.init = function init() { - if (this.transmuxer) { - this.transmuxer.dispose(); - } - - this.transmuxer = new transmuxer.Transmuxer(this.options); - wireTransmuxerEvents(this.self, this.transmuxer); - }; - - _proto.pushMp4Captions = function pushMp4Captions(data) { - if (!this.captionParser) { - this.captionParser = new captionParser(); - this.captionParser.init(); - } - - var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength); - var parsed = this.captionParser.parse(segment, data.trackIds, data.timescales); - this.self.postMessage({ - action: 'mp4Captions', - captions: parsed && parsed.captions || [], - data: segment.buffer - }, [segment.buffer]); - }; - - _proto.probeMp4StartTime = function probeMp4StartTime(_ref) { - var timescales = _ref.timescales, - data = _ref.data; - var startTime = probe$2.startTime(timescales, data); - this.self.postMessage({ - action: 'probeMp4StartTime', - startTime: startTime, - data: data - }, [data.buffer]); - }; - - _proto.probeMp4Tracks = function probeMp4Tracks(_ref2) { - var data = _ref2.data; - var tracks = probe$2.tracks(data); - this.self.postMessage({ - action: 'probeMp4Tracks', - tracks: tracks, - data: data - }, [data.buffer]); - } - /** - * Probe an mpeg2-ts segment to determine the start time of the segment in it's - * internal "media time," as well as whether it contains video and/or audio. - * - * @private - * @param {Uint8Array} bytes - segment bytes - * @param {number} baseStartTime - * Relative reference timestamp used when adjusting frame timestamps for rollover. - * This value should be in seconds, as it's converted to a 90khz clock within the - * function body. - * @return {Object} The start time of the current segment in "media time" as well as - * whether it contains video and/or audio - */ - ; - - _proto.probeTs = function probeTs(_ref3) { - var data = _ref3.data, - baseStartTime = _ref3.baseStartTime; - var tsStartTime = typeof baseStartTime === 'number' && !isNaN(baseStartTime) ? baseStartTime * clock.ONE_SECOND_IN_TS : void 0; - var timeInfo = tsInspector.inspect(data, tsStartTime); - var result = null; - - if (timeInfo) { - result = { - // each type's time info comes back as an array of 2 times, start and end - hasVideo: timeInfo.video && timeInfo.video.length === 2 || false, - hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false - }; - - if (result.hasVideo) { - result.videoStart = timeInfo.video[0].ptsTime; - } - - if (result.hasAudio) { - result.audioStart = timeInfo.audio[0].ptsTime; - } - } - - this.self.postMessage({ - action: 'probeTs', - result: result, - data: data - }, [data.buffer]); - }; - - _proto.clearAllMp4Captions = function clearAllMp4Captions() { - if (this.captionParser) { - this.captionParser.clearAllCaptions(); - } - }; - - _proto.clearParsedMp4Captions = function clearParsedMp4Captions() { - if (this.captionParser) { - this.captionParser.clearParsedCaptions(); - } - } - /** - * Adds data (a ts segment) to the start of the transmuxer pipeline for - * processing. - * - * @param {ArrayBuffer} data data to push into the muxer - */ - ; - - _proto.push = function push(data) { - // Cast array buffer to correct type for transmuxer - var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength); - this.transmuxer.push(segment); - } - /** - * Recreate the transmuxer so that the next segment added via `push` - * start with a fresh transmuxer. - */ - ; - - _proto.reset = function reset() { - this.transmuxer.reset(); - } - /** - * Set the value that will be used as the `baseMediaDecodeTime` time for the - * next segment pushed in. Subsequent segments will have their `baseMediaDecodeTime` - * set relative to the first based on the PTS values. - * - * @param {Object} data used to set the timestamp offset in the muxer - */ - ; - - _proto.setTimestampOffset = function setTimestampOffset(data) { - var timestampOffset = data.timestampOffset || 0; - this.transmuxer.setBaseMediaDecodeTime(Math.round(clock.secondsToVideoTs(timestampOffset))); - }; - - _proto.setAudioAppendStart = function setAudioAppendStart(data) { - this.transmuxer.setAudioAppendStart(Math.ceil(clock.secondsToVideoTs(data.appendStart))); - }; - - _proto.setRemux = function setRemux(data) { - this.transmuxer.setRemux(data.remux); - } - /** - * Forces the pipeline to finish processing the last segment and emit it's - * results. - * - * @param {Object} data event data, not really used - */ - ; - - _proto.flush = function flush(data) { - this.transmuxer.flush(); // transmuxed done action is fired after both audio/video pipelines are flushed - - self.postMessage({ - action: 'done', - type: 'transmuxed' - }); - }; - - _proto.endTimeline = function endTimeline() { - this.transmuxer.endTimeline(); // transmuxed endedtimeline action is fired after both audio/video pipelines end their - // timelines - - self.postMessage({ - action: 'endedtimeline', - type: 'transmuxed' - }); - }; - - _proto.alignGopsWith = function alignGopsWith(data) { - this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice()); - }; - - return MessageHandlers; - }(); - /** - * Our web worker interface so that things can talk to mux.js - * that will be running in a web worker. the scope is passed to this by - * webworkify. - * - * @param {Object} self the scope for the web worker - */ - - - self.onmessage = function (event) { - if (event.data.action === 'init' && event.data.options) { - this.messageHandlers = new MessageHandlers(self, event.data.options); - return; - } - - if (!this.messageHandlers) { - this.messageHandlers = new MessageHandlers(self); - } - - if (event.data && event.data.action && event.data.action !== 'init') { - if (this.messageHandlers[event.data.action]) { - this.messageHandlers[event.data.action](event.data); - } - } - }; -})); -var TransmuxWorker = factory(workerCode$1); -/* rollup-plugin-worker-factory end for worker!/Users/gkatsevman/p/http-streaming-release/src/transmuxer-worker.js */ - -var handleData_ = function handleData_(event, transmuxedData, callback) { - var _event$data$segment = event.data.segment, - type = _event$data$segment.type, - initSegment = _event$data$segment.initSegment, - captions = _event$data$segment.captions, - captionStreams = _event$data$segment.captionStreams, - metadata = _event$data$segment.metadata, - videoFrameDtsTime = _event$data$segment.videoFrameDtsTime, - videoFramePtsTime = _event$data$segment.videoFramePtsTime; - transmuxedData.buffer.push({ - captions: captions, - captionStreams: captionStreams, - metadata: metadata - }); - var boxes = event.data.segment.boxes || { - data: event.data.segment.data - }; - var result = { - type: type, - // cast ArrayBuffer to TypedArray - data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength), - initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength) - }; - - if (typeof videoFrameDtsTime !== 'undefined') { - result.videoFrameDtsTime = videoFrameDtsTime; - } - - if (typeof videoFramePtsTime !== 'undefined') { - result.videoFramePtsTime = videoFramePtsTime; - } - - callback(result); -}; -var handleDone_ = function handleDone_(_ref) { - var transmuxedData = _ref.transmuxedData, - callback = _ref.callback; - // Previously we only returned data on data events, - // not on done events. Clear out the buffer to keep that consistent. - transmuxedData.buffer = []; // all buffers should have been flushed from the muxer, so start processing anything we - // have received - - callback(transmuxedData); -}; -var handleGopInfo_ = function handleGopInfo_(event, transmuxedData) { - transmuxedData.gopInfo = event.data.gopInfo; -}; -var processTransmux = function processTransmux(options) { - var transmuxer = options.transmuxer, - bytes = options.bytes, - audioAppendStart = options.audioAppendStart, - gopsToAlignWith = options.gopsToAlignWith, - remux = options.remux, - onData = options.onData, - onTrackInfo = options.onTrackInfo, - onAudioTimingInfo = options.onAudioTimingInfo, - onVideoTimingInfo = options.onVideoTimingInfo, - onVideoSegmentTimingInfo = options.onVideoSegmentTimingInfo, - onAudioSegmentTimingInfo = options.onAudioSegmentTimingInfo, - onId3 = options.onId3, - onCaptions = options.onCaptions, - onDone = options.onDone, - onEndedTimeline = options.onEndedTimeline, - isEndOfTimeline = options.isEndOfTimeline; - var transmuxedData = { - buffer: [] - }; - var waitForEndedTimelineEvent = isEndOfTimeline; - - var handleMessage = function handleMessage(event) { - if (transmuxer.currentTransmux !== options) { - // disposed - return; - } - - if (event.data.action === 'data') { - handleData_(event, transmuxedData, onData); - } - - if (event.data.action === 'trackinfo') { - onTrackInfo(event.data.trackInfo); - } - - if (event.data.action === 'gopInfo') { - handleGopInfo_(event, transmuxedData); - } - - if (event.data.action === 'audioTimingInfo') { - onAudioTimingInfo(event.data.audioTimingInfo); - } - - if (event.data.action === 'videoTimingInfo') { - onVideoTimingInfo(event.data.videoTimingInfo); - } - - if (event.data.action === 'videoSegmentTimingInfo') { - onVideoSegmentTimingInfo(event.data.videoSegmentTimingInfo); - } - - if (event.data.action === 'audioSegmentTimingInfo') { - onAudioSegmentTimingInfo(event.data.audioSegmentTimingInfo); - } - - if (event.data.action === 'id3Frame') { - onId3([event.data.id3Frame], event.data.id3Frame.dispatchType); - } - - if (event.data.action === 'caption') { - onCaptions(event.data.caption); - } - - if (event.data.action === 'endedtimeline') { - waitForEndedTimelineEvent = false; - onEndedTimeline(); - } // wait for the transmuxed event since we may have audio and video - - - if (event.data.type !== 'transmuxed') { - return; - } // If the "endedtimeline" event has not yet fired, and this segment represents the end - // of a timeline, that means there may still be data events before the segment - // processing can be considerred complete. In that case, the final event should be - // an "endedtimeline" event with the type "transmuxed." - - - if (waitForEndedTimelineEvent) { - return; - } - - transmuxer.onmessage = null; - handleDone_({ - transmuxedData: transmuxedData, - callback: onDone - }); - /* eslint-disable no-use-before-define */ - - dequeue(transmuxer); - /* eslint-enable */ - }; - - transmuxer.onmessage = handleMessage; - - if (audioAppendStart) { - transmuxer.postMessage({ - action: 'setAudioAppendStart', - appendStart: audioAppendStart - }); - } // allow empty arrays to be passed to clear out GOPs - - - if (Array.isArray(gopsToAlignWith)) { - transmuxer.postMessage({ - action: 'alignGopsWith', - gopsToAlignWith: gopsToAlignWith - }); - } - - if (typeof remux !== 'undefined') { - transmuxer.postMessage({ - action: 'setRemux', - remux: remux - }); - } - - if (bytes.byteLength) { - var buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer; - var byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset; - transmuxer.postMessage({ - action: 'push', - // Send the typed-array of data as an ArrayBuffer so that - // it can be sent as a "Transferable" and avoid the costly - // memory copy - data: buffer, - // To recreate the original typed-array, we need information - // about what portion of the ArrayBuffer it was a view into - byteOffset: byteOffset, - byteLength: bytes.byteLength - }, [buffer]); - } - - if (isEndOfTimeline) { - transmuxer.postMessage({ - action: 'endTimeline' - }); - } // even if we didn't push any bytes, we have to make sure we flush in case we reached - // the end of the segment - - - transmuxer.postMessage({ - action: 'flush' - }); -}; -var dequeue = function dequeue(transmuxer) { - transmuxer.currentTransmux = null; - - if (transmuxer.transmuxQueue.length) { - transmuxer.currentTransmux = transmuxer.transmuxQueue.shift(); - - if (typeof transmuxer.currentTransmux === 'function') { - transmuxer.currentTransmux(); - } else { - processTransmux(transmuxer.currentTransmux); - } - } -}; -var processAction = function processAction(transmuxer, action) { - transmuxer.postMessage({ - action: action - }); - dequeue(transmuxer); -}; -var enqueueAction = function enqueueAction(action, transmuxer) { - if (!transmuxer.currentTransmux) { - transmuxer.currentTransmux = action; - processAction(transmuxer, action); - return; - } - - transmuxer.transmuxQueue.push(processAction.bind(null, transmuxer, action)); -}; -var reset = function reset(transmuxer) { - enqueueAction('reset', transmuxer); -}; -var endTimeline = function endTimeline(transmuxer) { - enqueueAction('endTimeline', transmuxer); -}; -var transmux = function transmux(options) { - if (!options.transmuxer.currentTransmux) { - options.transmuxer.currentTransmux = options; - processTransmux(options); - return; - } - - options.transmuxer.transmuxQueue.push(options); -}; -var createTransmuxer = function createTransmuxer(options) { - var transmuxer = new TransmuxWorker(); - transmuxer.currentTransmux = null; - transmuxer.transmuxQueue = []; - var term = transmuxer.terminate; - - transmuxer.terminate = function () { - transmuxer.currentTransmux = null; - transmuxer.transmuxQueue.length = 0; - return term.call(transmuxer); - }; - - transmuxer.postMessage({ - action: 'init', - options: options - }); - return transmuxer; -}; -var segmentTransmuxer = { - reset: reset, - endTimeline: endTimeline, - transmux: transmux, - createTransmuxer: createTransmuxer -}; - -var workerCallback = function workerCallback(options) { - var transmuxer = options.transmuxer; - var endAction = options.endAction || options.action; - var callback = options.callback; - - var message = _extends__default['default']({}, options, { - endAction: null, - transmuxer: null, - callback: null - }); - - var listenForEndEvent = function listenForEndEvent(event) { - if (event.data.action !== endAction) { - return; - } - - transmuxer.removeEventListener('message', listenForEndEvent); // transfer ownership of bytes back to us. - - if (event.data.data) { - event.data.data = new Uint8Array(event.data.data, options.byteOffset || 0, options.byteLength || event.data.data.byteLength); - - if (options.data) { - options.data = event.data.data; - } - } - - callback(event.data); - }; - - transmuxer.addEventListener('message', listenForEndEvent); - - if (options.data) { - var isArrayBuffer = options.data instanceof ArrayBuffer; - message.byteOffset = isArrayBuffer ? 0 : options.data.byteOffset; - message.byteLength = options.data.byteLength; - var transfers = [isArrayBuffer ? options.data : options.data.buffer]; - transmuxer.postMessage(message, transfers); - } else { - transmuxer.postMessage(message); - } -}; - -var REQUEST_ERRORS = { - FAILURE: 2, - TIMEOUT: -101, - ABORTED: -102 -}; -/** - * Abort all requests - * - * @param {Object} activeXhrs - an object that tracks all XHR requests - */ - -var abortAll = function abortAll(activeXhrs) { - activeXhrs.forEach(function (xhr) { - xhr.abort(); - }); -}; -/** - * Gather important bandwidth stats once a request has completed - * - * @param {Object} request - the XHR request from which to gather stats - */ - - -var getRequestStats = function getRequestStats(request) { - return { - bandwidth: request.bandwidth, - bytesReceived: request.bytesReceived || 0, - roundTripTime: request.roundTripTime || 0 - }; -}; -/** - * If possible gather bandwidth stats as a request is in - * progress - * - * @param {Event} progressEvent - an event object from an XHR's progress event - */ - - -var getProgressStats = function getProgressStats(progressEvent) { - var request = progressEvent.target; - var roundTripTime = Date.now() - request.requestTime; - var stats = { - bandwidth: Infinity, - bytesReceived: 0, - roundTripTime: roundTripTime || 0 - }; - stats.bytesReceived = progressEvent.loaded; // This can result in Infinity if stats.roundTripTime is 0 but that is ok - // because we should only use bandwidth stats on progress to determine when - // abort a request early due to insufficient bandwidth - - stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1000); - return stats; -}; -/** - * Handle all error conditions in one place and return an object - * with all the information - * - * @param {Error|null} error - if non-null signals an error occured with the XHR - * @param {Object} request - the XHR request that possibly generated the error - */ - - -var handleErrors = function handleErrors(error, request) { - if (request.timedout) { - return { - status: request.status, - message: 'HLS request timed-out at URL: ' + request.uri, - code: REQUEST_ERRORS.TIMEOUT, - xhr: request - }; - } - - if (request.aborted) { - return { - status: request.status, - message: 'HLS request aborted at URL: ' + request.uri, - code: REQUEST_ERRORS.ABORTED, - xhr: request - }; - } - - if (error) { - return { - status: request.status, - message: 'HLS request errored at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }; - } - - if (request.responseType === 'arraybuffer' && request.response.byteLength === 0) { - return { - status: request.status, - message: 'Empty HLS response at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }; - } - - return null; -}; -/** - * Handle responses for key data and convert the key data to the correct format - * for the decryption step later - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Array} objects - objects to add the key bytes to. - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - -var handleKeyResponse = function handleKeyResponse(segment, objects, finishProcessingFn) { - return function (error, request) { - var response = request.response; - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - if (response.byteLength !== 16) { - return finishProcessingFn({ - status: request.status, - message: 'Invalid HLS key at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }, segment); - } - - var view = new DataView(response); - var bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]); - - for (var i = 0; i < objects.length; i++) { - objects[i].bytes = bytes; - } - - return finishProcessingFn(null, segment); - }; -}; - -var parseInitSegment = function parseInitSegment(segment, _callback) { - var type = containers.detectContainerForBytes(segment.map.bytes); // TODO: We should also handle ts init segments here, but we - // only know how to parse mp4 init segments at the moment - - if (type !== 'mp4') { - var uri = segment.map.resolvedUri || segment.map.uri; - return _callback({ - internal: true, - message: "Found unsupported " + (type || 'unknown') + " container for initialization segment at URL: " + uri, - code: REQUEST_ERRORS.FAILURE - }); - } - - workerCallback({ - action: 'probeMp4Tracks', - data: segment.map.bytes, - transmuxer: segment.transmuxer, - callback: function callback(_ref) { - var tracks = _ref.tracks, - data = _ref.data; - // transfer bytes back to us - segment.map.bytes = data; - tracks.forEach(function (track) { - segment.map.tracks = segment.map.tracks || {}; // only support one track of each type for now - - if (segment.map.tracks[track.type]) { - return; - } - - segment.map.tracks[track.type] = track; - - if (typeof track.id === 'number' && track.timescale) { - segment.map.timescales = segment.map.timescales || {}; - segment.map.timescales[track.id] = track.timescale; - } - }); - return _callback(null); - } - }); -}; -/** - * Handle init-segment responses - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - -var handleInitSegmentResponse = function handleInitSegmentResponse(_ref2) { - var segment = _ref2.segment, - finishProcessingFn = _ref2.finishProcessingFn; - return function (error, request) { - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - var bytes = new Uint8Array(request.response); // init segment is encypted, we will have to wait - // until the key request is done to decrypt. - - if (segment.map.key) { - segment.map.encryptedBytes = bytes; - return finishProcessingFn(null, segment); - } - - segment.map.bytes = bytes; - parseInitSegment(segment, function (parseError) { - if (parseError) { - parseError.xhr = request; - parseError.status = request.status; - return finishProcessingFn(parseError, segment); - } - - finishProcessingFn(null, segment); - }); - }; -}; -/** - * Response handler for segment-requests being sure to set the correct - * property depending on whether the segment is encryped or not - * Also records and keeps track of stats that are used for ABR purposes - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - -var handleSegmentResponse = function handleSegmentResponse(_ref3) { - var segment = _ref3.segment, - finishProcessingFn = _ref3.finishProcessingFn, - responseType = _ref3.responseType; - return function (error, request) { - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - var newBytes = // although responseText "should" exist, this guard serves to prevent an error being - // thrown for two primary cases: - // 1. the mime type override stops working, or is not implemented for a specific - // browser - // 2. when using mock XHR libraries like sinon that do not allow the override behavior - responseType === 'arraybuffer' || !request.responseText ? request.response : stringToArrayBuffer(request.responseText.substring(segment.lastReachedChar || 0)); - segment.stats = getRequestStats(request); - - if (segment.key) { - segment.encryptedBytes = new Uint8Array(newBytes); - } else { - segment.bytes = new Uint8Array(newBytes); - } - - return finishProcessingFn(null, segment); - }; -}; - -var transmuxAndNotify = function transmuxAndNotify(_ref4) { - var segment = _ref4.segment, - bytes = _ref4.bytes, - trackInfoFn = _ref4.trackInfoFn, - timingInfoFn = _ref4.timingInfoFn, - videoSegmentTimingInfoFn = _ref4.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref4.audioSegmentTimingInfoFn, - id3Fn = _ref4.id3Fn, - captionsFn = _ref4.captionsFn, - isEndOfTimeline = _ref4.isEndOfTimeline, - endedTimelineFn = _ref4.endedTimelineFn, - dataFn = _ref4.dataFn, - doneFn = _ref4.doneFn; - var fmp4Tracks = segment.map && segment.map.tracks || {}; - var isMuxed = Boolean(fmp4Tracks.audio && fmp4Tracks.video); // Keep references to each function so we can null them out after we're done with them. - // One reason for this is that in the case of full segments, we want to trust start - // times from the probe, rather than the transmuxer. - - var audioStartFn = timingInfoFn.bind(null, segment, 'audio', 'start'); - var audioEndFn = timingInfoFn.bind(null, segment, 'audio', 'end'); - var videoStartFn = timingInfoFn.bind(null, segment, 'video', 'start'); - var videoEndFn = timingInfoFn.bind(null, segment, 'video', 'end'); - - var finish = function finish() { - return transmux({ - bytes: bytes, - transmuxer: segment.transmuxer, - audioAppendStart: segment.audioAppendStart, - gopsToAlignWith: segment.gopsToAlignWith, - remux: isMuxed, - onData: function onData(result) { - result.type = result.type === 'combined' ? 'video' : result.type; - dataFn(segment, result); - }, - onTrackInfo: function onTrackInfo(trackInfo) { - if (trackInfoFn) { - if (isMuxed) { - trackInfo.isMuxed = true; - } - - trackInfoFn(segment, trackInfo); - } - }, - onAudioTimingInfo: function onAudioTimingInfo(audioTimingInfo) { - // we only want the first start value we encounter - if (audioStartFn && typeof audioTimingInfo.start !== 'undefined') { - audioStartFn(audioTimingInfo.start); - audioStartFn = null; - } // we want to continually update the end time - - - if (audioEndFn && typeof audioTimingInfo.end !== 'undefined') { - audioEndFn(audioTimingInfo.end); - } - }, - onVideoTimingInfo: function onVideoTimingInfo(videoTimingInfo) { - // we only want the first start value we encounter - if (videoStartFn && typeof videoTimingInfo.start !== 'undefined') { - videoStartFn(videoTimingInfo.start); - videoStartFn = null; - } // we want to continually update the end time - - - if (videoEndFn && typeof videoTimingInfo.end !== 'undefined') { - videoEndFn(videoTimingInfo.end); - } - }, - onVideoSegmentTimingInfo: function onVideoSegmentTimingInfo(videoSegmentTimingInfo) { - videoSegmentTimingInfoFn(videoSegmentTimingInfo); - }, - onAudioSegmentTimingInfo: function onAudioSegmentTimingInfo(audioSegmentTimingInfo) { - audioSegmentTimingInfoFn(audioSegmentTimingInfo); - }, - onId3: function onId3(id3Frames, dispatchType) { - id3Fn(segment, id3Frames, dispatchType); - }, - onCaptions: function onCaptions(captions) { - captionsFn(segment, [captions]); - }, - isEndOfTimeline: isEndOfTimeline, - onEndedTimeline: function onEndedTimeline() { - endedTimelineFn(); - }, - onDone: function onDone(result) { - if (!doneFn) { - return; - } - - result.type = result.type === 'combined' ? 'video' : result.type; - doneFn(null, segment, result); - } - }); - }; // In the transmuxer, we don't yet have the ability to extract a "proper" start time. - // Meaning cached frame data may corrupt our notion of where this segment - // really starts. To get around this, probe for the info needed. - - - workerCallback({ - action: 'probeTs', - transmuxer: segment.transmuxer, - data: bytes, - baseStartTime: segment.baseStartTime, - callback: function callback(data) { - segment.bytes = bytes = data.data; - var probeResult = data.result; - - if (probeResult) { - trackInfoFn(segment, { - hasAudio: probeResult.hasAudio, - hasVideo: probeResult.hasVideo, - isMuxed: isMuxed - }); - trackInfoFn = null; - - if (probeResult.hasAudio && !isMuxed) { - audioStartFn(probeResult.audioStart); - } - - if (probeResult.hasVideo) { - videoStartFn(probeResult.videoStart); - } - - audioStartFn = null; - videoStartFn = null; - } - - finish(); - } - }); -}; - -var handleSegmentBytes = function handleSegmentBytes(_ref5) { - var segment = _ref5.segment, - bytes = _ref5.bytes, - trackInfoFn = _ref5.trackInfoFn, - timingInfoFn = _ref5.timingInfoFn, - videoSegmentTimingInfoFn = _ref5.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref5.audioSegmentTimingInfoFn, - id3Fn = _ref5.id3Fn, - captionsFn = _ref5.captionsFn, - isEndOfTimeline = _ref5.isEndOfTimeline, - endedTimelineFn = _ref5.endedTimelineFn, - dataFn = _ref5.dataFn, - doneFn = _ref5.doneFn; - var bytesAsUint8Array = new Uint8Array(bytes); // TODO: - // We should have a handler that fetches the number of bytes required - // to check if something is fmp4. This will allow us to save bandwidth - // because we can only blacklist a playlist and abort requests - // by codec after trackinfo triggers. - - if (containers.isLikelyFmp4MediaSegment(bytesAsUint8Array)) { - segment.isFmp4 = true; - var tracks = segment.map.tracks; - var trackInfo = { - isFmp4: true, - hasVideo: !!tracks.video, - hasAudio: !!tracks.audio - }; // if we have a audio track, with a codec that is not set to - // encrypted audio - - if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== 'enca') { - trackInfo.audioCodec = tracks.audio.codec; - } // if we have a video track, with a codec that is not set to - // encrypted video - - - if (tracks.video && tracks.video.codec && tracks.video.codec !== 'encv') { - trackInfo.videoCodec = tracks.video.codec; - } - - if (tracks.video && tracks.audio) { - trackInfo.isMuxed = true; - } // since we don't support appending fmp4 data on progress, we know we have the full - // segment here - - - trackInfoFn(segment, trackInfo); // The probe doesn't provide the segment end time, so only callback with the start - // time. The end time can be roughly calculated by the receiver using the duration. - // - // Note that the start time returned by the probe reflects the baseMediaDecodeTime, as - // that is the true start of the segment (where the playback engine should begin - // decoding). - - var finishLoading = function finishLoading(captions) { - // if the track still has audio at this point it is only possible - // for it to be audio only. See `tracks.video && tracks.audio` if statement - // above. - // we make sure to use segment.bytes here as that - dataFn(segment, { - data: bytesAsUint8Array, - type: trackInfo.hasAudio && !trackInfo.isMuxed ? 'audio' : 'video' - }); - - if (captions && captions.length) { - captionsFn(segment, captions); - } - - doneFn(null, segment, {}); - }; - - workerCallback({ - action: 'probeMp4StartTime', - timescales: segment.map.timescales, - data: bytesAsUint8Array, - transmuxer: segment.transmuxer, - callback: function callback(_ref6) { - var data = _ref6.data, - startTime = _ref6.startTime; - // transfer bytes back to us - bytes = data.buffer; - segment.bytes = bytesAsUint8Array = data; - - if (trackInfo.hasAudio && !trackInfo.isMuxed) { - timingInfoFn(segment, 'audio', 'start', startTime); - } - - if (trackInfo.hasVideo) { - timingInfoFn(segment, 'video', 'start', startTime); - } // Run through the CaptionParser in case there are captions. - // Initialize CaptionParser if it hasn't been yet - - - if (!tracks.video || !data.byteLength || !segment.transmuxer) { - finishLoading(); - return; - } - - workerCallback({ - action: 'pushMp4Captions', - endAction: 'mp4Captions', - transmuxer: segment.transmuxer, - data: bytesAsUint8Array, - timescales: segment.map.timescales, - trackIds: [tracks.video.id], - callback: function callback(message) { - // transfer bytes back to us - bytes = message.data.buffer; - segment.bytes = bytesAsUint8Array = message.data; - finishLoading(message.captions); - } - }); - } - }); - return; - } // VTT or other segments that don't need processing - - - if (!segment.transmuxer) { - doneFn(null, segment, {}); - return; - } - - if (typeof segment.container === 'undefined') { - segment.container = containers.detectContainerForBytes(bytesAsUint8Array); - } - - if (segment.container !== 'ts' && segment.container !== 'aac') { - trackInfoFn(segment, { - hasAudio: false, - hasVideo: false - }); - doneFn(null, segment, {}); - return; - } // ts or aac - - - transmuxAndNotify({ - segment: segment, - bytes: bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); -}; - -var decrypt = function decrypt(_ref7, callback) { - var id = _ref7.id, - key = _ref7.key, - encryptedBytes = _ref7.encryptedBytes, - decryptionWorker = _ref7.decryptionWorker; - - var decryptionHandler = function decryptionHandler(event) { - if (event.data.source === id) { - decryptionWorker.removeEventListener('message', decryptionHandler); - var decrypted = event.data.decrypted; - callback(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength)); - } - }; - - decryptionWorker.addEventListener('message', decryptionHandler); - var keyBytes; - - if (key.bytes.slice) { - keyBytes = key.bytes.slice(); - } else { - keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes)); - } // incrementally decrypt the bytes - - - decryptionWorker.postMessage(createTransferableMessage({ - source: id, - encrypted: encryptedBytes, - key: keyBytes, - iv: key.iv - }), [encryptedBytes.buffer, keyBytes.buffer]); -}; -/** - * Decrypt the segment via the decryption web worker - * - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption - * routines - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Function} doneFn - a callback that is executed after decryption has completed - */ - - -var decryptSegment = function decryptSegment(_ref8) { - var decryptionWorker = _ref8.decryptionWorker, - segment = _ref8.segment, - trackInfoFn = _ref8.trackInfoFn, - timingInfoFn = _ref8.timingInfoFn, - videoSegmentTimingInfoFn = _ref8.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref8.audioSegmentTimingInfoFn, - id3Fn = _ref8.id3Fn, - captionsFn = _ref8.captionsFn, - isEndOfTimeline = _ref8.isEndOfTimeline, - endedTimelineFn = _ref8.endedTimelineFn, - dataFn = _ref8.dataFn, - doneFn = _ref8.doneFn; - decrypt({ - id: segment.requestId, - key: segment.key, - encryptedBytes: segment.encryptedBytes, - decryptionWorker: decryptionWorker - }, function (decryptedBytes) { - segment.bytes = decryptedBytes; - handleSegmentBytes({ - segment: segment, - bytes: segment.bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - }); -}; -/** - * This function waits for all XHRs to finish (with either success or failure) - * before continueing processing via it's callback. The function gathers errors - * from each request into a single errors array so that the error status for - * each request can be examined later. - * - * @param {Object} activeXhrs - an object that tracks all XHR requests - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption - * routines - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} id3Fn - a callback that receives ID3 metadata - * @param {Function} captionsFn - a callback that receives captions - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Function} doneFn - a callback that is executed after all resources have been - * downloaded and any decryption completed - */ - - -var waitForCompletion = function waitForCompletion(_ref9) { - var activeXhrs = _ref9.activeXhrs, - decryptionWorker = _ref9.decryptionWorker, - trackInfoFn = _ref9.trackInfoFn, - timingInfoFn = _ref9.timingInfoFn, - videoSegmentTimingInfoFn = _ref9.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref9.audioSegmentTimingInfoFn, - id3Fn = _ref9.id3Fn, - captionsFn = _ref9.captionsFn, - isEndOfTimeline = _ref9.isEndOfTimeline, - endedTimelineFn = _ref9.endedTimelineFn, - dataFn = _ref9.dataFn, - doneFn = _ref9.doneFn; - var count = 0; - var didError = false; - return function (error, segment) { - if (didError) { - return; - } - - if (error) { - didError = true; // If there are errors, we have to abort any outstanding requests - - abortAll(activeXhrs); // Even though the requests above are aborted, and in theory we could wait until we - // handle the aborted events from those requests, there are some cases where we may - // never get an aborted event. For instance, if the network connection is lost and - // there were two requests, the first may have triggered an error immediately, while - // the second request remains unsent. In that case, the aborted algorithm will not - // trigger an abort: see https://xhr.spec.whatwg.org/#the-abort()-method - // - // We also can't rely on the ready state of the XHR, since the request that - // triggered the connection error may also show as a ready state of 0 (unsent). - // Therefore, we have to finish this group of requests immediately after the first - // seen error. - - return doneFn(error, segment); - } - - count += 1; - - if (count === activeXhrs.length) { - var segmentFinish = function segmentFinish() { - if (segment.encryptedBytes) { - return decryptSegment({ - decryptionWorker: decryptionWorker, - segment: segment, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - } // Otherwise, everything is ready just continue - - - handleSegmentBytes({ - segment: segment, - bytes: segment.bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - }; // Keep track of when *all* of the requests have completed - - - segment.endOfAllRequests = Date.now(); - - if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) { - return decrypt({ - decryptionWorker: decryptionWorker, - // add -init to the "id" to differentiate between segment - // and init segment decryption, just in case they happen - // at the same time at some point in the future. - id: segment.requestId + '-init', - encryptedBytes: segment.map.encryptedBytes, - key: segment.map.key - }, function (decryptedBytes) { - segment.map.bytes = decryptedBytes; - parseInitSegment(segment, function (parseError) { - if (parseError) { - abortAll(activeXhrs); - return doneFn(parseError, segment); - } - - segmentFinish(); - }); - }); - } - - segmentFinish(); - } - }; -}; -/** - * Calls the abort callback if any request within the batch was aborted. Will only call - * the callback once per batch of requests, even if multiple were aborted. - * - * @param {Object} loadendState - state to check to see if the abort function was called - * @param {Function} abortFn - callback to call for abort - */ - - -var handleLoadEnd = function handleLoadEnd(_ref10) { - var loadendState = _ref10.loadendState, - abortFn = _ref10.abortFn; - return function (event) { - var request = event.target; - - if (request.aborted && abortFn && !loadendState.calledAbortFn) { - abortFn(); - loadendState.calledAbortFn = true; - } - }; -}; -/** - * Simple progress event callback handler that gathers some stats before - * executing a provided callback with the `segment` object - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} progressFn - a callback that is executed each time a progress event - * is received - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Event} event - the progress event object from XMLHttpRequest - */ - - -var handleProgress = function handleProgress(_ref11) { - var segment = _ref11.segment, - progressFn = _ref11.progressFn; - _ref11.trackInfoFn; - _ref11.timingInfoFn; - _ref11.videoSegmentTimingInfoFn; - _ref11.audioSegmentTimingInfoFn; - _ref11.id3Fn; - _ref11.captionsFn; - _ref11.isEndOfTimeline; - _ref11.endedTimelineFn; - _ref11.dataFn; - return function (event) { - var request = event.target; - - if (request.aborted) { - return; - } - - segment.stats = videojs__default['default'].mergeOptions(segment.stats, getProgressStats(event)); // record the time that we receive the first byte of data - - if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) { - segment.stats.firstBytesReceivedAt = Date.now(); - } - - return progressFn(event, segment); - }; -}; -/** - * Load all resources and does any processing necessary for a media-segment - * - * Features: - * decrypts the media-segment if it has a key uri and an iv - * aborts *all* requests if *any* one request fails - * - * The segment object, at minimum, has the following format: - * { - * resolvedUri: String, - * [transmuxer]: Object, - * [byterange]: { - * offset: Number, - * length: Number - * }, - * [key]: { - * resolvedUri: String - * [byterange]: { - * offset: Number, - * length: Number - * }, - * iv: { - * bytes: Uint32Array - * } - * }, - * [map]: { - * resolvedUri: String, - * [byterange]: { - * offset: Number, - * length: Number - * }, - * [bytes]: Uint8Array - * } - * } - * ...where [name] denotes optional properties - * - * @param {Function} xhr - an instance of the xhr wrapper in xhr.js - * @param {Object} xhrOptions - the base options to provide to all xhr requests - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 - * decryption routines - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} abortFn - a callback called (only once) if any piece of a request was - * aborted - * @param {Function} progressFn - a callback that receives progress events from the main - * segment's xhr request - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} id3Fn - a callback that receives ID3 metadata - * @param {Function} captionsFn - a callback that receives captions - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that receives data from the main segment's xhr - * request, transmuxed if needed - * @param {Function} doneFn - a callback that is executed only once all requests have - * succeeded or failed - * @return {Function} a function that, when invoked, immediately aborts all - * outstanding requests - */ - - -var mediaSegmentRequest = function mediaSegmentRequest(_ref12) { - var xhr = _ref12.xhr, - xhrOptions = _ref12.xhrOptions, - decryptionWorker = _ref12.decryptionWorker, - segment = _ref12.segment, - abortFn = _ref12.abortFn, - progressFn = _ref12.progressFn, - trackInfoFn = _ref12.trackInfoFn, - timingInfoFn = _ref12.timingInfoFn, - videoSegmentTimingInfoFn = _ref12.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref12.audioSegmentTimingInfoFn, - id3Fn = _ref12.id3Fn, - captionsFn = _ref12.captionsFn, - isEndOfTimeline = _ref12.isEndOfTimeline, - endedTimelineFn = _ref12.endedTimelineFn, - dataFn = _ref12.dataFn, - doneFn = _ref12.doneFn; - var activeXhrs = []; - var finishProcessingFn = waitForCompletion({ - activeXhrs: activeXhrs, - decryptionWorker: decryptionWorker, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); // optionally, request the decryption key - - if (segment.key && !segment.key.bytes) { - var objects = [segment.key]; - - if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) { - objects.push(segment.map.key); - } - - var keyRequestOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.key.resolvedUri, - responseType: 'arraybuffer' - }); - var keyRequestCallback = handleKeyResponse(segment, objects, finishProcessingFn); - var keyXhr = xhr(keyRequestOptions, keyRequestCallback); - activeXhrs.push(keyXhr); - } // optionally, request the associated media init segment - - - if (segment.map && !segment.map.bytes) { - var differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri); - - if (differentMapKey) { - var mapKeyRequestOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.map.key.resolvedUri, - responseType: 'arraybuffer' - }); - var mapKeyRequestCallback = handleKeyResponse(segment, [segment.map.key], finishProcessingFn); - var mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback); - activeXhrs.push(mapKeyXhr); - } - - var initSegmentOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.map.resolvedUri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment.map) - }); - var initSegmentRequestCallback = handleInitSegmentResponse({ - segment: segment, - finishProcessingFn: finishProcessingFn - }); - var initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback); - activeXhrs.push(initSegmentXhr); - } - - var segmentRequestOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.part && segment.part.resolvedUri || segment.resolvedUri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment) - }); - var segmentRequestCallback = handleSegmentResponse({ - segment: segment, - finishProcessingFn: finishProcessingFn, - responseType: segmentRequestOptions.responseType - }); - var segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback); - segmentXhr.addEventListener('progress', handleProgress({ - segment: segment, - progressFn: progressFn, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn - })); - activeXhrs.push(segmentXhr); // since all parts of the request must be considered, but should not make callbacks - // multiple times, provide a shared state object - - var loadendState = {}; - activeXhrs.forEach(function (activeXhr) { - activeXhr.addEventListener('loadend', handleLoadEnd({ - loadendState: loadendState, - abortFn: abortFn - })); - }); - return function () { - return abortAll(activeXhrs); - }; -}; - -/** - * @file - codecs.js - Handles tasks regarding codec strings such as translating them to - * codec strings, or translating codec strings into objects that can be examined. - */ -var logFn$1 = logger('CodecUtils'); -/** - * Returns a set of codec strings parsed from the playlist or the default - * codec strings if no codecs were specified in the playlist - * - * @param {Playlist} media the current media playlist - * @return {Object} an object with the video and audio codecs - */ - -var getCodecs = function getCodecs(media) { - // if the codecs were explicitly specified, use them instead of the - // defaults - var mediaAttributes = media.attributes || {}; - - if (mediaAttributes.CODECS) { - return codecs_js.parseCodecs(mediaAttributes.CODECS); - } -}; - -var isMaat = function isMaat(master, media) { - var mediaAttributes = media.attributes || {}; - return master && master.mediaGroups && master.mediaGroups.AUDIO && mediaAttributes.AUDIO && master.mediaGroups.AUDIO[mediaAttributes.AUDIO]; -}; -var isMuxed = function isMuxed(master, media) { - if (!isMaat(master, media)) { - return true; - } - - var mediaAttributes = media.attributes || {}; - var audioGroup = master.mediaGroups.AUDIO[mediaAttributes.AUDIO]; - - for (var groupId in audioGroup) { - // If an audio group has a URI (the case for HLS, as HLS will use external playlists), - // or there are listed playlists (the case for DASH, as the manifest will have already - // provided all of the details necessary to generate the audio playlist, as opposed to - // HLS' externally requested playlists), then the content is demuxed. - if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) { - return true; - } - } - - return false; -}; -var unwrapCodecList = function unwrapCodecList(codecList) { - var codecs = {}; - codecList.forEach(function (_ref) { - var mediaType = _ref.mediaType, - type = _ref.type, - details = _ref.details; - codecs[mediaType] = codecs[mediaType] || []; - codecs[mediaType].push(codecs_js.translateLegacyCodec("" + type + details)); - }); - Object.keys(codecs).forEach(function (mediaType) { - if (codecs[mediaType].length > 1) { - logFn$1("multiple " + mediaType + " codecs found as attributes: " + codecs[mediaType].join(', ') + ". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."); - codecs[mediaType] = null; - return; - } - - codecs[mediaType] = codecs[mediaType][0]; - }); - return codecs; -}; -var codecCount = function codecCount(codecObj) { - var count = 0; - - if (codecObj.audio) { - count++; - } - - if (codecObj.video) { - count++; - } - - return count; -}; -/** - * Calculates the codec strings for a working configuration of - * SourceBuffers to play variant streams in a master playlist. If - * there is no possible working configuration, an empty object will be - * returned. - * - * @param master {Object} the m3u8 object for the master playlist - * @param media {Object} the m3u8 object for the variant playlist - * @return {Object} the codec strings. - * - * @private - */ - -var codecsForPlaylist = function codecsForPlaylist(master, media) { - var mediaAttributes = media.attributes || {}; - var codecInfo = unwrapCodecList(getCodecs(media) || []); // HLS with multiple-audio tracks must always get an audio codec. - // Put another way, there is no way to have a video-only multiple-audio HLS! - - if (isMaat(master, media) && !codecInfo.audio) { - if (!isMuxed(master, media)) { - // It is possible for codecs to be specified on the audio media group playlist but - // not on the rendition playlist. This is mostly the case for DASH, where audio and - // video are always separate (and separately specified). - var defaultCodecs = unwrapCodecList(codecs_js.codecsFromDefault(master, mediaAttributes.AUDIO) || []); - - if (defaultCodecs.audio) { - codecInfo.audio = defaultCodecs.audio; - } - } - } - - return codecInfo; -}; - -var logFn = logger('PlaylistSelector'); - -var representationToString = function representationToString(representation) { - if (!representation || !representation.playlist) { - return; - } - - var playlist = representation.playlist; - return JSON.stringify({ - id: playlist.id, - bandwidth: representation.bandwidth, - width: representation.width, - height: representation.height, - codecs: playlist.attributes && playlist.attributes.CODECS || '' - }); -}; // Utilities - -/** - * Returns the CSS value for the specified property on an element - * using `getComputedStyle`. Firefox has a long-standing issue where - * getComputedStyle() may return null when running in an iframe with - * `display: none`. - * - * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - * @param {HTMLElement} el the htmlelement to work on - * @param {string} the proprety to get the style for - */ - - -var safeGetComputedStyle = function safeGetComputedStyle(el, property) { - if (!el) { - return ''; - } - - var result = window__default['default'].getComputedStyle(el); - - if (!result) { - return ''; - } - - return result[property]; -}; -/** - * Resuable stable sort function - * - * @param {Playlists} array - * @param {Function} sortFn Different comparators - * @function stableSort - */ - - -var stableSort = function stableSort(array, sortFn) { - var newArray = array.slice(); - array.sort(function (left, right) { - var cmp = sortFn(left, right); - - if (cmp === 0) { - return newArray.indexOf(left) - newArray.indexOf(right); - } - - return cmp; - }); -}; -/** - * A comparator function to sort two playlist object by bandwidth. - * - * @param {Object} left a media playlist object - * @param {Object} right a media playlist object - * @return {number} Greater than zero if the bandwidth attribute of - * left is greater than the corresponding attribute of right. Less - * than zero if the bandwidth of right is greater than left and - * exactly zero if the two are equal. - */ - - -var comparePlaylistBandwidth = function comparePlaylistBandwidth(left, right) { - var leftBandwidth; - var rightBandwidth; - - if (left.attributes.BANDWIDTH) { - leftBandwidth = left.attributes.BANDWIDTH; - } - - leftBandwidth = leftBandwidth || window__default['default'].Number.MAX_VALUE; - - if (right.attributes.BANDWIDTH) { - rightBandwidth = right.attributes.BANDWIDTH; - } - - rightBandwidth = rightBandwidth || window__default['default'].Number.MAX_VALUE; - return leftBandwidth - rightBandwidth; -}; -/** - * A comparator function to sort two playlist object by resolution (width). - * - * @param {Object} left a media playlist object - * @param {Object} right a media playlist object - * @return {number} Greater than zero if the resolution.width attribute of - * left is greater than the corresponding attribute of right. Less - * than zero if the resolution.width of right is greater than left and - * exactly zero if the two are equal. - */ - -var comparePlaylistResolution = function comparePlaylistResolution(left, right) { - var leftWidth; - var rightWidth; - - if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) { - leftWidth = left.attributes.RESOLUTION.width; - } - - leftWidth = leftWidth || window__default['default'].Number.MAX_VALUE; - - if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) { - rightWidth = right.attributes.RESOLUTION.width; - } - - rightWidth = rightWidth || window__default['default'].Number.MAX_VALUE; // NOTE - Fallback to bandwidth sort as appropriate in cases where multiple renditions - // have the same media dimensions/ resolution - - if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) { - return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH; - } - - return leftWidth - rightWidth; -}; -/** - * Chooses the appropriate media playlist based on bandwidth and player size - * - * @param {Object} master - * Object representation of the master manifest - * @param {number} playerBandwidth - * Current calculated bandwidth of the player - * @param {number} playerWidth - * Current width of the player element (should account for the device pixel ratio) - * @param {number} playerHeight - * Current height of the player element (should account for the device pixel ratio) - * @param {boolean} limitRenditionByPlayerDimensions - * True if the player width and height should be used during the selection, false otherwise - * @param {Object} masterPlaylistController - * the current masterPlaylistController object - * @return {Playlist} the highest bitrate playlist less than the - * currently detected bandwidth, accounting for some amount of - * bandwidth variance - */ - -var simpleSelector = function simpleSelector(master, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, masterPlaylistController) { - // If we end up getting called before `master` is available, exit early - if (!master) { - return; - } - - var options = { - bandwidth: playerBandwidth, - width: playerWidth, - height: playerHeight, - limitRenditionByPlayerDimensions: limitRenditionByPlayerDimensions - }; - var playlists = master.playlists; // if playlist is audio only, select between currently active audio group playlists. - - if (Playlist.isAudioOnly(master)) { - playlists = masterPlaylistController.getAudioTrackPlaylists_(); // add audioOnly to options so that we log audioOnly: true - // at the buttom of this function for debugging. - - options.audioOnly = true; - } // convert the playlists to an intermediary representation to make comparisons easier - - - var sortedPlaylistReps = playlists.map(function (playlist) { - var bandwidth; - var width = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width; - var height = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height; - bandwidth = playlist.attributes && playlist.attributes.BANDWIDTH; - bandwidth = bandwidth || window__default['default'].Number.MAX_VALUE; - return { - bandwidth: bandwidth, - width: width, - height: height, - playlist: playlist - }; - }); - stableSort(sortedPlaylistReps, function (left, right) { - return left.bandwidth - right.bandwidth; - }); // filter out any playlists that have been excluded due to - // incompatible configurations - - sortedPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return !Playlist.isIncompatible(rep.playlist); - }); // filter out any playlists that have been disabled manually through the representations - // api or blacklisted temporarily due to playback errors. - - var enabledPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return Playlist.isEnabled(rep.playlist); - }); - - if (!enabledPlaylistReps.length) { - // if there are no enabled playlists, then they have all been blacklisted or disabled - // by the user through the representations api. In this case, ignore blacklisting and - // fallback to what the user wants by using playlists the user has not disabled. - enabledPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return !Playlist.isDisabled(rep.playlist); - }); - } // filter out any variant that has greater effective bitrate - // than the current estimated bandwidth - - - var bandwidthPlaylistReps = enabledPlaylistReps.filter(function (rep) { - return rep.bandwidth * Config.BANDWIDTH_VARIANCE < playerBandwidth; - }); - var highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1]; // get all of the renditions with the same (highest) bandwidth - // and then taking the very first element - - var bandwidthBestRep = bandwidthPlaylistReps.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; // if we're not going to limit renditions by player size, make an early decision. - - if (limitRenditionByPlayerDimensions === false) { - var _chosenRep = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0]; - - if (_chosenRep && _chosenRep.playlist) { - var type = 'sortedPlaylistReps'; - - if (bandwidthBestRep) { - type = 'bandwidthBestRep'; - } - - if (enabledPlaylistReps[0]) { - type = 'enabledPlaylistReps'; - } - - logFn("choosing " + representationToString(_chosenRep) + " using " + type + " with options", options); - return _chosenRep.playlist; - } - - logFn('could not choose a playlist with options', options); - return null; - } // filter out playlists without resolution information - - - var haveResolution = bandwidthPlaylistReps.filter(function (rep) { - return rep.width && rep.height; - }); // sort variants by resolution - - stableSort(haveResolution, function (left, right) { - return left.width - right.width; - }); // if we have the exact resolution as the player use it - - var resolutionBestRepList = haveResolution.filter(function (rep) { - return rep.width === playerWidth && rep.height === playerHeight; - }); - highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1]; // ensure that we pick the highest bandwidth variant that have exact resolution - - var resolutionBestRep = resolutionBestRepList.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - var resolutionPlusOneList; - var resolutionPlusOneSmallest; - var resolutionPlusOneRep; // find the smallest variant that is larger than the player - // if there is no match of exact resolution - - if (!resolutionBestRep) { - resolutionPlusOneList = haveResolution.filter(function (rep) { - return rep.width > playerWidth || rep.height > playerHeight; - }); // find all the variants have the same smallest resolution - - resolutionPlusOneSmallest = resolutionPlusOneList.filter(function (rep) { - return rep.width === resolutionPlusOneList[0].width && rep.height === resolutionPlusOneList[0].height; - }); // ensure that we also pick the highest bandwidth variant that - // is just-larger-than the video player - - highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1]; - resolutionPlusOneRep = resolutionPlusOneSmallest.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - } // fallback chain of variants - - - var chosenRep = resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0]; - - if (chosenRep && chosenRep.playlist) { - var _type = 'sortedPlaylistReps'; - - if (resolutionPlusOneRep) { - _type = 'resolutionPlusOneRep'; - } else if (resolutionBestRep) { - _type = 'resolutionBestRep'; - } else if (bandwidthBestRep) { - _type = 'bandwidthBestRep'; - } else if (enabledPlaylistReps[0]) { - _type = 'enabledPlaylistReps'; - } - - logFn("choosing " + representationToString(chosenRep) + " using " + _type + " with options", options); - return chosenRep.playlist; - } - - logFn('could not choose a playlist with options', options); - return null; -}; - -/** - * Chooses the appropriate media playlist based on the most recent - * bandwidth estimate and the player size. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @return {Playlist} the highest bitrate playlist less than the - * currently detected bandwidth, accounting for some amount of - * bandwidth variance - */ - -var lastBandwidthSelector = function lastBandwidthSelector() { - var pixelRatio = this.useDevicePixelRatio ? window__default['default'].devicePixelRatio || 1 : 1; - return simpleSelector(this.playlists.master, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); -}; -/** - * Chooses the appropriate media playlist based on an - * exponential-weighted moving average of the bandwidth after - * filtering for player size. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @param {number} decay - a number between 0 and 1. Higher values of - * this parameter will cause previous bandwidth estimates to lose - * significance more quickly. - * @return {Function} a function which can be invoked to create a new - * playlist selector function. - * @see https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average - */ - -var movingAverageBandwidthSelector = function movingAverageBandwidthSelector(decay) { - var average = -1; - var lastSystemBandwidth = -1; - - if (decay < 0 || decay > 1) { - throw new Error('Moving average bandwidth decay must be between 0 and 1.'); - } - - return function () { - var pixelRatio = this.useDevicePixelRatio ? window__default['default'].devicePixelRatio || 1 : 1; - - if (average < 0) { - average = this.systemBandwidth; - lastSystemBandwidth = this.systemBandwidth; - } // stop the average value from decaying for every 250ms - // when the systemBandwidth is constant - // and - // stop average from setting to a very low value when the - // systemBandwidth becomes 0 in case of chunk cancellation - - - if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) { - average = decay * this.systemBandwidth + (1 - decay) * average; - lastSystemBandwidth = this.systemBandwidth; - } - - return simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); - }; -}; -/** - * Chooses the appropriate media playlist based on the potential to rebuffer - * - * @param {Object} settings - * Object of information required to use this selector - * @param {Object} settings.master - * Object representation of the master manifest - * @param {number} settings.currentTime - * The current time of the player - * @param {number} settings.bandwidth - * Current measured bandwidth - * @param {number} settings.duration - * Duration of the media - * @param {number} settings.segmentDuration - * Segment duration to be used in round trip time calculations - * @param {number} settings.timeUntilRebuffer - * Time left in seconds until the player has to rebuffer - * @param {number} settings.currentTimeline - * The current timeline segments are being loaded from - * @param {SyncController} settings.syncController - * SyncController for determining if we have a sync point for a given playlist - * @return {Object|null} - * {Object} return.playlist - * The highest bandwidth playlist with the least amount of rebuffering - * {Number} return.rebufferingImpact - * The amount of time in seconds switching to this playlist will rebuffer. A - * negative value means that switching will cause zero rebuffering. - */ - -var minRebufferMaxBandwidthSelector = function minRebufferMaxBandwidthSelector(settings) { - var master = settings.master, - currentTime = settings.currentTime, - bandwidth = settings.bandwidth, - duration = settings.duration, - segmentDuration = settings.segmentDuration, - timeUntilRebuffer = settings.timeUntilRebuffer, - currentTimeline = settings.currentTimeline, - syncController = settings.syncController; // filter out any playlists that have been excluded due to - // incompatible configurations - - var compatiblePlaylists = master.playlists.filter(function (playlist) { - return !Playlist.isIncompatible(playlist); - }); // filter out any playlists that have been disabled manually through the representations - // api or blacklisted temporarily due to playback errors. - - var enabledPlaylists = compatiblePlaylists.filter(Playlist.isEnabled); - - if (!enabledPlaylists.length) { - // if there are no enabled playlists, then they have all been blacklisted or disabled - // by the user through the representations api. In this case, ignore blacklisting and - // fallback to what the user wants by using playlists the user has not disabled. - enabledPlaylists = compatiblePlaylists.filter(function (playlist) { - return !Playlist.isDisabled(playlist); - }); - } - - var bandwidthPlaylists = enabledPlaylists.filter(Playlist.hasAttribute.bind(null, 'BANDWIDTH')); - var rebufferingEstimates = bandwidthPlaylists.map(function (playlist) { - var syncPoint = syncController.getSyncPoint(playlist, duration, currentTimeline, currentTime); // If there is no sync point for this playlist, switching to it will require a - // sync request first. This will double the request time - - var numRequests = syncPoint ? 1 : 2; - var requestTimeEstimate = Playlist.estimateSegmentRequestTime(segmentDuration, bandwidth, playlist); - var rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer; - return { - playlist: playlist, - rebufferingImpact: rebufferingImpact - }; - }); - var noRebufferingPlaylists = rebufferingEstimates.filter(function (estimate) { - return estimate.rebufferingImpact <= 0; - }); // Sort by bandwidth DESC - - stableSort(noRebufferingPlaylists, function (a, b) { - return comparePlaylistBandwidth(b.playlist, a.playlist); - }); - - if (noRebufferingPlaylists.length) { - return noRebufferingPlaylists[0]; - } - - stableSort(rebufferingEstimates, function (a, b) { - return a.rebufferingImpact - b.rebufferingImpact; - }); - return rebufferingEstimates[0] || null; -}; -/** - * Chooses the appropriate media playlist, which in this case is the lowest bitrate - * one with video. If no renditions with video exist, return the lowest audio rendition. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @return {Object|null} - * {Object} return.playlist - * The lowest bitrate playlist that contains a video codec. If no such rendition - * exists pick the lowest audio rendition. - */ - -var lowestBitrateCompatibleVariantSelector = function lowestBitrateCompatibleVariantSelector() { - var _this = this; - - // filter out any playlists that have been excluded due to - // incompatible configurations or playback errors - var playlists = this.playlists.master.playlists.filter(Playlist.isEnabled); // Sort ascending by bitrate - - stableSort(playlists, function (a, b) { - return comparePlaylistBandwidth(a, b); - }); // Parse and assume that playlists with no video codec have no video - // (this is not necessarily true, although it is generally true). - // - // If an entire manifest has no valid videos everything will get filtered - // out. - - var playlistsWithVideo = playlists.filter(function (playlist) { - return !!codecsForPlaylist(_this.playlists.master, playlist).video; - }); - return playlistsWithVideo[0] || null; -}; - -/** - * Combine all segments into a single Uint8Array - * - * @param {Object} segmentObj - * @return {Uint8Array} concatenated bytes - * @private - */ -var concatSegments = function concatSegments(segmentObj) { - var offset = 0; - var tempBuffer; - - if (segmentObj.bytes) { - tempBuffer = new Uint8Array(segmentObj.bytes); // combine the individual segments into one large typed-array - - segmentObj.segments.forEach(function (segment) { - tempBuffer.set(segment, offset); - offset += segment.byteLength; - }); - } - - return tempBuffer; -}; - -/** - * @file text-tracks.js - */ -/** - * Create captions text tracks on video.js if they do not exist - * - * @param {Object} inbandTextTracks a reference to current inbandTextTracks - * @param {Object} tech the video.js tech - * @param {Object} captionStream the caption stream to create - * @private - */ - -var createCaptionsTrackIfNotExists = function createCaptionsTrackIfNotExists(inbandTextTracks, tech, captionStream) { - if (!inbandTextTracks[captionStream]) { - tech.trigger({ - type: 'usage', - name: 'vhs-608' - }); - tech.trigger({ - type: 'usage', - name: 'hls-608' - }); - var instreamId = captionStream; // we need to translate SERVICEn for 708 to how mux.js currently labels them - - if (/^cc708_/.test(captionStream)) { - instreamId = 'SERVICE' + captionStream.split('_')[1]; - } - - var track = tech.textTracks().getTrackById(instreamId); - - if (track) { - // Resuse an existing track with a CC# id because this was - // very likely created by videojs-contrib-hls from information - // in the m3u8 for us to use - inbandTextTracks[captionStream] = track; - } else { - // This section gets called when we have caption services that aren't specified in the manifest. - // Manifest level caption services are handled in media-groups.js under CLOSED-CAPTIONS. - var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {}; - var label = captionStream; - var language = captionStream; - var def = false; - var captionService = captionServices[instreamId]; - - if (captionService) { - label = captionService.label; - language = captionService.language; - def = captionService.default; - } // Otherwise, create a track with the default `CC#` label and - // without a language - - - inbandTextTracks[captionStream] = tech.addRemoteTextTrack({ - kind: 'captions', - id: instreamId, - // TODO: investigate why this doesn't seem to turn the caption on by default - default: def, - label: label, - language: language - }, false).track; - } - } -}; -/** - * Add caption text track data to a source handler given an array of captions - * - * @param {Object} - * @param {Object} inbandTextTracks the inband text tracks - * @param {number} timestampOffset the timestamp offset of the source buffer - * @param {Array} captionArray an array of caption data - * @private - */ - -var addCaptionData = function addCaptionData(_ref) { - var inbandTextTracks = _ref.inbandTextTracks, - captionArray = _ref.captionArray, - timestampOffset = _ref.timestampOffset; - - if (!captionArray) { - return; - } - - var Cue = window__default['default'].WebKitDataCue || window__default['default'].VTTCue; - captionArray.forEach(function (caption) { - var track = caption.stream; - inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset, caption.endTime + timestampOffset, caption.text)); - }); -}; -/** - * Define properties on a cue for backwards compatability, - * but warn the user that the way that they are using it - * is depricated and will be removed at a later date. - * - * @param {Cue} cue the cue to add the properties on - * @private - */ - -var deprecateOldCue = function deprecateOldCue(cue) { - Object.defineProperties(cue.frame, { - id: { - get: function get() { - videojs__default['default'].log.warn('cue.frame.id is deprecated. Use cue.value.key instead.'); - return cue.value.key; - } - }, - value: { - get: function get() { - videojs__default['default'].log.warn('cue.frame.value is deprecated. Use cue.value.data instead.'); - return cue.value.data; - } - }, - privateData: { - get: function get() { - videojs__default['default'].log.warn('cue.frame.privateData is deprecated. Use cue.value.data instead.'); - return cue.value.data; - } - } - }); -}; -/** - * Add metadata text track data to a source handler given an array of metadata - * - * @param {Object} - * @param {Object} inbandTextTracks the inband text tracks - * @param {Array} metadataArray an array of meta data - * @param {number} timestampOffset the timestamp offset of the source buffer - * @param {number} videoDuration the duration of the video - * @private - */ - - -var addMetadata = function addMetadata(_ref2) { - var inbandTextTracks = _ref2.inbandTextTracks, - metadataArray = _ref2.metadataArray, - timestampOffset = _ref2.timestampOffset, - videoDuration = _ref2.videoDuration; - - if (!metadataArray) { - return; - } - - var Cue = window__default['default'].WebKitDataCue || window__default['default'].VTTCue; - var metadataTrack = inbandTextTracks.metadataTrack_; - - if (!metadataTrack) { - return; - } - - metadataArray.forEach(function (metadata) { - var time = metadata.cueTime + timestampOffset; // if time isn't a finite number between 0 and Infinity, like NaN, - // ignore this bit of metadata. - // This likely occurs when you have an non-timed ID3 tag like TIT2, - // which is the "Title/Songname/Content description" frame - - if (typeof time !== 'number' || window__default['default'].isNaN(time) || time < 0 || !(time < Infinity)) { - return; - } - - metadata.frames.forEach(function (frame) { - var cue = new Cue(time, time, frame.value || frame.url || frame.data || ''); - cue.frame = frame; - cue.value = frame; - deprecateOldCue(cue); - metadataTrack.addCue(cue); - }); - }); - - if (!metadataTrack.cues || !metadataTrack.cues.length) { - return; - } // Updating the metadeta cues so that - // the endTime of each cue is the startTime of the next cue - // the endTime of last cue is the duration of the video - - - var cues = metadataTrack.cues; - var cuesArray = []; // Create a copy of the TextTrackCueList... - // ...disregarding cues with a falsey value - - for (var i = 0; i < cues.length; i++) { - if (cues[i]) { - cuesArray.push(cues[i]); - } - } // Group cues by their startTime value - - - var cuesGroupedByStartTime = cuesArray.reduce(function (obj, cue) { - var timeSlot = obj[cue.startTime] || []; - timeSlot.push(cue); - obj[cue.startTime] = timeSlot; - return obj; - }, {}); // Sort startTimes by ascending order - - var sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort(function (a, b) { - return Number(a) - Number(b); - }); // Map each cue group's endTime to the next group's startTime - - sortedStartTimes.forEach(function (startTime, idx) { - var cueGroup = cuesGroupedByStartTime[startTime]; - var nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration; // Map each cue's endTime the next group's startTime - - cueGroup.forEach(function (cue) { - cue.endTime = nextTime; - }); - }); -}; -/** - * Create metadata text track on video.js if it does not exist - * - * @param {Object} inbandTextTracks a reference to current inbandTextTracks - * @param {string} dispatchType the inband metadata track dispatch type - * @param {Object} tech the video.js tech - * @private - */ - -var createMetadataTrackIfNotExists = function createMetadataTrackIfNotExists(inbandTextTracks, dispatchType, tech) { - if (inbandTextTracks.metadataTrack_) { - return; - } - - inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({ - kind: 'metadata', - label: 'Timed Metadata' - }, false).track; - inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType; -}; -/** - * Remove cues from a track on video.js. - * - * @param {Double} start start of where we should remove the cue - * @param {Double} end end of where the we should remove the cue - * @param {Object} track the text track to remove the cues from - * @private - */ - -var removeCuesFromTrack = function removeCuesFromTrack(start, end, track) { - var i; - var cue; - - if (!track) { - return; - } - - if (!track.cues) { - return; - } - - i = track.cues.length; - - while (i--) { - cue = track.cues[i]; // Remove any cue within the provided start and end time - - if (cue.startTime >= start && cue.endTime <= end) { - track.removeCue(cue); - } - } -}; -/** - * Remove duplicate cues from a track on video.js (a cue is considered a - * duplicate if it has the same time interval and text as another) - * - * @param {Object} track the text track to remove the duplicate cues from - * @private - */ - -var removeDuplicateCuesFromTrack = function removeDuplicateCuesFromTrack(track) { - var cues = track.cues; - - if (!cues) { - return; - } - - for (var i = 0; i < cues.length; i++) { - var duplicates = []; - var occurrences = 0; - - for (var j = 0; j < cues.length; j++) { - if (cues[i].startTime === cues[j].startTime && cues[i].endTime === cues[j].endTime && cues[i].text === cues[j].text) { - occurrences++; - - if (occurrences > 1) { - duplicates.push(cues[j]); - } - } - } - - if (duplicates.length) { - duplicates.forEach(function (dupe) { - return track.removeCue(dupe); - }); - } - } -}; - -/** - * Returns a list of gops in the buffer that have a pts value of 3 seconds or more in - * front of current time. - * - * @param {Array} buffer - * The current buffer of gop information - * @param {number} currentTime - * The current time - * @param {Double} mapping - * Offset to map display time to stream presentation time - * @return {Array} - * List of gops considered safe to append over - */ - -var gopsSafeToAlignWith = function gopsSafeToAlignWith(buffer, currentTime, mapping) { - if (typeof currentTime === 'undefined' || currentTime === null || !buffer.length) { - return []; - } // pts value for current time + 3 seconds to give a bit more wiggle room - - - var currentTimePts = Math.ceil((currentTime - mapping + 3) * clock.ONE_SECOND_IN_TS); - var i; - - for (i = 0; i < buffer.length; i++) { - if (buffer[i].pts > currentTimePts) { - break; - } - } - - return buffer.slice(i); -}; -/** - * Appends gop information (timing and byteLength) received by the transmuxer for the - * gops appended in the last call to appendBuffer - * - * @param {Array} buffer - * The current buffer of gop information - * @param {Array} gops - * List of new gop information - * @param {boolean} replace - * If true, replace the buffer with the new gop information. If false, append the - * new gop information to the buffer in the right location of time. - * @return {Array} - * Updated list of gop information - */ - -var updateGopBuffer = function updateGopBuffer(buffer, gops, replace) { - if (!gops.length) { - return buffer; - } - - if (replace) { - // If we are in safe append mode, then completely overwrite the gop buffer - // with the most recent appeneded data. This will make sure that when appending - // future segments, we only try to align with gops that are both ahead of current - // time and in the last segment appended. - return gops.slice(); - } - - var start = gops[0].pts; - var i = 0; - - for (i; i < buffer.length; i++) { - if (buffer[i].pts >= start) { - break; - } - } - - return buffer.slice(0, i).concat(gops); -}; -/** - * Removes gop information in buffer that overlaps with provided start and end - * - * @param {Array} buffer - * The current buffer of gop information - * @param {Double} start - * position to start the remove at - * @param {Double} end - * position to end the remove at - * @param {Double} mapping - * Offset to map display time to stream presentation time - */ - -var removeGopBuffer = function removeGopBuffer(buffer, start, end, mapping) { - var startPts = Math.ceil((start - mapping) * clock.ONE_SECOND_IN_TS); - var endPts = Math.ceil((end - mapping) * clock.ONE_SECOND_IN_TS); - var updatedBuffer = buffer.slice(); - var i = buffer.length; - - while (i--) { - if (buffer[i].pts <= endPts) { - break; - } - } - - if (i === -1) { - // no removal because end of remove range is before start of buffer - return updatedBuffer; - } - - var j = i + 1; - - while (j--) { - if (buffer[j].pts <= startPts) { - break; - } - } // clamp remove range start to 0 index - - - j = Math.max(j, 0); - updatedBuffer.splice(j, i - j + 1); - return updatedBuffer; -}; - -var shallowEqual = function shallowEqual(a, b) { - // if both are undefined - // or one or the other is undefined - // they are not equal - if (!a && !b || !a && b || a && !b) { - return false; - } // they are the same object and thus, equal - - - if (a === b) { - return true; - } // sort keys so we can make sure they have - // all the same keys later. - - - var akeys = Object.keys(a).sort(); - var bkeys = Object.keys(b).sort(); // different number of keys, not equal - - if (akeys.length !== bkeys.length) { - return false; - } - - for (var i = 0; i < akeys.length; i++) { - var key = akeys[i]; // different sorted keys, not equal - - if (key !== bkeys[i]) { - return false; - } // different values, not equal - - - if (a[key] !== b[key]) { - return false; - } - } - - return true; -}; - -// https://www.w3.org/TR/WebIDL-1/#quotaexceedederror -var QUOTA_EXCEEDED_ERR = 22; - -/** - * The segment loader has no recourse except to fetch a segment in the - * current playlist and use the internal timestamps in that segment to - * generate a syncPoint. This function returns a good candidate index - * for that process. - * - * @param {Array} segments - the segments array from a playlist. - * @return {number} An index of a segment from the playlist to load - */ - -var getSyncSegmentCandidate = function getSyncSegmentCandidate(currentTimeline, segments, targetTime) { - segments = segments || []; - var timelineSegments = []; - var time = 0; - - for (var i = 0; i < segments.length; i++) { - var segment = segments[i]; - - if (currentTimeline === segment.timeline) { - timelineSegments.push(i); - time += segment.duration; - - if (time > targetTime) { - return i; - } - } - } - - if (timelineSegments.length === 0) { - return 0; - } // default to the last timeline segment - - - return timelineSegments[timelineSegments.length - 1]; -}; // In the event of a quota exceeded error, keep at least one second of back buffer. This -// number was arbitrarily chosen and may be updated in the future, but seemed reasonable -// as a start to prevent any potential issues with removing content too close to the -// playhead. - -var MIN_BACK_BUFFER = 1; // in ms - -var CHECK_BUFFER_DELAY = 500; - -var finite = function finite(num) { - return typeof num === 'number' && isFinite(num); -}; // With most content hovering around 30fps, if a segment has a duration less than a half -// frame at 30fps or one frame at 60fps, the bandwidth and throughput calculations will -// not accurately reflect the rest of the content. - - -var MIN_SEGMENT_DURATION_TO_SAVE_STATS = 1 / 60; -var illegalMediaSwitch = function illegalMediaSwitch(loaderType, startingMedia, trackInfo) { - // Although these checks should most likely cover non 'main' types, for now it narrows - // the scope of our checks. - if (loaderType !== 'main' || !startingMedia || !trackInfo) { - return null; - } - - if (!trackInfo.hasAudio && !trackInfo.hasVideo) { - return 'Neither audio nor video found in segment.'; - } - - if (startingMedia.hasVideo && !trackInfo.hasVideo) { - return 'Only audio found in segment when we expected video.' + ' We can\'t switch to audio only from a stream that had video.' + ' To get rid of this message, please add codec information to the manifest.'; - } - - if (!startingMedia.hasVideo && trackInfo.hasVideo) { - return 'Video found in segment when we expected only audio.' + ' We can\'t switch to a stream with video from an audio only stream.' + ' To get rid of this message, please add codec information to the manifest.'; - } - - return null; -}; -/** - * Calculates a time value that is safe to remove from the back buffer without interrupting - * playback. - * - * @param {TimeRange} seekable - * The current seekable range - * @param {number} currentTime - * The current time of the player - * @param {number} targetDuration - * The target duration of the current playlist - * @return {number} - * Time that is safe to remove from the back buffer without interrupting playback - */ - -var safeBackBufferTrimTime = function safeBackBufferTrimTime(seekable, currentTime, targetDuration) { - // 30 seconds before the playhead provides a safe default for trimming. - // - // Choosing a reasonable default is particularly important for high bitrate content and - // VOD videos/live streams with large windows, as the buffer may end up overfilled and - // throw an APPEND_BUFFER_ERR. - var trimTime = currentTime - Config.BACK_BUFFER_LENGTH; - - if (seekable.length) { - // Some live playlists may have a shorter window of content than the full allowed back - // buffer. For these playlists, don't save content that's no longer within the window. - trimTime = Math.max(trimTime, seekable.start(0)); - } // Don't remove within target duration of the current time to avoid the possibility of - // removing the GOP currently being played, as removing it can cause playback stalls. - - - var maxTrimTime = currentTime - targetDuration; - return Math.min(maxTrimTime, trimTime); -}; - -var segmentInfoString = function segmentInfoString(segmentInfo) { - var startOfSegment = segmentInfo.startOfSegment, - duration = segmentInfo.duration, - segment = segmentInfo.segment, - part = segmentInfo.part, - _segmentInfo$playlist = segmentInfo.playlist, - seq = _segmentInfo$playlist.mediaSequence, - id = _segmentInfo$playlist.id, - _segmentInfo$playlist2 = _segmentInfo$playlist.segments, - segments = _segmentInfo$playlist2 === void 0 ? [] : _segmentInfo$playlist2, - index = segmentInfo.mediaIndex, - partIndex = segmentInfo.partIndex, - timeline = segmentInfo.timeline; - var segmentLen = segments.length - 1; - var selection = 'mediaIndex/partIndex increment'; - - if (segmentInfo.getMediaInfoForTime) { - selection = "getMediaInfoForTime (" + segmentInfo.getMediaInfoForTime + ")"; - } else if (segmentInfo.isSyncRequest) { - selection = 'getSyncSegmentCandidate (isSyncRequest)'; - } - - var hasPartIndex = typeof partIndex === 'number'; - var name = segmentInfo.segment.uri ? 'segment' : 'pre-segment'; - var zeroBasedPartCount = hasPartIndex ? getKnownPartCount({ - preloadSegment: segment - }) - 1 : 0; - return name + " [" + (seq + index) + "/" + (seq + segmentLen) + "]" + (hasPartIndex ? " part [" + partIndex + "/" + zeroBasedPartCount + "]" : '') + (" segment start/end [" + segment.start + " => " + segment.end + "]") + (hasPartIndex ? " part start/end [" + part.start + " => " + part.end + "]" : '') + (" startOfSegment [" + startOfSegment + "]") + (" duration [" + duration + "]") + (" timeline [" + timeline + "]") + (" selected by [" + selection + "]") + (" playlist [" + id + "]"); -}; - -var timingInfoPropertyForMedia = function timingInfoPropertyForMedia(mediaType) { - return mediaType + "TimingInfo"; -}; -/** - * Returns the timestamp offset to use for the segment. - * - * @param {number} segmentTimeline - * The timeline of the segment - * @param {number} currentTimeline - * The timeline currently being followed by the loader - * @param {number} startOfSegment - * The estimated segment start - * @param {TimeRange[]} buffered - * The loader's buffer - * @param {boolean} overrideCheck - * If true, no checks are made to see if the timestamp offset value should be set, - * but sets it directly to a value. - * - * @return {number|null} - * Either a number representing a new timestamp offset, or null if the segment is - * part of the same timeline - */ - - -var timestampOffsetForSegment = function timestampOffsetForSegment(_ref) { - var segmentTimeline = _ref.segmentTimeline, - currentTimeline = _ref.currentTimeline, - startOfSegment = _ref.startOfSegment, - buffered = _ref.buffered, - overrideCheck = _ref.overrideCheck; - - // Check to see if we are crossing a discontinuity to see if we need to set the - // timestamp offset on the transmuxer and source buffer. - // - // Previously, we changed the timestampOffset if the start of this segment was less than - // the currently set timestampOffset, but this isn't desirable as it can produce bad - // behavior, especially around long running live streams. - if (!overrideCheck && segmentTimeline === currentTimeline) { - return null; - } // When changing renditions, it's possible to request a segment on an older timeline. For - // instance, given two renditions with the following: - // - // #EXTINF:10 - // segment1 - // #EXT-X-DISCONTINUITY - // #EXTINF:10 - // segment2 - // #EXTINF:10 - // segment3 - // - // And the current player state: - // - // current time: 8 - // buffer: 0 => 20 - // - // The next segment on the current rendition would be segment3, filling the buffer from - // 20s onwards. However, if a rendition switch happens after segment2 was requested, - // then the next segment to be requested will be segment1 from the new rendition in - // order to fill time 8 and onwards. Using the buffered end would result in repeated - // content (since it would position segment1 of the new rendition starting at 20s). This - // case can be identified when the new segment's timeline is a prior value. Instead of - // using the buffered end, the startOfSegment can be used, which, hopefully, will be - // more accurate to the actual start time of the segment. - - - if (segmentTimeline < currentTimeline) { - return startOfSegment; - } // segmentInfo.startOfSegment used to be used as the timestamp offset, however, that - // value uses the end of the last segment if it is available. While this value - // should often be correct, it's better to rely on the buffered end, as the new - // content post discontinuity should line up with the buffered end as if it were - // time 0 for the new content. - - - return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment; -}; -/** - * Returns whether or not the loader should wait for a timeline change from the timeline - * change controller before processing the segment. - * - * Primary timing in VHS goes by video. This is different from most media players, as - * audio is more often used as the primary timing source. For the foreseeable future, VHS - * will continue to use video as the primary timing source, due to the current logic and - * expectations built around it. - - * Since the timing follows video, in order to maintain sync, the video loader is - * responsible for setting both audio and video source buffer timestamp offsets. - * - * Setting different values for audio and video source buffers could lead to - * desyncing. The following examples demonstrate some of the situations where this - * distinction is important. Note that all of these cases involve demuxed content. When - * content is muxed, the audio and video are packaged together, therefore syncing - * separate media playlists is not an issue. - * - * CASE 1: Audio prepares to load a new timeline before video: - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, the audio loader is preparing to load the 6th segment, the first - * after a discontinuity, while the video loader is still loading the 5th segment, before - * the discontinuity. - * - * If the audio loader goes ahead and loads and appends the 6th segment before the video - * loader crosses the discontinuity, then when appended, the 6th audio segment will use - * the timestamp offset from timeline 0. This will likely lead to desyncing. In addition, - * the audio loader must provide the audioAppendStart value to trim the content in the - * transmuxer, and that value relies on the audio timestamp offset. Since the audio - * timestamp offset is set by the video (main) loader, the audio loader shouldn't load the - * segment until that value is provided. - * - * CASE 2: Video prepares to load a new timeline before audio: - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, the video loader is preparing to load the 6th segment, the first - * after a discontinuity, while the audio loader is still loading the 5th segment, before - * the discontinuity. - * - * If the video loader goes ahead and loads and appends the 6th segment, then once the - * segment is loaded and processed, both the video and audio timestamp offsets will be - * set, since video is used as the primary timing source. This is to ensure content lines - * up appropriately, as any modifications to the video timing are reflected by audio when - * the video loader sets the audio and video timestamp offsets to the same value. However, - * setting the timestamp offset for audio before audio has had a chance to change - * timelines will likely lead to desyncing, as the audio loader will append segment 5 with - * a timestamp intended to apply to segments from timeline 1 rather than timeline 0. - * - * CASE 3: When seeking, audio prepares to load a new timeline before video - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, both audio and video loaders are loading segments from timeline - * 0, but imagine that the seek originated from timeline 1. - * - * When seeking to a new timeline, the timestamp offset will be set based on the expected - * segment start of the loaded video segment. In order to maintain sync, the audio loader - * must wait for the video loader to load its segment and update both the audio and video - * timestamp offsets before it may load and append its own segment. This is the case - * whether the seek results in a mismatched segment request (e.g., the audio loader - * chooses to load segment 3 and the video loader chooses to load segment 4) or the - * loaders choose to load the same segment index from each playlist, as the segments may - * not be aligned perfectly, even for matching segment indexes. - * - * @param {Object} timelinechangeController - * @param {number} currentTimeline - * The timeline currently being followed by the loader - * @param {number} segmentTimeline - * The timeline of the segment being loaded - * @param {('main'|'audio')} loaderType - * The loader type - * @param {boolean} audioDisabled - * Whether the audio is disabled for the loader. This should only be true when the - * loader may have muxed audio in its segment, but should not append it, e.g., for - * the main loader when an alternate audio playlist is active. - * - * @return {boolean} - * Whether the loader should wait for a timeline change from the timeline change - * controller before processing the segment - */ - -var shouldWaitForTimelineChange = function shouldWaitForTimelineChange(_ref2) { - var timelineChangeController = _ref2.timelineChangeController, - currentTimeline = _ref2.currentTimeline, - segmentTimeline = _ref2.segmentTimeline, - loaderType = _ref2.loaderType, - audioDisabled = _ref2.audioDisabled; - - if (currentTimeline === segmentTimeline) { - return false; - } - - if (loaderType === 'audio') { - var lastMainTimelineChange = timelineChangeController.lastTimelineChange({ - type: 'main' - }); // Audio loader should wait if: - // - // * main hasn't had a timeline change yet (thus has not loaded its first segment) - // * main hasn't yet changed to the timeline audio is looking to load - - return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline; - } // The main loader only needs to wait for timeline changes if there's demuxed audio. - // Otherwise, there's nothing to wait for, since audio would be muxed into the main - // loader's segments (or the content is audio/video only and handled by the main - // loader). - - - if (loaderType === 'main' && audioDisabled) { - var pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({ - type: 'audio' - }); // Main loader should wait for the audio loader if audio is not pending a timeline - // change to the current timeline. - // - // Since the main loader is responsible for setting the timestamp offset for both - // audio and video, the main loader must wait for audio to be about to change to its - // timeline before setting the offset, otherwise, if audio is behind in loading, - // segments from the previous timeline would be adjusted by the new timestamp offset. - // - // This requirement means that video will not cross a timeline until the audio is - // about to cross to it, so that way audio and video will always cross the timeline - // together. - // - // In addition to normal timeline changes, these rules also apply to the start of a - // stream (going from a non-existent timeline, -1, to timeline 0). It's important - // that these rules apply to the first timeline change because if they did not, it's - // possible that the main loader will cross two timelines before the audio loader has - // crossed one. Logic may be implemented to handle the startup as a special case, but - // it's easier to simply treat all timeline changes the same. - - if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) { - return false; - } - - return true; - } - - return false; -}; -var mediaDuration = function mediaDuration(audioTimingInfo, videoTimingInfo) { - var audioDuration = audioTimingInfo && typeof audioTimingInfo.start === 'number' && typeof audioTimingInfo.end === 'number' ? audioTimingInfo.end - audioTimingInfo.start : 0; - var videoDuration = videoTimingInfo && typeof videoTimingInfo.start === 'number' && typeof videoTimingInfo.end === 'number' ? videoTimingInfo.end - videoTimingInfo.start : 0; - return Math.max(audioDuration, videoDuration); -}; -var segmentTooLong = function segmentTooLong(_ref3) { - var segmentDuration = _ref3.segmentDuration, - maxDuration = _ref3.maxDuration; - - // 0 duration segments are most likely due to metadata only segments or a lack of - // information. - if (!segmentDuration) { - return false; - } // For HLS: - // - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1 - // The EXTINF duration of each Media Segment in the Playlist - // file, when rounded to the nearest integer, MUST be less than or equal - // to the target duration; longer segments can trigger playback stalls - // or other errors. - // - // For DASH, the mpd-parser uses the largest reported segment duration as the target - // duration. Although that reported duration is occasionally approximate (i.e., not - // exact), a strict check may report that a segment is too long more often in DASH. - - - return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR; -}; -var getTroublesomeSegmentDurationMessage = function getTroublesomeSegmentDurationMessage(segmentInfo, sourceType) { - // Right now we aren't following DASH's timing model exactly, so only perform - // this check for HLS content. - if (sourceType !== 'hls') { - return null; - } - - var segmentDuration = mediaDuration(segmentInfo.audioTimingInfo, segmentInfo.videoTimingInfo); // Don't report if we lack information. - // - // If the segment has a duration of 0 it is either a lack of information or a - // metadata only segment and shouldn't be reported here. - - if (!segmentDuration) { - return null; - } - - var targetDuration = segmentInfo.playlist.targetDuration; - var isSegmentWayTooLong = segmentTooLong({ - segmentDuration: segmentDuration, - maxDuration: targetDuration * 2 - }); - var isSegmentSlightlyTooLong = segmentTooLong({ - segmentDuration: segmentDuration, - maxDuration: targetDuration - }); - var segmentTooLongMessage = "Segment with index " + segmentInfo.mediaIndex + " " + ("from playlist " + segmentInfo.playlist.id + " ") + ("has a duration of " + segmentDuration + " ") + ("when the reported duration is " + segmentInfo.duration + " ") + ("and the target duration is " + targetDuration + ". ") + 'For HLS content, a duration in excess of the target duration may result in ' + 'playback issues. See the HLS specification section on EXT-X-TARGETDURATION for ' + 'more details: ' + 'https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1'; - - if (isSegmentWayTooLong || isSegmentSlightlyTooLong) { - return { - severity: isSegmentWayTooLong ? 'warn' : 'info', - message: segmentTooLongMessage - }; - } - - return null; -}; -/** - * An object that manages segment loading and appending. - * - * @class SegmentLoader - * @param {Object} options required and optional options - * @extends videojs.EventTarget - */ - -var SegmentLoader = /*#__PURE__*/function (_videojs$EventTarget) { - _inheritsLoose__default['default'](SegmentLoader, _videojs$EventTarget); - - function SegmentLoader(settings, options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; // check pre-conditions - - if (!settings) { - throw new TypeError('Initialization settings are required'); - } - - if (typeof settings.currentTime !== 'function') { - throw new TypeError('No currentTime getter specified'); - } - - if (!settings.mediaSource) { - throw new TypeError('No MediaSource specified'); - } // public properties - - - _this.bandwidth = settings.bandwidth; - _this.throughput = { - rate: 0, - count: 0 - }; - _this.roundTrip = NaN; - - _this.resetStats_(); - - _this.mediaIndex = null; - _this.partIndex = null; // private settings - - _this.hasPlayed_ = settings.hasPlayed; - _this.currentTime_ = settings.currentTime; - _this.seekable_ = settings.seekable; - _this.seeking_ = settings.seeking; - _this.duration_ = settings.duration; - _this.mediaSource_ = settings.mediaSource; - _this.vhs_ = settings.vhs; - _this.loaderType_ = settings.loaderType; - _this.currentMediaInfo_ = void 0; - _this.startingMediaInfo_ = void 0; - _this.segmentMetadataTrack_ = settings.segmentMetadataTrack; - _this.goalBufferLength_ = settings.goalBufferLength; - _this.sourceType_ = settings.sourceType; - _this.sourceUpdater_ = settings.sourceUpdater; - _this.inbandTextTracks_ = settings.inbandTextTracks; - _this.state_ = 'INIT'; - _this.timelineChangeController_ = settings.timelineChangeController; - _this.shouldSaveSegmentTimingInfo_ = true; - _this.parse708captions_ = settings.parse708captions; // private instance variables - - _this.checkBufferTimeout_ = null; - _this.error_ = void 0; - _this.currentTimeline_ = -1; - _this.pendingSegment_ = null; - _this.xhrOptions_ = null; - _this.pendingSegments_ = []; - _this.audioDisabled_ = false; - _this.isPendingTimestampOffset_ = false; // TODO possibly move gopBuffer and timeMapping info to a separate controller - - _this.gopBuffer_ = []; - _this.timeMapping_ = 0; - _this.safeAppend_ = videojs__default['default'].browser.IE_VERSION >= 11; - _this.appendInitSegment_ = { - audio: true, - video: true - }; - _this.playlistOfLastInitSegment_ = { - audio: null, - video: null - }; - _this.callQueue_ = []; // If the segment loader prepares to load a segment, but does not have enough - // information yet to start the loading process (e.g., if the audio loader wants to - // load a segment from the next timeline but the main loader hasn't yet crossed that - // timeline), then the load call will be added to the queue until it is ready to be - // processed. - - _this.loadQueue_ = []; - _this.metadataQueue_ = { - id3: [], - caption: [] - }; - _this.waitingOnRemove_ = false; - _this.quotaExceededErrorRetryTimeout_ = null; // Fragmented mp4 playback - - _this.activeInitSegmentId_ = null; - _this.initSegments_ = {}; // HLSe playback - - _this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys; - _this.keyCache_ = {}; - _this.decrypter_ = settings.decrypter; // Manages the tracking and generation of sync-points, mappings - // between a time in the display time and a segment index within - // a playlist - - _this.syncController_ = settings.syncController; - _this.syncPoint_ = { - segmentIndex: 0, - time: 0 - }; - _this.transmuxer_ = _this.createTransmuxer_(); - - _this.triggerSyncInfoUpdate_ = function () { - return _this.trigger('syncinfoupdate'); - }; - - _this.syncController_.on('syncinfoupdate', _this.triggerSyncInfoUpdate_); - - _this.mediaSource_.addEventListener('sourceopen', function () { - if (!_this.isEndOfStream_()) { - _this.ended_ = false; - } - }); // ...for determining the fetch location - - - _this.fetchAtBuffer_ = false; - _this.logger_ = logger("SegmentLoader[" + _this.loaderType_ + "]"); - Object.defineProperty(_assertThisInitialized__default['default'](_this), 'state', { - get: function get() { - return this.state_; - }, - set: function set(newState) { - if (newState !== this.state_) { - this.logger_(this.state_ + " -> " + newState); - this.state_ = newState; - this.trigger('statechange'); - } - } - }); - - _this.sourceUpdater_.on('ready', function () { - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); // Only the main loader needs to listen for pending timeline changes, as the main - // loader should wait for audio to be ready to change its timeline so that both main - // and audio timelines change together. For more details, see the - // shouldWaitForTimelineChange function. - - - if (_this.loaderType_ === 'main') { - _this.timelineChangeController_.on('pendingtimelinechange', function () { - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); - } // The main loader only listens on pending timeline changes, but the audio loader, - // since its loads follow main, needs to listen on timeline changes. For more details, - // see the shouldWaitForTimelineChange function. - - - if (_this.loaderType_ === 'audio') { - _this.timelineChangeController_.on('timelinechange', function () { - if (_this.hasEnoughInfoToLoad_()) { - _this.processLoadQueue_(); - } - - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); - } - - return _this; - } - - var _proto = SegmentLoader.prototype; - - _proto.createTransmuxer_ = function createTransmuxer_() { - return segmentTransmuxer.createTransmuxer({ - remux: false, - alignGopsAtEnd: this.safeAppend_, - keepOriginalTimestamps: true, - parse708captions: this.parse708captions_ - }); - } - /** - * reset all of our media stats - * - * @private - */ - ; - - _proto.resetStats_ = function resetStats_() { - this.mediaBytesTransferred = 0; - this.mediaRequests = 0; - this.mediaRequestsAborted = 0; - this.mediaRequestsTimedout = 0; - this.mediaRequestsErrored = 0; - this.mediaTransferDuration = 0; - this.mediaSecondsLoaded = 0; - this.mediaAppends = 0; - } - /** - * dispose of the SegmentLoader and reset to the default state - */ - ; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.state = 'DISPOSED'; - this.pause(); - this.abort_(); - - if (this.transmuxer_) { - this.transmuxer_.terminate(); - } - - this.resetStats_(); - - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - } - - if (this.syncController_ && this.triggerSyncInfoUpdate_) { - this.syncController_.off('syncinfoupdate', this.triggerSyncInfoUpdate_); - } - - this.off(); - }; - - _proto.setAudio = function setAudio(enable) { - this.audioDisabled_ = !enable; - - if (enable) { - this.appendInitSegment_.audio = true; - } else { - // remove current track audio if it gets disabled - this.sourceUpdater_.removeAudio(0, this.duration_()); - } - } - /** - * abort anything that is currently doing on with the SegmentLoader - * and reset to a default state - */ - ; - - _proto.abort = function abort() { - if (this.state !== 'WAITING') { - if (this.pendingSegment_) { - this.pendingSegment_ = null; - } - - return; - } - - this.abort_(); // We aborted the requests we were waiting on, so reset the loader's state to READY - // since we are no longer "waiting" on any requests. XHR callback is not always run - // when the request is aborted. This will prevent the loader from being stuck in the - // WAITING state indefinitely. - - this.state = 'READY'; // don't wait for buffer check timeouts to begin fetching the - // next segment - - if (!this.paused()) { - this.monitorBuffer_(); - } - } - /** - * abort all pending xhr requests and null any pending segements - * - * @private - */ - ; - - _proto.abort_ = function abort_() { - if (this.pendingSegment_ && this.pendingSegment_.abortRequests) { - this.pendingSegment_.abortRequests(); - } // clear out the segment being processed - - - this.pendingSegment_ = null; - this.callQueue_ = []; - this.loadQueue_ = []; - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_); - this.waitingOnRemove_ = false; - window__default['default'].clearTimeout(this.quotaExceededErrorRetryTimeout_); - this.quotaExceededErrorRetryTimeout_ = null; - }; - - _proto.checkForAbort_ = function checkForAbort_(requestId) { - // If the state is APPENDING, then aborts will not modify the state, meaning the first - // callback that happens should reset the state to READY so that loading can continue. - if (this.state === 'APPENDING' && !this.pendingSegment_) { - this.state = 'READY'; - return true; - } - - if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) { - return true; - } - - return false; - } - /** - * set an error on the segment loader and null out any pending segements - * - * @param {Error} error the error to set on the SegmentLoader - * @return {Error} the error that was set or that is currently set - */ - ; - - _proto.error = function error(_error) { - if (typeof _error !== 'undefined') { - this.logger_('error occurred:', _error); - this.error_ = _error; - } - - this.pendingSegment_ = null; - return this.error_; - }; - - _proto.endOfStream = function endOfStream() { - this.ended_ = true; - - if (this.transmuxer_) { - // need to clear out any cached data to prepare for the new segment - segmentTransmuxer.reset(this.transmuxer_); - } - - this.gopBuffer_.length = 0; - this.pause(); - this.trigger('ended'); - } - /** - * Indicates which time ranges are buffered - * - * @return {TimeRange} - * TimeRange object representing the current buffered ranges - */ - ; - - _proto.buffered_ = function buffered_() { - if (!this.sourceUpdater_ || !this.startingMediaInfo_) { - return videojs__default['default'].createTimeRanges(); - } - - if (this.loaderType_ === 'main') { - var _this$startingMediaIn = this.startingMediaInfo_, - hasAudio = _this$startingMediaIn.hasAudio, - hasVideo = _this$startingMediaIn.hasVideo, - isMuxed = _this$startingMediaIn.isMuxed; - - if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed) { - return this.sourceUpdater_.buffered(); - } - - if (hasVideo) { - return this.sourceUpdater_.videoBuffered(); - } - } // One case that can be ignored for now is audio only with alt audio, - // as we don't yet have proper support for that. - - - return this.sourceUpdater_.audioBuffered(); - } - /** - * Gets and sets init segment for the provided map - * - * @param {Object} map - * The map object representing the init segment to get or set - * @param {boolean=} set - * If true, the init segment for the provided map should be saved - * @return {Object} - * map object for desired init segment - */ - ; - - _proto.initSegmentForMap = function initSegmentForMap(map, set) { - if (set === void 0) { - set = false; - } - - if (!map) { - return null; - } - - var id = initSegmentId(map); - var storedMap = this.initSegments_[id]; - - if (set && !storedMap && map.bytes) { - this.initSegments_[id] = storedMap = { - resolvedUri: map.resolvedUri, - byterange: map.byterange, - bytes: map.bytes, - tracks: map.tracks, - timescales: map.timescales - }; - } - - return storedMap || map; - } - /** - * Gets and sets key for the provided key - * - * @param {Object} key - * The key object representing the key to get or set - * @param {boolean=} set - * If true, the key for the provided key should be saved - * @return {Object} - * Key object for desired key - */ - ; - - _proto.segmentKey = function segmentKey(key, set) { - if (set === void 0) { - set = false; - } - - if (!key) { - return null; - } - - var id = segmentKeyId(key); - var storedKey = this.keyCache_[id]; // TODO: We should use the HTTP Expires header to invalidate our cache per - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-6.2.3 - - if (this.cacheEncryptionKeys_ && set && !storedKey && key.bytes) { - this.keyCache_[id] = storedKey = { - resolvedUri: key.resolvedUri, - bytes: key.bytes - }; - } - - var result = { - resolvedUri: (storedKey || key).resolvedUri - }; - - if (storedKey) { - result.bytes = storedKey.bytes; - } - - return result; - } - /** - * Returns true if all configuration required for loading is present, otherwise false. - * - * @return {boolean} True if the all configuration is ready for loading - * @private - */ - ; - - _proto.couldBeginLoading_ = function couldBeginLoading_() { - return this.playlist_ && !this.paused(); - } - /** - * load a playlist and start to fill the buffer - */ - ; - - _proto.load = function load() { - // un-pause - this.monitorBuffer_(); // if we don't have a playlist yet, keep waiting for one to be - // specified - - if (!this.playlist_) { - return; - } // if all the configuration is ready, initialize and begin loading - - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - return this.init_(); - } // if we're in the middle of processing a segment already, don't - // kick off an additional segment request - - - if (!this.couldBeginLoading_() || this.state !== 'READY' && this.state !== 'INIT') { - return; - } - - this.state = 'READY'; - } - /** - * Once all the starting parameters have been specified, begin - * operation. This method should only be invoked from the INIT - * state. - * - * @private - */ - ; - - _proto.init_ = function init_() { - this.state = 'READY'; // if this is the audio segment loader, and it hasn't been inited before, then any old - // audio data from the muxed content should be removed - - this.resetEverything(); - return this.monitorBuffer_(); - } - /** - * set a playlist on the segment loader - * - * @param {PlaylistLoader} media the playlist to set on the segment loader - */ - ; - - _proto.playlist = function playlist(newPlaylist, options) { - if (options === void 0) { - options = {}; - } - - if (!newPlaylist) { - return; - } - - var oldPlaylist = this.playlist_; - var segmentInfo = this.pendingSegment_; - this.playlist_ = newPlaylist; - this.xhrOptions_ = options; // when we haven't started playing yet, the start of a live playlist - // is always our zero-time so force a sync update each time the playlist - // is refreshed from the server - // - // Use the INIT state to determine if playback has started, as the playlist sync info - // should be fixed once requests begin (as sync points are generated based on sync - // info), but not before then. - - if (this.state === 'INIT') { - newPlaylist.syncInfo = { - mediaSequence: newPlaylist.mediaSequence, - time: 0 - }; // Setting the date time mapping means mapping the program date time (if available) - // to time 0 on the player's timeline. The playlist's syncInfo serves a similar - // purpose, mapping the initial mediaSequence to time zero. Since the syncInfo can - // be updated as the playlist is refreshed before the loader starts loading, the - // program date time mapping needs to be updated as well. - // - // This mapping is only done for the main loader because a program date time should - // map equivalently between playlists. - - if (this.loaderType_ === 'main') { - this.syncController_.setDateTimeMappingForStart(newPlaylist); - } - } - - var oldId = null; - - if (oldPlaylist) { - if (oldPlaylist.id) { - oldId = oldPlaylist.id; - } else if (oldPlaylist.uri) { - oldId = oldPlaylist.uri; - } - } - - this.logger_("playlist update [" + oldId + " => " + (newPlaylist.id || newPlaylist.uri) + "]"); // in VOD, this is always a rendition switch (or we updated our syncInfo above) - // in LIVE, we always want to update with new playlists (including refreshes) - - this.trigger('syncinfoupdate'); // if we were unpaused but waiting for a playlist, start - // buffering now - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - return this.init_(); - } - - if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) { - if (this.mediaIndex !== null) { - // we must "resync" the segment loader when we switch renditions and - // the segment loader is already synced to the previous rendition - this.resyncLoader(); - } - - this.currentMediaInfo_ = void 0; - this.trigger('playlistupdate'); // the rest of this function depends on `oldPlaylist` being defined - - return; - } // we reloaded the same playlist so we are in a live scenario - // and we will likely need to adjust the mediaIndex - - - var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; - this.logger_("live window shift [" + mediaSequenceDiff + "]"); // update the mediaIndex on the SegmentLoader - // this is important because we can abort a request and this value must be - // equal to the last appended mediaIndex - - if (this.mediaIndex !== null) { - this.mediaIndex -= mediaSequenceDiff; // this can happen if we are going to load the first segment, but get a playlist - // update during that. mediaIndex would go from 0 to -1 if mediaSequence in the - // new playlist was incremented by 1. - - if (this.mediaIndex < 0) { - this.mediaIndex = null; - this.partIndex = null; - } else { - var segment = this.playlist_.segments[this.mediaIndex]; // partIndex should remain the same for the same segment - // unless parts fell off of the playlist for this segment. - // In that case we need to reset partIndex and resync - - if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) { - var mediaIndex = this.mediaIndex; - this.logger_("currently processing part (index " + this.partIndex + ") no longer exists."); - this.resetLoader(); // We want to throw away the partIndex and the data associated with it, - // as the part was dropped from our current playlists segment. - // The mediaIndex will still be valid so keep that around. - - this.mediaIndex = mediaIndex; - } - } - } // update the mediaIndex on the SegmentInfo object - // this is important because we will update this.mediaIndex with this value - // in `handleAppendsDone_` after the segment has been successfully appended - - - if (segmentInfo) { - segmentInfo.mediaIndex -= mediaSequenceDiff; - - if (segmentInfo.mediaIndex < 0) { - segmentInfo.mediaIndex = null; - segmentInfo.partIndex = null; - } else { - // we need to update the referenced segment so that timing information is - // saved for the new playlist's segment, however, if the segment fell off the - // playlist, we can leave the old reference and just lose the timing info - if (segmentInfo.mediaIndex >= 0) { - segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex]; - } - - if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) { - segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex]; - } - } - } - - this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist); - } - /** - * Prevent the loader from fetching additional segments. If there - * is a segment request outstanding, it will finish processing - * before the loader halts. A segment loader can be unpaused by - * calling load(). - */ - ; - - _proto.pause = function pause() { - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - this.checkBufferTimeout_ = null; - } - } - /** - * Returns whether the segment loader is fetching additional - * segments when given the opportunity. This property can be - * modified through calls to pause() and load(). - */ - ; - - _proto.paused = function paused() { - return this.checkBufferTimeout_ === null; - } - /** - * Delete all the buffered data and reset the SegmentLoader - * - * @param {Function} [done] an optional callback to be executed when the remove - * operation is complete - */ - ; - - _proto.resetEverything = function resetEverything(done) { - this.ended_ = false; - this.appendInitSegment_ = { - audio: true, - video: true - }; - this.resetLoader(); // remove from 0, the earliest point, to Infinity, to signify removal of everything. - // VTT Segment Loader doesn't need to do anything but in the regular SegmentLoader, - // we then clamp the value to duration if necessary. - - this.remove(0, Infinity, done); // clears fmp4 captions - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearAllMp4Captions' - }); - } - } - /** - * Force the SegmentLoader to resync and start loading around the currentTime instead - * of starting at the end of the buffer - * - * Useful for fast quality changes - */ - ; - - _proto.resetLoader = function resetLoader() { - this.fetchAtBuffer_ = false; - this.resyncLoader(); - } - /** - * Force the SegmentLoader to restart synchronization and make a conservative guess - * before returning to the simple walk-forward method - */ - ; - - _proto.resyncLoader = function resyncLoader() { - if (this.transmuxer_) { - // need to clear out any cached data to prepare for the new segment - segmentTransmuxer.reset(this.transmuxer_); - } - - this.mediaIndex = null; - this.partIndex = null; - this.syncPoint_ = null; - this.isPendingTimestampOffset_ = false; - this.callQueue_ = []; - this.loadQueue_ = []; - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - this.abort(); - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearParsedMp4Captions' - }); - } - } - /** - * Remove any data in the source buffer between start and end times - * - * @param {number} start - the start time of the region to remove from the buffer - * @param {number} end - the end time of the region to remove from the buffer - * @param {Function} [done] - an optional callback to be executed when the remove - * @param {boolean} force - force all remove operations to happen - * operation is complete - */ - ; - - _proto.remove = function remove(start, end, done, force) { - if (done === void 0) { - done = function done() {}; - } - - if (force === void 0) { - force = false; - } - - // clamp end to duration if we need to remove everything. - // This is due to a browser bug that causes issues if we remove to Infinity. - // videojs/videojs-contrib-hls#1225 - if (end === Infinity) { - end = this.duration_(); - } // skip removes that would throw an error - // commonly happens during a rendition switch at the start of a video - // from start 0 to end 0 - - - if (end <= start) { - this.logger_('skipping remove because end ${end} is <= start ${start}'); - return; - } - - if (!this.sourceUpdater_ || !this.startingMediaInfo_) { - this.logger_('skipping remove because no source updater or starting media info'); // nothing to remove if we haven't processed any media - - return; - } // set it to one to complete this function's removes - - - var removesRemaining = 1; - - var removeFinished = function removeFinished() { - removesRemaining--; - - if (removesRemaining === 0) { - done(); - } - }; - - if (force || !this.audioDisabled_) { - removesRemaining++; - this.sourceUpdater_.removeAudio(start, end, removeFinished); - } // While it would be better to only remove video if the main loader has video, this - // should be safe with audio only as removeVideo will call back even if there's no - // video buffer. - // - // In theory we can check to see if there's video before calling the remove, but in - // the event that we're switching between renditions and from video to audio only - // (when we add support for that), we may need to clear the video contents despite - // what the new media will contain. - - - if (force || this.loaderType_ === 'main') { - this.gopBuffer_ = removeGopBuffer(this.gopBuffer_, start, end, this.timeMapping_); - removesRemaining++; - this.sourceUpdater_.removeVideo(start, end, removeFinished); - } // remove any captions and ID3 tags - - - for (var track in this.inbandTextTracks_) { - removeCuesFromTrack(start, end, this.inbandTextTracks_[track]); - } - - removeCuesFromTrack(start, end, this.segmentMetadataTrack_); // finished this function's removes - - removeFinished(); - } - /** - * (re-)schedule monitorBufferTick_ to run as soon as possible - * - * @private - */ - ; - - _proto.monitorBuffer_ = function monitorBuffer_() { - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - } - - this.checkBufferTimeout_ = window__default['default'].setTimeout(this.monitorBufferTick_.bind(this), 1); - } - /** - * As long as the SegmentLoader is in the READY state, periodically - * invoke fillBuffer_(). - * - * @private - */ - ; - - _proto.monitorBufferTick_ = function monitorBufferTick_() { - if (this.state === 'READY') { - this.fillBuffer_(); - } - - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - } - - this.checkBufferTimeout_ = window__default['default'].setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY); - } - /** - * fill the buffer with segements unless the sourceBuffers are - * currently updating - * - * Note: this function should only ever be called by monitorBuffer_ - * and never directly - * - * @private - */ - ; - - _proto.fillBuffer_ = function fillBuffer_() { - // TODO since the source buffer maintains a queue, and we shouldn't call this function - // except when we're ready for the next segment, this check can most likely be removed - if (this.sourceUpdater_.updating()) { - return; - } // see if we need to begin loading immediately - - - var segmentInfo = this.chooseNextRequest_(); - - if (!segmentInfo) { - return; - } - - if (typeof segmentInfo.timestampOffset === 'number') { - this.isPendingTimestampOffset_ = false; - this.timelineChangeController_.pendingTimelineChange({ - type: this.loaderType_, - from: this.currentTimeline_, - to: segmentInfo.timeline - }); - } - - this.loadSegment_(segmentInfo); - } - /** - * Determines if we should call endOfStream on the media source based - * on the state of the buffer or if appened segment was the final - * segment in the playlist. - * - * @param {number} [mediaIndex] the media index of segment we last appended - * @param {Object} [playlist] a media playlist object - * @return {boolean} do we need to call endOfStream on the MediaSource - */ - ; - - _proto.isEndOfStream_ = function isEndOfStream_(mediaIndex, playlist, partIndex) { - if (mediaIndex === void 0) { - mediaIndex = this.mediaIndex; - } - - if (playlist === void 0) { - playlist = this.playlist_; - } - - if (partIndex === void 0) { - partIndex = this.partIndex; - } - - if (!playlist || !this.mediaSource_) { - return false; - } - - var segment = typeof mediaIndex === 'number' && playlist.segments[mediaIndex]; // mediaIndex is zero based but length is 1 based - - var appendedLastSegment = mediaIndex + 1 === playlist.segments.length; // true if there are no parts, or this is the last part. - - var appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length; // if we've buffered to the end of the video, we need to call endOfStream - // so that MediaSources can trigger the `ended` event when it runs out of - // buffered data instead of waiting for me - - return playlist.endList && this.mediaSource_.readyState === 'open' && appendedLastSegment && appendedLastPart; - } - /** - * Determines what request should be made given current segment loader state. - * - * @return {Object} a request object that describes the segment/part to load - */ - ; - - _proto.chooseNextRequest_ = function chooseNextRequest_() { - var bufferedEnd = lastBufferedEnd(this.buffered_()) || 0; - var bufferedTime = Math.max(0, bufferedEnd - this.currentTime_()); - var preloaded = !this.hasPlayed_() && bufferedTime >= 1; - var haveEnoughBuffer = bufferedTime >= this.goalBufferLength_(); - var segments = this.playlist_.segments; // return no segment if: - // 1. we don't have segments - // 2. The video has not yet played and we already downloaded a segment - // 3. we already have enough buffered time - - if (!segments.length || preloaded || haveEnoughBuffer) { - return null; - } - - this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_()); - var next = { - partIndex: null, - mediaIndex: null, - startOfSegment: null, - playlist: this.playlist_, - isSyncRequest: Boolean(!this.syncPoint_) - }; - - if (next.isSyncRequest) { - next.mediaIndex = getSyncSegmentCandidate(this.currentTimeline_, segments, bufferedEnd); - } else if (this.mediaIndex !== null) { - var segment = segments[this.mediaIndex]; - var partIndex = typeof this.partIndex === 'number' ? this.partIndex : -1; - next.startOfSegment = segment.end ? segment.end : bufferedEnd; - - if (segment.parts && segment.parts[partIndex + 1]) { - next.mediaIndex = this.mediaIndex; - next.partIndex = partIndex + 1; - } else { - next.mediaIndex = this.mediaIndex + 1; - } - } else { - // Find the segment containing the end of the buffer or current time. - var _Playlist$getMediaInf = Playlist.getMediaInfoForTime({ - playlist: this.playlist_, - currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(), - startingPartIndex: this.syncPoint_.partIndex, - startingSegmentIndex: this.syncPoint_.segmentIndex, - startTime: this.syncPoint_.time - }), - segmentIndex = _Playlist$getMediaInf.segmentIndex, - startTime = _Playlist$getMediaInf.startTime, - _partIndex = _Playlist$getMediaInf.partIndex; - - next.getMediaInfoForTime = this.fetchAtBuffer_ ? 'bufferedEnd' : 'currentTime'; - next.mediaIndex = segmentIndex; - next.startOfSegment = startTime; - next.partIndex = _partIndex; - } - - var nextSegment = segments[next.mediaIndex]; - var nextPart = nextSegment && typeof next.partIndex === 'number' && nextSegment.parts && nextSegment.parts[next.partIndex]; // if the next segment index is invalid or - // the next partIndex is invalid do not choose a next segment. - - if (!nextSegment || typeof next.partIndex === 'number' && !nextPart) { - return null; - } // if the next segment has parts, and we don't have a partIndex. - // Set partIndex to 0 - - - if (typeof next.partIndex !== 'number' && nextSegment.parts) { - next.partIndex = 0; - } - - var ended = this.mediaSource_ && this.mediaSource_.readyState === 'ended'; // do not choose a next segment if all of the following: - // 1. this is the last segment in the playlist - // 2. end of stream has been called on the media source already - // 3. the player is not seeking - - if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) { - return null; - } - - return this.generateSegmentInfo_(next); - }; - - _proto.generateSegmentInfo_ = function generateSegmentInfo_(options) { - var playlist = options.playlist, - mediaIndex = options.mediaIndex, - startOfSegment = options.startOfSegment, - isSyncRequest = options.isSyncRequest, - partIndex = options.partIndex, - forceTimestampOffset = options.forceTimestampOffset, - getMediaInfoForTime = options.getMediaInfoForTime; - var segment = playlist.segments[mediaIndex]; - var part = typeof partIndex === 'number' && segment.parts[partIndex]; - var segmentInfo = { - requestId: 'segment-loader-' + Math.random(), - // resolve the segment URL relative to the playlist - uri: part && part.resolvedUri || segment.resolvedUri, - // the segment's mediaIndex at the time it was requested - mediaIndex: mediaIndex, - partIndex: part ? partIndex : null, - // whether or not to update the SegmentLoader's state with this - // segment's mediaIndex - isSyncRequest: isSyncRequest, - startOfSegment: startOfSegment, - // the segment's playlist - playlist: playlist, - // unencrypted bytes of the segment - bytes: null, - // when a key is defined for this segment, the encrypted bytes - encryptedBytes: null, - // The target timestampOffset for this segment when we append it - // to the source buffer - timestampOffset: null, - // The timeline that the segment is in - timeline: segment.timeline, - // The expected duration of the segment in seconds - duration: part && part.duration || segment.duration, - // retain the segment in case the playlist updates while doing an async process - segment: segment, - part: part, - byteLength: 0, - transmuxer: this.transmuxer_, - // type of getMediaInfoForTime that was used to get this segment - getMediaInfoForTime: getMediaInfoForTime - }; - var overrideCheck = typeof forceTimestampOffset !== 'undefined' ? forceTimestampOffset : this.isPendingTimestampOffset_; - segmentInfo.timestampOffset = this.timestampOffsetForSegment_({ - segmentTimeline: segment.timeline, - currentTimeline: this.currentTimeline_, - startOfSegment: startOfSegment, - buffered: this.buffered_(), - overrideCheck: overrideCheck - }); - var audioBufferedEnd = lastBufferedEnd(this.sourceUpdater_.audioBuffered()); - - if (typeof audioBufferedEnd === 'number') { - // since the transmuxer is using the actual timing values, but the buffer is - // adjusted by the timestamp offset, we must adjust the value here - segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset(); - } - - if (this.sourceUpdater_.videoBuffered().length) { - segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(this.gopBuffer_, // since the transmuxer is using the actual timing values, but the time is - // adjusted by the timestmap offset, we must adjust the value here - this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(), this.timeMapping_); - } - - return segmentInfo; - } // get the timestampoffset for a segment, - // added so that vtt segment loader can override and prevent - // adding timestamp offsets. - ; - - _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_(options) { - return timestampOffsetForSegment(options); - } - /** - * Determines if the network has enough bandwidth to complete the current segment - * request in a timely manner. If not, the request will be aborted early and bandwidth - * updated to trigger a playlist switch. - * - * @param {Object} stats - * Object containing stats about the request timing and size - * @private - */ - ; - - _proto.earlyAbortWhenNeeded_ = function earlyAbortWhenNeeded_(stats) { - if (this.vhs_.tech_.paused() || // Don't abort if the current playlist is on the lowestEnabledRendition - // TODO: Replace using timeout with a boolean indicating whether this playlist is - // the lowestEnabledRendition. - !this.xhrOptions_.timeout || // Don't abort if we have no bandwidth information to estimate segment sizes - !this.playlist_.attributes.BANDWIDTH) { - return; - } // Wait at least 1 second since the first byte of data has been received before - // using the calculated bandwidth from the progress event to allow the bitrate - // to stabilize - - - if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1000) { - return; - } - - var currentTime = this.currentTime_(); - var measuredBandwidth = stats.bandwidth; - var segmentDuration = this.pendingSegment_.duration; - var requestTimeRemaining = Playlist.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived); // Subtract 1 from the timeUntilRebuffer so we still consider an early abort - // if we are only left with less than 1 second when the request completes. - // A negative timeUntilRebuffering indicates we are already rebuffering - - var timeUntilRebuffer$1 = timeUntilRebuffer(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1; // Only consider aborting early if the estimated time to finish the download - // is larger than the estimated time until the player runs out of forward buffer - - if (requestTimeRemaining <= timeUntilRebuffer$1) { - return; - } - - var switchCandidate = minRebufferMaxBandwidthSelector({ - master: this.vhs_.playlists.master, - currentTime: currentTime, - bandwidth: measuredBandwidth, - duration: this.duration_(), - segmentDuration: segmentDuration, - timeUntilRebuffer: timeUntilRebuffer$1, - currentTimeline: this.currentTimeline_, - syncController: this.syncController_ - }); - - if (!switchCandidate) { - return; - } - - var rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$1; - var timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact; - var minimumTimeSaving = 0.5; // If we are already rebuffering, increase the amount of variance we add to the - // potential round trip time of the new request so that we are not too aggressive - // with switching to a playlist that might save us a fraction of a second. - - if (timeUntilRebuffer$1 <= TIME_FUDGE_FACTOR) { - minimumTimeSaving = 1; - } - - if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) { - return; - } // set the bandwidth to that of the desired playlist being sure to scale by - // BANDWIDTH_VARIANCE and add one so the playlist selector does not exclude it - // don't trigger a bandwidthupdate as the bandwidth is artifial - - - this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config.BANDWIDTH_VARIANCE + 1; - this.trigger('earlyabort'); - }; - - _proto.handleAbort_ = function handleAbort_(segmentInfo) { - this.logger_("Aborting " + segmentInfoString(segmentInfo)); - this.mediaRequestsAborted += 1; - } - /** - * XHR `progress` event handler - * - * @param {Event} - * The XHR `progress` event - * @param {Object} simpleSegment - * A simplified segment object copy - * @private - */ - ; - - _proto.handleProgress_ = function handleProgress_(event, simpleSegment) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - this.trigger('progress'); - }; - - _proto.handleTrackInfo_ = function handleTrackInfo_(simpleSegment, trackInfo) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - if (this.checkForIllegalMediaSwitch(trackInfo)) { - return; - } - - trackInfo = trackInfo || {}; // When we have track info, determine what media types this loader is dealing with. - // Guard against cases where we're not getting track info at all until we are - // certain that all streams will provide it. - - if (!shallowEqual(this.currentMediaInfo_, trackInfo)) { - this.appendInitSegment_ = { - audio: true, - video: true - }; - this.startingMediaInfo_ = trackInfo; - this.currentMediaInfo_ = trackInfo; - this.logger_('trackinfo update', trackInfo); - this.trigger('trackinfo'); - } // trackinfo may cause an abort if the trackinfo - // causes a codec change to an unsupported codec. - - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // set trackinfo on the pending segment so that - // it can append. - - - this.pendingSegment_.trackInfo = trackInfo; // check if any calls were waiting on the track info - - if (this.hasEnoughInfoToAppend_()) { - this.processCallQueue_(); - } - }; - - _proto.handleTimingInfo_ = function handleTimingInfo_(simpleSegment, mediaType, timeType, time) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - var segmentInfo = this.pendingSegment_; - var timingInfoProperty = timingInfoPropertyForMedia(mediaType); - segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {}; - segmentInfo[timingInfoProperty][timeType] = time; - this.logger_("timinginfo: " + mediaType + " - " + timeType + " - " + time); // check if any calls were waiting on the timing info - - if (this.hasEnoughInfoToAppend_()) { - this.processCallQueue_(); - } - }; - - _proto.handleCaptions_ = function handleCaptions_(simpleSegment, captionData) { - var _this2 = this; - - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // This could only happen with fmp4 segments, but - // should still not happen in general - - - if (captionData.length === 0) { - this.logger_('SegmentLoader received no captions from a caption event'); - return; - } - - var segmentInfo = this.pendingSegment_; // Wait until we have some video data so that caption timing - // can be adjusted by the timestamp offset - - if (!segmentInfo.hasAppendedData_) { - this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData)); - return; - } - - var timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset(); - var captionTracks = {}; // get total start/end and captions for each track/stream - - captionData.forEach(function (caption) { - // caption.stream is actually a track name... - // set to the existing values in tracks or default values - captionTracks[caption.stream] = captionTracks[caption.stream] || { - // Infinity, as any other value will be less than this - startTime: Infinity, - captions: [], - // 0 as an other value will be more than this - endTime: 0 - }; - var captionTrack = captionTracks[caption.stream]; - captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset); - captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset); - captionTrack.captions.push(caption); - }); - Object.keys(captionTracks).forEach(function (trackName) { - var _captionTracks$trackN = captionTracks[trackName], - startTime = _captionTracks$trackN.startTime, - endTime = _captionTracks$trackN.endTime, - captions = _captionTracks$trackN.captions; - var inbandTextTracks = _this2.inbandTextTracks_; - - _this2.logger_("adding cues from " + startTime + " -> " + endTime + " for " + trackName); - - createCaptionsTrackIfNotExists(inbandTextTracks, _this2.vhs_.tech_, trackName); // clear out any cues that start and end at the same time period for the same track. - // We do this because a rendition change that also changes the timescale for captions - // will result in captions being re-parsed for certain segments. If we add them again - // without clearing we will have two of the same captions visible. - - removeCuesFromTrack(startTime, endTime, inbandTextTracks[trackName]); - addCaptionData({ - captionArray: captions, - inbandTextTracks: inbandTextTracks, - timestampOffset: timestampOffset - }); - }); // Reset stored captions since we added parsed - // captions to a text track at this point - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearParsedMp4Captions' - }); - } - }; - - _proto.handleId3_ = function handleId3_(simpleSegment, id3Frames, dispatchType) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - var segmentInfo = this.pendingSegment_; // we need to have appended data in order for the timestamp offset to be set - - if (!segmentInfo.hasAppendedData_) { - this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType)); - return; - } - - var timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset(); // There's potentially an issue where we could double add metadata if there's a muxed - // audio/video source with a metadata track, and an alt audio with a metadata track. - // However, this probably won't happen, and if it does it can be handled then. - - createMetadataTrackIfNotExists(this.inbandTextTracks_, dispatchType, this.vhs_.tech_); - addMetadata({ - inbandTextTracks: this.inbandTextTracks_, - metadataArray: id3Frames, - timestampOffset: timestampOffset, - videoDuration: this.duration_() - }); - }; - - _proto.processMetadataQueue_ = function processMetadataQueue_() { - this.metadataQueue_.id3.forEach(function (fn) { - return fn(); - }); - this.metadataQueue_.caption.forEach(function (fn) { - return fn(); - }); - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - }; - - _proto.processCallQueue_ = function processCallQueue_() { - var callQueue = this.callQueue_; // Clear out the queue before the queued functions are run, since some of the - // functions may check the length of the load queue and default to pushing themselves - // back onto the queue. - - this.callQueue_ = []; - callQueue.forEach(function (fun) { - return fun(); - }); - }; - - _proto.processLoadQueue_ = function processLoadQueue_() { - var loadQueue = this.loadQueue_; // Clear out the queue before the queued functions are run, since some of the - // functions may check the length of the load queue and default to pushing themselves - // back onto the queue. - - this.loadQueue_ = []; - loadQueue.forEach(function (fun) { - return fun(); - }); - } - /** - * Determines whether the loader has enough info to load the next segment. - * - * @return {boolean} - * Whether or not the loader has enough info to load the next segment - */ - ; - - _proto.hasEnoughInfoToLoad_ = function hasEnoughInfoToLoad_() { - // Since primary timing goes by video, only the audio loader potentially needs to wait - // to load. - if (this.loaderType_ !== 'audio') { - return true; - } - - var segmentInfo = this.pendingSegment_; // A fill buffer must have already run to establish a pending segment before there's - // enough info to load. - - if (!segmentInfo) { - return false; - } // The first segment can and should be loaded immediately so that source buffers are - // created together (before appending). Source buffer creation uses the presence of - // audio and video data to determine whether to create audio/video source buffers, and - // uses processed (transmuxed or parsed) media to determine the types required. - - - if (!this.currentMediaInfo_) { - return true; - } - - if ( // Technically, instead of waiting to load a segment on timeline changes, a segment - // can be requested and downloaded and only wait before it is transmuxed or parsed. - // But in practice, there are a few reasons why it is better to wait until a loader - // is ready to append that segment before requesting and downloading: - // - // 1. Because audio and main loaders cross discontinuities together, if this loader - // is waiting for the other to catch up, then instead of requesting another - // segment and using up more bandwidth, by not yet loading, more bandwidth is - // allotted to the loader currently behind. - // 2. media-segment-request doesn't have to have logic to consider whether a segment - // is ready to be processed or not, isolating the queueing behavior to the loader. - // 3. The audio loader bases some of its segment properties on timing information - // provided by the main loader, meaning that, if the logic for waiting on - // processing was in media-segment-request, then it would also need to know how - // to re-generate the segment information after the main loader caught up. - shouldWaitForTimelineChange({ - timelineChangeController: this.timelineChangeController_, - currentTimeline: this.currentTimeline_, - segmentTimeline: segmentInfo.timeline, - loaderType: this.loaderType_, - audioDisabled: this.audioDisabled_ - })) { - return false; - } - - return true; - }; - - _proto.hasEnoughInfoToAppend_ = function hasEnoughInfoToAppend_() { - if (!this.sourceUpdater_.ready()) { - return false; - } // If content needs to be removed or the loader is waiting on an append reattempt, - // then no additional content should be appended until the prior append is resolved. - - - if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) { - return false; - } - - var segmentInfo = this.pendingSegment_; // no segment to append any data for or - // we do not have information on this specific - // segment yet - - if (!segmentInfo || !segmentInfo.trackInfo) { - return false; - } - - var _this$currentMediaInf = this.currentMediaInfo_, - hasAudio = _this$currentMediaInf.hasAudio, - hasVideo = _this$currentMediaInf.hasVideo, - isMuxed = _this$currentMediaInf.isMuxed; - - if (hasVideo && !segmentInfo.videoTimingInfo) { - return false; - } // muxed content only relies on video timing information for now. - - - if (hasAudio && !this.audioDisabled_ && !isMuxed && !segmentInfo.audioTimingInfo) { - return false; - } - - if (shouldWaitForTimelineChange({ - timelineChangeController: this.timelineChangeController_, - currentTimeline: this.currentTimeline_, - segmentTimeline: segmentInfo.timeline, - loaderType: this.loaderType_, - audioDisabled: this.audioDisabled_ - })) { - return false; - } - - return true; - }; - - _proto.handleData_ = function handleData_(simpleSegment, result) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // If there's anything in the call queue, then this data came later and should be - // executed after the calls currently queued. - - - if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) { - this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result)); - return; - } - - var segmentInfo = this.pendingSegment_; // update the time mapping so we can translate from display time to media time - - this.setTimeMapping_(segmentInfo.timeline); // for tracking overall stats - - this.updateMediaSecondsLoaded_(segmentInfo.segment); // Note that the state isn't changed from loading to appending. This is because abort - // logic may change behavior depending on the state, and changing state too early may - // inflate our estimates of bandwidth. In the future this should be re-examined to - // note more granular states. - // don't process and append data if the mediaSource is closed - - if (this.mediaSource_.readyState === 'closed') { - return; - } // if this request included an initialization segment, save that data - // to the initSegment cache - - - if (simpleSegment.map) { - simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true); // move over init segment properties to media request - - segmentInfo.segment.map = simpleSegment.map; - } // if this request included a segment key, save that data in the cache - - - if (simpleSegment.key) { - this.segmentKey(simpleSegment.key, true); - } - - segmentInfo.isFmp4 = simpleSegment.isFmp4; - segmentInfo.timingInfo = segmentInfo.timingInfo || {}; - - if (segmentInfo.isFmp4) { - this.trigger('fmp4'); - segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia(result.type)].start; - } else { - var useVideoTimingInfo = this.loaderType_ === 'main' && this.currentMediaInfo_.hasVideo; - var firstVideoFrameTimeForData; - - if (useVideoTimingInfo) { - firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start; - } // Segment loader knows more about segment timing than the transmuxer (in certain - // aspects), so make any changes required for a more accurate start time. - // Don't set the end time yet, as the segment may not be finished processing. - - - segmentInfo.timingInfo.start = this.trueSegmentStart_({ - currentStart: segmentInfo.timingInfo.start, - playlist: segmentInfo.playlist, - mediaIndex: segmentInfo.mediaIndex, - currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(), - useVideoTimingInfo: useVideoTimingInfo, - firstVideoFrameTimeForData: firstVideoFrameTimeForData, - videoTimingInfo: segmentInfo.videoTimingInfo, - audioTimingInfo: segmentInfo.audioTimingInfo - }); - } // Init segments for audio and video only need to be appended in certain cases. Now - // that data is about to be appended, we can check the final cases to determine - // whether we should append an init segment. - - - this.updateAppendInitSegmentStatus(segmentInfo, result.type); // Timestamp offset should be updated once we get new data and have its timing info, - // as we use the start of the segment to offset the best guess (playlist provided) - // timestamp offset. - - this.updateSourceBufferTimestampOffset_(segmentInfo); // if this is a sync request we need to determine whether it should - // be appended or not. - - if (segmentInfo.isSyncRequest) { - // first save/update our timing info for this segment. - // this is what allows us to choose an accurate segment - // and the main reason we make a sync request. - this.updateTimingInfoEnd_(segmentInfo); - this.syncController_.saveSegmentTimingInfo({ - segmentInfo: segmentInfo, - shouldSaveTimelineMapping: this.loaderType_ === 'main' - }); - var next = this.chooseNextRequest_(); // If the sync request isn't the segment that would be requested next - // after taking into account its timing info, do not append it. - - if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) { - this.logger_('sync segment was incorrect, not appending'); - return; - } // otherwise append it like any other segment as our guess was correct. - - - this.logger_('sync segment was correct, appending'); - } // Save some state so that in the future anything waiting on first append (and/or - // timestamp offset(s)) can process immediately. While the extra state isn't optimal, - // we need some notion of whether the timestamp offset or other relevant information - // has had a chance to be set. - - - segmentInfo.hasAppendedData_ = true; // Now that the timestamp offset should be set, we can append any waiting ID3 tags. - - this.processMetadataQueue_(); - this.appendData_(segmentInfo, result); - }; - - _proto.updateAppendInitSegmentStatus = function updateAppendInitSegmentStatus(segmentInfo, type) { - // alt audio doesn't manage timestamp offset - if (this.loaderType_ === 'main' && typeof segmentInfo.timestampOffset === 'number' && // in the case that we're handling partial data, we don't want to append an init - // segment for each chunk - !segmentInfo.changedTimestampOffset) { - // if the timestamp offset changed, the timeline may have changed, so we have to re- - // append init segments - this.appendInitSegment_ = { - audio: true, - video: true - }; - } - - if (this.playlistOfLastInitSegment_[type] !== segmentInfo.playlist) { - // make sure we append init segment on playlist changes, in case the media config - // changed - this.appendInitSegment_[type] = true; - } - }; - - _proto.getInitSegmentAndUpdateState_ = function getInitSegmentAndUpdateState_(_ref4) { - var type = _ref4.type, - initSegment = _ref4.initSegment, - map = _ref4.map, - playlist = _ref4.playlist; - - // "The EXT-X-MAP tag specifies how to obtain the Media Initialization Section - // (Section 3) required to parse the applicable Media Segments. It applies to every - // Media Segment that appears after it in the Playlist until the next EXT-X-MAP tag - // or until the end of the playlist." - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.5 - if (map) { - var id = initSegmentId(map); - - if (this.activeInitSegmentId_ === id) { - // don't need to re-append the init segment if the ID matches - return null; - } // a map-specified init segment takes priority over any transmuxed (or otherwise - // obtained) init segment - // - // this also caches the init segment for later use - - - initSegment = this.initSegmentForMap(map, true).bytes; - this.activeInitSegmentId_ = id; - } // We used to always prepend init segments for video, however, that shouldn't be - // necessary. Instead, we should only append on changes, similar to what we've always - // done for audio. This is more important (though may not be that important) for - // frame-by-frame appending for LHLS, simply because of the increased quantity of - // appends. - - - if (initSegment && this.appendInitSegment_[type]) { - // Make sure we track the playlist that we last used for the init segment, so that - // we can re-append the init segment in the event that we get data from a new - // playlist. Discontinuities and track changes are handled in other sections. - this.playlistOfLastInitSegment_[type] = playlist; // Disable future init segment appends for this type. Until a change is necessary. - - this.appendInitSegment_[type] = false; // we need to clear out the fmp4 active init segment id, since - // we are appending the muxer init segment - - this.activeInitSegmentId_ = null; - return initSegment; - } - - return null; - }; - - _proto.handleQuotaExceededError_ = function handleQuotaExceededError_(_ref5, error) { - var _this3 = this; - - var segmentInfo = _ref5.segmentInfo, - type = _ref5.type, - bytes = _ref5.bytes; - var audioBuffered = this.sourceUpdater_.audioBuffered(); - var videoBuffered = this.sourceUpdater_.videoBuffered(); // For now we're ignoring any notion of gaps in the buffer, but they, in theory, - // should be cleared out during the buffer removals. However, log in case it helps - // debug. - - if (audioBuffered.length > 1) { - this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: ' + timeRangesToArray(audioBuffered).join(', ')); - } - - if (videoBuffered.length > 1) { - this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: ' + timeRangesToArray(videoBuffered).join(', ')); - } - - var audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0; - var audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0; - var videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0; - var videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0; - - if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER) { - // Can't remove enough buffer to make room for new segment (or the browser doesn't - // allow for appends of segments this size). In the future, it may be possible to - // split up the segment and append in pieces, but for now, error out this playlist - // in an attempt to switch to a more manageable rendition. - this.logger_('On QUOTA_EXCEEDED_ERR, single segment too large to append to ' + 'buffer, triggering an error. ' + ("Appended byte length: " + bytes.byteLength + ", ") + ("audio buffer: " + timeRangesToArray(audioBuffered).join(', ') + ", ") + ("video buffer: " + timeRangesToArray(videoBuffered).join(', ') + ", ")); - this.error({ - message: 'Quota exceeded error with append of a single segment of content', - excludeUntil: Infinity - }); - this.trigger('error'); - return; - } // To try to resolve the quota exceeded error, clear back buffer and retry. This means - // that the segment-loader should block on future events until this one is handled, so - // that it doesn't keep moving onto further segments. Adding the call to the call - // queue will prevent further appends until waitingOnRemove_ and - // quotaExceededErrorRetryTimeout_ are cleared. - // - // Note that this will only block the current loader. In the case of demuxed content, - // the other load may keep filling as fast as possible. In practice, this should be - // OK, as it is a rare case when either audio has a high enough bitrate to fill up a - // source buffer, or video fills without enough room for audio to append (and without - // the availability of clearing out seconds of back buffer to make room for audio). - // But it might still be good to handle this case in the future as a TODO. - - - this.waitingOnRemove_ = true; - this.callQueue_.push(this.appendToSourceBuffer_.bind(this, { - segmentInfo: segmentInfo, - type: type, - bytes: bytes - })); - var currentTime = this.currentTime_(); // Try to remove as much audio and video as possible to make room for new content - // before retrying. - - var timeToRemoveUntil = currentTime - MIN_BACK_BUFFER; - this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to " + timeToRemoveUntil); - this.remove(0, timeToRemoveUntil, function () { - _this3.logger_("On QUOTA_EXCEEDED_ERR, retrying append in " + MIN_BACK_BUFFER + "s"); - - _this3.waitingOnRemove_ = false; // wait the length of time alotted in the back buffer to prevent wasted - // attempts (since we can't clear less than the minimum) - - _this3.quotaExceededErrorRetryTimeout_ = window__default['default'].setTimeout(function () { - _this3.logger_('On QUOTA_EXCEEDED_ERR, re-processing call queue'); - - _this3.quotaExceededErrorRetryTimeout_ = null; - - _this3.processCallQueue_(); - }, MIN_BACK_BUFFER * 1000); - }, true); - }; - - _proto.handleAppendError_ = function handleAppendError_(_ref6, error) { - var segmentInfo = _ref6.segmentInfo, - type = _ref6.type, - bytes = _ref6.bytes; - - // if there's no error, nothing to do - if (!error) { - return; - } - - if (error.code === QUOTA_EXCEEDED_ERR) { - this.handleQuotaExceededError_({ - segmentInfo: segmentInfo, - type: type, - bytes: bytes - }); // A quota exceeded error should be recoverable with a future re-append, so no need - // to trigger an append error. - - return; - } - - this.logger_('Received non QUOTA_EXCEEDED_ERR on append', error); - this.error(type + " append of " + bytes.length + "b failed for segment " + ("#" + segmentInfo.mediaIndex + " in playlist " + segmentInfo.playlist.id)); // If an append errors, we often can't recover. - // (see https://w3c.github.io/media-source/#sourcebuffer-append-error). - // - // Trigger a special error so that it can be handled separately from normal, - // recoverable errors. - - this.trigger('appenderror'); - }; - - _proto.appendToSourceBuffer_ = function appendToSourceBuffer_(_ref7) { - var segmentInfo = _ref7.segmentInfo, - type = _ref7.type, - initSegment = _ref7.initSegment, - data = _ref7.data, - bytes = _ref7.bytes; - - // If this is a re-append, bytes were already created and don't need to be recreated - if (!bytes) { - var segments = [data]; - var byteLength = data.byteLength; - - if (initSegment) { - // if the media initialization segment is changing, append it before the content - // segment - segments.unshift(initSegment); - byteLength += initSegment.byteLength; - } // Technically we should be OK appending the init segment separately, however, we - // haven't yet tested that, and prepending is how we have always done things. - - - bytes = concatSegments({ - bytes: byteLength, - segments: segments - }); - } - - this.sourceUpdater_.appendBuffer({ - segmentInfo: segmentInfo, - type: type, - bytes: bytes - }, this.handleAppendError_.bind(this, { - segmentInfo: segmentInfo, - type: type, - bytes: bytes - })); - }; - - _proto.handleSegmentTimingInfo_ = function handleSegmentTimingInfo_(type, requestId, segmentTimingInfo) { - if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) { - return; - } - - var segment = this.pendingSegment_.segment; - var timingInfoProperty = type + "TimingInfo"; - - if (!segment[timingInfoProperty]) { - segment[timingInfoProperty] = {}; - } - - segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0; - segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation; - segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode; - segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation; - segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode; // mainly used as a reference for debugging - - segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime; - }; - - _proto.appendData_ = function appendData_(segmentInfo, result) { - var type = result.type, - data = result.data; - - if (!data || !data.byteLength) { - return; - } - - if (type === 'audio' && this.audioDisabled_) { - return; - } - - var initSegment = this.getInitSegmentAndUpdateState_({ - type: type, - initSegment: result.initSegment, - playlist: segmentInfo.playlist, - map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null - }); - this.appendToSourceBuffer_({ - segmentInfo: segmentInfo, - type: type, - initSegment: initSegment, - data: data - }); - } - /** - * load a specific segment from a request into the buffer - * - * @private - */ - ; - - _proto.loadSegment_ = function loadSegment_(segmentInfo) { - var _this4 = this; - - this.state = 'WAITING'; - this.pendingSegment_ = segmentInfo; - this.trimBackBuffer_(segmentInfo); - - if (typeof segmentInfo.timestampOffset === 'number') { - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearAllMp4Captions' - }); - } - } - - if (!this.hasEnoughInfoToLoad_()) { - this.loadQueue_.push(function () { - // regenerate the audioAppendStart, timestampOffset, etc as they - // may have changed since this function was added to the queue. - var options = _extends__default['default']({}, segmentInfo, { - forceTimestampOffset: true - }); - - _extends__default['default'](segmentInfo, _this4.generateSegmentInfo_(options)); - - _this4.isPendingTimestampOffset_ = false; - - _this4.updateTransmuxerAndRequestSegment_(segmentInfo); - }); - return; - } - - this.updateTransmuxerAndRequestSegment_(segmentInfo); - }; - - _proto.updateTransmuxerAndRequestSegment_ = function updateTransmuxerAndRequestSegment_(segmentInfo) { - var _this5 = this; - - // We'll update the source buffer's timestamp offset once we have transmuxed data, but - // the transmuxer still needs to be updated before then. - // - // Even though keepOriginalTimestamps is set to true for the transmuxer, timestamp - // offset must be passed to the transmuxer for stream correcting adjustments. - if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) { - this.gopBuffer_.length = 0; // gopsToAlignWith was set before the GOP buffer was cleared - - segmentInfo.gopsToAlignWith = []; - this.timeMapping_ = 0; // reset values in the transmuxer since a discontinuity should start fresh - - this.transmuxer_.postMessage({ - action: 'reset' - }); - this.transmuxer_.postMessage({ - action: 'setTimestampOffset', - timestampOffset: segmentInfo.timestampOffset - }); - } - - var simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo); - var isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex); - var isWalkingForward = this.mediaIndex !== null; - var isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && // currentTimeline starts at -1, so we shouldn't end the timeline switching to 0, - // the first timeline - segmentInfo.timeline > 0; - var isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity; - this.logger_("Requesting " + segmentInfoString(segmentInfo)); // If there's an init segment associated with this segment, but it is not cached (identified by a lack of bytes), - // then this init segment has never been seen before and should be appended. - // - // At this point the content type (audio/video or both) is not yet known, but it should be safe to set - // both to true and leave the decision of whether to append the init segment to append time. - - if (simpleSegment.map && !simpleSegment.map.bytes) { - this.logger_('going to request init segment.'); - this.appendInitSegment_ = { - video: true, - audio: true - }; - } - - segmentInfo.abortRequests = mediaSegmentRequest({ - xhr: this.vhs_.xhr, - xhrOptions: this.xhrOptions_, - decryptionWorker: this.decrypter_, - segment: simpleSegment, - abortFn: this.handleAbort_.bind(this, segmentInfo), - progressFn: this.handleProgress_.bind(this), - trackInfoFn: this.handleTrackInfo_.bind(this), - timingInfoFn: this.handleTimingInfo_.bind(this), - videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'video', segmentInfo.requestId), - audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'audio', segmentInfo.requestId), - captionsFn: this.handleCaptions_.bind(this), - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: function endedTimelineFn() { - _this5.logger_('received endedtimeline callback'); - }, - id3Fn: this.handleId3_.bind(this), - dataFn: this.handleData_.bind(this), - doneFn: this.segmentRequestFinished_.bind(this) - }); - } - /** - * trim the back buffer so that we don't have too much data - * in the source buffer - * - * @private - * - * @param {Object} segmentInfo - the current segment - */ - ; - - _proto.trimBackBuffer_ = function trimBackBuffer_(segmentInfo) { - var removeToTime = safeBackBufferTrimTime(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10); // Chrome has a hard limit of 150MB of - // buffer and a very conservative "garbage collector" - // We manually clear out the old buffer to ensure - // we don't trigger the QuotaExceeded error - // on the source buffer during subsequent appends - - if (removeToTime > 0) { - this.remove(0, removeToTime); - } - } - /** - * created a simplified copy of the segment object with just the - * information necessary to perform the XHR and decryption - * - * @private - * - * @param {Object} segmentInfo - the current segment - * @return {Object} a simplified segment object copy - */ - ; - - _proto.createSimplifiedSegmentObj_ = function createSimplifiedSegmentObj_(segmentInfo) { - var segment = segmentInfo.segment; - var part = segmentInfo.part; - var simpleSegment = { - resolvedUri: part ? part.resolvedUri : segment.resolvedUri, - byterange: part ? part.byterange : segment.byterange, - requestId: segmentInfo.requestId, - transmuxer: segmentInfo.transmuxer, - audioAppendStart: segmentInfo.audioAppendStart, - gopsToAlignWith: segmentInfo.gopsToAlignWith, - part: segmentInfo.part - }; - var previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1]; - - if (previousSegment && previousSegment.timeline === segment.timeline) { - // The baseStartTime of a segment is used to handle rollover when probing the TS - // segment to retrieve timing information. Since the probe only looks at the media's - // times (e.g., PTS and DTS values of the segment), and doesn't consider the - // player's time (e.g., player.currentTime()), baseStartTime should reflect the - // media time as well. transmuxedDecodeEnd represents the end time of a segment, in - // seconds of media time, so should be used here. The previous segment is used since - // the end of the previous segment should represent the beginning of the current - // segment, so long as they are on the same timeline. - if (previousSegment.videoTimingInfo) { - simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd; - } else if (previousSegment.audioTimingInfo) { - simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd; - } - } - - if (segment.key) { - // if the media sequence is greater than 2^32, the IV will be incorrect - // assuming 10s segments, that would be about 1300 years - var iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]); - simpleSegment.key = this.segmentKey(segment.key); - simpleSegment.key.iv = iv; - } - - if (segment.map) { - simpleSegment.map = this.initSegmentForMap(segment.map); - } - - return simpleSegment; - }; - - _proto.saveTransferStats_ = function saveTransferStats_(stats) { - // every request counts as a media request even if it has been aborted - // or canceled due to a timeout - this.mediaRequests += 1; - - if (stats) { - this.mediaBytesTransferred += stats.bytesReceived; - this.mediaTransferDuration += stats.roundTripTime; - } - }; - - _proto.saveBandwidthRelatedStats_ = function saveBandwidthRelatedStats_(duration, stats) { - // byteLength will be used for throughput, and should be based on bytes receieved, - // which we only know at the end of the request and should reflect total bytes - // downloaded rather than just bytes processed from components of the segment - this.pendingSegment_.byteLength = stats.bytesReceived; - - if (duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) { - this.logger_("Ignoring segment's bandwidth because its duration of " + duration + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS)); - return; - } - - this.bandwidth = stats.bandwidth; - this.roundTrip = stats.roundTripTime; - }; - - _proto.handleTimeout_ = function handleTimeout_() { - // although the VTT segment loader bandwidth isn't really used, it's good to - // maintain functinality between segment loaders - this.mediaRequestsTimedout += 1; - this.bandwidth = 1; - this.roundTrip = NaN; - this.trigger('bandwidthupdate'); - } - /** - * Handle the callback from the segmentRequest function and set the - * associated SegmentLoader state and errors if necessary - * - * @private - */ - ; - - _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) { - // TODO handle special cases, e.g., muxed audio/video but only audio in the segment - // check the call queue directly since this function doesn't need to deal with any - // data, and can continue even if the source buffers are not set up and we didn't get - // any data from the segment - if (this.callQueue_.length) { - this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result)); - return; - } - - this.saveTransferStats_(simpleSegment.stats); // The request was aborted and the SegmentLoader has already been reset - - if (!this.pendingSegment_) { - return; - } // the request was aborted and the SegmentLoader has already started - // another request. this can happen when the timeout for an aborted - // request triggers due to a limitation in the XHR library - // do not count this as any sort of request or we risk double-counting - - - if (simpleSegment.requestId !== this.pendingSegment_.requestId) { - return; - } // an error occurred from the active pendingSegment_ so reset everything - - - if (error) { - this.pendingSegment_ = null; - this.state = 'READY'; // aborts are not a true error condition and nothing corrective needs to be done - - if (error.code === REQUEST_ERRORS.ABORTED) { - return; - } - - this.pause(); // the error is really just that at least one of the requests timed-out - // set the bandwidth to a very low value and trigger an ABR switch to - // take emergency action - - if (error.code === REQUEST_ERRORS.TIMEOUT) { - this.handleTimeout_(); - return; - } // if control-flow has arrived here, then the error is real - // emit an error event to blacklist the current playlist - - - this.mediaRequestsErrored += 1; - this.error(error); - this.trigger('error'); - return; - } - - var segmentInfo = this.pendingSegment_; // the response was a success so set any bandwidth stats the request - // generated for ABR purposes - - this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats); - segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests; - - if (result.gopInfo) { - this.gopBuffer_ = updateGopBuffer(this.gopBuffer_, result.gopInfo, this.safeAppend_); - } // Although we may have already started appending on progress, we shouldn't switch the - // state away from loading until we are officially done loading the segment data. - - - this.state = 'APPENDING'; // used for testing - - this.trigger('appending'); - this.waitForAppendsToComplete_(segmentInfo); - }; - - _proto.setTimeMapping_ = function setTimeMapping_(timeline) { - var timelineMapping = this.syncController_.mappingForTimeline(timeline); - - if (timelineMapping !== null) { - this.timeMapping_ = timelineMapping; - } - }; - - _proto.updateMediaSecondsLoaded_ = function updateMediaSecondsLoaded_(segment) { - if (typeof segment.start === 'number' && typeof segment.end === 'number') { - this.mediaSecondsLoaded += segment.end - segment.start; - } else { - this.mediaSecondsLoaded += segment.duration; - } - }; - - _proto.shouldUpdateTransmuxerTimestampOffset_ = function shouldUpdateTransmuxerTimestampOffset_(timestampOffset) { - if (timestampOffset === null) { - return false; - } // note that we're potentially using the same timestamp offset for both video and - // audio - - - if (this.loaderType_ === 'main' && timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) { - return true; - } - - if (!this.audioDisabled_ && timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) { - return true; - } - - return false; - }; - - _proto.trueSegmentStart_ = function trueSegmentStart_(_ref8) { - var currentStart = _ref8.currentStart, - playlist = _ref8.playlist, - mediaIndex = _ref8.mediaIndex, - firstVideoFrameTimeForData = _ref8.firstVideoFrameTimeForData, - currentVideoTimestampOffset = _ref8.currentVideoTimestampOffset, - useVideoTimingInfo = _ref8.useVideoTimingInfo, - videoTimingInfo = _ref8.videoTimingInfo, - audioTimingInfo = _ref8.audioTimingInfo; - - if (typeof currentStart !== 'undefined') { - // if start was set once, keep using it - return currentStart; - } - - if (!useVideoTimingInfo) { - return audioTimingInfo.start; - } - - var previousSegment = playlist.segments[mediaIndex - 1]; // The start of a segment should be the start of the first full frame contained - // within that segment. Since the transmuxer maintains a cache of incomplete data - // from and/or the last frame seen, the start time may reflect a frame that starts - // in the previous segment. Check for that case and ensure the start time is - // accurate for the segment. - - if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === 'undefined' || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) { - return firstVideoFrameTimeForData; - } - - return videoTimingInfo.start; - }; - - _proto.waitForAppendsToComplete_ = function waitForAppendsToComplete_(segmentInfo) { - if (!this.currentMediaInfo_) { - this.error({ - message: 'No starting media returned, likely due to an unsupported media format.', - blacklistDuration: Infinity - }); - this.trigger('error'); - return; - } // Although transmuxing is done, appends may not yet be finished. Throw a marker - // on each queue this loader is responsible for to ensure that the appends are - // complete. - - - var _this$currentMediaInf2 = this.currentMediaInfo_, - hasAudio = _this$currentMediaInf2.hasAudio, - hasVideo = _this$currentMediaInf2.hasVideo, - isMuxed = _this$currentMediaInf2.isMuxed; - var waitForVideo = this.loaderType_ === 'main' && hasVideo; - var waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed; - segmentInfo.waitingOnAppends = 0; // segments with no data - - if (!segmentInfo.hasAppendedData_) { - if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === 'number') { - // When there's no audio or video data in the segment, there's no audio or video - // timing information. - // - // If there's no audio or video timing information, then the timestamp offset - // can't be adjusted to the appropriate value for the transmuxer and source - // buffers. - // - // Therefore, the next segment should be used to set the timestamp offset. - this.isPendingTimestampOffset_ = true; - } // override settings for metadata only segments - - - segmentInfo.timingInfo = { - start: 0 - }; - segmentInfo.waitingOnAppends++; - - if (!this.isPendingTimestampOffset_) { - // update the timestampoffset - this.updateSourceBufferTimestampOffset_(segmentInfo); // make sure the metadata queue is processed even though we have - // no video/audio data. - - this.processMetadataQueue_(); - } // append is "done" instantly with no data. - - - this.checkAppendsDone_(segmentInfo); - return; - } // Since source updater could call back synchronously, do the increments first. - - - if (waitForVideo) { - segmentInfo.waitingOnAppends++; - } - - if (waitForAudio) { - segmentInfo.waitingOnAppends++; - } - - if (waitForVideo) { - this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo)); - } - - if (waitForAudio) { - this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo)); - } - }; - - _proto.checkAppendsDone_ = function checkAppendsDone_(segmentInfo) { - if (this.checkForAbort_(segmentInfo.requestId)) { - return; - } - - segmentInfo.waitingOnAppends--; - - if (segmentInfo.waitingOnAppends === 0) { - this.handleAppendsDone_(); - } - }; - - _proto.checkForIllegalMediaSwitch = function checkForIllegalMediaSwitch(trackInfo) { - var illegalMediaSwitchError = illegalMediaSwitch(this.loaderType_, this.currentMediaInfo_, trackInfo); - - if (illegalMediaSwitchError) { - this.error({ - message: illegalMediaSwitchError, - blacklistDuration: Infinity - }); - this.trigger('error'); - return true; - } - - return false; - }; - - _proto.updateSourceBufferTimestampOffset_ = function updateSourceBufferTimestampOffset_(segmentInfo) { - if (segmentInfo.timestampOffset === null || // we don't yet have the start for whatever media type (video or audio) has - // priority, timing-wise, so we must wait - typeof segmentInfo.timingInfo.start !== 'number' || // already updated the timestamp offset for this segment - segmentInfo.changedTimestampOffset || // the alt audio loader should not be responsible for setting the timestamp offset - this.loaderType_ !== 'main') { - return; - } - - var didChange = false; // Primary timing goes by video, and audio is trimmed in the transmuxer, meaning that - // the timing info here comes from video. In the event that the audio is longer than - // the video, this will trim the start of the audio. - // This also trims any offset from 0 at the beginning of the media - - segmentInfo.timestampOffset -= segmentInfo.timingInfo.start; // In the event that there are part segment downloads, each will try to update the - // timestamp offset. Retaining this bit of state prevents us from updating in the - // future (within the same segment), however, there may be a better way to handle it. - - segmentInfo.changedTimestampOffset = true; - - if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) { - this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset); - didChange = true; - } - - if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) { - this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset); - didChange = true; - } - - if (didChange) { - this.trigger('timestampoffset'); - } - }; - - _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_(segmentInfo) { - segmentInfo.timingInfo = segmentInfo.timingInfo || {}; - var useVideoTimingInfo = this.loaderType_ === 'main' && this.currentMediaInfo_.hasVideo; - var prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo; - - if (!prioritizedTimingInfo) { - return; - } - - segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === 'number' ? // End time may not exist in a case where we aren't parsing the full segment (one - // current example is the case of fmp4), so use the rough duration to calculate an - // end time. - prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration; - } - /** - * callback to run when appendBuffer is finished. detects if we are - * in a good state to do things with the data we got, or if we need - * to wait for more - * - * @private - */ - ; - - _proto.handleAppendsDone_ = function handleAppendsDone_() { - // appendsdone can cause an abort - if (this.pendingSegment_) { - this.trigger('appendsdone'); - } - - if (!this.pendingSegment_) { - this.state = 'READY'; // TODO should this move into this.checkForAbort to speed up requests post abort in - // all appending cases? - - if (!this.paused()) { - this.monitorBuffer_(); - } - - return; - } - - var segmentInfo = this.pendingSegment_; // Now that the end of the segment has been reached, we can set the end time. It's - // best to wait until all appends are done so we're sure that the primary media is - // finished (and we have its end time). - - this.updateTimingInfoEnd_(segmentInfo); - - if (this.shouldSaveSegmentTimingInfo_) { - // Timeline mappings should only be saved for the main loader. This is for multiple - // reasons: - // - // 1) Only one mapping is saved per timeline, meaning that if both the audio loader - // and the main loader try to save the timeline mapping, whichever comes later - // will overwrite the first. In theory this is OK, as the mappings should be the - // same, however, it breaks for (2) - // 2) In the event of a live stream, the initial live point will make for a somewhat - // arbitrary mapping. If audio and video streams are not perfectly in-sync, then - // the mapping will be off for one of the streams, dependent on which one was - // first saved (see (1)). - // 3) Primary timing goes by video in VHS, so the mapping should be video. - // - // Since the audio loader will wait for the main loader to load the first segment, - // the main loader will save the first timeline mapping, and ensure that there won't - // be a case where audio loads two segments without saving a mapping (thus leading - // to missing segment timing info). - this.syncController_.saveSegmentTimingInfo({ - segmentInfo: segmentInfo, - shouldSaveTimelineMapping: this.loaderType_ === 'main' - }); - } - - var segmentDurationMessage = getTroublesomeSegmentDurationMessage(segmentInfo, this.sourceType_); - - if (segmentDurationMessage) { - if (segmentDurationMessage.severity === 'warn') { - videojs__default['default'].log.warn(segmentDurationMessage.message); - } else { - this.logger_(segmentDurationMessage.message); - } - } - - this.recordThroughput_(segmentInfo); - this.pendingSegment_ = null; - this.state = 'READY'; - - if (segmentInfo.isSyncRequest) { - this.trigger('syncinfoupdate'); // if the sync request was not appended - // then it was not the correct segment. - // throw it away and use the data it gave us - // to get the correct one. - - if (!segmentInfo.hasAppendedData_) { - this.logger_("Throwing away un-appended sync request " + segmentInfoString(segmentInfo)); - return; - } - } - - this.logger_("Appended " + segmentInfoString(segmentInfo)); - this.addSegmentMetadataCue_(segmentInfo); - this.fetchAtBuffer_ = true; - - if (this.currentTimeline_ !== segmentInfo.timeline) { - this.timelineChangeController_.lastTimelineChange({ - type: this.loaderType_, - from: this.currentTimeline_, - to: segmentInfo.timeline - }); // If audio is not disabled, the main segment loader is responsible for updating - // the audio timeline as well. If the content is video only, this won't have any - // impact. - - if (this.loaderType_ === 'main' && !this.audioDisabled_) { - this.timelineChangeController_.lastTimelineChange({ - type: 'audio', - from: this.currentTimeline_, - to: segmentInfo.timeline - }); - } - } - - this.currentTimeline_ = segmentInfo.timeline; // We must update the syncinfo to recalculate the seekable range before - // the following conditional otherwise it may consider this a bad "guess" - // and attempt to resync when the post-update seekable window and live - // point would mean that this was the perfect segment to fetch - - this.trigger('syncinfoupdate'); - var segment = segmentInfo.segment; // If we previously appended a segment that ends more than 3 targetDurations before - // the currentTime_ that means that our conservative guess was too conservative. - // In that case, reset the loader state so that we try to use any information gained - // from the previous request to create a new, more accurate, sync-point. - - if (segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3) { - this.resetEverything(); - return; - } - - var isWalkingForward = this.mediaIndex !== null; // Don't do a rendition switch unless we have enough time to get a sync segment - // and conservatively guess - - if (isWalkingForward) { - this.trigger('bandwidthupdate'); - } - - this.trigger('progress'); - this.mediaIndex = segmentInfo.mediaIndex; - this.partIndex = segmentInfo.partIndex; // any time an update finishes and the last segment is in the - // buffer, end the stream. this ensures the "ended" event will - // fire if playback reaches that point. - - if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) { - this.endOfStream(); - } // used for testing - - - this.trigger('appended'); - - if (segmentInfo.hasAppendedData_) { - this.mediaAppends++; - } - - if (!this.paused()) { - this.monitorBuffer_(); - } - } - /** - * Records the current throughput of the decrypt, transmux, and append - * portion of the semgment pipeline. `throughput.rate` is a the cumulative - * moving average of the throughput. `throughput.count` is the number of - * data points in the average. - * - * @private - * @param {Object} segmentInfo the object returned by loadSegment - */ - ; - - _proto.recordThroughput_ = function recordThroughput_(segmentInfo) { - if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) { - this.logger_("Ignoring segment's throughput because its duration of " + segmentInfo.duration + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS)); - return; - } - - var rate = this.throughput.rate; // Add one to the time to ensure that we don't accidentally attempt to divide - // by zero in the case where the throughput is ridiculously high - - var segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1; // Multiply by 8000 to convert from bytes/millisecond to bits/second - - var segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1000); // This is just a cumulative moving average calculation: - // newAvg = oldAvg + (sample - oldAvg) / (sampleCount + 1) - - this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count; - } - /** - * Adds a cue to the segment-metadata track with some metadata information about the - * segment - * - * @private - * @param {Object} segmentInfo - * the object returned by loadSegment - * @method addSegmentMetadataCue_ - */ - ; - - _proto.addSegmentMetadataCue_ = function addSegmentMetadataCue_(segmentInfo) { - if (!this.segmentMetadataTrack_) { - return; - } - - var segment = segmentInfo.segment; - var start = segment.start; - var end = segment.end; // Do not try adding the cue if the start and end times are invalid. - - if (!finite(start) || !finite(end)) { - return; - } - - removeCuesFromTrack(start, end, this.segmentMetadataTrack_); - var Cue = window__default['default'].WebKitDataCue || window__default['default'].VTTCue; - var value = { - custom: segment.custom, - dateTimeObject: segment.dateTimeObject, - dateTimeString: segment.dateTimeString, - bandwidth: segmentInfo.playlist.attributes.BANDWIDTH, - resolution: segmentInfo.playlist.attributes.RESOLUTION, - codecs: segmentInfo.playlist.attributes.CODECS, - byteLength: segmentInfo.byteLength, - uri: segmentInfo.uri, - timeline: segmentInfo.timeline, - playlist: segmentInfo.playlist.id, - start: start, - end: end - }; - var data = JSON.stringify(value); - var cue = new Cue(start, end, data); // Attach the metadata to the value property of the cue to keep consistency between - // the differences of WebKitDataCue in safari and VTTCue in other browsers - - cue.value = value; - this.segmentMetadataTrack_.addCue(cue); - }; - - return SegmentLoader; -}(videojs__default['default'].EventTarget); - -function noop() {} - -var toTitleCase = function toTitleCase(string) { - if (typeof string !== 'string') { - return string; - } - - return string.replace(/./, function (w) { - return w.toUpperCase(); - }); -}; - -var bufferTypes = ['video', 'audio']; - -var _updating = function updating(type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type]; -}; - -var nextQueueIndexOfType = function nextQueueIndexOfType(type, queue) { - for (var i = 0; i < queue.length; i++) { - var queueEntry = queue[i]; - - if (queueEntry.type === 'mediaSource') { - // If the next entry is a media source entry (uses multiple source buffers), block - // processing to allow it to go through first. - return null; - } - - if (queueEntry.type === type) { - return i; - } - } - - return null; -}; - -var shiftQueue = function shiftQueue(type, sourceUpdater) { - if (sourceUpdater.queue.length === 0) { - return; - } - - var queueIndex = 0; - var queueEntry = sourceUpdater.queue[queueIndex]; - - if (queueEntry.type === 'mediaSource') { - if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== 'closed') { - sourceUpdater.queue.shift(); - queueEntry.action(sourceUpdater); - - if (queueEntry.doneFn) { - queueEntry.doneFn(); - } // Only specific source buffer actions must wait for async updateend events. Media - // Source actions process synchronously. Therefore, both audio and video source - // buffers are now clear to process the next queue entries. - - - shiftQueue('audio', sourceUpdater); - shiftQueue('video', sourceUpdater); - } // Media Source actions require both source buffers, so if the media source action - // couldn't process yet (because one or both source buffers are busy), block other - // queue actions until both are available and the media source action can process. - - - return; - } - - if (type === 'mediaSource') { - // If the queue was shifted by a media source action (this happens when pushing a - // media source action onto the queue), then it wasn't from an updateend event from an - // audio or video source buffer, so there's no change from previous state, and no - // processing should be done. - return; - } // Media source queue entries don't need to consider whether the source updater is - // started (i.e., source buffers are created) as they don't need the source buffers, but - // source buffer queue entries do. - - - if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === 'closed' || _updating(type, sourceUpdater)) { - return; - } - - if (queueEntry.type !== type) { - queueIndex = nextQueueIndexOfType(type, sourceUpdater.queue); - - if (queueIndex === null) { - // Either there's no queue entry that uses this source buffer type in the queue, or - // there's a media source queue entry before the next entry of this type, in which - // case wait for that action to process first. - return; - } - - queueEntry = sourceUpdater.queue[queueIndex]; - } - - sourceUpdater.queue.splice(queueIndex, 1); // Keep a record that this source buffer type is in use. - // - // The queue pending operation must be set before the action is performed in the event - // that the action results in a synchronous event that is acted upon. For instance, if - // an exception is thrown that can be handled, it's possible that new actions will be - // appended to an empty queue and immediately executed, but would not have the correct - // pending information if this property was set after the action was performed. - - sourceUpdater.queuePending[type] = queueEntry; - queueEntry.action(type, sourceUpdater); - - if (!queueEntry.doneFn) { - // synchronous operation, process next entry - sourceUpdater.queuePending[type] = null; - shiftQueue(type, sourceUpdater); - return; - } -}; - -var cleanupBuffer = function cleanupBuffer(type, sourceUpdater) { - var buffer = sourceUpdater[type + "Buffer"]; - var titleType = toTitleCase(type); - - if (!buffer) { - return; - } - - buffer.removeEventListener('updateend', sourceUpdater["on" + titleType + "UpdateEnd_"]); - buffer.removeEventListener('error', sourceUpdater["on" + titleType + "Error_"]); - sourceUpdater.codecs[type] = null; - sourceUpdater[type + "Buffer"] = null; -}; - -var inSourceBuffers = function inSourceBuffers(mediaSource, sourceBuffer) { - return mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1; -}; - -var actions = { - appendBuffer: function appendBuffer(bytes, segmentInfo, onError) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Appending segment " + segmentInfo.mediaIndex + "'s " + bytes.length + " bytes to " + type + "Buffer"); - - try { - sourceBuffer.appendBuffer(bytes); - } catch (e) { - sourceUpdater.logger_("Error with code " + e.code + " " + (e.code === QUOTA_EXCEEDED_ERR ? '(QUOTA_EXCEEDED_ERR) ' : '') + ("when appending segment " + segmentInfo.mediaIndex + " to " + type + "Buffer")); - sourceUpdater.queuePending[type] = null; - onError(e); - } - }; - }, - remove: function remove(start, end) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Removing " + start + " to " + end + " from " + type + "Buffer"); - - try { - sourceBuffer.remove(start, end); - } catch (e) { - sourceUpdater.logger_("Remove " + start + " to " + end + " from " + type + "Buffer failed"); - } - }; - }, - timestampOffset: function timestampOffset(offset) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Setting " + type + "timestampOffset to " + offset); - sourceBuffer.timestampOffset = offset; - }; - }, - callback: function callback(_callback) { - return function (type, sourceUpdater) { - _callback(); - }; - }, - endOfStream: function endOfStream(error) { - return function (sourceUpdater) { - if (sourceUpdater.mediaSource.readyState !== 'open') { - return; - } - - sourceUpdater.logger_("Calling mediaSource endOfStream(" + (error || '') + ")"); - - try { - sourceUpdater.mediaSource.endOfStream(error); - } catch (e) { - videojs__default['default'].log.warn('Failed to call media source endOfStream', e); - } - }; - }, - duration: function duration(_duration) { - return function (sourceUpdater) { - sourceUpdater.logger_("Setting mediaSource duration to " + _duration); - - try { - sourceUpdater.mediaSource.duration = _duration; - } catch (e) { - videojs__default['default'].log.warn('Failed to set media source duration', e); - } - }; - }, - abort: function abort() { - return function (type, sourceUpdater) { - if (sourceUpdater.mediaSource.readyState !== 'open') { - return; - } - - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("calling abort on " + type + "Buffer"); - - try { - sourceBuffer.abort(); - } catch (e) { - videojs__default['default'].log.warn("Failed to abort on " + type + "Buffer", e); - } - }; - }, - addSourceBuffer: function addSourceBuffer(type, codec) { - return function (sourceUpdater) { - var titleType = toTitleCase(type); - var mime = codecs_js.getMimeForCodec(codec); - sourceUpdater.logger_("Adding " + type + "Buffer with codec " + codec + " to mediaSource"); - var sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime); - sourceBuffer.addEventListener('updateend', sourceUpdater["on" + titleType + "UpdateEnd_"]); - sourceBuffer.addEventListener('error', sourceUpdater["on" + titleType + "Error_"]); - sourceUpdater.codecs[type] = codec; - sourceUpdater[type + "Buffer"] = sourceBuffer; - }; - }, - removeSourceBuffer: function removeSourceBuffer(type) { - return function (sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - cleanupBuffer(type, sourceUpdater); // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Removing " + type + "Buffer with codec " + sourceUpdater.codecs[type] + " from mediaSource"); - - try { - sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer); - } catch (e) { - videojs__default['default'].log.warn("Failed to removeSourceBuffer " + type + "Buffer", e); - } - }; - }, - changeType: function changeType(codec) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - var mime = codecs_js.getMimeForCodec(codec); // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } // do not update codec if we don't need to. - - - if (sourceUpdater.codecs[type] === codec) { - return; - } - - sourceUpdater.logger_("changing " + type + "Buffer codec from " + sourceUpdater.codecs[type] + " to " + codec); - sourceBuffer.changeType(mime); - sourceUpdater.codecs[type] = codec; - }; - } -}; - -var pushQueue = function pushQueue(_ref) { - var type = _ref.type, - sourceUpdater = _ref.sourceUpdater, - action = _ref.action, - doneFn = _ref.doneFn, - name = _ref.name; - sourceUpdater.queue.push({ - type: type, - action: action, - doneFn: doneFn, - name: name - }); - shiftQueue(type, sourceUpdater); -}; - -var onUpdateend = function onUpdateend(type, sourceUpdater) { - return function (e) { - // Although there should, in theory, be a pending action for any updateend receieved, - // there are some actions that may trigger updateend events without set definitions in - // the w3c spec. For instance, setting the duration on the media source may trigger - // updateend events on source buffers. This does not appear to be in the spec. As such, - // if we encounter an updateend without a corresponding pending action from our queue - // for that source buffer type, process the next action. - if (sourceUpdater.queuePending[type]) { - var doneFn = sourceUpdater.queuePending[type].doneFn; - sourceUpdater.queuePending[type] = null; - - if (doneFn) { - // if there's an error, report it - doneFn(sourceUpdater[type + "Error_"]); - } - } - - shiftQueue(type, sourceUpdater); - }; -}; -/** - * A queue of callbacks to be serialized and applied when a - * MediaSource and its associated SourceBuffers are not in the - * updating state. It is used by the segment loader to update the - * underlying SourceBuffers when new data is loaded, for instance. - * - * @class SourceUpdater - * @param {MediaSource} mediaSource the MediaSource to create the SourceBuffer from - * @param {string} mimeType the desired MIME type of the underlying SourceBuffer - */ - - -var SourceUpdater = /*#__PURE__*/function (_videojs$EventTarget) { - _inheritsLoose__default['default'](SourceUpdater, _videojs$EventTarget); - - function SourceUpdater(mediaSource) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - _this.mediaSource = mediaSource; - - _this.sourceopenListener_ = function () { - return shiftQueue('mediaSource', _assertThisInitialized__default['default'](_this)); - }; - - _this.mediaSource.addEventListener('sourceopen', _this.sourceopenListener_); - - _this.logger_ = logger('SourceUpdater'); // initial timestamp offset is 0 - - _this.audioTimestampOffset_ = 0; - _this.videoTimestampOffset_ = 0; - _this.queue = []; - _this.queuePending = { - audio: null, - video: null - }; - _this.delayedAudioAppendQueue_ = []; - _this.videoAppendQueued_ = false; - _this.codecs = {}; - _this.onVideoUpdateEnd_ = onUpdateend('video', _assertThisInitialized__default['default'](_this)); - _this.onAudioUpdateEnd_ = onUpdateend('audio', _assertThisInitialized__default['default'](_this)); - - _this.onVideoError_ = function (e) { - // used for debugging - _this.videoError_ = e; - }; - - _this.onAudioError_ = function (e) { - // used for debugging - _this.audioError_ = e; - }; - - _this.createdSourceBuffers_ = false; - _this.initializedEme_ = false; - _this.triggeredReady_ = false; - return _this; - } - - var _proto = SourceUpdater.prototype; - - _proto.initializedEme = function initializedEme() { - this.initializedEme_ = true; - this.triggerReady(); - }; - - _proto.hasCreatedSourceBuffers = function hasCreatedSourceBuffers() { - // if false, likely waiting on one of the segment loaders to get enough data to create - // source buffers - return this.createdSourceBuffers_; - }; - - _proto.hasInitializedAnyEme = function hasInitializedAnyEme() { - return this.initializedEme_; - }; - - _proto.ready = function ready() { - return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme(); - }; - - _proto.createSourceBuffers = function createSourceBuffers(codecs) { - if (this.hasCreatedSourceBuffers()) { - // already created them before - return; - } // the intial addOrChangeSourceBuffers will always be - // two add buffers. - - - this.addOrChangeSourceBuffers(codecs); - this.createdSourceBuffers_ = true; - this.trigger('createdsourcebuffers'); - this.triggerReady(); - }; - - _proto.triggerReady = function triggerReady() { - // only allow ready to be triggered once, this prevents the case - // where: - // 1. we trigger createdsourcebuffers - // 2. ie 11 synchronously initializates eme - // 3. the synchronous initialization causes us to trigger ready - // 4. We go back to the ready check in createSourceBuffers and ready is triggered again. - if (this.ready() && !this.triggeredReady_) { - this.triggeredReady_ = true; - this.trigger('ready'); - } - } - /** - * Add a type of source buffer to the media source. - * - * @param {string} type - * The type of source buffer to add. - * - * @param {string} codec - * The codec to add the source buffer with. - */ - ; - - _proto.addSourceBuffer = function addSourceBuffer(type, codec) { - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.addSourceBuffer(type, codec), - name: 'addSourceBuffer' - }); - } - /** - * call abort on a source buffer. - * - * @param {string} type - * The type of source buffer to call abort on. - */ - ; - - _proto.abort = function abort(type) { - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.abort(type), - name: 'abort' - }); - } - /** - * Call removeSourceBuffer and remove a specific type - * of source buffer on the mediaSource. - * - * @param {string} type - * The type of source buffer to remove. - */ - ; - - _proto.removeSourceBuffer = function removeSourceBuffer(type) { - if (!this.canRemoveSourceBuffer()) { - videojs__default['default'].log.error('removeSourceBuffer is not supported!'); - return; - } - - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.removeSourceBuffer(type), - name: 'removeSourceBuffer' - }); - } - /** - * Whether or not the removeSourceBuffer function is supported - * on the mediaSource. - * - * @return {boolean} - * if removeSourceBuffer can be called. - */ - ; - - _proto.canRemoveSourceBuffer = function canRemoveSourceBuffer() { - // IE reports that it supports removeSourceBuffer, but often throws - // errors when attempting to use the function. So we report that it - // does not support removeSourceBuffer. As of Firefox 83 removeSourceBuffer - // throws errors, so we report that it does not support this as well. - return !videojs__default['default'].browser.IE_VERSION && !videojs__default['default'].browser.IS_FIREFOX && window__default['default'].MediaSource && window__default['default'].MediaSource.prototype && typeof window__default['default'].MediaSource.prototype.removeSourceBuffer === 'function'; - } - /** - * Whether or not the changeType function is supported - * on our SourceBuffers. - * - * @return {boolean} - * if changeType can be called. - */ - ; - - SourceUpdater.canChangeType = function canChangeType() { - return window__default['default'].SourceBuffer && window__default['default'].SourceBuffer.prototype && typeof window__default['default'].SourceBuffer.prototype.changeType === 'function'; - } - /** - * Whether or not the changeType function is supported - * on our SourceBuffers. - * - * @return {boolean} - * if changeType can be called. - */ - ; - - _proto.canChangeType = function canChangeType() { - return this.constructor.canChangeType(); - } - /** - * Call the changeType function on a source buffer, given the code and type. - * - * @param {string} type - * The type of source buffer to call changeType on. - * - * @param {string} codec - * The codec string to change type with on the source buffer. - */ - ; - - _proto.changeType = function changeType(type, codec) { - if (!this.canChangeType()) { - videojs__default['default'].log.error('changeType is not supported!'); - return; - } - - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.changeType(codec), - name: 'changeType' - }); - } - /** - * Add source buffers with a codec or, if they are already created, - * call changeType on source buffers using changeType. - * - * @param {Object} codecs - * Codecs to switch to - */ - ; - - _proto.addOrChangeSourceBuffers = function addOrChangeSourceBuffers(codecs) { - var _this2 = this; - - if (!codecs || typeof codecs !== 'object' || Object.keys(codecs).length === 0) { - throw new Error('Cannot addOrChangeSourceBuffers to undefined codecs'); - } - - Object.keys(codecs).forEach(function (type) { - var codec = codecs[type]; - - if (!_this2.hasCreatedSourceBuffers()) { - return _this2.addSourceBuffer(type, codec); - } - - if (_this2.canChangeType()) { - _this2.changeType(type, codec); - } - }); - } - /** - * Queue an update to append an ArrayBuffer. - * - * @param {MediaObject} object containing audioBytes and/or videoBytes - * @param {Function} done the function to call when done - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-appendBuffer-void-ArrayBuffer-data - */ - ; - - _proto.appendBuffer = function appendBuffer(options, doneFn) { - var _this3 = this; - - var segmentInfo = options.segmentInfo, - type = options.type, - bytes = options.bytes; - this.processedAppend_ = true; - - if (type === 'audio' && this.videoBuffer && !this.videoAppendQueued_) { - this.delayedAudioAppendQueue_.push([options, doneFn]); - this.logger_("delayed audio append of " + bytes.length + " until video append"); - return; - } // In the case of certain errors, for instance, QUOTA_EXCEEDED_ERR, updateend will - // not be fired. This means that the queue will be blocked until the next action - // taken by the segment-loader. Provide a mechanism for segment-loader to handle - // these errors by calling the doneFn with the specific error. - - - var onError = doneFn; - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.appendBuffer(bytes, segmentInfo || { - mediaIndex: -1 - }, onError), - doneFn: doneFn, - name: 'appendBuffer' - }); - - if (type === 'video') { - this.videoAppendQueued_ = true; - - if (!this.delayedAudioAppendQueue_.length) { - return; - } - - var queue = this.delayedAudioAppendQueue_.slice(); - this.logger_("queuing delayed audio " + queue.length + " appendBuffers"); - this.delayedAudioAppendQueue_.length = 0; - queue.forEach(function (que) { - _this3.appendBuffer.apply(_this3, que); - }); - } - } - /** - * Get the audio buffer's buffered timerange. - * - * @return {TimeRange} - * The audio buffer's buffered time range - */ - ; - - _proto.audioBuffered = function audioBuffered() { - // no media source/source buffer or it isn't in the media sources - // source buffer list - if (!inSourceBuffers(this.mediaSource, this.audioBuffer)) { - return videojs__default['default'].createTimeRange(); - } - - return this.audioBuffer.buffered ? this.audioBuffer.buffered : videojs__default['default'].createTimeRange(); - } - /** - * Get the video buffer's buffered timerange. - * - * @return {TimeRange} - * The video buffer's buffered time range - */ - ; - - _proto.videoBuffered = function videoBuffered() { - // no media source/source buffer or it isn't in the media sources - // source buffer list - if (!inSourceBuffers(this.mediaSource, this.videoBuffer)) { - return videojs__default['default'].createTimeRange(); - } - - return this.videoBuffer.buffered ? this.videoBuffer.buffered : videojs__default['default'].createTimeRange(); - } - /** - * Get a combined video/audio buffer's buffered timerange. - * - * @return {TimeRange} - * the combined time range - */ - ; - - _proto.buffered = function buffered() { - var video = inSourceBuffers(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null; - var audio = inSourceBuffers(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null; - - if (audio && !video) { - return this.audioBuffered(); - } - - if (video && !audio) { - return this.videoBuffered(); - } - - return bufferIntersection(this.audioBuffered(), this.videoBuffered()); - } - /** - * Add a callback to the queue that will set duration on the mediaSource. - * - * @param {number} duration - * The duration to set - * - * @param {Function} [doneFn] - * function to run after duration has been set. - */ - ; - - _proto.setDuration = function setDuration(duration, doneFn) { - if (doneFn === void 0) { - doneFn = noop; - } - - // In order to set the duration on the media source, it's necessary to wait for all - // source buffers to no longer be updating. "If the updating attribute equals true on - // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and - // abort these steps." (source: https://www.w3.org/TR/media-source/#attributes). - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.duration(duration), - name: 'duration', - doneFn: doneFn - }); - } - /** - * Add a mediaSource endOfStream call to the queue - * - * @param {Error} [error] - * Call endOfStream with an error - * - * @param {Function} [doneFn] - * A function that should be called when the - * endOfStream call has finished. - */ - ; - - _proto.endOfStream = function endOfStream(error, doneFn) { - if (error === void 0) { - error = null; - } - - if (doneFn === void 0) { - doneFn = noop; - } - - if (typeof error !== 'string') { - error = undefined; - } // In order to set the duration on the media source, it's necessary to wait for all - // source buffers to no longer be updating. "If the updating attribute equals true on - // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and - // abort these steps." (source: https://www.w3.org/TR/media-source/#attributes). - - - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.endOfStream(error), - name: 'endOfStream', - doneFn: doneFn - }); - } - /** - * Queue an update to remove a time range from the buffer. - * - * @param {number} start where to start the removal - * @param {number} end where to end the removal - * @param {Function} [done=noop] optional callback to be executed when the remove - * operation is complete - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end - */ - ; - - _proto.removeAudio = function removeAudio(start, end, done) { - if (done === void 0) { - done = noop; - } - - if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) { - done(); - return; - } - - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.remove(start, end), - doneFn: done, - name: 'remove' - }); - } - /** - * Queue an update to remove a time range from the buffer. - * - * @param {number} start where to start the removal - * @param {number} end where to end the removal - * @param {Function} [done=noop] optional callback to be executed when the remove - * operation is complete - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end - */ - ; - - _proto.removeVideo = function removeVideo(start, end, done) { - if (done === void 0) { - done = noop; - } - - if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) { - done(); - return; - } - - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.remove(start, end), - doneFn: done, - name: 'remove' - }); - } - /** - * Whether the underlying sourceBuffer is updating or not - * - * @return {boolean} the updating status of the SourceBuffer - */ - ; - - _proto.updating = function updating() { - // the audio/video source buffer is updating - if (_updating('audio', this) || _updating('video', this)) { - return true; - } - - return false; - } - /** - * Set/get the timestampoffset on the audio SourceBuffer - * - * @return {number} the timestamp offset - */ - ; - - _proto.audioTimestampOffset = function audioTimestampOffset(offset) { - if (typeof offset !== 'undefined' && this.audioBuffer && // no point in updating if it's the same - this.audioTimestampOffset_ !== offset) { - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.timestampOffset(offset), - name: 'timestampOffset' - }); - this.audioTimestampOffset_ = offset; - } - - return this.audioTimestampOffset_; - } - /** - * Set/get the timestampoffset on the video SourceBuffer - * - * @return {number} the timestamp offset - */ - ; - - _proto.videoTimestampOffset = function videoTimestampOffset(offset) { - if (typeof offset !== 'undefined' && this.videoBuffer && // no point in updating if it's the same - this.videoTimestampOffset !== offset) { - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.timestampOffset(offset), - name: 'timestampOffset' - }); - this.videoTimestampOffset_ = offset; - } - - return this.videoTimestampOffset_; - } - /** - * Add a function to the queue that will be called - * when it is its turn to run in the audio queue. - * - * @param {Function} callback - * The callback to queue. - */ - ; - - _proto.audioQueueCallback = function audioQueueCallback(callback) { - if (!this.audioBuffer) { - return; - } - - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.callback(callback), - name: 'callback' - }); - } - /** - * Add a function to the queue that will be called - * when it is its turn to run in the video queue. - * - * @param {Function} callback - * The callback to queue. - */ - ; - - _proto.videoQueueCallback = function videoQueueCallback(callback) { - if (!this.videoBuffer) { - return; - } - - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.callback(callback), - name: 'callback' - }); - } - /** - * dispose of the source updater and the underlying sourceBuffer - */ - ; - - _proto.dispose = function dispose() { - var _this4 = this; - - this.trigger('dispose'); - bufferTypes.forEach(function (type) { - _this4.abort(type); - - if (_this4.canRemoveSourceBuffer()) { - _this4.removeSourceBuffer(type); - } else { - _this4[type + "QueueCallback"](function () { - return cleanupBuffer(type, _this4); - }); - } - }); - this.videoAppendQueued_ = false; - this.delayedAudioAppendQueue_.length = 0; - - if (this.sourceopenListener_) { - this.mediaSource.removeEventListener('sourceopen', this.sourceopenListener_); - } - - this.off(); - }; - - return SourceUpdater; -}(videojs__default['default'].EventTarget); - -var uint8ToUtf8 = function uint8ToUtf8(uintArray) { - return decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray))); -}; - -var VTT_LINE_TERMINATORS = new Uint8Array('\n\n'.split('').map(function (char) { - return char.charCodeAt(0); -})); -/** - * An object that manages segment loading and appending. - * - * @class VTTSegmentLoader - * @param {Object} options required and optional options - * @extends videojs.EventTarget - */ - -var VTTSegmentLoader = /*#__PURE__*/function (_SegmentLoader) { - _inheritsLoose__default['default'](VTTSegmentLoader, _SegmentLoader); - - function VTTSegmentLoader(settings, options) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _SegmentLoader.call(this, settings, options) || this; // SegmentLoader requires a MediaSource be specified or it will throw an error; - // however, VTTSegmentLoader has no need of a media source, so delete the reference - - _this.mediaSource_ = null; - _this.subtitlesTrack_ = null; - _this.loaderType_ = 'subtitle'; - _this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks; // The VTT segment will have its own time mappings. Saving VTT segment timing info in - // the sync controller leads to improper behavior. - - _this.shouldSaveSegmentTimingInfo_ = false; - return _this; - } - - var _proto = VTTSegmentLoader.prototype; - - _proto.createTransmuxer_ = function createTransmuxer_() { - // don't need to transmux any subtitles - return null; - } - /** - * Indicates which time ranges are buffered - * - * @return {TimeRange} - * TimeRange object representing the current buffered ranges - */ - ; - - _proto.buffered_ = function buffered_() { - if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) { - return videojs__default['default'].createTimeRanges(); - } - - var cues = this.subtitlesTrack_.cues; - var start = cues[0].startTime; - var end = cues[cues.length - 1].startTime; - return videojs__default['default'].createTimeRanges([[start, end]]); - } - /** - * Gets and sets init segment for the provided map - * - * @param {Object} map - * The map object representing the init segment to get or set - * @param {boolean=} set - * If true, the init segment for the provided map should be saved - * @return {Object} - * map object for desired init segment - */ - ; - - _proto.initSegmentForMap = function initSegmentForMap(map, set) { - if (set === void 0) { - set = false; - } - - if (!map) { - return null; - } - - var id = initSegmentId(map); - var storedMap = this.initSegments_[id]; - - if (set && !storedMap && map.bytes) { - // append WebVTT line terminators to the media initialization segment if it exists - // to follow the WebVTT spec (https://w3c.github.io/webvtt/#file-structure) that - // requires two or more WebVTT line terminators between the WebVTT header and the - // rest of the file - var combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength; - var combinedSegment = new Uint8Array(combinedByteLength); - combinedSegment.set(map.bytes); - combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength); - this.initSegments_[id] = storedMap = { - resolvedUri: map.resolvedUri, - byterange: map.byterange, - bytes: combinedSegment - }; - } - - return storedMap || map; - } - /** - * Returns true if all configuration required for loading is present, otherwise false. - * - * @return {boolean} True if the all configuration is ready for loading - * @private - */ - ; - - _proto.couldBeginLoading_ = function couldBeginLoading_() { - return this.playlist_ && this.subtitlesTrack_ && !this.paused(); - } - /** - * Once all the starting parameters have been specified, begin - * operation. This method should only be invoked from the INIT - * state. - * - * @private - */ - ; - - _proto.init_ = function init_() { - this.state = 'READY'; - this.resetEverything(); - return this.monitorBuffer_(); - } - /** - * Set a subtitle track on the segment loader to add subtitles to - * - * @param {TextTrack=} track - * The text track to add loaded subtitles to - * @return {TextTrack} - * Returns the subtitles track - */ - ; - - _proto.track = function track(_track) { - if (typeof _track === 'undefined') { - return this.subtitlesTrack_; - } - - this.subtitlesTrack_ = _track; // if we were unpaused but waiting for a sourceUpdater, start - // buffering now - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - this.init_(); - } - - return this.subtitlesTrack_; - } - /** - * Remove any data in the source buffer between start and end times - * - * @param {number} start - the start time of the region to remove from the buffer - * @param {number} end - the end time of the region to remove from the buffer - */ - ; - - _proto.remove = function remove(start, end) { - removeCuesFromTrack(start, end, this.subtitlesTrack_); - } - /** - * fill the buffer with segements unless the sourceBuffers are - * currently updating - * - * Note: this function should only ever be called by monitorBuffer_ - * and never directly - * - * @private - */ - ; - - _proto.fillBuffer_ = function fillBuffer_() { - var _this2 = this; - - // see if we need to begin loading immediately - var segmentInfo = this.chooseNextRequest_(); - - if (!segmentInfo) { - return; - } - - if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) { - // We don't have the timestamp offset that we need to sync subtitles. - // Rerun on a timestamp offset or user interaction. - var checkTimestampOffset = function checkTimestampOffset() { - _this2.state = 'READY'; - - if (!_this2.paused()) { - // if not paused, queue a buffer check as soon as possible - _this2.monitorBuffer_(); - } - }; - - this.syncController_.one('timestampoffset', checkTimestampOffset); - this.state = 'WAITING_ON_TIMELINE'; - return; - } - - this.loadSegment_(segmentInfo); - } // never set a timestamp offset for vtt segments. - ; - - _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_() { - return null; - }; - - _proto.chooseNextRequest_ = function chooseNextRequest_() { - return this.skipEmptySegments_(_SegmentLoader.prototype.chooseNextRequest_.call(this)); - } - /** - * Prevents the segment loader from requesting segments we know contain no subtitles - * by walking forward until we find the next segment that we don't know whether it is - * empty or not. - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @return {Object} - * a segment info object that describes the current segment - */ - ; - - _proto.skipEmptySegments_ = function skipEmptySegments_(segmentInfo) { - while (segmentInfo && segmentInfo.segment.empty) { - // stop at the last possible segmentInfo - if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) { - segmentInfo = null; - break; - } - - segmentInfo = this.generateSegmentInfo_({ - playlist: segmentInfo.playlist, - mediaIndex: segmentInfo.mediaIndex + 1, - startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration, - isSyncRequest: segmentInfo.isSyncRequest - }); - } - - return segmentInfo; - }; - - _proto.stopForError = function stopForError(error) { - this.error(error); - this.state = 'READY'; - this.pause(); - this.trigger('error'); - } - /** - * append a decrypted segement to the SourceBuffer through a SourceUpdater - * - * @private - */ - ; - - _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) { - var _this3 = this; - - if (!this.subtitlesTrack_) { - this.state = 'READY'; - return; - } - - this.saveTransferStats_(simpleSegment.stats); // the request was aborted - - if (!this.pendingSegment_) { - this.state = 'READY'; - this.mediaRequestsAborted += 1; - return; - } - - if (error) { - if (error.code === REQUEST_ERRORS.TIMEOUT) { - this.handleTimeout_(); - } - - if (error.code === REQUEST_ERRORS.ABORTED) { - this.mediaRequestsAborted += 1; - } else { - this.mediaRequestsErrored += 1; - } - - this.stopForError(error); - return; - } - - var segmentInfo = this.pendingSegment_; // although the VTT segment loader bandwidth isn't really used, it's good to - // maintain functionality between segment loaders - - this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats); - this.state = 'APPENDING'; // used for tests - - this.trigger('appending'); - var segment = segmentInfo.segment; - - if (segment.map) { - segment.map.bytes = simpleSegment.map.bytes; - } - - segmentInfo.bytes = simpleSegment.bytes; // Make sure that vttjs has loaded, otherwise, wait till it finished loading - - if (typeof window__default['default'].WebVTT !== 'function' && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) { - var loadHandler; - - var errorHandler = function errorHandler() { - _this3.subtitlesTrack_.tech_.off('vttjsloaded', loadHandler); - - _this3.stopForError({ - message: 'Error loading vtt.js' - }); - - return; - }; - - loadHandler = function loadHandler() { - _this3.subtitlesTrack_.tech_.off('vttjserror', errorHandler); - - _this3.segmentRequestFinished_(error, simpleSegment, result); - }; - - this.state = 'WAITING_ON_VTTJS'; - this.subtitlesTrack_.tech_.one('vttjsloaded', loadHandler); - this.subtitlesTrack_.tech_.one('vttjserror', errorHandler); - return; - } - - segment.requested = true; - - try { - this.parseVTTCues_(segmentInfo); - } catch (e) { - this.stopForError({ - message: e.message - }); - return; - } - - this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_); - - if (segmentInfo.cues.length) { - segmentInfo.timingInfo = { - start: segmentInfo.cues[0].startTime, - end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime - }; - } else { - segmentInfo.timingInfo = { - start: segmentInfo.startOfSegment, - end: segmentInfo.startOfSegment + segmentInfo.duration - }; - } - - if (segmentInfo.isSyncRequest) { - this.trigger('syncinfoupdate'); - this.pendingSegment_ = null; - this.state = 'READY'; - return; - } - - segmentInfo.byteLength = segmentInfo.bytes.byteLength; - this.mediaSecondsLoaded += segment.duration; // Create VTTCue instances for each cue in the new segment and add them to - // the subtitle track - - segmentInfo.cues.forEach(function (cue) { - _this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_ ? new window__default['default'].VTTCue(cue.startTime, cue.endTime, cue.text) : cue); - }); // Remove any duplicate cues from the subtitle track. The WebVTT spec allows - // cues to have identical time-intervals, but if the text is also identical - // we can safely assume it is a duplicate that can be removed (ex. when a cue - // "overlaps" VTT segments) - - removeDuplicateCuesFromTrack(this.subtitlesTrack_); - this.handleAppendsDone_(); - }; - - _proto.handleData_ = function handleData_() {// noop as we shouldn't be getting video/audio data captions - // that we do not support here. - }; - - _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_() {// noop - } - /** - * Uses the WebVTT parser to parse the segment response - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @private - */ - ; - - _proto.parseVTTCues_ = function parseVTTCues_(segmentInfo) { - var decoder; - var decodeBytesToString = false; - - if (typeof window__default['default'].TextDecoder === 'function') { - decoder = new window__default['default'].TextDecoder('utf8'); - } else { - decoder = window__default['default'].WebVTT.StringDecoder(); - decodeBytesToString = true; - } - - var parser = new window__default['default'].WebVTT.Parser(window__default['default'], window__default['default'].vttjs, decoder); - segmentInfo.cues = []; - segmentInfo.timestampmap = { - MPEGTS: 0, - LOCAL: 0 - }; - parser.oncue = segmentInfo.cues.push.bind(segmentInfo.cues); - - parser.ontimestampmap = function (map) { - segmentInfo.timestampmap = map; - }; - - parser.onparsingerror = function (error) { - videojs__default['default'].log.warn('Error encountered when parsing cues: ' + error.message); - }; - - if (segmentInfo.segment.map) { - var mapData = segmentInfo.segment.map.bytes; - - if (decodeBytesToString) { - mapData = uint8ToUtf8(mapData); - } - - parser.parse(mapData); - } - - var segmentData = segmentInfo.bytes; - - if (decodeBytesToString) { - segmentData = uint8ToUtf8(segmentData); - } - - parser.parse(segmentData); - parser.flush(); - } - /** - * Updates the start and end times of any cues parsed by the WebVTT parser using - * the information parsed from the X-TIMESTAMP-MAP header and a TS to media time mapping - * from the SyncController - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @param {Object} mappingObj - * object containing a mapping from TS to media time - * @param {Object} playlist - * the playlist object containing the segment - * @private - */ - ; - - _proto.updateTimeMapping_ = function updateTimeMapping_(segmentInfo, mappingObj, playlist) { - var segment = segmentInfo.segment; - - if (!mappingObj) { - // If the sync controller does not have a mapping of TS to Media Time for the - // timeline, then we don't have enough information to update the cue - // start/end times - return; - } - - if (!segmentInfo.cues.length) { - // If there are no cues, we also do not have enough information to figure out - // segment timing. Mark that the segment contains no cues so we don't re-request - // an empty segment. - segment.empty = true; - return; - } - - var timestampmap = segmentInfo.timestampmap; - var diff = timestampmap.MPEGTS / clock.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping; - segmentInfo.cues.forEach(function (cue) { - // First convert cue time to TS time using the timestamp-map provided within the vtt - cue.startTime += diff; - cue.endTime += diff; - }); - - if (!playlist.syncInfo) { - var firstStart = segmentInfo.cues[0].startTime; - var lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime; - playlist.syncInfo = { - mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex, - time: Math.min(firstStart, lastStart - segment.duration) - }; - } - }; - - return VTTSegmentLoader; -}(SegmentLoader); - -/** - * @file ad-cue-tags.js - */ -/** - * Searches for an ad cue that overlaps with the given mediaTime - * - * @param {Object} track - * the track to find the cue for - * - * @param {number} mediaTime - * the time to find the cue at - * - * @return {Object|null} - * the found cue or null - */ - -var findAdCue = function findAdCue(track, mediaTime) { - var cues = track.cues; - - for (var i = 0; i < cues.length; i++) { - var cue = cues[i]; - - if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) { - return cue; - } - } - - return null; -}; -var updateAdCues = function updateAdCues(media, track, offset) { - if (offset === void 0) { - offset = 0; - } - - if (!media.segments) { - return; - } - - var mediaTime = offset; - var cue; - - for (var i = 0; i < media.segments.length; i++) { - var segment = media.segments[i]; - - if (!cue) { - // Since the cues will span for at least the segment duration, adding a fudge - // factor of half segment duration will prevent duplicate cues from being - // created when timing info is not exact (e.g. cue start time initialized - // at 10.006677, but next call mediaTime is 10.003332 ) - cue = findAdCue(track, mediaTime + segment.duration / 2); - } - - if (cue) { - if ('cueIn' in segment) { - // Found a CUE-IN so end the cue - cue.endTime = mediaTime; - cue.adEndTime = mediaTime; - mediaTime += segment.duration; - cue = null; - continue; - } - - if (mediaTime < cue.endTime) { - // Already processed this mediaTime for this cue - mediaTime += segment.duration; - continue; - } // otherwise extend cue until a CUE-IN is found - - - cue.endTime += segment.duration; - } else { - if ('cueOut' in segment) { - cue = new window__default['default'].VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut); - cue.adStartTime = mediaTime; // Assumes tag format to be - // #EXT-X-CUE-OUT:30 - - cue.adEndTime = mediaTime + parseFloat(segment.cueOut); - track.addCue(cue); - } - - if ('cueOutCont' in segment) { - // Entered into the middle of an ad cue - // Assumes tag formate to be - // #EXT-X-CUE-OUT-CONT:10/30 - var _segment$cueOutCont$s = segment.cueOutCont.split('/').map(parseFloat), - adOffset = _segment$cueOutCont$s[0], - adTotal = _segment$cueOutCont$s[1]; - - cue = new window__default['default'].VTTCue(mediaTime, mediaTime + segment.duration, ''); - cue.adStartTime = mediaTime - adOffset; - cue.adEndTime = cue.adStartTime + adTotal; - track.addCue(cue); - } - } - - mediaTime += segment.duration; - } -}; - -var syncPointStrategies = [// Stategy "VOD": Handle the VOD-case where the sync-point is *always* -// the equivalence display-time 0 === segment-index 0 -{ - name: 'VOD', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (duration !== Infinity) { - var syncPoint = { - time: 0, - segmentIndex: 0, - partIndex: null - }; - return syncPoint; - } - - return null; - } -}, // Stategy "ProgramDateTime": We have a program-date-time tag in this playlist -{ - name: 'ProgramDateTime', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (!Object.keys(syncController.timelineToDatetimeMappings).length) { - return null; - } - - var syncPoint = null; - var lastDistance = null; - var partsAndSegments = getPartsAndSegments(playlist); - currentTime = currentTime || 0; - - for (var i = 0; i < partsAndSegments.length; i++) { - // start from the end and loop backwards for live - // or start from the front and loop forwards for non-live - var index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1); - var partAndSegment = partsAndSegments[index]; - var segment = partAndSegment.segment; - var datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline]; - - if (!datetimeMapping) { - continue; - } - - if (segment.dateTimeObject) { - var segmentTime = segment.dateTimeObject.getTime() / 1000; - var start = segmentTime + datetimeMapping; // take part duration into account. - - if (segment.parts && typeof partAndSegment.partIndex === 'number') { - for (var z = 0; z < partAndSegment.partIndex; z++) { - start += segment.parts[z].duration; - } - } - - var distance = Math.abs(currentTime - start); // Once the distance begins to increase, or if distance is 0, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && (distance === 0 || lastDistance < distance)) { - break; - } - - lastDistance = distance; - syncPoint = { - time: start, - segmentIndex: partAndSegment.segmentIndex, - partIndex: partAndSegment.partIndex - }; - } - } - - return syncPoint; - } -}, // Stategy "Segment": We have a known time mapping for a timeline and a -// segment in the current timeline with timing data -{ - name: 'Segment', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - var syncPoint = null; - var lastDistance = null; - currentTime = currentTime || 0; - var partsAndSegments = getPartsAndSegments(playlist); - - for (var i = 0; i < partsAndSegments.length; i++) { - // start from the end and loop backwards for live - // or start from the front and loop forwards for non-live - var index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1); - var partAndSegment = partsAndSegments[index]; - var segment = partAndSegment.segment; - var start = partAndSegment.part && partAndSegment.part.start || segment && segment.start; - - if (segment.timeline === currentTimeline && typeof start !== 'undefined') { - var distance = Math.abs(currentTime - start); // Once the distance begins to increase, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && lastDistance < distance) { - break; - } - - if (!syncPoint || lastDistance === null || lastDistance >= distance) { - lastDistance = distance; - syncPoint = { - time: start, - segmentIndex: partAndSegment.segmentIndex, - partIndex: partAndSegment.partIndex - }; - } - } - } - - return syncPoint; - } -}, // Stategy "Discontinuity": We have a discontinuity with a known -// display-time -{ - name: 'Discontinuity', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - var syncPoint = null; - currentTime = currentTime || 0; - - if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) { - var lastDistance = null; - - for (var i = 0; i < playlist.discontinuityStarts.length; i++) { - var segmentIndex = playlist.discontinuityStarts[i]; - var discontinuity = playlist.discontinuitySequence + i + 1; - var discontinuitySync = syncController.discontinuities[discontinuity]; - - if (discontinuitySync) { - var distance = Math.abs(currentTime - discontinuitySync.time); // Once the distance begins to increase, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && lastDistance < distance) { - break; - } - - if (!syncPoint || lastDistance === null || lastDistance >= distance) { - lastDistance = distance; - syncPoint = { - time: discontinuitySync.time, - segmentIndex: segmentIndex, - partIndex: null - }; - } - } - } - } - - return syncPoint; - } -}, // Stategy "Playlist": We have a playlist with a known mapping of -// segment index to display time -{ - name: 'Playlist', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (playlist.syncInfo) { - var syncPoint = { - time: playlist.syncInfo.time, - segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence, - partIndex: null - }; - return syncPoint; - } - - return null; - } -}]; - -var SyncController = /*#__PURE__*/function (_videojs$EventTarget) { - _inheritsLoose__default['default'](SyncController, _videojs$EventTarget); - - function SyncController(options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; // ...for synching across variants - - _this.timelines = []; - _this.discontinuities = []; - _this.timelineToDatetimeMappings = {}; - _this.logger_ = logger('SyncController'); - return _this; - } - /** - * Find a sync-point for the playlist specified - * - * A sync-point is defined as a known mapping from display-time to - * a segment-index in the current playlist. - * - * @param {Playlist} playlist - * The playlist that needs a sync-point - * @param {number} duration - * Duration of the MediaSource (Infinite if playing a live source) - * @param {number} currentTimeline - * The last timeline from which a segment was loaded - * @return {Object} - * A sync-point object - */ - - - var _proto = SyncController.prototype; - - _proto.getSyncPoint = function getSyncPoint(playlist, duration, currentTimeline, currentTime) { - var syncPoints = this.runStrategies_(playlist, duration, currentTimeline, currentTime); - - if (!syncPoints.length) { - // Signal that we need to attempt to get a sync-point manually - // by fetching a segment in the playlist and constructing - // a sync-point from that information - return null; - } // Now find the sync-point that is closest to the currentTime because - // that should result in the most accurate guess about which segment - // to fetch - - - return this.selectSyncPoint_(syncPoints, { - key: 'time', - value: currentTime - }); - } - /** - * Calculate the amount of time that has expired off the playlist during playback - * - * @param {Playlist} playlist - * Playlist object to calculate expired from - * @param {number} duration - * Duration of the MediaSource (Infinity if playling a live source) - * @return {number|null} - * The amount of time that has expired off the playlist during playback. Null - * if no sync-points for the playlist can be found. - */ - ; - - _proto.getExpiredTime = function getExpiredTime(playlist, duration) { - if (!playlist || !playlist.segments) { - return null; - } - - var syncPoints = this.runStrategies_(playlist, duration, playlist.discontinuitySequence, 0); // Without sync-points, there is not enough information to determine the expired time - - if (!syncPoints.length) { - return null; - } - - var syncPoint = this.selectSyncPoint_(syncPoints, { - key: 'segmentIndex', - value: 0 - }); // If the sync-point is beyond the start of the playlist, we want to subtract the - // duration from index 0 to syncPoint.segmentIndex instead of adding. - - if (syncPoint.segmentIndex > 0) { - syncPoint.time *= -1; - } - - return Math.abs(syncPoint.time + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: syncPoint.segmentIndex, - endIndex: 0 - })); - } - /** - * Runs each sync-point strategy and returns a list of sync-points returned by the - * strategies - * - * @private - * @param {Playlist} playlist - * The playlist that needs a sync-point - * @param {number} duration - * Duration of the MediaSource (Infinity if playing a live source) - * @param {number} currentTimeline - * The last timeline from which a segment was loaded - * @return {Array} - * A list of sync-point objects - */ - ; - - _proto.runStrategies_ = function runStrategies_(playlist, duration, currentTimeline, currentTime) { - var syncPoints = []; // Try to find a sync-point in by utilizing various strategies... - - for (var i = 0; i < syncPointStrategies.length; i++) { - var strategy = syncPointStrategies[i]; - var syncPoint = strategy.run(this, playlist, duration, currentTimeline, currentTime); - - if (syncPoint) { - syncPoint.strategy = strategy.name; - syncPoints.push({ - strategy: strategy.name, - syncPoint: syncPoint - }); - } - } - - return syncPoints; - } - /** - * Selects the sync-point nearest the specified target - * - * @private - * @param {Array} syncPoints - * List of sync-points to select from - * @param {Object} target - * Object specifying the property and value we are targeting - * @param {string} target.key - * Specifies the property to target. Must be either 'time' or 'segmentIndex' - * @param {number} target.value - * The value to target for the specified key. - * @return {Object} - * The sync-point nearest the target - */ - ; - - _proto.selectSyncPoint_ = function selectSyncPoint_(syncPoints, target) { - var bestSyncPoint = syncPoints[0].syncPoint; - var bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value); - var bestStrategy = syncPoints[0].strategy; - - for (var i = 1; i < syncPoints.length; i++) { - var newDistance = Math.abs(syncPoints[i].syncPoint[target.key] - target.value); - - if (newDistance < bestDistance) { - bestDistance = newDistance; - bestSyncPoint = syncPoints[i].syncPoint; - bestStrategy = syncPoints[i].strategy; - } - } - - this.logger_("syncPoint for [" + target.key + ": " + target.value + "] chosen with strategy" + (" [" + bestStrategy + "]: [time:" + bestSyncPoint.time + ",") + (" segmentIndex:" + bestSyncPoint.segmentIndex) + (typeof bestSyncPoint.partIndex === 'number' ? ",partIndex:" + bestSyncPoint.partIndex : '') + ']'); - return bestSyncPoint; - } - /** - * Save any meta-data present on the segments when segments leave - * the live window to the playlist to allow for synchronization at the - * playlist level later. - * - * @param {Playlist} oldPlaylist - The previous active playlist - * @param {Playlist} newPlaylist - The updated and most current playlist - */ - ; - - _proto.saveExpiredSegmentInfo = function saveExpiredSegmentInfo(oldPlaylist, newPlaylist) { - var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; // When a segment expires from the playlist and it has a start time - // save that information as a possible sync-point reference in future - - for (var i = mediaSequenceDiff - 1; i >= 0; i--) { - var lastRemovedSegment = oldPlaylist.segments[i]; - - if (lastRemovedSegment && typeof lastRemovedSegment.start !== 'undefined') { - newPlaylist.syncInfo = { - mediaSequence: oldPlaylist.mediaSequence + i, - time: lastRemovedSegment.start - }; - this.logger_("playlist refresh sync: [time:" + newPlaylist.syncInfo.time + "," + (" mediaSequence: " + newPlaylist.syncInfo.mediaSequence + "]")); - this.trigger('syncinfoupdate'); - break; - } - } - } - /** - * Save the mapping from playlist's ProgramDateTime to display. This should only happen - * before segments start to load. - * - * @param {Playlist} playlist - The currently active playlist - */ - ; - - _proto.setDateTimeMappingForStart = function setDateTimeMappingForStart(playlist) { - // It's possible for the playlist to be updated before playback starts, meaning time - // zero is not yet set. If, during these playlist refreshes, a discontinuity is - // crossed, then the old time zero mapping (for the prior timeline) would be retained - // unless the mappings are cleared. - this.timelineToDatetimeMappings = {}; - - if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) { - var firstSegment = playlist.segments[0]; - var playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1000; - this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp; - } - } - /** - * Calculates and saves timeline mappings, playlist sync info, and segment timing values - * based on the latest timing information. - * - * @param {Object} options - * Options object - * @param {SegmentInfo} options.segmentInfo - * The current active request information - * @param {boolean} options.shouldSaveTimelineMapping - * If there's a timeline change, determines if the timeline mapping should be - * saved for timeline mapping and program date time mappings. - */ - ; - - _proto.saveSegmentTimingInfo = function saveSegmentTimingInfo(_ref) { - var segmentInfo = _ref.segmentInfo, - shouldSaveTimelineMapping = _ref.shouldSaveTimelineMapping; - var didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping); - var segment = segmentInfo.segment; - - if (didCalculateSegmentTimeMapping) { - this.saveDiscontinuitySyncInfo_(segmentInfo); // If the playlist does not have sync information yet, record that information - // now with segment timing information - - if (!segmentInfo.playlist.syncInfo) { - segmentInfo.playlist.syncInfo = { - mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex, - time: segment.start - }; - } - } - - var dateTime = segment.dateTimeObject; - - if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) { - this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1000); - } - }; - - _proto.timestampOffsetForTimeline = function timestampOffsetForTimeline(timeline) { - if (typeof this.timelines[timeline] === 'undefined') { - return null; - } - - return this.timelines[timeline].time; - }; - - _proto.mappingForTimeline = function mappingForTimeline(timeline) { - if (typeof this.timelines[timeline] === 'undefined') { - return null; - } - - return this.timelines[timeline].mapping; - } - /** - * Use the "media time" for a segment to generate a mapping to "display time" and - * save that display time to the segment. - * - * @private - * @param {SegmentInfo} segmentInfo - * The current active request information - * @param {Object} timingInfo - * The start and end time of the current segment in "media time" - * @param {boolean} shouldSaveTimelineMapping - * If there's a timeline change, determines if the timeline mapping should be - * saved in timelines. - * @return {boolean} - * Returns false if segment time mapping could not be calculated - */ - ; - - _proto.calculateSegmentTimeMapping_ = function calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) { - // TODO: remove side effects - var segment = segmentInfo.segment; - var part = segmentInfo.part; - var mappingObj = this.timelines[segmentInfo.timeline]; - var start; - var end; - - if (typeof segmentInfo.timestampOffset === 'number') { - mappingObj = { - time: segmentInfo.startOfSegment, - mapping: segmentInfo.startOfSegment - timingInfo.start - }; - - if (shouldSaveTimelineMapping) { - this.timelines[segmentInfo.timeline] = mappingObj; - this.trigger('timestampoffset'); - this.logger_("time mapping for timeline " + segmentInfo.timeline + ": " + ("[time: " + mappingObj.time + "] [mapping: " + mappingObj.mapping + "]")); - } - - start = segmentInfo.startOfSegment; - end = timingInfo.end + mappingObj.mapping; - } else if (mappingObj) { - start = timingInfo.start + mappingObj.mapping; - end = timingInfo.end + mappingObj.mapping; - } else { - return false; - } - - if (part) { - part.start = start; - part.end = end; - } // If we don't have a segment start yet or the start value we got - // is less than our current segment.start value, save a new start value. - // We have to do this because parts will have segment timing info saved - // multiple times and we want segment start to be the earliest part start - // value for that segment. - - - if (!segment.start || start < segment.start) { - segment.start = start; - } - - segment.end = end; - return true; - } - /** - * Each time we have discontinuity in the playlist, attempt to calculate the location - * in display of the start of the discontinuity and save that. We also save an accuracy - * value so that we save values with the most accuracy (closest to 0.) - * - * @private - * @param {SegmentInfo} segmentInfo - The current active request information - */ - ; - - _proto.saveDiscontinuitySyncInfo_ = function saveDiscontinuitySyncInfo_(segmentInfo) { - var playlist = segmentInfo.playlist; - var segment = segmentInfo.segment; // If the current segment is a discontinuity then we know exactly where - // the start of the range and it's accuracy is 0 (greater accuracy values - // mean more approximation) - - if (segment.discontinuity) { - this.discontinuities[segment.timeline] = { - time: segment.start, - accuracy: 0 - }; - } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) { - // Search for future discontinuities that we can provide better timing - // information for and save that information for sync purposes - for (var i = 0; i < playlist.discontinuityStarts.length; i++) { - var segmentIndex = playlist.discontinuityStarts[i]; - var discontinuity = playlist.discontinuitySequence + i + 1; - var mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex; - var accuracy = Math.abs(mediaIndexDiff); - - if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) { - var time = void 0; - - if (mediaIndexDiff < 0) { - time = segment.start - sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: segmentInfo.mediaIndex, - endIndex: segmentIndex - }); - } else { - time = segment.end + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: segmentInfo.mediaIndex + 1, - endIndex: segmentIndex - }); - } - - this.discontinuities[discontinuity] = { - time: time, - accuracy: accuracy - }; - } - } - } - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.off(); - }; - - return SyncController; -}(videojs__default['default'].EventTarget); - -/** - * The TimelineChangeController acts as a source for segment loaders to listen for and - * keep track of latest and pending timeline changes. This is useful to ensure proper - * sync, as each loader may need to make a consideration for what timeline the other - * loader is on before making changes which could impact the other loader's media. - * - * @class TimelineChangeController - * @extends videojs.EventTarget - */ - -var TimelineChangeController = /*#__PURE__*/function (_videojs$EventTarget) { - _inheritsLoose__default['default'](TimelineChangeController, _videojs$EventTarget); - - function TimelineChangeController() { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - _this.pendingTimelineChanges_ = {}; - _this.lastTimelineChanges_ = {}; - return _this; - } - - var _proto = TimelineChangeController.prototype; - - _proto.clearPendingTimelineChange = function clearPendingTimelineChange(type) { - this.pendingTimelineChanges_[type] = null; - this.trigger('pendingtimelinechange'); - }; - - _proto.pendingTimelineChange = function pendingTimelineChange(_ref) { - var type = _ref.type, - from = _ref.from, - to = _ref.to; - - if (typeof from === 'number' && typeof to === 'number') { - this.pendingTimelineChanges_[type] = { - type: type, - from: from, - to: to - }; - this.trigger('pendingtimelinechange'); - } - - return this.pendingTimelineChanges_[type]; - }; - - _proto.lastTimelineChange = function lastTimelineChange(_ref2) { - var type = _ref2.type, - from = _ref2.from, - to = _ref2.to; - - if (typeof from === 'number' && typeof to === 'number') { - this.lastTimelineChanges_[type] = { - type: type, - from: from, - to: to - }; - delete this.pendingTimelineChanges_[type]; - this.trigger('timelinechange'); - } - - return this.lastTimelineChanges_[type]; - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.pendingTimelineChanges_ = {}; - this.lastTimelineChanges_ = {}; - this.off(); - }; - - return TimelineChangeController; -}(videojs__default['default'].EventTarget); - -/* rollup-plugin-worker-factory start for worker!/Users/gkatsevman/p/http-streaming-release/src/decrypter-worker.js */ -var workerCode = transform(getWorkerString(function () { - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function require(path, base) { - return commonjsRequire(path, base === undefined || base === null ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire() { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var createClass = createCommonjsModule(function (module) { - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - module.exports = _createClass; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - var setPrototypeOf = createCommonjsModule(function (module) { - function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _setPrototypeOf(o, p); - } - - module.exports = _setPrototypeOf; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - var inheritsLoose = createCommonjsModule(function (module) { - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); - } - - module.exports = _inheritsLoose; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - /** - * @file stream.js - */ - - /** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ - - var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; - }(); - /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ - - /** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - - - function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); - } - /*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */ - - /** - * @file aes.js - * - * This file contains an adaptation of the AES decryption algorithm - * from the Standford Javascript Cryptography Library. That work is - * covered by the following copyright and permissions notice: - * - * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 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. - * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing - * official policies, either expressed or implied, of the authors. - */ - - /** - * Expand the S-box tables. - * - * @private - */ - - - var precompute = function precompute() { - var tables = [[[], [], [], [], []], [[], [], [], [], []]]; - var encTable = tables[0]; - var decTable = tables[1]; - var sbox = encTable[4]; - var sboxInv = decTable[4]; - var i; - var x; - var xInv; - var d = []; - var th = []; - var x2; - var x4; - var x8; - var s; - var tEnc; - var tDec; // Compute double and third tables - - for (i = 0; i < 256; i++) { - th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i; - } - - for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) { - // Compute sbox - s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4; - s = s >> 8 ^ s & 255 ^ 99; - sbox[x] = s; - sboxInv[s] = x; // Compute MixColumns - - x8 = d[x4 = d[x2 = d[x]]]; - tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - tEnc = d[s] * 0x101 ^ s * 0x1010100; - - for (i = 0; i < 4; i++) { - encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8; - decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8; - } - } // Compactify. Considerable speedup on Firefox. - - - for (i = 0; i < 5; i++) { - encTable[i] = encTable[i].slice(0); - decTable[i] = decTable[i].slice(0); - } - - return tables; - }; - - var aesTables = null; - /** - * Schedule out an AES key for both encryption and decryption. This - * is a low-level class. Use a cipher mode to do bulk encryption. - * - * @class AES - * @param key {Array} The key as an array of 4, 6 or 8 words. - */ - - var AES = /*#__PURE__*/function () { - function AES(key) { - /** - * The expanded S-box and inverse S-box tables. These will be computed - * on the client so that we don't have to send them down the wire. - * - * There are two tables, _tables[0] is for encryption and - * _tables[1] is for decryption. - * - * The first 4 sub-tables are the expanded S-box with MixColumns. The - * last (_tables[01][4]) is the S-box itself. - * - * @private - */ - // if we have yet to precompute the S-box tables - // do so now - if (!aesTables) { - aesTables = precompute(); - } // then make a copy of that object for use - - - this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]]; - var i; - var j; - var tmp; - var sbox = this._tables[0][4]; - var decTable = this._tables[1]; - var keyLen = key.length; - var rcon = 1; - - if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) { - throw new Error('Invalid aes key size'); - } - - var encKey = key.slice(0); - var decKey = []; - this._key = [encKey, decKey]; // schedule encryption keys - - for (i = keyLen; i < 4 * keyLen + 28; i++) { - tmp = encKey[i - 1]; // apply sbox - - if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) { - tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; // shift rows and add rcon - - if (i % keyLen === 0) { - tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24; - rcon = rcon << 1 ^ (rcon >> 7) * 283; - } - } - - encKey[i] = encKey[i - keyLen] ^ tmp; - } // schedule decryption keys - - - for (j = 0; i; j++, i--) { - tmp = encKey[j & 3 ? i : i - 4]; - - if (i <= 4 || j < 4) { - decKey[j] = tmp; - } else { - decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]]; - } - } - } - /** - * Decrypt 16 bytes, specified as four 32-bit words. - * - * @param {number} encrypted0 the first word to decrypt - * @param {number} encrypted1 the second word to decrypt - * @param {number} encrypted2 the third word to decrypt - * @param {number} encrypted3 the fourth word to decrypt - * @param {Int32Array} out the array to write the decrypted words - * into - * @param {number} offset the offset into the output array to start - * writing results - * @return {Array} The plaintext. - */ - - - var _proto = AES.prototype; - - _proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) { - var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data - - var a = encrypted0 ^ key[0]; - var b = encrypted3 ^ key[1]; - var c = encrypted2 ^ key[2]; - var d = encrypted1 ^ key[3]; - var a2; - var b2; - var c2; // key.length === 2 ? - - var nInnerRounds = key.length / 4 - 2; - var i; - var kIndex = 4; - var table = this._tables[1]; // load up the tables - - var table0 = table[0]; - var table1 = table[1]; - var table2 = table[2]; - var table3 = table[3]; - var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL. - - for (i = 0; i < nInnerRounds; i++) { - a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex]; - b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1]; - c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2]; - d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3]; - kIndex += 4; - a = a2; - b = b2; - c = c2; - } // Last round. - - - for (i = 0; i < 4; i++) { - out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++]; - a2 = a; - a = b; - b = c; - c = d; - d = a2; - } - }; - - return AES; - }(); - /** - * A wrapper around the Stream class to use setTimeout - * and run stream "jobs" Asynchronously - * - * @class AsyncStream - * @extends Stream - */ - - - var AsyncStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(AsyncStream, _Stream); - - function AsyncStream() { - var _this; - - _this = _Stream.call(this, Stream) || this; - _this.jobs = []; - _this.delay = 1; - _this.timeout_ = null; - return _this; - } - /** - * process an async job - * - * @private - */ - - - var _proto = AsyncStream.prototype; - - _proto.processJob_ = function processJob_() { - this.jobs.shift()(); - - if (this.jobs.length) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } else { - this.timeout_ = null; - } - } - /** - * push a job into the stream - * - * @param {Function} job the job to push into the stream - */ - ; - - _proto.push = function push(job) { - this.jobs.push(job); - - if (!this.timeout_) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } - }; - - return AsyncStream; - }(Stream); - /** - * Convert network-order (big-endian) bytes into their little-endian - * representation. - */ - - - var ntoh = function ntoh(word) { - return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24; - }; - /** - * Decrypt bytes using AES-128 with CBC and PKCS#7 padding. - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * use for the first round of CBC. - * @return {Uint8Array} the decrypted bytes - * - * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard - * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29 - * @see https://tools.ietf.org/html/rfc2315 - */ - - - var decrypt = function decrypt(encrypted, key, initVector) { - // word-level access to the encrypted bytes - var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2); - var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output - - var decrypted = new Uint8Array(encrypted.byteLength); - var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and - // decrypted data - - var init0; - var init1; - var init2; - var init3; - var encrypted0; - var encrypted1; - var encrypted2; - var encrypted3; // iteration variable - - var wordIx; // pull out the words of the IV to ensure we don't modify the - // passed-in reference and easier access - - init0 = initVector[0]; - init1 = initVector[1]; - init2 = initVector[2]; - init3 = initVector[3]; // decrypt four word sequences, applying cipher-block chaining (CBC) - // to each decrypted block - - for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { - // convert big-endian (network order) words into little-endian - // (javascript order) - encrypted0 = ntoh(encrypted32[wordIx]); - encrypted1 = ntoh(encrypted32[wordIx + 1]); - encrypted2 = ntoh(encrypted32[wordIx + 2]); - encrypted3 = ntoh(encrypted32[wordIx + 3]); // decrypt the block - - decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); // XOR with the IV, and restore network byte-order to obtain the - // plaintext - - decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0); - decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1); - decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2); - decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); // setup the IV for the next round - - init0 = encrypted0; - init1 = encrypted1; - init2 = encrypted2; - init3 = encrypted3; - } - - return decrypted; - }; - /** - * The `Decrypter` class that manages decryption of AES - * data through `AsyncStream` objects and the `decrypt` - * function - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * @param {Function} done the function to run when done - * @class Decrypter - */ - - - var Decrypter = /*#__PURE__*/function () { - function Decrypter(encrypted, key, initVector, done) { - var step = Decrypter.STEP; - var encrypted32 = new Int32Array(encrypted.buffer); - var decrypted = new Uint8Array(encrypted.byteLength); - var i = 0; - this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously - - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - - for (i = step; i < encrypted32.length; i += step) { - initVector = new Uint32Array([ntoh(encrypted32[i - 4]), ntoh(encrypted32[i - 3]), ntoh(encrypted32[i - 2]), ntoh(encrypted32[i - 1])]); - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - } // invoke the done() callback when everything is finished - - - this.asyncStream_.push(function () { - // remove pkcs#7 padding from the decrypted bytes - done(null, unpad(decrypted)); - }); - } - /** - * a getter for step the maximum number of bytes to process at one time - * - * @return {number} the value of step 32000 - */ - - - var _proto = Decrypter.prototype; - /** - * @private - */ - - _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) { - return function () { - var bytes = decrypt(encrypted, key, initVector); - decrypted.set(bytes, encrypted.byteOffset); - }; - }; - - createClass(Decrypter, null, [{ - key: "STEP", - get: function get() { - // 4 * 8000; - return 32000; - } - }]); - return Decrypter; - }(); - /** - * @file bin-utils.js - */ - - /** - * Creates an object for sending to a web worker modifying properties that are TypedArrays - * into a new object with seperated properties for the buffer, byteOffset, and byteLength. - * - * @param {Object} message - * Object of properties and values to send to the web worker - * @return {Object} - * Modified message with TypedArray values expanded - * @function createTransferableMessage - */ - - - var createTransferableMessage = function createTransferableMessage(message) { - var transferable = {}; - Object.keys(message).forEach(function (key) { - var value = message[key]; - - if (ArrayBuffer.isView(value)) { - transferable[key] = { - bytes: value.buffer, - byteOffset: value.byteOffset, - byteLength: value.byteLength - }; - } else { - transferable[key] = value; - } - }); - return transferable; - }; - /* global self */ - - /** - * Our web worker interface so that things can talk to aes-decrypter - * that will be running in a web worker. the scope is passed to this by - * webworkify. - */ - - - self.onmessage = function (event) { - var data = event.data; - var encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength); - var key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4); - var iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4); - /* eslint-disable no-new, handle-callback-err */ - - new Decrypter(encrypted, key, iv, function (err, bytes) { - self.postMessage(createTransferableMessage({ - source: data.source, - decrypted: bytes - }), [bytes.buffer]); - }); - /* eslint-enable */ - }; -})); -var Decrypter = factory(workerCode); -/* rollup-plugin-worker-factory end for worker!/Users/gkatsevman/p/http-streaming-release/src/decrypter-worker.js */ - -/** - * Convert the properties of an HLS track into an audioTrackKind. - * - * @private - */ - -var audioTrackKind_ = function audioTrackKind_(properties) { - var kind = properties.default ? 'main' : 'alternative'; - - if (properties.characteristics && properties.characteristics.indexOf('public.accessibility.describes-video') >= 0) { - kind = 'main-desc'; - } - - return kind; -}; -/** - * Pause provided segment loader and playlist loader if active - * - * @param {SegmentLoader} segmentLoader - * SegmentLoader to pause - * @param {Object} mediaType - * Active media type - * @function stopLoaders - */ - - -var stopLoaders = function stopLoaders(segmentLoader, mediaType) { - segmentLoader.abort(); - segmentLoader.pause(); - - if (mediaType && mediaType.activePlaylistLoader) { - mediaType.activePlaylistLoader.pause(); - mediaType.activePlaylistLoader = null; - } -}; -/** - * Start loading provided segment loader and playlist loader - * - * @param {PlaylistLoader} playlistLoader - * PlaylistLoader to start loading - * @param {Object} mediaType - * Active media type - * @function startLoaders - */ - -var startLoaders = function startLoaders(playlistLoader, mediaType) { - // Segment loader will be started after `loadedmetadata` or `loadedplaylist` from the - // playlist loader - mediaType.activePlaylistLoader = playlistLoader; - playlistLoader.load(); -}; -/** - * Returns a function to be called when the media group changes. It performs a - * non-destructive (preserve the buffer) resync of the SegmentLoader. This is because a - * change of group is merely a rendition switch of the same content at another encoding, - * rather than a change of content, such as switching audio from English to Spanish. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Handler for a non-destructive resync of SegmentLoader when the active media - * group changes. - * @function onGroupChanged - */ - -var onGroupChanged = function onGroupChanged(type, settings) { - return function () { - var _settings$segmentLoad = settings.segmentLoaders, - segmentLoader = _settings$segmentLoad[type], - mainSegmentLoader = _settings$segmentLoad.main, - mediaType = settings.mediaTypes[type]; - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.getActiveGroup(); - var previousActiveLoader = mediaType.activePlaylistLoader; - var lastGroup = mediaType.lastGroup_; // the group did not change do nothing - - if (activeGroup && lastGroup && activeGroup.id === lastGroup.id) { - return; - } - - mediaType.lastGroup_ = activeGroup; - mediaType.lastTrack_ = activeTrack; - stopLoaders(segmentLoader, mediaType); - - if (!activeGroup || activeGroup.isMasterPlaylist) { - // there is no group active or active group is a main playlist and won't change - return; - } - - if (!activeGroup.playlistLoader) { - if (previousActiveLoader) { - // The previous group had a playlist loader but the new active group does not - // this means we are switching from demuxed to muxed audio. In this case we want to - // do a destructive reset of the main segment loader and not restart the audio - // loaders. - mainSegmentLoader.resetEverything(); - } - - return; - } // Non-destructive resync - - - segmentLoader.resyncLoader(); - startLoaders(activeGroup.playlistLoader, mediaType); - }; -}; -var onGroupChanging = function onGroupChanging(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - mediaType.lastGroup_ = null; - segmentLoader.abort(); - segmentLoader.pause(); - }; -}; -/** - * Returns a function to be called when the media track changes. It performs a - * destructive reset of the SegmentLoader to ensure we start loading as close to - * currentTime as possible. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Handler for a destructive reset of SegmentLoader when the active media - * track changes. - * @function onTrackChanged - */ - -var onTrackChanged = function onTrackChanged(type, settings) { - return function () { - var masterPlaylistLoader = settings.masterPlaylistLoader, - _settings$segmentLoad2 = settings.segmentLoaders, - segmentLoader = _settings$segmentLoad2[type], - mainSegmentLoader = _settings$segmentLoad2.main, - mediaType = settings.mediaTypes[type]; - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.getActiveGroup(); - var previousActiveLoader = mediaType.activePlaylistLoader; - var lastTrack = mediaType.lastTrack_; // track did not change, do nothing - - if (lastTrack && activeTrack && lastTrack.id === activeTrack.id) { - return; - } - - mediaType.lastGroup_ = activeGroup; - mediaType.lastTrack_ = activeTrack; - stopLoaders(segmentLoader, mediaType); - - if (!activeGroup) { - // there is no group active so we do not want to restart loaders - return; - } - - if (activeGroup.isMasterPlaylist) { - // track did not change, do nothing - if (!activeTrack || !lastTrack || activeTrack.id === lastTrack.id) { - return; - } - - var mpc = settings.vhs.masterPlaylistController_; - var newPlaylist = mpc.selectPlaylist(); // media will not change do nothing - - if (mpc.media() === newPlaylist) { - return; - } - - mediaType.logger_("track change. Switching master audio from " + lastTrack.id + " to " + activeTrack.id); - masterPlaylistLoader.pause(); - mainSegmentLoader.resetEverything(); - mpc.fastQualityChange_(newPlaylist); - return; - } - - if (type === 'AUDIO') { - if (!activeGroup.playlistLoader) { - // when switching from demuxed audio/video to muxed audio/video (noted by no - // playlist loader for the audio group), we want to do a destructive reset of the - // main segment loader and not restart the audio loaders - mainSegmentLoader.setAudio(true); // don't have to worry about disabling the audio of the audio segment loader since - // it should be stopped - - mainSegmentLoader.resetEverything(); - return; - } // although the segment loader is an audio segment loader, call the setAudio - // function to ensure it is prepared to re-append the init segment (or handle other - // config changes) - - - segmentLoader.setAudio(true); - mainSegmentLoader.setAudio(false); - } - - if (previousActiveLoader === activeGroup.playlistLoader) { - // Nothing has actually changed. This can happen because track change events can fire - // multiple times for a "single" change. One for enabling the new active track, and - // one for disabling the track that was active - startLoaders(activeGroup.playlistLoader, mediaType); - return; - } - - if (segmentLoader.track) { - // For WebVTT, set the new text track in the segmentloader - segmentLoader.track(activeTrack); - } // destructive reset - - - segmentLoader.resetEverything(); - startLoaders(activeGroup.playlistLoader, mediaType); - }; -}; -var onError = { - /** - * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters - * an error. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Error handler. Logs warning (or error if the playlist is blacklisted) to - * console and switches back to default audio track. - * @function onError.AUDIO - */ - AUDIO: function AUDIO(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type], - blacklistCurrentPlaylist = settings.blacklistCurrentPlaylist; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track - - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.activeGroup(); - var id = (activeGroup.filter(function (group) { - return group.default; - })[0] || activeGroup[0]).id; - var defaultTrack = mediaType.tracks[id]; - - if (activeTrack === defaultTrack) { - // Default track encountered an error. All we can do now is blacklist the current - // rendition and hope another will switch audio groups - blacklistCurrentPlaylist({ - message: 'Problem encountered loading the default audio track.' - }); - return; - } - - videojs__default['default'].log.warn('Problem encountered loading the alternate audio track.' + 'Switching back to default.'); - - for (var trackId in mediaType.tracks) { - mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack; - } - - mediaType.onTrackChanged(); - }; - }, - - /** - * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters - * an error. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Error handler. Logs warning to console and disables the active subtitle track - * @function onError.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - videojs__default['default'].log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); - var track = mediaType.activeTrack(); - - if (track) { - track.mode = 'disabled'; - } - - mediaType.onTrackChanged(); - }; - } -}; -var setupListeners = { - /** - * Setup event listeners for audio playlist loader - * - * @param {string} type - * MediaGroup type - * @param {PlaylistLoader|null} playlistLoader - * PlaylistLoader to register listeners on - * @param {Object} settings - * Object containing required information for media groups - * @function setupListeners.AUDIO - */ - AUDIO: function AUDIO(type, playlistLoader, settings) { - if (!playlistLoader) { - // no playlist loader means audio will be muxed with the video - return; - } - - var tech = settings.tech, - requestOptions = settings.requestOptions, - segmentLoader = settings.segmentLoaders[type]; - playlistLoader.on('loadedmetadata', function () { - var media = playlistLoader.media(); - segmentLoader.playlist(media, requestOptions); // if the video is already playing, or if this isn't a live video and preload - // permits, start downloading segments - - if (!tech.paused() || media.endList && tech.preload() !== 'none') { - segmentLoader.load(); - } - }); - playlistLoader.on('loadedplaylist', function () { - segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running - - if (!tech.paused()) { - segmentLoader.load(); - } - }); - playlistLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup event listeners for subtitle playlist loader - * - * @param {string} type - * MediaGroup type - * @param {PlaylistLoader|null} playlistLoader - * PlaylistLoader to register listeners on - * @param {Object} settings - * Object containing required information for media groups - * @function setupListeners.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, playlistLoader, settings) { - var tech = settings.tech, - requestOptions = settings.requestOptions, - segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - playlistLoader.on('loadedmetadata', function () { - var media = playlistLoader.media(); - segmentLoader.playlist(media, requestOptions); - segmentLoader.track(mediaType.activeTrack()); // if the video is already playing, or if this isn't a live video and preload - // permits, start downloading segments - - if (!tech.paused() || media.endList && tech.preload() !== 'none') { - segmentLoader.load(); - } - }); - playlistLoader.on('loadedplaylist', function () { - segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running - - if (!tech.paused()) { - segmentLoader.load(); - } - }); - playlistLoader.on('error', onError[type](type, settings)); - } -}; -var initialize = { - /** - * Setup PlaylistLoaders and AudioTracks for the audio groups - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize.AUDIO - */ - 'AUDIO': function AUDIO(type, settings) { - var vhs = settings.vhs, - sourceType = settings.sourceType, - segmentLoader = settings.segmentLoaders[type], - requestOptions = settings.requestOptions, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$ = settings.mediaTypes[type], - groups = _settings$mediaTypes$.groups, - tracks = _settings$mediaTypes$.tracks, - logger_ = _settings$mediaTypes$.logger_, - masterPlaylistLoader = settings.masterPlaylistLoader; - var audioOnlyMaster = isAudioOnly(masterPlaylistLoader.master); // force a default if we have none - - if (!mediaGroups[type] || Object.keys(mediaGroups[type]).length === 0) { - mediaGroups[type] = { - main: { - default: { - default: true - } - } - }; - } - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - var properties = mediaGroups[type][groupId][variantLabel]; - var playlistLoader = void 0; - - if (audioOnlyMaster) { - logger_("AUDIO group '" + groupId + "' label '" + variantLabel + "' is a master playlist"); - properties.isMasterPlaylist = true; - playlistLoader = null; // if vhs-json was provided as the source, and the media playlist was resolved, - // use the resolved media playlist object - } else if (sourceType === 'vhs-json' && properties.playlists) { - playlistLoader = new PlaylistLoader(properties.playlists[0], vhs, requestOptions); - } else if (properties.resolvedUri) { - playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions); // TODO: dash isn't the only type with properties.playlists - // should we even have properties.playlists in this check. - } else if (properties.playlists && sourceType === 'dash') { - playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader); - } else { - // no resolvedUri means the audio is muxed with the video when using this - // audio track - playlistLoader = null; - } - - properties = videojs__default['default'].mergeOptions({ - id: variantLabel, - playlistLoader: playlistLoader - }, properties); - setupListeners[type](type, properties.playlistLoader, settings); - groups[groupId].push(properties); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = new videojs__default['default'].AudioTrack({ - id: variantLabel, - kind: audioTrackKind_(properties), - enabled: false, - language: properties.language, - default: properties.default, - label: variantLabel - }); - tracks[variantLabel] = track; - } - } - } // setup single error event handler for the segment loader - - - segmentLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup PlaylistLoaders and TextTracks for the subtitle groups - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize.SUBTITLES - */ - 'SUBTITLES': function SUBTITLES(type, settings) { - var tech = settings.tech, - vhs = settings.vhs, - sourceType = settings.sourceType, - segmentLoader = settings.segmentLoaders[type], - requestOptions = settings.requestOptions, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$2 = settings.mediaTypes[type], - groups = _settings$mediaTypes$2.groups, - tracks = _settings$mediaTypes$2.tracks, - masterPlaylistLoader = settings.masterPlaylistLoader; - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - if (mediaGroups[type][groupId][variantLabel].forced) { - // Subtitle playlists with the forced attribute are not selectable in Safari. - // According to Apple's HLS Authoring Specification: - // If content has forced subtitles and regular subtitles in a given language, - // the regular subtitles track in that language MUST contain both the forced - // subtitles and the regular subtitles for that language. - // Because of this requirement and that Safari does not add forced subtitles, - // forced subtitles are skipped here to maintain consistent experience across - // all platforms - continue; - } - - var properties = mediaGroups[type][groupId][variantLabel]; - var playlistLoader = void 0; - - if (sourceType === 'hls') { - playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions); - } else if (sourceType === 'dash') { - var playlists = properties.playlists.filter(function (p) { - return p.excludeUntil !== Infinity; - }); - - if (!playlists.length) { - return; - } - - playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader); - } else if (sourceType === 'vhs-json') { - playlistLoader = new PlaylistLoader( // if the vhs-json object included the media playlist, use the media playlist - // as provided, otherwise use the resolved URI to load the playlist - properties.playlists ? properties.playlists[0] : properties.resolvedUri, vhs, requestOptions); - } - - properties = videojs__default['default'].mergeOptions({ - id: variantLabel, - playlistLoader: playlistLoader - }, properties); - setupListeners[type](type, properties.playlistLoader, settings); - groups[groupId].push(properties); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = tech.addRemoteTextTrack({ - id: variantLabel, - kind: 'subtitles', - default: properties.default && properties.autoselect, - language: properties.language, - label: variantLabel - }, false).track; - tracks[variantLabel] = track; - } - } - } // setup single error event handler for the segment loader - - - segmentLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup TextTracks for the closed-caption groups - * - * @param {String} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize['CLOSED-CAPTIONS'] - */ - 'CLOSED-CAPTIONS': function CLOSEDCAPTIONS(type, settings) { - var tech = settings.tech, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$3 = settings.mediaTypes[type], - groups = _settings$mediaTypes$3.groups, - tracks = _settings$mediaTypes$3.tracks; - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - var properties = mediaGroups[type][groupId][variantLabel]; // Look for either 608 (CCn) or 708 (SERVICEn) caption services - - if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) { - continue; - } - - var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {}; - var newProps = { - label: variantLabel, - language: properties.language, - instreamId: properties.instreamId, - default: properties.default && properties.autoselect - }; - - if (captionServices[newProps.instreamId]) { - newProps = videojs__default['default'].mergeOptions(newProps, captionServices[newProps.instreamId]); - } - - if (newProps.default === undefined) { - delete newProps.default; - } // No PlaylistLoader is required for Closed-Captions because the captions are - // embedded within the video stream - - - groups[groupId].push(videojs__default['default'].mergeOptions({ - id: variantLabel - }, properties)); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = tech.addRemoteTextTrack({ - id: newProps.instreamId, - kind: 'captions', - default: newProps.default, - language: newProps.language, - label: newProps.label - }, false).track; - tracks[variantLabel] = track; - } - } - } - } -}; - -var groupMatch = function groupMatch(list, media) { - for (var i = 0; i < list.length; i++) { - if (playlistMatch(media, list[i])) { - return true; - } - - if (list[i].playlists && groupMatch(list[i].playlists, media)) { - return true; - } - } - - return false; -}; -/** - * Returns a function used to get the active group of the provided type - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media group for the provided type. Takes an - * optional parameter {TextTrack} track. If no track is provided, a list of all - * variants in the group, otherwise the variant corresponding to the provided - * track is returned. - * @function activeGroup - */ - - -var activeGroup = function activeGroup(type, settings) { - return function (track) { - var masterPlaylistLoader = settings.masterPlaylistLoader, - groups = settings.mediaTypes[type].groups; - var media = masterPlaylistLoader.media(); - - if (!media) { - return null; - } - - var variants = null; // set to variants to main media active group - - if (media.attributes[type]) { - variants = groups[media.attributes[type]]; - } - - var groupKeys = Object.keys(groups); - - if (!variants) { - // find the masterPlaylistLoader media - // that is in a media group if we are dealing - // with audio only - if (type === 'AUDIO' && groupKeys.length > 1 && isAudioOnly(settings.master)) { - for (var i = 0; i < groupKeys.length; i++) { - var groupPropertyList = groups[groupKeys[i]]; - - if (groupMatch(groupPropertyList, media)) { - variants = groupPropertyList; - break; - } - } // use the main group if it exists - - } else if (groups.main) { - variants = groups.main; // only one group, use that one - } else if (groupKeys.length === 1) { - variants = groups[groupKeys[0]]; - } - } - - if (typeof track === 'undefined') { - return variants; - } - - if (track === null || !variants) { - // An active track was specified so a corresponding group is expected. track === null - // means no track is currently active so there is no corresponding group - return null; - } - - return variants.filter(function (props) { - return props.id === track.id; - })[0] || null; - }; -}; -var activeTrack = { - /** - * Returns a function used to get the active track of type provided - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media track for the provided type. Returns - * null if no track is active - * @function activeTrack.AUDIO - */ - AUDIO: function AUDIO(type, settings) { - return function () { - var tracks = settings.mediaTypes[type].tracks; - - for (var id in tracks) { - if (tracks[id].enabled) { - return tracks[id]; - } - } - - return null; - }; - }, - - /** - * Returns a function used to get the active track of type provided - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media track for the provided type. Returns - * null if no track is active - * @function activeTrack.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, settings) { - return function () { - var tracks = settings.mediaTypes[type].tracks; - - for (var id in tracks) { - if (tracks[id].mode === 'showing' || tracks[id].mode === 'hidden') { - return tracks[id]; - } - } - - return null; - }; - } -}; -var getActiveGroup = function getActiveGroup(type, _ref) { - var mediaTypes = _ref.mediaTypes; - return function () { - var activeTrack_ = mediaTypes[type].activeTrack(); - - if (!activeTrack_) { - return null; - } - - return mediaTypes[type].activeGroup(activeTrack_); - }; -}; -/** - * Setup PlaylistLoaders and Tracks for media groups (Audio, Subtitles, - * Closed-Captions) specified in the master manifest. - * - * @param {Object} settings - * Object containing required information for setting up the media groups - * @param {Tech} settings.tech - * The tech of the player - * @param {Object} settings.requestOptions - * XHR request options used by the segment loaders - * @param {PlaylistLoader} settings.masterPlaylistLoader - * PlaylistLoader for the master source - * @param {VhsHandler} settings.vhs - * VHS SourceHandler - * @param {Object} settings.master - * The parsed master manifest - * @param {Object} settings.mediaTypes - * Object to store the loaders, tracks, and utility methods for each media type - * @param {Function} settings.blacklistCurrentPlaylist - * Blacklists the current rendition and forces a rendition switch. - * @function setupMediaGroups - */ - -var setupMediaGroups = function setupMediaGroups(settings) { - ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(function (type) { - initialize[type](type, settings); - }); - var mediaTypes = settings.mediaTypes, - masterPlaylistLoader = settings.masterPlaylistLoader, - tech = settings.tech, - vhs = settings.vhs, - _settings$segmentLoad3 = settings.segmentLoaders, - audioSegmentLoader = _settings$segmentLoad3['AUDIO'], - mainSegmentLoader = _settings$segmentLoad3.main; // setup active group and track getters and change event handlers - - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - mediaTypes[type].activeGroup = activeGroup(type, settings); - mediaTypes[type].activeTrack = activeTrack[type](type, settings); - mediaTypes[type].onGroupChanged = onGroupChanged(type, settings); - mediaTypes[type].onGroupChanging = onGroupChanging(type, settings); - mediaTypes[type].onTrackChanged = onTrackChanged(type, settings); - mediaTypes[type].getActiveGroup = getActiveGroup(type, settings); - }); // DO NOT enable the default subtitle or caption track. - // DO enable the default audio track - - var audioGroup = mediaTypes.AUDIO.activeGroup(); - - if (audioGroup) { - var groupId = (audioGroup.filter(function (group) { - return group.default; - })[0] || audioGroup[0]).id; - mediaTypes.AUDIO.tracks[groupId].enabled = true; - mediaTypes.AUDIO.onGroupChanged(); - mediaTypes.AUDIO.onTrackChanged(); - var activeAudioGroup = mediaTypes.AUDIO.getActiveGroup(); // a similar check for handling setAudio on each loader is run again each time the - // track is changed, but needs to be handled here since the track may not be considered - // changed on the first call to onTrackChanged - - if (!activeAudioGroup.playlistLoader) { - // either audio is muxed with video or the stream is audio only - mainSegmentLoader.setAudio(true); - } else { - // audio is demuxed - mainSegmentLoader.setAudio(false); - audioSegmentLoader.setAudio(true); - } - } - - masterPlaylistLoader.on('mediachange', function () { - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - return mediaTypes[type].onGroupChanged(); - }); - }); - masterPlaylistLoader.on('mediachanging', function () { - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - return mediaTypes[type].onGroupChanging(); - }); - }); // custom audio track change event handler for usage event - - var onAudioTrackChanged = function onAudioTrackChanged() { - mediaTypes.AUDIO.onTrackChanged(); - tech.trigger({ - type: 'usage', - name: 'vhs-audio-change' - }); - tech.trigger({ - type: 'usage', - name: 'hls-audio-change' - }); - }; - - tech.audioTracks().addEventListener('change', onAudioTrackChanged); - tech.remoteTextTracks().addEventListener('change', mediaTypes.SUBTITLES.onTrackChanged); - vhs.on('dispose', function () { - tech.audioTracks().removeEventListener('change', onAudioTrackChanged); - tech.remoteTextTracks().removeEventListener('change', mediaTypes.SUBTITLES.onTrackChanged); - }); // clear existing audio tracks and add the ones we just created - - tech.clearTracks('audio'); - - for (var id in mediaTypes.AUDIO.tracks) { - tech.audioTracks().addTrack(mediaTypes.AUDIO.tracks[id]); - } -}; -/** - * Creates skeleton object used to store the loaders, tracks, and utility methods for each - * media type - * - * @return {Object} - * Object to store the loaders, tracks, and utility methods for each media type - * @function createMediaTypes - */ - -var createMediaTypes = function createMediaTypes() { - var mediaTypes = {}; - ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(function (type) { - mediaTypes[type] = { - groups: {}, - tracks: {}, - activePlaylistLoader: null, - activeGroup: noop, - activeTrack: noop, - getActiveGroup: noop, - onGroupChanged: noop, - onTrackChanged: noop, - lastTrack_: null, - logger_: logger("MediaGroups[" + type + "]") - }; - }); - return mediaTypes; -}; - -var ABORT_EARLY_BLACKLIST_SECONDS = 60 * 2; -var Vhs$1; // SegmentLoader stats that need to have each loader's -// values summed to calculate the final value - -var loaderStats = ['mediaRequests', 'mediaRequestsAborted', 'mediaRequestsTimedout', 'mediaRequestsErrored', 'mediaTransferDuration', 'mediaBytesTransferred', 'mediaAppends']; - -var sumLoaderStat = function sumLoaderStat(stat) { - return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat]; -}; - -var shouldSwitchToMedia = function shouldSwitchToMedia(_ref) { - var currentPlaylist = _ref.currentPlaylist, - nextPlaylist = _ref.nextPlaylist, - forwardBuffer = _ref.forwardBuffer, - bufferLowWaterLine = _ref.bufferLowWaterLine, - bufferHighWaterLine = _ref.bufferHighWaterLine, - duration = _ref.duration, - experimentalBufferBasedABR = _ref.experimentalBufferBasedABR, - log = _ref.log; - - // we have no other playlist to switch to - if (!nextPlaylist) { - videojs__default['default'].log.warn('We received no playlist to switch to. Please check your stream.'); - return false; - } - - var sharedLogLine = "allowing switch " + (currentPlaylist && currentPlaylist.id || 'null') + " -> " + nextPlaylist.id; // If the playlist is live, then we want to not take low water line into account. - // This is because in LIVE, the player plays 3 segments from the end of the - // playlist, and if `BUFFER_LOW_WATER_LINE` is greater than the duration availble - // in those segments, a viewer will never experience a rendition upswitch. - - if (!currentPlaylist || !currentPlaylist.endList) { - log(sharedLogLine + " as current playlist " + (!currentPlaylist ? 'is not set' : 'is live')); - return true; - } // no need to switch playlist is the same - - - if (nextPlaylist.id === currentPlaylist.id) { - return false; - } - - var maxBufferLowWaterLine = experimentalBufferBasedABR ? Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config.MAX_BUFFER_LOW_WATER_LINE; // For the same reason as LIVE, we ignore the low water line when the VOD - // duration is below the max potential low water line - - if (duration < maxBufferLowWaterLine) { - log(sharedLogLine + " as duration < max low water line (" + duration + " < " + maxBufferLowWaterLine + ")"); - return true; - } - - var nextBandwidth = nextPlaylist.attributes.BANDWIDTH; - var currBandwidth = currentPlaylist.attributes.BANDWIDTH; // when switching down, if our buffer is lower than the high water line, - // we can switch down - - if (nextBandwidth < currBandwidth && (!experimentalBufferBasedABR || forwardBuffer < bufferHighWaterLine)) { - var logLine = sharedLogLine + " as next bandwidth < current bandwidth (" + nextBandwidth + " < " + currBandwidth + ")"; - - if (experimentalBufferBasedABR) { - logLine += " and forwardBuffer < bufferHighWaterLine (" + forwardBuffer + " < " + bufferHighWaterLine + ")"; - } - - log(logLine); - return true; - } // and if our buffer is higher than the low water line, - // we can switch up - - - if ((!experimentalBufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) { - var _logLine = sharedLogLine + " as forwardBuffer >= bufferLowWaterLine (" + forwardBuffer + " >= " + bufferLowWaterLine + ")"; - - if (experimentalBufferBasedABR) { - _logLine += " and next bandwidth > current bandwidth (" + nextBandwidth + " > " + currBandwidth + ")"; - } - - log(_logLine); - return true; - } - - log("not " + sharedLogLine + " as no switching criteria met"); - return false; -}; -/** - * the master playlist controller controller all interactons - * between playlists and segmentloaders. At this time this mainly - * involves a master playlist and a series of audio playlists - * if they are available - * - * @class MasterPlaylistController - * @extends videojs.EventTarget - */ - - -var MasterPlaylistController = /*#__PURE__*/function (_videojs$EventTarget) { - _inheritsLoose__default['default'](MasterPlaylistController, _videojs$EventTarget); - - function MasterPlaylistController(options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - var src = options.src, - handleManifestRedirects = options.handleManifestRedirects, - withCredentials = options.withCredentials, - tech = options.tech, - bandwidth = options.bandwidth, - externVhs = options.externVhs, - useCueTags = options.useCueTags, - blacklistDuration = options.blacklistDuration, - enableLowInitialPlaylist = options.enableLowInitialPlaylist, - sourceType = options.sourceType, - cacheEncryptionKeys = options.cacheEncryptionKeys, - experimentalBufferBasedABR = options.experimentalBufferBasedABR; - - if (!src) { - throw new Error('A non-empty playlist URL or JSON manifest string is required'); - } - - var maxPlaylistRetries = options.maxPlaylistRetries; - - if (maxPlaylistRetries === null || typeof maxPlaylistRetries === 'undefined') { - maxPlaylistRetries = Infinity; - } - - Vhs$1 = externVhs; - _this.experimentalBufferBasedABR = Boolean(experimentalBufferBasedABR); - _this.withCredentials = withCredentials; - _this.tech_ = tech; - _this.vhs_ = tech.vhs; - _this.sourceType_ = sourceType; - _this.useCueTags_ = useCueTags; - _this.blacklistDuration = blacklistDuration; - _this.maxPlaylistRetries = maxPlaylistRetries; - _this.enableLowInitialPlaylist = enableLowInitialPlaylist; - - if (_this.useCueTags_) { - _this.cueTagsTrack_ = _this.tech_.addTextTrack('metadata', 'ad-cues'); - _this.cueTagsTrack_.inBandMetadataTrackDispatchType = ''; - } - - _this.requestOptions_ = { - withCredentials: withCredentials, - handleManifestRedirects: handleManifestRedirects, - maxPlaylistRetries: maxPlaylistRetries, - timeout: null - }; - - _this.on('error', _this.pauseLoading); - - _this.mediaTypes_ = createMediaTypes(); - _this.mediaSource = new window__default['default'].MediaSource(); - _this.handleDurationChange_ = _this.handleDurationChange_.bind(_assertThisInitialized__default['default'](_this)); - _this.handleSourceOpen_ = _this.handleSourceOpen_.bind(_assertThisInitialized__default['default'](_this)); - _this.handleSourceEnded_ = _this.handleSourceEnded_.bind(_assertThisInitialized__default['default'](_this)); - - _this.mediaSource.addEventListener('durationchange', _this.handleDurationChange_); // load the media source into the player - - - _this.mediaSource.addEventListener('sourceopen', _this.handleSourceOpen_); - - _this.mediaSource.addEventListener('sourceended', _this.handleSourceEnded_); // we don't have to handle sourceclose since dispose will handle termination of - // everything, and the MediaSource should not be detached without a proper disposal - - - _this.seekable_ = videojs__default['default'].createTimeRanges(); - _this.hasPlayed_ = false; - _this.syncController_ = new SyncController(options); - _this.segmentMetadataTrack_ = tech.addRemoteTextTrack({ - kind: 'metadata', - label: 'segment-metadata' - }, false).track; - _this.decrypter_ = new Decrypter(); - _this.sourceUpdater_ = new SourceUpdater(_this.mediaSource); - _this.inbandTextTracks_ = {}; - _this.timelineChangeController_ = new TimelineChangeController(); - var segmentLoaderSettings = { - vhs: _this.vhs_, - parse708captions: options.parse708captions, - mediaSource: _this.mediaSource, - currentTime: _this.tech_.currentTime.bind(_this.tech_), - seekable: function seekable() { - return _this.seekable(); - }, - seeking: function seeking() { - return _this.tech_.seeking(); - }, - duration: function duration() { - return _this.duration(); - }, - hasPlayed: function hasPlayed() { - return _this.hasPlayed_; - }, - goalBufferLength: function goalBufferLength() { - return _this.goalBufferLength(); - }, - bandwidth: bandwidth, - syncController: _this.syncController_, - decrypter: _this.decrypter_, - sourceType: _this.sourceType_, - inbandTextTracks: _this.inbandTextTracks_, - cacheEncryptionKeys: cacheEncryptionKeys, - sourceUpdater: _this.sourceUpdater_, - timelineChangeController: _this.timelineChangeController_ - }; // The source type check not only determines whether a special DASH playlist loader - // should be used, but also covers the case where the provided src is a vhs-json - // manifest object (instead of a URL). In the case of vhs-json, the default - // PlaylistLoader should be used. - - _this.masterPlaylistLoader_ = _this.sourceType_ === 'dash' ? new DashPlaylistLoader(src, _this.vhs_, _this.requestOptions_) : new PlaylistLoader(src, _this.vhs_, _this.requestOptions_); - - _this.setupMasterPlaylistLoaderListeners_(); // setup segment loaders - // combined audio/video or just video when alternate audio track is selected - - - _this.mainSegmentLoader_ = new SegmentLoader(videojs__default['default'].mergeOptions(segmentLoaderSettings, { - segmentMetadataTrack: _this.segmentMetadataTrack_, - loaderType: 'main' - }), options); // alternate audio track - - _this.audioSegmentLoader_ = new SegmentLoader(videojs__default['default'].mergeOptions(segmentLoaderSettings, { - loaderType: 'audio' - }), options); - _this.subtitleSegmentLoader_ = new VTTSegmentLoader(videojs__default['default'].mergeOptions(segmentLoaderSettings, { - loaderType: 'vtt', - featuresNativeTextTracks: _this.tech_.featuresNativeTextTracks - }), options); - - _this.setupSegmentLoaderListeners_(); - - if (_this.experimentalBufferBasedABR) { - _this.masterPlaylistLoader_.one('loadedplaylist', function () { - return _this.startABRTimer_(); - }); - - _this.tech_.on('pause', function () { - return _this.stopABRTimer_(); - }); - - _this.tech_.on('play', function () { - return _this.startABRTimer_(); - }); - } // Create SegmentLoader stat-getters - // mediaRequests_ - // mediaRequestsAborted_ - // mediaRequestsTimedout_ - // mediaRequestsErrored_ - // mediaTransferDuration_ - // mediaBytesTransferred_ - // mediaAppends_ - - - loaderStats.forEach(function (stat) { - _this[stat + '_'] = sumLoaderStat.bind(_assertThisInitialized__default['default'](_this), stat); - }); - _this.logger_ = logger('MPC'); - _this.triggeredFmp4Usage = false; - - if (_this.tech_.preload() === 'none') { - _this.loadOnPlay_ = function () { - _this.loadOnPlay_ = null; - - _this.masterPlaylistLoader_.load(); - }; - - _this.tech_.one('play', _this.loadOnPlay_); - } else { - _this.masterPlaylistLoader_.load(); - } - - _this.timeToLoadedData__ = -1; - _this.mainAppendsToLoadedData__ = -1; - _this.audioAppendsToLoadedData__ = -1; - var event = _this.tech_.preload() === 'none' ? 'play' : 'loadstart'; // start the first frame timer on loadstart or play (for preload none) - - _this.tech_.one(event, function () { - var timeToLoadedDataStart = Date.now(); - - _this.tech_.one('loadeddata', function () { - _this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart; - _this.mainAppendsToLoadedData__ = _this.mainSegmentLoader_.mediaAppends; - _this.audioAppendsToLoadedData__ = _this.audioSegmentLoader_.mediaAppends; - }); - }); - - return _this; - } - - var _proto = MasterPlaylistController.prototype; - - _proto.mainAppendsToLoadedData_ = function mainAppendsToLoadedData_() { - return this.mainAppendsToLoadedData__; - }; - - _proto.audioAppendsToLoadedData_ = function audioAppendsToLoadedData_() { - return this.audioAppendsToLoadedData__; - }; - - _proto.appendsToLoadedData_ = function appendsToLoadedData_() { - var main = this.mainAppendsToLoadedData_(); - var audio = this.audioAppendsToLoadedData_(); - - if (main === -1 || audio === -1) { - return -1; - } - - return main + audio; - }; - - _proto.timeToLoadedData_ = function timeToLoadedData_() { - return this.timeToLoadedData__; - } - /** - * Run selectPlaylist and switch to the new playlist if we should - * - * @private - * - */ - ; - - _proto.checkABR_ = function checkABR_() { - var nextPlaylist = this.selectPlaylist(); - - if (this.shouldSwitchToMedia_(nextPlaylist)) { - this.switchMedia_(nextPlaylist, 'abr'); - } - }; - - _proto.switchMedia_ = function switchMedia_(playlist, cause, delay) { - var oldMedia = this.media(); - var oldId = oldMedia && (oldMedia.id || oldMedia.uri); - var newId = playlist.id || playlist.uri; - - if (oldId && oldId !== newId) { - this.logger_("switch media " + oldId + " -> " + newId + " from " + cause); - this.tech_.trigger({ - type: 'usage', - name: "vhs-rendition-change-" + cause - }); - } - - this.masterPlaylistLoader_.media(playlist, delay); - } - /** - * Start a timer that periodically calls checkABR_ - * - * @private - */ - ; - - _proto.startABRTimer_ = function startABRTimer_() { - var _this2 = this; - - this.stopABRTimer_(); - this.abrTimer_ = window__default['default'].setInterval(function () { - return _this2.checkABR_(); - }, 250); - } - /** - * Stop the timer that periodically calls checkABR_ - * - * @private - */ - ; - - _proto.stopABRTimer_ = function stopABRTimer_() { - // if we're scrubbing, we don't need to pause. - // This getter will be added to Video.js in version 7.11. - if (this.tech_.scrubbing && this.tech_.scrubbing()) { - return; - } - - window__default['default'].clearInterval(this.abrTimer_); - this.abrTimer_ = null; - } - /** - * Get a list of playlists for the currently selected audio playlist - * - * @return {Array} the array of audio playlists - */ - ; - - _proto.getAudioTrackPlaylists_ = function getAudioTrackPlaylists_() { - var master = this.master(); // if we don't have any audio groups then we can only - // assume that the audio tracks are contained in masters - // playlist array, use that or an empty array. - - if (!master || !master.mediaGroups || !master.mediaGroups.AUDIO) { - return master && master.playlists || []; - } - - var AUDIO = master.mediaGroups.AUDIO; - var groupKeys = Object.keys(AUDIO); - var track; // get the current active track - - if (Object.keys(this.mediaTypes_.AUDIO.groups).length) { - track = this.mediaTypes_.AUDIO.activeTrack(); // or get the default track from master if mediaTypes_ isn't setup yet - } else { - // default group is `main` or just the first group. - var defaultGroup = AUDIO.main || groupKeys.length && AUDIO[groupKeys[0]]; - - for (var label in defaultGroup) { - if (defaultGroup[label].default) { - track = { - label: label - }; - break; - } - } - } // no active track no playlists. - - - if (!track) { - return []; - } - - var playlists = []; // get all of the playlists that are possible for the - // active track. - - for (var group in AUDIO) { - if (AUDIO[group][track.label]) { - var properties = AUDIO[group][track.label]; - - if (properties.playlists) { - playlists.push.apply(playlists, properties.playlists); - } else { - playlists.push(properties); - } - } - } - - return playlists; - } - /** - * Register event handlers on the master playlist loader. A helper - * function for construction time. - * - * @private - */ - ; - - _proto.setupMasterPlaylistLoaderListeners_ = function setupMasterPlaylistLoaderListeners_() { - var _this3 = this; - - this.masterPlaylistLoader_.on('loadedmetadata', function () { - var media = _this3.masterPlaylistLoader_.media(); - - var requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to - // timeout the request. - - if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) { - _this3.requestOptions_.timeout = 0; - } else { - _this3.requestOptions_.timeout = requestTimeout; - } // if this isn't a live video and preload permits, start - // downloading segments - - - if (media.endList && _this3.tech_.preload() !== 'none') { - _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_); - - _this3.mainSegmentLoader_.load(); - } - - setupMediaGroups({ - sourceType: _this3.sourceType_, - segmentLoaders: { - AUDIO: _this3.audioSegmentLoader_, - SUBTITLES: _this3.subtitleSegmentLoader_, - main: _this3.mainSegmentLoader_ - }, - tech: _this3.tech_, - requestOptions: _this3.requestOptions_, - masterPlaylistLoader: _this3.masterPlaylistLoader_, - vhs: _this3.vhs_, - master: _this3.master(), - mediaTypes: _this3.mediaTypes_, - blacklistCurrentPlaylist: _this3.blacklistCurrentPlaylist.bind(_this3) - }); - - _this3.triggerPresenceUsage_(_this3.master(), media); - - _this3.setupFirstPlay(); - - if (!_this3.mediaTypes_.AUDIO.activePlaylistLoader || _this3.mediaTypes_.AUDIO.activePlaylistLoader.media()) { - _this3.trigger('selectedinitialmedia'); - } else { - // We must wait for the active audio playlist loader to - // finish setting up before triggering this event so the - // representations API and EME setup is correct - _this3.mediaTypes_.AUDIO.activePlaylistLoader.one('loadedmetadata', function () { - _this3.trigger('selectedinitialmedia'); - }); - } - }); - this.masterPlaylistLoader_.on('loadedplaylist', function () { - if (_this3.loadOnPlay_) { - _this3.tech_.off('play', _this3.loadOnPlay_); - } - - var updatedPlaylist = _this3.masterPlaylistLoader_.media(); - - if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting - // an initial media as the playlist selectors do not consider browser support - _this3.excludeUnsupportedVariants_(); - - var selectedMedia; - - if (_this3.enableLowInitialPlaylist) { - selectedMedia = _this3.selectInitialPlaylist(); - } - - if (!selectedMedia) { - selectedMedia = _this3.selectPlaylist(); - } - - if (!selectedMedia || !_this3.shouldSwitchToMedia_(selectedMedia)) { - return; - } - - _this3.initialMedia_ = selectedMedia; - - _this3.switchMedia_(_this3.initialMedia_, 'initial'); // Under the standard case where a source URL is provided, loadedplaylist will - // fire again since the playlist will be requested. In the case of vhs-json - // (where the manifest object is provided as the source), when the media - // playlist's `segments` list is already available, a media playlist won't be - // requested, and loadedplaylist won't fire again, so the playlist handler must be - // called on its own here. - - - var haveJsonSource = _this3.sourceType_ === 'vhs-json' && _this3.initialMedia_.segments; - - if (!haveJsonSource) { - return; - } - - updatedPlaylist = _this3.initialMedia_; - } - - _this3.handleUpdatedMediaPlaylist(updatedPlaylist); - }); - this.masterPlaylistLoader_.on('error', function () { - _this3.blacklistCurrentPlaylist(_this3.masterPlaylistLoader_.error); - }); - this.masterPlaylistLoader_.on('mediachanging', function () { - _this3.mainSegmentLoader_.abort(); - - _this3.mainSegmentLoader_.pause(); - }); - this.masterPlaylistLoader_.on('mediachange', function () { - var media = _this3.masterPlaylistLoader_.media(); - - var requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to - // timeout the request. - - if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) { - _this3.requestOptions_.timeout = 0; - } else { - _this3.requestOptions_.timeout = requestTimeout; - } // TODO: Create a new event on the PlaylistLoader that signals - // that the segments have changed in some way and use that to - // update the SegmentLoader instead of doing it twice here and - // on `loadedplaylist` - - - _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_); - - _this3.mainSegmentLoader_.load(); - - _this3.tech_.trigger({ - type: 'mediachange', - bubbles: true - }); - }); - this.masterPlaylistLoader_.on('playlistunchanged', function () { - var updatedPlaylist = _this3.masterPlaylistLoader_.media(); // ignore unchanged playlists that have already been - // excluded for not-changing. We likely just have a really slowly updating - // playlist. - - - if (updatedPlaylist.lastExcludeReason_ === 'playlist-unchanged') { - return; - } - - var playlistOutdated = _this3.stuckAtPlaylistEnd_(updatedPlaylist); - - if (playlistOutdated) { - // Playlist has stopped updating and we're stuck at its end. Try to - // blacklist it and switch to another playlist in the hope that that - // one is updating (and give the player a chance to re-adjust to the - // safe live point). - _this3.blacklistCurrentPlaylist({ - message: 'Playlist no longer updating.', - reason: 'playlist-unchanged' - }); // useful for monitoring QoS - - - _this3.tech_.trigger('playliststuck'); - } - }); - this.masterPlaylistLoader_.on('renditiondisabled', function () { - _this3.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-disabled' - }); - - _this3.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-disabled' - }); - }); - this.masterPlaylistLoader_.on('renditionenabled', function () { - _this3.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-enabled' - }); - - _this3.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-enabled' - }); - }); - } - /** - * Given an updated media playlist (whether it was loaded for the first time, or - * refreshed for live playlists), update any relevant properties and state to reflect - * changes in the media that should be accounted for (e.g., cues and duration). - * - * @param {Object} updatedPlaylist the updated media playlist object - * - * @private - */ - ; - - _proto.handleUpdatedMediaPlaylist = function handleUpdatedMediaPlaylist(updatedPlaylist) { - if (this.useCueTags_) { - this.updateAdCues_(updatedPlaylist); - } // TODO: Create a new event on the PlaylistLoader that signals - // that the segments have changed in some way and use that to - // update the SegmentLoader instead of doing it twice here and - // on `mediachange` - - - this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_); - this.updateDuration(!updatedPlaylist.endList); // If the player isn't paused, ensure that the segment loader is running, - // as it is possible that it was temporarily stopped while waiting for - // a playlist (e.g., in case the playlist errored and we re-requested it). - - if (!this.tech_.paused()) { - this.mainSegmentLoader_.load(); - - if (this.audioSegmentLoader_) { - this.audioSegmentLoader_.load(); - } - } - } - /** - * A helper function for triggerring presence usage events once per source - * - * @private - */ - ; - - _proto.triggerPresenceUsage_ = function triggerPresenceUsage_(master, media) { - var mediaGroups = master.mediaGroups || {}; - var defaultDemuxed = true; - var audioGroupKeys = Object.keys(mediaGroups.AUDIO); - - for (var mediaGroup in mediaGroups.AUDIO) { - for (var label in mediaGroups.AUDIO[mediaGroup]) { - var properties = mediaGroups.AUDIO[mediaGroup][label]; - - if (!properties.uri) { - defaultDemuxed = false; - } - } - } - - if (defaultDemuxed) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-demuxed' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-demuxed' - }); - } - - if (Object.keys(mediaGroups.SUBTITLES).length) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-webvtt' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-webvtt' - }); - } - - if (Vhs$1.Playlist.isAes(media)) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-aes' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-aes' - }); - } - - if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-alternate-audio' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-alternate-audio' - }); - } - - if (this.useCueTags_) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-playlist-cue-tags' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-playlist-cue-tags' - }); - } - }; - - _proto.shouldSwitchToMedia_ = function shouldSwitchToMedia_(nextPlaylist) { - var currentPlaylist = this.masterPlaylistLoader_.media(); - var buffered = this.tech_.buffered(); - var forwardBuffer = buffered.length ? buffered.end(buffered.length - 1) - this.tech_.currentTime() : 0; - var bufferLowWaterLine = this.bufferLowWaterLine(); - var bufferHighWaterLine = this.bufferHighWaterLine(); - return shouldSwitchToMedia({ - currentPlaylist: currentPlaylist, - nextPlaylist: nextPlaylist, - forwardBuffer: forwardBuffer, - bufferLowWaterLine: bufferLowWaterLine, - bufferHighWaterLine: bufferHighWaterLine, - duration: this.duration(), - experimentalBufferBasedABR: this.experimentalBufferBasedABR, - log: this.logger_ - }); - } - /** - * Register event handlers on the segment loaders. A helper function - * for construction time. - * - * @private - */ - ; - - _proto.setupSegmentLoaderListeners_ = function setupSegmentLoaderListeners_() { - var _this4 = this; - - if (!this.experimentalBufferBasedABR) { - this.mainSegmentLoader_.on('bandwidthupdate', function () { - var nextPlaylist = _this4.selectPlaylist(); - - if (_this4.shouldSwitchToMedia_(nextPlaylist)) { - _this4.switchMedia_(nextPlaylist, 'bandwidthupdate'); - } - - _this4.tech_.trigger('bandwidthupdate'); - }); - this.mainSegmentLoader_.on('progress', function () { - _this4.trigger('progress'); - }); - } - - this.mainSegmentLoader_.on('error', function () { - _this4.blacklistCurrentPlaylist(_this4.mainSegmentLoader_.error()); - }); - this.mainSegmentLoader_.on('appenderror', function () { - _this4.error = _this4.mainSegmentLoader_.error_; - - _this4.trigger('error'); - }); - this.mainSegmentLoader_.on('syncinfoupdate', function () { - _this4.onSyncInfoUpdate_(); - }); - this.mainSegmentLoader_.on('timestampoffset', function () { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-timestamp-offset' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-timestamp-offset' - }); - }); - this.audioSegmentLoader_.on('syncinfoupdate', function () { - _this4.onSyncInfoUpdate_(); - }); - this.audioSegmentLoader_.on('appenderror', function () { - _this4.error = _this4.audioSegmentLoader_.error_; - - _this4.trigger('error'); - }); - this.mainSegmentLoader_.on('ended', function () { - _this4.logger_('main segment loader ended'); - - _this4.onEndOfStream(); - }); - this.mainSegmentLoader_.on('earlyabort', function (event) { - // never try to early abort with the new ABR algorithm - if (_this4.experimentalBufferBasedABR) { - return; - } - - _this4.delegateLoaders_('all', ['abort']); - - _this4.blacklistCurrentPlaylist({ - message: 'Aborted early because there isn\'t enough bandwidth to complete the ' + 'request without rebuffering.' - }, ABORT_EARLY_BLACKLIST_SECONDS); - }); - - var updateCodecs = function updateCodecs() { - if (!_this4.sourceUpdater_.hasCreatedSourceBuffers()) { - return _this4.tryToCreateSourceBuffers_(); - } - - var codecs = _this4.getCodecsOrExclude_(); // no codecs means that the playlist was excluded - - - if (!codecs) { - return; - } - - _this4.sourceUpdater_.addOrChangeSourceBuffers(codecs); - }; - - this.mainSegmentLoader_.on('trackinfo', updateCodecs); - this.audioSegmentLoader_.on('trackinfo', updateCodecs); - this.mainSegmentLoader_.on('fmp4', function () { - if (!_this4.triggeredFmp4Usage) { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-fmp4' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-fmp4' - }); - - _this4.triggeredFmp4Usage = true; - } - }); - this.audioSegmentLoader_.on('fmp4', function () { - if (!_this4.triggeredFmp4Usage) { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-fmp4' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-fmp4' - }); - - _this4.triggeredFmp4Usage = true; - } - }); - this.audioSegmentLoader_.on('ended', function () { - _this4.logger_('audioSegmentLoader ended'); - - _this4.onEndOfStream(); - }); - }; - - _proto.mediaSecondsLoaded_ = function mediaSecondsLoaded_() { - return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded); - } - /** - * Call load on our SegmentLoaders - */ - ; - - _proto.load = function load() { - this.mainSegmentLoader_.load(); - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - this.audioSegmentLoader_.load(); - } - - if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) { - this.subtitleSegmentLoader_.load(); - } - } - /** - * Re-tune playback quality level for the current player - * conditions without performing destructive actions, like - * removing already buffered content - * - * @private - * @deprecated - */ - ; - - _proto.smoothQualityChange_ = function smoothQualityChange_(media) { - if (media === void 0) { - media = this.selectPlaylist(); - } - - this.fastQualityChange_(media); - } - /** - * Re-tune playback quality level for the current player - * conditions. This method will perform destructive actions like removing - * already buffered content in order to readjust the currently active - * playlist quickly. This is good for manual quality changes - * - * @private - */ - ; - - _proto.fastQualityChange_ = function fastQualityChange_(media) { - var _this5 = this; - - if (media === void 0) { - media = this.selectPlaylist(); - } - - if (media === this.masterPlaylistLoader_.media()) { - this.logger_('skipping fastQualityChange because new media is same as old'); - return; - } - - this.switchMedia_(media, 'fast-quality'); // Delete all buffered data to allow an immediate quality switch, then seek to give - // the browser a kick to remove any cached frames from the previous rendtion (.04 seconds - // ahead is roughly the minimum that will accomplish this across a variety of content - // in IE and Edge, but seeking in place is sufficient on all other browsers) - // Edge/IE bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14600375/ - // Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=651904 - - this.mainSegmentLoader_.resetEverything(function () { - // Since this is not a typical seek, we avoid the seekTo method which can cause segments - // from the previously enabled rendition to load before the new playlist has finished loading - if (videojs__default['default'].browser.IE_VERSION || videojs__default['default'].browser.IS_EDGE) { - _this5.tech_.setCurrentTime(_this5.tech_.currentTime() + 0.04); - } else { - _this5.tech_.setCurrentTime(_this5.tech_.currentTime()); - } - }); // don't need to reset audio as it is reset when media changes - } - /** - * Begin playback. - */ - ; - - _proto.play = function play() { - if (this.setupFirstPlay()) { - return; - } - - if (this.tech_.ended()) { - this.tech_.setCurrentTime(0); - } - - if (this.hasPlayed_) { - this.load(); - } - - var seekable = this.tech_.seekable(); // if the viewer has paused and we fell out of the live window, - // seek forward to the live point - - if (this.tech_.duration() === Infinity) { - if (this.tech_.currentTime() < seekable.start(0)) { - return this.tech_.setCurrentTime(seekable.end(seekable.length - 1)); - } - } - } - /** - * Seek to the latest media position if this is a live video and the - * player and video are loaded and initialized. - */ - ; - - _proto.setupFirstPlay = function setupFirstPlay() { - var _this6 = this; - - var media = this.masterPlaylistLoader_.media(); // Check that everything is ready to begin buffering for the first call to play - // If 1) there is no active media - // 2) the player is paused - // 3) the first play has already been setup - // then exit early - - if (!media || this.tech_.paused() || this.hasPlayed_) { - return false; - } // when the video is a live stream - - - if (!media.endList) { - var seekable = this.seekable(); - - if (!seekable.length) { - // without a seekable range, the player cannot seek to begin buffering at the live - // point - return false; - } - - if (videojs__default['default'].browser.IE_VERSION && this.tech_.readyState() === 0) { - // IE11 throws an InvalidStateError if you try to set currentTime while the - // readyState is 0, so it must be delayed until the tech fires loadedmetadata. - this.tech_.one('loadedmetadata', function () { - _this6.trigger('firstplay'); - - _this6.tech_.setCurrentTime(seekable.end(0)); - - _this6.hasPlayed_ = true; - }); - return false; - } // trigger firstplay to inform the source handler to ignore the next seek event - - - this.trigger('firstplay'); // seek to the live point - - this.tech_.setCurrentTime(seekable.end(0)); - } - - this.hasPlayed_ = true; // we can begin loading now that everything is ready - - this.load(); - return true; - } - /** - * handle the sourceopen event on the MediaSource - * - * @private - */ - ; - - _proto.handleSourceOpen_ = function handleSourceOpen_() { - // Only attempt to create the source buffer if none already exist. - // handleSourceOpen is also called when we are "re-opening" a source buffer - // after `endOfStream` has been called (in response to a seek for instance) - this.tryToCreateSourceBuffers_(); // if autoplay is enabled, begin playback. This is duplicative of - // code in video.js but is required because play() must be invoked - // *after* the media source has opened. - - if (this.tech_.autoplay()) { - var playPromise = this.tech_.play(); // Catch/silence error when a pause interrupts a play request - // on browsers which return a promise - - if (typeof playPromise !== 'undefined' && typeof playPromise.then === 'function') { - playPromise.then(null, function (e) {}); - } - } - - this.trigger('sourceopen'); - } - /** - * handle the sourceended event on the MediaSource - * - * @private - */ - ; - - _proto.handleSourceEnded_ = function handleSourceEnded_() { - if (!this.inbandTextTracks_.metadataTrack_) { - return; - } - - var cues = this.inbandTextTracks_.metadataTrack_.cues; - - if (!cues || !cues.length) { - return; - } - - var duration = this.duration(); - cues[cues.length - 1].endTime = isNaN(duration) || Math.abs(duration) === Infinity ? Number.MAX_VALUE : duration; - } - /** - * handle the durationchange event on the MediaSource - * - * @private - */ - ; - - _proto.handleDurationChange_ = function handleDurationChange_() { - this.tech_.trigger('durationchange'); - } - /** - * Calls endOfStream on the media source when all active stream types have called - * endOfStream - * - * @param {string} streamType - * Stream type of the segment loader that called endOfStream - * @private - */ - ; - - _proto.onEndOfStream = function onEndOfStream() { - var isEndOfStream = this.mainSegmentLoader_.ended_; - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - // if the audio playlist loader exists, then alternate audio is active - if (!this.mainSegmentLoader_.currentMediaInfo_ || this.mainSegmentLoader_.currentMediaInfo_.hasVideo) { - // if we do not know if the main segment loader contains video yet or if we - // definitively know the main segment loader contains video, then we need to wait - // for both main and audio segment loaders to call endOfStream - isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_; - } else { - // otherwise just rely on the audio loader - isEndOfStream = this.audioSegmentLoader_.ended_; - } - } - - if (!isEndOfStream) { - return; - } - - this.stopABRTimer_(); - this.sourceUpdater_.endOfStream(); - } - /** - * Check if a playlist has stopped being updated - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist has stopped being updated or not - */ - ; - - _proto.stuckAtPlaylistEnd_ = function stuckAtPlaylistEnd_(playlist) { - var seekable = this.seekable(); - - if (!seekable.length) { - // playlist doesn't have enough information to determine whether we are stuck - return false; - } - - var expired = this.syncController_.getExpiredTime(playlist, this.duration()); - - if (expired === null) { - return false; - } // does not use the safe live end to calculate playlist end, since we - // don't want to say we are stuck while there is still content - - - var absolutePlaylistEnd = Vhs$1.Playlist.playlistEnd(playlist, expired); - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - - if (!buffered.length) { - // return true if the playhead reached the absolute end of the playlist - return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA; - } - - var bufferedEnd = buffered.end(buffered.length - 1); // return true if there is too little buffer left and buffer has reached absolute - // end of playlist - - return bufferedEnd - currentTime <= SAFE_TIME_DELTA && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA; - } - /** - * Blacklists a playlist when an error occurs for a set amount of time - * making it unavailable for selection by the rendition selection algorithm - * and then forces a new playlist (rendition) selection. - * - * @param {Object=} error an optional error that may include the playlist - * to blacklist - * @param {number=} blacklistDuration an optional number of seconds to blacklist the - * playlist - */ - ; - - _proto.blacklistCurrentPlaylist = function blacklistCurrentPlaylist(error, blacklistDuration) { - if (error === void 0) { - error = {}; - } - - // If the `error` was generated by the playlist loader, it will contain - // the playlist we were trying to load (but failed) and that should be - // blacklisted instead of the currently selected playlist which is likely - // out-of-date in this scenario - var currentPlaylist = error.playlist || this.masterPlaylistLoader_.media(); - blacklistDuration = blacklistDuration || error.blacklistDuration || this.blacklistDuration; // If there is no current playlist, then an error occurred while we were - // trying to load the master OR while we were disposing of the tech - - if (!currentPlaylist) { - this.error = error; - - if (this.mediaSource.readyState !== 'open') { - this.trigger('error'); - } else { - this.sourceUpdater_.endOfStream('network'); - } - - return; - } - - currentPlaylist.playlistErrors_++; - var playlists = this.masterPlaylistLoader_.master.playlists; - var enabledPlaylists = playlists.filter(isEnabled); - var isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === currentPlaylist; // Don't blacklist the only playlist unless it was blacklisted - // forever - - if (playlists.length === 1 && blacklistDuration !== Infinity) { - videojs__default['default'].log.warn("Problem encountered with playlist " + currentPlaylist.id + ". " + 'Trying again since it is the only playlist.'); - this.tech_.trigger('retryplaylist'); // if this is a final rendition, we should delay - - return this.masterPlaylistLoader_.load(isFinalRendition); - } - - if (isFinalRendition) { - // Since we're on the final non-blacklisted playlist, and we're about to blacklist - // it, instead of erring the player or retrying this playlist, clear out the current - // blacklist. This allows other playlists to be attempted in case any have been - // fixed. - var reincluded = false; - playlists.forEach(function (playlist) { - // skip current playlist which is about to be blacklisted - if (playlist === currentPlaylist) { - return; - } - - var excludeUntil = playlist.excludeUntil; // a playlist cannot be reincluded if it wasn't excluded to begin with. - - if (typeof excludeUntil !== 'undefined' && excludeUntil !== Infinity) { - reincluded = true; - delete playlist.excludeUntil; - } - }); - - if (reincluded) { - videojs__default['default'].log.warn('Removing other playlists from the exclusion list because the last ' + 'rendition is about to be excluded.'); // Technically we are retrying a playlist, in that we are simply retrying a previous - // playlist. This is needed for users relying on the retryplaylist event to catch a - // case where the player might be stuck and looping through "dead" playlists. - - this.tech_.trigger('retryplaylist'); - } - } // Blacklist this playlist - - - var excludeUntil; - - if (currentPlaylist.playlistErrors_ > this.maxPlaylistRetries) { - excludeUntil = Infinity; - } else { - excludeUntil = Date.now() + blacklistDuration * 1000; - } - - currentPlaylist.excludeUntil = excludeUntil; - - if (error.reason) { - currentPlaylist.lastExcludeReason_ = error.reason; - } - - this.tech_.trigger('blacklistplaylist'); - this.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-blacklisted' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-blacklisted' - }); // TODO: should we select a new playlist if this blacklist wasn't for the currentPlaylist? - // Would be something like media().id !=== currentPlaylist.id and we would need something - // like `pendingMedia` in playlist loaders to check against that too. This will prevent us - // from loading a new playlist on any blacklist. - // Select a new playlist - - var nextPlaylist = this.selectPlaylist(); - - if (!nextPlaylist) { - this.error = 'Playback cannot continue. No available working or supported playlists.'; - this.trigger('error'); - return; - } - - var logFn = error.internal ? this.logger_ : videojs__default['default'].log.warn; - var errorMessage = error.message ? ' ' + error.message : ''; - logFn((error.internal ? 'Internal problem' : 'Problem') + " encountered with playlist " + currentPlaylist.id + "." + (errorMessage + " Switching to playlist " + nextPlaylist.id + ".")); // if audio group changed reset audio loaders - - if (nextPlaylist.attributes.AUDIO !== currentPlaylist.attributes.AUDIO) { - this.delegateLoaders_('audio', ['abort', 'pause']); - } // if subtitle group changed reset subtitle loaders - - - if (nextPlaylist.attributes.SUBTITLES !== currentPlaylist.attributes.SUBTITLES) { - this.delegateLoaders_('subtitle', ['abort', 'pause']); - } - - this.delegateLoaders_('main', ['abort', 'pause']); - var delayDuration = nextPlaylist.targetDuration / 2 * 1000 || 5 * 1000; - var shouldDelay = typeof nextPlaylist.lastRequest === 'number' && Date.now() - nextPlaylist.lastRequest <= delayDuration; // delay if it's a final rendition or if the last refresh is sooner than half targetDuration - - return this.switchMedia_(nextPlaylist, 'exclude', isFinalRendition || shouldDelay); - } - /** - * Pause all segment/playlist loaders - */ - ; - - _proto.pauseLoading = function pauseLoading() { - this.delegateLoaders_('all', ['abort', 'pause']); - this.stopABRTimer_(); - } - /** - * Call a set of functions in order on playlist loaders, segment loaders, - * or both types of loaders. - * - * @param {string} filter - * Filter loaders that should call fnNames using a string. Can be: - * * all - run on all loaders - * * audio - run on all audio loaders - * * subtitle - run on all subtitle loaders - * * main - run on the main/master loaders - * - * @param {Array|string} fnNames - * A string or array of function names to call. - */ - ; - - _proto.delegateLoaders_ = function delegateLoaders_(filter, fnNames) { - var _this7 = this; - - var loaders = []; - var dontFilterPlaylist = filter === 'all'; - - if (dontFilterPlaylist || filter === 'main') { - loaders.push(this.masterPlaylistLoader_); - } - - var mediaTypes = []; - - if (dontFilterPlaylist || filter === 'audio') { - mediaTypes.push('AUDIO'); - } - - if (dontFilterPlaylist || filter === 'subtitle') { - mediaTypes.push('CLOSED-CAPTIONS'); - mediaTypes.push('SUBTITLES'); - } - - mediaTypes.forEach(function (mediaType) { - var loader = _this7.mediaTypes_[mediaType] && _this7.mediaTypes_[mediaType].activePlaylistLoader; - - if (loader) { - loaders.push(loader); - } - }); - ['main', 'audio', 'subtitle'].forEach(function (name) { - var loader = _this7[name + "SegmentLoader_"]; - - if (loader && (filter === name || filter === 'all')) { - loaders.push(loader); - } - }); - loaders.forEach(function (loader) { - return fnNames.forEach(function (fnName) { - if (typeof loader[fnName] === 'function') { - loader[fnName](); - } - }); - }); - } - /** - * set the current time on all segment loaders - * - * @param {TimeRange} currentTime the current time to set - * @return {TimeRange} the current time - */ - ; - - _proto.setCurrentTime = function setCurrentTime(currentTime) { - var buffered = findRange(this.tech_.buffered(), currentTime); - - if (!(this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media())) { - // return immediately if the metadata is not ready yet - return 0; - } // it's clearly an edge-case but don't thrown an error if asked to - // seek within an empty playlist - - - if (!this.masterPlaylistLoader_.media().segments) { - return 0; - } // if the seek location is already buffered, continue buffering as usual - - - if (buffered && buffered.length) { - return currentTime; - } // cancel outstanding requests so we begin buffering at the new - // location - - - this.mainSegmentLoader_.resetEverything(); - this.mainSegmentLoader_.abort(); - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - this.audioSegmentLoader_.resetEverything(); - this.audioSegmentLoader_.abort(); - } - - if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) { - this.subtitleSegmentLoader_.resetEverything(); - this.subtitleSegmentLoader_.abort(); - } // start segment loader loading in case they are paused - - - this.load(); - } - /** - * get the current duration - * - * @return {TimeRange} the duration - */ - ; - - _proto.duration = function duration() { - if (!this.masterPlaylistLoader_) { - return 0; - } - - var media = this.masterPlaylistLoader_.media(); - - if (!media) { - // no playlists loaded yet, so can't determine a duration - return 0; - } // Don't rely on the media source for duration in the case of a live playlist since - // setting the native MediaSource's duration to infinity ends up with consequences to - // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details. - // - // This is resolved in the spec by https://github.com/w3c/media-source/pull/92, - // however, few browsers have support for setLiveSeekableRange() - // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange - // - // Until a time when the duration of the media source can be set to infinity, and a - // seekable range specified across browsers, just return Infinity. - - - if (!media.endList) { - return Infinity; - } // Since this is a VOD video, it is safe to rely on the media source's duration (if - // available). If it's not available, fall back to a playlist-calculated estimate. - - - if (this.mediaSource) { - return this.mediaSource.duration; - } - - return Vhs$1.Playlist.duration(media); - } - /** - * check the seekable range - * - * @return {TimeRange} the seekable range - */ - ; - - _proto.seekable = function seekable() { - return this.seekable_; - }; - - _proto.onSyncInfoUpdate_ = function onSyncInfoUpdate_() { - var audioSeekable; - - if (!this.masterPlaylistLoader_) { - return; - } - - var media = this.masterPlaylistLoader_.media(); - - if (!media) { - return; - } - - var expired = this.syncController_.getExpiredTime(media, this.duration()); - - if (expired === null) { - // not enough information to update seekable - return; - } - - var master = this.masterPlaylistLoader_.master; - var mainSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media)); - - if (mainSeekable.length === 0) { - return; - } - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - media = this.mediaTypes_.AUDIO.activePlaylistLoader.media(); - expired = this.syncController_.getExpiredTime(media, this.duration()); - - if (expired === null) { - return; - } - - audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media)); - - if (audioSeekable.length === 0) { - return; - } - } - - var oldEnd; - var oldStart; - - if (this.seekable_ && this.seekable_.length) { - oldEnd = this.seekable_.end(0); - oldStart = this.seekable_.start(0); - } - - if (!audioSeekable) { - // seekable has been calculated based on buffering video data so it - // can be returned directly - this.seekable_ = mainSeekable; - } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) { - // seekables are pretty far off, rely on main - this.seekable_ = mainSeekable; - } else { - this.seekable_ = videojs__default['default'].createTimeRanges([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]); - } // seekable is the same as last time - - - if (this.seekable_ && this.seekable_.length) { - if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) { - return; - } - } - - this.logger_("seekable updated [" + printableRange(this.seekable_) + "]"); - this.tech_.trigger('seekablechanged'); - } - /** - * Update the player duration - */ - ; - - _proto.updateDuration = function updateDuration(isLive) { - if (this.updateDuration_) { - this.mediaSource.removeEventListener('sourceopen', this.updateDuration_); - this.updateDuration_ = null; - } - - if (this.mediaSource.readyState !== 'open') { - this.updateDuration_ = this.updateDuration.bind(this, isLive); - this.mediaSource.addEventListener('sourceopen', this.updateDuration_); - return; - } - - if (isLive) { - var seekable = this.seekable(); - - if (!seekable.length) { - return; - } // Even in the case of a live playlist, the native MediaSource's duration should not - // be set to Infinity (even though this would be expected for a live playlist), since - // setting the native MediaSource's duration to infinity ends up with consequences to - // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details. - // - // This is resolved in the spec by https://github.com/w3c/media-source/pull/92, - // however, few browsers have support for setLiveSeekableRange() - // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange - // - // Until a time when the duration of the media source can be set to infinity, and a - // seekable range specified across browsers, the duration should be greater than or - // equal to the last possible seekable value. - // MediaSource duration starts as NaN - // It is possible (and probable) that this case will never be reached for many - // sources, since the MediaSource reports duration as the highest value without - // accounting for timestamp offset. For example, if the timestamp offset is -100 and - // we buffered times 0 to 100 with real times of 100 to 200, even though current - // time will be between 0 and 100, the native media source may report the duration - // as 200. However, since we report duration separate from the media source (as - // Infinity), and as long as the native media source duration value is greater than - // our reported seekable range, seeks will work as expected. The large number as - // duration for live is actually a strategy used by some players to work around the - // issue of live seekable ranges cited above. - - - if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable.end(seekable.length - 1)) { - this.sourceUpdater_.setDuration(seekable.end(seekable.length - 1)); - } - - return; - } - - var buffered = this.tech_.buffered(); - var duration = Vhs$1.Playlist.duration(this.masterPlaylistLoader_.media()); - - if (buffered.length > 0) { - duration = Math.max(duration, buffered.end(buffered.length - 1)); - } - - if (this.mediaSource.duration !== duration) { - this.sourceUpdater_.setDuration(duration); - } - } - /** - * dispose of the MasterPlaylistController and everything - * that it controls - */ - ; - - _proto.dispose = function dispose() { - var _this8 = this; - - this.trigger('dispose'); - this.decrypter_.terminate(); - this.masterPlaylistLoader_.dispose(); - this.mainSegmentLoader_.dispose(); - - if (this.loadOnPlay_) { - this.tech_.off('play', this.loadOnPlay_); - } - - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - var groups = _this8.mediaTypes_[type].groups; - - for (var id in groups) { - groups[id].forEach(function (group) { - if (group.playlistLoader) { - group.playlistLoader.dispose(); - } - }); - } - }); - this.audioSegmentLoader_.dispose(); - this.subtitleSegmentLoader_.dispose(); - this.sourceUpdater_.dispose(); - this.timelineChangeController_.dispose(); - this.stopABRTimer_(); - - if (this.updateDuration_) { - this.mediaSource.removeEventListener('sourceopen', this.updateDuration_); - } - - this.mediaSource.removeEventListener('durationchange', this.handleDurationChange_); // load the media source into the player - - this.mediaSource.removeEventListener('sourceopen', this.handleSourceOpen_); - this.mediaSource.removeEventListener('sourceended', this.handleSourceEnded_); - this.off(); - } - /** - * return the master playlist object if we have one - * - * @return {Object} the master playlist object that we parsed - */ - ; - - _proto.master = function master() { - return this.masterPlaylistLoader_.master; - } - /** - * return the currently selected playlist - * - * @return {Object} the currently selected playlist object that we parsed - */ - ; - - _proto.media = function media() { - // playlist loader will not return media if it has not been fully loaded - return this.masterPlaylistLoader_.media() || this.initialMedia_; - }; - - _proto.areMediaTypesKnown_ = function areMediaTypesKnown_() { - var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader; // one or both loaders has not loaded sufficently to get codecs - - if (!this.mainSegmentLoader_.currentMediaInfo_ || usingAudioLoader && !this.audioSegmentLoader_.currentMediaInfo_) { - return false; - } - - return true; - }; - - _proto.getCodecsOrExclude_ = function getCodecsOrExclude_() { - var _this9 = this; - - var media = { - main: this.mainSegmentLoader_.currentMediaInfo_ || {}, - audio: this.audioSegmentLoader_.currentMediaInfo_ || {} - }; // set "main" media equal to video - - media.video = media.main; - var playlistCodecs = codecsForPlaylist(this.master(), this.media()); - var codecs = {}; - var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader; - - if (media.main.hasVideo) { - codecs.video = playlistCodecs.video || media.main.videoCodec || codecs_js.DEFAULT_VIDEO_CODEC; - } - - if (media.main.isMuxed) { - codecs.video += "," + (playlistCodecs.audio || media.main.audioCodec || codecs_js.DEFAULT_AUDIO_CODEC); - } - - if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) { - codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || codecs_js.DEFAULT_AUDIO_CODEC; // set audio isFmp4 so we use the correct "supports" function below - - media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4; - } // no codecs, no playback. - - - if (!codecs.audio && !codecs.video) { - this.blacklistCurrentPlaylist({ - playlist: this.media(), - message: 'Could not determine codecs for playlist.', - blacklistDuration: Infinity - }); - return; - } // fmp4 relies on browser support, while ts relies on muxer support - - - var supportFunction = function supportFunction(isFmp4, codec) { - return isFmp4 ? codecs_js.browserSupportsCodec(codec) : codecs_js.muxerSupportsCodec(codec); - }; - - var unsupportedCodecs = {}; - var unsupportedAudio; - ['video', 'audio'].forEach(function (type) { - if (codecs.hasOwnProperty(type) && !supportFunction(media[type].isFmp4, codecs[type])) { - var supporter = media[type].isFmp4 ? 'browser' : 'muxer'; - unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || []; - unsupportedCodecs[supporter].push(codecs[type]); - - if (type === 'audio') { - unsupportedAudio = supporter; - } - } - }); - - if (usingAudioLoader && unsupportedAudio && this.media().attributes.AUDIO) { - var audioGroup = this.media().attributes.AUDIO; - this.master().playlists.forEach(function (variant) { - var variantAudioGroup = variant.attributes && variant.attributes.AUDIO; - - if (variantAudioGroup === audioGroup && variant !== _this9.media()) { - variant.excludeUntil = Infinity; - } - }); - this.logger_("excluding audio group " + audioGroup + " as " + unsupportedAudio + " does not support codec(s): \"" + codecs.audio + "\""); - } // if we have any unsupported codecs blacklist this playlist. - - - if (Object.keys(unsupportedCodecs).length) { - var message = Object.keys(unsupportedCodecs).reduce(function (acc, supporter) { - if (acc) { - acc += ', '; - } - - acc += supporter + " does not support codec(s): \"" + unsupportedCodecs[supporter].join(',') + "\""; - return acc; - }, '') + '.'; - this.blacklistCurrentPlaylist({ - playlist: this.media(), - internal: true, - message: message, - blacklistDuration: Infinity - }); - return; - } // check if codec switching is happening - - - if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) { - var switchMessages = []; - ['video', 'audio'].forEach(function (type) { - var newCodec = (codecs_js.parseCodecs(_this9.sourceUpdater_.codecs[type] || '')[0] || {}).type; - var oldCodec = (codecs_js.parseCodecs(codecs[type] || '')[0] || {}).type; - - if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) { - switchMessages.push("\"" + _this9.sourceUpdater_.codecs[type] + "\" -> \"" + codecs[type] + "\""); - } - }); - - if (switchMessages.length) { - this.blacklistCurrentPlaylist({ - playlist: this.media(), - message: "Codec switching not supported: " + switchMessages.join(', ') + ".", - blacklistDuration: Infinity, - internal: true - }); - return; - } - } // TODO: when using the muxer shouldn't we just return - // the codecs that the muxer outputs? - - - return codecs; - } - /** - * Create source buffers and exlude any incompatible renditions. - * - * @private - */ - ; - - _proto.tryToCreateSourceBuffers_ = function tryToCreateSourceBuffers_() { - // media source is not ready yet or sourceBuffers are already - // created. - if (this.mediaSource.readyState !== 'open' || this.sourceUpdater_.hasCreatedSourceBuffers()) { - return; - } - - if (!this.areMediaTypesKnown_()) { - return; - } - - var codecs = this.getCodecsOrExclude_(); // no codecs means that the playlist was excluded - - if (!codecs) { - return; - } - - this.sourceUpdater_.createSourceBuffers(codecs); - var codecString = [codecs.video, codecs.audio].filter(Boolean).join(','); - this.excludeIncompatibleVariants_(codecString); - } - /** - * Excludes playlists with codecs that are unsupported by the muxer and browser. - */ - ; - - _proto.excludeUnsupportedVariants_ = function excludeUnsupportedVariants_() { - var _this10 = this; - - var playlists = this.master().playlists; - var ids = []; // TODO: why don't we have a property to loop through all - // playlist? Why did we ever mix indexes and keys? - - Object.keys(playlists).forEach(function (key) { - var variant = playlists[key]; // check if we already processed this playlist. - - if (ids.indexOf(variant.id) !== -1) { - return; - } - - ids.push(variant.id); - var codecs = codecsForPlaylist(_this10.master, variant); - var unsupported = []; - - if (codecs.audio && !codecs_js.muxerSupportsCodec(codecs.audio) && !codecs_js.browserSupportsCodec(codecs.audio)) { - unsupported.push("audio codec " + codecs.audio); - } - - if (codecs.video && !codecs_js.muxerSupportsCodec(codecs.video) && !codecs_js.browserSupportsCodec(codecs.video)) { - unsupported.push("video codec " + codecs.video); - } - - if (codecs.text && codecs.text === 'stpp.ttml.im1t') { - unsupported.push("text codec " + codecs.text); - } - - if (unsupported.length) { - variant.excludeUntil = Infinity; - - _this10.logger_("excluding " + variant.id + " for unsupported: " + unsupported.join(', ')); - } - }); - } - /** - * Blacklist playlists that are known to be codec or - * stream-incompatible with the SourceBuffer configuration. For - * instance, Media Source Extensions would cause the video element to - * stall waiting for video data if you switched from a variant with - * video and audio to an audio-only one. - * - * @param {Object} media a media playlist compatible with the current - * set of SourceBuffers. Variants in the current master playlist that - * do not appear to have compatible codec or stream configurations - * will be excluded from the default playlist selection algorithm - * indefinitely. - * @private - */ - ; - - _proto.excludeIncompatibleVariants_ = function excludeIncompatibleVariants_(codecString) { - var _this11 = this; - - var ids = []; - var playlists = this.master().playlists; - var codecs = unwrapCodecList(codecs_js.parseCodecs(codecString)); - var codecCount_ = codecCount(codecs); - var videoDetails = codecs.video && codecs_js.parseCodecs(codecs.video)[0] || null; - var audioDetails = codecs.audio && codecs_js.parseCodecs(codecs.audio)[0] || null; - Object.keys(playlists).forEach(function (key) { - var variant = playlists[key]; // check if we already processed this playlist. - // or it if it is already excluded forever. - - if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) { - return; - } - - ids.push(variant.id); - var blacklistReasons = []; // get codecs from the playlist for this variant - - var variantCodecs = codecsForPlaylist(_this11.masterPlaylistLoader_.master, variant); - var variantCodecCount = codecCount(variantCodecs); // if no codecs are listed, we cannot determine that this - // variant is incompatible. Wait for mux.js to probe - - if (!variantCodecs.audio && !variantCodecs.video) { - return; - } // TODO: we can support this by removing the - // old media source and creating a new one, but it will take some work. - // The number of streams cannot change - - - if (variantCodecCount !== codecCount_) { - blacklistReasons.push("codec count \"" + variantCodecCount + "\" !== \"" + codecCount_ + "\""); - } // only exclude playlists by codec change, if codecs cannot switch - // during playback. - - - if (!_this11.sourceUpdater_.canChangeType()) { - var variantVideoDetails = variantCodecs.video && codecs_js.parseCodecs(variantCodecs.video)[0] || null; - var variantAudioDetails = variantCodecs.audio && codecs_js.parseCodecs(variantCodecs.audio)[0] || null; // the video codec cannot change - - if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) { - blacklistReasons.push("video codec \"" + variantVideoDetails.type + "\" !== \"" + videoDetails.type + "\""); - } // the audio codec cannot change - - - if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) { - blacklistReasons.push("audio codec \"" + variantAudioDetails.type + "\" !== \"" + audioDetails.type + "\""); - } - } - - if (blacklistReasons.length) { - variant.excludeUntil = Infinity; - - _this11.logger_("blacklisting " + variant.id + ": " + blacklistReasons.join(' && ')); - } - }); - }; - - _proto.updateAdCues_ = function updateAdCues_(media) { - var offset = 0; - var seekable = this.seekable(); - - if (seekable.length) { - offset = seekable.start(0); - } - - updateAdCues(media, this.cueTagsTrack_, offset); - } - /** - * Calculates the desired forward buffer length based on current time - * - * @return {number} Desired forward buffer length in seconds - */ - ; - - _proto.goalBufferLength = function goalBufferLength() { - var currentTime = this.tech_.currentTime(); - var initial = Config.GOAL_BUFFER_LENGTH; - var rate = Config.GOAL_BUFFER_LENGTH_RATE; - var max = Math.max(initial, Config.MAX_GOAL_BUFFER_LENGTH); - return Math.min(initial + currentTime * rate, max); - } - /** - * Calculates the desired buffer low water line based on current time - * - * @return {number} Desired buffer low water line in seconds - */ - ; - - _proto.bufferLowWaterLine = function bufferLowWaterLine() { - var currentTime = this.tech_.currentTime(); - var initial = Config.BUFFER_LOW_WATER_LINE; - var rate = Config.BUFFER_LOW_WATER_LINE_RATE; - var max = Math.max(initial, Config.MAX_BUFFER_LOW_WATER_LINE); - var newMax = Math.max(initial, Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE); - return Math.min(initial + currentTime * rate, this.experimentalBufferBasedABR ? newMax : max); - }; - - _proto.bufferHighWaterLine = function bufferHighWaterLine() { - return Config.BUFFER_HIGH_WATER_LINE; - }; - - return MasterPlaylistController; -}(videojs__default['default'].EventTarget); - -/** - * Returns a function that acts as the Enable/disable playlist function. - * - * @param {PlaylistLoader} loader - The master playlist loader - * @param {string} playlistID - id of the playlist - * @param {Function} changePlaylistFn - A function to be called after a - * playlist's enabled-state has been changed. Will NOT be called if a - * playlist's enabled-state is unchanged - * @param {boolean=} enable - Value to set the playlist enabled-state to - * or if undefined returns the current enabled-state for the playlist - * @return {Function} Function for setting/getting enabled - */ - -var enableFunction = function enableFunction(loader, playlistID, changePlaylistFn) { - return function (enable) { - var playlist = loader.master.playlists[playlistID]; - var incompatible = isIncompatible(playlist); - var currentlyEnabled = isEnabled(playlist); - - if (typeof enable === 'undefined') { - return currentlyEnabled; - } - - if (enable) { - delete playlist.disabled; - } else { - playlist.disabled = true; - } - - if (enable !== currentlyEnabled && !incompatible) { - // Ensure the outside world knows about our changes - changePlaylistFn(); - - if (enable) { - loader.trigger('renditionenabled'); - } else { - loader.trigger('renditiondisabled'); - } - } - - return enable; - }; -}; -/** - * The representation object encapsulates the publicly visible information - * in a media playlist along with a setter/getter-type function (enabled) - * for changing the enabled-state of a particular playlist entry - * - * @class Representation - */ - - -var Representation = function Representation(vhsHandler, playlist, id) { - var mpc = vhsHandler.masterPlaylistController_, - smoothQualityChange = vhsHandler.options_.smoothQualityChange; // Get a reference to a bound version of the quality change function - - var changeType = smoothQualityChange ? 'smooth' : 'fast'; - var qualityChangeFunction = mpc[changeType + "QualityChange_"].bind(mpc); // some playlist attributes are optional - - if (playlist.attributes) { - var resolution = playlist.attributes.RESOLUTION; - this.width = resolution && resolution.width; - this.height = resolution && resolution.height; - this.bandwidth = playlist.attributes.BANDWIDTH; - } - - this.codecs = codecsForPlaylist(mpc.master(), playlist); - this.playlist = playlist; // The id is simply the ordinality of the media playlist - // within the master playlist - - this.id = id; // Partially-apply the enableFunction to create a playlist- - // specific variant - - this.enabled = enableFunction(vhsHandler.playlists, playlist.id, qualityChangeFunction); -}; -/** - * A mixin function that adds the `representations` api to an instance - * of the VhsHandler class - * - * @param {VhsHandler} vhsHandler - An instance of VhsHandler to add the - * representation API into - */ - - -var renditionSelectionMixin = function renditionSelectionMixin(vhsHandler) { - // Add a single API-specific function to the VhsHandler instance - vhsHandler.representations = function () { - var master = vhsHandler.masterPlaylistController_.master(); - var playlists = isAudioOnly(master) ? vhsHandler.masterPlaylistController_.getAudioTrackPlaylists_() : master.playlists; - - if (!playlists) { - return []; - } - - return playlists.filter(function (media) { - return !isIncompatible(media); - }).map(function (e, i) { - return new Representation(vhsHandler, e, e.id); - }); - }; -}; - -/** - * @file playback-watcher.js - * - * Playback starts, and now my watch begins. It shall not end until my death. I shall - * take no wait, hold no uncleared timeouts, father no bad seeks. I shall wear no crowns - * and win no glory. I shall live and die at my post. I am the corrector of the underflow. - * I am the watcher of gaps. I am the shield that guards the realms of seekable. I pledge - * my life and honor to the Playback Watch, for this Player and all the Players to come. - */ - -var timerCancelEvents = ['seeking', 'seeked', 'pause', 'playing', 'error']; -/** - * Returns whether or not the current time should be considered close to buffered content, - * taking into consideration whether there's enough buffered content for proper playback. - * - * @param {Object} options - * Options object - * @param {TimeRange} options.buffered - * Current buffer - * @param {number} options.targetDuration - * The active playlist's target duration - * @param {number} options.currentTime - * The current time of the player - * @return {boolean} - * Whether the current time should be considered close to the buffer - */ - -var closeToBufferedContent = function closeToBufferedContent(_ref) { - var buffered = _ref.buffered, - targetDuration = _ref.targetDuration, - currentTime = _ref.currentTime; - - if (!buffered.length) { - return false; - } // At least two to three segments worth of content should be buffered before there's a - // full enough buffer to consider taking any actions. - - - if (buffered.end(0) - buffered.start(0) < targetDuration * 2) { - return false; - } // It's possible that, on seek, a remove hasn't completed and the buffered range is - // somewhere past the current time. In that event, don't consider the buffered content - // close. - - - if (currentTime > buffered.start(0)) { - return false; - } // Since target duration generally represents the max (or close to max) duration of a - // segment, if the buffer is within a segment of the current time, the gap probably - // won't be closed, and current time should be considered close to buffered content. - - - return buffered.start(0) - currentTime < targetDuration; -}; -/** - * @class PlaybackWatcher - */ - -var PlaybackWatcher = /*#__PURE__*/function () { - /** - * Represents an PlaybackWatcher object. - * - * @class - * @param {Object} options an object that includes the tech and settings - */ - function PlaybackWatcher(options) { - var _this = this; - - this.masterPlaylistController_ = options.masterPlaylistController; - this.tech_ = options.tech; - this.seekable = options.seekable; - this.allowSeeksWithinUnsafeLiveWindow = options.allowSeeksWithinUnsafeLiveWindow; - this.liveRangeSafeTimeDelta = options.liveRangeSafeTimeDelta; - this.media = options.media; - this.consecutiveUpdates = 0; - this.lastRecordedTime = null; - this.timer_ = null; - this.checkCurrentTimeTimeout_ = null; - this.logger_ = logger('PlaybackWatcher'); - this.logger_('initialize'); - - var playHandler = function playHandler() { - return _this.monitorCurrentTime_(); - }; - - var canPlayHandler = function canPlayHandler() { - return _this.monitorCurrentTime_(); - }; - - var waitingHandler = function waitingHandler() { - return _this.techWaiting_(); - }; - - var cancelTimerHandler = function cancelTimerHandler() { - return _this.cancelTimer_(); - }; - - var fixesBadSeeksHandler = function fixesBadSeeksHandler() { - return _this.fixesBadSeeks_(); - }; - - var mpc = this.masterPlaylistController_; - var loaderTypes = ['main', 'subtitle', 'audio']; - var loaderChecks = {}; - loaderTypes.forEach(function (type) { - loaderChecks[type] = { - reset: function reset() { - return _this.resetSegmentDownloads_(type); - }, - updateend: function updateend() { - return _this.checkSegmentDownloads_(type); - } - }; - mpc[type + "SegmentLoader_"].on('appendsdone', loaderChecks[type].updateend); // If a rendition switch happens during a playback stall where the buffer - // isn't changing we want to reset. We cannot assume that the new rendition - // will also be stalled, until after new appends. - - mpc[type + "SegmentLoader_"].on('playlistupdate', loaderChecks[type].reset); // Playback stalls should not be detected right after seeking. - // This prevents one segment playlists (single vtt or single segment content) - // from being detected as stalling. As the buffer will not change in those cases, since - // the buffer is the entire video duration. - - _this.tech_.on(['seeked', 'seeking'], loaderChecks[type].reset); - }); - this.tech_.on('seekablechanged', fixesBadSeeksHandler); - this.tech_.on('waiting', waitingHandler); - this.tech_.on(timerCancelEvents, cancelTimerHandler); - this.tech_.on('canplay', canPlayHandler); - /* - An edge case exists that results in gaps not being skipped when they exist at the beginning of a stream. This case - is surfaced in one of two ways: - 1) The `waiting` event is fired before the player has buffered content, making it impossible - to find or skip the gap. The `waiting` event is followed by a `play` event. On first play - we can check if playback is stalled due to a gap, and skip the gap if necessary. - 2) A source with a gap at the beginning of the stream is loaded programatically while the player - is in a playing state. To catch this case, it's important that our one-time play listener is setup - even if the player is in a playing state - */ - - this.tech_.one('play', playHandler); // Define the dispose function to clean up our events - - this.dispose = function () { - _this.logger_('dispose'); - - _this.tech_.off('seekablechanged', fixesBadSeeksHandler); - - _this.tech_.off('waiting', waitingHandler); - - _this.tech_.off(timerCancelEvents, cancelTimerHandler); - - _this.tech_.off('canplay', canPlayHandler); - - _this.tech_.off('play', playHandler); - - loaderTypes.forEach(function (type) { - mpc[type + "SegmentLoader_"].off('appendsdone', loaderChecks[type].updateend); - mpc[type + "SegmentLoader_"].off('playlistupdate', loaderChecks[type].reset); - - _this.tech_.off(['seeked', 'seeking'], loaderChecks[type].reset); - }); - - if (_this.checkCurrentTimeTimeout_) { - window__default['default'].clearTimeout(_this.checkCurrentTimeTimeout_); - } - - _this.cancelTimer_(); - }; - } - /** - * Periodically check current time to see if playback stopped - * - * @private - */ - - - var _proto = PlaybackWatcher.prototype; - - _proto.monitorCurrentTime_ = function monitorCurrentTime_() { - this.checkCurrentTime_(); - - if (this.checkCurrentTimeTimeout_) { - window__default['default'].clearTimeout(this.checkCurrentTimeTimeout_); - } // 42 = 24 fps // 250 is what Webkit uses // FF uses 15 - - - this.checkCurrentTimeTimeout_ = window__default['default'].setTimeout(this.monitorCurrentTime_.bind(this), 250); - } - /** - * Reset stalled download stats for a specific type of loader - * - * @param {string} type - * The segment loader type to check. - * - * @listens SegmentLoader#playlistupdate - * @listens Tech#seeking - * @listens Tech#seeked - */ - ; - - _proto.resetSegmentDownloads_ = function resetSegmentDownloads_(type) { - var loader = this.masterPlaylistController_[type + "SegmentLoader_"]; - - if (this[type + "StalledDownloads_"] > 0) { - this.logger_("resetting possible stalled download count for " + type + " loader"); - } - - this[type + "StalledDownloads_"] = 0; - this[type + "Buffered_"] = loader.buffered_(); - } - /** - * Checks on every segment `appendsdone` to see - * if segment appends are making progress. If they are not - * and we are still downloading bytes. We blacklist the playlist. - * - * @param {string} type - * The segment loader type to check. - * - * @listens SegmentLoader#appendsdone - */ - ; - - _proto.checkSegmentDownloads_ = function checkSegmentDownloads_(type) { - var mpc = this.masterPlaylistController_; - var loader = mpc[type + "SegmentLoader_"]; - var buffered = loader.buffered_(); - var isBufferedDifferent = isRangeDifferent(this[type + "Buffered_"], buffered); - this[type + "Buffered_"] = buffered; // if another watcher is going to fix the issue or - // the buffered value for this loader changed - // appends are working - - if (isBufferedDifferent) { - this.resetSegmentDownloads_(type); - return; - } - - this[type + "StalledDownloads_"]++; - this.logger_("found #" + this[type + "StalledDownloads_"] + " " + type + " appends that did not increase buffer (possible stalled download)", { - playlistId: loader.playlist_ && loader.playlist_.id, - buffered: timeRangesToArray(buffered) - }); // after 10 possibly stalled appends with no reset, exclude - - if (this[type + "StalledDownloads_"] < 10) { - return; - } - - this.logger_(type + " loader stalled download exclusion"); - this.resetSegmentDownloads_(type); - this.tech_.trigger({ - type: 'usage', - name: "vhs-" + type + "-download-exclusion" - }); - - if (type === 'subtitle') { - return; - } // TODO: should we exclude audio tracks rather than main tracks - // when type is audio? - - - mpc.blacklistCurrentPlaylist({ - message: "Excessive " + type + " segment downloading detected." - }, Infinity); - } - /** - * The purpose of this function is to emulate the "waiting" event on - * browsers that do not emit it when they are waiting for more - * data to continue playback - * - * @private - */ - ; - - _proto.checkCurrentTime_ = function checkCurrentTime_() { - if (this.tech_.seeking() && this.fixesBadSeeks_()) { - this.consecutiveUpdates = 0; - this.lastRecordedTime = this.tech_.currentTime(); - return; - } - - if (this.tech_.paused() || this.tech_.seeking()) { - return; - } - - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - - if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA >= buffered.end(buffered.length - 1))) { - // If current time is at the end of the final buffered region, then any playback - // stall is most likely caused by buffering in a low bandwidth environment. The tech - // should fire a `waiting` event in this scenario, but due to browser and tech - // inconsistencies. Calling `techWaiting_` here allows us to simulate - // responding to a native `waiting` event when the tech fails to emit one. - return this.techWaiting_(); - } - - if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) { - this.consecutiveUpdates++; - this.waiting_(); - } else if (currentTime === this.lastRecordedTime) { - this.consecutiveUpdates++; - } else { - this.consecutiveUpdates = 0; - this.lastRecordedTime = currentTime; - } - } - /** - * Cancels any pending timers and resets the 'timeupdate' mechanism - * designed to detect that we are stalled - * - * @private - */ - ; - - _proto.cancelTimer_ = function cancelTimer_() { - this.consecutiveUpdates = 0; - - if (this.timer_) { - this.logger_('cancelTimer_'); - clearTimeout(this.timer_); - } - - this.timer_ = null; - } - /** - * Fixes situations where there's a bad seek - * - * @return {boolean} whether an action was taken to fix the seek - * @private - */ - ; - - _proto.fixesBadSeeks_ = function fixesBadSeeks_() { - var seeking = this.tech_.seeking(); - - if (!seeking) { - return false; - } - - var seekable = this.seekable(); - var currentTime = this.tech_.currentTime(); - var isAfterSeekableRange = this.afterSeekableWindow_(seekable, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow); - var seekTo; - - if (isAfterSeekableRange) { - var seekableEnd = seekable.end(seekable.length - 1); // sync to live point (if VOD, our seekable was updated and we're simply adjusting) - - seekTo = seekableEnd; - } - - if (this.beforeSeekableWindow_(seekable, currentTime)) { - var seekableStart = seekable.start(0); // sync to the beginning of the live window - // provide a buffer of .1 seconds to handle rounding/imprecise numbers - - seekTo = seekableStart + ( // if the playlist is too short and the seekable range is an exact time (can - // happen in live with a 3 segment playlist), then don't use a time delta - seekableStart === seekable.end(0) ? 0 : SAFE_TIME_DELTA); - } - - if (typeof seekTo !== 'undefined') { - this.logger_("Trying to seek outside of seekable at time " + currentTime + " with " + ("seekable range " + printableRange(seekable) + ". Seeking to ") + (seekTo + ".")); - this.tech_.setCurrentTime(seekTo); - return true; - } - - var buffered = this.tech_.buffered(); - - if (closeToBufferedContent({ - buffered: buffered, - targetDuration: this.media().targetDuration, - currentTime: currentTime - })) { - seekTo = buffered.start(0) + SAFE_TIME_DELTA; - this.logger_("Buffered region starts (" + buffered.start(0) + ") " + (" just beyond seek point (" + currentTime + "). Seeking to " + seekTo + ".")); - this.tech_.setCurrentTime(seekTo); - return true; - } - - return false; - } - /** - * Handler for situations when we determine the player is waiting. - * - * @private - */ - ; - - _proto.waiting_ = function waiting_() { - if (this.techWaiting_()) { - return; - } // All tech waiting checks failed. Use last resort correction - - - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - var currentRange = findRange(buffered, currentTime); // Sometimes the player can stall for unknown reasons within a contiguous buffered - // region with no indication that anything is amiss (seen in Firefox). Seeking to - // currentTime is usually enough to kickstart the player. This checks that the player - // is currently within a buffered region before attempting a corrective seek. - // Chrome does not appear to continue `timeupdate` events after a `waiting` event - // until there is ~ 3 seconds of forward buffer available. PlaybackWatcher should also - // make sure there is ~3 seconds of forward buffer before taking any corrective action - // to avoid triggering an `unknownwaiting` event when the network is slow. - - if (currentRange.length && currentTime + 3 <= currentRange.end(0)) { - this.cancelTimer_(); - this.tech_.setCurrentTime(currentTime); - this.logger_("Stopped at " + currentTime + " while inside a buffered region " + ("[" + currentRange.start(0) + " -> " + currentRange.end(0) + "]. Attempting to resume ") + 'playback by seeking to the current time.'); // unknown waiting corrections may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-unknown-waiting' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-unknown-waiting' - }); - return; - } - } - /** - * Handler for situations when the tech fires a `waiting` event - * - * @return {boolean} - * True if an action (or none) was needed to correct the waiting. False if no - * checks passed - * @private - */ - ; - - _proto.techWaiting_ = function techWaiting_() { - var seekable = this.seekable(); - var currentTime = this.tech_.currentTime(); - - if (this.tech_.seeking() && this.fixesBadSeeks_()) { - // Tech is seeking or bad seek fixed, no action needed - return true; - } - - if (this.tech_.seeking() || this.timer_ !== null) { - // Tech is seeking or already waiting on another action, no action needed - return true; - } - - if (this.beforeSeekableWindow_(seekable, currentTime)) { - var livePoint = seekable.end(seekable.length - 1); - this.logger_("Fell out of live window at time " + currentTime + ". Seeking to " + ("live point (seekable end) " + livePoint)); - this.cancelTimer_(); - this.tech_.setCurrentTime(livePoint); // live window resyncs may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-live-resync' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-live-resync' - }); - return true; - } - - var sourceUpdater = this.tech_.vhs.masterPlaylistController_.sourceUpdater_; - var buffered = this.tech_.buffered(); - var videoUnderflow = this.videoUnderflow_({ - audioBuffered: sourceUpdater.audioBuffered(), - videoBuffered: sourceUpdater.videoBuffered(), - currentTime: currentTime - }); - - if (videoUnderflow) { - // Even though the video underflowed and was stuck in a gap, the audio overplayed - // the gap, leading currentTime into a buffered range. Seeking to currentTime - // allows the video to catch up to the audio position without losing any audio - // (only suffering ~3 seconds of frozen video and a pause in audio playback). - this.cancelTimer_(); - this.tech_.setCurrentTime(currentTime); // video underflow may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-video-underflow' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-video-underflow' - }); - return true; - } - - var nextRange = findNextRange(buffered, currentTime); // check for gap - - if (nextRange.length > 0) { - var difference = nextRange.start(0) - currentTime; - this.logger_("Stopped at " + currentTime + ", setting timer for " + difference + ", seeking " + ("to " + nextRange.start(0))); - this.cancelTimer_(); - this.timer_ = setTimeout(this.skipTheGap_.bind(this), difference * 1000, currentTime); - return true; - } // All checks failed. Returning false to indicate failure to correct waiting - - - return false; - }; - - _proto.afterSeekableWindow_ = function afterSeekableWindow_(seekable, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow) { - if (allowSeeksWithinUnsafeLiveWindow === void 0) { - allowSeeksWithinUnsafeLiveWindow = false; - } - - if (!seekable.length) { - // we can't make a solid case if there's no seekable, default to false - return false; - } - - var allowedEnd = seekable.end(seekable.length - 1) + SAFE_TIME_DELTA; - var isLive = !playlist.endList; - - if (isLive && allowSeeksWithinUnsafeLiveWindow) { - allowedEnd = seekable.end(seekable.length - 1) + playlist.targetDuration * 3; - } - - if (currentTime > allowedEnd) { - return true; - } - - return false; - }; - - _proto.beforeSeekableWindow_ = function beforeSeekableWindow_(seekable, currentTime) { - if (seekable.length && // can't fall before 0 and 0 seekable start identifies VOD stream - seekable.start(0) > 0 && currentTime < seekable.start(0) - this.liveRangeSafeTimeDelta) { - return true; - } - - return false; - }; - - _proto.videoUnderflow_ = function videoUnderflow_(_ref2) { - var videoBuffered = _ref2.videoBuffered, - audioBuffered = _ref2.audioBuffered, - currentTime = _ref2.currentTime; - - // audio only content will not have video underflow :) - if (!videoBuffered) { - return; - } - - var gap; // find a gap in demuxed content. - - if (videoBuffered.length && audioBuffered.length) { - // in Chrome audio will continue to play for ~3s when we run out of video - // so we have to check that the video buffer did have some buffer in the - // past. - var lastVideoRange = findRange(videoBuffered, currentTime - 3); - var videoRange = findRange(videoBuffered, currentTime); - var audioRange = findRange(audioBuffered, currentTime); - - if (audioRange.length && !videoRange.length && lastVideoRange.length) { - gap = { - start: lastVideoRange.end(0), - end: audioRange.end(0) - }; - } // find a gap in muxed content. - - } else { - var nextRange = findNextRange(videoBuffered, currentTime); // Even if there is no available next range, there is still a possibility we are - // stuck in a gap due to video underflow. - - if (!nextRange.length) { - gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime); - } - } - - if (gap) { - this.logger_("Encountered a gap in video from " + gap.start + " to " + gap.end + ". " + ("Seeking to current time " + currentTime)); - return true; - } - - return false; - } - /** - * Timer callback. If playback still has not proceeded, then we seek - * to the start of the next buffered region. - * - * @private - */ - ; - - _proto.skipTheGap_ = function skipTheGap_(scheduledCurrentTime) { - var buffered = this.tech_.buffered(); - var currentTime = this.tech_.currentTime(); - var nextRange = findNextRange(buffered, currentTime); - this.cancelTimer_(); - - if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) { - return; - } - - this.logger_('skipTheGap_:', 'currentTime:', currentTime, 'scheduled currentTime:', scheduledCurrentTime, 'nextRange start:', nextRange.start(0)); // only seek if we still have not played - - this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR); - this.tech_.trigger({ - type: 'usage', - name: 'vhs-gap-skip' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-gap-skip' - }); - }; - - _proto.gapFromVideoUnderflow_ = function gapFromVideoUnderflow_(buffered, currentTime) { - // At least in Chrome, if there is a gap in the video buffer, the audio will continue - // playing for ~3 seconds after the video gap starts. This is done to account for - // video buffer underflow/underrun (note that this is not done when there is audio - // buffer underflow/underrun -- in that case the video will stop as soon as it - // encounters the gap, as audio stalls are more noticeable/jarring to a user than - // video stalls). The player's time will reflect the playthrough of audio, so the - // time will appear as if we are in a buffered region, even if we are stuck in a - // "gap." - // - // Example: - // video buffer: 0 => 10.1, 10.2 => 20 - // audio buffer: 0 => 20 - // overall buffer: 0 => 10.1, 10.2 => 20 - // current time: 13 - // - // Chrome's video froze at 10 seconds, where the video buffer encountered the gap, - // however, the audio continued playing until it reached ~3 seconds past the gap - // (13 seconds), at which point it stops as well. Since current time is past the - // gap, findNextRange will return no ranges. - // - // To check for this issue, we see if there is a gap that starts somewhere within - // a 3 second range (3 seconds +/- 1 second) back from our current time. - var gaps = findGaps(buffered); - - for (var i = 0; i < gaps.length; i++) { - var start = gaps.start(i); - var end = gaps.end(i); // gap is starts no more than 4 seconds back - - if (currentTime - start < 4 && currentTime - start > 2) { - return { - start: start, - end: end - }; - } - } - - return null; - }; - - return PlaybackWatcher; -}(); - -var defaultOptions = { - errorInterval: 30, - getSource: function getSource(next) { - var tech = this.tech({ - IWillNotUseThisInPlugins: true - }); - var sourceObj = tech.currentSource_ || this.currentSource(); - return next(sourceObj); - } -}; -/** - * Main entry point for the plugin - * - * @param {Player} player a reference to a videojs Player instance - * @param {Object} [options] an object with plugin options - * @private - */ - -var initPlugin = function initPlugin(player, options) { - var lastCalled = 0; - var seekTo = 0; - var localOptions = videojs__default['default'].mergeOptions(defaultOptions, options); - player.ready(function () { - player.trigger({ - type: 'usage', - name: 'vhs-error-reload-initialized' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload-initialized' - }); - }); - /** - * Player modifications to perform that must wait until `loadedmetadata` - * has been triggered - * - * @private - */ - - var loadedMetadataHandler = function loadedMetadataHandler() { - if (seekTo) { - player.currentTime(seekTo); - } - }; - /** - * Set the source on the player element, play, and seek if necessary - * - * @param {Object} sourceObj An object specifying the source url and mime-type to play - * @private - */ - - - var setSource = function setSource(sourceObj) { - if (sourceObj === null || sourceObj === undefined) { - return; - } - - seekTo = player.duration() !== Infinity && player.currentTime() || 0; - player.one('loadedmetadata', loadedMetadataHandler); - player.src(sourceObj); - player.trigger({ - type: 'usage', - name: 'vhs-error-reload' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload' - }); - player.play(); - }; - /** - * Attempt to get a source from either the built-in getSource function - * or a custom function provided via the options - * - * @private - */ - - - var errorHandler = function errorHandler() { - // Do not attempt to reload the source if a source-reload occurred before - // 'errorInterval' time has elapsed since the last source-reload - if (Date.now() - lastCalled < localOptions.errorInterval * 1000) { - player.trigger({ - type: 'usage', - name: 'vhs-error-reload-canceled' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload-canceled' - }); - return; - } - - if (!localOptions.getSource || typeof localOptions.getSource !== 'function') { - videojs__default['default'].log.error('ERROR: reloadSourceOnError - The option getSource must be a function!'); - return; - } - - lastCalled = Date.now(); - return localOptions.getSource.call(player, setSource); - }; - /** - * Unbind any event handlers that were bound by the plugin - * - * @private - */ - - - var cleanupEvents = function cleanupEvents() { - player.off('loadedmetadata', loadedMetadataHandler); - player.off('error', errorHandler); - player.off('dispose', cleanupEvents); - }; - /** - * Cleanup before re-initializing the plugin - * - * @param {Object} [newOptions] an object with plugin options - * @private - */ - - - var reinitPlugin = function reinitPlugin(newOptions) { - cleanupEvents(); - initPlugin(player, newOptions); - }; - - player.on('error', errorHandler); - player.on('dispose', cleanupEvents); // Overwrite the plugin function so that we can correctly cleanup before - // initializing the plugin - - player.reloadSourceOnError = reinitPlugin; -}; -/** - * Reload the source when an error is detected as long as there - * wasn't an error previously within the last 30 seconds - * - * @param {Object} [options] an object with plugin options - */ - - -var reloadSourceOnError = function reloadSourceOnError(options) { - initPlugin(this, options); -}; - -var version$4 = "2.9.1"; - -var version$3 = "5.11.1"; - -var version$2 = "0.17.0"; - -var version$1 = "4.7.0"; - -var version = "3.1.2"; - -var Vhs = { - PlaylistLoader: PlaylistLoader, - Playlist: Playlist, - utils: utils, - STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector, - INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector, - lastBandwidthSelector: lastBandwidthSelector, - movingAverageBandwidthSelector: movingAverageBandwidthSelector, - comparePlaylistBandwidth: comparePlaylistBandwidth, - comparePlaylistResolution: comparePlaylistResolution, - xhr: xhrFactory() -}; // Define getter/setters for config properties - -Object.keys(Config).forEach(function (prop) { - Object.defineProperty(Vhs, prop, { - get: function get() { - videojs__default['default'].log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing"); - return Config[prop]; - }, - set: function set(value) { - videojs__default['default'].log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing"); - - if (typeof value !== 'number' || value < 0) { - videojs__default['default'].log.warn("value of Vhs." + prop + " must be greater than or equal to 0"); - return; - } - - Config[prop] = value; - } - }); -}); -var LOCAL_STORAGE_KEY = 'videojs-vhs'; -/** - * Updates the selectedIndex of the QualityLevelList when a mediachange happens in vhs. - * - * @param {QualityLevelList} qualityLevels The QualityLevelList to update. - * @param {PlaylistLoader} playlistLoader PlaylistLoader containing the new media info. - * @function handleVhsMediaChange - */ - -var handleVhsMediaChange = function handleVhsMediaChange(qualityLevels, playlistLoader) { - var newPlaylist = playlistLoader.media(); - var selectedIndex = -1; - - for (var i = 0; i < qualityLevels.length; i++) { - if (qualityLevels[i].id === newPlaylist.id) { - selectedIndex = i; - break; - } - } - - qualityLevels.selectedIndex_ = selectedIndex; - qualityLevels.trigger({ - selectedIndex: selectedIndex, - type: 'change' - }); -}; -/** - * Adds quality levels to list once playlist metadata is available - * - * @param {QualityLevelList} qualityLevels The QualityLevelList to attach events to. - * @param {Object} vhs Vhs object to listen to for media events. - * @function handleVhsLoadedMetadata - */ - - -var handleVhsLoadedMetadata = function handleVhsLoadedMetadata(qualityLevels, vhs) { - vhs.representations().forEach(function (rep) { - qualityLevels.addQualityLevel(rep); - }); - handleVhsMediaChange(qualityLevels, vhs.playlists); -}; // HLS is a source handler, not a tech. Make sure attempts to use it -// as one do not cause exceptions. - - -Vhs.canPlaySource = function () { - return videojs__default['default'].log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\'s techOrder.'); -}; - -var emeKeySystems = function emeKeySystems(keySystemOptions, mainPlaylist, audioPlaylist) { - if (!keySystemOptions) { - return keySystemOptions; - } - - var codecs = {}; - - if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) { - codecs = unwrapCodecList(codecs_js.parseCodecs(mainPlaylist.attributes.CODECS)); - } - - if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) { - codecs.audio = audioPlaylist.attributes.CODECS; - } - - var videoContentType = codecs_js.getMimeForCodec(codecs.video); - var audioContentType = codecs_js.getMimeForCodec(codecs.audio); // upsert the content types based on the selected playlist - - var keySystemContentTypes = {}; - - for (var keySystem in keySystemOptions) { - keySystemContentTypes[keySystem] = {}; - - if (audioContentType) { - keySystemContentTypes[keySystem].audioContentType = audioContentType; - } - - if (videoContentType) { - keySystemContentTypes[keySystem].videoContentType = videoContentType; - } // Default to using the video playlist's PSSH even though they may be different, as - // videojs-contrib-eme will only accept one in the options. - // - // This shouldn't be an issue for most cases as early intialization will handle all - // unique PSSH values, and if they aren't, then encrypted events should have the - // specific information needed for the unique license. - - - if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) { - keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh; - } // videojs-contrib-eme accepts the option of specifying: 'com.some.cdm': 'url' - // so we need to prevent overwriting the URL entirely - - - if (typeof keySystemOptions[keySystem] === 'string') { - keySystemContentTypes[keySystem].url = keySystemOptions[keySystem]; - } - } - - return videojs__default['default'].mergeOptions(keySystemOptions, keySystemContentTypes); -}; -/** - * @typedef {Object} KeySystems - * - * keySystems configuration for https://github.com/videojs/videojs-contrib-eme - * Note: not all options are listed here. - * - * @property {Uint8Array} [pssh] - * Protection System Specific Header - */ - -/** - * Goes through all the playlists and collects an array of KeySystems options objects - * containing each playlist's keySystems and their pssh values, if available. - * - * @param {Object[]} playlists - * The playlists to look through - * @param {string[]} keySystems - * The keySystems to collect pssh values for - * - * @return {KeySystems[]} - * An array of KeySystems objects containing available key systems and their - * pssh values - */ - - -var getAllPsshKeySystemsOptions = function getAllPsshKeySystemsOptions(playlists, keySystems) { - return playlists.reduce(function (keySystemsArr, playlist) { - if (!playlist.contentProtection) { - return keySystemsArr; - } - - var keySystemsOptions = keySystems.reduce(function (keySystemsObj, keySystem) { - var keySystemOptions = playlist.contentProtection[keySystem]; - - if (keySystemOptions && keySystemOptions.pssh) { - keySystemsObj[keySystem] = { - pssh: keySystemOptions.pssh - }; - } - - return keySystemsObj; - }, {}); - - if (Object.keys(keySystemsOptions).length) { - keySystemsArr.push(keySystemsOptions); - } - - return keySystemsArr; - }, []); -}; -/** - * Returns a promise that waits for the - * [eme plugin](https://github.com/videojs/videojs-contrib-eme) to create a key session. - * - * Works around https://bugs.chromium.org/p/chromium/issues/detail?id=895449 in non-IE11 - * browsers. - * - * As per the above ticket, this is particularly important for Chrome, where, if - * unencrypted content is appended before encrypted content and the key session has not - * been created, a MEDIA_ERR_DECODE will be thrown once the encrypted content is reached - * during playback. - * - * @param {Object} player - * The player instance - * @param {Object[]} sourceKeySystems - * The key systems options from the player source - * @param {Object} [audioMedia] - * The active audio media playlist (optional) - * @param {Object[]} mainPlaylists - * The playlists found on the master playlist object - * - * @return {Object} - * Promise that resolves when the key session has been created - */ - - -var waitForKeySessionCreation = function waitForKeySessionCreation(_ref) { - var player = _ref.player, - sourceKeySystems = _ref.sourceKeySystems, - audioMedia = _ref.audioMedia, - mainPlaylists = _ref.mainPlaylists; - - if (!player.eme.initializeMediaKeys) { - return Promise.resolve(); - } // TODO should all audio PSSH values be initialized for DRM? - // - // All unique video rendition pssh values are initialized for DRM, but here only - // the initial audio playlist license is initialized. In theory, an encrypted - // event should be fired if the user switches to an alternative audio playlist - // where a license is required, but this case hasn't yet been tested. In addition, there - // may be many alternate audio playlists unlikely to be used (e.g., multiple different - // languages). - - - var playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists; - var keySystemsOptionsArr = getAllPsshKeySystemsOptions(playlists, Object.keys(sourceKeySystems)); - var initializationFinishedPromises = []; - var keySessionCreatedPromises = []; // Since PSSH values are interpreted as initData, EME will dedupe any duplicates. The - // only place where it should not be deduped is for ms-prefixed APIs, but the early - // return for IE11 above, and the existence of modern EME APIs in addition to - // ms-prefixed APIs on Edge should prevent this from being a concern. - // initializeMediaKeys also won't use the webkit-prefixed APIs. - - keySystemsOptionsArr.forEach(function (keySystemsOptions) { - keySessionCreatedPromises.push(new Promise(function (resolve, reject) { - player.tech_.one('keysessioncreated', resolve); - })); - initializationFinishedPromises.push(new Promise(function (resolve, reject) { - player.eme.initializeMediaKeys({ - keySystems: keySystemsOptions - }, function (err) { - if (err) { - reject(err); - return; - } - - resolve(); - }); - })); - }); // The reasons Promise.race is chosen over Promise.any: - // - // * Promise.any is only available in Safari 14+. - // * None of these promises are expected to reject. If they do reject, it might be - // better here for the race to surface the rejection, rather than mask it by using - // Promise.any. - - return Promise.race([// If a session was previously created, these will all finish resolving without - // creating a new session, otherwise it will take until the end of all license - // requests, which is why the key session check is used (to make setup much faster). - Promise.all(initializationFinishedPromises), // Once a single session is created, the browser knows DRM will be used. - Promise.race(keySessionCreatedPromises)]); -}; -/** - * If the [eme](https://github.com/videojs/videojs-contrib-eme) plugin is available, and - * there are keySystems on the source, sets up source options to prepare the source for - * eme. - * - * @param {Object} player - * The player instance - * @param {Object[]} sourceKeySystems - * The key systems options from the player source - * @param {Object} media - * The active media playlist - * @param {Object} [audioMedia] - * The active audio media playlist (optional) - * - * @return {boolean} - * Whether or not options were configured and EME is available - */ - -var setupEmeOptions = function setupEmeOptions(_ref2) { - var player = _ref2.player, - sourceKeySystems = _ref2.sourceKeySystems, - media = _ref2.media, - audioMedia = _ref2.audioMedia; - var sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia); - - if (!sourceOptions) { - return false; - } - - player.currentSource().keySystems = sourceOptions; // eme handles the rest of the setup, so if it is missing - // do nothing. - - if (sourceOptions && !player.eme) { - videojs__default['default'].log.warn('DRM encrypted source cannot be decrypted without a DRM plugin'); - return false; - } - - return true; -}; - -var getVhsLocalStorage = function getVhsLocalStorage() { - if (!window__default['default'].localStorage) { - return null; - } - - var storedObject = window__default['default'].localStorage.getItem(LOCAL_STORAGE_KEY); - - if (!storedObject) { - return null; - } - - try { - return JSON.parse(storedObject); - } catch (e) { - // someone may have tampered with the value - return null; - } -}; - -var updateVhsLocalStorage = function updateVhsLocalStorage(options) { - if (!window__default['default'].localStorage) { - return false; - } - - var objectToStore = getVhsLocalStorage(); - objectToStore = objectToStore ? videojs__default['default'].mergeOptions(objectToStore, options) : options; - - try { - window__default['default'].localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore)); - } catch (e) { - // Throws if storage is full (e.g., always on iOS 5+ Safari private mode, where - // storage is set to 0). - // https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#Exceptions - // No need to perform any operation. - return false; - } - - return objectToStore; -}; -/** - * Parses VHS-supported media types from data URIs. See - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs - * for information on data URIs. - * - * @param {string} dataUri - * The data URI - * - * @return {string|Object} - * The parsed object/string, or the original string if no supported media type - * was found - */ - - -var expandDataUri = function expandDataUri(dataUri) { - if (dataUri.toLowerCase().indexOf('data:application/vnd.videojs.vhs+json,') === 0) { - return JSON.parse(dataUri.substring(dataUri.indexOf(',') + 1)); - } // no known case for this data URI, return the string as-is - - - return dataUri; -}; -/** - * Whether the browser has built-in HLS support. - */ - - -Vhs.supportsNativeHls = function () { - if (!document__default['default'] || !document__default['default'].createElement) { - return false; - } - - var video = document__default['default'].createElement('video'); // native HLS is definitely not supported if HTML5 video isn't - - if (!videojs__default['default'].getTech('Html5').isSupported()) { - return false; - } // HLS manifests can go by many mime-types - - - var canPlay = [// Apple santioned - 'application/vnd.apple.mpegurl', // Apple sanctioned for backwards compatibility - 'audio/mpegurl', // Very common - 'audio/x-mpegurl', // Very common - 'application/x-mpegurl', // Included for completeness - 'video/x-mpegurl', 'video/mpegurl', 'application/mpegurl']; - return canPlay.some(function (canItPlay) { - return /maybe|probably/i.test(video.canPlayType(canItPlay)); - }); -}(); - -Vhs.supportsNativeDash = function () { - if (!document__default['default'] || !document__default['default'].createElement || !videojs__default['default'].getTech('Html5').isSupported()) { - return false; - } - - return /maybe|probably/i.test(document__default['default'].createElement('video').canPlayType('application/dash+xml')); -}(); - -Vhs.supportsTypeNatively = function (type) { - if (type === 'hls') { - return Vhs.supportsNativeHls; - } - - if (type === 'dash') { - return Vhs.supportsNativeDash; - } - - return false; -}; -/** - * HLS is a source handler, not a tech. Make sure attempts to use it - * as one do not cause exceptions. - */ - - -Vhs.isSupported = function () { - return videojs__default['default'].log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\'s techOrder.'); -}; - -var Component = videojs__default['default'].getComponent('Component'); -/** - * The Vhs Handler object, where we orchestrate all of the parts - * of HLS to interact with video.js - * - * @class VhsHandler - * @extends videojs.Component - * @param {Object} source the soruce object - * @param {Tech} tech the parent tech object - * @param {Object} options optional and required options - */ - -var VhsHandler = /*#__PURE__*/function (_Component) { - _inheritsLoose__default['default'](VhsHandler, _Component); - - function VhsHandler(source, tech, options) { - var _this; - - _this = _Component.call(this, tech, videojs__default['default'].mergeOptions(options.hls, options.vhs)) || this; - - if (options.hls && Object.keys(options.hls).length) { - videojs__default['default'].log.warn('Using hls options is deprecated. Use vhs instead.'); - } // if a tech level `initialBandwidth` option was passed - // use that over the VHS level `bandwidth` option - - - if (typeof options.initialBandwidth === 'number') { - _this.options_.bandwidth = options.initialBandwidth; - } - - _this.logger_ = logger('VhsHandler'); // tech.player() is deprecated but setup a reference to HLS for - // backwards-compatibility - - if (tech.options_ && tech.options_.playerId) { - var _player = videojs__default['default'](tech.options_.playerId); - - if (!_player.hasOwnProperty('hls')) { - Object.defineProperty(_player, 'hls', { - get: function get() { - videojs__default['default'].log.warn('player.hls is deprecated. Use player.tech().vhs instead.'); - tech.trigger({ - type: 'usage', - name: 'hls-player-access' - }); - return _assertThisInitialized__default['default'](_this); - }, - configurable: true - }); - } - - if (!_player.hasOwnProperty('vhs')) { - Object.defineProperty(_player, 'vhs', { - get: function get() { - videojs__default['default'].log.warn('player.vhs is deprecated. Use player.tech().vhs instead.'); - tech.trigger({ - type: 'usage', - name: 'vhs-player-access' - }); - return _assertThisInitialized__default['default'](_this); - }, - configurable: true - }); - } - - if (!_player.hasOwnProperty('dash')) { - Object.defineProperty(_player, 'dash', { - get: function get() { - videojs__default['default'].log.warn('player.dash is deprecated. Use player.tech().vhs instead.'); - return _assertThisInitialized__default['default'](_this); - }, - configurable: true - }); - } - - _this.player_ = _player; - } - - _this.tech_ = tech; - _this.source_ = source; - _this.stats = {}; - _this.ignoreNextSeekingEvent_ = false; - - _this.setOptions_(); - - if (_this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) { - tech.overrideNativeAudioTracks(true); - tech.overrideNativeVideoTracks(true); - } else if (_this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) { - // overriding native HLS only works if audio tracks have been emulated - // error early if we're misconfigured - throw new Error('Overriding native HLS requires emulated tracks. ' + 'See https://git.io/vMpjB'); - } // listen for fullscreenchange events for this player so that we - // can adjust our quality selection quickly - - - _this.on(document__default['default'], ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'], function (event) { - var fullscreenElement = document__default['default'].fullscreenElement || document__default['default'].webkitFullscreenElement || document__default['default'].mozFullScreenElement || document__default['default'].msFullscreenElement; - - if (fullscreenElement && fullscreenElement.contains(_this.tech_.el())) { - _this.masterPlaylistController_.fastQualityChange_(); - } else { - // When leaving fullscreen, since the in page pixel dimensions should be smaller - // than full screen, see if there should be a rendition switch down to preserve - // bandwidth. - _this.masterPlaylistController_.checkABR_(); - } - }); - - _this.on(_this.tech_, 'seeking', function () { - if (this.ignoreNextSeekingEvent_) { - this.ignoreNextSeekingEvent_ = false; - return; - } - - this.setCurrentTime(this.tech_.currentTime()); - }); - - _this.on(_this.tech_, 'error', function () { - // verify that the error was real and we are loaded - // enough to have mpc loaded. - if (this.tech_.error() && this.masterPlaylistController_) { - this.masterPlaylistController_.pauseLoading(); - } - }); - - _this.on(_this.tech_, 'play', _this.play); - - return _this; - } - - var _proto = VhsHandler.prototype; - - _proto.setOptions_ = function setOptions_() { - var _this2 = this; - - // defaults - this.options_.withCredentials = this.options_.withCredentials || false; - this.options_.handleManifestRedirects = this.options_.handleManifestRedirects === false ? false : true; - this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true; - this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false; - this.options_.smoothQualityChange = this.options_.smoothQualityChange || false; - this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== 'undefined' ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false; - this.options_.customTagParsers = this.options_.customTagParsers || []; - this.options_.customTagMappers = this.options_.customTagMappers || []; - this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false; - - if (typeof this.options_.blacklistDuration !== 'number') { - this.options_.blacklistDuration = 5 * 60; - } - - if (typeof this.options_.bandwidth !== 'number') { - if (this.options_.useBandwidthFromLocalStorage) { - var storedObject = getVhsLocalStorage(); - - if (storedObject && storedObject.bandwidth) { - this.options_.bandwidth = storedObject.bandwidth; - this.tech_.trigger({ - type: 'usage', - name: 'vhs-bandwidth-from-local-storage' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-bandwidth-from-local-storage' - }); - } - - if (storedObject && storedObject.throughput) { - this.options_.throughput = storedObject.throughput; - this.tech_.trigger({ - type: 'usage', - name: 'vhs-throughput-from-local-storage' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-throughput-from-local-storage' - }); - } - } - } // if bandwidth was not set by options or pulled from local storage, start playlist - // selection at a reasonable bandwidth - - - if (typeof this.options_.bandwidth !== 'number') { - this.options_.bandwidth = Config.INITIAL_BANDWIDTH; - } // If the bandwidth number is unchanged from the initial setting - // then this takes precedence over the enableLowInitialPlaylist option - - - this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config.INITIAL_BANDWIDTH; // grab options passed to player.src - - ['withCredentials', 'useDevicePixelRatio', 'limitRenditionByPlayerDimensions', 'bandwidth', 'smoothQualityChange', 'customTagParsers', 'customTagMappers', 'handleManifestRedirects', 'cacheEncryptionKeys', 'playlistSelector', 'initialPlaylistSelector', 'experimentalBufferBasedABR', 'liveRangeSafeTimeDelta', 'experimentalLLHLS'].forEach(function (option) { - if (typeof _this2.source_[option] !== 'undefined') { - _this2.options_[option] = _this2.source_[option]; - } - }); - this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions; - this.useDevicePixelRatio = this.options_.useDevicePixelRatio; - } - /** - * called when player.src gets called, handle a new source - * - * @param {Object} src the source object to handle - */ - ; - - _proto.src = function src(_src, type) { - var _this3 = this; - - // do nothing if the src is falsey - if (!_src) { - return; - } - - this.setOptions_(); // add master playlist controller options - - this.options_.src = expandDataUri(this.source_.src); - this.options_.tech = this.tech_; - this.options_.externVhs = Vhs; - this.options_.sourceType = mediaTypes_js.simpleTypeFromSourceType(type); // Whenever we seek internally, we should update the tech - - this.options_.seekTo = function (time) { - _this3.tech_.setCurrentTime(time); - }; - - if (this.options_.smoothQualityChange) { - videojs__default['default'].log.warn('smoothQualityChange is deprecated and will be removed in the next major version'); - } - - this.masterPlaylistController_ = new MasterPlaylistController(this.options_); - var playbackWatcherOptions = videojs__default['default'].mergeOptions({ - liveRangeSafeTimeDelta: SAFE_TIME_DELTA - }, this.options_, { - seekable: function seekable() { - return _this3.seekable(); - }, - media: function media() { - return _this3.masterPlaylistController_.media(); - }, - masterPlaylistController: this.masterPlaylistController_ - }); - this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions); - this.masterPlaylistController_.on('error', function () { - var player = videojs__default['default'].players[_this3.tech_.options_.playerId]; - var error = _this3.masterPlaylistController_.error; - - if (typeof error === 'object' && !error.code) { - error.code = 3; - } else if (typeof error === 'string') { - error = { - message: error, - code: 3 - }; - } - - player.error(error); - }); - var defaultSelector = this.options_.experimentalBufferBasedABR ? Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR; // `this` in selectPlaylist should be the VhsHandler for backwards - // compatibility with < v2 - - this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this); - this.masterPlaylistController_.selectInitialPlaylist = Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this); // re-expose some internal objects for backwards compatibility with < v2 - - this.playlists = this.masterPlaylistController_.masterPlaylistLoader_; - this.mediaSource = this.masterPlaylistController_.mediaSource; // Proxy assignment of some properties to the master playlist - // controller. Using a custom property for backwards compatibility - // with < v2 - - Object.defineProperties(this, { - selectPlaylist: { - get: function get() { - return this.masterPlaylistController_.selectPlaylist; - }, - set: function set(selectPlaylist) { - this.masterPlaylistController_.selectPlaylist = selectPlaylist.bind(this); - } - }, - throughput: { - get: function get() { - return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate; - }, - set: function set(throughput) { - this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = throughput; // By setting `count` to 1 the throughput value becomes the starting value - // for the cumulative average - - this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1; - } - }, - bandwidth: { - get: function get() { - return this.masterPlaylistController_.mainSegmentLoader_.bandwidth; - }, - set: function set(bandwidth) { - this.masterPlaylistController_.mainSegmentLoader_.bandwidth = bandwidth; // setting the bandwidth manually resets the throughput counter - // `count` is set to zero that current value of `rate` isn't included - // in the cumulative average - - this.masterPlaylistController_.mainSegmentLoader_.throughput = { - rate: 0, - count: 0 - }; - } - }, - - /** - * `systemBandwidth` is a combination of two serial processes bit-rates. The first - * is the network bitrate provided by `bandwidth` and the second is the bitrate of - * the entire process after that - decryption, transmuxing, and appending - provided - * by `throughput`. - * - * Since the two process are serial, the overall system bandwidth is given by: - * sysBandwidth = 1 / (1 / bandwidth + 1 / throughput) - */ - systemBandwidth: { - get: function get() { - var invBandwidth = 1 / (this.bandwidth || 1); - var invThroughput; - - if (this.throughput > 0) { - invThroughput = 1 / this.throughput; - } else { - invThroughput = 0; - } - - var systemBitrate = Math.floor(1 / (invBandwidth + invThroughput)); - return systemBitrate; - }, - set: function set() { - videojs__default['default'].log.error('The "systemBandwidth" property is read-only'); - } - } - }); - - if (this.options_.bandwidth) { - this.bandwidth = this.options_.bandwidth; - } - - if (this.options_.throughput) { - this.throughput = this.options_.throughput; - } - - Object.defineProperties(this.stats, { - bandwidth: { - get: function get() { - return _this3.bandwidth || 0; - }, - enumerable: true - }, - mediaRequests: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequests_() || 0; - }, - enumerable: true - }, - mediaRequestsAborted: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsAborted_() || 0; - }, - enumerable: true - }, - mediaRequestsTimedout: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsTimedout_() || 0; - }, - enumerable: true - }, - mediaRequestsErrored: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsErrored_() || 0; - }, - enumerable: true - }, - mediaTransferDuration: { - get: function get() { - return _this3.masterPlaylistController_.mediaTransferDuration_() || 0; - }, - enumerable: true - }, - mediaBytesTransferred: { - get: function get() { - return _this3.masterPlaylistController_.mediaBytesTransferred_() || 0; - }, - enumerable: true - }, - mediaSecondsLoaded: { - get: function get() { - return _this3.masterPlaylistController_.mediaSecondsLoaded_() || 0; - }, - enumerable: true - }, - mediaAppends: { - get: function get() { - return _this3.masterPlaylistController_.mediaAppends_() || 0; - }, - enumerable: true - }, - mainAppendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.mainAppendsToLoadedData_() || 0; - }, - enumerable: true - }, - audioAppendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.audioAppendsToLoadedData_() || 0; - }, - enumerable: true - }, - appendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.appendsToLoadedData_() || 0; - }, - enumerable: true - }, - timeToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.timeToLoadedData_() || 0; - }, - enumerable: true - }, - buffered: { - get: function get() { - return timeRangesToArray(_this3.tech_.buffered()); - }, - enumerable: true - }, - currentTime: { - get: function get() { - return _this3.tech_.currentTime(); - }, - enumerable: true - }, - currentSource: { - get: function get() { - return _this3.tech_.currentSource_; - }, - enumerable: true - }, - currentTech: { - get: function get() { - return _this3.tech_.name_; - }, - enumerable: true - }, - duration: { - get: function get() { - return _this3.tech_.duration(); - }, - enumerable: true - }, - master: { - get: function get() { - return _this3.playlists.master; - }, - enumerable: true - }, - playerDimensions: { - get: function get() { - return _this3.tech_.currentDimensions(); - }, - enumerable: true - }, - seekable: { - get: function get() { - return timeRangesToArray(_this3.tech_.seekable()); - }, - enumerable: true - }, - timestamp: { - get: function get() { - return Date.now(); - }, - enumerable: true - }, - videoPlaybackQuality: { - get: function get() { - return _this3.tech_.getVideoPlaybackQuality(); - }, - enumerable: true - } - }); - this.tech_.one('canplay', this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)); - this.tech_.on('bandwidthupdate', function () { - if (_this3.options_.useBandwidthFromLocalStorage) { - updateVhsLocalStorage({ - bandwidth: _this3.bandwidth, - throughput: Math.round(_this3.throughput) - }); - } - }); - this.masterPlaylistController_.on('selectedinitialmedia', function () { - // Add the manual rendition mix-in to VhsHandler - renditionSelectionMixin(_this3); - }); - this.masterPlaylistController_.sourceUpdater_.on('createdsourcebuffers', function () { - _this3.setupEme_(); - }); // the bandwidth of the primary segment loader is our best - // estimate of overall bandwidth - - this.on(this.masterPlaylistController_, 'progress', function () { - this.tech_.trigger('progress'); - }); // In the live case, we need to ignore the very first `seeking` event since - // that will be the result of the seek-to-live behavior - - this.on(this.masterPlaylistController_, 'firstplay', function () { - this.ignoreNextSeekingEvent_ = true; - }); - this.setupQualityLevels_(); // do nothing if the tech has been disposed already - // this can occur if someone sets the src in player.ready(), for instance - - if (!this.tech_.el()) { - return; - } - - this.mediaSourceUrl_ = window__default['default'].URL.createObjectURL(this.masterPlaylistController_.mediaSource); - this.tech_.src(this.mediaSourceUrl_); - } - /** - * If necessary and EME is available, sets up EME options and waits for key session - * creation. - * - * This function also updates the source updater so taht it can be used, as for some - * browsers, EME must be configured before content is appended (if appending unencrypted - * content before encrypted content). - */ - ; - - _proto.setupEme_ = function setupEme_() { - var _this4 = this; - - var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader; - var didSetupEmeOptions = setupEmeOptions({ - player: this.player_, - sourceKeySystems: this.source_.keySystems, - media: this.playlists.media(), - audioMedia: audioPlaylistLoader && audioPlaylistLoader.media() - }); // In IE11 this is too early to initialize media keys, and IE11 does not support - // promises. - - if (videojs__default['default'].browser.IE_VERSION === 11 || !didSetupEmeOptions) { - // If EME options were not set up, we've done all we could to initialize EME. - this.masterPlaylistController_.sourceUpdater_.initializedEme(); - return; - } - - this.logger_('waiting for EME key session creation'); - waitForKeySessionCreation({ - player: this.player_, - sourceKeySystems: this.source_.keySystems, - audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(), - mainPlaylists: this.playlists.master.playlists - }).then(function () { - _this4.logger_('created EME key session'); - - _this4.masterPlaylistController_.sourceUpdater_.initializedEme(); - }).catch(function (err) { - _this4.logger_('error while creating EME key session', err); - - _this4.player_.error({ - message: 'Failed to initialize media keys for EME', - code: 3 - }); - }); - } - /** - * Initializes the quality levels and sets listeners to update them. - * - * @method setupQualityLevels_ - * @private - */ - ; - - _proto.setupQualityLevels_ = function setupQualityLevels_() { - var _this5 = this; - - var player = videojs__default['default'].players[this.tech_.options_.playerId]; // if there isn't a player or there isn't a qualityLevels plugin - // or qualityLevels_ listeners have already been setup, do nothing. - - if (!player || !player.qualityLevels || this.qualityLevels_) { - return; - } - - this.qualityLevels_ = player.qualityLevels(); - this.masterPlaylistController_.on('selectedinitialmedia', function () { - handleVhsLoadedMetadata(_this5.qualityLevels_, _this5); - }); - this.playlists.on('mediachange', function () { - handleVhsMediaChange(_this5.qualityLevels_, _this5.playlists); - }); - } - /** - * return the version - */ - ; - - VhsHandler.version = function version$5() { - return { - '@videojs/http-streaming': version$4, - 'mux.js': version$3, - 'mpd-parser': version$2, - 'm3u8-parser': version$1, - 'aes-decrypter': version - }; - } - /** - * return the version - */ - ; - - _proto.version = function version() { - return this.constructor.version(); - }; - - _proto.canChangeType = function canChangeType() { - return SourceUpdater.canChangeType(); - } - /** - * Begin playing the video. - */ - ; - - _proto.play = function play() { - this.masterPlaylistController_.play(); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.setCurrentTime = function setCurrentTime(currentTime) { - this.masterPlaylistController_.setCurrentTime(currentTime); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.duration = function duration() { - return this.masterPlaylistController_.duration(); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.seekable = function seekable() { - return this.masterPlaylistController_.seekable(); - } - /** - * Abort all outstanding work and cleanup. - */ - ; - - _proto.dispose = function dispose() { - if (this.playbackWatcher_) { - this.playbackWatcher_.dispose(); - } - - if (this.masterPlaylistController_) { - this.masterPlaylistController_.dispose(); - } - - if (this.qualityLevels_) { - this.qualityLevels_.dispose(); - } - - if (this.player_) { - delete this.player_.vhs; - delete this.player_.dash; - delete this.player_.hls; - } - - if (this.tech_ && this.tech_.vhs) { - delete this.tech_.vhs; - } // don't check this.tech_.hls as it will log a deprecated warning - - - if (this.tech_) { - delete this.tech_.hls; - } - - if (this.mediaSourceUrl_ && window__default['default'].URL.revokeObjectURL) { - window__default['default'].URL.revokeObjectURL(this.mediaSourceUrl_); - this.mediaSourceUrl_ = null; - } - - _Component.prototype.dispose.call(this); - }; - - _proto.convertToProgramTime = function convertToProgramTime(time, callback) { - return getProgramTime({ - playlist: this.masterPlaylistController_.media(), - time: time, - callback: callback - }); - } // the player must be playing before calling this - ; - - _proto.seekToProgramTime = function seekToProgramTime$1(programTime, callback, pauseAfterSeek, retryCount) { - if (pauseAfterSeek === void 0) { - pauseAfterSeek = true; - } - - if (retryCount === void 0) { - retryCount = 2; - } - - return seekToProgramTime({ - programTime: programTime, - playlist: this.masterPlaylistController_.media(), - retryCount: retryCount, - pauseAfterSeek: pauseAfterSeek, - seekTo: this.options_.seekTo, - tech: this.options_.tech, - callback: callback - }); - }; - - return VhsHandler; -}(Component); -/** - * The Source Handler object, which informs video.js what additional - * MIME types are supported and sets up playback. It is registered - * automatically to the appropriate tech based on the capabilities of - * the browser it is running in. It is not necessary to use or modify - * this object in normal usage. - */ - - -var VhsSourceHandler = { - name: 'videojs-http-streaming', - VERSION: version$4, - canHandleSource: function canHandleSource(srcObj, options) { - if (options === void 0) { - options = {}; - } - - var localOptions = videojs__default['default'].mergeOptions(videojs__default['default'].options, options); - return VhsSourceHandler.canPlayType(srcObj.type, localOptions); - }, - handleSource: function handleSource(source, tech, options) { - if (options === void 0) { - options = {}; - } - - var localOptions = videojs__default['default'].mergeOptions(videojs__default['default'].options, options); - tech.vhs = new VhsHandler(source, tech, localOptions); - - if (!videojs__default['default'].hasOwnProperty('hls')) { - Object.defineProperty(tech, 'hls', { - get: function get() { - videojs__default['default'].log.warn('player.tech().hls is deprecated. Use player.tech().vhs instead.'); - return tech.vhs; - }, - configurable: true - }); - } - - tech.vhs.xhr = xhrFactory(); - tech.vhs.src(source.src, source.type); - return tech.vhs; - }, - canPlayType: function canPlayType(type, options) { - if (options === void 0) { - options = {}; - } - - var _videojs$mergeOptions = videojs__default['default'].mergeOptions(videojs__default['default'].options, options), - _videojs$mergeOptions2 = _videojs$mergeOptions.vhs.overrideNative, - overrideNative = _videojs$mergeOptions2 === void 0 ? !videojs__default['default'].browser.IS_ANY_SAFARI : _videojs$mergeOptions2; - - var supportedType = mediaTypes_js.simpleTypeFromSourceType(type); - var canUseMsePlayback = supportedType && (!Vhs.supportsTypeNatively(supportedType) || overrideNative); - return canUseMsePlayback ? 'maybe' : ''; - } -}; -/** - * Check to see if the native MediaSource object exists and supports - * an MP4 container with both H.264 video and AAC-LC audio. - * - * @return {boolean} if native media sources are supported - */ - -var supportsNativeMediaSources = function supportsNativeMediaSources() { - return codecs_js.browserSupportsCodec('avc1.4d400d,mp4a.40.2'); -}; // register source handlers with the appropriate techs - - -if (supportsNativeMediaSources()) { - videojs__default['default'].getTech('Html5').registerSourceHandler(VhsSourceHandler, 0); -} - -videojs__default['default'].VhsHandler = VhsHandler; -Object.defineProperty(videojs__default['default'], 'HlsHandler', { - get: function get() { - videojs__default['default'].log.warn('videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead.'); - return VhsHandler; - }, - configurable: true -}); -videojs__default['default'].VhsSourceHandler = VhsSourceHandler; -Object.defineProperty(videojs__default['default'], 'HlsSourceHandler', { - get: function get() { - videojs__default['default'].log.warn('videojs.HlsSourceHandler is deprecated. ' + 'Use videojs.VhsSourceHandler instead.'); - return VhsSourceHandler; - }, - configurable: true -}); -videojs__default['default'].Vhs = Vhs; -Object.defineProperty(videojs__default['default'], 'Hls', { - get: function get() { - videojs__default['default'].log.warn('videojs.Hls is deprecated. Use videojs.Vhs instead.'); - return Vhs; - }, - configurable: true -}); - -if (!videojs__default['default'].use) { - videojs__default['default'].registerComponent('Hls', Vhs); - videojs__default['default'].registerComponent('Vhs', Vhs); -} - -videojs__default['default'].options.vhs = videojs__default['default'].options.vhs || {}; -videojs__default['default'].options.hls = videojs__default['default'].options.hls || {}; - -if (videojs__default['default'].registerPlugin) { - videojs__default['default'].registerPlugin('reloadSourceOnError', reloadSourceOnError); -} else { - videojs__default['default'].plugin('reloadSourceOnError', reloadSourceOnError); -} - -Object.defineProperty(exports, 'simpleTypeFromSourceType', { - enumerable: true, - get: function () { - return mediaTypes_js.simpleTypeFromSourceType; - } -}); -exports.LOCAL_STORAGE_KEY = LOCAL_STORAGE_KEY; -exports.Vhs = Vhs; -exports.VhsHandler = VhsHandler; -exports.VhsSourceHandler = VhsSourceHandler; -exports.emeKeySystems = emeKeySystems; -exports.expandDataUri = expandDataUri; -exports.getAllPsshKeySystemsOptions = getAllPsshKeySystemsOptions; -exports.setupEmeOptions = setupEmeOptions; -exports.waitForKeySessionCreation = waitForKeySessionCreation; diff --git a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.es.js b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.es.js deleted file mode 100644 index e2dde0b..0000000 --- a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.es.js +++ /dev/null @@ -1,25692 +0,0 @@ -/*! @name @videojs/http-streaming @version 2.9.1 @license Apache-2.0 */ -import _assertThisInitialized from '@babel/runtime/helpers/assertThisInitialized'; -import _inheritsLoose from '@babel/runtime/helpers/inheritsLoose'; -import document from 'global/document'; -import window from 'global/window'; -import _resolveUrl from '@videojs/vhs-utils/es/resolve-url.js'; -import videojs from 'video.js'; -import _extends from '@babel/runtime/helpers/extends'; -import { Parser } from 'm3u8-parser'; -import { isAudioCodec, translateLegacyCodec, codecsFromDefault, parseCodecs, getMimeForCodec, DEFAULT_VIDEO_CODEC, DEFAULT_AUDIO_CODEC, browserSupportsCodec, muxerSupportsCodec } from '@videojs/vhs-utils/es/codecs.js'; -import { simpleTypeFromSourceType } from '@videojs/vhs-utils/es/media-types.js'; -export { simpleTypeFromSourceType } from '@videojs/vhs-utils/es/media-types.js'; -import { generateSidxKey, parseUTCTiming, parse, addSidxSegmentsToPlaylist } from 'mpd-parser'; -import parseSidx from 'mux.js/lib/tools/parse-sidx'; -import { getId3Offset } from '@videojs/vhs-utils/es/id3-helpers'; -import { detectContainerForBytes, isLikelyFmp4MediaSegment } from '@videojs/vhs-utils/es/containers'; -import { concatTypedArrays, stringToBytes, toUint8 } from '@videojs/vhs-utils/es/byte-helpers'; -import { ONE_SECOND_IN_TS } from 'mux.js/lib/utils/clock'; - -/** - * @file resolve-url.js - Handling how URLs are resolved and manipulated - */ -var resolveUrl = _resolveUrl; -/** - * Checks whether xhr request was redirected and returns correct url depending - * on `handleManifestRedirects` option - * - * @api private - * - * @param {string} url - an url being requested - * @param {XMLHttpRequest} req - xhr request result - * - * @return {string} - */ - -var resolveManifestRedirect = function resolveManifestRedirect(handleManifestRedirect, url, req) { - // To understand how the responseURL below is set and generated: - // - https://fetch.spec.whatwg.org/#concept-response-url - // - https://fetch.spec.whatwg.org/#atomic-http-redirect-handling - if (handleManifestRedirect && req && req.responseURL && url !== req.responseURL) { - return req.responseURL; - } - - return url; -}; - -var logger = function logger(source) { - if (videojs.log.debug) { - return videojs.log.debug.bind(videojs, 'VHS:', source + " >"); - } - - return function () {}; -}; - -/** - * ranges - * - * Utilities for working with TimeRanges. - * - */ - -var TIME_FUDGE_FACTOR = 1 / 30; // Comparisons between time values such as current time and the end of the buffered range -// can be misleading because of precision differences or when the current media has poorly -// aligned audio and video, which can cause values to be slightly off from what you would -// expect. This value is what we consider to be safe to use in such comparisons to account -// for these scenarios. - -var SAFE_TIME_DELTA = TIME_FUDGE_FACTOR * 3; - -var filterRanges = function filterRanges(timeRanges, predicate) { - var results = []; - var i; - - if (timeRanges && timeRanges.length) { - // Search for ranges that match the predicate - for (i = 0; i < timeRanges.length; i++) { - if (predicate(timeRanges.start(i), timeRanges.end(i))) { - results.push([timeRanges.start(i), timeRanges.end(i)]); - } - } - } - - return videojs.createTimeRanges(results); -}; -/** - * Attempts to find the buffered TimeRange that contains the specified - * time. - * - * @param {TimeRanges} buffered - the TimeRanges object to query - * @param {number} time - the time to filter on. - * @return {TimeRanges} a new TimeRanges object - */ - - -var findRange = function findRange(buffered, time) { - return filterRanges(buffered, function (start, end) { - return start - SAFE_TIME_DELTA <= time && end + SAFE_TIME_DELTA >= time; - }); -}; -/** - * Returns the TimeRanges that begin later than the specified time. - * - * @param {TimeRanges} timeRanges - the TimeRanges object to query - * @param {number} time - the time to filter on. - * @return {TimeRanges} a new TimeRanges object. - */ - -var findNextRange = function findNextRange(timeRanges, time) { - return filterRanges(timeRanges, function (start) { - return start - TIME_FUDGE_FACTOR >= time; - }); -}; -/** - * Returns gaps within a list of TimeRanges - * - * @param {TimeRanges} buffered - the TimeRanges object - * @return {TimeRanges} a TimeRanges object of gaps - */ - -var findGaps = function findGaps(buffered) { - if (buffered.length < 2) { - return videojs.createTimeRanges(); - } - - var ranges = []; - - for (var i = 1; i < buffered.length; i++) { - var start = buffered.end(i - 1); - var end = buffered.start(i); - ranges.push([start, end]); - } - - return videojs.createTimeRanges(ranges); -}; -/** - * Calculate the intersection of two TimeRanges - * - * @param {TimeRanges} bufferA - * @param {TimeRanges} bufferB - * @return {TimeRanges} The interesection of `bufferA` with `bufferB` - */ - -var bufferIntersection = function bufferIntersection(bufferA, bufferB) { - var start = null; - var end = null; - var arity = 0; - var extents = []; - var ranges = []; - - if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) { - return videojs.createTimeRange(); - } // Handle the case where we have both buffers and create an - // intersection of the two - - - var count = bufferA.length; // A) Gather up all start and end times - - while (count--) { - extents.push({ - time: bufferA.start(count), - type: 'start' - }); - extents.push({ - time: bufferA.end(count), - type: 'end' - }); - } - - count = bufferB.length; - - while (count--) { - extents.push({ - time: bufferB.start(count), - type: 'start' - }); - extents.push({ - time: bufferB.end(count), - type: 'end' - }); - } // B) Sort them by time - - - extents.sort(function (a, b) { - return a.time - b.time; - }); // C) Go along one by one incrementing arity for start and decrementing - // arity for ends - - for (count = 0; count < extents.length; count++) { - if (extents[count].type === 'start') { - arity++; // D) If arity is ever incremented to 2 we are entering an - // overlapping range - - if (arity === 2) { - start = extents[count].time; - } - } else if (extents[count].type === 'end') { - arity--; // E) If arity is ever decremented to 1 we leaving an - // overlapping range - - if (arity === 1) { - end = extents[count].time; - } - } // F) Record overlapping ranges - - - if (start !== null && end !== null) { - ranges.push([start, end]); - start = null; - end = null; - } - } - - return videojs.createTimeRanges(ranges); -}; -/** - * Gets a human readable string for a TimeRange - * - * @param {TimeRange} range - * @return {string} a human readable string - */ - -var printableRange = function printableRange(range) { - var strArr = []; - - if (!range || !range.length) { - return ''; - } - - for (var i = 0; i < range.length; i++) { - strArr.push(range.start(i) + ' => ' + range.end(i)); - } - - return strArr.join(', '); -}; -/** - * Calculates the amount of time left in seconds until the player hits the end of the - * buffer and causes a rebuffer - * - * @param {TimeRange} buffered - * The state of the buffer - * @param {Numnber} currentTime - * The current time of the player - * @param {number} playbackRate - * The current playback rate of the player. Defaults to 1. - * @return {number} - * Time until the player has to start rebuffering in seconds. - * @function timeUntilRebuffer - */ - -var timeUntilRebuffer = function timeUntilRebuffer(buffered, currentTime, playbackRate) { - if (playbackRate === void 0) { - playbackRate = 1; - } - - var bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0; - return (bufferedEnd - currentTime) / playbackRate; -}; -/** - * Converts a TimeRanges object into an array representation - * - * @param {TimeRanges} timeRanges - * @return {Array} - */ - -var timeRangesToArray = function timeRangesToArray(timeRanges) { - var timeRangesList = []; - - for (var i = 0; i < timeRanges.length; i++) { - timeRangesList.push({ - start: timeRanges.start(i), - end: timeRanges.end(i) - }); - } - - return timeRangesList; -}; -/** - * Determines if two time range objects are different. - * - * @param {TimeRange} a - * the first time range object to check - * - * @param {TimeRange} b - * the second time range object to check - * - * @return {Boolean} - * Whether the time range objects differ - */ - -var isRangeDifferent = function isRangeDifferent(a, b) { - // same object - if (a === b) { - return false; - } // one or the other is undefined - - - if (!a && b || !b && a) { - return true; - } // length is different - - - if (a.length !== b.length) { - return true; - } // see if any start/end pair is different - - - for (var i = 0; i < a.length; i++) { - if (a.start(i) !== b.start(i) || a.end(i) !== b.end(i)) { - return true; - } - } // if the length and every pair is the same - // this is the same time range - - - return false; -}; -var lastBufferedEnd = function lastBufferedEnd(a) { - if (!a || !a.length || !a.end) { - return; - } - - return a.end(a.length - 1); -}; - -/** - * @file playlist.js - * - * Playlist related utilities. - */ -var createTimeRange = videojs.createTimeRange; -/** - * A function to get a combined list of parts and segments with durations - * and indexes. - * - * @param {Playlist} playlist the playlist to get the list for. - * - * @return {Array} The part/segment list. - */ - -var getPartsAndSegments = function getPartsAndSegments(playlist) { - return (playlist.segments || []).reduce(function (acc, segment, si) { - if (segment.parts) { - segment.parts.forEach(function (part, pi) { - acc.push({ - duration: part.duration, - segmentIndex: si, - partIndex: pi, - part: part, - segment: segment - }); - }); - } else { - acc.push({ - duration: segment.duration, - segmentIndex: si, - partIndex: null, - segment: segment, - part: null - }); - } - - return acc; - }, []); -}; -var getLastParts = function getLastParts(media) { - var lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1]; - return lastSegment && lastSegment.parts || []; -}; -var getKnownPartCount = function getKnownPartCount(_ref) { - var preloadSegment = _ref.preloadSegment; - - if (!preloadSegment) { - return; - } - - var parts = preloadSegment.parts, - preloadHints = preloadSegment.preloadHints; - var partCount = (preloadHints || []).reduce(function (count, hint) { - return count + (hint.type === 'PART' ? 1 : 0); - }, 0); - partCount += parts && parts.length ? parts.length : 0; - return partCount; -}; -/** - * Get the number of seconds to delay from the end of a - * live playlist. - * - * @param {Playlist} master the master playlist - * @param {Playlist} media the media playlist - * @return {number} the hold back in seconds. - */ - -var liveEdgeDelay = function liveEdgeDelay(master, media) { - if (media.endList) { - return 0; - } // dash suggestedPresentationDelay trumps everything - - - if (master && master.suggestedPresentationDelay) { - return master.suggestedPresentationDelay; - } - - var hasParts = getLastParts(media).length > 0; // look for "part" delays from ll-hls first - - if (hasParts && media.serverControl && media.serverControl.partHoldBack) { - return media.serverControl.partHoldBack; - } else if (hasParts && media.partTargetDuration) { - return media.partTargetDuration * 3; // finally look for full segment delays - } else if (media.serverControl && media.serverControl.holdBack) { - return media.serverControl.holdBack; - } else if (media.targetDuration) { - return media.targetDuration * 3; - } - - return 0; -}; -/** - * walk backward until we find a duration we can use - * or return a failure - * - * @param {Playlist} playlist the playlist to walk through - * @param {Number} endSequence the mediaSequence to stop walking on - */ - -var backwardDuration = function backwardDuration(playlist, endSequence) { - var result = 0; - var i = endSequence - playlist.mediaSequence; // if a start time is available for segment immediately following - // the interval, use it - - var segment = playlist.segments[i]; // Walk backward until we find the latest segment with timeline - // information that is earlier than endSequence - - if (segment) { - if (typeof segment.start !== 'undefined') { - return { - result: segment.start, - precise: true - }; - } - - if (typeof segment.end !== 'undefined') { - return { - result: segment.end - segment.duration, - precise: true - }; - } - } - - while (i--) { - segment = playlist.segments[i]; - - if (typeof segment.end !== 'undefined') { - return { - result: result + segment.end, - precise: true - }; - } - - result += segment.duration; - - if (typeof segment.start !== 'undefined') { - return { - result: result + segment.start, - precise: true - }; - } - } - - return { - result: result, - precise: false - }; -}; -/** - * walk forward until we find a duration we can use - * or return a failure - * - * @param {Playlist} playlist the playlist to walk through - * @param {number} endSequence the mediaSequence to stop walking on - */ - - -var forwardDuration = function forwardDuration(playlist, endSequence) { - var result = 0; - var segment; - var i = endSequence - playlist.mediaSequence; // Walk forward until we find the earliest segment with timeline - // information - - for (; i < playlist.segments.length; i++) { - segment = playlist.segments[i]; - - if (typeof segment.start !== 'undefined') { - return { - result: segment.start - result, - precise: true - }; - } - - result += segment.duration; - - if (typeof segment.end !== 'undefined') { - return { - result: segment.end - result, - precise: true - }; - } - } // indicate we didn't find a useful duration estimate - - - return { - result: -1, - precise: false - }; -}; -/** - * Calculate the media duration from the segments associated with a - * playlist. The duration of a subinterval of the available segments - * may be calculated by specifying an end index. - * - * @param {Object} playlist a media playlist object - * @param {number=} endSequence an exclusive upper boundary - * for the playlist. Defaults to playlist length. - * @param {number} expired the amount of time that has dropped - * off the front of the playlist in a live scenario - * @return {number} the duration between the first available segment - * and end index. - */ - - -var intervalDuration = function intervalDuration(playlist, endSequence, expired) { - if (typeof endSequence === 'undefined') { - endSequence = playlist.mediaSequence + playlist.segments.length; - } - - if (endSequence < playlist.mediaSequence) { - return 0; - } // do a backward walk to estimate the duration - - - var backward = backwardDuration(playlist, endSequence); - - if (backward.precise) { - // if we were able to base our duration estimate on timing - // information provided directly from the Media Source, return - // it - return backward.result; - } // walk forward to see if a precise duration estimate can be made - // that way - - - var forward = forwardDuration(playlist, endSequence); - - if (forward.precise) { - // we found a segment that has been buffered and so it's - // position is known precisely - return forward.result; - } // return the less-precise, playlist-based duration estimate - - - return backward.result + expired; -}; -/** - * Calculates the duration of a playlist. If a start and end index - * are specified, the duration will be for the subset of the media - * timeline between those two indices. The total duration for live - * playlists is always Infinity. - * - * @param {Object} playlist a media playlist object - * @param {number=} endSequence an exclusive upper - * boundary for the playlist. Defaults to the playlist media - * sequence number plus its length. - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @return {number} the duration between the start index and end - * index. - */ - - -var duration = function duration(playlist, endSequence, expired) { - if (!playlist) { - return 0; - } - - if (typeof expired !== 'number') { - expired = 0; - } // if a slice of the total duration is not requested, use - // playlist-level duration indicators when they're present - - - if (typeof endSequence === 'undefined') { - // if present, use the duration specified in the playlist - if (playlist.totalDuration) { - return playlist.totalDuration; - } // duration should be Infinity for live playlists - - - if (!playlist.endList) { - return window.Infinity; - } - } // calculate the total duration based on the segment durations - - - return intervalDuration(playlist, endSequence, expired); -}; -/** - * Calculate the time between two indexes in the current playlist - * neight the start- nor the end-index need to be within the current - * playlist in which case, the targetDuration of the playlist is used - * to approximate the durations of the segments - * - * @param {Array} options.durationList list to iterate over for durations. - * @param {number} options.defaultDuration duration to use for elements before or after the durationList - * @param {number} options.startIndex partsAndSegments index to start - * @param {number} options.endIndex partsAndSegments index to end. - * @return {number} the number of seconds between startIndex and endIndex - */ - -var sumDurations = function sumDurations(_ref2) { - var defaultDuration = _ref2.defaultDuration, - durationList = _ref2.durationList, - startIndex = _ref2.startIndex, - endIndex = _ref2.endIndex; - var durations = 0; - - if (startIndex > endIndex) { - var _ref3 = [endIndex, startIndex]; - startIndex = _ref3[0]; - endIndex = _ref3[1]; - } - - if (startIndex < 0) { - for (var i = startIndex; i < Math.min(0, endIndex); i++) { - durations += defaultDuration; - } - - startIndex = 0; - } - - for (var _i = startIndex; _i < endIndex; _i++) { - durations += durationList[_i].duration; - } - - return durations; -}; -/** - * Calculates the playlist end time - * - * @param {Object} playlist a media playlist object - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @param {boolean|false} useSafeLiveEnd a boolean value indicating whether or not the - * playlist end calculation should consider the safe live end - * (truncate the playlist end by three segments). This is normally - * used for calculating the end of the playlist's seekable range. - * This takes into account the value of liveEdgePadding. - * Setting liveEdgePadding to 0 is equivalent to setting this to false. - * @param {number} liveEdgePadding a number indicating how far from the end of the playlist we should be in seconds. - * If this is provided, it is used in the safe live end calculation. - * Setting useSafeLiveEnd=false or liveEdgePadding=0 are equivalent. - * Corresponds to suggestedPresentationDelay in DASH manifests. - * @return {number} the end time of playlist - * @function playlistEnd - */ - -var playlistEnd = function playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding) { - if (!playlist || !playlist.segments) { - return null; - } - - if (playlist.endList) { - return duration(playlist); - } - - if (expired === null) { - return null; - } - - expired = expired || 0; - var lastSegmentTime = intervalDuration(playlist, playlist.mediaSequence + playlist.segments.length, expired); - - if (useSafeLiveEnd) { - liveEdgePadding = typeof liveEdgePadding === 'number' ? liveEdgePadding : liveEdgeDelay(null, playlist); - lastSegmentTime -= liveEdgePadding; - } // don't return a time less than zero - - - return Math.max(0, lastSegmentTime); -}; -/** - * Calculates the interval of time that is currently seekable in a - * playlist. The returned time ranges are relative to the earliest - * moment in the specified playlist that is still available. A full - * seekable implementation for live streams would need to offset - * these values by the duration of content that has expired from the - * stream. - * - * @param {Object} playlist a media playlist object - * dropped off the front of the playlist in a live scenario - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @param {number} liveEdgePadding how far from the end of the playlist we should be in seconds. - * Corresponds to suggestedPresentationDelay in DASH manifests. - * @return {TimeRanges} the periods of time that are valid targets - * for seeking - */ - -var seekable = function seekable(playlist, expired, liveEdgePadding) { - var useSafeLiveEnd = true; - var seekableStart = expired || 0; - var seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); - - if (seekableEnd === null) { - return createTimeRange(); - } - - return createTimeRange(seekableStart, seekableEnd); -}; -/** - * Determine the index and estimated starting time of the segment that - * contains a specified playback position in a media playlist. - * - * @param {Object} options.playlist the media playlist to query - * @param {number} options.currentTime The number of seconds since the earliest - * possible position to determine the containing segment for - * @param {number} options.startTime the time when the segment/part starts - * @param {number} options.startingSegmentIndex the segment index to start looking at. - * @param {number?} [options.startingPartIndex] the part index to look at within the segment. - * - * @return {Object} an object with partIndex, segmentIndex, and startTime. - */ - -var getMediaInfoForTime = function getMediaInfoForTime(_ref4) { - var playlist = _ref4.playlist, - currentTime = _ref4.currentTime, - startingSegmentIndex = _ref4.startingSegmentIndex, - startingPartIndex = _ref4.startingPartIndex, - startTime = _ref4.startTime; - var time = currentTime - startTime; - var partsAndSegments = getPartsAndSegments(playlist); - var startIndex = 0; - - for (var i = 0; i < partsAndSegments.length; i++) { - var partAndSegment = partsAndSegments[i]; - - if (startingSegmentIndex !== partAndSegment.segmentIndex) { - continue; - } // skip this if part index does not match. - - - if (typeof startingPartIndex === 'number' && typeof partAndSegment.partIndex === 'number' && startingPartIndex !== partAndSegment.partIndex) { - continue; - } - - startIndex = i; - break; - } - - if (time < 0) { - // Walk backward from startIndex in the playlist, adding durations - // until we find a segment that contains `time` and return it - if (startIndex > 0) { - for (var _i2 = startIndex - 1; _i2 >= 0; _i2--) { - var _partAndSegment = partsAndSegments[_i2]; - time += _partAndSegment.duration; // TODO: consider not using TIME_FUDGE_FACTOR at all here - - if (time + TIME_FUDGE_FACTOR > 0) { - return { - partIndex: _partAndSegment.partIndex, - segmentIndex: _partAndSegment.segmentIndex, - startTime: startTime - sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: partsAndSegments, - startIndex: startIndex, - endIndex: _i2 - }) - }; - } - } - } // We were unable to find a good segment within the playlist - // so select the first segment - - - return { - partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null, - segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0, - startTime: currentTime - }; - } // When startIndex is negative, we first walk forward to first segment - // adding target durations. If we "run out of time" before getting to - // the first segment, return the first segment - - - if (startIndex < 0) { - for (var _i3 = startIndex; _i3 < 0; _i3++) { - time -= playlist.targetDuration; - - if (time < 0) { - return { - partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null, - segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0, - startTime: currentTime - }; - } - } - - startIndex = 0; - } // Walk forward from startIndex in the playlist, subtracting durations - // until we find a segment that contains `time` and return it - - - for (var _i4 = startIndex; _i4 < partsAndSegments.length; _i4++) { - var _partAndSegment2 = partsAndSegments[_i4]; - time -= _partAndSegment2.duration; // TODO: consider not using TIME_FUDGE_FACTOR at all here - - if (time - TIME_FUDGE_FACTOR < 0) { - return { - partIndex: _partAndSegment2.partIndex, - segmentIndex: _partAndSegment2.segmentIndex, - startTime: startTime + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: partsAndSegments, - startIndex: startIndex, - endIndex: _i4 - }) - }; - } - } // We are out of possible candidates so load the last one... - - - return { - segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex, - partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex, - startTime: currentTime - }; -}; -/** - * Check whether the playlist is blacklisted or not. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is blacklisted or not - * @function isBlacklisted - */ - -var isBlacklisted = function isBlacklisted(playlist) { - return playlist.excludeUntil && playlist.excludeUntil > Date.now(); -}; -/** - * Check whether the playlist is compatible with current playback configuration or has - * been blacklisted permanently for being incompatible. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is incompatible or not - * @function isIncompatible - */ - -var isIncompatible = function isIncompatible(playlist) { - return playlist.excludeUntil && playlist.excludeUntil === Infinity; -}; -/** - * Check whether the playlist is enabled or not. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is enabled or not - * @function isEnabled - */ - -var isEnabled = function isEnabled(playlist) { - var blacklisted = isBlacklisted(playlist); - return !playlist.disabled && !blacklisted; -}; -/** - * Check whether the playlist has been manually disabled through the representations api. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is disabled manually or not - * @function isDisabled - */ - -var isDisabled = function isDisabled(playlist) { - return playlist.disabled; -}; -/** - * Returns whether the current playlist is an AES encrypted HLS stream - * - * @return {boolean} true if it's an AES encrypted HLS stream - */ - -var isAes = function isAes(media) { - for (var i = 0; i < media.segments.length; i++) { - if (media.segments[i].key) { - return true; - } - } - - return false; -}; -/** - * Checks if the playlist has a value for the specified attribute - * - * @param {string} attr - * Attribute to check for - * @param {Object} playlist - * The media playlist object - * @return {boolean} - * Whether the playlist contains a value for the attribute or not - * @function hasAttribute - */ - -var hasAttribute = function hasAttribute(attr, playlist) { - return playlist.attributes && playlist.attributes[attr]; -}; -/** - * Estimates the time required to complete a segment download from the specified playlist - * - * @param {number} segmentDuration - * Duration of requested segment - * @param {number} bandwidth - * Current measured bandwidth of the player - * @param {Object} playlist - * The media playlist object - * @param {number=} bytesReceived - * Number of bytes already received for the request. Defaults to 0 - * @return {number|NaN} - * The estimated time to request the segment. NaN if bandwidth information for - * the given playlist is unavailable - * @function estimateSegmentRequestTime - */ - -var estimateSegmentRequestTime = function estimateSegmentRequestTime(segmentDuration, bandwidth, playlist, bytesReceived) { - if (bytesReceived === void 0) { - bytesReceived = 0; - } - - if (!hasAttribute('BANDWIDTH', playlist)) { - return NaN; - } - - var size = segmentDuration * playlist.attributes.BANDWIDTH; - return (size - bytesReceived * 8) / bandwidth; -}; -/* - * Returns whether the current playlist is the lowest rendition - * - * @return {Boolean} true if on lowest rendition - */ - -var isLowestEnabledRendition = function isLowestEnabledRendition(master, media) { - if (master.playlists.length === 1) { - return true; - } - - var currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE; - return master.playlists.filter(function (playlist) { - if (!isEnabled(playlist)) { - return false; - } - - return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth; - }).length === 0; -}; -var playlistMatch = function playlistMatch(a, b) { - // both playlits are null - // or only one playlist is non-null - // no match - if (!a && !b || !a && b || a && !b) { - return false; - } // playlist objects are the same, match - - - if (a === b) { - return true; - } // first try to use id as it should be the most - // accurate - - - if (a.id && b.id && a.id === b.id) { - return true; - } // next try to use reslovedUri as it should be the - // second most accurate. - - - if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) { - return true; - } // finally try to use uri as it should be accurate - // but might miss a few cases for relative uris - - - if (a.uri && b.uri && a.uri === b.uri) { - return true; - } - - return false; -}; - -var someAudioVariant = function someAudioVariant(master, callback) { - var AUDIO = master && master.mediaGroups && master.mediaGroups.AUDIO || {}; - var found = false; - - for (var groupName in AUDIO) { - for (var label in AUDIO[groupName]) { - found = callback(AUDIO[groupName][label]); - - if (found) { - break; - } - } - - if (found) { - break; - } - } - - return !!found; -}; - -var isAudioOnly = function isAudioOnly(master) { - // we are audio only if we have no main playlists but do - // have media group playlists. - if (!master || !master.playlists || !master.playlists.length) { - // without audio variants or playlists this - // is not an audio only master. - var found = someAudioVariant(master, function (variant) { - return variant.playlists && variant.playlists.length || variant.uri; - }); - return found; - } // if every playlist has only an audio codec it is audio only - - - var _loop = function _loop(i) { - var playlist = master.playlists[i]; - var CODECS = playlist.attributes && playlist.attributes.CODECS; // all codecs are audio, this is an audio playlist. - - if (CODECS && CODECS.split(',').every(function (c) { - return isAudioCodec(c); - })) { - return "continue"; - } // playlist is in an audio group it is audio only - - - var found = someAudioVariant(master, function (variant) { - return playlistMatch(playlist, variant); - }); - - if (found) { - return "continue"; - } // if we make it here this playlist isn't audio and we - // are not audio only - - - return { - v: false - }; - }; - - for (var i = 0; i < master.playlists.length; i++) { - var _ret = _loop(i); - - if (_ret === "continue") continue; - if (typeof _ret === "object") return _ret.v; - } // if we make it past every playlist without returning, then - // this is an audio only playlist. - - - return true; -}; // exports - -var Playlist = { - liveEdgeDelay: liveEdgeDelay, - duration: duration, - seekable: seekable, - getMediaInfoForTime: getMediaInfoForTime, - isEnabled: isEnabled, - isDisabled: isDisabled, - isBlacklisted: isBlacklisted, - isIncompatible: isIncompatible, - playlistEnd: playlistEnd, - isAes: isAes, - hasAttribute: hasAttribute, - estimateSegmentRequestTime: estimateSegmentRequestTime, - isLowestEnabledRendition: isLowestEnabledRendition, - isAudioOnly: isAudioOnly, - playlistMatch: playlistMatch -}; - -var log = videojs.log; -var createPlaylistID = function createPlaylistID(index, uri) { - return index + "-" + uri; -}; -/** - * Parses a given m3u8 playlist - * - * @param {Function} [onwarn] - * a function to call when the parser triggers a warning event. - * @param {Function} [oninfo] - * a function to call when the parser triggers an info event. - * @param {string} manifestString - * The downloaded manifest string - * @param {Object[]} [customTagParsers] - * An array of custom tag parsers for the m3u8-parser instance - * @param {Object[]} [customTagMappers] - * An array of custom tag mappers for the m3u8-parser instance - * @param {boolean} [experimentalLLHLS=false] - * Whether to keep ll-hls features in the manifest after parsing. - * @return {Object} - * The manifest object - */ - -var parseManifest = function parseManifest(_ref) { - var onwarn = _ref.onwarn, - oninfo = _ref.oninfo, - manifestString = _ref.manifestString, - _ref$customTagParsers = _ref.customTagParsers, - customTagParsers = _ref$customTagParsers === void 0 ? [] : _ref$customTagParsers, - _ref$customTagMappers = _ref.customTagMappers, - customTagMappers = _ref$customTagMappers === void 0 ? [] : _ref$customTagMappers, - experimentalLLHLS = _ref.experimentalLLHLS; - var parser = new Parser(); - - if (onwarn) { - parser.on('warn', onwarn); - } - - if (oninfo) { - parser.on('info', oninfo); - } - - customTagParsers.forEach(function (customParser) { - return parser.addParser(customParser); - }); - customTagMappers.forEach(function (mapper) { - return parser.addTagMapper(mapper); - }); - parser.push(manifestString); - parser.end(); - var manifest = parser.manifest; // remove llhls features from the parsed manifest - // if we don't want llhls support. - - if (!experimentalLLHLS) { - ['preloadSegment', 'skip', 'serverControl', 'renditionReports', 'partInf', 'partTargetDuration'].forEach(function (k) { - if (manifest.hasOwnProperty(k)) { - delete manifest[k]; - } - }); - - if (manifest.segments) { - manifest.segments.forEach(function (segment) { - ['parts', 'preloadHints'].forEach(function (k) { - if (segment.hasOwnProperty(k)) { - delete segment[k]; - } - }); - }); - } - } - - if (!manifest.targetDuration) { - var targetDuration = 10; - - if (manifest.segments && manifest.segments.length) { - targetDuration = manifest.segments.reduce(function (acc, s) { - return Math.max(acc, s.duration); - }, 0); - } - - if (onwarn) { - onwarn("manifest has no targetDuration defaulting to " + targetDuration); - } - - manifest.targetDuration = targetDuration; - } - - var parts = getLastParts(manifest); - - if (parts.length && !manifest.partTargetDuration) { - var partTargetDuration = parts.reduce(function (acc, p) { - return Math.max(acc, p.duration); - }, 0); - - if (onwarn) { - onwarn("manifest has no partTargetDuration defaulting to " + partTargetDuration); - log.error('LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.'); - } - - manifest.partTargetDuration = partTargetDuration; - } - - return manifest; -}; -/** - * Loops through all supported media groups in master and calls the provided - * callback for each group - * - * @param {Object} master - * The parsed master manifest object - * @param {Function} callback - * Callback to call for each media group - */ - -var forEachMediaGroup = function forEachMediaGroup(master, callback) { - if (!master.mediaGroups) { - return; - } - - ['AUDIO', 'SUBTITLES'].forEach(function (mediaType) { - if (!master.mediaGroups[mediaType]) { - return; - } - - for (var groupKey in master.mediaGroups[mediaType]) { - for (var labelKey in master.mediaGroups[mediaType][groupKey]) { - var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey]; - callback(mediaProperties, mediaType, groupKey, labelKey); - } - } - }); -}; -/** - * Adds properties and attributes to the playlist to keep consistent functionality for - * playlists throughout VHS. - * - * @param {Object} config - * Arguments object - * @param {Object} config.playlist - * The media playlist - * @param {string} [config.uri] - * The uri to the media playlist (if media playlist is not from within a master - * playlist) - * @param {string} id - * ID to use for the playlist - */ - -var setupMediaPlaylist = function setupMediaPlaylist(_ref2) { - var playlist = _ref2.playlist, - uri = _ref2.uri, - id = _ref2.id; - playlist.id = id; - playlist.playlistErrors_ = 0; - - if (uri) { - // For media playlists, m3u8-parser does not have access to a URI, as HLS media - // playlists do not contain their own source URI, but one is needed for consistency in - // VHS. - playlist.uri = uri; - } // For HLS master playlists, even though certain attributes MUST be defined, the - // stream may still be played without them. - // For HLS media playlists, m3u8-parser does not attach an attributes object to the - // manifest. - // - // To avoid undefined reference errors through the project, and make the code easier - // to write/read, add an empty attributes object for these cases. - - - playlist.attributes = playlist.attributes || {}; -}; -/** - * Adds ID, resolvedUri, and attributes properties to each playlist of the master, where - * necessary. In addition, creates playlist IDs for each playlist and adds playlist ID to - * playlist references to the playlists array. - * - * @param {Object} master - * The master playlist - */ - -var setupMediaPlaylists = function setupMediaPlaylists(master) { - var i = master.playlists.length; - - while (i--) { - var playlist = master.playlists[i]; - setupMediaPlaylist({ - playlist: playlist, - id: createPlaylistID(i, playlist.uri) - }); - playlist.resolvedUri = resolveUrl(master.uri, playlist.uri); - master.playlists[playlist.id] = playlist; // URI reference added for backwards compatibility - - master.playlists[playlist.uri] = playlist; // Although the spec states an #EXT-X-STREAM-INF tag MUST have a BANDWIDTH attribute, - // the stream can be played without it. Although an attributes property may have been - // added to the playlist to prevent undefined references, issue a warning to fix the - // manifest. - - if (!playlist.attributes.BANDWIDTH) { - log.warn('Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.'); - } - } -}; -/** - * Adds resolvedUri properties to each media group. - * - * @param {Object} master - * The master playlist - */ - -var resolveMediaGroupUris = function resolveMediaGroupUris(master) { - forEachMediaGroup(master, function (properties) { - if (properties.uri) { - properties.resolvedUri = resolveUrl(master.uri, properties.uri); - } - }); -}; -/** - * Creates a master playlist wrapper to insert a sole media playlist into. - * - * @param {Object} media - * Media playlist - * @param {string} uri - * The media URI - * - * @return {Object} - * Master playlist - */ - -var masterForMedia = function masterForMedia(media, uri) { - var id = createPlaylistID(0, uri); - var master = { - mediaGroups: { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - uri: window.location.href, - resolvedUri: window.location.href, - playlists: [{ - uri: uri, - id: id, - resolvedUri: uri, - // m3u8-parser does not attach an attributes property to media playlists so make - // sure that the property is attached to avoid undefined reference errors - attributes: {} - }] - }; // set up ID reference - - master.playlists[id] = master.playlists[0]; // URI reference added for backwards compatibility - - master.playlists[uri] = master.playlists[0]; - return master; -}; -/** - * Does an in-place update of the master manifest to add updated playlist URI references - * as well as other properties needed by VHS that aren't included by the parser. - * - * @param {Object} master - * Master manifest object - * @param {string} uri - * The source URI - */ - -var addPropertiesToMaster = function addPropertiesToMaster(master, uri) { - master.uri = uri; - - for (var i = 0; i < master.playlists.length; i++) { - if (!master.playlists[i].uri) { - // Set up phony URIs for the playlists since playlists are referenced by their URIs - // throughout VHS, but some formats (e.g., DASH) don't have external URIs - // TODO: consider adding dummy URIs in mpd-parser - var phonyUri = "placeholder-uri-" + i; - master.playlists[i].uri = phonyUri; - } - } - - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - var groupId = "placeholder-uri-" + mediaType + "-" + groupKey + "-" + labelKey; - - if (!properties.playlists || !properties.playlists.length) { - properties.playlists = [_extends({}, properties)]; - } - - properties.playlists.forEach(function (p, i) { - var id = createPlaylistID(i, groupId); - - if (p.uri) { - p.resolvedUri = p.resolvedUri || resolveUrl(master.uri, p.uri); - } else { - // DEPRECATED, this has been added to prevent a breaking change. - // previously we only ever had a single media group playlist, so - // we mark the first playlist uri without prepending the index as we used to - // ideally we would do all of the playlists the same way. - p.uri = i === 0 ? groupId : id; // don't resolve a placeholder uri to an absolute url, just use - // the placeholder again - - p.resolvedUri = p.uri; - } - - p.id = p.id || id; // add an empty attributes object, all playlists are - // expected to have this. - - p.attributes = p.attributes || {}; // setup ID and URI references (URI for backwards compatibility) - - master.playlists[p.id] = p; - master.playlists[p.uri] = p; - }); - }); - setupMediaPlaylists(master); - resolveMediaGroupUris(master); -}; - -var mergeOptions$2 = videojs.mergeOptions, - EventTarget$1 = videojs.EventTarget; - -var addLLHLSQueryDirectives = function addLLHLSQueryDirectives(uri, media) { - if (media.endList) { - return uri; - } - - var query = []; - - if (media.serverControl && media.serverControl.canBlockReload) { - var preloadSegment = media.preloadSegment; // next msn is a zero based value, length is not. - - var nextMSN = media.mediaSequence + media.segments.length; // If preload segment has parts then it is likely - // that we are going to request a part of that preload segment. - // the logic below is used to determine that. - - if (preloadSegment) { - var parts = preloadSegment.parts || []; // _HLS_part is a zero based index - - var nextPart = getKnownPartCount(media) - 1; // if nextPart is > -1 and not equal to just the - // length of parts, then we know we had part preload hints - // and we need to add the _HLS_part= query - - if (nextPart > -1 && nextPart !== parts.length - 1) { - // add existing parts to our preload hints - query.push("_HLS_part=" + nextPart); - } // this if statement makes sure that we request the msn - // of the preload segment if: - // 1. the preload segment had parts (and was not yet a full segment) - // but was added to our segments array - // 2. the preload segment had preload hints for parts that are not in - // the manifest yet. - // in all other cases we want the segment after the preload segment - // which will be given by using media.segments.length because it is 1 based - // rather than 0 based. - - - if (nextPart > -1 || parts.length) { - nextMSN--; - } - } // add _HLS_msn= in front of any _HLS_part query - - - query.unshift("_HLS_msn=" + nextMSN); - } - - if (media.serverControl && media.serverControl.canSkipUntil) { - // add _HLS_skip= infront of all other queries. - query.unshift('_HLS_skip=' + (media.serverControl.canSkipDateranges ? 'v2' : 'YES')); - } - - query.forEach(function (str, i) { - var symbol = i === 0 ? '?' : '&'; - uri += "" + symbol + str; - }); - return uri; -}; -/** - * Returns a new segment object with properties and - * the parts array merged. - * - * @param {Object} a the old segment - * @param {Object} b the new segment - * - * @return {Object} the merged segment - */ - - -var updateSegment = function updateSegment(a, b) { - if (!a) { - return b; - } - - var result = mergeOptions$2(a, b); // if only the old segment has preload hints - // and the new one does not, remove preload hints. - - if (a.preloadHints && !b.preloadHints) { - delete result.preloadHints; - } // if only the old segment has parts - // then the parts are no longer valid - - - if (a.parts && !b.parts) { - delete result.parts; // if both segments have parts - // copy part propeties from the old segment - // to the new one. - } else if (a.parts && b.parts) { - for (var i = 0; i < b.parts.length; i++) { - if (a.parts && a.parts[i]) { - result.parts[i] = mergeOptions$2(a.parts[i], b.parts[i]); - } - } - } // set skipped to false for segments that have - // have had information merged from the old segment. - - - if (!a.skipped && b.skipped) { - result.skipped = false; - } // set preload to false for segments that have - // had information added in the new segment. - - - if (a.preload && !b.preload) { - result.preload = false; - } - - return result; -}; -/** - * Returns a new array of segments that is the result of merging - * properties from an older list of segments onto an updated - * list. No properties on the updated playlist will be ovewritten. - * - * @param {Array} original the outdated list of segments - * @param {Array} update the updated list of segments - * @param {number=} offset the index of the first update - * segment in the original segment list. For non-live playlists, - * this should always be zero and does not need to be - * specified. For live playlists, it should be the difference - * between the media sequence numbers in the original and updated - * playlists. - * @return {Array} a list of merged segment objects - */ - -var updateSegments = function updateSegments(original, update, offset) { - var oldSegments = original.slice(); - var newSegments = update.slice(); - offset = offset || 0; - var result = []; - var currentMap; - - for (var newIndex = 0; newIndex < newSegments.length; newIndex++) { - var oldSegment = oldSegments[newIndex + offset]; - var newSegment = newSegments[newIndex]; - - if (oldSegment) { - currentMap = oldSegment.map || currentMap; - result.push(updateSegment(oldSegment, newSegment)); - } else { - // carry over map to new segment if it is missing - if (currentMap && !newSegment.map) { - newSegment.map = currentMap; - } - - result.push(newSegment); - } - } - - return result; -}; -var resolveSegmentUris = function resolveSegmentUris(segment, baseUri) { - // preloadSegment will not have a uri at all - // as the segment isn't actually in the manifest yet, only parts - if (!segment.resolvedUri && segment.uri) { - segment.resolvedUri = resolveUrl(baseUri, segment.uri); - } - - if (segment.key && !segment.key.resolvedUri) { - segment.key.resolvedUri = resolveUrl(baseUri, segment.key.uri); - } - - if (segment.map && !segment.map.resolvedUri) { - segment.map.resolvedUri = resolveUrl(baseUri, segment.map.uri); - } - - if (segment.map && segment.map.key && !segment.map.key.resolvedUri) { - segment.map.key.resolvedUri = resolveUrl(baseUri, segment.map.key.uri); - } - - if (segment.parts && segment.parts.length) { - segment.parts.forEach(function (p) { - if (p.resolvedUri) { - return; - } - - p.resolvedUri = resolveUrl(baseUri, p.uri); - }); - } - - if (segment.preloadHints && segment.preloadHints.length) { - segment.preloadHints.forEach(function (p) { - if (p.resolvedUri) { - return; - } - - p.resolvedUri = resolveUrl(baseUri, p.uri); - }); - } -}; - -var getAllSegments = function getAllSegments(media) { - var segments = media.segments || []; - var preloadSegment = media.preloadSegment; // a preloadSegment with only preloadHints is not currently - // a usable segment, only include a preloadSegment that has - // parts. - - if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) { - // if preloadHints has a MAP that means that the - // init segment is going to change. We cannot use any of the parts - // from this preload segment. - if (preloadSegment.preloadHints) { - for (var i = 0; i < preloadSegment.preloadHints.length; i++) { - if (preloadSegment.preloadHints[i].type === 'MAP') { - return segments; - } - } - } // set the duration for our preload segment to target duration. - - - preloadSegment.duration = media.targetDuration; - preloadSegment.preload = true; - segments.push(preloadSegment); - } - - return segments; -}; // consider the playlist unchanged if the playlist object is the same or -// the number of segments is equal, the media sequence number is unchanged, -// and this playlist hasn't become the end of the playlist - - -var isPlaylistUnchanged = function isPlaylistUnchanged(a, b) { - return a === b || a.segments && b.segments && a.segments.length === b.segments.length && a.endList === b.endList && a.mediaSequence === b.mediaSequence; -}; -/** - * Returns a new master playlist that is the result of merging an - * updated media playlist into the original version. If the - * updated media playlist does not match any of the playlist - * entries in the original master playlist, null is returned. - * - * @param {Object} master a parsed master M3U8 object - * @param {Object} media a parsed media M3U8 object - * @return {Object} a new object that represents the original - * master playlist with the updated media playlist merged in, or - * null if the merge produced no change. - */ - -var updateMaster$1 = function updateMaster(master, newMedia, unchangedCheck) { - if (unchangedCheck === void 0) { - unchangedCheck = isPlaylistUnchanged; - } - - var result = mergeOptions$2(master, {}); - var oldMedia = result.playlists[newMedia.id]; - - if (!oldMedia) { - return null; - } - - if (unchangedCheck(oldMedia, newMedia)) { - return null; - } - - newMedia.segments = getAllSegments(newMedia); - var mergedPlaylist = mergeOptions$2(oldMedia, newMedia); // always use the new media's preload segment - - if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) { - delete mergedPlaylist.preloadSegment; - } // if the update could overlap existing segment information, merge the two segment lists - - - if (oldMedia.segments) { - if (newMedia.skip) { - newMedia.segments = newMedia.segments || []; // add back in objects for skipped segments, so that we merge - // old properties into the new segments - - for (var i = 0; i < newMedia.skip.skippedSegments; i++) { - newMedia.segments.unshift({ - skipped: true - }); - } - } - - mergedPlaylist.segments = updateSegments(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence); - } // resolve any segment URIs to prevent us from having to do it later - - - mergedPlaylist.segments.forEach(function (segment) { - resolveSegmentUris(segment, mergedPlaylist.resolvedUri); - }); // TODO Right now in the playlists array there are two references to each playlist, one - // that is referenced by index, and one by URI. The index reference may no longer be - // necessary. - - for (var _i = 0; _i < result.playlists.length; _i++) { - if (result.playlists[_i].id === newMedia.id) { - result.playlists[_i] = mergedPlaylist; - } - } - - result.playlists[newMedia.id] = mergedPlaylist; // URI reference added for backwards compatibility - - result.playlists[newMedia.uri] = mergedPlaylist; // update media group playlist references. - - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - if (!properties.playlists) { - return; - } - - for (var _i2 = 0; _i2 < properties.playlists.length; _i2++) { - if (newMedia.id === properties.playlists[_i2].id) { - properties.playlists[_i2] = newMedia; - } - } - }); - return result; -}; -/** - * Calculates the time to wait before refreshing a live playlist - * - * @param {Object} media - * The current media - * @param {boolean} update - * True if there were any updates from the last refresh, false otherwise - * @return {number} - * The time in ms to wait before refreshing the live playlist - */ - -var refreshDelay = function refreshDelay(media, update) { - var lastSegment = media.segments[media.segments.length - 1]; - var lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1]; - var lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration; - - if (update && lastDuration) { - return lastDuration * 1000; - } // if the playlist is unchanged since the last reload or last segment duration - // cannot be determined, try again after half the target duration - - - return (media.partTargetDuration || media.targetDuration || 10) * 500; -}; -/** - * Load a playlist from a remote location - * - * @class PlaylistLoader - * @extends Stream - * @param {string|Object} src url or object of manifest - * @param {boolean} withCredentials the withCredentials xhr option - * @class - */ - -var PlaylistLoader = /*#__PURE__*/function (_EventTarget) { - _inheritsLoose(PlaylistLoader, _EventTarget); - - function PlaylistLoader(src, vhs, options) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _EventTarget.call(this) || this; - - if (!src) { - throw new Error('A non-empty playlist URL or object is required'); - } - - _this.logger_ = logger('PlaylistLoader'); - var _options = options, - _options$withCredenti = _options.withCredentials, - withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, - _options$handleManife = _options.handleManifestRedirects, - handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife; - _this.src = src; - _this.vhs_ = vhs; - _this.withCredentials = withCredentials; - _this.handleManifestRedirects = handleManifestRedirects; - var vhsOptions = vhs.options_; - _this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || []; - _this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || []; - _this.experimentalLLHLS = vhsOptions && vhsOptions.experimentalLLHLS || false; // initialize the loader state - - _this.state = 'HAVE_NOTHING'; // live playlist staleness timeout - - _this.handleMediaupdatetimeout_ = _this.handleMediaupdatetimeout_.bind(_assertThisInitialized(_this)); - - _this.on('mediaupdatetimeout', _this.handleMediaupdatetimeout_); - - return _this; - } - - var _proto = PlaylistLoader.prototype; - - _proto.handleMediaupdatetimeout_ = function handleMediaupdatetimeout_() { - var _this2 = this; - - if (this.state !== 'HAVE_METADATA') { - // only refresh the media playlist if no other activity is going on - return; - } - - var media = this.media(); - var uri = resolveUrl(this.master.uri, media.uri); - - if (this.experimentalLLHLS) { - uri = addLLHLSQueryDirectives(uri, media); - } - - this.state = 'HAVE_CURRENT_METADATA'; - this.request = this.vhs_.xhr({ - uri: uri, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this2.request) { - return; - } - - if (error) { - return _this2.playlistRequestError(_this2.request, _this2.media(), 'HAVE_METADATA'); - } - - _this2.haveMetadata({ - playlistString: _this2.request.responseText, - url: _this2.media().uri, - id: _this2.media().id - }); - }); - }; - - _proto.playlistRequestError = function playlistRequestError(xhr, playlist, startingState) { - var uri = playlist.uri, - id = playlist.id; // any in-flight request is now finished - - this.request = null; - - if (startingState) { - this.state = startingState; - } - - this.error = { - playlist: this.master.playlists[id], - status: xhr.status, - message: "HLS playlist request error at URL: " + uri + ".", - responseText: xhr.responseText, - code: xhr.status >= 500 ? 4 : 2 - }; - this.trigger('error'); - }; - - _proto.parseManifest_ = function parseManifest_(_ref) { - var _this3 = this; - - var url = _ref.url, - manifestString = _ref.manifestString; - return parseManifest({ - onwarn: function onwarn(_ref2) { - var message = _ref2.message; - return _this3.logger_("m3u8-parser warn for " + url + ": " + message); - }, - oninfo: function oninfo(_ref3) { - var message = _ref3.message; - return _this3.logger_("m3u8-parser info for " + url + ": " + message); - }, - manifestString: manifestString, - customTagParsers: this.customTagParsers, - customTagMappers: this.customTagMappers, - experimentalLLHLS: this.experimentalLLHLS - }); - } - /** - * Update the playlist loader's state in response to a new or updated playlist. - * - * @param {string} [playlistString] - * Playlist string (if playlistObject is not provided) - * @param {Object} [playlistObject] - * Playlist object (if playlistString is not provided) - * @param {string} url - * URL of playlist - * @param {string} id - * ID to use for playlist - */ - ; - - _proto.haveMetadata = function haveMetadata(_ref4) { - var _this4 = this; - - var playlistString = _ref4.playlistString, - playlistObject = _ref4.playlistObject, - url = _ref4.url, - id = _ref4.id; - // any in-flight request is now finished - this.request = null; - this.state = 'HAVE_METADATA'; - var playlist = playlistObject || this.parseManifest_({ - url: url, - manifestString: playlistString - }); - playlist.lastRequest = Date.now(); - setupMediaPlaylist({ - playlist: playlist, - uri: url, - id: id - }); // merge this playlist into the master - - var update = updateMaster$1(this.master, playlist); - this.targetDuration = playlist.partTargetDuration || playlist.targetDuration; - - if (update) { - this.master = update; - this.media_ = this.master.playlists[id]; - } else { - this.trigger('playlistunchanged'); - } // refresh live playlists after a target duration passes - - - if (!this.media().endList) { - window.clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = window.setTimeout(function () { - _this4.trigger('mediaupdatetimeout'); - }, refreshDelay(this.media(), !!update)); - } - - this.trigger('loadedplaylist'); - } - /** - * Abort any outstanding work and clean up. - */ - ; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.stopRequest(); - window.clearTimeout(this.mediaUpdateTimeout); - window.clearTimeout(this.finalRenditionTimeout); - this.off(); - }; - - _proto.stopRequest = function stopRequest() { - if (this.request) { - var oldRequest = this.request; - this.request = null; - oldRequest.onreadystatechange = null; - oldRequest.abort(); - } - } - /** - * When called without any arguments, returns the currently - * active media playlist. When called with a single argument, - * triggers the playlist loader to asynchronously switch to the - * specified media playlist. Calling this method while the - * loader is in the HAVE_NOTHING causes an error to be emitted - * but otherwise has no effect. - * - * @param {Object=} playlist the parsed media playlist - * object to switch to - * @param {boolean=} shouldDelay whether we should delay the request by half target duration - * - * @return {Playlist} the current loaded media - */ - ; - - _proto.media = function media(playlist, shouldDelay) { - var _this5 = this; - - // getter - if (!playlist) { - return this.media_; - } // setter - - - if (this.state === 'HAVE_NOTHING') { - throw new Error('Cannot switch media playlist from ' + this.state); - } // find the playlist object if the target playlist has been - // specified by URI - - - if (typeof playlist === 'string') { - if (!this.master.playlists[playlist]) { - throw new Error('Unknown playlist URI: ' + playlist); - } - - playlist = this.master.playlists[playlist]; - } - - window.clearTimeout(this.finalRenditionTimeout); - - if (shouldDelay) { - var delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1000 || 5 * 1000; - this.finalRenditionTimeout = window.setTimeout(this.media.bind(this, playlist, false), delay); - return; - } - - var startingState = this.state; - var mediaChange = !this.media_ || playlist.id !== this.media_.id; - var masterPlaylistRef = this.master.playlists[playlist.id]; // switch to fully loaded playlists immediately - - if (masterPlaylistRef && masterPlaylistRef.endList || // handle the case of a playlist object (e.g., if using vhs-json with a resolved - // media playlist or, for the case of demuxed audio, a resolved audio media group) - playlist.endList && playlist.segments.length) { - // abort outstanding playlist requests - if (this.request) { - this.request.onreadystatechange = null; - this.request.abort(); - this.request = null; - } - - this.state = 'HAVE_METADATA'; - this.media_ = playlist; // trigger media change if the active media has been updated - - if (mediaChange) { - this.trigger('mediachanging'); - - if (startingState === 'HAVE_MASTER') { - // The initial playlist was a master manifest, and the first media selected was - // also provided (in the form of a resolved playlist object) as part of the - // source object (rather than just a URL). Therefore, since the media playlist - // doesn't need to be requested, loadedmetadata won't trigger as part of the - // normal flow, and needs an explicit trigger here. - this.trigger('loadedmetadata'); - } else { - this.trigger('mediachange'); - } - } - - return; - } // switching to the active playlist is a no-op - - - if (!mediaChange) { - return; - } - - this.state = 'SWITCHING_MEDIA'; // there is already an outstanding playlist request - - if (this.request) { - if (playlist.resolvedUri === this.request.url) { - // requesting to switch to the same playlist multiple times - // has no effect after the first - return; - } - - this.request.onreadystatechange = null; - this.request.abort(); - this.request = null; - } // request the new playlist - - - if (this.media_) { - this.trigger('mediachanging'); - } - - this.request = this.vhs_.xhr({ - uri: playlist.resolvedUri, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this5.request) { - return; - } - - playlist.lastRequest = Date.now(); - playlist.resolvedUri = resolveManifestRedirect(_this5.handleManifestRedirects, playlist.resolvedUri, req); - - if (error) { - return _this5.playlistRequestError(_this5.request, playlist, startingState); - } - - _this5.haveMetadata({ - playlistString: req.responseText, - url: playlist.uri, - id: playlist.id - }); // fire loadedmetadata the first time a media playlist is loaded - - - if (startingState === 'HAVE_MASTER') { - _this5.trigger('loadedmetadata'); - } else { - _this5.trigger('mediachange'); - } - }); - } - /** - * pause loading of the playlist - */ - ; - - _proto.pause = function pause() { - this.stopRequest(); - window.clearTimeout(this.mediaUpdateTimeout); - - if (this.state === 'HAVE_NOTHING') { - // If we pause the loader before any data has been retrieved, its as if we never - // started, so reset to an unstarted state. - this.started = false; - } // Need to restore state now that no activity is happening - - - if (this.state === 'SWITCHING_MEDIA') { - // if the loader was in the process of switching media, it should either return to - // HAVE_MASTER or HAVE_METADATA depending on if the loader has loaded a media - // playlist yet. This is determined by the existence of loader.media_ - if (this.media_) { - this.state = 'HAVE_METADATA'; - } else { - this.state = 'HAVE_MASTER'; - } - } else if (this.state === 'HAVE_CURRENT_METADATA') { - this.state = 'HAVE_METADATA'; - } - } - /** - * start loading of the playlist - */ - ; - - _proto.load = function load(shouldDelay) { - var _this6 = this; - - window.clearTimeout(this.mediaUpdateTimeout); - var media = this.media(); - - if (shouldDelay) { - var delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1000 : 5 * 1000; - this.mediaUpdateTimeout = window.setTimeout(function () { - return _this6.load(); - }, delay); - return; - } - - if (!this.started) { - this.start(); - return; - } - - if (media && !media.endList) { - this.trigger('mediaupdatetimeout'); - } else { - this.trigger('loadedplaylist'); - } - } - /** - * start loading of the playlist - */ - ; - - _proto.start = function start() { - var _this7 = this; - - this.started = true; - - if (typeof this.src === 'object') { - // in the case of an entirely constructed manifest object (meaning there's no actual - // manifest on a server), default the uri to the page's href - if (!this.src.uri) { - this.src.uri = window.location.href; - } // resolvedUri is added on internally after the initial request. Since there's no - // request for pre-resolved manifests, add on resolvedUri here. - - - this.src.resolvedUri = this.src.uri; // Since a manifest object was passed in as the source (instead of a URL), the first - // request can be skipped (since the top level of the manifest, at a minimum, is - // already available as a parsed manifest object). However, if the manifest object - // represents a master playlist, some media playlists may need to be resolved before - // the starting segment list is available. Therefore, go directly to setup of the - // initial playlist, and let the normal flow continue from there. - // - // Note that the call to setup is asynchronous, as other sections of VHS may assume - // that the first request is asynchronous. - - setTimeout(function () { - _this7.setupInitialPlaylist(_this7.src); - }, 0); - return; - } // request the specified URL - - - this.request = this.vhs_.xhr({ - uri: this.src, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this7.request) { - return; - } // clear the loader's request reference - - - _this7.request = null; - - if (error) { - _this7.error = { - status: req.status, - message: "HLS playlist request error at URL: " + _this7.src + ".", - responseText: req.responseText, - // MEDIA_ERR_NETWORK - code: 2 - }; - - if (_this7.state === 'HAVE_NOTHING') { - _this7.started = false; - } - - return _this7.trigger('error'); - } - - _this7.src = resolveManifestRedirect(_this7.handleManifestRedirects, _this7.src, req); - - var manifest = _this7.parseManifest_({ - manifestString: req.responseText, - url: _this7.src - }); - - _this7.setupInitialPlaylist(manifest); - }); - }; - - _proto.srcUri = function srcUri() { - return typeof this.src === 'string' ? this.src : this.src.uri; - } - /** - * Given a manifest object that's either a master or media playlist, trigger the proper - * events and set the state of the playlist loader. - * - * If the manifest object represents a master playlist, `loadedplaylist` will be - * triggered to allow listeners to select a playlist. If none is selected, the loader - * will default to the first one in the playlists array. - * - * If the manifest object represents a media playlist, `loadedplaylist` will be - * triggered followed by `loadedmetadata`, as the only available playlist is loaded. - * - * In the case of a media playlist, a master playlist object wrapper with one playlist - * will be created so that all logic can handle playlists in the same fashion (as an - * assumed manifest object schema). - * - * @param {Object} manifest - * The parsed manifest object - */ - ; - - _proto.setupInitialPlaylist = function setupInitialPlaylist(manifest) { - this.state = 'HAVE_MASTER'; - - if (manifest.playlists) { - this.master = manifest; - addPropertiesToMaster(this.master, this.srcUri()); // If the initial master playlist has playlists wtih segments already resolved, - // then resolve URIs in advance, as they are usually done after a playlist request, - // which may not happen if the playlist is resolved. - - manifest.playlists.forEach(function (playlist) { - playlist.segments = getAllSegments(playlist); - playlist.segments.forEach(function (segment) { - resolveSegmentUris(segment, playlist.resolvedUri); - }); - }); - this.trigger('loadedplaylist'); - - if (!this.request) { - // no media playlist was specifically selected so start - // from the first listed one - this.media(this.master.playlists[0]); - } - - return; - } // In order to support media playlists passed in as vhs-json, the case where the uri - // is not provided as part of the manifest should be considered, and an appropriate - // default used. - - - var uri = this.srcUri() || window.location.href; - this.master = masterForMedia(manifest, uri); - this.haveMetadata({ - playlistObject: manifest, - url: uri, - id: this.master.playlists[0].id - }); - this.trigger('loadedmetadata'); - }; - - return PlaylistLoader; -}(EventTarget$1); - -/** - * @file xhr.js - */ -var videojsXHR = videojs.xhr, - mergeOptions$1 = videojs.mergeOptions; - -var callbackWrapper = function callbackWrapper(request, error, response, callback) { - var reqResponse = request.responseType === 'arraybuffer' ? request.response : request.responseText; - - if (!error && reqResponse) { - request.responseTime = Date.now(); - request.roundTripTime = request.responseTime - request.requestTime; - request.bytesReceived = reqResponse.byteLength || reqResponse.length; - - if (!request.bandwidth) { - request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1000); - } - } - - if (response.headers) { - request.responseHeaders = response.headers; - } // videojs.xhr now uses a specific code on the error - // object to signal that a request has timed out instead - // of setting a boolean on the request object - - - if (error && error.code === 'ETIMEDOUT') { - request.timedout = true; - } // videojs.xhr no longer considers status codes outside of 200 and 0 - // (for file uris) to be errors, but the old XHR did, so emulate that - // behavior. Status 206 may be used in response to byterange requests. - - - if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) { - error = new Error('XHR Failed with a response of: ' + (request && (reqResponse || request.responseText))); - } - - callback(error, request); -}; - -var xhrFactory = function xhrFactory() { - var xhr = function XhrFunction(options, callback) { - // Add a default timeout - options = mergeOptions$1({ - timeout: 45e3 - }, options); // Allow an optional user-specified function to modify the option - // object before we construct the xhr request - - var beforeRequest = XhrFunction.beforeRequest || videojs.Vhs.xhr.beforeRequest; - - if (beforeRequest && typeof beforeRequest === 'function') { - var newOptions = beforeRequest(options); - - if (newOptions) { - options = newOptions; - } - } // Use the standard videojs.xhr() method unless `videojs.Vhs.xhr` has been overriden - // TODO: switch back to videojs.Vhs.xhr.name === 'XhrFunction' when we drop IE11 - - - var xhrMethod = videojs.Vhs.xhr.original === true ? videojsXHR : videojs.Vhs.xhr; - var request = xhrMethod(options, function (error, response) { - return callbackWrapper(request, error, response, callback); - }); - var originalAbort = request.abort; - - request.abort = function () { - request.aborted = true; - return originalAbort.apply(request, arguments); - }; - - request.uri = options.uri; - request.requestTime = Date.now(); - return request; - }; - - xhr.original = true; - return xhr; -}; -/** - * Turns segment byterange into a string suitable for use in - * HTTP Range requests - * - * @param {Object} byterange - an object with two values defining the start and end - * of a byte-range - */ - - -var byterangeStr = function byterangeStr(byterange) { - // `byterangeEnd` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - var byterangeEnd = byterange.offset + byterange.length - 1; - var byterangeStart = byterange.offset; - return 'bytes=' + byterangeStart + '-' + byterangeEnd; -}; -/** - * Defines headers for use in the xhr request for a particular segment. - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - */ - - -var segmentXhrHeaders = function segmentXhrHeaders(segment) { - var headers = {}; - - if (segment.byterange) { - headers.Range = byterangeStr(segment.byterange); - } - - return headers; -}; - -/** - * @file bin-utils.js - */ - -/** - * convert a TimeRange to text - * - * @param {TimeRange} range the timerange to use for conversion - * @param {number} i the iterator on the range to convert - * @return {string} the range in string format - */ -var textRange = function textRange(range, i) { - return range.start(i) + '-' + range.end(i); -}; -/** - * format a number as hex string - * - * @param {number} e The number - * @param {number} i the iterator - * @return {string} the hex formatted number as a string - */ - - -var formatHexString = function formatHexString(e, i) { - var value = e.toString(16); - return '00'.substring(0, 2 - value.length) + value + (i % 2 ? ' ' : ''); -}; - -var formatAsciiString = function formatAsciiString(e) { - if (e >= 0x20 && e < 0x7e) { - return String.fromCharCode(e); - } - - return '.'; -}; -/** - * Creates an object for sending to a web worker modifying properties that are TypedArrays - * into a new object with seperated properties for the buffer, byteOffset, and byteLength. - * - * @param {Object} message - * Object of properties and values to send to the web worker - * @return {Object} - * Modified message with TypedArray values expanded - * @function createTransferableMessage - */ - - -var createTransferableMessage = function createTransferableMessage(message) { - var transferable = {}; - Object.keys(message).forEach(function (key) { - var value = message[key]; - - if (ArrayBuffer.isView(value)) { - transferable[key] = { - bytes: value.buffer, - byteOffset: value.byteOffset, - byteLength: value.byteLength - }; - } else { - transferable[key] = value; - } - }); - return transferable; -}; -/** - * Returns a unique string identifier for a media initialization - * segment. - * - * @param {Object} initSegment - * the init segment object. - * - * @return {string} the generated init segment id - */ - -var initSegmentId = function initSegmentId(initSegment) { - var byterange = initSegment.byterange || { - length: Infinity, - offset: 0 - }; - return [byterange.length, byterange.offset, initSegment.resolvedUri].join(','); -}; -/** - * Returns a unique string identifier for a media segment key. - * - * @param {Object} key the encryption key - * @return {string} the unique id for the media segment key. - */ - -var segmentKeyId = function segmentKeyId(key) { - return key.resolvedUri; -}; -/** - * utils to help dump binary data to the console - * - * @param {Array|TypedArray} data - * data to dump to a string - * - * @return {string} the data as a hex string. - */ - -var hexDump = function hexDump(data) { - var bytes = Array.prototype.slice.call(data); - var step = 16; - var result = ''; - var hex; - var ascii; - - for (var j = 0; j < bytes.length / step; j++) { - hex = bytes.slice(j * step, j * step + step).map(formatHexString).join(''); - ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join(''); - result += hex + ' ' + ascii + '\n'; - } - - return result; -}; -var tagDump = function tagDump(_ref) { - var bytes = _ref.bytes; - return hexDump(bytes); -}; -var textRanges = function textRanges(ranges) { - var result = ''; - var i; - - for (i = 0; i < ranges.length; i++) { - result += textRange(ranges, i) + ' '; - } - - return result; -}; - -var utils = /*#__PURE__*/Object.freeze({ - __proto__: null, - createTransferableMessage: createTransferableMessage, - initSegmentId: initSegmentId, - segmentKeyId: segmentKeyId, - hexDump: hexDump, - tagDump: tagDump, - textRanges: textRanges -}); - -// TODO handle fmp4 case where the timing info is accurate and doesn't involve transmux -// 25% was arbitrarily chosen, and may need to be refined over time. - -var SEGMENT_END_FUDGE_PERCENT = 0.25; -/** - * Converts a player time (any time that can be gotten/set from player.currentTime(), - * e.g., any time within player.seekable().start(0) to player.seekable().end(0)) to a - * program time (any time referencing the real world (e.g., EXT-X-PROGRAM-DATE-TIME)). - * - * The containing segment is required as the EXT-X-PROGRAM-DATE-TIME serves as an "anchor - * point" (a point where we have a mapping from program time to player time, with player - * time being the post transmux start of the segment). - * - * For more details, see [this doc](../../docs/program-time-from-player-time.md). - * - * @param {number} playerTime the player time - * @param {Object} segment the segment which contains the player time - * @return {Date} program time - */ - -var playerTimeToProgramTime = function playerTimeToProgramTime(playerTime, segment) { - if (!segment.dateTimeObject) { - // Can't convert without an "anchor point" for the program time (i.e., a time that can - // be used to map the start of a segment with a real world time). - return null; - } - - var transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds; - var transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart; // get the start of the content from before old content is prepended - - var startOfSegment = transmuxedStart + transmuxerPrependedSeconds; - var offsetFromSegmentStart = playerTime - startOfSegment; - return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1000); -}; -var originalSegmentVideoDuration = function originalSegmentVideoDuration(videoTimingInfo) { - return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds; -}; -/** - * Finds a segment that contains the time requested given as an ISO-8601 string. The - * returned segment might be an estimate or an accurate match. - * - * @param {string} programTime The ISO-8601 programTime to find a match for - * @param {Object} playlist A playlist object to search within - */ - -var findSegmentForProgramTime = function findSegmentForProgramTime(programTime, playlist) { - // Assumptions: - // - verifyProgramDateTimeTags has already been run - // - live streams have been started - var dateTimeObject; - - try { - dateTimeObject = new Date(programTime); - } catch (e) { - return null; - } - - if (!playlist || !playlist.segments || playlist.segments.length === 0) { - return null; - } - - var segment = playlist.segments[0]; - - if (dateTimeObject < segment.dateTimeObject) { - // Requested time is before stream start. - return null; - } - - for (var i = 0; i < playlist.segments.length - 1; i++) { - segment = playlist.segments[i]; - var nextSegmentStart = playlist.segments[i + 1].dateTimeObject; - - if (dateTimeObject < nextSegmentStart) { - break; - } - } - - var lastSegment = playlist.segments[playlist.segments.length - 1]; - var lastSegmentStart = lastSegment.dateTimeObject; - var lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT; - var lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1000); - - if (dateTimeObject > lastSegmentEnd) { - // Beyond the end of the stream, or our best guess of the end of the stream. - return null; - } - - if (dateTimeObject > lastSegmentStart) { - segment = lastSegment; - } - - return { - segment: segment, - estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)), - // Although, given that all segments have accurate date time objects, the segment - // selected should be accurate, unless the video has been transmuxed at some point - // (determined by the presence of the videoTimingInfo object), the segment's "player - // time" (the start time in the player) can't be considered accurate. - type: segment.videoTimingInfo ? 'accurate' : 'estimate' - }; -}; -/** - * Finds a segment that contains the given player time(in seconds). - * - * @param {number} time The player time to find a match for - * @param {Object} playlist A playlist object to search within - */ - -var findSegmentForPlayerTime = function findSegmentForPlayerTime(time, playlist) { - // Assumptions: - // - there will always be a segment.duration - // - we can start from zero - // - segments are in time order - if (!playlist || !playlist.segments || playlist.segments.length === 0) { - return null; - } - - var segmentEnd = 0; - var segment; - - for (var i = 0; i < playlist.segments.length; i++) { - segment = playlist.segments[i]; // videoTimingInfo is set after the segment is downloaded and transmuxed, and - // should contain the most accurate values we have for the segment's player times. - // - // Use the accurate transmuxedPresentationEnd value if it is available, otherwise fall - // back to an estimate based on the manifest derived (inaccurate) segment.duration, to - // calculate an end value. - - segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration; - - if (time <= segmentEnd) { - break; - } - } - - var lastSegment = playlist.segments[playlist.segments.length - 1]; - - if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) { - // The time requested is beyond the stream end. - return null; - } - - if (time > segmentEnd) { - // The time is within or beyond the last segment. - // - // Check to see if the time is beyond a reasonable guess of the end of the stream. - if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT) { - // Technically, because the duration value is only an estimate, the time may still - // exist in the last segment, however, there isn't enough information to make even - // a reasonable estimate. - return null; - } - - segment = lastSegment; - } - - return { - segment: segment, - estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration, - // Because videoTimingInfo is only set after transmux, it is the only way to get - // accurate timing values. - type: segment.videoTimingInfo ? 'accurate' : 'estimate' - }; -}; -/** - * Gives the offset of the comparisonTimestamp from the programTime timestamp in seconds. - * If the offset returned is positive, the programTime occurs after the - * comparisonTimestamp. - * If the offset is negative, the programTime occurs before the comparisonTimestamp. - * - * @param {string} comparisonTimeStamp An ISO-8601 timestamp to compare against - * @param {string} programTime The programTime as an ISO-8601 string - * @return {number} offset - */ - -var getOffsetFromTimestamp = function getOffsetFromTimestamp(comparisonTimeStamp, programTime) { - var segmentDateTime; - var programDateTime; - - try { - segmentDateTime = new Date(comparisonTimeStamp); - programDateTime = new Date(programTime); - } catch (e) {// TODO handle error - } - - var segmentTimeEpoch = segmentDateTime.getTime(); - var programTimeEpoch = programDateTime.getTime(); - return (programTimeEpoch - segmentTimeEpoch) / 1000; -}; -/** - * Checks that all segments in this playlist have programDateTime tags. - * - * @param {Object} playlist A playlist object - */ - -var verifyProgramDateTimeTags = function verifyProgramDateTimeTags(playlist) { - if (!playlist.segments || playlist.segments.length === 0) { - return false; - } - - for (var i = 0; i < playlist.segments.length; i++) { - var segment = playlist.segments[i]; - - if (!segment.dateTimeObject) { - return false; - } - } - - return true; -}; -/** - * Returns the programTime of the media given a playlist and a playerTime. - * The playlist must have programDateTime tags for a programDateTime tag to be returned. - * If the segments containing the time requested have not been buffered yet, an estimate - * may be returned to the callback. - * - * @param {Object} args - * @param {Object} args.playlist A playlist object to search within - * @param {number} time A playerTime in seconds - * @param {Function} callback(err, programTime) - * @return {string} err.message A detailed error message - * @return {Object} programTime - * @return {number} programTime.mediaSeconds The streamTime in seconds - * @return {string} programTime.programDateTime The programTime as an ISO-8601 String - */ - -var getProgramTime = function getProgramTime(_ref) { - var playlist = _ref.playlist, - _ref$time = _ref.time, - time = _ref$time === void 0 ? undefined : _ref$time, - callback = _ref.callback; - - if (!callback) { - throw new Error('getProgramTime: callback must be provided'); - } - - if (!playlist || time === undefined) { - return callback({ - message: 'getProgramTime: playlist and time must be provided' - }); - } - - var matchedSegment = findSegmentForPlayerTime(time, playlist); - - if (!matchedSegment) { - return callback({ - message: 'valid programTime was not found' - }); - } - - if (matchedSegment.type === 'estimate') { - return callback({ - message: 'Accurate programTime could not be determined.' + ' Please seek to e.seekTime and try again', - seekTime: matchedSegment.estimatedStart - }); - } - - var programTimeObject = { - mediaSeconds: time - }; - var programTime = playerTimeToProgramTime(time, matchedSegment.segment); - - if (programTime) { - programTimeObject.programDateTime = programTime.toISOString(); - } - - return callback(null, programTimeObject); -}; -/** - * Seeks in the player to a time that matches the given programTime ISO-8601 string. - * - * @param {Object} args - * @param {string} args.programTime A programTime to seek to as an ISO-8601 String - * @param {Object} args.playlist A playlist to look within - * @param {number} args.retryCount The number of times to try for an accurate seek. Default is 2. - * @param {Function} args.seekTo A method to perform a seek - * @param {boolean} args.pauseAfterSeek Whether to end in a paused state after seeking. Default is true. - * @param {Object} args.tech The tech to seek on - * @param {Function} args.callback(err, newTime) A callback to return the new time to - * @return {string} err.message A detailed error message - * @return {number} newTime The exact time that was seeked to in seconds - */ - -var seekToProgramTime = function seekToProgramTime(_ref2) { - var programTime = _ref2.programTime, - playlist = _ref2.playlist, - _ref2$retryCount = _ref2.retryCount, - retryCount = _ref2$retryCount === void 0 ? 2 : _ref2$retryCount, - seekTo = _ref2.seekTo, - _ref2$pauseAfterSeek = _ref2.pauseAfterSeek, - pauseAfterSeek = _ref2$pauseAfterSeek === void 0 ? true : _ref2$pauseAfterSeek, - tech = _ref2.tech, - callback = _ref2.callback; - - if (!callback) { - throw new Error('seekToProgramTime: callback must be provided'); - } - - if (typeof programTime === 'undefined' || !playlist || !seekTo) { - return callback({ - message: 'seekToProgramTime: programTime, seekTo and playlist must be provided' - }); - } - - if (!playlist.endList && !tech.hasStarted_) { - return callback({ - message: 'player must be playing a live stream to start buffering' - }); - } - - if (!verifyProgramDateTimeTags(playlist)) { - return callback({ - message: 'programDateTime tags must be provided in the manifest ' + playlist.resolvedUri - }); - } - - var matchedSegment = findSegmentForProgramTime(programTime, playlist); // no match - - if (!matchedSegment) { - return callback({ - message: programTime + " was not found in the stream" - }); - } - - var segment = matchedSegment.segment; - var mediaOffset = getOffsetFromTimestamp(segment.dateTimeObject, programTime); - - if (matchedSegment.type === 'estimate') { - // we've run out of retries - if (retryCount === 0) { - return callback({ - message: programTime + " is not buffered yet. Try again" - }); - } - - seekTo(matchedSegment.estimatedStart + mediaOffset); - tech.one('seeked', function () { - seekToProgramTime({ - programTime: programTime, - playlist: playlist, - retryCount: retryCount - 1, - seekTo: seekTo, - pauseAfterSeek: pauseAfterSeek, - tech: tech, - callback: callback - }); - }); - return; - } // Since the segment.start value is determined from the buffered end or ending time - // of the prior segment, the seekToTime doesn't need to account for any transmuxer - // modifications. - - - var seekToTime = segment.start + mediaOffset; - - var seekedCallback = function seekedCallback() { - return callback(null, tech.currentTime()); - }; // listen for seeked event - - - tech.one('seeked', seekedCallback); // pause before seeking as video.js will restore this state - - if (pauseAfterSeek) { - tech.pause(); - } - - seekTo(seekToTime); -}; - -// which will only happen if the request is complete. - -var callbackOnCompleted = function callbackOnCompleted(request, cb) { - if (request.readyState === 4) { - return cb(); - } - - return; -}; - -var containerRequest = function containerRequest(uri, xhr, cb) { - var bytes = []; - var id3Offset; - var finished = false; - - var endRequestAndCallback = function endRequestAndCallback(err, req, type, _bytes) { - req.abort(); - finished = true; - return cb(err, req, type, _bytes); - }; - - var progressListener = function progressListener(error, request) { - if (finished) { - return; - } - - if (error) { - return endRequestAndCallback(error, request, '', bytes); - } // grap the new part of content that was just downloaded - - - var newPart = request.responseText.substring(bytes && bytes.byteLength || 0, request.responseText.length); // add that onto bytes - - bytes = concatTypedArrays(bytes, stringToBytes(newPart, true)); - id3Offset = id3Offset || getId3Offset(bytes); // we need at least 10 bytes to determine a type - // or we need at least two bytes after an id3Offset - - if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } - - var type = detectContainerForBytes(bytes); // if this looks like a ts segment but we don't have enough data - // to see the second sync byte, wait until we have enough data - // before declaring it ts - - if (type === 'ts' && bytes.length < 188) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } // this may be an unsynced ts segment - // wait for 376 bytes before detecting no container - - - if (!type && bytes.length < 376) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } - - return endRequestAndCallback(null, request, type, bytes); - }; - - var options = { - uri: uri, - beforeSend: function beforeSend(request) { - // this forces the browser to pass the bytes to us unprocessed - request.overrideMimeType('text/plain; charset=x-user-defined'); - request.addEventListener('progress', function (_ref) { - _ref.total; - _ref.loaded; - return callbackWrapper(request, null, { - statusCode: request.status - }, progressListener); - }); - } - }; - var request = xhr(options, function (error, response) { - return callbackWrapper(request, error, response, progressListener); - }); - return request; -}; - -var EventTarget = videojs.EventTarget, - mergeOptions = videojs.mergeOptions; - -var dashPlaylistUnchanged = function dashPlaylistUnchanged(a, b) { - if (!isPlaylistUnchanged(a, b)) { - return false; - } // for dash the above check will often return true in scenarios where - // the playlist actually has changed because mediaSequence isn't a - // dash thing, and we often set it to 1. So if the playlists have the same amount - // of segments we return true. - // So for dash we need to make sure that the underlying segments are different. - // if sidx changed then the playlists are different. - - - if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) { - return false; - } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) { - return false; - } // one or the other does not have segments - // there was a change. - - - if (a.segments && !b.segments || !a.segments && b.segments) { - return false; - } // neither has segments nothing changed - - - if (!a.segments && !b.segments) { - return true; - } // check segments themselves - - - for (var i = 0; i < a.segments.length; i++) { - var aSegment = a.segments[i]; - var bSegment = b.segments[i]; // if uris are different between segments there was a change - - if (aSegment.uri !== bSegment.uri) { - return false; - } // neither segment has a byterange, there will be no byterange change. - - - if (!aSegment.byterange && !bSegment.byterange) { - continue; - } - - var aByterange = aSegment.byterange; - var bByterange = bSegment.byterange; // if byterange only exists on one of the segments, there was a change. - - if (aByterange && !bByterange || !aByterange && bByterange) { - return false; - } // if both segments have byterange with different offsets, there was a change. - - - if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) { - return false; - } - } // if everything was the same with segments, this is the same playlist. - - - return true; -}; -/** - * Parses the master XML string and updates playlist URI references. - * - * @param {Object} config - * Object of arguments - * @param {string} config.masterXml - * The mpd XML - * @param {string} config.srcUrl - * The mpd URL - * @param {Date} config.clientOffset - * A time difference between server and client - * @param {Object} config.sidxMapping - * SIDX mappings for moof/mdat URIs and byte ranges - * @return {Object} - * The parsed mpd manifest object - */ - - -var parseMasterXml = function parseMasterXml(_ref) { - var masterXml = _ref.masterXml, - srcUrl = _ref.srcUrl, - clientOffset = _ref.clientOffset, - sidxMapping = _ref.sidxMapping; - var master = parse(masterXml, { - manifestUri: srcUrl, - clientOffset: clientOffset, - sidxMapping: sidxMapping - }); - addPropertiesToMaster(master, srcUrl); - return master; -}; -/** - * Returns a new master manifest that is the result of merging an updated master manifest - * into the original version. - * - * @param {Object} oldMaster - * The old parsed mpd object - * @param {Object} newMaster - * The updated parsed mpd object - * @return {Object} - * A new object representing the original master manifest with the updated media - * playlists merged in - */ - -var updateMaster = function updateMaster(oldMaster, newMaster, sidxMapping) { - var noChanges = true; - var update = mergeOptions(oldMaster, { - // These are top level properties that can be updated - duration: newMaster.duration, - minimumUpdatePeriod: newMaster.minimumUpdatePeriod - }); // First update the playlists in playlist list - - for (var i = 0; i < newMaster.playlists.length; i++) { - var playlist = newMaster.playlists[i]; - - if (playlist.sidx) { - var sidxKey = generateSidxKey(playlist.sidx); // add sidx segments to the playlist if we have all the sidx info already - - if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) { - addSidxSegmentsToPlaylist(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri); - } - } - - var playlistUpdate = updateMaster$1(update, playlist, dashPlaylistUnchanged); - - if (playlistUpdate) { - update = playlistUpdate; - noChanges = false; - } - } // Then update media group playlists - - - forEachMediaGroup(newMaster, function (properties, type, group, label) { - if (properties.playlists && properties.playlists.length) { - var id = properties.playlists[0].id; - - var _playlistUpdate = updateMaster$1(update, properties.playlists[0], dashPlaylistUnchanged); - - if (_playlistUpdate) { - update = _playlistUpdate; // update the playlist reference within media groups - - update.mediaGroups[type][group][label].playlists[0] = update.playlists[id]; - noChanges = false; - } - } - }); - - if (newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) { - noChanges = false; - } - - if (noChanges) { - return null; - } - - return update; -}; // SIDX should be equivalent if the URI and byteranges of the SIDX match. -// If the SIDXs have maps, the two maps should match, -// both `a` and `b` missing SIDXs is considered matching. -// If `a` or `b` but not both have a map, they aren't matching. - -var equivalentSidx = function equivalentSidx(a, b) { - var neitherMap = Boolean(!a.map && !b.map); - var equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length); - return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length; -}; // exported for testing - - -var compareSidxEntry = function compareSidxEntry(playlists, oldSidxMapping) { - var newSidxMapping = {}; - - for (var id in playlists) { - var playlist = playlists[id]; - var currentSidxInfo = playlist.sidx; - - if (currentSidxInfo) { - var key = generateSidxKey(currentSidxInfo); - - if (!oldSidxMapping[key]) { - break; - } - - var savedSidxInfo = oldSidxMapping[key].sidxInfo; - - if (equivalentSidx(savedSidxInfo, currentSidxInfo)) { - newSidxMapping[key] = oldSidxMapping[key]; - } - } - } - - return newSidxMapping; -}; -/** - * A function that filters out changed items as they need to be requested separately. - * - * The method is exported for testing - * - * @param {Object} master the parsed mpd XML returned via mpd-parser - * @param {Object} oldSidxMapping the SIDX to compare against - */ - -var filterChangedSidxMappings = function filterChangedSidxMappings(master, oldSidxMapping) { - var videoSidx = compareSidxEntry(master.playlists, oldSidxMapping); - var mediaGroupSidx = videoSidx; - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - if (properties.playlists && properties.playlists.length) { - var playlists = properties.playlists; - mediaGroupSidx = mergeOptions(mediaGroupSidx, compareSidxEntry(playlists, oldSidxMapping)); - } - }); - return mediaGroupSidx; -}; - -var DashPlaylistLoader = /*#__PURE__*/function (_EventTarget) { - _inheritsLoose(DashPlaylistLoader, _EventTarget); - - // DashPlaylistLoader must accept either a src url or a playlist because subsequent - // playlist loader setups from media groups will expect to be able to pass a playlist - // (since there aren't external URLs to media playlists with DASH) - function DashPlaylistLoader(srcUrlOrPlaylist, vhs, options, masterPlaylistLoader) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _EventTarget.call(this) || this; - _this.masterPlaylistLoader_ = masterPlaylistLoader || _assertThisInitialized(_this); - - if (!masterPlaylistLoader) { - _this.isMaster_ = true; - } - - var _options = options, - _options$withCredenti = _options.withCredentials, - withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, - _options$handleManife = _options.handleManifestRedirects, - handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife; - _this.vhs_ = vhs; - _this.withCredentials = withCredentials; - _this.handleManifestRedirects = handleManifestRedirects; - - if (!srcUrlOrPlaylist) { - throw new Error('A non-empty playlist URL or object is required'); - } // event naming? - - - _this.on('minimumUpdatePeriod', function () { - _this.refreshXml_(); - }); // live playlist staleness timeout - - - _this.on('mediaupdatetimeout', function () { - _this.refreshMedia_(_this.media().id); - }); - - _this.state = 'HAVE_NOTHING'; - _this.loadedPlaylists_ = {}; - _this.logger_ = logger('DashPlaylistLoader'); // initialize the loader state - // The masterPlaylistLoader will be created with a string - - if (_this.isMaster_) { - _this.masterPlaylistLoader_.srcUrl = srcUrlOrPlaylist; // TODO: reset sidxMapping between period changes - // once multi-period is refactored - - _this.masterPlaylistLoader_.sidxMapping_ = {}; - } else { - _this.childPlaylist_ = srcUrlOrPlaylist; - } - - return _this; - } - - var _proto = DashPlaylistLoader.prototype; - - _proto.requestErrored_ = function requestErrored_(err, request, startingState) { - // disposed - if (!this.request) { - return true; - } // pending request is cleared - - - this.request = null; - - if (err) { - // use the provided error object or create one - // based on the request/response - this.error = typeof err === 'object' && !(err instanceof Error) ? err : { - status: request.status, - message: 'DASH request error at URL: ' + request.uri, - response: request.response, - // MEDIA_ERR_NETWORK - code: 2 - }; - - if (startingState) { - this.state = startingState; - } - - this.trigger('error'); - return true; - } - } - /** - * Verify that the container of the sidx segment can be parsed - * and if it can, get and parse that segment. - */ - ; - - _proto.addSidxSegments_ = function addSidxSegments_(playlist, startingState, cb) { - var _this2 = this; - - var sidxKey = playlist.sidx && generateSidxKey(playlist.sidx); // playlist lacks sidx or sidx segments were added to this playlist already. - - if (!playlist.sidx || !sidxKey || this.masterPlaylistLoader_.sidxMapping_[sidxKey]) { - // keep this function async - this.mediaRequest_ = window.setTimeout(function () { - return cb(false); - }, 0); - return; - } // resolve the segment URL relative to the playlist - - - var uri = resolveManifestRedirect(this.handleManifestRedirects, playlist.sidx.resolvedUri); - - var fin = function fin(err, request) { - if (_this2.requestErrored_(err, request, startingState)) { - return; - } - - var sidxMapping = _this2.masterPlaylistLoader_.sidxMapping_; - var sidx; - - try { - sidx = parseSidx(toUint8(request.response).subarray(8)); - } catch (e) { - // sidx parsing failed. - _this2.requestErrored_(e, request, startingState); - - return; - } - - sidxMapping[sidxKey] = { - sidxInfo: playlist.sidx, - sidx: sidx - }; - addSidxSegmentsToPlaylist(playlist, sidx, playlist.sidx.resolvedUri); - return cb(true); - }; - - this.request = containerRequest(uri, this.vhs_.xhr, function (err, request, container, bytes) { - if (err) { - return fin(err, request); - } - - if (!container || container !== 'mp4') { - return fin({ - status: request.status, - message: "Unsupported " + (container || 'unknown') + " container type for sidx segment at URL: " + uri, - // response is just bytes in this case - // but we really don't want to return that. - response: '', - playlist: playlist, - internal: true, - blacklistDuration: Infinity, - // MEDIA_ERR_NETWORK - code: 2 - }, request); - } // if we already downloaded the sidx bytes in the container request, use them - - - var _playlist$sidx$bytera = playlist.sidx.byterange, - offset = _playlist$sidx$bytera.offset, - length = _playlist$sidx$bytera.length; - - if (bytes.length >= length + offset) { - return fin(err, { - response: bytes.subarray(offset, offset + length), - status: request.status, - uri: request.uri - }); - } // otherwise request sidx bytes - - - _this2.request = _this2.vhs_.xhr({ - uri: uri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders({ - byterange: playlist.sidx.byterange - }) - }, fin); - }); - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.stopRequest(); - this.loadedPlaylists_ = {}; - window.clearTimeout(this.minimumUpdatePeriodTimeout_); - window.clearTimeout(this.mediaRequest_); - window.clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - this.mediaRequest_ = null; - this.minimumUpdatePeriodTimeout_ = null; - - if (this.masterPlaylistLoader_.createMupOnMedia_) { - this.off('loadedmetadata', this.masterPlaylistLoader_.createMupOnMedia_); - this.masterPlaylistLoader_.createMupOnMedia_ = null; - } - - this.off(); - }; - - _proto.hasPendingRequest = function hasPendingRequest() { - return this.request || this.mediaRequest_; - }; - - _proto.stopRequest = function stopRequest() { - if (this.request) { - var oldRequest = this.request; - this.request = null; - oldRequest.onreadystatechange = null; - oldRequest.abort(); - } - }; - - _proto.media = function media(playlist) { - var _this3 = this; - - // getter - if (!playlist) { - return this.media_; - } // setter - - - if (this.state === 'HAVE_NOTHING') { - throw new Error('Cannot switch media playlist from ' + this.state); - } - - var startingState = this.state; // find the playlist object if the target playlist has been specified by URI - - if (typeof playlist === 'string') { - if (!this.masterPlaylistLoader_.master.playlists[playlist]) { - throw new Error('Unknown playlist URI: ' + playlist); - } - - playlist = this.masterPlaylistLoader_.master.playlists[playlist]; - } - - var mediaChange = !this.media_ || playlist.id !== this.media_.id; // switch to previously loaded playlists immediately - - if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) { - this.state = 'HAVE_METADATA'; - this.media_ = playlist; // trigger media change if the active media has been updated - - if (mediaChange) { - this.trigger('mediachanging'); - this.trigger('mediachange'); - } - - return; - } // switching to the active playlist is a no-op - - - if (!mediaChange) { - return; - } // switching from an already loaded playlist - - - if (this.media_) { - this.trigger('mediachanging'); - } - - this.addSidxSegments_(playlist, startingState, function (sidxChanged) { - // everything is ready just continue to haveMetadata - _this3.haveMetadata({ - startingState: startingState, - playlist: playlist - }); - }); - }; - - _proto.haveMetadata = function haveMetadata(_ref2) { - var startingState = _ref2.startingState, - playlist = _ref2.playlist; - this.state = 'HAVE_METADATA'; - this.loadedPlaylists_[playlist.id] = playlist; - this.mediaRequest_ = null; // This will trigger loadedplaylist - - this.refreshMedia_(playlist.id); // fire loadedmetadata the first time a media playlist is loaded - // to resolve setup of media groups - - if (startingState === 'HAVE_MASTER') { - this.trigger('loadedmetadata'); - } else { - // trigger media change if the active media has been updated - this.trigger('mediachange'); - } - }; - - _proto.pause = function pause() { - if (this.masterPlaylistLoader_.createMupOnMedia_) { - this.off('loadedmetadata', this.masterPlaylistLoader_.createMupOnMedia_); - this.masterPlaylistLoader_.createMupOnMedia_ = null; - } - - this.stopRequest(); - window.clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - - if (this.isMaster_) { - window.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_); - this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_ = null; - } - - if (this.state === 'HAVE_NOTHING') { - // If we pause the loader before any data has been retrieved, its as if we never - // started, so reset to an unstarted state. - this.started = false; - } - }; - - _proto.load = function load(isFinalRendition) { - var _this4 = this; - - window.clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - var media = this.media(); - - if (isFinalRendition) { - var delay = media ? media.targetDuration / 2 * 1000 : 5 * 1000; - this.mediaUpdateTimeout = window.setTimeout(function () { - return _this4.load(); - }, delay); - return; - } // because the playlists are internal to the manifest, load should either load the - // main manifest, or do nothing but trigger an event - - - if (!this.started) { - this.start(); - return; - } - - if (media && !media.endList) { - // Check to see if this is the master loader and the MUP was cleared (this happens - // when the loader was paused). `media` should be set at this point since one is always - // set during `start()`. - if (this.isMaster_ && !this.minimumUpdatePeriodTimeout_) { - // Trigger minimumUpdatePeriod to refresh the master manifest - this.trigger('minimumUpdatePeriod'); // Since there was no prior minimumUpdatePeriodTimeout it should be recreated - - this.updateMinimumUpdatePeriodTimeout_(); - } - - this.trigger('mediaupdatetimeout'); - } else { - this.trigger('loadedplaylist'); - } - }; - - _proto.start = function start() { - var _this5 = this; - - this.started = true; // We don't need to request the master manifest again - // Call this asynchronously to match the xhr request behavior below - - if (!this.isMaster_) { - this.mediaRequest_ = window.setTimeout(function () { - return _this5.haveMaster_(); - }, 0); - return; - } - - this.requestMaster_(function (req, masterChanged) { - _this5.haveMaster_(); - - if (!_this5.hasPendingRequest() && !_this5.media_) { - _this5.media(_this5.masterPlaylistLoader_.master.playlists[0]); - } - }); - }; - - _proto.requestMaster_ = function requestMaster_(cb) { - var _this6 = this; - - this.request = this.vhs_.xhr({ - uri: this.masterPlaylistLoader_.srcUrl, - withCredentials: this.withCredentials - }, function (error, req) { - if (_this6.requestErrored_(error, req)) { - if (_this6.state === 'HAVE_NOTHING') { - _this6.started = false; - } - - return; - } - - var masterChanged = req.responseText !== _this6.masterPlaylistLoader_.masterXml_; - _this6.masterPlaylistLoader_.masterXml_ = req.responseText; - - if (req.responseHeaders && req.responseHeaders.date) { - _this6.masterLoaded_ = Date.parse(req.responseHeaders.date); - } else { - _this6.masterLoaded_ = Date.now(); - } - - _this6.masterPlaylistLoader_.srcUrl = resolveManifestRedirect(_this6.handleManifestRedirects, _this6.masterPlaylistLoader_.srcUrl, req); - - if (masterChanged) { - _this6.handleMaster_(); - - _this6.syncClientServerClock_(function () { - return cb(req, masterChanged); - }); - - return; - } - - return cb(req, masterChanged); - }); - } - /** - * Parses the master xml for UTCTiming node to sync the client clock to the server - * clock. If the UTCTiming node requires a HEAD or GET request, that request is made. - * - * @param {Function} done - * Function to call when clock sync has completed - */ - ; - - _proto.syncClientServerClock_ = function syncClientServerClock_(done) { - var _this7 = this; - - var utcTiming = parseUTCTiming(this.masterPlaylistLoader_.masterXml_); // No UTCTiming element found in the mpd. Use Date header from mpd request as the - // server clock - - if (utcTiming === null) { - this.masterPlaylistLoader_.clientOffset_ = this.masterLoaded_ - Date.now(); - return done(); - } - - if (utcTiming.method === 'DIRECT') { - this.masterPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now(); - return done(); - } - - this.request = this.vhs_.xhr({ - uri: resolveUrl(this.masterPlaylistLoader_.srcUrl, utcTiming.value), - method: utcTiming.method, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this7.request) { - return; - } - - if (error) { - // sync request failed, fall back to using date header from mpd - // TODO: log warning - _this7.masterPlaylistLoader_.clientOffset_ = _this7.masterLoaded_ - Date.now(); - return done(); - } - - var serverTime; - - if (utcTiming.method === 'HEAD') { - if (!req.responseHeaders || !req.responseHeaders.date) { - // expected date header not preset, fall back to using date header from mpd - // TODO: log warning - serverTime = _this7.masterLoaded_; - } else { - serverTime = Date.parse(req.responseHeaders.date); - } - } else { - serverTime = Date.parse(req.responseText); - } - - _this7.masterPlaylistLoader_.clientOffset_ = serverTime - Date.now(); - done(); - }); - }; - - _proto.haveMaster_ = function haveMaster_() { - this.state = 'HAVE_MASTER'; - - if (this.isMaster_) { - // We have the master playlist at this point, so - // trigger this to allow MasterPlaylistController - // to make an initial playlist selection - this.trigger('loadedplaylist'); - } else if (!this.media_) { - // no media playlist was specifically selected so select - // the one the child playlist loader was created with - this.media(this.childPlaylist_); - } - }; - - _proto.handleMaster_ = function handleMaster_() { - // clear media request - this.mediaRequest_ = null; - var newMaster = parseMasterXml({ - masterXml: this.masterPlaylistLoader_.masterXml_, - srcUrl: this.masterPlaylistLoader_.srcUrl, - clientOffset: this.masterPlaylistLoader_.clientOffset_, - sidxMapping: this.masterPlaylistLoader_.sidxMapping_ - }); - var oldMaster = this.masterPlaylistLoader_.master; // if we have an old master to compare the new master against - - if (oldMaster) { - newMaster = updateMaster(oldMaster, newMaster, this.masterPlaylistLoader_.sidxMapping_); - } // only update master if we have a new master - - - this.masterPlaylistLoader_.master = newMaster ? newMaster : oldMaster; - var location = this.masterPlaylistLoader_.master.locations && this.masterPlaylistLoader_.master.locations[0]; - - if (location && location !== this.masterPlaylistLoader_.srcUrl) { - this.masterPlaylistLoader_.srcUrl = location; - } - - if (!oldMaster || newMaster && newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) { - this.updateMinimumUpdatePeriodTimeout_(); - } - - return Boolean(newMaster); - }; - - _proto.updateMinimumUpdatePeriodTimeout_ = function updateMinimumUpdatePeriodTimeout_() { - var mpl = this.masterPlaylistLoader_; // cancel any pending creation of mup on media - // a new one will be added if needed. - - if (mpl.createMupOnMedia_) { - mpl.off('loadedmetadata', mpl.createMupOnMedia_); - mpl.createMupOnMedia_ = null; - } // clear any pending timeouts - - - if (mpl.minimumUpdatePeriodTimeout_) { - window.clearTimeout(mpl.minimumUpdatePeriodTimeout_); - mpl.minimumUpdatePeriodTimeout_ = null; - } - - var mup = mpl.master && mpl.master.minimumUpdatePeriod; // If the minimumUpdatePeriod has a value of 0, that indicates that the current - // MPD has no future validity, so a new one will need to be acquired when new - // media segments are to be made available. Thus, we use the target duration - // in this case - - if (mup === 0) { - if (mpl.media()) { - mup = mpl.media().targetDuration * 1000; - } else { - mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_; - mpl.one('loadedmetadata', mpl.createMupOnMedia_); - } - } // if minimumUpdatePeriod is invalid or <= zero, which - // can happen when a live video becomes VOD. skip timeout - // creation. - - - if (typeof mup !== 'number' || mup <= 0) { - if (mup < 0) { - this.logger_("found invalid minimumUpdatePeriod of " + mup + ", not setting a timeout"); - } - - return; - } - - this.createMUPTimeout_(mup); - }; - - _proto.createMUPTimeout_ = function createMUPTimeout_(mup) { - var mpl = this.masterPlaylistLoader_; - mpl.minimumUpdatePeriodTimeout_ = window.setTimeout(function () { - mpl.minimumUpdatePeriodTimeout_ = null; - mpl.trigger('minimumUpdatePeriod'); - mpl.createMUPTimeout_(mup); - }, mup); - } - /** - * Sends request to refresh the master xml and updates the parsed master manifest - */ - ; - - _proto.refreshXml_ = function refreshXml_() { - var _this8 = this; - - this.requestMaster_(function (req, masterChanged) { - if (!masterChanged) { - return; - } - - if (_this8.media_) { - _this8.media_ = _this8.masterPlaylistLoader_.master.playlists[_this8.media_.id]; - } // This will filter out updated sidx info from the mapping - - - _this8.masterPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings(_this8.masterPlaylistLoader_.master, _this8.masterPlaylistLoader_.sidxMapping_); - - _this8.addSidxSegments_(_this8.media(), _this8.state, function (sidxChanged) { - // TODO: do we need to reload the current playlist? - _this8.refreshMedia_(_this8.media().id); - }); - }); - } - /** - * Refreshes the media playlist by re-parsing the master xml and updating playlist - * references. If this is an alternate loader, the updated parsed manifest is retrieved - * from the master loader. - */ - ; - - _proto.refreshMedia_ = function refreshMedia_(mediaID) { - var _this9 = this; - - if (!mediaID) { - throw new Error('refreshMedia_ must take a media id'); - } // for master we have to reparse the master xml - // to re-create segments based on current timing values - // which may change media. We only skip updating master - // if this is the first time this.media_ is being set. - // as master was just parsed in that case. - - - if (this.media_ && this.isMaster_) { - this.handleMaster_(); - } - - var playlists = this.masterPlaylistLoader_.master.playlists; - var mediaChanged = !this.media_ || this.media_ !== playlists[mediaID]; - - if (mediaChanged) { - this.media_ = playlists[mediaID]; - } else { - this.trigger('playlistunchanged'); - } - - if (!this.mediaUpdateTimeout) { - var createMediaUpdateTimeout = function createMediaUpdateTimeout() { - if (_this9.media().endList) { - return; - } - - _this9.mediaUpdateTimeout = window.setTimeout(function () { - _this9.trigger('mediaupdatetimeout'); - - createMediaUpdateTimeout(); - }, refreshDelay(_this9.media(), Boolean(mediaChanged))); - }; - - createMediaUpdateTimeout(); - } - - this.trigger('loadedplaylist'); - }; - - return DashPlaylistLoader; -}(EventTarget); - -var Config = { - GOAL_BUFFER_LENGTH: 30, - MAX_GOAL_BUFFER_LENGTH: 60, - BACK_BUFFER_LENGTH: 30, - GOAL_BUFFER_LENGTH_RATE: 1, - // 0.5 MB/s - INITIAL_BANDWIDTH: 4194304, - // A fudge factor to apply to advertised playlist bitrates to account for - // temporary flucations in client bandwidth - BANDWIDTH_VARIANCE: 1.2, - // How much of the buffer must be filled before we consider upswitching - BUFFER_LOW_WATER_LINE: 0, - MAX_BUFFER_LOW_WATER_LINE: 30, - // TODO: Remove this when experimentalBufferBasedABR is removed - EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16, - BUFFER_LOW_WATER_LINE_RATE: 1, - // If the buffer is greater than the high water line, we won't switch down - BUFFER_HIGH_WATER_LINE: 30 -}; - -var stringToArrayBuffer = function stringToArrayBuffer(string) { - var view = new Uint8Array(new ArrayBuffer(string.length)); - - for (var i = 0; i < string.length; i++) { - view[i] = string.charCodeAt(i); - } - - return view.buffer; -}; - -/* global Blob, BlobBuilder, Worker */ -// unify worker interface -var browserWorkerPolyFill = function browserWorkerPolyFill(workerObj) { - // node only supports on/off - workerObj.on = workerObj.addEventListener; - workerObj.off = workerObj.removeEventListener; - return workerObj; -}; - -var createObjectURL = function createObjectURL(str) { - try { - return URL.createObjectURL(new Blob([str], { - type: 'application/javascript' - })); - } catch (e) { - var blob = new BlobBuilder(); - blob.append(str); - return URL.createObjectURL(blob.getBlob()); - } -}; - -var factory = function factory(code) { - return function () { - var objectUrl = createObjectURL(code); - var worker = browserWorkerPolyFill(new Worker(objectUrl)); - worker.objURL = objectUrl; - var terminate = worker.terminate; - worker.on = worker.addEventListener; - worker.off = worker.removeEventListener; - - worker.terminate = function () { - URL.revokeObjectURL(objectUrl); - return terminate.call(this); - }; - - return worker; - }; -}; -var transform = function transform(code) { - return "var browserWorkerPolyFill = " + browserWorkerPolyFill.toString() + ";\n" + 'browserWorkerPolyFill(self);\n' + code; -}; - -var getWorkerString = function getWorkerString(fn) { - return fn.toString().replace(/^function.+?{/, '').slice(0, -1); -}; - -/* rollup-plugin-worker-factory start for worker!/Users/gkatsevman/p/http-streaming-release/src/transmuxer-worker.js */ -var workerCode$1 = transform(getWorkerString(function () { - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ - - var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; - }; - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - - Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; - }; // Default stream functions that are expected to be overridden to perform - // actual work. These are provided by the prototype as a sort of no-op - // implementation so that we don't have to check for their existence in the - // `pipe` function above. - - - Stream.prototype.push = function (data) { - this.trigger('data', data); - }; - - Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); - }; - - Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); - }; - - Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); - }; - - Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); - }; - - var stream = Stream; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ - - var UINT32_MAX = Math.pow(2, 32) - 1; - var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - - (function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); - })(); - - box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; - }; - - dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); - }; - - esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); - }; - - ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); - }; - - hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); - }; - - mdat = function mdat(data) { - return box(types.mdat, data); - }; - - mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); - }; - - mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); - }; - - mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); - }; - - minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); - }; - - moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); - }; - /** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - - moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); - }; - - mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); - }; - - mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); - }; - - sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); - }; - - stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); - }; - - (function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; - })(); - - tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); - }; - /** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - - traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (UINT32_MAX + 1)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (UINT32_MAX + 1)); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun$1(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); - }; - /** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - - trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); - }; - - trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); - }; - - (function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun$1 = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; - })(); - - var mp4Generator = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - // Convert an array of nal units into an array of frames with each frame being - // composed of the nal units that make up that frame - // Also keep track of cummulative data about the frame from the nal units such - // as the frame duration, starting pts, etc. - - var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; - }; // Convert an array of frames into an array of Gop with each Gop being composed - // of the frames that make up that Gop - // Also keep track of cummulative data about the Gop from the frames such as the - // Gop duration, starting pts, etc. - - - var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; - }; - /* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - - var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; - }; - /** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - - var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; - }; - /* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - - var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; - }; // generate the track's sample table from an array of gops - - - var generateSampleTable$1 = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; - }; // generate the track's raw mdat data from an array of gops - - - var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; - }; // generate the track's sample table from a frame - - - var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; - }; // generate the track's raw mdat data from a frame - - - var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; - }; - - var frameUtils = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable$1, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var highPrefix = [33, 16, 5, 32, 164, 27]; - var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - - var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; - }; - - var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); - }; - - var silence; - - var silence_1 = function silence_1() { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]], - 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - - var ONE_SECOND_IN_TS$4 = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS$4; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS$4; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - /** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; - }; // Possibly pad (prefix) the audio track with silence if appending this track - // would lead to the introduction of a gap in the audio buffer - - - var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = silence_1()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; - }; // If the audio segment extends before the earliest allowed dts - // value, remove AAC frames until starts at or after the earliest - // allowed DTS so that we don't end up with a negative baseMedia- - // DecodeTime for the audio track - - - var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); - }; // generate the track's raw mdat data from an array of frames - - - var generateSampleTable = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; - }; // generate the track's sample table from an array of frames - - - var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; - }; - - var audioFrameUtils = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS; - /** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } - }; - /** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - - var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; - }; - /** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS$3; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; - }; - - var trackDecodeInfo = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - // payload type field to indicate how they are to be - // interpreted. CEAS-708 caption content is always transmitted with - // payload type 0x04. - - var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - /** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - - var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; - }; // see ANSI/SCTE 128-1 (2013), section 8.1 - - - var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); - }; // see CEA-708-D, section 4.4 - - - var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; - }; - - var discardEmulationPreventionBytes$1 = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; // exports - - - var captionPacketParser = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes$1, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 - }; // Link To Transport - // ----------------- - - var CaptionStream$1 = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream(); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - }; - - CaptionStream$1.prototype = new stream(); - - CaptionStream$1.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; - }; - - CaptionStream$1.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); - }; - - CaptionStream$1.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); - }; - - CaptionStream$1.prototype.flush = function () { - return this.flushStream('flush'); - }; // Only called if handling partial data - - - CaptionStream$1.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); - }; - - CaptionStream$1.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); - }; // From the CEA-608 spec: - - /* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. - */ - // With that in mind, we ignore any data between an XDS control code and a - // subsequent closed-captioning control code. - - - CaptionStream$1.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); - }; - - CaptionStream$1.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; - }; - - CaptionStream$1.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; - }; - - CaptionStream$1.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; - }; - - CaptionStream$1.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } - }; // ---------------------- - // Session to Application - // ---------------------- - // This hash maps special and extended character codes to their - // proper Unicode equivalent. The first one-byte key is just a - // non-standard character code. The two-byte keys that follow are - // the extended CEA708 character codes, along with the preceding - // 0x10 extended character byte to distinguish these codes from - // non-extended character codes. Every CEA708 character code that - // is not in this object maps directly to a standard unicode - // character code. - // The transparent space and non-breaking transparent space are - // technically not fully supported since there is no code to - // make them transparent, so they have normal non-transparent - // stand-ins. - // The special closed caption (CC) character isn't a standard - // unicode character, so a fairly similar unicode character was - // chosen in it's place. - - - var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - - }; - - var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); - }; - - var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; - }; - - var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); - }; - - Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; - }; - - Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); - }; - - Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; - }; - - Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } - }; - - Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; - }; - - Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; - }; - - Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } - }; - - var Cea708Service = function Cea708Service(serviceNum) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - }; - /** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - - Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } - }; - /** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - - Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; - }; - - var Cea708Stream = function Cea708Stream() { - Cea708Stream.prototype.init.call(this); - var self = this; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; - }; - - Cea708Stream.prototype = new stream(); - /** - * Push current 708 packet, create new 708 packet. - */ - - Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; - }; - /** - * Add pts and both bytes from packet into current 708 packet. - */ - - - Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); - }; - /** - * Parse completed 708 packet into service blocks and push each service block. - */ - - - Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } - }; - /** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - - Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else ; - } - }; - /** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, true); - } - - return i; - }; - /** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - - Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; - }; - /** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - - Cea708Stream.prototype.initService = function (serviceNum, i) { - var self = this; - this.services[serviceNum] = new Cea708Service(serviceNum); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; - }; - /** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.handleText = function (i, service, isExtended) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var extended = isExtended ? 0x1000 : 0x0000; - var char = get708CharFromCode(extended | b); - var win = service.currentWindow; - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; - }; - /** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; - }; - /** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; - }; - /** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; - }; - /** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; - }; - /** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } - }; - /** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; - }; - /** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; - }; - /** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; - }; - /** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; - }; - /** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; - }; - /** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; - }; - /** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; - }; - /** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; - }; - /** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - - Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); - }; // This hash maps non-ASCII, special, and extended character codes to their - // proper Unicode equivalent. The first keys that are only a single byte - // are the non-standard ASCII characters, which simply map the CEA608 byte - // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 - // character codes, but have their MSB bitmasked with 0x03 so that a lookup - // can be performed regardless of the field and data channel on which the - // character code was received. - - - var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - - }; - - var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); - }; // the index of the last row in a CEA-608 display buffer - - - var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of - // getting it through bit logic. - - var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character - // cells. The "bottom" row is the last element in the outer array. - - var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push(''); - } - - return result; - }; - - var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; - }; - - Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the - // display buffer - - Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - // eslint-disable-next-line no-console - console.error('Skipping malformed caption.'); - return ''; - } - }) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content, - stream: this.name_ - }); - } - }; - /** - * Zero out the data, used for startup and on seek - */ - - - Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; - }; - /** - * Sets up control code and related constants for this instance - */ - - - Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; - }; - /** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - - Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - - Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - - Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; - }; - /** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - - Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; - }; - /** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - - Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; - }; - /** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - - Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; - }; - /** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - - Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; - }; - /** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - - Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; - }; // Adds the opening HTML tag for the passed character to the caption text, - // and keeps track of it for later closing - - - Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); - }; // Adds HTML closing tags for current formatting to caption text and - // clears remembered formatting - - - Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); - }; // Mode Implementations - - - Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = ''; - }; - - Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; // exports - - - var captionStream = { - CaptionStream: CaptionStream$1, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var streamTypes = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 - }; - var MAX_TS = 8589934592; - var RO_THRESH = 4294967296; - var TYPE_SHARED = 'shared'; - - var handleRollover$1 = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; - }; - - var TimestampRolloverStream$1 = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover$1(data.dts, referenceDTS); - data.pts = handleRollover$1(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; - }; - - TimestampRolloverStream$1.prototype = new stream(); - var timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream$1, - handleRollover: handleRollover$1 - }; - - var percentEncode$1 = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode$1(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591$1 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode$1(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger$1 = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }, - tagParsers = { - TXXX: function TXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); // do not include the null terminator in the tag value - - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - - tag.data = tag.value; - }, - WXXX: function WXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function PRIV(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591$1(tag.data, 0, i); - break; - } - } - - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } - }, - _MetadataStream; - - _MetadataStream = function MetadataStream(options) { - var settings = { - debug: !!(options && options.debug), - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger$1(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger$1(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseSyncSafeInteger$1(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger$1(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; - }; - - _MetadataStream.prototype = new stream(); - var metadataStream = _MetadataStream; - var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream; // object types - - var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - - var MP2T_PACKET_LENGTH$1 = 188, - // bytes - SYNC_BYTE$1 = 0x47; - /** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - - _TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH$1, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH$1; - endIndex += MP2T_PACKET_LENGTH$1; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; - }; - - _TransportPacketStream.prototype = new stream(); - /** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - - _TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === streamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = streamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = streamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; - }; - - _TransportParseStream.prototype = new stream(); - _TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f - }; - /** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - - _ElementaryStream = function ElementaryStream() { - var self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case streamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case streamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case streamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - this.flushStreams_(); - this.trigger('done'); - }; - }; - - _ElementaryStream.prototype = new stream(); - var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, - MetadataStream: metadataStream - }; - - for (var type in streamTypes) { - if (streamTypes.hasOwnProperty(type)) { - m2ts[type] = streamTypes[type]; - } - } - - var m2ts_1 = m2ts; - var ONE_SECOND_IN_TS$2 = clock.ONE_SECOND_IN_TS; - - var _AdtsStream; - - var ADTS_SAMPLING_FREQUENCIES$1 = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - /* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - - _AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - while (i + 5 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2]; - frameEnd = i + frameLength; // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - - if (buffer.byteLength < frameEnd) { - return; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - frameNum++; // If the buffer is empty, clear it and return - - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } // Remove the finished frame from the buffer and start the process again - - - buffer = buffer.subarray(frameEnd); - } - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; - }; - - _AdtsStream.prototype = new stream(); - var adts = _AdtsStream; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ExpGolomb; - /** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - - ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); - }; - - var expGolomb = ExpGolomb; - - var _H264Stream, _NalByteStream; - - var PROFILES_WITH_OPTIONAL_SPS_DATA; - /** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - - _NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - }; - - _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS - // see Recommendation ITU-T H.264 (4/2013), - // 7.3.2.1.1 Sequence parameter set data syntax - - PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true - }; - /** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - - _H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - expGolombDecoder = new expGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - sarRatio: sarRatio - }; - }; - }; - - _H264Stream.prototype = new stream(); - var h264 = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ - - var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - - var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - - var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); - }; // TODO: use vhs-utils - - - var isLikelyAacData$1 = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; - }; - - var parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }; // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - - - var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }; // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - - - var parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }; - - var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; - }; - - var parseType$2 = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; - }; - - var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; - }; - - var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; - }; - - var utils = { - isLikelyAacData: isLikelyAacData$1, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType$2, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp - }; - - var _AacStream; - /** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - - _AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = utils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = utils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; - }; - - _AacStream.prototype = new stream(); - var aac = _AacStream; // constants - - var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; - var audioProperties = AUDIO_PROPERTIES; - var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; - var videoProperties = VIDEO_PROPERTIES; - var H264Stream = h264.H264Stream; - var isLikelyAacData = utils.isLikelyAacData; - var ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS; // object types - - var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; - /** - * Compare two arrays (even typed) for same-ness - */ - - - var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; - }; - - var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; - }; - /** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - _AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - audioProperties.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4Generator.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS$1 * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; - }; - - _AudioSegmentStream.prototype = new stream(); - /** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - _VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - videoProperties.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4Generator.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4Generator.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; - }; - - _VideoSegmentStream.prototype = new stream(); - /** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - - _CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; - }; - - _CoalesceStream.prototype = new stream(); - - _CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - videoProperties.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - audioProperties.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4Generator.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - }; - - _CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; - }; - /** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - - _Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new aac(); - pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new adts(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts_1.TransportPacketStream(); - pipeline.parseStream = new m2ts_1.TransportParseStream(); - pipeline.elementaryStream = new m2ts_1.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream(); - pipeline.adtsStream = new adts(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts_1.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; - }; - - _Transmuxer.prototype = new stream(); - var transmuxer = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: audioProperties, - VIDEO_PROPERTIES: videoProperties, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var toUnsigned$3 = function toUnsigned(value) { - return value >>> 0; - }; - - var toHexString$1 = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); - }; - - var bin = { - toUnsigned: toUnsigned$3, - toHexString: toHexString$1 - }; - - var parseType$1 = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; - }; - - var parseType_1 = parseType$1; - var toUnsigned$2 = bin.toUnsigned; - - var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType_1(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; - }; - - var findBox_1 = findBox; - var toUnsigned$1 = bin.toUnsigned; - - var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - baseMediaDecodeTime: toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime *= Math.pow(2, 32); - result.baseMediaDecodeTime += toUnsigned$1(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11]); - } - - return result; - }; - - var parseTfdt = tfdt; - - var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; - }; - - var parseSampleFlags_1 = parseSampleFlags; - - var trun = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags_1(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; - }; - - var parseTrun = trun; - - var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; - }; - - var parseTfhd = tfhd; - var discardEmulationPreventionBytes = captionPacketParser.discardEmulationPreventionBytes; - var CaptionStream = captionStream.CaptionStream; - /** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; - }; - /** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - - var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - // eslint-disable-next-line no-console - console.log("We've encountered a nal unit without data. See mux.js#233."); - break; - } - - result.push(seiNal); - break; - } - } - - return result; - }; - /** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - - var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; - }; - /** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - - var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox_1(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox_1(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox_1(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox_1(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox_1(traf, ['trun']); - var samples; - var seiNals; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - seiNals = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = []; - } - - captionNals[trackId] = captionNals[trackId].concat(seiNals); - } - }); - return captionNals; - }; - /** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption - **/ - - - var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var seiNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - seiNals = parseCaptionNals(segment, trackId); - return { - seiNals: seiNals[trackId], - timescale: timescale - }; - }; - /** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - - var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData === null || !parsedData.seiNals) { - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {} - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); - }; - - var captionParser = CaptionParser; - var toUnsigned = bin.toUnsigned; - var toHexString = bin.toHexString; - var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader; - /** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - - timescale = function timescale(init) { - var result = {}, - traks = findBox_1(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox_1(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); - }; - /** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - - startTime = function startTime(timescale, fragment) { - var trafs, baseTimes, result; // we need info from two childrend of each track fragment box - - trafs = findBox_1(fragment, ['moof', 'traf']); // determine the start times for each track - - baseTimes = [].concat.apply([], trafs.map(function (traf) { - return findBox_1(traf, ['tfhd']).map(function (tfhd) { - var id, scale, baseTime; // get the track id from the tfhd - - id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - baseTime = findBox_1(traf, ['tfdt']).map(function (tfdt) { - var version, result; - version = tfdt[0]; - result = toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]); - - if (version === 1) { - result *= Math.pow(2, 32); - result += toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11]); - } - - return result; - })[0]; - baseTime = typeof baseTime === 'number' && !isNaN(baseTime) ? baseTime : Infinity; // convert base time to seconds - - return baseTime / scale; - }); - })); // return the minimum - - result = Math.min.apply(null, baseTimes); - return isFinite(result) ? result : 0; - }; - /** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - - compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox_1(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox_1(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox_1(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox_1(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - return (baseMediaDecodeTime + compositionTimeOffset) / timescale; - }; - /** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - - getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox_1(trak, ['mdia', 'hdlr']); - var tkhds = findBox_1(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType_1(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; - }; - - getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - }; - /** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - - getTracks = function getTracks(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox_1(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox_1(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType_1(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox_1(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType_1(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox_1(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[a-z]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString(codecConfig[10]); // level idc - - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; - }; - - var probe$2 = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox_1, - parseType: parseType_1, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader - }; - - var parsePid = function parsePid(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; - }; - - var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) { - return !!(packet[1] & 0x40); - }; - - var parseAdaptionField = function parseAdaptionField(packet) { - var offset = 0; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[4] + 1; - } - - return offset; - }; - - var parseType = function parseType(packet, pmtPid) { - var pid = parsePid(packet); - - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - - return null; - }; - - var parsePat = function parsePat(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; - }; - - var parsePmt = function parsePmt(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section - - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table - - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type - - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry - // skip past the elementary stream descriptors, if present - - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - - return programMapTable; - }; - - var parsePesType = function parsePesType(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - return 'video'; - - case streamTypes.ADTS_STREAM_TYPE: - return 'audio'; - - case streamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - - default: - return null; - } - }; - - var parsePesTime = function parsePesTime(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - pes = {}; // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - - pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - - return pes; - }; - - var parseNalUnitType = function parseNalUnitType(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - - case 0x06: - return 'sei_rbsp'; - - case 0x07: - return 'seq_parameter_set_rbsp'; - - case 0x08: - return 'pic_parameter_set_rbsp'; - - case 0x09: - return 'access_unit_delimiter_rbsp'; - - default: - return null; - } - }; - - var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; // advance the sync point to a NAL start, if necessary - - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } // drop trailing zeroes - - - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; // parse the final nal - - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; - }; - - var probe$1 = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame - }; - var handleRollover = timestampRolloverStream.handleRollover; - var probe = {}; - probe.ts = probe$1; - probe.aac = utils; - var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS; - var MP2T_PACKET_LENGTH = 188, - // bytes - SYNC_BYTE = 0x47; - /** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ - - var parsePsi_ = function parsePsi_(bytes, pmt) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - - case 'pmt': - var table = probe.ts.parsePmt(packet); - pmt.table = pmt.table || {}; - Object.keys(table).forEach(function (key) { - pmt.table[key] = table[key]; - }); - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ - - - var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed; - var endLoop = false; // Start walking from start of segment to get first audio packet - - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last audio packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ - - - var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed, - frame, - i, - pes; - var endLoop = false; - var currentFrame = { - data: [], - size: 0 - }; // Start walking from start of segment to get first video packet - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn('Failed to extract PTS/DTS from PES at first keyframe. ' + 'This could be an unusual TS segment, or else mux.js did not ' + 'parse your TS segment correctly. If you know your TS ' + 'segments do contain PTS/DTS on keyframes please file a bug ' + 'report! You can try ffprobe to double check for yourself.'); - } - } - - currentFrame.size = 0; - } - } - - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last video packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ - - - var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - - segmentInfo.audio.forEach(function (info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - - segmentInfo.video.forEach(function (info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds - - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } - }; - /** - * inspects the aac data stream for start and end time information - */ - - - var inspectAac_ = function inspectAac_(bytes) { - var endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - - byteIndex += frameSize; - break; - - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - - audioCount++; - byteIndex += frameSize; - break; - - default: - byteIndex++; - break; - } - - if (endLoop) { - return null; - } - } - - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - var result = { - audio: [{ - type: 'audio', - dts: timestamp, - pts: timestamp - }, { - type: 'audio', - dts: timestamp + audioCount * 1024 * audioTimescale, - pts: timestamp + audioCount * 1024 * audioTimescale - }] - }; - return result; - }; - /** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ - - - var inspectTs_ = function inspectTs_(bytes) { - var pmt = { - pid: null, - table: null - }; - var result = {}; - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - - if (result.video.length === 0) { - delete result.video; - } - - break; - - case streamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - - if (result.audio.length === 0) { - delete result.audio; - } - - break; - } - } - } - - return result; - }; - /** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ - - - var inspect = function inspect(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || !result.audio && !result.video) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - return result; - }; - - var tsInspector = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ - }; - /* global self */ - - /** - * Re-emits transmuxer events by converting them into messages to the - * world outside the worker. - * - * @param {Object} transmuxer the transmuxer to wire events on - * @private - */ - - var wireTransmuxerEvents = function wireTransmuxerEvents(self, transmuxer) { - transmuxer.on('data', function (segment) { - // transfer ownership of the underlying ArrayBuffer - // instead of doing a copy to save memory - // ArrayBuffers are transferable but generic TypedArrays are not - // @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects) - var initArray = segment.initSegment; - segment.initSegment = { - data: initArray.buffer, - byteOffset: initArray.byteOffset, - byteLength: initArray.byteLength - }; - var typedArray = segment.data; - segment.data = typedArray.buffer; - self.postMessage({ - action: 'data', - segment: segment, - byteOffset: typedArray.byteOffset, - byteLength: typedArray.byteLength - }, [segment.data]); - }); - transmuxer.on('done', function (data) { - self.postMessage({ - action: 'done' - }); - }); - transmuxer.on('gopInfo', function (gopInfo) { - self.postMessage({ - action: 'gopInfo', - gopInfo: gopInfo - }); - }); - transmuxer.on('videoSegmentTimingInfo', function (timingInfo) { - var videoSegmentTimingInfo = { - start: { - decode: clock.videoTsToSeconds(timingInfo.start.dts), - presentation: clock.videoTsToSeconds(timingInfo.start.pts) - }, - end: { - decode: clock.videoTsToSeconds(timingInfo.end.dts), - presentation: clock.videoTsToSeconds(timingInfo.end.pts) - }, - baseMediaDecodeTime: clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime) - }; - - if (timingInfo.prependedContentDuration) { - videoSegmentTimingInfo.prependedContentDuration = clock.videoTsToSeconds(timingInfo.prependedContentDuration); - } - - self.postMessage({ - action: 'videoSegmentTimingInfo', - videoSegmentTimingInfo: videoSegmentTimingInfo - }); - }); - transmuxer.on('audioSegmentTimingInfo', function (timingInfo) { - // Note that all times for [audio/video]SegmentTimingInfo events are in video clock - var audioSegmentTimingInfo = { - start: { - decode: clock.videoTsToSeconds(timingInfo.start.dts), - presentation: clock.videoTsToSeconds(timingInfo.start.pts) - }, - end: { - decode: clock.videoTsToSeconds(timingInfo.end.dts), - presentation: clock.videoTsToSeconds(timingInfo.end.pts) - }, - baseMediaDecodeTime: clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime) - }; - - if (timingInfo.prependedContentDuration) { - audioSegmentTimingInfo.prependedContentDuration = clock.videoTsToSeconds(timingInfo.prependedContentDuration); - } - - self.postMessage({ - action: 'audioSegmentTimingInfo', - audioSegmentTimingInfo: audioSegmentTimingInfo - }); - }); - transmuxer.on('id3Frame', function (id3Frame) { - self.postMessage({ - action: 'id3Frame', - id3Frame: id3Frame - }); - }); - transmuxer.on('caption', function (caption) { - self.postMessage({ - action: 'caption', - caption: caption - }); - }); - transmuxer.on('trackinfo', function (trackInfo) { - self.postMessage({ - action: 'trackinfo', - trackInfo: trackInfo - }); - }); - transmuxer.on('audioTimingInfo', function (audioTimingInfo) { - // convert to video TS since we prioritize video time over audio - self.postMessage({ - action: 'audioTimingInfo', - audioTimingInfo: { - start: clock.videoTsToSeconds(audioTimingInfo.start), - end: clock.videoTsToSeconds(audioTimingInfo.end) - } - }); - }); - transmuxer.on('videoTimingInfo', function (videoTimingInfo) { - self.postMessage({ - action: 'videoTimingInfo', - videoTimingInfo: { - start: clock.videoTsToSeconds(videoTimingInfo.start), - end: clock.videoTsToSeconds(videoTimingInfo.end) - } - }); - }); - }; - /** - * All incoming messages route through this hash. If no function exists - * to handle an incoming message, then we ignore the message. - * - * @class MessageHandlers - * @param {Object} options the options to initialize with - */ - - - var MessageHandlers = /*#__PURE__*/function () { - function MessageHandlers(self, options) { - this.options = options || {}; - this.self = self; - this.init(); - } - /** - * initialize our web worker and wire all the events. - */ - - - var _proto = MessageHandlers.prototype; - - _proto.init = function init() { - if (this.transmuxer) { - this.transmuxer.dispose(); - } - - this.transmuxer = new transmuxer.Transmuxer(this.options); - wireTransmuxerEvents(this.self, this.transmuxer); - }; - - _proto.pushMp4Captions = function pushMp4Captions(data) { - if (!this.captionParser) { - this.captionParser = new captionParser(); - this.captionParser.init(); - } - - var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength); - var parsed = this.captionParser.parse(segment, data.trackIds, data.timescales); - this.self.postMessage({ - action: 'mp4Captions', - captions: parsed && parsed.captions || [], - data: segment.buffer - }, [segment.buffer]); - }; - - _proto.probeMp4StartTime = function probeMp4StartTime(_ref) { - var timescales = _ref.timescales, - data = _ref.data; - var startTime = probe$2.startTime(timescales, data); - this.self.postMessage({ - action: 'probeMp4StartTime', - startTime: startTime, - data: data - }, [data.buffer]); - }; - - _proto.probeMp4Tracks = function probeMp4Tracks(_ref2) { - var data = _ref2.data; - var tracks = probe$2.tracks(data); - this.self.postMessage({ - action: 'probeMp4Tracks', - tracks: tracks, - data: data - }, [data.buffer]); - } - /** - * Probe an mpeg2-ts segment to determine the start time of the segment in it's - * internal "media time," as well as whether it contains video and/or audio. - * - * @private - * @param {Uint8Array} bytes - segment bytes - * @param {number} baseStartTime - * Relative reference timestamp used when adjusting frame timestamps for rollover. - * This value should be in seconds, as it's converted to a 90khz clock within the - * function body. - * @return {Object} The start time of the current segment in "media time" as well as - * whether it contains video and/or audio - */ - ; - - _proto.probeTs = function probeTs(_ref3) { - var data = _ref3.data, - baseStartTime = _ref3.baseStartTime; - var tsStartTime = typeof baseStartTime === 'number' && !isNaN(baseStartTime) ? baseStartTime * clock.ONE_SECOND_IN_TS : void 0; - var timeInfo = tsInspector.inspect(data, tsStartTime); - var result = null; - - if (timeInfo) { - result = { - // each type's time info comes back as an array of 2 times, start and end - hasVideo: timeInfo.video && timeInfo.video.length === 2 || false, - hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false - }; - - if (result.hasVideo) { - result.videoStart = timeInfo.video[0].ptsTime; - } - - if (result.hasAudio) { - result.audioStart = timeInfo.audio[0].ptsTime; - } - } - - this.self.postMessage({ - action: 'probeTs', - result: result, - data: data - }, [data.buffer]); - }; - - _proto.clearAllMp4Captions = function clearAllMp4Captions() { - if (this.captionParser) { - this.captionParser.clearAllCaptions(); - } - }; - - _proto.clearParsedMp4Captions = function clearParsedMp4Captions() { - if (this.captionParser) { - this.captionParser.clearParsedCaptions(); - } - } - /** - * Adds data (a ts segment) to the start of the transmuxer pipeline for - * processing. - * - * @param {ArrayBuffer} data data to push into the muxer - */ - ; - - _proto.push = function push(data) { - // Cast array buffer to correct type for transmuxer - var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength); - this.transmuxer.push(segment); - } - /** - * Recreate the transmuxer so that the next segment added via `push` - * start with a fresh transmuxer. - */ - ; - - _proto.reset = function reset() { - this.transmuxer.reset(); - } - /** - * Set the value that will be used as the `baseMediaDecodeTime` time for the - * next segment pushed in. Subsequent segments will have their `baseMediaDecodeTime` - * set relative to the first based on the PTS values. - * - * @param {Object} data used to set the timestamp offset in the muxer - */ - ; - - _proto.setTimestampOffset = function setTimestampOffset(data) { - var timestampOffset = data.timestampOffset || 0; - this.transmuxer.setBaseMediaDecodeTime(Math.round(clock.secondsToVideoTs(timestampOffset))); - }; - - _proto.setAudioAppendStart = function setAudioAppendStart(data) { - this.transmuxer.setAudioAppendStart(Math.ceil(clock.secondsToVideoTs(data.appendStart))); - }; - - _proto.setRemux = function setRemux(data) { - this.transmuxer.setRemux(data.remux); - } - /** - * Forces the pipeline to finish processing the last segment and emit it's - * results. - * - * @param {Object} data event data, not really used - */ - ; - - _proto.flush = function flush(data) { - this.transmuxer.flush(); // transmuxed done action is fired after both audio/video pipelines are flushed - - self.postMessage({ - action: 'done', - type: 'transmuxed' - }); - }; - - _proto.endTimeline = function endTimeline() { - this.transmuxer.endTimeline(); // transmuxed endedtimeline action is fired after both audio/video pipelines end their - // timelines - - self.postMessage({ - action: 'endedtimeline', - type: 'transmuxed' - }); - }; - - _proto.alignGopsWith = function alignGopsWith(data) { - this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice()); - }; - - return MessageHandlers; - }(); - /** - * Our web worker interface so that things can talk to mux.js - * that will be running in a web worker. the scope is passed to this by - * webworkify. - * - * @param {Object} self the scope for the web worker - */ - - - self.onmessage = function (event) { - if (event.data.action === 'init' && event.data.options) { - this.messageHandlers = new MessageHandlers(self, event.data.options); - return; - } - - if (!this.messageHandlers) { - this.messageHandlers = new MessageHandlers(self); - } - - if (event.data && event.data.action && event.data.action !== 'init') { - if (this.messageHandlers[event.data.action]) { - this.messageHandlers[event.data.action](event.data); - } - } - }; -})); -var TransmuxWorker = factory(workerCode$1); -/* rollup-plugin-worker-factory end for worker!/Users/gkatsevman/p/http-streaming-release/src/transmuxer-worker.js */ - -var handleData_ = function handleData_(event, transmuxedData, callback) { - var _event$data$segment = event.data.segment, - type = _event$data$segment.type, - initSegment = _event$data$segment.initSegment, - captions = _event$data$segment.captions, - captionStreams = _event$data$segment.captionStreams, - metadata = _event$data$segment.metadata, - videoFrameDtsTime = _event$data$segment.videoFrameDtsTime, - videoFramePtsTime = _event$data$segment.videoFramePtsTime; - transmuxedData.buffer.push({ - captions: captions, - captionStreams: captionStreams, - metadata: metadata - }); - var boxes = event.data.segment.boxes || { - data: event.data.segment.data - }; - var result = { - type: type, - // cast ArrayBuffer to TypedArray - data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength), - initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength) - }; - - if (typeof videoFrameDtsTime !== 'undefined') { - result.videoFrameDtsTime = videoFrameDtsTime; - } - - if (typeof videoFramePtsTime !== 'undefined') { - result.videoFramePtsTime = videoFramePtsTime; - } - - callback(result); -}; -var handleDone_ = function handleDone_(_ref) { - var transmuxedData = _ref.transmuxedData, - callback = _ref.callback; - // Previously we only returned data on data events, - // not on done events. Clear out the buffer to keep that consistent. - transmuxedData.buffer = []; // all buffers should have been flushed from the muxer, so start processing anything we - // have received - - callback(transmuxedData); -}; -var handleGopInfo_ = function handleGopInfo_(event, transmuxedData) { - transmuxedData.gopInfo = event.data.gopInfo; -}; -var processTransmux = function processTransmux(options) { - var transmuxer = options.transmuxer, - bytes = options.bytes, - audioAppendStart = options.audioAppendStart, - gopsToAlignWith = options.gopsToAlignWith, - remux = options.remux, - onData = options.onData, - onTrackInfo = options.onTrackInfo, - onAudioTimingInfo = options.onAudioTimingInfo, - onVideoTimingInfo = options.onVideoTimingInfo, - onVideoSegmentTimingInfo = options.onVideoSegmentTimingInfo, - onAudioSegmentTimingInfo = options.onAudioSegmentTimingInfo, - onId3 = options.onId3, - onCaptions = options.onCaptions, - onDone = options.onDone, - onEndedTimeline = options.onEndedTimeline, - isEndOfTimeline = options.isEndOfTimeline; - var transmuxedData = { - buffer: [] - }; - var waitForEndedTimelineEvent = isEndOfTimeline; - - var handleMessage = function handleMessage(event) { - if (transmuxer.currentTransmux !== options) { - // disposed - return; - } - - if (event.data.action === 'data') { - handleData_(event, transmuxedData, onData); - } - - if (event.data.action === 'trackinfo') { - onTrackInfo(event.data.trackInfo); - } - - if (event.data.action === 'gopInfo') { - handleGopInfo_(event, transmuxedData); - } - - if (event.data.action === 'audioTimingInfo') { - onAudioTimingInfo(event.data.audioTimingInfo); - } - - if (event.data.action === 'videoTimingInfo') { - onVideoTimingInfo(event.data.videoTimingInfo); - } - - if (event.data.action === 'videoSegmentTimingInfo') { - onVideoSegmentTimingInfo(event.data.videoSegmentTimingInfo); - } - - if (event.data.action === 'audioSegmentTimingInfo') { - onAudioSegmentTimingInfo(event.data.audioSegmentTimingInfo); - } - - if (event.data.action === 'id3Frame') { - onId3([event.data.id3Frame], event.data.id3Frame.dispatchType); - } - - if (event.data.action === 'caption') { - onCaptions(event.data.caption); - } - - if (event.data.action === 'endedtimeline') { - waitForEndedTimelineEvent = false; - onEndedTimeline(); - } // wait for the transmuxed event since we may have audio and video - - - if (event.data.type !== 'transmuxed') { - return; - } // If the "endedtimeline" event has not yet fired, and this segment represents the end - // of a timeline, that means there may still be data events before the segment - // processing can be considerred complete. In that case, the final event should be - // an "endedtimeline" event with the type "transmuxed." - - - if (waitForEndedTimelineEvent) { - return; - } - - transmuxer.onmessage = null; - handleDone_({ - transmuxedData: transmuxedData, - callback: onDone - }); - /* eslint-disable no-use-before-define */ - - dequeue(transmuxer); - /* eslint-enable */ - }; - - transmuxer.onmessage = handleMessage; - - if (audioAppendStart) { - transmuxer.postMessage({ - action: 'setAudioAppendStart', - appendStart: audioAppendStart - }); - } // allow empty arrays to be passed to clear out GOPs - - - if (Array.isArray(gopsToAlignWith)) { - transmuxer.postMessage({ - action: 'alignGopsWith', - gopsToAlignWith: gopsToAlignWith - }); - } - - if (typeof remux !== 'undefined') { - transmuxer.postMessage({ - action: 'setRemux', - remux: remux - }); - } - - if (bytes.byteLength) { - var buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer; - var byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset; - transmuxer.postMessage({ - action: 'push', - // Send the typed-array of data as an ArrayBuffer so that - // it can be sent as a "Transferable" and avoid the costly - // memory copy - data: buffer, - // To recreate the original typed-array, we need information - // about what portion of the ArrayBuffer it was a view into - byteOffset: byteOffset, - byteLength: bytes.byteLength - }, [buffer]); - } - - if (isEndOfTimeline) { - transmuxer.postMessage({ - action: 'endTimeline' - }); - } // even if we didn't push any bytes, we have to make sure we flush in case we reached - // the end of the segment - - - transmuxer.postMessage({ - action: 'flush' - }); -}; -var dequeue = function dequeue(transmuxer) { - transmuxer.currentTransmux = null; - - if (transmuxer.transmuxQueue.length) { - transmuxer.currentTransmux = transmuxer.transmuxQueue.shift(); - - if (typeof transmuxer.currentTransmux === 'function') { - transmuxer.currentTransmux(); - } else { - processTransmux(transmuxer.currentTransmux); - } - } -}; -var processAction = function processAction(transmuxer, action) { - transmuxer.postMessage({ - action: action - }); - dequeue(transmuxer); -}; -var enqueueAction = function enqueueAction(action, transmuxer) { - if (!transmuxer.currentTransmux) { - transmuxer.currentTransmux = action; - processAction(transmuxer, action); - return; - } - - transmuxer.transmuxQueue.push(processAction.bind(null, transmuxer, action)); -}; -var reset = function reset(transmuxer) { - enqueueAction('reset', transmuxer); -}; -var endTimeline = function endTimeline(transmuxer) { - enqueueAction('endTimeline', transmuxer); -}; -var transmux = function transmux(options) { - if (!options.transmuxer.currentTransmux) { - options.transmuxer.currentTransmux = options; - processTransmux(options); - return; - } - - options.transmuxer.transmuxQueue.push(options); -}; -var createTransmuxer = function createTransmuxer(options) { - var transmuxer = new TransmuxWorker(); - transmuxer.currentTransmux = null; - transmuxer.transmuxQueue = []; - var term = transmuxer.terminate; - - transmuxer.terminate = function () { - transmuxer.currentTransmux = null; - transmuxer.transmuxQueue.length = 0; - return term.call(transmuxer); - }; - - transmuxer.postMessage({ - action: 'init', - options: options - }); - return transmuxer; -}; -var segmentTransmuxer = { - reset: reset, - endTimeline: endTimeline, - transmux: transmux, - createTransmuxer: createTransmuxer -}; - -var workerCallback = function workerCallback(options) { - var transmuxer = options.transmuxer; - var endAction = options.endAction || options.action; - var callback = options.callback; - - var message = _extends({}, options, { - endAction: null, - transmuxer: null, - callback: null - }); - - var listenForEndEvent = function listenForEndEvent(event) { - if (event.data.action !== endAction) { - return; - } - - transmuxer.removeEventListener('message', listenForEndEvent); // transfer ownership of bytes back to us. - - if (event.data.data) { - event.data.data = new Uint8Array(event.data.data, options.byteOffset || 0, options.byteLength || event.data.data.byteLength); - - if (options.data) { - options.data = event.data.data; - } - } - - callback(event.data); - }; - - transmuxer.addEventListener('message', listenForEndEvent); - - if (options.data) { - var isArrayBuffer = options.data instanceof ArrayBuffer; - message.byteOffset = isArrayBuffer ? 0 : options.data.byteOffset; - message.byteLength = options.data.byteLength; - var transfers = [isArrayBuffer ? options.data : options.data.buffer]; - transmuxer.postMessage(message, transfers); - } else { - transmuxer.postMessage(message); - } -}; - -var REQUEST_ERRORS = { - FAILURE: 2, - TIMEOUT: -101, - ABORTED: -102 -}; -/** - * Abort all requests - * - * @param {Object} activeXhrs - an object that tracks all XHR requests - */ - -var abortAll = function abortAll(activeXhrs) { - activeXhrs.forEach(function (xhr) { - xhr.abort(); - }); -}; -/** - * Gather important bandwidth stats once a request has completed - * - * @param {Object} request - the XHR request from which to gather stats - */ - - -var getRequestStats = function getRequestStats(request) { - return { - bandwidth: request.bandwidth, - bytesReceived: request.bytesReceived || 0, - roundTripTime: request.roundTripTime || 0 - }; -}; -/** - * If possible gather bandwidth stats as a request is in - * progress - * - * @param {Event} progressEvent - an event object from an XHR's progress event - */ - - -var getProgressStats = function getProgressStats(progressEvent) { - var request = progressEvent.target; - var roundTripTime = Date.now() - request.requestTime; - var stats = { - bandwidth: Infinity, - bytesReceived: 0, - roundTripTime: roundTripTime || 0 - }; - stats.bytesReceived = progressEvent.loaded; // This can result in Infinity if stats.roundTripTime is 0 but that is ok - // because we should only use bandwidth stats on progress to determine when - // abort a request early due to insufficient bandwidth - - stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1000); - return stats; -}; -/** - * Handle all error conditions in one place and return an object - * with all the information - * - * @param {Error|null} error - if non-null signals an error occured with the XHR - * @param {Object} request - the XHR request that possibly generated the error - */ - - -var handleErrors = function handleErrors(error, request) { - if (request.timedout) { - return { - status: request.status, - message: 'HLS request timed-out at URL: ' + request.uri, - code: REQUEST_ERRORS.TIMEOUT, - xhr: request - }; - } - - if (request.aborted) { - return { - status: request.status, - message: 'HLS request aborted at URL: ' + request.uri, - code: REQUEST_ERRORS.ABORTED, - xhr: request - }; - } - - if (error) { - return { - status: request.status, - message: 'HLS request errored at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }; - } - - if (request.responseType === 'arraybuffer' && request.response.byteLength === 0) { - return { - status: request.status, - message: 'Empty HLS response at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }; - } - - return null; -}; -/** - * Handle responses for key data and convert the key data to the correct format - * for the decryption step later - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Array} objects - objects to add the key bytes to. - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - -var handleKeyResponse = function handleKeyResponse(segment, objects, finishProcessingFn) { - return function (error, request) { - var response = request.response; - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - if (response.byteLength !== 16) { - return finishProcessingFn({ - status: request.status, - message: 'Invalid HLS key at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }, segment); - } - - var view = new DataView(response); - var bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]); - - for (var i = 0; i < objects.length; i++) { - objects[i].bytes = bytes; - } - - return finishProcessingFn(null, segment); - }; -}; - -var parseInitSegment = function parseInitSegment(segment, _callback) { - var type = detectContainerForBytes(segment.map.bytes); // TODO: We should also handle ts init segments here, but we - // only know how to parse mp4 init segments at the moment - - if (type !== 'mp4') { - var uri = segment.map.resolvedUri || segment.map.uri; - return _callback({ - internal: true, - message: "Found unsupported " + (type || 'unknown') + " container for initialization segment at URL: " + uri, - code: REQUEST_ERRORS.FAILURE - }); - } - - workerCallback({ - action: 'probeMp4Tracks', - data: segment.map.bytes, - transmuxer: segment.transmuxer, - callback: function callback(_ref) { - var tracks = _ref.tracks, - data = _ref.data; - // transfer bytes back to us - segment.map.bytes = data; - tracks.forEach(function (track) { - segment.map.tracks = segment.map.tracks || {}; // only support one track of each type for now - - if (segment.map.tracks[track.type]) { - return; - } - - segment.map.tracks[track.type] = track; - - if (typeof track.id === 'number' && track.timescale) { - segment.map.timescales = segment.map.timescales || {}; - segment.map.timescales[track.id] = track.timescale; - } - }); - return _callback(null); - } - }); -}; -/** - * Handle init-segment responses - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - -var handleInitSegmentResponse = function handleInitSegmentResponse(_ref2) { - var segment = _ref2.segment, - finishProcessingFn = _ref2.finishProcessingFn; - return function (error, request) { - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - var bytes = new Uint8Array(request.response); // init segment is encypted, we will have to wait - // until the key request is done to decrypt. - - if (segment.map.key) { - segment.map.encryptedBytes = bytes; - return finishProcessingFn(null, segment); - } - - segment.map.bytes = bytes; - parseInitSegment(segment, function (parseError) { - if (parseError) { - parseError.xhr = request; - parseError.status = request.status; - return finishProcessingFn(parseError, segment); - } - - finishProcessingFn(null, segment); - }); - }; -}; -/** - * Response handler for segment-requests being sure to set the correct - * property depending on whether the segment is encryped or not - * Also records and keeps track of stats that are used for ABR purposes - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - -var handleSegmentResponse = function handleSegmentResponse(_ref3) { - var segment = _ref3.segment, - finishProcessingFn = _ref3.finishProcessingFn, - responseType = _ref3.responseType; - return function (error, request) { - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - var newBytes = // although responseText "should" exist, this guard serves to prevent an error being - // thrown for two primary cases: - // 1. the mime type override stops working, or is not implemented for a specific - // browser - // 2. when using mock XHR libraries like sinon that do not allow the override behavior - responseType === 'arraybuffer' || !request.responseText ? request.response : stringToArrayBuffer(request.responseText.substring(segment.lastReachedChar || 0)); - segment.stats = getRequestStats(request); - - if (segment.key) { - segment.encryptedBytes = new Uint8Array(newBytes); - } else { - segment.bytes = new Uint8Array(newBytes); - } - - return finishProcessingFn(null, segment); - }; -}; - -var transmuxAndNotify = function transmuxAndNotify(_ref4) { - var segment = _ref4.segment, - bytes = _ref4.bytes, - trackInfoFn = _ref4.trackInfoFn, - timingInfoFn = _ref4.timingInfoFn, - videoSegmentTimingInfoFn = _ref4.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref4.audioSegmentTimingInfoFn, - id3Fn = _ref4.id3Fn, - captionsFn = _ref4.captionsFn, - isEndOfTimeline = _ref4.isEndOfTimeline, - endedTimelineFn = _ref4.endedTimelineFn, - dataFn = _ref4.dataFn, - doneFn = _ref4.doneFn; - var fmp4Tracks = segment.map && segment.map.tracks || {}; - var isMuxed = Boolean(fmp4Tracks.audio && fmp4Tracks.video); // Keep references to each function so we can null them out after we're done with them. - // One reason for this is that in the case of full segments, we want to trust start - // times from the probe, rather than the transmuxer. - - var audioStartFn = timingInfoFn.bind(null, segment, 'audio', 'start'); - var audioEndFn = timingInfoFn.bind(null, segment, 'audio', 'end'); - var videoStartFn = timingInfoFn.bind(null, segment, 'video', 'start'); - var videoEndFn = timingInfoFn.bind(null, segment, 'video', 'end'); - - var finish = function finish() { - return transmux({ - bytes: bytes, - transmuxer: segment.transmuxer, - audioAppendStart: segment.audioAppendStart, - gopsToAlignWith: segment.gopsToAlignWith, - remux: isMuxed, - onData: function onData(result) { - result.type = result.type === 'combined' ? 'video' : result.type; - dataFn(segment, result); - }, - onTrackInfo: function onTrackInfo(trackInfo) { - if (trackInfoFn) { - if (isMuxed) { - trackInfo.isMuxed = true; - } - - trackInfoFn(segment, trackInfo); - } - }, - onAudioTimingInfo: function onAudioTimingInfo(audioTimingInfo) { - // we only want the first start value we encounter - if (audioStartFn && typeof audioTimingInfo.start !== 'undefined') { - audioStartFn(audioTimingInfo.start); - audioStartFn = null; - } // we want to continually update the end time - - - if (audioEndFn && typeof audioTimingInfo.end !== 'undefined') { - audioEndFn(audioTimingInfo.end); - } - }, - onVideoTimingInfo: function onVideoTimingInfo(videoTimingInfo) { - // we only want the first start value we encounter - if (videoStartFn && typeof videoTimingInfo.start !== 'undefined') { - videoStartFn(videoTimingInfo.start); - videoStartFn = null; - } // we want to continually update the end time - - - if (videoEndFn && typeof videoTimingInfo.end !== 'undefined') { - videoEndFn(videoTimingInfo.end); - } - }, - onVideoSegmentTimingInfo: function onVideoSegmentTimingInfo(videoSegmentTimingInfo) { - videoSegmentTimingInfoFn(videoSegmentTimingInfo); - }, - onAudioSegmentTimingInfo: function onAudioSegmentTimingInfo(audioSegmentTimingInfo) { - audioSegmentTimingInfoFn(audioSegmentTimingInfo); - }, - onId3: function onId3(id3Frames, dispatchType) { - id3Fn(segment, id3Frames, dispatchType); - }, - onCaptions: function onCaptions(captions) { - captionsFn(segment, [captions]); - }, - isEndOfTimeline: isEndOfTimeline, - onEndedTimeline: function onEndedTimeline() { - endedTimelineFn(); - }, - onDone: function onDone(result) { - if (!doneFn) { - return; - } - - result.type = result.type === 'combined' ? 'video' : result.type; - doneFn(null, segment, result); - } - }); - }; // In the transmuxer, we don't yet have the ability to extract a "proper" start time. - // Meaning cached frame data may corrupt our notion of where this segment - // really starts. To get around this, probe for the info needed. - - - workerCallback({ - action: 'probeTs', - transmuxer: segment.transmuxer, - data: bytes, - baseStartTime: segment.baseStartTime, - callback: function callback(data) { - segment.bytes = bytes = data.data; - var probeResult = data.result; - - if (probeResult) { - trackInfoFn(segment, { - hasAudio: probeResult.hasAudio, - hasVideo: probeResult.hasVideo, - isMuxed: isMuxed - }); - trackInfoFn = null; - - if (probeResult.hasAudio && !isMuxed) { - audioStartFn(probeResult.audioStart); - } - - if (probeResult.hasVideo) { - videoStartFn(probeResult.videoStart); - } - - audioStartFn = null; - videoStartFn = null; - } - - finish(); - } - }); -}; - -var handleSegmentBytes = function handleSegmentBytes(_ref5) { - var segment = _ref5.segment, - bytes = _ref5.bytes, - trackInfoFn = _ref5.trackInfoFn, - timingInfoFn = _ref5.timingInfoFn, - videoSegmentTimingInfoFn = _ref5.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref5.audioSegmentTimingInfoFn, - id3Fn = _ref5.id3Fn, - captionsFn = _ref5.captionsFn, - isEndOfTimeline = _ref5.isEndOfTimeline, - endedTimelineFn = _ref5.endedTimelineFn, - dataFn = _ref5.dataFn, - doneFn = _ref5.doneFn; - var bytesAsUint8Array = new Uint8Array(bytes); // TODO: - // We should have a handler that fetches the number of bytes required - // to check if something is fmp4. This will allow us to save bandwidth - // because we can only blacklist a playlist and abort requests - // by codec after trackinfo triggers. - - if (isLikelyFmp4MediaSegment(bytesAsUint8Array)) { - segment.isFmp4 = true; - var tracks = segment.map.tracks; - var trackInfo = { - isFmp4: true, - hasVideo: !!tracks.video, - hasAudio: !!tracks.audio - }; // if we have a audio track, with a codec that is not set to - // encrypted audio - - if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== 'enca') { - trackInfo.audioCodec = tracks.audio.codec; - } // if we have a video track, with a codec that is not set to - // encrypted video - - - if (tracks.video && tracks.video.codec && tracks.video.codec !== 'encv') { - trackInfo.videoCodec = tracks.video.codec; - } - - if (tracks.video && tracks.audio) { - trackInfo.isMuxed = true; - } // since we don't support appending fmp4 data on progress, we know we have the full - // segment here - - - trackInfoFn(segment, trackInfo); // The probe doesn't provide the segment end time, so only callback with the start - // time. The end time can be roughly calculated by the receiver using the duration. - // - // Note that the start time returned by the probe reflects the baseMediaDecodeTime, as - // that is the true start of the segment (where the playback engine should begin - // decoding). - - var finishLoading = function finishLoading(captions) { - // if the track still has audio at this point it is only possible - // for it to be audio only. See `tracks.video && tracks.audio` if statement - // above. - // we make sure to use segment.bytes here as that - dataFn(segment, { - data: bytesAsUint8Array, - type: trackInfo.hasAudio && !trackInfo.isMuxed ? 'audio' : 'video' - }); - - if (captions && captions.length) { - captionsFn(segment, captions); - } - - doneFn(null, segment, {}); - }; - - workerCallback({ - action: 'probeMp4StartTime', - timescales: segment.map.timescales, - data: bytesAsUint8Array, - transmuxer: segment.transmuxer, - callback: function callback(_ref6) { - var data = _ref6.data, - startTime = _ref6.startTime; - // transfer bytes back to us - bytes = data.buffer; - segment.bytes = bytesAsUint8Array = data; - - if (trackInfo.hasAudio && !trackInfo.isMuxed) { - timingInfoFn(segment, 'audio', 'start', startTime); - } - - if (trackInfo.hasVideo) { - timingInfoFn(segment, 'video', 'start', startTime); - } // Run through the CaptionParser in case there are captions. - // Initialize CaptionParser if it hasn't been yet - - - if (!tracks.video || !data.byteLength || !segment.transmuxer) { - finishLoading(); - return; - } - - workerCallback({ - action: 'pushMp4Captions', - endAction: 'mp4Captions', - transmuxer: segment.transmuxer, - data: bytesAsUint8Array, - timescales: segment.map.timescales, - trackIds: [tracks.video.id], - callback: function callback(message) { - // transfer bytes back to us - bytes = message.data.buffer; - segment.bytes = bytesAsUint8Array = message.data; - finishLoading(message.captions); - } - }); - } - }); - return; - } // VTT or other segments that don't need processing - - - if (!segment.transmuxer) { - doneFn(null, segment, {}); - return; - } - - if (typeof segment.container === 'undefined') { - segment.container = detectContainerForBytes(bytesAsUint8Array); - } - - if (segment.container !== 'ts' && segment.container !== 'aac') { - trackInfoFn(segment, { - hasAudio: false, - hasVideo: false - }); - doneFn(null, segment, {}); - return; - } // ts or aac - - - transmuxAndNotify({ - segment: segment, - bytes: bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); -}; - -var decrypt = function decrypt(_ref7, callback) { - var id = _ref7.id, - key = _ref7.key, - encryptedBytes = _ref7.encryptedBytes, - decryptionWorker = _ref7.decryptionWorker; - - var decryptionHandler = function decryptionHandler(event) { - if (event.data.source === id) { - decryptionWorker.removeEventListener('message', decryptionHandler); - var decrypted = event.data.decrypted; - callback(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength)); - } - }; - - decryptionWorker.addEventListener('message', decryptionHandler); - var keyBytes; - - if (key.bytes.slice) { - keyBytes = key.bytes.slice(); - } else { - keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes)); - } // incrementally decrypt the bytes - - - decryptionWorker.postMessage(createTransferableMessage({ - source: id, - encrypted: encryptedBytes, - key: keyBytes, - iv: key.iv - }), [encryptedBytes.buffer, keyBytes.buffer]); -}; -/** - * Decrypt the segment via the decryption web worker - * - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption - * routines - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Function} doneFn - a callback that is executed after decryption has completed - */ - - -var decryptSegment = function decryptSegment(_ref8) { - var decryptionWorker = _ref8.decryptionWorker, - segment = _ref8.segment, - trackInfoFn = _ref8.trackInfoFn, - timingInfoFn = _ref8.timingInfoFn, - videoSegmentTimingInfoFn = _ref8.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref8.audioSegmentTimingInfoFn, - id3Fn = _ref8.id3Fn, - captionsFn = _ref8.captionsFn, - isEndOfTimeline = _ref8.isEndOfTimeline, - endedTimelineFn = _ref8.endedTimelineFn, - dataFn = _ref8.dataFn, - doneFn = _ref8.doneFn; - decrypt({ - id: segment.requestId, - key: segment.key, - encryptedBytes: segment.encryptedBytes, - decryptionWorker: decryptionWorker - }, function (decryptedBytes) { - segment.bytes = decryptedBytes; - handleSegmentBytes({ - segment: segment, - bytes: segment.bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - }); -}; -/** - * This function waits for all XHRs to finish (with either success or failure) - * before continueing processing via it's callback. The function gathers errors - * from each request into a single errors array so that the error status for - * each request can be examined later. - * - * @param {Object} activeXhrs - an object that tracks all XHR requests - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption - * routines - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} id3Fn - a callback that receives ID3 metadata - * @param {Function} captionsFn - a callback that receives captions - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Function} doneFn - a callback that is executed after all resources have been - * downloaded and any decryption completed - */ - - -var waitForCompletion = function waitForCompletion(_ref9) { - var activeXhrs = _ref9.activeXhrs, - decryptionWorker = _ref9.decryptionWorker, - trackInfoFn = _ref9.trackInfoFn, - timingInfoFn = _ref9.timingInfoFn, - videoSegmentTimingInfoFn = _ref9.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref9.audioSegmentTimingInfoFn, - id3Fn = _ref9.id3Fn, - captionsFn = _ref9.captionsFn, - isEndOfTimeline = _ref9.isEndOfTimeline, - endedTimelineFn = _ref9.endedTimelineFn, - dataFn = _ref9.dataFn, - doneFn = _ref9.doneFn; - var count = 0; - var didError = false; - return function (error, segment) { - if (didError) { - return; - } - - if (error) { - didError = true; // If there are errors, we have to abort any outstanding requests - - abortAll(activeXhrs); // Even though the requests above are aborted, and in theory we could wait until we - // handle the aborted events from those requests, there are some cases where we may - // never get an aborted event. For instance, if the network connection is lost and - // there were two requests, the first may have triggered an error immediately, while - // the second request remains unsent. In that case, the aborted algorithm will not - // trigger an abort: see https://xhr.spec.whatwg.org/#the-abort()-method - // - // We also can't rely on the ready state of the XHR, since the request that - // triggered the connection error may also show as a ready state of 0 (unsent). - // Therefore, we have to finish this group of requests immediately after the first - // seen error. - - return doneFn(error, segment); - } - - count += 1; - - if (count === activeXhrs.length) { - var segmentFinish = function segmentFinish() { - if (segment.encryptedBytes) { - return decryptSegment({ - decryptionWorker: decryptionWorker, - segment: segment, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - } // Otherwise, everything is ready just continue - - - handleSegmentBytes({ - segment: segment, - bytes: segment.bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - }; // Keep track of when *all* of the requests have completed - - - segment.endOfAllRequests = Date.now(); - - if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) { - return decrypt({ - decryptionWorker: decryptionWorker, - // add -init to the "id" to differentiate between segment - // and init segment decryption, just in case they happen - // at the same time at some point in the future. - id: segment.requestId + '-init', - encryptedBytes: segment.map.encryptedBytes, - key: segment.map.key - }, function (decryptedBytes) { - segment.map.bytes = decryptedBytes; - parseInitSegment(segment, function (parseError) { - if (parseError) { - abortAll(activeXhrs); - return doneFn(parseError, segment); - } - - segmentFinish(); - }); - }); - } - - segmentFinish(); - } - }; -}; -/** - * Calls the abort callback if any request within the batch was aborted. Will only call - * the callback once per batch of requests, even if multiple were aborted. - * - * @param {Object} loadendState - state to check to see if the abort function was called - * @param {Function} abortFn - callback to call for abort - */ - - -var handleLoadEnd = function handleLoadEnd(_ref10) { - var loadendState = _ref10.loadendState, - abortFn = _ref10.abortFn; - return function (event) { - var request = event.target; - - if (request.aborted && abortFn && !loadendState.calledAbortFn) { - abortFn(); - loadendState.calledAbortFn = true; - } - }; -}; -/** - * Simple progress event callback handler that gathers some stats before - * executing a provided callback with the `segment` object - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} progressFn - a callback that is executed each time a progress event - * is received - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Event} event - the progress event object from XMLHttpRequest - */ - - -var handleProgress = function handleProgress(_ref11) { - var segment = _ref11.segment, - progressFn = _ref11.progressFn; - _ref11.trackInfoFn; - _ref11.timingInfoFn; - _ref11.videoSegmentTimingInfoFn; - _ref11.audioSegmentTimingInfoFn; - _ref11.id3Fn; - _ref11.captionsFn; - _ref11.isEndOfTimeline; - _ref11.endedTimelineFn; - _ref11.dataFn; - return function (event) { - var request = event.target; - - if (request.aborted) { - return; - } - - segment.stats = videojs.mergeOptions(segment.stats, getProgressStats(event)); // record the time that we receive the first byte of data - - if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) { - segment.stats.firstBytesReceivedAt = Date.now(); - } - - return progressFn(event, segment); - }; -}; -/** - * Load all resources and does any processing necessary for a media-segment - * - * Features: - * decrypts the media-segment if it has a key uri and an iv - * aborts *all* requests if *any* one request fails - * - * The segment object, at minimum, has the following format: - * { - * resolvedUri: String, - * [transmuxer]: Object, - * [byterange]: { - * offset: Number, - * length: Number - * }, - * [key]: { - * resolvedUri: String - * [byterange]: { - * offset: Number, - * length: Number - * }, - * iv: { - * bytes: Uint32Array - * } - * }, - * [map]: { - * resolvedUri: String, - * [byterange]: { - * offset: Number, - * length: Number - * }, - * [bytes]: Uint8Array - * } - * } - * ...where [name] denotes optional properties - * - * @param {Function} xhr - an instance of the xhr wrapper in xhr.js - * @param {Object} xhrOptions - the base options to provide to all xhr requests - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 - * decryption routines - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} abortFn - a callback called (only once) if any piece of a request was - * aborted - * @param {Function} progressFn - a callback that receives progress events from the main - * segment's xhr request - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} id3Fn - a callback that receives ID3 metadata - * @param {Function} captionsFn - a callback that receives captions - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that receives data from the main segment's xhr - * request, transmuxed if needed - * @param {Function} doneFn - a callback that is executed only once all requests have - * succeeded or failed - * @return {Function} a function that, when invoked, immediately aborts all - * outstanding requests - */ - - -var mediaSegmentRequest = function mediaSegmentRequest(_ref12) { - var xhr = _ref12.xhr, - xhrOptions = _ref12.xhrOptions, - decryptionWorker = _ref12.decryptionWorker, - segment = _ref12.segment, - abortFn = _ref12.abortFn, - progressFn = _ref12.progressFn, - trackInfoFn = _ref12.trackInfoFn, - timingInfoFn = _ref12.timingInfoFn, - videoSegmentTimingInfoFn = _ref12.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref12.audioSegmentTimingInfoFn, - id3Fn = _ref12.id3Fn, - captionsFn = _ref12.captionsFn, - isEndOfTimeline = _ref12.isEndOfTimeline, - endedTimelineFn = _ref12.endedTimelineFn, - dataFn = _ref12.dataFn, - doneFn = _ref12.doneFn; - var activeXhrs = []; - var finishProcessingFn = waitForCompletion({ - activeXhrs: activeXhrs, - decryptionWorker: decryptionWorker, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); // optionally, request the decryption key - - if (segment.key && !segment.key.bytes) { - var objects = [segment.key]; - - if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) { - objects.push(segment.map.key); - } - - var keyRequestOptions = videojs.mergeOptions(xhrOptions, { - uri: segment.key.resolvedUri, - responseType: 'arraybuffer' - }); - var keyRequestCallback = handleKeyResponse(segment, objects, finishProcessingFn); - var keyXhr = xhr(keyRequestOptions, keyRequestCallback); - activeXhrs.push(keyXhr); - } // optionally, request the associated media init segment - - - if (segment.map && !segment.map.bytes) { - var differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri); - - if (differentMapKey) { - var mapKeyRequestOptions = videojs.mergeOptions(xhrOptions, { - uri: segment.map.key.resolvedUri, - responseType: 'arraybuffer' - }); - var mapKeyRequestCallback = handleKeyResponse(segment, [segment.map.key], finishProcessingFn); - var mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback); - activeXhrs.push(mapKeyXhr); - } - - var initSegmentOptions = videojs.mergeOptions(xhrOptions, { - uri: segment.map.resolvedUri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment.map) - }); - var initSegmentRequestCallback = handleInitSegmentResponse({ - segment: segment, - finishProcessingFn: finishProcessingFn - }); - var initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback); - activeXhrs.push(initSegmentXhr); - } - - var segmentRequestOptions = videojs.mergeOptions(xhrOptions, { - uri: segment.part && segment.part.resolvedUri || segment.resolvedUri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment) - }); - var segmentRequestCallback = handleSegmentResponse({ - segment: segment, - finishProcessingFn: finishProcessingFn, - responseType: segmentRequestOptions.responseType - }); - var segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback); - segmentXhr.addEventListener('progress', handleProgress({ - segment: segment, - progressFn: progressFn, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn - })); - activeXhrs.push(segmentXhr); // since all parts of the request must be considered, but should not make callbacks - // multiple times, provide a shared state object - - var loadendState = {}; - activeXhrs.forEach(function (activeXhr) { - activeXhr.addEventListener('loadend', handleLoadEnd({ - loadendState: loadendState, - abortFn: abortFn - })); - }); - return function () { - return abortAll(activeXhrs); - }; -}; - -/** - * @file - codecs.js - Handles tasks regarding codec strings such as translating them to - * codec strings, or translating codec strings into objects that can be examined. - */ -var logFn$1 = logger('CodecUtils'); -/** - * Returns a set of codec strings parsed from the playlist or the default - * codec strings if no codecs were specified in the playlist - * - * @param {Playlist} media the current media playlist - * @return {Object} an object with the video and audio codecs - */ - -var getCodecs = function getCodecs(media) { - // if the codecs were explicitly specified, use them instead of the - // defaults - var mediaAttributes = media.attributes || {}; - - if (mediaAttributes.CODECS) { - return parseCodecs(mediaAttributes.CODECS); - } -}; - -var isMaat = function isMaat(master, media) { - var mediaAttributes = media.attributes || {}; - return master && master.mediaGroups && master.mediaGroups.AUDIO && mediaAttributes.AUDIO && master.mediaGroups.AUDIO[mediaAttributes.AUDIO]; -}; -var isMuxed = function isMuxed(master, media) { - if (!isMaat(master, media)) { - return true; - } - - var mediaAttributes = media.attributes || {}; - var audioGroup = master.mediaGroups.AUDIO[mediaAttributes.AUDIO]; - - for (var groupId in audioGroup) { - // If an audio group has a URI (the case for HLS, as HLS will use external playlists), - // or there are listed playlists (the case for DASH, as the manifest will have already - // provided all of the details necessary to generate the audio playlist, as opposed to - // HLS' externally requested playlists), then the content is demuxed. - if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) { - return true; - } - } - - return false; -}; -var unwrapCodecList = function unwrapCodecList(codecList) { - var codecs = {}; - codecList.forEach(function (_ref) { - var mediaType = _ref.mediaType, - type = _ref.type, - details = _ref.details; - codecs[mediaType] = codecs[mediaType] || []; - codecs[mediaType].push(translateLegacyCodec("" + type + details)); - }); - Object.keys(codecs).forEach(function (mediaType) { - if (codecs[mediaType].length > 1) { - logFn$1("multiple " + mediaType + " codecs found as attributes: " + codecs[mediaType].join(', ') + ". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."); - codecs[mediaType] = null; - return; - } - - codecs[mediaType] = codecs[mediaType][0]; - }); - return codecs; -}; -var codecCount = function codecCount(codecObj) { - var count = 0; - - if (codecObj.audio) { - count++; - } - - if (codecObj.video) { - count++; - } - - return count; -}; -/** - * Calculates the codec strings for a working configuration of - * SourceBuffers to play variant streams in a master playlist. If - * there is no possible working configuration, an empty object will be - * returned. - * - * @param master {Object} the m3u8 object for the master playlist - * @param media {Object} the m3u8 object for the variant playlist - * @return {Object} the codec strings. - * - * @private - */ - -var codecsForPlaylist = function codecsForPlaylist(master, media) { - var mediaAttributes = media.attributes || {}; - var codecInfo = unwrapCodecList(getCodecs(media) || []); // HLS with multiple-audio tracks must always get an audio codec. - // Put another way, there is no way to have a video-only multiple-audio HLS! - - if (isMaat(master, media) && !codecInfo.audio) { - if (!isMuxed(master, media)) { - // It is possible for codecs to be specified on the audio media group playlist but - // not on the rendition playlist. This is mostly the case for DASH, where audio and - // video are always separate (and separately specified). - var defaultCodecs = unwrapCodecList(codecsFromDefault(master, mediaAttributes.AUDIO) || []); - - if (defaultCodecs.audio) { - codecInfo.audio = defaultCodecs.audio; - } - } - } - - return codecInfo; -}; - -var logFn = logger('PlaylistSelector'); - -var representationToString = function representationToString(representation) { - if (!representation || !representation.playlist) { - return; - } - - var playlist = representation.playlist; - return JSON.stringify({ - id: playlist.id, - bandwidth: representation.bandwidth, - width: representation.width, - height: representation.height, - codecs: playlist.attributes && playlist.attributes.CODECS || '' - }); -}; // Utilities - -/** - * Returns the CSS value for the specified property on an element - * using `getComputedStyle`. Firefox has a long-standing issue where - * getComputedStyle() may return null when running in an iframe with - * `display: none`. - * - * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - * @param {HTMLElement} el the htmlelement to work on - * @param {string} the proprety to get the style for - */ - - -var safeGetComputedStyle = function safeGetComputedStyle(el, property) { - if (!el) { - return ''; - } - - var result = window.getComputedStyle(el); - - if (!result) { - return ''; - } - - return result[property]; -}; -/** - * Resuable stable sort function - * - * @param {Playlists} array - * @param {Function} sortFn Different comparators - * @function stableSort - */ - - -var stableSort = function stableSort(array, sortFn) { - var newArray = array.slice(); - array.sort(function (left, right) { - var cmp = sortFn(left, right); - - if (cmp === 0) { - return newArray.indexOf(left) - newArray.indexOf(right); - } - - return cmp; - }); -}; -/** - * A comparator function to sort two playlist object by bandwidth. - * - * @param {Object} left a media playlist object - * @param {Object} right a media playlist object - * @return {number} Greater than zero if the bandwidth attribute of - * left is greater than the corresponding attribute of right. Less - * than zero if the bandwidth of right is greater than left and - * exactly zero if the two are equal. - */ - - -var comparePlaylistBandwidth = function comparePlaylistBandwidth(left, right) { - var leftBandwidth; - var rightBandwidth; - - if (left.attributes.BANDWIDTH) { - leftBandwidth = left.attributes.BANDWIDTH; - } - - leftBandwidth = leftBandwidth || window.Number.MAX_VALUE; - - if (right.attributes.BANDWIDTH) { - rightBandwidth = right.attributes.BANDWIDTH; - } - - rightBandwidth = rightBandwidth || window.Number.MAX_VALUE; - return leftBandwidth - rightBandwidth; -}; -/** - * A comparator function to sort two playlist object by resolution (width). - * - * @param {Object} left a media playlist object - * @param {Object} right a media playlist object - * @return {number} Greater than zero if the resolution.width attribute of - * left is greater than the corresponding attribute of right. Less - * than zero if the resolution.width of right is greater than left and - * exactly zero if the two are equal. - */ - -var comparePlaylistResolution = function comparePlaylistResolution(left, right) { - var leftWidth; - var rightWidth; - - if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) { - leftWidth = left.attributes.RESOLUTION.width; - } - - leftWidth = leftWidth || window.Number.MAX_VALUE; - - if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) { - rightWidth = right.attributes.RESOLUTION.width; - } - - rightWidth = rightWidth || window.Number.MAX_VALUE; // NOTE - Fallback to bandwidth sort as appropriate in cases where multiple renditions - // have the same media dimensions/ resolution - - if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) { - return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH; - } - - return leftWidth - rightWidth; -}; -/** - * Chooses the appropriate media playlist based on bandwidth and player size - * - * @param {Object} master - * Object representation of the master manifest - * @param {number} playerBandwidth - * Current calculated bandwidth of the player - * @param {number} playerWidth - * Current width of the player element (should account for the device pixel ratio) - * @param {number} playerHeight - * Current height of the player element (should account for the device pixel ratio) - * @param {boolean} limitRenditionByPlayerDimensions - * True if the player width and height should be used during the selection, false otherwise - * @param {Object} masterPlaylistController - * the current masterPlaylistController object - * @return {Playlist} the highest bitrate playlist less than the - * currently detected bandwidth, accounting for some amount of - * bandwidth variance - */ - -var simpleSelector = function simpleSelector(master, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, masterPlaylistController) { - // If we end up getting called before `master` is available, exit early - if (!master) { - return; - } - - var options = { - bandwidth: playerBandwidth, - width: playerWidth, - height: playerHeight, - limitRenditionByPlayerDimensions: limitRenditionByPlayerDimensions - }; - var playlists = master.playlists; // if playlist is audio only, select between currently active audio group playlists. - - if (Playlist.isAudioOnly(master)) { - playlists = masterPlaylistController.getAudioTrackPlaylists_(); // add audioOnly to options so that we log audioOnly: true - // at the buttom of this function for debugging. - - options.audioOnly = true; - } // convert the playlists to an intermediary representation to make comparisons easier - - - var sortedPlaylistReps = playlists.map(function (playlist) { - var bandwidth; - var width = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width; - var height = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height; - bandwidth = playlist.attributes && playlist.attributes.BANDWIDTH; - bandwidth = bandwidth || window.Number.MAX_VALUE; - return { - bandwidth: bandwidth, - width: width, - height: height, - playlist: playlist - }; - }); - stableSort(sortedPlaylistReps, function (left, right) { - return left.bandwidth - right.bandwidth; - }); // filter out any playlists that have been excluded due to - // incompatible configurations - - sortedPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return !Playlist.isIncompatible(rep.playlist); - }); // filter out any playlists that have been disabled manually through the representations - // api or blacklisted temporarily due to playback errors. - - var enabledPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return Playlist.isEnabled(rep.playlist); - }); - - if (!enabledPlaylistReps.length) { - // if there are no enabled playlists, then they have all been blacklisted or disabled - // by the user through the representations api. In this case, ignore blacklisting and - // fallback to what the user wants by using playlists the user has not disabled. - enabledPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return !Playlist.isDisabled(rep.playlist); - }); - } // filter out any variant that has greater effective bitrate - // than the current estimated bandwidth - - - var bandwidthPlaylistReps = enabledPlaylistReps.filter(function (rep) { - return rep.bandwidth * Config.BANDWIDTH_VARIANCE < playerBandwidth; - }); - var highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1]; // get all of the renditions with the same (highest) bandwidth - // and then taking the very first element - - var bandwidthBestRep = bandwidthPlaylistReps.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; // if we're not going to limit renditions by player size, make an early decision. - - if (limitRenditionByPlayerDimensions === false) { - var _chosenRep = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0]; - - if (_chosenRep && _chosenRep.playlist) { - var type = 'sortedPlaylistReps'; - - if (bandwidthBestRep) { - type = 'bandwidthBestRep'; - } - - if (enabledPlaylistReps[0]) { - type = 'enabledPlaylistReps'; - } - - logFn("choosing " + representationToString(_chosenRep) + " using " + type + " with options", options); - return _chosenRep.playlist; - } - - logFn('could not choose a playlist with options', options); - return null; - } // filter out playlists without resolution information - - - var haveResolution = bandwidthPlaylistReps.filter(function (rep) { - return rep.width && rep.height; - }); // sort variants by resolution - - stableSort(haveResolution, function (left, right) { - return left.width - right.width; - }); // if we have the exact resolution as the player use it - - var resolutionBestRepList = haveResolution.filter(function (rep) { - return rep.width === playerWidth && rep.height === playerHeight; - }); - highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1]; // ensure that we pick the highest bandwidth variant that have exact resolution - - var resolutionBestRep = resolutionBestRepList.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - var resolutionPlusOneList; - var resolutionPlusOneSmallest; - var resolutionPlusOneRep; // find the smallest variant that is larger than the player - // if there is no match of exact resolution - - if (!resolutionBestRep) { - resolutionPlusOneList = haveResolution.filter(function (rep) { - return rep.width > playerWidth || rep.height > playerHeight; - }); // find all the variants have the same smallest resolution - - resolutionPlusOneSmallest = resolutionPlusOneList.filter(function (rep) { - return rep.width === resolutionPlusOneList[0].width && rep.height === resolutionPlusOneList[0].height; - }); // ensure that we also pick the highest bandwidth variant that - // is just-larger-than the video player - - highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1]; - resolutionPlusOneRep = resolutionPlusOneSmallest.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - } // fallback chain of variants - - - var chosenRep = resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0]; - - if (chosenRep && chosenRep.playlist) { - var _type = 'sortedPlaylistReps'; - - if (resolutionPlusOneRep) { - _type = 'resolutionPlusOneRep'; - } else if (resolutionBestRep) { - _type = 'resolutionBestRep'; - } else if (bandwidthBestRep) { - _type = 'bandwidthBestRep'; - } else if (enabledPlaylistReps[0]) { - _type = 'enabledPlaylistReps'; - } - - logFn("choosing " + representationToString(chosenRep) + " using " + _type + " with options", options); - return chosenRep.playlist; - } - - logFn('could not choose a playlist with options', options); - return null; -}; - -/** - * Chooses the appropriate media playlist based on the most recent - * bandwidth estimate and the player size. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @return {Playlist} the highest bitrate playlist less than the - * currently detected bandwidth, accounting for some amount of - * bandwidth variance - */ - -var lastBandwidthSelector = function lastBandwidthSelector() { - var pixelRatio = this.useDevicePixelRatio ? window.devicePixelRatio || 1 : 1; - return simpleSelector(this.playlists.master, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); -}; -/** - * Chooses the appropriate media playlist based on an - * exponential-weighted moving average of the bandwidth after - * filtering for player size. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @param {number} decay - a number between 0 and 1. Higher values of - * this parameter will cause previous bandwidth estimates to lose - * significance more quickly. - * @return {Function} a function which can be invoked to create a new - * playlist selector function. - * @see https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average - */ - -var movingAverageBandwidthSelector = function movingAverageBandwidthSelector(decay) { - var average = -1; - var lastSystemBandwidth = -1; - - if (decay < 0 || decay > 1) { - throw new Error('Moving average bandwidth decay must be between 0 and 1.'); - } - - return function () { - var pixelRatio = this.useDevicePixelRatio ? window.devicePixelRatio || 1 : 1; - - if (average < 0) { - average = this.systemBandwidth; - lastSystemBandwidth = this.systemBandwidth; - } // stop the average value from decaying for every 250ms - // when the systemBandwidth is constant - // and - // stop average from setting to a very low value when the - // systemBandwidth becomes 0 in case of chunk cancellation - - - if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) { - average = decay * this.systemBandwidth + (1 - decay) * average; - lastSystemBandwidth = this.systemBandwidth; - } - - return simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); - }; -}; -/** - * Chooses the appropriate media playlist based on the potential to rebuffer - * - * @param {Object} settings - * Object of information required to use this selector - * @param {Object} settings.master - * Object representation of the master manifest - * @param {number} settings.currentTime - * The current time of the player - * @param {number} settings.bandwidth - * Current measured bandwidth - * @param {number} settings.duration - * Duration of the media - * @param {number} settings.segmentDuration - * Segment duration to be used in round trip time calculations - * @param {number} settings.timeUntilRebuffer - * Time left in seconds until the player has to rebuffer - * @param {number} settings.currentTimeline - * The current timeline segments are being loaded from - * @param {SyncController} settings.syncController - * SyncController for determining if we have a sync point for a given playlist - * @return {Object|null} - * {Object} return.playlist - * The highest bandwidth playlist with the least amount of rebuffering - * {Number} return.rebufferingImpact - * The amount of time in seconds switching to this playlist will rebuffer. A - * negative value means that switching will cause zero rebuffering. - */ - -var minRebufferMaxBandwidthSelector = function minRebufferMaxBandwidthSelector(settings) { - var master = settings.master, - currentTime = settings.currentTime, - bandwidth = settings.bandwidth, - duration = settings.duration, - segmentDuration = settings.segmentDuration, - timeUntilRebuffer = settings.timeUntilRebuffer, - currentTimeline = settings.currentTimeline, - syncController = settings.syncController; // filter out any playlists that have been excluded due to - // incompatible configurations - - var compatiblePlaylists = master.playlists.filter(function (playlist) { - return !Playlist.isIncompatible(playlist); - }); // filter out any playlists that have been disabled manually through the representations - // api or blacklisted temporarily due to playback errors. - - var enabledPlaylists = compatiblePlaylists.filter(Playlist.isEnabled); - - if (!enabledPlaylists.length) { - // if there are no enabled playlists, then they have all been blacklisted or disabled - // by the user through the representations api. In this case, ignore blacklisting and - // fallback to what the user wants by using playlists the user has not disabled. - enabledPlaylists = compatiblePlaylists.filter(function (playlist) { - return !Playlist.isDisabled(playlist); - }); - } - - var bandwidthPlaylists = enabledPlaylists.filter(Playlist.hasAttribute.bind(null, 'BANDWIDTH')); - var rebufferingEstimates = bandwidthPlaylists.map(function (playlist) { - var syncPoint = syncController.getSyncPoint(playlist, duration, currentTimeline, currentTime); // If there is no sync point for this playlist, switching to it will require a - // sync request first. This will double the request time - - var numRequests = syncPoint ? 1 : 2; - var requestTimeEstimate = Playlist.estimateSegmentRequestTime(segmentDuration, bandwidth, playlist); - var rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer; - return { - playlist: playlist, - rebufferingImpact: rebufferingImpact - }; - }); - var noRebufferingPlaylists = rebufferingEstimates.filter(function (estimate) { - return estimate.rebufferingImpact <= 0; - }); // Sort by bandwidth DESC - - stableSort(noRebufferingPlaylists, function (a, b) { - return comparePlaylistBandwidth(b.playlist, a.playlist); - }); - - if (noRebufferingPlaylists.length) { - return noRebufferingPlaylists[0]; - } - - stableSort(rebufferingEstimates, function (a, b) { - return a.rebufferingImpact - b.rebufferingImpact; - }); - return rebufferingEstimates[0] || null; -}; -/** - * Chooses the appropriate media playlist, which in this case is the lowest bitrate - * one with video. If no renditions with video exist, return the lowest audio rendition. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @return {Object|null} - * {Object} return.playlist - * The lowest bitrate playlist that contains a video codec. If no such rendition - * exists pick the lowest audio rendition. - */ - -var lowestBitrateCompatibleVariantSelector = function lowestBitrateCompatibleVariantSelector() { - var _this = this; - - // filter out any playlists that have been excluded due to - // incompatible configurations or playback errors - var playlists = this.playlists.master.playlists.filter(Playlist.isEnabled); // Sort ascending by bitrate - - stableSort(playlists, function (a, b) { - return comparePlaylistBandwidth(a, b); - }); // Parse and assume that playlists with no video codec have no video - // (this is not necessarily true, although it is generally true). - // - // If an entire manifest has no valid videos everything will get filtered - // out. - - var playlistsWithVideo = playlists.filter(function (playlist) { - return !!codecsForPlaylist(_this.playlists.master, playlist).video; - }); - return playlistsWithVideo[0] || null; -}; - -/** - * Combine all segments into a single Uint8Array - * - * @param {Object} segmentObj - * @return {Uint8Array} concatenated bytes - * @private - */ -var concatSegments = function concatSegments(segmentObj) { - var offset = 0; - var tempBuffer; - - if (segmentObj.bytes) { - tempBuffer = new Uint8Array(segmentObj.bytes); // combine the individual segments into one large typed-array - - segmentObj.segments.forEach(function (segment) { - tempBuffer.set(segment, offset); - offset += segment.byteLength; - }); - } - - return tempBuffer; -}; - -/** - * @file text-tracks.js - */ -/** - * Create captions text tracks on video.js if they do not exist - * - * @param {Object} inbandTextTracks a reference to current inbandTextTracks - * @param {Object} tech the video.js tech - * @param {Object} captionStream the caption stream to create - * @private - */ - -var createCaptionsTrackIfNotExists = function createCaptionsTrackIfNotExists(inbandTextTracks, tech, captionStream) { - if (!inbandTextTracks[captionStream]) { - tech.trigger({ - type: 'usage', - name: 'vhs-608' - }); - tech.trigger({ - type: 'usage', - name: 'hls-608' - }); - var instreamId = captionStream; // we need to translate SERVICEn for 708 to how mux.js currently labels them - - if (/^cc708_/.test(captionStream)) { - instreamId = 'SERVICE' + captionStream.split('_')[1]; - } - - var track = tech.textTracks().getTrackById(instreamId); - - if (track) { - // Resuse an existing track with a CC# id because this was - // very likely created by videojs-contrib-hls from information - // in the m3u8 for us to use - inbandTextTracks[captionStream] = track; - } else { - // This section gets called when we have caption services that aren't specified in the manifest. - // Manifest level caption services are handled in media-groups.js under CLOSED-CAPTIONS. - var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {}; - var label = captionStream; - var language = captionStream; - var def = false; - var captionService = captionServices[instreamId]; - - if (captionService) { - label = captionService.label; - language = captionService.language; - def = captionService.default; - } // Otherwise, create a track with the default `CC#` label and - // without a language - - - inbandTextTracks[captionStream] = tech.addRemoteTextTrack({ - kind: 'captions', - id: instreamId, - // TODO: investigate why this doesn't seem to turn the caption on by default - default: def, - label: label, - language: language - }, false).track; - } - } -}; -/** - * Add caption text track data to a source handler given an array of captions - * - * @param {Object} - * @param {Object} inbandTextTracks the inband text tracks - * @param {number} timestampOffset the timestamp offset of the source buffer - * @param {Array} captionArray an array of caption data - * @private - */ - -var addCaptionData = function addCaptionData(_ref) { - var inbandTextTracks = _ref.inbandTextTracks, - captionArray = _ref.captionArray, - timestampOffset = _ref.timestampOffset; - - if (!captionArray) { - return; - } - - var Cue = window.WebKitDataCue || window.VTTCue; - captionArray.forEach(function (caption) { - var track = caption.stream; - inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset, caption.endTime + timestampOffset, caption.text)); - }); -}; -/** - * Define properties on a cue for backwards compatability, - * but warn the user that the way that they are using it - * is depricated and will be removed at a later date. - * - * @param {Cue} cue the cue to add the properties on - * @private - */ - -var deprecateOldCue = function deprecateOldCue(cue) { - Object.defineProperties(cue.frame, { - id: { - get: function get() { - videojs.log.warn('cue.frame.id is deprecated. Use cue.value.key instead.'); - return cue.value.key; - } - }, - value: { - get: function get() { - videojs.log.warn('cue.frame.value is deprecated. Use cue.value.data instead.'); - return cue.value.data; - } - }, - privateData: { - get: function get() { - videojs.log.warn('cue.frame.privateData is deprecated. Use cue.value.data instead.'); - return cue.value.data; - } - } - }); -}; -/** - * Add metadata text track data to a source handler given an array of metadata - * - * @param {Object} - * @param {Object} inbandTextTracks the inband text tracks - * @param {Array} metadataArray an array of meta data - * @param {number} timestampOffset the timestamp offset of the source buffer - * @param {number} videoDuration the duration of the video - * @private - */ - - -var addMetadata = function addMetadata(_ref2) { - var inbandTextTracks = _ref2.inbandTextTracks, - metadataArray = _ref2.metadataArray, - timestampOffset = _ref2.timestampOffset, - videoDuration = _ref2.videoDuration; - - if (!metadataArray) { - return; - } - - var Cue = window.WebKitDataCue || window.VTTCue; - var metadataTrack = inbandTextTracks.metadataTrack_; - - if (!metadataTrack) { - return; - } - - metadataArray.forEach(function (metadata) { - var time = metadata.cueTime + timestampOffset; // if time isn't a finite number between 0 and Infinity, like NaN, - // ignore this bit of metadata. - // This likely occurs when you have an non-timed ID3 tag like TIT2, - // which is the "Title/Songname/Content description" frame - - if (typeof time !== 'number' || window.isNaN(time) || time < 0 || !(time < Infinity)) { - return; - } - - metadata.frames.forEach(function (frame) { - var cue = new Cue(time, time, frame.value || frame.url || frame.data || ''); - cue.frame = frame; - cue.value = frame; - deprecateOldCue(cue); - metadataTrack.addCue(cue); - }); - }); - - if (!metadataTrack.cues || !metadataTrack.cues.length) { - return; - } // Updating the metadeta cues so that - // the endTime of each cue is the startTime of the next cue - // the endTime of last cue is the duration of the video - - - var cues = metadataTrack.cues; - var cuesArray = []; // Create a copy of the TextTrackCueList... - // ...disregarding cues with a falsey value - - for (var i = 0; i < cues.length; i++) { - if (cues[i]) { - cuesArray.push(cues[i]); - } - } // Group cues by their startTime value - - - var cuesGroupedByStartTime = cuesArray.reduce(function (obj, cue) { - var timeSlot = obj[cue.startTime] || []; - timeSlot.push(cue); - obj[cue.startTime] = timeSlot; - return obj; - }, {}); // Sort startTimes by ascending order - - var sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort(function (a, b) { - return Number(a) - Number(b); - }); // Map each cue group's endTime to the next group's startTime - - sortedStartTimes.forEach(function (startTime, idx) { - var cueGroup = cuesGroupedByStartTime[startTime]; - var nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration; // Map each cue's endTime the next group's startTime - - cueGroup.forEach(function (cue) { - cue.endTime = nextTime; - }); - }); -}; -/** - * Create metadata text track on video.js if it does not exist - * - * @param {Object} inbandTextTracks a reference to current inbandTextTracks - * @param {string} dispatchType the inband metadata track dispatch type - * @param {Object} tech the video.js tech - * @private - */ - -var createMetadataTrackIfNotExists = function createMetadataTrackIfNotExists(inbandTextTracks, dispatchType, tech) { - if (inbandTextTracks.metadataTrack_) { - return; - } - - inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({ - kind: 'metadata', - label: 'Timed Metadata' - }, false).track; - inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType; -}; -/** - * Remove cues from a track on video.js. - * - * @param {Double} start start of where we should remove the cue - * @param {Double} end end of where the we should remove the cue - * @param {Object} track the text track to remove the cues from - * @private - */ - -var removeCuesFromTrack = function removeCuesFromTrack(start, end, track) { - var i; - var cue; - - if (!track) { - return; - } - - if (!track.cues) { - return; - } - - i = track.cues.length; - - while (i--) { - cue = track.cues[i]; // Remove any cue within the provided start and end time - - if (cue.startTime >= start && cue.endTime <= end) { - track.removeCue(cue); - } - } -}; -/** - * Remove duplicate cues from a track on video.js (a cue is considered a - * duplicate if it has the same time interval and text as another) - * - * @param {Object} track the text track to remove the duplicate cues from - * @private - */ - -var removeDuplicateCuesFromTrack = function removeDuplicateCuesFromTrack(track) { - var cues = track.cues; - - if (!cues) { - return; - } - - for (var i = 0; i < cues.length; i++) { - var duplicates = []; - var occurrences = 0; - - for (var j = 0; j < cues.length; j++) { - if (cues[i].startTime === cues[j].startTime && cues[i].endTime === cues[j].endTime && cues[i].text === cues[j].text) { - occurrences++; - - if (occurrences > 1) { - duplicates.push(cues[j]); - } - } - } - - if (duplicates.length) { - duplicates.forEach(function (dupe) { - return track.removeCue(dupe); - }); - } - } -}; - -/** - * Returns a list of gops in the buffer that have a pts value of 3 seconds or more in - * front of current time. - * - * @param {Array} buffer - * The current buffer of gop information - * @param {number} currentTime - * The current time - * @param {Double} mapping - * Offset to map display time to stream presentation time - * @return {Array} - * List of gops considered safe to append over - */ - -var gopsSafeToAlignWith = function gopsSafeToAlignWith(buffer, currentTime, mapping) { - if (typeof currentTime === 'undefined' || currentTime === null || !buffer.length) { - return []; - } // pts value for current time + 3 seconds to give a bit more wiggle room - - - var currentTimePts = Math.ceil((currentTime - mapping + 3) * ONE_SECOND_IN_TS); - var i; - - for (i = 0; i < buffer.length; i++) { - if (buffer[i].pts > currentTimePts) { - break; - } - } - - return buffer.slice(i); -}; -/** - * Appends gop information (timing and byteLength) received by the transmuxer for the - * gops appended in the last call to appendBuffer - * - * @param {Array} buffer - * The current buffer of gop information - * @param {Array} gops - * List of new gop information - * @param {boolean} replace - * If true, replace the buffer with the new gop information. If false, append the - * new gop information to the buffer in the right location of time. - * @return {Array} - * Updated list of gop information - */ - -var updateGopBuffer = function updateGopBuffer(buffer, gops, replace) { - if (!gops.length) { - return buffer; - } - - if (replace) { - // If we are in safe append mode, then completely overwrite the gop buffer - // with the most recent appeneded data. This will make sure that when appending - // future segments, we only try to align with gops that are both ahead of current - // time and in the last segment appended. - return gops.slice(); - } - - var start = gops[0].pts; - var i = 0; - - for (i; i < buffer.length; i++) { - if (buffer[i].pts >= start) { - break; - } - } - - return buffer.slice(0, i).concat(gops); -}; -/** - * Removes gop information in buffer that overlaps with provided start and end - * - * @param {Array} buffer - * The current buffer of gop information - * @param {Double} start - * position to start the remove at - * @param {Double} end - * position to end the remove at - * @param {Double} mapping - * Offset to map display time to stream presentation time - */ - -var removeGopBuffer = function removeGopBuffer(buffer, start, end, mapping) { - var startPts = Math.ceil((start - mapping) * ONE_SECOND_IN_TS); - var endPts = Math.ceil((end - mapping) * ONE_SECOND_IN_TS); - var updatedBuffer = buffer.slice(); - var i = buffer.length; - - while (i--) { - if (buffer[i].pts <= endPts) { - break; - } - } - - if (i === -1) { - // no removal because end of remove range is before start of buffer - return updatedBuffer; - } - - var j = i + 1; - - while (j--) { - if (buffer[j].pts <= startPts) { - break; - } - } // clamp remove range start to 0 index - - - j = Math.max(j, 0); - updatedBuffer.splice(j, i - j + 1); - return updatedBuffer; -}; - -var shallowEqual = function shallowEqual(a, b) { - // if both are undefined - // or one or the other is undefined - // they are not equal - if (!a && !b || !a && b || a && !b) { - return false; - } // they are the same object and thus, equal - - - if (a === b) { - return true; - } // sort keys so we can make sure they have - // all the same keys later. - - - var akeys = Object.keys(a).sort(); - var bkeys = Object.keys(b).sort(); // different number of keys, not equal - - if (akeys.length !== bkeys.length) { - return false; - } - - for (var i = 0; i < akeys.length; i++) { - var key = akeys[i]; // different sorted keys, not equal - - if (key !== bkeys[i]) { - return false; - } // different values, not equal - - - if (a[key] !== b[key]) { - return false; - } - } - - return true; -}; - -// https://www.w3.org/TR/WebIDL-1/#quotaexceedederror -var QUOTA_EXCEEDED_ERR = 22; - -/** - * The segment loader has no recourse except to fetch a segment in the - * current playlist and use the internal timestamps in that segment to - * generate a syncPoint. This function returns a good candidate index - * for that process. - * - * @param {Array} segments - the segments array from a playlist. - * @return {number} An index of a segment from the playlist to load - */ - -var getSyncSegmentCandidate = function getSyncSegmentCandidate(currentTimeline, segments, targetTime) { - segments = segments || []; - var timelineSegments = []; - var time = 0; - - for (var i = 0; i < segments.length; i++) { - var segment = segments[i]; - - if (currentTimeline === segment.timeline) { - timelineSegments.push(i); - time += segment.duration; - - if (time > targetTime) { - return i; - } - } - } - - if (timelineSegments.length === 0) { - return 0; - } // default to the last timeline segment - - - return timelineSegments[timelineSegments.length - 1]; -}; // In the event of a quota exceeded error, keep at least one second of back buffer. This -// number was arbitrarily chosen and may be updated in the future, but seemed reasonable -// as a start to prevent any potential issues with removing content too close to the -// playhead. - -var MIN_BACK_BUFFER = 1; // in ms - -var CHECK_BUFFER_DELAY = 500; - -var finite = function finite(num) { - return typeof num === 'number' && isFinite(num); -}; // With most content hovering around 30fps, if a segment has a duration less than a half -// frame at 30fps or one frame at 60fps, the bandwidth and throughput calculations will -// not accurately reflect the rest of the content. - - -var MIN_SEGMENT_DURATION_TO_SAVE_STATS = 1 / 60; -var illegalMediaSwitch = function illegalMediaSwitch(loaderType, startingMedia, trackInfo) { - // Although these checks should most likely cover non 'main' types, for now it narrows - // the scope of our checks. - if (loaderType !== 'main' || !startingMedia || !trackInfo) { - return null; - } - - if (!trackInfo.hasAudio && !trackInfo.hasVideo) { - return 'Neither audio nor video found in segment.'; - } - - if (startingMedia.hasVideo && !trackInfo.hasVideo) { - return 'Only audio found in segment when we expected video.' + ' We can\'t switch to audio only from a stream that had video.' + ' To get rid of this message, please add codec information to the manifest.'; - } - - if (!startingMedia.hasVideo && trackInfo.hasVideo) { - return 'Video found in segment when we expected only audio.' + ' We can\'t switch to a stream with video from an audio only stream.' + ' To get rid of this message, please add codec information to the manifest.'; - } - - return null; -}; -/** - * Calculates a time value that is safe to remove from the back buffer without interrupting - * playback. - * - * @param {TimeRange} seekable - * The current seekable range - * @param {number} currentTime - * The current time of the player - * @param {number} targetDuration - * The target duration of the current playlist - * @return {number} - * Time that is safe to remove from the back buffer without interrupting playback - */ - -var safeBackBufferTrimTime = function safeBackBufferTrimTime(seekable, currentTime, targetDuration) { - // 30 seconds before the playhead provides a safe default for trimming. - // - // Choosing a reasonable default is particularly important for high bitrate content and - // VOD videos/live streams with large windows, as the buffer may end up overfilled and - // throw an APPEND_BUFFER_ERR. - var trimTime = currentTime - Config.BACK_BUFFER_LENGTH; - - if (seekable.length) { - // Some live playlists may have a shorter window of content than the full allowed back - // buffer. For these playlists, don't save content that's no longer within the window. - trimTime = Math.max(trimTime, seekable.start(0)); - } // Don't remove within target duration of the current time to avoid the possibility of - // removing the GOP currently being played, as removing it can cause playback stalls. - - - var maxTrimTime = currentTime - targetDuration; - return Math.min(maxTrimTime, trimTime); -}; - -var segmentInfoString = function segmentInfoString(segmentInfo) { - var startOfSegment = segmentInfo.startOfSegment, - duration = segmentInfo.duration, - segment = segmentInfo.segment, - part = segmentInfo.part, - _segmentInfo$playlist = segmentInfo.playlist, - seq = _segmentInfo$playlist.mediaSequence, - id = _segmentInfo$playlist.id, - _segmentInfo$playlist2 = _segmentInfo$playlist.segments, - segments = _segmentInfo$playlist2 === void 0 ? [] : _segmentInfo$playlist2, - index = segmentInfo.mediaIndex, - partIndex = segmentInfo.partIndex, - timeline = segmentInfo.timeline; - var segmentLen = segments.length - 1; - var selection = 'mediaIndex/partIndex increment'; - - if (segmentInfo.getMediaInfoForTime) { - selection = "getMediaInfoForTime (" + segmentInfo.getMediaInfoForTime + ")"; - } else if (segmentInfo.isSyncRequest) { - selection = 'getSyncSegmentCandidate (isSyncRequest)'; - } - - var hasPartIndex = typeof partIndex === 'number'; - var name = segmentInfo.segment.uri ? 'segment' : 'pre-segment'; - var zeroBasedPartCount = hasPartIndex ? getKnownPartCount({ - preloadSegment: segment - }) - 1 : 0; - return name + " [" + (seq + index) + "/" + (seq + segmentLen) + "]" + (hasPartIndex ? " part [" + partIndex + "/" + zeroBasedPartCount + "]" : '') + (" segment start/end [" + segment.start + " => " + segment.end + "]") + (hasPartIndex ? " part start/end [" + part.start + " => " + part.end + "]" : '') + (" startOfSegment [" + startOfSegment + "]") + (" duration [" + duration + "]") + (" timeline [" + timeline + "]") + (" selected by [" + selection + "]") + (" playlist [" + id + "]"); -}; - -var timingInfoPropertyForMedia = function timingInfoPropertyForMedia(mediaType) { - return mediaType + "TimingInfo"; -}; -/** - * Returns the timestamp offset to use for the segment. - * - * @param {number} segmentTimeline - * The timeline of the segment - * @param {number} currentTimeline - * The timeline currently being followed by the loader - * @param {number} startOfSegment - * The estimated segment start - * @param {TimeRange[]} buffered - * The loader's buffer - * @param {boolean} overrideCheck - * If true, no checks are made to see if the timestamp offset value should be set, - * but sets it directly to a value. - * - * @return {number|null} - * Either a number representing a new timestamp offset, or null if the segment is - * part of the same timeline - */ - - -var timestampOffsetForSegment = function timestampOffsetForSegment(_ref) { - var segmentTimeline = _ref.segmentTimeline, - currentTimeline = _ref.currentTimeline, - startOfSegment = _ref.startOfSegment, - buffered = _ref.buffered, - overrideCheck = _ref.overrideCheck; - - // Check to see if we are crossing a discontinuity to see if we need to set the - // timestamp offset on the transmuxer and source buffer. - // - // Previously, we changed the timestampOffset if the start of this segment was less than - // the currently set timestampOffset, but this isn't desirable as it can produce bad - // behavior, especially around long running live streams. - if (!overrideCheck && segmentTimeline === currentTimeline) { - return null; - } // When changing renditions, it's possible to request a segment on an older timeline. For - // instance, given two renditions with the following: - // - // #EXTINF:10 - // segment1 - // #EXT-X-DISCONTINUITY - // #EXTINF:10 - // segment2 - // #EXTINF:10 - // segment3 - // - // And the current player state: - // - // current time: 8 - // buffer: 0 => 20 - // - // The next segment on the current rendition would be segment3, filling the buffer from - // 20s onwards. However, if a rendition switch happens after segment2 was requested, - // then the next segment to be requested will be segment1 from the new rendition in - // order to fill time 8 and onwards. Using the buffered end would result in repeated - // content (since it would position segment1 of the new rendition starting at 20s). This - // case can be identified when the new segment's timeline is a prior value. Instead of - // using the buffered end, the startOfSegment can be used, which, hopefully, will be - // more accurate to the actual start time of the segment. - - - if (segmentTimeline < currentTimeline) { - return startOfSegment; - } // segmentInfo.startOfSegment used to be used as the timestamp offset, however, that - // value uses the end of the last segment if it is available. While this value - // should often be correct, it's better to rely on the buffered end, as the new - // content post discontinuity should line up with the buffered end as if it were - // time 0 for the new content. - - - return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment; -}; -/** - * Returns whether or not the loader should wait for a timeline change from the timeline - * change controller before processing the segment. - * - * Primary timing in VHS goes by video. This is different from most media players, as - * audio is more often used as the primary timing source. For the foreseeable future, VHS - * will continue to use video as the primary timing source, due to the current logic and - * expectations built around it. - - * Since the timing follows video, in order to maintain sync, the video loader is - * responsible for setting both audio and video source buffer timestamp offsets. - * - * Setting different values for audio and video source buffers could lead to - * desyncing. The following examples demonstrate some of the situations where this - * distinction is important. Note that all of these cases involve demuxed content. When - * content is muxed, the audio and video are packaged together, therefore syncing - * separate media playlists is not an issue. - * - * CASE 1: Audio prepares to load a new timeline before video: - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, the audio loader is preparing to load the 6th segment, the first - * after a discontinuity, while the video loader is still loading the 5th segment, before - * the discontinuity. - * - * If the audio loader goes ahead and loads and appends the 6th segment before the video - * loader crosses the discontinuity, then when appended, the 6th audio segment will use - * the timestamp offset from timeline 0. This will likely lead to desyncing. In addition, - * the audio loader must provide the audioAppendStart value to trim the content in the - * transmuxer, and that value relies on the audio timestamp offset. Since the audio - * timestamp offset is set by the video (main) loader, the audio loader shouldn't load the - * segment until that value is provided. - * - * CASE 2: Video prepares to load a new timeline before audio: - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, the video loader is preparing to load the 6th segment, the first - * after a discontinuity, while the audio loader is still loading the 5th segment, before - * the discontinuity. - * - * If the video loader goes ahead and loads and appends the 6th segment, then once the - * segment is loaded and processed, both the video and audio timestamp offsets will be - * set, since video is used as the primary timing source. This is to ensure content lines - * up appropriately, as any modifications to the video timing are reflected by audio when - * the video loader sets the audio and video timestamp offsets to the same value. However, - * setting the timestamp offset for audio before audio has had a chance to change - * timelines will likely lead to desyncing, as the audio loader will append segment 5 with - * a timestamp intended to apply to segments from timeline 1 rather than timeline 0. - * - * CASE 3: When seeking, audio prepares to load a new timeline before video - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, both audio and video loaders are loading segments from timeline - * 0, but imagine that the seek originated from timeline 1. - * - * When seeking to a new timeline, the timestamp offset will be set based on the expected - * segment start of the loaded video segment. In order to maintain sync, the audio loader - * must wait for the video loader to load its segment and update both the audio and video - * timestamp offsets before it may load and append its own segment. This is the case - * whether the seek results in a mismatched segment request (e.g., the audio loader - * chooses to load segment 3 and the video loader chooses to load segment 4) or the - * loaders choose to load the same segment index from each playlist, as the segments may - * not be aligned perfectly, even for matching segment indexes. - * - * @param {Object} timelinechangeController - * @param {number} currentTimeline - * The timeline currently being followed by the loader - * @param {number} segmentTimeline - * The timeline of the segment being loaded - * @param {('main'|'audio')} loaderType - * The loader type - * @param {boolean} audioDisabled - * Whether the audio is disabled for the loader. This should only be true when the - * loader may have muxed audio in its segment, but should not append it, e.g., for - * the main loader when an alternate audio playlist is active. - * - * @return {boolean} - * Whether the loader should wait for a timeline change from the timeline change - * controller before processing the segment - */ - -var shouldWaitForTimelineChange = function shouldWaitForTimelineChange(_ref2) { - var timelineChangeController = _ref2.timelineChangeController, - currentTimeline = _ref2.currentTimeline, - segmentTimeline = _ref2.segmentTimeline, - loaderType = _ref2.loaderType, - audioDisabled = _ref2.audioDisabled; - - if (currentTimeline === segmentTimeline) { - return false; - } - - if (loaderType === 'audio') { - var lastMainTimelineChange = timelineChangeController.lastTimelineChange({ - type: 'main' - }); // Audio loader should wait if: - // - // * main hasn't had a timeline change yet (thus has not loaded its first segment) - // * main hasn't yet changed to the timeline audio is looking to load - - return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline; - } // The main loader only needs to wait for timeline changes if there's demuxed audio. - // Otherwise, there's nothing to wait for, since audio would be muxed into the main - // loader's segments (or the content is audio/video only and handled by the main - // loader). - - - if (loaderType === 'main' && audioDisabled) { - var pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({ - type: 'audio' - }); // Main loader should wait for the audio loader if audio is not pending a timeline - // change to the current timeline. - // - // Since the main loader is responsible for setting the timestamp offset for both - // audio and video, the main loader must wait for audio to be about to change to its - // timeline before setting the offset, otherwise, if audio is behind in loading, - // segments from the previous timeline would be adjusted by the new timestamp offset. - // - // This requirement means that video will not cross a timeline until the audio is - // about to cross to it, so that way audio and video will always cross the timeline - // together. - // - // In addition to normal timeline changes, these rules also apply to the start of a - // stream (going from a non-existent timeline, -1, to timeline 0). It's important - // that these rules apply to the first timeline change because if they did not, it's - // possible that the main loader will cross two timelines before the audio loader has - // crossed one. Logic may be implemented to handle the startup as a special case, but - // it's easier to simply treat all timeline changes the same. - - if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) { - return false; - } - - return true; - } - - return false; -}; -var mediaDuration = function mediaDuration(audioTimingInfo, videoTimingInfo) { - var audioDuration = audioTimingInfo && typeof audioTimingInfo.start === 'number' && typeof audioTimingInfo.end === 'number' ? audioTimingInfo.end - audioTimingInfo.start : 0; - var videoDuration = videoTimingInfo && typeof videoTimingInfo.start === 'number' && typeof videoTimingInfo.end === 'number' ? videoTimingInfo.end - videoTimingInfo.start : 0; - return Math.max(audioDuration, videoDuration); -}; -var segmentTooLong = function segmentTooLong(_ref3) { - var segmentDuration = _ref3.segmentDuration, - maxDuration = _ref3.maxDuration; - - // 0 duration segments are most likely due to metadata only segments or a lack of - // information. - if (!segmentDuration) { - return false; - } // For HLS: - // - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1 - // The EXTINF duration of each Media Segment in the Playlist - // file, when rounded to the nearest integer, MUST be less than or equal - // to the target duration; longer segments can trigger playback stalls - // or other errors. - // - // For DASH, the mpd-parser uses the largest reported segment duration as the target - // duration. Although that reported duration is occasionally approximate (i.e., not - // exact), a strict check may report that a segment is too long more often in DASH. - - - return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR; -}; -var getTroublesomeSegmentDurationMessage = function getTroublesomeSegmentDurationMessage(segmentInfo, sourceType) { - // Right now we aren't following DASH's timing model exactly, so only perform - // this check for HLS content. - if (sourceType !== 'hls') { - return null; - } - - var segmentDuration = mediaDuration(segmentInfo.audioTimingInfo, segmentInfo.videoTimingInfo); // Don't report if we lack information. - // - // If the segment has a duration of 0 it is either a lack of information or a - // metadata only segment and shouldn't be reported here. - - if (!segmentDuration) { - return null; - } - - var targetDuration = segmentInfo.playlist.targetDuration; - var isSegmentWayTooLong = segmentTooLong({ - segmentDuration: segmentDuration, - maxDuration: targetDuration * 2 - }); - var isSegmentSlightlyTooLong = segmentTooLong({ - segmentDuration: segmentDuration, - maxDuration: targetDuration - }); - var segmentTooLongMessage = "Segment with index " + segmentInfo.mediaIndex + " " + ("from playlist " + segmentInfo.playlist.id + " ") + ("has a duration of " + segmentDuration + " ") + ("when the reported duration is " + segmentInfo.duration + " ") + ("and the target duration is " + targetDuration + ". ") + 'For HLS content, a duration in excess of the target duration may result in ' + 'playback issues. See the HLS specification section on EXT-X-TARGETDURATION for ' + 'more details: ' + 'https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1'; - - if (isSegmentWayTooLong || isSegmentSlightlyTooLong) { - return { - severity: isSegmentWayTooLong ? 'warn' : 'info', - message: segmentTooLongMessage - }; - } - - return null; -}; -/** - * An object that manages segment loading and appending. - * - * @class SegmentLoader - * @param {Object} options required and optional options - * @extends videojs.EventTarget - */ - -var SegmentLoader = /*#__PURE__*/function (_videojs$EventTarget) { - _inheritsLoose(SegmentLoader, _videojs$EventTarget); - - function SegmentLoader(settings, options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; // check pre-conditions - - if (!settings) { - throw new TypeError('Initialization settings are required'); - } - - if (typeof settings.currentTime !== 'function') { - throw new TypeError('No currentTime getter specified'); - } - - if (!settings.mediaSource) { - throw new TypeError('No MediaSource specified'); - } // public properties - - - _this.bandwidth = settings.bandwidth; - _this.throughput = { - rate: 0, - count: 0 - }; - _this.roundTrip = NaN; - - _this.resetStats_(); - - _this.mediaIndex = null; - _this.partIndex = null; // private settings - - _this.hasPlayed_ = settings.hasPlayed; - _this.currentTime_ = settings.currentTime; - _this.seekable_ = settings.seekable; - _this.seeking_ = settings.seeking; - _this.duration_ = settings.duration; - _this.mediaSource_ = settings.mediaSource; - _this.vhs_ = settings.vhs; - _this.loaderType_ = settings.loaderType; - _this.currentMediaInfo_ = void 0; - _this.startingMediaInfo_ = void 0; - _this.segmentMetadataTrack_ = settings.segmentMetadataTrack; - _this.goalBufferLength_ = settings.goalBufferLength; - _this.sourceType_ = settings.sourceType; - _this.sourceUpdater_ = settings.sourceUpdater; - _this.inbandTextTracks_ = settings.inbandTextTracks; - _this.state_ = 'INIT'; - _this.timelineChangeController_ = settings.timelineChangeController; - _this.shouldSaveSegmentTimingInfo_ = true; - _this.parse708captions_ = settings.parse708captions; // private instance variables - - _this.checkBufferTimeout_ = null; - _this.error_ = void 0; - _this.currentTimeline_ = -1; - _this.pendingSegment_ = null; - _this.xhrOptions_ = null; - _this.pendingSegments_ = []; - _this.audioDisabled_ = false; - _this.isPendingTimestampOffset_ = false; // TODO possibly move gopBuffer and timeMapping info to a separate controller - - _this.gopBuffer_ = []; - _this.timeMapping_ = 0; - _this.safeAppend_ = videojs.browser.IE_VERSION >= 11; - _this.appendInitSegment_ = { - audio: true, - video: true - }; - _this.playlistOfLastInitSegment_ = { - audio: null, - video: null - }; - _this.callQueue_ = []; // If the segment loader prepares to load a segment, but does not have enough - // information yet to start the loading process (e.g., if the audio loader wants to - // load a segment from the next timeline but the main loader hasn't yet crossed that - // timeline), then the load call will be added to the queue until it is ready to be - // processed. - - _this.loadQueue_ = []; - _this.metadataQueue_ = { - id3: [], - caption: [] - }; - _this.waitingOnRemove_ = false; - _this.quotaExceededErrorRetryTimeout_ = null; // Fragmented mp4 playback - - _this.activeInitSegmentId_ = null; - _this.initSegments_ = {}; // HLSe playback - - _this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys; - _this.keyCache_ = {}; - _this.decrypter_ = settings.decrypter; // Manages the tracking and generation of sync-points, mappings - // between a time in the display time and a segment index within - // a playlist - - _this.syncController_ = settings.syncController; - _this.syncPoint_ = { - segmentIndex: 0, - time: 0 - }; - _this.transmuxer_ = _this.createTransmuxer_(); - - _this.triggerSyncInfoUpdate_ = function () { - return _this.trigger('syncinfoupdate'); - }; - - _this.syncController_.on('syncinfoupdate', _this.triggerSyncInfoUpdate_); - - _this.mediaSource_.addEventListener('sourceopen', function () { - if (!_this.isEndOfStream_()) { - _this.ended_ = false; - } - }); // ...for determining the fetch location - - - _this.fetchAtBuffer_ = false; - _this.logger_ = logger("SegmentLoader[" + _this.loaderType_ + "]"); - Object.defineProperty(_assertThisInitialized(_this), 'state', { - get: function get() { - return this.state_; - }, - set: function set(newState) { - if (newState !== this.state_) { - this.logger_(this.state_ + " -> " + newState); - this.state_ = newState; - this.trigger('statechange'); - } - } - }); - - _this.sourceUpdater_.on('ready', function () { - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); // Only the main loader needs to listen for pending timeline changes, as the main - // loader should wait for audio to be ready to change its timeline so that both main - // and audio timelines change together. For more details, see the - // shouldWaitForTimelineChange function. - - - if (_this.loaderType_ === 'main') { - _this.timelineChangeController_.on('pendingtimelinechange', function () { - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); - } // The main loader only listens on pending timeline changes, but the audio loader, - // since its loads follow main, needs to listen on timeline changes. For more details, - // see the shouldWaitForTimelineChange function. - - - if (_this.loaderType_ === 'audio') { - _this.timelineChangeController_.on('timelinechange', function () { - if (_this.hasEnoughInfoToLoad_()) { - _this.processLoadQueue_(); - } - - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); - } - - return _this; - } - - var _proto = SegmentLoader.prototype; - - _proto.createTransmuxer_ = function createTransmuxer_() { - return segmentTransmuxer.createTransmuxer({ - remux: false, - alignGopsAtEnd: this.safeAppend_, - keepOriginalTimestamps: true, - parse708captions: this.parse708captions_ - }); - } - /** - * reset all of our media stats - * - * @private - */ - ; - - _proto.resetStats_ = function resetStats_() { - this.mediaBytesTransferred = 0; - this.mediaRequests = 0; - this.mediaRequestsAborted = 0; - this.mediaRequestsTimedout = 0; - this.mediaRequestsErrored = 0; - this.mediaTransferDuration = 0; - this.mediaSecondsLoaded = 0; - this.mediaAppends = 0; - } - /** - * dispose of the SegmentLoader and reset to the default state - */ - ; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.state = 'DISPOSED'; - this.pause(); - this.abort_(); - - if (this.transmuxer_) { - this.transmuxer_.terminate(); - } - - this.resetStats_(); - - if (this.checkBufferTimeout_) { - window.clearTimeout(this.checkBufferTimeout_); - } - - if (this.syncController_ && this.triggerSyncInfoUpdate_) { - this.syncController_.off('syncinfoupdate', this.triggerSyncInfoUpdate_); - } - - this.off(); - }; - - _proto.setAudio = function setAudio(enable) { - this.audioDisabled_ = !enable; - - if (enable) { - this.appendInitSegment_.audio = true; - } else { - // remove current track audio if it gets disabled - this.sourceUpdater_.removeAudio(0, this.duration_()); - } - } - /** - * abort anything that is currently doing on with the SegmentLoader - * and reset to a default state - */ - ; - - _proto.abort = function abort() { - if (this.state !== 'WAITING') { - if (this.pendingSegment_) { - this.pendingSegment_ = null; - } - - return; - } - - this.abort_(); // We aborted the requests we were waiting on, so reset the loader's state to READY - // since we are no longer "waiting" on any requests. XHR callback is not always run - // when the request is aborted. This will prevent the loader from being stuck in the - // WAITING state indefinitely. - - this.state = 'READY'; // don't wait for buffer check timeouts to begin fetching the - // next segment - - if (!this.paused()) { - this.monitorBuffer_(); - } - } - /** - * abort all pending xhr requests and null any pending segements - * - * @private - */ - ; - - _proto.abort_ = function abort_() { - if (this.pendingSegment_ && this.pendingSegment_.abortRequests) { - this.pendingSegment_.abortRequests(); - } // clear out the segment being processed - - - this.pendingSegment_ = null; - this.callQueue_ = []; - this.loadQueue_ = []; - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_); - this.waitingOnRemove_ = false; - window.clearTimeout(this.quotaExceededErrorRetryTimeout_); - this.quotaExceededErrorRetryTimeout_ = null; - }; - - _proto.checkForAbort_ = function checkForAbort_(requestId) { - // If the state is APPENDING, then aborts will not modify the state, meaning the first - // callback that happens should reset the state to READY so that loading can continue. - if (this.state === 'APPENDING' && !this.pendingSegment_) { - this.state = 'READY'; - return true; - } - - if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) { - return true; - } - - return false; - } - /** - * set an error on the segment loader and null out any pending segements - * - * @param {Error} error the error to set on the SegmentLoader - * @return {Error} the error that was set or that is currently set - */ - ; - - _proto.error = function error(_error) { - if (typeof _error !== 'undefined') { - this.logger_('error occurred:', _error); - this.error_ = _error; - } - - this.pendingSegment_ = null; - return this.error_; - }; - - _proto.endOfStream = function endOfStream() { - this.ended_ = true; - - if (this.transmuxer_) { - // need to clear out any cached data to prepare for the new segment - segmentTransmuxer.reset(this.transmuxer_); - } - - this.gopBuffer_.length = 0; - this.pause(); - this.trigger('ended'); - } - /** - * Indicates which time ranges are buffered - * - * @return {TimeRange} - * TimeRange object representing the current buffered ranges - */ - ; - - _proto.buffered_ = function buffered_() { - if (!this.sourceUpdater_ || !this.startingMediaInfo_) { - return videojs.createTimeRanges(); - } - - if (this.loaderType_ === 'main') { - var _this$startingMediaIn = this.startingMediaInfo_, - hasAudio = _this$startingMediaIn.hasAudio, - hasVideo = _this$startingMediaIn.hasVideo, - isMuxed = _this$startingMediaIn.isMuxed; - - if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed) { - return this.sourceUpdater_.buffered(); - } - - if (hasVideo) { - return this.sourceUpdater_.videoBuffered(); - } - } // One case that can be ignored for now is audio only with alt audio, - // as we don't yet have proper support for that. - - - return this.sourceUpdater_.audioBuffered(); - } - /** - * Gets and sets init segment for the provided map - * - * @param {Object} map - * The map object representing the init segment to get or set - * @param {boolean=} set - * If true, the init segment for the provided map should be saved - * @return {Object} - * map object for desired init segment - */ - ; - - _proto.initSegmentForMap = function initSegmentForMap(map, set) { - if (set === void 0) { - set = false; - } - - if (!map) { - return null; - } - - var id = initSegmentId(map); - var storedMap = this.initSegments_[id]; - - if (set && !storedMap && map.bytes) { - this.initSegments_[id] = storedMap = { - resolvedUri: map.resolvedUri, - byterange: map.byterange, - bytes: map.bytes, - tracks: map.tracks, - timescales: map.timescales - }; - } - - return storedMap || map; - } - /** - * Gets and sets key for the provided key - * - * @param {Object} key - * The key object representing the key to get or set - * @param {boolean=} set - * If true, the key for the provided key should be saved - * @return {Object} - * Key object for desired key - */ - ; - - _proto.segmentKey = function segmentKey(key, set) { - if (set === void 0) { - set = false; - } - - if (!key) { - return null; - } - - var id = segmentKeyId(key); - var storedKey = this.keyCache_[id]; // TODO: We should use the HTTP Expires header to invalidate our cache per - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-6.2.3 - - if (this.cacheEncryptionKeys_ && set && !storedKey && key.bytes) { - this.keyCache_[id] = storedKey = { - resolvedUri: key.resolvedUri, - bytes: key.bytes - }; - } - - var result = { - resolvedUri: (storedKey || key).resolvedUri - }; - - if (storedKey) { - result.bytes = storedKey.bytes; - } - - return result; - } - /** - * Returns true if all configuration required for loading is present, otherwise false. - * - * @return {boolean} True if the all configuration is ready for loading - * @private - */ - ; - - _proto.couldBeginLoading_ = function couldBeginLoading_() { - return this.playlist_ && !this.paused(); - } - /** - * load a playlist and start to fill the buffer - */ - ; - - _proto.load = function load() { - // un-pause - this.monitorBuffer_(); // if we don't have a playlist yet, keep waiting for one to be - // specified - - if (!this.playlist_) { - return; - } // if all the configuration is ready, initialize and begin loading - - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - return this.init_(); - } // if we're in the middle of processing a segment already, don't - // kick off an additional segment request - - - if (!this.couldBeginLoading_() || this.state !== 'READY' && this.state !== 'INIT') { - return; - } - - this.state = 'READY'; - } - /** - * Once all the starting parameters have been specified, begin - * operation. This method should only be invoked from the INIT - * state. - * - * @private - */ - ; - - _proto.init_ = function init_() { - this.state = 'READY'; // if this is the audio segment loader, and it hasn't been inited before, then any old - // audio data from the muxed content should be removed - - this.resetEverything(); - return this.monitorBuffer_(); - } - /** - * set a playlist on the segment loader - * - * @param {PlaylistLoader} media the playlist to set on the segment loader - */ - ; - - _proto.playlist = function playlist(newPlaylist, options) { - if (options === void 0) { - options = {}; - } - - if (!newPlaylist) { - return; - } - - var oldPlaylist = this.playlist_; - var segmentInfo = this.pendingSegment_; - this.playlist_ = newPlaylist; - this.xhrOptions_ = options; // when we haven't started playing yet, the start of a live playlist - // is always our zero-time so force a sync update each time the playlist - // is refreshed from the server - // - // Use the INIT state to determine if playback has started, as the playlist sync info - // should be fixed once requests begin (as sync points are generated based on sync - // info), but not before then. - - if (this.state === 'INIT') { - newPlaylist.syncInfo = { - mediaSequence: newPlaylist.mediaSequence, - time: 0 - }; // Setting the date time mapping means mapping the program date time (if available) - // to time 0 on the player's timeline. The playlist's syncInfo serves a similar - // purpose, mapping the initial mediaSequence to time zero. Since the syncInfo can - // be updated as the playlist is refreshed before the loader starts loading, the - // program date time mapping needs to be updated as well. - // - // This mapping is only done for the main loader because a program date time should - // map equivalently between playlists. - - if (this.loaderType_ === 'main') { - this.syncController_.setDateTimeMappingForStart(newPlaylist); - } - } - - var oldId = null; - - if (oldPlaylist) { - if (oldPlaylist.id) { - oldId = oldPlaylist.id; - } else if (oldPlaylist.uri) { - oldId = oldPlaylist.uri; - } - } - - this.logger_("playlist update [" + oldId + " => " + (newPlaylist.id || newPlaylist.uri) + "]"); // in VOD, this is always a rendition switch (or we updated our syncInfo above) - // in LIVE, we always want to update with new playlists (including refreshes) - - this.trigger('syncinfoupdate'); // if we were unpaused but waiting for a playlist, start - // buffering now - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - return this.init_(); - } - - if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) { - if (this.mediaIndex !== null) { - // we must "resync" the segment loader when we switch renditions and - // the segment loader is already synced to the previous rendition - this.resyncLoader(); - } - - this.currentMediaInfo_ = void 0; - this.trigger('playlistupdate'); // the rest of this function depends on `oldPlaylist` being defined - - return; - } // we reloaded the same playlist so we are in a live scenario - // and we will likely need to adjust the mediaIndex - - - var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; - this.logger_("live window shift [" + mediaSequenceDiff + "]"); // update the mediaIndex on the SegmentLoader - // this is important because we can abort a request and this value must be - // equal to the last appended mediaIndex - - if (this.mediaIndex !== null) { - this.mediaIndex -= mediaSequenceDiff; // this can happen if we are going to load the first segment, but get a playlist - // update during that. mediaIndex would go from 0 to -1 if mediaSequence in the - // new playlist was incremented by 1. - - if (this.mediaIndex < 0) { - this.mediaIndex = null; - this.partIndex = null; - } else { - var segment = this.playlist_.segments[this.mediaIndex]; // partIndex should remain the same for the same segment - // unless parts fell off of the playlist for this segment. - // In that case we need to reset partIndex and resync - - if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) { - var mediaIndex = this.mediaIndex; - this.logger_("currently processing part (index " + this.partIndex + ") no longer exists."); - this.resetLoader(); // We want to throw away the partIndex and the data associated with it, - // as the part was dropped from our current playlists segment. - // The mediaIndex will still be valid so keep that around. - - this.mediaIndex = mediaIndex; - } - } - } // update the mediaIndex on the SegmentInfo object - // this is important because we will update this.mediaIndex with this value - // in `handleAppendsDone_` after the segment has been successfully appended - - - if (segmentInfo) { - segmentInfo.mediaIndex -= mediaSequenceDiff; - - if (segmentInfo.mediaIndex < 0) { - segmentInfo.mediaIndex = null; - segmentInfo.partIndex = null; - } else { - // we need to update the referenced segment so that timing information is - // saved for the new playlist's segment, however, if the segment fell off the - // playlist, we can leave the old reference and just lose the timing info - if (segmentInfo.mediaIndex >= 0) { - segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex]; - } - - if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) { - segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex]; - } - } - } - - this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist); - } - /** - * Prevent the loader from fetching additional segments. If there - * is a segment request outstanding, it will finish processing - * before the loader halts. A segment loader can be unpaused by - * calling load(). - */ - ; - - _proto.pause = function pause() { - if (this.checkBufferTimeout_) { - window.clearTimeout(this.checkBufferTimeout_); - this.checkBufferTimeout_ = null; - } - } - /** - * Returns whether the segment loader is fetching additional - * segments when given the opportunity. This property can be - * modified through calls to pause() and load(). - */ - ; - - _proto.paused = function paused() { - return this.checkBufferTimeout_ === null; - } - /** - * Delete all the buffered data and reset the SegmentLoader - * - * @param {Function} [done] an optional callback to be executed when the remove - * operation is complete - */ - ; - - _proto.resetEverything = function resetEverything(done) { - this.ended_ = false; - this.appendInitSegment_ = { - audio: true, - video: true - }; - this.resetLoader(); // remove from 0, the earliest point, to Infinity, to signify removal of everything. - // VTT Segment Loader doesn't need to do anything but in the regular SegmentLoader, - // we then clamp the value to duration if necessary. - - this.remove(0, Infinity, done); // clears fmp4 captions - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearAllMp4Captions' - }); - } - } - /** - * Force the SegmentLoader to resync and start loading around the currentTime instead - * of starting at the end of the buffer - * - * Useful for fast quality changes - */ - ; - - _proto.resetLoader = function resetLoader() { - this.fetchAtBuffer_ = false; - this.resyncLoader(); - } - /** - * Force the SegmentLoader to restart synchronization and make a conservative guess - * before returning to the simple walk-forward method - */ - ; - - _proto.resyncLoader = function resyncLoader() { - if (this.transmuxer_) { - // need to clear out any cached data to prepare for the new segment - segmentTransmuxer.reset(this.transmuxer_); - } - - this.mediaIndex = null; - this.partIndex = null; - this.syncPoint_ = null; - this.isPendingTimestampOffset_ = false; - this.callQueue_ = []; - this.loadQueue_ = []; - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - this.abort(); - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearParsedMp4Captions' - }); - } - } - /** - * Remove any data in the source buffer between start and end times - * - * @param {number} start - the start time of the region to remove from the buffer - * @param {number} end - the end time of the region to remove from the buffer - * @param {Function} [done] - an optional callback to be executed when the remove - * @param {boolean} force - force all remove operations to happen - * operation is complete - */ - ; - - _proto.remove = function remove(start, end, done, force) { - if (done === void 0) { - done = function done() {}; - } - - if (force === void 0) { - force = false; - } - - // clamp end to duration if we need to remove everything. - // This is due to a browser bug that causes issues if we remove to Infinity. - // videojs/videojs-contrib-hls#1225 - if (end === Infinity) { - end = this.duration_(); - } // skip removes that would throw an error - // commonly happens during a rendition switch at the start of a video - // from start 0 to end 0 - - - if (end <= start) { - this.logger_('skipping remove because end ${end} is <= start ${start}'); - return; - } - - if (!this.sourceUpdater_ || !this.startingMediaInfo_) { - this.logger_('skipping remove because no source updater or starting media info'); // nothing to remove if we haven't processed any media - - return; - } // set it to one to complete this function's removes - - - var removesRemaining = 1; - - var removeFinished = function removeFinished() { - removesRemaining--; - - if (removesRemaining === 0) { - done(); - } - }; - - if (force || !this.audioDisabled_) { - removesRemaining++; - this.sourceUpdater_.removeAudio(start, end, removeFinished); - } // While it would be better to only remove video if the main loader has video, this - // should be safe with audio only as removeVideo will call back even if there's no - // video buffer. - // - // In theory we can check to see if there's video before calling the remove, but in - // the event that we're switching between renditions and from video to audio only - // (when we add support for that), we may need to clear the video contents despite - // what the new media will contain. - - - if (force || this.loaderType_ === 'main') { - this.gopBuffer_ = removeGopBuffer(this.gopBuffer_, start, end, this.timeMapping_); - removesRemaining++; - this.sourceUpdater_.removeVideo(start, end, removeFinished); - } // remove any captions and ID3 tags - - - for (var track in this.inbandTextTracks_) { - removeCuesFromTrack(start, end, this.inbandTextTracks_[track]); - } - - removeCuesFromTrack(start, end, this.segmentMetadataTrack_); // finished this function's removes - - removeFinished(); - } - /** - * (re-)schedule monitorBufferTick_ to run as soon as possible - * - * @private - */ - ; - - _proto.monitorBuffer_ = function monitorBuffer_() { - if (this.checkBufferTimeout_) { - window.clearTimeout(this.checkBufferTimeout_); - } - - this.checkBufferTimeout_ = window.setTimeout(this.monitorBufferTick_.bind(this), 1); - } - /** - * As long as the SegmentLoader is in the READY state, periodically - * invoke fillBuffer_(). - * - * @private - */ - ; - - _proto.monitorBufferTick_ = function monitorBufferTick_() { - if (this.state === 'READY') { - this.fillBuffer_(); - } - - if (this.checkBufferTimeout_) { - window.clearTimeout(this.checkBufferTimeout_); - } - - this.checkBufferTimeout_ = window.setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY); - } - /** - * fill the buffer with segements unless the sourceBuffers are - * currently updating - * - * Note: this function should only ever be called by monitorBuffer_ - * and never directly - * - * @private - */ - ; - - _proto.fillBuffer_ = function fillBuffer_() { - // TODO since the source buffer maintains a queue, and we shouldn't call this function - // except when we're ready for the next segment, this check can most likely be removed - if (this.sourceUpdater_.updating()) { - return; - } // see if we need to begin loading immediately - - - var segmentInfo = this.chooseNextRequest_(); - - if (!segmentInfo) { - return; - } - - if (typeof segmentInfo.timestampOffset === 'number') { - this.isPendingTimestampOffset_ = false; - this.timelineChangeController_.pendingTimelineChange({ - type: this.loaderType_, - from: this.currentTimeline_, - to: segmentInfo.timeline - }); - } - - this.loadSegment_(segmentInfo); - } - /** - * Determines if we should call endOfStream on the media source based - * on the state of the buffer or if appened segment was the final - * segment in the playlist. - * - * @param {number} [mediaIndex] the media index of segment we last appended - * @param {Object} [playlist] a media playlist object - * @return {boolean} do we need to call endOfStream on the MediaSource - */ - ; - - _proto.isEndOfStream_ = function isEndOfStream_(mediaIndex, playlist, partIndex) { - if (mediaIndex === void 0) { - mediaIndex = this.mediaIndex; - } - - if (playlist === void 0) { - playlist = this.playlist_; - } - - if (partIndex === void 0) { - partIndex = this.partIndex; - } - - if (!playlist || !this.mediaSource_) { - return false; - } - - var segment = typeof mediaIndex === 'number' && playlist.segments[mediaIndex]; // mediaIndex is zero based but length is 1 based - - var appendedLastSegment = mediaIndex + 1 === playlist.segments.length; // true if there are no parts, or this is the last part. - - var appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length; // if we've buffered to the end of the video, we need to call endOfStream - // so that MediaSources can trigger the `ended` event when it runs out of - // buffered data instead of waiting for me - - return playlist.endList && this.mediaSource_.readyState === 'open' && appendedLastSegment && appendedLastPart; - } - /** - * Determines what request should be made given current segment loader state. - * - * @return {Object} a request object that describes the segment/part to load - */ - ; - - _proto.chooseNextRequest_ = function chooseNextRequest_() { - var bufferedEnd = lastBufferedEnd(this.buffered_()) || 0; - var bufferedTime = Math.max(0, bufferedEnd - this.currentTime_()); - var preloaded = !this.hasPlayed_() && bufferedTime >= 1; - var haveEnoughBuffer = bufferedTime >= this.goalBufferLength_(); - var segments = this.playlist_.segments; // return no segment if: - // 1. we don't have segments - // 2. The video has not yet played and we already downloaded a segment - // 3. we already have enough buffered time - - if (!segments.length || preloaded || haveEnoughBuffer) { - return null; - } - - this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_()); - var next = { - partIndex: null, - mediaIndex: null, - startOfSegment: null, - playlist: this.playlist_, - isSyncRequest: Boolean(!this.syncPoint_) - }; - - if (next.isSyncRequest) { - next.mediaIndex = getSyncSegmentCandidate(this.currentTimeline_, segments, bufferedEnd); - } else if (this.mediaIndex !== null) { - var segment = segments[this.mediaIndex]; - var partIndex = typeof this.partIndex === 'number' ? this.partIndex : -1; - next.startOfSegment = segment.end ? segment.end : bufferedEnd; - - if (segment.parts && segment.parts[partIndex + 1]) { - next.mediaIndex = this.mediaIndex; - next.partIndex = partIndex + 1; - } else { - next.mediaIndex = this.mediaIndex + 1; - } - } else { - // Find the segment containing the end of the buffer or current time. - var _Playlist$getMediaInf = Playlist.getMediaInfoForTime({ - playlist: this.playlist_, - currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(), - startingPartIndex: this.syncPoint_.partIndex, - startingSegmentIndex: this.syncPoint_.segmentIndex, - startTime: this.syncPoint_.time - }), - segmentIndex = _Playlist$getMediaInf.segmentIndex, - startTime = _Playlist$getMediaInf.startTime, - _partIndex = _Playlist$getMediaInf.partIndex; - - next.getMediaInfoForTime = this.fetchAtBuffer_ ? 'bufferedEnd' : 'currentTime'; - next.mediaIndex = segmentIndex; - next.startOfSegment = startTime; - next.partIndex = _partIndex; - } - - var nextSegment = segments[next.mediaIndex]; - var nextPart = nextSegment && typeof next.partIndex === 'number' && nextSegment.parts && nextSegment.parts[next.partIndex]; // if the next segment index is invalid or - // the next partIndex is invalid do not choose a next segment. - - if (!nextSegment || typeof next.partIndex === 'number' && !nextPart) { - return null; - } // if the next segment has parts, and we don't have a partIndex. - // Set partIndex to 0 - - - if (typeof next.partIndex !== 'number' && nextSegment.parts) { - next.partIndex = 0; - } - - var ended = this.mediaSource_ && this.mediaSource_.readyState === 'ended'; // do not choose a next segment if all of the following: - // 1. this is the last segment in the playlist - // 2. end of stream has been called on the media source already - // 3. the player is not seeking - - if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) { - return null; - } - - return this.generateSegmentInfo_(next); - }; - - _proto.generateSegmentInfo_ = function generateSegmentInfo_(options) { - var playlist = options.playlist, - mediaIndex = options.mediaIndex, - startOfSegment = options.startOfSegment, - isSyncRequest = options.isSyncRequest, - partIndex = options.partIndex, - forceTimestampOffset = options.forceTimestampOffset, - getMediaInfoForTime = options.getMediaInfoForTime; - var segment = playlist.segments[mediaIndex]; - var part = typeof partIndex === 'number' && segment.parts[partIndex]; - var segmentInfo = { - requestId: 'segment-loader-' + Math.random(), - // resolve the segment URL relative to the playlist - uri: part && part.resolvedUri || segment.resolvedUri, - // the segment's mediaIndex at the time it was requested - mediaIndex: mediaIndex, - partIndex: part ? partIndex : null, - // whether or not to update the SegmentLoader's state with this - // segment's mediaIndex - isSyncRequest: isSyncRequest, - startOfSegment: startOfSegment, - // the segment's playlist - playlist: playlist, - // unencrypted bytes of the segment - bytes: null, - // when a key is defined for this segment, the encrypted bytes - encryptedBytes: null, - // The target timestampOffset for this segment when we append it - // to the source buffer - timestampOffset: null, - // The timeline that the segment is in - timeline: segment.timeline, - // The expected duration of the segment in seconds - duration: part && part.duration || segment.duration, - // retain the segment in case the playlist updates while doing an async process - segment: segment, - part: part, - byteLength: 0, - transmuxer: this.transmuxer_, - // type of getMediaInfoForTime that was used to get this segment - getMediaInfoForTime: getMediaInfoForTime - }; - var overrideCheck = typeof forceTimestampOffset !== 'undefined' ? forceTimestampOffset : this.isPendingTimestampOffset_; - segmentInfo.timestampOffset = this.timestampOffsetForSegment_({ - segmentTimeline: segment.timeline, - currentTimeline: this.currentTimeline_, - startOfSegment: startOfSegment, - buffered: this.buffered_(), - overrideCheck: overrideCheck - }); - var audioBufferedEnd = lastBufferedEnd(this.sourceUpdater_.audioBuffered()); - - if (typeof audioBufferedEnd === 'number') { - // since the transmuxer is using the actual timing values, but the buffer is - // adjusted by the timestamp offset, we must adjust the value here - segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset(); - } - - if (this.sourceUpdater_.videoBuffered().length) { - segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(this.gopBuffer_, // since the transmuxer is using the actual timing values, but the time is - // adjusted by the timestmap offset, we must adjust the value here - this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(), this.timeMapping_); - } - - return segmentInfo; - } // get the timestampoffset for a segment, - // added so that vtt segment loader can override and prevent - // adding timestamp offsets. - ; - - _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_(options) { - return timestampOffsetForSegment(options); - } - /** - * Determines if the network has enough bandwidth to complete the current segment - * request in a timely manner. If not, the request will be aborted early and bandwidth - * updated to trigger a playlist switch. - * - * @param {Object} stats - * Object containing stats about the request timing and size - * @private - */ - ; - - _proto.earlyAbortWhenNeeded_ = function earlyAbortWhenNeeded_(stats) { - if (this.vhs_.tech_.paused() || // Don't abort if the current playlist is on the lowestEnabledRendition - // TODO: Replace using timeout with a boolean indicating whether this playlist is - // the lowestEnabledRendition. - !this.xhrOptions_.timeout || // Don't abort if we have no bandwidth information to estimate segment sizes - !this.playlist_.attributes.BANDWIDTH) { - return; - } // Wait at least 1 second since the first byte of data has been received before - // using the calculated bandwidth from the progress event to allow the bitrate - // to stabilize - - - if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1000) { - return; - } - - var currentTime = this.currentTime_(); - var measuredBandwidth = stats.bandwidth; - var segmentDuration = this.pendingSegment_.duration; - var requestTimeRemaining = Playlist.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived); // Subtract 1 from the timeUntilRebuffer so we still consider an early abort - // if we are only left with less than 1 second when the request completes. - // A negative timeUntilRebuffering indicates we are already rebuffering - - var timeUntilRebuffer$1 = timeUntilRebuffer(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1; // Only consider aborting early if the estimated time to finish the download - // is larger than the estimated time until the player runs out of forward buffer - - if (requestTimeRemaining <= timeUntilRebuffer$1) { - return; - } - - var switchCandidate = minRebufferMaxBandwidthSelector({ - master: this.vhs_.playlists.master, - currentTime: currentTime, - bandwidth: measuredBandwidth, - duration: this.duration_(), - segmentDuration: segmentDuration, - timeUntilRebuffer: timeUntilRebuffer$1, - currentTimeline: this.currentTimeline_, - syncController: this.syncController_ - }); - - if (!switchCandidate) { - return; - } - - var rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$1; - var timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact; - var minimumTimeSaving = 0.5; // If we are already rebuffering, increase the amount of variance we add to the - // potential round trip time of the new request so that we are not too aggressive - // with switching to a playlist that might save us a fraction of a second. - - if (timeUntilRebuffer$1 <= TIME_FUDGE_FACTOR) { - minimumTimeSaving = 1; - } - - if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) { - return; - } // set the bandwidth to that of the desired playlist being sure to scale by - // BANDWIDTH_VARIANCE and add one so the playlist selector does not exclude it - // don't trigger a bandwidthupdate as the bandwidth is artifial - - - this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config.BANDWIDTH_VARIANCE + 1; - this.trigger('earlyabort'); - }; - - _proto.handleAbort_ = function handleAbort_(segmentInfo) { - this.logger_("Aborting " + segmentInfoString(segmentInfo)); - this.mediaRequestsAborted += 1; - } - /** - * XHR `progress` event handler - * - * @param {Event} - * The XHR `progress` event - * @param {Object} simpleSegment - * A simplified segment object copy - * @private - */ - ; - - _proto.handleProgress_ = function handleProgress_(event, simpleSegment) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - this.trigger('progress'); - }; - - _proto.handleTrackInfo_ = function handleTrackInfo_(simpleSegment, trackInfo) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - if (this.checkForIllegalMediaSwitch(trackInfo)) { - return; - } - - trackInfo = trackInfo || {}; // When we have track info, determine what media types this loader is dealing with. - // Guard against cases where we're not getting track info at all until we are - // certain that all streams will provide it. - - if (!shallowEqual(this.currentMediaInfo_, trackInfo)) { - this.appendInitSegment_ = { - audio: true, - video: true - }; - this.startingMediaInfo_ = trackInfo; - this.currentMediaInfo_ = trackInfo; - this.logger_('trackinfo update', trackInfo); - this.trigger('trackinfo'); - } // trackinfo may cause an abort if the trackinfo - // causes a codec change to an unsupported codec. - - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // set trackinfo on the pending segment so that - // it can append. - - - this.pendingSegment_.trackInfo = trackInfo; // check if any calls were waiting on the track info - - if (this.hasEnoughInfoToAppend_()) { - this.processCallQueue_(); - } - }; - - _proto.handleTimingInfo_ = function handleTimingInfo_(simpleSegment, mediaType, timeType, time) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - var segmentInfo = this.pendingSegment_; - var timingInfoProperty = timingInfoPropertyForMedia(mediaType); - segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {}; - segmentInfo[timingInfoProperty][timeType] = time; - this.logger_("timinginfo: " + mediaType + " - " + timeType + " - " + time); // check if any calls were waiting on the timing info - - if (this.hasEnoughInfoToAppend_()) { - this.processCallQueue_(); - } - }; - - _proto.handleCaptions_ = function handleCaptions_(simpleSegment, captionData) { - var _this2 = this; - - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // This could only happen with fmp4 segments, but - // should still not happen in general - - - if (captionData.length === 0) { - this.logger_('SegmentLoader received no captions from a caption event'); - return; - } - - var segmentInfo = this.pendingSegment_; // Wait until we have some video data so that caption timing - // can be adjusted by the timestamp offset - - if (!segmentInfo.hasAppendedData_) { - this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData)); - return; - } - - var timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset(); - var captionTracks = {}; // get total start/end and captions for each track/stream - - captionData.forEach(function (caption) { - // caption.stream is actually a track name... - // set to the existing values in tracks or default values - captionTracks[caption.stream] = captionTracks[caption.stream] || { - // Infinity, as any other value will be less than this - startTime: Infinity, - captions: [], - // 0 as an other value will be more than this - endTime: 0 - }; - var captionTrack = captionTracks[caption.stream]; - captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset); - captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset); - captionTrack.captions.push(caption); - }); - Object.keys(captionTracks).forEach(function (trackName) { - var _captionTracks$trackN = captionTracks[trackName], - startTime = _captionTracks$trackN.startTime, - endTime = _captionTracks$trackN.endTime, - captions = _captionTracks$trackN.captions; - var inbandTextTracks = _this2.inbandTextTracks_; - - _this2.logger_("adding cues from " + startTime + " -> " + endTime + " for " + trackName); - - createCaptionsTrackIfNotExists(inbandTextTracks, _this2.vhs_.tech_, trackName); // clear out any cues that start and end at the same time period for the same track. - // We do this because a rendition change that also changes the timescale for captions - // will result in captions being re-parsed for certain segments. If we add them again - // without clearing we will have two of the same captions visible. - - removeCuesFromTrack(startTime, endTime, inbandTextTracks[trackName]); - addCaptionData({ - captionArray: captions, - inbandTextTracks: inbandTextTracks, - timestampOffset: timestampOffset - }); - }); // Reset stored captions since we added parsed - // captions to a text track at this point - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearParsedMp4Captions' - }); - } - }; - - _proto.handleId3_ = function handleId3_(simpleSegment, id3Frames, dispatchType) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - var segmentInfo = this.pendingSegment_; // we need to have appended data in order for the timestamp offset to be set - - if (!segmentInfo.hasAppendedData_) { - this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType)); - return; - } - - var timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset(); // There's potentially an issue where we could double add metadata if there's a muxed - // audio/video source with a metadata track, and an alt audio with a metadata track. - // However, this probably won't happen, and if it does it can be handled then. - - createMetadataTrackIfNotExists(this.inbandTextTracks_, dispatchType, this.vhs_.tech_); - addMetadata({ - inbandTextTracks: this.inbandTextTracks_, - metadataArray: id3Frames, - timestampOffset: timestampOffset, - videoDuration: this.duration_() - }); - }; - - _proto.processMetadataQueue_ = function processMetadataQueue_() { - this.metadataQueue_.id3.forEach(function (fn) { - return fn(); - }); - this.metadataQueue_.caption.forEach(function (fn) { - return fn(); - }); - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - }; - - _proto.processCallQueue_ = function processCallQueue_() { - var callQueue = this.callQueue_; // Clear out the queue before the queued functions are run, since some of the - // functions may check the length of the load queue and default to pushing themselves - // back onto the queue. - - this.callQueue_ = []; - callQueue.forEach(function (fun) { - return fun(); - }); - }; - - _proto.processLoadQueue_ = function processLoadQueue_() { - var loadQueue = this.loadQueue_; // Clear out the queue before the queued functions are run, since some of the - // functions may check the length of the load queue and default to pushing themselves - // back onto the queue. - - this.loadQueue_ = []; - loadQueue.forEach(function (fun) { - return fun(); - }); - } - /** - * Determines whether the loader has enough info to load the next segment. - * - * @return {boolean} - * Whether or not the loader has enough info to load the next segment - */ - ; - - _proto.hasEnoughInfoToLoad_ = function hasEnoughInfoToLoad_() { - // Since primary timing goes by video, only the audio loader potentially needs to wait - // to load. - if (this.loaderType_ !== 'audio') { - return true; - } - - var segmentInfo = this.pendingSegment_; // A fill buffer must have already run to establish a pending segment before there's - // enough info to load. - - if (!segmentInfo) { - return false; - } // The first segment can and should be loaded immediately so that source buffers are - // created together (before appending). Source buffer creation uses the presence of - // audio and video data to determine whether to create audio/video source buffers, and - // uses processed (transmuxed or parsed) media to determine the types required. - - - if (!this.currentMediaInfo_) { - return true; - } - - if ( // Technically, instead of waiting to load a segment on timeline changes, a segment - // can be requested and downloaded and only wait before it is transmuxed or parsed. - // But in practice, there are a few reasons why it is better to wait until a loader - // is ready to append that segment before requesting and downloading: - // - // 1. Because audio and main loaders cross discontinuities together, if this loader - // is waiting for the other to catch up, then instead of requesting another - // segment and using up more bandwidth, by not yet loading, more bandwidth is - // allotted to the loader currently behind. - // 2. media-segment-request doesn't have to have logic to consider whether a segment - // is ready to be processed or not, isolating the queueing behavior to the loader. - // 3. The audio loader bases some of its segment properties on timing information - // provided by the main loader, meaning that, if the logic for waiting on - // processing was in media-segment-request, then it would also need to know how - // to re-generate the segment information after the main loader caught up. - shouldWaitForTimelineChange({ - timelineChangeController: this.timelineChangeController_, - currentTimeline: this.currentTimeline_, - segmentTimeline: segmentInfo.timeline, - loaderType: this.loaderType_, - audioDisabled: this.audioDisabled_ - })) { - return false; - } - - return true; - }; - - _proto.hasEnoughInfoToAppend_ = function hasEnoughInfoToAppend_() { - if (!this.sourceUpdater_.ready()) { - return false; - } // If content needs to be removed or the loader is waiting on an append reattempt, - // then no additional content should be appended until the prior append is resolved. - - - if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) { - return false; - } - - var segmentInfo = this.pendingSegment_; // no segment to append any data for or - // we do not have information on this specific - // segment yet - - if (!segmentInfo || !segmentInfo.trackInfo) { - return false; - } - - var _this$currentMediaInf = this.currentMediaInfo_, - hasAudio = _this$currentMediaInf.hasAudio, - hasVideo = _this$currentMediaInf.hasVideo, - isMuxed = _this$currentMediaInf.isMuxed; - - if (hasVideo && !segmentInfo.videoTimingInfo) { - return false; - } // muxed content only relies on video timing information for now. - - - if (hasAudio && !this.audioDisabled_ && !isMuxed && !segmentInfo.audioTimingInfo) { - return false; - } - - if (shouldWaitForTimelineChange({ - timelineChangeController: this.timelineChangeController_, - currentTimeline: this.currentTimeline_, - segmentTimeline: segmentInfo.timeline, - loaderType: this.loaderType_, - audioDisabled: this.audioDisabled_ - })) { - return false; - } - - return true; - }; - - _proto.handleData_ = function handleData_(simpleSegment, result) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // If there's anything in the call queue, then this data came later and should be - // executed after the calls currently queued. - - - if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) { - this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result)); - return; - } - - var segmentInfo = this.pendingSegment_; // update the time mapping so we can translate from display time to media time - - this.setTimeMapping_(segmentInfo.timeline); // for tracking overall stats - - this.updateMediaSecondsLoaded_(segmentInfo.segment); // Note that the state isn't changed from loading to appending. This is because abort - // logic may change behavior depending on the state, and changing state too early may - // inflate our estimates of bandwidth. In the future this should be re-examined to - // note more granular states. - // don't process and append data if the mediaSource is closed - - if (this.mediaSource_.readyState === 'closed') { - return; - } // if this request included an initialization segment, save that data - // to the initSegment cache - - - if (simpleSegment.map) { - simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true); // move over init segment properties to media request - - segmentInfo.segment.map = simpleSegment.map; - } // if this request included a segment key, save that data in the cache - - - if (simpleSegment.key) { - this.segmentKey(simpleSegment.key, true); - } - - segmentInfo.isFmp4 = simpleSegment.isFmp4; - segmentInfo.timingInfo = segmentInfo.timingInfo || {}; - - if (segmentInfo.isFmp4) { - this.trigger('fmp4'); - segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia(result.type)].start; - } else { - var useVideoTimingInfo = this.loaderType_ === 'main' && this.currentMediaInfo_.hasVideo; - var firstVideoFrameTimeForData; - - if (useVideoTimingInfo) { - firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start; - } // Segment loader knows more about segment timing than the transmuxer (in certain - // aspects), so make any changes required for a more accurate start time. - // Don't set the end time yet, as the segment may not be finished processing. - - - segmentInfo.timingInfo.start = this.trueSegmentStart_({ - currentStart: segmentInfo.timingInfo.start, - playlist: segmentInfo.playlist, - mediaIndex: segmentInfo.mediaIndex, - currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(), - useVideoTimingInfo: useVideoTimingInfo, - firstVideoFrameTimeForData: firstVideoFrameTimeForData, - videoTimingInfo: segmentInfo.videoTimingInfo, - audioTimingInfo: segmentInfo.audioTimingInfo - }); - } // Init segments for audio and video only need to be appended in certain cases. Now - // that data is about to be appended, we can check the final cases to determine - // whether we should append an init segment. - - - this.updateAppendInitSegmentStatus(segmentInfo, result.type); // Timestamp offset should be updated once we get new data and have its timing info, - // as we use the start of the segment to offset the best guess (playlist provided) - // timestamp offset. - - this.updateSourceBufferTimestampOffset_(segmentInfo); // if this is a sync request we need to determine whether it should - // be appended or not. - - if (segmentInfo.isSyncRequest) { - // first save/update our timing info for this segment. - // this is what allows us to choose an accurate segment - // and the main reason we make a sync request. - this.updateTimingInfoEnd_(segmentInfo); - this.syncController_.saveSegmentTimingInfo({ - segmentInfo: segmentInfo, - shouldSaveTimelineMapping: this.loaderType_ === 'main' - }); - var next = this.chooseNextRequest_(); // If the sync request isn't the segment that would be requested next - // after taking into account its timing info, do not append it. - - if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) { - this.logger_('sync segment was incorrect, not appending'); - return; - } // otherwise append it like any other segment as our guess was correct. - - - this.logger_('sync segment was correct, appending'); - } // Save some state so that in the future anything waiting on first append (and/or - // timestamp offset(s)) can process immediately. While the extra state isn't optimal, - // we need some notion of whether the timestamp offset or other relevant information - // has had a chance to be set. - - - segmentInfo.hasAppendedData_ = true; // Now that the timestamp offset should be set, we can append any waiting ID3 tags. - - this.processMetadataQueue_(); - this.appendData_(segmentInfo, result); - }; - - _proto.updateAppendInitSegmentStatus = function updateAppendInitSegmentStatus(segmentInfo, type) { - // alt audio doesn't manage timestamp offset - if (this.loaderType_ === 'main' && typeof segmentInfo.timestampOffset === 'number' && // in the case that we're handling partial data, we don't want to append an init - // segment for each chunk - !segmentInfo.changedTimestampOffset) { - // if the timestamp offset changed, the timeline may have changed, so we have to re- - // append init segments - this.appendInitSegment_ = { - audio: true, - video: true - }; - } - - if (this.playlistOfLastInitSegment_[type] !== segmentInfo.playlist) { - // make sure we append init segment on playlist changes, in case the media config - // changed - this.appendInitSegment_[type] = true; - } - }; - - _proto.getInitSegmentAndUpdateState_ = function getInitSegmentAndUpdateState_(_ref4) { - var type = _ref4.type, - initSegment = _ref4.initSegment, - map = _ref4.map, - playlist = _ref4.playlist; - - // "The EXT-X-MAP tag specifies how to obtain the Media Initialization Section - // (Section 3) required to parse the applicable Media Segments. It applies to every - // Media Segment that appears after it in the Playlist until the next EXT-X-MAP tag - // or until the end of the playlist." - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.5 - if (map) { - var id = initSegmentId(map); - - if (this.activeInitSegmentId_ === id) { - // don't need to re-append the init segment if the ID matches - return null; - } // a map-specified init segment takes priority over any transmuxed (or otherwise - // obtained) init segment - // - // this also caches the init segment for later use - - - initSegment = this.initSegmentForMap(map, true).bytes; - this.activeInitSegmentId_ = id; - } // We used to always prepend init segments for video, however, that shouldn't be - // necessary. Instead, we should only append on changes, similar to what we've always - // done for audio. This is more important (though may not be that important) for - // frame-by-frame appending for LHLS, simply because of the increased quantity of - // appends. - - - if (initSegment && this.appendInitSegment_[type]) { - // Make sure we track the playlist that we last used for the init segment, so that - // we can re-append the init segment in the event that we get data from a new - // playlist. Discontinuities and track changes are handled in other sections. - this.playlistOfLastInitSegment_[type] = playlist; // Disable future init segment appends for this type. Until a change is necessary. - - this.appendInitSegment_[type] = false; // we need to clear out the fmp4 active init segment id, since - // we are appending the muxer init segment - - this.activeInitSegmentId_ = null; - return initSegment; - } - - return null; - }; - - _proto.handleQuotaExceededError_ = function handleQuotaExceededError_(_ref5, error) { - var _this3 = this; - - var segmentInfo = _ref5.segmentInfo, - type = _ref5.type, - bytes = _ref5.bytes; - var audioBuffered = this.sourceUpdater_.audioBuffered(); - var videoBuffered = this.sourceUpdater_.videoBuffered(); // For now we're ignoring any notion of gaps in the buffer, but they, in theory, - // should be cleared out during the buffer removals. However, log in case it helps - // debug. - - if (audioBuffered.length > 1) { - this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: ' + timeRangesToArray(audioBuffered).join(', ')); - } - - if (videoBuffered.length > 1) { - this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: ' + timeRangesToArray(videoBuffered).join(', ')); - } - - var audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0; - var audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0; - var videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0; - var videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0; - - if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER) { - // Can't remove enough buffer to make room for new segment (or the browser doesn't - // allow for appends of segments this size). In the future, it may be possible to - // split up the segment and append in pieces, but for now, error out this playlist - // in an attempt to switch to a more manageable rendition. - this.logger_('On QUOTA_EXCEEDED_ERR, single segment too large to append to ' + 'buffer, triggering an error. ' + ("Appended byte length: " + bytes.byteLength + ", ") + ("audio buffer: " + timeRangesToArray(audioBuffered).join(', ') + ", ") + ("video buffer: " + timeRangesToArray(videoBuffered).join(', ') + ", ")); - this.error({ - message: 'Quota exceeded error with append of a single segment of content', - excludeUntil: Infinity - }); - this.trigger('error'); - return; - } // To try to resolve the quota exceeded error, clear back buffer and retry. This means - // that the segment-loader should block on future events until this one is handled, so - // that it doesn't keep moving onto further segments. Adding the call to the call - // queue will prevent further appends until waitingOnRemove_ and - // quotaExceededErrorRetryTimeout_ are cleared. - // - // Note that this will only block the current loader. In the case of demuxed content, - // the other load may keep filling as fast as possible. In practice, this should be - // OK, as it is a rare case when either audio has a high enough bitrate to fill up a - // source buffer, or video fills without enough room for audio to append (and without - // the availability of clearing out seconds of back buffer to make room for audio). - // But it might still be good to handle this case in the future as a TODO. - - - this.waitingOnRemove_ = true; - this.callQueue_.push(this.appendToSourceBuffer_.bind(this, { - segmentInfo: segmentInfo, - type: type, - bytes: bytes - })); - var currentTime = this.currentTime_(); // Try to remove as much audio and video as possible to make room for new content - // before retrying. - - var timeToRemoveUntil = currentTime - MIN_BACK_BUFFER; - this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to " + timeToRemoveUntil); - this.remove(0, timeToRemoveUntil, function () { - _this3.logger_("On QUOTA_EXCEEDED_ERR, retrying append in " + MIN_BACK_BUFFER + "s"); - - _this3.waitingOnRemove_ = false; // wait the length of time alotted in the back buffer to prevent wasted - // attempts (since we can't clear less than the minimum) - - _this3.quotaExceededErrorRetryTimeout_ = window.setTimeout(function () { - _this3.logger_('On QUOTA_EXCEEDED_ERR, re-processing call queue'); - - _this3.quotaExceededErrorRetryTimeout_ = null; - - _this3.processCallQueue_(); - }, MIN_BACK_BUFFER * 1000); - }, true); - }; - - _proto.handleAppendError_ = function handleAppendError_(_ref6, error) { - var segmentInfo = _ref6.segmentInfo, - type = _ref6.type, - bytes = _ref6.bytes; - - // if there's no error, nothing to do - if (!error) { - return; - } - - if (error.code === QUOTA_EXCEEDED_ERR) { - this.handleQuotaExceededError_({ - segmentInfo: segmentInfo, - type: type, - bytes: bytes - }); // A quota exceeded error should be recoverable with a future re-append, so no need - // to trigger an append error. - - return; - } - - this.logger_('Received non QUOTA_EXCEEDED_ERR on append', error); - this.error(type + " append of " + bytes.length + "b failed for segment " + ("#" + segmentInfo.mediaIndex + " in playlist " + segmentInfo.playlist.id)); // If an append errors, we often can't recover. - // (see https://w3c.github.io/media-source/#sourcebuffer-append-error). - // - // Trigger a special error so that it can be handled separately from normal, - // recoverable errors. - - this.trigger('appenderror'); - }; - - _proto.appendToSourceBuffer_ = function appendToSourceBuffer_(_ref7) { - var segmentInfo = _ref7.segmentInfo, - type = _ref7.type, - initSegment = _ref7.initSegment, - data = _ref7.data, - bytes = _ref7.bytes; - - // If this is a re-append, bytes were already created and don't need to be recreated - if (!bytes) { - var segments = [data]; - var byteLength = data.byteLength; - - if (initSegment) { - // if the media initialization segment is changing, append it before the content - // segment - segments.unshift(initSegment); - byteLength += initSegment.byteLength; - } // Technically we should be OK appending the init segment separately, however, we - // haven't yet tested that, and prepending is how we have always done things. - - - bytes = concatSegments({ - bytes: byteLength, - segments: segments - }); - } - - this.sourceUpdater_.appendBuffer({ - segmentInfo: segmentInfo, - type: type, - bytes: bytes - }, this.handleAppendError_.bind(this, { - segmentInfo: segmentInfo, - type: type, - bytes: bytes - })); - }; - - _proto.handleSegmentTimingInfo_ = function handleSegmentTimingInfo_(type, requestId, segmentTimingInfo) { - if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) { - return; - } - - var segment = this.pendingSegment_.segment; - var timingInfoProperty = type + "TimingInfo"; - - if (!segment[timingInfoProperty]) { - segment[timingInfoProperty] = {}; - } - - segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0; - segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation; - segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode; - segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation; - segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode; // mainly used as a reference for debugging - - segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime; - }; - - _proto.appendData_ = function appendData_(segmentInfo, result) { - var type = result.type, - data = result.data; - - if (!data || !data.byteLength) { - return; - } - - if (type === 'audio' && this.audioDisabled_) { - return; - } - - var initSegment = this.getInitSegmentAndUpdateState_({ - type: type, - initSegment: result.initSegment, - playlist: segmentInfo.playlist, - map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null - }); - this.appendToSourceBuffer_({ - segmentInfo: segmentInfo, - type: type, - initSegment: initSegment, - data: data - }); - } - /** - * load a specific segment from a request into the buffer - * - * @private - */ - ; - - _proto.loadSegment_ = function loadSegment_(segmentInfo) { - var _this4 = this; - - this.state = 'WAITING'; - this.pendingSegment_ = segmentInfo; - this.trimBackBuffer_(segmentInfo); - - if (typeof segmentInfo.timestampOffset === 'number') { - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearAllMp4Captions' - }); - } - } - - if (!this.hasEnoughInfoToLoad_()) { - this.loadQueue_.push(function () { - // regenerate the audioAppendStart, timestampOffset, etc as they - // may have changed since this function was added to the queue. - var options = _extends({}, segmentInfo, { - forceTimestampOffset: true - }); - - _extends(segmentInfo, _this4.generateSegmentInfo_(options)); - - _this4.isPendingTimestampOffset_ = false; - - _this4.updateTransmuxerAndRequestSegment_(segmentInfo); - }); - return; - } - - this.updateTransmuxerAndRequestSegment_(segmentInfo); - }; - - _proto.updateTransmuxerAndRequestSegment_ = function updateTransmuxerAndRequestSegment_(segmentInfo) { - var _this5 = this; - - // We'll update the source buffer's timestamp offset once we have transmuxed data, but - // the transmuxer still needs to be updated before then. - // - // Even though keepOriginalTimestamps is set to true for the transmuxer, timestamp - // offset must be passed to the transmuxer for stream correcting adjustments. - if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) { - this.gopBuffer_.length = 0; // gopsToAlignWith was set before the GOP buffer was cleared - - segmentInfo.gopsToAlignWith = []; - this.timeMapping_ = 0; // reset values in the transmuxer since a discontinuity should start fresh - - this.transmuxer_.postMessage({ - action: 'reset' - }); - this.transmuxer_.postMessage({ - action: 'setTimestampOffset', - timestampOffset: segmentInfo.timestampOffset - }); - } - - var simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo); - var isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex); - var isWalkingForward = this.mediaIndex !== null; - var isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && // currentTimeline starts at -1, so we shouldn't end the timeline switching to 0, - // the first timeline - segmentInfo.timeline > 0; - var isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity; - this.logger_("Requesting " + segmentInfoString(segmentInfo)); // If there's an init segment associated with this segment, but it is not cached (identified by a lack of bytes), - // then this init segment has never been seen before and should be appended. - // - // At this point the content type (audio/video or both) is not yet known, but it should be safe to set - // both to true and leave the decision of whether to append the init segment to append time. - - if (simpleSegment.map && !simpleSegment.map.bytes) { - this.logger_('going to request init segment.'); - this.appendInitSegment_ = { - video: true, - audio: true - }; - } - - segmentInfo.abortRequests = mediaSegmentRequest({ - xhr: this.vhs_.xhr, - xhrOptions: this.xhrOptions_, - decryptionWorker: this.decrypter_, - segment: simpleSegment, - abortFn: this.handleAbort_.bind(this, segmentInfo), - progressFn: this.handleProgress_.bind(this), - trackInfoFn: this.handleTrackInfo_.bind(this), - timingInfoFn: this.handleTimingInfo_.bind(this), - videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'video', segmentInfo.requestId), - audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'audio', segmentInfo.requestId), - captionsFn: this.handleCaptions_.bind(this), - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: function endedTimelineFn() { - _this5.logger_('received endedtimeline callback'); - }, - id3Fn: this.handleId3_.bind(this), - dataFn: this.handleData_.bind(this), - doneFn: this.segmentRequestFinished_.bind(this) - }); - } - /** - * trim the back buffer so that we don't have too much data - * in the source buffer - * - * @private - * - * @param {Object} segmentInfo - the current segment - */ - ; - - _proto.trimBackBuffer_ = function trimBackBuffer_(segmentInfo) { - var removeToTime = safeBackBufferTrimTime(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10); // Chrome has a hard limit of 150MB of - // buffer and a very conservative "garbage collector" - // We manually clear out the old buffer to ensure - // we don't trigger the QuotaExceeded error - // on the source buffer during subsequent appends - - if (removeToTime > 0) { - this.remove(0, removeToTime); - } - } - /** - * created a simplified copy of the segment object with just the - * information necessary to perform the XHR and decryption - * - * @private - * - * @param {Object} segmentInfo - the current segment - * @return {Object} a simplified segment object copy - */ - ; - - _proto.createSimplifiedSegmentObj_ = function createSimplifiedSegmentObj_(segmentInfo) { - var segment = segmentInfo.segment; - var part = segmentInfo.part; - var simpleSegment = { - resolvedUri: part ? part.resolvedUri : segment.resolvedUri, - byterange: part ? part.byterange : segment.byterange, - requestId: segmentInfo.requestId, - transmuxer: segmentInfo.transmuxer, - audioAppendStart: segmentInfo.audioAppendStart, - gopsToAlignWith: segmentInfo.gopsToAlignWith, - part: segmentInfo.part - }; - var previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1]; - - if (previousSegment && previousSegment.timeline === segment.timeline) { - // The baseStartTime of a segment is used to handle rollover when probing the TS - // segment to retrieve timing information. Since the probe only looks at the media's - // times (e.g., PTS and DTS values of the segment), and doesn't consider the - // player's time (e.g., player.currentTime()), baseStartTime should reflect the - // media time as well. transmuxedDecodeEnd represents the end time of a segment, in - // seconds of media time, so should be used here. The previous segment is used since - // the end of the previous segment should represent the beginning of the current - // segment, so long as they are on the same timeline. - if (previousSegment.videoTimingInfo) { - simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd; - } else if (previousSegment.audioTimingInfo) { - simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd; - } - } - - if (segment.key) { - // if the media sequence is greater than 2^32, the IV will be incorrect - // assuming 10s segments, that would be about 1300 years - var iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]); - simpleSegment.key = this.segmentKey(segment.key); - simpleSegment.key.iv = iv; - } - - if (segment.map) { - simpleSegment.map = this.initSegmentForMap(segment.map); - } - - return simpleSegment; - }; - - _proto.saveTransferStats_ = function saveTransferStats_(stats) { - // every request counts as a media request even if it has been aborted - // or canceled due to a timeout - this.mediaRequests += 1; - - if (stats) { - this.mediaBytesTransferred += stats.bytesReceived; - this.mediaTransferDuration += stats.roundTripTime; - } - }; - - _proto.saveBandwidthRelatedStats_ = function saveBandwidthRelatedStats_(duration, stats) { - // byteLength will be used for throughput, and should be based on bytes receieved, - // which we only know at the end of the request and should reflect total bytes - // downloaded rather than just bytes processed from components of the segment - this.pendingSegment_.byteLength = stats.bytesReceived; - - if (duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) { - this.logger_("Ignoring segment's bandwidth because its duration of " + duration + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS)); - return; - } - - this.bandwidth = stats.bandwidth; - this.roundTrip = stats.roundTripTime; - }; - - _proto.handleTimeout_ = function handleTimeout_() { - // although the VTT segment loader bandwidth isn't really used, it's good to - // maintain functinality between segment loaders - this.mediaRequestsTimedout += 1; - this.bandwidth = 1; - this.roundTrip = NaN; - this.trigger('bandwidthupdate'); - } - /** - * Handle the callback from the segmentRequest function and set the - * associated SegmentLoader state and errors if necessary - * - * @private - */ - ; - - _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) { - // TODO handle special cases, e.g., muxed audio/video but only audio in the segment - // check the call queue directly since this function doesn't need to deal with any - // data, and can continue even if the source buffers are not set up and we didn't get - // any data from the segment - if (this.callQueue_.length) { - this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result)); - return; - } - - this.saveTransferStats_(simpleSegment.stats); // The request was aborted and the SegmentLoader has already been reset - - if (!this.pendingSegment_) { - return; - } // the request was aborted and the SegmentLoader has already started - // another request. this can happen when the timeout for an aborted - // request triggers due to a limitation in the XHR library - // do not count this as any sort of request or we risk double-counting - - - if (simpleSegment.requestId !== this.pendingSegment_.requestId) { - return; - } // an error occurred from the active pendingSegment_ so reset everything - - - if (error) { - this.pendingSegment_ = null; - this.state = 'READY'; // aborts are not a true error condition and nothing corrective needs to be done - - if (error.code === REQUEST_ERRORS.ABORTED) { - return; - } - - this.pause(); // the error is really just that at least one of the requests timed-out - // set the bandwidth to a very low value and trigger an ABR switch to - // take emergency action - - if (error.code === REQUEST_ERRORS.TIMEOUT) { - this.handleTimeout_(); - return; - } // if control-flow has arrived here, then the error is real - // emit an error event to blacklist the current playlist - - - this.mediaRequestsErrored += 1; - this.error(error); - this.trigger('error'); - return; - } - - var segmentInfo = this.pendingSegment_; // the response was a success so set any bandwidth stats the request - // generated for ABR purposes - - this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats); - segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests; - - if (result.gopInfo) { - this.gopBuffer_ = updateGopBuffer(this.gopBuffer_, result.gopInfo, this.safeAppend_); - } // Although we may have already started appending on progress, we shouldn't switch the - // state away from loading until we are officially done loading the segment data. - - - this.state = 'APPENDING'; // used for testing - - this.trigger('appending'); - this.waitForAppendsToComplete_(segmentInfo); - }; - - _proto.setTimeMapping_ = function setTimeMapping_(timeline) { - var timelineMapping = this.syncController_.mappingForTimeline(timeline); - - if (timelineMapping !== null) { - this.timeMapping_ = timelineMapping; - } - }; - - _proto.updateMediaSecondsLoaded_ = function updateMediaSecondsLoaded_(segment) { - if (typeof segment.start === 'number' && typeof segment.end === 'number') { - this.mediaSecondsLoaded += segment.end - segment.start; - } else { - this.mediaSecondsLoaded += segment.duration; - } - }; - - _proto.shouldUpdateTransmuxerTimestampOffset_ = function shouldUpdateTransmuxerTimestampOffset_(timestampOffset) { - if (timestampOffset === null) { - return false; - } // note that we're potentially using the same timestamp offset for both video and - // audio - - - if (this.loaderType_ === 'main' && timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) { - return true; - } - - if (!this.audioDisabled_ && timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) { - return true; - } - - return false; - }; - - _proto.trueSegmentStart_ = function trueSegmentStart_(_ref8) { - var currentStart = _ref8.currentStart, - playlist = _ref8.playlist, - mediaIndex = _ref8.mediaIndex, - firstVideoFrameTimeForData = _ref8.firstVideoFrameTimeForData, - currentVideoTimestampOffset = _ref8.currentVideoTimestampOffset, - useVideoTimingInfo = _ref8.useVideoTimingInfo, - videoTimingInfo = _ref8.videoTimingInfo, - audioTimingInfo = _ref8.audioTimingInfo; - - if (typeof currentStart !== 'undefined') { - // if start was set once, keep using it - return currentStart; - } - - if (!useVideoTimingInfo) { - return audioTimingInfo.start; - } - - var previousSegment = playlist.segments[mediaIndex - 1]; // The start of a segment should be the start of the first full frame contained - // within that segment. Since the transmuxer maintains a cache of incomplete data - // from and/or the last frame seen, the start time may reflect a frame that starts - // in the previous segment. Check for that case and ensure the start time is - // accurate for the segment. - - if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === 'undefined' || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) { - return firstVideoFrameTimeForData; - } - - return videoTimingInfo.start; - }; - - _proto.waitForAppendsToComplete_ = function waitForAppendsToComplete_(segmentInfo) { - if (!this.currentMediaInfo_) { - this.error({ - message: 'No starting media returned, likely due to an unsupported media format.', - blacklistDuration: Infinity - }); - this.trigger('error'); - return; - } // Although transmuxing is done, appends may not yet be finished. Throw a marker - // on each queue this loader is responsible for to ensure that the appends are - // complete. - - - var _this$currentMediaInf2 = this.currentMediaInfo_, - hasAudio = _this$currentMediaInf2.hasAudio, - hasVideo = _this$currentMediaInf2.hasVideo, - isMuxed = _this$currentMediaInf2.isMuxed; - var waitForVideo = this.loaderType_ === 'main' && hasVideo; - var waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed; - segmentInfo.waitingOnAppends = 0; // segments with no data - - if (!segmentInfo.hasAppendedData_) { - if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === 'number') { - // When there's no audio or video data in the segment, there's no audio or video - // timing information. - // - // If there's no audio or video timing information, then the timestamp offset - // can't be adjusted to the appropriate value for the transmuxer and source - // buffers. - // - // Therefore, the next segment should be used to set the timestamp offset. - this.isPendingTimestampOffset_ = true; - } // override settings for metadata only segments - - - segmentInfo.timingInfo = { - start: 0 - }; - segmentInfo.waitingOnAppends++; - - if (!this.isPendingTimestampOffset_) { - // update the timestampoffset - this.updateSourceBufferTimestampOffset_(segmentInfo); // make sure the metadata queue is processed even though we have - // no video/audio data. - - this.processMetadataQueue_(); - } // append is "done" instantly with no data. - - - this.checkAppendsDone_(segmentInfo); - return; - } // Since source updater could call back synchronously, do the increments first. - - - if (waitForVideo) { - segmentInfo.waitingOnAppends++; - } - - if (waitForAudio) { - segmentInfo.waitingOnAppends++; - } - - if (waitForVideo) { - this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo)); - } - - if (waitForAudio) { - this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo)); - } - }; - - _proto.checkAppendsDone_ = function checkAppendsDone_(segmentInfo) { - if (this.checkForAbort_(segmentInfo.requestId)) { - return; - } - - segmentInfo.waitingOnAppends--; - - if (segmentInfo.waitingOnAppends === 0) { - this.handleAppendsDone_(); - } - }; - - _proto.checkForIllegalMediaSwitch = function checkForIllegalMediaSwitch(trackInfo) { - var illegalMediaSwitchError = illegalMediaSwitch(this.loaderType_, this.currentMediaInfo_, trackInfo); - - if (illegalMediaSwitchError) { - this.error({ - message: illegalMediaSwitchError, - blacklistDuration: Infinity - }); - this.trigger('error'); - return true; - } - - return false; - }; - - _proto.updateSourceBufferTimestampOffset_ = function updateSourceBufferTimestampOffset_(segmentInfo) { - if (segmentInfo.timestampOffset === null || // we don't yet have the start for whatever media type (video or audio) has - // priority, timing-wise, so we must wait - typeof segmentInfo.timingInfo.start !== 'number' || // already updated the timestamp offset for this segment - segmentInfo.changedTimestampOffset || // the alt audio loader should not be responsible for setting the timestamp offset - this.loaderType_ !== 'main') { - return; - } - - var didChange = false; // Primary timing goes by video, and audio is trimmed in the transmuxer, meaning that - // the timing info here comes from video. In the event that the audio is longer than - // the video, this will trim the start of the audio. - // This also trims any offset from 0 at the beginning of the media - - segmentInfo.timestampOffset -= segmentInfo.timingInfo.start; // In the event that there are part segment downloads, each will try to update the - // timestamp offset. Retaining this bit of state prevents us from updating in the - // future (within the same segment), however, there may be a better way to handle it. - - segmentInfo.changedTimestampOffset = true; - - if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) { - this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset); - didChange = true; - } - - if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) { - this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset); - didChange = true; - } - - if (didChange) { - this.trigger('timestampoffset'); - } - }; - - _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_(segmentInfo) { - segmentInfo.timingInfo = segmentInfo.timingInfo || {}; - var useVideoTimingInfo = this.loaderType_ === 'main' && this.currentMediaInfo_.hasVideo; - var prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo; - - if (!prioritizedTimingInfo) { - return; - } - - segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === 'number' ? // End time may not exist in a case where we aren't parsing the full segment (one - // current example is the case of fmp4), so use the rough duration to calculate an - // end time. - prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration; - } - /** - * callback to run when appendBuffer is finished. detects if we are - * in a good state to do things with the data we got, or if we need - * to wait for more - * - * @private - */ - ; - - _proto.handleAppendsDone_ = function handleAppendsDone_() { - // appendsdone can cause an abort - if (this.pendingSegment_) { - this.trigger('appendsdone'); - } - - if (!this.pendingSegment_) { - this.state = 'READY'; // TODO should this move into this.checkForAbort to speed up requests post abort in - // all appending cases? - - if (!this.paused()) { - this.monitorBuffer_(); - } - - return; - } - - var segmentInfo = this.pendingSegment_; // Now that the end of the segment has been reached, we can set the end time. It's - // best to wait until all appends are done so we're sure that the primary media is - // finished (and we have its end time). - - this.updateTimingInfoEnd_(segmentInfo); - - if (this.shouldSaveSegmentTimingInfo_) { - // Timeline mappings should only be saved for the main loader. This is for multiple - // reasons: - // - // 1) Only one mapping is saved per timeline, meaning that if both the audio loader - // and the main loader try to save the timeline mapping, whichever comes later - // will overwrite the first. In theory this is OK, as the mappings should be the - // same, however, it breaks for (2) - // 2) In the event of a live stream, the initial live point will make for a somewhat - // arbitrary mapping. If audio and video streams are not perfectly in-sync, then - // the mapping will be off for one of the streams, dependent on which one was - // first saved (see (1)). - // 3) Primary timing goes by video in VHS, so the mapping should be video. - // - // Since the audio loader will wait for the main loader to load the first segment, - // the main loader will save the first timeline mapping, and ensure that there won't - // be a case where audio loads two segments without saving a mapping (thus leading - // to missing segment timing info). - this.syncController_.saveSegmentTimingInfo({ - segmentInfo: segmentInfo, - shouldSaveTimelineMapping: this.loaderType_ === 'main' - }); - } - - var segmentDurationMessage = getTroublesomeSegmentDurationMessage(segmentInfo, this.sourceType_); - - if (segmentDurationMessage) { - if (segmentDurationMessage.severity === 'warn') { - videojs.log.warn(segmentDurationMessage.message); - } else { - this.logger_(segmentDurationMessage.message); - } - } - - this.recordThroughput_(segmentInfo); - this.pendingSegment_ = null; - this.state = 'READY'; - - if (segmentInfo.isSyncRequest) { - this.trigger('syncinfoupdate'); // if the sync request was not appended - // then it was not the correct segment. - // throw it away and use the data it gave us - // to get the correct one. - - if (!segmentInfo.hasAppendedData_) { - this.logger_("Throwing away un-appended sync request " + segmentInfoString(segmentInfo)); - return; - } - } - - this.logger_("Appended " + segmentInfoString(segmentInfo)); - this.addSegmentMetadataCue_(segmentInfo); - this.fetchAtBuffer_ = true; - - if (this.currentTimeline_ !== segmentInfo.timeline) { - this.timelineChangeController_.lastTimelineChange({ - type: this.loaderType_, - from: this.currentTimeline_, - to: segmentInfo.timeline - }); // If audio is not disabled, the main segment loader is responsible for updating - // the audio timeline as well. If the content is video only, this won't have any - // impact. - - if (this.loaderType_ === 'main' && !this.audioDisabled_) { - this.timelineChangeController_.lastTimelineChange({ - type: 'audio', - from: this.currentTimeline_, - to: segmentInfo.timeline - }); - } - } - - this.currentTimeline_ = segmentInfo.timeline; // We must update the syncinfo to recalculate the seekable range before - // the following conditional otherwise it may consider this a bad "guess" - // and attempt to resync when the post-update seekable window and live - // point would mean that this was the perfect segment to fetch - - this.trigger('syncinfoupdate'); - var segment = segmentInfo.segment; // If we previously appended a segment that ends more than 3 targetDurations before - // the currentTime_ that means that our conservative guess was too conservative. - // In that case, reset the loader state so that we try to use any information gained - // from the previous request to create a new, more accurate, sync-point. - - if (segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3) { - this.resetEverything(); - return; - } - - var isWalkingForward = this.mediaIndex !== null; // Don't do a rendition switch unless we have enough time to get a sync segment - // and conservatively guess - - if (isWalkingForward) { - this.trigger('bandwidthupdate'); - } - - this.trigger('progress'); - this.mediaIndex = segmentInfo.mediaIndex; - this.partIndex = segmentInfo.partIndex; // any time an update finishes and the last segment is in the - // buffer, end the stream. this ensures the "ended" event will - // fire if playback reaches that point. - - if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) { - this.endOfStream(); - } // used for testing - - - this.trigger('appended'); - - if (segmentInfo.hasAppendedData_) { - this.mediaAppends++; - } - - if (!this.paused()) { - this.monitorBuffer_(); - } - } - /** - * Records the current throughput of the decrypt, transmux, and append - * portion of the semgment pipeline. `throughput.rate` is a the cumulative - * moving average of the throughput. `throughput.count` is the number of - * data points in the average. - * - * @private - * @param {Object} segmentInfo the object returned by loadSegment - */ - ; - - _proto.recordThroughput_ = function recordThroughput_(segmentInfo) { - if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) { - this.logger_("Ignoring segment's throughput because its duration of " + segmentInfo.duration + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS)); - return; - } - - var rate = this.throughput.rate; // Add one to the time to ensure that we don't accidentally attempt to divide - // by zero in the case where the throughput is ridiculously high - - var segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1; // Multiply by 8000 to convert from bytes/millisecond to bits/second - - var segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1000); // This is just a cumulative moving average calculation: - // newAvg = oldAvg + (sample - oldAvg) / (sampleCount + 1) - - this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count; - } - /** - * Adds a cue to the segment-metadata track with some metadata information about the - * segment - * - * @private - * @param {Object} segmentInfo - * the object returned by loadSegment - * @method addSegmentMetadataCue_ - */ - ; - - _proto.addSegmentMetadataCue_ = function addSegmentMetadataCue_(segmentInfo) { - if (!this.segmentMetadataTrack_) { - return; - } - - var segment = segmentInfo.segment; - var start = segment.start; - var end = segment.end; // Do not try adding the cue if the start and end times are invalid. - - if (!finite(start) || !finite(end)) { - return; - } - - removeCuesFromTrack(start, end, this.segmentMetadataTrack_); - var Cue = window.WebKitDataCue || window.VTTCue; - var value = { - custom: segment.custom, - dateTimeObject: segment.dateTimeObject, - dateTimeString: segment.dateTimeString, - bandwidth: segmentInfo.playlist.attributes.BANDWIDTH, - resolution: segmentInfo.playlist.attributes.RESOLUTION, - codecs: segmentInfo.playlist.attributes.CODECS, - byteLength: segmentInfo.byteLength, - uri: segmentInfo.uri, - timeline: segmentInfo.timeline, - playlist: segmentInfo.playlist.id, - start: start, - end: end - }; - var data = JSON.stringify(value); - var cue = new Cue(start, end, data); // Attach the metadata to the value property of the cue to keep consistency between - // the differences of WebKitDataCue in safari and VTTCue in other browsers - - cue.value = value; - this.segmentMetadataTrack_.addCue(cue); - }; - - return SegmentLoader; -}(videojs.EventTarget); - -function noop() {} - -var toTitleCase = function toTitleCase(string) { - if (typeof string !== 'string') { - return string; - } - - return string.replace(/./, function (w) { - return w.toUpperCase(); - }); -}; - -var bufferTypes = ['video', 'audio']; - -var _updating = function updating(type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type]; -}; - -var nextQueueIndexOfType = function nextQueueIndexOfType(type, queue) { - for (var i = 0; i < queue.length; i++) { - var queueEntry = queue[i]; - - if (queueEntry.type === 'mediaSource') { - // If the next entry is a media source entry (uses multiple source buffers), block - // processing to allow it to go through first. - return null; - } - - if (queueEntry.type === type) { - return i; - } - } - - return null; -}; - -var shiftQueue = function shiftQueue(type, sourceUpdater) { - if (sourceUpdater.queue.length === 0) { - return; - } - - var queueIndex = 0; - var queueEntry = sourceUpdater.queue[queueIndex]; - - if (queueEntry.type === 'mediaSource') { - if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== 'closed') { - sourceUpdater.queue.shift(); - queueEntry.action(sourceUpdater); - - if (queueEntry.doneFn) { - queueEntry.doneFn(); - } // Only specific source buffer actions must wait for async updateend events. Media - // Source actions process synchronously. Therefore, both audio and video source - // buffers are now clear to process the next queue entries. - - - shiftQueue('audio', sourceUpdater); - shiftQueue('video', sourceUpdater); - } // Media Source actions require both source buffers, so if the media source action - // couldn't process yet (because one or both source buffers are busy), block other - // queue actions until both are available and the media source action can process. - - - return; - } - - if (type === 'mediaSource') { - // If the queue was shifted by a media source action (this happens when pushing a - // media source action onto the queue), then it wasn't from an updateend event from an - // audio or video source buffer, so there's no change from previous state, and no - // processing should be done. - return; - } // Media source queue entries don't need to consider whether the source updater is - // started (i.e., source buffers are created) as they don't need the source buffers, but - // source buffer queue entries do. - - - if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === 'closed' || _updating(type, sourceUpdater)) { - return; - } - - if (queueEntry.type !== type) { - queueIndex = nextQueueIndexOfType(type, sourceUpdater.queue); - - if (queueIndex === null) { - // Either there's no queue entry that uses this source buffer type in the queue, or - // there's a media source queue entry before the next entry of this type, in which - // case wait for that action to process first. - return; - } - - queueEntry = sourceUpdater.queue[queueIndex]; - } - - sourceUpdater.queue.splice(queueIndex, 1); // Keep a record that this source buffer type is in use. - // - // The queue pending operation must be set before the action is performed in the event - // that the action results in a synchronous event that is acted upon. For instance, if - // an exception is thrown that can be handled, it's possible that new actions will be - // appended to an empty queue and immediately executed, but would not have the correct - // pending information if this property was set after the action was performed. - - sourceUpdater.queuePending[type] = queueEntry; - queueEntry.action(type, sourceUpdater); - - if (!queueEntry.doneFn) { - // synchronous operation, process next entry - sourceUpdater.queuePending[type] = null; - shiftQueue(type, sourceUpdater); - return; - } -}; - -var cleanupBuffer = function cleanupBuffer(type, sourceUpdater) { - var buffer = sourceUpdater[type + "Buffer"]; - var titleType = toTitleCase(type); - - if (!buffer) { - return; - } - - buffer.removeEventListener('updateend', sourceUpdater["on" + titleType + "UpdateEnd_"]); - buffer.removeEventListener('error', sourceUpdater["on" + titleType + "Error_"]); - sourceUpdater.codecs[type] = null; - sourceUpdater[type + "Buffer"] = null; -}; - -var inSourceBuffers = function inSourceBuffers(mediaSource, sourceBuffer) { - return mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1; -}; - -var actions = { - appendBuffer: function appendBuffer(bytes, segmentInfo, onError) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Appending segment " + segmentInfo.mediaIndex + "'s " + bytes.length + " bytes to " + type + "Buffer"); - - try { - sourceBuffer.appendBuffer(bytes); - } catch (e) { - sourceUpdater.logger_("Error with code " + e.code + " " + (e.code === QUOTA_EXCEEDED_ERR ? '(QUOTA_EXCEEDED_ERR) ' : '') + ("when appending segment " + segmentInfo.mediaIndex + " to " + type + "Buffer")); - sourceUpdater.queuePending[type] = null; - onError(e); - } - }; - }, - remove: function remove(start, end) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Removing " + start + " to " + end + " from " + type + "Buffer"); - - try { - sourceBuffer.remove(start, end); - } catch (e) { - sourceUpdater.logger_("Remove " + start + " to " + end + " from " + type + "Buffer failed"); - } - }; - }, - timestampOffset: function timestampOffset(offset) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Setting " + type + "timestampOffset to " + offset); - sourceBuffer.timestampOffset = offset; - }; - }, - callback: function callback(_callback) { - return function (type, sourceUpdater) { - _callback(); - }; - }, - endOfStream: function endOfStream(error) { - return function (sourceUpdater) { - if (sourceUpdater.mediaSource.readyState !== 'open') { - return; - } - - sourceUpdater.logger_("Calling mediaSource endOfStream(" + (error || '') + ")"); - - try { - sourceUpdater.mediaSource.endOfStream(error); - } catch (e) { - videojs.log.warn('Failed to call media source endOfStream', e); - } - }; - }, - duration: function duration(_duration) { - return function (sourceUpdater) { - sourceUpdater.logger_("Setting mediaSource duration to " + _duration); - - try { - sourceUpdater.mediaSource.duration = _duration; - } catch (e) { - videojs.log.warn('Failed to set media source duration', e); - } - }; - }, - abort: function abort() { - return function (type, sourceUpdater) { - if (sourceUpdater.mediaSource.readyState !== 'open') { - return; - } - - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("calling abort on " + type + "Buffer"); - - try { - sourceBuffer.abort(); - } catch (e) { - videojs.log.warn("Failed to abort on " + type + "Buffer", e); - } - }; - }, - addSourceBuffer: function addSourceBuffer(type, codec) { - return function (sourceUpdater) { - var titleType = toTitleCase(type); - var mime = getMimeForCodec(codec); - sourceUpdater.logger_("Adding " + type + "Buffer with codec " + codec + " to mediaSource"); - var sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime); - sourceBuffer.addEventListener('updateend', sourceUpdater["on" + titleType + "UpdateEnd_"]); - sourceBuffer.addEventListener('error', sourceUpdater["on" + titleType + "Error_"]); - sourceUpdater.codecs[type] = codec; - sourceUpdater[type + "Buffer"] = sourceBuffer; - }; - }, - removeSourceBuffer: function removeSourceBuffer(type) { - return function (sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - cleanupBuffer(type, sourceUpdater); // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Removing " + type + "Buffer with codec " + sourceUpdater.codecs[type] + " from mediaSource"); - - try { - sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer); - } catch (e) { - videojs.log.warn("Failed to removeSourceBuffer " + type + "Buffer", e); - } - }; - }, - changeType: function changeType(codec) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - var mime = getMimeForCodec(codec); // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } // do not update codec if we don't need to. - - - if (sourceUpdater.codecs[type] === codec) { - return; - } - - sourceUpdater.logger_("changing " + type + "Buffer codec from " + sourceUpdater.codecs[type] + " to " + codec); - sourceBuffer.changeType(mime); - sourceUpdater.codecs[type] = codec; - }; - } -}; - -var pushQueue = function pushQueue(_ref) { - var type = _ref.type, - sourceUpdater = _ref.sourceUpdater, - action = _ref.action, - doneFn = _ref.doneFn, - name = _ref.name; - sourceUpdater.queue.push({ - type: type, - action: action, - doneFn: doneFn, - name: name - }); - shiftQueue(type, sourceUpdater); -}; - -var onUpdateend = function onUpdateend(type, sourceUpdater) { - return function (e) { - // Although there should, in theory, be a pending action for any updateend receieved, - // there are some actions that may trigger updateend events without set definitions in - // the w3c spec. For instance, setting the duration on the media source may trigger - // updateend events on source buffers. This does not appear to be in the spec. As such, - // if we encounter an updateend without a corresponding pending action from our queue - // for that source buffer type, process the next action. - if (sourceUpdater.queuePending[type]) { - var doneFn = sourceUpdater.queuePending[type].doneFn; - sourceUpdater.queuePending[type] = null; - - if (doneFn) { - // if there's an error, report it - doneFn(sourceUpdater[type + "Error_"]); - } - } - - shiftQueue(type, sourceUpdater); - }; -}; -/** - * A queue of callbacks to be serialized and applied when a - * MediaSource and its associated SourceBuffers are not in the - * updating state. It is used by the segment loader to update the - * underlying SourceBuffers when new data is loaded, for instance. - * - * @class SourceUpdater - * @param {MediaSource} mediaSource the MediaSource to create the SourceBuffer from - * @param {string} mimeType the desired MIME type of the underlying SourceBuffer - */ - - -var SourceUpdater = /*#__PURE__*/function (_videojs$EventTarget) { - _inheritsLoose(SourceUpdater, _videojs$EventTarget); - - function SourceUpdater(mediaSource) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - _this.mediaSource = mediaSource; - - _this.sourceopenListener_ = function () { - return shiftQueue('mediaSource', _assertThisInitialized(_this)); - }; - - _this.mediaSource.addEventListener('sourceopen', _this.sourceopenListener_); - - _this.logger_ = logger('SourceUpdater'); // initial timestamp offset is 0 - - _this.audioTimestampOffset_ = 0; - _this.videoTimestampOffset_ = 0; - _this.queue = []; - _this.queuePending = { - audio: null, - video: null - }; - _this.delayedAudioAppendQueue_ = []; - _this.videoAppendQueued_ = false; - _this.codecs = {}; - _this.onVideoUpdateEnd_ = onUpdateend('video', _assertThisInitialized(_this)); - _this.onAudioUpdateEnd_ = onUpdateend('audio', _assertThisInitialized(_this)); - - _this.onVideoError_ = function (e) { - // used for debugging - _this.videoError_ = e; - }; - - _this.onAudioError_ = function (e) { - // used for debugging - _this.audioError_ = e; - }; - - _this.createdSourceBuffers_ = false; - _this.initializedEme_ = false; - _this.triggeredReady_ = false; - return _this; - } - - var _proto = SourceUpdater.prototype; - - _proto.initializedEme = function initializedEme() { - this.initializedEme_ = true; - this.triggerReady(); - }; - - _proto.hasCreatedSourceBuffers = function hasCreatedSourceBuffers() { - // if false, likely waiting on one of the segment loaders to get enough data to create - // source buffers - return this.createdSourceBuffers_; - }; - - _proto.hasInitializedAnyEme = function hasInitializedAnyEme() { - return this.initializedEme_; - }; - - _proto.ready = function ready() { - return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme(); - }; - - _proto.createSourceBuffers = function createSourceBuffers(codecs) { - if (this.hasCreatedSourceBuffers()) { - // already created them before - return; - } // the intial addOrChangeSourceBuffers will always be - // two add buffers. - - - this.addOrChangeSourceBuffers(codecs); - this.createdSourceBuffers_ = true; - this.trigger('createdsourcebuffers'); - this.triggerReady(); - }; - - _proto.triggerReady = function triggerReady() { - // only allow ready to be triggered once, this prevents the case - // where: - // 1. we trigger createdsourcebuffers - // 2. ie 11 synchronously initializates eme - // 3. the synchronous initialization causes us to trigger ready - // 4. We go back to the ready check in createSourceBuffers and ready is triggered again. - if (this.ready() && !this.triggeredReady_) { - this.triggeredReady_ = true; - this.trigger('ready'); - } - } - /** - * Add a type of source buffer to the media source. - * - * @param {string} type - * The type of source buffer to add. - * - * @param {string} codec - * The codec to add the source buffer with. - */ - ; - - _proto.addSourceBuffer = function addSourceBuffer(type, codec) { - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.addSourceBuffer(type, codec), - name: 'addSourceBuffer' - }); - } - /** - * call abort on a source buffer. - * - * @param {string} type - * The type of source buffer to call abort on. - */ - ; - - _proto.abort = function abort(type) { - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.abort(type), - name: 'abort' - }); - } - /** - * Call removeSourceBuffer and remove a specific type - * of source buffer on the mediaSource. - * - * @param {string} type - * The type of source buffer to remove. - */ - ; - - _proto.removeSourceBuffer = function removeSourceBuffer(type) { - if (!this.canRemoveSourceBuffer()) { - videojs.log.error('removeSourceBuffer is not supported!'); - return; - } - - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.removeSourceBuffer(type), - name: 'removeSourceBuffer' - }); - } - /** - * Whether or not the removeSourceBuffer function is supported - * on the mediaSource. - * - * @return {boolean} - * if removeSourceBuffer can be called. - */ - ; - - _proto.canRemoveSourceBuffer = function canRemoveSourceBuffer() { - // IE reports that it supports removeSourceBuffer, but often throws - // errors when attempting to use the function. So we report that it - // does not support removeSourceBuffer. As of Firefox 83 removeSourceBuffer - // throws errors, so we report that it does not support this as well. - return !videojs.browser.IE_VERSION && !videojs.browser.IS_FIREFOX && window.MediaSource && window.MediaSource.prototype && typeof window.MediaSource.prototype.removeSourceBuffer === 'function'; - } - /** - * Whether or not the changeType function is supported - * on our SourceBuffers. - * - * @return {boolean} - * if changeType can be called. - */ - ; - - SourceUpdater.canChangeType = function canChangeType() { - return window.SourceBuffer && window.SourceBuffer.prototype && typeof window.SourceBuffer.prototype.changeType === 'function'; - } - /** - * Whether or not the changeType function is supported - * on our SourceBuffers. - * - * @return {boolean} - * if changeType can be called. - */ - ; - - _proto.canChangeType = function canChangeType() { - return this.constructor.canChangeType(); - } - /** - * Call the changeType function on a source buffer, given the code and type. - * - * @param {string} type - * The type of source buffer to call changeType on. - * - * @param {string} codec - * The codec string to change type with on the source buffer. - */ - ; - - _proto.changeType = function changeType(type, codec) { - if (!this.canChangeType()) { - videojs.log.error('changeType is not supported!'); - return; - } - - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.changeType(codec), - name: 'changeType' - }); - } - /** - * Add source buffers with a codec or, if they are already created, - * call changeType on source buffers using changeType. - * - * @param {Object} codecs - * Codecs to switch to - */ - ; - - _proto.addOrChangeSourceBuffers = function addOrChangeSourceBuffers(codecs) { - var _this2 = this; - - if (!codecs || typeof codecs !== 'object' || Object.keys(codecs).length === 0) { - throw new Error('Cannot addOrChangeSourceBuffers to undefined codecs'); - } - - Object.keys(codecs).forEach(function (type) { - var codec = codecs[type]; - - if (!_this2.hasCreatedSourceBuffers()) { - return _this2.addSourceBuffer(type, codec); - } - - if (_this2.canChangeType()) { - _this2.changeType(type, codec); - } - }); - } - /** - * Queue an update to append an ArrayBuffer. - * - * @param {MediaObject} object containing audioBytes and/or videoBytes - * @param {Function} done the function to call when done - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-appendBuffer-void-ArrayBuffer-data - */ - ; - - _proto.appendBuffer = function appendBuffer(options, doneFn) { - var _this3 = this; - - var segmentInfo = options.segmentInfo, - type = options.type, - bytes = options.bytes; - this.processedAppend_ = true; - - if (type === 'audio' && this.videoBuffer && !this.videoAppendQueued_) { - this.delayedAudioAppendQueue_.push([options, doneFn]); - this.logger_("delayed audio append of " + bytes.length + " until video append"); - return; - } // In the case of certain errors, for instance, QUOTA_EXCEEDED_ERR, updateend will - // not be fired. This means that the queue will be blocked until the next action - // taken by the segment-loader. Provide a mechanism for segment-loader to handle - // these errors by calling the doneFn with the specific error. - - - var onError = doneFn; - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.appendBuffer(bytes, segmentInfo || { - mediaIndex: -1 - }, onError), - doneFn: doneFn, - name: 'appendBuffer' - }); - - if (type === 'video') { - this.videoAppendQueued_ = true; - - if (!this.delayedAudioAppendQueue_.length) { - return; - } - - var queue = this.delayedAudioAppendQueue_.slice(); - this.logger_("queuing delayed audio " + queue.length + " appendBuffers"); - this.delayedAudioAppendQueue_.length = 0; - queue.forEach(function (que) { - _this3.appendBuffer.apply(_this3, que); - }); - } - } - /** - * Get the audio buffer's buffered timerange. - * - * @return {TimeRange} - * The audio buffer's buffered time range - */ - ; - - _proto.audioBuffered = function audioBuffered() { - // no media source/source buffer or it isn't in the media sources - // source buffer list - if (!inSourceBuffers(this.mediaSource, this.audioBuffer)) { - return videojs.createTimeRange(); - } - - return this.audioBuffer.buffered ? this.audioBuffer.buffered : videojs.createTimeRange(); - } - /** - * Get the video buffer's buffered timerange. - * - * @return {TimeRange} - * The video buffer's buffered time range - */ - ; - - _proto.videoBuffered = function videoBuffered() { - // no media source/source buffer or it isn't in the media sources - // source buffer list - if (!inSourceBuffers(this.mediaSource, this.videoBuffer)) { - return videojs.createTimeRange(); - } - - return this.videoBuffer.buffered ? this.videoBuffer.buffered : videojs.createTimeRange(); - } - /** - * Get a combined video/audio buffer's buffered timerange. - * - * @return {TimeRange} - * the combined time range - */ - ; - - _proto.buffered = function buffered() { - var video = inSourceBuffers(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null; - var audio = inSourceBuffers(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null; - - if (audio && !video) { - return this.audioBuffered(); - } - - if (video && !audio) { - return this.videoBuffered(); - } - - return bufferIntersection(this.audioBuffered(), this.videoBuffered()); - } - /** - * Add a callback to the queue that will set duration on the mediaSource. - * - * @param {number} duration - * The duration to set - * - * @param {Function} [doneFn] - * function to run after duration has been set. - */ - ; - - _proto.setDuration = function setDuration(duration, doneFn) { - if (doneFn === void 0) { - doneFn = noop; - } - - // In order to set the duration on the media source, it's necessary to wait for all - // source buffers to no longer be updating. "If the updating attribute equals true on - // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and - // abort these steps." (source: https://www.w3.org/TR/media-source/#attributes). - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.duration(duration), - name: 'duration', - doneFn: doneFn - }); - } - /** - * Add a mediaSource endOfStream call to the queue - * - * @param {Error} [error] - * Call endOfStream with an error - * - * @param {Function} [doneFn] - * A function that should be called when the - * endOfStream call has finished. - */ - ; - - _proto.endOfStream = function endOfStream(error, doneFn) { - if (error === void 0) { - error = null; - } - - if (doneFn === void 0) { - doneFn = noop; - } - - if (typeof error !== 'string') { - error = undefined; - } // In order to set the duration on the media source, it's necessary to wait for all - // source buffers to no longer be updating. "If the updating attribute equals true on - // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and - // abort these steps." (source: https://www.w3.org/TR/media-source/#attributes). - - - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.endOfStream(error), - name: 'endOfStream', - doneFn: doneFn - }); - } - /** - * Queue an update to remove a time range from the buffer. - * - * @param {number} start where to start the removal - * @param {number} end where to end the removal - * @param {Function} [done=noop] optional callback to be executed when the remove - * operation is complete - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end - */ - ; - - _proto.removeAudio = function removeAudio(start, end, done) { - if (done === void 0) { - done = noop; - } - - if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) { - done(); - return; - } - - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.remove(start, end), - doneFn: done, - name: 'remove' - }); - } - /** - * Queue an update to remove a time range from the buffer. - * - * @param {number} start where to start the removal - * @param {number} end where to end the removal - * @param {Function} [done=noop] optional callback to be executed when the remove - * operation is complete - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end - */ - ; - - _proto.removeVideo = function removeVideo(start, end, done) { - if (done === void 0) { - done = noop; - } - - if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) { - done(); - return; - } - - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.remove(start, end), - doneFn: done, - name: 'remove' - }); - } - /** - * Whether the underlying sourceBuffer is updating or not - * - * @return {boolean} the updating status of the SourceBuffer - */ - ; - - _proto.updating = function updating() { - // the audio/video source buffer is updating - if (_updating('audio', this) || _updating('video', this)) { - return true; - } - - return false; - } - /** - * Set/get the timestampoffset on the audio SourceBuffer - * - * @return {number} the timestamp offset - */ - ; - - _proto.audioTimestampOffset = function audioTimestampOffset(offset) { - if (typeof offset !== 'undefined' && this.audioBuffer && // no point in updating if it's the same - this.audioTimestampOffset_ !== offset) { - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.timestampOffset(offset), - name: 'timestampOffset' - }); - this.audioTimestampOffset_ = offset; - } - - return this.audioTimestampOffset_; - } - /** - * Set/get the timestampoffset on the video SourceBuffer - * - * @return {number} the timestamp offset - */ - ; - - _proto.videoTimestampOffset = function videoTimestampOffset(offset) { - if (typeof offset !== 'undefined' && this.videoBuffer && // no point in updating if it's the same - this.videoTimestampOffset !== offset) { - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.timestampOffset(offset), - name: 'timestampOffset' - }); - this.videoTimestampOffset_ = offset; - } - - return this.videoTimestampOffset_; - } - /** - * Add a function to the queue that will be called - * when it is its turn to run in the audio queue. - * - * @param {Function} callback - * The callback to queue. - */ - ; - - _proto.audioQueueCallback = function audioQueueCallback(callback) { - if (!this.audioBuffer) { - return; - } - - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.callback(callback), - name: 'callback' - }); - } - /** - * Add a function to the queue that will be called - * when it is its turn to run in the video queue. - * - * @param {Function} callback - * The callback to queue. - */ - ; - - _proto.videoQueueCallback = function videoQueueCallback(callback) { - if (!this.videoBuffer) { - return; - } - - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.callback(callback), - name: 'callback' - }); - } - /** - * dispose of the source updater and the underlying sourceBuffer - */ - ; - - _proto.dispose = function dispose() { - var _this4 = this; - - this.trigger('dispose'); - bufferTypes.forEach(function (type) { - _this4.abort(type); - - if (_this4.canRemoveSourceBuffer()) { - _this4.removeSourceBuffer(type); - } else { - _this4[type + "QueueCallback"](function () { - return cleanupBuffer(type, _this4); - }); - } - }); - this.videoAppendQueued_ = false; - this.delayedAudioAppendQueue_.length = 0; - - if (this.sourceopenListener_) { - this.mediaSource.removeEventListener('sourceopen', this.sourceopenListener_); - } - - this.off(); - }; - - return SourceUpdater; -}(videojs.EventTarget); - -var uint8ToUtf8 = function uint8ToUtf8(uintArray) { - return decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray))); -}; - -var VTT_LINE_TERMINATORS = new Uint8Array('\n\n'.split('').map(function (char) { - return char.charCodeAt(0); -})); -/** - * An object that manages segment loading and appending. - * - * @class VTTSegmentLoader - * @param {Object} options required and optional options - * @extends videojs.EventTarget - */ - -var VTTSegmentLoader = /*#__PURE__*/function (_SegmentLoader) { - _inheritsLoose(VTTSegmentLoader, _SegmentLoader); - - function VTTSegmentLoader(settings, options) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _SegmentLoader.call(this, settings, options) || this; // SegmentLoader requires a MediaSource be specified or it will throw an error; - // however, VTTSegmentLoader has no need of a media source, so delete the reference - - _this.mediaSource_ = null; - _this.subtitlesTrack_ = null; - _this.loaderType_ = 'subtitle'; - _this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks; // The VTT segment will have its own time mappings. Saving VTT segment timing info in - // the sync controller leads to improper behavior. - - _this.shouldSaveSegmentTimingInfo_ = false; - return _this; - } - - var _proto = VTTSegmentLoader.prototype; - - _proto.createTransmuxer_ = function createTransmuxer_() { - // don't need to transmux any subtitles - return null; - } - /** - * Indicates which time ranges are buffered - * - * @return {TimeRange} - * TimeRange object representing the current buffered ranges - */ - ; - - _proto.buffered_ = function buffered_() { - if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) { - return videojs.createTimeRanges(); - } - - var cues = this.subtitlesTrack_.cues; - var start = cues[0].startTime; - var end = cues[cues.length - 1].startTime; - return videojs.createTimeRanges([[start, end]]); - } - /** - * Gets and sets init segment for the provided map - * - * @param {Object} map - * The map object representing the init segment to get or set - * @param {boolean=} set - * If true, the init segment for the provided map should be saved - * @return {Object} - * map object for desired init segment - */ - ; - - _proto.initSegmentForMap = function initSegmentForMap(map, set) { - if (set === void 0) { - set = false; - } - - if (!map) { - return null; - } - - var id = initSegmentId(map); - var storedMap = this.initSegments_[id]; - - if (set && !storedMap && map.bytes) { - // append WebVTT line terminators to the media initialization segment if it exists - // to follow the WebVTT spec (https://w3c.github.io/webvtt/#file-structure) that - // requires two or more WebVTT line terminators between the WebVTT header and the - // rest of the file - var combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength; - var combinedSegment = new Uint8Array(combinedByteLength); - combinedSegment.set(map.bytes); - combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength); - this.initSegments_[id] = storedMap = { - resolvedUri: map.resolvedUri, - byterange: map.byterange, - bytes: combinedSegment - }; - } - - return storedMap || map; - } - /** - * Returns true if all configuration required for loading is present, otherwise false. - * - * @return {boolean} True if the all configuration is ready for loading - * @private - */ - ; - - _proto.couldBeginLoading_ = function couldBeginLoading_() { - return this.playlist_ && this.subtitlesTrack_ && !this.paused(); - } - /** - * Once all the starting parameters have been specified, begin - * operation. This method should only be invoked from the INIT - * state. - * - * @private - */ - ; - - _proto.init_ = function init_() { - this.state = 'READY'; - this.resetEverything(); - return this.monitorBuffer_(); - } - /** - * Set a subtitle track on the segment loader to add subtitles to - * - * @param {TextTrack=} track - * The text track to add loaded subtitles to - * @return {TextTrack} - * Returns the subtitles track - */ - ; - - _proto.track = function track(_track) { - if (typeof _track === 'undefined') { - return this.subtitlesTrack_; - } - - this.subtitlesTrack_ = _track; // if we were unpaused but waiting for a sourceUpdater, start - // buffering now - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - this.init_(); - } - - return this.subtitlesTrack_; - } - /** - * Remove any data in the source buffer between start and end times - * - * @param {number} start - the start time of the region to remove from the buffer - * @param {number} end - the end time of the region to remove from the buffer - */ - ; - - _proto.remove = function remove(start, end) { - removeCuesFromTrack(start, end, this.subtitlesTrack_); - } - /** - * fill the buffer with segements unless the sourceBuffers are - * currently updating - * - * Note: this function should only ever be called by monitorBuffer_ - * and never directly - * - * @private - */ - ; - - _proto.fillBuffer_ = function fillBuffer_() { - var _this2 = this; - - // see if we need to begin loading immediately - var segmentInfo = this.chooseNextRequest_(); - - if (!segmentInfo) { - return; - } - - if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) { - // We don't have the timestamp offset that we need to sync subtitles. - // Rerun on a timestamp offset or user interaction. - var checkTimestampOffset = function checkTimestampOffset() { - _this2.state = 'READY'; - - if (!_this2.paused()) { - // if not paused, queue a buffer check as soon as possible - _this2.monitorBuffer_(); - } - }; - - this.syncController_.one('timestampoffset', checkTimestampOffset); - this.state = 'WAITING_ON_TIMELINE'; - return; - } - - this.loadSegment_(segmentInfo); - } // never set a timestamp offset for vtt segments. - ; - - _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_() { - return null; - }; - - _proto.chooseNextRequest_ = function chooseNextRequest_() { - return this.skipEmptySegments_(_SegmentLoader.prototype.chooseNextRequest_.call(this)); - } - /** - * Prevents the segment loader from requesting segments we know contain no subtitles - * by walking forward until we find the next segment that we don't know whether it is - * empty or not. - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @return {Object} - * a segment info object that describes the current segment - */ - ; - - _proto.skipEmptySegments_ = function skipEmptySegments_(segmentInfo) { - while (segmentInfo && segmentInfo.segment.empty) { - // stop at the last possible segmentInfo - if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) { - segmentInfo = null; - break; - } - - segmentInfo = this.generateSegmentInfo_({ - playlist: segmentInfo.playlist, - mediaIndex: segmentInfo.mediaIndex + 1, - startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration, - isSyncRequest: segmentInfo.isSyncRequest - }); - } - - return segmentInfo; - }; - - _proto.stopForError = function stopForError(error) { - this.error(error); - this.state = 'READY'; - this.pause(); - this.trigger('error'); - } - /** - * append a decrypted segement to the SourceBuffer through a SourceUpdater - * - * @private - */ - ; - - _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) { - var _this3 = this; - - if (!this.subtitlesTrack_) { - this.state = 'READY'; - return; - } - - this.saveTransferStats_(simpleSegment.stats); // the request was aborted - - if (!this.pendingSegment_) { - this.state = 'READY'; - this.mediaRequestsAborted += 1; - return; - } - - if (error) { - if (error.code === REQUEST_ERRORS.TIMEOUT) { - this.handleTimeout_(); - } - - if (error.code === REQUEST_ERRORS.ABORTED) { - this.mediaRequestsAborted += 1; - } else { - this.mediaRequestsErrored += 1; - } - - this.stopForError(error); - return; - } - - var segmentInfo = this.pendingSegment_; // although the VTT segment loader bandwidth isn't really used, it's good to - // maintain functionality between segment loaders - - this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats); - this.state = 'APPENDING'; // used for tests - - this.trigger('appending'); - var segment = segmentInfo.segment; - - if (segment.map) { - segment.map.bytes = simpleSegment.map.bytes; - } - - segmentInfo.bytes = simpleSegment.bytes; // Make sure that vttjs has loaded, otherwise, wait till it finished loading - - if (typeof window.WebVTT !== 'function' && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) { - var loadHandler; - - var errorHandler = function errorHandler() { - _this3.subtitlesTrack_.tech_.off('vttjsloaded', loadHandler); - - _this3.stopForError({ - message: 'Error loading vtt.js' - }); - - return; - }; - - loadHandler = function loadHandler() { - _this3.subtitlesTrack_.tech_.off('vttjserror', errorHandler); - - _this3.segmentRequestFinished_(error, simpleSegment, result); - }; - - this.state = 'WAITING_ON_VTTJS'; - this.subtitlesTrack_.tech_.one('vttjsloaded', loadHandler); - this.subtitlesTrack_.tech_.one('vttjserror', errorHandler); - return; - } - - segment.requested = true; - - try { - this.parseVTTCues_(segmentInfo); - } catch (e) { - this.stopForError({ - message: e.message - }); - return; - } - - this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_); - - if (segmentInfo.cues.length) { - segmentInfo.timingInfo = { - start: segmentInfo.cues[0].startTime, - end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime - }; - } else { - segmentInfo.timingInfo = { - start: segmentInfo.startOfSegment, - end: segmentInfo.startOfSegment + segmentInfo.duration - }; - } - - if (segmentInfo.isSyncRequest) { - this.trigger('syncinfoupdate'); - this.pendingSegment_ = null; - this.state = 'READY'; - return; - } - - segmentInfo.byteLength = segmentInfo.bytes.byteLength; - this.mediaSecondsLoaded += segment.duration; // Create VTTCue instances for each cue in the new segment and add them to - // the subtitle track - - segmentInfo.cues.forEach(function (cue) { - _this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_ ? new window.VTTCue(cue.startTime, cue.endTime, cue.text) : cue); - }); // Remove any duplicate cues from the subtitle track. The WebVTT spec allows - // cues to have identical time-intervals, but if the text is also identical - // we can safely assume it is a duplicate that can be removed (ex. when a cue - // "overlaps" VTT segments) - - removeDuplicateCuesFromTrack(this.subtitlesTrack_); - this.handleAppendsDone_(); - }; - - _proto.handleData_ = function handleData_() {// noop as we shouldn't be getting video/audio data captions - // that we do not support here. - }; - - _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_() {// noop - } - /** - * Uses the WebVTT parser to parse the segment response - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @private - */ - ; - - _proto.parseVTTCues_ = function parseVTTCues_(segmentInfo) { - var decoder; - var decodeBytesToString = false; - - if (typeof window.TextDecoder === 'function') { - decoder = new window.TextDecoder('utf8'); - } else { - decoder = window.WebVTT.StringDecoder(); - decodeBytesToString = true; - } - - var parser = new window.WebVTT.Parser(window, window.vttjs, decoder); - segmentInfo.cues = []; - segmentInfo.timestampmap = { - MPEGTS: 0, - LOCAL: 0 - }; - parser.oncue = segmentInfo.cues.push.bind(segmentInfo.cues); - - parser.ontimestampmap = function (map) { - segmentInfo.timestampmap = map; - }; - - parser.onparsingerror = function (error) { - videojs.log.warn('Error encountered when parsing cues: ' + error.message); - }; - - if (segmentInfo.segment.map) { - var mapData = segmentInfo.segment.map.bytes; - - if (decodeBytesToString) { - mapData = uint8ToUtf8(mapData); - } - - parser.parse(mapData); - } - - var segmentData = segmentInfo.bytes; - - if (decodeBytesToString) { - segmentData = uint8ToUtf8(segmentData); - } - - parser.parse(segmentData); - parser.flush(); - } - /** - * Updates the start and end times of any cues parsed by the WebVTT parser using - * the information parsed from the X-TIMESTAMP-MAP header and a TS to media time mapping - * from the SyncController - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @param {Object} mappingObj - * object containing a mapping from TS to media time - * @param {Object} playlist - * the playlist object containing the segment - * @private - */ - ; - - _proto.updateTimeMapping_ = function updateTimeMapping_(segmentInfo, mappingObj, playlist) { - var segment = segmentInfo.segment; - - if (!mappingObj) { - // If the sync controller does not have a mapping of TS to Media Time for the - // timeline, then we don't have enough information to update the cue - // start/end times - return; - } - - if (!segmentInfo.cues.length) { - // If there are no cues, we also do not have enough information to figure out - // segment timing. Mark that the segment contains no cues so we don't re-request - // an empty segment. - segment.empty = true; - return; - } - - var timestampmap = segmentInfo.timestampmap; - var diff = timestampmap.MPEGTS / ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping; - segmentInfo.cues.forEach(function (cue) { - // First convert cue time to TS time using the timestamp-map provided within the vtt - cue.startTime += diff; - cue.endTime += diff; - }); - - if (!playlist.syncInfo) { - var firstStart = segmentInfo.cues[0].startTime; - var lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime; - playlist.syncInfo = { - mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex, - time: Math.min(firstStart, lastStart - segment.duration) - }; - } - }; - - return VTTSegmentLoader; -}(SegmentLoader); - -/** - * @file ad-cue-tags.js - */ -/** - * Searches for an ad cue that overlaps with the given mediaTime - * - * @param {Object} track - * the track to find the cue for - * - * @param {number} mediaTime - * the time to find the cue at - * - * @return {Object|null} - * the found cue or null - */ - -var findAdCue = function findAdCue(track, mediaTime) { - var cues = track.cues; - - for (var i = 0; i < cues.length; i++) { - var cue = cues[i]; - - if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) { - return cue; - } - } - - return null; -}; -var updateAdCues = function updateAdCues(media, track, offset) { - if (offset === void 0) { - offset = 0; - } - - if (!media.segments) { - return; - } - - var mediaTime = offset; - var cue; - - for (var i = 0; i < media.segments.length; i++) { - var segment = media.segments[i]; - - if (!cue) { - // Since the cues will span for at least the segment duration, adding a fudge - // factor of half segment duration will prevent duplicate cues from being - // created when timing info is not exact (e.g. cue start time initialized - // at 10.006677, but next call mediaTime is 10.003332 ) - cue = findAdCue(track, mediaTime + segment.duration / 2); - } - - if (cue) { - if ('cueIn' in segment) { - // Found a CUE-IN so end the cue - cue.endTime = mediaTime; - cue.adEndTime = mediaTime; - mediaTime += segment.duration; - cue = null; - continue; - } - - if (mediaTime < cue.endTime) { - // Already processed this mediaTime for this cue - mediaTime += segment.duration; - continue; - } // otherwise extend cue until a CUE-IN is found - - - cue.endTime += segment.duration; - } else { - if ('cueOut' in segment) { - cue = new window.VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut); - cue.adStartTime = mediaTime; // Assumes tag format to be - // #EXT-X-CUE-OUT:30 - - cue.adEndTime = mediaTime + parseFloat(segment.cueOut); - track.addCue(cue); - } - - if ('cueOutCont' in segment) { - // Entered into the middle of an ad cue - // Assumes tag formate to be - // #EXT-X-CUE-OUT-CONT:10/30 - var _segment$cueOutCont$s = segment.cueOutCont.split('/').map(parseFloat), - adOffset = _segment$cueOutCont$s[0], - adTotal = _segment$cueOutCont$s[1]; - - cue = new window.VTTCue(mediaTime, mediaTime + segment.duration, ''); - cue.adStartTime = mediaTime - adOffset; - cue.adEndTime = cue.adStartTime + adTotal; - track.addCue(cue); - } - } - - mediaTime += segment.duration; - } -}; - -var syncPointStrategies = [// Stategy "VOD": Handle the VOD-case where the sync-point is *always* -// the equivalence display-time 0 === segment-index 0 -{ - name: 'VOD', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (duration !== Infinity) { - var syncPoint = { - time: 0, - segmentIndex: 0, - partIndex: null - }; - return syncPoint; - } - - return null; - } -}, // Stategy "ProgramDateTime": We have a program-date-time tag in this playlist -{ - name: 'ProgramDateTime', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (!Object.keys(syncController.timelineToDatetimeMappings).length) { - return null; - } - - var syncPoint = null; - var lastDistance = null; - var partsAndSegments = getPartsAndSegments(playlist); - currentTime = currentTime || 0; - - for (var i = 0; i < partsAndSegments.length; i++) { - // start from the end and loop backwards for live - // or start from the front and loop forwards for non-live - var index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1); - var partAndSegment = partsAndSegments[index]; - var segment = partAndSegment.segment; - var datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline]; - - if (!datetimeMapping) { - continue; - } - - if (segment.dateTimeObject) { - var segmentTime = segment.dateTimeObject.getTime() / 1000; - var start = segmentTime + datetimeMapping; // take part duration into account. - - if (segment.parts && typeof partAndSegment.partIndex === 'number') { - for (var z = 0; z < partAndSegment.partIndex; z++) { - start += segment.parts[z].duration; - } - } - - var distance = Math.abs(currentTime - start); // Once the distance begins to increase, or if distance is 0, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && (distance === 0 || lastDistance < distance)) { - break; - } - - lastDistance = distance; - syncPoint = { - time: start, - segmentIndex: partAndSegment.segmentIndex, - partIndex: partAndSegment.partIndex - }; - } - } - - return syncPoint; - } -}, // Stategy "Segment": We have a known time mapping for a timeline and a -// segment in the current timeline with timing data -{ - name: 'Segment', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - var syncPoint = null; - var lastDistance = null; - currentTime = currentTime || 0; - var partsAndSegments = getPartsAndSegments(playlist); - - for (var i = 0; i < partsAndSegments.length; i++) { - // start from the end and loop backwards for live - // or start from the front and loop forwards for non-live - var index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1); - var partAndSegment = partsAndSegments[index]; - var segment = partAndSegment.segment; - var start = partAndSegment.part && partAndSegment.part.start || segment && segment.start; - - if (segment.timeline === currentTimeline && typeof start !== 'undefined') { - var distance = Math.abs(currentTime - start); // Once the distance begins to increase, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && lastDistance < distance) { - break; - } - - if (!syncPoint || lastDistance === null || lastDistance >= distance) { - lastDistance = distance; - syncPoint = { - time: start, - segmentIndex: partAndSegment.segmentIndex, - partIndex: partAndSegment.partIndex - }; - } - } - } - - return syncPoint; - } -}, // Stategy "Discontinuity": We have a discontinuity with a known -// display-time -{ - name: 'Discontinuity', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - var syncPoint = null; - currentTime = currentTime || 0; - - if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) { - var lastDistance = null; - - for (var i = 0; i < playlist.discontinuityStarts.length; i++) { - var segmentIndex = playlist.discontinuityStarts[i]; - var discontinuity = playlist.discontinuitySequence + i + 1; - var discontinuitySync = syncController.discontinuities[discontinuity]; - - if (discontinuitySync) { - var distance = Math.abs(currentTime - discontinuitySync.time); // Once the distance begins to increase, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && lastDistance < distance) { - break; - } - - if (!syncPoint || lastDistance === null || lastDistance >= distance) { - lastDistance = distance; - syncPoint = { - time: discontinuitySync.time, - segmentIndex: segmentIndex, - partIndex: null - }; - } - } - } - } - - return syncPoint; - } -}, // Stategy "Playlist": We have a playlist with a known mapping of -// segment index to display time -{ - name: 'Playlist', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (playlist.syncInfo) { - var syncPoint = { - time: playlist.syncInfo.time, - segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence, - partIndex: null - }; - return syncPoint; - } - - return null; - } -}]; - -var SyncController = /*#__PURE__*/function (_videojs$EventTarget) { - _inheritsLoose(SyncController, _videojs$EventTarget); - - function SyncController(options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; // ...for synching across variants - - _this.timelines = []; - _this.discontinuities = []; - _this.timelineToDatetimeMappings = {}; - _this.logger_ = logger('SyncController'); - return _this; - } - /** - * Find a sync-point for the playlist specified - * - * A sync-point is defined as a known mapping from display-time to - * a segment-index in the current playlist. - * - * @param {Playlist} playlist - * The playlist that needs a sync-point - * @param {number} duration - * Duration of the MediaSource (Infinite if playing a live source) - * @param {number} currentTimeline - * The last timeline from which a segment was loaded - * @return {Object} - * A sync-point object - */ - - - var _proto = SyncController.prototype; - - _proto.getSyncPoint = function getSyncPoint(playlist, duration, currentTimeline, currentTime) { - var syncPoints = this.runStrategies_(playlist, duration, currentTimeline, currentTime); - - if (!syncPoints.length) { - // Signal that we need to attempt to get a sync-point manually - // by fetching a segment in the playlist and constructing - // a sync-point from that information - return null; - } // Now find the sync-point that is closest to the currentTime because - // that should result in the most accurate guess about which segment - // to fetch - - - return this.selectSyncPoint_(syncPoints, { - key: 'time', - value: currentTime - }); - } - /** - * Calculate the amount of time that has expired off the playlist during playback - * - * @param {Playlist} playlist - * Playlist object to calculate expired from - * @param {number} duration - * Duration of the MediaSource (Infinity if playling a live source) - * @return {number|null} - * The amount of time that has expired off the playlist during playback. Null - * if no sync-points for the playlist can be found. - */ - ; - - _proto.getExpiredTime = function getExpiredTime(playlist, duration) { - if (!playlist || !playlist.segments) { - return null; - } - - var syncPoints = this.runStrategies_(playlist, duration, playlist.discontinuitySequence, 0); // Without sync-points, there is not enough information to determine the expired time - - if (!syncPoints.length) { - return null; - } - - var syncPoint = this.selectSyncPoint_(syncPoints, { - key: 'segmentIndex', - value: 0 - }); // If the sync-point is beyond the start of the playlist, we want to subtract the - // duration from index 0 to syncPoint.segmentIndex instead of adding. - - if (syncPoint.segmentIndex > 0) { - syncPoint.time *= -1; - } - - return Math.abs(syncPoint.time + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: syncPoint.segmentIndex, - endIndex: 0 - })); - } - /** - * Runs each sync-point strategy and returns a list of sync-points returned by the - * strategies - * - * @private - * @param {Playlist} playlist - * The playlist that needs a sync-point - * @param {number} duration - * Duration of the MediaSource (Infinity if playing a live source) - * @param {number} currentTimeline - * The last timeline from which a segment was loaded - * @return {Array} - * A list of sync-point objects - */ - ; - - _proto.runStrategies_ = function runStrategies_(playlist, duration, currentTimeline, currentTime) { - var syncPoints = []; // Try to find a sync-point in by utilizing various strategies... - - for (var i = 0; i < syncPointStrategies.length; i++) { - var strategy = syncPointStrategies[i]; - var syncPoint = strategy.run(this, playlist, duration, currentTimeline, currentTime); - - if (syncPoint) { - syncPoint.strategy = strategy.name; - syncPoints.push({ - strategy: strategy.name, - syncPoint: syncPoint - }); - } - } - - return syncPoints; - } - /** - * Selects the sync-point nearest the specified target - * - * @private - * @param {Array} syncPoints - * List of sync-points to select from - * @param {Object} target - * Object specifying the property and value we are targeting - * @param {string} target.key - * Specifies the property to target. Must be either 'time' or 'segmentIndex' - * @param {number} target.value - * The value to target for the specified key. - * @return {Object} - * The sync-point nearest the target - */ - ; - - _proto.selectSyncPoint_ = function selectSyncPoint_(syncPoints, target) { - var bestSyncPoint = syncPoints[0].syncPoint; - var bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value); - var bestStrategy = syncPoints[0].strategy; - - for (var i = 1; i < syncPoints.length; i++) { - var newDistance = Math.abs(syncPoints[i].syncPoint[target.key] - target.value); - - if (newDistance < bestDistance) { - bestDistance = newDistance; - bestSyncPoint = syncPoints[i].syncPoint; - bestStrategy = syncPoints[i].strategy; - } - } - - this.logger_("syncPoint for [" + target.key + ": " + target.value + "] chosen with strategy" + (" [" + bestStrategy + "]: [time:" + bestSyncPoint.time + ",") + (" segmentIndex:" + bestSyncPoint.segmentIndex) + (typeof bestSyncPoint.partIndex === 'number' ? ",partIndex:" + bestSyncPoint.partIndex : '') + ']'); - return bestSyncPoint; - } - /** - * Save any meta-data present on the segments when segments leave - * the live window to the playlist to allow for synchronization at the - * playlist level later. - * - * @param {Playlist} oldPlaylist - The previous active playlist - * @param {Playlist} newPlaylist - The updated and most current playlist - */ - ; - - _proto.saveExpiredSegmentInfo = function saveExpiredSegmentInfo(oldPlaylist, newPlaylist) { - var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; // When a segment expires from the playlist and it has a start time - // save that information as a possible sync-point reference in future - - for (var i = mediaSequenceDiff - 1; i >= 0; i--) { - var lastRemovedSegment = oldPlaylist.segments[i]; - - if (lastRemovedSegment && typeof lastRemovedSegment.start !== 'undefined') { - newPlaylist.syncInfo = { - mediaSequence: oldPlaylist.mediaSequence + i, - time: lastRemovedSegment.start - }; - this.logger_("playlist refresh sync: [time:" + newPlaylist.syncInfo.time + "," + (" mediaSequence: " + newPlaylist.syncInfo.mediaSequence + "]")); - this.trigger('syncinfoupdate'); - break; - } - } - } - /** - * Save the mapping from playlist's ProgramDateTime to display. This should only happen - * before segments start to load. - * - * @param {Playlist} playlist - The currently active playlist - */ - ; - - _proto.setDateTimeMappingForStart = function setDateTimeMappingForStart(playlist) { - // It's possible for the playlist to be updated before playback starts, meaning time - // zero is not yet set. If, during these playlist refreshes, a discontinuity is - // crossed, then the old time zero mapping (for the prior timeline) would be retained - // unless the mappings are cleared. - this.timelineToDatetimeMappings = {}; - - if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) { - var firstSegment = playlist.segments[0]; - var playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1000; - this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp; - } - } - /** - * Calculates and saves timeline mappings, playlist sync info, and segment timing values - * based on the latest timing information. - * - * @param {Object} options - * Options object - * @param {SegmentInfo} options.segmentInfo - * The current active request information - * @param {boolean} options.shouldSaveTimelineMapping - * If there's a timeline change, determines if the timeline mapping should be - * saved for timeline mapping and program date time mappings. - */ - ; - - _proto.saveSegmentTimingInfo = function saveSegmentTimingInfo(_ref) { - var segmentInfo = _ref.segmentInfo, - shouldSaveTimelineMapping = _ref.shouldSaveTimelineMapping; - var didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping); - var segment = segmentInfo.segment; - - if (didCalculateSegmentTimeMapping) { - this.saveDiscontinuitySyncInfo_(segmentInfo); // If the playlist does not have sync information yet, record that information - // now with segment timing information - - if (!segmentInfo.playlist.syncInfo) { - segmentInfo.playlist.syncInfo = { - mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex, - time: segment.start - }; - } - } - - var dateTime = segment.dateTimeObject; - - if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) { - this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1000); - } - }; - - _proto.timestampOffsetForTimeline = function timestampOffsetForTimeline(timeline) { - if (typeof this.timelines[timeline] === 'undefined') { - return null; - } - - return this.timelines[timeline].time; - }; - - _proto.mappingForTimeline = function mappingForTimeline(timeline) { - if (typeof this.timelines[timeline] === 'undefined') { - return null; - } - - return this.timelines[timeline].mapping; - } - /** - * Use the "media time" for a segment to generate a mapping to "display time" and - * save that display time to the segment. - * - * @private - * @param {SegmentInfo} segmentInfo - * The current active request information - * @param {Object} timingInfo - * The start and end time of the current segment in "media time" - * @param {boolean} shouldSaveTimelineMapping - * If there's a timeline change, determines if the timeline mapping should be - * saved in timelines. - * @return {boolean} - * Returns false if segment time mapping could not be calculated - */ - ; - - _proto.calculateSegmentTimeMapping_ = function calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) { - // TODO: remove side effects - var segment = segmentInfo.segment; - var part = segmentInfo.part; - var mappingObj = this.timelines[segmentInfo.timeline]; - var start; - var end; - - if (typeof segmentInfo.timestampOffset === 'number') { - mappingObj = { - time: segmentInfo.startOfSegment, - mapping: segmentInfo.startOfSegment - timingInfo.start - }; - - if (shouldSaveTimelineMapping) { - this.timelines[segmentInfo.timeline] = mappingObj; - this.trigger('timestampoffset'); - this.logger_("time mapping for timeline " + segmentInfo.timeline + ": " + ("[time: " + mappingObj.time + "] [mapping: " + mappingObj.mapping + "]")); - } - - start = segmentInfo.startOfSegment; - end = timingInfo.end + mappingObj.mapping; - } else if (mappingObj) { - start = timingInfo.start + mappingObj.mapping; - end = timingInfo.end + mappingObj.mapping; - } else { - return false; - } - - if (part) { - part.start = start; - part.end = end; - } // If we don't have a segment start yet or the start value we got - // is less than our current segment.start value, save a new start value. - // We have to do this because parts will have segment timing info saved - // multiple times and we want segment start to be the earliest part start - // value for that segment. - - - if (!segment.start || start < segment.start) { - segment.start = start; - } - - segment.end = end; - return true; - } - /** - * Each time we have discontinuity in the playlist, attempt to calculate the location - * in display of the start of the discontinuity and save that. We also save an accuracy - * value so that we save values with the most accuracy (closest to 0.) - * - * @private - * @param {SegmentInfo} segmentInfo - The current active request information - */ - ; - - _proto.saveDiscontinuitySyncInfo_ = function saveDiscontinuitySyncInfo_(segmentInfo) { - var playlist = segmentInfo.playlist; - var segment = segmentInfo.segment; // If the current segment is a discontinuity then we know exactly where - // the start of the range and it's accuracy is 0 (greater accuracy values - // mean more approximation) - - if (segment.discontinuity) { - this.discontinuities[segment.timeline] = { - time: segment.start, - accuracy: 0 - }; - } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) { - // Search for future discontinuities that we can provide better timing - // information for and save that information for sync purposes - for (var i = 0; i < playlist.discontinuityStarts.length; i++) { - var segmentIndex = playlist.discontinuityStarts[i]; - var discontinuity = playlist.discontinuitySequence + i + 1; - var mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex; - var accuracy = Math.abs(mediaIndexDiff); - - if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) { - var time = void 0; - - if (mediaIndexDiff < 0) { - time = segment.start - sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: segmentInfo.mediaIndex, - endIndex: segmentIndex - }); - } else { - time = segment.end + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: segmentInfo.mediaIndex + 1, - endIndex: segmentIndex - }); - } - - this.discontinuities[discontinuity] = { - time: time, - accuracy: accuracy - }; - } - } - } - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.off(); - }; - - return SyncController; -}(videojs.EventTarget); - -/** - * The TimelineChangeController acts as a source for segment loaders to listen for and - * keep track of latest and pending timeline changes. This is useful to ensure proper - * sync, as each loader may need to make a consideration for what timeline the other - * loader is on before making changes which could impact the other loader's media. - * - * @class TimelineChangeController - * @extends videojs.EventTarget - */ - -var TimelineChangeController = /*#__PURE__*/function (_videojs$EventTarget) { - _inheritsLoose(TimelineChangeController, _videojs$EventTarget); - - function TimelineChangeController() { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - _this.pendingTimelineChanges_ = {}; - _this.lastTimelineChanges_ = {}; - return _this; - } - - var _proto = TimelineChangeController.prototype; - - _proto.clearPendingTimelineChange = function clearPendingTimelineChange(type) { - this.pendingTimelineChanges_[type] = null; - this.trigger('pendingtimelinechange'); - }; - - _proto.pendingTimelineChange = function pendingTimelineChange(_ref) { - var type = _ref.type, - from = _ref.from, - to = _ref.to; - - if (typeof from === 'number' && typeof to === 'number') { - this.pendingTimelineChanges_[type] = { - type: type, - from: from, - to: to - }; - this.trigger('pendingtimelinechange'); - } - - return this.pendingTimelineChanges_[type]; - }; - - _proto.lastTimelineChange = function lastTimelineChange(_ref2) { - var type = _ref2.type, - from = _ref2.from, - to = _ref2.to; - - if (typeof from === 'number' && typeof to === 'number') { - this.lastTimelineChanges_[type] = { - type: type, - from: from, - to: to - }; - delete this.pendingTimelineChanges_[type]; - this.trigger('timelinechange'); - } - - return this.lastTimelineChanges_[type]; - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.pendingTimelineChanges_ = {}; - this.lastTimelineChanges_ = {}; - this.off(); - }; - - return TimelineChangeController; -}(videojs.EventTarget); - -/* rollup-plugin-worker-factory start for worker!/Users/gkatsevman/p/http-streaming-release/src/decrypter-worker.js */ -var workerCode = transform(getWorkerString(function () { - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function require(path, base) { - return commonjsRequire(path, base === undefined || base === null ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire() { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var createClass = createCommonjsModule(function (module) { - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - module.exports = _createClass; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - var setPrototypeOf = createCommonjsModule(function (module) { - function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _setPrototypeOf(o, p); - } - - module.exports = _setPrototypeOf; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - var inheritsLoose = createCommonjsModule(function (module) { - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); - } - - module.exports = _inheritsLoose; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - /** - * @file stream.js - */ - - /** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ - - var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; - }(); - /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ - - /** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - - - function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); - } - /*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */ - - /** - * @file aes.js - * - * This file contains an adaptation of the AES decryption algorithm - * from the Standford Javascript Cryptography Library. That work is - * covered by the following copyright and permissions notice: - * - * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 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. - * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing - * official policies, either expressed or implied, of the authors. - */ - - /** - * Expand the S-box tables. - * - * @private - */ - - - var precompute = function precompute() { - var tables = [[[], [], [], [], []], [[], [], [], [], []]]; - var encTable = tables[0]; - var decTable = tables[1]; - var sbox = encTable[4]; - var sboxInv = decTable[4]; - var i; - var x; - var xInv; - var d = []; - var th = []; - var x2; - var x4; - var x8; - var s; - var tEnc; - var tDec; // Compute double and third tables - - for (i = 0; i < 256; i++) { - th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i; - } - - for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) { - // Compute sbox - s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4; - s = s >> 8 ^ s & 255 ^ 99; - sbox[x] = s; - sboxInv[s] = x; // Compute MixColumns - - x8 = d[x4 = d[x2 = d[x]]]; - tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - tEnc = d[s] * 0x101 ^ s * 0x1010100; - - for (i = 0; i < 4; i++) { - encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8; - decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8; - } - } // Compactify. Considerable speedup on Firefox. - - - for (i = 0; i < 5; i++) { - encTable[i] = encTable[i].slice(0); - decTable[i] = decTable[i].slice(0); - } - - return tables; - }; - - var aesTables = null; - /** - * Schedule out an AES key for both encryption and decryption. This - * is a low-level class. Use a cipher mode to do bulk encryption. - * - * @class AES - * @param key {Array} The key as an array of 4, 6 or 8 words. - */ - - var AES = /*#__PURE__*/function () { - function AES(key) { - /** - * The expanded S-box and inverse S-box tables. These will be computed - * on the client so that we don't have to send them down the wire. - * - * There are two tables, _tables[0] is for encryption and - * _tables[1] is for decryption. - * - * The first 4 sub-tables are the expanded S-box with MixColumns. The - * last (_tables[01][4]) is the S-box itself. - * - * @private - */ - // if we have yet to precompute the S-box tables - // do so now - if (!aesTables) { - aesTables = precompute(); - } // then make a copy of that object for use - - - this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]]; - var i; - var j; - var tmp; - var sbox = this._tables[0][4]; - var decTable = this._tables[1]; - var keyLen = key.length; - var rcon = 1; - - if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) { - throw new Error('Invalid aes key size'); - } - - var encKey = key.slice(0); - var decKey = []; - this._key = [encKey, decKey]; // schedule encryption keys - - for (i = keyLen; i < 4 * keyLen + 28; i++) { - tmp = encKey[i - 1]; // apply sbox - - if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) { - tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; // shift rows and add rcon - - if (i % keyLen === 0) { - tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24; - rcon = rcon << 1 ^ (rcon >> 7) * 283; - } - } - - encKey[i] = encKey[i - keyLen] ^ tmp; - } // schedule decryption keys - - - for (j = 0; i; j++, i--) { - tmp = encKey[j & 3 ? i : i - 4]; - - if (i <= 4 || j < 4) { - decKey[j] = tmp; - } else { - decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]]; - } - } - } - /** - * Decrypt 16 bytes, specified as four 32-bit words. - * - * @param {number} encrypted0 the first word to decrypt - * @param {number} encrypted1 the second word to decrypt - * @param {number} encrypted2 the third word to decrypt - * @param {number} encrypted3 the fourth word to decrypt - * @param {Int32Array} out the array to write the decrypted words - * into - * @param {number} offset the offset into the output array to start - * writing results - * @return {Array} The plaintext. - */ - - - var _proto = AES.prototype; - - _proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) { - var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data - - var a = encrypted0 ^ key[0]; - var b = encrypted3 ^ key[1]; - var c = encrypted2 ^ key[2]; - var d = encrypted1 ^ key[3]; - var a2; - var b2; - var c2; // key.length === 2 ? - - var nInnerRounds = key.length / 4 - 2; - var i; - var kIndex = 4; - var table = this._tables[1]; // load up the tables - - var table0 = table[0]; - var table1 = table[1]; - var table2 = table[2]; - var table3 = table[3]; - var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL. - - for (i = 0; i < nInnerRounds; i++) { - a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex]; - b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1]; - c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2]; - d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3]; - kIndex += 4; - a = a2; - b = b2; - c = c2; - } // Last round. - - - for (i = 0; i < 4; i++) { - out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++]; - a2 = a; - a = b; - b = c; - c = d; - d = a2; - } - }; - - return AES; - }(); - /** - * A wrapper around the Stream class to use setTimeout - * and run stream "jobs" Asynchronously - * - * @class AsyncStream - * @extends Stream - */ - - - var AsyncStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(AsyncStream, _Stream); - - function AsyncStream() { - var _this; - - _this = _Stream.call(this, Stream) || this; - _this.jobs = []; - _this.delay = 1; - _this.timeout_ = null; - return _this; - } - /** - * process an async job - * - * @private - */ - - - var _proto = AsyncStream.prototype; - - _proto.processJob_ = function processJob_() { - this.jobs.shift()(); - - if (this.jobs.length) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } else { - this.timeout_ = null; - } - } - /** - * push a job into the stream - * - * @param {Function} job the job to push into the stream - */ - ; - - _proto.push = function push(job) { - this.jobs.push(job); - - if (!this.timeout_) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } - }; - - return AsyncStream; - }(Stream); - /** - * Convert network-order (big-endian) bytes into their little-endian - * representation. - */ - - - var ntoh = function ntoh(word) { - return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24; - }; - /** - * Decrypt bytes using AES-128 with CBC and PKCS#7 padding. - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * use for the first round of CBC. - * @return {Uint8Array} the decrypted bytes - * - * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard - * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29 - * @see https://tools.ietf.org/html/rfc2315 - */ - - - var decrypt = function decrypt(encrypted, key, initVector) { - // word-level access to the encrypted bytes - var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2); - var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output - - var decrypted = new Uint8Array(encrypted.byteLength); - var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and - // decrypted data - - var init0; - var init1; - var init2; - var init3; - var encrypted0; - var encrypted1; - var encrypted2; - var encrypted3; // iteration variable - - var wordIx; // pull out the words of the IV to ensure we don't modify the - // passed-in reference and easier access - - init0 = initVector[0]; - init1 = initVector[1]; - init2 = initVector[2]; - init3 = initVector[3]; // decrypt four word sequences, applying cipher-block chaining (CBC) - // to each decrypted block - - for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { - // convert big-endian (network order) words into little-endian - // (javascript order) - encrypted0 = ntoh(encrypted32[wordIx]); - encrypted1 = ntoh(encrypted32[wordIx + 1]); - encrypted2 = ntoh(encrypted32[wordIx + 2]); - encrypted3 = ntoh(encrypted32[wordIx + 3]); // decrypt the block - - decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); // XOR with the IV, and restore network byte-order to obtain the - // plaintext - - decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0); - decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1); - decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2); - decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); // setup the IV for the next round - - init0 = encrypted0; - init1 = encrypted1; - init2 = encrypted2; - init3 = encrypted3; - } - - return decrypted; - }; - /** - * The `Decrypter` class that manages decryption of AES - * data through `AsyncStream` objects and the `decrypt` - * function - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * @param {Function} done the function to run when done - * @class Decrypter - */ - - - var Decrypter = /*#__PURE__*/function () { - function Decrypter(encrypted, key, initVector, done) { - var step = Decrypter.STEP; - var encrypted32 = new Int32Array(encrypted.buffer); - var decrypted = new Uint8Array(encrypted.byteLength); - var i = 0; - this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously - - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - - for (i = step; i < encrypted32.length; i += step) { - initVector = new Uint32Array([ntoh(encrypted32[i - 4]), ntoh(encrypted32[i - 3]), ntoh(encrypted32[i - 2]), ntoh(encrypted32[i - 1])]); - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - } // invoke the done() callback when everything is finished - - - this.asyncStream_.push(function () { - // remove pkcs#7 padding from the decrypted bytes - done(null, unpad(decrypted)); - }); - } - /** - * a getter for step the maximum number of bytes to process at one time - * - * @return {number} the value of step 32000 - */ - - - var _proto = Decrypter.prototype; - /** - * @private - */ - - _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) { - return function () { - var bytes = decrypt(encrypted, key, initVector); - decrypted.set(bytes, encrypted.byteOffset); - }; - }; - - createClass(Decrypter, null, [{ - key: "STEP", - get: function get() { - // 4 * 8000; - return 32000; - } - }]); - return Decrypter; - }(); - /** - * @file bin-utils.js - */ - - /** - * Creates an object for sending to a web worker modifying properties that are TypedArrays - * into a new object with seperated properties for the buffer, byteOffset, and byteLength. - * - * @param {Object} message - * Object of properties and values to send to the web worker - * @return {Object} - * Modified message with TypedArray values expanded - * @function createTransferableMessage - */ - - - var createTransferableMessage = function createTransferableMessage(message) { - var transferable = {}; - Object.keys(message).forEach(function (key) { - var value = message[key]; - - if (ArrayBuffer.isView(value)) { - transferable[key] = { - bytes: value.buffer, - byteOffset: value.byteOffset, - byteLength: value.byteLength - }; - } else { - transferable[key] = value; - } - }); - return transferable; - }; - /* global self */ - - /** - * Our web worker interface so that things can talk to aes-decrypter - * that will be running in a web worker. the scope is passed to this by - * webworkify. - */ - - - self.onmessage = function (event) { - var data = event.data; - var encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength); - var key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4); - var iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4); - /* eslint-disable no-new, handle-callback-err */ - - new Decrypter(encrypted, key, iv, function (err, bytes) { - self.postMessage(createTransferableMessage({ - source: data.source, - decrypted: bytes - }), [bytes.buffer]); - }); - /* eslint-enable */ - }; -})); -var Decrypter = factory(workerCode); -/* rollup-plugin-worker-factory end for worker!/Users/gkatsevman/p/http-streaming-release/src/decrypter-worker.js */ - -/** - * Convert the properties of an HLS track into an audioTrackKind. - * - * @private - */ - -var audioTrackKind_ = function audioTrackKind_(properties) { - var kind = properties.default ? 'main' : 'alternative'; - - if (properties.characteristics && properties.characteristics.indexOf('public.accessibility.describes-video') >= 0) { - kind = 'main-desc'; - } - - return kind; -}; -/** - * Pause provided segment loader and playlist loader if active - * - * @param {SegmentLoader} segmentLoader - * SegmentLoader to pause - * @param {Object} mediaType - * Active media type - * @function stopLoaders - */ - - -var stopLoaders = function stopLoaders(segmentLoader, mediaType) { - segmentLoader.abort(); - segmentLoader.pause(); - - if (mediaType && mediaType.activePlaylistLoader) { - mediaType.activePlaylistLoader.pause(); - mediaType.activePlaylistLoader = null; - } -}; -/** - * Start loading provided segment loader and playlist loader - * - * @param {PlaylistLoader} playlistLoader - * PlaylistLoader to start loading - * @param {Object} mediaType - * Active media type - * @function startLoaders - */ - -var startLoaders = function startLoaders(playlistLoader, mediaType) { - // Segment loader will be started after `loadedmetadata` or `loadedplaylist` from the - // playlist loader - mediaType.activePlaylistLoader = playlistLoader; - playlistLoader.load(); -}; -/** - * Returns a function to be called when the media group changes. It performs a - * non-destructive (preserve the buffer) resync of the SegmentLoader. This is because a - * change of group is merely a rendition switch of the same content at another encoding, - * rather than a change of content, such as switching audio from English to Spanish. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Handler for a non-destructive resync of SegmentLoader when the active media - * group changes. - * @function onGroupChanged - */ - -var onGroupChanged = function onGroupChanged(type, settings) { - return function () { - var _settings$segmentLoad = settings.segmentLoaders, - segmentLoader = _settings$segmentLoad[type], - mainSegmentLoader = _settings$segmentLoad.main, - mediaType = settings.mediaTypes[type]; - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.getActiveGroup(); - var previousActiveLoader = mediaType.activePlaylistLoader; - var lastGroup = mediaType.lastGroup_; // the group did not change do nothing - - if (activeGroup && lastGroup && activeGroup.id === lastGroup.id) { - return; - } - - mediaType.lastGroup_ = activeGroup; - mediaType.lastTrack_ = activeTrack; - stopLoaders(segmentLoader, mediaType); - - if (!activeGroup || activeGroup.isMasterPlaylist) { - // there is no group active or active group is a main playlist and won't change - return; - } - - if (!activeGroup.playlistLoader) { - if (previousActiveLoader) { - // The previous group had a playlist loader but the new active group does not - // this means we are switching from demuxed to muxed audio. In this case we want to - // do a destructive reset of the main segment loader and not restart the audio - // loaders. - mainSegmentLoader.resetEverything(); - } - - return; - } // Non-destructive resync - - - segmentLoader.resyncLoader(); - startLoaders(activeGroup.playlistLoader, mediaType); - }; -}; -var onGroupChanging = function onGroupChanging(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - mediaType.lastGroup_ = null; - segmentLoader.abort(); - segmentLoader.pause(); - }; -}; -/** - * Returns a function to be called when the media track changes. It performs a - * destructive reset of the SegmentLoader to ensure we start loading as close to - * currentTime as possible. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Handler for a destructive reset of SegmentLoader when the active media - * track changes. - * @function onTrackChanged - */ - -var onTrackChanged = function onTrackChanged(type, settings) { - return function () { - var masterPlaylistLoader = settings.masterPlaylistLoader, - _settings$segmentLoad2 = settings.segmentLoaders, - segmentLoader = _settings$segmentLoad2[type], - mainSegmentLoader = _settings$segmentLoad2.main, - mediaType = settings.mediaTypes[type]; - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.getActiveGroup(); - var previousActiveLoader = mediaType.activePlaylistLoader; - var lastTrack = mediaType.lastTrack_; // track did not change, do nothing - - if (lastTrack && activeTrack && lastTrack.id === activeTrack.id) { - return; - } - - mediaType.lastGroup_ = activeGroup; - mediaType.lastTrack_ = activeTrack; - stopLoaders(segmentLoader, mediaType); - - if (!activeGroup) { - // there is no group active so we do not want to restart loaders - return; - } - - if (activeGroup.isMasterPlaylist) { - // track did not change, do nothing - if (!activeTrack || !lastTrack || activeTrack.id === lastTrack.id) { - return; - } - - var mpc = settings.vhs.masterPlaylistController_; - var newPlaylist = mpc.selectPlaylist(); // media will not change do nothing - - if (mpc.media() === newPlaylist) { - return; - } - - mediaType.logger_("track change. Switching master audio from " + lastTrack.id + " to " + activeTrack.id); - masterPlaylistLoader.pause(); - mainSegmentLoader.resetEverything(); - mpc.fastQualityChange_(newPlaylist); - return; - } - - if (type === 'AUDIO') { - if (!activeGroup.playlistLoader) { - // when switching from demuxed audio/video to muxed audio/video (noted by no - // playlist loader for the audio group), we want to do a destructive reset of the - // main segment loader and not restart the audio loaders - mainSegmentLoader.setAudio(true); // don't have to worry about disabling the audio of the audio segment loader since - // it should be stopped - - mainSegmentLoader.resetEverything(); - return; - } // although the segment loader is an audio segment loader, call the setAudio - // function to ensure it is prepared to re-append the init segment (or handle other - // config changes) - - - segmentLoader.setAudio(true); - mainSegmentLoader.setAudio(false); - } - - if (previousActiveLoader === activeGroup.playlistLoader) { - // Nothing has actually changed. This can happen because track change events can fire - // multiple times for a "single" change. One for enabling the new active track, and - // one for disabling the track that was active - startLoaders(activeGroup.playlistLoader, mediaType); - return; - } - - if (segmentLoader.track) { - // For WebVTT, set the new text track in the segmentloader - segmentLoader.track(activeTrack); - } // destructive reset - - - segmentLoader.resetEverything(); - startLoaders(activeGroup.playlistLoader, mediaType); - }; -}; -var onError = { - /** - * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters - * an error. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Error handler. Logs warning (or error if the playlist is blacklisted) to - * console and switches back to default audio track. - * @function onError.AUDIO - */ - AUDIO: function AUDIO(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type], - blacklistCurrentPlaylist = settings.blacklistCurrentPlaylist; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track - - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.activeGroup(); - var id = (activeGroup.filter(function (group) { - return group.default; - })[0] || activeGroup[0]).id; - var defaultTrack = mediaType.tracks[id]; - - if (activeTrack === defaultTrack) { - // Default track encountered an error. All we can do now is blacklist the current - // rendition and hope another will switch audio groups - blacklistCurrentPlaylist({ - message: 'Problem encountered loading the default audio track.' - }); - return; - } - - videojs.log.warn('Problem encountered loading the alternate audio track.' + 'Switching back to default.'); - - for (var trackId in mediaType.tracks) { - mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack; - } - - mediaType.onTrackChanged(); - }; - }, - - /** - * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters - * an error. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Error handler. Logs warning to console and disables the active subtitle track - * @function onError.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - videojs.log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); - var track = mediaType.activeTrack(); - - if (track) { - track.mode = 'disabled'; - } - - mediaType.onTrackChanged(); - }; - } -}; -var setupListeners = { - /** - * Setup event listeners for audio playlist loader - * - * @param {string} type - * MediaGroup type - * @param {PlaylistLoader|null} playlistLoader - * PlaylistLoader to register listeners on - * @param {Object} settings - * Object containing required information for media groups - * @function setupListeners.AUDIO - */ - AUDIO: function AUDIO(type, playlistLoader, settings) { - if (!playlistLoader) { - // no playlist loader means audio will be muxed with the video - return; - } - - var tech = settings.tech, - requestOptions = settings.requestOptions, - segmentLoader = settings.segmentLoaders[type]; - playlistLoader.on('loadedmetadata', function () { - var media = playlistLoader.media(); - segmentLoader.playlist(media, requestOptions); // if the video is already playing, or if this isn't a live video and preload - // permits, start downloading segments - - if (!tech.paused() || media.endList && tech.preload() !== 'none') { - segmentLoader.load(); - } - }); - playlistLoader.on('loadedplaylist', function () { - segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running - - if (!tech.paused()) { - segmentLoader.load(); - } - }); - playlistLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup event listeners for subtitle playlist loader - * - * @param {string} type - * MediaGroup type - * @param {PlaylistLoader|null} playlistLoader - * PlaylistLoader to register listeners on - * @param {Object} settings - * Object containing required information for media groups - * @function setupListeners.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, playlistLoader, settings) { - var tech = settings.tech, - requestOptions = settings.requestOptions, - segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - playlistLoader.on('loadedmetadata', function () { - var media = playlistLoader.media(); - segmentLoader.playlist(media, requestOptions); - segmentLoader.track(mediaType.activeTrack()); // if the video is already playing, or if this isn't a live video and preload - // permits, start downloading segments - - if (!tech.paused() || media.endList && tech.preload() !== 'none') { - segmentLoader.load(); - } - }); - playlistLoader.on('loadedplaylist', function () { - segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running - - if (!tech.paused()) { - segmentLoader.load(); - } - }); - playlistLoader.on('error', onError[type](type, settings)); - } -}; -var initialize = { - /** - * Setup PlaylistLoaders and AudioTracks for the audio groups - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize.AUDIO - */ - 'AUDIO': function AUDIO(type, settings) { - var vhs = settings.vhs, - sourceType = settings.sourceType, - segmentLoader = settings.segmentLoaders[type], - requestOptions = settings.requestOptions, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$ = settings.mediaTypes[type], - groups = _settings$mediaTypes$.groups, - tracks = _settings$mediaTypes$.tracks, - logger_ = _settings$mediaTypes$.logger_, - masterPlaylistLoader = settings.masterPlaylistLoader; - var audioOnlyMaster = isAudioOnly(masterPlaylistLoader.master); // force a default if we have none - - if (!mediaGroups[type] || Object.keys(mediaGroups[type]).length === 0) { - mediaGroups[type] = { - main: { - default: { - default: true - } - } - }; - } - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - var properties = mediaGroups[type][groupId][variantLabel]; - var playlistLoader = void 0; - - if (audioOnlyMaster) { - logger_("AUDIO group '" + groupId + "' label '" + variantLabel + "' is a master playlist"); - properties.isMasterPlaylist = true; - playlistLoader = null; // if vhs-json was provided as the source, and the media playlist was resolved, - // use the resolved media playlist object - } else if (sourceType === 'vhs-json' && properties.playlists) { - playlistLoader = new PlaylistLoader(properties.playlists[0], vhs, requestOptions); - } else if (properties.resolvedUri) { - playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions); // TODO: dash isn't the only type with properties.playlists - // should we even have properties.playlists in this check. - } else if (properties.playlists && sourceType === 'dash') { - playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader); - } else { - // no resolvedUri means the audio is muxed with the video when using this - // audio track - playlistLoader = null; - } - - properties = videojs.mergeOptions({ - id: variantLabel, - playlistLoader: playlistLoader - }, properties); - setupListeners[type](type, properties.playlistLoader, settings); - groups[groupId].push(properties); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = new videojs.AudioTrack({ - id: variantLabel, - kind: audioTrackKind_(properties), - enabled: false, - language: properties.language, - default: properties.default, - label: variantLabel - }); - tracks[variantLabel] = track; - } - } - } // setup single error event handler for the segment loader - - - segmentLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup PlaylistLoaders and TextTracks for the subtitle groups - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize.SUBTITLES - */ - 'SUBTITLES': function SUBTITLES(type, settings) { - var tech = settings.tech, - vhs = settings.vhs, - sourceType = settings.sourceType, - segmentLoader = settings.segmentLoaders[type], - requestOptions = settings.requestOptions, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$2 = settings.mediaTypes[type], - groups = _settings$mediaTypes$2.groups, - tracks = _settings$mediaTypes$2.tracks, - masterPlaylistLoader = settings.masterPlaylistLoader; - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - if (mediaGroups[type][groupId][variantLabel].forced) { - // Subtitle playlists with the forced attribute are not selectable in Safari. - // According to Apple's HLS Authoring Specification: - // If content has forced subtitles and regular subtitles in a given language, - // the regular subtitles track in that language MUST contain both the forced - // subtitles and the regular subtitles for that language. - // Because of this requirement and that Safari does not add forced subtitles, - // forced subtitles are skipped here to maintain consistent experience across - // all platforms - continue; - } - - var properties = mediaGroups[type][groupId][variantLabel]; - var playlistLoader = void 0; - - if (sourceType === 'hls') { - playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions); - } else if (sourceType === 'dash') { - var playlists = properties.playlists.filter(function (p) { - return p.excludeUntil !== Infinity; - }); - - if (!playlists.length) { - return; - } - - playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader); - } else if (sourceType === 'vhs-json') { - playlistLoader = new PlaylistLoader( // if the vhs-json object included the media playlist, use the media playlist - // as provided, otherwise use the resolved URI to load the playlist - properties.playlists ? properties.playlists[0] : properties.resolvedUri, vhs, requestOptions); - } - - properties = videojs.mergeOptions({ - id: variantLabel, - playlistLoader: playlistLoader - }, properties); - setupListeners[type](type, properties.playlistLoader, settings); - groups[groupId].push(properties); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = tech.addRemoteTextTrack({ - id: variantLabel, - kind: 'subtitles', - default: properties.default && properties.autoselect, - language: properties.language, - label: variantLabel - }, false).track; - tracks[variantLabel] = track; - } - } - } // setup single error event handler for the segment loader - - - segmentLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup TextTracks for the closed-caption groups - * - * @param {String} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize['CLOSED-CAPTIONS'] - */ - 'CLOSED-CAPTIONS': function CLOSEDCAPTIONS(type, settings) { - var tech = settings.tech, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$3 = settings.mediaTypes[type], - groups = _settings$mediaTypes$3.groups, - tracks = _settings$mediaTypes$3.tracks; - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - var properties = mediaGroups[type][groupId][variantLabel]; // Look for either 608 (CCn) or 708 (SERVICEn) caption services - - if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) { - continue; - } - - var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {}; - var newProps = { - label: variantLabel, - language: properties.language, - instreamId: properties.instreamId, - default: properties.default && properties.autoselect - }; - - if (captionServices[newProps.instreamId]) { - newProps = videojs.mergeOptions(newProps, captionServices[newProps.instreamId]); - } - - if (newProps.default === undefined) { - delete newProps.default; - } // No PlaylistLoader is required for Closed-Captions because the captions are - // embedded within the video stream - - - groups[groupId].push(videojs.mergeOptions({ - id: variantLabel - }, properties)); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = tech.addRemoteTextTrack({ - id: newProps.instreamId, - kind: 'captions', - default: newProps.default, - language: newProps.language, - label: newProps.label - }, false).track; - tracks[variantLabel] = track; - } - } - } - } -}; - -var groupMatch = function groupMatch(list, media) { - for (var i = 0; i < list.length; i++) { - if (playlistMatch(media, list[i])) { - return true; - } - - if (list[i].playlists && groupMatch(list[i].playlists, media)) { - return true; - } - } - - return false; -}; -/** - * Returns a function used to get the active group of the provided type - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media group for the provided type. Takes an - * optional parameter {TextTrack} track. If no track is provided, a list of all - * variants in the group, otherwise the variant corresponding to the provided - * track is returned. - * @function activeGroup - */ - - -var activeGroup = function activeGroup(type, settings) { - return function (track) { - var masterPlaylistLoader = settings.masterPlaylistLoader, - groups = settings.mediaTypes[type].groups; - var media = masterPlaylistLoader.media(); - - if (!media) { - return null; - } - - var variants = null; // set to variants to main media active group - - if (media.attributes[type]) { - variants = groups[media.attributes[type]]; - } - - var groupKeys = Object.keys(groups); - - if (!variants) { - // find the masterPlaylistLoader media - // that is in a media group if we are dealing - // with audio only - if (type === 'AUDIO' && groupKeys.length > 1 && isAudioOnly(settings.master)) { - for (var i = 0; i < groupKeys.length; i++) { - var groupPropertyList = groups[groupKeys[i]]; - - if (groupMatch(groupPropertyList, media)) { - variants = groupPropertyList; - break; - } - } // use the main group if it exists - - } else if (groups.main) { - variants = groups.main; // only one group, use that one - } else if (groupKeys.length === 1) { - variants = groups[groupKeys[0]]; - } - } - - if (typeof track === 'undefined') { - return variants; - } - - if (track === null || !variants) { - // An active track was specified so a corresponding group is expected. track === null - // means no track is currently active so there is no corresponding group - return null; - } - - return variants.filter(function (props) { - return props.id === track.id; - })[0] || null; - }; -}; -var activeTrack = { - /** - * Returns a function used to get the active track of type provided - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media track for the provided type. Returns - * null if no track is active - * @function activeTrack.AUDIO - */ - AUDIO: function AUDIO(type, settings) { - return function () { - var tracks = settings.mediaTypes[type].tracks; - - for (var id in tracks) { - if (tracks[id].enabled) { - return tracks[id]; - } - } - - return null; - }; - }, - - /** - * Returns a function used to get the active track of type provided - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media track for the provided type. Returns - * null if no track is active - * @function activeTrack.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, settings) { - return function () { - var tracks = settings.mediaTypes[type].tracks; - - for (var id in tracks) { - if (tracks[id].mode === 'showing' || tracks[id].mode === 'hidden') { - return tracks[id]; - } - } - - return null; - }; - } -}; -var getActiveGroup = function getActiveGroup(type, _ref) { - var mediaTypes = _ref.mediaTypes; - return function () { - var activeTrack_ = mediaTypes[type].activeTrack(); - - if (!activeTrack_) { - return null; - } - - return mediaTypes[type].activeGroup(activeTrack_); - }; -}; -/** - * Setup PlaylistLoaders and Tracks for media groups (Audio, Subtitles, - * Closed-Captions) specified in the master manifest. - * - * @param {Object} settings - * Object containing required information for setting up the media groups - * @param {Tech} settings.tech - * The tech of the player - * @param {Object} settings.requestOptions - * XHR request options used by the segment loaders - * @param {PlaylistLoader} settings.masterPlaylistLoader - * PlaylistLoader for the master source - * @param {VhsHandler} settings.vhs - * VHS SourceHandler - * @param {Object} settings.master - * The parsed master manifest - * @param {Object} settings.mediaTypes - * Object to store the loaders, tracks, and utility methods for each media type - * @param {Function} settings.blacklistCurrentPlaylist - * Blacklists the current rendition and forces a rendition switch. - * @function setupMediaGroups - */ - -var setupMediaGroups = function setupMediaGroups(settings) { - ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(function (type) { - initialize[type](type, settings); - }); - var mediaTypes = settings.mediaTypes, - masterPlaylistLoader = settings.masterPlaylistLoader, - tech = settings.tech, - vhs = settings.vhs, - _settings$segmentLoad3 = settings.segmentLoaders, - audioSegmentLoader = _settings$segmentLoad3['AUDIO'], - mainSegmentLoader = _settings$segmentLoad3.main; // setup active group and track getters and change event handlers - - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - mediaTypes[type].activeGroup = activeGroup(type, settings); - mediaTypes[type].activeTrack = activeTrack[type](type, settings); - mediaTypes[type].onGroupChanged = onGroupChanged(type, settings); - mediaTypes[type].onGroupChanging = onGroupChanging(type, settings); - mediaTypes[type].onTrackChanged = onTrackChanged(type, settings); - mediaTypes[type].getActiveGroup = getActiveGroup(type, settings); - }); // DO NOT enable the default subtitle or caption track. - // DO enable the default audio track - - var audioGroup = mediaTypes.AUDIO.activeGroup(); - - if (audioGroup) { - var groupId = (audioGroup.filter(function (group) { - return group.default; - })[0] || audioGroup[0]).id; - mediaTypes.AUDIO.tracks[groupId].enabled = true; - mediaTypes.AUDIO.onGroupChanged(); - mediaTypes.AUDIO.onTrackChanged(); - var activeAudioGroup = mediaTypes.AUDIO.getActiveGroup(); // a similar check for handling setAudio on each loader is run again each time the - // track is changed, but needs to be handled here since the track may not be considered - // changed on the first call to onTrackChanged - - if (!activeAudioGroup.playlistLoader) { - // either audio is muxed with video or the stream is audio only - mainSegmentLoader.setAudio(true); - } else { - // audio is demuxed - mainSegmentLoader.setAudio(false); - audioSegmentLoader.setAudio(true); - } - } - - masterPlaylistLoader.on('mediachange', function () { - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - return mediaTypes[type].onGroupChanged(); - }); - }); - masterPlaylistLoader.on('mediachanging', function () { - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - return mediaTypes[type].onGroupChanging(); - }); - }); // custom audio track change event handler for usage event - - var onAudioTrackChanged = function onAudioTrackChanged() { - mediaTypes.AUDIO.onTrackChanged(); - tech.trigger({ - type: 'usage', - name: 'vhs-audio-change' - }); - tech.trigger({ - type: 'usage', - name: 'hls-audio-change' - }); - }; - - tech.audioTracks().addEventListener('change', onAudioTrackChanged); - tech.remoteTextTracks().addEventListener('change', mediaTypes.SUBTITLES.onTrackChanged); - vhs.on('dispose', function () { - tech.audioTracks().removeEventListener('change', onAudioTrackChanged); - tech.remoteTextTracks().removeEventListener('change', mediaTypes.SUBTITLES.onTrackChanged); - }); // clear existing audio tracks and add the ones we just created - - tech.clearTracks('audio'); - - for (var id in mediaTypes.AUDIO.tracks) { - tech.audioTracks().addTrack(mediaTypes.AUDIO.tracks[id]); - } -}; -/** - * Creates skeleton object used to store the loaders, tracks, and utility methods for each - * media type - * - * @return {Object} - * Object to store the loaders, tracks, and utility methods for each media type - * @function createMediaTypes - */ - -var createMediaTypes = function createMediaTypes() { - var mediaTypes = {}; - ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(function (type) { - mediaTypes[type] = { - groups: {}, - tracks: {}, - activePlaylistLoader: null, - activeGroup: noop, - activeTrack: noop, - getActiveGroup: noop, - onGroupChanged: noop, - onTrackChanged: noop, - lastTrack_: null, - logger_: logger("MediaGroups[" + type + "]") - }; - }); - return mediaTypes; -}; - -var ABORT_EARLY_BLACKLIST_SECONDS = 60 * 2; -var Vhs$1; // SegmentLoader stats that need to have each loader's -// values summed to calculate the final value - -var loaderStats = ['mediaRequests', 'mediaRequestsAborted', 'mediaRequestsTimedout', 'mediaRequestsErrored', 'mediaTransferDuration', 'mediaBytesTransferred', 'mediaAppends']; - -var sumLoaderStat = function sumLoaderStat(stat) { - return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat]; -}; - -var shouldSwitchToMedia = function shouldSwitchToMedia(_ref) { - var currentPlaylist = _ref.currentPlaylist, - nextPlaylist = _ref.nextPlaylist, - forwardBuffer = _ref.forwardBuffer, - bufferLowWaterLine = _ref.bufferLowWaterLine, - bufferHighWaterLine = _ref.bufferHighWaterLine, - duration = _ref.duration, - experimentalBufferBasedABR = _ref.experimentalBufferBasedABR, - log = _ref.log; - - // we have no other playlist to switch to - if (!nextPlaylist) { - videojs.log.warn('We received no playlist to switch to. Please check your stream.'); - return false; - } - - var sharedLogLine = "allowing switch " + (currentPlaylist && currentPlaylist.id || 'null') + " -> " + nextPlaylist.id; // If the playlist is live, then we want to not take low water line into account. - // This is because in LIVE, the player plays 3 segments from the end of the - // playlist, and if `BUFFER_LOW_WATER_LINE` is greater than the duration availble - // in those segments, a viewer will never experience a rendition upswitch. - - if (!currentPlaylist || !currentPlaylist.endList) { - log(sharedLogLine + " as current playlist " + (!currentPlaylist ? 'is not set' : 'is live')); - return true; - } // no need to switch playlist is the same - - - if (nextPlaylist.id === currentPlaylist.id) { - return false; - } - - var maxBufferLowWaterLine = experimentalBufferBasedABR ? Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config.MAX_BUFFER_LOW_WATER_LINE; // For the same reason as LIVE, we ignore the low water line when the VOD - // duration is below the max potential low water line - - if (duration < maxBufferLowWaterLine) { - log(sharedLogLine + " as duration < max low water line (" + duration + " < " + maxBufferLowWaterLine + ")"); - return true; - } - - var nextBandwidth = nextPlaylist.attributes.BANDWIDTH; - var currBandwidth = currentPlaylist.attributes.BANDWIDTH; // when switching down, if our buffer is lower than the high water line, - // we can switch down - - if (nextBandwidth < currBandwidth && (!experimentalBufferBasedABR || forwardBuffer < bufferHighWaterLine)) { - var logLine = sharedLogLine + " as next bandwidth < current bandwidth (" + nextBandwidth + " < " + currBandwidth + ")"; - - if (experimentalBufferBasedABR) { - logLine += " and forwardBuffer < bufferHighWaterLine (" + forwardBuffer + " < " + bufferHighWaterLine + ")"; - } - - log(logLine); - return true; - } // and if our buffer is higher than the low water line, - // we can switch up - - - if ((!experimentalBufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) { - var _logLine = sharedLogLine + " as forwardBuffer >= bufferLowWaterLine (" + forwardBuffer + " >= " + bufferLowWaterLine + ")"; - - if (experimentalBufferBasedABR) { - _logLine += " and next bandwidth > current bandwidth (" + nextBandwidth + " > " + currBandwidth + ")"; - } - - log(_logLine); - return true; - } - - log("not " + sharedLogLine + " as no switching criteria met"); - return false; -}; -/** - * the master playlist controller controller all interactons - * between playlists and segmentloaders. At this time this mainly - * involves a master playlist and a series of audio playlists - * if they are available - * - * @class MasterPlaylistController - * @extends videojs.EventTarget - */ - - -var MasterPlaylistController = /*#__PURE__*/function (_videojs$EventTarget) { - _inheritsLoose(MasterPlaylistController, _videojs$EventTarget); - - function MasterPlaylistController(options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - var src = options.src, - handleManifestRedirects = options.handleManifestRedirects, - withCredentials = options.withCredentials, - tech = options.tech, - bandwidth = options.bandwidth, - externVhs = options.externVhs, - useCueTags = options.useCueTags, - blacklistDuration = options.blacklistDuration, - enableLowInitialPlaylist = options.enableLowInitialPlaylist, - sourceType = options.sourceType, - cacheEncryptionKeys = options.cacheEncryptionKeys, - experimentalBufferBasedABR = options.experimentalBufferBasedABR; - - if (!src) { - throw new Error('A non-empty playlist URL or JSON manifest string is required'); - } - - var maxPlaylistRetries = options.maxPlaylistRetries; - - if (maxPlaylistRetries === null || typeof maxPlaylistRetries === 'undefined') { - maxPlaylistRetries = Infinity; - } - - Vhs$1 = externVhs; - _this.experimentalBufferBasedABR = Boolean(experimentalBufferBasedABR); - _this.withCredentials = withCredentials; - _this.tech_ = tech; - _this.vhs_ = tech.vhs; - _this.sourceType_ = sourceType; - _this.useCueTags_ = useCueTags; - _this.blacklistDuration = blacklistDuration; - _this.maxPlaylistRetries = maxPlaylistRetries; - _this.enableLowInitialPlaylist = enableLowInitialPlaylist; - - if (_this.useCueTags_) { - _this.cueTagsTrack_ = _this.tech_.addTextTrack('metadata', 'ad-cues'); - _this.cueTagsTrack_.inBandMetadataTrackDispatchType = ''; - } - - _this.requestOptions_ = { - withCredentials: withCredentials, - handleManifestRedirects: handleManifestRedirects, - maxPlaylistRetries: maxPlaylistRetries, - timeout: null - }; - - _this.on('error', _this.pauseLoading); - - _this.mediaTypes_ = createMediaTypes(); - _this.mediaSource = new window.MediaSource(); - _this.handleDurationChange_ = _this.handleDurationChange_.bind(_assertThisInitialized(_this)); - _this.handleSourceOpen_ = _this.handleSourceOpen_.bind(_assertThisInitialized(_this)); - _this.handleSourceEnded_ = _this.handleSourceEnded_.bind(_assertThisInitialized(_this)); - - _this.mediaSource.addEventListener('durationchange', _this.handleDurationChange_); // load the media source into the player - - - _this.mediaSource.addEventListener('sourceopen', _this.handleSourceOpen_); - - _this.mediaSource.addEventListener('sourceended', _this.handleSourceEnded_); // we don't have to handle sourceclose since dispose will handle termination of - // everything, and the MediaSource should not be detached without a proper disposal - - - _this.seekable_ = videojs.createTimeRanges(); - _this.hasPlayed_ = false; - _this.syncController_ = new SyncController(options); - _this.segmentMetadataTrack_ = tech.addRemoteTextTrack({ - kind: 'metadata', - label: 'segment-metadata' - }, false).track; - _this.decrypter_ = new Decrypter(); - _this.sourceUpdater_ = new SourceUpdater(_this.mediaSource); - _this.inbandTextTracks_ = {}; - _this.timelineChangeController_ = new TimelineChangeController(); - var segmentLoaderSettings = { - vhs: _this.vhs_, - parse708captions: options.parse708captions, - mediaSource: _this.mediaSource, - currentTime: _this.tech_.currentTime.bind(_this.tech_), - seekable: function seekable() { - return _this.seekable(); - }, - seeking: function seeking() { - return _this.tech_.seeking(); - }, - duration: function duration() { - return _this.duration(); - }, - hasPlayed: function hasPlayed() { - return _this.hasPlayed_; - }, - goalBufferLength: function goalBufferLength() { - return _this.goalBufferLength(); - }, - bandwidth: bandwidth, - syncController: _this.syncController_, - decrypter: _this.decrypter_, - sourceType: _this.sourceType_, - inbandTextTracks: _this.inbandTextTracks_, - cacheEncryptionKeys: cacheEncryptionKeys, - sourceUpdater: _this.sourceUpdater_, - timelineChangeController: _this.timelineChangeController_ - }; // The source type check not only determines whether a special DASH playlist loader - // should be used, but also covers the case where the provided src is a vhs-json - // manifest object (instead of a URL). In the case of vhs-json, the default - // PlaylistLoader should be used. - - _this.masterPlaylistLoader_ = _this.sourceType_ === 'dash' ? new DashPlaylistLoader(src, _this.vhs_, _this.requestOptions_) : new PlaylistLoader(src, _this.vhs_, _this.requestOptions_); - - _this.setupMasterPlaylistLoaderListeners_(); // setup segment loaders - // combined audio/video or just video when alternate audio track is selected - - - _this.mainSegmentLoader_ = new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings, { - segmentMetadataTrack: _this.segmentMetadataTrack_, - loaderType: 'main' - }), options); // alternate audio track - - _this.audioSegmentLoader_ = new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings, { - loaderType: 'audio' - }), options); - _this.subtitleSegmentLoader_ = new VTTSegmentLoader(videojs.mergeOptions(segmentLoaderSettings, { - loaderType: 'vtt', - featuresNativeTextTracks: _this.tech_.featuresNativeTextTracks - }), options); - - _this.setupSegmentLoaderListeners_(); - - if (_this.experimentalBufferBasedABR) { - _this.masterPlaylistLoader_.one('loadedplaylist', function () { - return _this.startABRTimer_(); - }); - - _this.tech_.on('pause', function () { - return _this.stopABRTimer_(); - }); - - _this.tech_.on('play', function () { - return _this.startABRTimer_(); - }); - } // Create SegmentLoader stat-getters - // mediaRequests_ - // mediaRequestsAborted_ - // mediaRequestsTimedout_ - // mediaRequestsErrored_ - // mediaTransferDuration_ - // mediaBytesTransferred_ - // mediaAppends_ - - - loaderStats.forEach(function (stat) { - _this[stat + '_'] = sumLoaderStat.bind(_assertThisInitialized(_this), stat); - }); - _this.logger_ = logger('MPC'); - _this.triggeredFmp4Usage = false; - - if (_this.tech_.preload() === 'none') { - _this.loadOnPlay_ = function () { - _this.loadOnPlay_ = null; - - _this.masterPlaylistLoader_.load(); - }; - - _this.tech_.one('play', _this.loadOnPlay_); - } else { - _this.masterPlaylistLoader_.load(); - } - - _this.timeToLoadedData__ = -1; - _this.mainAppendsToLoadedData__ = -1; - _this.audioAppendsToLoadedData__ = -1; - var event = _this.tech_.preload() === 'none' ? 'play' : 'loadstart'; // start the first frame timer on loadstart or play (for preload none) - - _this.tech_.one(event, function () { - var timeToLoadedDataStart = Date.now(); - - _this.tech_.one('loadeddata', function () { - _this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart; - _this.mainAppendsToLoadedData__ = _this.mainSegmentLoader_.mediaAppends; - _this.audioAppendsToLoadedData__ = _this.audioSegmentLoader_.mediaAppends; - }); - }); - - return _this; - } - - var _proto = MasterPlaylistController.prototype; - - _proto.mainAppendsToLoadedData_ = function mainAppendsToLoadedData_() { - return this.mainAppendsToLoadedData__; - }; - - _proto.audioAppendsToLoadedData_ = function audioAppendsToLoadedData_() { - return this.audioAppendsToLoadedData__; - }; - - _proto.appendsToLoadedData_ = function appendsToLoadedData_() { - var main = this.mainAppendsToLoadedData_(); - var audio = this.audioAppendsToLoadedData_(); - - if (main === -1 || audio === -1) { - return -1; - } - - return main + audio; - }; - - _proto.timeToLoadedData_ = function timeToLoadedData_() { - return this.timeToLoadedData__; - } - /** - * Run selectPlaylist and switch to the new playlist if we should - * - * @private - * - */ - ; - - _proto.checkABR_ = function checkABR_() { - var nextPlaylist = this.selectPlaylist(); - - if (this.shouldSwitchToMedia_(nextPlaylist)) { - this.switchMedia_(nextPlaylist, 'abr'); - } - }; - - _proto.switchMedia_ = function switchMedia_(playlist, cause, delay) { - var oldMedia = this.media(); - var oldId = oldMedia && (oldMedia.id || oldMedia.uri); - var newId = playlist.id || playlist.uri; - - if (oldId && oldId !== newId) { - this.logger_("switch media " + oldId + " -> " + newId + " from " + cause); - this.tech_.trigger({ - type: 'usage', - name: "vhs-rendition-change-" + cause - }); - } - - this.masterPlaylistLoader_.media(playlist, delay); - } - /** - * Start a timer that periodically calls checkABR_ - * - * @private - */ - ; - - _proto.startABRTimer_ = function startABRTimer_() { - var _this2 = this; - - this.stopABRTimer_(); - this.abrTimer_ = window.setInterval(function () { - return _this2.checkABR_(); - }, 250); - } - /** - * Stop the timer that periodically calls checkABR_ - * - * @private - */ - ; - - _proto.stopABRTimer_ = function stopABRTimer_() { - // if we're scrubbing, we don't need to pause. - // This getter will be added to Video.js in version 7.11. - if (this.tech_.scrubbing && this.tech_.scrubbing()) { - return; - } - - window.clearInterval(this.abrTimer_); - this.abrTimer_ = null; - } - /** - * Get a list of playlists for the currently selected audio playlist - * - * @return {Array} the array of audio playlists - */ - ; - - _proto.getAudioTrackPlaylists_ = function getAudioTrackPlaylists_() { - var master = this.master(); // if we don't have any audio groups then we can only - // assume that the audio tracks are contained in masters - // playlist array, use that or an empty array. - - if (!master || !master.mediaGroups || !master.mediaGroups.AUDIO) { - return master && master.playlists || []; - } - - var AUDIO = master.mediaGroups.AUDIO; - var groupKeys = Object.keys(AUDIO); - var track; // get the current active track - - if (Object.keys(this.mediaTypes_.AUDIO.groups).length) { - track = this.mediaTypes_.AUDIO.activeTrack(); // or get the default track from master if mediaTypes_ isn't setup yet - } else { - // default group is `main` or just the first group. - var defaultGroup = AUDIO.main || groupKeys.length && AUDIO[groupKeys[0]]; - - for (var label in defaultGroup) { - if (defaultGroup[label].default) { - track = { - label: label - }; - break; - } - } - } // no active track no playlists. - - - if (!track) { - return []; - } - - var playlists = []; // get all of the playlists that are possible for the - // active track. - - for (var group in AUDIO) { - if (AUDIO[group][track.label]) { - var properties = AUDIO[group][track.label]; - - if (properties.playlists) { - playlists.push.apply(playlists, properties.playlists); - } else { - playlists.push(properties); - } - } - } - - return playlists; - } - /** - * Register event handlers on the master playlist loader. A helper - * function for construction time. - * - * @private - */ - ; - - _proto.setupMasterPlaylistLoaderListeners_ = function setupMasterPlaylistLoaderListeners_() { - var _this3 = this; - - this.masterPlaylistLoader_.on('loadedmetadata', function () { - var media = _this3.masterPlaylistLoader_.media(); - - var requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to - // timeout the request. - - if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) { - _this3.requestOptions_.timeout = 0; - } else { - _this3.requestOptions_.timeout = requestTimeout; - } // if this isn't a live video and preload permits, start - // downloading segments - - - if (media.endList && _this3.tech_.preload() !== 'none') { - _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_); - - _this3.mainSegmentLoader_.load(); - } - - setupMediaGroups({ - sourceType: _this3.sourceType_, - segmentLoaders: { - AUDIO: _this3.audioSegmentLoader_, - SUBTITLES: _this3.subtitleSegmentLoader_, - main: _this3.mainSegmentLoader_ - }, - tech: _this3.tech_, - requestOptions: _this3.requestOptions_, - masterPlaylistLoader: _this3.masterPlaylistLoader_, - vhs: _this3.vhs_, - master: _this3.master(), - mediaTypes: _this3.mediaTypes_, - blacklistCurrentPlaylist: _this3.blacklistCurrentPlaylist.bind(_this3) - }); - - _this3.triggerPresenceUsage_(_this3.master(), media); - - _this3.setupFirstPlay(); - - if (!_this3.mediaTypes_.AUDIO.activePlaylistLoader || _this3.mediaTypes_.AUDIO.activePlaylistLoader.media()) { - _this3.trigger('selectedinitialmedia'); - } else { - // We must wait for the active audio playlist loader to - // finish setting up before triggering this event so the - // representations API and EME setup is correct - _this3.mediaTypes_.AUDIO.activePlaylistLoader.one('loadedmetadata', function () { - _this3.trigger('selectedinitialmedia'); - }); - } - }); - this.masterPlaylistLoader_.on('loadedplaylist', function () { - if (_this3.loadOnPlay_) { - _this3.tech_.off('play', _this3.loadOnPlay_); - } - - var updatedPlaylist = _this3.masterPlaylistLoader_.media(); - - if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting - // an initial media as the playlist selectors do not consider browser support - _this3.excludeUnsupportedVariants_(); - - var selectedMedia; - - if (_this3.enableLowInitialPlaylist) { - selectedMedia = _this3.selectInitialPlaylist(); - } - - if (!selectedMedia) { - selectedMedia = _this3.selectPlaylist(); - } - - if (!selectedMedia || !_this3.shouldSwitchToMedia_(selectedMedia)) { - return; - } - - _this3.initialMedia_ = selectedMedia; - - _this3.switchMedia_(_this3.initialMedia_, 'initial'); // Under the standard case where a source URL is provided, loadedplaylist will - // fire again since the playlist will be requested. In the case of vhs-json - // (where the manifest object is provided as the source), when the media - // playlist's `segments` list is already available, a media playlist won't be - // requested, and loadedplaylist won't fire again, so the playlist handler must be - // called on its own here. - - - var haveJsonSource = _this3.sourceType_ === 'vhs-json' && _this3.initialMedia_.segments; - - if (!haveJsonSource) { - return; - } - - updatedPlaylist = _this3.initialMedia_; - } - - _this3.handleUpdatedMediaPlaylist(updatedPlaylist); - }); - this.masterPlaylistLoader_.on('error', function () { - _this3.blacklistCurrentPlaylist(_this3.masterPlaylistLoader_.error); - }); - this.masterPlaylistLoader_.on('mediachanging', function () { - _this3.mainSegmentLoader_.abort(); - - _this3.mainSegmentLoader_.pause(); - }); - this.masterPlaylistLoader_.on('mediachange', function () { - var media = _this3.masterPlaylistLoader_.media(); - - var requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to - // timeout the request. - - if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) { - _this3.requestOptions_.timeout = 0; - } else { - _this3.requestOptions_.timeout = requestTimeout; - } // TODO: Create a new event on the PlaylistLoader that signals - // that the segments have changed in some way and use that to - // update the SegmentLoader instead of doing it twice here and - // on `loadedplaylist` - - - _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_); - - _this3.mainSegmentLoader_.load(); - - _this3.tech_.trigger({ - type: 'mediachange', - bubbles: true - }); - }); - this.masterPlaylistLoader_.on('playlistunchanged', function () { - var updatedPlaylist = _this3.masterPlaylistLoader_.media(); // ignore unchanged playlists that have already been - // excluded for not-changing. We likely just have a really slowly updating - // playlist. - - - if (updatedPlaylist.lastExcludeReason_ === 'playlist-unchanged') { - return; - } - - var playlistOutdated = _this3.stuckAtPlaylistEnd_(updatedPlaylist); - - if (playlistOutdated) { - // Playlist has stopped updating and we're stuck at its end. Try to - // blacklist it and switch to another playlist in the hope that that - // one is updating (and give the player a chance to re-adjust to the - // safe live point). - _this3.blacklistCurrentPlaylist({ - message: 'Playlist no longer updating.', - reason: 'playlist-unchanged' - }); // useful for monitoring QoS - - - _this3.tech_.trigger('playliststuck'); - } - }); - this.masterPlaylistLoader_.on('renditiondisabled', function () { - _this3.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-disabled' - }); - - _this3.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-disabled' - }); - }); - this.masterPlaylistLoader_.on('renditionenabled', function () { - _this3.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-enabled' - }); - - _this3.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-enabled' - }); - }); - } - /** - * Given an updated media playlist (whether it was loaded for the first time, or - * refreshed for live playlists), update any relevant properties and state to reflect - * changes in the media that should be accounted for (e.g., cues and duration). - * - * @param {Object} updatedPlaylist the updated media playlist object - * - * @private - */ - ; - - _proto.handleUpdatedMediaPlaylist = function handleUpdatedMediaPlaylist(updatedPlaylist) { - if (this.useCueTags_) { - this.updateAdCues_(updatedPlaylist); - } // TODO: Create a new event on the PlaylistLoader that signals - // that the segments have changed in some way and use that to - // update the SegmentLoader instead of doing it twice here and - // on `mediachange` - - - this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_); - this.updateDuration(!updatedPlaylist.endList); // If the player isn't paused, ensure that the segment loader is running, - // as it is possible that it was temporarily stopped while waiting for - // a playlist (e.g., in case the playlist errored and we re-requested it). - - if (!this.tech_.paused()) { - this.mainSegmentLoader_.load(); - - if (this.audioSegmentLoader_) { - this.audioSegmentLoader_.load(); - } - } - } - /** - * A helper function for triggerring presence usage events once per source - * - * @private - */ - ; - - _proto.triggerPresenceUsage_ = function triggerPresenceUsage_(master, media) { - var mediaGroups = master.mediaGroups || {}; - var defaultDemuxed = true; - var audioGroupKeys = Object.keys(mediaGroups.AUDIO); - - for (var mediaGroup in mediaGroups.AUDIO) { - for (var label in mediaGroups.AUDIO[mediaGroup]) { - var properties = mediaGroups.AUDIO[mediaGroup][label]; - - if (!properties.uri) { - defaultDemuxed = false; - } - } - } - - if (defaultDemuxed) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-demuxed' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-demuxed' - }); - } - - if (Object.keys(mediaGroups.SUBTITLES).length) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-webvtt' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-webvtt' - }); - } - - if (Vhs$1.Playlist.isAes(media)) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-aes' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-aes' - }); - } - - if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-alternate-audio' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-alternate-audio' - }); - } - - if (this.useCueTags_) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-playlist-cue-tags' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-playlist-cue-tags' - }); - } - }; - - _proto.shouldSwitchToMedia_ = function shouldSwitchToMedia_(nextPlaylist) { - var currentPlaylist = this.masterPlaylistLoader_.media(); - var buffered = this.tech_.buffered(); - var forwardBuffer = buffered.length ? buffered.end(buffered.length - 1) - this.tech_.currentTime() : 0; - var bufferLowWaterLine = this.bufferLowWaterLine(); - var bufferHighWaterLine = this.bufferHighWaterLine(); - return shouldSwitchToMedia({ - currentPlaylist: currentPlaylist, - nextPlaylist: nextPlaylist, - forwardBuffer: forwardBuffer, - bufferLowWaterLine: bufferLowWaterLine, - bufferHighWaterLine: bufferHighWaterLine, - duration: this.duration(), - experimentalBufferBasedABR: this.experimentalBufferBasedABR, - log: this.logger_ - }); - } - /** - * Register event handlers on the segment loaders. A helper function - * for construction time. - * - * @private - */ - ; - - _proto.setupSegmentLoaderListeners_ = function setupSegmentLoaderListeners_() { - var _this4 = this; - - if (!this.experimentalBufferBasedABR) { - this.mainSegmentLoader_.on('bandwidthupdate', function () { - var nextPlaylist = _this4.selectPlaylist(); - - if (_this4.shouldSwitchToMedia_(nextPlaylist)) { - _this4.switchMedia_(nextPlaylist, 'bandwidthupdate'); - } - - _this4.tech_.trigger('bandwidthupdate'); - }); - this.mainSegmentLoader_.on('progress', function () { - _this4.trigger('progress'); - }); - } - - this.mainSegmentLoader_.on('error', function () { - _this4.blacklistCurrentPlaylist(_this4.mainSegmentLoader_.error()); - }); - this.mainSegmentLoader_.on('appenderror', function () { - _this4.error = _this4.mainSegmentLoader_.error_; - - _this4.trigger('error'); - }); - this.mainSegmentLoader_.on('syncinfoupdate', function () { - _this4.onSyncInfoUpdate_(); - }); - this.mainSegmentLoader_.on('timestampoffset', function () { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-timestamp-offset' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-timestamp-offset' - }); - }); - this.audioSegmentLoader_.on('syncinfoupdate', function () { - _this4.onSyncInfoUpdate_(); - }); - this.audioSegmentLoader_.on('appenderror', function () { - _this4.error = _this4.audioSegmentLoader_.error_; - - _this4.trigger('error'); - }); - this.mainSegmentLoader_.on('ended', function () { - _this4.logger_('main segment loader ended'); - - _this4.onEndOfStream(); - }); - this.mainSegmentLoader_.on('earlyabort', function (event) { - // never try to early abort with the new ABR algorithm - if (_this4.experimentalBufferBasedABR) { - return; - } - - _this4.delegateLoaders_('all', ['abort']); - - _this4.blacklistCurrentPlaylist({ - message: 'Aborted early because there isn\'t enough bandwidth to complete the ' + 'request without rebuffering.' - }, ABORT_EARLY_BLACKLIST_SECONDS); - }); - - var updateCodecs = function updateCodecs() { - if (!_this4.sourceUpdater_.hasCreatedSourceBuffers()) { - return _this4.tryToCreateSourceBuffers_(); - } - - var codecs = _this4.getCodecsOrExclude_(); // no codecs means that the playlist was excluded - - - if (!codecs) { - return; - } - - _this4.sourceUpdater_.addOrChangeSourceBuffers(codecs); - }; - - this.mainSegmentLoader_.on('trackinfo', updateCodecs); - this.audioSegmentLoader_.on('trackinfo', updateCodecs); - this.mainSegmentLoader_.on('fmp4', function () { - if (!_this4.triggeredFmp4Usage) { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-fmp4' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-fmp4' - }); - - _this4.triggeredFmp4Usage = true; - } - }); - this.audioSegmentLoader_.on('fmp4', function () { - if (!_this4.triggeredFmp4Usage) { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-fmp4' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-fmp4' - }); - - _this4.triggeredFmp4Usage = true; - } - }); - this.audioSegmentLoader_.on('ended', function () { - _this4.logger_('audioSegmentLoader ended'); - - _this4.onEndOfStream(); - }); - }; - - _proto.mediaSecondsLoaded_ = function mediaSecondsLoaded_() { - return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded); - } - /** - * Call load on our SegmentLoaders - */ - ; - - _proto.load = function load() { - this.mainSegmentLoader_.load(); - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - this.audioSegmentLoader_.load(); - } - - if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) { - this.subtitleSegmentLoader_.load(); - } - } - /** - * Re-tune playback quality level for the current player - * conditions without performing destructive actions, like - * removing already buffered content - * - * @private - * @deprecated - */ - ; - - _proto.smoothQualityChange_ = function smoothQualityChange_(media) { - if (media === void 0) { - media = this.selectPlaylist(); - } - - this.fastQualityChange_(media); - } - /** - * Re-tune playback quality level for the current player - * conditions. This method will perform destructive actions like removing - * already buffered content in order to readjust the currently active - * playlist quickly. This is good for manual quality changes - * - * @private - */ - ; - - _proto.fastQualityChange_ = function fastQualityChange_(media) { - var _this5 = this; - - if (media === void 0) { - media = this.selectPlaylist(); - } - - if (media === this.masterPlaylistLoader_.media()) { - this.logger_('skipping fastQualityChange because new media is same as old'); - return; - } - - this.switchMedia_(media, 'fast-quality'); // Delete all buffered data to allow an immediate quality switch, then seek to give - // the browser a kick to remove any cached frames from the previous rendtion (.04 seconds - // ahead is roughly the minimum that will accomplish this across a variety of content - // in IE and Edge, but seeking in place is sufficient on all other browsers) - // Edge/IE bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14600375/ - // Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=651904 - - this.mainSegmentLoader_.resetEverything(function () { - // Since this is not a typical seek, we avoid the seekTo method which can cause segments - // from the previously enabled rendition to load before the new playlist has finished loading - if (videojs.browser.IE_VERSION || videojs.browser.IS_EDGE) { - _this5.tech_.setCurrentTime(_this5.tech_.currentTime() + 0.04); - } else { - _this5.tech_.setCurrentTime(_this5.tech_.currentTime()); - } - }); // don't need to reset audio as it is reset when media changes - } - /** - * Begin playback. - */ - ; - - _proto.play = function play() { - if (this.setupFirstPlay()) { - return; - } - - if (this.tech_.ended()) { - this.tech_.setCurrentTime(0); - } - - if (this.hasPlayed_) { - this.load(); - } - - var seekable = this.tech_.seekable(); // if the viewer has paused and we fell out of the live window, - // seek forward to the live point - - if (this.tech_.duration() === Infinity) { - if (this.tech_.currentTime() < seekable.start(0)) { - return this.tech_.setCurrentTime(seekable.end(seekable.length - 1)); - } - } - } - /** - * Seek to the latest media position if this is a live video and the - * player and video are loaded and initialized. - */ - ; - - _proto.setupFirstPlay = function setupFirstPlay() { - var _this6 = this; - - var media = this.masterPlaylistLoader_.media(); // Check that everything is ready to begin buffering for the first call to play - // If 1) there is no active media - // 2) the player is paused - // 3) the first play has already been setup - // then exit early - - if (!media || this.tech_.paused() || this.hasPlayed_) { - return false; - } // when the video is a live stream - - - if (!media.endList) { - var seekable = this.seekable(); - - if (!seekable.length) { - // without a seekable range, the player cannot seek to begin buffering at the live - // point - return false; - } - - if (videojs.browser.IE_VERSION && this.tech_.readyState() === 0) { - // IE11 throws an InvalidStateError if you try to set currentTime while the - // readyState is 0, so it must be delayed until the tech fires loadedmetadata. - this.tech_.one('loadedmetadata', function () { - _this6.trigger('firstplay'); - - _this6.tech_.setCurrentTime(seekable.end(0)); - - _this6.hasPlayed_ = true; - }); - return false; - } // trigger firstplay to inform the source handler to ignore the next seek event - - - this.trigger('firstplay'); // seek to the live point - - this.tech_.setCurrentTime(seekable.end(0)); - } - - this.hasPlayed_ = true; // we can begin loading now that everything is ready - - this.load(); - return true; - } - /** - * handle the sourceopen event on the MediaSource - * - * @private - */ - ; - - _proto.handleSourceOpen_ = function handleSourceOpen_() { - // Only attempt to create the source buffer if none already exist. - // handleSourceOpen is also called when we are "re-opening" a source buffer - // after `endOfStream` has been called (in response to a seek for instance) - this.tryToCreateSourceBuffers_(); // if autoplay is enabled, begin playback. This is duplicative of - // code in video.js but is required because play() must be invoked - // *after* the media source has opened. - - if (this.tech_.autoplay()) { - var playPromise = this.tech_.play(); // Catch/silence error when a pause interrupts a play request - // on browsers which return a promise - - if (typeof playPromise !== 'undefined' && typeof playPromise.then === 'function') { - playPromise.then(null, function (e) {}); - } - } - - this.trigger('sourceopen'); - } - /** - * handle the sourceended event on the MediaSource - * - * @private - */ - ; - - _proto.handleSourceEnded_ = function handleSourceEnded_() { - if (!this.inbandTextTracks_.metadataTrack_) { - return; - } - - var cues = this.inbandTextTracks_.metadataTrack_.cues; - - if (!cues || !cues.length) { - return; - } - - var duration = this.duration(); - cues[cues.length - 1].endTime = isNaN(duration) || Math.abs(duration) === Infinity ? Number.MAX_VALUE : duration; - } - /** - * handle the durationchange event on the MediaSource - * - * @private - */ - ; - - _proto.handleDurationChange_ = function handleDurationChange_() { - this.tech_.trigger('durationchange'); - } - /** - * Calls endOfStream on the media source when all active stream types have called - * endOfStream - * - * @param {string} streamType - * Stream type of the segment loader that called endOfStream - * @private - */ - ; - - _proto.onEndOfStream = function onEndOfStream() { - var isEndOfStream = this.mainSegmentLoader_.ended_; - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - // if the audio playlist loader exists, then alternate audio is active - if (!this.mainSegmentLoader_.currentMediaInfo_ || this.mainSegmentLoader_.currentMediaInfo_.hasVideo) { - // if we do not know if the main segment loader contains video yet or if we - // definitively know the main segment loader contains video, then we need to wait - // for both main and audio segment loaders to call endOfStream - isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_; - } else { - // otherwise just rely on the audio loader - isEndOfStream = this.audioSegmentLoader_.ended_; - } - } - - if (!isEndOfStream) { - return; - } - - this.stopABRTimer_(); - this.sourceUpdater_.endOfStream(); - } - /** - * Check if a playlist has stopped being updated - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist has stopped being updated or not - */ - ; - - _proto.stuckAtPlaylistEnd_ = function stuckAtPlaylistEnd_(playlist) { - var seekable = this.seekable(); - - if (!seekable.length) { - // playlist doesn't have enough information to determine whether we are stuck - return false; - } - - var expired = this.syncController_.getExpiredTime(playlist, this.duration()); - - if (expired === null) { - return false; - } // does not use the safe live end to calculate playlist end, since we - // don't want to say we are stuck while there is still content - - - var absolutePlaylistEnd = Vhs$1.Playlist.playlistEnd(playlist, expired); - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - - if (!buffered.length) { - // return true if the playhead reached the absolute end of the playlist - return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA; - } - - var bufferedEnd = buffered.end(buffered.length - 1); // return true if there is too little buffer left and buffer has reached absolute - // end of playlist - - return bufferedEnd - currentTime <= SAFE_TIME_DELTA && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA; - } - /** - * Blacklists a playlist when an error occurs for a set amount of time - * making it unavailable for selection by the rendition selection algorithm - * and then forces a new playlist (rendition) selection. - * - * @param {Object=} error an optional error that may include the playlist - * to blacklist - * @param {number=} blacklistDuration an optional number of seconds to blacklist the - * playlist - */ - ; - - _proto.blacklistCurrentPlaylist = function blacklistCurrentPlaylist(error, blacklistDuration) { - if (error === void 0) { - error = {}; - } - - // If the `error` was generated by the playlist loader, it will contain - // the playlist we were trying to load (but failed) and that should be - // blacklisted instead of the currently selected playlist which is likely - // out-of-date in this scenario - var currentPlaylist = error.playlist || this.masterPlaylistLoader_.media(); - blacklistDuration = blacklistDuration || error.blacklistDuration || this.blacklistDuration; // If there is no current playlist, then an error occurred while we were - // trying to load the master OR while we were disposing of the tech - - if (!currentPlaylist) { - this.error = error; - - if (this.mediaSource.readyState !== 'open') { - this.trigger('error'); - } else { - this.sourceUpdater_.endOfStream('network'); - } - - return; - } - - currentPlaylist.playlistErrors_++; - var playlists = this.masterPlaylistLoader_.master.playlists; - var enabledPlaylists = playlists.filter(isEnabled); - var isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === currentPlaylist; // Don't blacklist the only playlist unless it was blacklisted - // forever - - if (playlists.length === 1 && blacklistDuration !== Infinity) { - videojs.log.warn("Problem encountered with playlist " + currentPlaylist.id + ". " + 'Trying again since it is the only playlist.'); - this.tech_.trigger('retryplaylist'); // if this is a final rendition, we should delay - - return this.masterPlaylistLoader_.load(isFinalRendition); - } - - if (isFinalRendition) { - // Since we're on the final non-blacklisted playlist, and we're about to blacklist - // it, instead of erring the player or retrying this playlist, clear out the current - // blacklist. This allows other playlists to be attempted in case any have been - // fixed. - var reincluded = false; - playlists.forEach(function (playlist) { - // skip current playlist which is about to be blacklisted - if (playlist === currentPlaylist) { - return; - } - - var excludeUntil = playlist.excludeUntil; // a playlist cannot be reincluded if it wasn't excluded to begin with. - - if (typeof excludeUntil !== 'undefined' && excludeUntil !== Infinity) { - reincluded = true; - delete playlist.excludeUntil; - } - }); - - if (reincluded) { - videojs.log.warn('Removing other playlists from the exclusion list because the last ' + 'rendition is about to be excluded.'); // Technically we are retrying a playlist, in that we are simply retrying a previous - // playlist. This is needed for users relying on the retryplaylist event to catch a - // case where the player might be stuck and looping through "dead" playlists. - - this.tech_.trigger('retryplaylist'); - } - } // Blacklist this playlist - - - var excludeUntil; - - if (currentPlaylist.playlistErrors_ > this.maxPlaylistRetries) { - excludeUntil = Infinity; - } else { - excludeUntil = Date.now() + blacklistDuration * 1000; - } - - currentPlaylist.excludeUntil = excludeUntil; - - if (error.reason) { - currentPlaylist.lastExcludeReason_ = error.reason; - } - - this.tech_.trigger('blacklistplaylist'); - this.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-blacklisted' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-blacklisted' - }); // TODO: should we select a new playlist if this blacklist wasn't for the currentPlaylist? - // Would be something like media().id !=== currentPlaylist.id and we would need something - // like `pendingMedia` in playlist loaders to check against that too. This will prevent us - // from loading a new playlist on any blacklist. - // Select a new playlist - - var nextPlaylist = this.selectPlaylist(); - - if (!nextPlaylist) { - this.error = 'Playback cannot continue. No available working or supported playlists.'; - this.trigger('error'); - return; - } - - var logFn = error.internal ? this.logger_ : videojs.log.warn; - var errorMessage = error.message ? ' ' + error.message : ''; - logFn((error.internal ? 'Internal problem' : 'Problem') + " encountered with playlist " + currentPlaylist.id + "." + (errorMessage + " Switching to playlist " + nextPlaylist.id + ".")); // if audio group changed reset audio loaders - - if (nextPlaylist.attributes.AUDIO !== currentPlaylist.attributes.AUDIO) { - this.delegateLoaders_('audio', ['abort', 'pause']); - } // if subtitle group changed reset subtitle loaders - - - if (nextPlaylist.attributes.SUBTITLES !== currentPlaylist.attributes.SUBTITLES) { - this.delegateLoaders_('subtitle', ['abort', 'pause']); - } - - this.delegateLoaders_('main', ['abort', 'pause']); - var delayDuration = nextPlaylist.targetDuration / 2 * 1000 || 5 * 1000; - var shouldDelay = typeof nextPlaylist.lastRequest === 'number' && Date.now() - nextPlaylist.lastRequest <= delayDuration; // delay if it's a final rendition or if the last refresh is sooner than half targetDuration - - return this.switchMedia_(nextPlaylist, 'exclude', isFinalRendition || shouldDelay); - } - /** - * Pause all segment/playlist loaders - */ - ; - - _proto.pauseLoading = function pauseLoading() { - this.delegateLoaders_('all', ['abort', 'pause']); - this.stopABRTimer_(); - } - /** - * Call a set of functions in order on playlist loaders, segment loaders, - * or both types of loaders. - * - * @param {string} filter - * Filter loaders that should call fnNames using a string. Can be: - * * all - run on all loaders - * * audio - run on all audio loaders - * * subtitle - run on all subtitle loaders - * * main - run on the main/master loaders - * - * @param {Array|string} fnNames - * A string or array of function names to call. - */ - ; - - _proto.delegateLoaders_ = function delegateLoaders_(filter, fnNames) { - var _this7 = this; - - var loaders = []; - var dontFilterPlaylist = filter === 'all'; - - if (dontFilterPlaylist || filter === 'main') { - loaders.push(this.masterPlaylistLoader_); - } - - var mediaTypes = []; - - if (dontFilterPlaylist || filter === 'audio') { - mediaTypes.push('AUDIO'); - } - - if (dontFilterPlaylist || filter === 'subtitle') { - mediaTypes.push('CLOSED-CAPTIONS'); - mediaTypes.push('SUBTITLES'); - } - - mediaTypes.forEach(function (mediaType) { - var loader = _this7.mediaTypes_[mediaType] && _this7.mediaTypes_[mediaType].activePlaylistLoader; - - if (loader) { - loaders.push(loader); - } - }); - ['main', 'audio', 'subtitle'].forEach(function (name) { - var loader = _this7[name + "SegmentLoader_"]; - - if (loader && (filter === name || filter === 'all')) { - loaders.push(loader); - } - }); - loaders.forEach(function (loader) { - return fnNames.forEach(function (fnName) { - if (typeof loader[fnName] === 'function') { - loader[fnName](); - } - }); - }); - } - /** - * set the current time on all segment loaders - * - * @param {TimeRange} currentTime the current time to set - * @return {TimeRange} the current time - */ - ; - - _proto.setCurrentTime = function setCurrentTime(currentTime) { - var buffered = findRange(this.tech_.buffered(), currentTime); - - if (!(this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media())) { - // return immediately if the metadata is not ready yet - return 0; - } // it's clearly an edge-case but don't thrown an error if asked to - // seek within an empty playlist - - - if (!this.masterPlaylistLoader_.media().segments) { - return 0; - } // if the seek location is already buffered, continue buffering as usual - - - if (buffered && buffered.length) { - return currentTime; - } // cancel outstanding requests so we begin buffering at the new - // location - - - this.mainSegmentLoader_.resetEverything(); - this.mainSegmentLoader_.abort(); - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - this.audioSegmentLoader_.resetEverything(); - this.audioSegmentLoader_.abort(); - } - - if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) { - this.subtitleSegmentLoader_.resetEverything(); - this.subtitleSegmentLoader_.abort(); - } // start segment loader loading in case they are paused - - - this.load(); - } - /** - * get the current duration - * - * @return {TimeRange} the duration - */ - ; - - _proto.duration = function duration() { - if (!this.masterPlaylistLoader_) { - return 0; - } - - var media = this.masterPlaylistLoader_.media(); - - if (!media) { - // no playlists loaded yet, so can't determine a duration - return 0; - } // Don't rely on the media source for duration in the case of a live playlist since - // setting the native MediaSource's duration to infinity ends up with consequences to - // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details. - // - // This is resolved in the spec by https://github.com/w3c/media-source/pull/92, - // however, few browsers have support for setLiveSeekableRange() - // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange - // - // Until a time when the duration of the media source can be set to infinity, and a - // seekable range specified across browsers, just return Infinity. - - - if (!media.endList) { - return Infinity; - } // Since this is a VOD video, it is safe to rely on the media source's duration (if - // available). If it's not available, fall back to a playlist-calculated estimate. - - - if (this.mediaSource) { - return this.mediaSource.duration; - } - - return Vhs$1.Playlist.duration(media); - } - /** - * check the seekable range - * - * @return {TimeRange} the seekable range - */ - ; - - _proto.seekable = function seekable() { - return this.seekable_; - }; - - _proto.onSyncInfoUpdate_ = function onSyncInfoUpdate_() { - var audioSeekable; - - if (!this.masterPlaylistLoader_) { - return; - } - - var media = this.masterPlaylistLoader_.media(); - - if (!media) { - return; - } - - var expired = this.syncController_.getExpiredTime(media, this.duration()); - - if (expired === null) { - // not enough information to update seekable - return; - } - - var master = this.masterPlaylistLoader_.master; - var mainSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media)); - - if (mainSeekable.length === 0) { - return; - } - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - media = this.mediaTypes_.AUDIO.activePlaylistLoader.media(); - expired = this.syncController_.getExpiredTime(media, this.duration()); - - if (expired === null) { - return; - } - - audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media)); - - if (audioSeekable.length === 0) { - return; - } - } - - var oldEnd; - var oldStart; - - if (this.seekable_ && this.seekable_.length) { - oldEnd = this.seekable_.end(0); - oldStart = this.seekable_.start(0); - } - - if (!audioSeekable) { - // seekable has been calculated based on buffering video data so it - // can be returned directly - this.seekable_ = mainSeekable; - } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) { - // seekables are pretty far off, rely on main - this.seekable_ = mainSeekable; - } else { - this.seekable_ = videojs.createTimeRanges([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]); - } // seekable is the same as last time - - - if (this.seekable_ && this.seekable_.length) { - if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) { - return; - } - } - - this.logger_("seekable updated [" + printableRange(this.seekable_) + "]"); - this.tech_.trigger('seekablechanged'); - } - /** - * Update the player duration - */ - ; - - _proto.updateDuration = function updateDuration(isLive) { - if (this.updateDuration_) { - this.mediaSource.removeEventListener('sourceopen', this.updateDuration_); - this.updateDuration_ = null; - } - - if (this.mediaSource.readyState !== 'open') { - this.updateDuration_ = this.updateDuration.bind(this, isLive); - this.mediaSource.addEventListener('sourceopen', this.updateDuration_); - return; - } - - if (isLive) { - var seekable = this.seekable(); - - if (!seekable.length) { - return; - } // Even in the case of a live playlist, the native MediaSource's duration should not - // be set to Infinity (even though this would be expected for a live playlist), since - // setting the native MediaSource's duration to infinity ends up with consequences to - // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details. - // - // This is resolved in the spec by https://github.com/w3c/media-source/pull/92, - // however, few browsers have support for setLiveSeekableRange() - // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange - // - // Until a time when the duration of the media source can be set to infinity, and a - // seekable range specified across browsers, the duration should be greater than or - // equal to the last possible seekable value. - // MediaSource duration starts as NaN - // It is possible (and probable) that this case will never be reached for many - // sources, since the MediaSource reports duration as the highest value without - // accounting for timestamp offset. For example, if the timestamp offset is -100 and - // we buffered times 0 to 100 with real times of 100 to 200, even though current - // time will be between 0 and 100, the native media source may report the duration - // as 200. However, since we report duration separate from the media source (as - // Infinity), and as long as the native media source duration value is greater than - // our reported seekable range, seeks will work as expected. The large number as - // duration for live is actually a strategy used by some players to work around the - // issue of live seekable ranges cited above. - - - if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable.end(seekable.length - 1)) { - this.sourceUpdater_.setDuration(seekable.end(seekable.length - 1)); - } - - return; - } - - var buffered = this.tech_.buffered(); - var duration = Vhs$1.Playlist.duration(this.masterPlaylistLoader_.media()); - - if (buffered.length > 0) { - duration = Math.max(duration, buffered.end(buffered.length - 1)); - } - - if (this.mediaSource.duration !== duration) { - this.sourceUpdater_.setDuration(duration); - } - } - /** - * dispose of the MasterPlaylistController and everything - * that it controls - */ - ; - - _proto.dispose = function dispose() { - var _this8 = this; - - this.trigger('dispose'); - this.decrypter_.terminate(); - this.masterPlaylistLoader_.dispose(); - this.mainSegmentLoader_.dispose(); - - if (this.loadOnPlay_) { - this.tech_.off('play', this.loadOnPlay_); - } - - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - var groups = _this8.mediaTypes_[type].groups; - - for (var id in groups) { - groups[id].forEach(function (group) { - if (group.playlistLoader) { - group.playlistLoader.dispose(); - } - }); - } - }); - this.audioSegmentLoader_.dispose(); - this.subtitleSegmentLoader_.dispose(); - this.sourceUpdater_.dispose(); - this.timelineChangeController_.dispose(); - this.stopABRTimer_(); - - if (this.updateDuration_) { - this.mediaSource.removeEventListener('sourceopen', this.updateDuration_); - } - - this.mediaSource.removeEventListener('durationchange', this.handleDurationChange_); // load the media source into the player - - this.mediaSource.removeEventListener('sourceopen', this.handleSourceOpen_); - this.mediaSource.removeEventListener('sourceended', this.handleSourceEnded_); - this.off(); - } - /** - * return the master playlist object if we have one - * - * @return {Object} the master playlist object that we parsed - */ - ; - - _proto.master = function master() { - return this.masterPlaylistLoader_.master; - } - /** - * return the currently selected playlist - * - * @return {Object} the currently selected playlist object that we parsed - */ - ; - - _proto.media = function media() { - // playlist loader will not return media if it has not been fully loaded - return this.masterPlaylistLoader_.media() || this.initialMedia_; - }; - - _proto.areMediaTypesKnown_ = function areMediaTypesKnown_() { - var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader; // one or both loaders has not loaded sufficently to get codecs - - if (!this.mainSegmentLoader_.currentMediaInfo_ || usingAudioLoader && !this.audioSegmentLoader_.currentMediaInfo_) { - return false; - } - - return true; - }; - - _proto.getCodecsOrExclude_ = function getCodecsOrExclude_() { - var _this9 = this; - - var media = { - main: this.mainSegmentLoader_.currentMediaInfo_ || {}, - audio: this.audioSegmentLoader_.currentMediaInfo_ || {} - }; // set "main" media equal to video - - media.video = media.main; - var playlistCodecs = codecsForPlaylist(this.master(), this.media()); - var codecs = {}; - var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader; - - if (media.main.hasVideo) { - codecs.video = playlistCodecs.video || media.main.videoCodec || DEFAULT_VIDEO_CODEC; - } - - if (media.main.isMuxed) { - codecs.video += "," + (playlistCodecs.audio || media.main.audioCodec || DEFAULT_AUDIO_CODEC); - } - - if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) { - codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || DEFAULT_AUDIO_CODEC; // set audio isFmp4 so we use the correct "supports" function below - - media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4; - } // no codecs, no playback. - - - if (!codecs.audio && !codecs.video) { - this.blacklistCurrentPlaylist({ - playlist: this.media(), - message: 'Could not determine codecs for playlist.', - blacklistDuration: Infinity - }); - return; - } // fmp4 relies on browser support, while ts relies on muxer support - - - var supportFunction = function supportFunction(isFmp4, codec) { - return isFmp4 ? browserSupportsCodec(codec) : muxerSupportsCodec(codec); - }; - - var unsupportedCodecs = {}; - var unsupportedAudio; - ['video', 'audio'].forEach(function (type) { - if (codecs.hasOwnProperty(type) && !supportFunction(media[type].isFmp4, codecs[type])) { - var supporter = media[type].isFmp4 ? 'browser' : 'muxer'; - unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || []; - unsupportedCodecs[supporter].push(codecs[type]); - - if (type === 'audio') { - unsupportedAudio = supporter; - } - } - }); - - if (usingAudioLoader && unsupportedAudio && this.media().attributes.AUDIO) { - var audioGroup = this.media().attributes.AUDIO; - this.master().playlists.forEach(function (variant) { - var variantAudioGroup = variant.attributes && variant.attributes.AUDIO; - - if (variantAudioGroup === audioGroup && variant !== _this9.media()) { - variant.excludeUntil = Infinity; - } - }); - this.logger_("excluding audio group " + audioGroup + " as " + unsupportedAudio + " does not support codec(s): \"" + codecs.audio + "\""); - } // if we have any unsupported codecs blacklist this playlist. - - - if (Object.keys(unsupportedCodecs).length) { - var message = Object.keys(unsupportedCodecs).reduce(function (acc, supporter) { - if (acc) { - acc += ', '; - } - - acc += supporter + " does not support codec(s): \"" + unsupportedCodecs[supporter].join(',') + "\""; - return acc; - }, '') + '.'; - this.blacklistCurrentPlaylist({ - playlist: this.media(), - internal: true, - message: message, - blacklistDuration: Infinity - }); - return; - } // check if codec switching is happening - - - if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) { - var switchMessages = []; - ['video', 'audio'].forEach(function (type) { - var newCodec = (parseCodecs(_this9.sourceUpdater_.codecs[type] || '')[0] || {}).type; - var oldCodec = (parseCodecs(codecs[type] || '')[0] || {}).type; - - if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) { - switchMessages.push("\"" + _this9.sourceUpdater_.codecs[type] + "\" -> \"" + codecs[type] + "\""); - } - }); - - if (switchMessages.length) { - this.blacklistCurrentPlaylist({ - playlist: this.media(), - message: "Codec switching not supported: " + switchMessages.join(', ') + ".", - blacklistDuration: Infinity, - internal: true - }); - return; - } - } // TODO: when using the muxer shouldn't we just return - // the codecs that the muxer outputs? - - - return codecs; - } - /** - * Create source buffers and exlude any incompatible renditions. - * - * @private - */ - ; - - _proto.tryToCreateSourceBuffers_ = function tryToCreateSourceBuffers_() { - // media source is not ready yet or sourceBuffers are already - // created. - if (this.mediaSource.readyState !== 'open' || this.sourceUpdater_.hasCreatedSourceBuffers()) { - return; - } - - if (!this.areMediaTypesKnown_()) { - return; - } - - var codecs = this.getCodecsOrExclude_(); // no codecs means that the playlist was excluded - - if (!codecs) { - return; - } - - this.sourceUpdater_.createSourceBuffers(codecs); - var codecString = [codecs.video, codecs.audio].filter(Boolean).join(','); - this.excludeIncompatibleVariants_(codecString); - } - /** - * Excludes playlists with codecs that are unsupported by the muxer and browser. - */ - ; - - _proto.excludeUnsupportedVariants_ = function excludeUnsupportedVariants_() { - var _this10 = this; - - var playlists = this.master().playlists; - var ids = []; // TODO: why don't we have a property to loop through all - // playlist? Why did we ever mix indexes and keys? - - Object.keys(playlists).forEach(function (key) { - var variant = playlists[key]; // check if we already processed this playlist. - - if (ids.indexOf(variant.id) !== -1) { - return; - } - - ids.push(variant.id); - var codecs = codecsForPlaylist(_this10.master, variant); - var unsupported = []; - - if (codecs.audio && !muxerSupportsCodec(codecs.audio) && !browserSupportsCodec(codecs.audio)) { - unsupported.push("audio codec " + codecs.audio); - } - - if (codecs.video && !muxerSupportsCodec(codecs.video) && !browserSupportsCodec(codecs.video)) { - unsupported.push("video codec " + codecs.video); - } - - if (codecs.text && codecs.text === 'stpp.ttml.im1t') { - unsupported.push("text codec " + codecs.text); - } - - if (unsupported.length) { - variant.excludeUntil = Infinity; - - _this10.logger_("excluding " + variant.id + " for unsupported: " + unsupported.join(', ')); - } - }); - } - /** - * Blacklist playlists that are known to be codec or - * stream-incompatible with the SourceBuffer configuration. For - * instance, Media Source Extensions would cause the video element to - * stall waiting for video data if you switched from a variant with - * video and audio to an audio-only one. - * - * @param {Object} media a media playlist compatible with the current - * set of SourceBuffers. Variants in the current master playlist that - * do not appear to have compatible codec or stream configurations - * will be excluded from the default playlist selection algorithm - * indefinitely. - * @private - */ - ; - - _proto.excludeIncompatibleVariants_ = function excludeIncompatibleVariants_(codecString) { - var _this11 = this; - - var ids = []; - var playlists = this.master().playlists; - var codecs = unwrapCodecList(parseCodecs(codecString)); - var codecCount_ = codecCount(codecs); - var videoDetails = codecs.video && parseCodecs(codecs.video)[0] || null; - var audioDetails = codecs.audio && parseCodecs(codecs.audio)[0] || null; - Object.keys(playlists).forEach(function (key) { - var variant = playlists[key]; // check if we already processed this playlist. - // or it if it is already excluded forever. - - if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) { - return; - } - - ids.push(variant.id); - var blacklistReasons = []; // get codecs from the playlist for this variant - - var variantCodecs = codecsForPlaylist(_this11.masterPlaylistLoader_.master, variant); - var variantCodecCount = codecCount(variantCodecs); // if no codecs are listed, we cannot determine that this - // variant is incompatible. Wait for mux.js to probe - - if (!variantCodecs.audio && !variantCodecs.video) { - return; - } // TODO: we can support this by removing the - // old media source and creating a new one, but it will take some work. - // The number of streams cannot change - - - if (variantCodecCount !== codecCount_) { - blacklistReasons.push("codec count \"" + variantCodecCount + "\" !== \"" + codecCount_ + "\""); - } // only exclude playlists by codec change, if codecs cannot switch - // during playback. - - - if (!_this11.sourceUpdater_.canChangeType()) { - var variantVideoDetails = variantCodecs.video && parseCodecs(variantCodecs.video)[0] || null; - var variantAudioDetails = variantCodecs.audio && parseCodecs(variantCodecs.audio)[0] || null; // the video codec cannot change - - if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) { - blacklistReasons.push("video codec \"" + variantVideoDetails.type + "\" !== \"" + videoDetails.type + "\""); - } // the audio codec cannot change - - - if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) { - blacklistReasons.push("audio codec \"" + variantAudioDetails.type + "\" !== \"" + audioDetails.type + "\""); - } - } - - if (blacklistReasons.length) { - variant.excludeUntil = Infinity; - - _this11.logger_("blacklisting " + variant.id + ": " + blacklistReasons.join(' && ')); - } - }); - }; - - _proto.updateAdCues_ = function updateAdCues_(media) { - var offset = 0; - var seekable = this.seekable(); - - if (seekable.length) { - offset = seekable.start(0); - } - - updateAdCues(media, this.cueTagsTrack_, offset); - } - /** - * Calculates the desired forward buffer length based on current time - * - * @return {number} Desired forward buffer length in seconds - */ - ; - - _proto.goalBufferLength = function goalBufferLength() { - var currentTime = this.tech_.currentTime(); - var initial = Config.GOAL_BUFFER_LENGTH; - var rate = Config.GOAL_BUFFER_LENGTH_RATE; - var max = Math.max(initial, Config.MAX_GOAL_BUFFER_LENGTH); - return Math.min(initial + currentTime * rate, max); - } - /** - * Calculates the desired buffer low water line based on current time - * - * @return {number} Desired buffer low water line in seconds - */ - ; - - _proto.bufferLowWaterLine = function bufferLowWaterLine() { - var currentTime = this.tech_.currentTime(); - var initial = Config.BUFFER_LOW_WATER_LINE; - var rate = Config.BUFFER_LOW_WATER_LINE_RATE; - var max = Math.max(initial, Config.MAX_BUFFER_LOW_WATER_LINE); - var newMax = Math.max(initial, Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE); - return Math.min(initial + currentTime * rate, this.experimentalBufferBasedABR ? newMax : max); - }; - - _proto.bufferHighWaterLine = function bufferHighWaterLine() { - return Config.BUFFER_HIGH_WATER_LINE; - }; - - return MasterPlaylistController; -}(videojs.EventTarget); - -/** - * Returns a function that acts as the Enable/disable playlist function. - * - * @param {PlaylistLoader} loader - The master playlist loader - * @param {string} playlistID - id of the playlist - * @param {Function} changePlaylistFn - A function to be called after a - * playlist's enabled-state has been changed. Will NOT be called if a - * playlist's enabled-state is unchanged - * @param {boolean=} enable - Value to set the playlist enabled-state to - * or if undefined returns the current enabled-state for the playlist - * @return {Function} Function for setting/getting enabled - */ - -var enableFunction = function enableFunction(loader, playlistID, changePlaylistFn) { - return function (enable) { - var playlist = loader.master.playlists[playlistID]; - var incompatible = isIncompatible(playlist); - var currentlyEnabled = isEnabled(playlist); - - if (typeof enable === 'undefined') { - return currentlyEnabled; - } - - if (enable) { - delete playlist.disabled; - } else { - playlist.disabled = true; - } - - if (enable !== currentlyEnabled && !incompatible) { - // Ensure the outside world knows about our changes - changePlaylistFn(); - - if (enable) { - loader.trigger('renditionenabled'); - } else { - loader.trigger('renditiondisabled'); - } - } - - return enable; - }; -}; -/** - * The representation object encapsulates the publicly visible information - * in a media playlist along with a setter/getter-type function (enabled) - * for changing the enabled-state of a particular playlist entry - * - * @class Representation - */ - - -var Representation = function Representation(vhsHandler, playlist, id) { - var mpc = vhsHandler.masterPlaylistController_, - smoothQualityChange = vhsHandler.options_.smoothQualityChange; // Get a reference to a bound version of the quality change function - - var changeType = smoothQualityChange ? 'smooth' : 'fast'; - var qualityChangeFunction = mpc[changeType + "QualityChange_"].bind(mpc); // some playlist attributes are optional - - if (playlist.attributes) { - var resolution = playlist.attributes.RESOLUTION; - this.width = resolution && resolution.width; - this.height = resolution && resolution.height; - this.bandwidth = playlist.attributes.BANDWIDTH; - } - - this.codecs = codecsForPlaylist(mpc.master(), playlist); - this.playlist = playlist; // The id is simply the ordinality of the media playlist - // within the master playlist - - this.id = id; // Partially-apply the enableFunction to create a playlist- - // specific variant - - this.enabled = enableFunction(vhsHandler.playlists, playlist.id, qualityChangeFunction); -}; -/** - * A mixin function that adds the `representations` api to an instance - * of the VhsHandler class - * - * @param {VhsHandler} vhsHandler - An instance of VhsHandler to add the - * representation API into - */ - - -var renditionSelectionMixin = function renditionSelectionMixin(vhsHandler) { - // Add a single API-specific function to the VhsHandler instance - vhsHandler.representations = function () { - var master = vhsHandler.masterPlaylistController_.master(); - var playlists = isAudioOnly(master) ? vhsHandler.masterPlaylistController_.getAudioTrackPlaylists_() : master.playlists; - - if (!playlists) { - return []; - } - - return playlists.filter(function (media) { - return !isIncompatible(media); - }).map(function (e, i) { - return new Representation(vhsHandler, e, e.id); - }); - }; -}; - -/** - * @file playback-watcher.js - * - * Playback starts, and now my watch begins. It shall not end until my death. I shall - * take no wait, hold no uncleared timeouts, father no bad seeks. I shall wear no crowns - * and win no glory. I shall live and die at my post. I am the corrector of the underflow. - * I am the watcher of gaps. I am the shield that guards the realms of seekable. I pledge - * my life and honor to the Playback Watch, for this Player and all the Players to come. - */ - -var timerCancelEvents = ['seeking', 'seeked', 'pause', 'playing', 'error']; -/** - * Returns whether or not the current time should be considered close to buffered content, - * taking into consideration whether there's enough buffered content for proper playback. - * - * @param {Object} options - * Options object - * @param {TimeRange} options.buffered - * Current buffer - * @param {number} options.targetDuration - * The active playlist's target duration - * @param {number} options.currentTime - * The current time of the player - * @return {boolean} - * Whether the current time should be considered close to the buffer - */ - -var closeToBufferedContent = function closeToBufferedContent(_ref) { - var buffered = _ref.buffered, - targetDuration = _ref.targetDuration, - currentTime = _ref.currentTime; - - if (!buffered.length) { - return false; - } // At least two to three segments worth of content should be buffered before there's a - // full enough buffer to consider taking any actions. - - - if (buffered.end(0) - buffered.start(0) < targetDuration * 2) { - return false; - } // It's possible that, on seek, a remove hasn't completed and the buffered range is - // somewhere past the current time. In that event, don't consider the buffered content - // close. - - - if (currentTime > buffered.start(0)) { - return false; - } // Since target duration generally represents the max (or close to max) duration of a - // segment, if the buffer is within a segment of the current time, the gap probably - // won't be closed, and current time should be considered close to buffered content. - - - return buffered.start(0) - currentTime < targetDuration; -}; -/** - * @class PlaybackWatcher - */ - -var PlaybackWatcher = /*#__PURE__*/function () { - /** - * Represents an PlaybackWatcher object. - * - * @class - * @param {Object} options an object that includes the tech and settings - */ - function PlaybackWatcher(options) { - var _this = this; - - this.masterPlaylistController_ = options.masterPlaylistController; - this.tech_ = options.tech; - this.seekable = options.seekable; - this.allowSeeksWithinUnsafeLiveWindow = options.allowSeeksWithinUnsafeLiveWindow; - this.liveRangeSafeTimeDelta = options.liveRangeSafeTimeDelta; - this.media = options.media; - this.consecutiveUpdates = 0; - this.lastRecordedTime = null; - this.timer_ = null; - this.checkCurrentTimeTimeout_ = null; - this.logger_ = logger('PlaybackWatcher'); - this.logger_('initialize'); - - var playHandler = function playHandler() { - return _this.monitorCurrentTime_(); - }; - - var canPlayHandler = function canPlayHandler() { - return _this.monitorCurrentTime_(); - }; - - var waitingHandler = function waitingHandler() { - return _this.techWaiting_(); - }; - - var cancelTimerHandler = function cancelTimerHandler() { - return _this.cancelTimer_(); - }; - - var fixesBadSeeksHandler = function fixesBadSeeksHandler() { - return _this.fixesBadSeeks_(); - }; - - var mpc = this.masterPlaylistController_; - var loaderTypes = ['main', 'subtitle', 'audio']; - var loaderChecks = {}; - loaderTypes.forEach(function (type) { - loaderChecks[type] = { - reset: function reset() { - return _this.resetSegmentDownloads_(type); - }, - updateend: function updateend() { - return _this.checkSegmentDownloads_(type); - } - }; - mpc[type + "SegmentLoader_"].on('appendsdone', loaderChecks[type].updateend); // If a rendition switch happens during a playback stall where the buffer - // isn't changing we want to reset. We cannot assume that the new rendition - // will also be stalled, until after new appends. - - mpc[type + "SegmentLoader_"].on('playlistupdate', loaderChecks[type].reset); // Playback stalls should not be detected right after seeking. - // This prevents one segment playlists (single vtt or single segment content) - // from being detected as stalling. As the buffer will not change in those cases, since - // the buffer is the entire video duration. - - _this.tech_.on(['seeked', 'seeking'], loaderChecks[type].reset); - }); - this.tech_.on('seekablechanged', fixesBadSeeksHandler); - this.tech_.on('waiting', waitingHandler); - this.tech_.on(timerCancelEvents, cancelTimerHandler); - this.tech_.on('canplay', canPlayHandler); - /* - An edge case exists that results in gaps not being skipped when they exist at the beginning of a stream. This case - is surfaced in one of two ways: - 1) The `waiting` event is fired before the player has buffered content, making it impossible - to find or skip the gap. The `waiting` event is followed by a `play` event. On first play - we can check if playback is stalled due to a gap, and skip the gap if necessary. - 2) A source with a gap at the beginning of the stream is loaded programatically while the player - is in a playing state. To catch this case, it's important that our one-time play listener is setup - even if the player is in a playing state - */ - - this.tech_.one('play', playHandler); // Define the dispose function to clean up our events - - this.dispose = function () { - _this.logger_('dispose'); - - _this.tech_.off('seekablechanged', fixesBadSeeksHandler); - - _this.tech_.off('waiting', waitingHandler); - - _this.tech_.off(timerCancelEvents, cancelTimerHandler); - - _this.tech_.off('canplay', canPlayHandler); - - _this.tech_.off('play', playHandler); - - loaderTypes.forEach(function (type) { - mpc[type + "SegmentLoader_"].off('appendsdone', loaderChecks[type].updateend); - mpc[type + "SegmentLoader_"].off('playlistupdate', loaderChecks[type].reset); - - _this.tech_.off(['seeked', 'seeking'], loaderChecks[type].reset); - }); - - if (_this.checkCurrentTimeTimeout_) { - window.clearTimeout(_this.checkCurrentTimeTimeout_); - } - - _this.cancelTimer_(); - }; - } - /** - * Periodically check current time to see if playback stopped - * - * @private - */ - - - var _proto = PlaybackWatcher.prototype; - - _proto.monitorCurrentTime_ = function monitorCurrentTime_() { - this.checkCurrentTime_(); - - if (this.checkCurrentTimeTimeout_) { - window.clearTimeout(this.checkCurrentTimeTimeout_); - } // 42 = 24 fps // 250 is what Webkit uses // FF uses 15 - - - this.checkCurrentTimeTimeout_ = window.setTimeout(this.monitorCurrentTime_.bind(this), 250); - } - /** - * Reset stalled download stats for a specific type of loader - * - * @param {string} type - * The segment loader type to check. - * - * @listens SegmentLoader#playlistupdate - * @listens Tech#seeking - * @listens Tech#seeked - */ - ; - - _proto.resetSegmentDownloads_ = function resetSegmentDownloads_(type) { - var loader = this.masterPlaylistController_[type + "SegmentLoader_"]; - - if (this[type + "StalledDownloads_"] > 0) { - this.logger_("resetting possible stalled download count for " + type + " loader"); - } - - this[type + "StalledDownloads_"] = 0; - this[type + "Buffered_"] = loader.buffered_(); - } - /** - * Checks on every segment `appendsdone` to see - * if segment appends are making progress. If they are not - * and we are still downloading bytes. We blacklist the playlist. - * - * @param {string} type - * The segment loader type to check. - * - * @listens SegmentLoader#appendsdone - */ - ; - - _proto.checkSegmentDownloads_ = function checkSegmentDownloads_(type) { - var mpc = this.masterPlaylistController_; - var loader = mpc[type + "SegmentLoader_"]; - var buffered = loader.buffered_(); - var isBufferedDifferent = isRangeDifferent(this[type + "Buffered_"], buffered); - this[type + "Buffered_"] = buffered; // if another watcher is going to fix the issue or - // the buffered value for this loader changed - // appends are working - - if (isBufferedDifferent) { - this.resetSegmentDownloads_(type); - return; - } - - this[type + "StalledDownloads_"]++; - this.logger_("found #" + this[type + "StalledDownloads_"] + " " + type + " appends that did not increase buffer (possible stalled download)", { - playlistId: loader.playlist_ && loader.playlist_.id, - buffered: timeRangesToArray(buffered) - }); // after 10 possibly stalled appends with no reset, exclude - - if (this[type + "StalledDownloads_"] < 10) { - return; - } - - this.logger_(type + " loader stalled download exclusion"); - this.resetSegmentDownloads_(type); - this.tech_.trigger({ - type: 'usage', - name: "vhs-" + type + "-download-exclusion" - }); - - if (type === 'subtitle') { - return; - } // TODO: should we exclude audio tracks rather than main tracks - // when type is audio? - - - mpc.blacklistCurrentPlaylist({ - message: "Excessive " + type + " segment downloading detected." - }, Infinity); - } - /** - * The purpose of this function is to emulate the "waiting" event on - * browsers that do not emit it when they are waiting for more - * data to continue playback - * - * @private - */ - ; - - _proto.checkCurrentTime_ = function checkCurrentTime_() { - if (this.tech_.seeking() && this.fixesBadSeeks_()) { - this.consecutiveUpdates = 0; - this.lastRecordedTime = this.tech_.currentTime(); - return; - } - - if (this.tech_.paused() || this.tech_.seeking()) { - return; - } - - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - - if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA >= buffered.end(buffered.length - 1))) { - // If current time is at the end of the final buffered region, then any playback - // stall is most likely caused by buffering in a low bandwidth environment. The tech - // should fire a `waiting` event in this scenario, but due to browser and tech - // inconsistencies. Calling `techWaiting_` here allows us to simulate - // responding to a native `waiting` event when the tech fails to emit one. - return this.techWaiting_(); - } - - if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) { - this.consecutiveUpdates++; - this.waiting_(); - } else if (currentTime === this.lastRecordedTime) { - this.consecutiveUpdates++; - } else { - this.consecutiveUpdates = 0; - this.lastRecordedTime = currentTime; - } - } - /** - * Cancels any pending timers and resets the 'timeupdate' mechanism - * designed to detect that we are stalled - * - * @private - */ - ; - - _proto.cancelTimer_ = function cancelTimer_() { - this.consecutiveUpdates = 0; - - if (this.timer_) { - this.logger_('cancelTimer_'); - clearTimeout(this.timer_); - } - - this.timer_ = null; - } - /** - * Fixes situations where there's a bad seek - * - * @return {boolean} whether an action was taken to fix the seek - * @private - */ - ; - - _proto.fixesBadSeeks_ = function fixesBadSeeks_() { - var seeking = this.tech_.seeking(); - - if (!seeking) { - return false; - } - - var seekable = this.seekable(); - var currentTime = this.tech_.currentTime(); - var isAfterSeekableRange = this.afterSeekableWindow_(seekable, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow); - var seekTo; - - if (isAfterSeekableRange) { - var seekableEnd = seekable.end(seekable.length - 1); // sync to live point (if VOD, our seekable was updated and we're simply adjusting) - - seekTo = seekableEnd; - } - - if (this.beforeSeekableWindow_(seekable, currentTime)) { - var seekableStart = seekable.start(0); // sync to the beginning of the live window - // provide a buffer of .1 seconds to handle rounding/imprecise numbers - - seekTo = seekableStart + ( // if the playlist is too short and the seekable range is an exact time (can - // happen in live with a 3 segment playlist), then don't use a time delta - seekableStart === seekable.end(0) ? 0 : SAFE_TIME_DELTA); - } - - if (typeof seekTo !== 'undefined') { - this.logger_("Trying to seek outside of seekable at time " + currentTime + " with " + ("seekable range " + printableRange(seekable) + ". Seeking to ") + (seekTo + ".")); - this.tech_.setCurrentTime(seekTo); - return true; - } - - var buffered = this.tech_.buffered(); - - if (closeToBufferedContent({ - buffered: buffered, - targetDuration: this.media().targetDuration, - currentTime: currentTime - })) { - seekTo = buffered.start(0) + SAFE_TIME_DELTA; - this.logger_("Buffered region starts (" + buffered.start(0) + ") " + (" just beyond seek point (" + currentTime + "). Seeking to " + seekTo + ".")); - this.tech_.setCurrentTime(seekTo); - return true; - } - - return false; - } - /** - * Handler for situations when we determine the player is waiting. - * - * @private - */ - ; - - _proto.waiting_ = function waiting_() { - if (this.techWaiting_()) { - return; - } // All tech waiting checks failed. Use last resort correction - - - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - var currentRange = findRange(buffered, currentTime); // Sometimes the player can stall for unknown reasons within a contiguous buffered - // region with no indication that anything is amiss (seen in Firefox). Seeking to - // currentTime is usually enough to kickstart the player. This checks that the player - // is currently within a buffered region before attempting a corrective seek. - // Chrome does not appear to continue `timeupdate` events after a `waiting` event - // until there is ~ 3 seconds of forward buffer available. PlaybackWatcher should also - // make sure there is ~3 seconds of forward buffer before taking any corrective action - // to avoid triggering an `unknownwaiting` event when the network is slow. - - if (currentRange.length && currentTime + 3 <= currentRange.end(0)) { - this.cancelTimer_(); - this.tech_.setCurrentTime(currentTime); - this.logger_("Stopped at " + currentTime + " while inside a buffered region " + ("[" + currentRange.start(0) + " -> " + currentRange.end(0) + "]. Attempting to resume ") + 'playback by seeking to the current time.'); // unknown waiting corrections may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-unknown-waiting' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-unknown-waiting' - }); - return; - } - } - /** - * Handler for situations when the tech fires a `waiting` event - * - * @return {boolean} - * True if an action (or none) was needed to correct the waiting. False if no - * checks passed - * @private - */ - ; - - _proto.techWaiting_ = function techWaiting_() { - var seekable = this.seekable(); - var currentTime = this.tech_.currentTime(); - - if (this.tech_.seeking() && this.fixesBadSeeks_()) { - // Tech is seeking or bad seek fixed, no action needed - return true; - } - - if (this.tech_.seeking() || this.timer_ !== null) { - // Tech is seeking or already waiting on another action, no action needed - return true; - } - - if (this.beforeSeekableWindow_(seekable, currentTime)) { - var livePoint = seekable.end(seekable.length - 1); - this.logger_("Fell out of live window at time " + currentTime + ". Seeking to " + ("live point (seekable end) " + livePoint)); - this.cancelTimer_(); - this.tech_.setCurrentTime(livePoint); // live window resyncs may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-live-resync' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-live-resync' - }); - return true; - } - - var sourceUpdater = this.tech_.vhs.masterPlaylistController_.sourceUpdater_; - var buffered = this.tech_.buffered(); - var videoUnderflow = this.videoUnderflow_({ - audioBuffered: sourceUpdater.audioBuffered(), - videoBuffered: sourceUpdater.videoBuffered(), - currentTime: currentTime - }); - - if (videoUnderflow) { - // Even though the video underflowed and was stuck in a gap, the audio overplayed - // the gap, leading currentTime into a buffered range. Seeking to currentTime - // allows the video to catch up to the audio position without losing any audio - // (only suffering ~3 seconds of frozen video and a pause in audio playback). - this.cancelTimer_(); - this.tech_.setCurrentTime(currentTime); // video underflow may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-video-underflow' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-video-underflow' - }); - return true; - } - - var nextRange = findNextRange(buffered, currentTime); // check for gap - - if (nextRange.length > 0) { - var difference = nextRange.start(0) - currentTime; - this.logger_("Stopped at " + currentTime + ", setting timer for " + difference + ", seeking " + ("to " + nextRange.start(0))); - this.cancelTimer_(); - this.timer_ = setTimeout(this.skipTheGap_.bind(this), difference * 1000, currentTime); - return true; - } // All checks failed. Returning false to indicate failure to correct waiting - - - return false; - }; - - _proto.afterSeekableWindow_ = function afterSeekableWindow_(seekable, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow) { - if (allowSeeksWithinUnsafeLiveWindow === void 0) { - allowSeeksWithinUnsafeLiveWindow = false; - } - - if (!seekable.length) { - // we can't make a solid case if there's no seekable, default to false - return false; - } - - var allowedEnd = seekable.end(seekable.length - 1) + SAFE_TIME_DELTA; - var isLive = !playlist.endList; - - if (isLive && allowSeeksWithinUnsafeLiveWindow) { - allowedEnd = seekable.end(seekable.length - 1) + playlist.targetDuration * 3; - } - - if (currentTime > allowedEnd) { - return true; - } - - return false; - }; - - _proto.beforeSeekableWindow_ = function beforeSeekableWindow_(seekable, currentTime) { - if (seekable.length && // can't fall before 0 and 0 seekable start identifies VOD stream - seekable.start(0) > 0 && currentTime < seekable.start(0) - this.liveRangeSafeTimeDelta) { - return true; - } - - return false; - }; - - _proto.videoUnderflow_ = function videoUnderflow_(_ref2) { - var videoBuffered = _ref2.videoBuffered, - audioBuffered = _ref2.audioBuffered, - currentTime = _ref2.currentTime; - - // audio only content will not have video underflow :) - if (!videoBuffered) { - return; - } - - var gap; // find a gap in demuxed content. - - if (videoBuffered.length && audioBuffered.length) { - // in Chrome audio will continue to play for ~3s when we run out of video - // so we have to check that the video buffer did have some buffer in the - // past. - var lastVideoRange = findRange(videoBuffered, currentTime - 3); - var videoRange = findRange(videoBuffered, currentTime); - var audioRange = findRange(audioBuffered, currentTime); - - if (audioRange.length && !videoRange.length && lastVideoRange.length) { - gap = { - start: lastVideoRange.end(0), - end: audioRange.end(0) - }; - } // find a gap in muxed content. - - } else { - var nextRange = findNextRange(videoBuffered, currentTime); // Even if there is no available next range, there is still a possibility we are - // stuck in a gap due to video underflow. - - if (!nextRange.length) { - gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime); - } - } - - if (gap) { - this.logger_("Encountered a gap in video from " + gap.start + " to " + gap.end + ". " + ("Seeking to current time " + currentTime)); - return true; - } - - return false; - } - /** - * Timer callback. If playback still has not proceeded, then we seek - * to the start of the next buffered region. - * - * @private - */ - ; - - _proto.skipTheGap_ = function skipTheGap_(scheduledCurrentTime) { - var buffered = this.tech_.buffered(); - var currentTime = this.tech_.currentTime(); - var nextRange = findNextRange(buffered, currentTime); - this.cancelTimer_(); - - if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) { - return; - } - - this.logger_('skipTheGap_:', 'currentTime:', currentTime, 'scheduled currentTime:', scheduledCurrentTime, 'nextRange start:', nextRange.start(0)); // only seek if we still have not played - - this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR); - this.tech_.trigger({ - type: 'usage', - name: 'vhs-gap-skip' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-gap-skip' - }); - }; - - _proto.gapFromVideoUnderflow_ = function gapFromVideoUnderflow_(buffered, currentTime) { - // At least in Chrome, if there is a gap in the video buffer, the audio will continue - // playing for ~3 seconds after the video gap starts. This is done to account for - // video buffer underflow/underrun (note that this is not done when there is audio - // buffer underflow/underrun -- in that case the video will stop as soon as it - // encounters the gap, as audio stalls are more noticeable/jarring to a user than - // video stalls). The player's time will reflect the playthrough of audio, so the - // time will appear as if we are in a buffered region, even if we are stuck in a - // "gap." - // - // Example: - // video buffer: 0 => 10.1, 10.2 => 20 - // audio buffer: 0 => 20 - // overall buffer: 0 => 10.1, 10.2 => 20 - // current time: 13 - // - // Chrome's video froze at 10 seconds, where the video buffer encountered the gap, - // however, the audio continued playing until it reached ~3 seconds past the gap - // (13 seconds), at which point it stops as well. Since current time is past the - // gap, findNextRange will return no ranges. - // - // To check for this issue, we see if there is a gap that starts somewhere within - // a 3 second range (3 seconds +/- 1 second) back from our current time. - var gaps = findGaps(buffered); - - for (var i = 0; i < gaps.length; i++) { - var start = gaps.start(i); - var end = gaps.end(i); // gap is starts no more than 4 seconds back - - if (currentTime - start < 4 && currentTime - start > 2) { - return { - start: start, - end: end - }; - } - } - - return null; - }; - - return PlaybackWatcher; -}(); - -var defaultOptions = { - errorInterval: 30, - getSource: function getSource(next) { - var tech = this.tech({ - IWillNotUseThisInPlugins: true - }); - var sourceObj = tech.currentSource_ || this.currentSource(); - return next(sourceObj); - } -}; -/** - * Main entry point for the plugin - * - * @param {Player} player a reference to a videojs Player instance - * @param {Object} [options] an object with plugin options - * @private - */ - -var initPlugin = function initPlugin(player, options) { - var lastCalled = 0; - var seekTo = 0; - var localOptions = videojs.mergeOptions(defaultOptions, options); - player.ready(function () { - player.trigger({ - type: 'usage', - name: 'vhs-error-reload-initialized' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload-initialized' - }); - }); - /** - * Player modifications to perform that must wait until `loadedmetadata` - * has been triggered - * - * @private - */ - - var loadedMetadataHandler = function loadedMetadataHandler() { - if (seekTo) { - player.currentTime(seekTo); - } - }; - /** - * Set the source on the player element, play, and seek if necessary - * - * @param {Object} sourceObj An object specifying the source url and mime-type to play - * @private - */ - - - var setSource = function setSource(sourceObj) { - if (sourceObj === null || sourceObj === undefined) { - return; - } - - seekTo = player.duration() !== Infinity && player.currentTime() || 0; - player.one('loadedmetadata', loadedMetadataHandler); - player.src(sourceObj); - player.trigger({ - type: 'usage', - name: 'vhs-error-reload' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload' - }); - player.play(); - }; - /** - * Attempt to get a source from either the built-in getSource function - * or a custom function provided via the options - * - * @private - */ - - - var errorHandler = function errorHandler() { - // Do not attempt to reload the source if a source-reload occurred before - // 'errorInterval' time has elapsed since the last source-reload - if (Date.now() - lastCalled < localOptions.errorInterval * 1000) { - player.trigger({ - type: 'usage', - name: 'vhs-error-reload-canceled' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload-canceled' - }); - return; - } - - if (!localOptions.getSource || typeof localOptions.getSource !== 'function') { - videojs.log.error('ERROR: reloadSourceOnError - The option getSource must be a function!'); - return; - } - - lastCalled = Date.now(); - return localOptions.getSource.call(player, setSource); - }; - /** - * Unbind any event handlers that were bound by the plugin - * - * @private - */ - - - var cleanupEvents = function cleanupEvents() { - player.off('loadedmetadata', loadedMetadataHandler); - player.off('error', errorHandler); - player.off('dispose', cleanupEvents); - }; - /** - * Cleanup before re-initializing the plugin - * - * @param {Object} [newOptions] an object with plugin options - * @private - */ - - - var reinitPlugin = function reinitPlugin(newOptions) { - cleanupEvents(); - initPlugin(player, newOptions); - }; - - player.on('error', errorHandler); - player.on('dispose', cleanupEvents); // Overwrite the plugin function so that we can correctly cleanup before - // initializing the plugin - - player.reloadSourceOnError = reinitPlugin; -}; -/** - * Reload the source when an error is detected as long as there - * wasn't an error previously within the last 30 seconds - * - * @param {Object} [options] an object with plugin options - */ - - -var reloadSourceOnError = function reloadSourceOnError(options) { - initPlugin(this, options); -}; - -var version$4 = "2.9.1"; - -var version$3 = "5.11.1"; - -var version$2 = "0.17.0"; - -var version$1 = "4.7.0"; - -var version = "3.1.2"; - -var Vhs = { - PlaylistLoader: PlaylistLoader, - Playlist: Playlist, - utils: utils, - STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector, - INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector, - lastBandwidthSelector: lastBandwidthSelector, - movingAverageBandwidthSelector: movingAverageBandwidthSelector, - comparePlaylistBandwidth: comparePlaylistBandwidth, - comparePlaylistResolution: comparePlaylistResolution, - xhr: xhrFactory() -}; // Define getter/setters for config properties - -Object.keys(Config).forEach(function (prop) { - Object.defineProperty(Vhs, prop, { - get: function get() { - videojs.log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing"); - return Config[prop]; - }, - set: function set(value) { - videojs.log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing"); - - if (typeof value !== 'number' || value < 0) { - videojs.log.warn("value of Vhs." + prop + " must be greater than or equal to 0"); - return; - } - - Config[prop] = value; - } - }); -}); -var LOCAL_STORAGE_KEY = 'videojs-vhs'; -/** - * Updates the selectedIndex of the QualityLevelList when a mediachange happens in vhs. - * - * @param {QualityLevelList} qualityLevels The QualityLevelList to update. - * @param {PlaylistLoader} playlistLoader PlaylistLoader containing the new media info. - * @function handleVhsMediaChange - */ - -var handleVhsMediaChange = function handleVhsMediaChange(qualityLevels, playlistLoader) { - var newPlaylist = playlistLoader.media(); - var selectedIndex = -1; - - for (var i = 0; i < qualityLevels.length; i++) { - if (qualityLevels[i].id === newPlaylist.id) { - selectedIndex = i; - break; - } - } - - qualityLevels.selectedIndex_ = selectedIndex; - qualityLevels.trigger({ - selectedIndex: selectedIndex, - type: 'change' - }); -}; -/** - * Adds quality levels to list once playlist metadata is available - * - * @param {QualityLevelList} qualityLevels The QualityLevelList to attach events to. - * @param {Object} vhs Vhs object to listen to for media events. - * @function handleVhsLoadedMetadata - */ - - -var handleVhsLoadedMetadata = function handleVhsLoadedMetadata(qualityLevels, vhs) { - vhs.representations().forEach(function (rep) { - qualityLevels.addQualityLevel(rep); - }); - handleVhsMediaChange(qualityLevels, vhs.playlists); -}; // HLS is a source handler, not a tech. Make sure attempts to use it -// as one do not cause exceptions. - - -Vhs.canPlaySource = function () { - return videojs.log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\'s techOrder.'); -}; - -var emeKeySystems = function emeKeySystems(keySystemOptions, mainPlaylist, audioPlaylist) { - if (!keySystemOptions) { - return keySystemOptions; - } - - var codecs = {}; - - if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) { - codecs = unwrapCodecList(parseCodecs(mainPlaylist.attributes.CODECS)); - } - - if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) { - codecs.audio = audioPlaylist.attributes.CODECS; - } - - var videoContentType = getMimeForCodec(codecs.video); - var audioContentType = getMimeForCodec(codecs.audio); // upsert the content types based on the selected playlist - - var keySystemContentTypes = {}; - - for (var keySystem in keySystemOptions) { - keySystemContentTypes[keySystem] = {}; - - if (audioContentType) { - keySystemContentTypes[keySystem].audioContentType = audioContentType; - } - - if (videoContentType) { - keySystemContentTypes[keySystem].videoContentType = videoContentType; - } // Default to using the video playlist's PSSH even though they may be different, as - // videojs-contrib-eme will only accept one in the options. - // - // This shouldn't be an issue for most cases as early intialization will handle all - // unique PSSH values, and if they aren't, then encrypted events should have the - // specific information needed for the unique license. - - - if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) { - keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh; - } // videojs-contrib-eme accepts the option of specifying: 'com.some.cdm': 'url' - // so we need to prevent overwriting the URL entirely - - - if (typeof keySystemOptions[keySystem] === 'string') { - keySystemContentTypes[keySystem].url = keySystemOptions[keySystem]; - } - } - - return videojs.mergeOptions(keySystemOptions, keySystemContentTypes); -}; -/** - * @typedef {Object} KeySystems - * - * keySystems configuration for https://github.com/videojs/videojs-contrib-eme - * Note: not all options are listed here. - * - * @property {Uint8Array} [pssh] - * Protection System Specific Header - */ - -/** - * Goes through all the playlists and collects an array of KeySystems options objects - * containing each playlist's keySystems and their pssh values, if available. - * - * @param {Object[]} playlists - * The playlists to look through - * @param {string[]} keySystems - * The keySystems to collect pssh values for - * - * @return {KeySystems[]} - * An array of KeySystems objects containing available key systems and their - * pssh values - */ - - -var getAllPsshKeySystemsOptions = function getAllPsshKeySystemsOptions(playlists, keySystems) { - return playlists.reduce(function (keySystemsArr, playlist) { - if (!playlist.contentProtection) { - return keySystemsArr; - } - - var keySystemsOptions = keySystems.reduce(function (keySystemsObj, keySystem) { - var keySystemOptions = playlist.contentProtection[keySystem]; - - if (keySystemOptions && keySystemOptions.pssh) { - keySystemsObj[keySystem] = { - pssh: keySystemOptions.pssh - }; - } - - return keySystemsObj; - }, {}); - - if (Object.keys(keySystemsOptions).length) { - keySystemsArr.push(keySystemsOptions); - } - - return keySystemsArr; - }, []); -}; -/** - * Returns a promise that waits for the - * [eme plugin](https://github.com/videojs/videojs-contrib-eme) to create a key session. - * - * Works around https://bugs.chromium.org/p/chromium/issues/detail?id=895449 in non-IE11 - * browsers. - * - * As per the above ticket, this is particularly important for Chrome, where, if - * unencrypted content is appended before encrypted content and the key session has not - * been created, a MEDIA_ERR_DECODE will be thrown once the encrypted content is reached - * during playback. - * - * @param {Object} player - * The player instance - * @param {Object[]} sourceKeySystems - * The key systems options from the player source - * @param {Object} [audioMedia] - * The active audio media playlist (optional) - * @param {Object[]} mainPlaylists - * The playlists found on the master playlist object - * - * @return {Object} - * Promise that resolves when the key session has been created - */ - - -var waitForKeySessionCreation = function waitForKeySessionCreation(_ref) { - var player = _ref.player, - sourceKeySystems = _ref.sourceKeySystems, - audioMedia = _ref.audioMedia, - mainPlaylists = _ref.mainPlaylists; - - if (!player.eme.initializeMediaKeys) { - return Promise.resolve(); - } // TODO should all audio PSSH values be initialized for DRM? - // - // All unique video rendition pssh values are initialized for DRM, but here only - // the initial audio playlist license is initialized. In theory, an encrypted - // event should be fired if the user switches to an alternative audio playlist - // where a license is required, but this case hasn't yet been tested. In addition, there - // may be many alternate audio playlists unlikely to be used (e.g., multiple different - // languages). - - - var playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists; - var keySystemsOptionsArr = getAllPsshKeySystemsOptions(playlists, Object.keys(sourceKeySystems)); - var initializationFinishedPromises = []; - var keySessionCreatedPromises = []; // Since PSSH values are interpreted as initData, EME will dedupe any duplicates. The - // only place where it should not be deduped is for ms-prefixed APIs, but the early - // return for IE11 above, and the existence of modern EME APIs in addition to - // ms-prefixed APIs on Edge should prevent this from being a concern. - // initializeMediaKeys also won't use the webkit-prefixed APIs. - - keySystemsOptionsArr.forEach(function (keySystemsOptions) { - keySessionCreatedPromises.push(new Promise(function (resolve, reject) { - player.tech_.one('keysessioncreated', resolve); - })); - initializationFinishedPromises.push(new Promise(function (resolve, reject) { - player.eme.initializeMediaKeys({ - keySystems: keySystemsOptions - }, function (err) { - if (err) { - reject(err); - return; - } - - resolve(); - }); - })); - }); // The reasons Promise.race is chosen over Promise.any: - // - // * Promise.any is only available in Safari 14+. - // * None of these promises are expected to reject. If they do reject, it might be - // better here for the race to surface the rejection, rather than mask it by using - // Promise.any. - - return Promise.race([// If a session was previously created, these will all finish resolving without - // creating a new session, otherwise it will take until the end of all license - // requests, which is why the key session check is used (to make setup much faster). - Promise.all(initializationFinishedPromises), // Once a single session is created, the browser knows DRM will be used. - Promise.race(keySessionCreatedPromises)]); -}; -/** - * If the [eme](https://github.com/videojs/videojs-contrib-eme) plugin is available, and - * there are keySystems on the source, sets up source options to prepare the source for - * eme. - * - * @param {Object} player - * The player instance - * @param {Object[]} sourceKeySystems - * The key systems options from the player source - * @param {Object} media - * The active media playlist - * @param {Object} [audioMedia] - * The active audio media playlist (optional) - * - * @return {boolean} - * Whether or not options were configured and EME is available - */ - -var setupEmeOptions = function setupEmeOptions(_ref2) { - var player = _ref2.player, - sourceKeySystems = _ref2.sourceKeySystems, - media = _ref2.media, - audioMedia = _ref2.audioMedia; - var sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia); - - if (!sourceOptions) { - return false; - } - - player.currentSource().keySystems = sourceOptions; // eme handles the rest of the setup, so if it is missing - // do nothing. - - if (sourceOptions && !player.eme) { - videojs.log.warn('DRM encrypted source cannot be decrypted without a DRM plugin'); - return false; - } - - return true; -}; - -var getVhsLocalStorage = function getVhsLocalStorage() { - if (!window.localStorage) { - return null; - } - - var storedObject = window.localStorage.getItem(LOCAL_STORAGE_KEY); - - if (!storedObject) { - return null; - } - - try { - return JSON.parse(storedObject); - } catch (e) { - // someone may have tampered with the value - return null; - } -}; - -var updateVhsLocalStorage = function updateVhsLocalStorage(options) { - if (!window.localStorage) { - return false; - } - - var objectToStore = getVhsLocalStorage(); - objectToStore = objectToStore ? videojs.mergeOptions(objectToStore, options) : options; - - try { - window.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore)); - } catch (e) { - // Throws if storage is full (e.g., always on iOS 5+ Safari private mode, where - // storage is set to 0). - // https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#Exceptions - // No need to perform any operation. - return false; - } - - return objectToStore; -}; -/** - * Parses VHS-supported media types from data URIs. See - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs - * for information on data URIs. - * - * @param {string} dataUri - * The data URI - * - * @return {string|Object} - * The parsed object/string, or the original string if no supported media type - * was found - */ - - -var expandDataUri = function expandDataUri(dataUri) { - if (dataUri.toLowerCase().indexOf('data:application/vnd.videojs.vhs+json,') === 0) { - return JSON.parse(dataUri.substring(dataUri.indexOf(',') + 1)); - } // no known case for this data URI, return the string as-is - - - return dataUri; -}; -/** - * Whether the browser has built-in HLS support. - */ - - -Vhs.supportsNativeHls = function () { - if (!document || !document.createElement) { - return false; - } - - var video = document.createElement('video'); // native HLS is definitely not supported if HTML5 video isn't - - if (!videojs.getTech('Html5').isSupported()) { - return false; - } // HLS manifests can go by many mime-types - - - var canPlay = [// Apple santioned - 'application/vnd.apple.mpegurl', // Apple sanctioned for backwards compatibility - 'audio/mpegurl', // Very common - 'audio/x-mpegurl', // Very common - 'application/x-mpegurl', // Included for completeness - 'video/x-mpegurl', 'video/mpegurl', 'application/mpegurl']; - return canPlay.some(function (canItPlay) { - return /maybe|probably/i.test(video.canPlayType(canItPlay)); - }); -}(); - -Vhs.supportsNativeDash = function () { - if (!document || !document.createElement || !videojs.getTech('Html5').isSupported()) { - return false; - } - - return /maybe|probably/i.test(document.createElement('video').canPlayType('application/dash+xml')); -}(); - -Vhs.supportsTypeNatively = function (type) { - if (type === 'hls') { - return Vhs.supportsNativeHls; - } - - if (type === 'dash') { - return Vhs.supportsNativeDash; - } - - return false; -}; -/** - * HLS is a source handler, not a tech. Make sure attempts to use it - * as one do not cause exceptions. - */ - - -Vhs.isSupported = function () { - return videojs.log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\'s techOrder.'); -}; - -var Component = videojs.getComponent('Component'); -/** - * The Vhs Handler object, where we orchestrate all of the parts - * of HLS to interact with video.js - * - * @class VhsHandler - * @extends videojs.Component - * @param {Object} source the soruce object - * @param {Tech} tech the parent tech object - * @param {Object} options optional and required options - */ - -var VhsHandler = /*#__PURE__*/function (_Component) { - _inheritsLoose(VhsHandler, _Component); - - function VhsHandler(source, tech, options) { - var _this; - - _this = _Component.call(this, tech, videojs.mergeOptions(options.hls, options.vhs)) || this; - - if (options.hls && Object.keys(options.hls).length) { - videojs.log.warn('Using hls options is deprecated. Use vhs instead.'); - } // if a tech level `initialBandwidth` option was passed - // use that over the VHS level `bandwidth` option - - - if (typeof options.initialBandwidth === 'number') { - _this.options_.bandwidth = options.initialBandwidth; - } - - _this.logger_ = logger('VhsHandler'); // tech.player() is deprecated but setup a reference to HLS for - // backwards-compatibility - - if (tech.options_ && tech.options_.playerId) { - var _player = videojs(tech.options_.playerId); - - if (!_player.hasOwnProperty('hls')) { - Object.defineProperty(_player, 'hls', { - get: function get() { - videojs.log.warn('player.hls is deprecated. Use player.tech().vhs instead.'); - tech.trigger({ - type: 'usage', - name: 'hls-player-access' - }); - return _assertThisInitialized(_this); - }, - configurable: true - }); - } - - if (!_player.hasOwnProperty('vhs')) { - Object.defineProperty(_player, 'vhs', { - get: function get() { - videojs.log.warn('player.vhs is deprecated. Use player.tech().vhs instead.'); - tech.trigger({ - type: 'usage', - name: 'vhs-player-access' - }); - return _assertThisInitialized(_this); - }, - configurable: true - }); - } - - if (!_player.hasOwnProperty('dash')) { - Object.defineProperty(_player, 'dash', { - get: function get() { - videojs.log.warn('player.dash is deprecated. Use player.tech().vhs instead.'); - return _assertThisInitialized(_this); - }, - configurable: true - }); - } - - _this.player_ = _player; - } - - _this.tech_ = tech; - _this.source_ = source; - _this.stats = {}; - _this.ignoreNextSeekingEvent_ = false; - - _this.setOptions_(); - - if (_this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) { - tech.overrideNativeAudioTracks(true); - tech.overrideNativeVideoTracks(true); - } else if (_this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) { - // overriding native HLS only works if audio tracks have been emulated - // error early if we're misconfigured - throw new Error('Overriding native HLS requires emulated tracks. ' + 'See https://git.io/vMpjB'); - } // listen for fullscreenchange events for this player so that we - // can adjust our quality selection quickly - - - _this.on(document, ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'], function (event) { - var fullscreenElement = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement; - - if (fullscreenElement && fullscreenElement.contains(_this.tech_.el())) { - _this.masterPlaylistController_.fastQualityChange_(); - } else { - // When leaving fullscreen, since the in page pixel dimensions should be smaller - // than full screen, see if there should be a rendition switch down to preserve - // bandwidth. - _this.masterPlaylistController_.checkABR_(); - } - }); - - _this.on(_this.tech_, 'seeking', function () { - if (this.ignoreNextSeekingEvent_) { - this.ignoreNextSeekingEvent_ = false; - return; - } - - this.setCurrentTime(this.tech_.currentTime()); - }); - - _this.on(_this.tech_, 'error', function () { - // verify that the error was real and we are loaded - // enough to have mpc loaded. - if (this.tech_.error() && this.masterPlaylistController_) { - this.masterPlaylistController_.pauseLoading(); - } - }); - - _this.on(_this.tech_, 'play', _this.play); - - return _this; - } - - var _proto = VhsHandler.prototype; - - _proto.setOptions_ = function setOptions_() { - var _this2 = this; - - // defaults - this.options_.withCredentials = this.options_.withCredentials || false; - this.options_.handleManifestRedirects = this.options_.handleManifestRedirects === false ? false : true; - this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true; - this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false; - this.options_.smoothQualityChange = this.options_.smoothQualityChange || false; - this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== 'undefined' ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false; - this.options_.customTagParsers = this.options_.customTagParsers || []; - this.options_.customTagMappers = this.options_.customTagMappers || []; - this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false; - - if (typeof this.options_.blacklistDuration !== 'number') { - this.options_.blacklistDuration = 5 * 60; - } - - if (typeof this.options_.bandwidth !== 'number') { - if (this.options_.useBandwidthFromLocalStorage) { - var storedObject = getVhsLocalStorage(); - - if (storedObject && storedObject.bandwidth) { - this.options_.bandwidth = storedObject.bandwidth; - this.tech_.trigger({ - type: 'usage', - name: 'vhs-bandwidth-from-local-storage' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-bandwidth-from-local-storage' - }); - } - - if (storedObject && storedObject.throughput) { - this.options_.throughput = storedObject.throughput; - this.tech_.trigger({ - type: 'usage', - name: 'vhs-throughput-from-local-storage' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-throughput-from-local-storage' - }); - } - } - } // if bandwidth was not set by options or pulled from local storage, start playlist - // selection at a reasonable bandwidth - - - if (typeof this.options_.bandwidth !== 'number') { - this.options_.bandwidth = Config.INITIAL_BANDWIDTH; - } // If the bandwidth number is unchanged from the initial setting - // then this takes precedence over the enableLowInitialPlaylist option - - - this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config.INITIAL_BANDWIDTH; // grab options passed to player.src - - ['withCredentials', 'useDevicePixelRatio', 'limitRenditionByPlayerDimensions', 'bandwidth', 'smoothQualityChange', 'customTagParsers', 'customTagMappers', 'handleManifestRedirects', 'cacheEncryptionKeys', 'playlistSelector', 'initialPlaylistSelector', 'experimentalBufferBasedABR', 'liveRangeSafeTimeDelta', 'experimentalLLHLS'].forEach(function (option) { - if (typeof _this2.source_[option] !== 'undefined') { - _this2.options_[option] = _this2.source_[option]; - } - }); - this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions; - this.useDevicePixelRatio = this.options_.useDevicePixelRatio; - } - /** - * called when player.src gets called, handle a new source - * - * @param {Object} src the source object to handle - */ - ; - - _proto.src = function src(_src, type) { - var _this3 = this; - - // do nothing if the src is falsey - if (!_src) { - return; - } - - this.setOptions_(); // add master playlist controller options - - this.options_.src = expandDataUri(this.source_.src); - this.options_.tech = this.tech_; - this.options_.externVhs = Vhs; - this.options_.sourceType = simpleTypeFromSourceType(type); // Whenever we seek internally, we should update the tech - - this.options_.seekTo = function (time) { - _this3.tech_.setCurrentTime(time); - }; - - if (this.options_.smoothQualityChange) { - videojs.log.warn('smoothQualityChange is deprecated and will be removed in the next major version'); - } - - this.masterPlaylistController_ = new MasterPlaylistController(this.options_); - var playbackWatcherOptions = videojs.mergeOptions({ - liveRangeSafeTimeDelta: SAFE_TIME_DELTA - }, this.options_, { - seekable: function seekable() { - return _this3.seekable(); - }, - media: function media() { - return _this3.masterPlaylistController_.media(); - }, - masterPlaylistController: this.masterPlaylistController_ - }); - this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions); - this.masterPlaylistController_.on('error', function () { - var player = videojs.players[_this3.tech_.options_.playerId]; - var error = _this3.masterPlaylistController_.error; - - if (typeof error === 'object' && !error.code) { - error.code = 3; - } else if (typeof error === 'string') { - error = { - message: error, - code: 3 - }; - } - - player.error(error); - }); - var defaultSelector = this.options_.experimentalBufferBasedABR ? Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR; // `this` in selectPlaylist should be the VhsHandler for backwards - // compatibility with < v2 - - this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this); - this.masterPlaylistController_.selectInitialPlaylist = Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this); // re-expose some internal objects for backwards compatibility with < v2 - - this.playlists = this.masterPlaylistController_.masterPlaylistLoader_; - this.mediaSource = this.masterPlaylistController_.mediaSource; // Proxy assignment of some properties to the master playlist - // controller. Using a custom property for backwards compatibility - // with < v2 - - Object.defineProperties(this, { - selectPlaylist: { - get: function get() { - return this.masterPlaylistController_.selectPlaylist; - }, - set: function set(selectPlaylist) { - this.masterPlaylistController_.selectPlaylist = selectPlaylist.bind(this); - } - }, - throughput: { - get: function get() { - return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate; - }, - set: function set(throughput) { - this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = throughput; // By setting `count` to 1 the throughput value becomes the starting value - // for the cumulative average - - this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1; - } - }, - bandwidth: { - get: function get() { - return this.masterPlaylistController_.mainSegmentLoader_.bandwidth; - }, - set: function set(bandwidth) { - this.masterPlaylistController_.mainSegmentLoader_.bandwidth = bandwidth; // setting the bandwidth manually resets the throughput counter - // `count` is set to zero that current value of `rate` isn't included - // in the cumulative average - - this.masterPlaylistController_.mainSegmentLoader_.throughput = { - rate: 0, - count: 0 - }; - } - }, - - /** - * `systemBandwidth` is a combination of two serial processes bit-rates. The first - * is the network bitrate provided by `bandwidth` and the second is the bitrate of - * the entire process after that - decryption, transmuxing, and appending - provided - * by `throughput`. - * - * Since the two process are serial, the overall system bandwidth is given by: - * sysBandwidth = 1 / (1 / bandwidth + 1 / throughput) - */ - systemBandwidth: { - get: function get() { - var invBandwidth = 1 / (this.bandwidth || 1); - var invThroughput; - - if (this.throughput > 0) { - invThroughput = 1 / this.throughput; - } else { - invThroughput = 0; - } - - var systemBitrate = Math.floor(1 / (invBandwidth + invThroughput)); - return systemBitrate; - }, - set: function set() { - videojs.log.error('The "systemBandwidth" property is read-only'); - } - } - }); - - if (this.options_.bandwidth) { - this.bandwidth = this.options_.bandwidth; - } - - if (this.options_.throughput) { - this.throughput = this.options_.throughput; - } - - Object.defineProperties(this.stats, { - bandwidth: { - get: function get() { - return _this3.bandwidth || 0; - }, - enumerable: true - }, - mediaRequests: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequests_() || 0; - }, - enumerable: true - }, - mediaRequestsAborted: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsAborted_() || 0; - }, - enumerable: true - }, - mediaRequestsTimedout: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsTimedout_() || 0; - }, - enumerable: true - }, - mediaRequestsErrored: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsErrored_() || 0; - }, - enumerable: true - }, - mediaTransferDuration: { - get: function get() { - return _this3.masterPlaylistController_.mediaTransferDuration_() || 0; - }, - enumerable: true - }, - mediaBytesTransferred: { - get: function get() { - return _this3.masterPlaylistController_.mediaBytesTransferred_() || 0; - }, - enumerable: true - }, - mediaSecondsLoaded: { - get: function get() { - return _this3.masterPlaylistController_.mediaSecondsLoaded_() || 0; - }, - enumerable: true - }, - mediaAppends: { - get: function get() { - return _this3.masterPlaylistController_.mediaAppends_() || 0; - }, - enumerable: true - }, - mainAppendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.mainAppendsToLoadedData_() || 0; - }, - enumerable: true - }, - audioAppendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.audioAppendsToLoadedData_() || 0; - }, - enumerable: true - }, - appendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.appendsToLoadedData_() || 0; - }, - enumerable: true - }, - timeToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.timeToLoadedData_() || 0; - }, - enumerable: true - }, - buffered: { - get: function get() { - return timeRangesToArray(_this3.tech_.buffered()); - }, - enumerable: true - }, - currentTime: { - get: function get() { - return _this3.tech_.currentTime(); - }, - enumerable: true - }, - currentSource: { - get: function get() { - return _this3.tech_.currentSource_; - }, - enumerable: true - }, - currentTech: { - get: function get() { - return _this3.tech_.name_; - }, - enumerable: true - }, - duration: { - get: function get() { - return _this3.tech_.duration(); - }, - enumerable: true - }, - master: { - get: function get() { - return _this3.playlists.master; - }, - enumerable: true - }, - playerDimensions: { - get: function get() { - return _this3.tech_.currentDimensions(); - }, - enumerable: true - }, - seekable: { - get: function get() { - return timeRangesToArray(_this3.tech_.seekable()); - }, - enumerable: true - }, - timestamp: { - get: function get() { - return Date.now(); - }, - enumerable: true - }, - videoPlaybackQuality: { - get: function get() { - return _this3.tech_.getVideoPlaybackQuality(); - }, - enumerable: true - } - }); - this.tech_.one('canplay', this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)); - this.tech_.on('bandwidthupdate', function () { - if (_this3.options_.useBandwidthFromLocalStorage) { - updateVhsLocalStorage({ - bandwidth: _this3.bandwidth, - throughput: Math.round(_this3.throughput) - }); - } - }); - this.masterPlaylistController_.on('selectedinitialmedia', function () { - // Add the manual rendition mix-in to VhsHandler - renditionSelectionMixin(_this3); - }); - this.masterPlaylistController_.sourceUpdater_.on('createdsourcebuffers', function () { - _this3.setupEme_(); - }); // the bandwidth of the primary segment loader is our best - // estimate of overall bandwidth - - this.on(this.masterPlaylistController_, 'progress', function () { - this.tech_.trigger('progress'); - }); // In the live case, we need to ignore the very first `seeking` event since - // that will be the result of the seek-to-live behavior - - this.on(this.masterPlaylistController_, 'firstplay', function () { - this.ignoreNextSeekingEvent_ = true; - }); - this.setupQualityLevels_(); // do nothing if the tech has been disposed already - // this can occur if someone sets the src in player.ready(), for instance - - if (!this.tech_.el()) { - return; - } - - this.mediaSourceUrl_ = window.URL.createObjectURL(this.masterPlaylistController_.mediaSource); - this.tech_.src(this.mediaSourceUrl_); - } - /** - * If necessary and EME is available, sets up EME options and waits for key session - * creation. - * - * This function also updates the source updater so taht it can be used, as for some - * browsers, EME must be configured before content is appended (if appending unencrypted - * content before encrypted content). - */ - ; - - _proto.setupEme_ = function setupEme_() { - var _this4 = this; - - var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader; - var didSetupEmeOptions = setupEmeOptions({ - player: this.player_, - sourceKeySystems: this.source_.keySystems, - media: this.playlists.media(), - audioMedia: audioPlaylistLoader && audioPlaylistLoader.media() - }); // In IE11 this is too early to initialize media keys, and IE11 does not support - // promises. - - if (videojs.browser.IE_VERSION === 11 || !didSetupEmeOptions) { - // If EME options were not set up, we've done all we could to initialize EME. - this.masterPlaylistController_.sourceUpdater_.initializedEme(); - return; - } - - this.logger_('waiting for EME key session creation'); - waitForKeySessionCreation({ - player: this.player_, - sourceKeySystems: this.source_.keySystems, - audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(), - mainPlaylists: this.playlists.master.playlists - }).then(function () { - _this4.logger_('created EME key session'); - - _this4.masterPlaylistController_.sourceUpdater_.initializedEme(); - }).catch(function (err) { - _this4.logger_('error while creating EME key session', err); - - _this4.player_.error({ - message: 'Failed to initialize media keys for EME', - code: 3 - }); - }); - } - /** - * Initializes the quality levels and sets listeners to update them. - * - * @method setupQualityLevels_ - * @private - */ - ; - - _proto.setupQualityLevels_ = function setupQualityLevels_() { - var _this5 = this; - - var player = videojs.players[this.tech_.options_.playerId]; // if there isn't a player or there isn't a qualityLevels plugin - // or qualityLevels_ listeners have already been setup, do nothing. - - if (!player || !player.qualityLevels || this.qualityLevels_) { - return; - } - - this.qualityLevels_ = player.qualityLevels(); - this.masterPlaylistController_.on('selectedinitialmedia', function () { - handleVhsLoadedMetadata(_this5.qualityLevels_, _this5); - }); - this.playlists.on('mediachange', function () { - handleVhsMediaChange(_this5.qualityLevels_, _this5.playlists); - }); - } - /** - * return the version - */ - ; - - VhsHandler.version = function version$5() { - return { - '@videojs/http-streaming': version$4, - 'mux.js': version$3, - 'mpd-parser': version$2, - 'm3u8-parser': version$1, - 'aes-decrypter': version - }; - } - /** - * return the version - */ - ; - - _proto.version = function version() { - return this.constructor.version(); - }; - - _proto.canChangeType = function canChangeType() { - return SourceUpdater.canChangeType(); - } - /** - * Begin playing the video. - */ - ; - - _proto.play = function play() { - this.masterPlaylistController_.play(); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.setCurrentTime = function setCurrentTime(currentTime) { - this.masterPlaylistController_.setCurrentTime(currentTime); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.duration = function duration() { - return this.masterPlaylistController_.duration(); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.seekable = function seekable() { - return this.masterPlaylistController_.seekable(); - } - /** - * Abort all outstanding work and cleanup. - */ - ; - - _proto.dispose = function dispose() { - if (this.playbackWatcher_) { - this.playbackWatcher_.dispose(); - } - - if (this.masterPlaylistController_) { - this.masterPlaylistController_.dispose(); - } - - if (this.qualityLevels_) { - this.qualityLevels_.dispose(); - } - - if (this.player_) { - delete this.player_.vhs; - delete this.player_.dash; - delete this.player_.hls; - } - - if (this.tech_ && this.tech_.vhs) { - delete this.tech_.vhs; - } // don't check this.tech_.hls as it will log a deprecated warning - - - if (this.tech_) { - delete this.tech_.hls; - } - - if (this.mediaSourceUrl_ && window.URL.revokeObjectURL) { - window.URL.revokeObjectURL(this.mediaSourceUrl_); - this.mediaSourceUrl_ = null; - } - - _Component.prototype.dispose.call(this); - }; - - _proto.convertToProgramTime = function convertToProgramTime(time, callback) { - return getProgramTime({ - playlist: this.masterPlaylistController_.media(), - time: time, - callback: callback - }); - } // the player must be playing before calling this - ; - - _proto.seekToProgramTime = function seekToProgramTime$1(programTime, callback, pauseAfterSeek, retryCount) { - if (pauseAfterSeek === void 0) { - pauseAfterSeek = true; - } - - if (retryCount === void 0) { - retryCount = 2; - } - - return seekToProgramTime({ - programTime: programTime, - playlist: this.masterPlaylistController_.media(), - retryCount: retryCount, - pauseAfterSeek: pauseAfterSeek, - seekTo: this.options_.seekTo, - tech: this.options_.tech, - callback: callback - }); - }; - - return VhsHandler; -}(Component); -/** - * The Source Handler object, which informs video.js what additional - * MIME types are supported and sets up playback. It is registered - * automatically to the appropriate tech based on the capabilities of - * the browser it is running in. It is not necessary to use or modify - * this object in normal usage. - */ - - -var VhsSourceHandler = { - name: 'videojs-http-streaming', - VERSION: version$4, - canHandleSource: function canHandleSource(srcObj, options) { - if (options === void 0) { - options = {}; - } - - var localOptions = videojs.mergeOptions(videojs.options, options); - return VhsSourceHandler.canPlayType(srcObj.type, localOptions); - }, - handleSource: function handleSource(source, tech, options) { - if (options === void 0) { - options = {}; - } - - var localOptions = videojs.mergeOptions(videojs.options, options); - tech.vhs = new VhsHandler(source, tech, localOptions); - - if (!videojs.hasOwnProperty('hls')) { - Object.defineProperty(tech, 'hls', { - get: function get() { - videojs.log.warn('player.tech().hls is deprecated. Use player.tech().vhs instead.'); - return tech.vhs; - }, - configurable: true - }); - } - - tech.vhs.xhr = xhrFactory(); - tech.vhs.src(source.src, source.type); - return tech.vhs; - }, - canPlayType: function canPlayType(type, options) { - if (options === void 0) { - options = {}; - } - - var _videojs$mergeOptions = videojs.mergeOptions(videojs.options, options), - _videojs$mergeOptions2 = _videojs$mergeOptions.vhs.overrideNative, - overrideNative = _videojs$mergeOptions2 === void 0 ? !videojs.browser.IS_ANY_SAFARI : _videojs$mergeOptions2; - - var supportedType = simpleTypeFromSourceType(type); - var canUseMsePlayback = supportedType && (!Vhs.supportsTypeNatively(supportedType) || overrideNative); - return canUseMsePlayback ? 'maybe' : ''; - } -}; -/** - * Check to see if the native MediaSource object exists and supports - * an MP4 container with both H.264 video and AAC-LC audio. - * - * @return {boolean} if native media sources are supported - */ - -var supportsNativeMediaSources = function supportsNativeMediaSources() { - return browserSupportsCodec('avc1.4d400d,mp4a.40.2'); -}; // register source handlers with the appropriate techs - - -if (supportsNativeMediaSources()) { - videojs.getTech('Html5').registerSourceHandler(VhsSourceHandler, 0); -} - -videojs.VhsHandler = VhsHandler; -Object.defineProperty(videojs, 'HlsHandler', { - get: function get() { - videojs.log.warn('videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead.'); - return VhsHandler; - }, - configurable: true -}); -videojs.VhsSourceHandler = VhsSourceHandler; -Object.defineProperty(videojs, 'HlsSourceHandler', { - get: function get() { - videojs.log.warn('videojs.HlsSourceHandler is deprecated. ' + 'Use videojs.VhsSourceHandler instead.'); - return VhsSourceHandler; - }, - configurable: true -}); -videojs.Vhs = Vhs; -Object.defineProperty(videojs, 'Hls', { - get: function get() { - videojs.log.warn('videojs.Hls is deprecated. Use videojs.Vhs instead.'); - return Vhs; - }, - configurable: true -}); - -if (!videojs.use) { - videojs.registerComponent('Hls', Vhs); - videojs.registerComponent('Vhs', Vhs); -} - -videojs.options.vhs = videojs.options.vhs || {}; -videojs.options.hls = videojs.options.hls || {}; - -if (videojs.registerPlugin) { - videojs.registerPlugin('reloadSourceOnError', reloadSourceOnError); -} else { - videojs.plugin('reloadSourceOnError', reloadSourceOnError); -} - -export { LOCAL_STORAGE_KEY, Vhs, VhsHandler, VhsSourceHandler, emeKeySystems, expandDataUri, getAllPsshKeySystemsOptions, setupEmeOptions, waitForKeySessionCreation }; diff --git a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.js b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.js deleted file mode 100644 index f39bb86..0000000 --- a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.js +++ /dev/null @@ -1,30873 +0,0 @@ -/*! @name @videojs/http-streaming @version 2.9.1 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('global/document'), require('global/window'), require('video.js'), require('xmldom')) : - typeof define === 'function' && define.amd ? define(['exports', 'global/document', 'global/window', 'video.js', 'xmldom'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.httpStreaming = {}, global.document, global.window, global.videojs, global.window)); -}(this, (function (exports, document, window, videojs, xmldom) { 'use strict'; - - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - - var document__default = /*#__PURE__*/_interopDefaultLegacy(document); - var window__default = /*#__PURE__*/_interopDefaultLegacy(window); - var videojs__default = /*#__PURE__*/_interopDefaultLegacy(videojs); - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function (path, base) { - return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var assertThisInitialized = createCommonjsModule(function (module) { - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; - } - - module.exports = _assertThisInitialized; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - - var setPrototypeOf = createCommonjsModule(function (module) { - function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _setPrototypeOf(o, p); - } - - module.exports = _setPrototypeOf; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - - var inheritsLoose = createCommonjsModule(function (module) { - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); - } - - module.exports = _inheritsLoose; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - - var urlToolkit = createCommonjsModule(function (module, exports) { - // see https://tools.ietf.org/html/rfc1808 - (function (root) { - var URL_REGEX = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/; - var FIRST_SEGMENT_REGEX = /^([^\/?#]*)(.*)$/; - var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g; - var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g; - var URLToolkit = { - // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or // - // E.g - // With opts.alwaysNormalize = false (default, spec compliant) - // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g - // With opts.alwaysNormalize = true (not spec compliant) - // http://a.com/b/cd + /e/f/../g => http://a.com/e/g - buildAbsoluteURL: function buildAbsoluteURL(baseURL, relativeURL, opts) { - opts = opts || {}; // remove any remaining space and CRLF - - baseURL = baseURL.trim(); - relativeURL = relativeURL.trim(); - - if (!relativeURL) { - // 2a) If the embedded URL is entirely empty, it inherits the - // entire base URL (i.e., is set equal to the base URL) - // and we are done. - if (!opts.alwaysNormalize) { - return baseURL; - } - - var basePartsForNormalise = URLToolkit.parseURL(baseURL); - - if (!basePartsForNormalise) { - throw new Error('Error trying to parse base URL.'); - } - - basePartsForNormalise.path = URLToolkit.normalizePath(basePartsForNormalise.path); - return URLToolkit.buildURLFromParts(basePartsForNormalise); - } - - var relativeParts = URLToolkit.parseURL(relativeURL); - - if (!relativeParts) { - throw new Error('Error trying to parse relative URL.'); - } - - if (relativeParts.scheme) { - // 2b) If the embedded URL starts with a scheme name, it is - // interpreted as an absolute URL and we are done. - if (!opts.alwaysNormalize) { - return relativeURL; - } - - relativeParts.path = URLToolkit.normalizePath(relativeParts.path); - return URLToolkit.buildURLFromParts(relativeParts); - } - - var baseParts = URLToolkit.parseURL(baseURL); - - if (!baseParts) { - throw new Error('Error trying to parse base URL.'); - } - - if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') { - // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc - // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a' - var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path); - baseParts.netLoc = pathParts[1]; - baseParts.path = pathParts[2]; - } - - if (baseParts.netLoc && !baseParts.path) { - baseParts.path = '/'; - } - - var builtParts = { - // 2c) Otherwise, the embedded URL inherits the scheme of - // the base URL. - scheme: baseParts.scheme, - netLoc: relativeParts.netLoc, - path: null, - params: relativeParts.params, - query: relativeParts.query, - fragment: relativeParts.fragment - }; - - if (!relativeParts.netLoc) { - // 3) If the embedded URL's is non-empty, we skip to - // Step 7. Otherwise, the embedded URL inherits the - // (if any) of the base URL. - builtParts.netLoc = baseParts.netLoc; // 4) If the embedded URL path is preceded by a slash "/", the - // path is not relative and we skip to Step 7. - - if (relativeParts.path[0] !== '/') { - if (!relativeParts.path) { - // 5) If the embedded URL path is empty (and not preceded by a - // slash), then the embedded URL inherits the base URL path - builtParts.path = baseParts.path; // 5a) if the embedded URL's is non-empty, we skip to - // step 7; otherwise, it inherits the of the base - // URL (if any) and - - if (!relativeParts.params) { - builtParts.params = baseParts.params; // 5b) if the embedded URL's is non-empty, we skip to - // step 7; otherwise, it inherits the of the base - // URL (if any) and we skip to step 7. - - if (!relativeParts.query) { - builtParts.query = baseParts.query; - } - } - } else { - // 6) The last segment of the base URL's path (anything - // following the rightmost slash "/", or the entire path if no - // slash is present) is removed and the embedded URL's path is - // appended in its place. - var baseURLPath = baseParts.path; - var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + relativeParts.path; - builtParts.path = URLToolkit.normalizePath(newPath); - } - } - } - - if (builtParts.path === null) { - builtParts.path = opts.alwaysNormalize ? URLToolkit.normalizePath(relativeParts.path) : relativeParts.path; - } - - return URLToolkit.buildURLFromParts(builtParts); - }, - parseURL: function parseURL(url) { - var parts = URL_REGEX.exec(url); - - if (!parts) { - return null; - } - - return { - scheme: parts[1] || '', - netLoc: parts[2] || '', - path: parts[3] || '', - params: parts[4] || '', - query: parts[5] || '', - fragment: parts[6] || '' - }; - }, - normalizePath: function normalizePath(path) { - // The following operations are - // then applied, in order, to the new path: - // 6a) All occurrences of "./", where "." is a complete path - // segment, are removed. - // 6b) If the path ends with "." as a complete path segment, - // that "." is removed. - path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, ''); // 6c) All occurrences of "/../", where is a - // complete path segment not equal to "..", are removed. - // Removal of these path segments is performed iteratively, - // removing the leftmost matching pattern on each iteration, - // until no matching pattern remains. - // 6d) If the path ends with "/..", where is a - // complete path segment not equal to "..", that - // "/.." is removed. - - while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length) {} - - return path.split('').reverse().join(''); - }, - buildURLFromParts: function buildURLFromParts(parts) { - return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment; - } - }; - module.exports = URLToolkit; - })(); - }); - - var DEFAULT_LOCATION = 'http://example.com'; - - var resolveUrl$1 = function resolveUrl(baseUrl, relativeUrl) { - // return early if we don't need to resolve - if (/^[a-z]+:/i.test(relativeUrl)) { - return relativeUrl; - } // if baseUrl is a data URI, ignore it and resolve everything relative to window.location - - - if (/^data:/.test(baseUrl)) { - baseUrl = window__default['default'].location && window__default['default'].location.href || ''; - } // IE11 supports URL but not the URL constructor - // feature detect the behavior we want - - - var nativeURL = typeof window__default['default'].URL === 'function'; - var protocolLess = /^\/\//.test(baseUrl); // remove location if window.location isn't available (i.e. we're in node) - // and if baseUrl isn't an absolute url - - var removeLocation = !window__default['default'].location && !/\/\//i.test(baseUrl); // if the base URL is relative then combine with the current location - - if (nativeURL) { - baseUrl = new window__default['default'].URL(baseUrl, window__default['default'].location || DEFAULT_LOCATION); - } else if (!/\/\//i.test(baseUrl)) { - baseUrl = urlToolkit.buildAbsoluteURL(window__default['default'].location && window__default['default'].location.href || '', baseUrl); - } - - if (nativeURL) { - var newUrl = new URL(relativeUrl, baseUrl); // if we're a protocol-less url, remove the protocol - // and if we're location-less, remove the location - // otherwise, return the url unmodified - - if (removeLocation) { - return newUrl.href.slice(DEFAULT_LOCATION.length); - } else if (protocolLess) { - return newUrl.href.slice(newUrl.protocol.length); - } - - return newUrl.href; - } - - return urlToolkit.buildAbsoluteURL(baseUrl, relativeUrl); - }; - - /** - * @file resolve-url.js - Handling how URLs are resolved and manipulated - */ - var resolveUrl = resolveUrl$1; - /** - * Checks whether xhr request was redirected and returns correct url depending - * on `handleManifestRedirects` option - * - * @api private - * - * @param {string} url - an url being requested - * @param {XMLHttpRequest} req - xhr request result - * - * @return {string} - */ - - var resolveManifestRedirect = function resolveManifestRedirect(handleManifestRedirect, url, req) { - // To understand how the responseURL below is set and generated: - // - https://fetch.spec.whatwg.org/#concept-response-url - // - https://fetch.spec.whatwg.org/#atomic-http-redirect-handling - if (handleManifestRedirect && req && req.responseURL && url !== req.responseURL) { - return req.responseURL; - } - - return url; - }; - - var logger = function logger(source) { - if (videojs__default['default'].log.debug) { - return videojs__default['default'].log.debug.bind(videojs__default['default'], 'VHS:', source + " >"); - } - - return function () {}; - }; - - var _extends_1 = createCommonjsModule(function (module) { - function _extends() { - module.exports = _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _extends.apply(this, arguments); - } - - module.exports = _extends; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - - /** - * @file stream.js - */ - - /** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ - var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; - }(); - - var atob = function atob(s) { - return window__default['default'].atob ? window__default['default'].atob(s) : Buffer.from(s, 'base64').toString('binary'); - }; - - function decodeB64ToUint8Array(b64Text) { - var decodedString = atob(b64Text); - var array = new Uint8Array(decodedString.length); - - for (var i = 0; i < decodedString.length; i++) { - array[i] = decodedString.charCodeAt(i); - } - - return array; - } - - /*! @name m3u8-parser @version 4.7.0 @license Apache-2.0 */ - /** - * A stream that buffers string input and generates a `data` event for each - * line. - * - * @class LineStream - * @extends Stream - */ - - var LineStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(LineStream, _Stream); - - function LineStream() { - var _this; - - _this = _Stream.call(this) || this; - _this.buffer = ''; - return _this; - } - /** - * Add new data to be parsed. - * - * @param {string} data the text to process - */ - - - var _proto = LineStream.prototype; - - _proto.push = function push(data) { - var nextNewline; - this.buffer += data; - nextNewline = this.buffer.indexOf('\n'); - - for (; nextNewline > -1; nextNewline = this.buffer.indexOf('\n')) { - this.trigger('data', this.buffer.substring(0, nextNewline)); - this.buffer = this.buffer.substring(nextNewline + 1); - } - }; - - return LineStream; - }(Stream); - - var TAB = String.fromCharCode(0x09); - - var parseByterange = function parseByterange(byterangeString) { - // optionally match and capture 0+ digits before `@` - // optionally match and capture 0+ digits after `@` - var match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || ''); - var result = {}; - - if (match[1]) { - result.length = parseInt(match[1], 10); - } - - if (match[2]) { - result.offset = parseInt(match[2], 10); - } - - return result; - }; - /** - * "forgiving" attribute list psuedo-grammar: - * attributes -> keyvalue (',' keyvalue)* - * keyvalue -> key '=' value - * key -> [^=]* - * value -> '"' [^"]* '"' | [^,]* - */ - - - var attributeSeparator = function attributeSeparator() { - var key = '[^=]*'; - var value = '"[^"]*"|[^,]*'; - var keyvalue = '(?:' + key + ')=(?:' + value + ')'; - return new RegExp('(?:^|,)(' + keyvalue + ')'); - }; - /** - * Parse attributes from a line given the separator - * - * @param {string} attributes the attribute line to parse - */ - - - var parseAttributes$1 = function parseAttributes(attributes) { - // split the string using attributes as the separator - var attrs = attributes.split(attributeSeparator()); - var result = {}; - var i = attrs.length; - var attr; - - while (i--) { - // filter out unmatched portions of the string - if (attrs[i] === '') { - continue; - } // split the key and value - - - attr = /([^=]*)=(.*)/.exec(attrs[i]).slice(1); // trim whitespace and remove optional quotes around the value - - attr[0] = attr[0].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^['"](.*)['"]$/g, '$1'); - result[attr[0]] = attr[1]; - } - - return result; - }; - /** - * A line-level M3U8 parser event stream. It expects to receive input one - * line at a time and performs a context-free parse of its contents. A stream - * interpretation of a manifest can be useful if the manifest is expected to - * be too large to fit comfortably into memory or the entirety of the input - * is not immediately available. Otherwise, it's probably much easier to work - * with a regular `Parser` object. - * - * Produces `data` events with an object that captures the parser's - * interpretation of the input. That object has a property `tag` that is one - * of `uri`, `comment`, or `tag`. URIs only have a single additional - * property, `line`, which captures the entirety of the input without - * interpretation. Comments similarly have a single additional property - * `text` which is the input without the leading `#`. - * - * Tags always have a property `tagType` which is the lower-cased version of - * the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance, - * `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized - * tags are given the tag type `unknown` and a single additional property - * `data` with the remainder of the input. - * - * @class ParseStream - * @extends Stream - */ - - - var ParseStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(ParseStream, _Stream); - - function ParseStream() { - var _this; - - _this = _Stream.call(this) || this; - _this.customParsers = []; - _this.tagMappers = []; - return _this; - } - /** - * Parses an additional line of input. - * - * @param {string} line a single line of an M3U8 file to parse - */ - - - var _proto = ParseStream.prototype; - - _proto.push = function push(line) { - var _this2 = this; - - var match; - var event; // strip whitespace - - line = line.trim(); - - if (line.length === 0) { - // ignore empty lines - return; - } // URIs - - - if (line[0] !== '#') { - this.trigger('data', { - type: 'uri', - uri: line - }); - return; - } // map tags - - - var newLines = this.tagMappers.reduce(function (acc, mapper) { - var mappedLine = mapper(line); // skip if unchanged - - if (mappedLine === line) { - return acc; - } - - return acc.concat([mappedLine]); - }, [line]); - newLines.forEach(function (newLine) { - for (var i = 0; i < _this2.customParsers.length; i++) { - if (_this2.customParsers[i].call(_this2, newLine)) { - return; - } - } // Comments - - - if (newLine.indexOf('#EXT') !== 0) { - _this2.trigger('data', { - type: 'comment', - text: newLine.slice(1) - }); - - return; - } // strip off any carriage returns here so the regex matching - // doesn't have to account for them. - - - newLine = newLine.replace('\r', ''); // Tags - - match = /^#EXTM3U/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'm3u' - }); - - return; - } - - match = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'inf' - }; - - if (match[1]) { - event.duration = parseFloat(match[1]); - } - - if (match[2]) { - event.title = match[2]; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'targetduration' - }; - - if (match[1]) { - event.duration = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'version' - }; - - if (match[1]) { - event.version = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'media-sequence' - }; - - if (match[1]) { - event.number = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'discontinuity-sequence' - }; - - if (match[1]) { - event.number = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'playlist-type' - }; - - if (match[1]) { - event.playlistType = match[1]; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-BYTERANGE:?(.*)?$/.exec(newLine); - - if (match) { - event = _extends_1(parseByterange(match[1]), { - type: 'tag', - tagType: 'byterange' - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'allow-cache' - }; - - if (match[1]) { - event.allowed = !/NO/.test(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MAP:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'map' - }; - - if (match[1]) { - var attributes = parseAttributes$1(match[1]); - - if (attributes.URI) { - event.uri = attributes.URI; - } - - if (attributes.BYTERANGE) { - event.byterange = parseByterange(attributes.BYTERANGE); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'stream-inf' - }; - - if (match[1]) { - event.attributes = parseAttributes$1(match[1]); - - if (event.attributes.RESOLUTION) { - var split = event.attributes.RESOLUTION.split('x'); - var resolution = {}; - - if (split[0]) { - resolution.width = parseInt(split[0], 10); - } - - if (split[1]) { - resolution.height = parseInt(split[1], 10); - } - - event.attributes.RESOLUTION = resolution; - } - - if (event.attributes.BANDWIDTH) { - event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10); - } - - if (event.attributes['PROGRAM-ID']) { - event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MEDIA:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'media' - }; - - if (match[1]) { - event.attributes = parseAttributes$1(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-ENDLIST/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'endlist' - }); - - return; - } - - match = /^#EXT-X-DISCONTINUITY/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'discontinuity' - }); - - return; - } - - match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'program-date-time' - }; - - if (match[1]) { - event.dateTimeString = match[1]; - event.dateTimeObject = new Date(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-KEY:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'key' - }; - - if (match[1]) { - event.attributes = parseAttributes$1(match[1]); // parse the IV string into a Uint32Array - - if (event.attributes.IV) { - if (event.attributes.IV.substring(0, 2).toLowerCase() === '0x') { - event.attributes.IV = event.attributes.IV.substring(2); - } - - event.attributes.IV = event.attributes.IV.match(/.{8}/g); - event.attributes.IV[0] = parseInt(event.attributes.IV[0], 16); - event.attributes.IV[1] = parseInt(event.attributes.IV[1], 16); - event.attributes.IV[2] = parseInt(event.attributes.IV[2], 16); - event.attributes.IV[3] = parseInt(event.attributes.IV[3], 16); - event.attributes.IV = new Uint32Array(event.attributes.IV); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-START:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'start' - }; - - if (match[1]) { - event.attributes = parseAttributes$1(match[1]); - event.attributes['TIME-OFFSET'] = parseFloat(event.attributes['TIME-OFFSET']); - event.attributes.PRECISE = /YES/.test(event.attributes.PRECISE); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-out-cont' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-out' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-in' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-SKIP:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'skip' - }; - event.attributes = parseAttributes$1(match[1]); - - if (event.attributes.hasOwnProperty('SKIPPED-SEGMENTS')) { - event.attributes['SKIPPED-SEGMENTS'] = parseInt(event.attributes['SKIPPED-SEGMENTS'], 10); - } - - if (event.attributes.hasOwnProperty('RECENTLY-REMOVED-DATERANGES')) { - event.attributes['RECENTLY-REMOVED-DATERANGES'] = event.attributes['RECENTLY-REMOVED-DATERANGES'].split(TAB); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PART:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part' - }; - event.attributes = parseAttributes$1(match[1]); - ['DURATION'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - ['INDEPENDENT', 'GAP'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = /YES/.test(event.attributes[key]); - } - }); - - if (event.attributes.hasOwnProperty('BYTERANGE')) { - event.attributes.byterange = parseByterange(event.attributes.BYTERANGE); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'server-control' - }; - event.attributes = parseAttributes$1(match[1]); - ['CAN-SKIP-UNTIL', 'PART-HOLD-BACK', 'HOLD-BACK'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - ['CAN-SKIP-DATERANGES', 'CAN-BLOCK-RELOAD'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = /YES/.test(event.attributes[key]); - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part-inf' - }; - event.attributes = parseAttributes$1(match[1]); - ['PART-TARGET'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'preload-hint' - }; - event.attributes = parseAttributes$1(match[1]); - ['BYTERANGE-START', 'BYTERANGE-LENGTH'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - var subkey = key === 'BYTERANGE-LENGTH' ? 'length' : 'offset'; - event.attributes.byterange = event.attributes.byterange || {}; - event.attributes.byterange[subkey] = event.attributes[key]; // only keep the parsed byterange object. - - delete event.attributes[key]; - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'rendition-report' - }; - event.attributes = parseAttributes$1(match[1]); - ['LAST-MSN', 'LAST-PART'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - } - }); - - _this2.trigger('data', event); - - return; - } // unknown tag type - - - _this2.trigger('data', { - type: 'tag', - data: newLine.slice(4) - }); - }); - } - /** - * Add a parser for custom headers - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.customType the custom type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - ; - - _proto.addParser = function addParser(_ref) { - var _this3 = this; - - var expression = _ref.expression, - customType = _ref.customType, - dataParser = _ref.dataParser, - segment = _ref.segment; - - if (typeof dataParser !== 'function') { - dataParser = function dataParser(line) { - return line; - }; - } - - this.customParsers.push(function (line) { - var match = expression.exec(line); - - if (match) { - _this3.trigger('data', { - type: 'custom', - data: dataParser(line), - customType: customType, - segment: segment - }); - - return true; - } - }); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - ; - - _proto.addTagMapper = function addTagMapper(_ref2) { - var expression = _ref2.expression, - map = _ref2.map; - - var mapFn = function mapFn(line) { - if (expression.test(line)) { - return map(line); - } - - return line; - }; - - this.tagMappers.push(mapFn); - }; - - return ParseStream; - }(Stream); - - var camelCase = function camelCase(str) { - return str.toLowerCase().replace(/-(\w)/g, function (a) { - return a[1].toUpperCase(); - }); - }; - - var camelCaseKeys = function camelCaseKeys(attributes) { - var result = {}; - Object.keys(attributes).forEach(function (key) { - result[camelCase(key)] = attributes[key]; - }); - return result; - }; // set SERVER-CONTROL hold back based upon targetDuration and partTargetDuration - // we need this helper because defaults are based upon targetDuration and - // partTargetDuration being set, but they may not be if SERVER-CONTROL appears before - // target durations are set. - - - var setHoldBack = function setHoldBack(manifest) { - var serverControl = manifest.serverControl, - targetDuration = manifest.targetDuration, - partTargetDuration = manifest.partTargetDuration; - - if (!serverControl) { - return; - } - - var tag = '#EXT-X-SERVER-CONTROL'; - var hb = 'holdBack'; - var phb = 'partHoldBack'; - var minTargetDuration = targetDuration && targetDuration * 3; - var minPartDuration = partTargetDuration && partTargetDuration * 2; - - if (targetDuration && !serverControl.hasOwnProperty(hb)) { - serverControl[hb] = minTargetDuration; - this.trigger('info', { - message: tag + " defaulting HOLD-BACK to targetDuration * 3 (" + minTargetDuration + ")." - }); - } - - if (minTargetDuration && serverControl[hb] < minTargetDuration) { - this.trigger('warn', { - message: tag + " clamping HOLD-BACK (" + serverControl[hb] + ") to targetDuration * 3 (" + minTargetDuration + ")" - }); - serverControl[hb] = minTargetDuration; - } // default no part hold back to part target duration * 3 - - - if (partTargetDuration && !serverControl.hasOwnProperty(phb)) { - serverControl[phb] = partTargetDuration * 3; - this.trigger('info', { - message: tag + " defaulting PART-HOLD-BACK to partTargetDuration * 3 (" + serverControl[phb] + ")." - }); - } // if part hold back is too small default it to part target duration * 2 - - - if (partTargetDuration && serverControl[phb] < minPartDuration) { - this.trigger('warn', { - message: tag + " clamping PART-HOLD-BACK (" + serverControl[phb] + ") to partTargetDuration * 2 (" + minPartDuration + ")." - }); - serverControl[phb] = minPartDuration; - } - }; - /** - * A parser for M3U8 files. The current interpretation of the input is - * exposed as a property `manifest` on parser objects. It's just two lines to - * create and parse a manifest once you have the contents available as a string: - * - * ```js - * var parser = new m3u8.Parser(); - * parser.push(xhr.responseText); - * ``` - * - * New input can later be applied to update the manifest object by calling - * `push` again. - * - * The parser attempts to create a usable manifest object even if the - * underlying input is somewhat nonsensical. It emits `info` and `warning` - * events during the parse if it encounters input that seems invalid or - * requires some property of the manifest object to be defaulted. - * - * @class Parser - * @extends Stream - */ - - - var Parser = /*#__PURE__*/function (_Stream) { - inheritsLoose(Parser, _Stream); - - function Parser() { - var _this; - - _this = _Stream.call(this) || this; - _this.lineStream = new LineStream(); - _this.parseStream = new ParseStream(); - - _this.lineStream.pipe(_this.parseStream); - /* eslint-disable consistent-this */ - - - var self = assertThisInitialized(_this); - /* eslint-enable consistent-this */ - - - var uris = []; - var currentUri = {}; // if specified, the active EXT-X-MAP definition - - var currentMap; // if specified, the active decryption key - - var _key; - - var hasParts = false; - - var noop = function noop() {}; - - var defaultMediaGroups = { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }; // This is the Widevine UUID from DASH IF IOP. The same exact string is - // used in MPDs with Widevine encrypted streams. - - var widevineUuid = 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'; // group segments into numbered timelines delineated by discontinuities - - var currentTimeline = 0; // the manifest is empty until the parse stream begins delivering data - - _this.manifest = { - allowCache: true, - discontinuityStarts: [], - segments: [] - }; // keep track of the last seen segment's byte range end, as segments are not required - // to provide the offset, in which case it defaults to the next byte after the - // previous segment - - var lastByterangeEnd = 0; // keep track of the last seen part's byte range end. - - var lastPartByterangeEnd = 0; - - _this.on('end', function () { - // only add preloadSegment if we don't yet have a uri for it. - // and we actually have parts/preloadHints - if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) { - return; - } - - if (!currentUri.map && currentMap) { - currentUri.map = currentMap; - } - - if (!currentUri.key && _key) { - currentUri.key = _key; - } - - if (!currentUri.timeline && typeof currentTimeline === 'number') { - currentUri.timeline = currentTimeline; - } - - _this.manifest.preloadSegment = currentUri; - }); // update the manifest with the m3u8 entry from the parse stream - - - _this.parseStream.on('data', function (entry) { - var mediaGroup; - var rendition; - ({ - tag: function tag() { - // switch based on the tag type - (({ - version: function version() { - if (entry.version) { - this.manifest.version = entry.version; - } - }, - 'allow-cache': function allowCache() { - this.manifest.allowCache = entry.allowed; - - if (!('allowed' in entry)) { - this.trigger('info', { - message: 'defaulting allowCache to YES' - }); - this.manifest.allowCache = true; - } - }, - byterange: function byterange() { - var byterange = {}; - - if ('length' in entry) { - currentUri.byterange = byterange; - byterange.length = entry.length; - - if (!('offset' in entry)) { - /* - * From the latest spec (as of this writing): - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.2 - * - * Same text since EXT-X-BYTERANGE's introduction in draft 7: - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-07#section-3.3.1) - * - * "If o [offset] is not present, the sub-range begins at the next byte - * following the sub-range of the previous media segment." - */ - entry.offset = lastByterangeEnd; - } - } - - if ('offset' in entry) { - currentUri.byterange = byterange; - byterange.offset = entry.offset; - } - - lastByterangeEnd = byterange.offset + byterange.length; - }, - endlist: function endlist() { - this.manifest.endList = true; - }, - inf: function inf() { - if (!('mediaSequence' in this.manifest)) { - this.manifest.mediaSequence = 0; - this.trigger('info', { - message: 'defaulting media sequence to zero' - }); - } - - if (!('discontinuitySequence' in this.manifest)) { - this.manifest.discontinuitySequence = 0; - this.trigger('info', { - message: 'defaulting discontinuity sequence to zero' - }); - } - - if (entry.duration > 0) { - currentUri.duration = entry.duration; - } - - if (entry.duration === 0) { - currentUri.duration = 0.01; - this.trigger('info', { - message: 'updating zero segment duration to a small value' - }); - } - - this.manifest.segments = uris; - }, - key: function key() { - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring key declaration without attribute list' - }); - return; - } // clear the active encryption key - - - if (entry.attributes.METHOD === 'NONE') { - _key = null; - return; - } - - if (!entry.attributes.URI) { - this.trigger('warn', { - message: 'ignoring key declaration without URI' - }); - return; - } - - if (entry.attributes.KEYFORMAT === 'com.apple.streamingkeydelivery') { - this.manifest.contentProtection = this.manifest.contentProtection || {}; // TODO: add full support for this. - - this.manifest.contentProtection['com.apple.fps.1_0'] = { - attributes: entry.attributes - }; - return; - } // check if the content is encrypted for Widevine - // Widevine/HLS spec: https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf - - - if (entry.attributes.KEYFORMAT === widevineUuid) { - var VALID_METHODS = ['SAMPLE-AES', 'SAMPLE-AES-CTR', 'SAMPLE-AES-CENC']; - - if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) { - this.trigger('warn', { - message: 'invalid key method provided for Widevine' - }); - return; - } - - if (entry.attributes.METHOD === 'SAMPLE-AES-CENC') { - this.trigger('warn', { - message: 'SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead' - }); - } - - if (entry.attributes.URI.substring(0, 23) !== 'data:text/plain;base64,') { - this.trigger('warn', { - message: 'invalid key URI provided for Widevine' - }); - return; - } - - if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === '0x')) { - this.trigger('warn', { - message: 'invalid key ID provided for Widevine' - }); - return; - } // if Widevine key attributes are valid, store them as `contentProtection` - // on the manifest to emulate Widevine tag structure in a DASH mpd - - - this.manifest.contentProtection = this.manifest.contentProtection || {}; - this.manifest.contentProtection['com.widevine.alpha'] = { - attributes: { - schemeIdUri: entry.attributes.KEYFORMAT, - // remove '0x' from the key id string - keyId: entry.attributes.KEYID.substring(2) - }, - // decode the base64-encoded PSSH box - pssh: decodeB64ToUint8Array(entry.attributes.URI.split(',')[1]) - }; - return; - } - - if (!entry.attributes.METHOD) { - this.trigger('warn', { - message: 'defaulting key method to AES-128' - }); - } // setup an encryption key for upcoming segments - - - _key = { - method: entry.attributes.METHOD || 'AES-128', - uri: entry.attributes.URI - }; - - if (typeof entry.attributes.IV !== 'undefined') { - _key.iv = entry.attributes.IV; - } - }, - 'media-sequence': function mediaSequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid media sequence: ' + entry.number - }); - return; - } - - this.manifest.mediaSequence = entry.number; - }, - 'discontinuity-sequence': function discontinuitySequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid discontinuity sequence: ' + entry.number - }); - return; - } - - this.manifest.discontinuitySequence = entry.number; - currentTimeline = entry.number; - }, - 'playlist-type': function playlistType() { - if (!/VOD|EVENT/.test(entry.playlistType)) { - this.trigger('warn', { - message: 'ignoring unknown playlist type: ' + entry.playlist - }); - return; - } - - this.manifest.playlistType = entry.playlistType; - }, - map: function map() { - currentMap = {}; - - if (entry.uri) { - currentMap.uri = entry.uri; - } - - if (entry.byterange) { - currentMap.byterange = entry.byterange; - } - - if (_key) { - currentMap.key = _key; - } - }, - 'stream-inf': function streamInf() { - this.manifest.playlists = uris; - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring empty stream-inf attributes' - }); - return; - } - - if (!currentUri.attributes) { - currentUri.attributes = {}; - } - - _extends_1(currentUri.attributes, entry.attributes); - }, - media: function media() { - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!(entry.attributes && entry.attributes.TYPE && entry.attributes['GROUP-ID'] && entry.attributes.NAME)) { - this.trigger('warn', { - message: 'ignoring incomplete or missing media group' - }); - return; - } // find the media group, creating defaults as necessary - - - var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE]; - mediaGroupType[entry.attributes['GROUP-ID']] = mediaGroupType[entry.attributes['GROUP-ID']] || {}; - mediaGroup = mediaGroupType[entry.attributes['GROUP-ID']]; // collect the rendition metadata - - rendition = { - default: /yes/i.test(entry.attributes.DEFAULT) - }; - - if (rendition.default) { - rendition.autoselect = true; - } else { - rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT); - } - - if (entry.attributes.LANGUAGE) { - rendition.language = entry.attributes.LANGUAGE; - } - - if (entry.attributes.URI) { - rendition.uri = entry.attributes.URI; - } - - if (entry.attributes['INSTREAM-ID']) { - rendition.instreamId = entry.attributes['INSTREAM-ID']; - } - - if (entry.attributes.CHARACTERISTICS) { - rendition.characteristics = entry.attributes.CHARACTERISTICS; - } - - if (entry.attributes.FORCED) { - rendition.forced = /yes/i.test(entry.attributes.FORCED); - } // insert the new rendition - - - mediaGroup[entry.attributes.NAME] = rendition; - }, - discontinuity: function discontinuity() { - currentTimeline += 1; - currentUri.discontinuity = true; - this.manifest.discontinuityStarts.push(uris.length); - }, - 'program-date-time': function programDateTime() { - if (typeof this.manifest.dateTimeString === 'undefined') { - // PROGRAM-DATE-TIME is a media-segment tag, but for backwards - // compatibility, we add the first occurence of the PROGRAM-DATE-TIME tag - // to the manifest object - // TODO: Consider removing this in future major version - this.manifest.dateTimeString = entry.dateTimeString; - this.manifest.dateTimeObject = entry.dateTimeObject; - } - - currentUri.dateTimeString = entry.dateTimeString; - currentUri.dateTimeObject = entry.dateTimeObject; - }, - targetduration: function targetduration() { - if (!isFinite(entry.duration) || entry.duration < 0) { - this.trigger('warn', { - message: 'ignoring invalid target duration: ' + entry.duration - }); - return; - } - - this.manifest.targetDuration = entry.duration; - setHoldBack.call(this, this.manifest); - }, - start: function start() { - if (!entry.attributes || isNaN(entry.attributes['TIME-OFFSET'])) { - this.trigger('warn', { - message: 'ignoring start declaration without appropriate attribute list' - }); - return; - } - - this.manifest.start = { - timeOffset: entry.attributes['TIME-OFFSET'], - precise: entry.attributes.PRECISE - }; - }, - 'cue-out': function cueOut() { - currentUri.cueOut = entry.data; - }, - 'cue-out-cont': function cueOutCont() { - currentUri.cueOutCont = entry.data; - }, - 'cue-in': function cueIn() { - currentUri.cueIn = entry.data; - }, - 'skip': function skip() { - this.manifest.skip = camelCaseKeys(entry.attributes); - this.warnOnMissingAttributes_('#EXT-X-SKIP', entry.attributes, ['SKIPPED-SEGMENTS']); - }, - 'part': function part() { - var _this2 = this; - - hasParts = true; // parts are always specifed before a segment - - var segmentIndex = this.manifest.segments.length; - var part = camelCaseKeys(entry.attributes); - currentUri.parts = currentUri.parts || []; - currentUri.parts.push(part); - - if (part.byterange) { - if (!part.byterange.hasOwnProperty('offset')) { - part.byterange.offset = lastPartByterangeEnd; - } - - lastPartByterangeEnd = part.byterange.offset + part.byterange.length; - } - - var partIndex = currentUri.parts.length - 1; - this.warnOnMissingAttributes_("#EXT-X-PART #" + partIndex + " for segment #" + segmentIndex, entry.attributes, ['URI', 'DURATION']); - - if (this.manifest.renditionReports) { - this.manifest.renditionReports.forEach(function (r, i) { - if (!r.hasOwnProperty('lastPart')) { - _this2.trigger('warn', { - message: "#EXT-X-RENDITION-REPORT #" + i + " lacks required attribute(s): LAST-PART" - }); - } - }); - } - }, - 'server-control': function serverControl() { - var attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes); - - if (!attrs.hasOwnProperty('canBlockReload')) { - attrs.canBlockReload = false; - this.trigger('info', { - message: '#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false' - }); - } - - setHoldBack.call(this, this.manifest); - - if (attrs.canSkipDateranges && !attrs.hasOwnProperty('canSkipUntil')) { - this.trigger('warn', { - message: '#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set' - }); - } - }, - 'preload-hint': function preloadHint() { - // parts are always specifed before a segment - var segmentIndex = this.manifest.segments.length; - var hint = camelCaseKeys(entry.attributes); - var isPart = hint.type && hint.type === 'PART'; - currentUri.preloadHints = currentUri.preloadHints || []; - currentUri.preloadHints.push(hint); - - if (hint.byterange) { - if (!hint.byterange.hasOwnProperty('offset')) { - // use last part byterange end or zero if not a part. - hint.byterange.offset = isPart ? lastPartByterangeEnd : 0; - - if (isPart) { - lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length; - } - } - } - - var index = currentUri.preloadHints.length - 1; - this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #" + index + " for segment #" + segmentIndex, entry.attributes, ['TYPE', 'URI']); - - if (!hint.type) { - return; - } // search through all preload hints except for the current one for - // a duplicate type. - - - for (var i = 0; i < currentUri.preloadHints.length - 1; i++) { - var otherHint = currentUri.preloadHints[i]; - - if (!otherHint.type) { - continue; - } - - if (otherHint.type === hint.type) { - this.trigger('warn', { - message: "#EXT-X-PRELOAD-HINT #" + index + " for segment #" + segmentIndex + " has the same TYPE " + hint.type + " as preload hint #" + i - }); - } - } - }, - 'rendition-report': function renditionReport() { - var report = camelCaseKeys(entry.attributes); - this.manifest.renditionReports = this.manifest.renditionReports || []; - this.manifest.renditionReports.push(report); - var index = this.manifest.renditionReports.length - 1; - var required = ['LAST-MSN', 'URI']; - - if (hasParts) { - required.push('LAST-PART'); - } - - this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #" + index, entry.attributes, required); - }, - 'part-inf': function partInf() { - this.manifest.partInf = camelCaseKeys(entry.attributes); - this.warnOnMissingAttributes_('#EXT-X-PART-INF', entry.attributes, ['PART-TARGET']); - - if (this.manifest.partInf.partTarget) { - this.manifest.partTargetDuration = this.manifest.partInf.partTarget; - } - - setHoldBack.call(this, this.manifest); - } - })[entry.tagType] || noop).call(self); - }, - uri: function uri() { - currentUri.uri = entry.uri; - uris.push(currentUri); // if no explicit duration was declared, use the target duration - - if (this.manifest.targetDuration && !('duration' in currentUri)) { - this.trigger('warn', { - message: 'defaulting segment duration to the target duration' - }); - currentUri.duration = this.manifest.targetDuration; - } // annotate with encryption information, if necessary - - - if (_key) { - currentUri.key = _key; - } - - currentUri.timeline = currentTimeline; // annotate with initialization segment information, if necessary - - if (currentMap) { - currentUri.map = currentMap; - } // reset the last byterange end as it needs to be 0 between parts - - - lastPartByterangeEnd = 0; // prepare for the next URI - - currentUri = {}; - }, - comment: function comment() {// comments are not important for playback - }, - custom: function custom() { - // if this is segment-level data attach the output to the segment - if (entry.segment) { - currentUri.custom = currentUri.custom || {}; - currentUri.custom[entry.customType] = entry.data; // if this is manifest-level data attach to the top level manifest object - } else { - this.manifest.custom = this.manifest.custom || {}; - this.manifest.custom[entry.customType] = entry.data; - } - } - })[entry.type].call(self); - }); - - return _this; - } - - var _proto = Parser.prototype; - - _proto.warnOnMissingAttributes_ = function warnOnMissingAttributes_(identifier, attributes, required) { - var missing = []; - required.forEach(function (key) { - if (!attributes.hasOwnProperty(key)) { - missing.push(key); - } - }); - - if (missing.length) { - this.trigger('warn', { - message: identifier + " lacks required attribute(s): " + missing.join(', ') - }); - } - } - /** - * Parse the input string and update the manifest object. - * - * @param {string} chunk a potentially incomplete portion of the manifest - */ - ; - - _proto.push = function push(chunk) { - this.lineStream.push(chunk); - } - /** - * Flush any remaining input. This can be handy if the last line of an M3U8 - * manifest did not contain a trailing newline but the file has been - * completely received. - */ - ; - - _proto.end = function end() { - // flush any buffered input - this.lineStream.push('\n'); - this.trigger('end'); - } - /** - * Add an additional parser for non-standard tags - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.type the type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - ; - - _proto.addParser = function addParser(options) { - this.parseStream.addParser(options); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - ; - - _proto.addTagMapper = function addTagMapper(options) { - this.parseStream.addTagMapper(options); - }; - - return Parser; - }(Stream); - - var regexs = { - // to determine mime types - mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/, - webm: /^(vp0?[89]|av0?1|opus|vorbis)/, - ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/, - // to determine if a codec is audio or video - video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/, - audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/, - text: /^(stpp.ttml.im1t)/, - // mux.js support regex - muxerVideo: /^(avc0?1)/, - muxerAudio: /^(mp4a)/, - // match nothing as muxer does not support text right now. - // there cannot never be a character before the start of a string - // so this matches nothing. - muxerText: /a^/ - }; - var mediaTypes = ['video', 'audio', 'text']; - var upperMediaTypes = ['Video', 'Audio', 'Text']; - /** - * Replace the old apple-style `avc1.
.
` codec string with the standard - * `avc1.` - * - * @param {string} codec - * Codec string to translate - * @return {string} - * The translated codec string - */ - - var translateLegacyCodec = function translateLegacyCodec(codec) { - if (!codec) { - return codec; - } - - return codec.replace(/avc1\.(\d+)\.(\d+)/i, function (orig, profile, avcLevel) { - var profileHex = ('00' + Number(profile).toString(16)).slice(-2); - var avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2); - return 'avc1.' + profileHex + '00' + avcLevelHex; - }); - }; - /** - * @typedef {Object} ParsedCodecInfo - * @property {number} codecCount - * Number of codecs parsed - * @property {string} [videoCodec] - * Parsed video codec (if found) - * @property {string} [videoObjectTypeIndicator] - * Video object type indicator (if found) - * @property {string|null} audioProfile - * Audio profile - */ - - /** - * Parses a codec string to retrieve the number of codecs specified, the video codec and - * object type indicator, and the audio profile. - * - * @param {string} [codecString] - * The codec string to parse - * @return {ParsedCodecInfo} - * Parsed codec info - */ - - var parseCodecs = function parseCodecs(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - var codecs = codecString.split(','); - var result = []; - codecs.forEach(function (codec) { - codec = codec.trim(); - var codecType; - mediaTypes.forEach(function (name) { - var match = regexs[name].exec(codec.toLowerCase()); - - if (!match || match.length <= 1) { - return; - } - - codecType = name; // maintain codec case - - var type = codec.substring(0, match[1].length); - var details = codec.replace(type, ''); - result.push({ - type: type, - details: details, - mediaType: name - }); - }); - - if (!codecType) { - result.push({ - type: codec, - details: '', - mediaType: 'unknown' - }); - } - }); - return result; - }; - /** - * Returns a ParsedCodecInfo object for the default alternate audio playlist if there is - * a default alternate audio playlist for the provided audio group. - * - * @param {Object} master - * The master playlist - * @param {string} audioGroupId - * ID of the audio group for which to find the default codec info - * @return {ParsedCodecInfo} - * Parsed codec info - */ - - var codecsFromDefault = function codecsFromDefault(master, audioGroupId) { - if (!master.mediaGroups.AUDIO || !audioGroupId) { - return null; - } - - var audioGroup = master.mediaGroups.AUDIO[audioGroupId]; - - if (!audioGroup) { - return null; - } - - for (var name in audioGroup) { - var audioType = audioGroup[name]; - - if (audioType.default && audioType.playlists) { - // codec should be the same for all playlists within the audio type - return parseCodecs(audioType.playlists[0].attributes.CODECS); - } - } - - return null; - }; - var isAudioCodec = function isAudioCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.audio.test(codec.trim().toLowerCase()); - }; - var isTextCodec = function isTextCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.text.test(codec.trim().toLowerCase()); - }; - var getMimeForCodec = function getMimeForCodec(codecString) { - if (!codecString || typeof codecString !== 'string') { - return; - } - - var codecs = codecString.toLowerCase().split(',').map(function (c) { - return translateLegacyCodec(c.trim()); - }); // default to video type - - var type = 'video'; // only change to audio type if the only codec we have is - // audio - - if (codecs.length === 1 && isAudioCodec(codecs[0])) { - type = 'audio'; - } else if (codecs.length === 1 && isTextCodec(codecs[0])) { - // text uses application/ for now - type = 'application'; - } // default the container to mp4 - - - var container = 'mp4'; // every codec must be able to go into the container - // for that container to be the correct one - - if (codecs.every(function (c) { - return regexs.mp4.test(c); - })) { - container = 'mp4'; - } else if (codecs.every(function (c) { - return regexs.webm.test(c); - })) { - container = 'webm'; - } else if (codecs.every(function (c) { - return regexs.ogg.test(c); - })) { - container = 'ogg'; - } - - return type + "/" + container + ";codecs=\"" + codecString + "\""; - }; - var browserSupportsCodec = function browserSupportsCodec(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - return window__default['default'].MediaSource && window__default['default'].MediaSource.isTypeSupported && window__default['default'].MediaSource.isTypeSupported(getMimeForCodec(codecString)) || false; - }; - var muxerSupportsCodec = function muxerSupportsCodec(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - return codecString.toLowerCase().split(',').every(function (codec) { - codec = codec.trim(); // any match is supported. - - for (var i = 0; i < upperMediaTypes.length; i++) { - var type = upperMediaTypes[i]; - - if (regexs["muxer" + type].test(codec)) { - return true; - } - } - - return false; - }); - }; - var DEFAULT_AUDIO_CODEC = 'mp4a.40.2'; - var DEFAULT_VIDEO_CODEC = 'avc1.4d400d'; - - /** - * ranges - * - * Utilities for working with TimeRanges. - * - */ - - var TIME_FUDGE_FACTOR = 1 / 30; // Comparisons between time values such as current time and the end of the buffered range - // can be misleading because of precision differences or when the current media has poorly - // aligned audio and video, which can cause values to be slightly off from what you would - // expect. This value is what we consider to be safe to use in such comparisons to account - // for these scenarios. - - var SAFE_TIME_DELTA = TIME_FUDGE_FACTOR * 3; - - var filterRanges = function filterRanges(timeRanges, predicate) { - var results = []; - var i; - - if (timeRanges && timeRanges.length) { - // Search for ranges that match the predicate - for (i = 0; i < timeRanges.length; i++) { - if (predicate(timeRanges.start(i), timeRanges.end(i))) { - results.push([timeRanges.start(i), timeRanges.end(i)]); - } - } - } - - return videojs__default['default'].createTimeRanges(results); - }; - /** - * Attempts to find the buffered TimeRange that contains the specified - * time. - * - * @param {TimeRanges} buffered - the TimeRanges object to query - * @param {number} time - the time to filter on. - * @return {TimeRanges} a new TimeRanges object - */ - - - var findRange = function findRange(buffered, time) { - return filterRanges(buffered, function (start, end) { - return start - SAFE_TIME_DELTA <= time && end + SAFE_TIME_DELTA >= time; - }); - }; - /** - * Returns the TimeRanges that begin later than the specified time. - * - * @param {TimeRanges} timeRanges - the TimeRanges object to query - * @param {number} time - the time to filter on. - * @return {TimeRanges} a new TimeRanges object. - */ - - var findNextRange = function findNextRange(timeRanges, time) { - return filterRanges(timeRanges, function (start) { - return start - TIME_FUDGE_FACTOR >= time; - }); - }; - /** - * Returns gaps within a list of TimeRanges - * - * @param {TimeRanges} buffered - the TimeRanges object - * @return {TimeRanges} a TimeRanges object of gaps - */ - - var findGaps = function findGaps(buffered) { - if (buffered.length < 2) { - return videojs__default['default'].createTimeRanges(); - } - - var ranges = []; - - for (var i = 1; i < buffered.length; i++) { - var start = buffered.end(i - 1); - var end = buffered.start(i); - ranges.push([start, end]); - } - - return videojs__default['default'].createTimeRanges(ranges); - }; - /** - * Calculate the intersection of two TimeRanges - * - * @param {TimeRanges} bufferA - * @param {TimeRanges} bufferB - * @return {TimeRanges} The interesection of `bufferA` with `bufferB` - */ - - var bufferIntersection = function bufferIntersection(bufferA, bufferB) { - var start = null; - var end = null; - var arity = 0; - var extents = []; - var ranges = []; - - if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) { - return videojs__default['default'].createTimeRange(); - } // Handle the case where we have both buffers and create an - // intersection of the two - - - var count = bufferA.length; // A) Gather up all start and end times - - while (count--) { - extents.push({ - time: bufferA.start(count), - type: 'start' - }); - extents.push({ - time: bufferA.end(count), - type: 'end' - }); - } - - count = bufferB.length; - - while (count--) { - extents.push({ - time: bufferB.start(count), - type: 'start' - }); - extents.push({ - time: bufferB.end(count), - type: 'end' - }); - } // B) Sort them by time - - - extents.sort(function (a, b) { - return a.time - b.time; - }); // C) Go along one by one incrementing arity for start and decrementing - // arity for ends - - for (count = 0; count < extents.length; count++) { - if (extents[count].type === 'start') { - arity++; // D) If arity is ever incremented to 2 we are entering an - // overlapping range - - if (arity === 2) { - start = extents[count].time; - } - } else if (extents[count].type === 'end') { - arity--; // E) If arity is ever decremented to 1 we leaving an - // overlapping range - - if (arity === 1) { - end = extents[count].time; - } - } // F) Record overlapping ranges - - - if (start !== null && end !== null) { - ranges.push([start, end]); - start = null; - end = null; - } - } - - return videojs__default['default'].createTimeRanges(ranges); - }; - /** - * Gets a human readable string for a TimeRange - * - * @param {TimeRange} range - * @return {string} a human readable string - */ - - var printableRange = function printableRange(range) { - var strArr = []; - - if (!range || !range.length) { - return ''; - } - - for (var i = 0; i < range.length; i++) { - strArr.push(range.start(i) + ' => ' + range.end(i)); - } - - return strArr.join(', '); - }; - /** - * Calculates the amount of time left in seconds until the player hits the end of the - * buffer and causes a rebuffer - * - * @param {TimeRange} buffered - * The state of the buffer - * @param {Numnber} currentTime - * The current time of the player - * @param {number} playbackRate - * The current playback rate of the player. Defaults to 1. - * @return {number} - * Time until the player has to start rebuffering in seconds. - * @function timeUntilRebuffer - */ - - var timeUntilRebuffer = function timeUntilRebuffer(buffered, currentTime, playbackRate) { - if (playbackRate === void 0) { - playbackRate = 1; - } - - var bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0; - return (bufferedEnd - currentTime) / playbackRate; - }; - /** - * Converts a TimeRanges object into an array representation - * - * @param {TimeRanges} timeRanges - * @return {Array} - */ - - var timeRangesToArray = function timeRangesToArray(timeRanges) { - var timeRangesList = []; - - for (var i = 0; i < timeRanges.length; i++) { - timeRangesList.push({ - start: timeRanges.start(i), - end: timeRanges.end(i) - }); - } - - return timeRangesList; - }; - /** - * Determines if two time range objects are different. - * - * @param {TimeRange} a - * the first time range object to check - * - * @param {TimeRange} b - * the second time range object to check - * - * @return {Boolean} - * Whether the time range objects differ - */ - - var isRangeDifferent = function isRangeDifferent(a, b) { - // same object - if (a === b) { - return false; - } // one or the other is undefined - - - if (!a && b || !b && a) { - return true; - } // length is different - - - if (a.length !== b.length) { - return true; - } // see if any start/end pair is different - - - for (var i = 0; i < a.length; i++) { - if (a.start(i) !== b.start(i) || a.end(i) !== b.end(i)) { - return true; - } - } // if the length and every pair is the same - // this is the same time range - - - return false; - }; - var lastBufferedEnd = function lastBufferedEnd(a) { - if (!a || !a.length || !a.end) { - return; - } - - return a.end(a.length - 1); - }; - - /** - * @file playlist.js - * - * Playlist related utilities. - */ - var createTimeRange = videojs__default['default'].createTimeRange; - /** - * A function to get a combined list of parts and segments with durations - * and indexes. - * - * @param {Playlist} playlist the playlist to get the list for. - * - * @return {Array} The part/segment list. - */ - - var getPartsAndSegments = function getPartsAndSegments(playlist) { - return (playlist.segments || []).reduce(function (acc, segment, si) { - if (segment.parts) { - segment.parts.forEach(function (part, pi) { - acc.push({ - duration: part.duration, - segmentIndex: si, - partIndex: pi, - part: part, - segment: segment - }); - }); - } else { - acc.push({ - duration: segment.duration, - segmentIndex: si, - partIndex: null, - segment: segment, - part: null - }); - } - - return acc; - }, []); - }; - var getLastParts = function getLastParts(media) { - var lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1]; - return lastSegment && lastSegment.parts || []; - }; - var getKnownPartCount = function getKnownPartCount(_ref) { - var preloadSegment = _ref.preloadSegment; - - if (!preloadSegment) { - return; - } - - var parts = preloadSegment.parts, - preloadHints = preloadSegment.preloadHints; - var partCount = (preloadHints || []).reduce(function (count, hint) { - return count + (hint.type === 'PART' ? 1 : 0); - }, 0); - partCount += parts && parts.length ? parts.length : 0; - return partCount; - }; - /** - * Get the number of seconds to delay from the end of a - * live playlist. - * - * @param {Playlist} master the master playlist - * @param {Playlist} media the media playlist - * @return {number} the hold back in seconds. - */ - - var liveEdgeDelay = function liveEdgeDelay(master, media) { - if (media.endList) { - return 0; - } // dash suggestedPresentationDelay trumps everything - - - if (master && master.suggestedPresentationDelay) { - return master.suggestedPresentationDelay; - } - - var hasParts = getLastParts(media).length > 0; // look for "part" delays from ll-hls first - - if (hasParts && media.serverControl && media.serverControl.partHoldBack) { - return media.serverControl.partHoldBack; - } else if (hasParts && media.partTargetDuration) { - return media.partTargetDuration * 3; // finally look for full segment delays - } else if (media.serverControl && media.serverControl.holdBack) { - return media.serverControl.holdBack; - } else if (media.targetDuration) { - return media.targetDuration * 3; - } - - return 0; - }; - /** - * walk backward until we find a duration we can use - * or return a failure - * - * @param {Playlist} playlist the playlist to walk through - * @param {Number} endSequence the mediaSequence to stop walking on - */ - - var backwardDuration = function backwardDuration(playlist, endSequence) { - var result = 0; - var i = endSequence - playlist.mediaSequence; // if a start time is available for segment immediately following - // the interval, use it - - var segment = playlist.segments[i]; // Walk backward until we find the latest segment with timeline - // information that is earlier than endSequence - - if (segment) { - if (typeof segment.start !== 'undefined') { - return { - result: segment.start, - precise: true - }; - } - - if (typeof segment.end !== 'undefined') { - return { - result: segment.end - segment.duration, - precise: true - }; - } - } - - while (i--) { - segment = playlist.segments[i]; - - if (typeof segment.end !== 'undefined') { - return { - result: result + segment.end, - precise: true - }; - } - - result += segment.duration; - - if (typeof segment.start !== 'undefined') { - return { - result: result + segment.start, - precise: true - }; - } - } - - return { - result: result, - precise: false - }; - }; - /** - * walk forward until we find a duration we can use - * or return a failure - * - * @param {Playlist} playlist the playlist to walk through - * @param {number} endSequence the mediaSequence to stop walking on - */ - - - var forwardDuration = function forwardDuration(playlist, endSequence) { - var result = 0; - var segment; - var i = endSequence - playlist.mediaSequence; // Walk forward until we find the earliest segment with timeline - // information - - for (; i < playlist.segments.length; i++) { - segment = playlist.segments[i]; - - if (typeof segment.start !== 'undefined') { - return { - result: segment.start - result, - precise: true - }; - } - - result += segment.duration; - - if (typeof segment.end !== 'undefined') { - return { - result: segment.end - result, - precise: true - }; - } - } // indicate we didn't find a useful duration estimate - - - return { - result: -1, - precise: false - }; - }; - /** - * Calculate the media duration from the segments associated with a - * playlist. The duration of a subinterval of the available segments - * may be calculated by specifying an end index. - * - * @param {Object} playlist a media playlist object - * @param {number=} endSequence an exclusive upper boundary - * for the playlist. Defaults to playlist length. - * @param {number} expired the amount of time that has dropped - * off the front of the playlist in a live scenario - * @return {number} the duration between the first available segment - * and end index. - */ - - - var intervalDuration = function intervalDuration(playlist, endSequence, expired) { - if (typeof endSequence === 'undefined') { - endSequence = playlist.mediaSequence + playlist.segments.length; - } - - if (endSequence < playlist.mediaSequence) { - return 0; - } // do a backward walk to estimate the duration - - - var backward = backwardDuration(playlist, endSequence); - - if (backward.precise) { - // if we were able to base our duration estimate on timing - // information provided directly from the Media Source, return - // it - return backward.result; - } // walk forward to see if a precise duration estimate can be made - // that way - - - var forward = forwardDuration(playlist, endSequence); - - if (forward.precise) { - // we found a segment that has been buffered and so it's - // position is known precisely - return forward.result; - } // return the less-precise, playlist-based duration estimate - - - return backward.result + expired; - }; - /** - * Calculates the duration of a playlist. If a start and end index - * are specified, the duration will be for the subset of the media - * timeline between those two indices. The total duration for live - * playlists is always Infinity. - * - * @param {Object} playlist a media playlist object - * @param {number=} endSequence an exclusive upper - * boundary for the playlist. Defaults to the playlist media - * sequence number plus its length. - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @return {number} the duration between the start index and end - * index. - */ - - - var duration = function duration(playlist, endSequence, expired) { - if (!playlist) { - return 0; - } - - if (typeof expired !== 'number') { - expired = 0; - } // if a slice of the total duration is not requested, use - // playlist-level duration indicators when they're present - - - if (typeof endSequence === 'undefined') { - // if present, use the duration specified in the playlist - if (playlist.totalDuration) { - return playlist.totalDuration; - } // duration should be Infinity for live playlists - - - if (!playlist.endList) { - return window__default['default'].Infinity; - } - } // calculate the total duration based on the segment durations - - - return intervalDuration(playlist, endSequence, expired); - }; - /** - * Calculate the time between two indexes in the current playlist - * neight the start- nor the end-index need to be within the current - * playlist in which case, the targetDuration of the playlist is used - * to approximate the durations of the segments - * - * @param {Array} options.durationList list to iterate over for durations. - * @param {number} options.defaultDuration duration to use for elements before or after the durationList - * @param {number} options.startIndex partsAndSegments index to start - * @param {number} options.endIndex partsAndSegments index to end. - * @return {number} the number of seconds between startIndex and endIndex - */ - - var sumDurations = function sumDurations(_ref2) { - var defaultDuration = _ref2.defaultDuration, - durationList = _ref2.durationList, - startIndex = _ref2.startIndex, - endIndex = _ref2.endIndex; - var durations = 0; - - if (startIndex > endIndex) { - var _ref3 = [endIndex, startIndex]; - startIndex = _ref3[0]; - endIndex = _ref3[1]; - } - - if (startIndex < 0) { - for (var i = startIndex; i < Math.min(0, endIndex); i++) { - durations += defaultDuration; - } - - startIndex = 0; - } - - for (var _i = startIndex; _i < endIndex; _i++) { - durations += durationList[_i].duration; - } - - return durations; - }; - /** - * Calculates the playlist end time - * - * @param {Object} playlist a media playlist object - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @param {boolean|false} useSafeLiveEnd a boolean value indicating whether or not the - * playlist end calculation should consider the safe live end - * (truncate the playlist end by three segments). This is normally - * used for calculating the end of the playlist's seekable range. - * This takes into account the value of liveEdgePadding. - * Setting liveEdgePadding to 0 is equivalent to setting this to false. - * @param {number} liveEdgePadding a number indicating how far from the end of the playlist we should be in seconds. - * If this is provided, it is used in the safe live end calculation. - * Setting useSafeLiveEnd=false or liveEdgePadding=0 are equivalent. - * Corresponds to suggestedPresentationDelay in DASH manifests. - * @return {number} the end time of playlist - * @function playlistEnd - */ - - var playlistEnd = function playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding) { - if (!playlist || !playlist.segments) { - return null; - } - - if (playlist.endList) { - return duration(playlist); - } - - if (expired === null) { - return null; - } - - expired = expired || 0; - var lastSegmentTime = intervalDuration(playlist, playlist.mediaSequence + playlist.segments.length, expired); - - if (useSafeLiveEnd) { - liveEdgePadding = typeof liveEdgePadding === 'number' ? liveEdgePadding : liveEdgeDelay(null, playlist); - lastSegmentTime -= liveEdgePadding; - } // don't return a time less than zero - - - return Math.max(0, lastSegmentTime); - }; - /** - * Calculates the interval of time that is currently seekable in a - * playlist. The returned time ranges are relative to the earliest - * moment in the specified playlist that is still available. A full - * seekable implementation for live streams would need to offset - * these values by the duration of content that has expired from the - * stream. - * - * @param {Object} playlist a media playlist object - * dropped off the front of the playlist in a live scenario - * @param {number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @param {number} liveEdgePadding how far from the end of the playlist we should be in seconds. - * Corresponds to suggestedPresentationDelay in DASH manifests. - * @return {TimeRanges} the periods of time that are valid targets - * for seeking - */ - - var seekable = function seekable(playlist, expired, liveEdgePadding) { - var useSafeLiveEnd = true; - var seekableStart = expired || 0; - var seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); - - if (seekableEnd === null) { - return createTimeRange(); - } - - return createTimeRange(seekableStart, seekableEnd); - }; - /** - * Determine the index and estimated starting time of the segment that - * contains a specified playback position in a media playlist. - * - * @param {Object} options.playlist the media playlist to query - * @param {number} options.currentTime The number of seconds since the earliest - * possible position to determine the containing segment for - * @param {number} options.startTime the time when the segment/part starts - * @param {number} options.startingSegmentIndex the segment index to start looking at. - * @param {number?} [options.startingPartIndex] the part index to look at within the segment. - * - * @return {Object} an object with partIndex, segmentIndex, and startTime. - */ - - var getMediaInfoForTime = function getMediaInfoForTime(_ref4) { - var playlist = _ref4.playlist, - currentTime = _ref4.currentTime, - startingSegmentIndex = _ref4.startingSegmentIndex, - startingPartIndex = _ref4.startingPartIndex, - startTime = _ref4.startTime; - var time = currentTime - startTime; - var partsAndSegments = getPartsAndSegments(playlist); - var startIndex = 0; - - for (var i = 0; i < partsAndSegments.length; i++) { - var partAndSegment = partsAndSegments[i]; - - if (startingSegmentIndex !== partAndSegment.segmentIndex) { - continue; - } // skip this if part index does not match. - - - if (typeof startingPartIndex === 'number' && typeof partAndSegment.partIndex === 'number' && startingPartIndex !== partAndSegment.partIndex) { - continue; - } - - startIndex = i; - break; - } - - if (time < 0) { - // Walk backward from startIndex in the playlist, adding durations - // until we find a segment that contains `time` and return it - if (startIndex > 0) { - for (var _i2 = startIndex - 1; _i2 >= 0; _i2--) { - var _partAndSegment = partsAndSegments[_i2]; - time += _partAndSegment.duration; // TODO: consider not using TIME_FUDGE_FACTOR at all here - - if (time + TIME_FUDGE_FACTOR > 0) { - return { - partIndex: _partAndSegment.partIndex, - segmentIndex: _partAndSegment.segmentIndex, - startTime: startTime - sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: partsAndSegments, - startIndex: startIndex, - endIndex: _i2 - }) - }; - } - } - } // We were unable to find a good segment within the playlist - // so select the first segment - - - return { - partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null, - segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0, - startTime: currentTime - }; - } // When startIndex is negative, we first walk forward to first segment - // adding target durations. If we "run out of time" before getting to - // the first segment, return the first segment - - - if (startIndex < 0) { - for (var _i3 = startIndex; _i3 < 0; _i3++) { - time -= playlist.targetDuration; - - if (time < 0) { - return { - partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null, - segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0, - startTime: currentTime - }; - } - } - - startIndex = 0; - } // Walk forward from startIndex in the playlist, subtracting durations - // until we find a segment that contains `time` and return it - - - for (var _i4 = startIndex; _i4 < partsAndSegments.length; _i4++) { - var _partAndSegment2 = partsAndSegments[_i4]; - time -= _partAndSegment2.duration; // TODO: consider not using TIME_FUDGE_FACTOR at all here - - if (time - TIME_FUDGE_FACTOR < 0) { - return { - partIndex: _partAndSegment2.partIndex, - segmentIndex: _partAndSegment2.segmentIndex, - startTime: startTime + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: partsAndSegments, - startIndex: startIndex, - endIndex: _i4 - }) - }; - } - } // We are out of possible candidates so load the last one... - - - return { - segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex, - partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex, - startTime: currentTime - }; - }; - /** - * Check whether the playlist is blacklisted or not. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is blacklisted or not - * @function isBlacklisted - */ - - var isBlacklisted = function isBlacklisted(playlist) { - return playlist.excludeUntil && playlist.excludeUntil > Date.now(); - }; - /** - * Check whether the playlist is compatible with current playback configuration or has - * been blacklisted permanently for being incompatible. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is incompatible or not - * @function isIncompatible - */ - - var isIncompatible = function isIncompatible(playlist) { - return playlist.excludeUntil && playlist.excludeUntil === Infinity; - }; - /** - * Check whether the playlist is enabled or not. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is enabled or not - * @function isEnabled - */ - - var isEnabled = function isEnabled(playlist) { - var blacklisted = isBlacklisted(playlist); - return !playlist.disabled && !blacklisted; - }; - /** - * Check whether the playlist has been manually disabled through the representations api. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is disabled manually or not - * @function isDisabled - */ - - var isDisabled = function isDisabled(playlist) { - return playlist.disabled; - }; - /** - * Returns whether the current playlist is an AES encrypted HLS stream - * - * @return {boolean} true if it's an AES encrypted HLS stream - */ - - var isAes = function isAes(media) { - for (var i = 0; i < media.segments.length; i++) { - if (media.segments[i].key) { - return true; - } - } - - return false; - }; - /** - * Checks if the playlist has a value for the specified attribute - * - * @param {string} attr - * Attribute to check for - * @param {Object} playlist - * The media playlist object - * @return {boolean} - * Whether the playlist contains a value for the attribute or not - * @function hasAttribute - */ - - var hasAttribute = function hasAttribute(attr, playlist) { - return playlist.attributes && playlist.attributes[attr]; - }; - /** - * Estimates the time required to complete a segment download from the specified playlist - * - * @param {number} segmentDuration - * Duration of requested segment - * @param {number} bandwidth - * Current measured bandwidth of the player - * @param {Object} playlist - * The media playlist object - * @param {number=} bytesReceived - * Number of bytes already received for the request. Defaults to 0 - * @return {number|NaN} - * The estimated time to request the segment. NaN if bandwidth information for - * the given playlist is unavailable - * @function estimateSegmentRequestTime - */ - - var estimateSegmentRequestTime = function estimateSegmentRequestTime(segmentDuration, bandwidth, playlist, bytesReceived) { - if (bytesReceived === void 0) { - bytesReceived = 0; - } - - if (!hasAttribute('BANDWIDTH', playlist)) { - return NaN; - } - - var size = segmentDuration * playlist.attributes.BANDWIDTH; - return (size - bytesReceived * 8) / bandwidth; - }; - /* - * Returns whether the current playlist is the lowest rendition - * - * @return {Boolean} true if on lowest rendition - */ - - var isLowestEnabledRendition = function isLowestEnabledRendition(master, media) { - if (master.playlists.length === 1) { - return true; - } - - var currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE; - return master.playlists.filter(function (playlist) { - if (!isEnabled(playlist)) { - return false; - } - - return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth; - }).length === 0; - }; - var playlistMatch = function playlistMatch(a, b) { - // both playlits are null - // or only one playlist is non-null - // no match - if (!a && !b || !a && b || a && !b) { - return false; - } // playlist objects are the same, match - - - if (a === b) { - return true; - } // first try to use id as it should be the most - // accurate - - - if (a.id && b.id && a.id === b.id) { - return true; - } // next try to use reslovedUri as it should be the - // second most accurate. - - - if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) { - return true; - } // finally try to use uri as it should be accurate - // but might miss a few cases for relative uris - - - if (a.uri && b.uri && a.uri === b.uri) { - return true; - } - - return false; - }; - - var someAudioVariant = function someAudioVariant(master, callback) { - var AUDIO = master && master.mediaGroups && master.mediaGroups.AUDIO || {}; - var found = false; - - for (var groupName in AUDIO) { - for (var label in AUDIO[groupName]) { - found = callback(AUDIO[groupName][label]); - - if (found) { - break; - } - } - - if (found) { - break; - } - } - - return !!found; - }; - - var isAudioOnly = function isAudioOnly(master) { - // we are audio only if we have no main playlists but do - // have media group playlists. - if (!master || !master.playlists || !master.playlists.length) { - // without audio variants or playlists this - // is not an audio only master. - var found = someAudioVariant(master, function (variant) { - return variant.playlists && variant.playlists.length || variant.uri; - }); - return found; - } // if every playlist has only an audio codec it is audio only - - - var _loop = function _loop(i) { - var playlist = master.playlists[i]; - var CODECS = playlist.attributes && playlist.attributes.CODECS; // all codecs are audio, this is an audio playlist. - - if (CODECS && CODECS.split(',').every(function (c) { - return isAudioCodec(c); - })) { - return "continue"; - } // playlist is in an audio group it is audio only - - - var found = someAudioVariant(master, function (variant) { - return playlistMatch(playlist, variant); - }); - - if (found) { - return "continue"; - } // if we make it here this playlist isn't audio and we - // are not audio only - - - return { - v: false - }; - }; - - for (var i = 0; i < master.playlists.length; i++) { - var _ret = _loop(i); - - if (_ret === "continue") continue; - if (typeof _ret === "object") return _ret.v; - } // if we make it past every playlist without returning, then - // this is an audio only playlist. - - - return true; - }; // exports - - var Playlist = { - liveEdgeDelay: liveEdgeDelay, - duration: duration, - seekable: seekable, - getMediaInfoForTime: getMediaInfoForTime, - isEnabled: isEnabled, - isDisabled: isDisabled, - isBlacklisted: isBlacklisted, - isIncompatible: isIncompatible, - playlistEnd: playlistEnd, - isAes: isAes, - hasAttribute: hasAttribute, - estimateSegmentRequestTime: estimateSegmentRequestTime, - isLowestEnabledRendition: isLowestEnabledRendition, - isAudioOnly: isAudioOnly, - playlistMatch: playlistMatch - }; - - var log = videojs__default['default'].log; - var createPlaylistID = function createPlaylistID(index, uri) { - return index + "-" + uri; - }; - /** - * Parses a given m3u8 playlist - * - * @param {Function} [onwarn] - * a function to call when the parser triggers a warning event. - * @param {Function} [oninfo] - * a function to call when the parser triggers an info event. - * @param {string} manifestString - * The downloaded manifest string - * @param {Object[]} [customTagParsers] - * An array of custom tag parsers for the m3u8-parser instance - * @param {Object[]} [customTagMappers] - * An array of custom tag mappers for the m3u8-parser instance - * @param {boolean} [experimentalLLHLS=false] - * Whether to keep ll-hls features in the manifest after parsing. - * @return {Object} - * The manifest object - */ - - var parseManifest = function parseManifest(_ref) { - var onwarn = _ref.onwarn, - oninfo = _ref.oninfo, - manifestString = _ref.manifestString, - _ref$customTagParsers = _ref.customTagParsers, - customTagParsers = _ref$customTagParsers === void 0 ? [] : _ref$customTagParsers, - _ref$customTagMappers = _ref.customTagMappers, - customTagMappers = _ref$customTagMappers === void 0 ? [] : _ref$customTagMappers, - experimentalLLHLS = _ref.experimentalLLHLS; - var parser = new Parser(); - - if (onwarn) { - parser.on('warn', onwarn); - } - - if (oninfo) { - parser.on('info', oninfo); - } - - customTagParsers.forEach(function (customParser) { - return parser.addParser(customParser); - }); - customTagMappers.forEach(function (mapper) { - return parser.addTagMapper(mapper); - }); - parser.push(manifestString); - parser.end(); - var manifest = parser.manifest; // remove llhls features from the parsed manifest - // if we don't want llhls support. - - if (!experimentalLLHLS) { - ['preloadSegment', 'skip', 'serverControl', 'renditionReports', 'partInf', 'partTargetDuration'].forEach(function (k) { - if (manifest.hasOwnProperty(k)) { - delete manifest[k]; - } - }); - - if (manifest.segments) { - manifest.segments.forEach(function (segment) { - ['parts', 'preloadHints'].forEach(function (k) { - if (segment.hasOwnProperty(k)) { - delete segment[k]; - } - }); - }); - } - } - - if (!manifest.targetDuration) { - var targetDuration = 10; - - if (manifest.segments && manifest.segments.length) { - targetDuration = manifest.segments.reduce(function (acc, s) { - return Math.max(acc, s.duration); - }, 0); - } - - if (onwarn) { - onwarn("manifest has no targetDuration defaulting to " + targetDuration); - } - - manifest.targetDuration = targetDuration; - } - - var parts = getLastParts(manifest); - - if (parts.length && !manifest.partTargetDuration) { - var partTargetDuration = parts.reduce(function (acc, p) { - return Math.max(acc, p.duration); - }, 0); - - if (onwarn) { - onwarn("manifest has no partTargetDuration defaulting to " + partTargetDuration); - log.error('LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.'); - } - - manifest.partTargetDuration = partTargetDuration; - } - - return manifest; - }; - /** - * Loops through all supported media groups in master and calls the provided - * callback for each group - * - * @param {Object} master - * The parsed master manifest object - * @param {Function} callback - * Callback to call for each media group - */ - - var forEachMediaGroup = function forEachMediaGroup(master, callback) { - if (!master.mediaGroups) { - return; - } - - ['AUDIO', 'SUBTITLES'].forEach(function (mediaType) { - if (!master.mediaGroups[mediaType]) { - return; - } - - for (var groupKey in master.mediaGroups[mediaType]) { - for (var labelKey in master.mediaGroups[mediaType][groupKey]) { - var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey]; - callback(mediaProperties, mediaType, groupKey, labelKey); - } - } - }); - }; - /** - * Adds properties and attributes to the playlist to keep consistent functionality for - * playlists throughout VHS. - * - * @param {Object} config - * Arguments object - * @param {Object} config.playlist - * The media playlist - * @param {string} [config.uri] - * The uri to the media playlist (if media playlist is not from within a master - * playlist) - * @param {string} id - * ID to use for the playlist - */ - - var setupMediaPlaylist = function setupMediaPlaylist(_ref2) { - var playlist = _ref2.playlist, - uri = _ref2.uri, - id = _ref2.id; - playlist.id = id; - playlist.playlistErrors_ = 0; - - if (uri) { - // For media playlists, m3u8-parser does not have access to a URI, as HLS media - // playlists do not contain their own source URI, but one is needed for consistency in - // VHS. - playlist.uri = uri; - } // For HLS master playlists, even though certain attributes MUST be defined, the - // stream may still be played without them. - // For HLS media playlists, m3u8-parser does not attach an attributes object to the - // manifest. - // - // To avoid undefined reference errors through the project, and make the code easier - // to write/read, add an empty attributes object for these cases. - - - playlist.attributes = playlist.attributes || {}; - }; - /** - * Adds ID, resolvedUri, and attributes properties to each playlist of the master, where - * necessary. In addition, creates playlist IDs for each playlist and adds playlist ID to - * playlist references to the playlists array. - * - * @param {Object} master - * The master playlist - */ - - var setupMediaPlaylists = function setupMediaPlaylists(master) { - var i = master.playlists.length; - - while (i--) { - var playlist = master.playlists[i]; - setupMediaPlaylist({ - playlist: playlist, - id: createPlaylistID(i, playlist.uri) - }); - playlist.resolvedUri = resolveUrl(master.uri, playlist.uri); - master.playlists[playlist.id] = playlist; // URI reference added for backwards compatibility - - master.playlists[playlist.uri] = playlist; // Although the spec states an #EXT-X-STREAM-INF tag MUST have a BANDWIDTH attribute, - // the stream can be played without it. Although an attributes property may have been - // added to the playlist to prevent undefined references, issue a warning to fix the - // manifest. - - if (!playlist.attributes.BANDWIDTH) { - log.warn('Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.'); - } - } - }; - /** - * Adds resolvedUri properties to each media group. - * - * @param {Object} master - * The master playlist - */ - - var resolveMediaGroupUris = function resolveMediaGroupUris(master) { - forEachMediaGroup(master, function (properties) { - if (properties.uri) { - properties.resolvedUri = resolveUrl(master.uri, properties.uri); - } - }); - }; - /** - * Creates a master playlist wrapper to insert a sole media playlist into. - * - * @param {Object} media - * Media playlist - * @param {string} uri - * The media URI - * - * @return {Object} - * Master playlist - */ - - var masterForMedia = function masterForMedia(media, uri) { - var id = createPlaylistID(0, uri); - var master = { - mediaGroups: { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - uri: window__default['default'].location.href, - resolvedUri: window__default['default'].location.href, - playlists: [{ - uri: uri, - id: id, - resolvedUri: uri, - // m3u8-parser does not attach an attributes property to media playlists so make - // sure that the property is attached to avoid undefined reference errors - attributes: {} - }] - }; // set up ID reference - - master.playlists[id] = master.playlists[0]; // URI reference added for backwards compatibility - - master.playlists[uri] = master.playlists[0]; - return master; - }; - /** - * Does an in-place update of the master manifest to add updated playlist URI references - * as well as other properties needed by VHS that aren't included by the parser. - * - * @param {Object} master - * Master manifest object - * @param {string} uri - * The source URI - */ - - var addPropertiesToMaster = function addPropertiesToMaster(master, uri) { - master.uri = uri; - - for (var i = 0; i < master.playlists.length; i++) { - if (!master.playlists[i].uri) { - // Set up phony URIs for the playlists since playlists are referenced by their URIs - // throughout VHS, but some formats (e.g., DASH) don't have external URIs - // TODO: consider adding dummy URIs in mpd-parser - var phonyUri = "placeholder-uri-" + i; - master.playlists[i].uri = phonyUri; - } - } - - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - var groupId = "placeholder-uri-" + mediaType + "-" + groupKey + "-" + labelKey; - - if (!properties.playlists || !properties.playlists.length) { - properties.playlists = [_extends_1({}, properties)]; - } - - properties.playlists.forEach(function (p, i) { - var id = createPlaylistID(i, groupId); - - if (p.uri) { - p.resolvedUri = p.resolvedUri || resolveUrl(master.uri, p.uri); - } else { - // DEPRECATED, this has been added to prevent a breaking change. - // previously we only ever had a single media group playlist, so - // we mark the first playlist uri without prepending the index as we used to - // ideally we would do all of the playlists the same way. - p.uri = i === 0 ? groupId : id; // don't resolve a placeholder uri to an absolute url, just use - // the placeholder again - - p.resolvedUri = p.uri; - } - - p.id = p.id || id; // add an empty attributes object, all playlists are - // expected to have this. - - p.attributes = p.attributes || {}; // setup ID and URI references (URI for backwards compatibility) - - master.playlists[p.id] = p; - master.playlists[p.uri] = p; - }); - }); - setupMediaPlaylists(master); - resolveMediaGroupUris(master); - }; - - var mergeOptions$2 = videojs__default['default'].mergeOptions, - EventTarget$1 = videojs__default['default'].EventTarget; - - var addLLHLSQueryDirectives = function addLLHLSQueryDirectives(uri, media) { - if (media.endList) { - return uri; - } - - var query = []; - - if (media.serverControl && media.serverControl.canBlockReload) { - var preloadSegment = media.preloadSegment; // next msn is a zero based value, length is not. - - var nextMSN = media.mediaSequence + media.segments.length; // If preload segment has parts then it is likely - // that we are going to request a part of that preload segment. - // the logic below is used to determine that. - - if (preloadSegment) { - var parts = preloadSegment.parts || []; // _HLS_part is a zero based index - - var nextPart = getKnownPartCount(media) - 1; // if nextPart is > -1 and not equal to just the - // length of parts, then we know we had part preload hints - // and we need to add the _HLS_part= query - - if (nextPart > -1 && nextPart !== parts.length - 1) { - // add existing parts to our preload hints - query.push("_HLS_part=" + nextPart); - } // this if statement makes sure that we request the msn - // of the preload segment if: - // 1. the preload segment had parts (and was not yet a full segment) - // but was added to our segments array - // 2. the preload segment had preload hints for parts that are not in - // the manifest yet. - // in all other cases we want the segment after the preload segment - // which will be given by using media.segments.length because it is 1 based - // rather than 0 based. - - - if (nextPart > -1 || parts.length) { - nextMSN--; - } - } // add _HLS_msn= in front of any _HLS_part query - - - query.unshift("_HLS_msn=" + nextMSN); - } - - if (media.serverControl && media.serverControl.canSkipUntil) { - // add _HLS_skip= infront of all other queries. - query.unshift('_HLS_skip=' + (media.serverControl.canSkipDateranges ? 'v2' : 'YES')); - } - - query.forEach(function (str, i) { - var symbol = i === 0 ? '?' : '&'; - uri += "" + symbol + str; - }); - return uri; - }; - /** - * Returns a new segment object with properties and - * the parts array merged. - * - * @param {Object} a the old segment - * @param {Object} b the new segment - * - * @return {Object} the merged segment - */ - - - var updateSegment = function updateSegment(a, b) { - if (!a) { - return b; - } - - var result = mergeOptions$2(a, b); // if only the old segment has preload hints - // and the new one does not, remove preload hints. - - if (a.preloadHints && !b.preloadHints) { - delete result.preloadHints; - } // if only the old segment has parts - // then the parts are no longer valid - - - if (a.parts && !b.parts) { - delete result.parts; // if both segments have parts - // copy part propeties from the old segment - // to the new one. - } else if (a.parts && b.parts) { - for (var i = 0; i < b.parts.length; i++) { - if (a.parts && a.parts[i]) { - result.parts[i] = mergeOptions$2(a.parts[i], b.parts[i]); - } - } - } // set skipped to false for segments that have - // have had information merged from the old segment. - - - if (!a.skipped && b.skipped) { - result.skipped = false; - } // set preload to false for segments that have - // had information added in the new segment. - - - if (a.preload && !b.preload) { - result.preload = false; - } - - return result; - }; - /** - * Returns a new array of segments that is the result of merging - * properties from an older list of segments onto an updated - * list. No properties on the updated playlist will be ovewritten. - * - * @param {Array} original the outdated list of segments - * @param {Array} update the updated list of segments - * @param {number=} offset the index of the first update - * segment in the original segment list. For non-live playlists, - * this should always be zero and does not need to be - * specified. For live playlists, it should be the difference - * between the media sequence numbers in the original and updated - * playlists. - * @return {Array} a list of merged segment objects - */ - - var updateSegments = function updateSegments(original, update, offset) { - var oldSegments = original.slice(); - var newSegments = update.slice(); - offset = offset || 0; - var result = []; - var currentMap; - - for (var newIndex = 0; newIndex < newSegments.length; newIndex++) { - var oldSegment = oldSegments[newIndex + offset]; - var newSegment = newSegments[newIndex]; - - if (oldSegment) { - currentMap = oldSegment.map || currentMap; - result.push(updateSegment(oldSegment, newSegment)); - } else { - // carry over map to new segment if it is missing - if (currentMap && !newSegment.map) { - newSegment.map = currentMap; - } - - result.push(newSegment); - } - } - - return result; - }; - var resolveSegmentUris = function resolveSegmentUris(segment, baseUri) { - // preloadSegment will not have a uri at all - // as the segment isn't actually in the manifest yet, only parts - if (!segment.resolvedUri && segment.uri) { - segment.resolvedUri = resolveUrl(baseUri, segment.uri); - } - - if (segment.key && !segment.key.resolvedUri) { - segment.key.resolvedUri = resolveUrl(baseUri, segment.key.uri); - } - - if (segment.map && !segment.map.resolvedUri) { - segment.map.resolvedUri = resolveUrl(baseUri, segment.map.uri); - } - - if (segment.map && segment.map.key && !segment.map.key.resolvedUri) { - segment.map.key.resolvedUri = resolveUrl(baseUri, segment.map.key.uri); - } - - if (segment.parts && segment.parts.length) { - segment.parts.forEach(function (p) { - if (p.resolvedUri) { - return; - } - - p.resolvedUri = resolveUrl(baseUri, p.uri); - }); - } - - if (segment.preloadHints && segment.preloadHints.length) { - segment.preloadHints.forEach(function (p) { - if (p.resolvedUri) { - return; - } - - p.resolvedUri = resolveUrl(baseUri, p.uri); - }); - } - }; - - var getAllSegments = function getAllSegments(media) { - var segments = media.segments || []; - var preloadSegment = media.preloadSegment; // a preloadSegment with only preloadHints is not currently - // a usable segment, only include a preloadSegment that has - // parts. - - if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) { - // if preloadHints has a MAP that means that the - // init segment is going to change. We cannot use any of the parts - // from this preload segment. - if (preloadSegment.preloadHints) { - for (var i = 0; i < preloadSegment.preloadHints.length; i++) { - if (preloadSegment.preloadHints[i].type === 'MAP') { - return segments; - } - } - } // set the duration for our preload segment to target duration. - - - preloadSegment.duration = media.targetDuration; - preloadSegment.preload = true; - segments.push(preloadSegment); - } - - return segments; - }; // consider the playlist unchanged if the playlist object is the same or - // the number of segments is equal, the media sequence number is unchanged, - // and this playlist hasn't become the end of the playlist - - - var isPlaylistUnchanged = function isPlaylistUnchanged(a, b) { - return a === b || a.segments && b.segments && a.segments.length === b.segments.length && a.endList === b.endList && a.mediaSequence === b.mediaSequence; - }; - /** - * Returns a new master playlist that is the result of merging an - * updated media playlist into the original version. If the - * updated media playlist does not match any of the playlist - * entries in the original master playlist, null is returned. - * - * @param {Object} master a parsed master M3U8 object - * @param {Object} media a parsed media M3U8 object - * @return {Object} a new object that represents the original - * master playlist with the updated media playlist merged in, or - * null if the merge produced no change. - */ - - var updateMaster$1 = function updateMaster(master, newMedia, unchangedCheck) { - if (unchangedCheck === void 0) { - unchangedCheck = isPlaylistUnchanged; - } - - var result = mergeOptions$2(master, {}); - var oldMedia = result.playlists[newMedia.id]; - - if (!oldMedia) { - return null; - } - - if (unchangedCheck(oldMedia, newMedia)) { - return null; - } - - newMedia.segments = getAllSegments(newMedia); - var mergedPlaylist = mergeOptions$2(oldMedia, newMedia); // always use the new media's preload segment - - if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) { - delete mergedPlaylist.preloadSegment; - } // if the update could overlap existing segment information, merge the two segment lists - - - if (oldMedia.segments) { - if (newMedia.skip) { - newMedia.segments = newMedia.segments || []; // add back in objects for skipped segments, so that we merge - // old properties into the new segments - - for (var i = 0; i < newMedia.skip.skippedSegments; i++) { - newMedia.segments.unshift({ - skipped: true - }); - } - } - - mergedPlaylist.segments = updateSegments(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence); - } // resolve any segment URIs to prevent us from having to do it later - - - mergedPlaylist.segments.forEach(function (segment) { - resolveSegmentUris(segment, mergedPlaylist.resolvedUri); - }); // TODO Right now in the playlists array there are two references to each playlist, one - // that is referenced by index, and one by URI. The index reference may no longer be - // necessary. - - for (var _i = 0; _i < result.playlists.length; _i++) { - if (result.playlists[_i].id === newMedia.id) { - result.playlists[_i] = mergedPlaylist; - } - } - - result.playlists[newMedia.id] = mergedPlaylist; // URI reference added for backwards compatibility - - result.playlists[newMedia.uri] = mergedPlaylist; // update media group playlist references. - - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - if (!properties.playlists) { - return; - } - - for (var _i2 = 0; _i2 < properties.playlists.length; _i2++) { - if (newMedia.id === properties.playlists[_i2].id) { - properties.playlists[_i2] = newMedia; - } - } - }); - return result; - }; - /** - * Calculates the time to wait before refreshing a live playlist - * - * @param {Object} media - * The current media - * @param {boolean} update - * True if there were any updates from the last refresh, false otherwise - * @return {number} - * The time in ms to wait before refreshing the live playlist - */ - - var refreshDelay = function refreshDelay(media, update) { - var lastSegment = media.segments[media.segments.length - 1]; - var lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1]; - var lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration; - - if (update && lastDuration) { - return lastDuration * 1000; - } // if the playlist is unchanged since the last reload or last segment duration - // cannot be determined, try again after half the target duration - - - return (media.partTargetDuration || media.targetDuration || 10) * 500; - }; - /** - * Load a playlist from a remote location - * - * @class PlaylistLoader - * @extends Stream - * @param {string|Object} src url or object of manifest - * @param {boolean} withCredentials the withCredentials xhr option - * @class - */ - - var PlaylistLoader = /*#__PURE__*/function (_EventTarget) { - inheritsLoose(PlaylistLoader, _EventTarget); - - function PlaylistLoader(src, vhs, options) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _EventTarget.call(this) || this; - - if (!src) { - throw new Error('A non-empty playlist URL or object is required'); - } - - _this.logger_ = logger('PlaylistLoader'); - var _options = options, - _options$withCredenti = _options.withCredentials, - withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, - _options$handleManife = _options.handleManifestRedirects, - handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife; - _this.src = src; - _this.vhs_ = vhs; - _this.withCredentials = withCredentials; - _this.handleManifestRedirects = handleManifestRedirects; - var vhsOptions = vhs.options_; - _this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || []; - _this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || []; - _this.experimentalLLHLS = vhsOptions && vhsOptions.experimentalLLHLS || false; // initialize the loader state - - _this.state = 'HAVE_NOTHING'; // live playlist staleness timeout - - _this.handleMediaupdatetimeout_ = _this.handleMediaupdatetimeout_.bind(assertThisInitialized(_this)); - - _this.on('mediaupdatetimeout', _this.handleMediaupdatetimeout_); - - return _this; - } - - var _proto = PlaylistLoader.prototype; - - _proto.handleMediaupdatetimeout_ = function handleMediaupdatetimeout_() { - var _this2 = this; - - if (this.state !== 'HAVE_METADATA') { - // only refresh the media playlist if no other activity is going on - return; - } - - var media = this.media(); - var uri = resolveUrl(this.master.uri, media.uri); - - if (this.experimentalLLHLS) { - uri = addLLHLSQueryDirectives(uri, media); - } - - this.state = 'HAVE_CURRENT_METADATA'; - this.request = this.vhs_.xhr({ - uri: uri, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this2.request) { - return; - } - - if (error) { - return _this2.playlistRequestError(_this2.request, _this2.media(), 'HAVE_METADATA'); - } - - _this2.haveMetadata({ - playlistString: _this2.request.responseText, - url: _this2.media().uri, - id: _this2.media().id - }); - }); - }; - - _proto.playlistRequestError = function playlistRequestError(xhr, playlist, startingState) { - var uri = playlist.uri, - id = playlist.id; // any in-flight request is now finished - - this.request = null; - - if (startingState) { - this.state = startingState; - } - - this.error = { - playlist: this.master.playlists[id], - status: xhr.status, - message: "HLS playlist request error at URL: " + uri + ".", - responseText: xhr.responseText, - code: xhr.status >= 500 ? 4 : 2 - }; - this.trigger('error'); - }; - - _proto.parseManifest_ = function parseManifest_(_ref) { - var _this3 = this; - - var url = _ref.url, - manifestString = _ref.manifestString; - return parseManifest({ - onwarn: function onwarn(_ref2) { - var message = _ref2.message; - return _this3.logger_("m3u8-parser warn for " + url + ": " + message); - }, - oninfo: function oninfo(_ref3) { - var message = _ref3.message; - return _this3.logger_("m3u8-parser info for " + url + ": " + message); - }, - manifestString: manifestString, - customTagParsers: this.customTagParsers, - customTagMappers: this.customTagMappers, - experimentalLLHLS: this.experimentalLLHLS - }); - } - /** - * Update the playlist loader's state in response to a new or updated playlist. - * - * @param {string} [playlistString] - * Playlist string (if playlistObject is not provided) - * @param {Object} [playlistObject] - * Playlist object (if playlistString is not provided) - * @param {string} url - * URL of playlist - * @param {string} id - * ID to use for playlist - */ - ; - - _proto.haveMetadata = function haveMetadata(_ref4) { - var _this4 = this; - - var playlistString = _ref4.playlistString, - playlistObject = _ref4.playlistObject, - url = _ref4.url, - id = _ref4.id; - // any in-flight request is now finished - this.request = null; - this.state = 'HAVE_METADATA'; - var playlist = playlistObject || this.parseManifest_({ - url: url, - manifestString: playlistString - }); - playlist.lastRequest = Date.now(); - setupMediaPlaylist({ - playlist: playlist, - uri: url, - id: id - }); // merge this playlist into the master - - var update = updateMaster$1(this.master, playlist); - this.targetDuration = playlist.partTargetDuration || playlist.targetDuration; - - if (update) { - this.master = update; - this.media_ = this.master.playlists[id]; - } else { - this.trigger('playlistunchanged'); - } // refresh live playlists after a target duration passes - - - if (!this.media().endList) { - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - _this4.trigger('mediaupdatetimeout'); - }, refreshDelay(this.media(), !!update)); - } - - this.trigger('loadedplaylist'); - } - /** - * Abort any outstanding work and clean up. - */ - ; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.stopRequest(); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - window__default['default'].clearTimeout(this.finalRenditionTimeout); - this.off(); - }; - - _proto.stopRequest = function stopRequest() { - if (this.request) { - var oldRequest = this.request; - this.request = null; - oldRequest.onreadystatechange = null; - oldRequest.abort(); - } - } - /** - * When called without any arguments, returns the currently - * active media playlist. When called with a single argument, - * triggers the playlist loader to asynchronously switch to the - * specified media playlist. Calling this method while the - * loader is in the HAVE_NOTHING causes an error to be emitted - * but otherwise has no effect. - * - * @param {Object=} playlist the parsed media playlist - * object to switch to - * @param {boolean=} shouldDelay whether we should delay the request by half target duration - * - * @return {Playlist} the current loaded media - */ - ; - - _proto.media = function media(playlist, shouldDelay) { - var _this5 = this; - - // getter - if (!playlist) { - return this.media_; - } // setter - - - if (this.state === 'HAVE_NOTHING') { - throw new Error('Cannot switch media playlist from ' + this.state); - } // find the playlist object if the target playlist has been - // specified by URI - - - if (typeof playlist === 'string') { - if (!this.master.playlists[playlist]) { - throw new Error('Unknown playlist URI: ' + playlist); - } - - playlist = this.master.playlists[playlist]; - } - - window__default['default'].clearTimeout(this.finalRenditionTimeout); - - if (shouldDelay) { - var delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1000 || 5 * 1000; - this.finalRenditionTimeout = window__default['default'].setTimeout(this.media.bind(this, playlist, false), delay); - return; - } - - var startingState = this.state; - var mediaChange = !this.media_ || playlist.id !== this.media_.id; - var masterPlaylistRef = this.master.playlists[playlist.id]; // switch to fully loaded playlists immediately - - if (masterPlaylistRef && masterPlaylistRef.endList || // handle the case of a playlist object (e.g., if using vhs-json with a resolved - // media playlist or, for the case of demuxed audio, a resolved audio media group) - playlist.endList && playlist.segments.length) { - // abort outstanding playlist requests - if (this.request) { - this.request.onreadystatechange = null; - this.request.abort(); - this.request = null; - } - - this.state = 'HAVE_METADATA'; - this.media_ = playlist; // trigger media change if the active media has been updated - - if (mediaChange) { - this.trigger('mediachanging'); - - if (startingState === 'HAVE_MASTER') { - // The initial playlist was a master manifest, and the first media selected was - // also provided (in the form of a resolved playlist object) as part of the - // source object (rather than just a URL). Therefore, since the media playlist - // doesn't need to be requested, loadedmetadata won't trigger as part of the - // normal flow, and needs an explicit trigger here. - this.trigger('loadedmetadata'); - } else { - this.trigger('mediachange'); - } - } - - return; - } // switching to the active playlist is a no-op - - - if (!mediaChange) { - return; - } - - this.state = 'SWITCHING_MEDIA'; // there is already an outstanding playlist request - - if (this.request) { - if (playlist.resolvedUri === this.request.url) { - // requesting to switch to the same playlist multiple times - // has no effect after the first - return; - } - - this.request.onreadystatechange = null; - this.request.abort(); - this.request = null; - } // request the new playlist - - - if (this.media_) { - this.trigger('mediachanging'); - } - - this.request = this.vhs_.xhr({ - uri: playlist.resolvedUri, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this5.request) { - return; - } - - playlist.lastRequest = Date.now(); - playlist.resolvedUri = resolveManifestRedirect(_this5.handleManifestRedirects, playlist.resolvedUri, req); - - if (error) { - return _this5.playlistRequestError(_this5.request, playlist, startingState); - } - - _this5.haveMetadata({ - playlistString: req.responseText, - url: playlist.uri, - id: playlist.id - }); // fire loadedmetadata the first time a media playlist is loaded - - - if (startingState === 'HAVE_MASTER') { - _this5.trigger('loadedmetadata'); - } else { - _this5.trigger('mediachange'); - } - }); - } - /** - * pause loading of the playlist - */ - ; - - _proto.pause = function pause() { - this.stopRequest(); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - - if (this.state === 'HAVE_NOTHING') { - // If we pause the loader before any data has been retrieved, its as if we never - // started, so reset to an unstarted state. - this.started = false; - } // Need to restore state now that no activity is happening - - - if (this.state === 'SWITCHING_MEDIA') { - // if the loader was in the process of switching media, it should either return to - // HAVE_MASTER or HAVE_METADATA depending on if the loader has loaded a media - // playlist yet. This is determined by the existence of loader.media_ - if (this.media_) { - this.state = 'HAVE_METADATA'; - } else { - this.state = 'HAVE_MASTER'; - } - } else if (this.state === 'HAVE_CURRENT_METADATA') { - this.state = 'HAVE_METADATA'; - } - } - /** - * start loading of the playlist - */ - ; - - _proto.load = function load(shouldDelay) { - var _this6 = this; - - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - var media = this.media(); - - if (shouldDelay) { - var delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1000 : 5 * 1000; - this.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - return _this6.load(); - }, delay); - return; - } - - if (!this.started) { - this.start(); - return; - } - - if (media && !media.endList) { - this.trigger('mediaupdatetimeout'); - } else { - this.trigger('loadedplaylist'); - } - } - /** - * start loading of the playlist - */ - ; - - _proto.start = function start() { - var _this7 = this; - - this.started = true; - - if (typeof this.src === 'object') { - // in the case of an entirely constructed manifest object (meaning there's no actual - // manifest on a server), default the uri to the page's href - if (!this.src.uri) { - this.src.uri = window__default['default'].location.href; - } // resolvedUri is added on internally after the initial request. Since there's no - // request for pre-resolved manifests, add on resolvedUri here. - - - this.src.resolvedUri = this.src.uri; // Since a manifest object was passed in as the source (instead of a URL), the first - // request can be skipped (since the top level of the manifest, at a minimum, is - // already available as a parsed manifest object). However, if the manifest object - // represents a master playlist, some media playlists may need to be resolved before - // the starting segment list is available. Therefore, go directly to setup of the - // initial playlist, and let the normal flow continue from there. - // - // Note that the call to setup is asynchronous, as other sections of VHS may assume - // that the first request is asynchronous. - - setTimeout(function () { - _this7.setupInitialPlaylist(_this7.src); - }, 0); - return; - } // request the specified URL - - - this.request = this.vhs_.xhr({ - uri: this.src, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this7.request) { - return; - } // clear the loader's request reference - - - _this7.request = null; - - if (error) { - _this7.error = { - status: req.status, - message: "HLS playlist request error at URL: " + _this7.src + ".", - responseText: req.responseText, - // MEDIA_ERR_NETWORK - code: 2 - }; - - if (_this7.state === 'HAVE_NOTHING') { - _this7.started = false; - } - - return _this7.trigger('error'); - } - - _this7.src = resolveManifestRedirect(_this7.handleManifestRedirects, _this7.src, req); - - var manifest = _this7.parseManifest_({ - manifestString: req.responseText, - url: _this7.src - }); - - _this7.setupInitialPlaylist(manifest); - }); - }; - - _proto.srcUri = function srcUri() { - return typeof this.src === 'string' ? this.src : this.src.uri; - } - /** - * Given a manifest object that's either a master or media playlist, trigger the proper - * events and set the state of the playlist loader. - * - * If the manifest object represents a master playlist, `loadedplaylist` will be - * triggered to allow listeners to select a playlist. If none is selected, the loader - * will default to the first one in the playlists array. - * - * If the manifest object represents a media playlist, `loadedplaylist` will be - * triggered followed by `loadedmetadata`, as the only available playlist is loaded. - * - * In the case of a media playlist, a master playlist object wrapper with one playlist - * will be created so that all logic can handle playlists in the same fashion (as an - * assumed manifest object schema). - * - * @param {Object} manifest - * The parsed manifest object - */ - ; - - _proto.setupInitialPlaylist = function setupInitialPlaylist(manifest) { - this.state = 'HAVE_MASTER'; - - if (manifest.playlists) { - this.master = manifest; - addPropertiesToMaster(this.master, this.srcUri()); // If the initial master playlist has playlists wtih segments already resolved, - // then resolve URIs in advance, as they are usually done after a playlist request, - // which may not happen if the playlist is resolved. - - manifest.playlists.forEach(function (playlist) { - playlist.segments = getAllSegments(playlist); - playlist.segments.forEach(function (segment) { - resolveSegmentUris(segment, playlist.resolvedUri); - }); - }); - this.trigger('loadedplaylist'); - - if (!this.request) { - // no media playlist was specifically selected so start - // from the first listed one - this.media(this.master.playlists[0]); - } - - return; - } // In order to support media playlists passed in as vhs-json, the case where the uri - // is not provided as part of the manifest should be considered, and an appropriate - // default used. - - - var uri = this.srcUri() || window__default['default'].location.href; - this.master = masterForMedia(manifest, uri); - this.haveMetadata({ - playlistObject: manifest, - url: uri, - id: this.master.playlists[0].id - }); - this.trigger('loadedmetadata'); - }; - - return PlaylistLoader; - }(EventTarget$1); - - /** - * @file xhr.js - */ - var videojsXHR = videojs__default['default'].xhr, - mergeOptions$1 = videojs__default['default'].mergeOptions; - - var callbackWrapper = function callbackWrapper(request, error, response, callback) { - var reqResponse = request.responseType === 'arraybuffer' ? request.response : request.responseText; - - if (!error && reqResponse) { - request.responseTime = Date.now(); - request.roundTripTime = request.responseTime - request.requestTime; - request.bytesReceived = reqResponse.byteLength || reqResponse.length; - - if (!request.bandwidth) { - request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1000); - } - } - - if (response.headers) { - request.responseHeaders = response.headers; - } // videojs.xhr now uses a specific code on the error - // object to signal that a request has timed out instead - // of setting a boolean on the request object - - - if (error && error.code === 'ETIMEDOUT') { - request.timedout = true; - } // videojs.xhr no longer considers status codes outside of 200 and 0 - // (for file uris) to be errors, but the old XHR did, so emulate that - // behavior. Status 206 may be used in response to byterange requests. - - - if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) { - error = new Error('XHR Failed with a response of: ' + (request && (reqResponse || request.responseText))); - } - - callback(error, request); - }; - - var xhrFactory = function xhrFactory() { - var xhr = function XhrFunction(options, callback) { - // Add a default timeout - options = mergeOptions$1({ - timeout: 45e3 - }, options); // Allow an optional user-specified function to modify the option - // object before we construct the xhr request - - var beforeRequest = XhrFunction.beforeRequest || videojs__default['default'].Vhs.xhr.beforeRequest; - - if (beforeRequest && typeof beforeRequest === 'function') { - var newOptions = beforeRequest(options); - - if (newOptions) { - options = newOptions; - } - } // Use the standard videojs.xhr() method unless `videojs.Vhs.xhr` has been overriden - // TODO: switch back to videojs.Vhs.xhr.name === 'XhrFunction' when we drop IE11 - - - var xhrMethod = videojs__default['default'].Vhs.xhr.original === true ? videojsXHR : videojs__default['default'].Vhs.xhr; - var request = xhrMethod(options, function (error, response) { - return callbackWrapper(request, error, response, callback); - }); - var originalAbort = request.abort; - - request.abort = function () { - request.aborted = true; - return originalAbort.apply(request, arguments); - }; - - request.uri = options.uri; - request.requestTime = Date.now(); - return request; - }; - - xhr.original = true; - return xhr; - }; - /** - * Turns segment byterange into a string suitable for use in - * HTTP Range requests - * - * @param {Object} byterange - an object with two values defining the start and end - * of a byte-range - */ - - - var byterangeStr = function byterangeStr(byterange) { - // `byterangeEnd` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - var byterangeEnd = byterange.offset + byterange.length - 1; - var byterangeStart = byterange.offset; - return 'bytes=' + byterangeStart + '-' + byterangeEnd; - }; - /** - * Defines headers for use in the xhr request for a particular segment. - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - */ - - - var segmentXhrHeaders = function segmentXhrHeaders(segment) { - var headers = {}; - - if (segment.byterange) { - headers.Range = byterangeStr(segment.byterange); - } - - return headers; - }; - - var MPEGURL_REGEX = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i; - var DASH_REGEX = /^application\/dash\+xml/i; - /** - * Returns a string that describes the type of source based on a video source object's - * media type. - * - * @see {@link https://dev.w3.org/html5/pf-summary/video.html#dom-source-type|Source Type} - * - * @param {string} type - * Video source object media type - * @return {('hls'|'dash'|'vhs-json'|null)} - * VHS source type string - */ - - var simpleTypeFromSourceType = function simpleTypeFromSourceType(type) { - if (MPEGURL_REGEX.test(type)) { - return 'hls'; - } - - if (DASH_REGEX.test(type)) { - return 'dash'; - } // Denotes the special case of a manifest object passed to http-streaming instead of a - // source URL. - // - // See https://en.wikipedia.org/wiki/Media_type for details on specifying media types. - // - // In this case, vnd stands for vendor, video.js for the organization, VHS for this - // project, and the +json suffix identifies the structure of the media type. - - - if (type === 'application/vnd.videojs.vhs+json') { - return 'vhs-json'; - } - - return null; - }; - - /** - * @file bin-utils.js - */ - - /** - * convert a TimeRange to text - * - * @param {TimeRange} range the timerange to use for conversion - * @param {number} i the iterator on the range to convert - * @return {string} the range in string format - */ - var textRange = function textRange(range, i) { - return range.start(i) + '-' + range.end(i); - }; - /** - * format a number as hex string - * - * @param {number} e The number - * @param {number} i the iterator - * @return {string} the hex formatted number as a string - */ - - - var formatHexString = function formatHexString(e, i) { - var value = e.toString(16); - return '00'.substring(0, 2 - value.length) + value + (i % 2 ? ' ' : ''); - }; - - var formatAsciiString = function formatAsciiString(e) { - if (e >= 0x20 && e < 0x7e) { - return String.fromCharCode(e); - } - - return '.'; - }; - /** - * Creates an object for sending to a web worker modifying properties that are TypedArrays - * into a new object with seperated properties for the buffer, byteOffset, and byteLength. - * - * @param {Object} message - * Object of properties and values to send to the web worker - * @return {Object} - * Modified message with TypedArray values expanded - * @function createTransferableMessage - */ - - - var createTransferableMessage = function createTransferableMessage(message) { - var transferable = {}; - Object.keys(message).forEach(function (key) { - var value = message[key]; - - if (ArrayBuffer.isView(value)) { - transferable[key] = { - bytes: value.buffer, - byteOffset: value.byteOffset, - byteLength: value.byteLength - }; - } else { - transferable[key] = value; - } - }); - return transferable; - }; - /** - * Returns a unique string identifier for a media initialization - * segment. - * - * @param {Object} initSegment - * the init segment object. - * - * @return {string} the generated init segment id - */ - - var initSegmentId = function initSegmentId(initSegment) { - var byterange = initSegment.byterange || { - length: Infinity, - offset: 0 - }; - return [byterange.length, byterange.offset, initSegment.resolvedUri].join(','); - }; - /** - * Returns a unique string identifier for a media segment key. - * - * @param {Object} key the encryption key - * @return {string} the unique id for the media segment key. - */ - - var segmentKeyId = function segmentKeyId(key) { - return key.resolvedUri; - }; - /** - * utils to help dump binary data to the console - * - * @param {Array|TypedArray} data - * data to dump to a string - * - * @return {string} the data as a hex string. - */ - - var hexDump = function hexDump(data) { - var bytes = Array.prototype.slice.call(data); - var step = 16; - var result = ''; - var hex; - var ascii; - - for (var j = 0; j < bytes.length / step; j++) { - hex = bytes.slice(j * step, j * step + step).map(formatHexString).join(''); - ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join(''); - result += hex + ' ' + ascii + '\n'; - } - - return result; - }; - var tagDump = function tagDump(_ref) { - var bytes = _ref.bytes; - return hexDump(bytes); - }; - var textRanges = function textRanges(ranges) { - var result = ''; - var i; - - for (i = 0; i < ranges.length; i++) { - result += textRange(ranges, i) + ' '; - } - - return result; - }; - - var utils = /*#__PURE__*/Object.freeze({ - __proto__: null, - createTransferableMessage: createTransferableMessage, - initSegmentId: initSegmentId, - segmentKeyId: segmentKeyId, - hexDump: hexDump, - tagDump: tagDump, - textRanges: textRanges - }); - - // TODO handle fmp4 case where the timing info is accurate and doesn't involve transmux - // 25% was arbitrarily chosen, and may need to be refined over time. - - var SEGMENT_END_FUDGE_PERCENT = 0.25; - /** - * Converts a player time (any time that can be gotten/set from player.currentTime(), - * e.g., any time within player.seekable().start(0) to player.seekable().end(0)) to a - * program time (any time referencing the real world (e.g., EXT-X-PROGRAM-DATE-TIME)). - * - * The containing segment is required as the EXT-X-PROGRAM-DATE-TIME serves as an "anchor - * point" (a point where we have a mapping from program time to player time, with player - * time being the post transmux start of the segment). - * - * For more details, see [this doc](../../docs/program-time-from-player-time.md). - * - * @param {number} playerTime the player time - * @param {Object} segment the segment which contains the player time - * @return {Date} program time - */ - - var playerTimeToProgramTime = function playerTimeToProgramTime(playerTime, segment) { - if (!segment.dateTimeObject) { - // Can't convert without an "anchor point" for the program time (i.e., a time that can - // be used to map the start of a segment with a real world time). - return null; - } - - var transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds; - var transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart; // get the start of the content from before old content is prepended - - var startOfSegment = transmuxedStart + transmuxerPrependedSeconds; - var offsetFromSegmentStart = playerTime - startOfSegment; - return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1000); - }; - var originalSegmentVideoDuration = function originalSegmentVideoDuration(videoTimingInfo) { - return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds; - }; - /** - * Finds a segment that contains the time requested given as an ISO-8601 string. The - * returned segment might be an estimate or an accurate match. - * - * @param {string} programTime The ISO-8601 programTime to find a match for - * @param {Object} playlist A playlist object to search within - */ - - var findSegmentForProgramTime = function findSegmentForProgramTime(programTime, playlist) { - // Assumptions: - // - verifyProgramDateTimeTags has already been run - // - live streams have been started - var dateTimeObject; - - try { - dateTimeObject = new Date(programTime); - } catch (e) { - return null; - } - - if (!playlist || !playlist.segments || playlist.segments.length === 0) { - return null; - } - - var segment = playlist.segments[0]; - - if (dateTimeObject < segment.dateTimeObject) { - // Requested time is before stream start. - return null; - } - - for (var i = 0; i < playlist.segments.length - 1; i++) { - segment = playlist.segments[i]; - var nextSegmentStart = playlist.segments[i + 1].dateTimeObject; - - if (dateTimeObject < nextSegmentStart) { - break; - } - } - - var lastSegment = playlist.segments[playlist.segments.length - 1]; - var lastSegmentStart = lastSegment.dateTimeObject; - var lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT; - var lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1000); - - if (dateTimeObject > lastSegmentEnd) { - // Beyond the end of the stream, or our best guess of the end of the stream. - return null; - } - - if (dateTimeObject > lastSegmentStart) { - segment = lastSegment; - } - - return { - segment: segment, - estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)), - // Although, given that all segments have accurate date time objects, the segment - // selected should be accurate, unless the video has been transmuxed at some point - // (determined by the presence of the videoTimingInfo object), the segment's "player - // time" (the start time in the player) can't be considered accurate. - type: segment.videoTimingInfo ? 'accurate' : 'estimate' - }; - }; - /** - * Finds a segment that contains the given player time(in seconds). - * - * @param {number} time The player time to find a match for - * @param {Object} playlist A playlist object to search within - */ - - var findSegmentForPlayerTime = function findSegmentForPlayerTime(time, playlist) { - // Assumptions: - // - there will always be a segment.duration - // - we can start from zero - // - segments are in time order - if (!playlist || !playlist.segments || playlist.segments.length === 0) { - return null; - } - - var segmentEnd = 0; - var segment; - - for (var i = 0; i < playlist.segments.length; i++) { - segment = playlist.segments[i]; // videoTimingInfo is set after the segment is downloaded and transmuxed, and - // should contain the most accurate values we have for the segment's player times. - // - // Use the accurate transmuxedPresentationEnd value if it is available, otherwise fall - // back to an estimate based on the manifest derived (inaccurate) segment.duration, to - // calculate an end value. - - segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration; - - if (time <= segmentEnd) { - break; - } - } - - var lastSegment = playlist.segments[playlist.segments.length - 1]; - - if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) { - // The time requested is beyond the stream end. - return null; - } - - if (time > segmentEnd) { - // The time is within or beyond the last segment. - // - // Check to see if the time is beyond a reasonable guess of the end of the stream. - if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT) { - // Technically, because the duration value is only an estimate, the time may still - // exist in the last segment, however, there isn't enough information to make even - // a reasonable estimate. - return null; - } - - segment = lastSegment; - } - - return { - segment: segment, - estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration, - // Because videoTimingInfo is only set after transmux, it is the only way to get - // accurate timing values. - type: segment.videoTimingInfo ? 'accurate' : 'estimate' - }; - }; - /** - * Gives the offset of the comparisonTimestamp from the programTime timestamp in seconds. - * If the offset returned is positive, the programTime occurs after the - * comparisonTimestamp. - * If the offset is negative, the programTime occurs before the comparisonTimestamp. - * - * @param {string} comparisonTimeStamp An ISO-8601 timestamp to compare against - * @param {string} programTime The programTime as an ISO-8601 string - * @return {number} offset - */ - - var getOffsetFromTimestamp = function getOffsetFromTimestamp(comparisonTimeStamp, programTime) { - var segmentDateTime; - var programDateTime; - - try { - segmentDateTime = new Date(comparisonTimeStamp); - programDateTime = new Date(programTime); - } catch (e) {// TODO handle error - } - - var segmentTimeEpoch = segmentDateTime.getTime(); - var programTimeEpoch = programDateTime.getTime(); - return (programTimeEpoch - segmentTimeEpoch) / 1000; - }; - /** - * Checks that all segments in this playlist have programDateTime tags. - * - * @param {Object} playlist A playlist object - */ - - var verifyProgramDateTimeTags = function verifyProgramDateTimeTags(playlist) { - if (!playlist.segments || playlist.segments.length === 0) { - return false; - } - - for (var i = 0; i < playlist.segments.length; i++) { - var segment = playlist.segments[i]; - - if (!segment.dateTimeObject) { - return false; - } - } - - return true; - }; - /** - * Returns the programTime of the media given a playlist and a playerTime. - * The playlist must have programDateTime tags for a programDateTime tag to be returned. - * If the segments containing the time requested have not been buffered yet, an estimate - * may be returned to the callback. - * - * @param {Object} args - * @param {Object} args.playlist A playlist object to search within - * @param {number} time A playerTime in seconds - * @param {Function} callback(err, programTime) - * @return {string} err.message A detailed error message - * @return {Object} programTime - * @return {number} programTime.mediaSeconds The streamTime in seconds - * @return {string} programTime.programDateTime The programTime as an ISO-8601 String - */ - - var getProgramTime = function getProgramTime(_ref) { - var playlist = _ref.playlist, - _ref$time = _ref.time, - time = _ref$time === void 0 ? undefined : _ref$time, - callback = _ref.callback; - - if (!callback) { - throw new Error('getProgramTime: callback must be provided'); - } - - if (!playlist || time === undefined) { - return callback({ - message: 'getProgramTime: playlist and time must be provided' - }); - } - - var matchedSegment = findSegmentForPlayerTime(time, playlist); - - if (!matchedSegment) { - return callback({ - message: 'valid programTime was not found' - }); - } - - if (matchedSegment.type === 'estimate') { - return callback({ - message: 'Accurate programTime could not be determined.' + ' Please seek to e.seekTime and try again', - seekTime: matchedSegment.estimatedStart - }); - } - - var programTimeObject = { - mediaSeconds: time - }; - var programTime = playerTimeToProgramTime(time, matchedSegment.segment); - - if (programTime) { - programTimeObject.programDateTime = programTime.toISOString(); - } - - return callback(null, programTimeObject); - }; - /** - * Seeks in the player to a time that matches the given programTime ISO-8601 string. - * - * @param {Object} args - * @param {string} args.programTime A programTime to seek to as an ISO-8601 String - * @param {Object} args.playlist A playlist to look within - * @param {number} args.retryCount The number of times to try for an accurate seek. Default is 2. - * @param {Function} args.seekTo A method to perform a seek - * @param {boolean} args.pauseAfterSeek Whether to end in a paused state after seeking. Default is true. - * @param {Object} args.tech The tech to seek on - * @param {Function} args.callback(err, newTime) A callback to return the new time to - * @return {string} err.message A detailed error message - * @return {number} newTime The exact time that was seeked to in seconds - */ - - var seekToProgramTime = function seekToProgramTime(_ref2) { - var programTime = _ref2.programTime, - playlist = _ref2.playlist, - _ref2$retryCount = _ref2.retryCount, - retryCount = _ref2$retryCount === void 0 ? 2 : _ref2$retryCount, - seekTo = _ref2.seekTo, - _ref2$pauseAfterSeek = _ref2.pauseAfterSeek, - pauseAfterSeek = _ref2$pauseAfterSeek === void 0 ? true : _ref2$pauseAfterSeek, - tech = _ref2.tech, - callback = _ref2.callback; - - if (!callback) { - throw new Error('seekToProgramTime: callback must be provided'); - } - - if (typeof programTime === 'undefined' || !playlist || !seekTo) { - return callback({ - message: 'seekToProgramTime: programTime, seekTo and playlist must be provided' - }); - } - - if (!playlist.endList && !tech.hasStarted_) { - return callback({ - message: 'player must be playing a live stream to start buffering' - }); - } - - if (!verifyProgramDateTimeTags(playlist)) { - return callback({ - message: 'programDateTime tags must be provided in the manifest ' + playlist.resolvedUri - }); - } - - var matchedSegment = findSegmentForProgramTime(programTime, playlist); // no match - - if (!matchedSegment) { - return callback({ - message: programTime + " was not found in the stream" - }); - } - - var segment = matchedSegment.segment; - var mediaOffset = getOffsetFromTimestamp(segment.dateTimeObject, programTime); - - if (matchedSegment.type === 'estimate') { - // we've run out of retries - if (retryCount === 0) { - return callback({ - message: programTime + " is not buffered yet. Try again" - }); - } - - seekTo(matchedSegment.estimatedStart + mediaOffset); - tech.one('seeked', function () { - seekToProgramTime({ - programTime: programTime, - playlist: playlist, - retryCount: retryCount - 1, - seekTo: seekTo, - pauseAfterSeek: pauseAfterSeek, - tech: tech, - callback: callback - }); - }); - return; - } // Since the segment.start value is determined from the buffered end or ending time - // of the prior segment, the seekToTime doesn't need to account for any transmuxer - // modifications. - - - var seekToTime = segment.start + mediaOffset; - - var seekedCallback = function seekedCallback() { - return callback(null, tech.currentTime()); - }; // listen for seeked event - - - tech.one('seeked', seekedCallback); // pause before seeking as video.js will restore this state - - if (pauseAfterSeek) { - tech.pause(); - } - - seekTo(seekToTime); - }; - - /*! @name mpd-parser @version 0.17.0 @license Apache-2.0 */ - - var isObject = function isObject(obj) { - return !!obj && typeof obj === 'object'; - }; - - var merge = function merge() { - for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) { - objects[_key] = arguments[_key]; - } - - return objects.reduce(function (result, source) { - if (typeof source !== 'object') { - return result; - } - - Object.keys(source).forEach(function (key) { - if (Array.isArray(result[key]) && Array.isArray(source[key])) { - result[key] = result[key].concat(source[key]); - } else if (isObject(result[key]) && isObject(source[key])) { - result[key] = merge(result[key], source[key]); - } else { - result[key] = source[key]; - } - }); - return result; - }, {}); - }; - - var values = function values(o) { - return Object.keys(o).map(function (k) { - return o[k]; - }); - }; - - var range = function range(start, end) { - var result = []; - - for (var i = start; i < end; i++) { - result.push(i); - } - - return result; - }; - - var flatten = function flatten(lists) { - return lists.reduce(function (x, y) { - return x.concat(y); - }, []); - }; - - var from = function from(list) { - if (!list.length) { - return []; - } - - var result = []; - - for (var i = 0; i < list.length; i++) { - result.push(list[i]); - } - - return result; - }; - - var findIndexes = function findIndexes(l, key) { - return l.reduce(function (a, e, i) { - if (e[key]) { - a.push(i); - } - - return a; - }, []); - }; - - var errors = { - INVALID_NUMBER_OF_PERIOD: 'INVALID_NUMBER_OF_PERIOD', - DASH_EMPTY_MANIFEST: 'DASH_EMPTY_MANIFEST', - DASH_INVALID_XML: 'DASH_INVALID_XML', - NO_BASE_URL: 'NO_BASE_URL', - MISSING_SEGMENT_INFORMATION: 'MISSING_SEGMENT_INFORMATION', - SEGMENT_TIME_UNSPECIFIED: 'SEGMENT_TIME_UNSPECIFIED', - UNSUPPORTED_UTC_TIMING_SCHEME: 'UNSUPPORTED_UTC_TIMING_SCHEME' - }; - /** - * @typedef {Object} SingleUri - * @property {string} uri - relative location of segment - * @property {string} resolvedUri - resolved location of segment - * @property {Object} byterange - Object containing information on how to make byte range - * requests following byte-range-spec per RFC2616. - * @property {String} byterange.length - length of range request - * @property {String} byterange.offset - byte offset of range request - * - * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 - */ - - /** - * Converts a URLType node (5.3.9.2.3 Table 13) to a segment object - * that conforms to how m3u8-parser is structured - * - * @see https://github.com/videojs/m3u8-parser - * - * @param {string} baseUrl - baseUrl provided by nodes - * @param {string} source - source url for segment - * @param {string} range - optional range used for range calls, - * follows RFC 2616, Clause 14.35.1 - * @return {SingleUri} full segment information transformed into a format similar - * to m3u8-parser - */ - - var urlTypeToSegment = function urlTypeToSegment(_ref) { - var _ref$baseUrl = _ref.baseUrl, - baseUrl = _ref$baseUrl === void 0 ? '' : _ref$baseUrl, - _ref$source = _ref.source, - source = _ref$source === void 0 ? '' : _ref$source, - _ref$range = _ref.range, - range = _ref$range === void 0 ? '' : _ref$range, - _ref$indexRange = _ref.indexRange, - indexRange = _ref$indexRange === void 0 ? '' : _ref$indexRange; - var segment = { - uri: source, - resolvedUri: resolveUrl$1(baseUrl || '', source) - }; - - if (range || indexRange) { - var rangeStr = range ? range : indexRange; - var ranges = rangeStr.split('-'); - var startRange = parseInt(ranges[0], 10); - var endRange = parseInt(ranges[1], 10); // byterange should be inclusive according to - // RFC 2616, Clause 14.35.1 - - segment.byterange = { - length: endRange - startRange + 1, - offset: startRange - }; - } - - return segment; - }; - - var byteRangeToString = function byteRangeToString(byterange) { - // `endRange` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - var endRange = byterange.offset + byterange.length - 1; - return byterange.offset + "-" + endRange; - }; - /** - * parse the end number attribue that can be a string - * number, or undefined. - * - * @param {string|number|undefined} endNumber - * The end number attribute. - * - * @return {number|null} - * The result of parsing the end number. - */ - - - var parseEndNumber = function parseEndNumber(endNumber) { - if (endNumber && typeof endNumber !== 'number') { - endNumber = parseInt(endNumber, 10); - } - - if (isNaN(endNumber)) { - return null; - } - - return endNumber; - }; - /** - * Functions for calculating the range of available segments in static and dynamic - * manifests. - */ - - - var segmentRange = { - /** - * Returns the entire range of available segments for a static MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - static: function _static(attributes) { - var duration = attributes.duration, - _attributes$timescale = attributes.timescale, - timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale, - sourceDuration = attributes.sourceDuration; - var endNumber = parseEndNumber(attributes.endNumber); - return { - start: 0, - end: typeof endNumber === 'number' ? endNumber : Math.ceil(sourceDuration / (duration / timescale)) - }; - }, - - /** - * Returns the current live window range of available segments for a dynamic MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - dynamic: function dynamic(attributes) { - var NOW = attributes.NOW, - clientOffset = attributes.clientOffset, - availabilityStartTime = attributes.availabilityStartTime, - _attributes$timescale2 = attributes.timescale, - timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, - duration = attributes.duration, - _attributes$start = attributes.start, - start = _attributes$start === void 0 ? 0 : _attributes$start, - _attributes$minimumUp = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp, - _attributes$timeShift = attributes.timeShiftBufferDepth, - timeShiftBufferDepth = _attributes$timeShift === void 0 ? Infinity : _attributes$timeShift; - var endNumber = parseEndNumber(attributes.endNumber); - var now = (NOW + clientOffset) / 1000; - var periodStartWC = availabilityStartTime + start; - var periodEndWC = now + minimumUpdatePeriod; - var periodDuration = periodEndWC - periodStartWC; - var segmentCount = Math.ceil(periodDuration * timescale / duration); - var availableStart = Math.floor((now - periodStartWC - timeShiftBufferDepth) * timescale / duration); - var availableEnd = Math.floor((now - periodStartWC) * timescale / duration); - return { - start: Math.max(0, availableStart), - end: typeof endNumber === 'number' ? endNumber : Math.min(segmentCount, availableEnd) - }; - } - }; - /** - * Maps a range of numbers to objects with information needed to build the corresponding - * segment list - * - * @name toSegmentsCallback - * @function - * @param {number} number - * Number of the segment - * @param {number} index - * Index of the number in the range list - * @return {{ number: Number, duration: Number, timeline: Number, time: Number }} - * Object with segment timing and duration info - */ - - /** - * Returns a callback for Array.prototype.map for mapping a range of numbers to - * information needed to build the segment list. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {toSegmentsCallback} - * Callback map function - */ - - var toSegments = function toSegments(attributes) { - return function (number, index) { - var duration = attributes.duration, - _attributes$timescale3 = attributes.timescale, - timescale = _attributes$timescale3 === void 0 ? 1 : _attributes$timescale3, - periodIndex = attributes.periodIndex, - _attributes$startNumb = attributes.startNumber, - startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb; - return { - number: startNumber + number, - duration: duration / timescale, - timeline: periodIndex, - time: index * duration - }; - }; - }; - /** - * Returns a list of objects containing segment timing and duration info used for - * building the list of segments. This uses the @duration attribute specified - * in the MPD manifest to derive the range of segments. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - - var parseByDuration = function parseByDuration(attributes) { - var _attributes$type = attributes.type, - type = _attributes$type === void 0 ? 'static' : _attributes$type, - duration = attributes.duration, - _attributes$timescale4 = attributes.timescale, - timescale = _attributes$timescale4 === void 0 ? 1 : _attributes$timescale4, - sourceDuration = attributes.sourceDuration; - - var _segmentRange$type = segmentRange[type](attributes), - start = _segmentRange$type.start, - end = _segmentRange$type.end; - - var segments = range(start, end).map(toSegments(attributes)); - - if (type === 'static') { - var index = segments.length - 1; // final segment may be less than full segment duration - - segments[index].duration = sourceDuration - duration / timescale * index; - } - - return segments; - }; - /** - * Translates SegmentBase into a set of segments. - * (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @return {Object.} list of segments - */ - - - var segmentsFromBase = function segmentsFromBase(attributes) { - var baseUrl = attributes.baseUrl, - _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ, - sourceDuration = attributes.sourceDuration, - _attributes$indexRang = attributes.indexRange, - indexRange = _attributes$indexRang === void 0 ? '' : _attributes$indexRang, - duration = attributes.duration; // base url is required for SegmentBase to work, per spec (Section 5.3.9.2.1) - - if (!baseUrl) { - throw new Error(errors.NO_BASE_URL); - } - - var initSegment = urlTypeToSegment({ - baseUrl: baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - var segment = urlTypeToSegment({ - baseUrl: baseUrl, - source: baseUrl, - indexRange: indexRange - }); - segment.map = initSegment; // If there is a duration, use it, otherwise use the given duration of the source - // (since SegmentBase is only for one total segment) - - if (duration) { - var segmentTimeInfo = parseByDuration(attributes); - - if (segmentTimeInfo.length) { - segment.duration = segmentTimeInfo[0].duration; - segment.timeline = segmentTimeInfo[0].timeline; - } - } else if (sourceDuration) { - segment.duration = sourceDuration; - segment.timeline = 0; - } // This is used for mediaSequence - - - segment.number = 0; - return [segment]; - }; - /** - * Given a playlist, a sidx box, and a baseUrl, update the segment list of the playlist - * according to the sidx information given. - * - * playlist.sidx has metadadata about the sidx where-as the sidx param - * is the parsed sidx box itself. - * - * @param {Object} playlist the playlist to update the sidx information for - * @param {Object} sidx the parsed sidx box - * @return {Object} the playlist object with the updated sidx information - */ - - - var addSidxSegmentsToPlaylist = function addSidxSegmentsToPlaylist(playlist, sidx, baseUrl) { - // Retain init segment information - var initSegment = playlist.sidx.map ? playlist.sidx.map : null; // Retain source duration from initial master manifest parsing - - var sourceDuration = playlist.sidx.duration; // Retain source timeline - - var timeline = playlist.timeline || 0; - var sidxByteRange = playlist.sidx.byterange; - var sidxEnd = sidxByteRange.offset + sidxByteRange.length; // Retain timescale of the parsed sidx - - var timescale = sidx.timescale; // referenceType 1 refers to other sidx boxes - - var mediaReferences = sidx.references.filter(function (r) { - return r.referenceType !== 1; - }); - var segments = []; // firstOffset is the offset from the end of the sidx box - - var startIndex = sidxEnd + sidx.firstOffset; - - for (var i = 0; i < mediaReferences.length; i++) { - var reference = sidx.references[i]; // size of the referenced (sub)segment - - var size = reference.referencedSize; // duration of the referenced (sub)segment, in the timescale - // this will be converted to seconds when generating segments - - var duration = reference.subsegmentDuration; // should be an inclusive range - - var endIndex = startIndex + size - 1; - var indexRange = startIndex + "-" + endIndex; - var attributes = { - baseUrl: baseUrl, - timescale: timescale, - timeline: timeline, - // this is used in parseByDuration - periodIndex: timeline, - duration: duration, - sourceDuration: sourceDuration, - indexRange: indexRange - }; - var segment = segmentsFromBase(attributes)[0]; - - if (initSegment) { - segment.map = initSegment; - } - - segments.push(segment); - startIndex += size; - } - - playlist.segments = segments; - return playlist; - }; - - var generateSidxKey = function generateSidxKey(sidx) { - return sidx && sidx.uri + '-' + byteRangeToString(sidx.byterange); - }; - - var mergeDiscontiguousPlaylists = function mergeDiscontiguousPlaylists(playlists) { - var mergedPlaylists = values(playlists.reduce(function (acc, playlist) { - // assuming playlist IDs are the same across periods - // TODO: handle multiperiod where representation sets are not the same - // across periods - var name = playlist.attributes.id + (playlist.attributes.lang || ''); // Periods after first - - if (acc[name]) { - var _acc$name$segments; // first segment of subsequent periods signal a discontinuity - - - if (playlist.segments[0]) { - playlist.segments[0].discontinuity = true; - } - - (_acc$name$segments = acc[name].segments).push.apply(_acc$name$segments, playlist.segments); // bubble up contentProtection, this assumes all DRM content - // has the same contentProtection - - - if (playlist.attributes.contentProtection) { - acc[name].attributes.contentProtection = playlist.attributes.contentProtection; - } - } else { - // first Period - acc[name] = playlist; - } - - return acc; - }, {})); - return mergedPlaylists.map(function (playlist) { - playlist.discontinuityStarts = findIndexes(playlist.segments, 'discontinuity'); - return playlist; - }); - }; - - var addSidxSegmentsToPlaylist$1 = function addSidxSegmentsToPlaylist$1(playlist, sidxMapping) { - var sidxKey = generateSidxKey(playlist.sidx); - var sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx; - - if (sidxMatch) { - addSidxSegmentsToPlaylist(playlist, sidxMatch, playlist.sidx.resolvedUri); - } - - return playlist; - }; - - var addSidxSegmentsToPlaylists = function addSidxSegmentsToPlaylists(playlists, sidxMapping) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (!Object.keys(sidxMapping).length) { - return playlists; - } - - for (var i in playlists) { - playlists[i] = addSidxSegmentsToPlaylist$1(playlists[i], sidxMapping); - } - - return playlists; - }; - - var formatAudioPlaylist = function formatAudioPlaylist(_ref, isAudioOnly) { - var _attributes; - - var attributes = _ref.attributes, - segments = _ref.segments, - sidx = _ref.sidx; - var playlist = { - attributes: (_attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth, - CODECS: attributes.codecs - }, _attributes['PROGRAM-ID'] = 1, _attributes), - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - if (isAudioOnly) { - playlist.attributes.AUDIO = 'audio'; - playlist.attributes.SUBTITLES = 'subs'; - } - - return playlist; - }; - - var formatVttPlaylist = function formatVttPlaylist(_ref2) { - var _m3u8Attributes; - - var attributes = _ref2.attributes, - segments = _ref2.segments; - - if (typeof segments === 'undefined') { - // vtt tracks may use single file in BaseURL - segments = [{ - uri: attributes.baseUrl, - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - duration: attributes.sourceDuration, - number: 0 - }]; // targetDuration should be the same duration as the only segment - - attributes.duration = attributes.sourceDuration; - } - - var m3u8Attributes = (_m3u8Attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth - }, _m3u8Attributes['PROGRAM-ID'] = 1, _m3u8Attributes); - - if (attributes.codecs) { - m3u8Attributes.CODECS = attributes.codecs; - } - - return { - attributes: m3u8Attributes, - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - }; - - var organizeAudioPlaylists = function organizeAudioPlaylists(playlists, sidxMapping, isAudioOnly) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (isAudioOnly === void 0) { - isAudioOnly = false; - } - - var mainPlaylist; - var formattedPlaylists = playlists.reduce(function (a, playlist) { - var role = playlist.attributes.role && playlist.attributes.role.value || ''; - var language = playlist.attributes.lang || ''; - var label = playlist.attributes.label || 'main'; - - if (language && !playlist.attributes.label) { - var roleLabel = role ? " (" + role + ")" : ''; - label = "" + playlist.attributes.lang + roleLabel; - } - - if (!a[label]) { - a[label] = { - language: language, - autoselect: true, - default: role === 'main', - playlists: [], - uri: '' - }; - } - - var formatted = addSidxSegmentsToPlaylist$1(formatAudioPlaylist(playlist, isAudioOnly), sidxMapping); - a[label].playlists.push(formatted); - - if (typeof mainPlaylist === 'undefined' && role === 'main') { - mainPlaylist = playlist; - mainPlaylist.default = true; - } - - return a; - }, {}); // if no playlists have role "main", mark the first as main - - if (!mainPlaylist) { - var firstLabel = Object.keys(formattedPlaylists)[0]; - formattedPlaylists[firstLabel].default = true; - } - - return formattedPlaylists; - }; - - var organizeVttPlaylists = function organizeVttPlaylists(playlists, sidxMapping) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - return playlists.reduce(function (a, playlist) { - var label = playlist.attributes.lang || 'text'; - - if (!a[label]) { - a[label] = { - language: label, - default: false, - autoselect: false, - playlists: [], - uri: '' - }; - } - - a[label].playlists.push(addSidxSegmentsToPlaylist$1(formatVttPlaylist(playlist), sidxMapping)); - return a; - }, {}); - }; - - var organizeCaptionServices = function organizeCaptionServices(captionServices) { - return captionServices.reduce(function (svcObj, svc) { - if (!svc) { - return svcObj; - } - - svc.forEach(function (service) { - var channel = service.channel, - language = service.language; - svcObj[language] = { - autoselect: false, - default: false, - instreamId: channel, - language: language - }; - - if (service.hasOwnProperty('aspectRatio')) { - svcObj[language].aspectRatio = service.aspectRatio; - } - - if (service.hasOwnProperty('easyReader')) { - svcObj[language].easyReader = service.easyReader; - } - - if (service.hasOwnProperty('3D')) { - svcObj[language]['3D'] = service['3D']; - } - }); - return svcObj; - }, {}); - }; - - var formatVideoPlaylist = function formatVideoPlaylist(_ref3) { - var _attributes2; - - var attributes = _ref3.attributes, - segments = _ref3.segments, - sidx = _ref3.sidx; - var playlist = { - attributes: (_attributes2 = { - NAME: attributes.id, - AUDIO: 'audio', - SUBTITLES: 'subs', - RESOLUTION: { - width: attributes.width, - height: attributes.height - }, - CODECS: attributes.codecs, - BANDWIDTH: attributes.bandwidth - }, _attributes2['PROGRAM-ID'] = 1, _attributes2), - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - return playlist; - }; - - var videoOnly = function videoOnly(_ref4) { - var attributes = _ref4.attributes; - return attributes.mimeType === 'video/mp4' || attributes.mimeType === 'video/webm' || attributes.contentType === 'video'; - }; - - var audioOnly = function audioOnly(_ref5) { - var attributes = _ref5.attributes; - return attributes.mimeType === 'audio/mp4' || attributes.mimeType === 'audio/webm' || attributes.contentType === 'audio'; - }; - - var vttOnly = function vttOnly(_ref6) { - var attributes = _ref6.attributes; - return attributes.mimeType === 'text/vtt' || attributes.contentType === 'text'; - }; - - var toM3u8 = function toM3u8(dashPlaylists, locations, sidxMapping) { - var _mediaGroups; - - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (!dashPlaylists.length) { - return {}; - } // grab all master attributes - - - var _dashPlaylists$0$attr = dashPlaylists[0].attributes, - duration = _dashPlaylists$0$attr.sourceDuration, - _dashPlaylists$0$attr2 = _dashPlaylists$0$attr.type, - type = _dashPlaylists$0$attr2 === void 0 ? 'static' : _dashPlaylists$0$attr2, - suggestedPresentationDelay = _dashPlaylists$0$attr.suggestedPresentationDelay, - minimumUpdatePeriod = _dashPlaylists$0$attr.minimumUpdatePeriod; - var videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist); - var audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly)); - var vttPlaylists = dashPlaylists.filter(vttOnly); - var captions = dashPlaylists.map(function (playlist) { - return playlist.attributes.captionServices; - }).filter(Boolean); - var master = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: (_mediaGroups = { - AUDIO: {}, - VIDEO: {} - }, _mediaGroups['CLOSED-CAPTIONS'] = {}, _mediaGroups.SUBTITLES = {}, _mediaGroups), - uri: '', - duration: duration, - playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping) - }; - - if (minimumUpdatePeriod >= 0) { - master.minimumUpdatePeriod = minimumUpdatePeriod * 1000; - } - - if (locations) { - master.locations = locations; - } - - if (type === 'dynamic') { - master.suggestedPresentationDelay = suggestedPresentationDelay; - } - - var isAudioOnly = master.playlists.length === 0; - - if (audioPlaylists.length) { - master.mediaGroups.AUDIO.audio = organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly); - } - - if (vttPlaylists.length) { - master.mediaGroups.SUBTITLES.subs = organizeVttPlaylists(vttPlaylists, sidxMapping); - } - - if (captions.length) { - master.mediaGroups['CLOSED-CAPTIONS'].cc = organizeCaptionServices(captions); - } - - return master; - }; - /** - * Calculates the R (repetition) value for a live stream (for the final segment - * in a manifest where the r value is negative 1) - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {number} time - * current time (typically the total time up until the final segment) - * @param {number} duration - * duration property for the given - * - * @return {number} - * R value to reach the end of the given period - */ - - - var getLiveRValue = function getLiveRValue(attributes, time, duration) { - var NOW = attributes.NOW, - clientOffset = attributes.clientOffset, - availabilityStartTime = attributes.availabilityStartTime, - _attributes$timescale = attributes.timescale, - timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale, - _attributes$start = attributes.start, - start = _attributes$start === void 0 ? 0 : _attributes$start, - _attributes$minimumUp = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp; - var now = (NOW + clientOffset) / 1000; - var periodStartWC = availabilityStartTime + start; - var periodEndWC = now + minimumUpdatePeriod; - var periodDuration = periodEndWC - periodStartWC; - return Math.ceil((periodDuration * timescale - time) / duration); - }; - /** - * Uses information provided by SegmentTemplate.SegmentTimeline to determine segment - * timing and duration - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]} segmentTimeline - * List of objects representing the attributes of each S element contained within - * - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - - var parseByTimeline = function parseByTimeline(attributes, segmentTimeline) { - var _attributes$type = attributes.type, - type = _attributes$type === void 0 ? 'static' : _attributes$type, - _attributes$minimumUp2 = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp2 === void 0 ? 0 : _attributes$minimumUp2, - _attributes$media = attributes.media, - media = _attributes$media === void 0 ? '' : _attributes$media, - sourceDuration = attributes.sourceDuration, - _attributes$timescale2 = attributes.timescale, - timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, - _attributes$startNumb = attributes.startNumber, - startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb, - timeline = attributes.periodIndex; - var segments = []; - var time = -1; - - for (var sIndex = 0; sIndex < segmentTimeline.length; sIndex++) { - var S = segmentTimeline[sIndex]; - var duration = S.d; - var repeat = S.r || 0; - var segmentTime = S.t || 0; - - if (time < 0) { - // first segment - time = segmentTime; - } - - if (segmentTime && segmentTime > time) { - // discontinuity - // TODO: How to handle this type of discontinuity - // timeline++ here would treat it like HLS discontuity and content would - // get appended without gap - // E.G. - // - // - // - // - // would have $Time$ values of [0, 1, 2, 5] - // should this be appened at time positions [0, 1, 2, 3],(#EXT-X-DISCONTINUITY) - // or [0, 1, 2, gap, gap, 5]? (#EXT-X-GAP) - // does the value of sourceDuration consider this when calculating arbitrary - // negative @r repeat value? - // E.G. Same elements as above with this added at the end - // - // with a sourceDuration of 10 - // Would the 2 gaps be included in the time duration calculations resulting in - // 8 segments with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9] or 10 segments - // with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9, 10, 11] ? - time = segmentTime; - } - - var count = void 0; - - if (repeat < 0) { - var nextS = sIndex + 1; - - if (nextS === segmentTimeline.length) { - // last segment - if (type === 'dynamic' && minimumUpdatePeriod > 0 && media.indexOf('$Number$') > 0) { - count = getLiveRValue(attributes, time, duration); - } else { - // TODO: This may be incorrect depending on conclusion of TODO above - count = (sourceDuration * timescale - time) / duration; - } - } else { - count = (segmentTimeline[nextS].t - time) / duration; - } - } else { - count = repeat + 1; - } - - var end = startNumber + segments.length + count; - var number = startNumber + segments.length; - - while (number < end) { - segments.push({ - number: number, - duration: duration / timescale, - time: time, - timeline: timeline - }); - time += duration; - number++; - } - } - - return segments; - }; - - var identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g; - /** - * Replaces template identifiers with corresponding values. To be used as the callback - * for String.prototype.replace - * - * @name replaceCallback - * @function - * @param {string} match - * Entire match of identifier - * @param {string} identifier - * Name of matched identifier - * @param {string} format - * Format tag string. Its presence indicates that padding is expected - * @param {string} width - * Desired length of the replaced value. Values less than this width shall be left - * zero padded - * @return {string} - * Replacement for the matched identifier - */ - - /** - * Returns a function to be used as a callback for String.prototype.replace to replace - * template identifiers - * - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {replaceCallback} - * Callback to be used with String.prototype.replace to replace identifiers - */ - - var identifierReplacement = function identifierReplacement(values) { - return function (match, identifier, format, width) { - if (match === '$$') { - // escape sequence - return '$'; - } - - if (typeof values[identifier] === 'undefined') { - return match; - } - - var value = '' + values[identifier]; - - if (identifier === 'RepresentationID') { - // Format tag shall not be present with RepresentationID - return value; - } - - if (!format) { - width = 1; - } else { - width = parseInt(width, 10); - } - - if (value.length >= width) { - return value; - } - - return "" + new Array(width - value.length + 1).join('0') + value; - }; - }; - /** - * Constructs a segment url from a template string - * - * @param {string} url - * Template string to construct url from - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {string} - * Segment url with identifiers replaced - */ - - - var constructTemplateUrl = function constructTemplateUrl(url, values) { - return url.replace(identifierPattern, identifierReplacement(values)); - }; - /** - * Generates a list of objects containing timing and duration information about each - * segment needed to generate segment uris and the complete segment object - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - - var parseTemplateInfo = function parseTemplateInfo(attributes, segmentTimeline) { - if (!attributes.duration && !segmentTimeline) { - // if neither @duration or SegmentTimeline are present, then there shall be exactly - // one media segment - return [{ - number: attributes.startNumber || 1, - duration: attributes.sourceDuration, - time: 0, - timeline: attributes.periodIndex - }]; - } - - if (attributes.duration) { - return parseByDuration(attributes); - } - - return parseByTimeline(attributes, segmentTimeline); - }; - /** - * Generates a list of segments using information provided by the SegmentTemplate element - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object[]} - * List of segment objects - */ - - - var segmentsFromTemplate = function segmentsFromTemplate(attributes, segmentTimeline) { - var templateValues = { - RepresentationID: attributes.id, - Bandwidth: attributes.bandwidth || 0 - }; - var _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? { - sourceURL: '', - range: '' - } : _attributes$initializ; - var mapSegment = urlTypeToSegment({ - baseUrl: attributes.baseUrl, - source: constructTemplateUrl(initialization.sourceURL, templateValues), - range: initialization.range - }); - var segments = parseTemplateInfo(attributes, segmentTimeline); - return segments.map(function (segment) { - templateValues.Number = segment.number; - templateValues.Time = segment.time; - var uri = constructTemplateUrl(attributes.media || '', templateValues); - var map = { - uri: uri, - timeline: segment.timeline, - duration: segment.duration, - resolvedUri: resolveUrl$1(attributes.baseUrl || '', uri), - map: mapSegment, - number: segment.number - }; - - if (attributes.presentationTimeOffset) { - map.presentationTimeOffset = attributes.presentationTimeOffset; - } - - return map; - }); - }; - /** - * Converts a (of type URLType from the DASH spec 5.3.9.2 Table 14) - * to an object that matches the output of a segment in videojs/mpd-parser - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object} segmentUrl - * node to translate into a segment object - * @return {Object} translated segment object - */ - - - var SegmentURLToSegmentObject = function SegmentURLToSegmentObject(attributes, segmentUrl) { - var baseUrl = attributes.baseUrl, - _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ; - var initSegment = urlTypeToSegment({ - baseUrl: baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - var segment = urlTypeToSegment({ - baseUrl: baseUrl, - source: segmentUrl.media, - range: segmentUrl.mediaRange - }); - segment.map = initSegment; - return segment; - }; - /** - * Generates a list of segments using information provided by the SegmentList element - * SegmentList (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object.} list of segments - */ - - - var segmentsFromList = function segmentsFromList(attributes, segmentTimeline) { - var duration = attributes.duration, - _attributes$segmentUr = attributes.segmentUrls, - segmentUrls = _attributes$segmentUr === void 0 ? [] : _attributes$segmentUr; // Per spec (5.3.9.2.1) no way to determine segment duration OR - // if both SegmentTimeline and @duration are defined, it is outside of spec. - - if (!duration && !segmentTimeline || duration && segmentTimeline) { - throw new Error(errors.SEGMENT_TIME_UNSPECIFIED); - } - - var segmentUrlMap = segmentUrls.map(function (segmentUrlObject) { - return SegmentURLToSegmentObject(attributes, segmentUrlObject); - }); - var segmentTimeInfo; - - if (duration) { - segmentTimeInfo = parseByDuration(attributes); - } - - if (segmentTimeline) { - segmentTimeInfo = parseByTimeline(attributes, segmentTimeline); - } - - var segments = segmentTimeInfo.map(function (segmentTime, index) { - if (segmentUrlMap[index]) { - var segment = segmentUrlMap[index]; - segment.timeline = segmentTime.timeline; - segment.duration = segmentTime.duration; - segment.number = segmentTime.number; - return segment; - } // Since we're mapping we should get rid of any blank segments (in case - // the given SegmentTimeline is handling for more elements than we have - // SegmentURLs for). - - }).filter(function (segment) { - return segment; - }); - return segments; - }; - - var generateSegments = function generateSegments(_ref) { - var attributes = _ref.attributes, - segmentInfo = _ref.segmentInfo; - var segmentAttributes; - var segmentsFn; - - if (segmentInfo.template) { - segmentsFn = segmentsFromTemplate; - segmentAttributes = merge(attributes, segmentInfo.template); - - if (segmentInfo.template.presentationTimeOffset) { - segmentAttributes.presentationTimeOffset = segmentInfo.template.presentationTimeOffset / segmentInfo.template.timescale; - } - } else if (segmentInfo.base) { - segmentsFn = segmentsFromBase; - segmentAttributes = merge(attributes, segmentInfo.base); - } else if (segmentInfo.list) { - segmentsFn = segmentsFromList; - segmentAttributes = merge(attributes, segmentInfo.list); - } - - var segmentsInfo = { - attributes: attributes - }; - - if (!segmentsFn) { - return segmentsInfo; - } - - var segments = segmentsFn(segmentAttributes, segmentInfo.timeline); // The @duration attribute will be used to determin the playlist's targetDuration which - // must be in seconds. Since we've generated the segment list, we no longer need - // @duration to be in @timescale units, so we can convert it here. - - if (segmentAttributes.duration) { - var _segmentAttributes = segmentAttributes, - duration = _segmentAttributes.duration, - _segmentAttributes$ti = _segmentAttributes.timescale, - timescale = _segmentAttributes$ti === void 0 ? 1 : _segmentAttributes$ti; - segmentAttributes.duration = duration / timescale; - } else if (segments.length) { - // if there is no @duration attribute, use the largest segment duration as - // as target duration - segmentAttributes.duration = segments.reduce(function (max, segment) { - return Math.max(max, Math.ceil(segment.duration)); - }, 0); - } else { - segmentAttributes.duration = 0; - } - - segmentsInfo.attributes = segmentAttributes; - segmentsInfo.segments = segments; // This is a sidx box without actual segment information - - if (segmentInfo.base && segmentAttributes.indexRange) { - segmentsInfo.sidx = segments[0]; - segmentsInfo.segments = []; - } - - return segmentsInfo; - }; - - var toPlaylists = function toPlaylists(representations) { - return representations.map(generateSegments); - }; - - var findChildren = function findChildren(element, name) { - return from(element.childNodes).filter(function (_ref) { - var tagName = _ref.tagName; - return tagName === name; - }); - }; - - var getContent = function getContent(element) { - return element.textContent.trim(); - }; - - var parseDuration = function parseDuration(str) { - var SECONDS_IN_YEAR = 365 * 24 * 60 * 60; - var SECONDS_IN_MONTH = 30 * 24 * 60 * 60; - var SECONDS_IN_DAY = 24 * 60 * 60; - var SECONDS_IN_HOUR = 60 * 60; - var SECONDS_IN_MIN = 60; // P10Y10M10DT10H10M10.1S - - var durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/; - var match = durationRegex.exec(str); - - if (!match) { - return 0; - } - - var _match$slice = match.slice(1), - year = _match$slice[0], - month = _match$slice[1], - day = _match$slice[2], - hour = _match$slice[3], - minute = _match$slice[4], - second = _match$slice[5]; - - return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0); - }; - - var parseDate = function parseDate(str) { - // Date format without timezone according to ISO 8601 - // YYY-MM-DDThh:mm:ss.ssssss - var dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/; // If the date string does not specifiy a timezone, we must specifiy UTC. This is - // expressed by ending with 'Z' - - if (dateRegex.test(str)) { - str += 'Z'; - } - - return Date.parse(str); - }; - - var parsers = { - /** - * Specifies the duration of the entire Media Presentation. Format is a duration string - * as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - mediaPresentationDuration: function mediaPresentationDuration(value) { - return parseDuration(value); - }, - - /** - * Specifies the Segment availability start time for all Segments referred to in this - * MPD. For a dynamic manifest, it specifies the anchor for the earliest availability - * time. Format is a date string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The date as seconds from unix epoch - */ - availabilityStartTime: function availabilityStartTime(value) { - return parseDate(value) / 1000; - }, - - /** - * Specifies the smallest period between potential changes to the MPD. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - minimumUpdatePeriod: function minimumUpdatePeriod(value) { - return parseDuration(value); - }, - - /** - * Specifies the suggested presentation delay. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - suggestedPresentationDelay: function suggestedPresentationDelay(value) { - return parseDuration(value); - }, - - /** - * specifices the type of mpd. Can be either "static" or "dynamic" - * - * @param {string} value - * value of attribute as a string - * - * @return {string} - * The type as a string - */ - type: function type(value) { - return value; - }, - - /** - * Specifies the duration of the smallest time shifting buffer for any Representation - * in the MPD. Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - timeShiftBufferDepth: function timeShiftBufferDepth(value) { - return parseDuration(value); - }, - - /** - * Specifies the PeriodStart time of the Period relative to the availabilityStarttime. - * Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - start: function start(value) { - return parseDuration(value); - }, - - /** - * Specifies the width of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed width - */ - width: function width(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the height of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed height - */ - height: function height(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the bitrate of the representation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed bandwidth - */ - bandwidth: function bandwidth(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the number of the first Media Segment in this Representation in the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - startNumber: function startNumber(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the timescale in units per seconds - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed timescale - */ - timescale: function timescale(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the presentationTimeOffset. - * - * @param {string} value - * value of the attribute as a string - * - * @return {number} - * The parsed presentationTimeOffset - */ - presentationTimeOffset: function presentationTimeOffset(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the constant approximate Segment duration - * NOTE: The element also contains an @duration attribute. This duration - * specifies the duration of the Period. This attribute is currently not - * supported by the rest of the parser, however we still check for it to prevent - * errors. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - duration: function duration(value) { - var parsedValue = parseInt(value, 10); - - if (isNaN(parsedValue)) { - return parseDuration(value); - } - - return parsedValue; - }, - - /** - * Specifies the Segment duration, in units of the value of the @timescale. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - d: function d(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the MPD start time, in @timescale units, the first Segment in the series - * starts relative to the beginning of the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed time - */ - t: function t(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the repeat count of the number of following contiguous Segments with the - * same duration expressed by the value of @d - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - r: function r(value) { - return parseInt(value, 10); - }, - - /** - * Default parser for all other attributes. Acts as a no-op and just returns the value - * as a string - * - * @param {string} value - * value of attribute as a string - * @return {string} - * Unparsed value - */ - DEFAULT: function DEFAULT(value) { - return value; - } - }; - /** - * Gets all the attributes and values of the provided node, parses attributes with known - * types, and returns an object with attribute names mapped to values. - * - * @param {Node} el - * The node to parse attributes from - * @return {Object} - * Object with all attributes of el parsed - */ - - var parseAttributes = function parseAttributes(el) { - if (!(el && el.attributes)) { - return {}; - } - - return from(el.attributes).reduce(function (a, e) { - var parseFn = parsers[e.name] || parsers.DEFAULT; - a[e.name] = parseFn(e.value); - return a; - }, {}); - }; - - var keySystemsMap = { - 'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b': 'org.w3.clearkey', - 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed': 'com.widevine.alpha', - 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95': 'com.microsoft.playready', - 'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime' - }; - /** - * Builds a list of urls that is the product of the reference urls and BaseURL values - * - * @param {string[]} referenceUrls - * List of reference urls to resolve to - * @param {Node[]} baseUrlElements - * List of BaseURL nodes from the mpd - * @return {string[]} - * List of resolved urls - */ - - var buildBaseUrls = function buildBaseUrls(referenceUrls, baseUrlElements) { - if (!baseUrlElements.length) { - return referenceUrls; - } - - return flatten(referenceUrls.map(function (reference) { - return baseUrlElements.map(function (baseUrlElement) { - return resolveUrl$1(reference, getContent(baseUrlElement)); - }); - })); - }; - /** - * Contains all Segment information for its containing AdaptationSet - * - * @typedef {Object} SegmentInformation - * @property {Object|undefined} template - * Contains the attributes for the SegmentTemplate node - * @property {Object[]|undefined} timeline - * Contains a list of atrributes for each S node within the SegmentTimeline node - * @property {Object|undefined} list - * Contains the attributes for the SegmentList node - * @property {Object|undefined} base - * Contains the attributes for the SegmentBase node - */ - - /** - * Returns all available Segment information contained within the AdaptationSet node - * - * @param {Node} adaptationSet - * The AdaptationSet node to get Segment information from - * @return {SegmentInformation} - * The Segment information contained within the provided AdaptationSet - */ - - - var getSegmentInformation = function getSegmentInformation(adaptationSet) { - var segmentTemplate = findChildren(adaptationSet, 'SegmentTemplate')[0]; - var segmentList = findChildren(adaptationSet, 'SegmentList')[0]; - var segmentUrls = segmentList && findChildren(segmentList, 'SegmentURL').map(function (s) { - return merge({ - tag: 'SegmentURL' - }, parseAttributes(s)); - }); - var segmentBase = findChildren(adaptationSet, 'SegmentBase')[0]; - var segmentTimelineParentNode = segmentList || segmentTemplate; - var segmentTimeline = segmentTimelineParentNode && findChildren(segmentTimelineParentNode, 'SegmentTimeline')[0]; - var segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate; - var segmentInitialization = segmentInitializationParentNode && findChildren(segmentInitializationParentNode, 'Initialization')[0]; // SegmentTemplate is handled slightly differently, since it can have both - // @initialization and an node. @initialization can be templated, - // while the node can have a url and range specified. If the has - // both @initialization and an subelement we opt to override with - // the node, as this interaction is not defined in the spec. - - var template = segmentTemplate && parseAttributes(segmentTemplate); - - if (template && segmentInitialization) { - template.initialization = segmentInitialization && parseAttributes(segmentInitialization); - } else if (template && template.initialization) { - // If it is @initialization we convert it to an object since this is the format that - // later functions will rely on for the initialization segment. This is only valid - // for - template.initialization = { - sourceURL: template.initialization - }; - } - - var segmentInfo = { - template: template, - timeline: segmentTimeline && findChildren(segmentTimeline, 'S').map(function (s) { - return parseAttributes(s); - }), - list: segmentList && merge(parseAttributes(segmentList), { - segmentUrls: segmentUrls, - initialization: parseAttributes(segmentInitialization) - }), - base: segmentBase && merge(parseAttributes(segmentBase), { - initialization: parseAttributes(segmentInitialization) - }) - }; - Object.keys(segmentInfo).forEach(function (key) { - if (!segmentInfo[key]) { - delete segmentInfo[key]; - } - }); - return segmentInfo; - }; - /** - * Contains Segment information and attributes needed to construct a Playlist object - * from a Representation - * - * @typedef {Object} RepresentationInformation - * @property {SegmentInformation} segmentInfo - * Segment information for this Representation - * @property {Object} attributes - * Inherited attributes for this Representation - */ - - /** - * Maps a Representation node to an object containing Segment information and attributes - * - * @name inheritBaseUrlsCallback - * @function - * @param {Node} representation - * Representation node from the mpd - * @return {RepresentationInformation} - * Representation information needed to construct a Playlist object - */ - - /** - * Returns a callback for Array.prototype.map for mapping Representation nodes to - * Segment information and attributes using inherited BaseURL nodes. - * - * @param {Object} adaptationSetAttributes - * Contains attributes inherited by the AdaptationSet - * @param {string[]} adaptationSetBaseUrls - * Contains list of resolved base urls inherited by the AdaptationSet - * @param {SegmentInformation} adaptationSetSegmentInfo - * Contains Segment information for the AdaptationSet - * @return {inheritBaseUrlsCallback} - * Callback map function - */ - - - var inheritBaseUrls = function inheritBaseUrls(adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) { - return function (representation) { - var repBaseUrlElements = findChildren(representation, 'BaseURL'); - var repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements); - var attributes = merge(adaptationSetAttributes, parseAttributes(representation)); - var representationSegmentInfo = getSegmentInformation(representation); - return repBaseUrls.map(function (baseUrl) { - return { - segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo), - attributes: merge(attributes, { - baseUrl: baseUrl - }) - }; - }); - }; - }; - /** - * Tranforms a series of content protection nodes to - * an object containing pssh data by key system - * - * @param {Node[]} contentProtectionNodes - * Content protection nodes - * @return {Object} - * Object containing pssh data by key system - */ - - - var generateKeySystemInformation = function generateKeySystemInformation(contentProtectionNodes) { - return contentProtectionNodes.reduce(function (acc, node) { - var attributes = parseAttributes(node); - var keySystem = keySystemsMap[attributes.schemeIdUri]; - - if (keySystem) { - acc[keySystem] = { - attributes: attributes - }; - var psshNode = findChildren(node, 'cenc:pssh')[0]; - - if (psshNode) { - var pssh = getContent(psshNode); - var psshBuffer = pssh && decodeB64ToUint8Array(pssh); - acc[keySystem].pssh = psshBuffer; - } - } - - return acc; - }, {}); - }; // defined in ANSI_SCTE 214-1 2016 - - - var parseCaptionServiceMetadata = function parseCaptionServiceMetadata(service) { - // 608 captions - if (service.schemeIdUri === 'urn:scte:dash:cc:cea-608:2015') { - var values = service.value.split(';'); - return values.map(function (value) { - var channel; - var language; // default language to value - - language = value; - - if (/^CC\d=/.test(value)) { - var _value$split = value.split('='); - - channel = _value$split[0]; - language = _value$split[1]; - } else if (/^CC\d$/.test(value)) { - channel = value; - } - - return { - channel: channel, - language: language - }; - }); - } else if (service.schemeIdUri === 'urn:scte:dash:cc:cea-708:2015') { - var _values = service.value.split(';'); - - return _values.map(function (value) { - var flags = { - // service or channel number 1-63 - 'channel': undefined, - // language is a 3ALPHA per ISO 639.2/B - // field is required - 'language': undefined, - // BIT 1/0 or ? - // default value is 1, meaning 16:9 aspect ratio, 0 is 4:3, ? is unknown - 'aspectRatio': 1, - // BIT 1/0 - // easy reader flag indicated the text is tailed to the needs of beginning readers - // default 0, or off - 'easyReader': 0, - // BIT 1/0 - // If 3d metadata is present (CEA-708.1) then 1 - // default 0 - '3D': 0 - }; - - if (/=/.test(value)) { - var _value$split2 = value.split('='), - channel = _value$split2[0], - _value$split2$ = _value$split2[1], - opts = _value$split2$ === void 0 ? '' : _value$split2$; - - flags.channel = channel; - flags.language = value; - opts.split(',').forEach(function (opt) { - var _opt$split = opt.split(':'), - name = _opt$split[0], - val = _opt$split[1]; - - if (name === 'lang') { - flags.language = val; // er for easyReadery - } else if (name === 'er') { - flags.easyReader = Number(val); // war for wide aspect ratio - } else if (name === 'war') { - flags.aspectRatio = Number(val); - } else if (name === '3D') { - flags['3D'] = Number(val); - } - }); - } else { - flags.language = value; - } - - if (flags.channel) { - flags.channel = 'SERVICE' + flags.channel; - } - - return flags; - }); - } - }; - /** - * Maps an AdaptationSet node to a list of Representation information objects - * - * @name toRepresentationsCallback - * @function - * @param {Node} adaptationSet - * AdaptationSet node from the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - - /** - * Returns a callback for Array.prototype.map for mapping AdaptationSet nodes to a list of - * Representation information objects - * - * @param {Object} periodAttributes - * Contains attributes inherited by the Period - * @param {string[]} periodBaseUrls - * Contains list of resolved base urls inherited by the Period - * @param {string[]} periodSegmentInfo - * Contains Segment Information at the period level - * @return {toRepresentationsCallback} - * Callback map function - */ - - - var toRepresentations = function toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo) { - return function (adaptationSet) { - var adaptationSetAttributes = parseAttributes(adaptationSet); - var adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls, findChildren(adaptationSet, 'BaseURL')); - var role = findChildren(adaptationSet, 'Role')[0]; - var roleAttributes = { - role: parseAttributes(role) - }; - var attrs = merge(periodAttributes, adaptationSetAttributes, roleAttributes); - var accessibility = findChildren(adaptationSet, 'Accessibility')[0]; - var captionServices = parseCaptionServiceMetadata(parseAttributes(accessibility)); - - if (captionServices) { - attrs = merge(attrs, { - captionServices: captionServices - }); - } - - var label = findChildren(adaptationSet, 'Label')[0]; - - if (label && label.childNodes.length) { - var labelVal = label.childNodes[0].nodeValue.trim(); - attrs = merge(attrs, { - label: labelVal - }); - } - - var contentProtection = generateKeySystemInformation(findChildren(adaptationSet, 'ContentProtection')); - - if (Object.keys(contentProtection).length) { - attrs = merge(attrs, { - contentProtection: contentProtection - }); - } - - var segmentInfo = getSegmentInformation(adaptationSet); - var representations = findChildren(adaptationSet, 'Representation'); - var adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo); - return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo))); - }; - }; - /** - * Maps an Period node to a list of Representation inforamtion objects for all - * AdaptationSet nodes contained within the Period - * - * @name toAdaptationSetsCallback - * @function - * @param {Node} period - * Period node from the mpd - * @param {number} periodIndex - * Index of the Period within the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - - /** - * Returns a callback for Array.prototype.map for mapping Period nodes to a list of - * Representation information objects - * - * @param {Object} mpdAttributes - * Contains attributes inherited by the mpd - * @param {string[]} mpdBaseUrls - * Contains list of resolved base urls inherited by the mpd - * @return {toAdaptationSetsCallback} - * Callback map function - */ - - - var toAdaptationSets = function toAdaptationSets(mpdAttributes, mpdBaseUrls) { - return function (period, index) { - var periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period, 'BaseURL')); - var periodAtt = parseAttributes(period); - var parsedPeriodId = parseInt(periodAtt.id, 10); // fallback to mapping index if Period@id is not a number - - var periodIndex = window__default['default'].isNaN(parsedPeriodId) ? index : parsedPeriodId; - var periodAttributes = merge(mpdAttributes, { - periodIndex: periodIndex - }); - var adaptationSets = findChildren(period, 'AdaptationSet'); - var periodSegmentInfo = getSegmentInformation(period); - return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo))); - }; - }; - /** - * Traverses the mpd xml tree to generate a list of Representation information objects - * that have inherited attributes from parent nodes - * - * @param {Node} mpd - * The root node of the mpd - * @param {Object} options - * Available options for inheritAttributes - * @param {string} options.manifestUri - * The uri source of the mpd - * @param {number} options.NOW - * Current time per DASH IOP. Default is current time in ms since epoch - * @param {number} options.clientOffset - * Client time difference from NOW (in milliseconds) - * @return {RepresentationInformation[]} - * List of objects containing Representation information - */ - - - var inheritAttributes = function inheritAttributes(mpd, options) { - if (options === void 0) { - options = {}; - } - - var _options = options, - _options$manifestUri = _options.manifestUri, - manifestUri = _options$manifestUri === void 0 ? '' : _options$manifestUri, - _options$NOW = _options.NOW, - NOW = _options$NOW === void 0 ? Date.now() : _options$NOW, - _options$clientOffset = _options.clientOffset, - clientOffset = _options$clientOffset === void 0 ? 0 : _options$clientOffset; - var periods = findChildren(mpd, 'Period'); - - if (!periods.length) { - throw new Error(errors.INVALID_NUMBER_OF_PERIOD); - } - - var locations = findChildren(mpd, 'Location'); - var mpdAttributes = parseAttributes(mpd); - var mpdBaseUrls = buildBaseUrls([manifestUri], findChildren(mpd, 'BaseURL')); - mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0; - mpdAttributes.NOW = NOW; - mpdAttributes.clientOffset = clientOffset; - - if (locations.length) { - mpdAttributes.locations = locations.map(getContent); - } - - return { - locations: mpdAttributes.locations, - representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls))) - }; - }; - - var stringToMpdXml = function stringToMpdXml(manifestString) { - if (manifestString === '') { - throw new Error(errors.DASH_EMPTY_MANIFEST); - } - - var parser = new xmldom.DOMParser(); - var xml; - var mpd; - - try { - xml = parser.parseFromString(manifestString, 'application/xml'); - mpd = xml && xml.documentElement.tagName === 'MPD' ? xml.documentElement : null; - } catch (e) {// ie 11 throwsw on invalid xml - } - - if (!mpd || mpd && mpd.getElementsByTagName('parsererror').length > 0) { - throw new Error(errors.DASH_INVALID_XML); - } - - return mpd; - }; - /** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} mpd - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ - - - var parseUTCTimingScheme = function parseUTCTimingScheme(mpd) { - var UTCTimingNode = findChildren(mpd, 'UTCTiming')[0]; - - if (!UTCTimingNode) { - return null; - } - - var attributes = parseAttributes(UTCTimingNode); - - switch (attributes.schemeIdUri) { - case 'urn:mpeg:dash:utc:http-head:2014': - case 'urn:mpeg:dash:utc:http-head:2012': - attributes.method = 'HEAD'; - break; - - case 'urn:mpeg:dash:utc:http-xsdate:2014': - case 'urn:mpeg:dash:utc:http-iso:2014': - case 'urn:mpeg:dash:utc:http-xsdate:2012': - case 'urn:mpeg:dash:utc:http-iso:2012': - attributes.method = 'GET'; - break; - - case 'urn:mpeg:dash:utc:direct:2014': - case 'urn:mpeg:dash:utc:direct:2012': - attributes.method = 'DIRECT'; - attributes.value = Date.parse(attributes.value); - break; - - case 'urn:mpeg:dash:utc:http-ntp:2014': - case 'urn:mpeg:dash:utc:ntp:2014': - case 'urn:mpeg:dash:utc:sntp:2014': - default: - throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME); - } - - return attributes; - }; - - var parse = function parse(manifestString, options) { - if (options === void 0) { - options = {}; - } - - var parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options); - var playlists = toPlaylists(parsedManifestInfo.representationInfo); - return toM3u8(playlists, parsedManifestInfo.locations, options.sidxMapping); - }; - /** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} manifestString - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ - - - var parseUTCTiming = function parseUTCTiming(manifestString) { - return parseUTCTimingScheme(stringToMpdXml(manifestString)); - }; - - var MAX_UINT32 = Math.pow(2, 32); - - var parseSidx = function parseSidx(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - references: [], - referenceId: view.getUint32(4), - timescale: view.getUint32(8) - }, - i = 12; - - if (result.version === 0) { - result.earliestPresentationTime = view.getUint32(i); - result.firstOffset = view.getUint32(i + 4); - i += 8; - } else { - // read 64 bits - result.earliestPresentationTime = view.getUint32(i) * MAX_UINT32 + view.getUint32(i + 4); - result.firstOffset = view.getUint32(i + 8) * MAX_UINT32 + view.getUint32(i + 12); - i += 16; - } - - i += 2; // reserved - - var referenceCount = view.getUint16(i); - i += 2; // start of references - - for (; referenceCount > 0; i += 12, referenceCount--) { - result.references.push({ - referenceType: (data[i] & 0x80) >>> 7, - referencedSize: view.getUint32(i) & 0x7FFFFFFF, - subsegmentDuration: view.getUint32(i + 4), - startsWithSap: !!(data[i + 8] & 0x80), - sapType: (data[i + 8] & 0x70) >>> 4, - sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF - }); - } - - return result; - }; - - var parseSidx_1 = parseSidx; - - // we used to do this with log2 but BigInt does not support builtin math - // Math.ceil(log2(x)); - - - var countBits = function countBits(x) { - return x.toString(2).length; - }; // count the number of whole bytes it would take to represent a number - - var countBytes = function countBytes(x) { - return Math.ceil(countBits(x) / 8); - }; - var isTypedArray = function isTypedArray(obj) { - return ArrayBuffer.isView(obj); - }; - var toUint8 = function toUint8(bytes) { - if (bytes instanceof Uint8Array) { - return bytes; - } - - if (!Array.isArray(bytes) && !isTypedArray(bytes) && !(bytes instanceof ArrayBuffer)) { - // any non-number or NaN leads to empty uint8array - // eslint-disable-next-line - if (typeof bytes !== 'number' || typeof bytes === 'number' && bytes !== bytes) { - bytes = 0; - } else { - bytes = [bytes]; - } - } - - return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0); - }; - var BigInt = window__default['default'].BigInt || Number; - var BYTE_TABLE = [BigInt('0x1'), BigInt('0x100'), BigInt('0x10000'), BigInt('0x1000000'), BigInt('0x100000000'), BigInt('0x10000000000'), BigInt('0x1000000000000'), BigInt('0x100000000000000'), BigInt('0x10000000000000000')]; - var bytesToNumber = function bytesToNumber(bytes, _temp) { - var _ref = _temp === void 0 ? {} : _temp, - _ref$signed = _ref.signed, - signed = _ref$signed === void 0 ? false : _ref$signed, - _ref$le = _ref.le, - le = _ref$le === void 0 ? false : _ref$le; - - bytes = toUint8(bytes); - var fn = le ? 'reduce' : 'reduceRight'; - var obj = bytes[fn] ? bytes[fn] : Array.prototype[fn]; - var number = obj.call(bytes, function (total, byte, i) { - var exponent = le ? i : Math.abs(i + 1 - bytes.length); - return total + BigInt(byte) * BYTE_TABLE[exponent]; - }, BigInt(0)); - - if (signed) { - var max = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1); - number = BigInt(number); - - if (number > max) { - number -= max; - number -= max; - number -= BigInt(2); - } - } - - return Number(number); - }; - var numberToBytes = function numberToBytes(number, _temp2) { - var _ref2 = _temp2 === void 0 ? {} : _temp2, - _ref2$le = _ref2.le, - le = _ref2$le === void 0 ? false : _ref2$le; // eslint-disable-next-line - - - if (typeof number !== 'bigint' && typeof number !== 'number' || typeof number === 'number' && number !== number) { - number = 0; - } - - number = BigInt(number); - var byteCount = countBytes(number); - var bytes = new Uint8Array(new ArrayBuffer(byteCount)); - - for (var i = 0; i < byteCount; i++) { - var byteIndex = le ? i : Math.abs(i + 1 - bytes.length); - bytes[byteIndex] = Number(number / BYTE_TABLE[i] & BigInt(0xFF)); - - if (number < 0) { - bytes[byteIndex] = Math.abs(~bytes[byteIndex]); - bytes[byteIndex] -= i === 0 ? 1 : 2; - } - } - - return bytes; - }; - var stringToBytes = function stringToBytes(string, stringIsBytes) { - if (typeof string !== 'string' && string && typeof string.toString === 'function') { - string = string.toString(); - } - - if (typeof string !== 'string') { - return new Uint8Array(); - } // If the string already is bytes, we don't have to do this - // otherwise we do this so that we split multi length characters - // into individual bytes - - - if (!stringIsBytes) { - string = unescape(encodeURIComponent(string)); - } - - var view = new Uint8Array(string.length); - - for (var i = 0; i < string.length; i++) { - view[i] = string.charCodeAt(i); - } - - return view; - }; - var concatTypedArrays = function concatTypedArrays() { - for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) { - buffers[_key] = arguments[_key]; - } - - buffers = buffers.filter(function (b) { - return b && (b.byteLength || b.length) && typeof b !== 'string'; - }); - - if (buffers.length <= 1) { - // for 0 length we will return empty uint8 - // for 1 length we return the first uint8 - return toUint8(buffers[0]); - } - - var totalLen = buffers.reduce(function (total, buf, i) { - return total + (buf.byteLength || buf.length); - }, 0); - var tempBuffer = new Uint8Array(totalLen); - var offset = 0; - buffers.forEach(function (buf) { - buf = toUint8(buf); - tempBuffer.set(buf, offset); - offset += buf.byteLength; - }); - return tempBuffer; - }; - /** - * Check if the bytes "b" are contained within bytes "a". - * - * @param {Uint8Array|Array} a - * Bytes to check in - * - * @param {Uint8Array|Array} b - * Bytes to check for - * - * @param {Object} options - * options - * - * @param {Array|Uint8Array} [offset=0] - * offset to use when looking at bytes in a - * - * @param {Array|Uint8Array} [mask=[]] - * mask to use on bytes before comparison. - * - * @return {boolean} - * If all bytes in b are inside of a, taking into account - * bit masks. - */ - - var bytesMatch = function bytesMatch(a, b, _temp3) { - var _ref3 = _temp3 === void 0 ? {} : _temp3, - _ref3$offset = _ref3.offset, - offset = _ref3$offset === void 0 ? 0 : _ref3$offset, - _ref3$mask = _ref3.mask, - mask = _ref3$mask === void 0 ? [] : _ref3$mask; - - a = toUint8(a); - b = toUint8(b); // ie 11 does not support uint8 every - - var fn = b.every ? b.every : Array.prototype.every; - return b.length && a.length - offset >= b.length && // ie 11 doesn't support every on uin8 - fn.call(b, function (bByte, i) { - var aByte = mask[i] ? mask[i] & a[offset + i] : a[offset + i]; - return bByte === aByte; - }); - }; - - var ID3 = toUint8([0x49, 0x44, 0x33]); - var getId3Size = function getId3Size(bytes, offset) { - if (offset === void 0) { - offset = 0; - } - - bytes = toUint8(bytes); - var flags = bytes[offset + 5]; - var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9]; - var footerPresent = (flags & 16) >> 4; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - var getId3Offset = function getId3Offset(bytes, offset) { - if (offset === void 0) { - offset = 0; - } - - bytes = toUint8(bytes); - - if (bytes.length - offset < 10 || !bytesMatch(bytes, ID3, { - offset: offset - })) { - return offset; - } - - offset += getId3Size(bytes, offset); // recursive check for id3 tags as some files - // have multiple ID3 tag sections even though - // they should not. - - return getId3Offset(bytes, offset); - }; - - var normalizePath$1 = function normalizePath(path) { - if (typeof path === 'string') { - return stringToBytes(path); - } - - if (typeof path === 'number') { - return path; - } - - return path; - }; - - var normalizePaths$1 = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath$1(paths)]; - } - - return paths.map(function (p) { - return normalizePath$1(p); - }); - }; - /** - * find any number of boxes by name given a path to it in an iso bmff - * such as mp4. - * - * @param {TypedArray} bytes - * bytes for the iso bmff to search for boxes in - * - * @param {Uint8Array[]|string[]|string|Uint8Array} name - * An array of paths or a single path representing the name - * of boxes to search through in bytes. Paths may be - * uint8 (character codes) or strings. - * - * @param {boolean} [complete=false] - * Should we search only for complete boxes on the final path. - * This is very useful when you do not want to get back partial boxes - * in the case of streaming files. - * - * @return {Uint8Array[]} - * An array of the end paths that we found. - */ - - var findBox = function findBox(bytes, paths, complete) { - if (complete === void 0) { - complete = false; - } - - paths = normalizePaths$1(paths); - bytes = toUint8(bytes); - var results = []; - - if (!paths.length) { - // short-circuit the search for empty paths - return results; - } - - var i = 0; - - while (i < bytes.length) { - var size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0; - var type = bytes.subarray(i + 4, i + 8); // invalid box format. - - if (size === 0) { - break; - } - - var end = i + size; - - if (end > bytes.length) { - // this box is bigger than the number of bytes we have - // and complete is set, we cannot find any more boxes. - if (complete) { - break; - } - - end = bytes.length; - } - - var data = bytes.subarray(i + 8, end); - - if (bytesMatch(type, paths[0])) { - if (paths.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data); - } else { - // recursively search for the next box along the path - results.push.apply(results, findBox(data, paths.slice(1), complete)); - } - } - - i = end; - } // we've finished searching all of bytes - - - return results; - }; - - // https://matroska-org.github.io/libebml/specs.html - // https://www.matroska.org/technical/elements.html - // https://www.webmproject.org/docs/container/ - - var EBML_TAGS = { - EBML: toUint8([0x1A, 0x45, 0xDF, 0xA3]), - DocType: toUint8([0x42, 0x82]), - Segment: toUint8([0x18, 0x53, 0x80, 0x67]), - SegmentInfo: toUint8([0x15, 0x49, 0xA9, 0x66]), - Tracks: toUint8([0x16, 0x54, 0xAE, 0x6B]), - Track: toUint8([0xAE]), - TrackNumber: toUint8([0xd7]), - DefaultDuration: toUint8([0x23, 0xe3, 0x83]), - TrackEntry: toUint8([0xAE]), - TrackType: toUint8([0x83]), - FlagDefault: toUint8([0x88]), - CodecID: toUint8([0x86]), - CodecPrivate: toUint8([0x63, 0xA2]), - VideoTrack: toUint8([0xe0]), - AudioTrack: toUint8([0xe1]), - // Not used yet, but will be used for live webm/mkv - // see https://www.matroska.org/technical/basics.html#block-structure - // see https://www.matroska.org/technical/basics.html#simpleblock-structure - Cluster: toUint8([0x1F, 0x43, 0xB6, 0x75]), - Timestamp: toUint8([0xE7]), - TimestampScale: toUint8([0x2A, 0xD7, 0xB1]), - BlockGroup: toUint8([0xA0]), - BlockDuration: toUint8([0x9B]), - Block: toUint8([0xA1]), - SimpleBlock: toUint8([0xA3]) - }; - /** - * This is a simple table to determine the length - * of things in ebml. The length is one based (starts at 1, - * rather than zero) and for every zero bit before a one bit - * we add one to length. We also need this table because in some - * case we have to xor all the length bits from another value. - */ - - var LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1]; - - var getLength = function getLength(byte) { - var len = 1; - - for (var i = 0; i < LENGTH_TABLE.length; i++) { - if (byte & LENGTH_TABLE[i]) { - break; - } - - len++; - } - - return len; - }; // length in ebml is stored in the first 4 to 8 bits - // of the first byte. 4 for the id length and 8 for the - // data size length. Length is measured by converting the number to binary - // then 1 + the number of zeros before a 1 is encountered starting - // from the left. - - - var getvint = function getvint(bytes, offset, removeLength, signed) { - if (removeLength === void 0) { - removeLength = true; - } - - if (signed === void 0) { - signed = false; - } - - var length = getLength(bytes[offset]); - var valueBytes = bytes.subarray(offset, offset + length); // NOTE that we do **not** subarray here because we need to copy these bytes - // as they will be modified below to remove the dataSizeLen bits and we do not - // want to modify the original data. normally we could just call slice on - // uint8array but ie 11 does not support that... - - if (removeLength) { - valueBytes = Array.prototype.slice.call(bytes, offset, offset + length); - valueBytes[0] ^= LENGTH_TABLE[length - 1]; - } - - return { - length: length, - value: bytesToNumber(valueBytes, { - signed: signed - }), - bytes: valueBytes - }; - }; - - var normalizePath = function normalizePath(path) { - if (typeof path === 'string') { - return path.match(/.{1,2}/g).map(function (p) { - return normalizePath(p); - }); - } - - if (typeof path === 'number') { - return numberToBytes(path); - } - - return path; - }; - - var normalizePaths = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map(function (p) { - return normalizePath(p); - }); - }; - - var getInfinityDataSize = function getInfinityDataSize(id, bytes, offset) { - if (offset >= bytes.length) { - return bytes.length; - } - - var innerid = getvint(bytes, offset, false); - - if (bytesMatch(id.bytes, innerid.bytes)) { - return offset; - } - - var dataHeader = getvint(bytes, offset + innerid.length); - return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length); - }; - /** - * Notes on the EBLM format. - * - * EBLM uses "vints" tags. Every vint tag contains - * two parts - * - * 1. The length from the first byte. You get this by - * converting the byte to binary and counting the zeros - * before a 1. Then you add 1 to that. Examples - * 00011111 = length 4 because there are 3 zeros before a 1. - * 00100000 = length 3 because there are 2 zeros before a 1. - * 00000011 = length 7 because there are 6 zeros before a 1. - * - * 2. The bits used for length are removed from the first byte - * Then all the bytes are merged into a value. NOTE: this - * is not the case for id ebml tags as there id includes - * length bits. - * - */ - - - var findEbml = function findEbml(bytes, paths) { - paths = normalizePaths(paths); - bytes = toUint8(bytes); - var results = []; - - if (!paths.length) { - return results; - } - - var i = 0; - - while (i < bytes.length) { - var id = getvint(bytes, i, false); - var dataHeader = getvint(bytes, i + id.length); - var dataStart = i + id.length + dataHeader.length; // dataSize is unknown or this is a live stream - - if (dataHeader.value === 0x7f) { - dataHeader.value = getInfinityDataSize(id, bytes, dataStart); - - if (dataHeader.value !== bytes.length) { - dataHeader.value -= dataStart; - } - } - - var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value; - var data = bytes.subarray(dataStart, dataEnd); - - if (bytesMatch(paths[0], id.bytes)) { - if (paths.length === 1) { - // this is the end of the paths and we've found the tag we were - // looking for - results.push(data); - } else { - // recursively search for the next tag inside of the data - // of this one - results = results.concat(findEbml(data, paths.slice(1))); - } - } - - var totalLength = id.length + dataHeader.length + data.length; // move past this tag entirely, we are not looking for it - - i += totalLength; - } - - return results; - }; // see https://www.matroska.org/technical/basics.html#block-structure - - var NAL_TYPE_ONE = toUint8([0x00, 0x00, 0x00, 0x01]); - var NAL_TYPE_TWO = toUint8([0x00, 0x00, 0x01]); - var EMULATION_PREVENTION = toUint8([0x00, 0x00, 0x03]); - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(bytes) { - var positions = []; - var i = 1; // Find all `Emulation Prevention Bytes` - - while (i < bytes.length - 2) { - if (bytesMatch(bytes.subarray(i, i + 3), EMULATION_PREVENTION)) { - positions.push(i + 2); - i++; - } - - i++; - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (positions.length === 0) { - return bytes; - } // Create a new array to hold the NAL unit data - - - var newLength = bytes.length - positions.length; - var newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === positions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - positions.shift(); - } - - newData[i] = bytes[sourceIndex]; - } - - return newData; - }; - var findNal = function findNal(bytes, dataType, types, nalLimit) { - if (nalLimit === void 0) { - nalLimit = Infinity; - } - - bytes = toUint8(bytes); - types = [].concat(types); - var i = 0; - var nalStart; - var nalsFound = 0; // keep searching until: - // we reach the end of bytes - // we reach the maximum number of nals they want to seach - // NOTE: that we disregard nalLimit when we have found the start - // of the nal we want so that we can find the end of the nal we want. - - while (i < bytes.length && (nalsFound < nalLimit || nalStart)) { - var nalOffset = void 0; - - if (bytesMatch(bytes.subarray(i), NAL_TYPE_ONE)) { - nalOffset = 4; - } else if (bytesMatch(bytes.subarray(i), NAL_TYPE_TWO)) { - nalOffset = 3; - } // we are unsynced, - // find the next nal unit - - - if (!nalOffset) { - i++; - continue; - } - - nalsFound++; - - if (nalStart) { - return discardEmulationPreventionBytes(bytes.subarray(nalStart, i)); - } - - var nalType = void 0; - - if (dataType === 'h264') { - nalType = bytes[i + nalOffset] & 0x1f; - } else if (dataType === 'h265') { - nalType = bytes[i + nalOffset] >> 1 & 0x3f; - } - - if (types.indexOf(nalType) !== -1) { - nalStart = i + nalOffset; - } // nal header is 1 length for h264, and 2 for h265 - - - i += nalOffset + (dataType === 'h264' ? 1 : 2); - } - - return bytes.subarray(0, 0); - }; - var findH264Nal = function findH264Nal(bytes, type, nalLimit) { - return findNal(bytes, 'h264', type, nalLimit); - }; - var findH265Nal = function findH265Nal(bytes, type, nalLimit) { - return findNal(bytes, 'h265', type, nalLimit); - }; - - var CONSTANTS = { - // "webm" string literal in hex - 'webm': toUint8([0x77, 0x65, 0x62, 0x6d]), - // "matroska" string literal in hex - 'matroska': toUint8([0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61]), - // "fLaC" string literal in hex - 'flac': toUint8([0x66, 0x4c, 0x61, 0x43]), - // "OggS" string literal in hex - 'ogg': toUint8([0x4f, 0x67, 0x67, 0x53]), - // ac-3 sync byte, also works for ec-3 as that is simply a codec - // of ac-3 - 'ac3': toUint8([0x0b, 0x77]), - // "RIFF" string literal in hex used for wav and avi - 'riff': toUint8([0x52, 0x49, 0x46, 0x46]), - // "AVI" string literal in hex - 'avi': toUint8([0x41, 0x56, 0x49]), - // "WAVE" string literal in hex - 'wav': toUint8([0x57, 0x41, 0x56, 0x45]), - // "ftyp3g" string literal in hex - '3gp': toUint8([0x66, 0x74, 0x79, 0x70, 0x33, 0x67]), - // "ftyp" string literal in hex - 'mp4': toUint8([0x66, 0x74, 0x79, 0x70]), - // "styp" string literal in hex - 'fmp4': toUint8([0x73, 0x74, 0x79, 0x70]), - // "ftyp" string literal in hex - 'mov': toUint8([0x66, 0x74, 0x79, 0x70, 0x71, 0x74]) - }; - var _isLikely = { - aac: function aac(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, [0xFF, 0x10], { - offset: offset, - mask: [0xFF, 0x16] - }); - }, - mp3: function mp3(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, [0xFF, 0x02], { - offset: offset, - mask: [0xFF, 0x06] - }); - }, - webm: function webm(bytes) { - var docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is webm - - return bytesMatch(docType, CONSTANTS.webm); - }, - mkv: function mkv(bytes) { - var docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is matroska - - return bytesMatch(docType, CONSTANTS.matroska); - }, - mp4: function mp4(bytes) { - return !_isLikely['3gp'](bytes) && !_isLikely.mov(bytes) && (bytesMatch(bytes, CONSTANTS.mp4, { - offset: 4 - }) || bytesMatch(bytes, CONSTANTS.fmp4, { - offset: 4 - })); - }, - mov: function mov(bytes) { - return bytesMatch(bytes, CONSTANTS.mov, { - offset: 4 - }); - }, - '3gp': function gp(bytes) { - return bytesMatch(bytes, CONSTANTS['3gp'], { - offset: 4 - }); - }, - ac3: function ac3(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, CONSTANTS.ac3, { - offset: offset - }); - }, - ts: function ts(bytes) { - if (bytes.length < 189 && bytes.length >= 1) { - return bytes[0] === 0x47; - } - - var i = 0; // check the first 376 bytes for two matching sync bytes - - while (i + 188 < bytes.length && i < 188) { - if (bytes[i] === 0x47 && bytes[i + 188] === 0x47) { - return true; - } - - i += 1; - } - - return false; - }, - flac: function flac(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, CONSTANTS.flac, { - offset: offset - }); - }, - ogg: function ogg(bytes) { - return bytesMatch(bytes, CONSTANTS.ogg); - }, - avi: function avi(bytes) { - return bytesMatch(bytes, CONSTANTS.riff) && bytesMatch(bytes, CONSTANTS.avi, { - offset: 8 - }); - }, - wav: function wav(bytes) { - return bytesMatch(bytes, CONSTANTS.riff) && bytesMatch(bytes, CONSTANTS.wav, { - offset: 8 - }); - }, - 'h264': function h264(bytes) { - // find seq_parameter_set_rbsp - return findH264Nal(bytes, 7, 3).length; - }, - 'h265': function h265(bytes) { - // find video_parameter_set_rbsp or seq_parameter_set_rbsp - return findH265Nal(bytes, [32, 33], 3).length; - } - }; // get all the isLikely functions - // but make sure 'ts' is above h264 and h265 - // but below everything else as it is the least specific - - var isLikelyTypes = Object.keys(_isLikely) // remove ts, h264, h265 - .filter(function (t) { - return t !== 'ts' && t !== 'h264' && t !== 'h265'; - }) // add it back to the bottom - .concat(['ts', 'h264', 'h265']); // make sure we are dealing with uint8 data. - - isLikelyTypes.forEach(function (type) { - var isLikelyFn = _isLikely[type]; - - _isLikely[type] = function (bytes) { - return isLikelyFn(toUint8(bytes)); - }; - }); // export after wrapping - - var isLikely = _isLikely; // A useful list of file signatures can be found here - // https://en.wikipedia.org/wiki/List_of_file_signatures - - var detectContainerForBytes = function detectContainerForBytes(bytes) { - bytes = toUint8(bytes); - - for (var i = 0; i < isLikelyTypes.length; i++) { - var type = isLikelyTypes[i]; - - if (isLikely[type](bytes)) { - return type; - } - } - - return ''; - }; // fmp4 is not a container - - var isLikelyFmp4MediaSegment = function isLikelyFmp4MediaSegment(bytes) { - return findBox(bytes, ['moof']).length > 0; - }; - - // which will only happen if the request is complete. - - var callbackOnCompleted = function callbackOnCompleted(request, cb) { - if (request.readyState === 4) { - return cb(); - } - - return; - }; - - var containerRequest = function containerRequest(uri, xhr, cb) { - var bytes = []; - var id3Offset; - var finished = false; - - var endRequestAndCallback = function endRequestAndCallback(err, req, type, _bytes) { - req.abort(); - finished = true; - return cb(err, req, type, _bytes); - }; - - var progressListener = function progressListener(error, request) { - if (finished) { - return; - } - - if (error) { - return endRequestAndCallback(error, request, '', bytes); - } // grap the new part of content that was just downloaded - - - var newPart = request.responseText.substring(bytes && bytes.byteLength || 0, request.responseText.length); // add that onto bytes - - bytes = concatTypedArrays(bytes, stringToBytes(newPart, true)); - id3Offset = id3Offset || getId3Offset(bytes); // we need at least 10 bytes to determine a type - // or we need at least two bytes after an id3Offset - - if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } - - var type = detectContainerForBytes(bytes); // if this looks like a ts segment but we don't have enough data - // to see the second sync byte, wait until we have enough data - // before declaring it ts - - if (type === 'ts' && bytes.length < 188) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } // this may be an unsynced ts segment - // wait for 376 bytes before detecting no container - - - if (!type && bytes.length < 376) { - return callbackOnCompleted(request, function () { - return endRequestAndCallback(error, request, '', bytes); - }); - } - - return endRequestAndCallback(null, request, type, bytes); - }; - - var options = { - uri: uri, - beforeSend: function beforeSend(request) { - // this forces the browser to pass the bytes to us unprocessed - request.overrideMimeType('text/plain; charset=x-user-defined'); - request.addEventListener('progress', function (_ref) { - _ref.total; - _ref.loaded; - return callbackWrapper(request, null, { - statusCode: request.status - }, progressListener); - }); - } - }; - var request = xhr(options, function (error, response) { - return callbackWrapper(request, error, response, progressListener); - }); - return request; - }; - - var EventTarget = videojs__default['default'].EventTarget, - mergeOptions = videojs__default['default'].mergeOptions; - - var dashPlaylistUnchanged = function dashPlaylistUnchanged(a, b) { - if (!isPlaylistUnchanged(a, b)) { - return false; - } // for dash the above check will often return true in scenarios where - // the playlist actually has changed because mediaSequence isn't a - // dash thing, and we often set it to 1. So if the playlists have the same amount - // of segments we return true. - // So for dash we need to make sure that the underlying segments are different. - // if sidx changed then the playlists are different. - - - if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) { - return false; - } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) { - return false; - } // one or the other does not have segments - // there was a change. - - - if (a.segments && !b.segments || !a.segments && b.segments) { - return false; - } // neither has segments nothing changed - - - if (!a.segments && !b.segments) { - return true; - } // check segments themselves - - - for (var i = 0; i < a.segments.length; i++) { - var aSegment = a.segments[i]; - var bSegment = b.segments[i]; // if uris are different between segments there was a change - - if (aSegment.uri !== bSegment.uri) { - return false; - } // neither segment has a byterange, there will be no byterange change. - - - if (!aSegment.byterange && !bSegment.byterange) { - continue; - } - - var aByterange = aSegment.byterange; - var bByterange = bSegment.byterange; // if byterange only exists on one of the segments, there was a change. - - if (aByterange && !bByterange || !aByterange && bByterange) { - return false; - } // if both segments have byterange with different offsets, there was a change. - - - if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) { - return false; - } - } // if everything was the same with segments, this is the same playlist. - - - return true; - }; - /** - * Parses the master XML string and updates playlist URI references. - * - * @param {Object} config - * Object of arguments - * @param {string} config.masterXml - * The mpd XML - * @param {string} config.srcUrl - * The mpd URL - * @param {Date} config.clientOffset - * A time difference between server and client - * @param {Object} config.sidxMapping - * SIDX mappings for moof/mdat URIs and byte ranges - * @return {Object} - * The parsed mpd manifest object - */ - - - var parseMasterXml = function parseMasterXml(_ref) { - var masterXml = _ref.masterXml, - srcUrl = _ref.srcUrl, - clientOffset = _ref.clientOffset, - sidxMapping = _ref.sidxMapping; - var master = parse(masterXml, { - manifestUri: srcUrl, - clientOffset: clientOffset, - sidxMapping: sidxMapping - }); - addPropertiesToMaster(master, srcUrl); - return master; - }; - /** - * Returns a new master manifest that is the result of merging an updated master manifest - * into the original version. - * - * @param {Object} oldMaster - * The old parsed mpd object - * @param {Object} newMaster - * The updated parsed mpd object - * @return {Object} - * A new object representing the original master manifest with the updated media - * playlists merged in - */ - - var updateMaster = function updateMaster(oldMaster, newMaster, sidxMapping) { - var noChanges = true; - var update = mergeOptions(oldMaster, { - // These are top level properties that can be updated - duration: newMaster.duration, - minimumUpdatePeriod: newMaster.minimumUpdatePeriod - }); // First update the playlists in playlist list - - for (var i = 0; i < newMaster.playlists.length; i++) { - var playlist = newMaster.playlists[i]; - - if (playlist.sidx) { - var sidxKey = generateSidxKey(playlist.sidx); // add sidx segments to the playlist if we have all the sidx info already - - if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) { - addSidxSegmentsToPlaylist(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri); - } - } - - var playlistUpdate = updateMaster$1(update, playlist, dashPlaylistUnchanged); - - if (playlistUpdate) { - update = playlistUpdate; - noChanges = false; - } - } // Then update media group playlists - - - forEachMediaGroup(newMaster, function (properties, type, group, label) { - if (properties.playlists && properties.playlists.length) { - var id = properties.playlists[0].id; - - var _playlistUpdate = updateMaster$1(update, properties.playlists[0], dashPlaylistUnchanged); - - if (_playlistUpdate) { - update = _playlistUpdate; // update the playlist reference within media groups - - update.mediaGroups[type][group][label].playlists[0] = update.playlists[id]; - noChanges = false; - } - } - }); - - if (newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) { - noChanges = false; - } - - if (noChanges) { - return null; - } - - return update; - }; // SIDX should be equivalent if the URI and byteranges of the SIDX match. - // If the SIDXs have maps, the two maps should match, - // both `a` and `b` missing SIDXs is considered matching. - // If `a` or `b` but not both have a map, they aren't matching. - - var equivalentSidx = function equivalentSidx(a, b) { - var neitherMap = Boolean(!a.map && !b.map); - var equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length); - return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length; - }; // exported for testing - - - var compareSidxEntry = function compareSidxEntry(playlists, oldSidxMapping) { - var newSidxMapping = {}; - - for (var id in playlists) { - var playlist = playlists[id]; - var currentSidxInfo = playlist.sidx; - - if (currentSidxInfo) { - var key = generateSidxKey(currentSidxInfo); - - if (!oldSidxMapping[key]) { - break; - } - - var savedSidxInfo = oldSidxMapping[key].sidxInfo; - - if (equivalentSidx(savedSidxInfo, currentSidxInfo)) { - newSidxMapping[key] = oldSidxMapping[key]; - } - } - } - - return newSidxMapping; - }; - /** - * A function that filters out changed items as they need to be requested separately. - * - * The method is exported for testing - * - * @param {Object} master the parsed mpd XML returned via mpd-parser - * @param {Object} oldSidxMapping the SIDX to compare against - */ - - var filterChangedSidxMappings = function filterChangedSidxMappings(master, oldSidxMapping) { - var videoSidx = compareSidxEntry(master.playlists, oldSidxMapping); - var mediaGroupSidx = videoSidx; - forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) { - if (properties.playlists && properties.playlists.length) { - var playlists = properties.playlists; - mediaGroupSidx = mergeOptions(mediaGroupSidx, compareSidxEntry(playlists, oldSidxMapping)); - } - }); - return mediaGroupSidx; - }; - - var DashPlaylistLoader = /*#__PURE__*/function (_EventTarget) { - inheritsLoose(DashPlaylistLoader, _EventTarget); - - // DashPlaylistLoader must accept either a src url or a playlist because subsequent - // playlist loader setups from media groups will expect to be able to pass a playlist - // (since there aren't external URLs to media playlists with DASH) - function DashPlaylistLoader(srcUrlOrPlaylist, vhs, options, masterPlaylistLoader) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _EventTarget.call(this) || this; - _this.masterPlaylistLoader_ = masterPlaylistLoader || assertThisInitialized(_this); - - if (!masterPlaylistLoader) { - _this.isMaster_ = true; - } - - var _options = options, - _options$withCredenti = _options.withCredentials, - withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, - _options$handleManife = _options.handleManifestRedirects, - handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife; - _this.vhs_ = vhs; - _this.withCredentials = withCredentials; - _this.handleManifestRedirects = handleManifestRedirects; - - if (!srcUrlOrPlaylist) { - throw new Error('A non-empty playlist URL or object is required'); - } // event naming? - - - _this.on('minimumUpdatePeriod', function () { - _this.refreshXml_(); - }); // live playlist staleness timeout - - - _this.on('mediaupdatetimeout', function () { - _this.refreshMedia_(_this.media().id); - }); - - _this.state = 'HAVE_NOTHING'; - _this.loadedPlaylists_ = {}; - _this.logger_ = logger('DashPlaylistLoader'); // initialize the loader state - // The masterPlaylistLoader will be created with a string - - if (_this.isMaster_) { - _this.masterPlaylistLoader_.srcUrl = srcUrlOrPlaylist; // TODO: reset sidxMapping between period changes - // once multi-period is refactored - - _this.masterPlaylistLoader_.sidxMapping_ = {}; - } else { - _this.childPlaylist_ = srcUrlOrPlaylist; - } - - return _this; - } - - var _proto = DashPlaylistLoader.prototype; - - _proto.requestErrored_ = function requestErrored_(err, request, startingState) { - // disposed - if (!this.request) { - return true; - } // pending request is cleared - - - this.request = null; - - if (err) { - // use the provided error object or create one - // based on the request/response - this.error = typeof err === 'object' && !(err instanceof Error) ? err : { - status: request.status, - message: 'DASH request error at URL: ' + request.uri, - response: request.response, - // MEDIA_ERR_NETWORK - code: 2 - }; - - if (startingState) { - this.state = startingState; - } - - this.trigger('error'); - return true; - } - } - /** - * Verify that the container of the sidx segment can be parsed - * and if it can, get and parse that segment. - */ - ; - - _proto.addSidxSegments_ = function addSidxSegments_(playlist, startingState, cb) { - var _this2 = this; - - var sidxKey = playlist.sidx && generateSidxKey(playlist.sidx); // playlist lacks sidx or sidx segments were added to this playlist already. - - if (!playlist.sidx || !sidxKey || this.masterPlaylistLoader_.sidxMapping_[sidxKey]) { - // keep this function async - this.mediaRequest_ = window__default['default'].setTimeout(function () { - return cb(false); - }, 0); - return; - } // resolve the segment URL relative to the playlist - - - var uri = resolveManifestRedirect(this.handleManifestRedirects, playlist.sidx.resolvedUri); - - var fin = function fin(err, request) { - if (_this2.requestErrored_(err, request, startingState)) { - return; - } - - var sidxMapping = _this2.masterPlaylistLoader_.sidxMapping_; - var sidx; - - try { - sidx = parseSidx_1(toUint8(request.response).subarray(8)); - } catch (e) { - // sidx parsing failed. - _this2.requestErrored_(e, request, startingState); - - return; - } - - sidxMapping[sidxKey] = { - sidxInfo: playlist.sidx, - sidx: sidx - }; - addSidxSegmentsToPlaylist(playlist, sidx, playlist.sidx.resolvedUri); - return cb(true); - }; - - this.request = containerRequest(uri, this.vhs_.xhr, function (err, request, container, bytes) { - if (err) { - return fin(err, request); - } - - if (!container || container !== 'mp4') { - return fin({ - status: request.status, - message: "Unsupported " + (container || 'unknown') + " container type for sidx segment at URL: " + uri, - // response is just bytes in this case - // but we really don't want to return that. - response: '', - playlist: playlist, - internal: true, - blacklistDuration: Infinity, - // MEDIA_ERR_NETWORK - code: 2 - }, request); - } // if we already downloaded the sidx bytes in the container request, use them - - - var _playlist$sidx$bytera = playlist.sidx.byterange, - offset = _playlist$sidx$bytera.offset, - length = _playlist$sidx$bytera.length; - - if (bytes.length >= length + offset) { - return fin(err, { - response: bytes.subarray(offset, offset + length), - status: request.status, - uri: request.uri - }); - } // otherwise request sidx bytes - - - _this2.request = _this2.vhs_.xhr({ - uri: uri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders({ - byterange: playlist.sidx.byterange - }) - }, fin); - }); - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.stopRequest(); - this.loadedPlaylists_ = {}; - window__default['default'].clearTimeout(this.minimumUpdatePeriodTimeout_); - window__default['default'].clearTimeout(this.mediaRequest_); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - this.mediaRequest_ = null; - this.minimumUpdatePeriodTimeout_ = null; - - if (this.masterPlaylistLoader_.createMupOnMedia_) { - this.off('loadedmetadata', this.masterPlaylistLoader_.createMupOnMedia_); - this.masterPlaylistLoader_.createMupOnMedia_ = null; - } - - this.off(); - }; - - _proto.hasPendingRequest = function hasPendingRequest() { - return this.request || this.mediaRequest_; - }; - - _proto.stopRequest = function stopRequest() { - if (this.request) { - var oldRequest = this.request; - this.request = null; - oldRequest.onreadystatechange = null; - oldRequest.abort(); - } - }; - - _proto.media = function media(playlist) { - var _this3 = this; - - // getter - if (!playlist) { - return this.media_; - } // setter - - - if (this.state === 'HAVE_NOTHING') { - throw new Error('Cannot switch media playlist from ' + this.state); - } - - var startingState = this.state; // find the playlist object if the target playlist has been specified by URI - - if (typeof playlist === 'string') { - if (!this.masterPlaylistLoader_.master.playlists[playlist]) { - throw new Error('Unknown playlist URI: ' + playlist); - } - - playlist = this.masterPlaylistLoader_.master.playlists[playlist]; - } - - var mediaChange = !this.media_ || playlist.id !== this.media_.id; // switch to previously loaded playlists immediately - - if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) { - this.state = 'HAVE_METADATA'; - this.media_ = playlist; // trigger media change if the active media has been updated - - if (mediaChange) { - this.trigger('mediachanging'); - this.trigger('mediachange'); - } - - return; - } // switching to the active playlist is a no-op - - - if (!mediaChange) { - return; - } // switching from an already loaded playlist - - - if (this.media_) { - this.trigger('mediachanging'); - } - - this.addSidxSegments_(playlist, startingState, function (sidxChanged) { - // everything is ready just continue to haveMetadata - _this3.haveMetadata({ - startingState: startingState, - playlist: playlist - }); - }); - }; - - _proto.haveMetadata = function haveMetadata(_ref2) { - var startingState = _ref2.startingState, - playlist = _ref2.playlist; - this.state = 'HAVE_METADATA'; - this.loadedPlaylists_[playlist.id] = playlist; - this.mediaRequest_ = null; // This will trigger loadedplaylist - - this.refreshMedia_(playlist.id); // fire loadedmetadata the first time a media playlist is loaded - // to resolve setup of media groups - - if (startingState === 'HAVE_MASTER') { - this.trigger('loadedmetadata'); - } else { - // trigger media change if the active media has been updated - this.trigger('mediachange'); - } - }; - - _proto.pause = function pause() { - if (this.masterPlaylistLoader_.createMupOnMedia_) { - this.off('loadedmetadata', this.masterPlaylistLoader_.createMupOnMedia_); - this.masterPlaylistLoader_.createMupOnMedia_ = null; - } - - this.stopRequest(); - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - - if (this.isMaster_) { - window__default['default'].clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_); - this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_ = null; - } - - if (this.state === 'HAVE_NOTHING') { - // If we pause the loader before any data has been retrieved, its as if we never - // started, so reset to an unstarted state. - this.started = false; - } - }; - - _proto.load = function load(isFinalRendition) { - var _this4 = this; - - window__default['default'].clearTimeout(this.mediaUpdateTimeout); - this.mediaUpdateTimeout = null; - var media = this.media(); - - if (isFinalRendition) { - var delay = media ? media.targetDuration / 2 * 1000 : 5 * 1000; - this.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - return _this4.load(); - }, delay); - return; - } // because the playlists are internal to the manifest, load should either load the - // main manifest, or do nothing but trigger an event - - - if (!this.started) { - this.start(); - return; - } - - if (media && !media.endList) { - // Check to see if this is the master loader and the MUP was cleared (this happens - // when the loader was paused). `media` should be set at this point since one is always - // set during `start()`. - if (this.isMaster_ && !this.minimumUpdatePeriodTimeout_) { - // Trigger minimumUpdatePeriod to refresh the master manifest - this.trigger('minimumUpdatePeriod'); // Since there was no prior minimumUpdatePeriodTimeout it should be recreated - - this.updateMinimumUpdatePeriodTimeout_(); - } - - this.trigger('mediaupdatetimeout'); - } else { - this.trigger('loadedplaylist'); - } - }; - - _proto.start = function start() { - var _this5 = this; - - this.started = true; // We don't need to request the master manifest again - // Call this asynchronously to match the xhr request behavior below - - if (!this.isMaster_) { - this.mediaRequest_ = window__default['default'].setTimeout(function () { - return _this5.haveMaster_(); - }, 0); - return; - } - - this.requestMaster_(function (req, masterChanged) { - _this5.haveMaster_(); - - if (!_this5.hasPendingRequest() && !_this5.media_) { - _this5.media(_this5.masterPlaylistLoader_.master.playlists[0]); - } - }); - }; - - _proto.requestMaster_ = function requestMaster_(cb) { - var _this6 = this; - - this.request = this.vhs_.xhr({ - uri: this.masterPlaylistLoader_.srcUrl, - withCredentials: this.withCredentials - }, function (error, req) { - if (_this6.requestErrored_(error, req)) { - if (_this6.state === 'HAVE_NOTHING') { - _this6.started = false; - } - - return; - } - - var masterChanged = req.responseText !== _this6.masterPlaylistLoader_.masterXml_; - _this6.masterPlaylistLoader_.masterXml_ = req.responseText; - - if (req.responseHeaders && req.responseHeaders.date) { - _this6.masterLoaded_ = Date.parse(req.responseHeaders.date); - } else { - _this6.masterLoaded_ = Date.now(); - } - - _this6.masterPlaylistLoader_.srcUrl = resolveManifestRedirect(_this6.handleManifestRedirects, _this6.masterPlaylistLoader_.srcUrl, req); - - if (masterChanged) { - _this6.handleMaster_(); - - _this6.syncClientServerClock_(function () { - return cb(req, masterChanged); - }); - - return; - } - - return cb(req, masterChanged); - }); - } - /** - * Parses the master xml for UTCTiming node to sync the client clock to the server - * clock. If the UTCTiming node requires a HEAD or GET request, that request is made. - * - * @param {Function} done - * Function to call when clock sync has completed - */ - ; - - _proto.syncClientServerClock_ = function syncClientServerClock_(done) { - var _this7 = this; - - var utcTiming = parseUTCTiming(this.masterPlaylistLoader_.masterXml_); // No UTCTiming element found in the mpd. Use Date header from mpd request as the - // server clock - - if (utcTiming === null) { - this.masterPlaylistLoader_.clientOffset_ = this.masterLoaded_ - Date.now(); - return done(); - } - - if (utcTiming.method === 'DIRECT') { - this.masterPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now(); - return done(); - } - - this.request = this.vhs_.xhr({ - uri: resolveUrl(this.masterPlaylistLoader_.srcUrl, utcTiming.value), - method: utcTiming.method, - withCredentials: this.withCredentials - }, function (error, req) { - // disposed - if (!_this7.request) { - return; - } - - if (error) { - // sync request failed, fall back to using date header from mpd - // TODO: log warning - _this7.masterPlaylistLoader_.clientOffset_ = _this7.masterLoaded_ - Date.now(); - return done(); - } - - var serverTime; - - if (utcTiming.method === 'HEAD') { - if (!req.responseHeaders || !req.responseHeaders.date) { - // expected date header not preset, fall back to using date header from mpd - // TODO: log warning - serverTime = _this7.masterLoaded_; - } else { - serverTime = Date.parse(req.responseHeaders.date); - } - } else { - serverTime = Date.parse(req.responseText); - } - - _this7.masterPlaylistLoader_.clientOffset_ = serverTime - Date.now(); - done(); - }); - }; - - _proto.haveMaster_ = function haveMaster_() { - this.state = 'HAVE_MASTER'; - - if (this.isMaster_) { - // We have the master playlist at this point, so - // trigger this to allow MasterPlaylistController - // to make an initial playlist selection - this.trigger('loadedplaylist'); - } else if (!this.media_) { - // no media playlist was specifically selected so select - // the one the child playlist loader was created with - this.media(this.childPlaylist_); - } - }; - - _proto.handleMaster_ = function handleMaster_() { - // clear media request - this.mediaRequest_ = null; - var newMaster = parseMasterXml({ - masterXml: this.masterPlaylistLoader_.masterXml_, - srcUrl: this.masterPlaylistLoader_.srcUrl, - clientOffset: this.masterPlaylistLoader_.clientOffset_, - sidxMapping: this.masterPlaylistLoader_.sidxMapping_ - }); - var oldMaster = this.masterPlaylistLoader_.master; // if we have an old master to compare the new master against - - if (oldMaster) { - newMaster = updateMaster(oldMaster, newMaster, this.masterPlaylistLoader_.sidxMapping_); - } // only update master if we have a new master - - - this.masterPlaylistLoader_.master = newMaster ? newMaster : oldMaster; - var location = this.masterPlaylistLoader_.master.locations && this.masterPlaylistLoader_.master.locations[0]; - - if (location && location !== this.masterPlaylistLoader_.srcUrl) { - this.masterPlaylistLoader_.srcUrl = location; - } - - if (!oldMaster || newMaster && newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) { - this.updateMinimumUpdatePeriodTimeout_(); - } - - return Boolean(newMaster); - }; - - _proto.updateMinimumUpdatePeriodTimeout_ = function updateMinimumUpdatePeriodTimeout_() { - var mpl = this.masterPlaylistLoader_; // cancel any pending creation of mup on media - // a new one will be added if needed. - - if (mpl.createMupOnMedia_) { - mpl.off('loadedmetadata', mpl.createMupOnMedia_); - mpl.createMupOnMedia_ = null; - } // clear any pending timeouts - - - if (mpl.minimumUpdatePeriodTimeout_) { - window__default['default'].clearTimeout(mpl.minimumUpdatePeriodTimeout_); - mpl.minimumUpdatePeriodTimeout_ = null; - } - - var mup = mpl.master && mpl.master.minimumUpdatePeriod; // If the minimumUpdatePeriod has a value of 0, that indicates that the current - // MPD has no future validity, so a new one will need to be acquired when new - // media segments are to be made available. Thus, we use the target duration - // in this case - - if (mup === 0) { - if (mpl.media()) { - mup = mpl.media().targetDuration * 1000; - } else { - mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_; - mpl.one('loadedmetadata', mpl.createMupOnMedia_); - } - } // if minimumUpdatePeriod is invalid or <= zero, which - // can happen when a live video becomes VOD. skip timeout - // creation. - - - if (typeof mup !== 'number' || mup <= 0) { - if (mup < 0) { - this.logger_("found invalid minimumUpdatePeriod of " + mup + ", not setting a timeout"); - } - - return; - } - - this.createMUPTimeout_(mup); - }; - - _proto.createMUPTimeout_ = function createMUPTimeout_(mup) { - var mpl = this.masterPlaylistLoader_; - mpl.minimumUpdatePeriodTimeout_ = window__default['default'].setTimeout(function () { - mpl.minimumUpdatePeriodTimeout_ = null; - mpl.trigger('minimumUpdatePeriod'); - mpl.createMUPTimeout_(mup); - }, mup); - } - /** - * Sends request to refresh the master xml and updates the parsed master manifest - */ - ; - - _proto.refreshXml_ = function refreshXml_() { - var _this8 = this; - - this.requestMaster_(function (req, masterChanged) { - if (!masterChanged) { - return; - } - - if (_this8.media_) { - _this8.media_ = _this8.masterPlaylistLoader_.master.playlists[_this8.media_.id]; - } // This will filter out updated sidx info from the mapping - - - _this8.masterPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings(_this8.masterPlaylistLoader_.master, _this8.masterPlaylistLoader_.sidxMapping_); - - _this8.addSidxSegments_(_this8.media(), _this8.state, function (sidxChanged) { - // TODO: do we need to reload the current playlist? - _this8.refreshMedia_(_this8.media().id); - }); - }); - } - /** - * Refreshes the media playlist by re-parsing the master xml and updating playlist - * references. If this is an alternate loader, the updated parsed manifest is retrieved - * from the master loader. - */ - ; - - _proto.refreshMedia_ = function refreshMedia_(mediaID) { - var _this9 = this; - - if (!mediaID) { - throw new Error('refreshMedia_ must take a media id'); - } // for master we have to reparse the master xml - // to re-create segments based on current timing values - // which may change media. We only skip updating master - // if this is the first time this.media_ is being set. - // as master was just parsed in that case. - - - if (this.media_ && this.isMaster_) { - this.handleMaster_(); - } - - var playlists = this.masterPlaylistLoader_.master.playlists; - var mediaChanged = !this.media_ || this.media_ !== playlists[mediaID]; - - if (mediaChanged) { - this.media_ = playlists[mediaID]; - } else { - this.trigger('playlistunchanged'); - } - - if (!this.mediaUpdateTimeout) { - var createMediaUpdateTimeout = function createMediaUpdateTimeout() { - if (_this9.media().endList) { - return; - } - - _this9.mediaUpdateTimeout = window__default['default'].setTimeout(function () { - _this9.trigger('mediaupdatetimeout'); - - createMediaUpdateTimeout(); - }, refreshDelay(_this9.media(), Boolean(mediaChanged))); - }; - - createMediaUpdateTimeout(); - } - - this.trigger('loadedplaylist'); - }; - - return DashPlaylistLoader; - }(EventTarget); - - var Config = { - GOAL_BUFFER_LENGTH: 30, - MAX_GOAL_BUFFER_LENGTH: 60, - BACK_BUFFER_LENGTH: 30, - GOAL_BUFFER_LENGTH_RATE: 1, - // 0.5 MB/s - INITIAL_BANDWIDTH: 4194304, - // A fudge factor to apply to advertised playlist bitrates to account for - // temporary flucations in client bandwidth - BANDWIDTH_VARIANCE: 1.2, - // How much of the buffer must be filled before we consider upswitching - BUFFER_LOW_WATER_LINE: 0, - MAX_BUFFER_LOW_WATER_LINE: 30, - // TODO: Remove this when experimentalBufferBasedABR is removed - EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16, - BUFFER_LOW_WATER_LINE_RATE: 1, - // If the buffer is greater than the high water line, we won't switch down - BUFFER_HIGH_WATER_LINE: 30 - }; - - var stringToArrayBuffer = function stringToArrayBuffer(string) { - var view = new Uint8Array(new ArrayBuffer(string.length)); - - for (var i = 0; i < string.length; i++) { - view[i] = string.charCodeAt(i); - } - - return view.buffer; - }; - - /* global Blob, BlobBuilder, Worker */ - // unify worker interface - var browserWorkerPolyFill = function browserWorkerPolyFill(workerObj) { - // node only supports on/off - workerObj.on = workerObj.addEventListener; - workerObj.off = workerObj.removeEventListener; - return workerObj; - }; - - var createObjectURL = function createObjectURL(str) { - try { - return URL.createObjectURL(new Blob([str], { - type: 'application/javascript' - })); - } catch (e) { - var blob = new BlobBuilder(); - blob.append(str); - return URL.createObjectURL(blob.getBlob()); - } - }; - - var factory = function factory(code) { - return function () { - var objectUrl = createObjectURL(code); - var worker = browserWorkerPolyFill(new Worker(objectUrl)); - worker.objURL = objectUrl; - var terminate = worker.terminate; - worker.on = worker.addEventListener; - worker.off = worker.removeEventListener; - - worker.terminate = function () { - URL.revokeObjectURL(objectUrl); - return terminate.call(this); - }; - - return worker; - }; - }; - var transform = function transform(code) { - return "var browserWorkerPolyFill = " + browserWorkerPolyFill.toString() + ";\n" + 'browserWorkerPolyFill(self);\n' + code; - }; - - var getWorkerString = function getWorkerString(fn) { - return fn.toString().replace(/^function.+?{/, '').slice(0, -1); - }; - - /* rollup-plugin-worker-factory start for worker!/Users/gkatsevman/p/http-streaming-release/src/transmuxer-worker.js */ - var workerCode$1 = transform(getWorkerString(function () { - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ - - var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; - }; - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - - Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; - }; // Default stream functions that are expected to be overridden to perform - // actual work. These are provided by the prototype as a sort of no-op - // implementation so that we don't have to check for their existence in the - // `pipe` function above. - - - Stream.prototype.push = function (data) { - this.trigger('data', data); - }; - - Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); - }; - - Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); - }; - - Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); - }; - - Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); - }; - - var stream = Stream; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ - - var UINT32_MAX = Math.pow(2, 32) - 1; - var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - - (function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); - })(); - - box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; - }; - - dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); - }; - - esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); - }; - - ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); - }; - - hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); - }; - - mdat = function mdat(data) { - return box(types.mdat, data); - }; - - mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); - }; - - mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); - }; - - mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); - }; - - minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); - }; - - moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); - }; - /** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - - moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); - }; - - mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); - }; - - mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); - }; - - sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); - }; - - stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); - }; - - (function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; - })(); - - tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); - }; - /** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - - traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (UINT32_MAX + 1)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (UINT32_MAX + 1)); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun$1(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); - }; - /** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - - trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); - }; - - trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); - }; - - (function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun$1 = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; - })(); - - var mp4Generator = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - // Convert an array of nal units into an array of frames with each frame being - // composed of the nal units that make up that frame - // Also keep track of cummulative data about the frame from the nal units such - // as the frame duration, starting pts, etc. - - var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; - }; // Convert an array of frames into an array of Gop with each Gop being composed - // of the frames that make up that Gop - // Also keep track of cummulative data about the Gop from the frames such as the - // Gop duration, starting pts, etc. - - - var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; - }; - /* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - - var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; - }; - /** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - - var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; - }; - /* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - - var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; - }; // generate the track's sample table from an array of gops - - - var generateSampleTable$1 = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; - }; // generate the track's raw mdat data from an array of gops - - - var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; - }; // generate the track's sample table from a frame - - - var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; - }; // generate the track's raw mdat data from a frame - - - var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; - }; - - var frameUtils = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable$1, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var highPrefix = [33, 16, 5, 32, 164, 27]; - var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - - var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; - }; - - var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); - }; - - var silence; - - var silence_1 = function silence_1() { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]], - 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - - var ONE_SECOND_IN_TS$4 = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS$4; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS$4; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - /** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; - }; // Possibly pad (prefix) the audio track with silence if appending this track - // would lead to the introduction of a gap in the audio buffer - - - var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = silence_1()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; - }; // If the audio segment extends before the earliest allowed dts - // value, remove AAC frames until starts at or after the earliest - // allowed DTS so that we don't end up with a negative baseMedia- - // DecodeTime for the audio track - - - var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); - }; // generate the track's raw mdat data from an array of frames - - - var generateSampleTable = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; - }; // generate the track's sample table from an array of frames - - - var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; - }; - - var audioFrameUtils = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS; - /** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } - }; - /** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - - var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; - }; - /** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS$3; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; - }; - - var trackDecodeInfo = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - // payload type field to indicate how they are to be - // interpreted. CEAS-708 caption content is always transmitted with - // payload type 0x04. - - var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - /** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - - var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; - }; // see ANSI/SCTE 128-1 (2013), section 8.1 - - - var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); - }; // see CEA-708-D, section 4.4 - - - var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; - }; - - var discardEmulationPreventionBytes$1 = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; // exports - - - var captionPacketParser = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes$1, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 - }; // Link To Transport - // ----------------- - - var CaptionStream$1 = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream(); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - }; - - CaptionStream$1.prototype = new stream(); - - CaptionStream$1.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; - }; - - CaptionStream$1.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); - }; - - CaptionStream$1.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); - }; - - CaptionStream$1.prototype.flush = function () { - return this.flushStream('flush'); - }; // Only called if handling partial data - - - CaptionStream$1.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); - }; - - CaptionStream$1.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); - }; // From the CEA-608 spec: - - /* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. - */ - // With that in mind, we ignore any data between an XDS control code and a - // subsequent closed-captioning control code. - - - CaptionStream$1.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); - }; - - CaptionStream$1.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; - }; - - CaptionStream$1.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; - }; - - CaptionStream$1.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; - }; - - CaptionStream$1.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } - }; // ---------------------- - // Session to Application - // ---------------------- - // This hash maps special and extended character codes to their - // proper Unicode equivalent. The first one-byte key is just a - // non-standard character code. The two-byte keys that follow are - // the extended CEA708 character codes, along with the preceding - // 0x10 extended character byte to distinguish these codes from - // non-extended character codes. Every CEA708 character code that - // is not in this object maps directly to a standard unicode - // character code. - // The transparent space and non-breaking transparent space are - // technically not fully supported since there is no code to - // make them transparent, so they have normal non-transparent - // stand-ins. - // The special closed caption (CC) character isn't a standard - // unicode character, so a fairly similar unicode character was - // chosen in it's place. - - - var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - - }; - - var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); - }; - - var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; - }; - - var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); - }; - - Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; - }; - - Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); - }; - - Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; - }; - - Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } - }; - - Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; - }; - - Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; - }; - - Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } - }; - - var Cea708Service = function Cea708Service(serviceNum) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - }; - /** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - - Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } - }; - /** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - - Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; - }; - - var Cea708Stream = function Cea708Stream() { - Cea708Stream.prototype.init.call(this); - var self = this; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; - }; - - Cea708Stream.prototype = new stream(); - /** - * Push current 708 packet, create new 708 packet. - */ - - Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; - }; - /** - * Add pts and both bytes from packet into current 708 packet. - */ - - - Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); - }; - /** - * Parse completed 708 packet into service blocks and push each service block. - */ - - - Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } - }; - /** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - - Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else ; - } - }; - /** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, true); - } - - return i; - }; - /** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - - Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; - }; - /** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - - Cea708Stream.prototype.initService = function (serviceNum, i) { - var self = this; - this.services[serviceNum] = new Cea708Service(serviceNum); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; - }; - /** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.handleText = function (i, service, isExtended) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var extended = isExtended ? 0x1000 : 0x0000; - var char = get708CharFromCode(extended | b); - var win = service.currentWindow; - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; - }; - /** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; - }; - /** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; - }; - /** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; - }; - /** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; - }; - /** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } - }; - /** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; - }; - /** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; - }; - /** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; - }; - /** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; - }; - /** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; - }; - /** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; - }; - /** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; - }; - /** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; - }; - /** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - - Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); - }; // This hash maps non-ASCII, special, and extended character codes to their - // proper Unicode equivalent. The first keys that are only a single byte - // are the non-standard ASCII characters, which simply map the CEA608 byte - // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 - // character codes, but have their MSB bitmasked with 0x03 so that a lookup - // can be performed regardless of the field and data channel on which the - // character code was received. - - - var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - - }; - - var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); - }; // the index of the last row in a CEA-608 display buffer - - - var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of - // getting it through bit logic. - - var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character - // cells. The "bottom" row is the last element in the outer array. - - var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push(''); - } - - return result; - }; - - var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; - }; - - Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the - // display buffer - - Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - // eslint-disable-next-line no-console - console.error('Skipping malformed caption.'); - return ''; - } - }) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content, - stream: this.name_ - }); - } - }; - /** - * Zero out the data, used for startup and on seek - */ - - - Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; - }; - /** - * Sets up control code and related constants for this instance - */ - - - Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; - }; - /** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - - Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - - Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - - Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; - }; - /** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - - Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; - }; - /** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - - Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; - }; - /** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - - Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; - }; - /** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - - Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; - }; - /** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - - Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; - }; // Adds the opening HTML tag for the passed character to the caption text, - // and keeps track of it for later closing - - - Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); - }; // Adds HTML closing tags for current formatting to caption text and - // clears remembered formatting - - - Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); - }; // Mode Implementations - - - Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = ''; - }; - - Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; // exports - - - var captionStream = { - CaptionStream: CaptionStream$1, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var streamTypes = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 - }; - var MAX_TS = 8589934592; - var RO_THRESH = 4294967296; - var TYPE_SHARED = 'shared'; - - var handleRollover$1 = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; - }; - - var TimestampRolloverStream$1 = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover$1(data.dts, referenceDTS); - data.pts = handleRollover$1(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; - }; - - TimestampRolloverStream$1.prototype = new stream(); - var timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream$1, - handleRollover: handleRollover$1 - }; - - var percentEncode$1 = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode$1(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591$1 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode$1(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger$1 = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }, - tagParsers = { - TXXX: function TXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); // do not include the null terminator in the tag value - - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - - tag.data = tag.value; - }, - WXXX: function WXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function PRIV(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591$1(tag.data, 0, i); - break; - } - } - - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } - }, - _MetadataStream; - - _MetadataStream = function MetadataStream(options) { - var settings = { - debug: !!(options && options.debug), - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger$1(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger$1(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseSyncSafeInteger$1(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger$1(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; - }; - - _MetadataStream.prototype = new stream(); - var metadataStream = _MetadataStream; - var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream; // object types - - var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - - var MP2T_PACKET_LENGTH$1 = 188, - // bytes - SYNC_BYTE$1 = 0x47; - /** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - - _TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH$1, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH$1; - endIndex += MP2T_PACKET_LENGTH$1; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; - }; - - _TransportPacketStream.prototype = new stream(); - /** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - - _TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === streamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = streamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = streamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; - }; - - _TransportParseStream.prototype = new stream(); - _TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f - }; - /** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - - _ElementaryStream = function ElementaryStream() { - var self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case streamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case streamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case streamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - this.flushStreams_(); - this.trigger('done'); - }; - }; - - _ElementaryStream.prototype = new stream(); - var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, - MetadataStream: metadataStream - }; - - for (var type in streamTypes) { - if (streamTypes.hasOwnProperty(type)) { - m2ts[type] = streamTypes[type]; - } - } - - var m2ts_1 = m2ts; - var ONE_SECOND_IN_TS$2 = clock.ONE_SECOND_IN_TS; - - var _AdtsStream; - - var ADTS_SAMPLING_FREQUENCIES$1 = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - /* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - - _AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - while (i + 5 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2]; - frameEnd = i + frameLength; // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - - if (buffer.byteLength < frameEnd) { - return; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - frameNum++; // If the buffer is empty, clear it and return - - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } // Remove the finished frame from the buffer and start the process again - - - buffer = buffer.subarray(frameEnd); - } - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; - }; - - _AdtsStream.prototype = new stream(); - var adts = _AdtsStream; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ExpGolomb; - /** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - - ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); - }; - - var expGolomb = ExpGolomb; - - var _H264Stream, _NalByteStream; - - var PROFILES_WITH_OPTIONAL_SPS_DATA; - /** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - - _NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - }; - - _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS - // see Recommendation ITU-T H.264 (4/2013), - // 7.3.2.1.1 Sequence parameter set data syntax - - PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true - }; - /** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - - _H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - expGolombDecoder = new expGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - sarRatio: sarRatio - }; - }; - }; - - _H264Stream.prototype = new stream(); - var h264 = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ - - var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - - var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - - var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); - }; // TODO: use vhs-utils - - - var isLikelyAacData$1 = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; - }; - - var parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }; // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - - - var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }; // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - - - var parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }; - - var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; - }; - - var parseType$2 = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; - }; - - var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; - }; - - var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; - }; - - var utils = { - isLikelyAacData: isLikelyAacData$1, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType$2, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp - }; - - var _AacStream; - /** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - - _AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = utils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = utils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; - }; - - _AacStream.prototype = new stream(); - var aac = _AacStream; // constants - - var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; - var audioProperties = AUDIO_PROPERTIES; - var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; - var videoProperties = VIDEO_PROPERTIES; - var H264Stream = h264.H264Stream; - var isLikelyAacData = utils.isLikelyAacData; - var ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS; // object types - - var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; - /** - * Compare two arrays (even typed) for same-ness - */ - - - var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; - }; - - var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; - }; - /** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - _AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - audioProperties.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4Generator.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS$1 * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; - }; - - _AudioSegmentStream.prototype = new stream(); - /** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - _VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - videoProperties.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4Generator.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4Generator.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; - }; - - _VideoSegmentStream.prototype = new stream(); - /** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - - _CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; - }; - - _CoalesceStream.prototype = new stream(); - - _CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - videoProperties.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - audioProperties.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4Generator.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - }; - - _CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; - }; - /** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - - _Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new aac(); - pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new adts(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts_1.TransportPacketStream(); - pipeline.parseStream = new m2ts_1.TransportParseStream(); - pipeline.elementaryStream = new m2ts_1.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream(); - pipeline.adtsStream = new adts(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts_1.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; - }; - - _Transmuxer.prototype = new stream(); - var transmuxer = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: audioProperties, - VIDEO_PROPERTIES: videoProperties, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo - }; - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var toUnsigned$3 = function toUnsigned(value) { - return value >>> 0; - }; - - var toHexString$1 = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); - }; - - var bin = { - toUnsigned: toUnsigned$3, - toHexString: toHexString$1 - }; - - var parseType$1 = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; - }; - - var parseType_1 = parseType$1; - var toUnsigned$2 = bin.toUnsigned; - - var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType_1(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; - }; - - var findBox_1 = findBox; - var toUnsigned$1 = bin.toUnsigned; - - var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - baseMediaDecodeTime: toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime *= Math.pow(2, 32); - result.baseMediaDecodeTime += toUnsigned$1(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11]); - } - - return result; - }; - - var parseTfdt = tfdt; - - var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; - }; - - var parseSampleFlags_1 = parseSampleFlags; - - var trun = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags_1(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; - }; - - var parseTrun = trun; - - var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; - }; - - var parseTfhd = tfhd; - var discardEmulationPreventionBytes = captionPacketParser.discardEmulationPreventionBytes; - var CaptionStream = captionStream.CaptionStream; - /** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; - }; - /** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - - var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - // eslint-disable-next-line no-console - console.log("We've encountered a nal unit without data. See mux.js#233."); - break; - } - - result.push(seiNal); - break; - } - } - - return result; - }; - /** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - - var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; - }; - /** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - - var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox_1(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox_1(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox_1(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox_1(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox_1(traf, ['trun']); - var samples; - var seiNals; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - seiNals = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = []; - } - - captionNals[trackId] = captionNals[trackId].concat(seiNals); - } - }); - return captionNals; - }; - /** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption - **/ - - - var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var seiNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - seiNals = parseCaptionNals(segment, trackId); - return { - seiNals: seiNals[trackId], - timescale: timescale - }; - }; - /** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - - var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData === null || !parsedData.seiNals) { - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {} - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); - }; - - var captionParser = CaptionParser; - var toUnsigned = bin.toUnsigned; - var toHexString = bin.toHexString; - var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader; - /** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - - timescale = function timescale(init) { - var result = {}, - traks = findBox_1(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox_1(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); - }; - /** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - - startTime = function startTime(timescale, fragment) { - var trafs, baseTimes, result; // we need info from two childrend of each track fragment box - - trafs = findBox_1(fragment, ['moof', 'traf']); // determine the start times for each track - - baseTimes = [].concat.apply([], trafs.map(function (traf) { - return findBox_1(traf, ['tfhd']).map(function (tfhd) { - var id, scale, baseTime; // get the track id from the tfhd - - id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - baseTime = findBox_1(traf, ['tfdt']).map(function (tfdt) { - var version, result; - version = tfdt[0]; - result = toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]); - - if (version === 1) { - result *= Math.pow(2, 32); - result += toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11]); - } - - return result; - })[0]; - baseTime = typeof baseTime === 'number' && !isNaN(baseTime) ? baseTime : Infinity; // convert base time to seconds - - return baseTime / scale; - }); - })); // return the minimum - - result = Math.min.apply(null, baseTimes); - return isFinite(result) ? result : 0; - }; - /** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - - compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox_1(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox_1(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox_1(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox_1(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - return (baseMediaDecodeTime + compositionTimeOffset) / timescale; - }; - /** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - - getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox_1(trak, ['mdia', 'hdlr']); - var tkhds = findBox_1(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType_1(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; - }; - - getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - }; - /** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - - getTracks = function getTracks(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox_1(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox_1(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType_1(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox_1(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType_1(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox_1(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[a-z]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString(codecConfig[10]); // level idc - - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; - }; - - var probe$2 = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox_1, - parseType: parseType_1, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader - }; - - var parsePid = function parsePid(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; - }; - - var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) { - return !!(packet[1] & 0x40); - }; - - var parseAdaptionField = function parseAdaptionField(packet) { - var offset = 0; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[4] + 1; - } - - return offset; - }; - - var parseType = function parseType(packet, pmtPid) { - var pid = parsePid(packet); - - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - - return null; - }; - - var parsePat = function parsePat(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; - }; - - var parsePmt = function parsePmt(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section - - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table - - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type - - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry - // skip past the elementary stream descriptors, if present - - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - - return programMapTable; - }; - - var parsePesType = function parsePesType(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - return 'video'; - - case streamTypes.ADTS_STREAM_TYPE: - return 'audio'; - - case streamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - - default: - return null; - } - }; - - var parsePesTime = function parsePesTime(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - pes = {}; // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - - pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - - return pes; - }; - - var parseNalUnitType = function parseNalUnitType(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - - case 0x06: - return 'sei_rbsp'; - - case 0x07: - return 'seq_parameter_set_rbsp'; - - case 0x08: - return 'pic_parameter_set_rbsp'; - - case 0x09: - return 'access_unit_delimiter_rbsp'; - - default: - return null; - } - }; - - var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; // advance the sync point to a NAL start, if necessary - - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } // drop trailing zeroes - - - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; // parse the final nal - - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; - }; - - var probe$1 = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame - }; - var handleRollover = timestampRolloverStream.handleRollover; - var probe = {}; - probe.ts = probe$1; - probe.aac = utils; - var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS; - var MP2T_PACKET_LENGTH = 188, - // bytes - SYNC_BYTE = 0x47; - /** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ - - var parsePsi_ = function parsePsi_(bytes, pmt) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - - case 'pmt': - var table = probe.ts.parsePmt(packet); - pmt.table = pmt.table || {}; - Object.keys(table).forEach(function (key) { - pmt.table[key] = table[key]; - }); - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ - - - var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed; - var endLoop = false; // Start walking from start of segment to get first audio packet - - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last audio packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ - - - var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed, - frame, - i, - pes; - var endLoop = false; - var currentFrame = { - data: [], - size: 0 - }; // Start walking from start of segment to get first video packet - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn('Failed to extract PTS/DTS from PES at first keyframe. ' + 'This could be an unusual TS segment, or else mux.js did not ' + 'parse your TS segment correctly. If you know your TS ' + 'segments do contain PTS/DTS on keyframes please file a bug ' + 'report! You can try ffprobe to double check for yourself.'); - } - } - - currentFrame.size = 0; - } - } - - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last video packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ - - - var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - - segmentInfo.audio.forEach(function (info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - - segmentInfo.video.forEach(function (info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds - - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } - }; - /** - * inspects the aac data stream for start and end time information - */ - - - var inspectAac_ = function inspectAac_(bytes) { - var endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - - byteIndex += frameSize; - break; - - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - - audioCount++; - byteIndex += frameSize; - break; - - default: - byteIndex++; - break; - } - - if (endLoop) { - return null; - } - } - - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - var result = { - audio: [{ - type: 'audio', - dts: timestamp, - pts: timestamp - }, { - type: 'audio', - dts: timestamp + audioCount * 1024 * audioTimescale, - pts: timestamp + audioCount * 1024 * audioTimescale - }] - }; - return result; - }; - /** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ - - - var inspectTs_ = function inspectTs_(bytes) { - var pmt = { - pid: null, - table: null - }; - var result = {}; - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - - if (result.video.length === 0) { - delete result.video; - } - - break; - - case streamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - - if (result.audio.length === 0) { - delete result.audio; - } - - break; - } - } - } - - return result; - }; - /** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ - - - var inspect = function inspect(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || !result.audio && !result.video) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - return result; - }; - - var tsInspector = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ - }; - /* global self */ - - /** - * Re-emits transmuxer events by converting them into messages to the - * world outside the worker. - * - * @param {Object} transmuxer the transmuxer to wire events on - * @private - */ - - var wireTransmuxerEvents = function wireTransmuxerEvents(self, transmuxer) { - transmuxer.on('data', function (segment) { - // transfer ownership of the underlying ArrayBuffer - // instead of doing a copy to save memory - // ArrayBuffers are transferable but generic TypedArrays are not - // @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects) - var initArray = segment.initSegment; - segment.initSegment = { - data: initArray.buffer, - byteOffset: initArray.byteOffset, - byteLength: initArray.byteLength - }; - var typedArray = segment.data; - segment.data = typedArray.buffer; - self.postMessage({ - action: 'data', - segment: segment, - byteOffset: typedArray.byteOffset, - byteLength: typedArray.byteLength - }, [segment.data]); - }); - transmuxer.on('done', function (data) { - self.postMessage({ - action: 'done' - }); - }); - transmuxer.on('gopInfo', function (gopInfo) { - self.postMessage({ - action: 'gopInfo', - gopInfo: gopInfo - }); - }); - transmuxer.on('videoSegmentTimingInfo', function (timingInfo) { - var videoSegmentTimingInfo = { - start: { - decode: clock.videoTsToSeconds(timingInfo.start.dts), - presentation: clock.videoTsToSeconds(timingInfo.start.pts) - }, - end: { - decode: clock.videoTsToSeconds(timingInfo.end.dts), - presentation: clock.videoTsToSeconds(timingInfo.end.pts) - }, - baseMediaDecodeTime: clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime) - }; - - if (timingInfo.prependedContentDuration) { - videoSegmentTimingInfo.prependedContentDuration = clock.videoTsToSeconds(timingInfo.prependedContentDuration); - } - - self.postMessage({ - action: 'videoSegmentTimingInfo', - videoSegmentTimingInfo: videoSegmentTimingInfo - }); - }); - transmuxer.on('audioSegmentTimingInfo', function (timingInfo) { - // Note that all times for [audio/video]SegmentTimingInfo events are in video clock - var audioSegmentTimingInfo = { - start: { - decode: clock.videoTsToSeconds(timingInfo.start.dts), - presentation: clock.videoTsToSeconds(timingInfo.start.pts) - }, - end: { - decode: clock.videoTsToSeconds(timingInfo.end.dts), - presentation: clock.videoTsToSeconds(timingInfo.end.pts) - }, - baseMediaDecodeTime: clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime) - }; - - if (timingInfo.prependedContentDuration) { - audioSegmentTimingInfo.prependedContentDuration = clock.videoTsToSeconds(timingInfo.prependedContentDuration); - } - - self.postMessage({ - action: 'audioSegmentTimingInfo', - audioSegmentTimingInfo: audioSegmentTimingInfo - }); - }); - transmuxer.on('id3Frame', function (id3Frame) { - self.postMessage({ - action: 'id3Frame', - id3Frame: id3Frame - }); - }); - transmuxer.on('caption', function (caption) { - self.postMessage({ - action: 'caption', - caption: caption - }); - }); - transmuxer.on('trackinfo', function (trackInfo) { - self.postMessage({ - action: 'trackinfo', - trackInfo: trackInfo - }); - }); - transmuxer.on('audioTimingInfo', function (audioTimingInfo) { - // convert to video TS since we prioritize video time over audio - self.postMessage({ - action: 'audioTimingInfo', - audioTimingInfo: { - start: clock.videoTsToSeconds(audioTimingInfo.start), - end: clock.videoTsToSeconds(audioTimingInfo.end) - } - }); - }); - transmuxer.on('videoTimingInfo', function (videoTimingInfo) { - self.postMessage({ - action: 'videoTimingInfo', - videoTimingInfo: { - start: clock.videoTsToSeconds(videoTimingInfo.start), - end: clock.videoTsToSeconds(videoTimingInfo.end) - } - }); - }); - }; - /** - * All incoming messages route through this hash. If no function exists - * to handle an incoming message, then we ignore the message. - * - * @class MessageHandlers - * @param {Object} options the options to initialize with - */ - - - var MessageHandlers = /*#__PURE__*/function () { - function MessageHandlers(self, options) { - this.options = options || {}; - this.self = self; - this.init(); - } - /** - * initialize our web worker and wire all the events. - */ - - - var _proto = MessageHandlers.prototype; - - _proto.init = function init() { - if (this.transmuxer) { - this.transmuxer.dispose(); - } - - this.transmuxer = new transmuxer.Transmuxer(this.options); - wireTransmuxerEvents(this.self, this.transmuxer); - }; - - _proto.pushMp4Captions = function pushMp4Captions(data) { - if (!this.captionParser) { - this.captionParser = new captionParser(); - this.captionParser.init(); - } - - var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength); - var parsed = this.captionParser.parse(segment, data.trackIds, data.timescales); - this.self.postMessage({ - action: 'mp4Captions', - captions: parsed && parsed.captions || [], - data: segment.buffer - }, [segment.buffer]); - }; - - _proto.probeMp4StartTime = function probeMp4StartTime(_ref) { - var timescales = _ref.timescales, - data = _ref.data; - var startTime = probe$2.startTime(timescales, data); - this.self.postMessage({ - action: 'probeMp4StartTime', - startTime: startTime, - data: data - }, [data.buffer]); - }; - - _proto.probeMp4Tracks = function probeMp4Tracks(_ref2) { - var data = _ref2.data; - var tracks = probe$2.tracks(data); - this.self.postMessage({ - action: 'probeMp4Tracks', - tracks: tracks, - data: data - }, [data.buffer]); - } - /** - * Probe an mpeg2-ts segment to determine the start time of the segment in it's - * internal "media time," as well as whether it contains video and/or audio. - * - * @private - * @param {Uint8Array} bytes - segment bytes - * @param {number} baseStartTime - * Relative reference timestamp used when adjusting frame timestamps for rollover. - * This value should be in seconds, as it's converted to a 90khz clock within the - * function body. - * @return {Object} The start time of the current segment in "media time" as well as - * whether it contains video and/or audio - */ - ; - - _proto.probeTs = function probeTs(_ref3) { - var data = _ref3.data, - baseStartTime = _ref3.baseStartTime; - var tsStartTime = typeof baseStartTime === 'number' && !isNaN(baseStartTime) ? baseStartTime * clock.ONE_SECOND_IN_TS : void 0; - var timeInfo = tsInspector.inspect(data, tsStartTime); - var result = null; - - if (timeInfo) { - result = { - // each type's time info comes back as an array of 2 times, start and end - hasVideo: timeInfo.video && timeInfo.video.length === 2 || false, - hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false - }; - - if (result.hasVideo) { - result.videoStart = timeInfo.video[0].ptsTime; - } - - if (result.hasAudio) { - result.audioStart = timeInfo.audio[0].ptsTime; - } - } - - this.self.postMessage({ - action: 'probeTs', - result: result, - data: data - }, [data.buffer]); - }; - - _proto.clearAllMp4Captions = function clearAllMp4Captions() { - if (this.captionParser) { - this.captionParser.clearAllCaptions(); - } - }; - - _proto.clearParsedMp4Captions = function clearParsedMp4Captions() { - if (this.captionParser) { - this.captionParser.clearParsedCaptions(); - } - } - /** - * Adds data (a ts segment) to the start of the transmuxer pipeline for - * processing. - * - * @param {ArrayBuffer} data data to push into the muxer - */ - ; - - _proto.push = function push(data) { - // Cast array buffer to correct type for transmuxer - var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength); - this.transmuxer.push(segment); - } - /** - * Recreate the transmuxer so that the next segment added via `push` - * start with a fresh transmuxer. - */ - ; - - _proto.reset = function reset() { - this.transmuxer.reset(); - } - /** - * Set the value that will be used as the `baseMediaDecodeTime` time for the - * next segment pushed in. Subsequent segments will have their `baseMediaDecodeTime` - * set relative to the first based on the PTS values. - * - * @param {Object} data used to set the timestamp offset in the muxer - */ - ; - - _proto.setTimestampOffset = function setTimestampOffset(data) { - var timestampOffset = data.timestampOffset || 0; - this.transmuxer.setBaseMediaDecodeTime(Math.round(clock.secondsToVideoTs(timestampOffset))); - }; - - _proto.setAudioAppendStart = function setAudioAppendStart(data) { - this.transmuxer.setAudioAppendStart(Math.ceil(clock.secondsToVideoTs(data.appendStart))); - }; - - _proto.setRemux = function setRemux(data) { - this.transmuxer.setRemux(data.remux); - } - /** - * Forces the pipeline to finish processing the last segment and emit it's - * results. - * - * @param {Object} data event data, not really used - */ - ; - - _proto.flush = function flush(data) { - this.transmuxer.flush(); // transmuxed done action is fired after both audio/video pipelines are flushed - - self.postMessage({ - action: 'done', - type: 'transmuxed' - }); - }; - - _proto.endTimeline = function endTimeline() { - this.transmuxer.endTimeline(); // transmuxed endedtimeline action is fired after both audio/video pipelines end their - // timelines - - self.postMessage({ - action: 'endedtimeline', - type: 'transmuxed' - }); - }; - - _proto.alignGopsWith = function alignGopsWith(data) { - this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice()); - }; - - return MessageHandlers; - }(); - /** - * Our web worker interface so that things can talk to mux.js - * that will be running in a web worker. the scope is passed to this by - * webworkify. - * - * @param {Object} self the scope for the web worker - */ - - - self.onmessage = function (event) { - if (event.data.action === 'init' && event.data.options) { - this.messageHandlers = new MessageHandlers(self, event.data.options); - return; - } - - if (!this.messageHandlers) { - this.messageHandlers = new MessageHandlers(self); - } - - if (event.data && event.data.action && event.data.action !== 'init') { - if (this.messageHandlers[event.data.action]) { - this.messageHandlers[event.data.action](event.data); - } - } - }; - })); - var TransmuxWorker = factory(workerCode$1); - /* rollup-plugin-worker-factory end for worker!/Users/gkatsevman/p/http-streaming-release/src/transmuxer-worker.js */ - - var handleData_ = function handleData_(event, transmuxedData, callback) { - var _event$data$segment = event.data.segment, - type = _event$data$segment.type, - initSegment = _event$data$segment.initSegment, - captions = _event$data$segment.captions, - captionStreams = _event$data$segment.captionStreams, - metadata = _event$data$segment.metadata, - videoFrameDtsTime = _event$data$segment.videoFrameDtsTime, - videoFramePtsTime = _event$data$segment.videoFramePtsTime; - transmuxedData.buffer.push({ - captions: captions, - captionStreams: captionStreams, - metadata: metadata - }); - var boxes = event.data.segment.boxes || { - data: event.data.segment.data - }; - var result = { - type: type, - // cast ArrayBuffer to TypedArray - data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength), - initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength) - }; - - if (typeof videoFrameDtsTime !== 'undefined') { - result.videoFrameDtsTime = videoFrameDtsTime; - } - - if (typeof videoFramePtsTime !== 'undefined') { - result.videoFramePtsTime = videoFramePtsTime; - } - - callback(result); - }; - var handleDone_ = function handleDone_(_ref) { - var transmuxedData = _ref.transmuxedData, - callback = _ref.callback; - // Previously we only returned data on data events, - // not on done events. Clear out the buffer to keep that consistent. - transmuxedData.buffer = []; // all buffers should have been flushed from the muxer, so start processing anything we - // have received - - callback(transmuxedData); - }; - var handleGopInfo_ = function handleGopInfo_(event, transmuxedData) { - transmuxedData.gopInfo = event.data.gopInfo; - }; - var processTransmux = function processTransmux(options) { - var transmuxer = options.transmuxer, - bytes = options.bytes, - audioAppendStart = options.audioAppendStart, - gopsToAlignWith = options.gopsToAlignWith, - remux = options.remux, - onData = options.onData, - onTrackInfo = options.onTrackInfo, - onAudioTimingInfo = options.onAudioTimingInfo, - onVideoTimingInfo = options.onVideoTimingInfo, - onVideoSegmentTimingInfo = options.onVideoSegmentTimingInfo, - onAudioSegmentTimingInfo = options.onAudioSegmentTimingInfo, - onId3 = options.onId3, - onCaptions = options.onCaptions, - onDone = options.onDone, - onEndedTimeline = options.onEndedTimeline, - isEndOfTimeline = options.isEndOfTimeline; - var transmuxedData = { - buffer: [] - }; - var waitForEndedTimelineEvent = isEndOfTimeline; - - var handleMessage = function handleMessage(event) { - if (transmuxer.currentTransmux !== options) { - // disposed - return; - } - - if (event.data.action === 'data') { - handleData_(event, transmuxedData, onData); - } - - if (event.data.action === 'trackinfo') { - onTrackInfo(event.data.trackInfo); - } - - if (event.data.action === 'gopInfo') { - handleGopInfo_(event, transmuxedData); - } - - if (event.data.action === 'audioTimingInfo') { - onAudioTimingInfo(event.data.audioTimingInfo); - } - - if (event.data.action === 'videoTimingInfo') { - onVideoTimingInfo(event.data.videoTimingInfo); - } - - if (event.data.action === 'videoSegmentTimingInfo') { - onVideoSegmentTimingInfo(event.data.videoSegmentTimingInfo); - } - - if (event.data.action === 'audioSegmentTimingInfo') { - onAudioSegmentTimingInfo(event.data.audioSegmentTimingInfo); - } - - if (event.data.action === 'id3Frame') { - onId3([event.data.id3Frame], event.data.id3Frame.dispatchType); - } - - if (event.data.action === 'caption') { - onCaptions(event.data.caption); - } - - if (event.data.action === 'endedtimeline') { - waitForEndedTimelineEvent = false; - onEndedTimeline(); - } // wait for the transmuxed event since we may have audio and video - - - if (event.data.type !== 'transmuxed') { - return; - } // If the "endedtimeline" event has not yet fired, and this segment represents the end - // of a timeline, that means there may still be data events before the segment - // processing can be considerred complete. In that case, the final event should be - // an "endedtimeline" event with the type "transmuxed." - - - if (waitForEndedTimelineEvent) { - return; - } - - transmuxer.onmessage = null; - handleDone_({ - transmuxedData: transmuxedData, - callback: onDone - }); - /* eslint-disable no-use-before-define */ - - dequeue(transmuxer); - /* eslint-enable */ - }; - - transmuxer.onmessage = handleMessage; - - if (audioAppendStart) { - transmuxer.postMessage({ - action: 'setAudioAppendStart', - appendStart: audioAppendStart - }); - } // allow empty arrays to be passed to clear out GOPs - - - if (Array.isArray(gopsToAlignWith)) { - transmuxer.postMessage({ - action: 'alignGopsWith', - gopsToAlignWith: gopsToAlignWith - }); - } - - if (typeof remux !== 'undefined') { - transmuxer.postMessage({ - action: 'setRemux', - remux: remux - }); - } - - if (bytes.byteLength) { - var buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer; - var byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset; - transmuxer.postMessage({ - action: 'push', - // Send the typed-array of data as an ArrayBuffer so that - // it can be sent as a "Transferable" and avoid the costly - // memory copy - data: buffer, - // To recreate the original typed-array, we need information - // about what portion of the ArrayBuffer it was a view into - byteOffset: byteOffset, - byteLength: bytes.byteLength - }, [buffer]); - } - - if (isEndOfTimeline) { - transmuxer.postMessage({ - action: 'endTimeline' - }); - } // even if we didn't push any bytes, we have to make sure we flush in case we reached - // the end of the segment - - - transmuxer.postMessage({ - action: 'flush' - }); - }; - var dequeue = function dequeue(transmuxer) { - transmuxer.currentTransmux = null; - - if (transmuxer.transmuxQueue.length) { - transmuxer.currentTransmux = transmuxer.transmuxQueue.shift(); - - if (typeof transmuxer.currentTransmux === 'function') { - transmuxer.currentTransmux(); - } else { - processTransmux(transmuxer.currentTransmux); - } - } - }; - var processAction = function processAction(transmuxer, action) { - transmuxer.postMessage({ - action: action - }); - dequeue(transmuxer); - }; - var enqueueAction = function enqueueAction(action, transmuxer) { - if (!transmuxer.currentTransmux) { - transmuxer.currentTransmux = action; - processAction(transmuxer, action); - return; - } - - transmuxer.transmuxQueue.push(processAction.bind(null, transmuxer, action)); - }; - var reset = function reset(transmuxer) { - enqueueAction('reset', transmuxer); - }; - var endTimeline = function endTimeline(transmuxer) { - enqueueAction('endTimeline', transmuxer); - }; - var transmux = function transmux(options) { - if (!options.transmuxer.currentTransmux) { - options.transmuxer.currentTransmux = options; - processTransmux(options); - return; - } - - options.transmuxer.transmuxQueue.push(options); - }; - var createTransmuxer = function createTransmuxer(options) { - var transmuxer = new TransmuxWorker(); - transmuxer.currentTransmux = null; - transmuxer.transmuxQueue = []; - var term = transmuxer.terminate; - - transmuxer.terminate = function () { - transmuxer.currentTransmux = null; - transmuxer.transmuxQueue.length = 0; - return term.call(transmuxer); - }; - - transmuxer.postMessage({ - action: 'init', - options: options - }); - return transmuxer; - }; - var segmentTransmuxer = { - reset: reset, - endTimeline: endTimeline, - transmux: transmux, - createTransmuxer: createTransmuxer - }; - - var workerCallback = function workerCallback(options) { - var transmuxer = options.transmuxer; - var endAction = options.endAction || options.action; - var callback = options.callback; - - var message = _extends_1({}, options, { - endAction: null, - transmuxer: null, - callback: null - }); - - var listenForEndEvent = function listenForEndEvent(event) { - if (event.data.action !== endAction) { - return; - } - - transmuxer.removeEventListener('message', listenForEndEvent); // transfer ownership of bytes back to us. - - if (event.data.data) { - event.data.data = new Uint8Array(event.data.data, options.byteOffset || 0, options.byteLength || event.data.data.byteLength); - - if (options.data) { - options.data = event.data.data; - } - } - - callback(event.data); - }; - - transmuxer.addEventListener('message', listenForEndEvent); - - if (options.data) { - var isArrayBuffer = options.data instanceof ArrayBuffer; - message.byteOffset = isArrayBuffer ? 0 : options.data.byteOffset; - message.byteLength = options.data.byteLength; - var transfers = [isArrayBuffer ? options.data : options.data.buffer]; - transmuxer.postMessage(message, transfers); - } else { - transmuxer.postMessage(message); - } - }; - - var REQUEST_ERRORS = { - FAILURE: 2, - TIMEOUT: -101, - ABORTED: -102 - }; - /** - * Abort all requests - * - * @param {Object} activeXhrs - an object that tracks all XHR requests - */ - - var abortAll = function abortAll(activeXhrs) { - activeXhrs.forEach(function (xhr) { - xhr.abort(); - }); - }; - /** - * Gather important bandwidth stats once a request has completed - * - * @param {Object} request - the XHR request from which to gather stats - */ - - - var getRequestStats = function getRequestStats(request) { - return { - bandwidth: request.bandwidth, - bytesReceived: request.bytesReceived || 0, - roundTripTime: request.roundTripTime || 0 - }; - }; - /** - * If possible gather bandwidth stats as a request is in - * progress - * - * @param {Event} progressEvent - an event object from an XHR's progress event - */ - - - var getProgressStats = function getProgressStats(progressEvent) { - var request = progressEvent.target; - var roundTripTime = Date.now() - request.requestTime; - var stats = { - bandwidth: Infinity, - bytesReceived: 0, - roundTripTime: roundTripTime || 0 - }; - stats.bytesReceived = progressEvent.loaded; // This can result in Infinity if stats.roundTripTime is 0 but that is ok - // because we should only use bandwidth stats on progress to determine when - // abort a request early due to insufficient bandwidth - - stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1000); - return stats; - }; - /** - * Handle all error conditions in one place and return an object - * with all the information - * - * @param {Error|null} error - if non-null signals an error occured with the XHR - * @param {Object} request - the XHR request that possibly generated the error - */ - - - var handleErrors = function handleErrors(error, request) { - if (request.timedout) { - return { - status: request.status, - message: 'HLS request timed-out at URL: ' + request.uri, - code: REQUEST_ERRORS.TIMEOUT, - xhr: request - }; - } - - if (request.aborted) { - return { - status: request.status, - message: 'HLS request aborted at URL: ' + request.uri, - code: REQUEST_ERRORS.ABORTED, - xhr: request - }; - } - - if (error) { - return { - status: request.status, - message: 'HLS request errored at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }; - } - - if (request.responseType === 'arraybuffer' && request.response.byteLength === 0) { - return { - status: request.status, - message: 'Empty HLS response at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }; - } - - return null; - }; - /** - * Handle responses for key data and convert the key data to the correct format - * for the decryption step later - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Array} objects - objects to add the key bytes to. - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - - var handleKeyResponse = function handleKeyResponse(segment, objects, finishProcessingFn) { - return function (error, request) { - var response = request.response; - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - if (response.byteLength !== 16) { - return finishProcessingFn({ - status: request.status, - message: 'Invalid HLS key at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }, segment); - } - - var view = new DataView(response); - var bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]); - - for (var i = 0; i < objects.length; i++) { - objects[i].bytes = bytes; - } - - return finishProcessingFn(null, segment); - }; - }; - - var parseInitSegment = function parseInitSegment(segment, _callback) { - var type = detectContainerForBytes(segment.map.bytes); // TODO: We should also handle ts init segments here, but we - // only know how to parse mp4 init segments at the moment - - if (type !== 'mp4') { - var uri = segment.map.resolvedUri || segment.map.uri; - return _callback({ - internal: true, - message: "Found unsupported " + (type || 'unknown') + " container for initialization segment at URL: " + uri, - code: REQUEST_ERRORS.FAILURE - }); - } - - workerCallback({ - action: 'probeMp4Tracks', - data: segment.map.bytes, - transmuxer: segment.transmuxer, - callback: function callback(_ref) { - var tracks = _ref.tracks, - data = _ref.data; - // transfer bytes back to us - segment.map.bytes = data; - tracks.forEach(function (track) { - segment.map.tracks = segment.map.tracks || {}; // only support one track of each type for now - - if (segment.map.tracks[track.type]) { - return; - } - - segment.map.tracks[track.type] = track; - - if (typeof track.id === 'number' && track.timescale) { - segment.map.timescales = segment.map.timescales || {}; - segment.map.timescales[track.id] = track.timescale; - } - }); - return _callback(null); - } - }); - }; - /** - * Handle init-segment responses - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - - var handleInitSegmentResponse = function handleInitSegmentResponse(_ref2) { - var segment = _ref2.segment, - finishProcessingFn = _ref2.finishProcessingFn; - return function (error, request) { - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - var bytes = new Uint8Array(request.response); // init segment is encypted, we will have to wait - // until the key request is done to decrypt. - - if (segment.map.key) { - segment.map.encryptedBytes = bytes; - return finishProcessingFn(null, segment); - } - - segment.map.bytes = bytes; - parseInitSegment(segment, function (parseError) { - if (parseError) { - parseError.xhr = request; - parseError.status = request.status; - return finishProcessingFn(parseError, segment); - } - - finishProcessingFn(null, segment); - }); - }; - }; - /** - * Response handler for segment-requests being sure to set the correct - * property depending on whether the segment is encryped or not - * Also records and keeps track of stats that are used for ABR purposes - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ - - - var handleSegmentResponse = function handleSegmentResponse(_ref3) { - var segment = _ref3.segment, - finishProcessingFn = _ref3.finishProcessingFn, - responseType = _ref3.responseType; - return function (error, request) { - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - var newBytes = // although responseText "should" exist, this guard serves to prevent an error being - // thrown for two primary cases: - // 1. the mime type override stops working, or is not implemented for a specific - // browser - // 2. when using mock XHR libraries like sinon that do not allow the override behavior - responseType === 'arraybuffer' || !request.responseText ? request.response : stringToArrayBuffer(request.responseText.substring(segment.lastReachedChar || 0)); - segment.stats = getRequestStats(request); - - if (segment.key) { - segment.encryptedBytes = new Uint8Array(newBytes); - } else { - segment.bytes = new Uint8Array(newBytes); - } - - return finishProcessingFn(null, segment); - }; - }; - - var transmuxAndNotify = function transmuxAndNotify(_ref4) { - var segment = _ref4.segment, - bytes = _ref4.bytes, - trackInfoFn = _ref4.trackInfoFn, - timingInfoFn = _ref4.timingInfoFn, - videoSegmentTimingInfoFn = _ref4.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref4.audioSegmentTimingInfoFn, - id3Fn = _ref4.id3Fn, - captionsFn = _ref4.captionsFn, - isEndOfTimeline = _ref4.isEndOfTimeline, - endedTimelineFn = _ref4.endedTimelineFn, - dataFn = _ref4.dataFn, - doneFn = _ref4.doneFn; - var fmp4Tracks = segment.map && segment.map.tracks || {}; - var isMuxed = Boolean(fmp4Tracks.audio && fmp4Tracks.video); // Keep references to each function so we can null them out after we're done with them. - // One reason for this is that in the case of full segments, we want to trust start - // times from the probe, rather than the transmuxer. - - var audioStartFn = timingInfoFn.bind(null, segment, 'audio', 'start'); - var audioEndFn = timingInfoFn.bind(null, segment, 'audio', 'end'); - var videoStartFn = timingInfoFn.bind(null, segment, 'video', 'start'); - var videoEndFn = timingInfoFn.bind(null, segment, 'video', 'end'); - - var finish = function finish() { - return transmux({ - bytes: bytes, - transmuxer: segment.transmuxer, - audioAppendStart: segment.audioAppendStart, - gopsToAlignWith: segment.gopsToAlignWith, - remux: isMuxed, - onData: function onData(result) { - result.type = result.type === 'combined' ? 'video' : result.type; - dataFn(segment, result); - }, - onTrackInfo: function onTrackInfo(trackInfo) { - if (trackInfoFn) { - if (isMuxed) { - trackInfo.isMuxed = true; - } - - trackInfoFn(segment, trackInfo); - } - }, - onAudioTimingInfo: function onAudioTimingInfo(audioTimingInfo) { - // we only want the first start value we encounter - if (audioStartFn && typeof audioTimingInfo.start !== 'undefined') { - audioStartFn(audioTimingInfo.start); - audioStartFn = null; - } // we want to continually update the end time - - - if (audioEndFn && typeof audioTimingInfo.end !== 'undefined') { - audioEndFn(audioTimingInfo.end); - } - }, - onVideoTimingInfo: function onVideoTimingInfo(videoTimingInfo) { - // we only want the first start value we encounter - if (videoStartFn && typeof videoTimingInfo.start !== 'undefined') { - videoStartFn(videoTimingInfo.start); - videoStartFn = null; - } // we want to continually update the end time - - - if (videoEndFn && typeof videoTimingInfo.end !== 'undefined') { - videoEndFn(videoTimingInfo.end); - } - }, - onVideoSegmentTimingInfo: function onVideoSegmentTimingInfo(videoSegmentTimingInfo) { - videoSegmentTimingInfoFn(videoSegmentTimingInfo); - }, - onAudioSegmentTimingInfo: function onAudioSegmentTimingInfo(audioSegmentTimingInfo) { - audioSegmentTimingInfoFn(audioSegmentTimingInfo); - }, - onId3: function onId3(id3Frames, dispatchType) { - id3Fn(segment, id3Frames, dispatchType); - }, - onCaptions: function onCaptions(captions) { - captionsFn(segment, [captions]); - }, - isEndOfTimeline: isEndOfTimeline, - onEndedTimeline: function onEndedTimeline() { - endedTimelineFn(); - }, - onDone: function onDone(result) { - if (!doneFn) { - return; - } - - result.type = result.type === 'combined' ? 'video' : result.type; - doneFn(null, segment, result); - } - }); - }; // In the transmuxer, we don't yet have the ability to extract a "proper" start time. - // Meaning cached frame data may corrupt our notion of where this segment - // really starts. To get around this, probe for the info needed. - - - workerCallback({ - action: 'probeTs', - transmuxer: segment.transmuxer, - data: bytes, - baseStartTime: segment.baseStartTime, - callback: function callback(data) { - segment.bytes = bytes = data.data; - var probeResult = data.result; - - if (probeResult) { - trackInfoFn(segment, { - hasAudio: probeResult.hasAudio, - hasVideo: probeResult.hasVideo, - isMuxed: isMuxed - }); - trackInfoFn = null; - - if (probeResult.hasAudio && !isMuxed) { - audioStartFn(probeResult.audioStart); - } - - if (probeResult.hasVideo) { - videoStartFn(probeResult.videoStart); - } - - audioStartFn = null; - videoStartFn = null; - } - - finish(); - } - }); - }; - - var handleSegmentBytes = function handleSegmentBytes(_ref5) { - var segment = _ref5.segment, - bytes = _ref5.bytes, - trackInfoFn = _ref5.trackInfoFn, - timingInfoFn = _ref5.timingInfoFn, - videoSegmentTimingInfoFn = _ref5.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref5.audioSegmentTimingInfoFn, - id3Fn = _ref5.id3Fn, - captionsFn = _ref5.captionsFn, - isEndOfTimeline = _ref5.isEndOfTimeline, - endedTimelineFn = _ref5.endedTimelineFn, - dataFn = _ref5.dataFn, - doneFn = _ref5.doneFn; - var bytesAsUint8Array = new Uint8Array(bytes); // TODO: - // We should have a handler that fetches the number of bytes required - // to check if something is fmp4. This will allow us to save bandwidth - // because we can only blacklist a playlist and abort requests - // by codec after trackinfo triggers. - - if (isLikelyFmp4MediaSegment(bytesAsUint8Array)) { - segment.isFmp4 = true; - var tracks = segment.map.tracks; - var trackInfo = { - isFmp4: true, - hasVideo: !!tracks.video, - hasAudio: !!tracks.audio - }; // if we have a audio track, with a codec that is not set to - // encrypted audio - - if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== 'enca') { - trackInfo.audioCodec = tracks.audio.codec; - } // if we have a video track, with a codec that is not set to - // encrypted video - - - if (tracks.video && tracks.video.codec && tracks.video.codec !== 'encv') { - trackInfo.videoCodec = tracks.video.codec; - } - - if (tracks.video && tracks.audio) { - trackInfo.isMuxed = true; - } // since we don't support appending fmp4 data on progress, we know we have the full - // segment here - - - trackInfoFn(segment, trackInfo); // The probe doesn't provide the segment end time, so only callback with the start - // time. The end time can be roughly calculated by the receiver using the duration. - // - // Note that the start time returned by the probe reflects the baseMediaDecodeTime, as - // that is the true start of the segment (where the playback engine should begin - // decoding). - - var finishLoading = function finishLoading(captions) { - // if the track still has audio at this point it is only possible - // for it to be audio only. See `tracks.video && tracks.audio` if statement - // above. - // we make sure to use segment.bytes here as that - dataFn(segment, { - data: bytesAsUint8Array, - type: trackInfo.hasAudio && !trackInfo.isMuxed ? 'audio' : 'video' - }); - - if (captions && captions.length) { - captionsFn(segment, captions); - } - - doneFn(null, segment, {}); - }; - - workerCallback({ - action: 'probeMp4StartTime', - timescales: segment.map.timescales, - data: bytesAsUint8Array, - transmuxer: segment.transmuxer, - callback: function callback(_ref6) { - var data = _ref6.data, - startTime = _ref6.startTime; - // transfer bytes back to us - bytes = data.buffer; - segment.bytes = bytesAsUint8Array = data; - - if (trackInfo.hasAudio && !trackInfo.isMuxed) { - timingInfoFn(segment, 'audio', 'start', startTime); - } - - if (trackInfo.hasVideo) { - timingInfoFn(segment, 'video', 'start', startTime); - } // Run through the CaptionParser in case there are captions. - // Initialize CaptionParser if it hasn't been yet - - - if (!tracks.video || !data.byteLength || !segment.transmuxer) { - finishLoading(); - return; - } - - workerCallback({ - action: 'pushMp4Captions', - endAction: 'mp4Captions', - transmuxer: segment.transmuxer, - data: bytesAsUint8Array, - timescales: segment.map.timescales, - trackIds: [tracks.video.id], - callback: function callback(message) { - // transfer bytes back to us - bytes = message.data.buffer; - segment.bytes = bytesAsUint8Array = message.data; - finishLoading(message.captions); - } - }); - } - }); - return; - } // VTT or other segments that don't need processing - - - if (!segment.transmuxer) { - doneFn(null, segment, {}); - return; - } - - if (typeof segment.container === 'undefined') { - segment.container = detectContainerForBytes(bytesAsUint8Array); - } - - if (segment.container !== 'ts' && segment.container !== 'aac') { - trackInfoFn(segment, { - hasAudio: false, - hasVideo: false - }); - doneFn(null, segment, {}); - return; - } // ts or aac - - - transmuxAndNotify({ - segment: segment, - bytes: bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - }; - - var decrypt = function decrypt(_ref7, callback) { - var id = _ref7.id, - key = _ref7.key, - encryptedBytes = _ref7.encryptedBytes, - decryptionWorker = _ref7.decryptionWorker; - - var decryptionHandler = function decryptionHandler(event) { - if (event.data.source === id) { - decryptionWorker.removeEventListener('message', decryptionHandler); - var decrypted = event.data.decrypted; - callback(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength)); - } - }; - - decryptionWorker.addEventListener('message', decryptionHandler); - var keyBytes; - - if (key.bytes.slice) { - keyBytes = key.bytes.slice(); - } else { - keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes)); - } // incrementally decrypt the bytes - - - decryptionWorker.postMessage(createTransferableMessage({ - source: id, - encrypted: encryptedBytes, - key: keyBytes, - iv: key.iv - }), [encryptedBytes.buffer, keyBytes.buffer]); - }; - /** - * Decrypt the segment via the decryption web worker - * - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption - * routines - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Function} doneFn - a callback that is executed after decryption has completed - */ - - - var decryptSegment = function decryptSegment(_ref8) { - var decryptionWorker = _ref8.decryptionWorker, - segment = _ref8.segment, - trackInfoFn = _ref8.trackInfoFn, - timingInfoFn = _ref8.timingInfoFn, - videoSegmentTimingInfoFn = _ref8.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref8.audioSegmentTimingInfoFn, - id3Fn = _ref8.id3Fn, - captionsFn = _ref8.captionsFn, - isEndOfTimeline = _ref8.isEndOfTimeline, - endedTimelineFn = _ref8.endedTimelineFn, - dataFn = _ref8.dataFn, - doneFn = _ref8.doneFn; - decrypt({ - id: segment.requestId, - key: segment.key, - encryptedBytes: segment.encryptedBytes, - decryptionWorker: decryptionWorker - }, function (decryptedBytes) { - segment.bytes = decryptedBytes; - handleSegmentBytes({ - segment: segment, - bytes: segment.bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - }); - }; - /** - * This function waits for all XHRs to finish (with either success or failure) - * before continueing processing via it's callback. The function gathers errors - * from each request into a single errors array so that the error status for - * each request can be examined later. - * - * @param {Object} activeXhrs - an object that tracks all XHR requests - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption - * routines - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} id3Fn - a callback that receives ID3 metadata - * @param {Function} captionsFn - a callback that receives captions - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Function} doneFn - a callback that is executed after all resources have been - * downloaded and any decryption completed - */ - - - var waitForCompletion = function waitForCompletion(_ref9) { - var activeXhrs = _ref9.activeXhrs, - decryptionWorker = _ref9.decryptionWorker, - trackInfoFn = _ref9.trackInfoFn, - timingInfoFn = _ref9.timingInfoFn, - videoSegmentTimingInfoFn = _ref9.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref9.audioSegmentTimingInfoFn, - id3Fn = _ref9.id3Fn, - captionsFn = _ref9.captionsFn, - isEndOfTimeline = _ref9.isEndOfTimeline, - endedTimelineFn = _ref9.endedTimelineFn, - dataFn = _ref9.dataFn, - doneFn = _ref9.doneFn; - var count = 0; - var didError = false; - return function (error, segment) { - if (didError) { - return; - } - - if (error) { - didError = true; // If there are errors, we have to abort any outstanding requests - - abortAll(activeXhrs); // Even though the requests above are aborted, and in theory we could wait until we - // handle the aborted events from those requests, there are some cases where we may - // never get an aborted event. For instance, if the network connection is lost and - // there were two requests, the first may have triggered an error immediately, while - // the second request remains unsent. In that case, the aborted algorithm will not - // trigger an abort: see https://xhr.spec.whatwg.org/#the-abort()-method - // - // We also can't rely on the ready state of the XHR, since the request that - // triggered the connection error may also show as a ready state of 0 (unsent). - // Therefore, we have to finish this group of requests immediately after the first - // seen error. - - return doneFn(error, segment); - } - - count += 1; - - if (count === activeXhrs.length) { - var segmentFinish = function segmentFinish() { - if (segment.encryptedBytes) { - return decryptSegment({ - decryptionWorker: decryptionWorker, - segment: segment, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - } // Otherwise, everything is ready just continue - - - handleSegmentBytes({ - segment: segment, - bytes: segment.bytes, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); - }; // Keep track of when *all* of the requests have completed - - - segment.endOfAllRequests = Date.now(); - - if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) { - return decrypt({ - decryptionWorker: decryptionWorker, - // add -init to the "id" to differentiate between segment - // and init segment decryption, just in case they happen - // at the same time at some point in the future. - id: segment.requestId + '-init', - encryptedBytes: segment.map.encryptedBytes, - key: segment.map.key - }, function (decryptedBytes) { - segment.map.bytes = decryptedBytes; - parseInitSegment(segment, function (parseError) { - if (parseError) { - abortAll(activeXhrs); - return doneFn(parseError, segment); - } - - segmentFinish(); - }); - }); - } - - segmentFinish(); - } - }; - }; - /** - * Calls the abort callback if any request within the batch was aborted. Will only call - * the callback once per batch of requests, even if multiple were aborted. - * - * @param {Object} loadendState - state to check to see if the abort function was called - * @param {Function} abortFn - callback to call for abort - */ - - - var handleLoadEnd = function handleLoadEnd(_ref10) { - var loadendState = _ref10.loadendState, - abortFn = _ref10.abortFn; - return function (event) { - var request = event.target; - - if (request.aborted && abortFn && !loadendState.calledAbortFn) { - abortFn(); - loadendState.calledAbortFn = true; - } - }; - }; - /** - * Simple progress event callback handler that gathers some stats before - * executing a provided callback with the `segment` object - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} progressFn - a callback that is executed each time a progress event - * is received - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that is executed when segment bytes are available - * and ready to use - * @param {Event} event - the progress event object from XMLHttpRequest - */ - - - var handleProgress = function handleProgress(_ref11) { - var segment = _ref11.segment, - progressFn = _ref11.progressFn; - _ref11.trackInfoFn; - _ref11.timingInfoFn; - _ref11.videoSegmentTimingInfoFn; - _ref11.audioSegmentTimingInfoFn; - _ref11.id3Fn; - _ref11.captionsFn; - _ref11.isEndOfTimeline; - _ref11.endedTimelineFn; - _ref11.dataFn; - return function (event) { - var request = event.target; - - if (request.aborted) { - return; - } - - segment.stats = videojs__default['default'].mergeOptions(segment.stats, getProgressStats(event)); // record the time that we receive the first byte of data - - if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) { - segment.stats.firstBytesReceivedAt = Date.now(); - } - - return progressFn(event, segment); - }; - }; - /** - * Load all resources and does any processing necessary for a media-segment - * - * Features: - * decrypts the media-segment if it has a key uri and an iv - * aborts *all* requests if *any* one request fails - * - * The segment object, at minimum, has the following format: - * { - * resolvedUri: String, - * [transmuxer]: Object, - * [byterange]: { - * offset: Number, - * length: Number - * }, - * [key]: { - * resolvedUri: String - * [byterange]: { - * offset: Number, - * length: Number - * }, - * iv: { - * bytes: Uint32Array - * } - * }, - * [map]: { - * resolvedUri: String, - * [byterange]: { - * offset: Number, - * length: Number - * }, - * [bytes]: Uint8Array - * } - * } - * ...where [name] denotes optional properties - * - * @param {Function} xhr - an instance of the xhr wrapper in xhr.js - * @param {Object} xhrOptions - the base options to provide to all xhr requests - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 - * decryption routines - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} abortFn - a callback called (only once) if any piece of a request was - * aborted - * @param {Function} progressFn - a callback that receives progress events from the main - * segment's xhr request - * @param {Function} trackInfoFn - a callback that receives track info - * @param {Function} timingInfoFn - a callback that receives timing info - * @param {Function} videoSegmentTimingInfoFn - * a callback that receives video timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} audioSegmentTimingInfoFn - * a callback that receives audio timing info based on media times and - * any adjustments made by the transmuxer - * @param {Function} id3Fn - a callback that receives ID3 metadata - * @param {Function} captionsFn - a callback that receives captions - * @param {boolean} isEndOfTimeline - * true if this segment represents the last segment in a timeline - * @param {Function} endedTimelineFn - * a callback made when a timeline is ended, will only be called if - * isEndOfTimeline is true - * @param {Function} dataFn - a callback that receives data from the main segment's xhr - * request, transmuxed if needed - * @param {Function} doneFn - a callback that is executed only once all requests have - * succeeded or failed - * @return {Function} a function that, when invoked, immediately aborts all - * outstanding requests - */ - - - var mediaSegmentRequest = function mediaSegmentRequest(_ref12) { - var xhr = _ref12.xhr, - xhrOptions = _ref12.xhrOptions, - decryptionWorker = _ref12.decryptionWorker, - segment = _ref12.segment, - abortFn = _ref12.abortFn, - progressFn = _ref12.progressFn, - trackInfoFn = _ref12.trackInfoFn, - timingInfoFn = _ref12.timingInfoFn, - videoSegmentTimingInfoFn = _ref12.videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn = _ref12.audioSegmentTimingInfoFn, - id3Fn = _ref12.id3Fn, - captionsFn = _ref12.captionsFn, - isEndOfTimeline = _ref12.isEndOfTimeline, - endedTimelineFn = _ref12.endedTimelineFn, - dataFn = _ref12.dataFn, - doneFn = _ref12.doneFn; - var activeXhrs = []; - var finishProcessingFn = waitForCompletion({ - activeXhrs: activeXhrs, - decryptionWorker: decryptionWorker, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn, - doneFn: doneFn - }); // optionally, request the decryption key - - if (segment.key && !segment.key.bytes) { - var objects = [segment.key]; - - if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) { - objects.push(segment.map.key); - } - - var keyRequestOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.key.resolvedUri, - responseType: 'arraybuffer' - }); - var keyRequestCallback = handleKeyResponse(segment, objects, finishProcessingFn); - var keyXhr = xhr(keyRequestOptions, keyRequestCallback); - activeXhrs.push(keyXhr); - } // optionally, request the associated media init segment - - - if (segment.map && !segment.map.bytes) { - var differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri); - - if (differentMapKey) { - var mapKeyRequestOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.map.key.resolvedUri, - responseType: 'arraybuffer' - }); - var mapKeyRequestCallback = handleKeyResponse(segment, [segment.map.key], finishProcessingFn); - var mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback); - activeXhrs.push(mapKeyXhr); - } - - var initSegmentOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.map.resolvedUri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment.map) - }); - var initSegmentRequestCallback = handleInitSegmentResponse({ - segment: segment, - finishProcessingFn: finishProcessingFn - }); - var initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback); - activeXhrs.push(initSegmentXhr); - } - - var segmentRequestOptions = videojs__default['default'].mergeOptions(xhrOptions, { - uri: segment.part && segment.part.resolvedUri || segment.resolvedUri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment) - }); - var segmentRequestCallback = handleSegmentResponse({ - segment: segment, - finishProcessingFn: finishProcessingFn, - responseType: segmentRequestOptions.responseType - }); - var segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback); - segmentXhr.addEventListener('progress', handleProgress({ - segment: segment, - progressFn: progressFn, - trackInfoFn: trackInfoFn, - timingInfoFn: timingInfoFn, - videoSegmentTimingInfoFn: videoSegmentTimingInfoFn, - audioSegmentTimingInfoFn: audioSegmentTimingInfoFn, - id3Fn: id3Fn, - captionsFn: captionsFn, - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: endedTimelineFn, - dataFn: dataFn - })); - activeXhrs.push(segmentXhr); // since all parts of the request must be considered, but should not make callbacks - // multiple times, provide a shared state object - - var loadendState = {}; - activeXhrs.forEach(function (activeXhr) { - activeXhr.addEventListener('loadend', handleLoadEnd({ - loadendState: loadendState, - abortFn: abortFn - })); - }); - return function () { - return abortAll(activeXhrs); - }; - }; - - /** - * @file - codecs.js - Handles tasks regarding codec strings such as translating them to - * codec strings, or translating codec strings into objects that can be examined. - */ - var logFn$1 = logger('CodecUtils'); - /** - * Returns a set of codec strings parsed from the playlist or the default - * codec strings if no codecs were specified in the playlist - * - * @param {Playlist} media the current media playlist - * @return {Object} an object with the video and audio codecs - */ - - var getCodecs = function getCodecs(media) { - // if the codecs were explicitly specified, use them instead of the - // defaults - var mediaAttributes = media.attributes || {}; - - if (mediaAttributes.CODECS) { - return parseCodecs(mediaAttributes.CODECS); - } - }; - - var isMaat = function isMaat(master, media) { - var mediaAttributes = media.attributes || {}; - return master && master.mediaGroups && master.mediaGroups.AUDIO && mediaAttributes.AUDIO && master.mediaGroups.AUDIO[mediaAttributes.AUDIO]; - }; - var isMuxed = function isMuxed(master, media) { - if (!isMaat(master, media)) { - return true; - } - - var mediaAttributes = media.attributes || {}; - var audioGroup = master.mediaGroups.AUDIO[mediaAttributes.AUDIO]; - - for (var groupId in audioGroup) { - // If an audio group has a URI (the case for HLS, as HLS will use external playlists), - // or there are listed playlists (the case for DASH, as the manifest will have already - // provided all of the details necessary to generate the audio playlist, as opposed to - // HLS' externally requested playlists), then the content is demuxed. - if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) { - return true; - } - } - - return false; - }; - var unwrapCodecList = function unwrapCodecList(codecList) { - var codecs = {}; - codecList.forEach(function (_ref) { - var mediaType = _ref.mediaType, - type = _ref.type, - details = _ref.details; - codecs[mediaType] = codecs[mediaType] || []; - codecs[mediaType].push(translateLegacyCodec("" + type + details)); - }); - Object.keys(codecs).forEach(function (mediaType) { - if (codecs[mediaType].length > 1) { - logFn$1("multiple " + mediaType + " codecs found as attributes: " + codecs[mediaType].join(', ') + ". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."); - codecs[mediaType] = null; - return; - } - - codecs[mediaType] = codecs[mediaType][0]; - }); - return codecs; - }; - var codecCount = function codecCount(codecObj) { - var count = 0; - - if (codecObj.audio) { - count++; - } - - if (codecObj.video) { - count++; - } - - return count; - }; - /** - * Calculates the codec strings for a working configuration of - * SourceBuffers to play variant streams in a master playlist. If - * there is no possible working configuration, an empty object will be - * returned. - * - * @param master {Object} the m3u8 object for the master playlist - * @param media {Object} the m3u8 object for the variant playlist - * @return {Object} the codec strings. - * - * @private - */ - - var codecsForPlaylist = function codecsForPlaylist(master, media) { - var mediaAttributes = media.attributes || {}; - var codecInfo = unwrapCodecList(getCodecs(media) || []); // HLS with multiple-audio tracks must always get an audio codec. - // Put another way, there is no way to have a video-only multiple-audio HLS! - - if (isMaat(master, media) && !codecInfo.audio) { - if (!isMuxed(master, media)) { - // It is possible for codecs to be specified on the audio media group playlist but - // not on the rendition playlist. This is mostly the case for DASH, where audio and - // video are always separate (and separately specified). - var defaultCodecs = unwrapCodecList(codecsFromDefault(master, mediaAttributes.AUDIO) || []); - - if (defaultCodecs.audio) { - codecInfo.audio = defaultCodecs.audio; - } - } - } - - return codecInfo; - }; - - var logFn = logger('PlaylistSelector'); - - var representationToString = function representationToString(representation) { - if (!representation || !representation.playlist) { - return; - } - - var playlist = representation.playlist; - return JSON.stringify({ - id: playlist.id, - bandwidth: representation.bandwidth, - width: representation.width, - height: representation.height, - codecs: playlist.attributes && playlist.attributes.CODECS || '' - }); - }; // Utilities - - /** - * Returns the CSS value for the specified property on an element - * using `getComputedStyle`. Firefox has a long-standing issue where - * getComputedStyle() may return null when running in an iframe with - * `display: none`. - * - * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - * @param {HTMLElement} el the htmlelement to work on - * @param {string} the proprety to get the style for - */ - - - var safeGetComputedStyle = function safeGetComputedStyle(el, property) { - if (!el) { - return ''; - } - - var result = window__default['default'].getComputedStyle(el); - - if (!result) { - return ''; - } - - return result[property]; - }; - /** - * Resuable stable sort function - * - * @param {Playlists} array - * @param {Function} sortFn Different comparators - * @function stableSort - */ - - - var stableSort = function stableSort(array, sortFn) { - var newArray = array.slice(); - array.sort(function (left, right) { - var cmp = sortFn(left, right); - - if (cmp === 0) { - return newArray.indexOf(left) - newArray.indexOf(right); - } - - return cmp; - }); - }; - /** - * A comparator function to sort two playlist object by bandwidth. - * - * @param {Object} left a media playlist object - * @param {Object} right a media playlist object - * @return {number} Greater than zero if the bandwidth attribute of - * left is greater than the corresponding attribute of right. Less - * than zero if the bandwidth of right is greater than left and - * exactly zero if the two are equal. - */ - - - var comparePlaylistBandwidth = function comparePlaylistBandwidth(left, right) { - var leftBandwidth; - var rightBandwidth; - - if (left.attributes.BANDWIDTH) { - leftBandwidth = left.attributes.BANDWIDTH; - } - - leftBandwidth = leftBandwidth || window__default['default'].Number.MAX_VALUE; - - if (right.attributes.BANDWIDTH) { - rightBandwidth = right.attributes.BANDWIDTH; - } - - rightBandwidth = rightBandwidth || window__default['default'].Number.MAX_VALUE; - return leftBandwidth - rightBandwidth; - }; - /** - * A comparator function to sort two playlist object by resolution (width). - * - * @param {Object} left a media playlist object - * @param {Object} right a media playlist object - * @return {number} Greater than zero if the resolution.width attribute of - * left is greater than the corresponding attribute of right. Less - * than zero if the resolution.width of right is greater than left and - * exactly zero if the two are equal. - */ - - var comparePlaylistResolution = function comparePlaylistResolution(left, right) { - var leftWidth; - var rightWidth; - - if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) { - leftWidth = left.attributes.RESOLUTION.width; - } - - leftWidth = leftWidth || window__default['default'].Number.MAX_VALUE; - - if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) { - rightWidth = right.attributes.RESOLUTION.width; - } - - rightWidth = rightWidth || window__default['default'].Number.MAX_VALUE; // NOTE - Fallback to bandwidth sort as appropriate in cases where multiple renditions - // have the same media dimensions/ resolution - - if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) { - return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH; - } - - return leftWidth - rightWidth; - }; - /** - * Chooses the appropriate media playlist based on bandwidth and player size - * - * @param {Object} master - * Object representation of the master manifest - * @param {number} playerBandwidth - * Current calculated bandwidth of the player - * @param {number} playerWidth - * Current width of the player element (should account for the device pixel ratio) - * @param {number} playerHeight - * Current height of the player element (should account for the device pixel ratio) - * @param {boolean} limitRenditionByPlayerDimensions - * True if the player width and height should be used during the selection, false otherwise - * @param {Object} masterPlaylistController - * the current masterPlaylistController object - * @return {Playlist} the highest bitrate playlist less than the - * currently detected bandwidth, accounting for some amount of - * bandwidth variance - */ - - var simpleSelector = function simpleSelector(master, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, masterPlaylistController) { - // If we end up getting called before `master` is available, exit early - if (!master) { - return; - } - - var options = { - bandwidth: playerBandwidth, - width: playerWidth, - height: playerHeight, - limitRenditionByPlayerDimensions: limitRenditionByPlayerDimensions - }; - var playlists = master.playlists; // if playlist is audio only, select between currently active audio group playlists. - - if (Playlist.isAudioOnly(master)) { - playlists = masterPlaylistController.getAudioTrackPlaylists_(); // add audioOnly to options so that we log audioOnly: true - // at the buttom of this function for debugging. - - options.audioOnly = true; - } // convert the playlists to an intermediary representation to make comparisons easier - - - var sortedPlaylistReps = playlists.map(function (playlist) { - var bandwidth; - var width = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width; - var height = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height; - bandwidth = playlist.attributes && playlist.attributes.BANDWIDTH; - bandwidth = bandwidth || window__default['default'].Number.MAX_VALUE; - return { - bandwidth: bandwidth, - width: width, - height: height, - playlist: playlist - }; - }); - stableSort(sortedPlaylistReps, function (left, right) { - return left.bandwidth - right.bandwidth; - }); // filter out any playlists that have been excluded due to - // incompatible configurations - - sortedPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return !Playlist.isIncompatible(rep.playlist); - }); // filter out any playlists that have been disabled manually through the representations - // api or blacklisted temporarily due to playback errors. - - var enabledPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return Playlist.isEnabled(rep.playlist); - }); - - if (!enabledPlaylistReps.length) { - // if there are no enabled playlists, then they have all been blacklisted or disabled - // by the user through the representations api. In this case, ignore blacklisting and - // fallback to what the user wants by using playlists the user has not disabled. - enabledPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return !Playlist.isDisabled(rep.playlist); - }); - } // filter out any variant that has greater effective bitrate - // than the current estimated bandwidth - - - var bandwidthPlaylistReps = enabledPlaylistReps.filter(function (rep) { - return rep.bandwidth * Config.BANDWIDTH_VARIANCE < playerBandwidth; - }); - var highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1]; // get all of the renditions with the same (highest) bandwidth - // and then taking the very first element - - var bandwidthBestRep = bandwidthPlaylistReps.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; // if we're not going to limit renditions by player size, make an early decision. - - if (limitRenditionByPlayerDimensions === false) { - var _chosenRep = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0]; - - if (_chosenRep && _chosenRep.playlist) { - var type = 'sortedPlaylistReps'; - - if (bandwidthBestRep) { - type = 'bandwidthBestRep'; - } - - if (enabledPlaylistReps[0]) { - type = 'enabledPlaylistReps'; - } - - logFn("choosing " + representationToString(_chosenRep) + " using " + type + " with options", options); - return _chosenRep.playlist; - } - - logFn('could not choose a playlist with options', options); - return null; - } // filter out playlists without resolution information - - - var haveResolution = bandwidthPlaylistReps.filter(function (rep) { - return rep.width && rep.height; - }); // sort variants by resolution - - stableSort(haveResolution, function (left, right) { - return left.width - right.width; - }); // if we have the exact resolution as the player use it - - var resolutionBestRepList = haveResolution.filter(function (rep) { - return rep.width === playerWidth && rep.height === playerHeight; - }); - highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1]; // ensure that we pick the highest bandwidth variant that have exact resolution - - var resolutionBestRep = resolutionBestRepList.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - var resolutionPlusOneList; - var resolutionPlusOneSmallest; - var resolutionPlusOneRep; // find the smallest variant that is larger than the player - // if there is no match of exact resolution - - if (!resolutionBestRep) { - resolutionPlusOneList = haveResolution.filter(function (rep) { - return rep.width > playerWidth || rep.height > playerHeight; - }); // find all the variants have the same smallest resolution - - resolutionPlusOneSmallest = resolutionPlusOneList.filter(function (rep) { - return rep.width === resolutionPlusOneList[0].width && rep.height === resolutionPlusOneList[0].height; - }); // ensure that we also pick the highest bandwidth variant that - // is just-larger-than the video player - - highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1]; - resolutionPlusOneRep = resolutionPlusOneSmallest.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - } // fallback chain of variants - - - var chosenRep = resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0]; - - if (chosenRep && chosenRep.playlist) { - var _type = 'sortedPlaylistReps'; - - if (resolutionPlusOneRep) { - _type = 'resolutionPlusOneRep'; - } else if (resolutionBestRep) { - _type = 'resolutionBestRep'; - } else if (bandwidthBestRep) { - _type = 'bandwidthBestRep'; - } else if (enabledPlaylistReps[0]) { - _type = 'enabledPlaylistReps'; - } - - logFn("choosing " + representationToString(chosenRep) + " using " + _type + " with options", options); - return chosenRep.playlist; - } - - logFn('could not choose a playlist with options', options); - return null; - }; - - /** - * Chooses the appropriate media playlist based on the most recent - * bandwidth estimate and the player size. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @return {Playlist} the highest bitrate playlist less than the - * currently detected bandwidth, accounting for some amount of - * bandwidth variance - */ - - var lastBandwidthSelector = function lastBandwidthSelector() { - var pixelRatio = this.useDevicePixelRatio ? window__default['default'].devicePixelRatio || 1 : 1; - return simpleSelector(this.playlists.master, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); - }; - /** - * Chooses the appropriate media playlist based on an - * exponential-weighted moving average of the bandwidth after - * filtering for player size. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @param {number} decay - a number between 0 and 1. Higher values of - * this parameter will cause previous bandwidth estimates to lose - * significance more quickly. - * @return {Function} a function which can be invoked to create a new - * playlist selector function. - * @see https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average - */ - - var movingAverageBandwidthSelector = function movingAverageBandwidthSelector(decay) { - var average = -1; - var lastSystemBandwidth = -1; - - if (decay < 0 || decay > 1) { - throw new Error('Moving average bandwidth decay must be between 0 and 1.'); - } - - return function () { - var pixelRatio = this.useDevicePixelRatio ? window__default['default'].devicePixelRatio || 1 : 1; - - if (average < 0) { - average = this.systemBandwidth; - lastSystemBandwidth = this.systemBandwidth; - } // stop the average value from decaying for every 250ms - // when the systemBandwidth is constant - // and - // stop average from setting to a very low value when the - // systemBandwidth becomes 0 in case of chunk cancellation - - - if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) { - average = decay * this.systemBandwidth + (1 - decay) * average; - lastSystemBandwidth = this.systemBandwidth; - } - - return simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); - }; - }; - /** - * Chooses the appropriate media playlist based on the potential to rebuffer - * - * @param {Object} settings - * Object of information required to use this selector - * @param {Object} settings.master - * Object representation of the master manifest - * @param {number} settings.currentTime - * The current time of the player - * @param {number} settings.bandwidth - * Current measured bandwidth - * @param {number} settings.duration - * Duration of the media - * @param {number} settings.segmentDuration - * Segment duration to be used in round trip time calculations - * @param {number} settings.timeUntilRebuffer - * Time left in seconds until the player has to rebuffer - * @param {number} settings.currentTimeline - * The current timeline segments are being loaded from - * @param {SyncController} settings.syncController - * SyncController for determining if we have a sync point for a given playlist - * @return {Object|null} - * {Object} return.playlist - * The highest bandwidth playlist with the least amount of rebuffering - * {Number} return.rebufferingImpact - * The amount of time in seconds switching to this playlist will rebuffer. A - * negative value means that switching will cause zero rebuffering. - */ - - var minRebufferMaxBandwidthSelector = function minRebufferMaxBandwidthSelector(settings) { - var master = settings.master, - currentTime = settings.currentTime, - bandwidth = settings.bandwidth, - duration = settings.duration, - segmentDuration = settings.segmentDuration, - timeUntilRebuffer = settings.timeUntilRebuffer, - currentTimeline = settings.currentTimeline, - syncController = settings.syncController; // filter out any playlists that have been excluded due to - // incompatible configurations - - var compatiblePlaylists = master.playlists.filter(function (playlist) { - return !Playlist.isIncompatible(playlist); - }); // filter out any playlists that have been disabled manually through the representations - // api or blacklisted temporarily due to playback errors. - - var enabledPlaylists = compatiblePlaylists.filter(Playlist.isEnabled); - - if (!enabledPlaylists.length) { - // if there are no enabled playlists, then they have all been blacklisted or disabled - // by the user through the representations api. In this case, ignore blacklisting and - // fallback to what the user wants by using playlists the user has not disabled. - enabledPlaylists = compatiblePlaylists.filter(function (playlist) { - return !Playlist.isDisabled(playlist); - }); - } - - var bandwidthPlaylists = enabledPlaylists.filter(Playlist.hasAttribute.bind(null, 'BANDWIDTH')); - var rebufferingEstimates = bandwidthPlaylists.map(function (playlist) { - var syncPoint = syncController.getSyncPoint(playlist, duration, currentTimeline, currentTime); // If there is no sync point for this playlist, switching to it will require a - // sync request first. This will double the request time - - var numRequests = syncPoint ? 1 : 2; - var requestTimeEstimate = Playlist.estimateSegmentRequestTime(segmentDuration, bandwidth, playlist); - var rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer; - return { - playlist: playlist, - rebufferingImpact: rebufferingImpact - }; - }); - var noRebufferingPlaylists = rebufferingEstimates.filter(function (estimate) { - return estimate.rebufferingImpact <= 0; - }); // Sort by bandwidth DESC - - stableSort(noRebufferingPlaylists, function (a, b) { - return comparePlaylistBandwidth(b.playlist, a.playlist); - }); - - if (noRebufferingPlaylists.length) { - return noRebufferingPlaylists[0]; - } - - stableSort(rebufferingEstimates, function (a, b) { - return a.rebufferingImpact - b.rebufferingImpact; - }); - return rebufferingEstimates[0] || null; - }; - /** - * Chooses the appropriate media playlist, which in this case is the lowest bitrate - * one with video. If no renditions with video exist, return the lowest audio rendition. - * - * Expects to be called within the context of an instance of VhsHandler - * - * @return {Object|null} - * {Object} return.playlist - * The lowest bitrate playlist that contains a video codec. If no such rendition - * exists pick the lowest audio rendition. - */ - - var lowestBitrateCompatibleVariantSelector = function lowestBitrateCompatibleVariantSelector() { - var _this = this; - - // filter out any playlists that have been excluded due to - // incompatible configurations or playback errors - var playlists = this.playlists.master.playlists.filter(Playlist.isEnabled); // Sort ascending by bitrate - - stableSort(playlists, function (a, b) { - return comparePlaylistBandwidth(a, b); - }); // Parse and assume that playlists with no video codec have no video - // (this is not necessarily true, although it is generally true). - // - // If an entire manifest has no valid videos everything will get filtered - // out. - - var playlistsWithVideo = playlists.filter(function (playlist) { - return !!codecsForPlaylist(_this.playlists.master, playlist).video; - }); - return playlistsWithVideo[0] || null; - }; - - /** - * Combine all segments into a single Uint8Array - * - * @param {Object} segmentObj - * @return {Uint8Array} concatenated bytes - * @private - */ - var concatSegments = function concatSegments(segmentObj) { - var offset = 0; - var tempBuffer; - - if (segmentObj.bytes) { - tempBuffer = new Uint8Array(segmentObj.bytes); // combine the individual segments into one large typed-array - - segmentObj.segments.forEach(function (segment) { - tempBuffer.set(segment, offset); - offset += segment.byteLength; - }); - } - - return tempBuffer; - }; - - /** - * @file text-tracks.js - */ - /** - * Create captions text tracks on video.js if they do not exist - * - * @param {Object} inbandTextTracks a reference to current inbandTextTracks - * @param {Object} tech the video.js tech - * @param {Object} captionStream the caption stream to create - * @private - */ - - var createCaptionsTrackIfNotExists = function createCaptionsTrackIfNotExists(inbandTextTracks, tech, captionStream) { - if (!inbandTextTracks[captionStream]) { - tech.trigger({ - type: 'usage', - name: 'vhs-608' - }); - tech.trigger({ - type: 'usage', - name: 'hls-608' - }); - var instreamId = captionStream; // we need to translate SERVICEn for 708 to how mux.js currently labels them - - if (/^cc708_/.test(captionStream)) { - instreamId = 'SERVICE' + captionStream.split('_')[1]; - } - - var track = tech.textTracks().getTrackById(instreamId); - - if (track) { - // Resuse an existing track with a CC# id because this was - // very likely created by videojs-contrib-hls from information - // in the m3u8 for us to use - inbandTextTracks[captionStream] = track; - } else { - // This section gets called when we have caption services that aren't specified in the manifest. - // Manifest level caption services are handled in media-groups.js under CLOSED-CAPTIONS. - var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {}; - var label = captionStream; - var language = captionStream; - var def = false; - var captionService = captionServices[instreamId]; - - if (captionService) { - label = captionService.label; - language = captionService.language; - def = captionService.default; - } // Otherwise, create a track with the default `CC#` label and - // without a language - - - inbandTextTracks[captionStream] = tech.addRemoteTextTrack({ - kind: 'captions', - id: instreamId, - // TODO: investigate why this doesn't seem to turn the caption on by default - default: def, - label: label, - language: language - }, false).track; - } - } - }; - /** - * Add caption text track data to a source handler given an array of captions - * - * @param {Object} - * @param {Object} inbandTextTracks the inband text tracks - * @param {number} timestampOffset the timestamp offset of the source buffer - * @param {Array} captionArray an array of caption data - * @private - */ - - var addCaptionData = function addCaptionData(_ref) { - var inbandTextTracks = _ref.inbandTextTracks, - captionArray = _ref.captionArray, - timestampOffset = _ref.timestampOffset; - - if (!captionArray) { - return; - } - - var Cue = window__default['default'].WebKitDataCue || window__default['default'].VTTCue; - captionArray.forEach(function (caption) { - var track = caption.stream; - inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset, caption.endTime + timestampOffset, caption.text)); - }); - }; - /** - * Define properties on a cue for backwards compatability, - * but warn the user that the way that they are using it - * is depricated and will be removed at a later date. - * - * @param {Cue} cue the cue to add the properties on - * @private - */ - - var deprecateOldCue = function deprecateOldCue(cue) { - Object.defineProperties(cue.frame, { - id: { - get: function get() { - videojs__default['default'].log.warn('cue.frame.id is deprecated. Use cue.value.key instead.'); - return cue.value.key; - } - }, - value: { - get: function get() { - videojs__default['default'].log.warn('cue.frame.value is deprecated. Use cue.value.data instead.'); - return cue.value.data; - } - }, - privateData: { - get: function get() { - videojs__default['default'].log.warn('cue.frame.privateData is deprecated. Use cue.value.data instead.'); - return cue.value.data; - } - } - }); - }; - /** - * Add metadata text track data to a source handler given an array of metadata - * - * @param {Object} - * @param {Object} inbandTextTracks the inband text tracks - * @param {Array} metadataArray an array of meta data - * @param {number} timestampOffset the timestamp offset of the source buffer - * @param {number} videoDuration the duration of the video - * @private - */ - - - var addMetadata = function addMetadata(_ref2) { - var inbandTextTracks = _ref2.inbandTextTracks, - metadataArray = _ref2.metadataArray, - timestampOffset = _ref2.timestampOffset, - videoDuration = _ref2.videoDuration; - - if (!metadataArray) { - return; - } - - var Cue = window__default['default'].WebKitDataCue || window__default['default'].VTTCue; - var metadataTrack = inbandTextTracks.metadataTrack_; - - if (!metadataTrack) { - return; - } - - metadataArray.forEach(function (metadata) { - var time = metadata.cueTime + timestampOffset; // if time isn't a finite number between 0 and Infinity, like NaN, - // ignore this bit of metadata. - // This likely occurs when you have an non-timed ID3 tag like TIT2, - // which is the "Title/Songname/Content description" frame - - if (typeof time !== 'number' || window__default['default'].isNaN(time) || time < 0 || !(time < Infinity)) { - return; - } - - metadata.frames.forEach(function (frame) { - var cue = new Cue(time, time, frame.value || frame.url || frame.data || ''); - cue.frame = frame; - cue.value = frame; - deprecateOldCue(cue); - metadataTrack.addCue(cue); - }); - }); - - if (!metadataTrack.cues || !metadataTrack.cues.length) { - return; - } // Updating the metadeta cues so that - // the endTime of each cue is the startTime of the next cue - // the endTime of last cue is the duration of the video - - - var cues = metadataTrack.cues; - var cuesArray = []; // Create a copy of the TextTrackCueList... - // ...disregarding cues with a falsey value - - for (var i = 0; i < cues.length; i++) { - if (cues[i]) { - cuesArray.push(cues[i]); - } - } // Group cues by their startTime value - - - var cuesGroupedByStartTime = cuesArray.reduce(function (obj, cue) { - var timeSlot = obj[cue.startTime] || []; - timeSlot.push(cue); - obj[cue.startTime] = timeSlot; - return obj; - }, {}); // Sort startTimes by ascending order - - var sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort(function (a, b) { - return Number(a) - Number(b); - }); // Map each cue group's endTime to the next group's startTime - - sortedStartTimes.forEach(function (startTime, idx) { - var cueGroup = cuesGroupedByStartTime[startTime]; - var nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration; // Map each cue's endTime the next group's startTime - - cueGroup.forEach(function (cue) { - cue.endTime = nextTime; - }); - }); - }; - /** - * Create metadata text track on video.js if it does not exist - * - * @param {Object} inbandTextTracks a reference to current inbandTextTracks - * @param {string} dispatchType the inband metadata track dispatch type - * @param {Object} tech the video.js tech - * @private - */ - - var createMetadataTrackIfNotExists = function createMetadataTrackIfNotExists(inbandTextTracks, dispatchType, tech) { - if (inbandTextTracks.metadataTrack_) { - return; - } - - inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({ - kind: 'metadata', - label: 'Timed Metadata' - }, false).track; - inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType; - }; - /** - * Remove cues from a track on video.js. - * - * @param {Double} start start of where we should remove the cue - * @param {Double} end end of where the we should remove the cue - * @param {Object} track the text track to remove the cues from - * @private - */ - - var removeCuesFromTrack = function removeCuesFromTrack(start, end, track) { - var i; - var cue; - - if (!track) { - return; - } - - if (!track.cues) { - return; - } - - i = track.cues.length; - - while (i--) { - cue = track.cues[i]; // Remove any cue within the provided start and end time - - if (cue.startTime >= start && cue.endTime <= end) { - track.removeCue(cue); - } - } - }; - /** - * Remove duplicate cues from a track on video.js (a cue is considered a - * duplicate if it has the same time interval and text as another) - * - * @param {Object} track the text track to remove the duplicate cues from - * @private - */ - - var removeDuplicateCuesFromTrack = function removeDuplicateCuesFromTrack(track) { - var cues = track.cues; - - if (!cues) { - return; - } - - for (var i = 0; i < cues.length; i++) { - var duplicates = []; - var occurrences = 0; - - for (var j = 0; j < cues.length; j++) { - if (cues[i].startTime === cues[j].startTime && cues[i].endTime === cues[j].endTime && cues[i].text === cues[j].text) { - occurrences++; - - if (occurrences > 1) { - duplicates.push(cues[j]); - } - } - } - - if (duplicates.length) { - duplicates.forEach(function (dupe) { - return track.removeCue(dupe); - }); - } - } - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var ONE_SECOND_IN_TS = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - - /** - * Returns a list of gops in the buffer that have a pts value of 3 seconds or more in - * front of current time. - * - * @param {Array} buffer - * The current buffer of gop information - * @param {number} currentTime - * The current time - * @param {Double} mapping - * Offset to map display time to stream presentation time - * @return {Array} - * List of gops considered safe to append over - */ - - var gopsSafeToAlignWith = function gopsSafeToAlignWith(buffer, currentTime, mapping) { - if (typeof currentTime === 'undefined' || currentTime === null || !buffer.length) { - return []; - } // pts value for current time + 3 seconds to give a bit more wiggle room - - - var currentTimePts = Math.ceil((currentTime - mapping + 3) * clock.ONE_SECOND_IN_TS); - var i; - - for (i = 0; i < buffer.length; i++) { - if (buffer[i].pts > currentTimePts) { - break; - } - } - - return buffer.slice(i); - }; - /** - * Appends gop information (timing and byteLength) received by the transmuxer for the - * gops appended in the last call to appendBuffer - * - * @param {Array} buffer - * The current buffer of gop information - * @param {Array} gops - * List of new gop information - * @param {boolean} replace - * If true, replace the buffer with the new gop information. If false, append the - * new gop information to the buffer in the right location of time. - * @return {Array} - * Updated list of gop information - */ - - var updateGopBuffer = function updateGopBuffer(buffer, gops, replace) { - if (!gops.length) { - return buffer; - } - - if (replace) { - // If we are in safe append mode, then completely overwrite the gop buffer - // with the most recent appeneded data. This will make sure that when appending - // future segments, we only try to align with gops that are both ahead of current - // time and in the last segment appended. - return gops.slice(); - } - - var start = gops[0].pts; - var i = 0; - - for (i; i < buffer.length; i++) { - if (buffer[i].pts >= start) { - break; - } - } - - return buffer.slice(0, i).concat(gops); - }; - /** - * Removes gop information in buffer that overlaps with provided start and end - * - * @param {Array} buffer - * The current buffer of gop information - * @param {Double} start - * position to start the remove at - * @param {Double} end - * position to end the remove at - * @param {Double} mapping - * Offset to map display time to stream presentation time - */ - - var removeGopBuffer = function removeGopBuffer(buffer, start, end, mapping) { - var startPts = Math.ceil((start - mapping) * clock.ONE_SECOND_IN_TS); - var endPts = Math.ceil((end - mapping) * clock.ONE_SECOND_IN_TS); - var updatedBuffer = buffer.slice(); - var i = buffer.length; - - while (i--) { - if (buffer[i].pts <= endPts) { - break; - } - } - - if (i === -1) { - // no removal because end of remove range is before start of buffer - return updatedBuffer; - } - - var j = i + 1; - - while (j--) { - if (buffer[j].pts <= startPts) { - break; - } - } // clamp remove range start to 0 index - - - j = Math.max(j, 0); - updatedBuffer.splice(j, i - j + 1); - return updatedBuffer; - }; - - var shallowEqual = function shallowEqual(a, b) { - // if both are undefined - // or one or the other is undefined - // they are not equal - if (!a && !b || !a && b || a && !b) { - return false; - } // they are the same object and thus, equal - - - if (a === b) { - return true; - } // sort keys so we can make sure they have - // all the same keys later. - - - var akeys = Object.keys(a).sort(); - var bkeys = Object.keys(b).sort(); // different number of keys, not equal - - if (akeys.length !== bkeys.length) { - return false; - } - - for (var i = 0; i < akeys.length; i++) { - var key = akeys[i]; // different sorted keys, not equal - - if (key !== bkeys[i]) { - return false; - } // different values, not equal - - - if (a[key] !== b[key]) { - return false; - } - } - - return true; - }; - - // https://www.w3.org/TR/WebIDL-1/#quotaexceedederror - var QUOTA_EXCEEDED_ERR = 22; - - /** - * The segment loader has no recourse except to fetch a segment in the - * current playlist and use the internal timestamps in that segment to - * generate a syncPoint. This function returns a good candidate index - * for that process. - * - * @param {Array} segments - the segments array from a playlist. - * @return {number} An index of a segment from the playlist to load - */ - - var getSyncSegmentCandidate = function getSyncSegmentCandidate(currentTimeline, segments, targetTime) { - segments = segments || []; - var timelineSegments = []; - var time = 0; - - for (var i = 0; i < segments.length; i++) { - var segment = segments[i]; - - if (currentTimeline === segment.timeline) { - timelineSegments.push(i); - time += segment.duration; - - if (time > targetTime) { - return i; - } - } - } - - if (timelineSegments.length === 0) { - return 0; - } // default to the last timeline segment - - - return timelineSegments[timelineSegments.length - 1]; - }; // In the event of a quota exceeded error, keep at least one second of back buffer. This - // number was arbitrarily chosen and may be updated in the future, but seemed reasonable - // as a start to prevent any potential issues with removing content too close to the - // playhead. - - var MIN_BACK_BUFFER = 1; // in ms - - var CHECK_BUFFER_DELAY = 500; - - var finite = function finite(num) { - return typeof num === 'number' && isFinite(num); - }; // With most content hovering around 30fps, if a segment has a duration less than a half - // frame at 30fps or one frame at 60fps, the bandwidth and throughput calculations will - // not accurately reflect the rest of the content. - - - var MIN_SEGMENT_DURATION_TO_SAVE_STATS = 1 / 60; - var illegalMediaSwitch = function illegalMediaSwitch(loaderType, startingMedia, trackInfo) { - // Although these checks should most likely cover non 'main' types, for now it narrows - // the scope of our checks. - if (loaderType !== 'main' || !startingMedia || !trackInfo) { - return null; - } - - if (!trackInfo.hasAudio && !trackInfo.hasVideo) { - return 'Neither audio nor video found in segment.'; - } - - if (startingMedia.hasVideo && !trackInfo.hasVideo) { - return 'Only audio found in segment when we expected video.' + ' We can\'t switch to audio only from a stream that had video.' + ' To get rid of this message, please add codec information to the manifest.'; - } - - if (!startingMedia.hasVideo && trackInfo.hasVideo) { - return 'Video found in segment when we expected only audio.' + ' We can\'t switch to a stream with video from an audio only stream.' + ' To get rid of this message, please add codec information to the manifest.'; - } - - return null; - }; - /** - * Calculates a time value that is safe to remove from the back buffer without interrupting - * playback. - * - * @param {TimeRange} seekable - * The current seekable range - * @param {number} currentTime - * The current time of the player - * @param {number} targetDuration - * The target duration of the current playlist - * @return {number} - * Time that is safe to remove from the back buffer without interrupting playback - */ - - var safeBackBufferTrimTime = function safeBackBufferTrimTime(seekable, currentTime, targetDuration) { - // 30 seconds before the playhead provides a safe default for trimming. - // - // Choosing a reasonable default is particularly important for high bitrate content and - // VOD videos/live streams with large windows, as the buffer may end up overfilled and - // throw an APPEND_BUFFER_ERR. - var trimTime = currentTime - Config.BACK_BUFFER_LENGTH; - - if (seekable.length) { - // Some live playlists may have a shorter window of content than the full allowed back - // buffer. For these playlists, don't save content that's no longer within the window. - trimTime = Math.max(trimTime, seekable.start(0)); - } // Don't remove within target duration of the current time to avoid the possibility of - // removing the GOP currently being played, as removing it can cause playback stalls. - - - var maxTrimTime = currentTime - targetDuration; - return Math.min(maxTrimTime, trimTime); - }; - - var segmentInfoString = function segmentInfoString(segmentInfo) { - var startOfSegment = segmentInfo.startOfSegment, - duration = segmentInfo.duration, - segment = segmentInfo.segment, - part = segmentInfo.part, - _segmentInfo$playlist = segmentInfo.playlist, - seq = _segmentInfo$playlist.mediaSequence, - id = _segmentInfo$playlist.id, - _segmentInfo$playlist2 = _segmentInfo$playlist.segments, - segments = _segmentInfo$playlist2 === void 0 ? [] : _segmentInfo$playlist2, - index = segmentInfo.mediaIndex, - partIndex = segmentInfo.partIndex, - timeline = segmentInfo.timeline; - var segmentLen = segments.length - 1; - var selection = 'mediaIndex/partIndex increment'; - - if (segmentInfo.getMediaInfoForTime) { - selection = "getMediaInfoForTime (" + segmentInfo.getMediaInfoForTime + ")"; - } else if (segmentInfo.isSyncRequest) { - selection = 'getSyncSegmentCandidate (isSyncRequest)'; - } - - var hasPartIndex = typeof partIndex === 'number'; - var name = segmentInfo.segment.uri ? 'segment' : 'pre-segment'; - var zeroBasedPartCount = hasPartIndex ? getKnownPartCount({ - preloadSegment: segment - }) - 1 : 0; - return name + " [" + (seq + index) + "/" + (seq + segmentLen) + "]" + (hasPartIndex ? " part [" + partIndex + "/" + zeroBasedPartCount + "]" : '') + (" segment start/end [" + segment.start + " => " + segment.end + "]") + (hasPartIndex ? " part start/end [" + part.start + " => " + part.end + "]" : '') + (" startOfSegment [" + startOfSegment + "]") + (" duration [" + duration + "]") + (" timeline [" + timeline + "]") + (" selected by [" + selection + "]") + (" playlist [" + id + "]"); - }; - - var timingInfoPropertyForMedia = function timingInfoPropertyForMedia(mediaType) { - return mediaType + "TimingInfo"; - }; - /** - * Returns the timestamp offset to use for the segment. - * - * @param {number} segmentTimeline - * The timeline of the segment - * @param {number} currentTimeline - * The timeline currently being followed by the loader - * @param {number} startOfSegment - * The estimated segment start - * @param {TimeRange[]} buffered - * The loader's buffer - * @param {boolean} overrideCheck - * If true, no checks are made to see if the timestamp offset value should be set, - * but sets it directly to a value. - * - * @return {number|null} - * Either a number representing a new timestamp offset, or null if the segment is - * part of the same timeline - */ - - - var timestampOffsetForSegment = function timestampOffsetForSegment(_ref) { - var segmentTimeline = _ref.segmentTimeline, - currentTimeline = _ref.currentTimeline, - startOfSegment = _ref.startOfSegment, - buffered = _ref.buffered, - overrideCheck = _ref.overrideCheck; - - // Check to see if we are crossing a discontinuity to see if we need to set the - // timestamp offset on the transmuxer and source buffer. - // - // Previously, we changed the timestampOffset if the start of this segment was less than - // the currently set timestampOffset, but this isn't desirable as it can produce bad - // behavior, especially around long running live streams. - if (!overrideCheck && segmentTimeline === currentTimeline) { - return null; - } // When changing renditions, it's possible to request a segment on an older timeline. For - // instance, given two renditions with the following: - // - // #EXTINF:10 - // segment1 - // #EXT-X-DISCONTINUITY - // #EXTINF:10 - // segment2 - // #EXTINF:10 - // segment3 - // - // And the current player state: - // - // current time: 8 - // buffer: 0 => 20 - // - // The next segment on the current rendition would be segment3, filling the buffer from - // 20s onwards. However, if a rendition switch happens after segment2 was requested, - // then the next segment to be requested will be segment1 from the new rendition in - // order to fill time 8 and onwards. Using the buffered end would result in repeated - // content (since it would position segment1 of the new rendition starting at 20s). This - // case can be identified when the new segment's timeline is a prior value. Instead of - // using the buffered end, the startOfSegment can be used, which, hopefully, will be - // more accurate to the actual start time of the segment. - - - if (segmentTimeline < currentTimeline) { - return startOfSegment; - } // segmentInfo.startOfSegment used to be used as the timestamp offset, however, that - // value uses the end of the last segment if it is available. While this value - // should often be correct, it's better to rely on the buffered end, as the new - // content post discontinuity should line up with the buffered end as if it were - // time 0 for the new content. - - - return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment; - }; - /** - * Returns whether or not the loader should wait for a timeline change from the timeline - * change controller before processing the segment. - * - * Primary timing in VHS goes by video. This is different from most media players, as - * audio is more often used as the primary timing source. For the foreseeable future, VHS - * will continue to use video as the primary timing source, due to the current logic and - * expectations built around it. - - * Since the timing follows video, in order to maintain sync, the video loader is - * responsible for setting both audio and video source buffer timestamp offsets. - * - * Setting different values for audio and video source buffers could lead to - * desyncing. The following examples demonstrate some of the situations where this - * distinction is important. Note that all of these cases involve demuxed content. When - * content is muxed, the audio and video are packaged together, therefore syncing - * separate media playlists is not an issue. - * - * CASE 1: Audio prepares to load a new timeline before video: - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, the audio loader is preparing to load the 6th segment, the first - * after a discontinuity, while the video loader is still loading the 5th segment, before - * the discontinuity. - * - * If the audio loader goes ahead and loads and appends the 6th segment before the video - * loader crosses the discontinuity, then when appended, the 6th audio segment will use - * the timestamp offset from timeline 0. This will likely lead to desyncing. In addition, - * the audio loader must provide the audioAppendStart value to trim the content in the - * transmuxer, and that value relies on the audio timestamp offset. Since the audio - * timestamp offset is set by the video (main) loader, the audio loader shouldn't load the - * segment until that value is provided. - * - * CASE 2: Video prepares to load a new timeline before audio: - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, the video loader is preparing to load the 6th segment, the first - * after a discontinuity, while the audio loader is still loading the 5th segment, before - * the discontinuity. - * - * If the video loader goes ahead and loads and appends the 6th segment, then once the - * segment is loaded and processed, both the video and audio timestamp offsets will be - * set, since video is used as the primary timing source. This is to ensure content lines - * up appropriately, as any modifications to the video timing are reflected by audio when - * the video loader sets the audio and video timestamp offsets to the same value. However, - * setting the timestamp offset for audio before audio has had a chance to change - * timelines will likely lead to desyncing, as the audio loader will append segment 5 with - * a timestamp intended to apply to segments from timeline 1 rather than timeline 0. - * - * CASE 3: When seeking, audio prepares to load a new timeline before video - * - * Timeline: 0 1 - * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Audio Loader: ^ - * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9 - * Video Loader ^ - * - * In the above example, both audio and video loaders are loading segments from timeline - * 0, but imagine that the seek originated from timeline 1. - * - * When seeking to a new timeline, the timestamp offset will be set based on the expected - * segment start of the loaded video segment. In order to maintain sync, the audio loader - * must wait for the video loader to load its segment and update both the audio and video - * timestamp offsets before it may load and append its own segment. This is the case - * whether the seek results in a mismatched segment request (e.g., the audio loader - * chooses to load segment 3 and the video loader chooses to load segment 4) or the - * loaders choose to load the same segment index from each playlist, as the segments may - * not be aligned perfectly, even for matching segment indexes. - * - * @param {Object} timelinechangeController - * @param {number} currentTimeline - * The timeline currently being followed by the loader - * @param {number} segmentTimeline - * The timeline of the segment being loaded - * @param {('main'|'audio')} loaderType - * The loader type - * @param {boolean} audioDisabled - * Whether the audio is disabled for the loader. This should only be true when the - * loader may have muxed audio in its segment, but should not append it, e.g., for - * the main loader when an alternate audio playlist is active. - * - * @return {boolean} - * Whether the loader should wait for a timeline change from the timeline change - * controller before processing the segment - */ - - var shouldWaitForTimelineChange = function shouldWaitForTimelineChange(_ref2) { - var timelineChangeController = _ref2.timelineChangeController, - currentTimeline = _ref2.currentTimeline, - segmentTimeline = _ref2.segmentTimeline, - loaderType = _ref2.loaderType, - audioDisabled = _ref2.audioDisabled; - - if (currentTimeline === segmentTimeline) { - return false; - } - - if (loaderType === 'audio') { - var lastMainTimelineChange = timelineChangeController.lastTimelineChange({ - type: 'main' - }); // Audio loader should wait if: - // - // * main hasn't had a timeline change yet (thus has not loaded its first segment) - // * main hasn't yet changed to the timeline audio is looking to load - - return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline; - } // The main loader only needs to wait for timeline changes if there's demuxed audio. - // Otherwise, there's nothing to wait for, since audio would be muxed into the main - // loader's segments (or the content is audio/video only and handled by the main - // loader). - - - if (loaderType === 'main' && audioDisabled) { - var pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({ - type: 'audio' - }); // Main loader should wait for the audio loader if audio is not pending a timeline - // change to the current timeline. - // - // Since the main loader is responsible for setting the timestamp offset for both - // audio and video, the main loader must wait for audio to be about to change to its - // timeline before setting the offset, otherwise, if audio is behind in loading, - // segments from the previous timeline would be adjusted by the new timestamp offset. - // - // This requirement means that video will not cross a timeline until the audio is - // about to cross to it, so that way audio and video will always cross the timeline - // together. - // - // In addition to normal timeline changes, these rules also apply to the start of a - // stream (going from a non-existent timeline, -1, to timeline 0). It's important - // that these rules apply to the first timeline change because if they did not, it's - // possible that the main loader will cross two timelines before the audio loader has - // crossed one. Logic may be implemented to handle the startup as a special case, but - // it's easier to simply treat all timeline changes the same. - - if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) { - return false; - } - - return true; - } - - return false; - }; - var mediaDuration = function mediaDuration(audioTimingInfo, videoTimingInfo) { - var audioDuration = audioTimingInfo && typeof audioTimingInfo.start === 'number' && typeof audioTimingInfo.end === 'number' ? audioTimingInfo.end - audioTimingInfo.start : 0; - var videoDuration = videoTimingInfo && typeof videoTimingInfo.start === 'number' && typeof videoTimingInfo.end === 'number' ? videoTimingInfo.end - videoTimingInfo.start : 0; - return Math.max(audioDuration, videoDuration); - }; - var segmentTooLong = function segmentTooLong(_ref3) { - var segmentDuration = _ref3.segmentDuration, - maxDuration = _ref3.maxDuration; - - // 0 duration segments are most likely due to metadata only segments or a lack of - // information. - if (!segmentDuration) { - return false; - } // For HLS: - // - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1 - // The EXTINF duration of each Media Segment in the Playlist - // file, when rounded to the nearest integer, MUST be less than or equal - // to the target duration; longer segments can trigger playback stalls - // or other errors. - // - // For DASH, the mpd-parser uses the largest reported segment duration as the target - // duration. Although that reported duration is occasionally approximate (i.e., not - // exact), a strict check may report that a segment is too long more often in DASH. - - - return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR; - }; - var getTroublesomeSegmentDurationMessage = function getTroublesomeSegmentDurationMessage(segmentInfo, sourceType) { - // Right now we aren't following DASH's timing model exactly, so only perform - // this check for HLS content. - if (sourceType !== 'hls') { - return null; - } - - var segmentDuration = mediaDuration(segmentInfo.audioTimingInfo, segmentInfo.videoTimingInfo); // Don't report if we lack information. - // - // If the segment has a duration of 0 it is either a lack of information or a - // metadata only segment and shouldn't be reported here. - - if (!segmentDuration) { - return null; - } - - var targetDuration = segmentInfo.playlist.targetDuration; - var isSegmentWayTooLong = segmentTooLong({ - segmentDuration: segmentDuration, - maxDuration: targetDuration * 2 - }); - var isSegmentSlightlyTooLong = segmentTooLong({ - segmentDuration: segmentDuration, - maxDuration: targetDuration - }); - var segmentTooLongMessage = "Segment with index " + segmentInfo.mediaIndex + " " + ("from playlist " + segmentInfo.playlist.id + " ") + ("has a duration of " + segmentDuration + " ") + ("when the reported duration is " + segmentInfo.duration + " ") + ("and the target duration is " + targetDuration + ". ") + 'For HLS content, a duration in excess of the target duration may result in ' + 'playback issues. See the HLS specification section on EXT-X-TARGETDURATION for ' + 'more details: ' + 'https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1'; - - if (isSegmentWayTooLong || isSegmentSlightlyTooLong) { - return { - severity: isSegmentWayTooLong ? 'warn' : 'info', - message: segmentTooLongMessage - }; - } - - return null; - }; - /** - * An object that manages segment loading and appending. - * - * @class SegmentLoader - * @param {Object} options required and optional options - * @extends videojs.EventTarget - */ - - var SegmentLoader = /*#__PURE__*/function (_videojs$EventTarget) { - inheritsLoose(SegmentLoader, _videojs$EventTarget); - - function SegmentLoader(settings, options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; // check pre-conditions - - if (!settings) { - throw new TypeError('Initialization settings are required'); - } - - if (typeof settings.currentTime !== 'function') { - throw new TypeError('No currentTime getter specified'); - } - - if (!settings.mediaSource) { - throw new TypeError('No MediaSource specified'); - } // public properties - - - _this.bandwidth = settings.bandwidth; - _this.throughput = { - rate: 0, - count: 0 - }; - _this.roundTrip = NaN; - - _this.resetStats_(); - - _this.mediaIndex = null; - _this.partIndex = null; // private settings - - _this.hasPlayed_ = settings.hasPlayed; - _this.currentTime_ = settings.currentTime; - _this.seekable_ = settings.seekable; - _this.seeking_ = settings.seeking; - _this.duration_ = settings.duration; - _this.mediaSource_ = settings.mediaSource; - _this.vhs_ = settings.vhs; - _this.loaderType_ = settings.loaderType; - _this.currentMediaInfo_ = void 0; - _this.startingMediaInfo_ = void 0; - _this.segmentMetadataTrack_ = settings.segmentMetadataTrack; - _this.goalBufferLength_ = settings.goalBufferLength; - _this.sourceType_ = settings.sourceType; - _this.sourceUpdater_ = settings.sourceUpdater; - _this.inbandTextTracks_ = settings.inbandTextTracks; - _this.state_ = 'INIT'; - _this.timelineChangeController_ = settings.timelineChangeController; - _this.shouldSaveSegmentTimingInfo_ = true; - _this.parse708captions_ = settings.parse708captions; // private instance variables - - _this.checkBufferTimeout_ = null; - _this.error_ = void 0; - _this.currentTimeline_ = -1; - _this.pendingSegment_ = null; - _this.xhrOptions_ = null; - _this.pendingSegments_ = []; - _this.audioDisabled_ = false; - _this.isPendingTimestampOffset_ = false; // TODO possibly move gopBuffer and timeMapping info to a separate controller - - _this.gopBuffer_ = []; - _this.timeMapping_ = 0; - _this.safeAppend_ = videojs__default['default'].browser.IE_VERSION >= 11; - _this.appendInitSegment_ = { - audio: true, - video: true - }; - _this.playlistOfLastInitSegment_ = { - audio: null, - video: null - }; - _this.callQueue_ = []; // If the segment loader prepares to load a segment, but does not have enough - // information yet to start the loading process (e.g., if the audio loader wants to - // load a segment from the next timeline but the main loader hasn't yet crossed that - // timeline), then the load call will be added to the queue until it is ready to be - // processed. - - _this.loadQueue_ = []; - _this.metadataQueue_ = { - id3: [], - caption: [] - }; - _this.waitingOnRemove_ = false; - _this.quotaExceededErrorRetryTimeout_ = null; // Fragmented mp4 playback - - _this.activeInitSegmentId_ = null; - _this.initSegments_ = {}; // HLSe playback - - _this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys; - _this.keyCache_ = {}; - _this.decrypter_ = settings.decrypter; // Manages the tracking and generation of sync-points, mappings - // between a time in the display time and a segment index within - // a playlist - - _this.syncController_ = settings.syncController; - _this.syncPoint_ = { - segmentIndex: 0, - time: 0 - }; - _this.transmuxer_ = _this.createTransmuxer_(); - - _this.triggerSyncInfoUpdate_ = function () { - return _this.trigger('syncinfoupdate'); - }; - - _this.syncController_.on('syncinfoupdate', _this.triggerSyncInfoUpdate_); - - _this.mediaSource_.addEventListener('sourceopen', function () { - if (!_this.isEndOfStream_()) { - _this.ended_ = false; - } - }); // ...for determining the fetch location - - - _this.fetchAtBuffer_ = false; - _this.logger_ = logger("SegmentLoader[" + _this.loaderType_ + "]"); - Object.defineProperty(assertThisInitialized(_this), 'state', { - get: function get() { - return this.state_; - }, - set: function set(newState) { - if (newState !== this.state_) { - this.logger_(this.state_ + " -> " + newState); - this.state_ = newState; - this.trigger('statechange'); - } - } - }); - - _this.sourceUpdater_.on('ready', function () { - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); // Only the main loader needs to listen for pending timeline changes, as the main - // loader should wait for audio to be ready to change its timeline so that both main - // and audio timelines change together. For more details, see the - // shouldWaitForTimelineChange function. - - - if (_this.loaderType_ === 'main') { - _this.timelineChangeController_.on('pendingtimelinechange', function () { - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); - } // The main loader only listens on pending timeline changes, but the audio loader, - // since its loads follow main, needs to listen on timeline changes. For more details, - // see the shouldWaitForTimelineChange function. - - - if (_this.loaderType_ === 'audio') { - _this.timelineChangeController_.on('timelinechange', function () { - if (_this.hasEnoughInfoToLoad_()) { - _this.processLoadQueue_(); - } - - if (_this.hasEnoughInfoToAppend_()) { - _this.processCallQueue_(); - } - }); - } - - return _this; - } - - var _proto = SegmentLoader.prototype; - - _proto.createTransmuxer_ = function createTransmuxer_() { - return segmentTransmuxer.createTransmuxer({ - remux: false, - alignGopsAtEnd: this.safeAppend_, - keepOriginalTimestamps: true, - parse708captions: this.parse708captions_ - }); - } - /** - * reset all of our media stats - * - * @private - */ - ; - - _proto.resetStats_ = function resetStats_() { - this.mediaBytesTransferred = 0; - this.mediaRequests = 0; - this.mediaRequestsAborted = 0; - this.mediaRequestsTimedout = 0; - this.mediaRequestsErrored = 0; - this.mediaTransferDuration = 0; - this.mediaSecondsLoaded = 0; - this.mediaAppends = 0; - } - /** - * dispose of the SegmentLoader and reset to the default state - */ - ; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.state = 'DISPOSED'; - this.pause(); - this.abort_(); - - if (this.transmuxer_) { - this.transmuxer_.terminate(); - } - - this.resetStats_(); - - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - } - - if (this.syncController_ && this.triggerSyncInfoUpdate_) { - this.syncController_.off('syncinfoupdate', this.triggerSyncInfoUpdate_); - } - - this.off(); - }; - - _proto.setAudio = function setAudio(enable) { - this.audioDisabled_ = !enable; - - if (enable) { - this.appendInitSegment_.audio = true; - } else { - // remove current track audio if it gets disabled - this.sourceUpdater_.removeAudio(0, this.duration_()); - } - } - /** - * abort anything that is currently doing on with the SegmentLoader - * and reset to a default state - */ - ; - - _proto.abort = function abort() { - if (this.state !== 'WAITING') { - if (this.pendingSegment_) { - this.pendingSegment_ = null; - } - - return; - } - - this.abort_(); // We aborted the requests we were waiting on, so reset the loader's state to READY - // since we are no longer "waiting" on any requests. XHR callback is not always run - // when the request is aborted. This will prevent the loader from being stuck in the - // WAITING state indefinitely. - - this.state = 'READY'; // don't wait for buffer check timeouts to begin fetching the - // next segment - - if (!this.paused()) { - this.monitorBuffer_(); - } - } - /** - * abort all pending xhr requests and null any pending segements - * - * @private - */ - ; - - _proto.abort_ = function abort_() { - if (this.pendingSegment_ && this.pendingSegment_.abortRequests) { - this.pendingSegment_.abortRequests(); - } // clear out the segment being processed - - - this.pendingSegment_ = null; - this.callQueue_ = []; - this.loadQueue_ = []; - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_); - this.waitingOnRemove_ = false; - window__default['default'].clearTimeout(this.quotaExceededErrorRetryTimeout_); - this.quotaExceededErrorRetryTimeout_ = null; - }; - - _proto.checkForAbort_ = function checkForAbort_(requestId) { - // If the state is APPENDING, then aborts will not modify the state, meaning the first - // callback that happens should reset the state to READY so that loading can continue. - if (this.state === 'APPENDING' && !this.pendingSegment_) { - this.state = 'READY'; - return true; - } - - if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) { - return true; - } - - return false; - } - /** - * set an error on the segment loader and null out any pending segements - * - * @param {Error} error the error to set on the SegmentLoader - * @return {Error} the error that was set or that is currently set - */ - ; - - _proto.error = function error(_error) { - if (typeof _error !== 'undefined') { - this.logger_('error occurred:', _error); - this.error_ = _error; - } - - this.pendingSegment_ = null; - return this.error_; - }; - - _proto.endOfStream = function endOfStream() { - this.ended_ = true; - - if (this.transmuxer_) { - // need to clear out any cached data to prepare for the new segment - segmentTransmuxer.reset(this.transmuxer_); - } - - this.gopBuffer_.length = 0; - this.pause(); - this.trigger('ended'); - } - /** - * Indicates which time ranges are buffered - * - * @return {TimeRange} - * TimeRange object representing the current buffered ranges - */ - ; - - _proto.buffered_ = function buffered_() { - if (!this.sourceUpdater_ || !this.startingMediaInfo_) { - return videojs__default['default'].createTimeRanges(); - } - - if (this.loaderType_ === 'main') { - var _this$startingMediaIn = this.startingMediaInfo_, - hasAudio = _this$startingMediaIn.hasAudio, - hasVideo = _this$startingMediaIn.hasVideo, - isMuxed = _this$startingMediaIn.isMuxed; - - if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed) { - return this.sourceUpdater_.buffered(); - } - - if (hasVideo) { - return this.sourceUpdater_.videoBuffered(); - } - } // One case that can be ignored for now is audio only with alt audio, - // as we don't yet have proper support for that. - - - return this.sourceUpdater_.audioBuffered(); - } - /** - * Gets and sets init segment for the provided map - * - * @param {Object} map - * The map object representing the init segment to get or set - * @param {boolean=} set - * If true, the init segment for the provided map should be saved - * @return {Object} - * map object for desired init segment - */ - ; - - _proto.initSegmentForMap = function initSegmentForMap(map, set) { - if (set === void 0) { - set = false; - } - - if (!map) { - return null; - } - - var id = initSegmentId(map); - var storedMap = this.initSegments_[id]; - - if (set && !storedMap && map.bytes) { - this.initSegments_[id] = storedMap = { - resolvedUri: map.resolvedUri, - byterange: map.byterange, - bytes: map.bytes, - tracks: map.tracks, - timescales: map.timescales - }; - } - - return storedMap || map; - } - /** - * Gets and sets key for the provided key - * - * @param {Object} key - * The key object representing the key to get or set - * @param {boolean=} set - * If true, the key for the provided key should be saved - * @return {Object} - * Key object for desired key - */ - ; - - _proto.segmentKey = function segmentKey(key, set) { - if (set === void 0) { - set = false; - } - - if (!key) { - return null; - } - - var id = segmentKeyId(key); - var storedKey = this.keyCache_[id]; // TODO: We should use the HTTP Expires header to invalidate our cache per - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-6.2.3 - - if (this.cacheEncryptionKeys_ && set && !storedKey && key.bytes) { - this.keyCache_[id] = storedKey = { - resolvedUri: key.resolvedUri, - bytes: key.bytes - }; - } - - var result = { - resolvedUri: (storedKey || key).resolvedUri - }; - - if (storedKey) { - result.bytes = storedKey.bytes; - } - - return result; - } - /** - * Returns true if all configuration required for loading is present, otherwise false. - * - * @return {boolean} True if the all configuration is ready for loading - * @private - */ - ; - - _proto.couldBeginLoading_ = function couldBeginLoading_() { - return this.playlist_ && !this.paused(); - } - /** - * load a playlist and start to fill the buffer - */ - ; - - _proto.load = function load() { - // un-pause - this.monitorBuffer_(); // if we don't have a playlist yet, keep waiting for one to be - // specified - - if (!this.playlist_) { - return; - } // if all the configuration is ready, initialize and begin loading - - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - return this.init_(); - } // if we're in the middle of processing a segment already, don't - // kick off an additional segment request - - - if (!this.couldBeginLoading_() || this.state !== 'READY' && this.state !== 'INIT') { - return; - } - - this.state = 'READY'; - } - /** - * Once all the starting parameters have been specified, begin - * operation. This method should only be invoked from the INIT - * state. - * - * @private - */ - ; - - _proto.init_ = function init_() { - this.state = 'READY'; // if this is the audio segment loader, and it hasn't been inited before, then any old - // audio data from the muxed content should be removed - - this.resetEverything(); - return this.monitorBuffer_(); - } - /** - * set a playlist on the segment loader - * - * @param {PlaylistLoader} media the playlist to set on the segment loader - */ - ; - - _proto.playlist = function playlist(newPlaylist, options) { - if (options === void 0) { - options = {}; - } - - if (!newPlaylist) { - return; - } - - var oldPlaylist = this.playlist_; - var segmentInfo = this.pendingSegment_; - this.playlist_ = newPlaylist; - this.xhrOptions_ = options; // when we haven't started playing yet, the start of a live playlist - // is always our zero-time so force a sync update each time the playlist - // is refreshed from the server - // - // Use the INIT state to determine if playback has started, as the playlist sync info - // should be fixed once requests begin (as sync points are generated based on sync - // info), but not before then. - - if (this.state === 'INIT') { - newPlaylist.syncInfo = { - mediaSequence: newPlaylist.mediaSequence, - time: 0 - }; // Setting the date time mapping means mapping the program date time (if available) - // to time 0 on the player's timeline. The playlist's syncInfo serves a similar - // purpose, mapping the initial mediaSequence to time zero. Since the syncInfo can - // be updated as the playlist is refreshed before the loader starts loading, the - // program date time mapping needs to be updated as well. - // - // This mapping is only done for the main loader because a program date time should - // map equivalently between playlists. - - if (this.loaderType_ === 'main') { - this.syncController_.setDateTimeMappingForStart(newPlaylist); - } - } - - var oldId = null; - - if (oldPlaylist) { - if (oldPlaylist.id) { - oldId = oldPlaylist.id; - } else if (oldPlaylist.uri) { - oldId = oldPlaylist.uri; - } - } - - this.logger_("playlist update [" + oldId + " => " + (newPlaylist.id || newPlaylist.uri) + "]"); // in VOD, this is always a rendition switch (or we updated our syncInfo above) - // in LIVE, we always want to update with new playlists (including refreshes) - - this.trigger('syncinfoupdate'); // if we were unpaused but waiting for a playlist, start - // buffering now - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - return this.init_(); - } - - if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) { - if (this.mediaIndex !== null) { - // we must "resync" the segment loader when we switch renditions and - // the segment loader is already synced to the previous rendition - this.resyncLoader(); - } - - this.currentMediaInfo_ = void 0; - this.trigger('playlistupdate'); // the rest of this function depends on `oldPlaylist` being defined - - return; - } // we reloaded the same playlist so we are in a live scenario - // and we will likely need to adjust the mediaIndex - - - var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; - this.logger_("live window shift [" + mediaSequenceDiff + "]"); // update the mediaIndex on the SegmentLoader - // this is important because we can abort a request and this value must be - // equal to the last appended mediaIndex - - if (this.mediaIndex !== null) { - this.mediaIndex -= mediaSequenceDiff; // this can happen if we are going to load the first segment, but get a playlist - // update during that. mediaIndex would go from 0 to -1 if mediaSequence in the - // new playlist was incremented by 1. - - if (this.mediaIndex < 0) { - this.mediaIndex = null; - this.partIndex = null; - } else { - var segment = this.playlist_.segments[this.mediaIndex]; // partIndex should remain the same for the same segment - // unless parts fell off of the playlist for this segment. - // In that case we need to reset partIndex and resync - - if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) { - var mediaIndex = this.mediaIndex; - this.logger_("currently processing part (index " + this.partIndex + ") no longer exists."); - this.resetLoader(); // We want to throw away the partIndex and the data associated with it, - // as the part was dropped from our current playlists segment. - // The mediaIndex will still be valid so keep that around. - - this.mediaIndex = mediaIndex; - } - } - } // update the mediaIndex on the SegmentInfo object - // this is important because we will update this.mediaIndex with this value - // in `handleAppendsDone_` after the segment has been successfully appended - - - if (segmentInfo) { - segmentInfo.mediaIndex -= mediaSequenceDiff; - - if (segmentInfo.mediaIndex < 0) { - segmentInfo.mediaIndex = null; - segmentInfo.partIndex = null; - } else { - // we need to update the referenced segment so that timing information is - // saved for the new playlist's segment, however, if the segment fell off the - // playlist, we can leave the old reference and just lose the timing info - if (segmentInfo.mediaIndex >= 0) { - segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex]; - } - - if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) { - segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex]; - } - } - } - - this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist); - } - /** - * Prevent the loader from fetching additional segments. If there - * is a segment request outstanding, it will finish processing - * before the loader halts. A segment loader can be unpaused by - * calling load(). - */ - ; - - _proto.pause = function pause() { - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - this.checkBufferTimeout_ = null; - } - } - /** - * Returns whether the segment loader is fetching additional - * segments when given the opportunity. This property can be - * modified through calls to pause() and load(). - */ - ; - - _proto.paused = function paused() { - return this.checkBufferTimeout_ === null; - } - /** - * Delete all the buffered data and reset the SegmentLoader - * - * @param {Function} [done] an optional callback to be executed when the remove - * operation is complete - */ - ; - - _proto.resetEverything = function resetEverything(done) { - this.ended_ = false; - this.appendInitSegment_ = { - audio: true, - video: true - }; - this.resetLoader(); // remove from 0, the earliest point, to Infinity, to signify removal of everything. - // VTT Segment Loader doesn't need to do anything but in the regular SegmentLoader, - // we then clamp the value to duration if necessary. - - this.remove(0, Infinity, done); // clears fmp4 captions - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearAllMp4Captions' - }); - } - } - /** - * Force the SegmentLoader to resync and start loading around the currentTime instead - * of starting at the end of the buffer - * - * Useful for fast quality changes - */ - ; - - _proto.resetLoader = function resetLoader() { - this.fetchAtBuffer_ = false; - this.resyncLoader(); - } - /** - * Force the SegmentLoader to restart synchronization and make a conservative guess - * before returning to the simple walk-forward method - */ - ; - - _proto.resyncLoader = function resyncLoader() { - if (this.transmuxer_) { - // need to clear out any cached data to prepare for the new segment - segmentTransmuxer.reset(this.transmuxer_); - } - - this.mediaIndex = null; - this.partIndex = null; - this.syncPoint_ = null; - this.isPendingTimestampOffset_ = false; - this.callQueue_ = []; - this.loadQueue_ = []; - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - this.abort(); - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearParsedMp4Captions' - }); - } - } - /** - * Remove any data in the source buffer between start and end times - * - * @param {number} start - the start time of the region to remove from the buffer - * @param {number} end - the end time of the region to remove from the buffer - * @param {Function} [done] - an optional callback to be executed when the remove - * @param {boolean} force - force all remove operations to happen - * operation is complete - */ - ; - - _proto.remove = function remove(start, end, done, force) { - if (done === void 0) { - done = function done() {}; - } - - if (force === void 0) { - force = false; - } - - // clamp end to duration if we need to remove everything. - // This is due to a browser bug that causes issues if we remove to Infinity. - // videojs/videojs-contrib-hls#1225 - if (end === Infinity) { - end = this.duration_(); - } // skip removes that would throw an error - // commonly happens during a rendition switch at the start of a video - // from start 0 to end 0 - - - if (end <= start) { - this.logger_('skipping remove because end ${end} is <= start ${start}'); - return; - } - - if (!this.sourceUpdater_ || !this.startingMediaInfo_) { - this.logger_('skipping remove because no source updater or starting media info'); // nothing to remove if we haven't processed any media - - return; - } // set it to one to complete this function's removes - - - var removesRemaining = 1; - - var removeFinished = function removeFinished() { - removesRemaining--; - - if (removesRemaining === 0) { - done(); - } - }; - - if (force || !this.audioDisabled_) { - removesRemaining++; - this.sourceUpdater_.removeAudio(start, end, removeFinished); - } // While it would be better to only remove video if the main loader has video, this - // should be safe with audio only as removeVideo will call back even if there's no - // video buffer. - // - // In theory we can check to see if there's video before calling the remove, but in - // the event that we're switching between renditions and from video to audio only - // (when we add support for that), we may need to clear the video contents despite - // what the new media will contain. - - - if (force || this.loaderType_ === 'main') { - this.gopBuffer_ = removeGopBuffer(this.gopBuffer_, start, end, this.timeMapping_); - removesRemaining++; - this.sourceUpdater_.removeVideo(start, end, removeFinished); - } // remove any captions and ID3 tags - - - for (var track in this.inbandTextTracks_) { - removeCuesFromTrack(start, end, this.inbandTextTracks_[track]); - } - - removeCuesFromTrack(start, end, this.segmentMetadataTrack_); // finished this function's removes - - removeFinished(); - } - /** - * (re-)schedule monitorBufferTick_ to run as soon as possible - * - * @private - */ - ; - - _proto.monitorBuffer_ = function monitorBuffer_() { - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - } - - this.checkBufferTimeout_ = window__default['default'].setTimeout(this.monitorBufferTick_.bind(this), 1); - } - /** - * As long as the SegmentLoader is in the READY state, periodically - * invoke fillBuffer_(). - * - * @private - */ - ; - - _proto.monitorBufferTick_ = function monitorBufferTick_() { - if (this.state === 'READY') { - this.fillBuffer_(); - } - - if (this.checkBufferTimeout_) { - window__default['default'].clearTimeout(this.checkBufferTimeout_); - } - - this.checkBufferTimeout_ = window__default['default'].setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY); - } - /** - * fill the buffer with segements unless the sourceBuffers are - * currently updating - * - * Note: this function should only ever be called by monitorBuffer_ - * and never directly - * - * @private - */ - ; - - _proto.fillBuffer_ = function fillBuffer_() { - // TODO since the source buffer maintains a queue, and we shouldn't call this function - // except when we're ready for the next segment, this check can most likely be removed - if (this.sourceUpdater_.updating()) { - return; - } // see if we need to begin loading immediately - - - var segmentInfo = this.chooseNextRequest_(); - - if (!segmentInfo) { - return; - } - - if (typeof segmentInfo.timestampOffset === 'number') { - this.isPendingTimestampOffset_ = false; - this.timelineChangeController_.pendingTimelineChange({ - type: this.loaderType_, - from: this.currentTimeline_, - to: segmentInfo.timeline - }); - } - - this.loadSegment_(segmentInfo); - } - /** - * Determines if we should call endOfStream on the media source based - * on the state of the buffer or if appened segment was the final - * segment in the playlist. - * - * @param {number} [mediaIndex] the media index of segment we last appended - * @param {Object} [playlist] a media playlist object - * @return {boolean} do we need to call endOfStream on the MediaSource - */ - ; - - _proto.isEndOfStream_ = function isEndOfStream_(mediaIndex, playlist, partIndex) { - if (mediaIndex === void 0) { - mediaIndex = this.mediaIndex; - } - - if (playlist === void 0) { - playlist = this.playlist_; - } - - if (partIndex === void 0) { - partIndex = this.partIndex; - } - - if (!playlist || !this.mediaSource_) { - return false; - } - - var segment = typeof mediaIndex === 'number' && playlist.segments[mediaIndex]; // mediaIndex is zero based but length is 1 based - - var appendedLastSegment = mediaIndex + 1 === playlist.segments.length; // true if there are no parts, or this is the last part. - - var appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length; // if we've buffered to the end of the video, we need to call endOfStream - // so that MediaSources can trigger the `ended` event when it runs out of - // buffered data instead of waiting for me - - return playlist.endList && this.mediaSource_.readyState === 'open' && appendedLastSegment && appendedLastPart; - } - /** - * Determines what request should be made given current segment loader state. - * - * @return {Object} a request object that describes the segment/part to load - */ - ; - - _proto.chooseNextRequest_ = function chooseNextRequest_() { - var bufferedEnd = lastBufferedEnd(this.buffered_()) || 0; - var bufferedTime = Math.max(0, bufferedEnd - this.currentTime_()); - var preloaded = !this.hasPlayed_() && bufferedTime >= 1; - var haveEnoughBuffer = bufferedTime >= this.goalBufferLength_(); - var segments = this.playlist_.segments; // return no segment if: - // 1. we don't have segments - // 2. The video has not yet played and we already downloaded a segment - // 3. we already have enough buffered time - - if (!segments.length || preloaded || haveEnoughBuffer) { - return null; - } - - this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_()); - var next = { - partIndex: null, - mediaIndex: null, - startOfSegment: null, - playlist: this.playlist_, - isSyncRequest: Boolean(!this.syncPoint_) - }; - - if (next.isSyncRequest) { - next.mediaIndex = getSyncSegmentCandidate(this.currentTimeline_, segments, bufferedEnd); - } else if (this.mediaIndex !== null) { - var segment = segments[this.mediaIndex]; - var partIndex = typeof this.partIndex === 'number' ? this.partIndex : -1; - next.startOfSegment = segment.end ? segment.end : bufferedEnd; - - if (segment.parts && segment.parts[partIndex + 1]) { - next.mediaIndex = this.mediaIndex; - next.partIndex = partIndex + 1; - } else { - next.mediaIndex = this.mediaIndex + 1; - } - } else { - // Find the segment containing the end of the buffer or current time. - var _Playlist$getMediaInf = Playlist.getMediaInfoForTime({ - playlist: this.playlist_, - currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(), - startingPartIndex: this.syncPoint_.partIndex, - startingSegmentIndex: this.syncPoint_.segmentIndex, - startTime: this.syncPoint_.time - }), - segmentIndex = _Playlist$getMediaInf.segmentIndex, - startTime = _Playlist$getMediaInf.startTime, - _partIndex = _Playlist$getMediaInf.partIndex; - - next.getMediaInfoForTime = this.fetchAtBuffer_ ? 'bufferedEnd' : 'currentTime'; - next.mediaIndex = segmentIndex; - next.startOfSegment = startTime; - next.partIndex = _partIndex; - } - - var nextSegment = segments[next.mediaIndex]; - var nextPart = nextSegment && typeof next.partIndex === 'number' && nextSegment.parts && nextSegment.parts[next.partIndex]; // if the next segment index is invalid or - // the next partIndex is invalid do not choose a next segment. - - if (!nextSegment || typeof next.partIndex === 'number' && !nextPart) { - return null; - } // if the next segment has parts, and we don't have a partIndex. - // Set partIndex to 0 - - - if (typeof next.partIndex !== 'number' && nextSegment.parts) { - next.partIndex = 0; - } - - var ended = this.mediaSource_ && this.mediaSource_.readyState === 'ended'; // do not choose a next segment if all of the following: - // 1. this is the last segment in the playlist - // 2. end of stream has been called on the media source already - // 3. the player is not seeking - - if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) { - return null; - } - - return this.generateSegmentInfo_(next); - }; - - _proto.generateSegmentInfo_ = function generateSegmentInfo_(options) { - var playlist = options.playlist, - mediaIndex = options.mediaIndex, - startOfSegment = options.startOfSegment, - isSyncRequest = options.isSyncRequest, - partIndex = options.partIndex, - forceTimestampOffset = options.forceTimestampOffset, - getMediaInfoForTime = options.getMediaInfoForTime; - var segment = playlist.segments[mediaIndex]; - var part = typeof partIndex === 'number' && segment.parts[partIndex]; - var segmentInfo = { - requestId: 'segment-loader-' + Math.random(), - // resolve the segment URL relative to the playlist - uri: part && part.resolvedUri || segment.resolvedUri, - // the segment's mediaIndex at the time it was requested - mediaIndex: mediaIndex, - partIndex: part ? partIndex : null, - // whether or not to update the SegmentLoader's state with this - // segment's mediaIndex - isSyncRequest: isSyncRequest, - startOfSegment: startOfSegment, - // the segment's playlist - playlist: playlist, - // unencrypted bytes of the segment - bytes: null, - // when a key is defined for this segment, the encrypted bytes - encryptedBytes: null, - // The target timestampOffset for this segment when we append it - // to the source buffer - timestampOffset: null, - // The timeline that the segment is in - timeline: segment.timeline, - // The expected duration of the segment in seconds - duration: part && part.duration || segment.duration, - // retain the segment in case the playlist updates while doing an async process - segment: segment, - part: part, - byteLength: 0, - transmuxer: this.transmuxer_, - // type of getMediaInfoForTime that was used to get this segment - getMediaInfoForTime: getMediaInfoForTime - }; - var overrideCheck = typeof forceTimestampOffset !== 'undefined' ? forceTimestampOffset : this.isPendingTimestampOffset_; - segmentInfo.timestampOffset = this.timestampOffsetForSegment_({ - segmentTimeline: segment.timeline, - currentTimeline: this.currentTimeline_, - startOfSegment: startOfSegment, - buffered: this.buffered_(), - overrideCheck: overrideCheck - }); - var audioBufferedEnd = lastBufferedEnd(this.sourceUpdater_.audioBuffered()); - - if (typeof audioBufferedEnd === 'number') { - // since the transmuxer is using the actual timing values, but the buffer is - // adjusted by the timestamp offset, we must adjust the value here - segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset(); - } - - if (this.sourceUpdater_.videoBuffered().length) { - segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(this.gopBuffer_, // since the transmuxer is using the actual timing values, but the time is - // adjusted by the timestmap offset, we must adjust the value here - this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(), this.timeMapping_); - } - - return segmentInfo; - } // get the timestampoffset for a segment, - // added so that vtt segment loader can override and prevent - // adding timestamp offsets. - ; - - _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_(options) { - return timestampOffsetForSegment(options); - } - /** - * Determines if the network has enough bandwidth to complete the current segment - * request in a timely manner. If not, the request will be aborted early and bandwidth - * updated to trigger a playlist switch. - * - * @param {Object} stats - * Object containing stats about the request timing and size - * @private - */ - ; - - _proto.earlyAbortWhenNeeded_ = function earlyAbortWhenNeeded_(stats) { - if (this.vhs_.tech_.paused() || // Don't abort if the current playlist is on the lowestEnabledRendition - // TODO: Replace using timeout with a boolean indicating whether this playlist is - // the lowestEnabledRendition. - !this.xhrOptions_.timeout || // Don't abort if we have no bandwidth information to estimate segment sizes - !this.playlist_.attributes.BANDWIDTH) { - return; - } // Wait at least 1 second since the first byte of data has been received before - // using the calculated bandwidth from the progress event to allow the bitrate - // to stabilize - - - if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1000) { - return; - } - - var currentTime = this.currentTime_(); - var measuredBandwidth = stats.bandwidth; - var segmentDuration = this.pendingSegment_.duration; - var requestTimeRemaining = Playlist.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived); // Subtract 1 from the timeUntilRebuffer so we still consider an early abort - // if we are only left with less than 1 second when the request completes. - // A negative timeUntilRebuffering indicates we are already rebuffering - - var timeUntilRebuffer$1 = timeUntilRebuffer(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1; // Only consider aborting early if the estimated time to finish the download - // is larger than the estimated time until the player runs out of forward buffer - - if (requestTimeRemaining <= timeUntilRebuffer$1) { - return; - } - - var switchCandidate = minRebufferMaxBandwidthSelector({ - master: this.vhs_.playlists.master, - currentTime: currentTime, - bandwidth: measuredBandwidth, - duration: this.duration_(), - segmentDuration: segmentDuration, - timeUntilRebuffer: timeUntilRebuffer$1, - currentTimeline: this.currentTimeline_, - syncController: this.syncController_ - }); - - if (!switchCandidate) { - return; - } - - var rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$1; - var timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact; - var minimumTimeSaving = 0.5; // If we are already rebuffering, increase the amount of variance we add to the - // potential round trip time of the new request so that we are not too aggressive - // with switching to a playlist that might save us a fraction of a second. - - if (timeUntilRebuffer$1 <= TIME_FUDGE_FACTOR) { - minimumTimeSaving = 1; - } - - if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) { - return; - } // set the bandwidth to that of the desired playlist being sure to scale by - // BANDWIDTH_VARIANCE and add one so the playlist selector does not exclude it - // don't trigger a bandwidthupdate as the bandwidth is artifial - - - this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config.BANDWIDTH_VARIANCE + 1; - this.trigger('earlyabort'); - }; - - _proto.handleAbort_ = function handleAbort_(segmentInfo) { - this.logger_("Aborting " + segmentInfoString(segmentInfo)); - this.mediaRequestsAborted += 1; - } - /** - * XHR `progress` event handler - * - * @param {Event} - * The XHR `progress` event - * @param {Object} simpleSegment - * A simplified segment object copy - * @private - */ - ; - - _proto.handleProgress_ = function handleProgress_(event, simpleSegment) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - this.trigger('progress'); - }; - - _proto.handleTrackInfo_ = function handleTrackInfo_(simpleSegment, trackInfo) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - if (this.checkForIllegalMediaSwitch(trackInfo)) { - return; - } - - trackInfo = trackInfo || {}; // When we have track info, determine what media types this loader is dealing with. - // Guard against cases where we're not getting track info at all until we are - // certain that all streams will provide it. - - if (!shallowEqual(this.currentMediaInfo_, trackInfo)) { - this.appendInitSegment_ = { - audio: true, - video: true - }; - this.startingMediaInfo_ = trackInfo; - this.currentMediaInfo_ = trackInfo; - this.logger_('trackinfo update', trackInfo); - this.trigger('trackinfo'); - } // trackinfo may cause an abort if the trackinfo - // causes a codec change to an unsupported codec. - - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // set trackinfo on the pending segment so that - // it can append. - - - this.pendingSegment_.trackInfo = trackInfo; // check if any calls were waiting on the track info - - if (this.hasEnoughInfoToAppend_()) { - this.processCallQueue_(); - } - }; - - _proto.handleTimingInfo_ = function handleTimingInfo_(simpleSegment, mediaType, timeType, time) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - var segmentInfo = this.pendingSegment_; - var timingInfoProperty = timingInfoPropertyForMedia(mediaType); - segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {}; - segmentInfo[timingInfoProperty][timeType] = time; - this.logger_("timinginfo: " + mediaType + " - " + timeType + " - " + time); // check if any calls were waiting on the timing info - - if (this.hasEnoughInfoToAppend_()) { - this.processCallQueue_(); - } - }; - - _proto.handleCaptions_ = function handleCaptions_(simpleSegment, captionData) { - var _this2 = this; - - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // This could only happen with fmp4 segments, but - // should still not happen in general - - - if (captionData.length === 0) { - this.logger_('SegmentLoader received no captions from a caption event'); - return; - } - - var segmentInfo = this.pendingSegment_; // Wait until we have some video data so that caption timing - // can be adjusted by the timestamp offset - - if (!segmentInfo.hasAppendedData_) { - this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData)); - return; - } - - var timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset(); - var captionTracks = {}; // get total start/end and captions for each track/stream - - captionData.forEach(function (caption) { - // caption.stream is actually a track name... - // set to the existing values in tracks or default values - captionTracks[caption.stream] = captionTracks[caption.stream] || { - // Infinity, as any other value will be less than this - startTime: Infinity, - captions: [], - // 0 as an other value will be more than this - endTime: 0 - }; - var captionTrack = captionTracks[caption.stream]; - captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset); - captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset); - captionTrack.captions.push(caption); - }); - Object.keys(captionTracks).forEach(function (trackName) { - var _captionTracks$trackN = captionTracks[trackName], - startTime = _captionTracks$trackN.startTime, - endTime = _captionTracks$trackN.endTime, - captions = _captionTracks$trackN.captions; - var inbandTextTracks = _this2.inbandTextTracks_; - - _this2.logger_("adding cues from " + startTime + " -> " + endTime + " for " + trackName); - - createCaptionsTrackIfNotExists(inbandTextTracks, _this2.vhs_.tech_, trackName); // clear out any cues that start and end at the same time period for the same track. - // We do this because a rendition change that also changes the timescale for captions - // will result in captions being re-parsed for certain segments. If we add them again - // without clearing we will have two of the same captions visible. - - removeCuesFromTrack(startTime, endTime, inbandTextTracks[trackName]); - addCaptionData({ - captionArray: captions, - inbandTextTracks: inbandTextTracks, - timestampOffset: timestampOffset - }); - }); // Reset stored captions since we added parsed - // captions to a text track at this point - - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearParsedMp4Captions' - }); - } - }; - - _proto.handleId3_ = function handleId3_(simpleSegment, id3Frames, dispatchType) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } - - var segmentInfo = this.pendingSegment_; // we need to have appended data in order for the timestamp offset to be set - - if (!segmentInfo.hasAppendedData_) { - this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType)); - return; - } - - var timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset(); // There's potentially an issue where we could double add metadata if there's a muxed - // audio/video source with a metadata track, and an alt audio with a metadata track. - // However, this probably won't happen, and if it does it can be handled then. - - createMetadataTrackIfNotExists(this.inbandTextTracks_, dispatchType, this.vhs_.tech_); - addMetadata({ - inbandTextTracks: this.inbandTextTracks_, - metadataArray: id3Frames, - timestampOffset: timestampOffset, - videoDuration: this.duration_() - }); - }; - - _proto.processMetadataQueue_ = function processMetadataQueue_() { - this.metadataQueue_.id3.forEach(function (fn) { - return fn(); - }); - this.metadataQueue_.caption.forEach(function (fn) { - return fn(); - }); - this.metadataQueue_.id3 = []; - this.metadataQueue_.caption = []; - }; - - _proto.processCallQueue_ = function processCallQueue_() { - var callQueue = this.callQueue_; // Clear out the queue before the queued functions are run, since some of the - // functions may check the length of the load queue and default to pushing themselves - // back onto the queue. - - this.callQueue_ = []; - callQueue.forEach(function (fun) { - return fun(); - }); - }; - - _proto.processLoadQueue_ = function processLoadQueue_() { - var loadQueue = this.loadQueue_; // Clear out the queue before the queued functions are run, since some of the - // functions may check the length of the load queue and default to pushing themselves - // back onto the queue. - - this.loadQueue_ = []; - loadQueue.forEach(function (fun) { - return fun(); - }); - } - /** - * Determines whether the loader has enough info to load the next segment. - * - * @return {boolean} - * Whether or not the loader has enough info to load the next segment - */ - ; - - _proto.hasEnoughInfoToLoad_ = function hasEnoughInfoToLoad_() { - // Since primary timing goes by video, only the audio loader potentially needs to wait - // to load. - if (this.loaderType_ !== 'audio') { - return true; - } - - var segmentInfo = this.pendingSegment_; // A fill buffer must have already run to establish a pending segment before there's - // enough info to load. - - if (!segmentInfo) { - return false; - } // The first segment can and should be loaded immediately so that source buffers are - // created together (before appending). Source buffer creation uses the presence of - // audio and video data to determine whether to create audio/video source buffers, and - // uses processed (transmuxed or parsed) media to determine the types required. - - - if (!this.currentMediaInfo_) { - return true; - } - - if ( // Technically, instead of waiting to load a segment on timeline changes, a segment - // can be requested and downloaded and only wait before it is transmuxed or parsed. - // But in practice, there are a few reasons why it is better to wait until a loader - // is ready to append that segment before requesting and downloading: - // - // 1. Because audio and main loaders cross discontinuities together, if this loader - // is waiting for the other to catch up, then instead of requesting another - // segment and using up more bandwidth, by not yet loading, more bandwidth is - // allotted to the loader currently behind. - // 2. media-segment-request doesn't have to have logic to consider whether a segment - // is ready to be processed or not, isolating the queueing behavior to the loader. - // 3. The audio loader bases some of its segment properties on timing information - // provided by the main loader, meaning that, if the logic for waiting on - // processing was in media-segment-request, then it would also need to know how - // to re-generate the segment information after the main loader caught up. - shouldWaitForTimelineChange({ - timelineChangeController: this.timelineChangeController_, - currentTimeline: this.currentTimeline_, - segmentTimeline: segmentInfo.timeline, - loaderType: this.loaderType_, - audioDisabled: this.audioDisabled_ - })) { - return false; - } - - return true; - }; - - _proto.hasEnoughInfoToAppend_ = function hasEnoughInfoToAppend_() { - if (!this.sourceUpdater_.ready()) { - return false; - } // If content needs to be removed or the loader is waiting on an append reattempt, - // then no additional content should be appended until the prior append is resolved. - - - if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) { - return false; - } - - var segmentInfo = this.pendingSegment_; // no segment to append any data for or - // we do not have information on this specific - // segment yet - - if (!segmentInfo || !segmentInfo.trackInfo) { - return false; - } - - var _this$currentMediaInf = this.currentMediaInfo_, - hasAudio = _this$currentMediaInf.hasAudio, - hasVideo = _this$currentMediaInf.hasVideo, - isMuxed = _this$currentMediaInf.isMuxed; - - if (hasVideo && !segmentInfo.videoTimingInfo) { - return false; - } // muxed content only relies on video timing information for now. - - - if (hasAudio && !this.audioDisabled_ && !isMuxed && !segmentInfo.audioTimingInfo) { - return false; - } - - if (shouldWaitForTimelineChange({ - timelineChangeController: this.timelineChangeController_, - currentTimeline: this.currentTimeline_, - segmentTimeline: segmentInfo.timeline, - loaderType: this.loaderType_, - audioDisabled: this.audioDisabled_ - })) { - return false; - } - - return true; - }; - - _proto.handleData_ = function handleData_(simpleSegment, result) { - this.earlyAbortWhenNeeded_(simpleSegment.stats); - - if (this.checkForAbort_(simpleSegment.requestId)) { - return; - } // If there's anything in the call queue, then this data came later and should be - // executed after the calls currently queued. - - - if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) { - this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result)); - return; - } - - var segmentInfo = this.pendingSegment_; // update the time mapping so we can translate from display time to media time - - this.setTimeMapping_(segmentInfo.timeline); // for tracking overall stats - - this.updateMediaSecondsLoaded_(segmentInfo.segment); // Note that the state isn't changed from loading to appending. This is because abort - // logic may change behavior depending on the state, and changing state too early may - // inflate our estimates of bandwidth. In the future this should be re-examined to - // note more granular states. - // don't process and append data if the mediaSource is closed - - if (this.mediaSource_.readyState === 'closed') { - return; - } // if this request included an initialization segment, save that data - // to the initSegment cache - - - if (simpleSegment.map) { - simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true); // move over init segment properties to media request - - segmentInfo.segment.map = simpleSegment.map; - } // if this request included a segment key, save that data in the cache - - - if (simpleSegment.key) { - this.segmentKey(simpleSegment.key, true); - } - - segmentInfo.isFmp4 = simpleSegment.isFmp4; - segmentInfo.timingInfo = segmentInfo.timingInfo || {}; - - if (segmentInfo.isFmp4) { - this.trigger('fmp4'); - segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia(result.type)].start; - } else { - var useVideoTimingInfo = this.loaderType_ === 'main' && this.currentMediaInfo_.hasVideo; - var firstVideoFrameTimeForData; - - if (useVideoTimingInfo) { - firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start; - } // Segment loader knows more about segment timing than the transmuxer (in certain - // aspects), so make any changes required for a more accurate start time. - // Don't set the end time yet, as the segment may not be finished processing. - - - segmentInfo.timingInfo.start = this.trueSegmentStart_({ - currentStart: segmentInfo.timingInfo.start, - playlist: segmentInfo.playlist, - mediaIndex: segmentInfo.mediaIndex, - currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(), - useVideoTimingInfo: useVideoTimingInfo, - firstVideoFrameTimeForData: firstVideoFrameTimeForData, - videoTimingInfo: segmentInfo.videoTimingInfo, - audioTimingInfo: segmentInfo.audioTimingInfo - }); - } // Init segments for audio and video only need to be appended in certain cases. Now - // that data is about to be appended, we can check the final cases to determine - // whether we should append an init segment. - - - this.updateAppendInitSegmentStatus(segmentInfo, result.type); // Timestamp offset should be updated once we get new data and have its timing info, - // as we use the start of the segment to offset the best guess (playlist provided) - // timestamp offset. - - this.updateSourceBufferTimestampOffset_(segmentInfo); // if this is a sync request we need to determine whether it should - // be appended or not. - - if (segmentInfo.isSyncRequest) { - // first save/update our timing info for this segment. - // this is what allows us to choose an accurate segment - // and the main reason we make a sync request. - this.updateTimingInfoEnd_(segmentInfo); - this.syncController_.saveSegmentTimingInfo({ - segmentInfo: segmentInfo, - shouldSaveTimelineMapping: this.loaderType_ === 'main' - }); - var next = this.chooseNextRequest_(); // If the sync request isn't the segment that would be requested next - // after taking into account its timing info, do not append it. - - if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) { - this.logger_('sync segment was incorrect, not appending'); - return; - } // otherwise append it like any other segment as our guess was correct. - - - this.logger_('sync segment was correct, appending'); - } // Save some state so that in the future anything waiting on first append (and/or - // timestamp offset(s)) can process immediately. While the extra state isn't optimal, - // we need some notion of whether the timestamp offset or other relevant information - // has had a chance to be set. - - - segmentInfo.hasAppendedData_ = true; // Now that the timestamp offset should be set, we can append any waiting ID3 tags. - - this.processMetadataQueue_(); - this.appendData_(segmentInfo, result); - }; - - _proto.updateAppendInitSegmentStatus = function updateAppendInitSegmentStatus(segmentInfo, type) { - // alt audio doesn't manage timestamp offset - if (this.loaderType_ === 'main' && typeof segmentInfo.timestampOffset === 'number' && // in the case that we're handling partial data, we don't want to append an init - // segment for each chunk - !segmentInfo.changedTimestampOffset) { - // if the timestamp offset changed, the timeline may have changed, so we have to re- - // append init segments - this.appendInitSegment_ = { - audio: true, - video: true - }; - } - - if (this.playlistOfLastInitSegment_[type] !== segmentInfo.playlist) { - // make sure we append init segment on playlist changes, in case the media config - // changed - this.appendInitSegment_[type] = true; - } - }; - - _proto.getInitSegmentAndUpdateState_ = function getInitSegmentAndUpdateState_(_ref4) { - var type = _ref4.type, - initSegment = _ref4.initSegment, - map = _ref4.map, - playlist = _ref4.playlist; - - // "The EXT-X-MAP tag specifies how to obtain the Media Initialization Section - // (Section 3) required to parse the applicable Media Segments. It applies to every - // Media Segment that appears after it in the Playlist until the next EXT-X-MAP tag - // or until the end of the playlist." - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.5 - if (map) { - var id = initSegmentId(map); - - if (this.activeInitSegmentId_ === id) { - // don't need to re-append the init segment if the ID matches - return null; - } // a map-specified init segment takes priority over any transmuxed (or otherwise - // obtained) init segment - // - // this also caches the init segment for later use - - - initSegment = this.initSegmentForMap(map, true).bytes; - this.activeInitSegmentId_ = id; - } // We used to always prepend init segments for video, however, that shouldn't be - // necessary. Instead, we should only append on changes, similar to what we've always - // done for audio. This is more important (though may not be that important) for - // frame-by-frame appending for LHLS, simply because of the increased quantity of - // appends. - - - if (initSegment && this.appendInitSegment_[type]) { - // Make sure we track the playlist that we last used for the init segment, so that - // we can re-append the init segment in the event that we get data from a new - // playlist. Discontinuities and track changes are handled in other sections. - this.playlistOfLastInitSegment_[type] = playlist; // Disable future init segment appends for this type. Until a change is necessary. - - this.appendInitSegment_[type] = false; // we need to clear out the fmp4 active init segment id, since - // we are appending the muxer init segment - - this.activeInitSegmentId_ = null; - return initSegment; - } - - return null; - }; - - _proto.handleQuotaExceededError_ = function handleQuotaExceededError_(_ref5, error) { - var _this3 = this; - - var segmentInfo = _ref5.segmentInfo, - type = _ref5.type, - bytes = _ref5.bytes; - var audioBuffered = this.sourceUpdater_.audioBuffered(); - var videoBuffered = this.sourceUpdater_.videoBuffered(); // For now we're ignoring any notion of gaps in the buffer, but they, in theory, - // should be cleared out during the buffer removals. However, log in case it helps - // debug. - - if (audioBuffered.length > 1) { - this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: ' + timeRangesToArray(audioBuffered).join(', ')); - } - - if (videoBuffered.length > 1) { - this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: ' + timeRangesToArray(videoBuffered).join(', ')); - } - - var audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0; - var audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0; - var videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0; - var videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0; - - if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER) { - // Can't remove enough buffer to make room for new segment (or the browser doesn't - // allow for appends of segments this size). In the future, it may be possible to - // split up the segment and append in pieces, but for now, error out this playlist - // in an attempt to switch to a more manageable rendition. - this.logger_('On QUOTA_EXCEEDED_ERR, single segment too large to append to ' + 'buffer, triggering an error. ' + ("Appended byte length: " + bytes.byteLength + ", ") + ("audio buffer: " + timeRangesToArray(audioBuffered).join(', ') + ", ") + ("video buffer: " + timeRangesToArray(videoBuffered).join(', ') + ", ")); - this.error({ - message: 'Quota exceeded error with append of a single segment of content', - excludeUntil: Infinity - }); - this.trigger('error'); - return; - } // To try to resolve the quota exceeded error, clear back buffer and retry. This means - // that the segment-loader should block on future events until this one is handled, so - // that it doesn't keep moving onto further segments. Adding the call to the call - // queue will prevent further appends until waitingOnRemove_ and - // quotaExceededErrorRetryTimeout_ are cleared. - // - // Note that this will only block the current loader. In the case of demuxed content, - // the other load may keep filling as fast as possible. In practice, this should be - // OK, as it is a rare case when either audio has a high enough bitrate to fill up a - // source buffer, or video fills without enough room for audio to append (and without - // the availability of clearing out seconds of back buffer to make room for audio). - // But it might still be good to handle this case in the future as a TODO. - - - this.waitingOnRemove_ = true; - this.callQueue_.push(this.appendToSourceBuffer_.bind(this, { - segmentInfo: segmentInfo, - type: type, - bytes: bytes - })); - var currentTime = this.currentTime_(); // Try to remove as much audio and video as possible to make room for new content - // before retrying. - - var timeToRemoveUntil = currentTime - MIN_BACK_BUFFER; - this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to " + timeToRemoveUntil); - this.remove(0, timeToRemoveUntil, function () { - _this3.logger_("On QUOTA_EXCEEDED_ERR, retrying append in " + MIN_BACK_BUFFER + "s"); - - _this3.waitingOnRemove_ = false; // wait the length of time alotted in the back buffer to prevent wasted - // attempts (since we can't clear less than the minimum) - - _this3.quotaExceededErrorRetryTimeout_ = window__default['default'].setTimeout(function () { - _this3.logger_('On QUOTA_EXCEEDED_ERR, re-processing call queue'); - - _this3.quotaExceededErrorRetryTimeout_ = null; - - _this3.processCallQueue_(); - }, MIN_BACK_BUFFER * 1000); - }, true); - }; - - _proto.handleAppendError_ = function handleAppendError_(_ref6, error) { - var segmentInfo = _ref6.segmentInfo, - type = _ref6.type, - bytes = _ref6.bytes; - - // if there's no error, nothing to do - if (!error) { - return; - } - - if (error.code === QUOTA_EXCEEDED_ERR) { - this.handleQuotaExceededError_({ - segmentInfo: segmentInfo, - type: type, - bytes: bytes - }); // A quota exceeded error should be recoverable with a future re-append, so no need - // to trigger an append error. - - return; - } - - this.logger_('Received non QUOTA_EXCEEDED_ERR on append', error); - this.error(type + " append of " + bytes.length + "b failed for segment " + ("#" + segmentInfo.mediaIndex + " in playlist " + segmentInfo.playlist.id)); // If an append errors, we often can't recover. - // (see https://w3c.github.io/media-source/#sourcebuffer-append-error). - // - // Trigger a special error so that it can be handled separately from normal, - // recoverable errors. - - this.trigger('appenderror'); - }; - - _proto.appendToSourceBuffer_ = function appendToSourceBuffer_(_ref7) { - var segmentInfo = _ref7.segmentInfo, - type = _ref7.type, - initSegment = _ref7.initSegment, - data = _ref7.data, - bytes = _ref7.bytes; - - // If this is a re-append, bytes were already created and don't need to be recreated - if (!bytes) { - var segments = [data]; - var byteLength = data.byteLength; - - if (initSegment) { - // if the media initialization segment is changing, append it before the content - // segment - segments.unshift(initSegment); - byteLength += initSegment.byteLength; - } // Technically we should be OK appending the init segment separately, however, we - // haven't yet tested that, and prepending is how we have always done things. - - - bytes = concatSegments({ - bytes: byteLength, - segments: segments - }); - } - - this.sourceUpdater_.appendBuffer({ - segmentInfo: segmentInfo, - type: type, - bytes: bytes - }, this.handleAppendError_.bind(this, { - segmentInfo: segmentInfo, - type: type, - bytes: bytes - })); - }; - - _proto.handleSegmentTimingInfo_ = function handleSegmentTimingInfo_(type, requestId, segmentTimingInfo) { - if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) { - return; - } - - var segment = this.pendingSegment_.segment; - var timingInfoProperty = type + "TimingInfo"; - - if (!segment[timingInfoProperty]) { - segment[timingInfoProperty] = {}; - } - - segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0; - segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation; - segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode; - segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation; - segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode; // mainly used as a reference for debugging - - segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime; - }; - - _proto.appendData_ = function appendData_(segmentInfo, result) { - var type = result.type, - data = result.data; - - if (!data || !data.byteLength) { - return; - } - - if (type === 'audio' && this.audioDisabled_) { - return; - } - - var initSegment = this.getInitSegmentAndUpdateState_({ - type: type, - initSegment: result.initSegment, - playlist: segmentInfo.playlist, - map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null - }); - this.appendToSourceBuffer_({ - segmentInfo: segmentInfo, - type: type, - initSegment: initSegment, - data: data - }); - } - /** - * load a specific segment from a request into the buffer - * - * @private - */ - ; - - _proto.loadSegment_ = function loadSegment_(segmentInfo) { - var _this4 = this; - - this.state = 'WAITING'; - this.pendingSegment_ = segmentInfo; - this.trimBackBuffer_(segmentInfo); - - if (typeof segmentInfo.timestampOffset === 'number') { - if (this.transmuxer_) { - this.transmuxer_.postMessage({ - action: 'clearAllMp4Captions' - }); - } - } - - if (!this.hasEnoughInfoToLoad_()) { - this.loadQueue_.push(function () { - // regenerate the audioAppendStart, timestampOffset, etc as they - // may have changed since this function was added to the queue. - var options = _extends_1({}, segmentInfo, { - forceTimestampOffset: true - }); - - _extends_1(segmentInfo, _this4.generateSegmentInfo_(options)); - - _this4.isPendingTimestampOffset_ = false; - - _this4.updateTransmuxerAndRequestSegment_(segmentInfo); - }); - return; - } - - this.updateTransmuxerAndRequestSegment_(segmentInfo); - }; - - _proto.updateTransmuxerAndRequestSegment_ = function updateTransmuxerAndRequestSegment_(segmentInfo) { - var _this5 = this; - - // We'll update the source buffer's timestamp offset once we have transmuxed data, but - // the transmuxer still needs to be updated before then. - // - // Even though keepOriginalTimestamps is set to true for the transmuxer, timestamp - // offset must be passed to the transmuxer for stream correcting adjustments. - if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) { - this.gopBuffer_.length = 0; // gopsToAlignWith was set before the GOP buffer was cleared - - segmentInfo.gopsToAlignWith = []; - this.timeMapping_ = 0; // reset values in the transmuxer since a discontinuity should start fresh - - this.transmuxer_.postMessage({ - action: 'reset' - }); - this.transmuxer_.postMessage({ - action: 'setTimestampOffset', - timestampOffset: segmentInfo.timestampOffset - }); - } - - var simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo); - var isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex); - var isWalkingForward = this.mediaIndex !== null; - var isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && // currentTimeline starts at -1, so we shouldn't end the timeline switching to 0, - // the first timeline - segmentInfo.timeline > 0; - var isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity; - this.logger_("Requesting " + segmentInfoString(segmentInfo)); // If there's an init segment associated with this segment, but it is not cached (identified by a lack of bytes), - // then this init segment has never been seen before and should be appended. - // - // At this point the content type (audio/video or both) is not yet known, but it should be safe to set - // both to true and leave the decision of whether to append the init segment to append time. - - if (simpleSegment.map && !simpleSegment.map.bytes) { - this.logger_('going to request init segment.'); - this.appendInitSegment_ = { - video: true, - audio: true - }; - } - - segmentInfo.abortRequests = mediaSegmentRequest({ - xhr: this.vhs_.xhr, - xhrOptions: this.xhrOptions_, - decryptionWorker: this.decrypter_, - segment: simpleSegment, - abortFn: this.handleAbort_.bind(this, segmentInfo), - progressFn: this.handleProgress_.bind(this), - trackInfoFn: this.handleTrackInfo_.bind(this), - timingInfoFn: this.handleTimingInfo_.bind(this), - videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'video', segmentInfo.requestId), - audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'audio', segmentInfo.requestId), - captionsFn: this.handleCaptions_.bind(this), - isEndOfTimeline: isEndOfTimeline, - endedTimelineFn: function endedTimelineFn() { - _this5.logger_('received endedtimeline callback'); - }, - id3Fn: this.handleId3_.bind(this), - dataFn: this.handleData_.bind(this), - doneFn: this.segmentRequestFinished_.bind(this) - }); - } - /** - * trim the back buffer so that we don't have too much data - * in the source buffer - * - * @private - * - * @param {Object} segmentInfo - the current segment - */ - ; - - _proto.trimBackBuffer_ = function trimBackBuffer_(segmentInfo) { - var removeToTime = safeBackBufferTrimTime(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10); // Chrome has a hard limit of 150MB of - // buffer and a very conservative "garbage collector" - // We manually clear out the old buffer to ensure - // we don't trigger the QuotaExceeded error - // on the source buffer during subsequent appends - - if (removeToTime > 0) { - this.remove(0, removeToTime); - } - } - /** - * created a simplified copy of the segment object with just the - * information necessary to perform the XHR and decryption - * - * @private - * - * @param {Object} segmentInfo - the current segment - * @return {Object} a simplified segment object copy - */ - ; - - _proto.createSimplifiedSegmentObj_ = function createSimplifiedSegmentObj_(segmentInfo) { - var segment = segmentInfo.segment; - var part = segmentInfo.part; - var simpleSegment = { - resolvedUri: part ? part.resolvedUri : segment.resolvedUri, - byterange: part ? part.byterange : segment.byterange, - requestId: segmentInfo.requestId, - transmuxer: segmentInfo.transmuxer, - audioAppendStart: segmentInfo.audioAppendStart, - gopsToAlignWith: segmentInfo.gopsToAlignWith, - part: segmentInfo.part - }; - var previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1]; - - if (previousSegment && previousSegment.timeline === segment.timeline) { - // The baseStartTime of a segment is used to handle rollover when probing the TS - // segment to retrieve timing information. Since the probe only looks at the media's - // times (e.g., PTS and DTS values of the segment), and doesn't consider the - // player's time (e.g., player.currentTime()), baseStartTime should reflect the - // media time as well. transmuxedDecodeEnd represents the end time of a segment, in - // seconds of media time, so should be used here. The previous segment is used since - // the end of the previous segment should represent the beginning of the current - // segment, so long as they are on the same timeline. - if (previousSegment.videoTimingInfo) { - simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd; - } else if (previousSegment.audioTimingInfo) { - simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd; - } - } - - if (segment.key) { - // if the media sequence is greater than 2^32, the IV will be incorrect - // assuming 10s segments, that would be about 1300 years - var iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]); - simpleSegment.key = this.segmentKey(segment.key); - simpleSegment.key.iv = iv; - } - - if (segment.map) { - simpleSegment.map = this.initSegmentForMap(segment.map); - } - - return simpleSegment; - }; - - _proto.saveTransferStats_ = function saveTransferStats_(stats) { - // every request counts as a media request even if it has been aborted - // or canceled due to a timeout - this.mediaRequests += 1; - - if (stats) { - this.mediaBytesTransferred += stats.bytesReceived; - this.mediaTransferDuration += stats.roundTripTime; - } - }; - - _proto.saveBandwidthRelatedStats_ = function saveBandwidthRelatedStats_(duration, stats) { - // byteLength will be used for throughput, and should be based on bytes receieved, - // which we only know at the end of the request and should reflect total bytes - // downloaded rather than just bytes processed from components of the segment - this.pendingSegment_.byteLength = stats.bytesReceived; - - if (duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) { - this.logger_("Ignoring segment's bandwidth because its duration of " + duration + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS)); - return; - } - - this.bandwidth = stats.bandwidth; - this.roundTrip = stats.roundTripTime; - }; - - _proto.handleTimeout_ = function handleTimeout_() { - // although the VTT segment loader bandwidth isn't really used, it's good to - // maintain functinality between segment loaders - this.mediaRequestsTimedout += 1; - this.bandwidth = 1; - this.roundTrip = NaN; - this.trigger('bandwidthupdate'); - } - /** - * Handle the callback from the segmentRequest function and set the - * associated SegmentLoader state and errors if necessary - * - * @private - */ - ; - - _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) { - // TODO handle special cases, e.g., muxed audio/video but only audio in the segment - // check the call queue directly since this function doesn't need to deal with any - // data, and can continue even if the source buffers are not set up and we didn't get - // any data from the segment - if (this.callQueue_.length) { - this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result)); - return; - } - - this.saveTransferStats_(simpleSegment.stats); // The request was aborted and the SegmentLoader has already been reset - - if (!this.pendingSegment_) { - return; - } // the request was aborted and the SegmentLoader has already started - // another request. this can happen when the timeout for an aborted - // request triggers due to a limitation in the XHR library - // do not count this as any sort of request or we risk double-counting - - - if (simpleSegment.requestId !== this.pendingSegment_.requestId) { - return; - } // an error occurred from the active pendingSegment_ so reset everything - - - if (error) { - this.pendingSegment_ = null; - this.state = 'READY'; // aborts are not a true error condition and nothing corrective needs to be done - - if (error.code === REQUEST_ERRORS.ABORTED) { - return; - } - - this.pause(); // the error is really just that at least one of the requests timed-out - // set the bandwidth to a very low value and trigger an ABR switch to - // take emergency action - - if (error.code === REQUEST_ERRORS.TIMEOUT) { - this.handleTimeout_(); - return; - } // if control-flow has arrived here, then the error is real - // emit an error event to blacklist the current playlist - - - this.mediaRequestsErrored += 1; - this.error(error); - this.trigger('error'); - return; - } - - var segmentInfo = this.pendingSegment_; // the response was a success so set any bandwidth stats the request - // generated for ABR purposes - - this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats); - segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests; - - if (result.gopInfo) { - this.gopBuffer_ = updateGopBuffer(this.gopBuffer_, result.gopInfo, this.safeAppend_); - } // Although we may have already started appending on progress, we shouldn't switch the - // state away from loading until we are officially done loading the segment data. - - - this.state = 'APPENDING'; // used for testing - - this.trigger('appending'); - this.waitForAppendsToComplete_(segmentInfo); - }; - - _proto.setTimeMapping_ = function setTimeMapping_(timeline) { - var timelineMapping = this.syncController_.mappingForTimeline(timeline); - - if (timelineMapping !== null) { - this.timeMapping_ = timelineMapping; - } - }; - - _proto.updateMediaSecondsLoaded_ = function updateMediaSecondsLoaded_(segment) { - if (typeof segment.start === 'number' && typeof segment.end === 'number') { - this.mediaSecondsLoaded += segment.end - segment.start; - } else { - this.mediaSecondsLoaded += segment.duration; - } - }; - - _proto.shouldUpdateTransmuxerTimestampOffset_ = function shouldUpdateTransmuxerTimestampOffset_(timestampOffset) { - if (timestampOffset === null) { - return false; - } // note that we're potentially using the same timestamp offset for both video and - // audio - - - if (this.loaderType_ === 'main' && timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) { - return true; - } - - if (!this.audioDisabled_ && timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) { - return true; - } - - return false; - }; - - _proto.trueSegmentStart_ = function trueSegmentStart_(_ref8) { - var currentStart = _ref8.currentStart, - playlist = _ref8.playlist, - mediaIndex = _ref8.mediaIndex, - firstVideoFrameTimeForData = _ref8.firstVideoFrameTimeForData, - currentVideoTimestampOffset = _ref8.currentVideoTimestampOffset, - useVideoTimingInfo = _ref8.useVideoTimingInfo, - videoTimingInfo = _ref8.videoTimingInfo, - audioTimingInfo = _ref8.audioTimingInfo; - - if (typeof currentStart !== 'undefined') { - // if start was set once, keep using it - return currentStart; - } - - if (!useVideoTimingInfo) { - return audioTimingInfo.start; - } - - var previousSegment = playlist.segments[mediaIndex - 1]; // The start of a segment should be the start of the first full frame contained - // within that segment. Since the transmuxer maintains a cache of incomplete data - // from and/or the last frame seen, the start time may reflect a frame that starts - // in the previous segment. Check for that case and ensure the start time is - // accurate for the segment. - - if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === 'undefined' || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) { - return firstVideoFrameTimeForData; - } - - return videoTimingInfo.start; - }; - - _proto.waitForAppendsToComplete_ = function waitForAppendsToComplete_(segmentInfo) { - if (!this.currentMediaInfo_) { - this.error({ - message: 'No starting media returned, likely due to an unsupported media format.', - blacklistDuration: Infinity - }); - this.trigger('error'); - return; - } // Although transmuxing is done, appends may not yet be finished. Throw a marker - // on each queue this loader is responsible for to ensure that the appends are - // complete. - - - var _this$currentMediaInf2 = this.currentMediaInfo_, - hasAudio = _this$currentMediaInf2.hasAudio, - hasVideo = _this$currentMediaInf2.hasVideo, - isMuxed = _this$currentMediaInf2.isMuxed; - var waitForVideo = this.loaderType_ === 'main' && hasVideo; - var waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed; - segmentInfo.waitingOnAppends = 0; // segments with no data - - if (!segmentInfo.hasAppendedData_) { - if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === 'number') { - // When there's no audio or video data in the segment, there's no audio or video - // timing information. - // - // If there's no audio or video timing information, then the timestamp offset - // can't be adjusted to the appropriate value for the transmuxer and source - // buffers. - // - // Therefore, the next segment should be used to set the timestamp offset. - this.isPendingTimestampOffset_ = true; - } // override settings for metadata only segments - - - segmentInfo.timingInfo = { - start: 0 - }; - segmentInfo.waitingOnAppends++; - - if (!this.isPendingTimestampOffset_) { - // update the timestampoffset - this.updateSourceBufferTimestampOffset_(segmentInfo); // make sure the metadata queue is processed even though we have - // no video/audio data. - - this.processMetadataQueue_(); - } // append is "done" instantly with no data. - - - this.checkAppendsDone_(segmentInfo); - return; - } // Since source updater could call back synchronously, do the increments first. - - - if (waitForVideo) { - segmentInfo.waitingOnAppends++; - } - - if (waitForAudio) { - segmentInfo.waitingOnAppends++; - } - - if (waitForVideo) { - this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo)); - } - - if (waitForAudio) { - this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo)); - } - }; - - _proto.checkAppendsDone_ = function checkAppendsDone_(segmentInfo) { - if (this.checkForAbort_(segmentInfo.requestId)) { - return; - } - - segmentInfo.waitingOnAppends--; - - if (segmentInfo.waitingOnAppends === 0) { - this.handleAppendsDone_(); - } - }; - - _proto.checkForIllegalMediaSwitch = function checkForIllegalMediaSwitch(trackInfo) { - var illegalMediaSwitchError = illegalMediaSwitch(this.loaderType_, this.currentMediaInfo_, trackInfo); - - if (illegalMediaSwitchError) { - this.error({ - message: illegalMediaSwitchError, - blacklistDuration: Infinity - }); - this.trigger('error'); - return true; - } - - return false; - }; - - _proto.updateSourceBufferTimestampOffset_ = function updateSourceBufferTimestampOffset_(segmentInfo) { - if (segmentInfo.timestampOffset === null || // we don't yet have the start for whatever media type (video or audio) has - // priority, timing-wise, so we must wait - typeof segmentInfo.timingInfo.start !== 'number' || // already updated the timestamp offset for this segment - segmentInfo.changedTimestampOffset || // the alt audio loader should not be responsible for setting the timestamp offset - this.loaderType_ !== 'main') { - return; - } - - var didChange = false; // Primary timing goes by video, and audio is trimmed in the transmuxer, meaning that - // the timing info here comes from video. In the event that the audio is longer than - // the video, this will trim the start of the audio. - // This also trims any offset from 0 at the beginning of the media - - segmentInfo.timestampOffset -= segmentInfo.timingInfo.start; // In the event that there are part segment downloads, each will try to update the - // timestamp offset. Retaining this bit of state prevents us from updating in the - // future (within the same segment), however, there may be a better way to handle it. - - segmentInfo.changedTimestampOffset = true; - - if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) { - this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset); - didChange = true; - } - - if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) { - this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset); - didChange = true; - } - - if (didChange) { - this.trigger('timestampoffset'); - } - }; - - _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_(segmentInfo) { - segmentInfo.timingInfo = segmentInfo.timingInfo || {}; - var useVideoTimingInfo = this.loaderType_ === 'main' && this.currentMediaInfo_.hasVideo; - var prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo; - - if (!prioritizedTimingInfo) { - return; - } - - segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === 'number' ? // End time may not exist in a case where we aren't parsing the full segment (one - // current example is the case of fmp4), so use the rough duration to calculate an - // end time. - prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration; - } - /** - * callback to run when appendBuffer is finished. detects if we are - * in a good state to do things with the data we got, or if we need - * to wait for more - * - * @private - */ - ; - - _proto.handleAppendsDone_ = function handleAppendsDone_() { - // appendsdone can cause an abort - if (this.pendingSegment_) { - this.trigger('appendsdone'); - } - - if (!this.pendingSegment_) { - this.state = 'READY'; // TODO should this move into this.checkForAbort to speed up requests post abort in - // all appending cases? - - if (!this.paused()) { - this.monitorBuffer_(); - } - - return; - } - - var segmentInfo = this.pendingSegment_; // Now that the end of the segment has been reached, we can set the end time. It's - // best to wait until all appends are done so we're sure that the primary media is - // finished (and we have its end time). - - this.updateTimingInfoEnd_(segmentInfo); - - if (this.shouldSaveSegmentTimingInfo_) { - // Timeline mappings should only be saved for the main loader. This is for multiple - // reasons: - // - // 1) Only one mapping is saved per timeline, meaning that if both the audio loader - // and the main loader try to save the timeline mapping, whichever comes later - // will overwrite the first. In theory this is OK, as the mappings should be the - // same, however, it breaks for (2) - // 2) In the event of a live stream, the initial live point will make for a somewhat - // arbitrary mapping. If audio and video streams are not perfectly in-sync, then - // the mapping will be off for one of the streams, dependent on which one was - // first saved (see (1)). - // 3) Primary timing goes by video in VHS, so the mapping should be video. - // - // Since the audio loader will wait for the main loader to load the first segment, - // the main loader will save the first timeline mapping, and ensure that there won't - // be a case where audio loads two segments without saving a mapping (thus leading - // to missing segment timing info). - this.syncController_.saveSegmentTimingInfo({ - segmentInfo: segmentInfo, - shouldSaveTimelineMapping: this.loaderType_ === 'main' - }); - } - - var segmentDurationMessage = getTroublesomeSegmentDurationMessage(segmentInfo, this.sourceType_); - - if (segmentDurationMessage) { - if (segmentDurationMessage.severity === 'warn') { - videojs__default['default'].log.warn(segmentDurationMessage.message); - } else { - this.logger_(segmentDurationMessage.message); - } - } - - this.recordThroughput_(segmentInfo); - this.pendingSegment_ = null; - this.state = 'READY'; - - if (segmentInfo.isSyncRequest) { - this.trigger('syncinfoupdate'); // if the sync request was not appended - // then it was not the correct segment. - // throw it away and use the data it gave us - // to get the correct one. - - if (!segmentInfo.hasAppendedData_) { - this.logger_("Throwing away un-appended sync request " + segmentInfoString(segmentInfo)); - return; - } - } - - this.logger_("Appended " + segmentInfoString(segmentInfo)); - this.addSegmentMetadataCue_(segmentInfo); - this.fetchAtBuffer_ = true; - - if (this.currentTimeline_ !== segmentInfo.timeline) { - this.timelineChangeController_.lastTimelineChange({ - type: this.loaderType_, - from: this.currentTimeline_, - to: segmentInfo.timeline - }); // If audio is not disabled, the main segment loader is responsible for updating - // the audio timeline as well. If the content is video only, this won't have any - // impact. - - if (this.loaderType_ === 'main' && !this.audioDisabled_) { - this.timelineChangeController_.lastTimelineChange({ - type: 'audio', - from: this.currentTimeline_, - to: segmentInfo.timeline - }); - } - } - - this.currentTimeline_ = segmentInfo.timeline; // We must update the syncinfo to recalculate the seekable range before - // the following conditional otherwise it may consider this a bad "guess" - // and attempt to resync when the post-update seekable window and live - // point would mean that this was the perfect segment to fetch - - this.trigger('syncinfoupdate'); - var segment = segmentInfo.segment; // If we previously appended a segment that ends more than 3 targetDurations before - // the currentTime_ that means that our conservative guess was too conservative. - // In that case, reset the loader state so that we try to use any information gained - // from the previous request to create a new, more accurate, sync-point. - - if (segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3) { - this.resetEverything(); - return; - } - - var isWalkingForward = this.mediaIndex !== null; // Don't do a rendition switch unless we have enough time to get a sync segment - // and conservatively guess - - if (isWalkingForward) { - this.trigger('bandwidthupdate'); - } - - this.trigger('progress'); - this.mediaIndex = segmentInfo.mediaIndex; - this.partIndex = segmentInfo.partIndex; // any time an update finishes and the last segment is in the - // buffer, end the stream. this ensures the "ended" event will - // fire if playback reaches that point. - - if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) { - this.endOfStream(); - } // used for testing - - - this.trigger('appended'); - - if (segmentInfo.hasAppendedData_) { - this.mediaAppends++; - } - - if (!this.paused()) { - this.monitorBuffer_(); - } - } - /** - * Records the current throughput of the decrypt, transmux, and append - * portion of the semgment pipeline. `throughput.rate` is a the cumulative - * moving average of the throughput. `throughput.count` is the number of - * data points in the average. - * - * @private - * @param {Object} segmentInfo the object returned by loadSegment - */ - ; - - _proto.recordThroughput_ = function recordThroughput_(segmentInfo) { - if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) { - this.logger_("Ignoring segment's throughput because its duration of " + segmentInfo.duration + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS)); - return; - } - - var rate = this.throughput.rate; // Add one to the time to ensure that we don't accidentally attempt to divide - // by zero in the case where the throughput is ridiculously high - - var segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1; // Multiply by 8000 to convert from bytes/millisecond to bits/second - - var segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1000); // This is just a cumulative moving average calculation: - // newAvg = oldAvg + (sample - oldAvg) / (sampleCount + 1) - - this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count; - } - /** - * Adds a cue to the segment-metadata track with some metadata information about the - * segment - * - * @private - * @param {Object} segmentInfo - * the object returned by loadSegment - * @method addSegmentMetadataCue_ - */ - ; - - _proto.addSegmentMetadataCue_ = function addSegmentMetadataCue_(segmentInfo) { - if (!this.segmentMetadataTrack_) { - return; - } - - var segment = segmentInfo.segment; - var start = segment.start; - var end = segment.end; // Do not try adding the cue if the start and end times are invalid. - - if (!finite(start) || !finite(end)) { - return; - } - - removeCuesFromTrack(start, end, this.segmentMetadataTrack_); - var Cue = window__default['default'].WebKitDataCue || window__default['default'].VTTCue; - var value = { - custom: segment.custom, - dateTimeObject: segment.dateTimeObject, - dateTimeString: segment.dateTimeString, - bandwidth: segmentInfo.playlist.attributes.BANDWIDTH, - resolution: segmentInfo.playlist.attributes.RESOLUTION, - codecs: segmentInfo.playlist.attributes.CODECS, - byteLength: segmentInfo.byteLength, - uri: segmentInfo.uri, - timeline: segmentInfo.timeline, - playlist: segmentInfo.playlist.id, - start: start, - end: end - }; - var data = JSON.stringify(value); - var cue = new Cue(start, end, data); // Attach the metadata to the value property of the cue to keep consistency between - // the differences of WebKitDataCue in safari and VTTCue in other browsers - - cue.value = value; - this.segmentMetadataTrack_.addCue(cue); - }; - - return SegmentLoader; - }(videojs__default['default'].EventTarget); - - function noop() {} - - var toTitleCase = function toTitleCase(string) { - if (typeof string !== 'string') { - return string; - } - - return string.replace(/./, function (w) { - return w.toUpperCase(); - }); - }; - - var bufferTypes = ['video', 'audio']; - - var _updating = function updating(type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type]; - }; - - var nextQueueIndexOfType = function nextQueueIndexOfType(type, queue) { - for (var i = 0; i < queue.length; i++) { - var queueEntry = queue[i]; - - if (queueEntry.type === 'mediaSource') { - // If the next entry is a media source entry (uses multiple source buffers), block - // processing to allow it to go through first. - return null; - } - - if (queueEntry.type === type) { - return i; - } - } - - return null; - }; - - var shiftQueue = function shiftQueue(type, sourceUpdater) { - if (sourceUpdater.queue.length === 0) { - return; - } - - var queueIndex = 0; - var queueEntry = sourceUpdater.queue[queueIndex]; - - if (queueEntry.type === 'mediaSource') { - if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== 'closed') { - sourceUpdater.queue.shift(); - queueEntry.action(sourceUpdater); - - if (queueEntry.doneFn) { - queueEntry.doneFn(); - } // Only specific source buffer actions must wait for async updateend events. Media - // Source actions process synchronously. Therefore, both audio and video source - // buffers are now clear to process the next queue entries. - - - shiftQueue('audio', sourceUpdater); - shiftQueue('video', sourceUpdater); - } // Media Source actions require both source buffers, so if the media source action - // couldn't process yet (because one or both source buffers are busy), block other - // queue actions until both are available and the media source action can process. - - - return; - } - - if (type === 'mediaSource') { - // If the queue was shifted by a media source action (this happens when pushing a - // media source action onto the queue), then it wasn't from an updateend event from an - // audio or video source buffer, so there's no change from previous state, and no - // processing should be done. - return; - } // Media source queue entries don't need to consider whether the source updater is - // started (i.e., source buffers are created) as they don't need the source buffers, but - // source buffer queue entries do. - - - if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === 'closed' || _updating(type, sourceUpdater)) { - return; - } - - if (queueEntry.type !== type) { - queueIndex = nextQueueIndexOfType(type, sourceUpdater.queue); - - if (queueIndex === null) { - // Either there's no queue entry that uses this source buffer type in the queue, or - // there's a media source queue entry before the next entry of this type, in which - // case wait for that action to process first. - return; - } - - queueEntry = sourceUpdater.queue[queueIndex]; - } - - sourceUpdater.queue.splice(queueIndex, 1); // Keep a record that this source buffer type is in use. - // - // The queue pending operation must be set before the action is performed in the event - // that the action results in a synchronous event that is acted upon. For instance, if - // an exception is thrown that can be handled, it's possible that new actions will be - // appended to an empty queue and immediately executed, but would not have the correct - // pending information if this property was set after the action was performed. - - sourceUpdater.queuePending[type] = queueEntry; - queueEntry.action(type, sourceUpdater); - - if (!queueEntry.doneFn) { - // synchronous operation, process next entry - sourceUpdater.queuePending[type] = null; - shiftQueue(type, sourceUpdater); - return; - } - }; - - var cleanupBuffer = function cleanupBuffer(type, sourceUpdater) { - var buffer = sourceUpdater[type + "Buffer"]; - var titleType = toTitleCase(type); - - if (!buffer) { - return; - } - - buffer.removeEventListener('updateend', sourceUpdater["on" + titleType + "UpdateEnd_"]); - buffer.removeEventListener('error', sourceUpdater["on" + titleType + "Error_"]); - sourceUpdater.codecs[type] = null; - sourceUpdater[type + "Buffer"] = null; - }; - - var inSourceBuffers = function inSourceBuffers(mediaSource, sourceBuffer) { - return mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1; - }; - - var actions = { - appendBuffer: function appendBuffer(bytes, segmentInfo, onError) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Appending segment " + segmentInfo.mediaIndex + "'s " + bytes.length + " bytes to " + type + "Buffer"); - - try { - sourceBuffer.appendBuffer(bytes); - } catch (e) { - sourceUpdater.logger_("Error with code " + e.code + " " + (e.code === QUOTA_EXCEEDED_ERR ? '(QUOTA_EXCEEDED_ERR) ' : '') + ("when appending segment " + segmentInfo.mediaIndex + " to " + type + "Buffer")); - sourceUpdater.queuePending[type] = null; - onError(e); - } - }; - }, - remove: function remove(start, end) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Removing " + start + " to " + end + " from " + type + "Buffer"); - - try { - sourceBuffer.remove(start, end); - } catch (e) { - sourceUpdater.logger_("Remove " + start + " to " + end + " from " + type + "Buffer failed"); - } - }; - }, - timestampOffset: function timestampOffset(offset) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Setting " + type + "timestampOffset to " + offset); - sourceBuffer.timestampOffset = offset; - }; - }, - callback: function callback(_callback) { - return function (type, sourceUpdater) { - _callback(); - }; - }, - endOfStream: function endOfStream(error) { - return function (sourceUpdater) { - if (sourceUpdater.mediaSource.readyState !== 'open') { - return; - } - - sourceUpdater.logger_("Calling mediaSource endOfStream(" + (error || '') + ")"); - - try { - sourceUpdater.mediaSource.endOfStream(error); - } catch (e) { - videojs__default['default'].log.warn('Failed to call media source endOfStream', e); - } - }; - }, - duration: function duration(_duration) { - return function (sourceUpdater) { - sourceUpdater.logger_("Setting mediaSource duration to " + _duration); - - try { - sourceUpdater.mediaSource.duration = _duration; - } catch (e) { - videojs__default['default'].log.warn('Failed to set media source duration', e); - } - }; - }, - abort: function abort() { - return function (type, sourceUpdater) { - if (sourceUpdater.mediaSource.readyState !== 'open') { - return; - } - - var sourceBuffer = sourceUpdater[type + "Buffer"]; // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("calling abort on " + type + "Buffer"); - - try { - sourceBuffer.abort(); - } catch (e) { - videojs__default['default'].log.warn("Failed to abort on " + type + "Buffer", e); - } - }; - }, - addSourceBuffer: function addSourceBuffer(type, codec) { - return function (sourceUpdater) { - var titleType = toTitleCase(type); - var mime = getMimeForCodec(codec); - sourceUpdater.logger_("Adding " + type + "Buffer with codec " + codec + " to mediaSource"); - var sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime); - sourceBuffer.addEventListener('updateend', sourceUpdater["on" + titleType + "UpdateEnd_"]); - sourceBuffer.addEventListener('error', sourceUpdater["on" + titleType + "Error_"]); - sourceUpdater.codecs[type] = codec; - sourceUpdater[type + "Buffer"] = sourceBuffer; - }; - }, - removeSourceBuffer: function removeSourceBuffer(type) { - return function (sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - cleanupBuffer(type, sourceUpdater); // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } - - sourceUpdater.logger_("Removing " + type + "Buffer with codec " + sourceUpdater.codecs[type] + " from mediaSource"); - - try { - sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer); - } catch (e) { - videojs__default['default'].log.warn("Failed to removeSourceBuffer " + type + "Buffer", e); - } - }; - }, - changeType: function changeType(codec) { - return function (type, sourceUpdater) { - var sourceBuffer = sourceUpdater[type + "Buffer"]; - var mime = getMimeForCodec(codec); // can't do anything if the media source / source buffer is null - // or the media source does not contain this source buffer. - - if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) { - return; - } // do not update codec if we don't need to. - - - if (sourceUpdater.codecs[type] === codec) { - return; - } - - sourceUpdater.logger_("changing " + type + "Buffer codec from " + sourceUpdater.codecs[type] + " to " + codec); - sourceBuffer.changeType(mime); - sourceUpdater.codecs[type] = codec; - }; - } - }; - - var pushQueue = function pushQueue(_ref) { - var type = _ref.type, - sourceUpdater = _ref.sourceUpdater, - action = _ref.action, - doneFn = _ref.doneFn, - name = _ref.name; - sourceUpdater.queue.push({ - type: type, - action: action, - doneFn: doneFn, - name: name - }); - shiftQueue(type, sourceUpdater); - }; - - var onUpdateend = function onUpdateend(type, sourceUpdater) { - return function (e) { - // Although there should, in theory, be a pending action for any updateend receieved, - // there are some actions that may trigger updateend events without set definitions in - // the w3c spec. For instance, setting the duration on the media source may trigger - // updateend events on source buffers. This does not appear to be in the spec. As such, - // if we encounter an updateend without a corresponding pending action from our queue - // for that source buffer type, process the next action. - if (sourceUpdater.queuePending[type]) { - var doneFn = sourceUpdater.queuePending[type].doneFn; - sourceUpdater.queuePending[type] = null; - - if (doneFn) { - // if there's an error, report it - doneFn(sourceUpdater[type + "Error_"]); - } - } - - shiftQueue(type, sourceUpdater); - }; - }; - /** - * A queue of callbacks to be serialized and applied when a - * MediaSource and its associated SourceBuffers are not in the - * updating state. It is used by the segment loader to update the - * underlying SourceBuffers when new data is loaded, for instance. - * - * @class SourceUpdater - * @param {MediaSource} mediaSource the MediaSource to create the SourceBuffer from - * @param {string} mimeType the desired MIME type of the underlying SourceBuffer - */ - - - var SourceUpdater = /*#__PURE__*/function (_videojs$EventTarget) { - inheritsLoose(SourceUpdater, _videojs$EventTarget); - - function SourceUpdater(mediaSource) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - _this.mediaSource = mediaSource; - - _this.sourceopenListener_ = function () { - return shiftQueue('mediaSource', assertThisInitialized(_this)); - }; - - _this.mediaSource.addEventListener('sourceopen', _this.sourceopenListener_); - - _this.logger_ = logger('SourceUpdater'); // initial timestamp offset is 0 - - _this.audioTimestampOffset_ = 0; - _this.videoTimestampOffset_ = 0; - _this.queue = []; - _this.queuePending = { - audio: null, - video: null - }; - _this.delayedAudioAppendQueue_ = []; - _this.videoAppendQueued_ = false; - _this.codecs = {}; - _this.onVideoUpdateEnd_ = onUpdateend('video', assertThisInitialized(_this)); - _this.onAudioUpdateEnd_ = onUpdateend('audio', assertThisInitialized(_this)); - - _this.onVideoError_ = function (e) { - // used for debugging - _this.videoError_ = e; - }; - - _this.onAudioError_ = function (e) { - // used for debugging - _this.audioError_ = e; - }; - - _this.createdSourceBuffers_ = false; - _this.initializedEme_ = false; - _this.triggeredReady_ = false; - return _this; - } - - var _proto = SourceUpdater.prototype; - - _proto.initializedEme = function initializedEme() { - this.initializedEme_ = true; - this.triggerReady(); - }; - - _proto.hasCreatedSourceBuffers = function hasCreatedSourceBuffers() { - // if false, likely waiting on one of the segment loaders to get enough data to create - // source buffers - return this.createdSourceBuffers_; - }; - - _proto.hasInitializedAnyEme = function hasInitializedAnyEme() { - return this.initializedEme_; - }; - - _proto.ready = function ready() { - return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme(); - }; - - _proto.createSourceBuffers = function createSourceBuffers(codecs) { - if (this.hasCreatedSourceBuffers()) { - // already created them before - return; - } // the intial addOrChangeSourceBuffers will always be - // two add buffers. - - - this.addOrChangeSourceBuffers(codecs); - this.createdSourceBuffers_ = true; - this.trigger('createdsourcebuffers'); - this.triggerReady(); - }; - - _proto.triggerReady = function triggerReady() { - // only allow ready to be triggered once, this prevents the case - // where: - // 1. we trigger createdsourcebuffers - // 2. ie 11 synchronously initializates eme - // 3. the synchronous initialization causes us to trigger ready - // 4. We go back to the ready check in createSourceBuffers and ready is triggered again. - if (this.ready() && !this.triggeredReady_) { - this.triggeredReady_ = true; - this.trigger('ready'); - } - } - /** - * Add a type of source buffer to the media source. - * - * @param {string} type - * The type of source buffer to add. - * - * @param {string} codec - * The codec to add the source buffer with. - */ - ; - - _proto.addSourceBuffer = function addSourceBuffer(type, codec) { - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.addSourceBuffer(type, codec), - name: 'addSourceBuffer' - }); - } - /** - * call abort on a source buffer. - * - * @param {string} type - * The type of source buffer to call abort on. - */ - ; - - _proto.abort = function abort(type) { - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.abort(type), - name: 'abort' - }); - } - /** - * Call removeSourceBuffer and remove a specific type - * of source buffer on the mediaSource. - * - * @param {string} type - * The type of source buffer to remove. - */ - ; - - _proto.removeSourceBuffer = function removeSourceBuffer(type) { - if (!this.canRemoveSourceBuffer()) { - videojs__default['default'].log.error('removeSourceBuffer is not supported!'); - return; - } - - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.removeSourceBuffer(type), - name: 'removeSourceBuffer' - }); - } - /** - * Whether or not the removeSourceBuffer function is supported - * on the mediaSource. - * - * @return {boolean} - * if removeSourceBuffer can be called. - */ - ; - - _proto.canRemoveSourceBuffer = function canRemoveSourceBuffer() { - // IE reports that it supports removeSourceBuffer, but often throws - // errors when attempting to use the function. So we report that it - // does not support removeSourceBuffer. As of Firefox 83 removeSourceBuffer - // throws errors, so we report that it does not support this as well. - return !videojs__default['default'].browser.IE_VERSION && !videojs__default['default'].browser.IS_FIREFOX && window__default['default'].MediaSource && window__default['default'].MediaSource.prototype && typeof window__default['default'].MediaSource.prototype.removeSourceBuffer === 'function'; - } - /** - * Whether or not the changeType function is supported - * on our SourceBuffers. - * - * @return {boolean} - * if changeType can be called. - */ - ; - - SourceUpdater.canChangeType = function canChangeType() { - return window__default['default'].SourceBuffer && window__default['default'].SourceBuffer.prototype && typeof window__default['default'].SourceBuffer.prototype.changeType === 'function'; - } - /** - * Whether or not the changeType function is supported - * on our SourceBuffers. - * - * @return {boolean} - * if changeType can be called. - */ - ; - - _proto.canChangeType = function canChangeType() { - return this.constructor.canChangeType(); - } - /** - * Call the changeType function on a source buffer, given the code and type. - * - * @param {string} type - * The type of source buffer to call changeType on. - * - * @param {string} codec - * The codec string to change type with on the source buffer. - */ - ; - - _proto.changeType = function changeType(type, codec) { - if (!this.canChangeType()) { - videojs__default['default'].log.error('changeType is not supported!'); - return; - } - - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.changeType(codec), - name: 'changeType' - }); - } - /** - * Add source buffers with a codec or, if they are already created, - * call changeType on source buffers using changeType. - * - * @param {Object} codecs - * Codecs to switch to - */ - ; - - _proto.addOrChangeSourceBuffers = function addOrChangeSourceBuffers(codecs) { - var _this2 = this; - - if (!codecs || typeof codecs !== 'object' || Object.keys(codecs).length === 0) { - throw new Error('Cannot addOrChangeSourceBuffers to undefined codecs'); - } - - Object.keys(codecs).forEach(function (type) { - var codec = codecs[type]; - - if (!_this2.hasCreatedSourceBuffers()) { - return _this2.addSourceBuffer(type, codec); - } - - if (_this2.canChangeType()) { - _this2.changeType(type, codec); - } - }); - } - /** - * Queue an update to append an ArrayBuffer. - * - * @param {MediaObject} object containing audioBytes and/or videoBytes - * @param {Function} done the function to call when done - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-appendBuffer-void-ArrayBuffer-data - */ - ; - - _proto.appendBuffer = function appendBuffer(options, doneFn) { - var _this3 = this; - - var segmentInfo = options.segmentInfo, - type = options.type, - bytes = options.bytes; - this.processedAppend_ = true; - - if (type === 'audio' && this.videoBuffer && !this.videoAppendQueued_) { - this.delayedAudioAppendQueue_.push([options, doneFn]); - this.logger_("delayed audio append of " + bytes.length + " until video append"); - return; - } // In the case of certain errors, for instance, QUOTA_EXCEEDED_ERR, updateend will - // not be fired. This means that the queue will be blocked until the next action - // taken by the segment-loader. Provide a mechanism for segment-loader to handle - // these errors by calling the doneFn with the specific error. - - - var onError = doneFn; - pushQueue({ - type: type, - sourceUpdater: this, - action: actions.appendBuffer(bytes, segmentInfo || { - mediaIndex: -1 - }, onError), - doneFn: doneFn, - name: 'appendBuffer' - }); - - if (type === 'video') { - this.videoAppendQueued_ = true; - - if (!this.delayedAudioAppendQueue_.length) { - return; - } - - var queue = this.delayedAudioAppendQueue_.slice(); - this.logger_("queuing delayed audio " + queue.length + " appendBuffers"); - this.delayedAudioAppendQueue_.length = 0; - queue.forEach(function (que) { - _this3.appendBuffer.apply(_this3, que); - }); - } - } - /** - * Get the audio buffer's buffered timerange. - * - * @return {TimeRange} - * The audio buffer's buffered time range - */ - ; - - _proto.audioBuffered = function audioBuffered() { - // no media source/source buffer or it isn't in the media sources - // source buffer list - if (!inSourceBuffers(this.mediaSource, this.audioBuffer)) { - return videojs__default['default'].createTimeRange(); - } - - return this.audioBuffer.buffered ? this.audioBuffer.buffered : videojs__default['default'].createTimeRange(); - } - /** - * Get the video buffer's buffered timerange. - * - * @return {TimeRange} - * The video buffer's buffered time range - */ - ; - - _proto.videoBuffered = function videoBuffered() { - // no media source/source buffer or it isn't in the media sources - // source buffer list - if (!inSourceBuffers(this.mediaSource, this.videoBuffer)) { - return videojs__default['default'].createTimeRange(); - } - - return this.videoBuffer.buffered ? this.videoBuffer.buffered : videojs__default['default'].createTimeRange(); - } - /** - * Get a combined video/audio buffer's buffered timerange. - * - * @return {TimeRange} - * the combined time range - */ - ; - - _proto.buffered = function buffered() { - var video = inSourceBuffers(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null; - var audio = inSourceBuffers(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null; - - if (audio && !video) { - return this.audioBuffered(); - } - - if (video && !audio) { - return this.videoBuffered(); - } - - return bufferIntersection(this.audioBuffered(), this.videoBuffered()); - } - /** - * Add a callback to the queue that will set duration on the mediaSource. - * - * @param {number} duration - * The duration to set - * - * @param {Function} [doneFn] - * function to run after duration has been set. - */ - ; - - _proto.setDuration = function setDuration(duration, doneFn) { - if (doneFn === void 0) { - doneFn = noop; - } - - // In order to set the duration on the media source, it's necessary to wait for all - // source buffers to no longer be updating. "If the updating attribute equals true on - // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and - // abort these steps." (source: https://www.w3.org/TR/media-source/#attributes). - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.duration(duration), - name: 'duration', - doneFn: doneFn - }); - } - /** - * Add a mediaSource endOfStream call to the queue - * - * @param {Error} [error] - * Call endOfStream with an error - * - * @param {Function} [doneFn] - * A function that should be called when the - * endOfStream call has finished. - */ - ; - - _proto.endOfStream = function endOfStream(error, doneFn) { - if (error === void 0) { - error = null; - } - - if (doneFn === void 0) { - doneFn = noop; - } - - if (typeof error !== 'string') { - error = undefined; - } // In order to set the duration on the media source, it's necessary to wait for all - // source buffers to no longer be updating. "If the updating attribute equals true on - // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and - // abort these steps." (source: https://www.w3.org/TR/media-source/#attributes). - - - pushQueue({ - type: 'mediaSource', - sourceUpdater: this, - action: actions.endOfStream(error), - name: 'endOfStream', - doneFn: doneFn - }); - } - /** - * Queue an update to remove a time range from the buffer. - * - * @param {number} start where to start the removal - * @param {number} end where to end the removal - * @param {Function} [done=noop] optional callback to be executed when the remove - * operation is complete - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end - */ - ; - - _proto.removeAudio = function removeAudio(start, end, done) { - if (done === void 0) { - done = noop; - } - - if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) { - done(); - return; - } - - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.remove(start, end), - doneFn: done, - name: 'remove' - }); - } - /** - * Queue an update to remove a time range from the buffer. - * - * @param {number} start where to start the removal - * @param {number} end where to end the removal - * @param {Function} [done=noop] optional callback to be executed when the remove - * operation is complete - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end - */ - ; - - _proto.removeVideo = function removeVideo(start, end, done) { - if (done === void 0) { - done = noop; - } - - if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) { - done(); - return; - } - - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.remove(start, end), - doneFn: done, - name: 'remove' - }); - } - /** - * Whether the underlying sourceBuffer is updating or not - * - * @return {boolean} the updating status of the SourceBuffer - */ - ; - - _proto.updating = function updating() { - // the audio/video source buffer is updating - if (_updating('audio', this) || _updating('video', this)) { - return true; - } - - return false; - } - /** - * Set/get the timestampoffset on the audio SourceBuffer - * - * @return {number} the timestamp offset - */ - ; - - _proto.audioTimestampOffset = function audioTimestampOffset(offset) { - if (typeof offset !== 'undefined' && this.audioBuffer && // no point in updating if it's the same - this.audioTimestampOffset_ !== offset) { - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.timestampOffset(offset), - name: 'timestampOffset' - }); - this.audioTimestampOffset_ = offset; - } - - return this.audioTimestampOffset_; - } - /** - * Set/get the timestampoffset on the video SourceBuffer - * - * @return {number} the timestamp offset - */ - ; - - _proto.videoTimestampOffset = function videoTimestampOffset(offset) { - if (typeof offset !== 'undefined' && this.videoBuffer && // no point in updating if it's the same - this.videoTimestampOffset !== offset) { - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.timestampOffset(offset), - name: 'timestampOffset' - }); - this.videoTimestampOffset_ = offset; - } - - return this.videoTimestampOffset_; - } - /** - * Add a function to the queue that will be called - * when it is its turn to run in the audio queue. - * - * @param {Function} callback - * The callback to queue. - */ - ; - - _proto.audioQueueCallback = function audioQueueCallback(callback) { - if (!this.audioBuffer) { - return; - } - - pushQueue({ - type: 'audio', - sourceUpdater: this, - action: actions.callback(callback), - name: 'callback' - }); - } - /** - * Add a function to the queue that will be called - * when it is its turn to run in the video queue. - * - * @param {Function} callback - * The callback to queue. - */ - ; - - _proto.videoQueueCallback = function videoQueueCallback(callback) { - if (!this.videoBuffer) { - return; - } - - pushQueue({ - type: 'video', - sourceUpdater: this, - action: actions.callback(callback), - name: 'callback' - }); - } - /** - * dispose of the source updater and the underlying sourceBuffer - */ - ; - - _proto.dispose = function dispose() { - var _this4 = this; - - this.trigger('dispose'); - bufferTypes.forEach(function (type) { - _this4.abort(type); - - if (_this4.canRemoveSourceBuffer()) { - _this4.removeSourceBuffer(type); - } else { - _this4[type + "QueueCallback"](function () { - return cleanupBuffer(type, _this4); - }); - } - }); - this.videoAppendQueued_ = false; - this.delayedAudioAppendQueue_.length = 0; - - if (this.sourceopenListener_) { - this.mediaSource.removeEventListener('sourceopen', this.sourceopenListener_); - } - - this.off(); - }; - - return SourceUpdater; - }(videojs__default['default'].EventTarget); - - var uint8ToUtf8 = function uint8ToUtf8(uintArray) { - return decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray))); - }; - - var VTT_LINE_TERMINATORS = new Uint8Array('\n\n'.split('').map(function (char) { - return char.charCodeAt(0); - })); - /** - * An object that manages segment loading and appending. - * - * @class VTTSegmentLoader - * @param {Object} options required and optional options - * @extends videojs.EventTarget - */ - - var VTTSegmentLoader = /*#__PURE__*/function (_SegmentLoader) { - inheritsLoose(VTTSegmentLoader, _SegmentLoader); - - function VTTSegmentLoader(settings, options) { - var _this; - - if (options === void 0) { - options = {}; - } - - _this = _SegmentLoader.call(this, settings, options) || this; // SegmentLoader requires a MediaSource be specified or it will throw an error; - // however, VTTSegmentLoader has no need of a media source, so delete the reference - - _this.mediaSource_ = null; - _this.subtitlesTrack_ = null; - _this.loaderType_ = 'subtitle'; - _this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks; // The VTT segment will have its own time mappings. Saving VTT segment timing info in - // the sync controller leads to improper behavior. - - _this.shouldSaveSegmentTimingInfo_ = false; - return _this; - } - - var _proto = VTTSegmentLoader.prototype; - - _proto.createTransmuxer_ = function createTransmuxer_() { - // don't need to transmux any subtitles - return null; - } - /** - * Indicates which time ranges are buffered - * - * @return {TimeRange} - * TimeRange object representing the current buffered ranges - */ - ; - - _proto.buffered_ = function buffered_() { - if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) { - return videojs__default['default'].createTimeRanges(); - } - - var cues = this.subtitlesTrack_.cues; - var start = cues[0].startTime; - var end = cues[cues.length - 1].startTime; - return videojs__default['default'].createTimeRanges([[start, end]]); - } - /** - * Gets and sets init segment for the provided map - * - * @param {Object} map - * The map object representing the init segment to get or set - * @param {boolean=} set - * If true, the init segment for the provided map should be saved - * @return {Object} - * map object for desired init segment - */ - ; - - _proto.initSegmentForMap = function initSegmentForMap(map, set) { - if (set === void 0) { - set = false; - } - - if (!map) { - return null; - } - - var id = initSegmentId(map); - var storedMap = this.initSegments_[id]; - - if (set && !storedMap && map.bytes) { - // append WebVTT line terminators to the media initialization segment if it exists - // to follow the WebVTT spec (https://w3c.github.io/webvtt/#file-structure) that - // requires two or more WebVTT line terminators between the WebVTT header and the - // rest of the file - var combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength; - var combinedSegment = new Uint8Array(combinedByteLength); - combinedSegment.set(map.bytes); - combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength); - this.initSegments_[id] = storedMap = { - resolvedUri: map.resolvedUri, - byterange: map.byterange, - bytes: combinedSegment - }; - } - - return storedMap || map; - } - /** - * Returns true if all configuration required for loading is present, otherwise false. - * - * @return {boolean} True if the all configuration is ready for loading - * @private - */ - ; - - _proto.couldBeginLoading_ = function couldBeginLoading_() { - return this.playlist_ && this.subtitlesTrack_ && !this.paused(); - } - /** - * Once all the starting parameters have been specified, begin - * operation. This method should only be invoked from the INIT - * state. - * - * @private - */ - ; - - _proto.init_ = function init_() { - this.state = 'READY'; - this.resetEverything(); - return this.monitorBuffer_(); - } - /** - * Set a subtitle track on the segment loader to add subtitles to - * - * @param {TextTrack=} track - * The text track to add loaded subtitles to - * @return {TextTrack} - * Returns the subtitles track - */ - ; - - _proto.track = function track(_track) { - if (typeof _track === 'undefined') { - return this.subtitlesTrack_; - } - - this.subtitlesTrack_ = _track; // if we were unpaused but waiting for a sourceUpdater, start - // buffering now - - if (this.state === 'INIT' && this.couldBeginLoading_()) { - this.init_(); - } - - return this.subtitlesTrack_; - } - /** - * Remove any data in the source buffer between start and end times - * - * @param {number} start - the start time of the region to remove from the buffer - * @param {number} end - the end time of the region to remove from the buffer - */ - ; - - _proto.remove = function remove(start, end) { - removeCuesFromTrack(start, end, this.subtitlesTrack_); - } - /** - * fill the buffer with segements unless the sourceBuffers are - * currently updating - * - * Note: this function should only ever be called by monitorBuffer_ - * and never directly - * - * @private - */ - ; - - _proto.fillBuffer_ = function fillBuffer_() { - var _this2 = this; - - // see if we need to begin loading immediately - var segmentInfo = this.chooseNextRequest_(); - - if (!segmentInfo) { - return; - } - - if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) { - // We don't have the timestamp offset that we need to sync subtitles. - // Rerun on a timestamp offset or user interaction. - var checkTimestampOffset = function checkTimestampOffset() { - _this2.state = 'READY'; - - if (!_this2.paused()) { - // if not paused, queue a buffer check as soon as possible - _this2.monitorBuffer_(); - } - }; - - this.syncController_.one('timestampoffset', checkTimestampOffset); - this.state = 'WAITING_ON_TIMELINE'; - return; - } - - this.loadSegment_(segmentInfo); - } // never set a timestamp offset for vtt segments. - ; - - _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_() { - return null; - }; - - _proto.chooseNextRequest_ = function chooseNextRequest_() { - return this.skipEmptySegments_(_SegmentLoader.prototype.chooseNextRequest_.call(this)); - } - /** - * Prevents the segment loader from requesting segments we know contain no subtitles - * by walking forward until we find the next segment that we don't know whether it is - * empty or not. - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @return {Object} - * a segment info object that describes the current segment - */ - ; - - _proto.skipEmptySegments_ = function skipEmptySegments_(segmentInfo) { - while (segmentInfo && segmentInfo.segment.empty) { - // stop at the last possible segmentInfo - if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) { - segmentInfo = null; - break; - } - - segmentInfo = this.generateSegmentInfo_({ - playlist: segmentInfo.playlist, - mediaIndex: segmentInfo.mediaIndex + 1, - startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration, - isSyncRequest: segmentInfo.isSyncRequest - }); - } - - return segmentInfo; - }; - - _proto.stopForError = function stopForError(error) { - this.error(error); - this.state = 'READY'; - this.pause(); - this.trigger('error'); - } - /** - * append a decrypted segement to the SourceBuffer through a SourceUpdater - * - * @private - */ - ; - - _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) { - var _this3 = this; - - if (!this.subtitlesTrack_) { - this.state = 'READY'; - return; - } - - this.saveTransferStats_(simpleSegment.stats); // the request was aborted - - if (!this.pendingSegment_) { - this.state = 'READY'; - this.mediaRequestsAborted += 1; - return; - } - - if (error) { - if (error.code === REQUEST_ERRORS.TIMEOUT) { - this.handleTimeout_(); - } - - if (error.code === REQUEST_ERRORS.ABORTED) { - this.mediaRequestsAborted += 1; - } else { - this.mediaRequestsErrored += 1; - } - - this.stopForError(error); - return; - } - - var segmentInfo = this.pendingSegment_; // although the VTT segment loader bandwidth isn't really used, it's good to - // maintain functionality between segment loaders - - this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats); - this.state = 'APPENDING'; // used for tests - - this.trigger('appending'); - var segment = segmentInfo.segment; - - if (segment.map) { - segment.map.bytes = simpleSegment.map.bytes; - } - - segmentInfo.bytes = simpleSegment.bytes; // Make sure that vttjs has loaded, otherwise, wait till it finished loading - - if (typeof window__default['default'].WebVTT !== 'function' && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) { - var loadHandler; - - var errorHandler = function errorHandler() { - _this3.subtitlesTrack_.tech_.off('vttjsloaded', loadHandler); - - _this3.stopForError({ - message: 'Error loading vtt.js' - }); - - return; - }; - - loadHandler = function loadHandler() { - _this3.subtitlesTrack_.tech_.off('vttjserror', errorHandler); - - _this3.segmentRequestFinished_(error, simpleSegment, result); - }; - - this.state = 'WAITING_ON_VTTJS'; - this.subtitlesTrack_.tech_.one('vttjsloaded', loadHandler); - this.subtitlesTrack_.tech_.one('vttjserror', errorHandler); - return; - } - - segment.requested = true; - - try { - this.parseVTTCues_(segmentInfo); - } catch (e) { - this.stopForError({ - message: e.message - }); - return; - } - - this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_); - - if (segmentInfo.cues.length) { - segmentInfo.timingInfo = { - start: segmentInfo.cues[0].startTime, - end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime - }; - } else { - segmentInfo.timingInfo = { - start: segmentInfo.startOfSegment, - end: segmentInfo.startOfSegment + segmentInfo.duration - }; - } - - if (segmentInfo.isSyncRequest) { - this.trigger('syncinfoupdate'); - this.pendingSegment_ = null; - this.state = 'READY'; - return; - } - - segmentInfo.byteLength = segmentInfo.bytes.byteLength; - this.mediaSecondsLoaded += segment.duration; // Create VTTCue instances for each cue in the new segment and add them to - // the subtitle track - - segmentInfo.cues.forEach(function (cue) { - _this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_ ? new window__default['default'].VTTCue(cue.startTime, cue.endTime, cue.text) : cue); - }); // Remove any duplicate cues from the subtitle track. The WebVTT spec allows - // cues to have identical time-intervals, but if the text is also identical - // we can safely assume it is a duplicate that can be removed (ex. when a cue - // "overlaps" VTT segments) - - removeDuplicateCuesFromTrack(this.subtitlesTrack_); - this.handleAppendsDone_(); - }; - - _proto.handleData_ = function handleData_() {// noop as we shouldn't be getting video/audio data captions - // that we do not support here. - }; - - _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_() {// noop - } - /** - * Uses the WebVTT parser to parse the segment response - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @private - */ - ; - - _proto.parseVTTCues_ = function parseVTTCues_(segmentInfo) { - var decoder; - var decodeBytesToString = false; - - if (typeof window__default['default'].TextDecoder === 'function') { - decoder = new window__default['default'].TextDecoder('utf8'); - } else { - decoder = window__default['default'].WebVTT.StringDecoder(); - decodeBytesToString = true; - } - - var parser = new window__default['default'].WebVTT.Parser(window__default['default'], window__default['default'].vttjs, decoder); - segmentInfo.cues = []; - segmentInfo.timestampmap = { - MPEGTS: 0, - LOCAL: 0 - }; - parser.oncue = segmentInfo.cues.push.bind(segmentInfo.cues); - - parser.ontimestampmap = function (map) { - segmentInfo.timestampmap = map; - }; - - parser.onparsingerror = function (error) { - videojs__default['default'].log.warn('Error encountered when parsing cues: ' + error.message); - }; - - if (segmentInfo.segment.map) { - var mapData = segmentInfo.segment.map.bytes; - - if (decodeBytesToString) { - mapData = uint8ToUtf8(mapData); - } - - parser.parse(mapData); - } - - var segmentData = segmentInfo.bytes; - - if (decodeBytesToString) { - segmentData = uint8ToUtf8(segmentData); - } - - parser.parse(segmentData); - parser.flush(); - } - /** - * Updates the start and end times of any cues parsed by the WebVTT parser using - * the information parsed from the X-TIMESTAMP-MAP header and a TS to media time mapping - * from the SyncController - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @param {Object} mappingObj - * object containing a mapping from TS to media time - * @param {Object} playlist - * the playlist object containing the segment - * @private - */ - ; - - _proto.updateTimeMapping_ = function updateTimeMapping_(segmentInfo, mappingObj, playlist) { - var segment = segmentInfo.segment; - - if (!mappingObj) { - // If the sync controller does not have a mapping of TS to Media Time for the - // timeline, then we don't have enough information to update the cue - // start/end times - return; - } - - if (!segmentInfo.cues.length) { - // If there are no cues, we also do not have enough information to figure out - // segment timing. Mark that the segment contains no cues so we don't re-request - // an empty segment. - segment.empty = true; - return; - } - - var timestampmap = segmentInfo.timestampmap; - var diff = timestampmap.MPEGTS / clock.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping; - segmentInfo.cues.forEach(function (cue) { - // First convert cue time to TS time using the timestamp-map provided within the vtt - cue.startTime += diff; - cue.endTime += diff; - }); - - if (!playlist.syncInfo) { - var firstStart = segmentInfo.cues[0].startTime; - var lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime; - playlist.syncInfo = { - mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex, - time: Math.min(firstStart, lastStart - segment.duration) - }; - } - }; - - return VTTSegmentLoader; - }(SegmentLoader); - - /** - * @file ad-cue-tags.js - */ - /** - * Searches for an ad cue that overlaps with the given mediaTime - * - * @param {Object} track - * the track to find the cue for - * - * @param {number} mediaTime - * the time to find the cue at - * - * @return {Object|null} - * the found cue or null - */ - - var findAdCue = function findAdCue(track, mediaTime) { - var cues = track.cues; - - for (var i = 0; i < cues.length; i++) { - var cue = cues[i]; - - if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) { - return cue; - } - } - - return null; - }; - var updateAdCues = function updateAdCues(media, track, offset) { - if (offset === void 0) { - offset = 0; - } - - if (!media.segments) { - return; - } - - var mediaTime = offset; - var cue; - - for (var i = 0; i < media.segments.length; i++) { - var segment = media.segments[i]; - - if (!cue) { - // Since the cues will span for at least the segment duration, adding a fudge - // factor of half segment duration will prevent duplicate cues from being - // created when timing info is not exact (e.g. cue start time initialized - // at 10.006677, but next call mediaTime is 10.003332 ) - cue = findAdCue(track, mediaTime + segment.duration / 2); - } - - if (cue) { - if ('cueIn' in segment) { - // Found a CUE-IN so end the cue - cue.endTime = mediaTime; - cue.adEndTime = mediaTime; - mediaTime += segment.duration; - cue = null; - continue; - } - - if (mediaTime < cue.endTime) { - // Already processed this mediaTime for this cue - mediaTime += segment.duration; - continue; - } // otherwise extend cue until a CUE-IN is found - - - cue.endTime += segment.duration; - } else { - if ('cueOut' in segment) { - cue = new window__default['default'].VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut); - cue.adStartTime = mediaTime; // Assumes tag format to be - // #EXT-X-CUE-OUT:30 - - cue.adEndTime = mediaTime + parseFloat(segment.cueOut); - track.addCue(cue); - } - - if ('cueOutCont' in segment) { - // Entered into the middle of an ad cue - // Assumes tag formate to be - // #EXT-X-CUE-OUT-CONT:10/30 - var _segment$cueOutCont$s = segment.cueOutCont.split('/').map(parseFloat), - adOffset = _segment$cueOutCont$s[0], - adTotal = _segment$cueOutCont$s[1]; - - cue = new window__default['default'].VTTCue(mediaTime, mediaTime + segment.duration, ''); - cue.adStartTime = mediaTime - adOffset; - cue.adEndTime = cue.adStartTime + adTotal; - track.addCue(cue); - } - } - - mediaTime += segment.duration; - } - }; - - var syncPointStrategies = [// Stategy "VOD": Handle the VOD-case where the sync-point is *always* - // the equivalence display-time 0 === segment-index 0 - { - name: 'VOD', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (duration !== Infinity) { - var syncPoint = { - time: 0, - segmentIndex: 0, - partIndex: null - }; - return syncPoint; - } - - return null; - } - }, // Stategy "ProgramDateTime": We have a program-date-time tag in this playlist - { - name: 'ProgramDateTime', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (!Object.keys(syncController.timelineToDatetimeMappings).length) { - return null; - } - - var syncPoint = null; - var lastDistance = null; - var partsAndSegments = getPartsAndSegments(playlist); - currentTime = currentTime || 0; - - for (var i = 0; i < partsAndSegments.length; i++) { - // start from the end and loop backwards for live - // or start from the front and loop forwards for non-live - var index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1); - var partAndSegment = partsAndSegments[index]; - var segment = partAndSegment.segment; - var datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline]; - - if (!datetimeMapping) { - continue; - } - - if (segment.dateTimeObject) { - var segmentTime = segment.dateTimeObject.getTime() / 1000; - var start = segmentTime + datetimeMapping; // take part duration into account. - - if (segment.parts && typeof partAndSegment.partIndex === 'number') { - for (var z = 0; z < partAndSegment.partIndex; z++) { - start += segment.parts[z].duration; - } - } - - var distance = Math.abs(currentTime - start); // Once the distance begins to increase, or if distance is 0, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && (distance === 0 || lastDistance < distance)) { - break; - } - - lastDistance = distance; - syncPoint = { - time: start, - segmentIndex: partAndSegment.segmentIndex, - partIndex: partAndSegment.partIndex - }; - } - } - - return syncPoint; - } - }, // Stategy "Segment": We have a known time mapping for a timeline and a - // segment in the current timeline with timing data - { - name: 'Segment', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - var syncPoint = null; - var lastDistance = null; - currentTime = currentTime || 0; - var partsAndSegments = getPartsAndSegments(playlist); - - for (var i = 0; i < partsAndSegments.length; i++) { - // start from the end and loop backwards for live - // or start from the front and loop forwards for non-live - var index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1); - var partAndSegment = partsAndSegments[index]; - var segment = partAndSegment.segment; - var start = partAndSegment.part && partAndSegment.part.start || segment && segment.start; - - if (segment.timeline === currentTimeline && typeof start !== 'undefined') { - var distance = Math.abs(currentTime - start); // Once the distance begins to increase, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && lastDistance < distance) { - break; - } - - if (!syncPoint || lastDistance === null || lastDistance >= distance) { - lastDistance = distance; - syncPoint = { - time: start, - segmentIndex: partAndSegment.segmentIndex, - partIndex: partAndSegment.partIndex - }; - } - } - } - - return syncPoint; - } - }, // Stategy "Discontinuity": We have a discontinuity with a known - // display-time - { - name: 'Discontinuity', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - var syncPoint = null; - currentTime = currentTime || 0; - - if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) { - var lastDistance = null; - - for (var i = 0; i < playlist.discontinuityStarts.length; i++) { - var segmentIndex = playlist.discontinuityStarts[i]; - var discontinuity = playlist.discontinuitySequence + i + 1; - var discontinuitySync = syncController.discontinuities[discontinuity]; - - if (discontinuitySync) { - var distance = Math.abs(currentTime - discontinuitySync.time); // Once the distance begins to increase, we have passed - // currentTime and can stop looking for better candidates - - if (lastDistance !== null && lastDistance < distance) { - break; - } - - if (!syncPoint || lastDistance === null || lastDistance >= distance) { - lastDistance = distance; - syncPoint = { - time: discontinuitySync.time, - segmentIndex: segmentIndex, - partIndex: null - }; - } - } - } - } - - return syncPoint; - } - }, // Stategy "Playlist": We have a playlist with a known mapping of - // segment index to display time - { - name: 'Playlist', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (playlist.syncInfo) { - var syncPoint = { - time: playlist.syncInfo.time, - segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence, - partIndex: null - }; - return syncPoint; - } - - return null; - } - }]; - - var SyncController = /*#__PURE__*/function (_videojs$EventTarget) { - inheritsLoose(SyncController, _videojs$EventTarget); - - function SyncController(options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; // ...for synching across variants - - _this.timelines = []; - _this.discontinuities = []; - _this.timelineToDatetimeMappings = {}; - _this.logger_ = logger('SyncController'); - return _this; - } - /** - * Find a sync-point for the playlist specified - * - * A sync-point is defined as a known mapping from display-time to - * a segment-index in the current playlist. - * - * @param {Playlist} playlist - * The playlist that needs a sync-point - * @param {number} duration - * Duration of the MediaSource (Infinite if playing a live source) - * @param {number} currentTimeline - * The last timeline from which a segment was loaded - * @return {Object} - * A sync-point object - */ - - - var _proto = SyncController.prototype; - - _proto.getSyncPoint = function getSyncPoint(playlist, duration, currentTimeline, currentTime) { - var syncPoints = this.runStrategies_(playlist, duration, currentTimeline, currentTime); - - if (!syncPoints.length) { - // Signal that we need to attempt to get a sync-point manually - // by fetching a segment in the playlist and constructing - // a sync-point from that information - return null; - } // Now find the sync-point that is closest to the currentTime because - // that should result in the most accurate guess about which segment - // to fetch - - - return this.selectSyncPoint_(syncPoints, { - key: 'time', - value: currentTime - }); - } - /** - * Calculate the amount of time that has expired off the playlist during playback - * - * @param {Playlist} playlist - * Playlist object to calculate expired from - * @param {number} duration - * Duration of the MediaSource (Infinity if playling a live source) - * @return {number|null} - * The amount of time that has expired off the playlist during playback. Null - * if no sync-points for the playlist can be found. - */ - ; - - _proto.getExpiredTime = function getExpiredTime(playlist, duration) { - if (!playlist || !playlist.segments) { - return null; - } - - var syncPoints = this.runStrategies_(playlist, duration, playlist.discontinuitySequence, 0); // Without sync-points, there is not enough information to determine the expired time - - if (!syncPoints.length) { - return null; - } - - var syncPoint = this.selectSyncPoint_(syncPoints, { - key: 'segmentIndex', - value: 0 - }); // If the sync-point is beyond the start of the playlist, we want to subtract the - // duration from index 0 to syncPoint.segmentIndex instead of adding. - - if (syncPoint.segmentIndex > 0) { - syncPoint.time *= -1; - } - - return Math.abs(syncPoint.time + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: syncPoint.segmentIndex, - endIndex: 0 - })); - } - /** - * Runs each sync-point strategy and returns a list of sync-points returned by the - * strategies - * - * @private - * @param {Playlist} playlist - * The playlist that needs a sync-point - * @param {number} duration - * Duration of the MediaSource (Infinity if playing a live source) - * @param {number} currentTimeline - * The last timeline from which a segment was loaded - * @return {Array} - * A list of sync-point objects - */ - ; - - _proto.runStrategies_ = function runStrategies_(playlist, duration, currentTimeline, currentTime) { - var syncPoints = []; // Try to find a sync-point in by utilizing various strategies... - - for (var i = 0; i < syncPointStrategies.length; i++) { - var strategy = syncPointStrategies[i]; - var syncPoint = strategy.run(this, playlist, duration, currentTimeline, currentTime); - - if (syncPoint) { - syncPoint.strategy = strategy.name; - syncPoints.push({ - strategy: strategy.name, - syncPoint: syncPoint - }); - } - } - - return syncPoints; - } - /** - * Selects the sync-point nearest the specified target - * - * @private - * @param {Array} syncPoints - * List of sync-points to select from - * @param {Object} target - * Object specifying the property and value we are targeting - * @param {string} target.key - * Specifies the property to target. Must be either 'time' or 'segmentIndex' - * @param {number} target.value - * The value to target for the specified key. - * @return {Object} - * The sync-point nearest the target - */ - ; - - _proto.selectSyncPoint_ = function selectSyncPoint_(syncPoints, target) { - var bestSyncPoint = syncPoints[0].syncPoint; - var bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value); - var bestStrategy = syncPoints[0].strategy; - - for (var i = 1; i < syncPoints.length; i++) { - var newDistance = Math.abs(syncPoints[i].syncPoint[target.key] - target.value); - - if (newDistance < bestDistance) { - bestDistance = newDistance; - bestSyncPoint = syncPoints[i].syncPoint; - bestStrategy = syncPoints[i].strategy; - } - } - - this.logger_("syncPoint for [" + target.key + ": " + target.value + "] chosen with strategy" + (" [" + bestStrategy + "]: [time:" + bestSyncPoint.time + ",") + (" segmentIndex:" + bestSyncPoint.segmentIndex) + (typeof bestSyncPoint.partIndex === 'number' ? ",partIndex:" + bestSyncPoint.partIndex : '') + ']'); - return bestSyncPoint; - } - /** - * Save any meta-data present on the segments when segments leave - * the live window to the playlist to allow for synchronization at the - * playlist level later. - * - * @param {Playlist} oldPlaylist - The previous active playlist - * @param {Playlist} newPlaylist - The updated and most current playlist - */ - ; - - _proto.saveExpiredSegmentInfo = function saveExpiredSegmentInfo(oldPlaylist, newPlaylist) { - var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; // When a segment expires from the playlist and it has a start time - // save that information as a possible sync-point reference in future - - for (var i = mediaSequenceDiff - 1; i >= 0; i--) { - var lastRemovedSegment = oldPlaylist.segments[i]; - - if (lastRemovedSegment && typeof lastRemovedSegment.start !== 'undefined') { - newPlaylist.syncInfo = { - mediaSequence: oldPlaylist.mediaSequence + i, - time: lastRemovedSegment.start - }; - this.logger_("playlist refresh sync: [time:" + newPlaylist.syncInfo.time + "," + (" mediaSequence: " + newPlaylist.syncInfo.mediaSequence + "]")); - this.trigger('syncinfoupdate'); - break; - } - } - } - /** - * Save the mapping from playlist's ProgramDateTime to display. This should only happen - * before segments start to load. - * - * @param {Playlist} playlist - The currently active playlist - */ - ; - - _proto.setDateTimeMappingForStart = function setDateTimeMappingForStart(playlist) { - // It's possible for the playlist to be updated before playback starts, meaning time - // zero is not yet set. If, during these playlist refreshes, a discontinuity is - // crossed, then the old time zero mapping (for the prior timeline) would be retained - // unless the mappings are cleared. - this.timelineToDatetimeMappings = {}; - - if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) { - var firstSegment = playlist.segments[0]; - var playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1000; - this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp; - } - } - /** - * Calculates and saves timeline mappings, playlist sync info, and segment timing values - * based on the latest timing information. - * - * @param {Object} options - * Options object - * @param {SegmentInfo} options.segmentInfo - * The current active request information - * @param {boolean} options.shouldSaveTimelineMapping - * If there's a timeline change, determines if the timeline mapping should be - * saved for timeline mapping and program date time mappings. - */ - ; - - _proto.saveSegmentTimingInfo = function saveSegmentTimingInfo(_ref) { - var segmentInfo = _ref.segmentInfo, - shouldSaveTimelineMapping = _ref.shouldSaveTimelineMapping; - var didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping); - var segment = segmentInfo.segment; - - if (didCalculateSegmentTimeMapping) { - this.saveDiscontinuitySyncInfo_(segmentInfo); // If the playlist does not have sync information yet, record that information - // now with segment timing information - - if (!segmentInfo.playlist.syncInfo) { - segmentInfo.playlist.syncInfo = { - mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex, - time: segment.start - }; - } - } - - var dateTime = segment.dateTimeObject; - - if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) { - this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1000); - } - }; - - _proto.timestampOffsetForTimeline = function timestampOffsetForTimeline(timeline) { - if (typeof this.timelines[timeline] === 'undefined') { - return null; - } - - return this.timelines[timeline].time; - }; - - _proto.mappingForTimeline = function mappingForTimeline(timeline) { - if (typeof this.timelines[timeline] === 'undefined') { - return null; - } - - return this.timelines[timeline].mapping; - } - /** - * Use the "media time" for a segment to generate a mapping to "display time" and - * save that display time to the segment. - * - * @private - * @param {SegmentInfo} segmentInfo - * The current active request information - * @param {Object} timingInfo - * The start and end time of the current segment in "media time" - * @param {boolean} shouldSaveTimelineMapping - * If there's a timeline change, determines if the timeline mapping should be - * saved in timelines. - * @return {boolean} - * Returns false if segment time mapping could not be calculated - */ - ; - - _proto.calculateSegmentTimeMapping_ = function calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) { - // TODO: remove side effects - var segment = segmentInfo.segment; - var part = segmentInfo.part; - var mappingObj = this.timelines[segmentInfo.timeline]; - var start; - var end; - - if (typeof segmentInfo.timestampOffset === 'number') { - mappingObj = { - time: segmentInfo.startOfSegment, - mapping: segmentInfo.startOfSegment - timingInfo.start - }; - - if (shouldSaveTimelineMapping) { - this.timelines[segmentInfo.timeline] = mappingObj; - this.trigger('timestampoffset'); - this.logger_("time mapping for timeline " + segmentInfo.timeline + ": " + ("[time: " + mappingObj.time + "] [mapping: " + mappingObj.mapping + "]")); - } - - start = segmentInfo.startOfSegment; - end = timingInfo.end + mappingObj.mapping; - } else if (mappingObj) { - start = timingInfo.start + mappingObj.mapping; - end = timingInfo.end + mappingObj.mapping; - } else { - return false; - } - - if (part) { - part.start = start; - part.end = end; - } // If we don't have a segment start yet or the start value we got - // is less than our current segment.start value, save a new start value. - // We have to do this because parts will have segment timing info saved - // multiple times and we want segment start to be the earliest part start - // value for that segment. - - - if (!segment.start || start < segment.start) { - segment.start = start; - } - - segment.end = end; - return true; - } - /** - * Each time we have discontinuity in the playlist, attempt to calculate the location - * in display of the start of the discontinuity and save that. We also save an accuracy - * value so that we save values with the most accuracy (closest to 0.) - * - * @private - * @param {SegmentInfo} segmentInfo - The current active request information - */ - ; - - _proto.saveDiscontinuitySyncInfo_ = function saveDiscontinuitySyncInfo_(segmentInfo) { - var playlist = segmentInfo.playlist; - var segment = segmentInfo.segment; // If the current segment is a discontinuity then we know exactly where - // the start of the range and it's accuracy is 0 (greater accuracy values - // mean more approximation) - - if (segment.discontinuity) { - this.discontinuities[segment.timeline] = { - time: segment.start, - accuracy: 0 - }; - } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) { - // Search for future discontinuities that we can provide better timing - // information for and save that information for sync purposes - for (var i = 0; i < playlist.discontinuityStarts.length; i++) { - var segmentIndex = playlist.discontinuityStarts[i]; - var discontinuity = playlist.discontinuitySequence + i + 1; - var mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex; - var accuracy = Math.abs(mediaIndexDiff); - - if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) { - var time = void 0; - - if (mediaIndexDiff < 0) { - time = segment.start - sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: segmentInfo.mediaIndex, - endIndex: segmentIndex - }); - } else { - time = segment.end + sumDurations({ - defaultDuration: playlist.targetDuration, - durationList: playlist.segments, - startIndex: segmentInfo.mediaIndex + 1, - endIndex: segmentIndex - }); - } - - this.discontinuities[discontinuity] = { - time: time, - accuracy: accuracy - }; - } - } - } - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.off(); - }; - - return SyncController; - }(videojs__default['default'].EventTarget); - - /** - * The TimelineChangeController acts as a source for segment loaders to listen for and - * keep track of latest and pending timeline changes. This is useful to ensure proper - * sync, as each loader may need to make a consideration for what timeline the other - * loader is on before making changes which could impact the other loader's media. - * - * @class TimelineChangeController - * @extends videojs.EventTarget - */ - - var TimelineChangeController = /*#__PURE__*/function (_videojs$EventTarget) { - inheritsLoose(TimelineChangeController, _videojs$EventTarget); - - function TimelineChangeController() { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - _this.pendingTimelineChanges_ = {}; - _this.lastTimelineChanges_ = {}; - return _this; - } - - var _proto = TimelineChangeController.prototype; - - _proto.clearPendingTimelineChange = function clearPendingTimelineChange(type) { - this.pendingTimelineChanges_[type] = null; - this.trigger('pendingtimelinechange'); - }; - - _proto.pendingTimelineChange = function pendingTimelineChange(_ref) { - var type = _ref.type, - from = _ref.from, - to = _ref.to; - - if (typeof from === 'number' && typeof to === 'number') { - this.pendingTimelineChanges_[type] = { - type: type, - from: from, - to: to - }; - this.trigger('pendingtimelinechange'); - } - - return this.pendingTimelineChanges_[type]; - }; - - _proto.lastTimelineChange = function lastTimelineChange(_ref2) { - var type = _ref2.type, - from = _ref2.from, - to = _ref2.to; - - if (typeof from === 'number' && typeof to === 'number') { - this.lastTimelineChanges_[type] = { - type: type, - from: from, - to: to - }; - delete this.pendingTimelineChanges_[type]; - this.trigger('timelinechange'); - } - - return this.lastTimelineChanges_[type]; - }; - - _proto.dispose = function dispose() { - this.trigger('dispose'); - this.pendingTimelineChanges_ = {}; - this.lastTimelineChanges_ = {}; - this.off(); - }; - - return TimelineChangeController; - }(videojs__default['default'].EventTarget); - - /* rollup-plugin-worker-factory start for worker!/Users/gkatsevman/p/http-streaming-release/src/decrypter-worker.js */ - var workerCode = transform(getWorkerString(function () { - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function require(path, base) { - return commonjsRequire(path, base === undefined || base === null ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire() { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var createClass = createCommonjsModule(function (module) { - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - module.exports = _createClass; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - var setPrototypeOf = createCommonjsModule(function (module) { - function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _setPrototypeOf(o, p); - } - - module.exports = _setPrototypeOf; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - var inheritsLoose = createCommonjsModule(function (module) { - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); - } - - module.exports = _inheritsLoose; - module.exports["default"] = module.exports, module.exports.__esModule = true; - }); - /** - * @file stream.js - */ - - /** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ - - var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; - }(); - /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ - - /** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - - - function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); - } - /*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */ - - /** - * @file aes.js - * - * This file contains an adaptation of the AES decryption algorithm - * from the Standford Javascript Cryptography Library. That work is - * covered by the following copyright and permissions notice: - * - * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 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. - * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing - * official policies, either expressed or implied, of the authors. - */ - - /** - * Expand the S-box tables. - * - * @private - */ - - - var precompute = function precompute() { - var tables = [[[], [], [], [], []], [[], [], [], [], []]]; - var encTable = tables[0]; - var decTable = tables[1]; - var sbox = encTable[4]; - var sboxInv = decTable[4]; - var i; - var x; - var xInv; - var d = []; - var th = []; - var x2; - var x4; - var x8; - var s; - var tEnc; - var tDec; // Compute double and third tables - - for (i = 0; i < 256; i++) { - th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i; - } - - for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) { - // Compute sbox - s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4; - s = s >> 8 ^ s & 255 ^ 99; - sbox[x] = s; - sboxInv[s] = x; // Compute MixColumns - - x8 = d[x4 = d[x2 = d[x]]]; - tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - tEnc = d[s] * 0x101 ^ s * 0x1010100; - - for (i = 0; i < 4; i++) { - encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8; - decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8; - } - } // Compactify. Considerable speedup on Firefox. - - - for (i = 0; i < 5; i++) { - encTable[i] = encTable[i].slice(0); - decTable[i] = decTable[i].slice(0); - } - - return tables; - }; - - var aesTables = null; - /** - * Schedule out an AES key for both encryption and decryption. This - * is a low-level class. Use a cipher mode to do bulk encryption. - * - * @class AES - * @param key {Array} The key as an array of 4, 6 or 8 words. - */ - - var AES = /*#__PURE__*/function () { - function AES(key) { - /** - * The expanded S-box and inverse S-box tables. These will be computed - * on the client so that we don't have to send them down the wire. - * - * There are two tables, _tables[0] is for encryption and - * _tables[1] is for decryption. - * - * The first 4 sub-tables are the expanded S-box with MixColumns. The - * last (_tables[01][4]) is the S-box itself. - * - * @private - */ - // if we have yet to precompute the S-box tables - // do so now - if (!aesTables) { - aesTables = precompute(); - } // then make a copy of that object for use - - - this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]]; - var i; - var j; - var tmp; - var sbox = this._tables[0][4]; - var decTable = this._tables[1]; - var keyLen = key.length; - var rcon = 1; - - if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) { - throw new Error('Invalid aes key size'); - } - - var encKey = key.slice(0); - var decKey = []; - this._key = [encKey, decKey]; // schedule encryption keys - - for (i = keyLen; i < 4 * keyLen + 28; i++) { - tmp = encKey[i - 1]; // apply sbox - - if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) { - tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; // shift rows and add rcon - - if (i % keyLen === 0) { - tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24; - rcon = rcon << 1 ^ (rcon >> 7) * 283; - } - } - - encKey[i] = encKey[i - keyLen] ^ tmp; - } // schedule decryption keys - - - for (j = 0; i; j++, i--) { - tmp = encKey[j & 3 ? i : i - 4]; - - if (i <= 4 || j < 4) { - decKey[j] = tmp; - } else { - decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]]; - } - } - } - /** - * Decrypt 16 bytes, specified as four 32-bit words. - * - * @param {number} encrypted0 the first word to decrypt - * @param {number} encrypted1 the second word to decrypt - * @param {number} encrypted2 the third word to decrypt - * @param {number} encrypted3 the fourth word to decrypt - * @param {Int32Array} out the array to write the decrypted words - * into - * @param {number} offset the offset into the output array to start - * writing results - * @return {Array} The plaintext. - */ - - - var _proto = AES.prototype; - - _proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) { - var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data - - var a = encrypted0 ^ key[0]; - var b = encrypted3 ^ key[1]; - var c = encrypted2 ^ key[2]; - var d = encrypted1 ^ key[3]; - var a2; - var b2; - var c2; // key.length === 2 ? - - var nInnerRounds = key.length / 4 - 2; - var i; - var kIndex = 4; - var table = this._tables[1]; // load up the tables - - var table0 = table[0]; - var table1 = table[1]; - var table2 = table[2]; - var table3 = table[3]; - var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL. - - for (i = 0; i < nInnerRounds; i++) { - a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex]; - b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1]; - c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2]; - d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3]; - kIndex += 4; - a = a2; - b = b2; - c = c2; - } // Last round. - - - for (i = 0; i < 4; i++) { - out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++]; - a2 = a; - a = b; - b = c; - c = d; - d = a2; - } - }; - - return AES; - }(); - /** - * A wrapper around the Stream class to use setTimeout - * and run stream "jobs" Asynchronously - * - * @class AsyncStream - * @extends Stream - */ - - - var AsyncStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(AsyncStream, _Stream); - - function AsyncStream() { - var _this; - - _this = _Stream.call(this, Stream) || this; - _this.jobs = []; - _this.delay = 1; - _this.timeout_ = null; - return _this; - } - /** - * process an async job - * - * @private - */ - - - var _proto = AsyncStream.prototype; - - _proto.processJob_ = function processJob_() { - this.jobs.shift()(); - - if (this.jobs.length) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } else { - this.timeout_ = null; - } - } - /** - * push a job into the stream - * - * @param {Function} job the job to push into the stream - */ - ; - - _proto.push = function push(job) { - this.jobs.push(job); - - if (!this.timeout_) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } - }; - - return AsyncStream; - }(Stream); - /** - * Convert network-order (big-endian) bytes into their little-endian - * representation. - */ - - - var ntoh = function ntoh(word) { - return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24; - }; - /** - * Decrypt bytes using AES-128 with CBC and PKCS#7 padding. - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * use for the first round of CBC. - * @return {Uint8Array} the decrypted bytes - * - * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard - * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29 - * @see https://tools.ietf.org/html/rfc2315 - */ - - - var decrypt = function decrypt(encrypted, key, initVector) { - // word-level access to the encrypted bytes - var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2); - var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output - - var decrypted = new Uint8Array(encrypted.byteLength); - var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and - // decrypted data - - var init0; - var init1; - var init2; - var init3; - var encrypted0; - var encrypted1; - var encrypted2; - var encrypted3; // iteration variable - - var wordIx; // pull out the words of the IV to ensure we don't modify the - // passed-in reference and easier access - - init0 = initVector[0]; - init1 = initVector[1]; - init2 = initVector[2]; - init3 = initVector[3]; // decrypt four word sequences, applying cipher-block chaining (CBC) - // to each decrypted block - - for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { - // convert big-endian (network order) words into little-endian - // (javascript order) - encrypted0 = ntoh(encrypted32[wordIx]); - encrypted1 = ntoh(encrypted32[wordIx + 1]); - encrypted2 = ntoh(encrypted32[wordIx + 2]); - encrypted3 = ntoh(encrypted32[wordIx + 3]); // decrypt the block - - decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); // XOR with the IV, and restore network byte-order to obtain the - // plaintext - - decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0); - decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1); - decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2); - decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); // setup the IV for the next round - - init0 = encrypted0; - init1 = encrypted1; - init2 = encrypted2; - init3 = encrypted3; - } - - return decrypted; - }; - /** - * The `Decrypter` class that manages decryption of AES - * data through `AsyncStream` objects and the `decrypt` - * function - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * @param {Function} done the function to run when done - * @class Decrypter - */ - - - var Decrypter = /*#__PURE__*/function () { - function Decrypter(encrypted, key, initVector, done) { - var step = Decrypter.STEP; - var encrypted32 = new Int32Array(encrypted.buffer); - var decrypted = new Uint8Array(encrypted.byteLength); - var i = 0; - this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously - - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - - for (i = step; i < encrypted32.length; i += step) { - initVector = new Uint32Array([ntoh(encrypted32[i - 4]), ntoh(encrypted32[i - 3]), ntoh(encrypted32[i - 2]), ntoh(encrypted32[i - 1])]); - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - } // invoke the done() callback when everything is finished - - - this.asyncStream_.push(function () { - // remove pkcs#7 padding from the decrypted bytes - done(null, unpad(decrypted)); - }); - } - /** - * a getter for step the maximum number of bytes to process at one time - * - * @return {number} the value of step 32000 - */ - - - var _proto = Decrypter.prototype; - /** - * @private - */ - - _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) { - return function () { - var bytes = decrypt(encrypted, key, initVector); - decrypted.set(bytes, encrypted.byteOffset); - }; - }; - - createClass(Decrypter, null, [{ - key: "STEP", - get: function get() { - // 4 * 8000; - return 32000; - } - }]); - return Decrypter; - }(); - /** - * @file bin-utils.js - */ - - /** - * Creates an object for sending to a web worker modifying properties that are TypedArrays - * into a new object with seperated properties for the buffer, byteOffset, and byteLength. - * - * @param {Object} message - * Object of properties and values to send to the web worker - * @return {Object} - * Modified message with TypedArray values expanded - * @function createTransferableMessage - */ - - - var createTransferableMessage = function createTransferableMessage(message) { - var transferable = {}; - Object.keys(message).forEach(function (key) { - var value = message[key]; - - if (ArrayBuffer.isView(value)) { - transferable[key] = { - bytes: value.buffer, - byteOffset: value.byteOffset, - byteLength: value.byteLength - }; - } else { - transferable[key] = value; - } - }); - return transferable; - }; - /* global self */ - - /** - * Our web worker interface so that things can talk to aes-decrypter - * that will be running in a web worker. the scope is passed to this by - * webworkify. - */ - - - self.onmessage = function (event) { - var data = event.data; - var encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength); - var key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4); - var iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4); - /* eslint-disable no-new, handle-callback-err */ - - new Decrypter(encrypted, key, iv, function (err, bytes) { - self.postMessage(createTransferableMessage({ - source: data.source, - decrypted: bytes - }), [bytes.buffer]); - }); - /* eslint-enable */ - }; - })); - var Decrypter = factory(workerCode); - /* rollup-plugin-worker-factory end for worker!/Users/gkatsevman/p/http-streaming-release/src/decrypter-worker.js */ - - /** - * Convert the properties of an HLS track into an audioTrackKind. - * - * @private - */ - - var audioTrackKind_ = function audioTrackKind_(properties) { - var kind = properties.default ? 'main' : 'alternative'; - - if (properties.characteristics && properties.characteristics.indexOf('public.accessibility.describes-video') >= 0) { - kind = 'main-desc'; - } - - return kind; - }; - /** - * Pause provided segment loader and playlist loader if active - * - * @param {SegmentLoader} segmentLoader - * SegmentLoader to pause - * @param {Object} mediaType - * Active media type - * @function stopLoaders - */ - - - var stopLoaders = function stopLoaders(segmentLoader, mediaType) { - segmentLoader.abort(); - segmentLoader.pause(); - - if (mediaType && mediaType.activePlaylistLoader) { - mediaType.activePlaylistLoader.pause(); - mediaType.activePlaylistLoader = null; - } - }; - /** - * Start loading provided segment loader and playlist loader - * - * @param {PlaylistLoader} playlistLoader - * PlaylistLoader to start loading - * @param {Object} mediaType - * Active media type - * @function startLoaders - */ - - var startLoaders = function startLoaders(playlistLoader, mediaType) { - // Segment loader will be started after `loadedmetadata` or `loadedplaylist` from the - // playlist loader - mediaType.activePlaylistLoader = playlistLoader; - playlistLoader.load(); - }; - /** - * Returns a function to be called when the media group changes. It performs a - * non-destructive (preserve the buffer) resync of the SegmentLoader. This is because a - * change of group is merely a rendition switch of the same content at another encoding, - * rather than a change of content, such as switching audio from English to Spanish. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Handler for a non-destructive resync of SegmentLoader when the active media - * group changes. - * @function onGroupChanged - */ - - var onGroupChanged = function onGroupChanged(type, settings) { - return function () { - var _settings$segmentLoad = settings.segmentLoaders, - segmentLoader = _settings$segmentLoad[type], - mainSegmentLoader = _settings$segmentLoad.main, - mediaType = settings.mediaTypes[type]; - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.getActiveGroup(); - var previousActiveLoader = mediaType.activePlaylistLoader; - var lastGroup = mediaType.lastGroup_; // the group did not change do nothing - - if (activeGroup && lastGroup && activeGroup.id === lastGroup.id) { - return; - } - - mediaType.lastGroup_ = activeGroup; - mediaType.lastTrack_ = activeTrack; - stopLoaders(segmentLoader, mediaType); - - if (!activeGroup || activeGroup.isMasterPlaylist) { - // there is no group active or active group is a main playlist and won't change - return; - } - - if (!activeGroup.playlistLoader) { - if (previousActiveLoader) { - // The previous group had a playlist loader but the new active group does not - // this means we are switching from demuxed to muxed audio. In this case we want to - // do a destructive reset of the main segment loader and not restart the audio - // loaders. - mainSegmentLoader.resetEverything(); - } - - return; - } // Non-destructive resync - - - segmentLoader.resyncLoader(); - startLoaders(activeGroup.playlistLoader, mediaType); - }; - }; - var onGroupChanging = function onGroupChanging(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - mediaType.lastGroup_ = null; - segmentLoader.abort(); - segmentLoader.pause(); - }; - }; - /** - * Returns a function to be called when the media track changes. It performs a - * destructive reset of the SegmentLoader to ensure we start loading as close to - * currentTime as possible. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Handler for a destructive reset of SegmentLoader when the active media - * track changes. - * @function onTrackChanged - */ - - var onTrackChanged = function onTrackChanged(type, settings) { - return function () { - var masterPlaylistLoader = settings.masterPlaylistLoader, - _settings$segmentLoad2 = settings.segmentLoaders, - segmentLoader = _settings$segmentLoad2[type], - mainSegmentLoader = _settings$segmentLoad2.main, - mediaType = settings.mediaTypes[type]; - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.getActiveGroup(); - var previousActiveLoader = mediaType.activePlaylistLoader; - var lastTrack = mediaType.lastTrack_; // track did not change, do nothing - - if (lastTrack && activeTrack && lastTrack.id === activeTrack.id) { - return; - } - - mediaType.lastGroup_ = activeGroup; - mediaType.lastTrack_ = activeTrack; - stopLoaders(segmentLoader, mediaType); - - if (!activeGroup) { - // there is no group active so we do not want to restart loaders - return; - } - - if (activeGroup.isMasterPlaylist) { - // track did not change, do nothing - if (!activeTrack || !lastTrack || activeTrack.id === lastTrack.id) { - return; - } - - var mpc = settings.vhs.masterPlaylistController_; - var newPlaylist = mpc.selectPlaylist(); // media will not change do nothing - - if (mpc.media() === newPlaylist) { - return; - } - - mediaType.logger_("track change. Switching master audio from " + lastTrack.id + " to " + activeTrack.id); - masterPlaylistLoader.pause(); - mainSegmentLoader.resetEverything(); - mpc.fastQualityChange_(newPlaylist); - return; - } - - if (type === 'AUDIO') { - if (!activeGroup.playlistLoader) { - // when switching from demuxed audio/video to muxed audio/video (noted by no - // playlist loader for the audio group), we want to do a destructive reset of the - // main segment loader and not restart the audio loaders - mainSegmentLoader.setAudio(true); // don't have to worry about disabling the audio of the audio segment loader since - // it should be stopped - - mainSegmentLoader.resetEverything(); - return; - } // although the segment loader is an audio segment loader, call the setAudio - // function to ensure it is prepared to re-append the init segment (or handle other - // config changes) - - - segmentLoader.setAudio(true); - mainSegmentLoader.setAudio(false); - } - - if (previousActiveLoader === activeGroup.playlistLoader) { - // Nothing has actually changed. This can happen because track change events can fire - // multiple times for a "single" change. One for enabling the new active track, and - // one for disabling the track that was active - startLoaders(activeGroup.playlistLoader, mediaType); - return; - } - - if (segmentLoader.track) { - // For WebVTT, set the new text track in the segmentloader - segmentLoader.track(activeTrack); - } // destructive reset - - - segmentLoader.resetEverything(); - startLoaders(activeGroup.playlistLoader, mediaType); - }; - }; - var onError = { - /** - * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters - * an error. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Error handler. Logs warning (or error if the playlist is blacklisted) to - * console and switches back to default audio track. - * @function onError.AUDIO - */ - AUDIO: function AUDIO(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type], - blacklistCurrentPlaylist = settings.blacklistCurrentPlaylist; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track - - var activeTrack = mediaType.activeTrack(); - var activeGroup = mediaType.activeGroup(); - var id = (activeGroup.filter(function (group) { - return group.default; - })[0] || activeGroup[0]).id; - var defaultTrack = mediaType.tracks[id]; - - if (activeTrack === defaultTrack) { - // Default track encountered an error. All we can do now is blacklist the current - // rendition and hope another will switch audio groups - blacklistCurrentPlaylist({ - message: 'Problem encountered loading the default audio track.' - }); - return; - } - - videojs__default['default'].log.warn('Problem encountered loading the alternate audio track.' + 'Switching back to default.'); - - for (var trackId in mediaType.tracks) { - mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack; - } - - mediaType.onTrackChanged(); - }; - }, - - /** - * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters - * an error. - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Error handler. Logs warning to console and disables the active subtitle track - * @function onError.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, settings) { - return function () { - var segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - videojs__default['default'].log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); - var track = mediaType.activeTrack(); - - if (track) { - track.mode = 'disabled'; - } - - mediaType.onTrackChanged(); - }; - } - }; - var setupListeners = { - /** - * Setup event listeners for audio playlist loader - * - * @param {string} type - * MediaGroup type - * @param {PlaylistLoader|null} playlistLoader - * PlaylistLoader to register listeners on - * @param {Object} settings - * Object containing required information for media groups - * @function setupListeners.AUDIO - */ - AUDIO: function AUDIO(type, playlistLoader, settings) { - if (!playlistLoader) { - // no playlist loader means audio will be muxed with the video - return; - } - - var tech = settings.tech, - requestOptions = settings.requestOptions, - segmentLoader = settings.segmentLoaders[type]; - playlistLoader.on('loadedmetadata', function () { - var media = playlistLoader.media(); - segmentLoader.playlist(media, requestOptions); // if the video is already playing, or if this isn't a live video and preload - // permits, start downloading segments - - if (!tech.paused() || media.endList && tech.preload() !== 'none') { - segmentLoader.load(); - } - }); - playlistLoader.on('loadedplaylist', function () { - segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running - - if (!tech.paused()) { - segmentLoader.load(); - } - }); - playlistLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup event listeners for subtitle playlist loader - * - * @param {string} type - * MediaGroup type - * @param {PlaylistLoader|null} playlistLoader - * PlaylistLoader to register listeners on - * @param {Object} settings - * Object containing required information for media groups - * @function setupListeners.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, playlistLoader, settings) { - var tech = settings.tech, - requestOptions = settings.requestOptions, - segmentLoader = settings.segmentLoaders[type], - mediaType = settings.mediaTypes[type]; - playlistLoader.on('loadedmetadata', function () { - var media = playlistLoader.media(); - segmentLoader.playlist(media, requestOptions); - segmentLoader.track(mediaType.activeTrack()); // if the video is already playing, or if this isn't a live video and preload - // permits, start downloading segments - - if (!tech.paused() || media.endList && tech.preload() !== 'none') { - segmentLoader.load(); - } - }); - playlistLoader.on('loadedplaylist', function () { - segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running - - if (!tech.paused()) { - segmentLoader.load(); - } - }); - playlistLoader.on('error', onError[type](type, settings)); - } - }; - var initialize = { - /** - * Setup PlaylistLoaders and AudioTracks for the audio groups - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize.AUDIO - */ - 'AUDIO': function AUDIO(type, settings) { - var vhs = settings.vhs, - sourceType = settings.sourceType, - segmentLoader = settings.segmentLoaders[type], - requestOptions = settings.requestOptions, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$ = settings.mediaTypes[type], - groups = _settings$mediaTypes$.groups, - tracks = _settings$mediaTypes$.tracks, - logger_ = _settings$mediaTypes$.logger_, - masterPlaylistLoader = settings.masterPlaylistLoader; - var audioOnlyMaster = isAudioOnly(masterPlaylistLoader.master); // force a default if we have none - - if (!mediaGroups[type] || Object.keys(mediaGroups[type]).length === 0) { - mediaGroups[type] = { - main: { - default: { - default: true - } - } - }; - } - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - var properties = mediaGroups[type][groupId][variantLabel]; - var playlistLoader = void 0; - - if (audioOnlyMaster) { - logger_("AUDIO group '" + groupId + "' label '" + variantLabel + "' is a master playlist"); - properties.isMasterPlaylist = true; - playlistLoader = null; // if vhs-json was provided as the source, and the media playlist was resolved, - // use the resolved media playlist object - } else if (sourceType === 'vhs-json' && properties.playlists) { - playlistLoader = new PlaylistLoader(properties.playlists[0], vhs, requestOptions); - } else if (properties.resolvedUri) { - playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions); // TODO: dash isn't the only type with properties.playlists - // should we even have properties.playlists in this check. - } else if (properties.playlists && sourceType === 'dash') { - playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader); - } else { - // no resolvedUri means the audio is muxed with the video when using this - // audio track - playlistLoader = null; - } - - properties = videojs__default['default'].mergeOptions({ - id: variantLabel, - playlistLoader: playlistLoader - }, properties); - setupListeners[type](type, properties.playlistLoader, settings); - groups[groupId].push(properties); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = new videojs__default['default'].AudioTrack({ - id: variantLabel, - kind: audioTrackKind_(properties), - enabled: false, - language: properties.language, - default: properties.default, - label: variantLabel - }); - tracks[variantLabel] = track; - } - } - } // setup single error event handler for the segment loader - - - segmentLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup PlaylistLoaders and TextTracks for the subtitle groups - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize.SUBTITLES - */ - 'SUBTITLES': function SUBTITLES(type, settings) { - var tech = settings.tech, - vhs = settings.vhs, - sourceType = settings.sourceType, - segmentLoader = settings.segmentLoaders[type], - requestOptions = settings.requestOptions, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$2 = settings.mediaTypes[type], - groups = _settings$mediaTypes$2.groups, - tracks = _settings$mediaTypes$2.tracks, - masterPlaylistLoader = settings.masterPlaylistLoader; - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - if (mediaGroups[type][groupId][variantLabel].forced) { - // Subtitle playlists with the forced attribute are not selectable in Safari. - // According to Apple's HLS Authoring Specification: - // If content has forced subtitles and regular subtitles in a given language, - // the regular subtitles track in that language MUST contain both the forced - // subtitles and the regular subtitles for that language. - // Because of this requirement and that Safari does not add forced subtitles, - // forced subtitles are skipped here to maintain consistent experience across - // all platforms - continue; - } - - var properties = mediaGroups[type][groupId][variantLabel]; - var playlistLoader = void 0; - - if (sourceType === 'hls') { - playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions); - } else if (sourceType === 'dash') { - var playlists = properties.playlists.filter(function (p) { - return p.excludeUntil !== Infinity; - }); - - if (!playlists.length) { - return; - } - - playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader); - } else if (sourceType === 'vhs-json') { - playlistLoader = new PlaylistLoader( // if the vhs-json object included the media playlist, use the media playlist - // as provided, otherwise use the resolved URI to load the playlist - properties.playlists ? properties.playlists[0] : properties.resolvedUri, vhs, requestOptions); - } - - properties = videojs__default['default'].mergeOptions({ - id: variantLabel, - playlistLoader: playlistLoader - }, properties); - setupListeners[type](type, properties.playlistLoader, settings); - groups[groupId].push(properties); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = tech.addRemoteTextTrack({ - id: variantLabel, - kind: 'subtitles', - default: properties.default && properties.autoselect, - language: properties.language, - label: variantLabel - }, false).track; - tracks[variantLabel] = track; - } - } - } // setup single error event handler for the segment loader - - - segmentLoader.on('error', onError[type](type, settings)); - }, - - /** - * Setup TextTracks for the closed-caption groups - * - * @param {String} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @function initialize['CLOSED-CAPTIONS'] - */ - 'CLOSED-CAPTIONS': function CLOSEDCAPTIONS(type, settings) { - var tech = settings.tech, - mediaGroups = settings.master.mediaGroups, - _settings$mediaTypes$3 = settings.mediaTypes[type], - groups = _settings$mediaTypes$3.groups, - tracks = _settings$mediaTypes$3.tracks; - - for (var groupId in mediaGroups[type]) { - if (!groups[groupId]) { - groups[groupId] = []; - } - - for (var variantLabel in mediaGroups[type][groupId]) { - var properties = mediaGroups[type][groupId][variantLabel]; // Look for either 608 (CCn) or 708 (SERVICEn) caption services - - if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) { - continue; - } - - var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {}; - var newProps = { - label: variantLabel, - language: properties.language, - instreamId: properties.instreamId, - default: properties.default && properties.autoselect - }; - - if (captionServices[newProps.instreamId]) { - newProps = videojs__default['default'].mergeOptions(newProps, captionServices[newProps.instreamId]); - } - - if (newProps.default === undefined) { - delete newProps.default; - } // No PlaylistLoader is required for Closed-Captions because the captions are - // embedded within the video stream - - - groups[groupId].push(videojs__default['default'].mergeOptions({ - id: variantLabel - }, properties)); - - if (typeof tracks[variantLabel] === 'undefined') { - var track = tech.addRemoteTextTrack({ - id: newProps.instreamId, - kind: 'captions', - default: newProps.default, - language: newProps.language, - label: newProps.label - }, false).track; - tracks[variantLabel] = track; - } - } - } - } - }; - - var groupMatch = function groupMatch(list, media) { - for (var i = 0; i < list.length; i++) { - if (playlistMatch(media, list[i])) { - return true; - } - - if (list[i].playlists && groupMatch(list[i].playlists, media)) { - return true; - } - } - - return false; - }; - /** - * Returns a function used to get the active group of the provided type - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media group for the provided type. Takes an - * optional parameter {TextTrack} track. If no track is provided, a list of all - * variants in the group, otherwise the variant corresponding to the provided - * track is returned. - * @function activeGroup - */ - - - var activeGroup = function activeGroup(type, settings) { - return function (track) { - var masterPlaylistLoader = settings.masterPlaylistLoader, - groups = settings.mediaTypes[type].groups; - var media = masterPlaylistLoader.media(); - - if (!media) { - return null; - } - - var variants = null; // set to variants to main media active group - - if (media.attributes[type]) { - variants = groups[media.attributes[type]]; - } - - var groupKeys = Object.keys(groups); - - if (!variants) { - // find the masterPlaylistLoader media - // that is in a media group if we are dealing - // with audio only - if (type === 'AUDIO' && groupKeys.length > 1 && isAudioOnly(settings.master)) { - for (var i = 0; i < groupKeys.length; i++) { - var groupPropertyList = groups[groupKeys[i]]; - - if (groupMatch(groupPropertyList, media)) { - variants = groupPropertyList; - break; - } - } // use the main group if it exists - - } else if (groups.main) { - variants = groups.main; // only one group, use that one - } else if (groupKeys.length === 1) { - variants = groups[groupKeys[0]]; - } - } - - if (typeof track === 'undefined') { - return variants; - } - - if (track === null || !variants) { - // An active track was specified so a corresponding group is expected. track === null - // means no track is currently active so there is no corresponding group - return null; - } - - return variants.filter(function (props) { - return props.id === track.id; - })[0] || null; - }; - }; - var activeTrack = { - /** - * Returns a function used to get the active track of type provided - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media track for the provided type. Returns - * null if no track is active - * @function activeTrack.AUDIO - */ - AUDIO: function AUDIO(type, settings) { - return function () { - var tracks = settings.mediaTypes[type].tracks; - - for (var id in tracks) { - if (tracks[id].enabled) { - return tracks[id]; - } - } - - return null; - }; - }, - - /** - * Returns a function used to get the active track of type provided - * - * @param {string} type - * MediaGroup type - * @param {Object} settings - * Object containing required information for media groups - * @return {Function} - * Function that returns the active media track for the provided type. Returns - * null if no track is active - * @function activeTrack.SUBTITLES - */ - SUBTITLES: function SUBTITLES(type, settings) { - return function () { - var tracks = settings.mediaTypes[type].tracks; - - for (var id in tracks) { - if (tracks[id].mode === 'showing' || tracks[id].mode === 'hidden') { - return tracks[id]; - } - } - - return null; - }; - } - }; - var getActiveGroup = function getActiveGroup(type, _ref) { - var mediaTypes = _ref.mediaTypes; - return function () { - var activeTrack_ = mediaTypes[type].activeTrack(); - - if (!activeTrack_) { - return null; - } - - return mediaTypes[type].activeGroup(activeTrack_); - }; - }; - /** - * Setup PlaylistLoaders and Tracks for media groups (Audio, Subtitles, - * Closed-Captions) specified in the master manifest. - * - * @param {Object} settings - * Object containing required information for setting up the media groups - * @param {Tech} settings.tech - * The tech of the player - * @param {Object} settings.requestOptions - * XHR request options used by the segment loaders - * @param {PlaylistLoader} settings.masterPlaylistLoader - * PlaylistLoader for the master source - * @param {VhsHandler} settings.vhs - * VHS SourceHandler - * @param {Object} settings.master - * The parsed master manifest - * @param {Object} settings.mediaTypes - * Object to store the loaders, tracks, and utility methods for each media type - * @param {Function} settings.blacklistCurrentPlaylist - * Blacklists the current rendition and forces a rendition switch. - * @function setupMediaGroups - */ - - var setupMediaGroups = function setupMediaGroups(settings) { - ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(function (type) { - initialize[type](type, settings); - }); - var mediaTypes = settings.mediaTypes, - masterPlaylistLoader = settings.masterPlaylistLoader, - tech = settings.tech, - vhs = settings.vhs, - _settings$segmentLoad3 = settings.segmentLoaders, - audioSegmentLoader = _settings$segmentLoad3['AUDIO'], - mainSegmentLoader = _settings$segmentLoad3.main; // setup active group and track getters and change event handlers - - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - mediaTypes[type].activeGroup = activeGroup(type, settings); - mediaTypes[type].activeTrack = activeTrack[type](type, settings); - mediaTypes[type].onGroupChanged = onGroupChanged(type, settings); - mediaTypes[type].onGroupChanging = onGroupChanging(type, settings); - mediaTypes[type].onTrackChanged = onTrackChanged(type, settings); - mediaTypes[type].getActiveGroup = getActiveGroup(type, settings); - }); // DO NOT enable the default subtitle or caption track. - // DO enable the default audio track - - var audioGroup = mediaTypes.AUDIO.activeGroup(); - - if (audioGroup) { - var groupId = (audioGroup.filter(function (group) { - return group.default; - })[0] || audioGroup[0]).id; - mediaTypes.AUDIO.tracks[groupId].enabled = true; - mediaTypes.AUDIO.onGroupChanged(); - mediaTypes.AUDIO.onTrackChanged(); - var activeAudioGroup = mediaTypes.AUDIO.getActiveGroup(); // a similar check for handling setAudio on each loader is run again each time the - // track is changed, but needs to be handled here since the track may not be considered - // changed on the first call to onTrackChanged - - if (!activeAudioGroup.playlistLoader) { - // either audio is muxed with video or the stream is audio only - mainSegmentLoader.setAudio(true); - } else { - // audio is demuxed - mainSegmentLoader.setAudio(false); - audioSegmentLoader.setAudio(true); - } - } - - masterPlaylistLoader.on('mediachange', function () { - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - return mediaTypes[type].onGroupChanged(); - }); - }); - masterPlaylistLoader.on('mediachanging', function () { - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - return mediaTypes[type].onGroupChanging(); - }); - }); // custom audio track change event handler for usage event - - var onAudioTrackChanged = function onAudioTrackChanged() { - mediaTypes.AUDIO.onTrackChanged(); - tech.trigger({ - type: 'usage', - name: 'vhs-audio-change' - }); - tech.trigger({ - type: 'usage', - name: 'hls-audio-change' - }); - }; - - tech.audioTracks().addEventListener('change', onAudioTrackChanged); - tech.remoteTextTracks().addEventListener('change', mediaTypes.SUBTITLES.onTrackChanged); - vhs.on('dispose', function () { - tech.audioTracks().removeEventListener('change', onAudioTrackChanged); - tech.remoteTextTracks().removeEventListener('change', mediaTypes.SUBTITLES.onTrackChanged); - }); // clear existing audio tracks and add the ones we just created - - tech.clearTracks('audio'); - - for (var id in mediaTypes.AUDIO.tracks) { - tech.audioTracks().addTrack(mediaTypes.AUDIO.tracks[id]); - } - }; - /** - * Creates skeleton object used to store the loaders, tracks, and utility methods for each - * media type - * - * @return {Object} - * Object to store the loaders, tracks, and utility methods for each media type - * @function createMediaTypes - */ - - var createMediaTypes = function createMediaTypes() { - var mediaTypes = {}; - ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(function (type) { - mediaTypes[type] = { - groups: {}, - tracks: {}, - activePlaylistLoader: null, - activeGroup: noop, - activeTrack: noop, - getActiveGroup: noop, - onGroupChanged: noop, - onTrackChanged: noop, - lastTrack_: null, - logger_: logger("MediaGroups[" + type + "]") - }; - }); - return mediaTypes; - }; - - var ABORT_EARLY_BLACKLIST_SECONDS = 60 * 2; - var Vhs$1; // SegmentLoader stats that need to have each loader's - // values summed to calculate the final value - - var loaderStats = ['mediaRequests', 'mediaRequestsAborted', 'mediaRequestsTimedout', 'mediaRequestsErrored', 'mediaTransferDuration', 'mediaBytesTransferred', 'mediaAppends']; - - var sumLoaderStat = function sumLoaderStat(stat) { - return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat]; - }; - - var shouldSwitchToMedia = function shouldSwitchToMedia(_ref) { - var currentPlaylist = _ref.currentPlaylist, - nextPlaylist = _ref.nextPlaylist, - forwardBuffer = _ref.forwardBuffer, - bufferLowWaterLine = _ref.bufferLowWaterLine, - bufferHighWaterLine = _ref.bufferHighWaterLine, - duration = _ref.duration, - experimentalBufferBasedABR = _ref.experimentalBufferBasedABR, - log = _ref.log; - - // we have no other playlist to switch to - if (!nextPlaylist) { - videojs__default['default'].log.warn('We received no playlist to switch to. Please check your stream.'); - return false; - } - - var sharedLogLine = "allowing switch " + (currentPlaylist && currentPlaylist.id || 'null') + " -> " + nextPlaylist.id; // If the playlist is live, then we want to not take low water line into account. - // This is because in LIVE, the player plays 3 segments from the end of the - // playlist, and if `BUFFER_LOW_WATER_LINE` is greater than the duration availble - // in those segments, a viewer will never experience a rendition upswitch. - - if (!currentPlaylist || !currentPlaylist.endList) { - log(sharedLogLine + " as current playlist " + (!currentPlaylist ? 'is not set' : 'is live')); - return true; - } // no need to switch playlist is the same - - - if (nextPlaylist.id === currentPlaylist.id) { - return false; - } - - var maxBufferLowWaterLine = experimentalBufferBasedABR ? Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config.MAX_BUFFER_LOW_WATER_LINE; // For the same reason as LIVE, we ignore the low water line when the VOD - // duration is below the max potential low water line - - if (duration < maxBufferLowWaterLine) { - log(sharedLogLine + " as duration < max low water line (" + duration + " < " + maxBufferLowWaterLine + ")"); - return true; - } - - var nextBandwidth = nextPlaylist.attributes.BANDWIDTH; - var currBandwidth = currentPlaylist.attributes.BANDWIDTH; // when switching down, if our buffer is lower than the high water line, - // we can switch down - - if (nextBandwidth < currBandwidth && (!experimentalBufferBasedABR || forwardBuffer < bufferHighWaterLine)) { - var logLine = sharedLogLine + " as next bandwidth < current bandwidth (" + nextBandwidth + " < " + currBandwidth + ")"; - - if (experimentalBufferBasedABR) { - logLine += " and forwardBuffer < bufferHighWaterLine (" + forwardBuffer + " < " + bufferHighWaterLine + ")"; - } - - log(logLine); - return true; - } // and if our buffer is higher than the low water line, - // we can switch up - - - if ((!experimentalBufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) { - var _logLine = sharedLogLine + " as forwardBuffer >= bufferLowWaterLine (" + forwardBuffer + " >= " + bufferLowWaterLine + ")"; - - if (experimentalBufferBasedABR) { - _logLine += " and next bandwidth > current bandwidth (" + nextBandwidth + " > " + currBandwidth + ")"; - } - - log(_logLine); - return true; - } - - log("not " + sharedLogLine + " as no switching criteria met"); - return false; - }; - /** - * the master playlist controller controller all interactons - * between playlists and segmentloaders. At this time this mainly - * involves a master playlist and a series of audio playlists - * if they are available - * - * @class MasterPlaylistController - * @extends videojs.EventTarget - */ - - - var MasterPlaylistController = /*#__PURE__*/function (_videojs$EventTarget) { - inheritsLoose(MasterPlaylistController, _videojs$EventTarget); - - function MasterPlaylistController(options) { - var _this; - - _this = _videojs$EventTarget.call(this) || this; - var src = options.src, - handleManifestRedirects = options.handleManifestRedirects, - withCredentials = options.withCredentials, - tech = options.tech, - bandwidth = options.bandwidth, - externVhs = options.externVhs, - useCueTags = options.useCueTags, - blacklistDuration = options.blacklistDuration, - enableLowInitialPlaylist = options.enableLowInitialPlaylist, - sourceType = options.sourceType, - cacheEncryptionKeys = options.cacheEncryptionKeys, - experimentalBufferBasedABR = options.experimentalBufferBasedABR; - - if (!src) { - throw new Error('A non-empty playlist URL or JSON manifest string is required'); - } - - var maxPlaylistRetries = options.maxPlaylistRetries; - - if (maxPlaylistRetries === null || typeof maxPlaylistRetries === 'undefined') { - maxPlaylistRetries = Infinity; - } - - Vhs$1 = externVhs; - _this.experimentalBufferBasedABR = Boolean(experimentalBufferBasedABR); - _this.withCredentials = withCredentials; - _this.tech_ = tech; - _this.vhs_ = tech.vhs; - _this.sourceType_ = sourceType; - _this.useCueTags_ = useCueTags; - _this.blacklistDuration = blacklistDuration; - _this.maxPlaylistRetries = maxPlaylistRetries; - _this.enableLowInitialPlaylist = enableLowInitialPlaylist; - - if (_this.useCueTags_) { - _this.cueTagsTrack_ = _this.tech_.addTextTrack('metadata', 'ad-cues'); - _this.cueTagsTrack_.inBandMetadataTrackDispatchType = ''; - } - - _this.requestOptions_ = { - withCredentials: withCredentials, - handleManifestRedirects: handleManifestRedirects, - maxPlaylistRetries: maxPlaylistRetries, - timeout: null - }; - - _this.on('error', _this.pauseLoading); - - _this.mediaTypes_ = createMediaTypes(); - _this.mediaSource = new window__default['default'].MediaSource(); - _this.handleDurationChange_ = _this.handleDurationChange_.bind(assertThisInitialized(_this)); - _this.handleSourceOpen_ = _this.handleSourceOpen_.bind(assertThisInitialized(_this)); - _this.handleSourceEnded_ = _this.handleSourceEnded_.bind(assertThisInitialized(_this)); - - _this.mediaSource.addEventListener('durationchange', _this.handleDurationChange_); // load the media source into the player - - - _this.mediaSource.addEventListener('sourceopen', _this.handleSourceOpen_); - - _this.mediaSource.addEventListener('sourceended', _this.handleSourceEnded_); // we don't have to handle sourceclose since dispose will handle termination of - // everything, and the MediaSource should not be detached without a proper disposal - - - _this.seekable_ = videojs__default['default'].createTimeRanges(); - _this.hasPlayed_ = false; - _this.syncController_ = new SyncController(options); - _this.segmentMetadataTrack_ = tech.addRemoteTextTrack({ - kind: 'metadata', - label: 'segment-metadata' - }, false).track; - _this.decrypter_ = new Decrypter(); - _this.sourceUpdater_ = new SourceUpdater(_this.mediaSource); - _this.inbandTextTracks_ = {}; - _this.timelineChangeController_ = new TimelineChangeController(); - var segmentLoaderSettings = { - vhs: _this.vhs_, - parse708captions: options.parse708captions, - mediaSource: _this.mediaSource, - currentTime: _this.tech_.currentTime.bind(_this.tech_), - seekable: function seekable() { - return _this.seekable(); - }, - seeking: function seeking() { - return _this.tech_.seeking(); - }, - duration: function duration() { - return _this.duration(); - }, - hasPlayed: function hasPlayed() { - return _this.hasPlayed_; - }, - goalBufferLength: function goalBufferLength() { - return _this.goalBufferLength(); - }, - bandwidth: bandwidth, - syncController: _this.syncController_, - decrypter: _this.decrypter_, - sourceType: _this.sourceType_, - inbandTextTracks: _this.inbandTextTracks_, - cacheEncryptionKeys: cacheEncryptionKeys, - sourceUpdater: _this.sourceUpdater_, - timelineChangeController: _this.timelineChangeController_ - }; // The source type check not only determines whether a special DASH playlist loader - // should be used, but also covers the case where the provided src is a vhs-json - // manifest object (instead of a URL). In the case of vhs-json, the default - // PlaylistLoader should be used. - - _this.masterPlaylistLoader_ = _this.sourceType_ === 'dash' ? new DashPlaylistLoader(src, _this.vhs_, _this.requestOptions_) : new PlaylistLoader(src, _this.vhs_, _this.requestOptions_); - - _this.setupMasterPlaylistLoaderListeners_(); // setup segment loaders - // combined audio/video or just video when alternate audio track is selected - - - _this.mainSegmentLoader_ = new SegmentLoader(videojs__default['default'].mergeOptions(segmentLoaderSettings, { - segmentMetadataTrack: _this.segmentMetadataTrack_, - loaderType: 'main' - }), options); // alternate audio track - - _this.audioSegmentLoader_ = new SegmentLoader(videojs__default['default'].mergeOptions(segmentLoaderSettings, { - loaderType: 'audio' - }), options); - _this.subtitleSegmentLoader_ = new VTTSegmentLoader(videojs__default['default'].mergeOptions(segmentLoaderSettings, { - loaderType: 'vtt', - featuresNativeTextTracks: _this.tech_.featuresNativeTextTracks - }), options); - - _this.setupSegmentLoaderListeners_(); - - if (_this.experimentalBufferBasedABR) { - _this.masterPlaylistLoader_.one('loadedplaylist', function () { - return _this.startABRTimer_(); - }); - - _this.tech_.on('pause', function () { - return _this.stopABRTimer_(); - }); - - _this.tech_.on('play', function () { - return _this.startABRTimer_(); - }); - } // Create SegmentLoader stat-getters - // mediaRequests_ - // mediaRequestsAborted_ - // mediaRequestsTimedout_ - // mediaRequestsErrored_ - // mediaTransferDuration_ - // mediaBytesTransferred_ - // mediaAppends_ - - - loaderStats.forEach(function (stat) { - _this[stat + '_'] = sumLoaderStat.bind(assertThisInitialized(_this), stat); - }); - _this.logger_ = logger('MPC'); - _this.triggeredFmp4Usage = false; - - if (_this.tech_.preload() === 'none') { - _this.loadOnPlay_ = function () { - _this.loadOnPlay_ = null; - - _this.masterPlaylistLoader_.load(); - }; - - _this.tech_.one('play', _this.loadOnPlay_); - } else { - _this.masterPlaylistLoader_.load(); - } - - _this.timeToLoadedData__ = -1; - _this.mainAppendsToLoadedData__ = -1; - _this.audioAppendsToLoadedData__ = -1; - var event = _this.tech_.preload() === 'none' ? 'play' : 'loadstart'; // start the first frame timer on loadstart or play (for preload none) - - _this.tech_.one(event, function () { - var timeToLoadedDataStart = Date.now(); - - _this.tech_.one('loadeddata', function () { - _this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart; - _this.mainAppendsToLoadedData__ = _this.mainSegmentLoader_.mediaAppends; - _this.audioAppendsToLoadedData__ = _this.audioSegmentLoader_.mediaAppends; - }); - }); - - return _this; - } - - var _proto = MasterPlaylistController.prototype; - - _proto.mainAppendsToLoadedData_ = function mainAppendsToLoadedData_() { - return this.mainAppendsToLoadedData__; - }; - - _proto.audioAppendsToLoadedData_ = function audioAppendsToLoadedData_() { - return this.audioAppendsToLoadedData__; - }; - - _proto.appendsToLoadedData_ = function appendsToLoadedData_() { - var main = this.mainAppendsToLoadedData_(); - var audio = this.audioAppendsToLoadedData_(); - - if (main === -1 || audio === -1) { - return -1; - } - - return main + audio; - }; - - _proto.timeToLoadedData_ = function timeToLoadedData_() { - return this.timeToLoadedData__; - } - /** - * Run selectPlaylist and switch to the new playlist if we should - * - * @private - * - */ - ; - - _proto.checkABR_ = function checkABR_() { - var nextPlaylist = this.selectPlaylist(); - - if (this.shouldSwitchToMedia_(nextPlaylist)) { - this.switchMedia_(nextPlaylist, 'abr'); - } - }; - - _proto.switchMedia_ = function switchMedia_(playlist, cause, delay) { - var oldMedia = this.media(); - var oldId = oldMedia && (oldMedia.id || oldMedia.uri); - var newId = playlist.id || playlist.uri; - - if (oldId && oldId !== newId) { - this.logger_("switch media " + oldId + " -> " + newId + " from " + cause); - this.tech_.trigger({ - type: 'usage', - name: "vhs-rendition-change-" + cause - }); - } - - this.masterPlaylistLoader_.media(playlist, delay); - } - /** - * Start a timer that periodically calls checkABR_ - * - * @private - */ - ; - - _proto.startABRTimer_ = function startABRTimer_() { - var _this2 = this; - - this.stopABRTimer_(); - this.abrTimer_ = window__default['default'].setInterval(function () { - return _this2.checkABR_(); - }, 250); - } - /** - * Stop the timer that periodically calls checkABR_ - * - * @private - */ - ; - - _proto.stopABRTimer_ = function stopABRTimer_() { - // if we're scrubbing, we don't need to pause. - // This getter will be added to Video.js in version 7.11. - if (this.tech_.scrubbing && this.tech_.scrubbing()) { - return; - } - - window__default['default'].clearInterval(this.abrTimer_); - this.abrTimer_ = null; - } - /** - * Get a list of playlists for the currently selected audio playlist - * - * @return {Array} the array of audio playlists - */ - ; - - _proto.getAudioTrackPlaylists_ = function getAudioTrackPlaylists_() { - var master = this.master(); // if we don't have any audio groups then we can only - // assume that the audio tracks are contained in masters - // playlist array, use that or an empty array. - - if (!master || !master.mediaGroups || !master.mediaGroups.AUDIO) { - return master && master.playlists || []; - } - - var AUDIO = master.mediaGroups.AUDIO; - var groupKeys = Object.keys(AUDIO); - var track; // get the current active track - - if (Object.keys(this.mediaTypes_.AUDIO.groups).length) { - track = this.mediaTypes_.AUDIO.activeTrack(); // or get the default track from master if mediaTypes_ isn't setup yet - } else { - // default group is `main` or just the first group. - var defaultGroup = AUDIO.main || groupKeys.length && AUDIO[groupKeys[0]]; - - for (var label in defaultGroup) { - if (defaultGroup[label].default) { - track = { - label: label - }; - break; - } - } - } // no active track no playlists. - - - if (!track) { - return []; - } - - var playlists = []; // get all of the playlists that are possible for the - // active track. - - for (var group in AUDIO) { - if (AUDIO[group][track.label]) { - var properties = AUDIO[group][track.label]; - - if (properties.playlists) { - playlists.push.apply(playlists, properties.playlists); - } else { - playlists.push(properties); - } - } - } - - return playlists; - } - /** - * Register event handlers on the master playlist loader. A helper - * function for construction time. - * - * @private - */ - ; - - _proto.setupMasterPlaylistLoaderListeners_ = function setupMasterPlaylistLoaderListeners_() { - var _this3 = this; - - this.masterPlaylistLoader_.on('loadedmetadata', function () { - var media = _this3.masterPlaylistLoader_.media(); - - var requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to - // timeout the request. - - if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) { - _this3.requestOptions_.timeout = 0; - } else { - _this3.requestOptions_.timeout = requestTimeout; - } // if this isn't a live video and preload permits, start - // downloading segments - - - if (media.endList && _this3.tech_.preload() !== 'none') { - _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_); - - _this3.mainSegmentLoader_.load(); - } - - setupMediaGroups({ - sourceType: _this3.sourceType_, - segmentLoaders: { - AUDIO: _this3.audioSegmentLoader_, - SUBTITLES: _this3.subtitleSegmentLoader_, - main: _this3.mainSegmentLoader_ - }, - tech: _this3.tech_, - requestOptions: _this3.requestOptions_, - masterPlaylistLoader: _this3.masterPlaylistLoader_, - vhs: _this3.vhs_, - master: _this3.master(), - mediaTypes: _this3.mediaTypes_, - blacklistCurrentPlaylist: _this3.blacklistCurrentPlaylist.bind(_this3) - }); - - _this3.triggerPresenceUsage_(_this3.master(), media); - - _this3.setupFirstPlay(); - - if (!_this3.mediaTypes_.AUDIO.activePlaylistLoader || _this3.mediaTypes_.AUDIO.activePlaylistLoader.media()) { - _this3.trigger('selectedinitialmedia'); - } else { - // We must wait for the active audio playlist loader to - // finish setting up before triggering this event so the - // representations API and EME setup is correct - _this3.mediaTypes_.AUDIO.activePlaylistLoader.one('loadedmetadata', function () { - _this3.trigger('selectedinitialmedia'); - }); - } - }); - this.masterPlaylistLoader_.on('loadedplaylist', function () { - if (_this3.loadOnPlay_) { - _this3.tech_.off('play', _this3.loadOnPlay_); - } - - var updatedPlaylist = _this3.masterPlaylistLoader_.media(); - - if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting - // an initial media as the playlist selectors do not consider browser support - _this3.excludeUnsupportedVariants_(); - - var selectedMedia; - - if (_this3.enableLowInitialPlaylist) { - selectedMedia = _this3.selectInitialPlaylist(); - } - - if (!selectedMedia) { - selectedMedia = _this3.selectPlaylist(); - } - - if (!selectedMedia || !_this3.shouldSwitchToMedia_(selectedMedia)) { - return; - } - - _this3.initialMedia_ = selectedMedia; - - _this3.switchMedia_(_this3.initialMedia_, 'initial'); // Under the standard case where a source URL is provided, loadedplaylist will - // fire again since the playlist will be requested. In the case of vhs-json - // (where the manifest object is provided as the source), when the media - // playlist's `segments` list is already available, a media playlist won't be - // requested, and loadedplaylist won't fire again, so the playlist handler must be - // called on its own here. - - - var haveJsonSource = _this3.sourceType_ === 'vhs-json' && _this3.initialMedia_.segments; - - if (!haveJsonSource) { - return; - } - - updatedPlaylist = _this3.initialMedia_; - } - - _this3.handleUpdatedMediaPlaylist(updatedPlaylist); - }); - this.masterPlaylistLoader_.on('error', function () { - _this3.blacklistCurrentPlaylist(_this3.masterPlaylistLoader_.error); - }); - this.masterPlaylistLoader_.on('mediachanging', function () { - _this3.mainSegmentLoader_.abort(); - - _this3.mainSegmentLoader_.pause(); - }); - this.masterPlaylistLoader_.on('mediachange', function () { - var media = _this3.masterPlaylistLoader_.media(); - - var requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to - // timeout the request. - - if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) { - _this3.requestOptions_.timeout = 0; - } else { - _this3.requestOptions_.timeout = requestTimeout; - } // TODO: Create a new event on the PlaylistLoader that signals - // that the segments have changed in some way and use that to - // update the SegmentLoader instead of doing it twice here and - // on `loadedplaylist` - - - _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_); - - _this3.mainSegmentLoader_.load(); - - _this3.tech_.trigger({ - type: 'mediachange', - bubbles: true - }); - }); - this.masterPlaylistLoader_.on('playlistunchanged', function () { - var updatedPlaylist = _this3.masterPlaylistLoader_.media(); // ignore unchanged playlists that have already been - // excluded for not-changing. We likely just have a really slowly updating - // playlist. - - - if (updatedPlaylist.lastExcludeReason_ === 'playlist-unchanged') { - return; - } - - var playlistOutdated = _this3.stuckAtPlaylistEnd_(updatedPlaylist); - - if (playlistOutdated) { - // Playlist has stopped updating and we're stuck at its end. Try to - // blacklist it and switch to another playlist in the hope that that - // one is updating (and give the player a chance to re-adjust to the - // safe live point). - _this3.blacklistCurrentPlaylist({ - message: 'Playlist no longer updating.', - reason: 'playlist-unchanged' - }); // useful for monitoring QoS - - - _this3.tech_.trigger('playliststuck'); - } - }); - this.masterPlaylistLoader_.on('renditiondisabled', function () { - _this3.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-disabled' - }); - - _this3.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-disabled' - }); - }); - this.masterPlaylistLoader_.on('renditionenabled', function () { - _this3.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-enabled' - }); - - _this3.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-enabled' - }); - }); - } - /** - * Given an updated media playlist (whether it was loaded for the first time, or - * refreshed for live playlists), update any relevant properties and state to reflect - * changes in the media that should be accounted for (e.g., cues and duration). - * - * @param {Object} updatedPlaylist the updated media playlist object - * - * @private - */ - ; - - _proto.handleUpdatedMediaPlaylist = function handleUpdatedMediaPlaylist(updatedPlaylist) { - if (this.useCueTags_) { - this.updateAdCues_(updatedPlaylist); - } // TODO: Create a new event on the PlaylistLoader that signals - // that the segments have changed in some way and use that to - // update the SegmentLoader instead of doing it twice here and - // on `mediachange` - - - this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_); - this.updateDuration(!updatedPlaylist.endList); // If the player isn't paused, ensure that the segment loader is running, - // as it is possible that it was temporarily stopped while waiting for - // a playlist (e.g., in case the playlist errored and we re-requested it). - - if (!this.tech_.paused()) { - this.mainSegmentLoader_.load(); - - if (this.audioSegmentLoader_) { - this.audioSegmentLoader_.load(); - } - } - } - /** - * A helper function for triggerring presence usage events once per source - * - * @private - */ - ; - - _proto.triggerPresenceUsage_ = function triggerPresenceUsage_(master, media) { - var mediaGroups = master.mediaGroups || {}; - var defaultDemuxed = true; - var audioGroupKeys = Object.keys(mediaGroups.AUDIO); - - for (var mediaGroup in mediaGroups.AUDIO) { - for (var label in mediaGroups.AUDIO[mediaGroup]) { - var properties = mediaGroups.AUDIO[mediaGroup][label]; - - if (!properties.uri) { - defaultDemuxed = false; - } - } - } - - if (defaultDemuxed) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-demuxed' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-demuxed' - }); - } - - if (Object.keys(mediaGroups.SUBTITLES).length) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-webvtt' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-webvtt' - }); - } - - if (Vhs$1.Playlist.isAes(media)) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-aes' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-aes' - }); - } - - if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-alternate-audio' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-alternate-audio' - }); - } - - if (this.useCueTags_) { - this.tech_.trigger({ - type: 'usage', - name: 'vhs-playlist-cue-tags' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-playlist-cue-tags' - }); - } - }; - - _proto.shouldSwitchToMedia_ = function shouldSwitchToMedia_(nextPlaylist) { - var currentPlaylist = this.masterPlaylistLoader_.media(); - var buffered = this.tech_.buffered(); - var forwardBuffer = buffered.length ? buffered.end(buffered.length - 1) - this.tech_.currentTime() : 0; - var bufferLowWaterLine = this.bufferLowWaterLine(); - var bufferHighWaterLine = this.bufferHighWaterLine(); - return shouldSwitchToMedia({ - currentPlaylist: currentPlaylist, - nextPlaylist: nextPlaylist, - forwardBuffer: forwardBuffer, - bufferLowWaterLine: bufferLowWaterLine, - bufferHighWaterLine: bufferHighWaterLine, - duration: this.duration(), - experimentalBufferBasedABR: this.experimentalBufferBasedABR, - log: this.logger_ - }); - } - /** - * Register event handlers on the segment loaders. A helper function - * for construction time. - * - * @private - */ - ; - - _proto.setupSegmentLoaderListeners_ = function setupSegmentLoaderListeners_() { - var _this4 = this; - - if (!this.experimentalBufferBasedABR) { - this.mainSegmentLoader_.on('bandwidthupdate', function () { - var nextPlaylist = _this4.selectPlaylist(); - - if (_this4.shouldSwitchToMedia_(nextPlaylist)) { - _this4.switchMedia_(nextPlaylist, 'bandwidthupdate'); - } - - _this4.tech_.trigger('bandwidthupdate'); - }); - this.mainSegmentLoader_.on('progress', function () { - _this4.trigger('progress'); - }); - } - - this.mainSegmentLoader_.on('error', function () { - _this4.blacklistCurrentPlaylist(_this4.mainSegmentLoader_.error()); - }); - this.mainSegmentLoader_.on('appenderror', function () { - _this4.error = _this4.mainSegmentLoader_.error_; - - _this4.trigger('error'); - }); - this.mainSegmentLoader_.on('syncinfoupdate', function () { - _this4.onSyncInfoUpdate_(); - }); - this.mainSegmentLoader_.on('timestampoffset', function () { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-timestamp-offset' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-timestamp-offset' - }); - }); - this.audioSegmentLoader_.on('syncinfoupdate', function () { - _this4.onSyncInfoUpdate_(); - }); - this.audioSegmentLoader_.on('appenderror', function () { - _this4.error = _this4.audioSegmentLoader_.error_; - - _this4.trigger('error'); - }); - this.mainSegmentLoader_.on('ended', function () { - _this4.logger_('main segment loader ended'); - - _this4.onEndOfStream(); - }); - this.mainSegmentLoader_.on('earlyabort', function (event) { - // never try to early abort with the new ABR algorithm - if (_this4.experimentalBufferBasedABR) { - return; - } - - _this4.delegateLoaders_('all', ['abort']); - - _this4.blacklistCurrentPlaylist({ - message: 'Aborted early because there isn\'t enough bandwidth to complete the ' + 'request without rebuffering.' - }, ABORT_EARLY_BLACKLIST_SECONDS); - }); - - var updateCodecs = function updateCodecs() { - if (!_this4.sourceUpdater_.hasCreatedSourceBuffers()) { - return _this4.tryToCreateSourceBuffers_(); - } - - var codecs = _this4.getCodecsOrExclude_(); // no codecs means that the playlist was excluded - - - if (!codecs) { - return; - } - - _this4.sourceUpdater_.addOrChangeSourceBuffers(codecs); - }; - - this.mainSegmentLoader_.on('trackinfo', updateCodecs); - this.audioSegmentLoader_.on('trackinfo', updateCodecs); - this.mainSegmentLoader_.on('fmp4', function () { - if (!_this4.triggeredFmp4Usage) { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-fmp4' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-fmp4' - }); - - _this4.triggeredFmp4Usage = true; - } - }); - this.audioSegmentLoader_.on('fmp4', function () { - if (!_this4.triggeredFmp4Usage) { - _this4.tech_.trigger({ - type: 'usage', - name: 'vhs-fmp4' - }); - - _this4.tech_.trigger({ - type: 'usage', - name: 'hls-fmp4' - }); - - _this4.triggeredFmp4Usage = true; - } - }); - this.audioSegmentLoader_.on('ended', function () { - _this4.logger_('audioSegmentLoader ended'); - - _this4.onEndOfStream(); - }); - }; - - _proto.mediaSecondsLoaded_ = function mediaSecondsLoaded_() { - return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded); - } - /** - * Call load on our SegmentLoaders - */ - ; - - _proto.load = function load() { - this.mainSegmentLoader_.load(); - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - this.audioSegmentLoader_.load(); - } - - if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) { - this.subtitleSegmentLoader_.load(); - } - } - /** - * Re-tune playback quality level for the current player - * conditions without performing destructive actions, like - * removing already buffered content - * - * @private - * @deprecated - */ - ; - - _proto.smoothQualityChange_ = function smoothQualityChange_(media) { - if (media === void 0) { - media = this.selectPlaylist(); - } - - this.fastQualityChange_(media); - } - /** - * Re-tune playback quality level for the current player - * conditions. This method will perform destructive actions like removing - * already buffered content in order to readjust the currently active - * playlist quickly. This is good for manual quality changes - * - * @private - */ - ; - - _proto.fastQualityChange_ = function fastQualityChange_(media) { - var _this5 = this; - - if (media === void 0) { - media = this.selectPlaylist(); - } - - if (media === this.masterPlaylistLoader_.media()) { - this.logger_('skipping fastQualityChange because new media is same as old'); - return; - } - - this.switchMedia_(media, 'fast-quality'); // Delete all buffered data to allow an immediate quality switch, then seek to give - // the browser a kick to remove any cached frames from the previous rendtion (.04 seconds - // ahead is roughly the minimum that will accomplish this across a variety of content - // in IE and Edge, but seeking in place is sufficient on all other browsers) - // Edge/IE bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14600375/ - // Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=651904 - - this.mainSegmentLoader_.resetEverything(function () { - // Since this is not a typical seek, we avoid the seekTo method which can cause segments - // from the previously enabled rendition to load before the new playlist has finished loading - if (videojs__default['default'].browser.IE_VERSION || videojs__default['default'].browser.IS_EDGE) { - _this5.tech_.setCurrentTime(_this5.tech_.currentTime() + 0.04); - } else { - _this5.tech_.setCurrentTime(_this5.tech_.currentTime()); - } - }); // don't need to reset audio as it is reset when media changes - } - /** - * Begin playback. - */ - ; - - _proto.play = function play() { - if (this.setupFirstPlay()) { - return; - } - - if (this.tech_.ended()) { - this.tech_.setCurrentTime(0); - } - - if (this.hasPlayed_) { - this.load(); - } - - var seekable = this.tech_.seekable(); // if the viewer has paused and we fell out of the live window, - // seek forward to the live point - - if (this.tech_.duration() === Infinity) { - if (this.tech_.currentTime() < seekable.start(0)) { - return this.tech_.setCurrentTime(seekable.end(seekable.length - 1)); - } - } - } - /** - * Seek to the latest media position if this is a live video and the - * player and video are loaded and initialized. - */ - ; - - _proto.setupFirstPlay = function setupFirstPlay() { - var _this6 = this; - - var media = this.masterPlaylistLoader_.media(); // Check that everything is ready to begin buffering for the first call to play - // If 1) there is no active media - // 2) the player is paused - // 3) the first play has already been setup - // then exit early - - if (!media || this.tech_.paused() || this.hasPlayed_) { - return false; - } // when the video is a live stream - - - if (!media.endList) { - var seekable = this.seekable(); - - if (!seekable.length) { - // without a seekable range, the player cannot seek to begin buffering at the live - // point - return false; - } - - if (videojs__default['default'].browser.IE_VERSION && this.tech_.readyState() === 0) { - // IE11 throws an InvalidStateError if you try to set currentTime while the - // readyState is 0, so it must be delayed until the tech fires loadedmetadata. - this.tech_.one('loadedmetadata', function () { - _this6.trigger('firstplay'); - - _this6.tech_.setCurrentTime(seekable.end(0)); - - _this6.hasPlayed_ = true; - }); - return false; - } // trigger firstplay to inform the source handler to ignore the next seek event - - - this.trigger('firstplay'); // seek to the live point - - this.tech_.setCurrentTime(seekable.end(0)); - } - - this.hasPlayed_ = true; // we can begin loading now that everything is ready - - this.load(); - return true; - } - /** - * handle the sourceopen event on the MediaSource - * - * @private - */ - ; - - _proto.handleSourceOpen_ = function handleSourceOpen_() { - // Only attempt to create the source buffer if none already exist. - // handleSourceOpen is also called when we are "re-opening" a source buffer - // after `endOfStream` has been called (in response to a seek for instance) - this.tryToCreateSourceBuffers_(); // if autoplay is enabled, begin playback. This is duplicative of - // code in video.js but is required because play() must be invoked - // *after* the media source has opened. - - if (this.tech_.autoplay()) { - var playPromise = this.tech_.play(); // Catch/silence error when a pause interrupts a play request - // on browsers which return a promise - - if (typeof playPromise !== 'undefined' && typeof playPromise.then === 'function') { - playPromise.then(null, function (e) {}); - } - } - - this.trigger('sourceopen'); - } - /** - * handle the sourceended event on the MediaSource - * - * @private - */ - ; - - _proto.handleSourceEnded_ = function handleSourceEnded_() { - if (!this.inbandTextTracks_.metadataTrack_) { - return; - } - - var cues = this.inbandTextTracks_.metadataTrack_.cues; - - if (!cues || !cues.length) { - return; - } - - var duration = this.duration(); - cues[cues.length - 1].endTime = isNaN(duration) || Math.abs(duration) === Infinity ? Number.MAX_VALUE : duration; - } - /** - * handle the durationchange event on the MediaSource - * - * @private - */ - ; - - _proto.handleDurationChange_ = function handleDurationChange_() { - this.tech_.trigger('durationchange'); - } - /** - * Calls endOfStream on the media source when all active stream types have called - * endOfStream - * - * @param {string} streamType - * Stream type of the segment loader that called endOfStream - * @private - */ - ; - - _proto.onEndOfStream = function onEndOfStream() { - var isEndOfStream = this.mainSegmentLoader_.ended_; - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - // if the audio playlist loader exists, then alternate audio is active - if (!this.mainSegmentLoader_.currentMediaInfo_ || this.mainSegmentLoader_.currentMediaInfo_.hasVideo) { - // if we do not know if the main segment loader contains video yet or if we - // definitively know the main segment loader contains video, then we need to wait - // for both main and audio segment loaders to call endOfStream - isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_; - } else { - // otherwise just rely on the audio loader - isEndOfStream = this.audioSegmentLoader_.ended_; - } - } - - if (!isEndOfStream) { - return; - } - - this.stopABRTimer_(); - this.sourceUpdater_.endOfStream(); - } - /** - * Check if a playlist has stopped being updated - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist has stopped being updated or not - */ - ; - - _proto.stuckAtPlaylistEnd_ = function stuckAtPlaylistEnd_(playlist) { - var seekable = this.seekable(); - - if (!seekable.length) { - // playlist doesn't have enough information to determine whether we are stuck - return false; - } - - var expired = this.syncController_.getExpiredTime(playlist, this.duration()); - - if (expired === null) { - return false; - } // does not use the safe live end to calculate playlist end, since we - // don't want to say we are stuck while there is still content - - - var absolutePlaylistEnd = Vhs$1.Playlist.playlistEnd(playlist, expired); - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - - if (!buffered.length) { - // return true if the playhead reached the absolute end of the playlist - return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA; - } - - var bufferedEnd = buffered.end(buffered.length - 1); // return true if there is too little buffer left and buffer has reached absolute - // end of playlist - - return bufferedEnd - currentTime <= SAFE_TIME_DELTA && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA; - } - /** - * Blacklists a playlist when an error occurs for a set amount of time - * making it unavailable for selection by the rendition selection algorithm - * and then forces a new playlist (rendition) selection. - * - * @param {Object=} error an optional error that may include the playlist - * to blacklist - * @param {number=} blacklistDuration an optional number of seconds to blacklist the - * playlist - */ - ; - - _proto.blacklistCurrentPlaylist = function blacklistCurrentPlaylist(error, blacklistDuration) { - if (error === void 0) { - error = {}; - } - - // If the `error` was generated by the playlist loader, it will contain - // the playlist we were trying to load (but failed) and that should be - // blacklisted instead of the currently selected playlist which is likely - // out-of-date in this scenario - var currentPlaylist = error.playlist || this.masterPlaylistLoader_.media(); - blacklistDuration = blacklistDuration || error.blacklistDuration || this.blacklistDuration; // If there is no current playlist, then an error occurred while we were - // trying to load the master OR while we were disposing of the tech - - if (!currentPlaylist) { - this.error = error; - - if (this.mediaSource.readyState !== 'open') { - this.trigger('error'); - } else { - this.sourceUpdater_.endOfStream('network'); - } - - return; - } - - currentPlaylist.playlistErrors_++; - var playlists = this.masterPlaylistLoader_.master.playlists; - var enabledPlaylists = playlists.filter(isEnabled); - var isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === currentPlaylist; // Don't blacklist the only playlist unless it was blacklisted - // forever - - if (playlists.length === 1 && blacklistDuration !== Infinity) { - videojs__default['default'].log.warn("Problem encountered with playlist " + currentPlaylist.id + ". " + 'Trying again since it is the only playlist.'); - this.tech_.trigger('retryplaylist'); // if this is a final rendition, we should delay - - return this.masterPlaylistLoader_.load(isFinalRendition); - } - - if (isFinalRendition) { - // Since we're on the final non-blacklisted playlist, and we're about to blacklist - // it, instead of erring the player or retrying this playlist, clear out the current - // blacklist. This allows other playlists to be attempted in case any have been - // fixed. - var reincluded = false; - playlists.forEach(function (playlist) { - // skip current playlist which is about to be blacklisted - if (playlist === currentPlaylist) { - return; - } - - var excludeUntil = playlist.excludeUntil; // a playlist cannot be reincluded if it wasn't excluded to begin with. - - if (typeof excludeUntil !== 'undefined' && excludeUntil !== Infinity) { - reincluded = true; - delete playlist.excludeUntil; - } - }); - - if (reincluded) { - videojs__default['default'].log.warn('Removing other playlists from the exclusion list because the last ' + 'rendition is about to be excluded.'); // Technically we are retrying a playlist, in that we are simply retrying a previous - // playlist. This is needed for users relying on the retryplaylist event to catch a - // case where the player might be stuck and looping through "dead" playlists. - - this.tech_.trigger('retryplaylist'); - } - } // Blacklist this playlist - - - var excludeUntil; - - if (currentPlaylist.playlistErrors_ > this.maxPlaylistRetries) { - excludeUntil = Infinity; - } else { - excludeUntil = Date.now() + blacklistDuration * 1000; - } - - currentPlaylist.excludeUntil = excludeUntil; - - if (error.reason) { - currentPlaylist.lastExcludeReason_ = error.reason; - } - - this.tech_.trigger('blacklistplaylist'); - this.tech_.trigger({ - type: 'usage', - name: 'vhs-rendition-blacklisted' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-rendition-blacklisted' - }); // TODO: should we select a new playlist if this blacklist wasn't for the currentPlaylist? - // Would be something like media().id !=== currentPlaylist.id and we would need something - // like `pendingMedia` in playlist loaders to check against that too. This will prevent us - // from loading a new playlist on any blacklist. - // Select a new playlist - - var nextPlaylist = this.selectPlaylist(); - - if (!nextPlaylist) { - this.error = 'Playback cannot continue. No available working or supported playlists.'; - this.trigger('error'); - return; - } - - var logFn = error.internal ? this.logger_ : videojs__default['default'].log.warn; - var errorMessage = error.message ? ' ' + error.message : ''; - logFn((error.internal ? 'Internal problem' : 'Problem') + " encountered with playlist " + currentPlaylist.id + "." + (errorMessage + " Switching to playlist " + nextPlaylist.id + ".")); // if audio group changed reset audio loaders - - if (nextPlaylist.attributes.AUDIO !== currentPlaylist.attributes.AUDIO) { - this.delegateLoaders_('audio', ['abort', 'pause']); - } // if subtitle group changed reset subtitle loaders - - - if (nextPlaylist.attributes.SUBTITLES !== currentPlaylist.attributes.SUBTITLES) { - this.delegateLoaders_('subtitle', ['abort', 'pause']); - } - - this.delegateLoaders_('main', ['abort', 'pause']); - var delayDuration = nextPlaylist.targetDuration / 2 * 1000 || 5 * 1000; - var shouldDelay = typeof nextPlaylist.lastRequest === 'number' && Date.now() - nextPlaylist.lastRequest <= delayDuration; // delay if it's a final rendition or if the last refresh is sooner than half targetDuration - - return this.switchMedia_(nextPlaylist, 'exclude', isFinalRendition || shouldDelay); - } - /** - * Pause all segment/playlist loaders - */ - ; - - _proto.pauseLoading = function pauseLoading() { - this.delegateLoaders_('all', ['abort', 'pause']); - this.stopABRTimer_(); - } - /** - * Call a set of functions in order on playlist loaders, segment loaders, - * or both types of loaders. - * - * @param {string} filter - * Filter loaders that should call fnNames using a string. Can be: - * * all - run on all loaders - * * audio - run on all audio loaders - * * subtitle - run on all subtitle loaders - * * main - run on the main/master loaders - * - * @param {Array|string} fnNames - * A string or array of function names to call. - */ - ; - - _proto.delegateLoaders_ = function delegateLoaders_(filter, fnNames) { - var _this7 = this; - - var loaders = []; - var dontFilterPlaylist = filter === 'all'; - - if (dontFilterPlaylist || filter === 'main') { - loaders.push(this.masterPlaylistLoader_); - } - - var mediaTypes = []; - - if (dontFilterPlaylist || filter === 'audio') { - mediaTypes.push('AUDIO'); - } - - if (dontFilterPlaylist || filter === 'subtitle') { - mediaTypes.push('CLOSED-CAPTIONS'); - mediaTypes.push('SUBTITLES'); - } - - mediaTypes.forEach(function (mediaType) { - var loader = _this7.mediaTypes_[mediaType] && _this7.mediaTypes_[mediaType].activePlaylistLoader; - - if (loader) { - loaders.push(loader); - } - }); - ['main', 'audio', 'subtitle'].forEach(function (name) { - var loader = _this7[name + "SegmentLoader_"]; - - if (loader && (filter === name || filter === 'all')) { - loaders.push(loader); - } - }); - loaders.forEach(function (loader) { - return fnNames.forEach(function (fnName) { - if (typeof loader[fnName] === 'function') { - loader[fnName](); - } - }); - }); - } - /** - * set the current time on all segment loaders - * - * @param {TimeRange} currentTime the current time to set - * @return {TimeRange} the current time - */ - ; - - _proto.setCurrentTime = function setCurrentTime(currentTime) { - var buffered = findRange(this.tech_.buffered(), currentTime); - - if (!(this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media())) { - // return immediately if the metadata is not ready yet - return 0; - } // it's clearly an edge-case but don't thrown an error if asked to - // seek within an empty playlist - - - if (!this.masterPlaylistLoader_.media().segments) { - return 0; - } // if the seek location is already buffered, continue buffering as usual - - - if (buffered && buffered.length) { - return currentTime; - } // cancel outstanding requests so we begin buffering at the new - // location - - - this.mainSegmentLoader_.resetEverything(); - this.mainSegmentLoader_.abort(); - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - this.audioSegmentLoader_.resetEverything(); - this.audioSegmentLoader_.abort(); - } - - if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) { - this.subtitleSegmentLoader_.resetEverything(); - this.subtitleSegmentLoader_.abort(); - } // start segment loader loading in case they are paused - - - this.load(); - } - /** - * get the current duration - * - * @return {TimeRange} the duration - */ - ; - - _proto.duration = function duration() { - if (!this.masterPlaylistLoader_) { - return 0; - } - - var media = this.masterPlaylistLoader_.media(); - - if (!media) { - // no playlists loaded yet, so can't determine a duration - return 0; - } // Don't rely on the media source for duration in the case of a live playlist since - // setting the native MediaSource's duration to infinity ends up with consequences to - // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details. - // - // This is resolved in the spec by https://github.com/w3c/media-source/pull/92, - // however, few browsers have support for setLiveSeekableRange() - // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange - // - // Until a time when the duration of the media source can be set to infinity, and a - // seekable range specified across browsers, just return Infinity. - - - if (!media.endList) { - return Infinity; - } // Since this is a VOD video, it is safe to rely on the media source's duration (if - // available). If it's not available, fall back to a playlist-calculated estimate. - - - if (this.mediaSource) { - return this.mediaSource.duration; - } - - return Vhs$1.Playlist.duration(media); - } - /** - * check the seekable range - * - * @return {TimeRange} the seekable range - */ - ; - - _proto.seekable = function seekable() { - return this.seekable_; - }; - - _proto.onSyncInfoUpdate_ = function onSyncInfoUpdate_() { - var audioSeekable; - - if (!this.masterPlaylistLoader_) { - return; - } - - var media = this.masterPlaylistLoader_.media(); - - if (!media) { - return; - } - - var expired = this.syncController_.getExpiredTime(media, this.duration()); - - if (expired === null) { - // not enough information to update seekable - return; - } - - var master = this.masterPlaylistLoader_.master; - var mainSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media)); - - if (mainSeekable.length === 0) { - return; - } - - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - media = this.mediaTypes_.AUDIO.activePlaylistLoader.media(); - expired = this.syncController_.getExpiredTime(media, this.duration()); - - if (expired === null) { - return; - } - - audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media)); - - if (audioSeekable.length === 0) { - return; - } - } - - var oldEnd; - var oldStart; - - if (this.seekable_ && this.seekable_.length) { - oldEnd = this.seekable_.end(0); - oldStart = this.seekable_.start(0); - } - - if (!audioSeekable) { - // seekable has been calculated based on buffering video data so it - // can be returned directly - this.seekable_ = mainSeekable; - } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) { - // seekables are pretty far off, rely on main - this.seekable_ = mainSeekable; - } else { - this.seekable_ = videojs__default['default'].createTimeRanges([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]); - } // seekable is the same as last time - - - if (this.seekable_ && this.seekable_.length) { - if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) { - return; - } - } - - this.logger_("seekable updated [" + printableRange(this.seekable_) + "]"); - this.tech_.trigger('seekablechanged'); - } - /** - * Update the player duration - */ - ; - - _proto.updateDuration = function updateDuration(isLive) { - if (this.updateDuration_) { - this.mediaSource.removeEventListener('sourceopen', this.updateDuration_); - this.updateDuration_ = null; - } - - if (this.mediaSource.readyState !== 'open') { - this.updateDuration_ = this.updateDuration.bind(this, isLive); - this.mediaSource.addEventListener('sourceopen', this.updateDuration_); - return; - } - - if (isLive) { - var seekable = this.seekable(); - - if (!seekable.length) { - return; - } // Even in the case of a live playlist, the native MediaSource's duration should not - // be set to Infinity (even though this would be expected for a live playlist), since - // setting the native MediaSource's duration to infinity ends up with consequences to - // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details. - // - // This is resolved in the spec by https://github.com/w3c/media-source/pull/92, - // however, few browsers have support for setLiveSeekableRange() - // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange - // - // Until a time when the duration of the media source can be set to infinity, and a - // seekable range specified across browsers, the duration should be greater than or - // equal to the last possible seekable value. - // MediaSource duration starts as NaN - // It is possible (and probable) that this case will never be reached for many - // sources, since the MediaSource reports duration as the highest value without - // accounting for timestamp offset. For example, if the timestamp offset is -100 and - // we buffered times 0 to 100 with real times of 100 to 200, even though current - // time will be between 0 and 100, the native media source may report the duration - // as 200. However, since we report duration separate from the media source (as - // Infinity), and as long as the native media source duration value is greater than - // our reported seekable range, seeks will work as expected. The large number as - // duration for live is actually a strategy used by some players to work around the - // issue of live seekable ranges cited above. - - - if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable.end(seekable.length - 1)) { - this.sourceUpdater_.setDuration(seekable.end(seekable.length - 1)); - } - - return; - } - - var buffered = this.tech_.buffered(); - var duration = Vhs$1.Playlist.duration(this.masterPlaylistLoader_.media()); - - if (buffered.length > 0) { - duration = Math.max(duration, buffered.end(buffered.length - 1)); - } - - if (this.mediaSource.duration !== duration) { - this.sourceUpdater_.setDuration(duration); - } - } - /** - * dispose of the MasterPlaylistController and everything - * that it controls - */ - ; - - _proto.dispose = function dispose() { - var _this8 = this; - - this.trigger('dispose'); - this.decrypter_.terminate(); - this.masterPlaylistLoader_.dispose(); - this.mainSegmentLoader_.dispose(); - - if (this.loadOnPlay_) { - this.tech_.off('play', this.loadOnPlay_); - } - - ['AUDIO', 'SUBTITLES'].forEach(function (type) { - var groups = _this8.mediaTypes_[type].groups; - - for (var id in groups) { - groups[id].forEach(function (group) { - if (group.playlistLoader) { - group.playlistLoader.dispose(); - } - }); - } - }); - this.audioSegmentLoader_.dispose(); - this.subtitleSegmentLoader_.dispose(); - this.sourceUpdater_.dispose(); - this.timelineChangeController_.dispose(); - this.stopABRTimer_(); - - if (this.updateDuration_) { - this.mediaSource.removeEventListener('sourceopen', this.updateDuration_); - } - - this.mediaSource.removeEventListener('durationchange', this.handleDurationChange_); // load the media source into the player - - this.mediaSource.removeEventListener('sourceopen', this.handleSourceOpen_); - this.mediaSource.removeEventListener('sourceended', this.handleSourceEnded_); - this.off(); - } - /** - * return the master playlist object if we have one - * - * @return {Object} the master playlist object that we parsed - */ - ; - - _proto.master = function master() { - return this.masterPlaylistLoader_.master; - } - /** - * return the currently selected playlist - * - * @return {Object} the currently selected playlist object that we parsed - */ - ; - - _proto.media = function media() { - // playlist loader will not return media if it has not been fully loaded - return this.masterPlaylistLoader_.media() || this.initialMedia_; - }; - - _proto.areMediaTypesKnown_ = function areMediaTypesKnown_() { - var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader; // one or both loaders has not loaded sufficently to get codecs - - if (!this.mainSegmentLoader_.currentMediaInfo_ || usingAudioLoader && !this.audioSegmentLoader_.currentMediaInfo_) { - return false; - } - - return true; - }; - - _proto.getCodecsOrExclude_ = function getCodecsOrExclude_() { - var _this9 = this; - - var media = { - main: this.mainSegmentLoader_.currentMediaInfo_ || {}, - audio: this.audioSegmentLoader_.currentMediaInfo_ || {} - }; // set "main" media equal to video - - media.video = media.main; - var playlistCodecs = codecsForPlaylist(this.master(), this.media()); - var codecs = {}; - var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader; - - if (media.main.hasVideo) { - codecs.video = playlistCodecs.video || media.main.videoCodec || DEFAULT_VIDEO_CODEC; - } - - if (media.main.isMuxed) { - codecs.video += "," + (playlistCodecs.audio || media.main.audioCodec || DEFAULT_AUDIO_CODEC); - } - - if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) { - codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || DEFAULT_AUDIO_CODEC; // set audio isFmp4 so we use the correct "supports" function below - - media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4; - } // no codecs, no playback. - - - if (!codecs.audio && !codecs.video) { - this.blacklistCurrentPlaylist({ - playlist: this.media(), - message: 'Could not determine codecs for playlist.', - blacklistDuration: Infinity - }); - return; - } // fmp4 relies on browser support, while ts relies on muxer support - - - var supportFunction = function supportFunction(isFmp4, codec) { - return isFmp4 ? browserSupportsCodec(codec) : muxerSupportsCodec(codec); - }; - - var unsupportedCodecs = {}; - var unsupportedAudio; - ['video', 'audio'].forEach(function (type) { - if (codecs.hasOwnProperty(type) && !supportFunction(media[type].isFmp4, codecs[type])) { - var supporter = media[type].isFmp4 ? 'browser' : 'muxer'; - unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || []; - unsupportedCodecs[supporter].push(codecs[type]); - - if (type === 'audio') { - unsupportedAudio = supporter; - } - } - }); - - if (usingAudioLoader && unsupportedAudio && this.media().attributes.AUDIO) { - var audioGroup = this.media().attributes.AUDIO; - this.master().playlists.forEach(function (variant) { - var variantAudioGroup = variant.attributes && variant.attributes.AUDIO; - - if (variantAudioGroup === audioGroup && variant !== _this9.media()) { - variant.excludeUntil = Infinity; - } - }); - this.logger_("excluding audio group " + audioGroup + " as " + unsupportedAudio + " does not support codec(s): \"" + codecs.audio + "\""); - } // if we have any unsupported codecs blacklist this playlist. - - - if (Object.keys(unsupportedCodecs).length) { - var message = Object.keys(unsupportedCodecs).reduce(function (acc, supporter) { - if (acc) { - acc += ', '; - } - - acc += supporter + " does not support codec(s): \"" + unsupportedCodecs[supporter].join(',') + "\""; - return acc; - }, '') + '.'; - this.blacklistCurrentPlaylist({ - playlist: this.media(), - internal: true, - message: message, - blacklistDuration: Infinity - }); - return; - } // check if codec switching is happening - - - if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) { - var switchMessages = []; - ['video', 'audio'].forEach(function (type) { - var newCodec = (parseCodecs(_this9.sourceUpdater_.codecs[type] || '')[0] || {}).type; - var oldCodec = (parseCodecs(codecs[type] || '')[0] || {}).type; - - if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) { - switchMessages.push("\"" + _this9.sourceUpdater_.codecs[type] + "\" -> \"" + codecs[type] + "\""); - } - }); - - if (switchMessages.length) { - this.blacklistCurrentPlaylist({ - playlist: this.media(), - message: "Codec switching not supported: " + switchMessages.join(', ') + ".", - blacklistDuration: Infinity, - internal: true - }); - return; - } - } // TODO: when using the muxer shouldn't we just return - // the codecs that the muxer outputs? - - - return codecs; - } - /** - * Create source buffers and exlude any incompatible renditions. - * - * @private - */ - ; - - _proto.tryToCreateSourceBuffers_ = function tryToCreateSourceBuffers_() { - // media source is not ready yet or sourceBuffers are already - // created. - if (this.mediaSource.readyState !== 'open' || this.sourceUpdater_.hasCreatedSourceBuffers()) { - return; - } - - if (!this.areMediaTypesKnown_()) { - return; - } - - var codecs = this.getCodecsOrExclude_(); // no codecs means that the playlist was excluded - - if (!codecs) { - return; - } - - this.sourceUpdater_.createSourceBuffers(codecs); - var codecString = [codecs.video, codecs.audio].filter(Boolean).join(','); - this.excludeIncompatibleVariants_(codecString); - } - /** - * Excludes playlists with codecs that are unsupported by the muxer and browser. - */ - ; - - _proto.excludeUnsupportedVariants_ = function excludeUnsupportedVariants_() { - var _this10 = this; - - var playlists = this.master().playlists; - var ids = []; // TODO: why don't we have a property to loop through all - // playlist? Why did we ever mix indexes and keys? - - Object.keys(playlists).forEach(function (key) { - var variant = playlists[key]; // check if we already processed this playlist. - - if (ids.indexOf(variant.id) !== -1) { - return; - } - - ids.push(variant.id); - var codecs = codecsForPlaylist(_this10.master, variant); - var unsupported = []; - - if (codecs.audio && !muxerSupportsCodec(codecs.audio) && !browserSupportsCodec(codecs.audio)) { - unsupported.push("audio codec " + codecs.audio); - } - - if (codecs.video && !muxerSupportsCodec(codecs.video) && !browserSupportsCodec(codecs.video)) { - unsupported.push("video codec " + codecs.video); - } - - if (codecs.text && codecs.text === 'stpp.ttml.im1t') { - unsupported.push("text codec " + codecs.text); - } - - if (unsupported.length) { - variant.excludeUntil = Infinity; - - _this10.logger_("excluding " + variant.id + " for unsupported: " + unsupported.join(', ')); - } - }); - } - /** - * Blacklist playlists that are known to be codec or - * stream-incompatible with the SourceBuffer configuration. For - * instance, Media Source Extensions would cause the video element to - * stall waiting for video data if you switched from a variant with - * video and audio to an audio-only one. - * - * @param {Object} media a media playlist compatible with the current - * set of SourceBuffers. Variants in the current master playlist that - * do not appear to have compatible codec or stream configurations - * will be excluded from the default playlist selection algorithm - * indefinitely. - * @private - */ - ; - - _proto.excludeIncompatibleVariants_ = function excludeIncompatibleVariants_(codecString) { - var _this11 = this; - - var ids = []; - var playlists = this.master().playlists; - var codecs = unwrapCodecList(parseCodecs(codecString)); - var codecCount_ = codecCount(codecs); - var videoDetails = codecs.video && parseCodecs(codecs.video)[0] || null; - var audioDetails = codecs.audio && parseCodecs(codecs.audio)[0] || null; - Object.keys(playlists).forEach(function (key) { - var variant = playlists[key]; // check if we already processed this playlist. - // or it if it is already excluded forever. - - if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) { - return; - } - - ids.push(variant.id); - var blacklistReasons = []; // get codecs from the playlist for this variant - - var variantCodecs = codecsForPlaylist(_this11.masterPlaylistLoader_.master, variant); - var variantCodecCount = codecCount(variantCodecs); // if no codecs are listed, we cannot determine that this - // variant is incompatible. Wait for mux.js to probe - - if (!variantCodecs.audio && !variantCodecs.video) { - return; - } // TODO: we can support this by removing the - // old media source and creating a new one, but it will take some work. - // The number of streams cannot change - - - if (variantCodecCount !== codecCount_) { - blacklistReasons.push("codec count \"" + variantCodecCount + "\" !== \"" + codecCount_ + "\""); - } // only exclude playlists by codec change, if codecs cannot switch - // during playback. - - - if (!_this11.sourceUpdater_.canChangeType()) { - var variantVideoDetails = variantCodecs.video && parseCodecs(variantCodecs.video)[0] || null; - var variantAudioDetails = variantCodecs.audio && parseCodecs(variantCodecs.audio)[0] || null; // the video codec cannot change - - if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) { - blacklistReasons.push("video codec \"" + variantVideoDetails.type + "\" !== \"" + videoDetails.type + "\""); - } // the audio codec cannot change - - - if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) { - blacklistReasons.push("audio codec \"" + variantAudioDetails.type + "\" !== \"" + audioDetails.type + "\""); - } - } - - if (blacklistReasons.length) { - variant.excludeUntil = Infinity; - - _this11.logger_("blacklisting " + variant.id + ": " + blacklistReasons.join(' && ')); - } - }); - }; - - _proto.updateAdCues_ = function updateAdCues_(media) { - var offset = 0; - var seekable = this.seekable(); - - if (seekable.length) { - offset = seekable.start(0); - } - - updateAdCues(media, this.cueTagsTrack_, offset); - } - /** - * Calculates the desired forward buffer length based on current time - * - * @return {number} Desired forward buffer length in seconds - */ - ; - - _proto.goalBufferLength = function goalBufferLength() { - var currentTime = this.tech_.currentTime(); - var initial = Config.GOAL_BUFFER_LENGTH; - var rate = Config.GOAL_BUFFER_LENGTH_RATE; - var max = Math.max(initial, Config.MAX_GOAL_BUFFER_LENGTH); - return Math.min(initial + currentTime * rate, max); - } - /** - * Calculates the desired buffer low water line based on current time - * - * @return {number} Desired buffer low water line in seconds - */ - ; - - _proto.bufferLowWaterLine = function bufferLowWaterLine() { - var currentTime = this.tech_.currentTime(); - var initial = Config.BUFFER_LOW_WATER_LINE; - var rate = Config.BUFFER_LOW_WATER_LINE_RATE; - var max = Math.max(initial, Config.MAX_BUFFER_LOW_WATER_LINE); - var newMax = Math.max(initial, Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE); - return Math.min(initial + currentTime * rate, this.experimentalBufferBasedABR ? newMax : max); - }; - - _proto.bufferHighWaterLine = function bufferHighWaterLine() { - return Config.BUFFER_HIGH_WATER_LINE; - }; - - return MasterPlaylistController; - }(videojs__default['default'].EventTarget); - - /** - * Returns a function that acts as the Enable/disable playlist function. - * - * @param {PlaylistLoader} loader - The master playlist loader - * @param {string} playlistID - id of the playlist - * @param {Function} changePlaylistFn - A function to be called after a - * playlist's enabled-state has been changed. Will NOT be called if a - * playlist's enabled-state is unchanged - * @param {boolean=} enable - Value to set the playlist enabled-state to - * or if undefined returns the current enabled-state for the playlist - * @return {Function} Function for setting/getting enabled - */ - - var enableFunction = function enableFunction(loader, playlistID, changePlaylistFn) { - return function (enable) { - var playlist = loader.master.playlists[playlistID]; - var incompatible = isIncompatible(playlist); - var currentlyEnabled = isEnabled(playlist); - - if (typeof enable === 'undefined') { - return currentlyEnabled; - } - - if (enable) { - delete playlist.disabled; - } else { - playlist.disabled = true; - } - - if (enable !== currentlyEnabled && !incompatible) { - // Ensure the outside world knows about our changes - changePlaylistFn(); - - if (enable) { - loader.trigger('renditionenabled'); - } else { - loader.trigger('renditiondisabled'); - } - } - - return enable; - }; - }; - /** - * The representation object encapsulates the publicly visible information - * in a media playlist along with a setter/getter-type function (enabled) - * for changing the enabled-state of a particular playlist entry - * - * @class Representation - */ - - - var Representation = function Representation(vhsHandler, playlist, id) { - var mpc = vhsHandler.masterPlaylistController_, - smoothQualityChange = vhsHandler.options_.smoothQualityChange; // Get a reference to a bound version of the quality change function - - var changeType = smoothQualityChange ? 'smooth' : 'fast'; - var qualityChangeFunction = mpc[changeType + "QualityChange_"].bind(mpc); // some playlist attributes are optional - - if (playlist.attributes) { - var resolution = playlist.attributes.RESOLUTION; - this.width = resolution && resolution.width; - this.height = resolution && resolution.height; - this.bandwidth = playlist.attributes.BANDWIDTH; - } - - this.codecs = codecsForPlaylist(mpc.master(), playlist); - this.playlist = playlist; // The id is simply the ordinality of the media playlist - // within the master playlist - - this.id = id; // Partially-apply the enableFunction to create a playlist- - // specific variant - - this.enabled = enableFunction(vhsHandler.playlists, playlist.id, qualityChangeFunction); - }; - /** - * A mixin function that adds the `representations` api to an instance - * of the VhsHandler class - * - * @param {VhsHandler} vhsHandler - An instance of VhsHandler to add the - * representation API into - */ - - - var renditionSelectionMixin = function renditionSelectionMixin(vhsHandler) { - // Add a single API-specific function to the VhsHandler instance - vhsHandler.representations = function () { - var master = vhsHandler.masterPlaylistController_.master(); - var playlists = isAudioOnly(master) ? vhsHandler.masterPlaylistController_.getAudioTrackPlaylists_() : master.playlists; - - if (!playlists) { - return []; - } - - return playlists.filter(function (media) { - return !isIncompatible(media); - }).map(function (e, i) { - return new Representation(vhsHandler, e, e.id); - }); - }; - }; - - /** - * @file playback-watcher.js - * - * Playback starts, and now my watch begins. It shall not end until my death. I shall - * take no wait, hold no uncleared timeouts, father no bad seeks. I shall wear no crowns - * and win no glory. I shall live and die at my post. I am the corrector of the underflow. - * I am the watcher of gaps. I am the shield that guards the realms of seekable. I pledge - * my life and honor to the Playback Watch, for this Player and all the Players to come. - */ - - var timerCancelEvents = ['seeking', 'seeked', 'pause', 'playing', 'error']; - /** - * Returns whether or not the current time should be considered close to buffered content, - * taking into consideration whether there's enough buffered content for proper playback. - * - * @param {Object} options - * Options object - * @param {TimeRange} options.buffered - * Current buffer - * @param {number} options.targetDuration - * The active playlist's target duration - * @param {number} options.currentTime - * The current time of the player - * @return {boolean} - * Whether the current time should be considered close to the buffer - */ - - var closeToBufferedContent = function closeToBufferedContent(_ref) { - var buffered = _ref.buffered, - targetDuration = _ref.targetDuration, - currentTime = _ref.currentTime; - - if (!buffered.length) { - return false; - } // At least two to three segments worth of content should be buffered before there's a - // full enough buffer to consider taking any actions. - - - if (buffered.end(0) - buffered.start(0) < targetDuration * 2) { - return false; - } // It's possible that, on seek, a remove hasn't completed and the buffered range is - // somewhere past the current time. In that event, don't consider the buffered content - // close. - - - if (currentTime > buffered.start(0)) { - return false; - } // Since target duration generally represents the max (or close to max) duration of a - // segment, if the buffer is within a segment of the current time, the gap probably - // won't be closed, and current time should be considered close to buffered content. - - - return buffered.start(0) - currentTime < targetDuration; - }; - /** - * @class PlaybackWatcher - */ - - var PlaybackWatcher = /*#__PURE__*/function () { - /** - * Represents an PlaybackWatcher object. - * - * @class - * @param {Object} options an object that includes the tech and settings - */ - function PlaybackWatcher(options) { - var _this = this; - - this.masterPlaylistController_ = options.masterPlaylistController; - this.tech_ = options.tech; - this.seekable = options.seekable; - this.allowSeeksWithinUnsafeLiveWindow = options.allowSeeksWithinUnsafeLiveWindow; - this.liveRangeSafeTimeDelta = options.liveRangeSafeTimeDelta; - this.media = options.media; - this.consecutiveUpdates = 0; - this.lastRecordedTime = null; - this.timer_ = null; - this.checkCurrentTimeTimeout_ = null; - this.logger_ = logger('PlaybackWatcher'); - this.logger_('initialize'); - - var playHandler = function playHandler() { - return _this.monitorCurrentTime_(); - }; - - var canPlayHandler = function canPlayHandler() { - return _this.monitorCurrentTime_(); - }; - - var waitingHandler = function waitingHandler() { - return _this.techWaiting_(); - }; - - var cancelTimerHandler = function cancelTimerHandler() { - return _this.cancelTimer_(); - }; - - var fixesBadSeeksHandler = function fixesBadSeeksHandler() { - return _this.fixesBadSeeks_(); - }; - - var mpc = this.masterPlaylistController_; - var loaderTypes = ['main', 'subtitle', 'audio']; - var loaderChecks = {}; - loaderTypes.forEach(function (type) { - loaderChecks[type] = { - reset: function reset() { - return _this.resetSegmentDownloads_(type); - }, - updateend: function updateend() { - return _this.checkSegmentDownloads_(type); - } - }; - mpc[type + "SegmentLoader_"].on('appendsdone', loaderChecks[type].updateend); // If a rendition switch happens during a playback stall where the buffer - // isn't changing we want to reset. We cannot assume that the new rendition - // will also be stalled, until after new appends. - - mpc[type + "SegmentLoader_"].on('playlistupdate', loaderChecks[type].reset); // Playback stalls should not be detected right after seeking. - // This prevents one segment playlists (single vtt or single segment content) - // from being detected as stalling. As the buffer will not change in those cases, since - // the buffer is the entire video duration. - - _this.tech_.on(['seeked', 'seeking'], loaderChecks[type].reset); - }); - this.tech_.on('seekablechanged', fixesBadSeeksHandler); - this.tech_.on('waiting', waitingHandler); - this.tech_.on(timerCancelEvents, cancelTimerHandler); - this.tech_.on('canplay', canPlayHandler); - /* - An edge case exists that results in gaps not being skipped when they exist at the beginning of a stream. This case - is surfaced in one of two ways: - 1) The `waiting` event is fired before the player has buffered content, making it impossible - to find or skip the gap. The `waiting` event is followed by a `play` event. On first play - we can check if playback is stalled due to a gap, and skip the gap if necessary. - 2) A source with a gap at the beginning of the stream is loaded programatically while the player - is in a playing state. To catch this case, it's important that our one-time play listener is setup - even if the player is in a playing state - */ - - this.tech_.one('play', playHandler); // Define the dispose function to clean up our events - - this.dispose = function () { - _this.logger_('dispose'); - - _this.tech_.off('seekablechanged', fixesBadSeeksHandler); - - _this.tech_.off('waiting', waitingHandler); - - _this.tech_.off(timerCancelEvents, cancelTimerHandler); - - _this.tech_.off('canplay', canPlayHandler); - - _this.tech_.off('play', playHandler); - - loaderTypes.forEach(function (type) { - mpc[type + "SegmentLoader_"].off('appendsdone', loaderChecks[type].updateend); - mpc[type + "SegmentLoader_"].off('playlistupdate', loaderChecks[type].reset); - - _this.tech_.off(['seeked', 'seeking'], loaderChecks[type].reset); - }); - - if (_this.checkCurrentTimeTimeout_) { - window__default['default'].clearTimeout(_this.checkCurrentTimeTimeout_); - } - - _this.cancelTimer_(); - }; - } - /** - * Periodically check current time to see if playback stopped - * - * @private - */ - - - var _proto = PlaybackWatcher.prototype; - - _proto.monitorCurrentTime_ = function monitorCurrentTime_() { - this.checkCurrentTime_(); - - if (this.checkCurrentTimeTimeout_) { - window__default['default'].clearTimeout(this.checkCurrentTimeTimeout_); - } // 42 = 24 fps // 250 is what Webkit uses // FF uses 15 - - - this.checkCurrentTimeTimeout_ = window__default['default'].setTimeout(this.monitorCurrentTime_.bind(this), 250); - } - /** - * Reset stalled download stats for a specific type of loader - * - * @param {string} type - * The segment loader type to check. - * - * @listens SegmentLoader#playlistupdate - * @listens Tech#seeking - * @listens Tech#seeked - */ - ; - - _proto.resetSegmentDownloads_ = function resetSegmentDownloads_(type) { - var loader = this.masterPlaylistController_[type + "SegmentLoader_"]; - - if (this[type + "StalledDownloads_"] > 0) { - this.logger_("resetting possible stalled download count for " + type + " loader"); - } - - this[type + "StalledDownloads_"] = 0; - this[type + "Buffered_"] = loader.buffered_(); - } - /** - * Checks on every segment `appendsdone` to see - * if segment appends are making progress. If they are not - * and we are still downloading bytes. We blacklist the playlist. - * - * @param {string} type - * The segment loader type to check. - * - * @listens SegmentLoader#appendsdone - */ - ; - - _proto.checkSegmentDownloads_ = function checkSegmentDownloads_(type) { - var mpc = this.masterPlaylistController_; - var loader = mpc[type + "SegmentLoader_"]; - var buffered = loader.buffered_(); - var isBufferedDifferent = isRangeDifferent(this[type + "Buffered_"], buffered); - this[type + "Buffered_"] = buffered; // if another watcher is going to fix the issue or - // the buffered value for this loader changed - // appends are working - - if (isBufferedDifferent) { - this.resetSegmentDownloads_(type); - return; - } - - this[type + "StalledDownloads_"]++; - this.logger_("found #" + this[type + "StalledDownloads_"] + " " + type + " appends that did not increase buffer (possible stalled download)", { - playlistId: loader.playlist_ && loader.playlist_.id, - buffered: timeRangesToArray(buffered) - }); // after 10 possibly stalled appends with no reset, exclude - - if (this[type + "StalledDownloads_"] < 10) { - return; - } - - this.logger_(type + " loader stalled download exclusion"); - this.resetSegmentDownloads_(type); - this.tech_.trigger({ - type: 'usage', - name: "vhs-" + type + "-download-exclusion" - }); - - if (type === 'subtitle') { - return; - } // TODO: should we exclude audio tracks rather than main tracks - // when type is audio? - - - mpc.blacklistCurrentPlaylist({ - message: "Excessive " + type + " segment downloading detected." - }, Infinity); - } - /** - * The purpose of this function is to emulate the "waiting" event on - * browsers that do not emit it when they are waiting for more - * data to continue playback - * - * @private - */ - ; - - _proto.checkCurrentTime_ = function checkCurrentTime_() { - if (this.tech_.seeking() && this.fixesBadSeeks_()) { - this.consecutiveUpdates = 0; - this.lastRecordedTime = this.tech_.currentTime(); - return; - } - - if (this.tech_.paused() || this.tech_.seeking()) { - return; - } - - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - - if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA >= buffered.end(buffered.length - 1))) { - // If current time is at the end of the final buffered region, then any playback - // stall is most likely caused by buffering in a low bandwidth environment. The tech - // should fire a `waiting` event in this scenario, but due to browser and tech - // inconsistencies. Calling `techWaiting_` here allows us to simulate - // responding to a native `waiting` event when the tech fails to emit one. - return this.techWaiting_(); - } - - if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) { - this.consecutiveUpdates++; - this.waiting_(); - } else if (currentTime === this.lastRecordedTime) { - this.consecutiveUpdates++; - } else { - this.consecutiveUpdates = 0; - this.lastRecordedTime = currentTime; - } - } - /** - * Cancels any pending timers and resets the 'timeupdate' mechanism - * designed to detect that we are stalled - * - * @private - */ - ; - - _proto.cancelTimer_ = function cancelTimer_() { - this.consecutiveUpdates = 0; - - if (this.timer_) { - this.logger_('cancelTimer_'); - clearTimeout(this.timer_); - } - - this.timer_ = null; - } - /** - * Fixes situations where there's a bad seek - * - * @return {boolean} whether an action was taken to fix the seek - * @private - */ - ; - - _proto.fixesBadSeeks_ = function fixesBadSeeks_() { - var seeking = this.tech_.seeking(); - - if (!seeking) { - return false; - } - - var seekable = this.seekable(); - var currentTime = this.tech_.currentTime(); - var isAfterSeekableRange = this.afterSeekableWindow_(seekable, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow); - var seekTo; - - if (isAfterSeekableRange) { - var seekableEnd = seekable.end(seekable.length - 1); // sync to live point (if VOD, our seekable was updated and we're simply adjusting) - - seekTo = seekableEnd; - } - - if (this.beforeSeekableWindow_(seekable, currentTime)) { - var seekableStart = seekable.start(0); // sync to the beginning of the live window - // provide a buffer of .1 seconds to handle rounding/imprecise numbers - - seekTo = seekableStart + ( // if the playlist is too short and the seekable range is an exact time (can - // happen in live with a 3 segment playlist), then don't use a time delta - seekableStart === seekable.end(0) ? 0 : SAFE_TIME_DELTA); - } - - if (typeof seekTo !== 'undefined') { - this.logger_("Trying to seek outside of seekable at time " + currentTime + " with " + ("seekable range " + printableRange(seekable) + ". Seeking to ") + (seekTo + ".")); - this.tech_.setCurrentTime(seekTo); - return true; - } - - var buffered = this.tech_.buffered(); - - if (closeToBufferedContent({ - buffered: buffered, - targetDuration: this.media().targetDuration, - currentTime: currentTime - })) { - seekTo = buffered.start(0) + SAFE_TIME_DELTA; - this.logger_("Buffered region starts (" + buffered.start(0) + ") " + (" just beyond seek point (" + currentTime + "). Seeking to " + seekTo + ".")); - this.tech_.setCurrentTime(seekTo); - return true; - } - - return false; - } - /** - * Handler for situations when we determine the player is waiting. - * - * @private - */ - ; - - _proto.waiting_ = function waiting_() { - if (this.techWaiting_()) { - return; - } // All tech waiting checks failed. Use last resort correction - - - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - var currentRange = findRange(buffered, currentTime); // Sometimes the player can stall for unknown reasons within a contiguous buffered - // region with no indication that anything is amiss (seen in Firefox). Seeking to - // currentTime is usually enough to kickstart the player. This checks that the player - // is currently within a buffered region before attempting a corrective seek. - // Chrome does not appear to continue `timeupdate` events after a `waiting` event - // until there is ~ 3 seconds of forward buffer available. PlaybackWatcher should also - // make sure there is ~3 seconds of forward buffer before taking any corrective action - // to avoid triggering an `unknownwaiting` event when the network is slow. - - if (currentRange.length && currentTime + 3 <= currentRange.end(0)) { - this.cancelTimer_(); - this.tech_.setCurrentTime(currentTime); - this.logger_("Stopped at " + currentTime + " while inside a buffered region " + ("[" + currentRange.start(0) + " -> " + currentRange.end(0) + "]. Attempting to resume ") + 'playback by seeking to the current time.'); // unknown waiting corrections may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-unknown-waiting' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-unknown-waiting' - }); - return; - } - } - /** - * Handler for situations when the tech fires a `waiting` event - * - * @return {boolean} - * True if an action (or none) was needed to correct the waiting. False if no - * checks passed - * @private - */ - ; - - _proto.techWaiting_ = function techWaiting_() { - var seekable = this.seekable(); - var currentTime = this.tech_.currentTime(); - - if (this.tech_.seeking() && this.fixesBadSeeks_()) { - // Tech is seeking or bad seek fixed, no action needed - return true; - } - - if (this.tech_.seeking() || this.timer_ !== null) { - // Tech is seeking or already waiting on another action, no action needed - return true; - } - - if (this.beforeSeekableWindow_(seekable, currentTime)) { - var livePoint = seekable.end(seekable.length - 1); - this.logger_("Fell out of live window at time " + currentTime + ". Seeking to " + ("live point (seekable end) " + livePoint)); - this.cancelTimer_(); - this.tech_.setCurrentTime(livePoint); // live window resyncs may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-live-resync' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-live-resync' - }); - return true; - } - - var sourceUpdater = this.tech_.vhs.masterPlaylistController_.sourceUpdater_; - var buffered = this.tech_.buffered(); - var videoUnderflow = this.videoUnderflow_({ - audioBuffered: sourceUpdater.audioBuffered(), - videoBuffered: sourceUpdater.videoBuffered(), - currentTime: currentTime - }); - - if (videoUnderflow) { - // Even though the video underflowed and was stuck in a gap, the audio overplayed - // the gap, leading currentTime into a buffered range. Seeking to currentTime - // allows the video to catch up to the audio position without losing any audio - // (only suffering ~3 seconds of frozen video and a pause in audio playback). - this.cancelTimer_(); - this.tech_.setCurrentTime(currentTime); // video underflow may be useful for monitoring QoS - - this.tech_.trigger({ - type: 'usage', - name: 'vhs-video-underflow' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-video-underflow' - }); - return true; - } - - var nextRange = findNextRange(buffered, currentTime); // check for gap - - if (nextRange.length > 0) { - var difference = nextRange.start(0) - currentTime; - this.logger_("Stopped at " + currentTime + ", setting timer for " + difference + ", seeking " + ("to " + nextRange.start(0))); - this.cancelTimer_(); - this.timer_ = setTimeout(this.skipTheGap_.bind(this), difference * 1000, currentTime); - return true; - } // All checks failed. Returning false to indicate failure to correct waiting - - - return false; - }; - - _proto.afterSeekableWindow_ = function afterSeekableWindow_(seekable, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow) { - if (allowSeeksWithinUnsafeLiveWindow === void 0) { - allowSeeksWithinUnsafeLiveWindow = false; - } - - if (!seekable.length) { - // we can't make a solid case if there's no seekable, default to false - return false; - } - - var allowedEnd = seekable.end(seekable.length - 1) + SAFE_TIME_DELTA; - var isLive = !playlist.endList; - - if (isLive && allowSeeksWithinUnsafeLiveWindow) { - allowedEnd = seekable.end(seekable.length - 1) + playlist.targetDuration * 3; - } - - if (currentTime > allowedEnd) { - return true; - } - - return false; - }; - - _proto.beforeSeekableWindow_ = function beforeSeekableWindow_(seekable, currentTime) { - if (seekable.length && // can't fall before 0 and 0 seekable start identifies VOD stream - seekable.start(0) > 0 && currentTime < seekable.start(0) - this.liveRangeSafeTimeDelta) { - return true; - } - - return false; - }; - - _proto.videoUnderflow_ = function videoUnderflow_(_ref2) { - var videoBuffered = _ref2.videoBuffered, - audioBuffered = _ref2.audioBuffered, - currentTime = _ref2.currentTime; - - // audio only content will not have video underflow :) - if (!videoBuffered) { - return; - } - - var gap; // find a gap in demuxed content. - - if (videoBuffered.length && audioBuffered.length) { - // in Chrome audio will continue to play for ~3s when we run out of video - // so we have to check that the video buffer did have some buffer in the - // past. - var lastVideoRange = findRange(videoBuffered, currentTime - 3); - var videoRange = findRange(videoBuffered, currentTime); - var audioRange = findRange(audioBuffered, currentTime); - - if (audioRange.length && !videoRange.length && lastVideoRange.length) { - gap = { - start: lastVideoRange.end(0), - end: audioRange.end(0) - }; - } // find a gap in muxed content. - - } else { - var nextRange = findNextRange(videoBuffered, currentTime); // Even if there is no available next range, there is still a possibility we are - // stuck in a gap due to video underflow. - - if (!nextRange.length) { - gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime); - } - } - - if (gap) { - this.logger_("Encountered a gap in video from " + gap.start + " to " + gap.end + ". " + ("Seeking to current time " + currentTime)); - return true; - } - - return false; - } - /** - * Timer callback. If playback still has not proceeded, then we seek - * to the start of the next buffered region. - * - * @private - */ - ; - - _proto.skipTheGap_ = function skipTheGap_(scheduledCurrentTime) { - var buffered = this.tech_.buffered(); - var currentTime = this.tech_.currentTime(); - var nextRange = findNextRange(buffered, currentTime); - this.cancelTimer_(); - - if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) { - return; - } - - this.logger_('skipTheGap_:', 'currentTime:', currentTime, 'scheduled currentTime:', scheduledCurrentTime, 'nextRange start:', nextRange.start(0)); // only seek if we still have not played - - this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR); - this.tech_.trigger({ - type: 'usage', - name: 'vhs-gap-skip' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-gap-skip' - }); - }; - - _proto.gapFromVideoUnderflow_ = function gapFromVideoUnderflow_(buffered, currentTime) { - // At least in Chrome, if there is a gap in the video buffer, the audio will continue - // playing for ~3 seconds after the video gap starts. This is done to account for - // video buffer underflow/underrun (note that this is not done when there is audio - // buffer underflow/underrun -- in that case the video will stop as soon as it - // encounters the gap, as audio stalls are more noticeable/jarring to a user than - // video stalls). The player's time will reflect the playthrough of audio, so the - // time will appear as if we are in a buffered region, even if we are stuck in a - // "gap." - // - // Example: - // video buffer: 0 => 10.1, 10.2 => 20 - // audio buffer: 0 => 20 - // overall buffer: 0 => 10.1, 10.2 => 20 - // current time: 13 - // - // Chrome's video froze at 10 seconds, where the video buffer encountered the gap, - // however, the audio continued playing until it reached ~3 seconds past the gap - // (13 seconds), at which point it stops as well. Since current time is past the - // gap, findNextRange will return no ranges. - // - // To check for this issue, we see if there is a gap that starts somewhere within - // a 3 second range (3 seconds +/- 1 second) back from our current time. - var gaps = findGaps(buffered); - - for (var i = 0; i < gaps.length; i++) { - var start = gaps.start(i); - var end = gaps.end(i); // gap is starts no more than 4 seconds back - - if (currentTime - start < 4 && currentTime - start > 2) { - return { - start: start, - end: end - }; - } - } - - return null; - }; - - return PlaybackWatcher; - }(); - - var defaultOptions = { - errorInterval: 30, - getSource: function getSource(next) { - var tech = this.tech({ - IWillNotUseThisInPlugins: true - }); - var sourceObj = tech.currentSource_ || this.currentSource(); - return next(sourceObj); - } - }; - /** - * Main entry point for the plugin - * - * @param {Player} player a reference to a videojs Player instance - * @param {Object} [options] an object with plugin options - * @private - */ - - var initPlugin = function initPlugin(player, options) { - var lastCalled = 0; - var seekTo = 0; - var localOptions = videojs__default['default'].mergeOptions(defaultOptions, options); - player.ready(function () { - player.trigger({ - type: 'usage', - name: 'vhs-error-reload-initialized' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload-initialized' - }); - }); - /** - * Player modifications to perform that must wait until `loadedmetadata` - * has been triggered - * - * @private - */ - - var loadedMetadataHandler = function loadedMetadataHandler() { - if (seekTo) { - player.currentTime(seekTo); - } - }; - /** - * Set the source on the player element, play, and seek if necessary - * - * @param {Object} sourceObj An object specifying the source url and mime-type to play - * @private - */ - - - var setSource = function setSource(sourceObj) { - if (sourceObj === null || sourceObj === undefined) { - return; - } - - seekTo = player.duration() !== Infinity && player.currentTime() || 0; - player.one('loadedmetadata', loadedMetadataHandler); - player.src(sourceObj); - player.trigger({ - type: 'usage', - name: 'vhs-error-reload' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload' - }); - player.play(); - }; - /** - * Attempt to get a source from either the built-in getSource function - * or a custom function provided via the options - * - * @private - */ - - - var errorHandler = function errorHandler() { - // Do not attempt to reload the source if a source-reload occurred before - // 'errorInterval' time has elapsed since the last source-reload - if (Date.now() - lastCalled < localOptions.errorInterval * 1000) { - player.trigger({ - type: 'usage', - name: 'vhs-error-reload-canceled' - }); - player.trigger({ - type: 'usage', - name: 'hls-error-reload-canceled' - }); - return; - } - - if (!localOptions.getSource || typeof localOptions.getSource !== 'function') { - videojs__default['default'].log.error('ERROR: reloadSourceOnError - The option getSource must be a function!'); - return; - } - - lastCalled = Date.now(); - return localOptions.getSource.call(player, setSource); - }; - /** - * Unbind any event handlers that were bound by the plugin - * - * @private - */ - - - var cleanupEvents = function cleanupEvents() { - player.off('loadedmetadata', loadedMetadataHandler); - player.off('error', errorHandler); - player.off('dispose', cleanupEvents); - }; - /** - * Cleanup before re-initializing the plugin - * - * @param {Object} [newOptions] an object with plugin options - * @private - */ - - - var reinitPlugin = function reinitPlugin(newOptions) { - cleanupEvents(); - initPlugin(player, newOptions); - }; - - player.on('error', errorHandler); - player.on('dispose', cleanupEvents); // Overwrite the plugin function so that we can correctly cleanup before - // initializing the plugin - - player.reloadSourceOnError = reinitPlugin; - }; - /** - * Reload the source when an error is detected as long as there - * wasn't an error previously within the last 30 seconds - * - * @param {Object} [options] an object with plugin options - */ - - - var reloadSourceOnError = function reloadSourceOnError(options) { - initPlugin(this, options); - }; - - var version$4 = "2.9.1"; - - var version$3 = "5.11.1"; - - var version$2 = "0.17.0"; - - var version$1 = "4.7.0"; - - var version = "3.1.2"; - - var Vhs = { - PlaylistLoader: PlaylistLoader, - Playlist: Playlist, - utils: utils, - STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector, - INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector, - lastBandwidthSelector: lastBandwidthSelector, - movingAverageBandwidthSelector: movingAverageBandwidthSelector, - comparePlaylistBandwidth: comparePlaylistBandwidth, - comparePlaylistResolution: comparePlaylistResolution, - xhr: xhrFactory() - }; // Define getter/setters for config properties - - Object.keys(Config).forEach(function (prop) { - Object.defineProperty(Vhs, prop, { - get: function get() { - videojs__default['default'].log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing"); - return Config[prop]; - }, - set: function set(value) { - videojs__default['default'].log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing"); - - if (typeof value !== 'number' || value < 0) { - videojs__default['default'].log.warn("value of Vhs." + prop + " must be greater than or equal to 0"); - return; - } - - Config[prop] = value; - } - }); - }); - var LOCAL_STORAGE_KEY = 'videojs-vhs'; - /** - * Updates the selectedIndex of the QualityLevelList when a mediachange happens in vhs. - * - * @param {QualityLevelList} qualityLevels The QualityLevelList to update. - * @param {PlaylistLoader} playlistLoader PlaylistLoader containing the new media info. - * @function handleVhsMediaChange - */ - - var handleVhsMediaChange = function handleVhsMediaChange(qualityLevels, playlistLoader) { - var newPlaylist = playlistLoader.media(); - var selectedIndex = -1; - - for (var i = 0; i < qualityLevels.length; i++) { - if (qualityLevels[i].id === newPlaylist.id) { - selectedIndex = i; - break; - } - } - - qualityLevels.selectedIndex_ = selectedIndex; - qualityLevels.trigger({ - selectedIndex: selectedIndex, - type: 'change' - }); - }; - /** - * Adds quality levels to list once playlist metadata is available - * - * @param {QualityLevelList} qualityLevels The QualityLevelList to attach events to. - * @param {Object} vhs Vhs object to listen to for media events. - * @function handleVhsLoadedMetadata - */ - - - var handleVhsLoadedMetadata = function handleVhsLoadedMetadata(qualityLevels, vhs) { - vhs.representations().forEach(function (rep) { - qualityLevels.addQualityLevel(rep); - }); - handleVhsMediaChange(qualityLevels, vhs.playlists); - }; // HLS is a source handler, not a tech. Make sure attempts to use it - // as one do not cause exceptions. - - - Vhs.canPlaySource = function () { - return videojs__default['default'].log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\'s techOrder.'); - }; - - var emeKeySystems = function emeKeySystems(keySystemOptions, mainPlaylist, audioPlaylist) { - if (!keySystemOptions) { - return keySystemOptions; - } - - var codecs = {}; - - if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) { - codecs = unwrapCodecList(parseCodecs(mainPlaylist.attributes.CODECS)); - } - - if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) { - codecs.audio = audioPlaylist.attributes.CODECS; - } - - var videoContentType = getMimeForCodec(codecs.video); - var audioContentType = getMimeForCodec(codecs.audio); // upsert the content types based on the selected playlist - - var keySystemContentTypes = {}; - - for (var keySystem in keySystemOptions) { - keySystemContentTypes[keySystem] = {}; - - if (audioContentType) { - keySystemContentTypes[keySystem].audioContentType = audioContentType; - } - - if (videoContentType) { - keySystemContentTypes[keySystem].videoContentType = videoContentType; - } // Default to using the video playlist's PSSH even though they may be different, as - // videojs-contrib-eme will only accept one in the options. - // - // This shouldn't be an issue for most cases as early intialization will handle all - // unique PSSH values, and if they aren't, then encrypted events should have the - // specific information needed for the unique license. - - - if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) { - keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh; - } // videojs-contrib-eme accepts the option of specifying: 'com.some.cdm': 'url' - // so we need to prevent overwriting the URL entirely - - - if (typeof keySystemOptions[keySystem] === 'string') { - keySystemContentTypes[keySystem].url = keySystemOptions[keySystem]; - } - } - - return videojs__default['default'].mergeOptions(keySystemOptions, keySystemContentTypes); - }; - /** - * @typedef {Object} KeySystems - * - * keySystems configuration for https://github.com/videojs/videojs-contrib-eme - * Note: not all options are listed here. - * - * @property {Uint8Array} [pssh] - * Protection System Specific Header - */ - - /** - * Goes through all the playlists and collects an array of KeySystems options objects - * containing each playlist's keySystems and their pssh values, if available. - * - * @param {Object[]} playlists - * The playlists to look through - * @param {string[]} keySystems - * The keySystems to collect pssh values for - * - * @return {KeySystems[]} - * An array of KeySystems objects containing available key systems and their - * pssh values - */ - - - var getAllPsshKeySystemsOptions = function getAllPsshKeySystemsOptions(playlists, keySystems) { - return playlists.reduce(function (keySystemsArr, playlist) { - if (!playlist.contentProtection) { - return keySystemsArr; - } - - var keySystemsOptions = keySystems.reduce(function (keySystemsObj, keySystem) { - var keySystemOptions = playlist.contentProtection[keySystem]; - - if (keySystemOptions && keySystemOptions.pssh) { - keySystemsObj[keySystem] = { - pssh: keySystemOptions.pssh - }; - } - - return keySystemsObj; - }, {}); - - if (Object.keys(keySystemsOptions).length) { - keySystemsArr.push(keySystemsOptions); - } - - return keySystemsArr; - }, []); - }; - /** - * Returns a promise that waits for the - * [eme plugin](https://github.com/videojs/videojs-contrib-eme) to create a key session. - * - * Works around https://bugs.chromium.org/p/chromium/issues/detail?id=895449 in non-IE11 - * browsers. - * - * As per the above ticket, this is particularly important for Chrome, where, if - * unencrypted content is appended before encrypted content and the key session has not - * been created, a MEDIA_ERR_DECODE will be thrown once the encrypted content is reached - * during playback. - * - * @param {Object} player - * The player instance - * @param {Object[]} sourceKeySystems - * The key systems options from the player source - * @param {Object} [audioMedia] - * The active audio media playlist (optional) - * @param {Object[]} mainPlaylists - * The playlists found on the master playlist object - * - * @return {Object} - * Promise that resolves when the key session has been created - */ - - - var waitForKeySessionCreation = function waitForKeySessionCreation(_ref) { - var player = _ref.player, - sourceKeySystems = _ref.sourceKeySystems, - audioMedia = _ref.audioMedia, - mainPlaylists = _ref.mainPlaylists; - - if (!player.eme.initializeMediaKeys) { - return Promise.resolve(); - } // TODO should all audio PSSH values be initialized for DRM? - // - // All unique video rendition pssh values are initialized for DRM, but here only - // the initial audio playlist license is initialized. In theory, an encrypted - // event should be fired if the user switches to an alternative audio playlist - // where a license is required, but this case hasn't yet been tested. In addition, there - // may be many alternate audio playlists unlikely to be used (e.g., multiple different - // languages). - - - var playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists; - var keySystemsOptionsArr = getAllPsshKeySystemsOptions(playlists, Object.keys(sourceKeySystems)); - var initializationFinishedPromises = []; - var keySessionCreatedPromises = []; // Since PSSH values are interpreted as initData, EME will dedupe any duplicates. The - // only place where it should not be deduped is for ms-prefixed APIs, but the early - // return for IE11 above, and the existence of modern EME APIs in addition to - // ms-prefixed APIs on Edge should prevent this from being a concern. - // initializeMediaKeys also won't use the webkit-prefixed APIs. - - keySystemsOptionsArr.forEach(function (keySystemsOptions) { - keySessionCreatedPromises.push(new Promise(function (resolve, reject) { - player.tech_.one('keysessioncreated', resolve); - })); - initializationFinishedPromises.push(new Promise(function (resolve, reject) { - player.eme.initializeMediaKeys({ - keySystems: keySystemsOptions - }, function (err) { - if (err) { - reject(err); - return; - } - - resolve(); - }); - })); - }); // The reasons Promise.race is chosen over Promise.any: - // - // * Promise.any is only available in Safari 14+. - // * None of these promises are expected to reject. If they do reject, it might be - // better here for the race to surface the rejection, rather than mask it by using - // Promise.any. - - return Promise.race([// If a session was previously created, these will all finish resolving without - // creating a new session, otherwise it will take until the end of all license - // requests, which is why the key session check is used (to make setup much faster). - Promise.all(initializationFinishedPromises), // Once a single session is created, the browser knows DRM will be used. - Promise.race(keySessionCreatedPromises)]); - }; - /** - * If the [eme](https://github.com/videojs/videojs-contrib-eme) plugin is available, and - * there are keySystems on the source, sets up source options to prepare the source for - * eme. - * - * @param {Object} player - * The player instance - * @param {Object[]} sourceKeySystems - * The key systems options from the player source - * @param {Object} media - * The active media playlist - * @param {Object} [audioMedia] - * The active audio media playlist (optional) - * - * @return {boolean} - * Whether or not options were configured and EME is available - */ - - var setupEmeOptions = function setupEmeOptions(_ref2) { - var player = _ref2.player, - sourceKeySystems = _ref2.sourceKeySystems, - media = _ref2.media, - audioMedia = _ref2.audioMedia; - var sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia); - - if (!sourceOptions) { - return false; - } - - player.currentSource().keySystems = sourceOptions; // eme handles the rest of the setup, so if it is missing - // do nothing. - - if (sourceOptions && !player.eme) { - videojs__default['default'].log.warn('DRM encrypted source cannot be decrypted without a DRM plugin'); - return false; - } - - return true; - }; - - var getVhsLocalStorage = function getVhsLocalStorage() { - if (!window__default['default'].localStorage) { - return null; - } - - var storedObject = window__default['default'].localStorage.getItem(LOCAL_STORAGE_KEY); - - if (!storedObject) { - return null; - } - - try { - return JSON.parse(storedObject); - } catch (e) { - // someone may have tampered with the value - return null; - } - }; - - var updateVhsLocalStorage = function updateVhsLocalStorage(options) { - if (!window__default['default'].localStorage) { - return false; - } - - var objectToStore = getVhsLocalStorage(); - objectToStore = objectToStore ? videojs__default['default'].mergeOptions(objectToStore, options) : options; - - try { - window__default['default'].localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore)); - } catch (e) { - // Throws if storage is full (e.g., always on iOS 5+ Safari private mode, where - // storage is set to 0). - // https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#Exceptions - // No need to perform any operation. - return false; - } - - return objectToStore; - }; - /** - * Parses VHS-supported media types from data URIs. See - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs - * for information on data URIs. - * - * @param {string} dataUri - * The data URI - * - * @return {string|Object} - * The parsed object/string, or the original string if no supported media type - * was found - */ - - - var expandDataUri = function expandDataUri(dataUri) { - if (dataUri.toLowerCase().indexOf('data:application/vnd.videojs.vhs+json,') === 0) { - return JSON.parse(dataUri.substring(dataUri.indexOf(',') + 1)); - } // no known case for this data URI, return the string as-is - - - return dataUri; - }; - /** - * Whether the browser has built-in HLS support. - */ - - - Vhs.supportsNativeHls = function () { - if (!document__default['default'] || !document__default['default'].createElement) { - return false; - } - - var video = document__default['default'].createElement('video'); // native HLS is definitely not supported if HTML5 video isn't - - if (!videojs__default['default'].getTech('Html5').isSupported()) { - return false; - } // HLS manifests can go by many mime-types - - - var canPlay = [// Apple santioned - 'application/vnd.apple.mpegurl', // Apple sanctioned for backwards compatibility - 'audio/mpegurl', // Very common - 'audio/x-mpegurl', // Very common - 'application/x-mpegurl', // Included for completeness - 'video/x-mpegurl', 'video/mpegurl', 'application/mpegurl']; - return canPlay.some(function (canItPlay) { - return /maybe|probably/i.test(video.canPlayType(canItPlay)); - }); - }(); - - Vhs.supportsNativeDash = function () { - if (!document__default['default'] || !document__default['default'].createElement || !videojs__default['default'].getTech('Html5').isSupported()) { - return false; - } - - return /maybe|probably/i.test(document__default['default'].createElement('video').canPlayType('application/dash+xml')); - }(); - - Vhs.supportsTypeNatively = function (type) { - if (type === 'hls') { - return Vhs.supportsNativeHls; - } - - if (type === 'dash') { - return Vhs.supportsNativeDash; - } - - return false; - }; - /** - * HLS is a source handler, not a tech. Make sure attempts to use it - * as one do not cause exceptions. - */ - - - Vhs.isSupported = function () { - return videojs__default['default'].log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\'s techOrder.'); - }; - - var Component = videojs__default['default'].getComponent('Component'); - /** - * The Vhs Handler object, where we orchestrate all of the parts - * of HLS to interact with video.js - * - * @class VhsHandler - * @extends videojs.Component - * @param {Object} source the soruce object - * @param {Tech} tech the parent tech object - * @param {Object} options optional and required options - */ - - var VhsHandler = /*#__PURE__*/function (_Component) { - inheritsLoose(VhsHandler, _Component); - - function VhsHandler(source, tech, options) { - var _this; - - _this = _Component.call(this, tech, videojs__default['default'].mergeOptions(options.hls, options.vhs)) || this; - - if (options.hls && Object.keys(options.hls).length) { - videojs__default['default'].log.warn('Using hls options is deprecated. Use vhs instead.'); - } // if a tech level `initialBandwidth` option was passed - // use that over the VHS level `bandwidth` option - - - if (typeof options.initialBandwidth === 'number') { - _this.options_.bandwidth = options.initialBandwidth; - } - - _this.logger_ = logger('VhsHandler'); // tech.player() is deprecated but setup a reference to HLS for - // backwards-compatibility - - if (tech.options_ && tech.options_.playerId) { - var _player = videojs__default['default'](tech.options_.playerId); - - if (!_player.hasOwnProperty('hls')) { - Object.defineProperty(_player, 'hls', { - get: function get() { - videojs__default['default'].log.warn('player.hls is deprecated. Use player.tech().vhs instead.'); - tech.trigger({ - type: 'usage', - name: 'hls-player-access' - }); - return assertThisInitialized(_this); - }, - configurable: true - }); - } - - if (!_player.hasOwnProperty('vhs')) { - Object.defineProperty(_player, 'vhs', { - get: function get() { - videojs__default['default'].log.warn('player.vhs is deprecated. Use player.tech().vhs instead.'); - tech.trigger({ - type: 'usage', - name: 'vhs-player-access' - }); - return assertThisInitialized(_this); - }, - configurable: true - }); - } - - if (!_player.hasOwnProperty('dash')) { - Object.defineProperty(_player, 'dash', { - get: function get() { - videojs__default['default'].log.warn('player.dash is deprecated. Use player.tech().vhs instead.'); - return assertThisInitialized(_this); - }, - configurable: true - }); - } - - _this.player_ = _player; - } - - _this.tech_ = tech; - _this.source_ = source; - _this.stats = {}; - _this.ignoreNextSeekingEvent_ = false; - - _this.setOptions_(); - - if (_this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) { - tech.overrideNativeAudioTracks(true); - tech.overrideNativeVideoTracks(true); - } else if (_this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) { - // overriding native HLS only works if audio tracks have been emulated - // error early if we're misconfigured - throw new Error('Overriding native HLS requires emulated tracks. ' + 'See https://git.io/vMpjB'); - } // listen for fullscreenchange events for this player so that we - // can adjust our quality selection quickly - - - _this.on(document__default['default'], ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'], function (event) { - var fullscreenElement = document__default['default'].fullscreenElement || document__default['default'].webkitFullscreenElement || document__default['default'].mozFullScreenElement || document__default['default'].msFullscreenElement; - - if (fullscreenElement && fullscreenElement.contains(_this.tech_.el())) { - _this.masterPlaylistController_.fastQualityChange_(); - } else { - // When leaving fullscreen, since the in page pixel dimensions should be smaller - // than full screen, see if there should be a rendition switch down to preserve - // bandwidth. - _this.masterPlaylistController_.checkABR_(); - } - }); - - _this.on(_this.tech_, 'seeking', function () { - if (this.ignoreNextSeekingEvent_) { - this.ignoreNextSeekingEvent_ = false; - return; - } - - this.setCurrentTime(this.tech_.currentTime()); - }); - - _this.on(_this.tech_, 'error', function () { - // verify that the error was real and we are loaded - // enough to have mpc loaded. - if (this.tech_.error() && this.masterPlaylistController_) { - this.masterPlaylistController_.pauseLoading(); - } - }); - - _this.on(_this.tech_, 'play', _this.play); - - return _this; - } - - var _proto = VhsHandler.prototype; - - _proto.setOptions_ = function setOptions_() { - var _this2 = this; - - // defaults - this.options_.withCredentials = this.options_.withCredentials || false; - this.options_.handleManifestRedirects = this.options_.handleManifestRedirects === false ? false : true; - this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true; - this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false; - this.options_.smoothQualityChange = this.options_.smoothQualityChange || false; - this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== 'undefined' ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false; - this.options_.customTagParsers = this.options_.customTagParsers || []; - this.options_.customTagMappers = this.options_.customTagMappers || []; - this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false; - - if (typeof this.options_.blacklistDuration !== 'number') { - this.options_.blacklistDuration = 5 * 60; - } - - if (typeof this.options_.bandwidth !== 'number') { - if (this.options_.useBandwidthFromLocalStorage) { - var storedObject = getVhsLocalStorage(); - - if (storedObject && storedObject.bandwidth) { - this.options_.bandwidth = storedObject.bandwidth; - this.tech_.trigger({ - type: 'usage', - name: 'vhs-bandwidth-from-local-storage' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-bandwidth-from-local-storage' - }); - } - - if (storedObject && storedObject.throughput) { - this.options_.throughput = storedObject.throughput; - this.tech_.trigger({ - type: 'usage', - name: 'vhs-throughput-from-local-storage' - }); - this.tech_.trigger({ - type: 'usage', - name: 'hls-throughput-from-local-storage' - }); - } - } - } // if bandwidth was not set by options or pulled from local storage, start playlist - // selection at a reasonable bandwidth - - - if (typeof this.options_.bandwidth !== 'number') { - this.options_.bandwidth = Config.INITIAL_BANDWIDTH; - } // If the bandwidth number is unchanged from the initial setting - // then this takes precedence over the enableLowInitialPlaylist option - - - this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config.INITIAL_BANDWIDTH; // grab options passed to player.src - - ['withCredentials', 'useDevicePixelRatio', 'limitRenditionByPlayerDimensions', 'bandwidth', 'smoothQualityChange', 'customTagParsers', 'customTagMappers', 'handleManifestRedirects', 'cacheEncryptionKeys', 'playlistSelector', 'initialPlaylistSelector', 'experimentalBufferBasedABR', 'liveRangeSafeTimeDelta', 'experimentalLLHLS'].forEach(function (option) { - if (typeof _this2.source_[option] !== 'undefined') { - _this2.options_[option] = _this2.source_[option]; - } - }); - this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions; - this.useDevicePixelRatio = this.options_.useDevicePixelRatio; - } - /** - * called when player.src gets called, handle a new source - * - * @param {Object} src the source object to handle - */ - ; - - _proto.src = function src(_src, type) { - var _this3 = this; - - // do nothing if the src is falsey - if (!_src) { - return; - } - - this.setOptions_(); // add master playlist controller options - - this.options_.src = expandDataUri(this.source_.src); - this.options_.tech = this.tech_; - this.options_.externVhs = Vhs; - this.options_.sourceType = simpleTypeFromSourceType(type); // Whenever we seek internally, we should update the tech - - this.options_.seekTo = function (time) { - _this3.tech_.setCurrentTime(time); - }; - - if (this.options_.smoothQualityChange) { - videojs__default['default'].log.warn('smoothQualityChange is deprecated and will be removed in the next major version'); - } - - this.masterPlaylistController_ = new MasterPlaylistController(this.options_); - var playbackWatcherOptions = videojs__default['default'].mergeOptions({ - liveRangeSafeTimeDelta: SAFE_TIME_DELTA - }, this.options_, { - seekable: function seekable() { - return _this3.seekable(); - }, - media: function media() { - return _this3.masterPlaylistController_.media(); - }, - masterPlaylistController: this.masterPlaylistController_ - }); - this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions); - this.masterPlaylistController_.on('error', function () { - var player = videojs__default['default'].players[_this3.tech_.options_.playerId]; - var error = _this3.masterPlaylistController_.error; - - if (typeof error === 'object' && !error.code) { - error.code = 3; - } else if (typeof error === 'string') { - error = { - message: error, - code: 3 - }; - } - - player.error(error); - }); - var defaultSelector = this.options_.experimentalBufferBasedABR ? Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR; // `this` in selectPlaylist should be the VhsHandler for backwards - // compatibility with < v2 - - this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this); - this.masterPlaylistController_.selectInitialPlaylist = Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this); // re-expose some internal objects for backwards compatibility with < v2 - - this.playlists = this.masterPlaylistController_.masterPlaylistLoader_; - this.mediaSource = this.masterPlaylistController_.mediaSource; // Proxy assignment of some properties to the master playlist - // controller. Using a custom property for backwards compatibility - // with < v2 - - Object.defineProperties(this, { - selectPlaylist: { - get: function get() { - return this.masterPlaylistController_.selectPlaylist; - }, - set: function set(selectPlaylist) { - this.masterPlaylistController_.selectPlaylist = selectPlaylist.bind(this); - } - }, - throughput: { - get: function get() { - return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate; - }, - set: function set(throughput) { - this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = throughput; // By setting `count` to 1 the throughput value becomes the starting value - // for the cumulative average - - this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1; - } - }, - bandwidth: { - get: function get() { - return this.masterPlaylistController_.mainSegmentLoader_.bandwidth; - }, - set: function set(bandwidth) { - this.masterPlaylistController_.mainSegmentLoader_.bandwidth = bandwidth; // setting the bandwidth manually resets the throughput counter - // `count` is set to zero that current value of `rate` isn't included - // in the cumulative average - - this.masterPlaylistController_.mainSegmentLoader_.throughput = { - rate: 0, - count: 0 - }; - } - }, - - /** - * `systemBandwidth` is a combination of two serial processes bit-rates. The first - * is the network bitrate provided by `bandwidth` and the second is the bitrate of - * the entire process after that - decryption, transmuxing, and appending - provided - * by `throughput`. - * - * Since the two process are serial, the overall system bandwidth is given by: - * sysBandwidth = 1 / (1 / bandwidth + 1 / throughput) - */ - systemBandwidth: { - get: function get() { - var invBandwidth = 1 / (this.bandwidth || 1); - var invThroughput; - - if (this.throughput > 0) { - invThroughput = 1 / this.throughput; - } else { - invThroughput = 0; - } - - var systemBitrate = Math.floor(1 / (invBandwidth + invThroughput)); - return systemBitrate; - }, - set: function set() { - videojs__default['default'].log.error('The "systemBandwidth" property is read-only'); - } - } - }); - - if (this.options_.bandwidth) { - this.bandwidth = this.options_.bandwidth; - } - - if (this.options_.throughput) { - this.throughput = this.options_.throughput; - } - - Object.defineProperties(this.stats, { - bandwidth: { - get: function get() { - return _this3.bandwidth || 0; - }, - enumerable: true - }, - mediaRequests: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequests_() || 0; - }, - enumerable: true - }, - mediaRequestsAborted: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsAborted_() || 0; - }, - enumerable: true - }, - mediaRequestsTimedout: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsTimedout_() || 0; - }, - enumerable: true - }, - mediaRequestsErrored: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsErrored_() || 0; - }, - enumerable: true - }, - mediaTransferDuration: { - get: function get() { - return _this3.masterPlaylistController_.mediaTransferDuration_() || 0; - }, - enumerable: true - }, - mediaBytesTransferred: { - get: function get() { - return _this3.masterPlaylistController_.mediaBytesTransferred_() || 0; - }, - enumerable: true - }, - mediaSecondsLoaded: { - get: function get() { - return _this3.masterPlaylistController_.mediaSecondsLoaded_() || 0; - }, - enumerable: true - }, - mediaAppends: { - get: function get() { - return _this3.masterPlaylistController_.mediaAppends_() || 0; - }, - enumerable: true - }, - mainAppendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.mainAppendsToLoadedData_() || 0; - }, - enumerable: true - }, - audioAppendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.audioAppendsToLoadedData_() || 0; - }, - enumerable: true - }, - appendsToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.appendsToLoadedData_() || 0; - }, - enumerable: true - }, - timeToLoadedData: { - get: function get() { - return _this3.masterPlaylistController_.timeToLoadedData_() || 0; - }, - enumerable: true - }, - buffered: { - get: function get() { - return timeRangesToArray(_this3.tech_.buffered()); - }, - enumerable: true - }, - currentTime: { - get: function get() { - return _this3.tech_.currentTime(); - }, - enumerable: true - }, - currentSource: { - get: function get() { - return _this3.tech_.currentSource_; - }, - enumerable: true - }, - currentTech: { - get: function get() { - return _this3.tech_.name_; - }, - enumerable: true - }, - duration: { - get: function get() { - return _this3.tech_.duration(); - }, - enumerable: true - }, - master: { - get: function get() { - return _this3.playlists.master; - }, - enumerable: true - }, - playerDimensions: { - get: function get() { - return _this3.tech_.currentDimensions(); - }, - enumerable: true - }, - seekable: { - get: function get() { - return timeRangesToArray(_this3.tech_.seekable()); - }, - enumerable: true - }, - timestamp: { - get: function get() { - return Date.now(); - }, - enumerable: true - }, - videoPlaybackQuality: { - get: function get() { - return _this3.tech_.getVideoPlaybackQuality(); - }, - enumerable: true - } - }); - this.tech_.one('canplay', this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)); - this.tech_.on('bandwidthupdate', function () { - if (_this3.options_.useBandwidthFromLocalStorage) { - updateVhsLocalStorage({ - bandwidth: _this3.bandwidth, - throughput: Math.round(_this3.throughput) - }); - } - }); - this.masterPlaylistController_.on('selectedinitialmedia', function () { - // Add the manual rendition mix-in to VhsHandler - renditionSelectionMixin(_this3); - }); - this.masterPlaylistController_.sourceUpdater_.on('createdsourcebuffers', function () { - _this3.setupEme_(); - }); // the bandwidth of the primary segment loader is our best - // estimate of overall bandwidth - - this.on(this.masterPlaylistController_, 'progress', function () { - this.tech_.trigger('progress'); - }); // In the live case, we need to ignore the very first `seeking` event since - // that will be the result of the seek-to-live behavior - - this.on(this.masterPlaylistController_, 'firstplay', function () { - this.ignoreNextSeekingEvent_ = true; - }); - this.setupQualityLevels_(); // do nothing if the tech has been disposed already - // this can occur if someone sets the src in player.ready(), for instance - - if (!this.tech_.el()) { - return; - } - - this.mediaSourceUrl_ = window__default['default'].URL.createObjectURL(this.masterPlaylistController_.mediaSource); - this.tech_.src(this.mediaSourceUrl_); - } - /** - * If necessary and EME is available, sets up EME options and waits for key session - * creation. - * - * This function also updates the source updater so taht it can be used, as for some - * browsers, EME must be configured before content is appended (if appending unencrypted - * content before encrypted content). - */ - ; - - _proto.setupEme_ = function setupEme_() { - var _this4 = this; - - var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader; - var didSetupEmeOptions = setupEmeOptions({ - player: this.player_, - sourceKeySystems: this.source_.keySystems, - media: this.playlists.media(), - audioMedia: audioPlaylistLoader && audioPlaylistLoader.media() - }); // In IE11 this is too early to initialize media keys, and IE11 does not support - // promises. - - if (videojs__default['default'].browser.IE_VERSION === 11 || !didSetupEmeOptions) { - // If EME options were not set up, we've done all we could to initialize EME. - this.masterPlaylistController_.sourceUpdater_.initializedEme(); - return; - } - - this.logger_('waiting for EME key session creation'); - waitForKeySessionCreation({ - player: this.player_, - sourceKeySystems: this.source_.keySystems, - audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(), - mainPlaylists: this.playlists.master.playlists - }).then(function () { - _this4.logger_('created EME key session'); - - _this4.masterPlaylistController_.sourceUpdater_.initializedEme(); - }).catch(function (err) { - _this4.logger_('error while creating EME key session', err); - - _this4.player_.error({ - message: 'Failed to initialize media keys for EME', - code: 3 - }); - }); - } - /** - * Initializes the quality levels and sets listeners to update them. - * - * @method setupQualityLevels_ - * @private - */ - ; - - _proto.setupQualityLevels_ = function setupQualityLevels_() { - var _this5 = this; - - var player = videojs__default['default'].players[this.tech_.options_.playerId]; // if there isn't a player or there isn't a qualityLevels plugin - // or qualityLevels_ listeners have already been setup, do nothing. - - if (!player || !player.qualityLevels || this.qualityLevels_) { - return; - } - - this.qualityLevels_ = player.qualityLevels(); - this.masterPlaylistController_.on('selectedinitialmedia', function () { - handleVhsLoadedMetadata(_this5.qualityLevels_, _this5); - }); - this.playlists.on('mediachange', function () { - handleVhsMediaChange(_this5.qualityLevels_, _this5.playlists); - }); - } - /** - * return the version - */ - ; - - VhsHandler.version = function version$5() { - return { - '@videojs/http-streaming': version$4, - 'mux.js': version$3, - 'mpd-parser': version$2, - 'm3u8-parser': version$1, - 'aes-decrypter': version - }; - } - /** - * return the version - */ - ; - - _proto.version = function version() { - return this.constructor.version(); - }; - - _proto.canChangeType = function canChangeType() { - return SourceUpdater.canChangeType(); - } - /** - * Begin playing the video. - */ - ; - - _proto.play = function play() { - this.masterPlaylistController_.play(); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.setCurrentTime = function setCurrentTime(currentTime) { - this.masterPlaylistController_.setCurrentTime(currentTime); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.duration = function duration() { - return this.masterPlaylistController_.duration(); - } - /** - * a wrapper around the function in MasterPlaylistController - */ - ; - - _proto.seekable = function seekable() { - return this.masterPlaylistController_.seekable(); - } - /** - * Abort all outstanding work and cleanup. - */ - ; - - _proto.dispose = function dispose() { - if (this.playbackWatcher_) { - this.playbackWatcher_.dispose(); - } - - if (this.masterPlaylistController_) { - this.masterPlaylistController_.dispose(); - } - - if (this.qualityLevels_) { - this.qualityLevels_.dispose(); - } - - if (this.player_) { - delete this.player_.vhs; - delete this.player_.dash; - delete this.player_.hls; - } - - if (this.tech_ && this.tech_.vhs) { - delete this.tech_.vhs; - } // don't check this.tech_.hls as it will log a deprecated warning - - - if (this.tech_) { - delete this.tech_.hls; - } - - if (this.mediaSourceUrl_ && window__default['default'].URL.revokeObjectURL) { - window__default['default'].URL.revokeObjectURL(this.mediaSourceUrl_); - this.mediaSourceUrl_ = null; - } - - _Component.prototype.dispose.call(this); - }; - - _proto.convertToProgramTime = function convertToProgramTime(time, callback) { - return getProgramTime({ - playlist: this.masterPlaylistController_.media(), - time: time, - callback: callback - }); - } // the player must be playing before calling this - ; - - _proto.seekToProgramTime = function seekToProgramTime$1(programTime, callback, pauseAfterSeek, retryCount) { - if (pauseAfterSeek === void 0) { - pauseAfterSeek = true; - } - - if (retryCount === void 0) { - retryCount = 2; - } - - return seekToProgramTime({ - programTime: programTime, - playlist: this.masterPlaylistController_.media(), - retryCount: retryCount, - pauseAfterSeek: pauseAfterSeek, - seekTo: this.options_.seekTo, - tech: this.options_.tech, - callback: callback - }); - }; - - return VhsHandler; - }(Component); - /** - * The Source Handler object, which informs video.js what additional - * MIME types are supported and sets up playback. It is registered - * automatically to the appropriate tech based on the capabilities of - * the browser it is running in. It is not necessary to use or modify - * this object in normal usage. - */ - - - var VhsSourceHandler = { - name: 'videojs-http-streaming', - VERSION: version$4, - canHandleSource: function canHandleSource(srcObj, options) { - if (options === void 0) { - options = {}; - } - - var localOptions = videojs__default['default'].mergeOptions(videojs__default['default'].options, options); - return VhsSourceHandler.canPlayType(srcObj.type, localOptions); - }, - handleSource: function handleSource(source, tech, options) { - if (options === void 0) { - options = {}; - } - - var localOptions = videojs__default['default'].mergeOptions(videojs__default['default'].options, options); - tech.vhs = new VhsHandler(source, tech, localOptions); - - if (!videojs__default['default'].hasOwnProperty('hls')) { - Object.defineProperty(tech, 'hls', { - get: function get() { - videojs__default['default'].log.warn('player.tech().hls is deprecated. Use player.tech().vhs instead.'); - return tech.vhs; - }, - configurable: true - }); - } - - tech.vhs.xhr = xhrFactory(); - tech.vhs.src(source.src, source.type); - return tech.vhs; - }, - canPlayType: function canPlayType(type, options) { - if (options === void 0) { - options = {}; - } - - var _videojs$mergeOptions = videojs__default['default'].mergeOptions(videojs__default['default'].options, options), - _videojs$mergeOptions2 = _videojs$mergeOptions.vhs.overrideNative, - overrideNative = _videojs$mergeOptions2 === void 0 ? !videojs__default['default'].browser.IS_ANY_SAFARI : _videojs$mergeOptions2; - - var supportedType = simpleTypeFromSourceType(type); - var canUseMsePlayback = supportedType && (!Vhs.supportsTypeNatively(supportedType) || overrideNative); - return canUseMsePlayback ? 'maybe' : ''; - } - }; - /** - * Check to see if the native MediaSource object exists and supports - * an MP4 container with both H.264 video and AAC-LC audio. - * - * @return {boolean} if native media sources are supported - */ - - var supportsNativeMediaSources = function supportsNativeMediaSources() { - return browserSupportsCodec('avc1.4d400d,mp4a.40.2'); - }; // register source handlers with the appropriate techs - - - if (supportsNativeMediaSources()) { - videojs__default['default'].getTech('Html5').registerSourceHandler(VhsSourceHandler, 0); - } - - videojs__default['default'].VhsHandler = VhsHandler; - Object.defineProperty(videojs__default['default'], 'HlsHandler', { - get: function get() { - videojs__default['default'].log.warn('videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead.'); - return VhsHandler; - }, - configurable: true - }); - videojs__default['default'].VhsSourceHandler = VhsSourceHandler; - Object.defineProperty(videojs__default['default'], 'HlsSourceHandler', { - get: function get() { - videojs__default['default'].log.warn('videojs.HlsSourceHandler is deprecated. ' + 'Use videojs.VhsSourceHandler instead.'); - return VhsSourceHandler; - }, - configurable: true - }); - videojs__default['default'].Vhs = Vhs; - Object.defineProperty(videojs__default['default'], 'Hls', { - get: function get() { - videojs__default['default'].log.warn('videojs.Hls is deprecated. Use videojs.Vhs instead.'); - return Vhs; - }, - configurable: true - }); - - if (!videojs__default['default'].use) { - videojs__default['default'].registerComponent('Hls', Vhs); - videojs__default['default'].registerComponent('Vhs', Vhs); - } - - videojs__default['default'].options.vhs = videojs__default['default'].options.vhs || {}; - videojs__default['default'].options.hls = videojs__default['default'].options.hls || {}; - - if (videojs__default['default'].registerPlugin) { - videojs__default['default'].registerPlugin('reloadSourceOnError', reloadSourceOnError); - } else { - videojs__default['default'].plugin('reloadSourceOnError', reloadSourceOnError); - } - - exports.LOCAL_STORAGE_KEY = LOCAL_STORAGE_KEY; - exports.Vhs = Vhs; - exports.VhsHandler = VhsHandler; - exports.VhsSourceHandler = VhsSourceHandler; - exports.emeKeySystems = emeKeySystems; - exports.expandDataUri = expandDataUri; - exports.getAllPsshKeySystemsOptions = getAllPsshKeySystemsOptions; - exports.setupEmeOptions = setupEmeOptions; - exports.simpleTypeFromSourceType = simpleTypeFromSourceType; - exports.waitForKeySessionCreation = waitForKeySessionCreation; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.min.js b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.min.js deleted file mode 100644 index 777e384..0000000 --- a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! @name @videojs/http-streaming @version 2.9.1 @license Apache-2.0 */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("global/document"),require("global/window"),require("video.js"),require("xmldom")):"function"==typeof define&&define.amd?define(["exports","global/document","global/window","video.js","xmldom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).httpStreaming={},e.document,e.window,e.videojs,e.window)}(this,(function(e,t,i,n,r){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(t),o=a(i),u=a(n);function d(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var l=d((function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0})),c=d((function(e){function t(i,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(i,n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0})),h=d((function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,c(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0})),f=d((function(e,t){var i,n,r,a,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,n=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=s.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=s.normalizePath(r.path),s.buildURLFromParts(r)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return i.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=n.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var d={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(d.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var l=o.path,c=l.substring(0,l.lastIndexOf("/")+1)+a.path;d.path=s.normalizePath(c)}else d.path=o.path,a.params||(d.params=o.params,a.query||(d.query=o.query));return null===d.path&&(d.path=i.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(d)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s})),p="http://example.com",m=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=o.default.location&&o.default.location.href||"");var i="function"==typeof o.default.URL,n=/^\/\//.test(e),r=!o.default.location&&!/\/\//i.test(e);if(i?e=new o.default.URL(e,o.default.location||p):/\/\//i.test(e)||(e=f.buildAbsoluteURL(o.default.location&&o.default.location.href||"",e)),i){var a=new URL(t,e);return r?a.href.slice(p.length):n?a.href.slice(a.protocol.length):a.href}return f.buildAbsoluteURL(e,t)},g=m,y=function(e,t,i){return e&&i&&i.responseURL&&t!==i.responseURL?i.responseURL:t},_=function(e){return u.default.log.debug?u.default.log.debug.bind(u.default,"VHS:",e+" >"):function(){}},v=d((function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(T),I=String.fromCharCode(9),E=function(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},w=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n},A=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}h(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,i){var n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((function(e){for(var r=0;r0&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=a},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:b(e.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,c=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange),n&&(i.key=n)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||d,e.attributes?(s.attributes||(s.attributes={}),v(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||d,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(l={default:/yes/i.test(e.attributes.DEFAULT)}).default?l.autoselect=!0:l.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(l.language=e.attributes.LANGUAGE),e.attributes.URI&&(l.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(l.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(l.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(l.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=l}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){c+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),s.dateTimeString=e.dateTimeString,s.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,P.call(this,this.manifest))},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data},skip:function(){this.manifest.skip=L(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part:function(){var t=this;o=!0;var i=this.manifest.segments.length,n=L(e.attributes);s.parts=s.parts||[],s.parts.push(n),n.byterange&&(n.byterange.hasOwnProperty("offset")||(n.byterange.offset=f),f=n.byterange.offset+n.byterange.length);var r=s.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+r+" for segment #"+i,e.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((function(e,i){e.hasOwnProperty("lastPart")||t.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+i+" lacks required attribute(s): LAST-PART"})}))},"server-control":function(){var t=this.manifest.serverControl=L(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),P.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var t=this.manifest.segments.length,i=L(e.attributes),n=i.type&&"PART"===i.type;s.preloadHints=s.preloadHints||[],s.preloadHints.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=n?f:0,n&&(f=i.byterange.offset+i.byterange.length)));var r=s.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t,e.attributes,["TYPE","URI"]),i.type)for(var a=0;a=t}))},V=function(e,t){return W(e,(function(e){return e-q>=t}))},j=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i "+e.end(i));return t.join(", ")},X=function(e){for(var t=[],i=0;i0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},Z=function(e,t,i){if(void 0===t&&(t=e.mediaSequence+e.segments.length),tr){var s=[r,n];n=s[0],r=s[1]}if(n<0){for(var o=n;oDate.now()},re=function(e){return e.excludeUntil&&e.excludeUntil===1/0},ae=function(e){var t=ne(e);return!e.disabled&&!t},se=function(e,t){return t.attributes&&t.attributes[e]},oe=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((function(e){return!!ae(e)&&(e.attributes.BANDWIDTH||0)0)for(var c=u-1;c>=0;c--){var h=o[c];if((s+=h.duration)+q>0)return{partIndex:h.partIndex,segmentIndex:h.segmentIndex,startTime:a-te({defaultDuration:t.targetDuration,durationList:o,startIndex:u,endIndex:c})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:i}}if(u<0){for(var f=u;f<0;f++)if((s-=t.targetDuration)<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:i};u=0}for(var p=u;p-1&&s!==a.length-1&&i.push("_HLS_part="+s),(s>-1||a.length)&&r--}i.unshift("_HLS_msn="+r)}return t.serverControl&&t.serverControl.canSkipUntil&&i.unshift("_HLS_skip="+(t.serverControl.canSkipDateranges?"v2":"YES")),i.forEach((function(t,i){e+=(0===i?"?":"&")+t})),e}(i,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(function(t,i){if(e.request)return t?e.playlistRequestError(e.request,e.media(),"HAVE_METADATA"):void e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})}))}},i.playlistRequestError=function(e,t,i){var n=t.uri,r=t.id;this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")},i.parseManifest_=function(e){var t=this,i=e.url;return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,s=e.customTagMappers,o=void 0===s?[]:s,u=e.experimentalLLHLS,d=new k;t&&d.on("warn",t),i&&d.on("info",i),a.forEach((function(e){return d.addParser(e)})),o.forEach((function(e){return d.addTagMapper(e)})),d.push(n),d.end();var l=d.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){l.hasOwnProperty(e)&&delete l[e]})),l.segments&&l.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!l.targetDuration){var c=10;l.segments&&l.segments.length&&(c=l.segments.reduce((function(e,t){return Math.max(e,t.duration)}),0)),t&&t("manifest has no targetDuration defaulting to "+c),l.targetDuration=c}var h=K(l);if(h.length&&!l.partTargetDuration){var f=h.reduce((function(e,t){return Math.max(e,t.duration)}),0);t&&(t("manifest has no partTargetDuration defaulting to "+f),he.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=f}return l}({onwarn:function(e){var n=e.message;return t.logger_("m3u8-parser warn for "+i+": "+n)},oninfo:function(e){var n=e.message;return t.logger_("m3u8-parser info for "+i+": "+n)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},i.haveMetadata=function(e){var t=this,i=e.playlistString,n=e.playlistObject,r=e.url,a=e.id;this.request=null,this.state="HAVE_METADATA";var s=n||this.parseManifest_({url:r,manifestString:i});s.lastRequest=Date.now(),me({playlist:s,uri:r,id:a});var u=Ie(this.master,s);this.targetDuration=s.partTargetDuration||s.targetDuration,u?(this.master=u,this.media_=this.master.playlists[a]):this.trigger("playlistunchanged"),this.media().endList||(o.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=o.default.setTimeout((function(){t.trigger("mediaupdatetimeout")}),Ee(this.media(),!!u))),this.trigger("loadedplaylist")},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),o.default.clearTimeout(this.mediaUpdateTimeout),o.default.clearTimeout(this.finalRenditionTimeout),this.off()},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e,t){var i=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(o.default.clearTimeout(this.finalRenditionTimeout),t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=o.default.setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state,a=!this.media_||e.id!==this.media_.id,s=this.master.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(a&&(this.trigger("mediachanging"),"HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(a){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){if(e.lastRequest=Date.now(),e.resolvedUri=y(i.handleManifestRedirects,e.resolvedUri,n),t)return i.playlistRequestError(i.request,e,r);i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}},i.pause=function(){this.stopRequest(),o.default.clearTimeout(this.mediaUpdateTimeout),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},i.load=function(e){var t=this;o.default.clearTimeout(this.mediaUpdateTimeout);var i=this.media();if(e){var n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=o.default.setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},i.start=function(){var e=this;if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=o.default.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((function(){e.setupInitialPlaylist(e.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.src=y(e.handleManifestRedirects,e.src,i);var n=e.parseManifest_({manifestString:i.responseText,url:e.src});e.setupInitialPlaylist(n)}}))},i.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri},i.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,ge(this.master,this.srcUri()),e.playlists.forEach((function(e){e.segments=be(e),e.segments.forEach((function(t){Te(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t=this.srcUri()||o.default.location.href;this.master=function(e,t){var i=fe(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:o.default.location.href,resolvedUri:o.default.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n}(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(_e),Ae=u.default.xhr,Le=u.default.mergeOptions,Pe=function(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),n(t,e)},ke=function(){var e=function e(t,i){t=Le({timeout:45e3},t);var n=e.beforeRequest||u.default.Vhs.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var a=(!0===u.default.Vhs.xhr.original?Ae:u.default.Vhs.xhr)(t,(function(e,t){return Pe(a,e,t,i)})),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=t.uri,a.requestTime=Date.now(),a};return e.original=!0,e},Oe=function(e){var t,i,n={};return e.byterange&&(n.Range=(i=(t=e.byterange).offset+t.length-1,"bytes="+t.offset+"-"+i)),n},xe=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,De=/^application\/dash\+xml/i,Ce=function(e){return xe.test(e)?"hls":De.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null},Ue=function(e,t){return e.start(t)+"-"+e.end(t)},Re=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Me=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Be=function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},Ne=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Fe=function(e){return e.resolvedUri},qe=function(e){for(var t=Array.prototype.slice.call(e),i=16,n="",r=0;rnew Date(o.getTime()+1e3*u)?null:(i>o&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:ce.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(i,n);if(!c)return l({message:i+" was not found in the stream"});var h=c.segment,f=function(e,t){var i,n;try{i=new Date(e),n=new Date(t)}catch(e){}var r=i.getTime();return(n.getTime()-r)/1e3}(h.dateTimeObject,i);if("estimate"===c.type)return 0===a?l({message:i+" is not buffered yet. Try again"}):(s(c.estimatedStart+f),void d.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:a-1,seekTo:s,pauseAfterSeek:u,tech:d,callback:l})})));var p=h.start+f;d.one("seeked",(function(){return l(null,d.currentTime())})),u&&d.pause(),s(p)},Ge=function(e){return!!e&&"object"==typeof e},Ve=function e(){for(var t=arguments.length,i=new Array(t),n=0;nm&&(m=T);var b=void 0;if(v<0){var S=g+1;b=S===t.length?"dynamic"===n&&a>0&&o.indexOf("$Number$")>0?ot(e,m,_):(u*l-m)/_:(t[S].t-m)/_}else b=v+1;for(var I=h+p.length+b,E=h+p.length;E=r?a:""+new Array(r-a.length+1).join("0")+a)}}(t))},ct=function(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,a=ze({baseUrl:e.baseUrl,source:lt(r.sourceURL,i),range:r.range});return function(e,t){return e.duration||t?e.duration?Ke(e):ut(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}(e,t).map((function(t){i.Number=t.number,i.Time=t.time;var n=lt(e.media||"",i),r={uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:m(e.baseUrl||"",n),map:a,number:t.number};return e.presentationTimeOffset&&(r.presentationTimeOffset=e.presentationTimeOffset),r}))},ht=function(e,t){var i=e.duration,n=e.segmentUrls,r=void 0===n?[]:n;if(!i&&!t||i&&t)throw new Error("SEGMENT_TIME_UNSPECIFIED");var a,s=r.map((function(t){return function(e,t){var i=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,a=ze({baseUrl:i,source:r.sourceURL,range:r.range}),s=ze({baseUrl:i,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)}));return i&&(a=Ke(e)),t&&(a=ut(e,t)),a.map((function(e,t){if(s[t]){var i=s[t];return i.timeline=e.timeline,i.duration=e.duration,i.number=e.number,i}})).filter((function(e){return e}))},ft=function(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=ct,t=Ve(n,r.template),r.template.presentationTimeOffset&&(t.presentationTimeOffset=r.template.presentationTimeOffset/r.template.timescale)):r.base?(i=$e,t=Ve(n,r.base)):r.list&&(i=ht,t=Ve(n,r.list));var a={attributes:n};if(!i)return a;var s=i(t,r.timeline);if(t.duration){var o=t,u=o.duration,d=o.timescale,l=void 0===d?1:d;t.duration=u/l}else s.length?t.duration=s.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0;return a.attributes=t,a.segments=s,r.base&&t.indexRange&&(a.sidx=s[0],a.segments=[]),a},pt=function(e,t){return Xe(e.childNodes).filter((function(e){return e.tagName===t}))},mt=function(e){return e.textContent.trim()},gt=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],u=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)},yt={mediaPresentationDuration:function(e){return gt(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return gt(e)},suggestedPresentationDelay:function(e){return gt(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return gt(e)},start:function(e){return gt(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?gt(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},_t=function(e){return e&&e.attributes?Xe(e.attributes).reduce((function(e,t){var i=yt[t.name]||yt.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}},vt={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},Tt=function(e,t){return t.length?je(e.map((function(e){return t.map((function(t){return m(e,mt(t))}))}))):e},bt=function(e){var t=pt(e,"SegmentTemplate")[0],i=pt(e,"SegmentList")[0],n=i&&pt(i,"SegmentURL").map((function(e){return Ve({tag:"SegmentURL"},_t(e))})),r=pt(e,"SegmentBase")[0],a=i||t,s=a&&pt(a,"SegmentTimeline")[0],o=i||r||t,u=o&&pt(o,"Initialization")[0],d=t&&_t(t);d&&u?d.initialization=u&&_t(u):d&&d.initialization&&(d.initialization={sourceURL:d.initialization});var l={template:d,timeline:s&&pt(s,"S").map((function(e){return _t(e)})),list:i&&Ve(_t(i),{segmentUrls:n,initialization:_t(u)}),base:r&&Ve(_t(r),{initialization:_t(u)})};return Object.keys(l).forEach((function(e){l[e]||delete l[e]})),l},St=function(e,t){return function(i,n){var r=Tt(t,pt(i,"BaseURL")),a=_t(i),s=parseInt(a.id,10),u=o.default.isNaN(s)?n:s,d=Ve(e,{periodIndex:u}),l=pt(i,"AdaptationSet"),c=bt(i);return je(l.map(function(e,t,i){return function(n){var r,a=_t(n),s=Tt(t,pt(n,"BaseURL")),o=pt(n,"Role")[0],u={role:_t(o)},d=Ve(e,a,u),l=pt(n,"Accessibility")[0],c="urn:scte:dash:cc:cea-608:2015"===(r=_t(l)).schemeIdUri?r.value.split(";").map((function(e){var t,i;if(i=e,/^CC\d=/.test(e)){var n=e.split("=");t=n[0],i=n[1]}else/^CC\d$/.test(e)&&(t=e);return{channel:t,language:i}})):"urn:scte:dash:cc:cea-708:2015"===r.schemeIdUri?r.value.split(";").map((function(e){var t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){var i=e.split("="),n=i[0],r=i[1],a=void 0===r?"":r;t.channel=n,t.language=e,a.split(",").forEach((function(e){var i=e.split(":"),n=i[0],r=i[1];"lang"===n?t.language=r:"er"===n?t.easyReader=Number(r):"war"===n?t.aspectRatio=Number(r):"3D"===n&&(t["3D"]=Number(r))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0;c&&(d=Ve(d,{captionServices:c}));var h=pt(n,"Label")[0];if(h&&h.childNodes.length){var f=h.childNodes[0].nodeValue.trim();d=Ve(d,{label:f})}var p=pt(n,"ContentProtection").reduce((function(e,t){var i=_t(t),n=vt[i.schemeIdUri];if(n){e[n]={attributes:i};var r=pt(t,"cenc:pssh")[0];if(r){var a=mt(r),s=a&&b(a);e[n].pssh=s}}return e}),{});Object.keys(p).length&&(d=Ve(d,{contentProtection:p}));var m=bt(n),g=pt(n,"Representation"),y=Ve(i,m);return je(g.map(function(e,t,i){return function(n){var r=pt(n,"BaseURL"),a=Tt(t,r),s=Ve(e,_t(n)),o=bt(n);return a.map((function(e){return{segmentInfo:Ve(i,o),attributes:Ve(s,{baseUrl:e})}}))}}(d,s,y)))}}(d,r,c)))}},It=function(e){if(""===e)throw new Error("DASH_EMPTY_MANIFEST");var t,i,n=new r.DOMParser;try{i=(t=n.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error("DASH_INVALID_XML");return i},Et=function(e,t){void 0===t&&(t={});var i=function(e,t){void 0===t&&(t={});var i=t,n=i.manifestUri,r=void 0===n?"":n,a=i.NOW,s=void 0===a?Date.now():a,o=i.clientOffset,u=void 0===o?0:o,d=pt(e,"Period");if(!d.length)throw new Error("INVALID_NUMBER_OF_PERIOD");var l=pt(e,"Location"),c=_t(e),h=Tt([r],pt(e,"BaseURL"));return c.sourceDuration=c.mediaPresentationDuration||0,c.NOW=s,c.clientOffset=u,l.length&&(c.locations=l.map(mt)),{locations:c.locations,representationInfo:je(d.map(St(c,h)))}}(It(e),t);return function(e,t,i){var n;if(void 0===i&&(i={}),!e.length)return{};var r=e[0].attributes,a=r.sourceDuration,s=r.type,o=void 0===s?"static":s,u=r.suggestedPresentationDelay,d=r.minimumUpdatePeriod,l=et(e.filter(rt)).map(nt),c=et(e.filter(at)),h=e.filter(st),f=e.map((function(e){return e.attributes.captionServices})).filter(Boolean),p={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(n={AUDIO:{},VIDEO:{}},n["CLOSED-CAPTIONS"]={},n.SUBTITLES={},n),uri:"",duration:a,playlists:it(l,i)};d>=0&&(p.minimumUpdatePeriod=1e3*d),t&&(p.locations=t),"dynamic"===o&&(p.suggestedPresentationDelay=u);var m=0===p.playlists.length;return c.length&&(p.mediaGroups.AUDIO.audio=function(e,t,i){var n;void 0===t&&(t={}),void 0===i&&(i=!1);var r=e.reduce((function(e,r){var a=r.attributes.role&&r.attributes.role.value||"",s=r.attributes.lang||"",o=r.attributes.label||"main";if(s&&!r.attributes.label){var u=a?" ("+a+")":"";o=""+r.attributes.lang+u}e[o]||(e[o]={language:s,autoselect:!0,default:"main"===a,playlists:[],uri:""});var d=tt(function(e,t){var i,n=e.attributes,r=e.segments,a=e.sidx,s={attributes:(i={NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},i["PROGRAM-ID"]=1,i),uri:"",endList:"static"===(n.type||"static"),timeline:n.periodIndex,resolvedUri:"",targetDuration:n.duration,segments:r,mediaSequence:r.length?r[0].number:1};return n.contentProtection&&(s.contentProtection=n.contentProtection),a&&(s.sidx=a),t&&(s.attributes.AUDIO="audio",s.attributes.SUBTITLES="subs"),s}(r,i),t);return e[o].playlists.push(d),void 0===n&&"main"===a&&((n=r).default=!0),e}),{});return n||(r[Object.keys(r)[0]].default=!0),r}(c,i,m)),h.length&&(p.mediaGroups.SUBTITLES.subs=function(e,t){return void 0===t&&(t={}),e.reduce((function(e,i){var n=i.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),e[n].playlists.push(tt(function(e){var t,i=e.attributes,n=e.segments;void 0===n&&(n=[{uri:i.baseUrl,timeline:i.periodIndex,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);var r=((t={NAME:i.id,BANDWIDTH:i.bandwidth})["PROGRAM-ID"]=1,t);return i.codecs&&(r.CODECS=i.codecs),{attributes:r,uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:i.baseUrl||"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1}}(i),t)),e}),{})}(h,i)),f.length&&(p.mediaGroups["CLOSED-CAPTIONS"].cc=f.reduce((function(e,t){return t?(t.forEach((function(t){var i=t.channel,n=t.language;e[n]={autoselect:!1,default:!1,instreamId:i,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e):e}),{})),p}(i.representationInfo.map(ft),i.locations,t.sidxMapping)},wt=Math.pow(2,32),At=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||(t=e,ArrayBuffer.isView(t))||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0));var t},Lt=o.default.BigInt||Number,Pt=[Lt("0x1"),Lt("0x100"),Lt("0x10000"),Lt("0x1000000"),Lt("0x100000000"),Lt("0x10000000000"),Lt("0x1000000000000"),Lt("0x100000000000000"),Lt("0x10000000000000000")],kt=function(e,t){var i=void 0===t?{}:t,n=i.signed,r=void 0!==n&&n,a=i.le,s=void 0!==a&&a;e=At(e);var o=s?"reduce":"reduceRight",u=(e[o]?e[o]:Array.prototype[o]).call(e,(function(t,i,n){var r=s?n:Math.abs(n+1-e.length);return t+Lt(i)*Pt[r]}),Lt(0));if(r){var d=Pt[e.length]/Lt(2)-Lt(1);(u=Lt(u))>d&&(u-=d,u-=d,u-=Lt(2))}return Number(u)},Ot=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n=t.length&&u.call(t,(function(t,i){return t===(o[i]?o[i]&e[a+i]:e[a+i])}))},Dt=At([73,68,51]),Ct=function e(t,i){return void 0===i&&(i=0),(t=At(t)).length-i<10||!xt(t,Dt,{offset:i})?i:(i+=function(e,t){void 0===t&&(t=0);var i=(e=At(e))[t+5],n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?n+20:n+10}(t,i),e(t,i))},Ut=function(e){return"string"==typeof e?Ot(e):e},Rt=function e(t,i,n){void 0===n&&(n=!1),i=function(e){return Array.isArray(e)?e.map((function(e){return Ut(e)})):[Ut(e)]}(i),t=At(t);var r=[];if(!i.length)return r;for(var a=0;a>>0,o=t.subarray(a+4,a+8);if(0===s)break;var u=a+s;if(u>t.length){if(n)break;u=t.length}var d=t.subarray(a+8,u);xt(o,i[0])&&(1===i.length?r.push(d):r.push.apply(r,e(d,i.slice(1),n))),a=u}return r},Mt={EBML:At([26,69,223,163]),DocType:At([66,130]),Segment:At([24,83,128,103]),SegmentInfo:At([21,73,169,102]),Tracks:At([22,84,174,107]),Track:At([174]),TrackNumber:At([215]),DefaultDuration:At([35,227,131]),TrackEntry:At([174]),TrackType:At([131]),FlagDefault:At([136]),CodecID:At([134]),CodecPrivate:At([99,162]),VideoTrack:At([224]),AudioTrack:At([225]),Cluster:At([31,67,182,117]),Timestamp:At([231]),TimestampScale:At([42,215,177]),BlockGroup:At([160]),BlockDuration:At([155]),Block:At([161]),SimpleBlock:At([163])},Bt=[128,64,32,16,8,4,2,1],Nt=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var r=function(e){for(var t=1,i=0;i=i.length)return i.length;var r=Nt(i,n,!1);if(xt(t.bytes,r.bytes))return n;var a=Nt(i,n+r.length);return e(t,i,n+a.length+a.value+r.length)},Ht=function e(t,i){i=function(e){return Array.isArray(e)?e.map((function(e){return Ft(e)})):[Ft(e)]}(i),t=At(t);var n=[];if(!i.length)return n;for(var r=0;rt.length?t.length:o+s.value,d=t.subarray(o,u);xt(i[0],a.bytes)&&(1===i.length?n.push(d):n=n.concat(e(d,i.slice(1)))),r+=a.length+s.length+d.length}return n},Wt=At([0,0,0,1]),Gt=At([0,0,1]),Vt=At([0,0,3]),jt=function(e){for(var t=[],i=1;i>1&63),-1!==i.indexOf(u)&&(r=a+o),a+=o+("h264"===t?1:2)}else a++}return e.subarray(0,0)},zt={webm:At([119,101,98,109]),matroska:At([109,97,116,114,111,115,107,97]),flac:At([102,76,97,67]),ogg:At([79,103,103,83]),ac3:At([11,119]),riff:At([82,73,70,70]),avi:At([65,86,73]),wav:At([87,65,86,69]),"3gp":At([102,116,121,112,51,103]),mp4:At([102,116,121,112]),fmp4:At([115,116,121,112]),mov:At([102,116,121,112,113,116])},Qt={aac:function(e){var t=Ct(e);return xt(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Ct(e);return xt(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Ht(e,[Mt.EBML,Mt.DocType])[0];return xt(t,zt.webm)},mkv:function(e){var t=Ht(e,[Mt.EBML,Mt.DocType])[0];return xt(t,zt.matroska)},mp4:function(e){return!Qt["3gp"](e)&&!Qt.mov(e)&&(xt(e,zt.mp4,{offset:4})||xt(e,zt.fmp4,{offset:4}))},mov:function(e){return xt(e,zt.mov,{offset:4})},"3gp":function(e){return xt(e,zt["3gp"],{offset:4})},ac3:function(e){var t=Ct(e);return xt(e,zt.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+1880;n+=12,r--)i.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)});return i}(At(s.response).subarray(8))}catch(e){return void n.requestErrored_(e,s,t)}return u[r]={sidxInfo:e.sidx,sidx:o},Je(e,o,e.sidx.resolvedUri),i(!0)}};this.request=function(e,t,i){var n,r=[],a=!1,s=function(e,t,n,r){return t.abort(),a=!0,i(e,t,n,r)},o=function(e,t){if(!a){if(e)return s(e,t,"",r);var i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length);if(r=function(){for(var e=arguments.length,t=new Array(e),i=0;i=l+d)return s(t,{response:o.subarray(d,d+l),status:i.status,uri:i.uri});n.request=n.vhs_.xhr({uri:a,responseType:"arraybuffer",headers:Oe({byterange:e.sidx.byterange})},s)}))}else this.mediaRequest_=o.default.setTimeout((function(){return i(!1)}),0)},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},o.default.clearTimeout(this.minimumUpdatePeriodTimeout_),o.default.clearTimeout(this.mediaRequest_),o.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},i.hasPendingRequest=function(){return this.request||this.mediaRequest_},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=this.state;if("string"==typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})})))},i.haveMetadata=function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},i.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),o.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(o.default.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},i.load=function(e){var t=this;o.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var i=this.media();if(e){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=o.default.setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},i.start=function(){var e=this;this.started=!0,this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_(),e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=o.default.setTimeout((function(){return e.haveMaster_()}),0)},i.requestMaster_=function(e){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(!t.requestErrored_(i,n)){var r=n.responseText!==t.masterPlaylistLoader_.masterXml_;return t.masterPlaylistLoader_.masterXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now(),t.masterPlaylistLoader_.srcUrl=y(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n),r?(t.handleMaster_(),void t.syncClientServerClock_((function(){return e(n,r)}))):e(n,r)}"HAVE_NOTHING"===t.state&&(t.started=!1)}))},i.syncClientServerClock_=function(e){var t,i=this,n=(t=this.masterPlaylistLoader_.masterXml_,function(e){var t=pt(e,"UTCTiming")[0];if(!t)return null;var i=_t(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error("UNSUPPORTED_UTC_TIMING_SCHEME")}return i}(It(t)));return null===n?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===n.method?(this.masterPlaylistLoader_.clientOffset_=n.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:g(this.masterPlaylistLoader_.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials},(function(t,r){if(i.request){if(t)return i.masterPlaylistLoader_.clientOffset_=i.masterLoaded_-Date.now(),e();var a;a="HEAD"===n.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):i.masterLoaded_:Date.parse(r.responseText),i.masterPlaylistLoader_.clientOffset_=a-Date.now(),e()}})))},i.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},i.handleMaster_=function(){this.mediaRequest_=null;var e,t,i,n=(e={masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_},i=Et(e.masterXml,{manifestUri:t=e.srcUrl,clientOffset:e.clientOffset,sidxMapping:e.sidxMapping}),ge(i,t),i),r=this.masterPlaylistLoader_.master;r&&(n=function(e,t,i){for(var n=!0,r=ei(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),a=0;a-1)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},m=function(e){return t(S.hdlr,P[e])},p=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(S.mdhd,i)},f=function(e){return t(S.mdia,p(e),m(e.type),s(e))},a=function(e){return t(S.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},s=function(e){return t(S.minf,"video"===e.type?t(S.vmhd,k):t(S.smhd,O),i(),y(e))},o=function(e,i){for(var n=[],r=i.length;r--;)n[r]=v(i[r]);return t.apply(null,[S.moof,a(e)].concat(n))},u=function(e){for(var i=e.length,n=[];i--;)n[i]=c(e[i]);return t.apply(null,[S.moov,l(4294967295)].concat(n).concat(d(e)))},d=function(e){for(var i=e.length,n=[];i--;)n[i]=T(e[i]);return t.apply(null,[S.mvex].concat(n))},l=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t(S.mvhd,i)},g=function(e){var i,n,r=e.samples||[],a=new Uint8Array(4+r.length);for(n=0;n>>8),s.push(255&r[i].byteLength),s=s.concat(Array.prototype.slice.call(r[i]));for(i=0;i>>8),o.push(255&a[i].byteLength),o=o.concat(Array.prototype.slice.call(a[i]));if(n=[S.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(S.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),t(S.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var u=e.sarRatio[0],d=e.sarRatio[1];n.push(t(S.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d])))}return t.apply(null,n)},B=function(e){return t(S.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),n(e))},h=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(S.tkhd,i)},v=function(e){var i,n,r,a,s,o;return i=t(S.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/(W+1)),o=Math.floor(e.baseMediaDecodeTime%(W+1)),n=t(S.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(r=b(e,92),t(S.traf,i,n,r)):(a=g(e),r=b(e,a.length+92),t(S.traf,i,n,r,a))},c=function(e){return e.duration=e.duration||4294967295,t(S.trak,h(e),f(e))},T=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(S.trex,i)},q=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},F=function(e,i){var n,r,a,s,o,u;for(i+=20+16*(s=e.samples||[]).length,a=q(s,i),(r=new Uint8Array(a.length+16*s.length)).set(a),n=a.length,u=0;u>>24,r[n++]=(16711680&o.duration)>>>16,r[n++]=(65280&o.duration)>>>8,r[n++]=255&o.duration,r[n++]=(4278190080&o.size)>>>24,r[n++]=(16711680&o.size)>>>16,r[n++]=(65280&o.size)>>>8,r[n++]=255&o.size,r[n++]=o.flags.isLeading<<2|o.flags.dependsOn,r[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[n++]=61440&o.flags.degradationPriority,r[n++]=15&o.flags.degradationPriority,r[n++]=(4278190080&o.compositionTimeOffset)>>>24,r[n++]=(16711680&o.compositionTimeOffset)>>>16,r[n++]=(65280&o.compositionTimeOffset)>>>8,r[n++]=255&o.compositionTimeOffset;return t(S.trun,r)},N=function(e,i){var n,r,a,s,o,u;for(i+=20+8*(s=e.samples||[]).length,a=q(s,i),(n=new Uint8Array(a.length+8*s.length)).set(a),r=a.length,u=0;u>>24,n[r++]=(16711680&o.duration)>>>16,n[r++]=(65280&o.duration)>>>8,n[r++]=255&o.duration,n[r++]=(4278190080&o.size)>>>24,n[r++]=(16711680&o.size)>>>16,n[r++]=(65280&o.size)>>>8,n[r++]=255&o.size;return t(S.trun,n)},b=function(e,t){return"audio"===e.type?N(e,t):F(e,t)},r=function(){return t(S.ftyp,I,E,I,w)};var G,V,j,X,z,Q,Y,K,$=function(e){return t(S.mdat,e)},J=o,Z=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ee=[33,16,5,32,164,27],te=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ie=function(e){for(var t=[];e--;)t.push(0);return t},ne=9e4;Q=function(e,t){return V(z(e,t))},Y=function(e,t){return j(X(e),t)},K=function(e,t,i){return X(i?e:e-t)};var re=ne,ae=V=function(e){return e*ne},se=(j=function(e,t){return e*t},X=function(e){return e/ne}),oe=(z=function(e,t){return e/t},Q),ue=Y,de=K,le=function(e,t,i,n){var r,a,s,o,u,d=0,l=0,c=0;if(t.length&&(r=oe(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(re/(e.samplerate/1024)),i&&n&&(d=r-Math.max(i,n),c=(l=Math.floor(d/a))*a),!(l<1||c>45e3))){for((s=function(){if(!G){var e={96e3:[ee,[227,64],ie(154),[56]],88200:[ee,[231],ie(170),[56]],64e3:[ee,[248,192],ie(240),[56]],48e3:[ee,[255,192],ie(268),[55,148,128],ie(54),[112]],44100:[ee,[255,192],ie(268),[55,163,128],ie(84),[112]],32e3:[ee,[255,192],ie(268),[55,234],ie(226),[112]],24e3:[ee,[255,192],ie(268),[55,255,128],ie(268),[111,112],ie(126),[224]],16e3:[ee,[255,192],ie(268),[55,255,128],ie(268),[111,255],ie(269),[223,108],ie(195),[1,192]],12e3:[te,ie(268),[3,127,248],ie(268),[6,255,240],ie(268),[13,255,224],ie(268),[27,253,128],ie(259),[56]],11025:[te,ie(268),[3,127,248],ie(268),[6,255,240],ie(268),[13,255,224],ie(268),[27,255,192],ie(268),[55,175,128],ie(108),[112]],8e3:[te,ie(268),[3,121,16],ie(47),[7]]};t=e,G=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})}var t;return G}()[e.samplerate])||(s=t[0].data),o=0;o=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},ye.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},ye.prototype.addText=function(e){this.rows[this.rowIdx]+=e},ye.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var _e=function(e){this.serviceNum=e,this.text="",this.currentWindow=new ye(-1),this.windows=[]};_e.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new ye(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},_e.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]};var ve=function e(){e.prototype.init.call(this);var t=this;this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(t.new708Packet(),t.add708Bytes(e)):(null===t.current708Packet&&t.new708Packet(),t.add708Bytes(e))}};ve.prototype=new H,ve.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},ve.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},ve.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,r=0,a=t[r++];for(e.seq=a>>6,e.sizeCode=63&a;r>5)&&n>0&&(i=a=t[r++]),this.pushServiceBlock(i,r,n),n>0&&(r+=n-1)},ve.prototype.pushServiceBlock=function(e,t,i){var n,r=t,a=this.current708Packet.data,s=this.services[e];for(s||(s=this.initService(e,r));r>5,a.rowLock=(16&n)>>4,a.columnLock=(8&n)>>3,a.priority=7&n,n=i[++e],a.relativePositioning=(128&n)>>7,a.anchorVertical=127&n,n=i[++e],a.anchorHorizontal=n,n=i[++e],a.anchorPoint=(240&n)>>4,a.rowCount=15&n,n=i[++e],a.columnCount=63&n,n=i[++e],a.windowStyle=(56&n)>>3,a.penStyle=7&n,a.virtualRowCount=a.rowCount+1,e},ve.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.winAttr;return n=i[++e],r.fillOpacity=(192&n)>>6,r.fillRed=(48&n)>>4,r.fillGreen=(12&n)>>2,r.fillBlue=3&n,n=i[++e],r.borderType=(192&n)>>6,r.borderRed=(48&n)>>4,r.borderGreen=(12&n)>>2,r.borderBlue=3&n,n=i[++e],r.borderType+=(128&n)>>5,r.wordWrap=(64&n)>>6,r.printDirection=(48&n)>>4,r.scrollDirection=(12&n)>>2,r.justify=3&n,n=i[++e],r.effectSpeed=(240&n)>>4,r.effectDirection=(12&n)>>2,r.displayEffect=3&n,e},ve.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},ve.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},ve.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<>4,r.offset=(12&n)>>2,r.penSize=3&n,n=i[++e],r.italics=(128&n)>>7,r.underline=(64&n)>>6,r.edgeType=(56&n)>>3,r.fontStyle=7&n,e},ve.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penColor;return n=i[++e],r.fgOpacity=(192&n)>>6,r.fgRed=(48&n)>>4,r.fgGreen=(12&n)>>2,r.fgBlue=3&n,n=i[++e],r.bgOpacity=(192&n)>>6,r.bgRed=(48&n)>>4,r.bgGreen=(12&n)>>2,r.bgBlue=3&n,n=i[++e],r.edgeRed=(48&n)>>4,r.edgeGreen=(12&n)>>2,r.edgeBlue=3&n,e},ve.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],r.row=15&n,n=i[++e],r.column=63&n,e},ve.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Te={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},be=function(e){return null===e?"":(e=Te[e]||e,String.fromCharCode(e))},Se=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ie=function(){for(var e=[],t=15;t--;)e.push("");return e},Ee=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Ie();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ie();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Ie()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))a=be((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=be((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=Se.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=be(n),a+=be(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Ee.prototype=new H,Ee.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e){try{return e.trim()}catch(e){return console.error("Skipping malformed caption."),""}})).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},Ee.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ie(),this.nonDisplayed_=Ie(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Ee.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Ee.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Ee.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Ee.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Ee.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Ee.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},Ee.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Ee.prototype.isNormalChar=function(e){return e>=32&&e<=127},Ee.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Ie(),this.displayed_=Ie()),void 0!==t&&t!==this.row_)for(var i=0;i"}),"");this[this.mode_](e,i)},Ee.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+""}),"");this.formatting_=[],this[this.mode_](e,t)}},Ee.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Ee.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Ee.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},ke=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||Le,this.push=function(e){this.type_!==Le&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=Pe(e.dts,n),e.pts=Pe(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};ke.prototype=new H;var Oe,xe=ke,De=Pe,Ce=function(e,t,i){var n,r="";for(n=t;n>>2;c*=4,c+=3&l[7],u.timeStamp=c,void 0===t.pts&&void 0===t.dts&&(t.pts=u.timeStamp,t.dts=u.timeStamp),this.trigger("timestamp",u)}t.frames.push(u),s+=10,s+=o}while(s>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Ae.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ae.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new H,Ne.STREAM_TYPES={h264:27,adts:15},(Fe=function(){var e,t=this,i={data:[],size:0},n={data:[],size:0},r={data:[],size:0},a=function(e,i,n){var r,a,s=new Uint8Array(e.size),o={type:i},u=0,d=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,u=0;u>>3,c.pts*=4,c.pts+=(6&l[13])>>>1,c.dts=c.pts,64&h&&(c.dts=(14&l[14])<<27|(255&l[15])<<20|(254&l[16])<<12|(255&l[17])<<5|(254&l[18])>>>3,c.dts*=4,c.dts+=(6&l[18])>>>1)),c.data=l.subarray(9+l[8])),r="video"===i||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};Fe.prototype.init.call(this),this.push=function(s){({pat:function(){},pes:function(){var e,t;switch(s.streamType){case Ae.H264_STREAM_TYPE:e=i,t="video";break;case Ae.ADTS_STREAM_TYPE:e=n,t="audio";break;case Ae.METADATA_STREAM_TYPE:e=r,t="timed-metadata";break;default:return}s.payloadUnitStartIndicator&&a(e,t,!0),e.data.push(s),e.size+=s.data.byteLength},pmt:function(){var i={type:"metadata",tracks:[]};null!==(e=s.programMapTable).video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",i)}})[s.type]()},this.reset=function(){i.size=0,i.data.length=0,n.size=0,n.data.length=0,this.trigger("reset")},this.flushStreams_=function(){a(i,"video"),a(n,"audio"),a(r,"timed-metadata")},this.flush=function(){this.flushStreams_(),this.trigger("done")}}).prototype=new H;var Ge={PAT_PID:0,MP2T_PACKET_LENGTH:We,TransportPacketStream:Be,TransportParseStream:Ne,ElementaryStream:Fe,TimestampRolloverStream:He,CaptionStream:we.CaptionStream,Cea608Stream:we.Cea608Stream,Cea708Stream:we.Cea708Stream,MetadataStream:qe};for(var Ve in Ae)Ae.hasOwnProperty(Ve)&&(Ge[Ve]=Ae[Ve]);var je,Xe=Ge,ze=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(je=function(e){var t,i=0;je.prototype.init.call(this),this.push=function(n){var r,a,s,o,u,d,l=0;if(e||(i=0),"audio"===n.type)for(t?(o=t,(t=new Uint8Array(o.byteLength+n.data.byteLength)).set(o),t.set(n.data,o.byteLength)):t=n.data;l+5>5,d=9e4*(u=1024*(1+(3&t[l+6])))/ze[(60&t[l+2])>>>2],s=l+r,t.byteLength>>6&3),channelcount:(1&t[l+2])<<2|(192&t[l+3])>>>6,samplerate:ze[(60&t[l+2])>>>2],samplingfrequencyindex:(60&t[l+2])>>>2,samplesize:16,data:t.subarray(l+7+a,s)}),i++,t.byteLength===s)return void(t=void 0);t=t.subarray(s)}else l++},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new H;var Qe,Ye,Ke,$e=je,Je=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Ye=function(){var e,t,i=0;Ye.prototype.init.call(this),this.push=function(n){var r;t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;for(var a=t.byteLength;i3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new H,Ke={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Qe=function(){var e,t,i,n,r,a,s,o=new Ye;Qe.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(s){var o={trackId:t,pts:i,dts:n,data:s};switch(31&s[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(e,t){var i,n=8,r=8;for(i=0;i=0?i:0,(16&e[t+5])>>4?i+20:i+10},nt=function e(t,i){return t.length-i<10||t[i]!=="I".charCodeAt(0)||t[i+1]!=="D".charCodeAt(0)||t[i+2]!=="3".charCodeAt(0)?i:e(t,i+=it(t,i))},rt=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},at={isLikelyAacData:function(e){var t=nt(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:it,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=rt(e.subarray(10,14)));do{if((i=rt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r>>2;return(s*=4)+(3&a[7])}break}}t+=10,t+=i}while(t=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255!=(255&e[u])||240!=(240&e[u+1]))u++;else{if(e.length-u<7)break;if(u+(o=at.parseAdtsSize(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else{if(e.length-u<10)break;if(u+(o=at.parseId3TagSize(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=n>0?e.subarray(u):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new H;var st,ot,ut,dt,lt=Ze,ct=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],ht=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],ft=et.H264Stream,pt=at.isLikelyAacData,mt=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))}(i,e,r),e.baseMediaDecodeTime=he(e,t.keepOriginalTimestamps),f=le(e,o,a,s),e.samples=function(e){var t,i,n=[];for(t=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e}(n)),s.length){var f;if(!(f=t.alignGopsAtEnd?this.alignGopsAtEnd_(n):this.alignGopsAtStart_(n)))return this.gopCache_.unshift({gop:n.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");ce(e),n=f}fe(e,n),e.samples=function(e,t){var i,n,r,a,s,o=t||0,u=[];for(i=0;i=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,a,o,u,d;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=i=0;tn.pts?t++:(i++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===i?e:i===e.length?null:((d=e.slice(i)).byteLength=a,d.duration=u,d.nalCount=o,d.pts=d[0].pts,d.dts=d[0].dts,d)},this.alignGopsAtEnd_=function(e){var t,i,n,r,a,o,u;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=s[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(u=o?i:a))return e;var d=e.slice(u),l=d.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return d.byteLength=l.byteLength,d.duration=l.duration,d.nalCount=l.nalCount,d.pts=d[0].pts,d.dts=d[0].dts,d},this.alignGopsWith=function(e){s=e}}).prototype=new H,(dt=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,dt.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new H,dt.prototype.flush=function(e){var t,i,n,a,s,o,d,l,c=0,h={captions:[],captionStreams:{},metadata:[],info:{}},f=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(f=this.videoTrack.timelineStartInfo.pts,ht.forEach((function(e){h.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(f=this.audioTrack.timelineStartInfo.pts,ct.forEach((function(e){h.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?h.type=this.pendingTracks[0].type:h.type="combined",this.emittedTracks+=this.pendingTracks.length,s=this.pendingTracks,o=void 0,d=void 0,l=void 0,d=r(),l=u(s),(o=new Uint8Array(d.byteLength+l.byteLength)).set(d),o.set(l,d.byteLength),n=o,h.initSegment=new Uint8Array(n.byteLength),h.initSegment.set(n),h.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},dt.prototype.setRemux=function(e){this.remuxTracks=e},(ut=function(e){var t,i,n=this,r=!0;ut.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new Xe.MetadataStream,r.aacStream=new lt,r.audioTimestampRolloverStream=new Xe.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Xe.TimestampRolloverStream("timed-metadata"),r.adtsStream=new $e,r.coalesceStream=new dt(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(a){"timed-metadata"!==a.type&&"audio"!==a.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new ot(i,e),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Xe.MetadataStream,r.packetStream=new Xe.TransportPacketStream,r.parseStream=new Xe.TransportParseStream,r.elementaryStream=new Xe.ElementaryStream,r.timestampRolloverStream=new Xe.TimestampRolloverStream,r.adtsStream=new $e,r.h264Stream=new ft,r.captionStream=new Xe.CaptionStream(e),r.coalesceStream=new dt(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new st(t,e),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new ot(i,e),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,ce(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,ce(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.push=function(e){if(r){var t=pt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new H;var yt,_t={Transmuxer:ut,VideoSegmentStream:st,AudioSegmentStream:ot,AUDIO_PROPERTIES:ct,VIDEO_PROPERTIES:ht,generateSegmentTimingInfo:gt},vt=function(e){return e>>>0},Tt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])},bt=vt,St=function e(t,i){var n,r,a,s,o,u=[];if(!i.length)return null;for(n=0;n1?n+r:t.byteLength,a===i[0]&&(1===i.length?u.push(t.subarray(n+8,s)):(o=e(t.subarray(n+8,s),i.slice(1))).length&&(u=u.concat(o))),n=s;return u},It=vt,Et=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},wt=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a0?function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:It(e[4]<<24|e[5]<<16|e[6]<<8|e[7])};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=It(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),t}(T[0]).baseMediaDecodeTime:0,S=St(g,["trun"]);t===v&&S.length>0&&(i=function(e,t,i){var n,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u=[];for(r=0;r+40;){var u=t.shift();this.parse(u,a,s)}return null!==(o=function(e,t,i){return null===t?null:{seiNals:Pt(e,t)[t],timescale:i}}(e,i,n))&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()},Ot=vt,xt=function(e){return("00"+e.toString(16)).slice(-2)},Dt=function(e,t){var i,n,r;return i=St(t,["moof","traf"]),n=[].concat.apply([],i.map((function(t){return St(t,["tfhd"]).map((function(i){var n,r,a;return n=Ot(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),r=e[n]||9e4,(a="number"!=typeof(a=St(t,["tfdt"]).map((function(e){var t,i;return t=e[0],i=Ot(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=Ot(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),i}))[0])||isNaN(a)?1/0:a)/r}))}))),r=Math.min.apply(null,n),isFinite(r)?r:0},Ct=function(e){var t=St(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,n,r={},a=St(e,["tkhd"])[0];a&&(n=(t=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0),r.id=0===n?t.getUint32(12):t.getUint32(20));var s=St(e,["mdia","hdlr"])[0];if(s){var o=Tt(s.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var u=St(e,["mdia","minf","stbl","stsd"])[0];if(u){var d=u.subarray(8);r.codec=Tt(d.subarray(4,8));var l,c=St(d,[r.codec])[0];c&&(/^[a-z]vc[1-9]$/i.test(r.codec)?(l=c.subarray(78),"avcC"===Tt(l.subarray(4,8))&&l.length>11?(r.codec+=".",r.codec+=xt(l[9]),r.codec+=xt(l[10]),r.codec+=xt(l[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(l=c.subarray(28),"esds"===Tt(l.subarray(4,8))&&l.length>20&&0!==l[19]?(r.codec+="."+xt(l[19]),r.codec+="."+xt(l[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var h=St(e,["mdia","mdhd"])[0];h&&(r.timescale=yt(h)),i.push(r)})),i},Ut=(yt=function(e){var t=0===e[0]?12:20;return Ot(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},function(e){var t=31&e[1];return(t<<=8)|e[2]}),Rt=function(e){return!!(64&e[1])},Mt=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},Bt=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Nt={parseType:function(e,t){var i=Ut(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=Rt(e),i=4+Mt(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=Rt(e),n=4+Mt(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var a=12+((15&e[n+10])<<8|e[n+11]);a=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+Mt(e),i=e.subarray(t),n=0,r=0,a=!1;r3&&"slice_layer_without_partitioning_rbsp_idr"===Bt(31&i[r+3])&&(a=!0),a}},Ft=De,qt={};qt.ts=Nt,qt.aac=at;var Ht=re,Wt=188,Gt=71,Vt=function(e,t,i){for(var n,r,a,s,o=0,u=Wt,d=!1;u<=e.byteLength;)if(e[o]!==Gt||e[u]!==Gt&&u!==e.byteLength)o++,u++;else{switch(n=e.subarray(o,u),qt.ts.parseType(n,t.pid)){case"pes":r=qt.ts.parsePesType(n,t.table),a=qt.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=qt.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),d=!0)}if(d)break;o+=Wt,u+=Wt}for(o=(u=e.byteLength)-Wt,d=!1;o>=0;)if(e[o]!==Gt||e[u]!==Gt&&u!==e.byteLength)o--,u--;else{switch(n=e.subarray(o,u),qt.ts.parseType(n,t.pid)){case"pes":r=qt.ts.parsePesType(n,t.table),a=qt.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=qt.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),d=!0)}if(d)break;o-=Wt,u-=Wt}},jt=function(e,t,i){for(var n,r,a,s,o,u,d,l=0,c=Wt,h=!1,f={data:[],size:0};c=0;)if(e[l]!==Gt||e[c]!==Gt)l--,c--;else{switch(n=e.subarray(l,c),qt.ts.parseType(n,t.pid)){case"pes":r=qt.ts.parsePesType(n,t.table),a=qt.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=qt.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),h=!0)}if(h)break;l-=Wt,c-=Wt}},Xt=function(e,t){var i;return(i=qt.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,a=null,s=0,o=0;e.length-o>=3;){switch(qt.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=qt.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=qt.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=qt.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=qt.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var u=Ht/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*u,pts:a+1024*n*u}]}}(e):function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=Wt;r0}(f)){t.isFmp4=!0;var p=t.map.tracks,m={isFmp4:!0,hasVideo:!!p.video,hasAudio:!!p.audio};p.audio&&p.audio.codec&&"enca"!==p.audio.codec&&(m.audioCodec=p.audio.codec),p.video&&p.video.codec&&"encv"!==p.video.codec&&(m.videoCodec=p.video.codec),p.video&&p.audio&&(m.isMuxed=!0),n(t,m);var g=function(e){c(t,{data:f,type:m.hasAudio&&!m.isMuxed?"audio":"video"}),e&&e.length&&u(t,e),h(null,t,{})};pi({action:"probeMp4StartTime",timescales:t.map.timescales,data:f,transmuxer:t.transmuxer,callback:function(e){var n=e.data,a=e.startTime;i=n.buffer,t.bytes=f=n,m.hasAudio&&!m.isMuxed&&r(t,"audio","start",a),m.hasVideo&&r(t,"video","start",a),p.video&&n.byteLength&&t.transmuxer?pi({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:f,timescales:t.map.timescales,trackIds:[p.video.id],callback:function(e){i=e.data.buffer,t.bytes=f=e.data,g(e.captions)}}):g()}})}else if(t.transmuxer){if(void 0===t.container&&(t.container=$t(f)),"ts"!==t.container&&"aac"!==t.container)return n(t,{hasAudio:!1,hasVideo:!1}),void h(null,t,{});bi({segment:t,bytes:i,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:d,endedTimelineFn:l,dataFn:c,doneFn:h})}else h(null,t,{})},Ii=function(e,t){var i,n=e.id,r=e.key,a=e.encryptedBytes,s=e.decryptionWorker;s.addEventListener("message",(function e(i){if(i.data.source===n){s.removeEventListener("message",e);var r=i.data.decrypted;t(new Uint8Array(r.bytes,r.byteOffset,r.byteLength))}})),i=r.bytes.slice?r.bytes.slice():new Uint32Array(Array.prototype.slice.call(r.bytes)),s.postMessage(Be({source:n,encrypted:a,key:i,iv:r.iv}),[a.buffer,i.buffer])},Ei=function(e){var t=e.xhr,i=e.xhrOptions,n=e.decryptionWorker,r=e.segment,a=e.abortFn,s=e.progressFn,o=e.trackInfoFn,d=e.timingInfoFn,l=e.videoSegmentTimingInfoFn,c=e.audioSegmentTimingInfoFn,h=e.id3Fn,f=e.captionsFn,p=e.isEndOfTimeline,m=e.endedTimelineFn,g=e.dataFn,y=e.doneFn,_=[],v=function(e){var t=e.activeXhrs,i=e.decryptionWorker,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,d=e.isEndOfTimeline,l=e.endedTimelineFn,c=e.dataFn,h=e.doneFn,f=0,p=!1;return function(e,m){if(!p){if(e)return p=!0,yi(t),h(e,m);if((f+=1)===t.length){var g=function(){if(m.encryptedBytes)return function(e){var t=e.decryptionWorker,i=e.segment,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,d=e.isEndOfTimeline,l=e.endedTimelineFn,c=e.dataFn,h=e.doneFn;Ii({id:i.requestId,key:i.key,encryptedBytes:i.encryptedBytes,decryptionWorker:t},(function(e){i.bytes=e,Si({segment:i,bytes:i.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:d,endedTimelineFn:l,dataFn:c,doneFn:h})}))}({decryptionWorker:i,segment:m,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:d,endedTimelineFn:l,dataFn:c,doneFn:h});Si({segment:m,bytes:m.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:d,endedTimelineFn:l,dataFn:c,doneFn:h})};if(m.endOfAllRequests=Date.now(),m.map&&m.map.encryptedBytes&&!m.map.bytes)return Ii({decryptionWorker:i,id:m.requestId+"-init",encryptedBytes:m.map.encryptedBytes,key:m.map.key},(function(e){m.map.bytes=e,Ti(m,(function(e){if(e)return yi(t),h(e,m);g()}))}));g()}}}}({activeXhrs:_,decryptionWorker:n,trackInfoFn:o,timingInfoFn:d,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:h,captionsFn:f,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y});if(r.key&&!r.key.bytes){var T=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&T.push(r.map.key);var b=t(u.default.mergeOptions(i,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),vi(r,T,v));_.push(b)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){var S=t(u.default.mergeOptions(i,{uri:r.map.key.resolvedUri,responseType:"arraybuffer"}),vi(r,[r.map.key],v));_.push(S)}var I=t(u.default.mergeOptions(i,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Oe(r.map)}),function(e){var t=e.segment,i=e.finishProcessingFn;return function(e,n){var r=_i(e,n);if(r)return i(r,t);var a=new Uint8Array(n.response);if(t.map.key)return t.map.encryptedBytes=a,i(null,t);t.map.bytes=a,Ti(t,(function(e){if(e)return e.xhr=n,e.status=n.status,i(e,t);i(null,t)}))}}({segment:r,finishProcessingFn:v}));_.push(I)}var E=u.default.mergeOptions(i,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:Oe(r)}),w=t(E,function(e){var t=e.segment,i=e.finishProcessingFn,n=e.responseType;return function(e,r){var a=_i(e,r);if(a)return i(a,t);var s="arraybuffer"!==n&&r.responseText?function(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),i=0;i1)return wi("multiple "+e+" codecs found as attributes: "+t[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(t[e]=null);t[e]=t[e][0]})),t},Pi=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},ki=function(e,t){var i=t.attributes||{},n=Li(function(e){var t=e.attributes||{};if(t.CODECS)return U(t.CODECS)}(t)||[]);if(Ai(e,t)&&!n.audio&&!function(e,t){if(!Ai(e,t))return!0;var i=t.attributes||{},n=e.mediaGroups.AUDIO[i.AUDIO];for(var r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1}(e,t)){var r=Li(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return U(r.playlists[0].attributes.CODECS)}return null}(e,i.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},Oi=_("PlaylistSelector"),xi=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},Di=function(e,t){if(!e)return"";var i=o.default.getComputedStyle(e);return i?i[t]:""},Ci=function(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))},Ui=function(e,t){var i,n;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||o.default.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),i-(n||o.default.Number.MAX_VALUE)},Ri=function(e,t,i,n,r,a){if(e){var s={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r},u=e.playlists;ce.isAudioOnly(e)&&(u=a.getAudioTrackPlaylists_(),s.audioOnly=!0);var d=u.map((function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||o.default.Number.MAX_VALUE,width:t,height:i,playlist:e}}));Ci(d,(function(e,t){return e.bandwidth-t.bandwidth}));var l=(d=d.filter((function(e){return!ce.isIncompatible(e.playlist)}))).filter((function(e){return ce.isEnabled(e.playlist)}));l.length||(l=d.filter((function(e){return!ce.isDisabled(e.playlist)})));var c=l.filter((function(e){return e.bandwidth*ri.BANDWIDTH_VARIANCEi||e.height>n}))).filter((function(e){return e.width===_[0].width&&e.height===_[0].height})),h=v[v.length-1],T=v.filter((function(e){return e.bandwidth===h.bandwidth}))[0]);var S=T||b||f||l[0]||d[0];if(S&&S.playlist){var I="sortedPlaylistReps";return T?I="resolutionPlusOneRep":b?I="resolutionBestRep":f?I="bandwidthBestRep":l[0]&&(I="enabledPlaylistReps"),Oi("choosing "+xi(S)+" using "+I+" with options",s),S.playlist}return Oi("could not choose a playlist with options",s),null}},Mi=function(){var e=this.useDevicePixelRatio&&o.default.devicePixelRatio||1;return Ri(this.playlists.master,this.systemBandwidth,parseInt(Di(this.tech_.el(),"width"),10)*e,parseInt(Di(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},Bi=function(e,t,i){var n,r;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime>=e&&r.endTime<=t&&i.removeCue(r)},Ni=9e4,Fi=Ni,qi=(function(e){return e*Ni},function(e,t){return e*t},function(e){return e/Ni},function(e,t){return e/t},function(e){return"number"==typeof e&&isFinite(e)}),Hi=1/60,Wi=function(e){var t=e.startOfSegment,i=e.duration,n=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,u=a.segments,d=void 0===u?[]:u,l=e.mediaIndex,c=e.partIndex,h=e.timeline,f=d.length-1,p="mediaIndex/partIndex increment";e.getMediaInfoForTime?p="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(p="getSyncSegmentCandidate (isSyncRequest)");var m="number"==typeof c,g=e.segment.uri?"segment":"pre-segment",y=m?$({preloadSegment:n})-1:0;return g+" ["+(s+l)+"/"+(s+f)+"]"+(m?" part ["+c+"/"+y+"]":"")+" segment start/end ["+n.start+" => "+n.end+"]"+(m?" part start/end ["+r.start+" => "+r.end+"]":"")+" startOfSegment ["+t+"] duration ["+i+"] timeline ["+h+"] selected by ["+p+"] playlist ["+o+"]"},Gi=function(e){return e+"TimingInfo"},Vi=function(e){var t=e.timelineChangeController,i=e.currentTimeline,n=e.segmentTimeline,r=e.loaderType,a=e.audioDisabled;if(i===n)return!1;if("audio"===r){var s=t.lastTimelineChange({type:"main"});return!s||s.to!==n}if("main"===r&&a){var o=t.pendingTimelineChange({type:"audio"});return!o||o.to!==n}return!1},ji=function(e){var t=e.segmentDuration,i=e.maxDuration;return!!t&&Math.round(t)>i+q},Xi=function(e){function t(t,i){var n;if(n=e.call(this)||this,!t)throw new TypeError("Initialization settings are required");if("function"!=typeof t.currentTime)throw new TypeError("No currentTime getter specified");if(!t.mediaSource)throw new TypeError("No MediaSource specified");return n.bandwidth=t.bandwidth,n.throughput={rate:0,count:0},n.roundTrip=NaN,n.resetStats_(),n.mediaIndex=null,n.partIndex=null,n.hasPlayed_=t.hasPlayed,n.currentTime_=t.currentTime,n.seekable_=t.seekable,n.seeking_=t.seeking,n.duration_=t.duration,n.mediaSource_=t.mediaSource,n.vhs_=t.vhs,n.loaderType_=t.loaderType,n.currentMediaInfo_=void 0,n.startingMediaInfo_=void 0,n.segmentMetadataTrack_=t.segmentMetadataTrack,n.goalBufferLength_=t.goalBufferLength,n.sourceType_=t.sourceType,n.sourceUpdater_=t.sourceUpdater,n.inbandTextTracks_=t.inbandTextTracks,n.state_="INIT",n.timelineChangeController_=t.timelineChangeController,n.shouldSaveSegmentTimingInfo_=!0,n.parse708captions_=t.parse708captions,n.checkBufferTimeout_=null,n.error_=void 0,n.currentTimeline_=-1,n.pendingSegment_=null,n.xhrOptions_=null,n.pendingSegments_=[],n.audioDisabled_=!1,n.isPendingTimestampOffset_=!1,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=u.default.browser.IE_VERSION>=11,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",(function(){n.isEndOfStream_()||(n.ended_=!1)})),n.fetchAtBuffer_=!1,n.logger_=_("SegmentLoader["+n.loaderType_+"]"),Object.defineProperty(l(n),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",(function(){n.hasEnoughInfoToLoad_()&&n.processLoadQueue_(),n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),n}h(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return function(e){var t=new di;t.currentTransmux=null,t.transmuxQueue=[];var i=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)},t.postMessage({action:"init",options:e}),t}({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_})},i.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},i.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&o.default.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},i.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},i.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},i.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,o.default.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},i.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},i.error=function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},i.endOfStream=function(){this.ended_=!0,this.transmuxer_&&fi(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},i.buffered_=function(){if(!this.sourceUpdater_||!this.startingMediaInfo_)return u.default.createTimeRanges();if("main"===this.loaderType_){var e=this.startingMediaInfo_,t=e.hasAudio,i=e.hasVideo,n=e.isMuxed;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Ne(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e},i.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Fe(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r},i.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},i.load=function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.playlist=function(e,t){if(void 0===t&&(t={}),e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&this.resyncLoader(),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");var a=e.mediaSequence-i.mediaSequence;if(this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var s=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!s.parts||!s.parts.length||!s.parts[this.partIndex])){var o=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=o}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}},i.pause=function(){this.checkBufferTimeout_&&(o.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},i.paused=function(){return null===this.checkBufferTimeout_},i.resetEverything=function(e){this.ended_=!1,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"})},i.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},i.resyncLoader=function(){this.transmuxer_&&fi(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},i.remove=function(e,t,i,n){if(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.startingMediaInfo_){var r=1,a=function(){0==--r&&i()};for(var s in!n&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,a)),(n||"main"===this.loaderType_)&&(this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil((t-n)*Fi),a=Math.ceil((i-n)*Fi),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),s.splice(u,o-u+1),s}(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a)),this.inbandTextTracks_)Bi(e,t,this.inbandTextTracks_[s]);Bi(e,t,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")},i.monitorBuffer_=function(){this.checkBufferTimeout_&&o.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=o.default.setTimeout(this.monitorBufferTick_.bind(this),1)},i.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&o.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=o.default.setTimeout(this.monitorBufferTick_.bind(this),500)},i.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}},i.isEndOfStream_=function(e,t,i){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===i&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var n="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&a},i.chooseNextRequest_=function(){var e=z(this.buffered_())||0,t=Math.max(0,e-this.currentTime_()),i=!this.hasPlayed_()&&t>=1,n=t>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||i||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var a={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(a.isSyncRequest)a.mediaIndex=function(e,t,i){t=t||[];for(var n=[],r=0,a=0;ai))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,r,e);else if(null!==this.mediaIndex){var s=r[this.mediaIndex],o="number"==typeof this.partIndex?this.partIndex:-1;a.startOfSegment=s.end?s.end:e,s.parts&&s.parts[o+1]?(a.mediaIndex=this.mediaIndex,a.partIndex=o+1):a.mediaIndex=this.mediaIndex+1}else{var u=ce.getMediaInfoForTime({playlist:this.playlist_,currentTime:this.fetchAtBuffer_?e:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),d=u.segmentIndex,l=u.startTime,c=u.partIndex;a.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd":"currentTime",a.mediaIndex=d,a.startOfSegment=l,a.partIndex=c}var h=r[a.mediaIndex],f=h&&"number"==typeof a.partIndex&&h.parts&&h.parts[a.partIndex];if(!h||"number"==typeof a.partIndex&&!f)return null;"number"!=typeof a.partIndex&&h.parts&&(a.partIndex=0);var p=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return a.mediaIndex>=r.length-1&&p&&!this.seeking_()?null:this.generateSegmentInfo_(a)},i.generateSegmentInfo_=function(e){var t=e.playlist,i=e.mediaIndex,n=e.startOfSegment,r=e.isSyncRequest,a=e.partIndex,s=e.forceTimestampOffset,o=e.getMediaInfoForTime,u=t.segments[i],d="number"==typeof a&&u.parts[a],l={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||u.resolvedUri,mediaIndex:i,partIndex:d?a:null,isSyncRequest:r,startOfSegment:n,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:d&&d.duration||u.duration,segment:u,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o},c=void 0!==s?s:this.isPendingTimestampOffset_;l.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:u.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),overrideCheck:c});var h=z(this.sourceUpdater_.audioBuffered());return"number"==typeof h&&(l.audioAppendStart=h-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(l.gopsToAlignWith=function(e,t,i){if(null==t||!e.length)return[];var n,r=Math.ceil((t-i+3)*Fi);for(n=0;nr);n++);return e.slice(n)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),l},i.timestampOffsetForSegment_=function(e){return i=(t=e).segmentTimeline,n=t.currentTimeline,r=t.startOfSegment,a=t.buffered,t.overrideCheck||i!==n?i "+s+" for "+e),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"});var n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);var r=t.textTracks().getTrackById(n);if(r)e[i]=r;else{var a=i,s=i,o=!1,u=(t.options_.vhs&&t.options_.vhs.captionServices||{})[n];u&&(a=u.label,s=u.language,o=u.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:n,default:o,label:a,language:s},!1).track}}}(d,i.vhs_.tech_,e),Bi(a,s,d[e]),function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var r=o.default.WebKitDataCue||o.default.VTTCue;i.forEach((function(e){var i=e.stream;t[i].addCue(new r(e.startTime+n,e.endTime+n,e.text))}))}}({captionArray:u,inbandTextTracks:d,timestampOffset:n})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")},i.handleId3_=function(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();!function(e,t,i){e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)}(this.inbandTextTracks_,i,this.vhs_.tech_),function(e){var t=e.inbandTextTracks,i=e.metadataArray,n=e.timestampOffset,r=e.videoDuration;if(i){var a=o.default.WebKitDataCue||o.default.VTTCue,s=t.metadataTrack_;if(s&&(i.forEach((function(e){var t=e.cueTime+n;!("number"!=typeof t||o.default.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((function(e){var i=new a(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return u.default.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return u.default.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return u.default.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(i),s.addCue(i)}))})),s.cues&&s.cues.length)){for(var d=s.cues,l=[],c=0;c1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+X(s).join(", ")),u.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+X(u).join(", "));var d=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,c=u.length?u.start(0):0,h=u.length?u.end(u.length-1):0;if(l-d<=1&&h-c<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+a.byteLength+", audio buffer: "+X(s).join(", ")+", video buffer: "+X(u).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:n,type:r,bytes:a}));var f=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+f),this.remove(0,f,(function(){i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=o.default.setTimeout((function(){i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),i.quotaExceededErrorRetryTimeout_=null,i.processCallQueue_()}),1e3)}),!0)},i.handleAppendError_=function(e,t){var i=e.segmentInfo,n=e.type,r=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(n+" append of "+r.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:i,type:n,bytes:r}))},i.appendToSourceBuffer_=function(e){var t,i,n,r=e.segmentInfo,a=e.type,s=e.initSegment,o=e.data,u=e.bytes;if(!u){var d=[o],l=o.byteLength;s&&(d.unshift(s),l+=s.byteLength),n=0,(t={bytes:l,segments:d}).bytes&&(i=new Uint8Array(t.bytes),t.segments.forEach((function(e){i.set(e,n),n+=e.byteLength}))),u=i}this.sourceUpdater_.appendBuffer({segmentInfo:r,type:a,bytes:u},this.handleAppendError_.bind(this,{segmentInfo:r,type:a,bytes:u}))},i.handleSegmentTimingInfo_=function(e,t,i){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var n=this.pendingSegment_.segment,r=e+"TimingInfo";n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}},i.appendData_=function(e,t){var i=t.type,n=t.data;if(n&&n.byteLength&&("audio"!==i||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}},i.loadSegment_=function(e){var t=this;this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((function(){var i=v({},e,{forceTimestampOffset:!0});v(e,t.generateSegmentInfo_(i)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)}))},i.updateTransmuxerAndRequestSegment_=function(e){var t=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,a=e.timeline!==this.currentTimeline_&&e.timeline>0,s=n||r&&a;this.logger_("Requesting "+Wi(e)),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Ei({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:s,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this)})},i.trimBackBuffer_=function(e){var t=function(e,t,i){var n=t-ri.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));var r=t-i;return Math.min(r,n)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)},i.createSimplifiedSegmentObj_=function(e){var t=e.segment,i=e.part,n={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},r=e.playlist.segments[e.mediaIndex-1];if(r&&r.timeline===t.timeline&&(r.videoTimingInfo?n.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(n.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key){var a=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=a}return t.map&&(n.map=this.initSegmentForMap(t.map)),n},i.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},i.saveBandwidthRelatedStats_=function(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}},i.setTimeMapping_=function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)},i.updateMediaSecondsLoaded_=function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},i.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},i.trueSegmentStart_=function(e){var t=e.currentStart,i=e.playlist,n=e.mediaIndex,r=e.firstVideoFrameTimeForData,a=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,o=e.videoTimingInfo,u=e.audioTimingInfo;if(void 0!==t)return t;if(!s)return u.start;var d=i.segments[n-1];return 0!==n&&d&&void 0!==d.start&&d.end===r+a?o.start:r},i.waitForAppendsToComplete_=function(e){if(!this.currentMediaInfo_)return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var t=this.currentMediaInfo_,i=t.hasAudio,n=t.hasVideo,r=t.isMuxed,a="main"===this.loaderType_&&n,s=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);a&&e.waitingOnAppends++,s&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},i.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},i.checkForIllegalMediaSwitch=function(e){var t=function(e,t,i){return"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null}(this.loaderType_,this.currentMediaInfo_,e);return!!t&&(this.error({message:t,blacklistDuration:1/0}),this.trigger("error"),!0)},i.updateSourceBufferTimestampOffset_=function(e){if(null!==e.timestampOffset&&"number"==typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var t=!1;e.timestampOffset-=e.timingInfo.start,e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}},i.updateTimingInfoEnd_=function(e){e.timingInfo=e.timingInfo||{};var t="main"===this.loaderType_&&this.currentMediaInfo_.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;t&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)},i.handleAppendsDone_=function(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});var t=function(e,t){if("hls"!==t)return null;var i,n,r,a,s=(i=e.audioTimingInfo,n=e.videoTimingInfo,r=i&&"number"==typeof i.start&&"number"==typeof i.end?i.end-i.start:0,a=n&&"number"==typeof n.start&&"number"==typeof n.end?n.end-n.start:0,Math.max(r,a));if(!s)return null;var o=e.playlist.targetDuration,u=ji({segmentDuration:s,maxDuration:2*o}),d=ji({segmentDuration:s,maxDuration:o}),l="Segment with index "+e.mediaIndex+" from playlist "+e.playlist.id+" has a duration of "+s+" when the reported duration is "+e.duration+" and the target duration is "+o+". For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";return u||d?{severity:u?"warn":"info",message:l}:null}(e,this.sourceType_);if(t&&("warn"===t.severity?u.default.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",!e.isSyncRequest||(this.trigger("syncinfoupdate"),e.hasAppendedData_)){this.logger_("Appended "+Wi(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");var i=e.segment;i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration?this.resetEverything():(null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_())}else this.logger_("Throwing away un-appended sync request "+Wi(e))},i.recordThroughput_=function(e){if(e.duration=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e},i.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},i.segmentRequestFinished_=function(e,t,i){var n=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===mi&&this.handleTimeout_(),e.code===gi?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),this.state="APPENDING",this.trigger("appending");var a=r.segment;if(a.map&&(a.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof o.default.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var s,u=function(){n.subtitlesTrack_.tech_.off("vttjsloaded",s),n.stopForError({message:"Error loading vtt.js"})};return s=function(){n.subtitlesTrack_.tech_.off("vttjserror",u),n.segmentRequestFinished_(e,t,i)},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",s),void this.subtitlesTrack_.tech_.one("vttjserror",u)}a.requested=!0;try{this.parseVTTCues_(r)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,r.cues.forEach((function(e){n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_?new o.default.VTTCue(e.startTime,e.endTime,e.text):e)})),function(e){var t=e.cues;if(t)for(var i=0;i1&&n.push(t[a]);n.length&&n.forEach((function(t){return e.removeCue(t)}))}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},i.handleData_=function(){},i.updateTimingInfoEnd_=function(){},i.parseVTTCues_=function(e){var t,i=!1;"function"==typeof o.default.TextDecoder?t=new o.default.TextDecoder("utf8"):(t=o.default.WebVTT.StringDecoder(),i=!0);var n=new o.default.WebVTT.Parser(o.default,o.default.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){e.timestampmap=t},n.onparsingerror=function(e){u.default.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;i&&(r=fn(r)),n.parse(r)}var a=e.bytes;i&&(a=fn(a)),n.parse(a),n.flush()},i.updateTimeMapping_=function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,a=r.MPEGTS/Fi-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=a,e.endTime+=a})),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}else n.empty=!0},t}(Xi),gn=function(e,t){for(var i=e.cues,n=0;n=r.adStartTime&&t<=r.adEndTime)return r}return null},yn=[{name:"VOD",run:function(e,t,i,n,r){return i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var a=null,s=null,o=Y(t);r=r||0;for(var u=0;u=h)&&(s=h,a={time:c,segmentIndex:d.segmentIndex,partIndex:d.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o=c)&&(s=c,a={time:l.time,segmentIndex:u,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],_n=function(e){function t(t){var i;return(i=e.call(this)||this).timelines=[],i.discontinuities=[],i.timelineToDatetimeMappings={},i.logger_=_("SyncController"),i}h(t,e);var i=t.prototype;return i.getSyncPoint=function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null},i.getExpiredTime=function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+te({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))},i.runStrategies_=function(e,t,i,n){for(var r=[],a=0;a=0;i--){var n=e.segments[i];if(n&&void 0!==n.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:n.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},i.setDateTimeMappingForStart=function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}},i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i),r=t.segment;n&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start}));var a=r.dateTimeObject;r.discontinuity&&i&&a&&(this.timelineToDatetimeMappings[r.timeline]=-a.getTime()/1e3)},i.timestampOffsetForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].time},i.mappingForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping},i.calculateSegmentTimeMapping_=function(e,t,i){var n,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+o.time+"] [mapping: "+o.mapping+"]")),n=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=n,s.end=r),(!a.start||no){var u;u=s<0?i.start-te({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+te({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:u,accuracy:o}}}},i.dispose=function(){this.trigger("dispose"),this.off()},t}(u.default.EventTarget),vn=function(e){function t(){var t;return(t=e.call(this)||this).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}h(t,e);var i=t.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.lastTimelineChanges_[t]={type:t,from:i,to:n},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(u.default.EventTarget),Tn=si(oi(ui((function(){function e(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var t=e((function(e){function t(e,t){for(var i=0;i-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n>7))^e]=e;for(t=i=0;!c[t];t^=n||1,i=p[i]||1)for(a=(a=i^i<<1^i<<2^i<<3^i<<4)>>8^255&a^99,c[t]=a,h[a]=t,o=16843009*f[r=f[n=f[t]]]^65537*r^257*n^16843008*t,s=257*f[a]^16843008*a,e=0;e<4;e++)d[e][t]=s=s<<24^s>>>8,l[e][a]=o=o<<24^o>>>8;for(e=0;e<5;e++)d[e]=d[e].slice(0),l[e]=l[e].slice(0);return u}()),this._tables=[[a[0][0].slice(),a[0][1].slice(),a[0][2].slice(),a[0][3].slice(),a[0][4].slice()],[a[1][0].slice(),a[1][1].slice(),a[1][2].slice(),a[1][3].slice(),a[1][4].slice()]];var r=this._tables[0][4],s=this._tables[1],o=e.length,u=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");var d=e.slice(0),l=[];for(this._key=[d,l],t=o;t<4*o+28;t++)n=d[t-1],(t%o==0||8===o&&t%o==4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],t%o==0&&(n=n<<8^n>>>24^u<<24,u=u<<1^283*(u>>7))),d[t]=d[t-o]^n;for(i=0;t;i++,t--)n=d[3&i?t:t-4],l[i]=t<=4||i<4?n:s[0][r[n>>>24]]^s[1][r[n>>16&255]]^s[2][r[n>>8&255]]^s[3][r[255&n]]}return e.prototype.decrypt=function(e,t,i,n,r,a){var s,o,u,d,l=this._key[1],c=e^l[0],h=n^l[1],f=i^l[2],p=t^l[3],m=l.length/4-2,g=4,y=this._tables[1],_=y[0],v=y[1],T=y[2],b=y[3],S=y[4];for(d=0;d>>24]^v[h>>16&255]^T[f>>8&255]^b[255&p]^l[g],o=_[h>>>24]^v[f>>16&255]^T[p>>8&255]^b[255&c]^l[g+1],u=_[f>>>24]^v[p>>16&255]^T[c>>8&255]^b[255&h]^l[g+2],p=_[p>>>24]^v[c>>16&255]^T[h>>8&255]^b[255&f]^l[g+3],g+=4,c=s,h=o,f=u;for(d=0;d<4;d++)r[(3&-d)+a]=S[c>>>24]<<24^S[h>>16&255]<<16^S[f>>8&255]<<8^S[255&p]^l[g++],s=c,c=h,h=f,f=p,p=s},e}(),o=function(e){function t(){var t;return(t=e.call(this,r)||this).jobs=[],t.delay=1,t.timeout_=null,t}n(t,e);var i=t.prototype;return i.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(r),u=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},d=function(){function e(t,i,n,r){var a=e.STEP,s=new Int32Array(t.buffer),d=new Uint8Array(t.byteLength),l=0;for(this.asyncStream_=new o,this.asyncStream_.push(this.decryptChunk_(s.subarray(l,l+a),i,n,d)),l=a;l>2),m=new s(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),y=new Int32Array(g.buffer);for(n=i[0],r=i[1],a=i[2],o=i[3],f=0;f=0&&(t="main-desc"),t},Sn=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},In=function(e,t){t.activePlaylistLoader=e,e.load()},En={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;Sn(i,n);var a=n.activeTrack(),s=n.activeGroup(),o=(s.filter((function(e){return e.default}))[0]||s[0]).id,d=n.tracks[o];if(a!==d){for(var l in u.default.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[l].enabled=n.tracks[l]===d;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];u.default.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Sn(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},wn={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",En[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",En[e](e,i))}},An={AUDIO:function(e,t){var i=t.vhs,n=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],d=o.groups,l=o.tracks,c=o.logger_,h=t.masterPlaylistLoader,f=le(h.master);for(var p in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}}),s[e])for(var m in d[p]||(d[p]=[]),s[e][p]){var g=s[e][p][m],y=void 0;if(f?(c("AUDIO group '"+p+"' label '"+m+"' is a master playlist"),g.isMasterPlaylist=!0,y=null):y="vhs-json"===n&&g.playlists?new we(g.playlists[0],i,a):g.resolvedUri?new we(g.resolvedUri,i,a):g.playlists&&"dash"===n?new ni(g.playlists[0],i,a,h):null,g=u.default.mergeOptions({id:m,playlistLoader:y},g),wn[e](e,g.playlistLoader,t),d[p].push(g),void 0===l[m]){var _=new u.default.AudioTrack({id:m,kind:bn(g),enabled:!1,language:g.language,default:g.default,label:m});l[m]=_}}r.on("error",En[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,d=t.mediaTypes[e],l=d.groups,c=d.tracks,h=t.masterPlaylistLoader;for(var f in o[e])for(var p in l[f]||(l[f]=[]),o[e][f])if(!o[e][f][p].forced){var m=o[e][f][p],g=void 0;if("hls"===r)g=new we(m.resolvedUri,n,s);else if("dash"===r){if(!m.playlists.filter((function(e){return e.excludeUntil!==1/0})).length)return;g=new ni(m.playlists[0],n,s,h)}else"vhs-json"===r&&(g=new we(m.playlists?m.playlists[0]:m.resolvedUri,n,s));if(m=u.default.mergeOptions({id:p,playlistLoader:g},m),wn[e](e,m.playlistLoader,t),l[f].push(m),void 0===c[p]){var y=i.addRemoteTextTrack({id:p,kind:"subtitles",default:m.default&&m.autoselect,language:m.language,label:p},!1).track;c[p]=y}}a.on("error",En[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in n[e])for(var d in a[o]||(a[o]=[]),n[e][o]){var l=n[e][o][d];if(/^(?:CC|SERVICE)/.test(l.instreamId)){var c=i.options_.vhs&&i.options_.vhs.captionServices||{},h={label:d,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(c[h.instreamId]&&(h=u.default.mergeOptions(h,c[h.instreamId])),void 0===h.default&&delete h.default,a[o].push(u.default.mergeOptions({id:d},l)),void 0===s[d]){var f=i.addRemoteTextTrack({id:h.instreamId,kind:"captions",default:h.default,language:h.language,label:h.label},!1).track;s[d]=f}}}}},Ln=function e(t,i){for(var n=0;n "+a+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,i)},i.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=o.default.setInterval((function(){return e.checkABR_()}),250)},i.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(o.default.clearInterval(this.abrTimer_),this.abrTimer_=null)},i.getAudioTrackPlaylists_=function(){var e=this.master();if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return e&&e.playlists||[];var t,i=e.mediaGroups.AUDIO,n=Object.keys(i);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)t=this.mediaTypes_.AUDIO.activeTrack();else{var r=i.main||n.length&&i[n[0]];for(var a in r)if(r[a].default){t={label:a};break}}if(!t)return[];var s=[];for(var o in i)if(i[o][t.label]){var u=i[o][t.label];u.playlists?s.push.apply(s,u.playlists):s.push(u)}return s},i.setupMasterPlaylistLoaderListeners_=function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;oe(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){An[t](t,e)}));var t=e.mediaTypes,i=e.masterPlaylistLoader,n=e.tech,r=e.vhs,a=e.segmentLoaders,s=a.AUDIO,o=a.main;["AUDIO","SUBTITLES"].forEach((function(i){t[i].activeGroup=function(e,t){return function(i){var n=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,a=n.media();if(!a)return null;var s=null;a.attributes[e]&&(s=r[a.attributes[e]]);var o=Object.keys(r);if(!s)if("AUDIO"===e&&o.length>1&&le(t.master))for(var u=0;u1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},i.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media(),i=this.tech_.buffered();return function(e){var t=e.currentPlaylist,i=e.nextPlaylist,n=e.forwardBuffer,r=e.bufferLowWaterLine,a=e.bufferHighWaterLine,s=e.duration,o=e.experimentalBufferBasedABR,d=e.log;if(!i)return u.default.log.warn("We received no playlist to switch to. Please check your stream."),!1;var l="allowing switch "+(t&&t.id||"null")+" -> "+i.id;if(!t||!t.endList)return d(l+" as current playlist "+(t?"is live":"is not set")),!0;if(i.id===t.id)return!1;var c=o?ri.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:ri.MAX_BUFFER_LOW_WATER_LINE;if(sf)&&n>=r){var m=l+" as forwardBuffer >= bufferLowWaterLine ("+n+" >= "+r+")";return o&&(m+=" and next bandwidth > current bandwidth ("+h+" > "+f+")"),d(m),!0}return d("not "+l+" as no switching criteria met"),!1}({currentPlaylist:t,nextPlaylist:e,forwardBuffer:i.length?i.end(i.length-1)-this.tech_.currentTime():0,bufferLowWaterLine:this.bufferLowWaterLine(),bufferHighWaterLine:this.bufferHighWaterLine(),duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},i.setupSegmentLoaderListeners_=function(){var e=this;this.experimentalBufferBasedABR||(this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist();e.shouldSwitchToMedia_(t)&&e.switchMedia_(t,"bandwidthupdate"),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")}))),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("appenderror",(function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("ended",(function(){e.logger_("main segment loader ended"),e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(t){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120))}));var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()}))},i.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},i.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},i.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},i.fastQualityChange_=function(e){var t=this;void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((function(){u.default.browser.IE_VERSION||u.default.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")},i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()this.maxPlaylistRetries?1/0:Date.now()+1e3*t,i.excludeUntil=n,e.reason&&(i.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var d=this.selectPlaylist();if(!d)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var l=e.internal?this.logger_:u.default.log.warn,c=e.message?" "+e.message:"";l((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+c+" Switching to playlist "+d.id+"."),d.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),d.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var h=d.targetDuration/2*1e3||5e3,f="number"==typeof d.lastRequest&&Date.now()-d.lastRequest<=h;return this.switchMedia_(d,"exclude",s||f)},i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},i.delegateLoaders_=function(e,t){var i=this,n=[],r="all"===e;(r||"main"===e)&&n.push(this.masterPlaylistLoader_);var a=[];(r||"audio"===e)&&a.push("AUDIO"),(r||"subtitle"===e)&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach((function(e){var t=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader;t&&n.push(t)})),["main","audio","subtitle"].forEach((function(t){var r=i[t+"SegmentLoader_"];!r||e!==t&&"all"!==e||n.push(r)})),n.forEach((function(e){return t.forEach((function(t){"function"==typeof e[t]&&e[t]()}))}))},i.setCurrentTime=function(e){var t=G(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0},i.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Qi.Playlist.duration(e):1/0:0},i.seekable=function(){return this.seekable_},i.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n=this.masterPlaylistLoader_.master,r=Qi.Playlist.seekable(t,i,Qi.Playlist.liveEdgeDelay(n,t));if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=Qi.Playlist.seekable(t,i,Qi.Playlist.liveEdgeDelay(n,t))).length)return}var a,s;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),s=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=u.default.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)0&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}},i.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()},i.master=function(){return this.masterPlaylistLoader_.master},i.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},i.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader;return!(!this.mainSegmentLoader_.currentMediaInfo_||e&&!this.audioSegmentLoader_.currentMediaInfo_)},i.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.currentMediaInfo_||{},audio:this.audioSegmentLoader_.currentMediaInfo_||{}};t.video=t.main;var i=ki(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||F)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r)&&(n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||F,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),n.audio||n.video){var a,s={};if(["video","audio"].forEach((function(e){if(n.hasOwnProperty(e)&&(r=t[e].isFmp4,o=n[e],!(r?B(o):N(o)))){var i=t[e].isFmp4?"browser":"muxer";s[i]=s[i]||[],s[i].push(n[e]),"audio"===e&&(a=i)}var r,o})),r&&a&&this.media().attributes.AUDIO){var o=this.media().attributes.AUDIO;this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===o&&t!==e.media()&&(t.excludeUntil=1/0)})),this.logger_("excluding audio group "+o+" as "+a+' does not support codec(s): "'+n.audio+'"')}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var u=[];if(["video","audio"].forEach((function(t){var i=(U(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(U(n[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&u.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+n[t]+'"')})),u.length)return void this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+u.join(", ")+".",blacklistDuration:1/0,internal:!0})}return n}var d=Object.keys(s).reduce((function(e,t){return e&&(e+=", "),e+(t+' does not support codec(s): "')+s[t].join(",")+'"'}),"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:d,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},i.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}},i.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,i=[];Object.keys(t).forEach((function(n){var r=t[n];if(-1===i.indexOf(r.id)){i.push(r.id);var a=ki(e.master,r),s=[];!a.audio||N(a.audio)||B(a.audio)||s.push("audio codec "+a.audio),!a.video||N(a.video)||B(a.video)||s.push("video codec "+a.video),a.text&&"stpp.ttml.im1t"===a.text&&s.push("text codec "+a.text),s.length&&(r.excludeUntil=1/0,e.logger_("excluding "+r.id+" for unsupported: "+s.join(", ")))}}))},i.excludeIncompatibleVariants_=function(e){var t=this,i=[],n=this.master().playlists,r=Li(U(e)),a=Pi(r),s=r.video&&U(r.video)[0]||null,o=r.audio&&U(r.audio)[0]||null;Object.keys(n).forEach((function(e){var r=n[e];if(-1===i.indexOf(r.id)&&r.excludeUntil!==1/0){i.push(r.id);var u=[],d=ki(t.masterPlaylistLoader_.master,r),l=Pi(d);if(d.audio||d.video){if(l!==a&&u.push('codec count "'+l+'" !== "'+a+'"'),!t.sourceUpdater_.canChangeType()){var c=d.video&&U(d.video)[0]||null,h=d.audio&&U(d.audio)[0]||null;c&&s&&c.type.toLowerCase()!==s.type.toLowerCase()&&u.push('video codec "'+c.type+'" !== "'+s.type+'"'),h&&o&&h.type.toLowerCase()!==o.type.toLowerCase()&&u.push('audio codec "'+h.type+'" !== "'+o.type+'"')}u.length&&(r.excludeUntil=1/0,t.logger_("blacklisting "+r.id+": "+u.join(" && ")))}}}))},i.updateAdCues_=function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i){if(void 0===i&&(i=0),e.segments)for(var n,r=i,a=0;a0&&this.logger_("resetting possible stalled download count for "+e+" loader"),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var i=0;i=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),i=this.tech_.currentTime();if(this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){var n=t.start(0);e=n+(n===t.end(0)?0:H)}if(void 0!==e)return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+j(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;var r=this.tech_.buffered();return!!function(e){var t=e.buffered,i=e.targetDuration,n=e.currentTime;return!(!t.length||t.end(0)-t.start(0)<2*i||n>t.start(0)||!(t.start(0)-n "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"}),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;var a=V(r,t);if(a.length>0){var s=a.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+a.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1},t.afterSeekableWindow_=function(e,t,i,n){if(void 0===n&&(n=!1),!e.length)return!1;var r=e.end(e.length-1)+H;return!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:a}}return null},e}(),Rn={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Mn=function e(t,i){var n=0,r=0,a=u.default.mergeOptions(Rn,i);t.ready((function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})}));var s=function(){r&&t.currentTime(r)},o=function(e){null!=e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},d=function(){return Date.now()-n<1e3*a.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):a.getSource&&"function"==typeof a.getSource?(n=Date.now(),a.getSource.call(t,o)):void u.default.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},l=function e(){t.off("loadedmetadata",s),t.off("error",d),t.off("dispose",e)};t.on("error",d),t.on("dispose",l),t.reloadSourceOnError=function(i){l(),e(t,i)}},Bn=function(e){Mn(this,e)},Nn="2.9.1",Fn={PlaylistLoader:we,Playlist:ce,utils:He,STANDARD_PLAYLIST_SELECTOR:Mi,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(ce.isEnabled);return Ci(t,(function(e,t){return Ui(e,t)})),t.filter((function(t){return!!ki(e.playlists.master,t).video}))[0]||null},lastBandwidthSelector:Mi,movingAverageBandwidthSelector:function(e){var t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var n=this.useDevicePixelRatio&&o.default.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),Ri(this.playlists.master,t,parseInt(Di(this.tech_.el(),"width"),10)*n,parseInt(Di(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:Ui,comparePlaylistResolution:function(e,t){var i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||o.default.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),i===(n=n||o.default.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:ke()};Object.keys(ri).forEach((function(e){Object.defineProperty(Fn,e,{get:function(){return u.default.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),ri[e]},set:function(t){u.default.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?u.default.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):ri[e]=t}})}));var qn="videojs-vhs",Hn=function(e,t){for(var i=t.media(),n=-1,r=0;r0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){u.default.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return i.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return i.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return i.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return X(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return X(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!o.default.localStorage)return!1;var t=Xn();t=t?u.default.mergeOptions(t,e):e;try{o.default.localStorage.setItem(qn,JSON.stringify(t))}catch(e){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var e;(e=i).representations=function(){var t=e.masterPlaylistController_.master(),i=le(t)?e.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((function(e){return!re(e)})).map((function(t,i){return new Dn(e,t,t.id)})):[]}})),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",(function(){i.setupEme_()})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.masterPlaylistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=o.default.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},i.setupEme_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,i=jn({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});11!==u.default.browser.IE_VERSION&&i?(this.logger_("waiting for EME key session creation"),Vn({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.master.playlists}).then((function(){e.logger_("created EME key session"),e.masterPlaylistController_.sourceUpdater_.initializedEme()})).catch((function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})}))):this.masterPlaylistController_.sourceUpdater_.initializedEme()},i.setupQualityLevels_=function(){var e=this,t=u.default.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach((function(e){t.addQualityLevel(e)})),Hn(t,i.playlists)})),this.playlists.on("mediachange",(function(){Hn(e.qualityLevels_,e.playlists)})))},t.version=function(){return{"@videojs/http-streaming":Nn,"mux.js":"5.11.1","mpd-parser":"0.17.0","m3u8-parser":"4.7.0","aes-decrypter":"3.1.2"}},i.version=function(){return this.constructor.version()},i.canChangeType=function(){return hn.canChangeType()},i.play=function(){this.masterPlaylistController_.play()},i.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},i.duration=function(){return this.masterPlaylistController_.duration()},i.seekable=function(){return this.masterPlaylistController_.seekable()},i.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&o.default.URL.revokeObjectURL&&(o.default.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),e.prototype.dispose.call(this)},i.convertToProgramTime=function(e,t){return function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===n)return r({message:"getProgramTime: playlist and time must be provided"});var a=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i,n=0,r=0;rn){if(e>n+.25*a.duration)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t);if(!a)return r({message:"valid programTime was not found"});if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)}({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},i.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),We({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},t}(u.default.getComponent("Component")),Yn={name:"videojs-http-streaming",VERSION:Nn,canHandleSource:function(e,t){void 0===t&&(t={});var i=u.default.mergeOptions(u.default.options,t);return Yn.canPlayType(e.type,i)},handleSource:function(e,t,i){void 0===i&&(i={});var n=u.default.mergeOptions(u.default.options,i);return t.vhs=new Qn(e,t,n),u.default.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return u.default.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=ke(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){void 0===t&&(t={});var i=u.default.mergeOptions(u.default.options,t).vhs.overrideNative,n=void 0===i?!u.default.browser.IS_ANY_SAFARI:i,r=Ce(e);return!r||Fn.supportsTypeNatively(r)&&!n?"":"maybe"}};B("avc1.4d400d,mp4a.40.2")&&u.default.getTech("Html5").registerSourceHandler(Yn,0),u.default.VhsHandler=Qn,Object.defineProperty(u.default,"HlsHandler",{get:function(){return u.default.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),Qn},configurable:!0}),u.default.VhsSourceHandler=Yn,Object.defineProperty(u.default,"HlsSourceHandler",{get:function(){return u.default.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),Yn},configurable:!0}),u.default.Vhs=Fn,Object.defineProperty(u.default,"Hls",{get:function(){return u.default.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),Fn},configurable:!0}),u.default.use||(u.default.registerComponent("Hls",Fn),u.default.registerComponent("Vhs",Fn)),u.default.options.vhs=u.default.options.vhs||{},u.default.options.hls=u.default.options.hls||{},u.default.registerPlugin?u.default.registerPlugin("reloadSourceOnError",Bn):u.default.plugin("reloadSourceOnError",Bn),e.LOCAL_STORAGE_KEY=qn,e.Vhs=Fn,e.VhsHandler=Qn,e.VhsSourceHandler=Yn,e.emeKeySystems=Wn,e.expandDataUri=zn,e.getAllPsshKeySystemsOptions=Gn,e.setupEmeOptions=jn,e.simpleTypeFromSourceType=Ce,e.waitForKeySessionCreation=Vn,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/node_modules/@videojs/http-streaming/docs/README.md b/node_modules/@videojs/http-streaming/docs/README.md deleted file mode 100644 index 9a5fc2b..0000000 --- a/node_modules/@videojs/http-streaming/docs/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Overview -This project supports both [HLS][hls] and [MPEG-DASH][dash] playback in the video.js player. This document is intended as a primer for anyone interested in contributing or just better understanding how bits from a server get turned into video on their display. - -## HTTP Live Streaming -[HLS][apple-hls-intro] has two primary characteristics that distinguish it from other video formats: - -- Delivered over HTTP(S): it uses the standard application protocol of the web to deliver all its data -- Segmented: longer videos are broken up into smaller chunks which can be downloaded independently and switched between at runtime - -A standard HLS stream consists of a *Master Playlist* which references one or more *Media Playlists*. Each Media Playlist contains one or more sequential video segments. All these components form a logical hierarchy that informs the player of the different quality levels of the video available and how to address the individual segments of video at each of those levels: - -![HLS Format](images/hls-format.png) - -HLS streams can be delivered in two different modes: a "static" mode for videos that can be played back from any point, often referred to as video-on-demand (VOD); or a "live" mode where later portions of the video become available as time goes by. In the static mode, the Master and Media playlists are fixed. The player is guaranteed that the set of video segments referenced by those playlists will not change over time. - -Live mode can work in one of two ways. For truly live events, the most common configuration is for each individual Media Playlist to only include the latest video segment and a small number of consecutive previous segments. In this mode, the player may be able to seek backwards a short time in the video but probably not all the way back to the beginning. In the other live configuration, new video segments can be appended to the Media Playlists but older segments are never removed. This configuration allows the player to seek back to the beginning of the stream at any time during the broadcast and transitions seamlessly to the static stream type when the event finishes. - -If you're interested in a more in-depth treatment of the HLS format, check out [Apple's documentation][apple-hls-intro] and the IETF [Draft Specification][hls-spec]. - -## Dynamic Adaptive Streaming over HTTP -Similar to HLS, [DASH][dash-wiki] content is segmented and is delivered over HTTP(s). - -A DASH stream consits of a *Media Presentation Description*(MPD) that describes segment metadata such as timing information, URLs, resolution and bitrate. Each segment can contain either ISO base media file format(e.g MP4) or MPEG-2 TS data. Typically, the MPD will describe the various *Representations* that map to collections of segments at different bitrates to allow bitrate selection. These Representations can be organized as a SegmentList, SegmentTemplate, SegmentBase, or SegmentTimeline. - -DASH streams can be delivered in both video-on-demand(VOD) and live streaming modes. In the VOD case, the MPD describes all the segments and representations available and the player can chose which representation to play based on it's capabilities. - -Live mode is accomplished using the ISOBMFF Live profile if the segments are in ISOBMFF. There are a few different ways to setup the MPD including but not limited to updating the MPD after an interval of time, using *Periods*, or using the *availabilityTimeOffset* field. A few examples of this are provided by the [DASH Reference Client][dash-if-reference-client]. The MPD will provide enough information for the player to playback the live stream and seek back as far as is specified in the MPD. - -If you're interested in a more in-depth description of MPEG-DASH, check out [MDN's tutorial on setting up DASH][mdn-dash-tut] or the [DASHIF Guidelines][dash-if-guide]. - -# Further Documentation - -- [Architechture](arch.md) -- [Glossary](glossary.md) -- [Adaptive Bitrate Switching](bitrate-switching.md) -- [Multiple Alternative Audio Tracks](multiple-alternative-audio-tracks.md) -- [reloadSourceOnError](reload-source-on-error.md) - -# Helpful Tools -- [FFmpeg](http://trac.ffmpeg.org/wiki/CompilationGuide) -- [Thumbcoil](http://thumb.co.il/): web based video inspector - -[hls]: /docs/intro.md#http-live-streaming -[dash]: /docs/intro.md#dynamic-adaptive-streaming-over-http -[apple-hls-intro]: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/Introduction/Introduction.html -[hls-spec]: https://datatracker.ietf.org/doc/draft-pantos-http-live-streaming/ -[dash-wiki]: https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP -[dash-if-reference-client]: https://reference.dashif.org/dash.js/ -[mdn-dash-tut]: https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Setting_up_adaptive_streaming_media_sources -[dash-if-guide]: http://dashif.org/guidelines/ diff --git a/node_modules/@videojs/http-streaming/docs/arch.md b/node_modules/@videojs/http-streaming/docs/arch.md deleted file mode 100644 index 994757f..0000000 --- a/node_modules/@videojs/http-streaming/docs/arch.md +++ /dev/null @@ -1,28 +0,0 @@ -## HLS Project Overview -This project has three primary duties: - -1. Download and parse playlist files -1. Implement the [HTMLVideoElement](https://html.spec.whatwg.org/multipage/embedded-content.html#the-video-element) interface -1. Feed content bits to a SourceBuffer by downloading and transmuxing video segments - -### Playlist Management -The [playlist loader](../src/playlist-loader.js) handles all of the details of requesting, parsing, updating, and switching playlists at runtime. It's operation is described by this state diagram: - -![Playlist Loader States](images/playlist-loader-states.png) - -During VOD playback, the loader will move quickly to the HAVE_METADATA state and then stay there unless a quality switch request sends it to SWITCHING_MEDIA while it fetches an alternate playlist. The loader enters the HAVE_CURRENT_METADATA when a live stream is detected and it's time to refresh the current media playlist to find out about new video segments. - -### HLS Tech -Currently, the HLS project integrates with [video.js](http://www.videojs.com/) as a [tech](https://github.com/videojs/video.js/blob/master/docs/guides/tech.md). That means it's responsible for providing an interface that closely mirrors the `
.
` codec string with the standard - * `avc1.` - * - * @param {string} codec - * Codec string to translate - * @return {string} - * The translated codec string - */ - -var translateLegacyCodec = function translateLegacyCodec(codec) { - if (!codec) { - return codec; - } - - return codec.replace(/avc1\.(\d+)\.(\d+)/i, function (orig, profile, avcLevel) { - var profileHex = ('00' + Number(profile).toString(16)).slice(-2); - var avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2); - return 'avc1.' + profileHex + '00' + avcLevelHex; - }); -}; -/** - * Replace the old apple-style `avc1.
.
` codec strings with the standard - * `avc1.` - * - * @param {string[]} codecs - * An array of codec strings to translate - * @return {string[]} - * The translated array of codec strings - */ - - -exports.translateLegacyCodec = translateLegacyCodec; - -var translateLegacyCodecs = function translateLegacyCodecs(codecs) { - return codecs.map(translateLegacyCodec); -}; -/** - * Replace codecs in the codec string with the old apple-style `avc1.
.
` to the - * standard `avc1.`. - * - * @param {string} codecString - * The codec string - * @return {string} - * The codec string with old apple-style codecs replaced - * - * @private - */ - - -exports.translateLegacyCodecs = translateLegacyCodecs; - -var mapLegacyAvcCodecs = function mapLegacyAvcCodecs(codecString) { - return codecString.replace(/avc1\.(\d+)\.(\d+)/i, function (match) { - return translateLegacyCodecs([match])[0]; - }); -}; -/** - * @typedef {Object} ParsedCodecInfo - * @property {number} codecCount - * Number of codecs parsed - * @property {string} [videoCodec] - * Parsed video codec (if found) - * @property {string} [videoObjectTypeIndicator] - * Video object type indicator (if found) - * @property {string|null} audioProfile - * Audio profile - */ - -/** - * Parses a codec string to retrieve the number of codecs specified, the video codec and - * object type indicator, and the audio profile. - * - * @param {string} [codecString] - * The codec string to parse - * @return {ParsedCodecInfo} - * Parsed codec info - */ - - -exports.mapLegacyAvcCodecs = mapLegacyAvcCodecs; - -var parseCodecs = function parseCodecs(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - var codecs = codecString.split(','); - var result = []; - codecs.forEach(function (codec) { - codec = codec.trim(); - var codecType; - mediaTypes.forEach(function (name) { - var match = regexs[name].exec(codec.toLowerCase()); - - if (!match || match.length <= 1) { - return; - } - - codecType = name; // maintain codec case - - var type = codec.substring(0, match[1].length); - var details = codec.replace(type, ''); - result.push({ - type: type, - details: details, - mediaType: name - }); - }); - - if (!codecType) { - result.push({ - type: codec, - details: '', - mediaType: 'unknown' - }); - } - }); - return result; -}; -/** - * Returns a ParsedCodecInfo object for the default alternate audio playlist if there is - * a default alternate audio playlist for the provided audio group. - * - * @param {Object} master - * The master playlist - * @param {string} audioGroupId - * ID of the audio group for which to find the default codec info - * @return {ParsedCodecInfo} - * Parsed codec info - */ - - -exports.parseCodecs = parseCodecs; - -var codecsFromDefault = function codecsFromDefault(master, audioGroupId) { - if (!master.mediaGroups.AUDIO || !audioGroupId) { - return null; - } - - var audioGroup = master.mediaGroups.AUDIO[audioGroupId]; - - if (!audioGroup) { - return null; - } - - for (var name in audioGroup) { - var audioType = audioGroup[name]; - - if (audioType.default && audioType.playlists) { - // codec should be the same for all playlists within the audio type - return parseCodecs(audioType.playlists[0].attributes.CODECS); - } - } - - return null; -}; - -exports.codecsFromDefault = codecsFromDefault; - -var isVideoCodec = function isVideoCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.video.test(codec.trim().toLowerCase()); -}; - -exports.isVideoCodec = isVideoCodec; - -var isAudioCodec = function isAudioCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.audio.test(codec.trim().toLowerCase()); -}; - -exports.isAudioCodec = isAudioCodec; - -var isTextCodec = function isTextCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.text.test(codec.trim().toLowerCase()); -}; - -exports.isTextCodec = isTextCodec; - -var getMimeForCodec = function getMimeForCodec(codecString) { - if (!codecString || typeof codecString !== 'string') { - return; - } - - var codecs = codecString.toLowerCase().split(',').map(function (c) { - return translateLegacyCodec(c.trim()); - }); // default to video type - - var type = 'video'; // only change to audio type if the only codec we have is - // audio - - if (codecs.length === 1 && isAudioCodec(codecs[0])) { - type = 'audio'; - } else if (codecs.length === 1 && isTextCodec(codecs[0])) { - // text uses application/ for now - type = 'application'; - } // default the container to mp4 - - - var container = 'mp4'; // every codec must be able to go into the container - // for that container to be the correct one - - if (codecs.every(function (c) { - return regexs.mp4.test(c); - })) { - container = 'mp4'; - } else if (codecs.every(function (c) { - return regexs.webm.test(c); - })) { - container = 'webm'; - } else if (codecs.every(function (c) { - return regexs.ogg.test(c); - })) { - container = 'ogg'; - } - - return type + "/" + container + ";codecs=\"" + codecString + "\""; -}; - -exports.getMimeForCodec = getMimeForCodec; - -var browserSupportsCodec = function browserSupportsCodec(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - return _window.default.MediaSource && _window.default.MediaSource.isTypeSupported && _window.default.MediaSource.isTypeSupported(getMimeForCodec(codecString)) || false; -}; - -exports.browserSupportsCodec = browserSupportsCodec; - -var muxerSupportsCodec = function muxerSupportsCodec(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - return codecString.toLowerCase().split(',').every(function (codec) { - codec = codec.trim(); // any match is supported. - - for (var i = 0; i < upperMediaTypes.length; i++) { - var type = upperMediaTypes[i]; - - if (regexs["muxer" + type].test(codec)) { - return true; - } - } - - return false; - }); -}; - -exports.muxerSupportsCodec = muxerSupportsCodec; -var DEFAULT_AUDIO_CODEC = 'mp4a.40.2'; -exports.DEFAULT_AUDIO_CODEC = DEFAULT_AUDIO_CODEC; -var DEFAULT_VIDEO_CODEC = 'avc1.4d400d'; -exports.DEFAULT_VIDEO_CODEC = DEFAULT_VIDEO_CODEC; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/containers.js b/node_modules/@videojs/vhs-utils/cjs/containers.js deleted file mode 100644 index 5c079cf..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/containers.js +++ /dev/null @@ -1,181 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isLikelyFmp4MediaSegment = exports.detectContainerForBytes = exports.isLikely = void 0; - -var _byteHelpers = require("./byte-helpers.js"); - -var _mp4Helpers = require("./mp4-helpers.js"); - -var _ebmlHelpers = require("./ebml-helpers.js"); - -var _id3Helpers = require("./id3-helpers.js"); - -var _nalHelpers = require("./nal-helpers.js"); - -var CONSTANTS = { - // "webm" string literal in hex - 'webm': (0, _byteHelpers.toUint8)([0x77, 0x65, 0x62, 0x6d]), - // "matroska" string literal in hex - 'matroska': (0, _byteHelpers.toUint8)([0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61]), - // "fLaC" string literal in hex - 'flac': (0, _byteHelpers.toUint8)([0x66, 0x4c, 0x61, 0x43]), - // "OggS" string literal in hex - 'ogg': (0, _byteHelpers.toUint8)([0x4f, 0x67, 0x67, 0x53]), - // ac-3 sync byte, also works for ec-3 as that is simply a codec - // of ac-3 - 'ac3': (0, _byteHelpers.toUint8)([0x0b, 0x77]), - // "RIFF" string literal in hex used for wav and avi - 'riff': (0, _byteHelpers.toUint8)([0x52, 0x49, 0x46, 0x46]), - // "AVI" string literal in hex - 'avi': (0, _byteHelpers.toUint8)([0x41, 0x56, 0x49]), - // "WAVE" string literal in hex - 'wav': (0, _byteHelpers.toUint8)([0x57, 0x41, 0x56, 0x45]), - // "ftyp3g" string literal in hex - '3gp': (0, _byteHelpers.toUint8)([0x66, 0x74, 0x79, 0x70, 0x33, 0x67]), - // "ftyp" string literal in hex - 'mp4': (0, _byteHelpers.toUint8)([0x66, 0x74, 0x79, 0x70]), - // "styp" string literal in hex - 'fmp4': (0, _byteHelpers.toUint8)([0x73, 0x74, 0x79, 0x70]), - // "ftyp" string literal in hex - 'mov': (0, _byteHelpers.toUint8)([0x66, 0x74, 0x79, 0x70, 0x71, 0x74]) -}; -var _isLikely = { - aac: function aac(bytes) { - var offset = (0, _id3Helpers.getId3Offset)(bytes); - return (0, _byteHelpers.bytesMatch)(bytes, [0xFF, 0x10], { - offset: offset, - mask: [0xFF, 0x16] - }); - }, - mp3: function mp3(bytes) { - var offset = (0, _id3Helpers.getId3Offset)(bytes); - return (0, _byteHelpers.bytesMatch)(bytes, [0xFF, 0x02], { - offset: offset, - mask: [0xFF, 0x06] - }); - }, - webm: function webm(bytes) { - var docType = (0, _ebmlHelpers.findEbml)(bytes, [_ebmlHelpers.EBML_TAGS.EBML, _ebmlHelpers.EBML_TAGS.DocType])[0]; // check if DocType EBML tag is webm - - return (0, _byteHelpers.bytesMatch)(docType, CONSTANTS.webm); - }, - mkv: function mkv(bytes) { - var docType = (0, _ebmlHelpers.findEbml)(bytes, [_ebmlHelpers.EBML_TAGS.EBML, _ebmlHelpers.EBML_TAGS.DocType])[0]; // check if DocType EBML tag is matroska - - return (0, _byteHelpers.bytesMatch)(docType, CONSTANTS.matroska); - }, - mp4: function mp4(bytes) { - return !_isLikely['3gp'](bytes) && !_isLikely.mov(bytes) && ((0, _byteHelpers.bytesMatch)(bytes, CONSTANTS.mp4, { - offset: 4 - }) || (0, _byteHelpers.bytesMatch)(bytes, CONSTANTS.fmp4, { - offset: 4 - })); - }, - mov: function mov(bytes) { - return (0, _byteHelpers.bytesMatch)(bytes, CONSTANTS.mov, { - offset: 4 - }); - }, - '3gp': function gp(bytes) { - return (0, _byteHelpers.bytesMatch)(bytes, CONSTANTS['3gp'], { - offset: 4 - }); - }, - ac3: function ac3(bytes) { - var offset = (0, _id3Helpers.getId3Offset)(bytes); - return (0, _byteHelpers.bytesMatch)(bytes, CONSTANTS.ac3, { - offset: offset - }); - }, - ts: function ts(bytes) { - if (bytes.length < 189 && bytes.length >= 1) { - return bytes[0] === 0x47; - } - - var i = 0; // check the first 376 bytes for two matching sync bytes - - while (i + 188 < bytes.length && i < 188) { - if (bytes[i] === 0x47 && bytes[i + 188] === 0x47) { - return true; - } - - i += 1; - } - - return false; - }, - flac: function flac(bytes) { - var offset = (0, _id3Helpers.getId3Offset)(bytes); - return (0, _byteHelpers.bytesMatch)(bytes, CONSTANTS.flac, { - offset: offset - }); - }, - ogg: function ogg(bytes) { - return (0, _byteHelpers.bytesMatch)(bytes, CONSTANTS.ogg); - }, - avi: function avi(bytes) { - return (0, _byteHelpers.bytesMatch)(bytes, CONSTANTS.riff) && (0, _byteHelpers.bytesMatch)(bytes, CONSTANTS.avi, { - offset: 8 - }); - }, - wav: function wav(bytes) { - return (0, _byteHelpers.bytesMatch)(bytes, CONSTANTS.riff) && (0, _byteHelpers.bytesMatch)(bytes, CONSTANTS.wav, { - offset: 8 - }); - }, - 'h264': function h264(bytes) { - // find seq_parameter_set_rbsp - return (0, _nalHelpers.findH264Nal)(bytes, 7, 3).length; - }, - 'h265': function h265(bytes) { - // find video_parameter_set_rbsp or seq_parameter_set_rbsp - return (0, _nalHelpers.findH265Nal)(bytes, [32, 33], 3).length; - } -}; // get all the isLikely functions -// but make sure 'ts' is above h264 and h265 -// but below everything else as it is the least specific - -var isLikelyTypes = Object.keys(_isLikely) // remove ts, h264, h265 -.filter(function (t) { - return t !== 'ts' && t !== 'h264' && t !== 'h265'; -}) // add it back to the bottom -.concat(['ts', 'h264', 'h265']); // make sure we are dealing with uint8 data. - -isLikelyTypes.forEach(function (type) { - var isLikelyFn = _isLikely[type]; - - _isLikely[type] = function (bytes) { - return isLikelyFn((0, _byteHelpers.toUint8)(bytes)); - }; -}); // export after wrapping - -var isLikely = _isLikely; // A useful list of file signatures can be found here -// https://en.wikipedia.org/wiki/List_of_file_signatures - -exports.isLikely = isLikely; - -var detectContainerForBytes = function detectContainerForBytes(bytes) { - bytes = (0, _byteHelpers.toUint8)(bytes); - - for (var i = 0; i < isLikelyTypes.length; i++) { - var type = isLikelyTypes[i]; - - if (isLikely[type](bytes)) { - return type; - } - } - - return ''; -}; // fmp4 is not a container - - -exports.detectContainerForBytes = detectContainerForBytes; - -var isLikelyFmp4MediaSegment = function isLikelyFmp4MediaSegment(bytes) { - return (0, _mp4Helpers.findBox)(bytes, ['moof']).length > 0; -}; - -exports.isLikelyFmp4MediaSegment = isLikelyFmp4MediaSegment; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/decode-b64-to-uint8-array.js b/node_modules/@videojs/vhs-utils/cjs/decode-b64-to-uint8-array.js deleted file mode 100644 index d0c5a2f..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/decode-b64-to-uint8-array.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = decodeB64ToUint8Array; - -var _window = _interopRequireDefault(require("global/window")); - -var atob = function atob(s) { - return _window.default.atob ? _window.default.atob(s) : Buffer.from(s, 'base64').toString('binary'); -}; - -function decodeB64ToUint8Array(b64Text) { - var decodedString = atob(b64Text); - var array = new Uint8Array(decodedString.length); - - for (var i = 0; i < decodedString.length; i++) { - array[i] = decodedString.charCodeAt(i); - } - - return array; -} - -module.exports = exports.default; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/ebml-helpers.js b/node_modules/@videojs/vhs-utils/cjs/ebml-helpers.js deleted file mode 100644 index 3beb936..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/ebml-helpers.js +++ /dev/null @@ -1,518 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parseData = exports.parseTracks = exports.decodeBlock = exports.findEbml = exports.EBML_TAGS = void 0; - -var _byteHelpers = require("./byte-helpers"); - -var _codecHelpers = require("./codec-helpers.js"); - -// relevant specs for this parser: -// https://matroska-org.github.io/libebml/specs.html -// https://www.matroska.org/technical/elements.html -// https://www.webmproject.org/docs/container/ -var EBML_TAGS = { - EBML: (0, _byteHelpers.toUint8)([0x1A, 0x45, 0xDF, 0xA3]), - DocType: (0, _byteHelpers.toUint8)([0x42, 0x82]), - Segment: (0, _byteHelpers.toUint8)([0x18, 0x53, 0x80, 0x67]), - SegmentInfo: (0, _byteHelpers.toUint8)([0x15, 0x49, 0xA9, 0x66]), - Tracks: (0, _byteHelpers.toUint8)([0x16, 0x54, 0xAE, 0x6B]), - Track: (0, _byteHelpers.toUint8)([0xAE]), - TrackNumber: (0, _byteHelpers.toUint8)([0xd7]), - DefaultDuration: (0, _byteHelpers.toUint8)([0x23, 0xe3, 0x83]), - TrackEntry: (0, _byteHelpers.toUint8)([0xAE]), - TrackType: (0, _byteHelpers.toUint8)([0x83]), - FlagDefault: (0, _byteHelpers.toUint8)([0x88]), - CodecID: (0, _byteHelpers.toUint8)([0x86]), - CodecPrivate: (0, _byteHelpers.toUint8)([0x63, 0xA2]), - VideoTrack: (0, _byteHelpers.toUint8)([0xe0]), - AudioTrack: (0, _byteHelpers.toUint8)([0xe1]), - // Not used yet, but will be used for live webm/mkv - // see https://www.matroska.org/technical/basics.html#block-structure - // see https://www.matroska.org/technical/basics.html#simpleblock-structure - Cluster: (0, _byteHelpers.toUint8)([0x1F, 0x43, 0xB6, 0x75]), - Timestamp: (0, _byteHelpers.toUint8)([0xE7]), - TimestampScale: (0, _byteHelpers.toUint8)([0x2A, 0xD7, 0xB1]), - BlockGroup: (0, _byteHelpers.toUint8)([0xA0]), - BlockDuration: (0, _byteHelpers.toUint8)([0x9B]), - Block: (0, _byteHelpers.toUint8)([0xA1]), - SimpleBlock: (0, _byteHelpers.toUint8)([0xA3]) -}; -/** - * This is a simple table to determine the length - * of things in ebml. The length is one based (starts at 1, - * rather than zero) and for every zero bit before a one bit - * we add one to length. We also need this table because in some - * case we have to xor all the length bits from another value. - */ - -exports.EBML_TAGS = EBML_TAGS; -var LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1]; - -var getLength = function getLength(byte) { - var len = 1; - - for (var i = 0; i < LENGTH_TABLE.length; i++) { - if (byte & LENGTH_TABLE[i]) { - break; - } - - len++; - } - - return len; -}; // length in ebml is stored in the first 4 to 8 bits -// of the first byte. 4 for the id length and 8 for the -// data size length. Length is measured by converting the number to binary -// then 1 + the number of zeros before a 1 is encountered starting -// from the left. - - -var getvint = function getvint(bytes, offset, removeLength, signed) { - if (removeLength === void 0) { - removeLength = true; - } - - if (signed === void 0) { - signed = false; - } - - var length = getLength(bytes[offset]); - var valueBytes = bytes.subarray(offset, offset + length); // NOTE that we do **not** subarray here because we need to copy these bytes - // as they will be modified below to remove the dataSizeLen bits and we do not - // want to modify the original data. normally we could just call slice on - // uint8array but ie 11 does not support that... - - if (removeLength) { - valueBytes = Array.prototype.slice.call(bytes, offset, offset + length); - valueBytes[0] ^= LENGTH_TABLE[length - 1]; - } - - return { - length: length, - value: (0, _byteHelpers.bytesToNumber)(valueBytes, { - signed: signed - }), - bytes: valueBytes - }; -}; - -var normalizePath = function normalizePath(path) { - if (typeof path === 'string') { - return path.match(/.{1,2}/g).map(function (p) { - return normalizePath(p); - }); - } - - if (typeof path === 'number') { - return (0, _byteHelpers.numberToBytes)(path); - } - - return path; -}; - -var normalizePaths = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map(function (p) { - return normalizePath(p); - }); -}; - -var getInfinityDataSize = function getInfinityDataSize(id, bytes, offset) { - if (offset >= bytes.length) { - return bytes.length; - } - - var innerid = getvint(bytes, offset, false); - - if ((0, _byteHelpers.bytesMatch)(id.bytes, innerid.bytes)) { - return offset; - } - - var dataHeader = getvint(bytes, offset + innerid.length); - return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length); -}; -/** - * Notes on the EBLM format. - * - * EBLM uses "vints" tags. Every vint tag contains - * two parts - * - * 1. The length from the first byte. You get this by - * converting the byte to binary and counting the zeros - * before a 1. Then you add 1 to that. Examples - * 00011111 = length 4 because there are 3 zeros before a 1. - * 00100000 = length 3 because there are 2 zeros before a 1. - * 00000011 = length 7 because there are 6 zeros before a 1. - * - * 2. The bits used for length are removed from the first byte - * Then all the bytes are merged into a value. NOTE: this - * is not the case for id ebml tags as there id includes - * length bits. - * - */ - - -var findEbml = function findEbml(bytes, paths) { - paths = normalizePaths(paths); - bytes = (0, _byteHelpers.toUint8)(bytes); - var results = []; - - if (!paths.length) { - return results; - } - - var i = 0; - - while (i < bytes.length) { - var id = getvint(bytes, i, false); - var dataHeader = getvint(bytes, i + id.length); - var dataStart = i + id.length + dataHeader.length; // dataSize is unknown or this is a live stream - - if (dataHeader.value === 0x7f) { - dataHeader.value = getInfinityDataSize(id, bytes, dataStart); - - if (dataHeader.value !== bytes.length) { - dataHeader.value -= dataStart; - } - } - - var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value; - var data = bytes.subarray(dataStart, dataEnd); - - if ((0, _byteHelpers.bytesMatch)(paths[0], id.bytes)) { - if (paths.length === 1) { - // this is the end of the paths and we've found the tag we were - // looking for - results.push(data); - } else { - // recursively search for the next tag inside of the data - // of this one - results = results.concat(findEbml(data, paths.slice(1))); - } - } - - var totalLength = id.length + dataHeader.length + data.length; // move past this tag entirely, we are not looking for it - - i += totalLength; - } - - return results; -}; // see https://www.matroska.org/technical/basics.html#block-structure - - -exports.findEbml = findEbml; - -var decodeBlock = function decodeBlock(block, type, timestampScale, clusterTimestamp) { - var duration; - - if (type === 'group') { - duration = findEbml(block, [EBML_TAGS.BlockDuration])[0]; - - if (duration) { - duration = (0, _byteHelpers.bytesToNumber)(duration); - duration = 1 / timestampScale * duration * timestampScale / 1000; - } - - block = findEbml(block, [EBML_TAGS.Block])[0]; - type = 'block'; // treat data as a block after this point - } - - var dv = new DataView(block.buffer, block.byteOffset, block.byteLength); - var trackNumber = getvint(block, 0); - var timestamp = dv.getInt16(trackNumber.length, false); - var flags = block[trackNumber.length + 2]; - var data = block.subarray(trackNumber.length + 3); // pts/dts in seconds - - var ptsdts = 1 / timestampScale * (clusterTimestamp + timestamp) * timestampScale / 1000; // return the frame - - var parsed = { - duration: duration, - trackNumber: trackNumber.value, - keyframe: type === 'simple' && flags >> 7 === 1, - invisible: (flags & 0x08) >> 3 === 1, - lacing: (flags & 0x06) >> 1, - discardable: type === 'simple' && (flags & 0x01) === 1, - frames: [], - pts: ptsdts, - dts: ptsdts, - timestamp: timestamp - }; - - if (!parsed.lacing) { - parsed.frames.push(data); - return parsed; - } - - var numberOfFrames = data[0] + 1; - var frameSizes = []; - var offset = 1; // Fixed - - if (parsed.lacing === 2) { - var sizeOfFrame = (data.length - offset) / numberOfFrames; - - for (var i = 0; i < numberOfFrames; i++) { - frameSizes.push(sizeOfFrame); - } - } // xiph - - - if (parsed.lacing === 1) { - for (var _i = 0; _i < numberOfFrames - 1; _i++) { - var size = 0; - - do { - size += data[offset]; - offset++; - } while (data[offset - 1] === 0xFF); - - frameSizes.push(size); - } - } // ebml - - - if (parsed.lacing === 3) { - // first vint is unsinged - // after that vints are singed and - // based on a compounding size - var _size = 0; - - for (var _i2 = 0; _i2 < numberOfFrames - 1; _i2++) { - var vint = _i2 === 0 ? getvint(data, offset) : getvint(data, offset, true, true); - _size += vint.value; - frameSizes.push(_size); - offset += vint.length; - } - } - - frameSizes.forEach(function (size) { - parsed.frames.push(data.subarray(offset, offset + size)); - offset += size; - }); - return parsed; -}; // VP9 Codec Feature Metadata (CodecPrivate) -// https://www.webmproject.org/docs/container/ - - -exports.decodeBlock = decodeBlock; - -var parseVp9Private = function parseVp9Private(bytes) { - var i = 0; - var params = {}; - - while (i < bytes.length) { - var id = bytes[i] & 0x7f; - var len = bytes[i + 1]; - var val = void 0; - - if (len === 1) { - val = bytes[i + 2]; - } else { - val = bytes.subarray(i + 2, i + 2 + len); - } - - if (id === 1) { - params.profile = val; - } else if (id === 2) { - params.level = val; - } else if (id === 3) { - params.bitDepth = val; - } else if (id === 4) { - params.chromaSubsampling = val; - } else { - params[id] = val; - } - - i += 2 + len; - } - - return params; -}; - -var parseTracks = function parseTracks(bytes) { - bytes = (0, _byteHelpers.toUint8)(bytes); - var decodedTracks = []; - var tracks = findEbml(bytes, [EBML_TAGS.Segment, EBML_TAGS.Tracks, EBML_TAGS.Track]); - - if (!tracks.length) { - tracks = findEbml(bytes, [EBML_TAGS.Tracks, EBML_TAGS.Track]); - } - - if (!tracks.length) { - tracks = findEbml(bytes, [EBML_TAGS.Track]); - } - - if (!tracks.length) { - return decodedTracks; - } - - tracks.forEach(function (track) { - var trackType = findEbml(track, EBML_TAGS.TrackType)[0]; - - if (!trackType || !trackType.length) { - return; - } // 1 is video, 2 is audio, 17 is subtitle - // other values are unimportant in this context - - - if (trackType[0] === 1) { - trackType = 'video'; - } else if (trackType[0] === 2) { - trackType = 'audio'; - } else if (trackType[0] === 17) { - trackType = 'subtitle'; - } else { - return; - } // todo parse language - - - var decodedTrack = { - rawCodec: (0, _byteHelpers.bytesToString)(findEbml(track, [EBML_TAGS.CodecID])[0]), - type: trackType, - codecPrivate: findEbml(track, [EBML_TAGS.CodecPrivate])[0], - number: (0, _byteHelpers.bytesToNumber)(findEbml(track, [EBML_TAGS.TrackNumber])[0]), - defaultDuration: (0, _byteHelpers.bytesToNumber)(findEbml(track, [EBML_TAGS.DefaultDuration])[0]), - default: findEbml(track, [EBML_TAGS.FlagDefault])[0], - rawData: track - }; - var codec = ''; - - if (/V_MPEG4\/ISO\/AVC/.test(decodedTrack.rawCodec)) { - codec = "avc1." + (0, _codecHelpers.getAvcCodec)(decodedTrack.codecPrivate); - } else if (/V_MPEGH\/ISO\/HEVC/.test(decodedTrack.rawCodec)) { - codec = "hev1." + (0, _codecHelpers.getHvcCodec)(decodedTrack.codecPrivate); - } else if (/V_MPEG4\/ISO\/ASP/.test(decodedTrack.rawCodec)) { - if (decodedTrack.codecPrivate) { - codec = 'mp4v.20.' + decodedTrack.codecPrivate[4].toString(); - } else { - codec = 'mp4v.20.9'; - } - } else if (/^V_THEORA/.test(decodedTrack.rawCodec)) { - codec = 'theora'; - } else if (/^V_VP8/.test(decodedTrack.rawCodec)) { - codec = 'vp8'; - } else if (/^V_VP9/.test(decodedTrack.rawCodec)) { - if (decodedTrack.codecPrivate) { - var _parseVp9Private = parseVp9Private(decodedTrack.codecPrivate), - profile = _parseVp9Private.profile, - level = _parseVp9Private.level, - bitDepth = _parseVp9Private.bitDepth, - chromaSubsampling = _parseVp9Private.chromaSubsampling; - - codec = 'vp09.'; - codec += (0, _byteHelpers.padStart)(profile, 2, '0') + "."; - codec += (0, _byteHelpers.padStart)(level, 2, '0') + "."; - codec += (0, _byteHelpers.padStart)(bitDepth, 2, '0') + "."; - codec += "" + (0, _byteHelpers.padStart)(chromaSubsampling, 2, '0'); // Video -> Colour -> Ebml name - - var matrixCoefficients = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xB1]])[0] || []; - var videoFullRangeFlag = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xB9]])[0] || []; - var transferCharacteristics = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xBA]])[0] || []; - var colourPrimaries = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xBB]])[0] || []; // if we find any optional codec parameter specify them all. - - if (matrixCoefficients.length || videoFullRangeFlag.length || transferCharacteristics.length || colourPrimaries.length) { - codec += "." + (0, _byteHelpers.padStart)(colourPrimaries[0], 2, '0'); - codec += "." + (0, _byteHelpers.padStart)(transferCharacteristics[0], 2, '0'); - codec += "." + (0, _byteHelpers.padStart)(matrixCoefficients[0], 2, '0'); - codec += "." + (0, _byteHelpers.padStart)(videoFullRangeFlag[0], 2, '0'); - } - } else { - codec = 'vp9'; - } - } else if (/^V_AV1/.test(decodedTrack.rawCodec)) { - codec = "av01." + (0, _codecHelpers.getAv1Codec)(decodedTrack.codecPrivate); - } else if (/A_ALAC/.test(decodedTrack.rawCodec)) { - codec = 'alac'; - } else if (/A_MPEG\/L2/.test(decodedTrack.rawCodec)) { - codec = 'mp2'; - } else if (/A_MPEG\/L3/.test(decodedTrack.rawCodec)) { - codec = 'mp3'; - } else if (/^A_AAC/.test(decodedTrack.rawCodec)) { - if (decodedTrack.codecPrivate) { - codec = 'mp4a.40.' + (decodedTrack.codecPrivate[0] >>> 3).toString(); - } else { - codec = 'mp4a.40.2'; - } - } else if (/^A_AC3/.test(decodedTrack.rawCodec)) { - codec = 'ac-3'; - } else if (/^A_PCM/.test(decodedTrack.rawCodec)) { - codec = 'pcm'; - } else if (/^A_MS\/ACM/.test(decodedTrack.rawCodec)) { - codec = 'speex'; - } else if (/^A_EAC3/.test(decodedTrack.rawCodec)) { - codec = 'ec-3'; - } else if (/^A_VORBIS/.test(decodedTrack.rawCodec)) { - codec = 'vorbis'; - } else if (/^A_FLAC/.test(decodedTrack.rawCodec)) { - codec = 'flac'; - } else if (/^A_OPUS/.test(decodedTrack.rawCodec)) { - codec = 'opus'; - } - - decodedTrack.codec = codec; - decodedTracks.push(decodedTrack); - }); - return decodedTracks.sort(function (a, b) { - return a.number - b.number; - }); -}; - -exports.parseTracks = parseTracks; - -var parseData = function parseData(data, tracks) { - var allBlocks = []; - var segment = findEbml(data, [EBML_TAGS.Segment])[0]; - var timestampScale = findEbml(segment, [EBML_TAGS.SegmentInfo, EBML_TAGS.TimestampScale])[0]; // in nanoseconds, defaults to 1ms - - if (timestampScale && timestampScale.length) { - timestampScale = (0, _byteHelpers.bytesToNumber)(timestampScale); - } else { - timestampScale = 1000000; - } - - var clusters = findEbml(segment, [EBML_TAGS.Cluster]); - - if (!tracks) { - tracks = parseTracks(segment); - } - - clusters.forEach(function (cluster, ci) { - var simpleBlocks = findEbml(cluster, [EBML_TAGS.SimpleBlock]).map(function (b) { - return { - type: 'simple', - data: b - }; - }); - var blockGroups = findEbml(cluster, [EBML_TAGS.BlockGroup]).map(function (b) { - return { - type: 'group', - data: b - }; - }); - var timestamp = findEbml(cluster, [EBML_TAGS.Timestamp])[0] || 0; - - if (timestamp && timestamp.length) { - timestamp = (0, _byteHelpers.bytesToNumber)(timestamp); - } // get all blocks then sort them into the correct order - - - var blocks = simpleBlocks.concat(blockGroups).sort(function (a, b) { - return a.data.byteOffset - b.data.byteOffset; - }); - blocks.forEach(function (block, bi) { - var decoded = decodeBlock(block.data, block.type, timestampScale, timestamp); - allBlocks.push(decoded); - }); - }); - return { - tracks: tracks, - blocks: allBlocks - }; -}; - -exports.parseData = parseData; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/format-parser.js b/node_modules/@videojs/vhs-utils/cjs/format-parser.js deleted file mode 100644 index 422f928..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/format-parser.js +++ /dev/null @@ -1,408 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parseFormatForBytes = void 0; - -var _byteHelpers = require("./byte-helpers.js"); - -var _ebmlHelpers = require("./ebml-helpers.js"); - -var _mp4Helpers = require("./mp4-helpers.js"); - -var _riffHelpers = require("./riff-helpers.js"); - -var _oggHelpers = require("./ogg-helpers.js"); - -var _containers = require("./containers.js"); - -var _nalHelpers = require("./nal-helpers.js"); - -var _m2tsHelpers = require("./m2ts-helpers.js"); - -var _codecHelpers = require("./codec-helpers.js"); - -var _id3Helpers = require("./id3-helpers.js"); - -// https://docs.microsoft.com/en-us/windows/win32/medfound/audio-subtype-guids -// https://tools.ietf.org/html/rfc2361 -var wFormatTagCodec = function wFormatTagCodec(wFormatTag) { - wFormatTag = (0, _byteHelpers.toUint8)(wFormatTag); - - if ((0, _byteHelpers.bytesMatch)(wFormatTag, [0x00, 0x55])) { - return 'mp3'; - } else if ((0, _byteHelpers.bytesMatch)(wFormatTag, [0x16, 0x00]) || (0, _byteHelpers.bytesMatch)(wFormatTag, [0x00, 0xFF])) { - return 'aac'; - } else if ((0, _byteHelpers.bytesMatch)(wFormatTag, [0x70, 0x4f])) { - return 'opus'; - } else if ((0, _byteHelpers.bytesMatch)(wFormatTag, [0x6C, 0x61])) { - return 'alac'; - } else if ((0, _byteHelpers.bytesMatch)(wFormatTag, [0xF1, 0xAC])) { - return 'flac'; - } else if ((0, _byteHelpers.bytesMatch)(wFormatTag, [0x20, 0x00])) { - return 'ac-3'; - } else if ((0, _byteHelpers.bytesMatch)(wFormatTag, [0xFF, 0xFE])) { - return 'ec-3'; - } else if ((0, _byteHelpers.bytesMatch)(wFormatTag, [0x00, 0x50])) { - return 'mp2'; - } else if ((0, _byteHelpers.bytesMatch)(wFormatTag, [0x56, 0x6f])) { - return 'vorbis'; - } else if ((0, _byteHelpers.bytesMatch)(wFormatTag, [0xA1, 0x09])) { - return 'speex'; - } - - return ''; -}; - -var formatMimetype = function formatMimetype(name, codecs) { - var codecString = ['video', 'audio'].reduce(function (acc, type) { - if (codecs[type]) { - acc += (acc.length ? ',' : '') + codecs[type]; - } - - return acc; - }, ''); - return (codecs.video ? 'video' : 'audio') + "/" + name + (codecString ? ";codecs=\"" + codecString + "\"" : ''); -}; - -var parseCodecFrom = { - mov: function mov(bytes) { - // mov and mp4 both use a nearly identical box structure. - var retval = parseCodecFrom.mp4(bytes); - - if (retval.mimetype) { - retval.mimetype = retval.mimetype.replace('mp4', 'quicktime'); - } - - return retval; - }, - mp4: function mp4(bytes) { - bytes = (0, _byteHelpers.toUint8)(bytes); - var codecs = {}; - var tracks = (0, _mp4Helpers.parseTracks)(bytes); - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - if (track.type === 'audio' && !codecs.audio) { - codecs.audio = track.codec; - } - - if (track.type === 'video' && !codecs.video) { - codecs.video = track.codec; - } - } - - return { - codecs: codecs, - mimetype: formatMimetype('mp4', codecs) - }; - }, - '3gp': function gp(bytes) { - return { - codecs: {}, - mimetype: 'video/3gpp' - }; - }, - ogg: function ogg(bytes) { - var pages = (0, _oggHelpers.getPages)(bytes, 0, 4); - var codecs = {}; - pages.forEach(function (page) { - if ((0, _byteHelpers.bytesMatch)(page, [0x4F, 0x70, 0x75, 0x73], { - offset: 28 - })) { - codecs.audio = 'opus'; - } else if ((0, _byteHelpers.bytesMatch)(page, [0x56, 0x50, 0x38, 0x30], { - offset: 29 - })) { - codecs.video = 'vp8'; - } else if ((0, _byteHelpers.bytesMatch)(page, [0x74, 0x68, 0x65, 0x6F, 0x72, 0x61], { - offset: 29 - })) { - codecs.video = 'theora'; - } else if ((0, _byteHelpers.bytesMatch)(page, [0x46, 0x4C, 0x41, 0x43], { - offset: 29 - })) { - codecs.audio = 'flac'; - } else if ((0, _byteHelpers.bytesMatch)(page, [0x53, 0x70, 0x65, 0x65, 0x78], { - offset: 28 - })) { - codecs.audio = 'speex'; - } else if ((0, _byteHelpers.bytesMatch)(page, [0x76, 0x6F, 0x72, 0x62, 0x69, 0x73], { - offset: 29 - })) { - codecs.audio = 'vorbis'; - } - }); - return { - codecs: codecs, - mimetype: formatMimetype('ogg', codecs) - }; - }, - wav: function wav(bytes) { - var format = (0, _riffHelpers.findFourCC)(bytes, ['WAVE', 'fmt'])[0]; - var wFormatTag = Array.prototype.slice.call(format, 0, 2).reverse(); - var mimetype = 'audio/vnd.wave'; - var codecs = { - audio: wFormatTagCodec(wFormatTag) - }; - var codecString = wFormatTag.reduce(function (acc, v) { - if (v) { - acc += (0, _byteHelpers.toHexString)(v); - } - - return acc; - }, ''); - - if (codecString) { - mimetype += ";codec=" + codecString; - } - - if (codecString && !codecs.audio) { - codecs.audio = codecString; - } - - return { - codecs: codecs, - mimetype: mimetype - }; - }, - avi: function avi(bytes) { - var movi = (0, _riffHelpers.findFourCC)(bytes, ['AVI', 'movi'])[0]; - var strls = (0, _riffHelpers.findFourCC)(bytes, ['AVI', 'hdrl', 'strl']); - var codecs = {}; - strls.forEach(function (strl) { - var strh = (0, _riffHelpers.findFourCC)(strl, ['strh'])[0]; - var strf = (0, _riffHelpers.findFourCC)(strl, ['strf'])[0]; // now parse AVIStreamHeader to get codec and type: - // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/api/avifmt/ns-avifmt-avistreamheader - - var type = (0, _byteHelpers.bytesToString)(strh.subarray(0, 4)); - var codec; - var codecType; - - if (type === 'vids') { - // https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapinfoheader - var handler = (0, _byteHelpers.bytesToString)(strh.subarray(4, 8)); - var compression = (0, _byteHelpers.bytesToString)(strf.subarray(16, 20)); // look for 00dc (compressed video fourcc code) or 00db (uncompressed video fourcc code) - - var videoData = (0, _riffHelpers.findFourCC)(movi, ['00dc'])[0] || (0, _riffHelpers.findFourCC)(movi, ['00db'][0]); - - if (handler === 'H264' || compression === 'H264') { - if (videoData && videoData.length) { - codec = parseCodecFrom.h264(videoData).codecs.video; - } else { - codec = 'avc1'; - } - } else if (handler === 'HEVC' || compression === 'HEVC') { - if (videoData && videoData.length) { - codec = parseCodecFrom.h265(videoData).codecs.video; - } else { - codec = 'hev1'; - } - } else if (handler === 'FMP4' || compression === 'FMP4') { - if (movi.length) { - codec = 'mp4v.20.' + movi[12].toString(); - } else { - codec = 'mp4v.20'; - } - } else if (handler === 'VP80' || compression === 'VP80') { - codec = 'vp8'; - } else if (handler === 'VP90' || compression === 'VP90') { - codec = 'vp9'; - } else if (handler === 'AV01' || compression === 'AV01') { - codec = 'av01'; - } else if (handler === 'theo' || compression === 'theora') { - codec = 'theora'; - } else { - if (videoData && videoData.length) { - var result = (0, _containers.detectContainerForBytes)(videoData); - - if (result === 'h264') { - codec = parseCodecFrom.h264(movi).codecs.video; - } - - if (result === 'h265') { - codec = parseCodecFrom.h265(movi).codecs.video; - } - } - - if (!codec) { - codec = handler || compression; - } - } - - codecType = 'video'; - } else if (type === 'auds') { - codecType = 'audio'; // look for 00wb (audio data fourcc) - // const audioData = findFourCC(movi, ['01wb']); - - var wFormatTag = Array.prototype.slice.call(strf, 0, 2).reverse(); - codecs.audio = wFormatTagCodec(wFormatTag); - } else { - return; - } - - if (codec) { - codecs[codecType] = codec; - } - }); - return { - codecs: codecs, - mimetype: formatMimetype('avi', codecs) - }; - }, - ts: function ts(bytes) { - var result = (0, _m2tsHelpers.parseTs)(bytes, 2); - var codecs = {}; - Object.keys(result.streams).forEach(function (esPid) { - var stream = result.streams[esPid]; - - if (stream.codec === 'avc1' && stream.packets.length) { - stream.codec = parseCodecFrom.h264(stream.packets[0]).codecs.video; - } else if (stream.codec === 'hev1' && stream.packets.length) { - stream.codec = parseCodecFrom.h265(stream.packets[0]).codecs.video; - } - - codecs[stream.type] = stream.codec; - }); - return { - codecs: codecs, - mimetype: formatMimetype('mp2t', codecs) - }; - }, - webm: function webm(bytes) { - // mkv and webm both use ebml to store code info - var retval = parseCodecFrom.mkv(bytes); - - if (retval.mimetype) { - retval.mimetype = retval.mimetype.replace('x-matroska', 'webm'); - } - - return retval; - }, - mkv: function mkv(bytes) { - var codecs = {}; - var tracks = (0, _ebmlHelpers.parseTracks)(bytes); - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - if (track.type === 'audio' && !codecs.audio) { - codecs.audio = track.codec; - } - - if (track.type === 'video' && !codecs.video) { - codecs.video = track.codec; - } - } - - return { - codecs: codecs, - mimetype: formatMimetype('x-matroska', codecs) - }; - }, - aac: function aac(bytes) { - return { - codecs: { - audio: 'aac' - }, - mimetype: 'audio/aac' - }; - }, - ac3: function ac3(bytes) { - // past id3 and syncword - var offset = (0, _id3Helpers.getId3Offset)(bytes) + 2; // default to ac-3 - - var codec = 'ac-3'; - - if ((0, _byteHelpers.bytesMatch)(bytes, [0xB8, 0xE0], { - offset: offset - })) { - codec = 'ac-3'; // 0x01, 0x7F - } else if ((0, _byteHelpers.bytesMatch)(bytes, [0x01, 0x7f], { - offset: offset - })) { - codec = 'ec-3'; - } - - return { - codecs: { - audio: codec - }, - mimetype: 'audio/vnd.dolby.dd-raw' - }; - }, - mp3: function mp3(bytes) { - return { - codecs: { - audio: 'mp3' - }, - mimetype: 'audio/mpeg' - }; - }, - flac: function flac(bytes) { - return { - codecs: { - audio: 'flac' - }, - mimetype: 'audio/flac' - }; - }, - 'h264': function h264(bytes) { - // find seq_parameter_set_rbsp to get encoding settings for codec - var nal = (0, _nalHelpers.findH264Nal)(bytes, 7, 3); - var retval = { - codecs: { - video: 'avc1' - }, - mimetype: 'video/h264' - }; - - if (nal.length) { - retval.codecs.video += "." + (0, _codecHelpers.getAvcCodec)(nal); - } - - return retval; - }, - 'h265': function h265(bytes) { - var retval = { - codecs: { - video: 'hev1' - }, - mimetype: 'video/h265' - }; // find video_parameter_set_rbsp or seq_parameter_set_rbsp - // to get encoding settings for codec - - var nal = (0, _nalHelpers.findH265Nal)(bytes, [32, 33], 3); - - if (nal.length) { - var type = nal[0] >> 1 & 0x3F; // profile_tier_level starts at byte 5 for video_parameter_set_rbsp - // byte 2 for seq_parameter_set_rbsp - - retval.codecs.video += "." + (0, _codecHelpers.getHvcCodec)(nal.subarray(type === 32 ? 5 : 2)); - } - - return retval; - } -}; - -var parseFormatForBytes = function parseFormatForBytes(bytes) { - bytes = (0, _byteHelpers.toUint8)(bytes); - var result = { - codecs: {}, - container: (0, _containers.detectContainerForBytes)(bytes), - mimetype: '' - }; - var parseCodecFn = parseCodecFrom[result.container]; - - if (parseCodecFn) { - var parsed = parseCodecFn ? parseCodecFn(bytes) : {}; - result.codecs = parsed.codecs || {}; - result.mimetype = parsed.mimetype || ''; - } - - return result; -}; - -exports.parseFormatForBytes = parseFormatForBytes; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/id3-helpers.js b/node_modules/@videojs/vhs-utils/cjs/id3-helpers.js deleted file mode 100644 index 4609f57..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/id3-helpers.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getId3Offset = exports.getId3Size = void 0; - -var _byteHelpers = require("./byte-helpers.js"); - -var ID3 = (0, _byteHelpers.toUint8)([0x49, 0x44, 0x33]); - -var getId3Size = function getId3Size(bytes, offset) { - if (offset === void 0) { - offset = 0; - } - - bytes = (0, _byteHelpers.toUint8)(bytes); - var flags = bytes[offset + 5]; - var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9]; - var footerPresent = (flags & 16) >> 4; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; -}; - -exports.getId3Size = getId3Size; - -var getId3Offset = function getId3Offset(bytes, offset) { - if (offset === void 0) { - offset = 0; - } - - bytes = (0, _byteHelpers.toUint8)(bytes); - - if (bytes.length - offset < 10 || !(0, _byteHelpers.bytesMatch)(bytes, ID3, { - offset: offset - })) { - return offset; - } - - offset += getId3Size(bytes, offset); // recursive check for id3 tags as some files - // have multiple ID3 tag sections even though - // they should not. - - return getId3Offset(bytes, offset); -}; - -exports.getId3Offset = getId3Offset; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/index.js b/node_modules/@videojs/vhs-utils/cjs/index.js deleted file mode 100644 index 3aa9a75..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/index.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var codecs = _interopRequireWildcard(require("./codecs")); - -var byteHelpers = _interopRequireWildcard(require("./byte-helpers.js")); - -var containers = _interopRequireWildcard(require("./containers.js")); - -var _decodeB64ToUint8Array = _interopRequireDefault(require("./decode-b64-to-uint8-array.js")); - -var mediaGroups = _interopRequireWildcard(require("./media-groups.js")); - -var _resolveUrl = _interopRequireDefault(require("./resolve-url.js")); - -var _stream = _interopRequireDefault(require("./stream.js")); - -var _default = { - codecs: codecs, - byteHelpers: byteHelpers, - containers: containers, - decodeB64ToUint8Array: _decodeB64ToUint8Array.default, - mediaGroups: mediaGroups, - resolveUrl: _resolveUrl.default, - Stream: _stream.default -}; -exports.default = _default; -module.exports = exports.default; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/m2ts-helpers.js b/node_modules/@videojs/vhs-utils/cjs/m2ts-helpers.js deleted file mode 100644 index 0045a83..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/m2ts-helpers.js +++ /dev/null @@ -1,116 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parseTs = void 0; - -var _byteHelpers = require("./byte-helpers.js"); - -var SYNC_BYTE = 0x47; - -var parseTs = function parseTs(bytes, maxPes) { - if (maxPes === void 0) { - maxPes = Infinity; - } - - bytes = (0, _byteHelpers.toUint8)(bytes); - var startIndex = 0; - var endIndex = 188; - var pmt = {}; - var pesCount = 0; - - while (endIndex < bytes.byteLength && pesCount < maxPes) { - if (bytes[startIndex] !== SYNC_BYTE && bytes[endIndex] !== SYNC_BYTE) { - endIndex += 1; - startIndex += 1; - continue; - } - - var packet = bytes.subarray(startIndex, endIndex); - var pid = (packet[1] & 0x1f) << 8 | packet[2]; - var hasPusi = !!(packet[1] & 0x40); - var hasAdaptationHeader = (packet[3] & 0x30) >>> 4 > 0x01; - var payloadOffset = 4 + (hasAdaptationHeader ? packet[4] + 1 : 0); - - if (hasPusi) { - payloadOffset += packet[payloadOffset] + 1; - } - - if (pid === 0 && !pmt.pid) { - pmt.pid = (packet[payloadOffset + 10] & 0x1f) << 8 | packet[payloadOffset + 11]; - } else if (pmt.pid && pid === pmt.pid && !pmt.streams) { - var isNotForward = packet[payloadOffset + 5] & 0x01; // ignore forward pmt delarations - - if (!isNotForward) { - continue; - } - - pmt.streams = {}; - var sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - var tableEnd = 3 + sectionLength - 4; - var programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - // add an entry that maps the elementary_pid to the stream_type - var i = payloadOffset + offset; - var type = packet[i]; - var esPid = (packet[i + 1] & 0x1F) << 8 | packet[i + 2]; - var esLength = (packet[i + 3] & 0x0f) << 8 | packet[i + 4]; - var esInfo = packet.subarray(i + 5, i + 5 + esLength); - var stream = pmt.streams[esPid] = { - esInfo: esInfo, - typeNumber: type, - packets: [], - type: '', - codec: '' - }; - - if (type === 0x06 && (0, _byteHelpers.bytesMatch)(esInfo, [0x4F, 0x70, 0x75, 0x73], { - offset: 2 - })) { - stream.type = 'audio'; - stream.codec = 'opus'; - } else if (type === 0x1B || type === 0x20) { - stream.type = 'video'; - stream.codec = 'avc1'; - } else if (type === 0x24) { - stream.type = 'video'; - stream.codec = 'hev1'; - } else if (type === 0x10) { - stream.type = 'video'; - stream.codec = 'mp4v.20'; - } else if (type === 0x0F) { - stream.type = 'audio'; - stream.codec = 'aac'; - } else if (type === 0x81) { - stream.type = 'audio'; - stream.codec = 'ac-3'; - } else if (type === 0x87) { - stream.type = 'audio'; - stream.codec = 'ec-3'; - } else if (type === 0x03 || type === 0x04) { - stream.type = 'audio'; - stream.codec = 'mp3'; - } - - offset += esLength + 5; - } - } else if (pmt.pid && pmt.streams) { - pmt.streams[pid].packets.push(packet.subarray(payloadOffset)); - pesCount++; - } - - startIndex += 188; - endIndex += 188; - } - - if (!pmt.streams) { - pmt.streams = {}; - } - - return pmt; -}; - -exports.parseTs = parseTs; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/media-groups.js b/node_modules/@videojs/vhs-utils/cjs/media-groups.js deleted file mode 100644 index 85d3612..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/media-groups.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.forEachMediaGroup = void 0; - -/** - * Loops through all supported media groups in master and calls the provided - * callback for each group - * - * @param {Object} master - * The parsed master manifest object - * @param {string[]} groups - * The media groups to call the callback for - * @param {Function} callback - * Callback to call for each media group - */ -var forEachMediaGroup = function forEachMediaGroup(master, groups, callback) { - groups.forEach(function (mediaType) { - for (var groupKey in master.mediaGroups[mediaType]) { - for (var labelKey in master.mediaGroups[mediaType][groupKey]) { - var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey]; - callback(mediaProperties, mediaType, groupKey, labelKey); - } - } - }); -}; - -exports.forEachMediaGroup = forEachMediaGroup; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/media-types.js b/node_modules/@videojs/vhs-utils/cjs/media-types.js deleted file mode 100644 index 3ad62ea..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/media-types.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.simpleTypeFromSourceType = void 0; -var MPEGURL_REGEX = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i; -var DASH_REGEX = /^application\/dash\+xml/i; -/** - * Returns a string that describes the type of source based on a video source object's - * media type. - * - * @see {@link https://dev.w3.org/html5/pf-summary/video.html#dom-source-type|Source Type} - * - * @param {string} type - * Video source object media type - * @return {('hls'|'dash'|'vhs-json'|null)} - * VHS source type string - */ - -var simpleTypeFromSourceType = function simpleTypeFromSourceType(type) { - if (MPEGURL_REGEX.test(type)) { - return 'hls'; - } - - if (DASH_REGEX.test(type)) { - return 'dash'; - } // Denotes the special case of a manifest object passed to http-streaming instead of a - // source URL. - // - // See https://en.wikipedia.org/wiki/Media_type for details on specifying media types. - // - // In this case, vnd stands for vendor, video.js for the organization, VHS for this - // project, and the +json suffix identifies the structure of the media type. - - - if (type === 'application/vnd.videojs.vhs+json') { - return 'vhs-json'; - } - - return null; -}; - -exports.simpleTypeFromSourceType = simpleTypeFromSourceType; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/mp4-helpers.js b/node_modules/@videojs/vhs-utils/cjs/mp4-helpers.js deleted file mode 100644 index 66c9a7b..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/mp4-helpers.js +++ /dev/null @@ -1,581 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parseMediaInfo = exports.parseTracks = exports.addSampleDescription = exports.buildFrameTable = exports.findNamedBox = exports.findBox = exports.parseDescriptors = void 0; - -var _byteHelpers = require("./byte-helpers.js"); - -var _codecHelpers = require("./codec-helpers.js"); - -var _opusHelpers = require("./opus-helpers.js"); - -var normalizePath = function normalizePath(path) { - if (typeof path === 'string') { - return (0, _byteHelpers.stringToBytes)(path); - } - - if (typeof path === 'number') { - return path; - } - - return path; -}; - -var normalizePaths = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map(function (p) { - return normalizePath(p); - }); -}; - -var DESCRIPTORS; - -var parseDescriptors = function parseDescriptors(bytes) { - bytes = (0, _byteHelpers.toUint8)(bytes); - var results = []; - var i = 0; - - while (bytes.length > i) { - var tag = bytes[i]; - var size = 0; - var headerSize = 0; // tag - - headerSize++; - var byte = bytes[headerSize]; // first byte - - headerSize++; - - while (byte & 0x80) { - size = (byte & 0x7F) << 7; - byte = bytes[headerSize]; - headerSize++; - } - - size += byte & 0x7F; - - for (var z = 0; z < DESCRIPTORS.length; z++) { - var _DESCRIPTORS$z = DESCRIPTORS[z], - id = _DESCRIPTORS$z.id, - parser = _DESCRIPTORS$z.parser; - - if (tag === id) { - results.push(parser(bytes.subarray(headerSize, headerSize + size))); - break; - } - } - - i += size + headerSize; - } - - return results; -}; - -exports.parseDescriptors = parseDescriptors; -DESCRIPTORS = [{ - id: 0x03, - parser: function parser(bytes) { - var desc = { - tag: 0x03, - id: bytes[0] << 8 | bytes[1], - flags: bytes[2], - size: 3, - dependsOnEsId: 0, - ocrEsId: 0, - descriptors: [], - url: '' - }; // depends on es id - - if (desc.flags & 0x80) { - desc.dependsOnEsId = bytes[desc.size] << 8 | bytes[desc.size + 1]; - desc.size += 2; - } // url - - - if (desc.flags & 0x40) { - var len = bytes[desc.size]; - desc.url = (0, _byteHelpers.bytesToString)(bytes.subarray(desc.size + 1, desc.size + 1 + len)); - desc.size += len; - } // ocr es id - - - if (desc.flags & 0x20) { - desc.ocrEsId = bytes[desc.size] << 8 | bytes[desc.size + 1]; - desc.size += 2; - } - - desc.descriptors = parseDescriptors(bytes.subarray(desc.size)) || []; - return desc; - } -}, { - id: 0x04, - parser: function parser(bytes) { - // DecoderConfigDescriptor - var desc = { - tag: 0x04, - oti: bytes[0], - streamType: bytes[1], - bufferSize: bytes[2] << 16 | bytes[3] << 8 | bytes[4], - maxBitrate: bytes[5] << 24 | bytes[6] << 16 | bytes[7] << 8 | bytes[8], - avgBitrate: bytes[9] << 24 | bytes[10] << 16 | bytes[11] << 8 | bytes[12], - descriptors: parseDescriptors(bytes.subarray(13)) - }; - return desc; - } -}, { - id: 0x05, - parser: function parser(bytes) { - // DecoderSpecificInfo - return { - tag: 0x05, - bytes: bytes - }; - } -}, { - id: 0x06, - parser: function parser(bytes) { - // SLConfigDescriptor - return { - tag: 0x06, - bytes: bytes - }; - } -}]; -/** - * find any number of boxes by name given a path to it in an iso bmff - * such as mp4. - * - * @param {TypedArray} bytes - * bytes for the iso bmff to search for boxes in - * - * @param {Uint8Array[]|string[]|string|Uint8Array} name - * An array of paths or a single path representing the name - * of boxes to search through in bytes. Paths may be - * uint8 (character codes) or strings. - * - * @param {boolean} [complete=false] - * Should we search only for complete boxes on the final path. - * This is very useful when you do not want to get back partial boxes - * in the case of streaming files. - * - * @return {Uint8Array[]} - * An array of the end paths that we found. - */ - -var findBox = function findBox(bytes, paths, complete) { - if (complete === void 0) { - complete = false; - } - - paths = normalizePaths(paths); - bytes = (0, _byteHelpers.toUint8)(bytes); - var results = []; - - if (!paths.length) { - // short-circuit the search for empty paths - return results; - } - - var i = 0; - - while (i < bytes.length) { - var size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0; - var type = bytes.subarray(i + 4, i + 8); // invalid box format. - - if (size === 0) { - break; - } - - var end = i + size; - - if (end > bytes.length) { - // this box is bigger than the number of bytes we have - // and complete is set, we cannot find any more boxes. - if (complete) { - break; - } - - end = bytes.length; - } - - var data = bytes.subarray(i + 8, end); - - if ((0, _byteHelpers.bytesMatch)(type, paths[0])) { - if (paths.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data); - } else { - // recursively search for the next box along the path - results.push.apply(results, findBox(data, paths.slice(1), complete)); - } - } - - i = end; - } // we've finished searching all of bytes - - - return results; -}; -/** - * Search for a single matching box by name in an iso bmff format like - * mp4. This function is useful for finding codec boxes which - * can be placed arbitrarily in sample descriptions depending - * on the version of the file or file type. - * - * @param {TypedArray} bytes - * bytes for the iso bmff to search for boxes in - * - * @param {string|Uint8Array} name - * The name of the box to find. - * - * @return {Uint8Array[]} - * a subarray of bytes representing the name boxed we found. - */ - - -exports.findBox = findBox; - -var findNamedBox = function findNamedBox(bytes, name) { - name = normalizePath(name); - - if (!name.length) { - // short-circuit the search for empty paths - return bytes.subarray(bytes.length); - } - - var i = 0; - - while (i < bytes.length) { - if ((0, _byteHelpers.bytesMatch)(bytes.subarray(i, i + name.length), name)) { - var size = (bytes[i - 4] << 24 | bytes[i - 3] << 16 | bytes[i - 2] << 8 | bytes[i - 1]) >>> 0; - var end = size > 1 ? i + size : bytes.byteLength; - return bytes.subarray(i + 4, end); - } - - i++; - } // we've finished searching all of bytes - - - return bytes.subarray(bytes.length); -}; - -exports.findNamedBox = findNamedBox; - -var parseSamples = function parseSamples(data, entrySize, parseEntry) { - if (entrySize === void 0) { - entrySize = 4; - } - - if (parseEntry === void 0) { - parseEntry = function parseEntry(d) { - return (0, _byteHelpers.bytesToNumber)(d); - }; - } - - var entries = []; - - if (!data || !data.length) { - return entries; - } - - var entryCount = (0, _byteHelpers.bytesToNumber)(data.subarray(4, 8)); - - for (var i = 8; entryCount; i += entrySize, entryCount--) { - entries.push(parseEntry(data.subarray(i, i + entrySize))); - } - - return entries; -}; - -var buildFrameTable = function buildFrameTable(stbl, timescale) { - var keySamples = parseSamples(findBox(stbl, ['stss'])[0]); - var chunkOffsets = parseSamples(findBox(stbl, ['stco'])[0]); - var timeToSamples = parseSamples(findBox(stbl, ['stts'])[0], 8, function (entry) { - return { - sampleCount: (0, _byteHelpers.bytesToNumber)(entry.subarray(0, 4)), - sampleDelta: (0, _byteHelpers.bytesToNumber)(entry.subarray(4, 8)) - }; - }); - var samplesToChunks = parseSamples(findBox(stbl, ['stsc'])[0], 12, function (entry) { - return { - firstChunk: (0, _byteHelpers.bytesToNumber)(entry.subarray(0, 4)), - samplesPerChunk: (0, _byteHelpers.bytesToNumber)(entry.subarray(4, 8)), - sampleDescriptionIndex: (0, _byteHelpers.bytesToNumber)(entry.subarray(8, 12)) - }; - }); - var stsz = findBox(stbl, ['stsz'])[0]; // stsz starts with a 4 byte sampleSize which we don't need - - var sampleSizes = parseSamples(stsz && stsz.length && stsz.subarray(4) || null); - var frames = []; - - for (var chunkIndex = 0; chunkIndex < chunkOffsets.length; chunkIndex++) { - var samplesInChunk = void 0; - - for (var i = 0; i < samplesToChunks.length; i++) { - var sampleToChunk = samplesToChunks[i]; - var isThisOne = chunkIndex + 1 >= sampleToChunk.firstChunk && (i + 1 >= samplesToChunks.length || chunkIndex + 1 < samplesToChunks[i + 1].firstChunk); - - if (isThisOne) { - samplesInChunk = sampleToChunk.samplesPerChunk; - break; - } - } - - var chunkOffset = chunkOffsets[chunkIndex]; - - for (var _i = 0; _i < samplesInChunk; _i++) { - var frameEnd = sampleSizes[frames.length]; // if we don't have key samples every frame is a keyframe - - var keyframe = !keySamples.length; - - if (keySamples.length && keySamples.indexOf(frames.length + 1) !== -1) { - keyframe = true; - } - - var frame = { - keyframe: keyframe, - start: chunkOffset, - end: chunkOffset + frameEnd - }; - - for (var k = 0; k < timeToSamples.length; k++) { - var _timeToSamples$k = timeToSamples[k], - sampleCount = _timeToSamples$k.sampleCount, - sampleDelta = _timeToSamples$k.sampleDelta; - - if (frames.length <= sampleCount) { - // ms to ns - var lastTimestamp = frames.length ? frames[frames.length - 1].timestamp : 0; - frame.timestamp = lastTimestamp + sampleDelta / timescale * 1000; - frame.duration = sampleDelta; - break; - } - } - - frames.push(frame); - chunkOffset += frameEnd; - } - } - - return frames; -}; - -exports.buildFrameTable = buildFrameTable; - -var addSampleDescription = function addSampleDescription(track, bytes) { - var codec = (0, _byteHelpers.bytesToString)(bytes.subarray(0, 4)); - - if (track.type === 'video') { - track.info = track.info || {}; - track.info.width = bytes[28] << 8 | bytes[29]; - track.info.height = bytes[30] << 8 | bytes[31]; - } else if (track.type === 'audio') { - track.info = track.info || {}; - track.info.channels = bytes[20] << 8 | bytes[21]; - track.info.bitDepth = bytes[22] << 8 | bytes[23]; - track.info.sampleRate = bytes[28] << 8 | bytes[29]; - } - - if (codec === 'avc1') { - var avcC = findNamedBox(bytes, 'avcC'); // AVCDecoderConfigurationRecord - - codec += "." + (0, _codecHelpers.getAvcCodec)(avcC); - track.info.avcC = avcC; // TODO: do we need to parse all this? - - /* { - configurationVersion: avcC[0], - profile: avcC[1], - profileCompatibility: avcC[2], - level: avcC[3], - lengthSizeMinusOne: avcC[4] & 0x3 - }; - let spsNalUnitCount = avcC[5] & 0x1F; - const spsNalUnits = track.info.avc.spsNalUnits = []; - // past spsNalUnitCount - let offset = 6; - while (spsNalUnitCount--) { - const nalLen = avcC[offset] << 8 | avcC[offset + 1]; - spsNalUnits.push(avcC.subarray(offset + 2, offset + 2 + nalLen)); - offset += nalLen + 2; - } - let ppsNalUnitCount = avcC[offset]; - const ppsNalUnits = track.info.avc.ppsNalUnits = []; - // past ppsNalUnitCount - offset += 1; - while (ppsNalUnitCount--) { - const nalLen = avcC[offset] << 8 | avcC[offset + 1]; - ppsNalUnits.push(avcC.subarray(offset + 2, offset + 2 + nalLen)); - offset += nalLen + 2; - }*/ - // HEVCDecoderConfigurationRecord - } else if (codec === 'hvc1' || codec === 'hev1') { - codec += "." + (0, _codecHelpers.getHvcCodec)(findNamedBox(bytes, 'hvcC')); - } else if (codec === 'mp4a' || codec === 'mp4v') { - var esds = findNamedBox(bytes, 'esds'); - var esDescriptor = parseDescriptors(esds.subarray(4))[0]; - var decoderConfig = esDescriptor && esDescriptor.descriptors.filter(function (_ref) { - var tag = _ref.tag; - return tag === 0x04; - })[0]; - - if (decoderConfig) { - // most codecs do not have a further '.' - // such as 0xa5 for ac-3 and 0xa6 for e-ac-3 - codec += '.' + (0, _byteHelpers.toHexString)(decoderConfig.oti); - - if (decoderConfig.oti === 0x40) { - codec += '.' + (decoderConfig.descriptors[0].bytes[0] >> 3).toString(); - } else if (decoderConfig.oti === 0x20) { - codec += '.' + decoderConfig.descriptors[0].bytes[4].toString(); - } else if (decoderConfig.oti === 0xdd) { - codec = 'vorbis'; - } - } else if (track.type === 'audio') { - codec += '.40.2'; - } else { - codec += '.20.9'; - } - } else if (codec === 'av01') { - // AV1DecoderConfigurationRecord - codec += "." + (0, _codecHelpers.getAv1Codec)(findNamedBox(bytes, 'av1C')); - } else if (codec === 'vp09') { - // VPCodecConfigurationRecord - var vpcC = findNamedBox(bytes, 'vpcC'); // https://www.webmproject.org/vp9/mp4/ - - var profile = vpcC[0]; - var level = vpcC[1]; - var bitDepth = vpcC[2] >> 4; - var chromaSubsampling = (vpcC[2] & 0x0F) >> 1; - var videoFullRangeFlag = (vpcC[2] & 0x0F) >> 3; - var colourPrimaries = vpcC[3]; - var transferCharacteristics = vpcC[4]; - var matrixCoefficients = vpcC[5]; - codec += "." + (0, _byteHelpers.padStart)(profile, 2, '0'); - codec += "." + (0, _byteHelpers.padStart)(level, 2, '0'); - codec += "." + (0, _byteHelpers.padStart)(bitDepth, 2, '0'); - codec += "." + (0, _byteHelpers.padStart)(chromaSubsampling, 2, '0'); - codec += "." + (0, _byteHelpers.padStart)(colourPrimaries, 2, '0'); - codec += "." + (0, _byteHelpers.padStart)(transferCharacteristics, 2, '0'); - codec += "." + (0, _byteHelpers.padStart)(matrixCoefficients, 2, '0'); - codec += "." + (0, _byteHelpers.padStart)(videoFullRangeFlag, 2, '0'); - } else if (codec === 'theo') { - codec = 'theora'; - } else if (codec === 'spex') { - codec = 'speex'; - } else if (codec === '.mp3') { - codec = 'mp4a.40.34'; - } else if (codec === 'msVo') { - codec = 'vorbis'; - } else if (codec === 'Opus') { - codec = 'opus'; - var dOps = findNamedBox(bytes, 'dOps'); - track.info.opus = (0, _opusHelpers.parseOpusHead)(dOps); // TODO: should this go into the webm code?? - // Firefox requires a codecDelay for opus playback - // see https://bugzilla.mozilla.org/show_bug.cgi?id=1276238 - - track.info.codecDelay = 6500000; - } else { - codec = codec.toLowerCase(); - } - /* eslint-enable */ - // flac, ac-3, ec-3, opus - - - track.codec = codec; -}; - -exports.addSampleDescription = addSampleDescription; - -var parseTracks = function parseTracks(bytes, frameTable) { - if (frameTable === void 0) { - frameTable = true; - } - - bytes = (0, _byteHelpers.toUint8)(bytes); - var traks = findBox(bytes, ['moov', 'trak'], true); - var tracks = []; - traks.forEach(function (trak) { - var track = { - bytes: trak - }; - var mdia = findBox(trak, ['mdia'])[0]; - var hdlr = findBox(mdia, ['hdlr'])[0]; - var trakType = (0, _byteHelpers.bytesToString)(hdlr.subarray(8, 12)); - - if (trakType === 'soun') { - track.type = 'audio'; - } else if (trakType === 'vide') { - track.type = 'video'; - } else { - track.type = trakType; - } - - var tkhd = findBox(trak, ['tkhd'])[0]; - - if (tkhd) { - var view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - var tkhdVersion = view.getUint8(0); - track.number = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var mdhd = findBox(mdia, ['mdhd'])[0]; - - if (mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - track.timescale = (mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]) >>> 0; - } - - var stbl = findBox(mdia, ['minf', 'stbl'])[0]; - var stsd = findBox(stbl, ['stsd'])[0]; - var descriptionCount = (0, _byteHelpers.bytesToNumber)(stsd.subarray(4, 8)); - var offset = 8; // add codec and codec info - - while (descriptionCount--) { - var len = (0, _byteHelpers.bytesToNumber)(stsd.subarray(offset, offset + 4)); - var sampleDescriptor = stsd.subarray(offset + 4, offset + 4 + len); - addSampleDescription(track, sampleDescriptor); - offset += 4 + len; - } - - if (frameTable) { - track.frameTable = buildFrameTable(stbl, track.timescale); - } // codec has no sub parameters - - - tracks.push(track); - }); - return tracks; -}; - -exports.parseTracks = parseTracks; - -var parseMediaInfo = function parseMediaInfo(bytes) { - var mvhd = findBox(bytes, ['moov', 'mvhd'], true)[0]; - - if (!mvhd || !mvhd.length) { - return; - } - - var info = {}; // ms to ns - // mvhd v1 has 8 byte duration and other fields too - - if (mvhd[0] === 1) { - info.timestampScale = (0, _byteHelpers.bytesToNumber)(mvhd.subarray(20, 24)); - info.duration = (0, _byteHelpers.bytesToNumber)(mvhd.subarray(24, 32)); - } else { - info.timestampScale = (0, _byteHelpers.bytesToNumber)(mvhd.subarray(12, 16)); - info.duration = (0, _byteHelpers.bytesToNumber)(mvhd.subarray(16, 20)); - } - - info.bytes = mvhd; - return info; -}; - -exports.parseMediaInfo = parseMediaInfo; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/nal-helpers.js b/node_modules/@videojs/vhs-utils/cjs/nal-helpers.js deleted file mode 100644 index 3c4c811..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/nal-helpers.js +++ /dev/null @@ -1,135 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.findH265Nal = exports.findH264Nal = exports.findNal = exports.discardEmulationPreventionBytes = exports.EMULATION_PREVENTION = exports.NAL_TYPE_TWO = exports.NAL_TYPE_ONE = void 0; - -var _byteHelpers = require("./byte-helpers.js"); - -var NAL_TYPE_ONE = (0, _byteHelpers.toUint8)([0x00, 0x00, 0x00, 0x01]); -exports.NAL_TYPE_ONE = NAL_TYPE_ONE; -var NAL_TYPE_TWO = (0, _byteHelpers.toUint8)([0x00, 0x00, 0x01]); -exports.NAL_TYPE_TWO = NAL_TYPE_TWO; -var EMULATION_PREVENTION = (0, _byteHelpers.toUint8)([0x00, 0x00, 0x03]); -/** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - -exports.EMULATION_PREVENTION = EMULATION_PREVENTION; - -var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(bytes) { - var positions = []; - var i = 1; // Find all `Emulation Prevention Bytes` - - while (i < bytes.length - 2) { - if ((0, _byteHelpers.bytesMatch)(bytes.subarray(i, i + 3), EMULATION_PREVENTION)) { - positions.push(i + 2); - i++; - } - - i++; - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (positions.length === 0) { - return bytes; - } // Create a new array to hold the NAL unit data - - - var newLength = bytes.length - positions.length; - var newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === positions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - positions.shift(); - } - - newData[i] = bytes[sourceIndex]; - } - - return newData; -}; - -exports.discardEmulationPreventionBytes = discardEmulationPreventionBytes; - -var findNal = function findNal(bytes, dataType, types, nalLimit) { - if (nalLimit === void 0) { - nalLimit = Infinity; - } - - bytes = (0, _byteHelpers.toUint8)(bytes); - types = [].concat(types); - var i = 0; - var nalStart; - var nalsFound = 0; // keep searching until: - // we reach the end of bytes - // we reach the maximum number of nals they want to seach - // NOTE: that we disregard nalLimit when we have found the start - // of the nal we want so that we can find the end of the nal we want. - - while (i < bytes.length && (nalsFound < nalLimit || nalStart)) { - var nalOffset = void 0; - - if ((0, _byteHelpers.bytesMatch)(bytes.subarray(i), NAL_TYPE_ONE)) { - nalOffset = 4; - } else if ((0, _byteHelpers.bytesMatch)(bytes.subarray(i), NAL_TYPE_TWO)) { - nalOffset = 3; - } // we are unsynced, - // find the next nal unit - - - if (!nalOffset) { - i++; - continue; - } - - nalsFound++; - - if (nalStart) { - return discardEmulationPreventionBytes(bytes.subarray(nalStart, i)); - } - - var nalType = void 0; - - if (dataType === 'h264') { - nalType = bytes[i + nalOffset] & 0x1f; - } else if (dataType === 'h265') { - nalType = bytes[i + nalOffset] >> 1 & 0x3f; - } - - if (types.indexOf(nalType) !== -1) { - nalStart = i + nalOffset; - } // nal header is 1 length for h264, and 2 for h265 - - - i += nalOffset + (dataType === 'h264' ? 1 : 2); - } - - return bytes.subarray(0, 0); -}; - -exports.findNal = findNal; - -var findH264Nal = function findH264Nal(bytes, type, nalLimit) { - return findNal(bytes, 'h264', type, nalLimit); -}; - -exports.findH264Nal = findH264Nal; - -var findH265Nal = function findH265Nal(bytes, type, nalLimit) { - return findNal(bytes, 'h265', type, nalLimit); -}; - -exports.findH265Nal = findH265Nal; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/ogg-helpers.js b/node_modules/@videojs/vhs-utils/cjs/ogg-helpers.js deleted file mode 100644 index bc0eb26..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/ogg-helpers.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getPages = void 0; - -var _byteHelpers = require("./byte-helpers"); - -var SYNC_WORD = (0, _byteHelpers.toUint8)([0x4f, 0x67, 0x67, 0x53]); - -var getPages = function getPages(bytes, start, end) { - if (end === void 0) { - end = Infinity; - } - - bytes = (0, _byteHelpers.toUint8)(bytes); - var pages = []; - var i = 0; - - while (i < bytes.length && pages.length < end) { - // we are unsynced, - // find the next syncword - if (!(0, _byteHelpers.bytesMatch)(bytes, SYNC_WORD, { - offset: i - })) { - i++; - continue; - } - - var segmentLength = bytes[i + 27]; - pages.push(bytes.subarray(i, i + 28 + segmentLength)); - i += pages[pages.length - 1].length; - } - - return pages.slice(start, end); -}; - -exports.getPages = getPages; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/opus-helpers.js b/node_modules/@videojs/vhs-utils/cjs/opus-helpers.js deleted file mode 100644 index 1c58379..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/opus-helpers.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.setOpusHead = exports.parseOpusHead = exports.OPUS_HEAD = void 0; -var OPUS_HEAD = new Uint8Array([// O, p, u, s -0x4f, 0x70, 0x75, 0x73, // H, e, a, d -0x48, 0x65, 0x61, 0x64]); // https://wiki.xiph.org/OggOpus -// https://vfrmaniac.fushizen.eu/contents/opus_in_isobmff.html -// https://opus-codec.org/docs/opusfile_api-0.7/structOpusHead.html - -exports.OPUS_HEAD = OPUS_HEAD; - -var parseOpusHead = function parseOpusHead(bytes) { - var view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); - var version = view.getUint8(0); // version 0, from mp4, does not use littleEndian. - - var littleEndian = version !== 0; - var config = { - version: version, - channels: view.getUint8(1), - preSkip: view.getUint16(2, littleEndian), - sampleRate: view.getUint32(4, littleEndian), - outputGain: view.getUint16(8, littleEndian), - channelMappingFamily: view.getUint8(10) - }; - - if (config.channelMappingFamily > 0 && bytes.length > 10) { - config.streamCount = view.getUint8(11); - config.twoChannelStreamCount = view.getUint8(12); - config.channelMapping = []; - - for (var c = 0; c < config.channels; c++) { - config.channelMapping.push(view.getUint8(13 + c)); - } - } - - return config; -}; - -exports.parseOpusHead = parseOpusHead; - -var setOpusHead = function setOpusHead(config) { - var size = config.channelMappingFamily <= 0 ? 11 : 12 + config.channels; - var view = new DataView(new ArrayBuffer(size)); - var littleEndian = config.version !== 0; - view.setUint8(0, config.version); - view.setUint8(1, config.channels); - view.setUint16(2, config.preSkip, littleEndian); - view.setUint32(4, config.sampleRate, littleEndian); - view.setUint16(8, config.outputGain, littleEndian); - view.setUint8(10, config.channelMappingFamily); - - if (config.channelMappingFamily > 0) { - view.setUint8(11, config.streamCount); - config.channelMapping.foreach(function (cm, i) { - view.setUint8(12 + i, cm); - }); - } - - return new Uint8Array(view.buffer); -}; - -exports.setOpusHead = setOpusHead; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/resolve-url.js b/node_modules/@videojs/vhs-utils/cjs/resolve-url.js deleted file mode 100644 index 3562950..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/resolve-url.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _urlToolkit = _interopRequireDefault(require("url-toolkit")); - -var _window = _interopRequireDefault(require("global/window")); - -var DEFAULT_LOCATION = 'http://example.com'; - -var resolveUrl = function resolveUrl(baseUrl, relativeUrl) { - // return early if we don't need to resolve - if (/^[a-z]+:/i.test(relativeUrl)) { - return relativeUrl; - } // if baseUrl is a data URI, ignore it and resolve everything relative to window.location - - - if (/^data:/.test(baseUrl)) { - baseUrl = _window.default.location && _window.default.location.href || ''; - } // IE11 supports URL but not the URL constructor - // feature detect the behavior we want - - - var nativeURL = typeof _window.default.URL === 'function'; - var protocolLess = /^\/\//.test(baseUrl); // remove location if window.location isn't available (i.e. we're in node) - // and if baseUrl isn't an absolute url - - var removeLocation = !_window.default.location && !/\/\//i.test(baseUrl); // if the base URL is relative then combine with the current location - - if (nativeURL) { - baseUrl = new _window.default.URL(baseUrl, _window.default.location || DEFAULT_LOCATION); - } else if (!/\/\//i.test(baseUrl)) { - baseUrl = _urlToolkit.default.buildAbsoluteURL(_window.default.location && _window.default.location.href || '', baseUrl); - } - - if (nativeURL) { - var newUrl = new URL(relativeUrl, baseUrl); // if we're a protocol-less url, remove the protocol - // and if we're location-less, remove the location - // otherwise, return the url unmodified - - if (removeLocation) { - return newUrl.href.slice(DEFAULT_LOCATION.length); - } else if (protocolLess) { - return newUrl.href.slice(newUrl.protocol.length); - } - - return newUrl.href; - } - - return _urlToolkit.default.buildAbsoluteURL(baseUrl, relativeUrl); -}; - -var _default = resolveUrl; -exports.default = _default; -module.exports = exports.default; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/riff-helpers.js b/node_modules/@videojs/vhs-utils/cjs/riff-helpers.js deleted file mode 100644 index 3f13ea9..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/riff-helpers.js +++ /dev/null @@ -1,84 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.findFourCC = void 0; - -var _byteHelpers = require("./byte-helpers.js"); - -var CONSTANTS = { - LIST: (0, _byteHelpers.toUint8)([0x4c, 0x49, 0x53, 0x54]), - RIFF: (0, _byteHelpers.toUint8)([0x52, 0x49, 0x46, 0x46]), - WAVE: (0, _byteHelpers.toUint8)([0x57, 0x41, 0x56, 0x45]) -}; - -var normalizePath = function normalizePath(path) { - if (typeof path === 'string') { - return (0, _byteHelpers.stringToBytes)(path); - } - - if (typeof path === 'number') { - return path; - } - - return path; -}; - -var normalizePaths = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map(function (p) { - return normalizePath(p); - }); -}; - -var findFourCC = function findFourCC(bytes, paths) { - paths = normalizePaths(paths); - bytes = (0, _byteHelpers.toUint8)(bytes); - var results = []; - - if (!paths.length) { - // short-circuit the search for empty paths - return results; - } - - var i = 0; - - while (i < bytes.length) { - var type = bytes.subarray(i, i + 4); - var size = (bytes[i + 7] << 24 | bytes[i + 6] << 16 | bytes[i + 5] << 8 | bytes[i + 4]) >>> 0; // skip LIST/RIFF and get the actual type - - if ((0, _byteHelpers.bytesMatch)(type, CONSTANTS.LIST) || (0, _byteHelpers.bytesMatch)(type, CONSTANTS.RIFF) || (0, _byteHelpers.bytesMatch)(type, CONSTANTS.WAVE)) { - type = bytes.subarray(i + 8, i + 12); - i += 4; - size -= 4; - } - - var data = bytes.subarray(i + 8, i + 8 + size); - - if ((0, _byteHelpers.bytesMatch)(type, paths[0])) { - if (paths.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data); - } else { - // recursively search for the next box along the path - var subresults = findFourCC(data, paths.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i += 8 + data.length; - } // we've finished searching all of bytes - - - return results; -}; - -exports.findFourCC = findFourCC; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/cjs/stream.js b/node_modules/@videojs/vhs-utils/cjs/stream.js deleted file mode 100644 index 0760fa4..0000000 --- a/node_modules/@videojs/vhs-utils/cjs/stream.js +++ /dev/null @@ -1,129 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** - * @file stream.js - */ - -/** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ -var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; -}(); - -exports.default = Stream; -module.exports = exports.default; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/dist/vhs-utils.js b/node_modules/@videojs/vhs-utils/dist/vhs-utils.js deleted file mode 100644 index 120f132..0000000 --- a/node_modules/@videojs/vhs-utils/dist/vhs-utils.js +++ /dev/null @@ -1,1576 +0,0 @@ -/*! @name @videojs/vhs-utils @version 3.0.2 @license MIT */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('global/window')) : - typeof define === 'function' && define.amd ? define(['global/window'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.vhsUtils = factory(global.window)); -}(this, (function (window) { 'use strict'; - - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - - var window__default = /*#__PURE__*/_interopDefaultLegacy(window); - - var regexs = { - // to determine mime types - mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/, - webm: /^(vp0?[89]|av0?1|opus|vorbis)/, - ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/, - // to determine if a codec is audio or video - video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/, - audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/, - text: /^(stpp.ttml.im1t)/, - // mux.js support regex - muxerVideo: /^(avc0?1)/, - muxerAudio: /^(mp4a)/, - // match nothing as muxer does not support text right now. - // there cannot never be a character before the start of a string - // so this matches nothing. - muxerText: /a^/ - }; - var mediaTypes = ['video', 'audio', 'text']; - var upperMediaTypes = ['Video', 'Audio', 'Text']; - /** - * Replace the old apple-style `avc1.
.
` codec string with the standard - * `avc1.` - * - * @param {string} codec - * Codec string to translate - * @return {string} - * The translated codec string - */ - - var translateLegacyCodec = function translateLegacyCodec(codec) { - if (!codec) { - return codec; - } - - return codec.replace(/avc1\.(\d+)\.(\d+)/i, function (orig, profile, avcLevel) { - var profileHex = ('00' + Number(profile).toString(16)).slice(-2); - var avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2); - return 'avc1.' + profileHex + '00' + avcLevelHex; - }); - }; - /** - * Replace the old apple-style `avc1.
.
` codec strings with the standard - * `avc1.` - * - * @param {string[]} codecs - * An array of codec strings to translate - * @return {string[]} - * The translated array of codec strings - */ - - var translateLegacyCodecs = function translateLegacyCodecs(codecs) { - return codecs.map(translateLegacyCodec); - }; - /** - * Replace codecs in the codec string with the old apple-style `avc1.
.
` to the - * standard `avc1.`. - * - * @param {string} codecString - * The codec string - * @return {string} - * The codec string with old apple-style codecs replaced - * - * @private - */ - - var mapLegacyAvcCodecs = function mapLegacyAvcCodecs(codecString) { - return codecString.replace(/avc1\.(\d+)\.(\d+)/i, function (match) { - return translateLegacyCodecs([match])[0]; - }); - }; - /** - * @typedef {Object} ParsedCodecInfo - * @property {number} codecCount - * Number of codecs parsed - * @property {string} [videoCodec] - * Parsed video codec (if found) - * @property {string} [videoObjectTypeIndicator] - * Video object type indicator (if found) - * @property {string|null} audioProfile - * Audio profile - */ - - /** - * Parses a codec string to retrieve the number of codecs specified, the video codec and - * object type indicator, and the audio profile. - * - * @param {string} [codecString] - * The codec string to parse - * @return {ParsedCodecInfo} - * Parsed codec info - */ - - var parseCodecs = function parseCodecs(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - var codecs = codecString.split(','); - var result = []; - codecs.forEach(function (codec) { - codec = codec.trim(); - var codecType; - mediaTypes.forEach(function (name) { - var match = regexs[name].exec(codec.toLowerCase()); - - if (!match || match.length <= 1) { - return; - } - - codecType = name; // maintain codec case - - var type = codec.substring(0, match[1].length); - var details = codec.replace(type, ''); - result.push({ - type: type, - details: details, - mediaType: name - }); - }); - - if (!codecType) { - result.push({ - type: codec, - details: '', - mediaType: 'unknown' - }); - } - }); - return result; - }; - /** - * Returns a ParsedCodecInfo object for the default alternate audio playlist if there is - * a default alternate audio playlist for the provided audio group. - * - * @param {Object} master - * The master playlist - * @param {string} audioGroupId - * ID of the audio group for which to find the default codec info - * @return {ParsedCodecInfo} - * Parsed codec info - */ - - var codecsFromDefault = function codecsFromDefault(master, audioGroupId) { - if (!master.mediaGroups.AUDIO || !audioGroupId) { - return null; - } - - var audioGroup = master.mediaGroups.AUDIO[audioGroupId]; - - if (!audioGroup) { - return null; - } - - for (var name in audioGroup) { - var audioType = audioGroup[name]; - - if (audioType.default && audioType.playlists) { - // codec should be the same for all playlists within the audio type - return parseCodecs(audioType.playlists[0].attributes.CODECS); - } - } - - return null; - }; - var isVideoCodec = function isVideoCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.video.test(codec.trim().toLowerCase()); - }; - var isAudioCodec = function isAudioCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.audio.test(codec.trim().toLowerCase()); - }; - var isTextCodec = function isTextCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.text.test(codec.trim().toLowerCase()); - }; - var getMimeForCodec = function getMimeForCodec(codecString) { - if (!codecString || typeof codecString !== 'string') { - return; - } - - var codecs = codecString.toLowerCase().split(',').map(function (c) { - return translateLegacyCodec(c.trim()); - }); // default to video type - - var type = 'video'; // only change to audio type if the only codec we have is - // audio - - if (codecs.length === 1 && isAudioCodec(codecs[0])) { - type = 'audio'; - } else if (codecs.length === 1 && isTextCodec(codecs[0])) { - // text uses application/ for now - type = 'application'; - } // default the container to mp4 - - - var container = 'mp4'; // every codec must be able to go into the container - // for that container to be the correct one - - if (codecs.every(function (c) { - return regexs.mp4.test(c); - })) { - container = 'mp4'; - } else if (codecs.every(function (c) { - return regexs.webm.test(c); - })) { - container = 'webm'; - } else if (codecs.every(function (c) { - return regexs.ogg.test(c); - })) { - container = 'ogg'; - } - - return type + "/" + container + ";codecs=\"" + codecString + "\""; - }; - var browserSupportsCodec = function browserSupportsCodec(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - return window__default['default'].MediaSource && window__default['default'].MediaSource.isTypeSupported && window__default['default'].MediaSource.isTypeSupported(getMimeForCodec(codecString)) || false; - }; - var muxerSupportsCodec = function muxerSupportsCodec(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - return codecString.toLowerCase().split(',').every(function (codec) { - codec = codec.trim(); // any match is supported. - - for (var i = 0; i < upperMediaTypes.length; i++) { - var type = upperMediaTypes[i]; - - if (regexs["muxer" + type].test(codec)) { - return true; - } - } - - return false; - }); - }; - var DEFAULT_AUDIO_CODEC = 'mp4a.40.2'; - var DEFAULT_VIDEO_CODEC = 'avc1.4d400d'; - - var codecs = /*#__PURE__*/Object.freeze({ - __proto__: null, - translateLegacyCodec: translateLegacyCodec, - translateLegacyCodecs: translateLegacyCodecs, - mapLegacyAvcCodecs: mapLegacyAvcCodecs, - parseCodecs: parseCodecs, - codecsFromDefault: codecsFromDefault, - isVideoCodec: isVideoCodec, - isAudioCodec: isAudioCodec, - isTextCodec: isTextCodec, - getMimeForCodec: getMimeForCodec, - browserSupportsCodec: browserSupportsCodec, - muxerSupportsCodec: muxerSupportsCodec, - DEFAULT_AUDIO_CODEC: DEFAULT_AUDIO_CODEC, - DEFAULT_VIDEO_CODEC: DEFAULT_VIDEO_CODEC - }); - - var repeat = function repeat(str, len) { - var acc = ''; - - while (len--) { - acc += str; - } - - return acc; - }; // count the number of bits it would take to represent a number - // we used to do this with log2 but BigInt does not support builtin math - // Math.ceil(log2(x)); - - - var countBits = function countBits(x) { - return x.toString(2).length; - }; // count the number of whole bytes it would take to represent a number - - var countBytes = function countBytes(x) { - return Math.ceil(countBits(x) / 8); - }; - var padStart = function padStart(b, len, str) { - if (str === void 0) { - str = ' '; - } - - return (repeat(str, len) + b.toString()).slice(-len); - }; - var isTypedArray = function isTypedArray(obj) { - return ArrayBuffer.isView(obj); - }; - var toUint8 = function toUint8(bytes) { - if (bytes instanceof Uint8Array) { - return bytes; - } - - if (!Array.isArray(bytes) && !isTypedArray(bytes) && !(bytes instanceof ArrayBuffer)) { - // any non-number or NaN leads to empty uint8array - // eslint-disable-next-line - if (typeof bytes !== 'number' || typeof bytes === 'number' && bytes !== bytes) { - bytes = 0; - } else { - bytes = [bytes]; - } - } - - return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0); - }; - var toHexString = function toHexString(bytes) { - bytes = toUint8(bytes); - var str = ''; - - for (var i = 0; i < bytes.length; i++) { - str += padStart(bytes[i].toString(16), 2, '0'); - } - - return str; - }; - var toBinaryString = function toBinaryString(bytes) { - bytes = toUint8(bytes); - var str = ''; - - for (var i = 0; i < bytes.length; i++) { - str += padStart(bytes[i].toString(2), 8, '0'); - } - - return str; - }; - var BigInt = window__default['default'].BigInt || Number; - var BYTE_TABLE = [BigInt('0x1'), BigInt('0x100'), BigInt('0x10000'), BigInt('0x1000000'), BigInt('0x100000000'), BigInt('0x10000000000'), BigInt('0x1000000000000'), BigInt('0x100000000000000'), BigInt('0x10000000000000000')]; - var ENDIANNESS = function () { - var a = new Uint16Array([0xFFCC]); - var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength); - - if (b[0] === 0xFF) { - return 'big'; - } - - if (b[0] === 0xCC) { - return 'little'; - } - - return 'unknown'; - }(); - var IS_BIG_ENDIAN = ENDIANNESS === 'big'; - var IS_LITTLE_ENDIAN = ENDIANNESS === 'little'; - var bytesToNumber = function bytesToNumber(bytes, _temp) { - var _ref = _temp === void 0 ? {} : _temp, - _ref$signed = _ref.signed, - signed = _ref$signed === void 0 ? false : _ref$signed, - _ref$le = _ref.le, - le = _ref$le === void 0 ? false : _ref$le; - - bytes = toUint8(bytes); - var fn = le ? 'reduce' : 'reduceRight'; - var obj = bytes[fn] ? bytes[fn] : Array.prototype[fn]; - var number = obj.call(bytes, function (total, byte, i) { - var exponent = le ? i : Math.abs(i + 1 - bytes.length); - return total + BigInt(byte) * BYTE_TABLE[exponent]; - }, BigInt(0)); - - if (signed) { - var max = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1); - number = BigInt(number); - - if (number > max) { - number -= max; - number -= max; - number -= BigInt(2); - } - } - - return Number(number); - }; - var numberToBytes = function numberToBytes(number, _temp2) { - var _ref2 = _temp2 === void 0 ? {} : _temp2, - _ref2$le = _ref2.le, - le = _ref2$le === void 0 ? false : _ref2$le; - - // eslint-disable-next-line - if (typeof number !== 'bigint' && typeof number !== 'number' || typeof number === 'number' && number !== number) { - number = 0; - } - - number = BigInt(number); - var byteCount = countBytes(number); - var bytes = new Uint8Array(new ArrayBuffer(byteCount)); - - for (var i = 0; i < byteCount; i++) { - var byteIndex = le ? i : Math.abs(i + 1 - bytes.length); - bytes[byteIndex] = Number(number / BYTE_TABLE[i] & BigInt(0xFF)); - - if (number < 0) { - bytes[byteIndex] = Math.abs(~bytes[byteIndex]); - bytes[byteIndex] -= i === 0 ? 1 : 2; - } - } - - return bytes; - }; - var bytesToString = function bytesToString(bytes) { - if (!bytes) { - return ''; - } // TODO: should toUint8 handle cases where we only have 8 bytes - // but report more since this is a Uint16+ Array? - - - bytes = Array.prototype.slice.call(bytes); - var string = String.fromCharCode.apply(null, toUint8(bytes)); - - try { - return decodeURIComponent(escape(string)); - } catch (e) {// if decodeURIComponent/escape fails, we are dealing with partial - // or full non string data. Just return the potentially garbled string. - } - - return string; - }; - var stringToBytes = function stringToBytes(string, stringIsBytes) { - if (typeof string !== 'string' && string && typeof string.toString === 'function') { - string = string.toString(); - } - - if (typeof string !== 'string') { - return new Uint8Array(); - } // If the string already is bytes, we don't have to do this - // otherwise we do this so that we split multi length characters - // into individual bytes - - - if (!stringIsBytes) { - string = unescape(encodeURIComponent(string)); - } - - var view = new Uint8Array(string.length); - - for (var i = 0; i < string.length; i++) { - view[i] = string.charCodeAt(i); - } - - return view; - }; - var concatTypedArrays = function concatTypedArrays() { - for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) { - buffers[_key] = arguments[_key]; - } - - buffers = buffers.filter(function (b) { - return b && (b.byteLength || b.length) && typeof b !== 'string'; - }); - - if (buffers.length <= 1) { - // for 0 length we will return empty uint8 - // for 1 length we return the first uint8 - return toUint8(buffers[0]); - } - - var totalLen = buffers.reduce(function (total, buf, i) { - return total + (buf.byteLength || buf.length); - }, 0); - var tempBuffer = new Uint8Array(totalLen); - var offset = 0; - buffers.forEach(function (buf) { - buf = toUint8(buf); - tempBuffer.set(buf, offset); - offset += buf.byteLength; - }); - return tempBuffer; - }; - /** - * Check if the bytes "b" are contained within bytes "a". - * - * @param {Uint8Array|Array} a - * Bytes to check in - * - * @param {Uint8Array|Array} b - * Bytes to check for - * - * @param {Object} options - * options - * - * @param {Array|Uint8Array} [offset=0] - * offset to use when looking at bytes in a - * - * @param {Array|Uint8Array} [mask=[]] - * mask to use on bytes before comparison. - * - * @return {boolean} - * If all bytes in b are inside of a, taking into account - * bit masks. - */ - - var bytesMatch = function bytesMatch(a, b, _temp3) { - var _ref3 = _temp3 === void 0 ? {} : _temp3, - _ref3$offset = _ref3.offset, - offset = _ref3$offset === void 0 ? 0 : _ref3$offset, - _ref3$mask = _ref3.mask, - mask = _ref3$mask === void 0 ? [] : _ref3$mask; - - a = toUint8(a); - b = toUint8(b); // ie 11 does not support uint8 every - - var fn = b.every ? b.every : Array.prototype.every; - return b.length && a.length - offset >= b.length && // ie 11 doesn't support every on uin8 - fn.call(b, function (bByte, i) { - var aByte = mask[i] ? mask[i] & a[offset + i] : a[offset + i]; - return bByte === aByte; - }); - }; - var sliceBytes = function sliceBytes(src, start, end) { - if (Uint8Array.prototype.slice) { - return Uint8Array.prototype.slice.call(src, start, end); - } - - return new Uint8Array(Array.prototype.slice.call(src, start, end)); - }; - var reverseBytes = function reverseBytes(src) { - if (src.reverse) { - return src.reverse(); - } - - return Array.prototype.reverse.call(src); - }; - - var byteHelpers = /*#__PURE__*/Object.freeze({ - __proto__: null, - countBits: countBits, - countBytes: countBytes, - padStart: padStart, - isTypedArray: isTypedArray, - toUint8: toUint8, - toHexString: toHexString, - toBinaryString: toBinaryString, - ENDIANNESS: ENDIANNESS, - IS_BIG_ENDIAN: IS_BIG_ENDIAN, - IS_LITTLE_ENDIAN: IS_LITTLE_ENDIAN, - bytesToNumber: bytesToNumber, - numberToBytes: numberToBytes, - bytesToString: bytesToString, - stringToBytes: stringToBytes, - concatTypedArrays: concatTypedArrays, - bytesMatch: bytesMatch, - sliceBytes: sliceBytes, - reverseBytes: reverseBytes - }); - - var normalizePath = function normalizePath(path) { - if (typeof path === 'string') { - return stringToBytes(path); - } - - if (typeof path === 'number') { - return path; - } - - return path; - }; - - var normalizePaths = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map(function (p) { - return normalizePath(p); - }); - }; - /** - * find any number of boxes by name given a path to it in an iso bmff - * such as mp4. - * - * @param {TypedArray} bytes - * bytes for the iso bmff to search for boxes in - * - * @param {Uint8Array[]|string[]|string|Uint8Array} name - * An array of paths or a single path representing the name - * of boxes to search through in bytes. Paths may be - * uint8 (character codes) or strings. - * - * @param {boolean} [complete=false] - * Should we search only for complete boxes on the final path. - * This is very useful when you do not want to get back partial boxes - * in the case of streaming files. - * - * @return {Uint8Array[]} - * An array of the end paths that we found. - */ - - var findBox = function findBox(bytes, paths, complete) { - if (complete === void 0) { - complete = false; - } - - paths = normalizePaths(paths); - bytes = toUint8(bytes); - var results = []; - - if (!paths.length) { - // short-circuit the search for empty paths - return results; - } - - var i = 0; - - while (i < bytes.length) { - var size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0; - var type = bytes.subarray(i + 4, i + 8); // invalid box format. - - if (size === 0) { - break; - } - - var end = i + size; - - if (end > bytes.length) { - // this box is bigger than the number of bytes we have - // and complete is set, we cannot find any more boxes. - if (complete) { - break; - } - - end = bytes.length; - } - - var data = bytes.subarray(i + 8, end); - - if (bytesMatch(type, paths[0])) { - if (paths.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data); - } else { - // recursively search for the next box along the path - results.push.apply(results, findBox(data, paths.slice(1), complete)); - } - } - - i = end; - } // we've finished searching all of bytes - - - return results; - }; - - // https://matroska-org.github.io/libebml/specs.html - // https://www.matroska.org/technical/elements.html - // https://www.webmproject.org/docs/container/ - - var EBML_TAGS = { - EBML: toUint8([0x1A, 0x45, 0xDF, 0xA3]), - DocType: toUint8([0x42, 0x82]), - Segment: toUint8([0x18, 0x53, 0x80, 0x67]), - SegmentInfo: toUint8([0x15, 0x49, 0xA9, 0x66]), - Tracks: toUint8([0x16, 0x54, 0xAE, 0x6B]), - Track: toUint8([0xAE]), - TrackNumber: toUint8([0xd7]), - DefaultDuration: toUint8([0x23, 0xe3, 0x83]), - TrackEntry: toUint8([0xAE]), - TrackType: toUint8([0x83]), - FlagDefault: toUint8([0x88]), - CodecID: toUint8([0x86]), - CodecPrivate: toUint8([0x63, 0xA2]), - VideoTrack: toUint8([0xe0]), - AudioTrack: toUint8([0xe1]), - // Not used yet, but will be used for live webm/mkv - // see https://www.matroska.org/technical/basics.html#block-structure - // see https://www.matroska.org/technical/basics.html#simpleblock-structure - Cluster: toUint8([0x1F, 0x43, 0xB6, 0x75]), - Timestamp: toUint8([0xE7]), - TimestampScale: toUint8([0x2A, 0xD7, 0xB1]), - BlockGroup: toUint8([0xA0]), - BlockDuration: toUint8([0x9B]), - Block: toUint8([0xA1]), - SimpleBlock: toUint8([0xA3]) - }; - /** - * This is a simple table to determine the length - * of things in ebml. The length is one based (starts at 1, - * rather than zero) and for every zero bit before a one bit - * we add one to length. We also need this table because in some - * case we have to xor all the length bits from another value. - */ - - var LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1]; - - var getLength = function getLength(byte) { - var len = 1; - - for (var i = 0; i < LENGTH_TABLE.length; i++) { - if (byte & LENGTH_TABLE[i]) { - break; - } - - len++; - } - - return len; - }; // length in ebml is stored in the first 4 to 8 bits - // of the first byte. 4 for the id length and 8 for the - // data size length. Length is measured by converting the number to binary - // then 1 + the number of zeros before a 1 is encountered starting - // from the left. - - - var getvint = function getvint(bytes, offset, removeLength, signed) { - if (removeLength === void 0) { - removeLength = true; - } - - if (signed === void 0) { - signed = false; - } - - var length = getLength(bytes[offset]); - var valueBytes = bytes.subarray(offset, offset + length); // NOTE that we do **not** subarray here because we need to copy these bytes - // as they will be modified below to remove the dataSizeLen bits and we do not - // want to modify the original data. normally we could just call slice on - // uint8array but ie 11 does not support that... - - if (removeLength) { - valueBytes = Array.prototype.slice.call(bytes, offset, offset + length); - valueBytes[0] ^= LENGTH_TABLE[length - 1]; - } - - return { - length: length, - value: bytesToNumber(valueBytes, { - signed: signed - }), - bytes: valueBytes - }; - }; - - var normalizePath$1 = function normalizePath(path) { - if (typeof path === 'string') { - return path.match(/.{1,2}/g).map(function (p) { - return normalizePath(p); - }); - } - - if (typeof path === 'number') { - return numberToBytes(path); - } - - return path; - }; - - var normalizePaths$1 = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath$1(paths)]; - } - - return paths.map(function (p) { - return normalizePath$1(p); - }); - }; - - var getInfinityDataSize = function getInfinityDataSize(id, bytes, offset) { - if (offset >= bytes.length) { - return bytes.length; - } - - var innerid = getvint(bytes, offset, false); - - if (bytesMatch(id.bytes, innerid.bytes)) { - return offset; - } - - var dataHeader = getvint(bytes, offset + innerid.length); - return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length); - }; - /** - * Notes on the EBLM format. - * - * EBLM uses "vints" tags. Every vint tag contains - * two parts - * - * 1. The length from the first byte. You get this by - * converting the byte to binary and counting the zeros - * before a 1. Then you add 1 to that. Examples - * 00011111 = length 4 because there are 3 zeros before a 1. - * 00100000 = length 3 because there are 2 zeros before a 1. - * 00000011 = length 7 because there are 6 zeros before a 1. - * - * 2. The bits used for length are removed from the first byte - * Then all the bytes are merged into a value. NOTE: this - * is not the case for id ebml tags as there id includes - * length bits. - * - */ - - - var findEbml = function findEbml(bytes, paths) { - paths = normalizePaths$1(paths); - bytes = toUint8(bytes); - var results = []; - - if (!paths.length) { - return results; - } - - var i = 0; - - while (i < bytes.length) { - var id = getvint(bytes, i, false); - var dataHeader = getvint(bytes, i + id.length); - var dataStart = i + id.length + dataHeader.length; // dataSize is unknown or this is a live stream - - if (dataHeader.value === 0x7f) { - dataHeader.value = getInfinityDataSize(id, bytes, dataStart); - - if (dataHeader.value !== bytes.length) { - dataHeader.value -= dataStart; - } - } - - var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value; - var data = bytes.subarray(dataStart, dataEnd); - - if (bytesMatch(paths[0], id.bytes)) { - if (paths.length === 1) { - // this is the end of the paths and we've found the tag we were - // looking for - results.push(data); - } else { - // recursively search for the next tag inside of the data - // of this one - results = results.concat(findEbml(data, paths.slice(1))); - } - } - - var totalLength = id.length + dataHeader.length + data.length; // move past this tag entirely, we are not looking for it - - i += totalLength; - } - - return results; - }; // see https://www.matroska.org/technical/basics.html#block-structure - - var ID3 = toUint8([0x49, 0x44, 0x33]); - var getId3Size = function getId3Size(bytes, offset) { - if (offset === void 0) { - offset = 0; - } - - bytes = toUint8(bytes); - var flags = bytes[offset + 5]; - var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9]; - var footerPresent = (flags & 16) >> 4; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - var getId3Offset = function getId3Offset(bytes, offset) { - if (offset === void 0) { - offset = 0; - } - - bytes = toUint8(bytes); - - if (bytes.length - offset < 10 || !bytesMatch(bytes, ID3, { - offset: offset - })) { - return offset; - } - - offset += getId3Size(bytes, offset); // recursive check for id3 tags as some files - // have multiple ID3 tag sections even though - // they should not. - - return getId3Offset(bytes, offset); - }; - - var NAL_TYPE_ONE = toUint8([0x00, 0x00, 0x00, 0x01]); - var NAL_TYPE_TWO = toUint8([0x00, 0x00, 0x01]); - var EMULATION_PREVENTION = toUint8([0x00, 0x00, 0x03]); - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(bytes) { - var positions = []; - var i = 1; // Find all `Emulation Prevention Bytes` - - while (i < bytes.length - 2) { - if (bytesMatch(bytes.subarray(i, i + 3), EMULATION_PREVENTION)) { - positions.push(i + 2); - i++; - } - - i++; - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (positions.length === 0) { - return bytes; - } // Create a new array to hold the NAL unit data - - - var newLength = bytes.length - positions.length; - var newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === positions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - positions.shift(); - } - - newData[i] = bytes[sourceIndex]; - } - - return newData; - }; - var findNal = function findNal(bytes, dataType, types, nalLimit) { - if (nalLimit === void 0) { - nalLimit = Infinity; - } - - bytes = toUint8(bytes); - types = [].concat(types); - var i = 0; - var nalStart; - var nalsFound = 0; // keep searching until: - // we reach the end of bytes - // we reach the maximum number of nals they want to seach - // NOTE: that we disregard nalLimit when we have found the start - // of the nal we want so that we can find the end of the nal we want. - - while (i < bytes.length && (nalsFound < nalLimit || nalStart)) { - var nalOffset = void 0; - - if (bytesMatch(bytes.subarray(i), NAL_TYPE_ONE)) { - nalOffset = 4; - } else if (bytesMatch(bytes.subarray(i), NAL_TYPE_TWO)) { - nalOffset = 3; - } // we are unsynced, - // find the next nal unit - - - if (!nalOffset) { - i++; - continue; - } - - nalsFound++; - - if (nalStart) { - return discardEmulationPreventionBytes(bytes.subarray(nalStart, i)); - } - - var nalType = void 0; - - if (dataType === 'h264') { - nalType = bytes[i + nalOffset] & 0x1f; - } else if (dataType === 'h265') { - nalType = bytes[i + nalOffset] >> 1 & 0x3f; - } - - if (types.indexOf(nalType) !== -1) { - nalStart = i + nalOffset; - } // nal header is 1 length for h264, and 2 for h265 - - - i += nalOffset + (dataType === 'h264' ? 1 : 2); - } - - return bytes.subarray(0, 0); - }; - var findH264Nal = function findH264Nal(bytes, type, nalLimit) { - return findNal(bytes, 'h264', type, nalLimit); - }; - var findH265Nal = function findH265Nal(bytes, type, nalLimit) { - return findNal(bytes, 'h265', type, nalLimit); - }; - - var CONSTANTS = { - // "webm" string literal in hex - 'webm': toUint8([0x77, 0x65, 0x62, 0x6d]), - // "matroska" string literal in hex - 'matroska': toUint8([0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61]), - // "fLaC" string literal in hex - 'flac': toUint8([0x66, 0x4c, 0x61, 0x43]), - // "OggS" string literal in hex - 'ogg': toUint8([0x4f, 0x67, 0x67, 0x53]), - // ac-3 sync byte, also works for ec-3 as that is simply a codec - // of ac-3 - 'ac3': toUint8([0x0b, 0x77]), - // "RIFF" string literal in hex used for wav and avi - 'riff': toUint8([0x52, 0x49, 0x46, 0x46]), - // "AVI" string literal in hex - 'avi': toUint8([0x41, 0x56, 0x49]), - // "WAVE" string literal in hex - 'wav': toUint8([0x57, 0x41, 0x56, 0x45]), - // "ftyp3g" string literal in hex - '3gp': toUint8([0x66, 0x74, 0x79, 0x70, 0x33, 0x67]), - // "ftyp" string literal in hex - 'mp4': toUint8([0x66, 0x74, 0x79, 0x70]), - // "styp" string literal in hex - 'fmp4': toUint8([0x73, 0x74, 0x79, 0x70]), - // "ftyp" string literal in hex - 'mov': toUint8([0x66, 0x74, 0x79, 0x70, 0x71, 0x74]) - }; - var _isLikely = { - aac: function aac(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, [0xFF, 0x10], { - offset: offset, - mask: [0xFF, 0x16] - }); - }, - mp3: function mp3(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, [0xFF, 0x02], { - offset: offset, - mask: [0xFF, 0x06] - }); - }, - webm: function webm(bytes) { - var docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is webm - - return bytesMatch(docType, CONSTANTS.webm); - }, - mkv: function mkv(bytes) { - var docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is matroska - - return bytesMatch(docType, CONSTANTS.matroska); - }, - mp4: function mp4(bytes) { - return !_isLikely['3gp'](bytes) && !_isLikely.mov(bytes) && (bytesMatch(bytes, CONSTANTS.mp4, { - offset: 4 - }) || bytesMatch(bytes, CONSTANTS.fmp4, { - offset: 4 - })); - }, - mov: function mov(bytes) { - return bytesMatch(bytes, CONSTANTS.mov, { - offset: 4 - }); - }, - '3gp': function gp(bytes) { - return bytesMatch(bytes, CONSTANTS['3gp'], { - offset: 4 - }); - }, - ac3: function ac3(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, CONSTANTS.ac3, { - offset: offset - }); - }, - ts: function ts(bytes) { - if (bytes.length < 189 && bytes.length >= 1) { - return bytes[0] === 0x47; - } - - var i = 0; // check the first 376 bytes for two matching sync bytes - - while (i + 188 < bytes.length && i < 188) { - if (bytes[i] === 0x47 && bytes[i + 188] === 0x47) { - return true; - } - - i += 1; - } - - return false; - }, - flac: function flac(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, CONSTANTS.flac, { - offset: offset - }); - }, - ogg: function ogg(bytes) { - return bytesMatch(bytes, CONSTANTS.ogg); - }, - avi: function avi(bytes) { - return bytesMatch(bytes, CONSTANTS.riff) && bytesMatch(bytes, CONSTANTS.avi, { - offset: 8 - }); - }, - wav: function wav(bytes) { - return bytesMatch(bytes, CONSTANTS.riff) && bytesMatch(bytes, CONSTANTS.wav, { - offset: 8 - }); - }, - 'h264': function h264(bytes) { - // find seq_parameter_set_rbsp - return findH264Nal(bytes, 7, 3).length; - }, - 'h265': function h265(bytes) { - // find video_parameter_set_rbsp or seq_parameter_set_rbsp - return findH265Nal(bytes, [32, 33], 3).length; - } - }; // get all the isLikely functions - // but make sure 'ts' is above h264 and h265 - // but below everything else as it is the least specific - - var isLikelyTypes = Object.keys(_isLikely) // remove ts, h264, h265 - .filter(function (t) { - return t !== 'ts' && t !== 'h264' && t !== 'h265'; - }) // add it back to the bottom - .concat(['ts', 'h264', 'h265']); // make sure we are dealing with uint8 data. - - isLikelyTypes.forEach(function (type) { - var isLikelyFn = _isLikely[type]; - - _isLikely[type] = function (bytes) { - return isLikelyFn(toUint8(bytes)); - }; - }); // export after wrapping - - var isLikely = _isLikely; // A useful list of file signatures can be found here - // https://en.wikipedia.org/wiki/List_of_file_signatures - - var detectContainerForBytes = function detectContainerForBytes(bytes) { - bytes = toUint8(bytes); - - for (var i = 0; i < isLikelyTypes.length; i++) { - var type = isLikelyTypes[i]; - - if (isLikely[type](bytes)) { - return type; - } - } - - return ''; - }; // fmp4 is not a container - - var isLikelyFmp4MediaSegment = function isLikelyFmp4MediaSegment(bytes) { - return findBox(bytes, ['moof']).length > 0; - }; - - var containers = /*#__PURE__*/Object.freeze({ - __proto__: null, - isLikely: isLikely, - detectContainerForBytes: detectContainerForBytes, - isLikelyFmp4MediaSegment: isLikelyFmp4MediaSegment - }); - - var atob = function atob(s) { - return window__default['default'].atob ? window__default['default'].atob(s) : Buffer.from(s, 'base64').toString('binary'); - }; - - function decodeB64ToUint8Array(b64Text) { - var decodedString = atob(b64Text); - var array = new Uint8Array(decodedString.length); - - for (var i = 0; i < decodedString.length; i++) { - array[i] = decodedString.charCodeAt(i); - } - - return array; - } - - /** - * Loops through all supported media groups in master and calls the provided - * callback for each group - * - * @param {Object} master - * The parsed master manifest object - * @param {string[]} groups - * The media groups to call the callback for - * @param {Function} callback - * Callback to call for each media group - */ - var forEachMediaGroup = function forEachMediaGroup(master, groups, callback) { - groups.forEach(function (mediaType) { - for (var groupKey in master.mediaGroups[mediaType]) { - for (var labelKey in master.mediaGroups[mediaType][groupKey]) { - var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey]; - callback(mediaProperties, mediaType, groupKey, labelKey); - } - } - }); - }; - - var mediaGroups = /*#__PURE__*/Object.freeze({ - __proto__: null, - forEachMediaGroup: forEachMediaGroup - }); - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function (path, base) { - return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var urlToolkit = createCommonjsModule(function (module, exports) { - // see https://tools.ietf.org/html/rfc1808 - (function (root) { - var URL_REGEX = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/; - var FIRST_SEGMENT_REGEX = /^([^\/?#]*)(.*)$/; - var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g; - var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g; - var URLToolkit = { - // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or // - // E.g - // With opts.alwaysNormalize = false (default, spec compliant) - // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g - // With opts.alwaysNormalize = true (not spec compliant) - // http://a.com/b/cd + /e/f/../g => http://a.com/e/g - buildAbsoluteURL: function buildAbsoluteURL(baseURL, relativeURL, opts) { - opts = opts || {}; // remove any remaining space and CRLF - - baseURL = baseURL.trim(); - relativeURL = relativeURL.trim(); - - if (!relativeURL) { - // 2a) If the embedded URL is entirely empty, it inherits the - // entire base URL (i.e., is set equal to the base URL) - // and we are done. - if (!opts.alwaysNormalize) { - return baseURL; - } - - var basePartsForNormalise = URLToolkit.parseURL(baseURL); - - if (!basePartsForNormalise) { - throw new Error('Error trying to parse base URL.'); - } - - basePartsForNormalise.path = URLToolkit.normalizePath(basePartsForNormalise.path); - return URLToolkit.buildURLFromParts(basePartsForNormalise); - } - - var relativeParts = URLToolkit.parseURL(relativeURL); - - if (!relativeParts) { - throw new Error('Error trying to parse relative URL.'); - } - - if (relativeParts.scheme) { - // 2b) If the embedded URL starts with a scheme name, it is - // interpreted as an absolute URL and we are done. - if (!opts.alwaysNormalize) { - return relativeURL; - } - - relativeParts.path = URLToolkit.normalizePath(relativeParts.path); - return URLToolkit.buildURLFromParts(relativeParts); - } - - var baseParts = URLToolkit.parseURL(baseURL); - - if (!baseParts) { - throw new Error('Error trying to parse base URL.'); - } - - if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') { - // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc - // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a' - var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path); - baseParts.netLoc = pathParts[1]; - baseParts.path = pathParts[2]; - } - - if (baseParts.netLoc && !baseParts.path) { - baseParts.path = '/'; - } - - var builtParts = { - // 2c) Otherwise, the embedded URL inherits the scheme of - // the base URL. - scheme: baseParts.scheme, - netLoc: relativeParts.netLoc, - path: null, - params: relativeParts.params, - query: relativeParts.query, - fragment: relativeParts.fragment - }; - - if (!relativeParts.netLoc) { - // 3) If the embedded URL's is non-empty, we skip to - // Step 7. Otherwise, the embedded URL inherits the - // (if any) of the base URL. - builtParts.netLoc = baseParts.netLoc; // 4) If the embedded URL path is preceded by a slash "/", the - // path is not relative and we skip to Step 7. - - if (relativeParts.path[0] !== '/') { - if (!relativeParts.path) { - // 5) If the embedded URL path is empty (and not preceded by a - // slash), then the embedded URL inherits the base URL path - builtParts.path = baseParts.path; // 5a) if the embedded URL's is non-empty, we skip to - // step 7; otherwise, it inherits the of the base - // URL (if any) and - - if (!relativeParts.params) { - builtParts.params = baseParts.params; // 5b) if the embedded URL's is non-empty, we skip to - // step 7; otherwise, it inherits the of the base - // URL (if any) and we skip to step 7. - - if (!relativeParts.query) { - builtParts.query = baseParts.query; - } - } - } else { - // 6) The last segment of the base URL's path (anything - // following the rightmost slash "/", or the entire path if no - // slash is present) is removed and the embedded URL's path is - // appended in its place. - var baseURLPath = baseParts.path; - var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + relativeParts.path; - builtParts.path = URLToolkit.normalizePath(newPath); - } - } - } - - if (builtParts.path === null) { - builtParts.path = opts.alwaysNormalize ? URLToolkit.normalizePath(relativeParts.path) : relativeParts.path; - } - - return URLToolkit.buildURLFromParts(builtParts); - }, - parseURL: function parseURL(url) { - var parts = URL_REGEX.exec(url); - - if (!parts) { - return null; - } - - return { - scheme: parts[1] || '', - netLoc: parts[2] || '', - path: parts[3] || '', - params: parts[4] || '', - query: parts[5] || '', - fragment: parts[6] || '' - }; - }, - normalizePath: function normalizePath(path) { - // The following operations are - // then applied, in order, to the new path: - // 6a) All occurrences of "./", where "." is a complete path - // segment, are removed. - // 6b) If the path ends with "." as a complete path segment, - // that "." is removed. - path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, ''); // 6c) All occurrences of "/../", where is a - // complete path segment not equal to "..", are removed. - // Removal of these path segments is performed iteratively, - // removing the leftmost matching pattern on each iteration, - // until no matching pattern remains. - // 6d) If the path ends with "/..", where is a - // complete path segment not equal to "..", that - // "/.." is removed. - - while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length) {} - - return path.split('').reverse().join(''); - }, - buildURLFromParts: function buildURLFromParts(parts) { - return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment; - } - }; - module.exports = URLToolkit; - })(); - }); - - var DEFAULT_LOCATION = 'http://example.com'; - - var resolveUrl = function resolveUrl(baseUrl, relativeUrl) { - // return early if we don't need to resolve - if (/^[a-z]+:/i.test(relativeUrl)) { - return relativeUrl; - } // if baseUrl is a data URI, ignore it and resolve everything relative to window.location - - - if (/^data:/.test(baseUrl)) { - baseUrl = window__default['default'].location && window__default['default'].location.href || ''; - } // IE11 supports URL but not the URL constructor - // feature detect the behavior we want - - - var nativeURL = typeof window__default['default'].URL === 'function'; - var protocolLess = /^\/\//.test(baseUrl); // remove location if window.location isn't available (i.e. we're in node) - // and if baseUrl isn't an absolute url - - var removeLocation = !window__default['default'].location && !/\/\//i.test(baseUrl); // if the base URL is relative then combine with the current location - - if (nativeURL) { - baseUrl = new window__default['default'].URL(baseUrl, window__default['default'].location || DEFAULT_LOCATION); - } else if (!/\/\//i.test(baseUrl)) { - baseUrl = urlToolkit.buildAbsoluteURL(window__default['default'].location && window__default['default'].location.href || '', baseUrl); - } - - if (nativeURL) { - var newUrl = new URL(relativeUrl, baseUrl); // if we're a protocol-less url, remove the protocol - // and if we're location-less, remove the location - // otherwise, return the url unmodified - - if (removeLocation) { - return newUrl.href.slice(DEFAULT_LOCATION.length); - } else if (protocolLess) { - return newUrl.href.slice(newUrl.protocol.length); - } - - return newUrl.href; - } - - return urlToolkit.buildAbsoluteURL(baseUrl, relativeUrl); - }; - - /** - * @file stream.js - */ - - /** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ - var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; - }(); - - var index = { - codecs: codecs, - byteHelpers: byteHelpers, - containers: containers, - decodeB64ToUint8Array: decodeB64ToUint8Array, - mediaGroups: mediaGroups, - resolveUrl: resolveUrl, - Stream: Stream - }; - - return index; - -}))); diff --git a/node_modules/@videojs/vhs-utils/dist/vhs-utils.min.js b/node_modules/@videojs/vhs-utils/dist/vhs-utils.min.js deleted file mode 100644 index a0d9ca9..0000000 --- a/node_modules/@videojs/vhs-utils/dist/vhs-utils.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name @videojs/vhs-utils @version 3.0.2 @license MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("global/window")):"function"==typeof define&&define.amd?define(["global/window"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).vhsUtils=e(t.window)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r,n,o=e(t),a={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},i=["video","audio","text"],u=["Video","Audio","Text"],f=function(t){return t?t.replace(/avc1\.(\d+)\.(\d+)/i,(function(t,e,r){return"avc1."+("00"+Number(e).toString(16)).slice(-2)+"00"+("00"+Number(r).toString(16)).slice(-2)})):t},c=function(t){return t.map(f)},s=function(t){void 0===t&&(t="");var e=t.split(","),r=[];return e.forEach((function(t){var e;t=t.trim(),i.forEach((function(n){var o=a[n].exec(t.toLowerCase());if(o&&!(o.length<=1)){e=n;var i=t.substring(0,o[1].length),u=t.replace(i,"");r.push({type:i,details:u,mediaType:n})}})),e||r.push({type:t,details:"",mediaType:"unknown"})})),r},l=function(t){return void 0===t&&(t=""),a.audio.test(t.trim().toLowerCase())},p=function(t){return void 0===t&&(t=""),a.text.test(t.trim().toLowerCase())},h=function(t){if(t&&"string"==typeof t){var e=t.toLowerCase().split(",").map((function(t){return f(t.trim())})),r="video";1===e.length&&l(e[0])?r="audio":1===e.length&&p(e[0])&&(r="application");var n="mp4";return e.every((function(t){return a.mp4.test(t)}))?n="mp4":e.every((function(t){return a.webm.test(t)}))?n="webm":e.every((function(t){return a.ogg.test(t)}))&&(n="ogg"),r+"/"+n+';codecs="'+t+'"'}},v=Object.freeze({__proto__:null,translateLegacyCodec:f,translateLegacyCodecs:c,mapLegacyAvcCodecs:function(t){return t.replace(/avc1\.(\d+)\.(\d+)/i,(function(t){return c([t])[0]}))},parseCodecs:s,codecsFromDefault:function(t,e){if(!t.mediaGroups.AUDIO||!e)return null;var r=t.mediaGroups.AUDIO[e];if(!r)return null;for(var n in r){var o=r[n];if(o.default&&o.playlists)return s(o.playlists[0].attributes.CODECS)}return null},isVideoCodec:function(t){return void 0===t&&(t=""),a.video.test(t.trim().toLowerCase())},isAudioCodec:l,isTextCodec:p,getMimeForCodec:h,browserSupportsCodec:function(t){return void 0===t&&(t=""),o.default.MediaSource&&o.default.MediaSource.isTypeSupported&&o.default.MediaSource.isTypeSupported(h(t))||!1},muxerSupportsCodec:function(t){return void 0===t&&(t=""),t.toLowerCase().split(",").every((function(t){t=t.trim();for(var e=0;ec&&(f-=c,f-=c,f-=A(2))}return Number(f)},C=function(t,e){var r=(void 0===e?{}:e).le,n=void 0!==r&&r;("bigint"!=typeof t&&"number"!=typeof t||"number"==typeof t&&t!=t)&&(t=0),t=A(t);for(var o=g(t),a=new Uint8Array(new ArrayBuffer(o)),i=0;i=e.length&&f.call(e,(function(e,r){return e===(u[r]?u[r]&t[a+r]:t[a+r])}))},k=Object.freeze({__proto__:null,countBits:y,countBytes:g,padStart:d,isTypedArray:m,toUint8:b,toHexString:function(t){t=b(t);for(var e="",r=0;r>>0,u=e.subarray(a+4,a+8);if(0===i)break;var f=a+i;if(f>e.length){if(n)break;f=e.length}var c=e.subarray(a+8,f);E(u,r[0])&&(1===r.length?o.push(c):o.push.apply(o,t(c,r.slice(1),n))),a=f}return o},D={EBML:b([26,69,223,163]),DocType:b([66,130]),Segment:b([24,83,128,103]),SegmentInfo:b([21,73,169,102]),Tracks:b([22,84,174,107]),Track:b([174]),TrackNumber:b([215]),DefaultDuration:b([35,227,131]),TrackEntry:b([174]),TrackType:b([131]),FlagDefault:b([136]),CodecID:b([134]),CodecPrivate:b([99,162]),VideoTrack:b([224]),AudioTrack:b([225]),Cluster:b([31,67,182,117]),Timestamp:b([231]),TimestampScale:b([42,215,177]),BlockGroup:b([160]),BlockDuration:b([155]),Block:b([161]),SimpleBlock:b([163])},R=[128,64,32,16,8,4,2,1],I=function(t,e,r,n){void 0===r&&(r=!0),void 0===n&&(n=!1);var o=function(t){for(var e=1,r=0;r=r.length)return r.length;var o=I(r,n,!1);if(E(e.bytes,o.bytes))return n;var a=I(r,n+o.length);return t(e,r,n+a.length+a.value+o.length)},z=function t(e,r){r=function(t){return Array.isArray(t)?t.map((function(t){return N(t)})):[N(t)]}(r),e=b(e);var n=[];if(!r.length)return n;for(var o=0;oe.length?e.length:u+i.value,c=e.subarray(u,f);E(r[0],a.bytes)&&(1===r.length?n.push(c):n=n.concat(t(c,r.slice(1)))),o+=a.length+i.length+c.length}return n},M=b([73,68,51]),F=function t(e,r){return void 0===r&&(r=0),(e=b(e)).length-r<10||!E(e,M,{offset:r})?r:(r+=function(t,e){void 0===e&&(e=0);var r=(t=b(t))[e+5],n=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return(16&r)>>4?n+20:n+10}(e,r),t(e,r))},j=b([0,0,0,1]),q=b([0,0,1]),P=b([0,0,3]),G=function(t){for(var e=[],r=1;r>1&63),-1!==r.indexOf(f)&&(o=a+u),a+=u+("h264"===e?1:2)}else a++}return t.subarray(0,0)},H={webm:b([119,101,98,109]),matroska:b([109,97,116,114,111,115,107,97]),flac:b([102,76,97,67]),ogg:b([79,103,103,83]),ac3:b([11,119]),riff:b([82,73,70,70]),avi:b([65,86,73]),wav:b([87,65,86,69]),"3gp":b([102,116,121,112,51,103]),mp4:b([102,116,121,112]),fmp4:b([115,116,121,112]),mov:b([102,116,121,112,113,116])},$={aac:function(t){var e=F(t);return E(t,[255,16],{offset:e,mask:[255,22]})},mp3:function(t){var e=F(t);return E(t,[255,2],{offset:e,mask:[255,6]})},webm:function(t){var e=z(t,[D.EBML,D.DocType])[0];return E(e,H.webm)},mkv:function(t){var e=z(t,[D.EBML,D.DocType])[0];return E(e,H.matroska)},mp4:function(t){return!$["3gp"](t)&&!$.mov(t)&&(E(t,H.mp4,{offset:4})||E(t,H.fmp4,{offset:4}))},mov:function(t){return E(t,H.mov,{offset:4})},"3gp":function(t){return E(t,H["3gp"],{offset:4})},ac3:function(t){var e=F(t);return E(t,H.ac3,{offset:e})},ts:function(t){if(t.length<189&&t.length>=1)return 71===t[0];for(var e=0;e+1880}});var Q=Object.freeze({__proto__:null,forEachMediaGroup:function(t,e,r){e.forEach((function(e){for(var n in t.mediaGroups[e])for(var o in t.mediaGroups[e][n]){var a=t.mediaGroups[e][n][o];r(a,e,n,o)}}))}});var W=function(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}((function(t,e){var r,n,o,a,i;r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,n=/^([^\/?#]*)(.*)$/,o=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,i={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var o=i.parseURL(t);if(!o)throw new Error("Error trying to parse base URL.");return o.path=i.normalizePath(o.path),i.buildURLFromParts(o)}var a=i.parseURL(e);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=i.normalizePath(a.path),i.buildURLFromParts(a)):e;var u=i.parseURL(t);if(!u)throw new Error("Error trying to parse base URL.");if(!u.netLoc&&u.path&&"/"!==u.path[0]){var f=n.exec(u.path);u.netLoc=f[1],u.path=f[2]}u.netLoc&&!u.path&&(u.path="/");var c={scheme:u.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(c.netLoc=u.netLoc,"/"!==a.path[0]))if(a.path){var s=u.path,l=s.substring(0,s.lastIndexOf("/")+1)+a.path;c.path=i.normalizePath(l)}else c.path=u.path,a.params||(c.params=u.params,a.query||(c.query=u.query));return null===c.path&&(c.path=r.alwaysNormalize?i.normalizePath(a.path):a.path),i.buildURLFromParts(c)},parseURL:function(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(o,"");t.length!==(t=t.replace(a,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=i})),X="http://example.com";return{codecs:v,byteHelpers:k,containers:K,decodeB64ToUint8Array:function(t){for(var e,r=(e=t,o.default.atob?o.default.atob(e):Buffer.from(e,"base64").toString("binary")),n=new Uint8Array(r.length),a=0;a-1},e.trigger=function(t){var e=this.listeners[t];if(e)if(2===arguments.length)for(var r=e.length,n=0;n (Math.log(x) / Math.log(2)); - -var repeat = function repeat(str, len) { - var acc = ''; - - while (len--) { - acc += str; - } - - return acc; -}; // count the number of bits it would take to represent a number -// we used to do this with log2 but BigInt does not support builtin math -// Math.ceil(log2(x)); - - -export var countBits = function countBits(x) { - return x.toString(2).length; -}; // count the number of whole bytes it would take to represent a number - -export var countBytes = function countBytes(x) { - return Math.ceil(countBits(x) / 8); -}; -export var padStart = function padStart(b, len, str) { - if (str === void 0) { - str = ' '; - } - - return (repeat(str, len) + b.toString()).slice(-len); -}; -export var isTypedArray = function isTypedArray(obj) { - return ArrayBuffer.isView(obj); -}; -export var toUint8 = function toUint8(bytes) { - if (bytes instanceof Uint8Array) { - return bytes; - } - - if (!Array.isArray(bytes) && !isTypedArray(bytes) && !(bytes instanceof ArrayBuffer)) { - // any non-number or NaN leads to empty uint8array - // eslint-disable-next-line - if (typeof bytes !== 'number' || typeof bytes === 'number' && bytes !== bytes) { - bytes = 0; - } else { - bytes = [bytes]; - } - } - - return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0); -}; -export var toHexString = function toHexString(bytes) { - bytes = toUint8(bytes); - var str = ''; - - for (var i = 0; i < bytes.length; i++) { - str += padStart(bytes[i].toString(16), 2, '0'); - } - - return str; -}; -export var toBinaryString = function toBinaryString(bytes) { - bytes = toUint8(bytes); - var str = ''; - - for (var i = 0; i < bytes.length; i++) { - str += padStart(bytes[i].toString(2), 8, '0'); - } - - return str; -}; -var BigInt = window.BigInt || Number; -var BYTE_TABLE = [BigInt('0x1'), BigInt('0x100'), BigInt('0x10000'), BigInt('0x1000000'), BigInt('0x100000000'), BigInt('0x10000000000'), BigInt('0x1000000000000'), BigInt('0x100000000000000'), BigInt('0x10000000000000000')]; -export var ENDIANNESS = function () { - var a = new Uint16Array([0xFFCC]); - var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength); - - if (b[0] === 0xFF) { - return 'big'; - } - - if (b[0] === 0xCC) { - return 'little'; - } - - return 'unknown'; -}(); -export var IS_BIG_ENDIAN = ENDIANNESS === 'big'; -export var IS_LITTLE_ENDIAN = ENDIANNESS === 'little'; -export var bytesToNumber = function bytesToNumber(bytes, _temp) { - var _ref = _temp === void 0 ? {} : _temp, - _ref$signed = _ref.signed, - signed = _ref$signed === void 0 ? false : _ref$signed, - _ref$le = _ref.le, - le = _ref$le === void 0 ? false : _ref$le; - - bytes = toUint8(bytes); - var fn = le ? 'reduce' : 'reduceRight'; - var obj = bytes[fn] ? bytes[fn] : Array.prototype[fn]; - var number = obj.call(bytes, function (total, byte, i) { - var exponent = le ? i : Math.abs(i + 1 - bytes.length); - return total + BigInt(byte) * BYTE_TABLE[exponent]; - }, BigInt(0)); - - if (signed) { - var max = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1); - number = BigInt(number); - - if (number > max) { - number -= max; - number -= max; - number -= BigInt(2); - } - } - - return Number(number); -}; -export var numberToBytes = function numberToBytes(number, _temp2) { - var _ref2 = _temp2 === void 0 ? {} : _temp2, - _ref2$le = _ref2.le, - le = _ref2$le === void 0 ? false : _ref2$le; - - // eslint-disable-next-line - if (typeof number !== 'bigint' && typeof number !== 'number' || typeof number === 'number' && number !== number) { - number = 0; - } - - number = BigInt(number); - var byteCount = countBytes(number); - var bytes = new Uint8Array(new ArrayBuffer(byteCount)); - - for (var i = 0; i < byteCount; i++) { - var byteIndex = le ? i : Math.abs(i + 1 - bytes.length); - bytes[byteIndex] = Number(number / BYTE_TABLE[i] & BigInt(0xFF)); - - if (number < 0) { - bytes[byteIndex] = Math.abs(~bytes[byteIndex]); - bytes[byteIndex] -= i === 0 ? 1 : 2; - } - } - - return bytes; -}; -export var bytesToString = function bytesToString(bytes) { - if (!bytes) { - return ''; - } // TODO: should toUint8 handle cases where we only have 8 bytes - // but report more since this is a Uint16+ Array? - - - bytes = Array.prototype.slice.call(bytes); - var string = String.fromCharCode.apply(null, toUint8(bytes)); - - try { - return decodeURIComponent(escape(string)); - } catch (e) {// if decodeURIComponent/escape fails, we are dealing with partial - // or full non string data. Just return the potentially garbled string. - } - - return string; -}; -export var stringToBytes = function stringToBytes(string, stringIsBytes) { - if (typeof string !== 'string' && string && typeof string.toString === 'function') { - string = string.toString(); - } - - if (typeof string !== 'string') { - return new Uint8Array(); - } // If the string already is bytes, we don't have to do this - // otherwise we do this so that we split multi length characters - // into individual bytes - - - if (!stringIsBytes) { - string = unescape(encodeURIComponent(string)); - } - - var view = new Uint8Array(string.length); - - for (var i = 0; i < string.length; i++) { - view[i] = string.charCodeAt(i); - } - - return view; -}; -export var concatTypedArrays = function concatTypedArrays() { - for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) { - buffers[_key] = arguments[_key]; - } - - buffers = buffers.filter(function (b) { - return b && (b.byteLength || b.length) && typeof b !== 'string'; - }); - - if (buffers.length <= 1) { - // for 0 length we will return empty uint8 - // for 1 length we return the first uint8 - return toUint8(buffers[0]); - } - - var totalLen = buffers.reduce(function (total, buf, i) { - return total + (buf.byteLength || buf.length); - }, 0); - var tempBuffer = new Uint8Array(totalLen); - var offset = 0; - buffers.forEach(function (buf) { - buf = toUint8(buf); - tempBuffer.set(buf, offset); - offset += buf.byteLength; - }); - return tempBuffer; -}; -/** - * Check if the bytes "b" are contained within bytes "a". - * - * @param {Uint8Array|Array} a - * Bytes to check in - * - * @param {Uint8Array|Array} b - * Bytes to check for - * - * @param {Object} options - * options - * - * @param {Array|Uint8Array} [offset=0] - * offset to use when looking at bytes in a - * - * @param {Array|Uint8Array} [mask=[]] - * mask to use on bytes before comparison. - * - * @return {boolean} - * If all bytes in b are inside of a, taking into account - * bit masks. - */ - -export var bytesMatch = function bytesMatch(a, b, _temp3) { - var _ref3 = _temp3 === void 0 ? {} : _temp3, - _ref3$offset = _ref3.offset, - offset = _ref3$offset === void 0 ? 0 : _ref3$offset, - _ref3$mask = _ref3.mask, - mask = _ref3$mask === void 0 ? [] : _ref3$mask; - - a = toUint8(a); - b = toUint8(b); // ie 11 does not support uint8 every - - var fn = b.every ? b.every : Array.prototype.every; - return b.length && a.length - offset >= b.length && // ie 11 doesn't support every on uin8 - fn.call(b, function (bByte, i) { - var aByte = mask[i] ? mask[i] & a[offset + i] : a[offset + i]; - return bByte === aByte; - }); -}; -export var sliceBytes = function sliceBytes(src, start, end) { - if (Uint8Array.prototype.slice) { - return Uint8Array.prototype.slice.call(src, start, end); - } - - return new Uint8Array(Array.prototype.slice.call(src, start, end)); -}; -export var reverseBytes = function reverseBytes(src) { - if (src.reverse) { - return src.reverse(); - } - - return Array.prototype.reverse.call(src); -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/codec-helpers.js b/node_modules/@videojs/vhs-utils/es/codec-helpers.js deleted file mode 100644 index ece8f3b..0000000 --- a/node_modules/@videojs/vhs-utils/es/codec-helpers.js +++ /dev/null @@ -1,96 +0,0 @@ -import { padStart, toHexString, toBinaryString } from './byte-helpers.js'; // https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax -// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/codecs_parameter#AV1 - -export var getAv1Codec = function getAv1Codec(bytes) { - var codec = ''; - var profile = bytes[1] >>> 3; - var level = bytes[1] & 0x1F; - var tier = bytes[2] >>> 7; - var highBitDepth = (bytes[2] & 0x40) >> 6; - var twelveBit = (bytes[2] & 0x20) >> 5; - var monochrome = (bytes[2] & 0x10) >> 4; - var chromaSubsamplingX = (bytes[2] & 0x08) >> 3; - var chromaSubsamplingY = (bytes[2] & 0x04) >> 2; - var chromaSamplePosition = bytes[2] & 0x03; - codec += profile + "." + padStart(level, 2, '0'); - - if (tier === 0) { - codec += 'M'; - } else if (tier === 1) { - codec += 'H'; - } - - var bitDepth; - - if (profile === 2 && highBitDepth) { - bitDepth = twelveBit ? 12 : 10; - } else { - bitDepth = highBitDepth ? 10 : 8; - } - - codec += "." + padStart(bitDepth, 2, '0'); // TODO: can we parse color range?? - - codec += "." + monochrome; - codec += "." + chromaSubsamplingX + chromaSubsamplingY + chromaSamplePosition; - return codec; -}; -export var getAvcCodec = function getAvcCodec(bytes) { - var profileId = toHexString(bytes[1]); - var constraintFlags = toHexString(bytes[2] & 0xFC); - var levelId = toHexString(bytes[3]); - return "" + profileId + constraintFlags + levelId; -}; -export var getHvcCodec = function getHvcCodec(bytes) { - var codec = ''; - var profileSpace = bytes[1] >> 6; - var profileId = bytes[1] & 0x1F; - var tierFlag = (bytes[1] & 0x20) >> 5; - var profileCompat = bytes.subarray(2, 6); - var constraintIds = bytes.subarray(6, 12); - var levelId = bytes[12]; - - if (profileSpace === 1) { - codec += 'A'; - } else if (profileSpace === 2) { - codec += 'B'; - } else if (profileSpace === 3) { - codec += 'C'; - } - - codec += profileId + "."; // ffmpeg does this in big endian - - var profileCompatVal = parseInt(toBinaryString(profileCompat).split('').reverse().join(''), 2); // apple does this in little endian... - - if (profileCompatVal > 255) { - profileCompatVal = parseInt(toBinaryString(profileCompat), 2); - } - - codec += profileCompatVal.toString(16) + "."; - - if (tierFlag === 0) { - codec += 'L'; - } else { - codec += 'H'; - } - - codec += levelId; - var constraints = ''; - - for (var i = 0; i < constraintIds.length; i++) { - var v = constraintIds[i]; - - if (v) { - if (constraints) { - constraints += '.'; - } - - constraints += v.toString(16); - } - } - - if (constraints) { - codec += "." + constraints; - } - - return codec; -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/codecs.js b/node_modules/@videojs/vhs-utils/es/codecs.js deleted file mode 100644 index 816a7ce..0000000 --- a/node_modules/@videojs/vhs-utils/es/codecs.js +++ /dev/null @@ -1,253 +0,0 @@ -import window from 'global/window'; -var regexs = { - // to determine mime types - mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/, - webm: /^(vp0?[89]|av0?1|opus|vorbis)/, - ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/, - // to determine if a codec is audio or video - video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/, - audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/, - text: /^(stpp.ttml.im1t)/, - // mux.js support regex - muxerVideo: /^(avc0?1)/, - muxerAudio: /^(mp4a)/, - // match nothing as muxer does not support text right now. - // there cannot never be a character before the start of a string - // so this matches nothing. - muxerText: /a^/ -}; -var mediaTypes = ['video', 'audio', 'text']; -var upperMediaTypes = ['Video', 'Audio', 'Text']; -/** - * Replace the old apple-style `avc1.
.
` codec string with the standard - * `avc1.` - * - * @param {string} codec - * Codec string to translate - * @return {string} - * The translated codec string - */ - -export var translateLegacyCodec = function translateLegacyCodec(codec) { - if (!codec) { - return codec; - } - - return codec.replace(/avc1\.(\d+)\.(\d+)/i, function (orig, profile, avcLevel) { - var profileHex = ('00' + Number(profile).toString(16)).slice(-2); - var avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2); - return 'avc1.' + profileHex + '00' + avcLevelHex; - }); -}; -/** - * Replace the old apple-style `avc1.
.
` codec strings with the standard - * `avc1.` - * - * @param {string[]} codecs - * An array of codec strings to translate - * @return {string[]} - * The translated array of codec strings - */ - -export var translateLegacyCodecs = function translateLegacyCodecs(codecs) { - return codecs.map(translateLegacyCodec); -}; -/** - * Replace codecs in the codec string with the old apple-style `avc1.
.
` to the - * standard `avc1.`. - * - * @param {string} codecString - * The codec string - * @return {string} - * The codec string with old apple-style codecs replaced - * - * @private - */ - -export var mapLegacyAvcCodecs = function mapLegacyAvcCodecs(codecString) { - return codecString.replace(/avc1\.(\d+)\.(\d+)/i, function (match) { - return translateLegacyCodecs([match])[0]; - }); -}; -/** - * @typedef {Object} ParsedCodecInfo - * @property {number} codecCount - * Number of codecs parsed - * @property {string} [videoCodec] - * Parsed video codec (if found) - * @property {string} [videoObjectTypeIndicator] - * Video object type indicator (if found) - * @property {string|null} audioProfile - * Audio profile - */ - -/** - * Parses a codec string to retrieve the number of codecs specified, the video codec and - * object type indicator, and the audio profile. - * - * @param {string} [codecString] - * The codec string to parse - * @return {ParsedCodecInfo} - * Parsed codec info - */ - -export var parseCodecs = function parseCodecs(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - var codecs = codecString.split(','); - var result = []; - codecs.forEach(function (codec) { - codec = codec.trim(); - var codecType; - mediaTypes.forEach(function (name) { - var match = regexs[name].exec(codec.toLowerCase()); - - if (!match || match.length <= 1) { - return; - } - - codecType = name; // maintain codec case - - var type = codec.substring(0, match[1].length); - var details = codec.replace(type, ''); - result.push({ - type: type, - details: details, - mediaType: name - }); - }); - - if (!codecType) { - result.push({ - type: codec, - details: '', - mediaType: 'unknown' - }); - } - }); - return result; -}; -/** - * Returns a ParsedCodecInfo object for the default alternate audio playlist if there is - * a default alternate audio playlist for the provided audio group. - * - * @param {Object} master - * The master playlist - * @param {string} audioGroupId - * ID of the audio group for which to find the default codec info - * @return {ParsedCodecInfo} - * Parsed codec info - */ - -export var codecsFromDefault = function codecsFromDefault(master, audioGroupId) { - if (!master.mediaGroups.AUDIO || !audioGroupId) { - return null; - } - - var audioGroup = master.mediaGroups.AUDIO[audioGroupId]; - - if (!audioGroup) { - return null; - } - - for (var name in audioGroup) { - var audioType = audioGroup[name]; - - if (audioType.default && audioType.playlists) { - // codec should be the same for all playlists within the audio type - return parseCodecs(audioType.playlists[0].attributes.CODECS); - } - } - - return null; -}; -export var isVideoCodec = function isVideoCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.video.test(codec.trim().toLowerCase()); -}; -export var isAudioCodec = function isAudioCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.audio.test(codec.trim().toLowerCase()); -}; -export var isTextCodec = function isTextCodec(codec) { - if (codec === void 0) { - codec = ''; - } - - return regexs.text.test(codec.trim().toLowerCase()); -}; -export var getMimeForCodec = function getMimeForCodec(codecString) { - if (!codecString || typeof codecString !== 'string') { - return; - } - - var codecs = codecString.toLowerCase().split(',').map(function (c) { - return translateLegacyCodec(c.trim()); - }); // default to video type - - var type = 'video'; // only change to audio type if the only codec we have is - // audio - - if (codecs.length === 1 && isAudioCodec(codecs[0])) { - type = 'audio'; - } else if (codecs.length === 1 && isTextCodec(codecs[0])) { - // text uses application/ for now - type = 'application'; - } // default the container to mp4 - - - var container = 'mp4'; // every codec must be able to go into the container - // for that container to be the correct one - - if (codecs.every(function (c) { - return regexs.mp4.test(c); - })) { - container = 'mp4'; - } else if (codecs.every(function (c) { - return regexs.webm.test(c); - })) { - container = 'webm'; - } else if (codecs.every(function (c) { - return regexs.ogg.test(c); - })) { - container = 'ogg'; - } - - return type + "/" + container + ";codecs=\"" + codecString + "\""; -}; -export var browserSupportsCodec = function browserSupportsCodec(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - return window.MediaSource && window.MediaSource.isTypeSupported && window.MediaSource.isTypeSupported(getMimeForCodec(codecString)) || false; -}; -export var muxerSupportsCodec = function muxerSupportsCodec(codecString) { - if (codecString === void 0) { - codecString = ''; - } - - return codecString.toLowerCase().split(',').every(function (codec) { - codec = codec.trim(); // any match is supported. - - for (var i = 0; i < upperMediaTypes.length; i++) { - var type = upperMediaTypes[i]; - - if (regexs["muxer" + type].test(codec)) { - return true; - } - } - - return false; - }); -}; -export var DEFAULT_AUDIO_CODEC = 'mp4a.40.2'; -export var DEFAULT_VIDEO_CODEC = 'avc1.4d400d'; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/containers.js b/node_modules/@videojs/vhs-utils/es/containers.js deleted file mode 100644 index 088606c..0000000 --- a/node_modules/@videojs/vhs-utils/es/containers.js +++ /dev/null @@ -1,162 +0,0 @@ -import { toUint8, bytesMatch } from './byte-helpers.js'; -import { findBox } from './mp4-helpers.js'; -import { findEbml, EBML_TAGS } from './ebml-helpers.js'; -import { getId3Offset } from './id3-helpers.js'; -import { findH264Nal, findH265Nal } from './nal-helpers.js'; -var CONSTANTS = { - // "webm" string literal in hex - 'webm': toUint8([0x77, 0x65, 0x62, 0x6d]), - // "matroska" string literal in hex - 'matroska': toUint8([0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61]), - // "fLaC" string literal in hex - 'flac': toUint8([0x66, 0x4c, 0x61, 0x43]), - // "OggS" string literal in hex - 'ogg': toUint8([0x4f, 0x67, 0x67, 0x53]), - // ac-3 sync byte, also works for ec-3 as that is simply a codec - // of ac-3 - 'ac3': toUint8([0x0b, 0x77]), - // "RIFF" string literal in hex used for wav and avi - 'riff': toUint8([0x52, 0x49, 0x46, 0x46]), - // "AVI" string literal in hex - 'avi': toUint8([0x41, 0x56, 0x49]), - // "WAVE" string literal in hex - 'wav': toUint8([0x57, 0x41, 0x56, 0x45]), - // "ftyp3g" string literal in hex - '3gp': toUint8([0x66, 0x74, 0x79, 0x70, 0x33, 0x67]), - // "ftyp" string literal in hex - 'mp4': toUint8([0x66, 0x74, 0x79, 0x70]), - // "styp" string literal in hex - 'fmp4': toUint8([0x73, 0x74, 0x79, 0x70]), - // "ftyp" string literal in hex - 'mov': toUint8([0x66, 0x74, 0x79, 0x70, 0x71, 0x74]) -}; -var _isLikely = { - aac: function aac(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, [0xFF, 0x10], { - offset: offset, - mask: [0xFF, 0x16] - }); - }, - mp3: function mp3(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, [0xFF, 0x02], { - offset: offset, - mask: [0xFF, 0x06] - }); - }, - webm: function webm(bytes) { - var docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is webm - - return bytesMatch(docType, CONSTANTS.webm); - }, - mkv: function mkv(bytes) { - var docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is matroska - - return bytesMatch(docType, CONSTANTS.matroska); - }, - mp4: function mp4(bytes) { - return !_isLikely['3gp'](bytes) && !_isLikely.mov(bytes) && (bytesMatch(bytes, CONSTANTS.mp4, { - offset: 4 - }) || bytesMatch(bytes, CONSTANTS.fmp4, { - offset: 4 - })); - }, - mov: function mov(bytes) { - return bytesMatch(bytes, CONSTANTS.mov, { - offset: 4 - }); - }, - '3gp': function gp(bytes) { - return bytesMatch(bytes, CONSTANTS['3gp'], { - offset: 4 - }); - }, - ac3: function ac3(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, CONSTANTS.ac3, { - offset: offset - }); - }, - ts: function ts(bytes) { - if (bytes.length < 189 && bytes.length >= 1) { - return bytes[0] === 0x47; - } - - var i = 0; // check the first 376 bytes for two matching sync bytes - - while (i + 188 < bytes.length && i < 188) { - if (bytes[i] === 0x47 && bytes[i + 188] === 0x47) { - return true; - } - - i += 1; - } - - return false; - }, - flac: function flac(bytes) { - var offset = getId3Offset(bytes); - return bytesMatch(bytes, CONSTANTS.flac, { - offset: offset - }); - }, - ogg: function ogg(bytes) { - return bytesMatch(bytes, CONSTANTS.ogg); - }, - avi: function avi(bytes) { - return bytesMatch(bytes, CONSTANTS.riff) && bytesMatch(bytes, CONSTANTS.avi, { - offset: 8 - }); - }, - wav: function wav(bytes) { - return bytesMatch(bytes, CONSTANTS.riff) && bytesMatch(bytes, CONSTANTS.wav, { - offset: 8 - }); - }, - 'h264': function h264(bytes) { - // find seq_parameter_set_rbsp - return findH264Nal(bytes, 7, 3).length; - }, - 'h265': function h265(bytes) { - // find video_parameter_set_rbsp or seq_parameter_set_rbsp - return findH265Nal(bytes, [32, 33], 3).length; - } -}; // get all the isLikely functions -// but make sure 'ts' is above h264 and h265 -// but below everything else as it is the least specific - -var isLikelyTypes = Object.keys(_isLikely) // remove ts, h264, h265 -.filter(function (t) { - return t !== 'ts' && t !== 'h264' && t !== 'h265'; -}) // add it back to the bottom -.concat(['ts', 'h264', 'h265']); // make sure we are dealing with uint8 data. - -isLikelyTypes.forEach(function (type) { - var isLikelyFn = _isLikely[type]; - - _isLikely[type] = function (bytes) { - return isLikelyFn(toUint8(bytes)); - }; -}); // export after wrapping - -export var isLikely = _isLikely; // A useful list of file signatures can be found here -// https://en.wikipedia.org/wiki/List_of_file_signatures - -export var detectContainerForBytes = function detectContainerForBytes(bytes) { - bytes = toUint8(bytes); - - for (var i = 0; i < isLikelyTypes.length; i++) { - var type = isLikelyTypes[i]; - - if (isLikely[type](bytes)) { - return type; - } - } - - return ''; -}; // fmp4 is not a container - -export var isLikelyFmp4MediaSegment = function isLikelyFmp4MediaSegment(bytes) { - return findBox(bytes, ['moof']).length > 0; -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js b/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js deleted file mode 100644 index 7d96cf8..0000000 --- a/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js +++ /dev/null @@ -1,16 +0,0 @@ -import window from 'global/window'; - -var atob = function atob(s) { - return window.atob ? window.atob(s) : Buffer.from(s, 'base64').toString('binary'); -}; - -export default function decodeB64ToUint8Array(b64Text) { - var decodedString = atob(b64Text); - var array = new Uint8Array(decodedString.length); - - for (var i = 0; i < decodedString.length; i++) { - array[i] = decodedString.charCodeAt(i); - } - - return array; -} \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/ebml-helpers.js b/node_modules/@videojs/vhs-utils/es/ebml-helpers.js deleted file mode 100644 index 9f16cf0..0000000 --- a/node_modules/@videojs/vhs-utils/es/ebml-helpers.js +++ /dev/null @@ -1,497 +0,0 @@ -import { toUint8, bytesToNumber, bytesMatch, bytesToString, numberToBytes, padStart } from './byte-helpers'; -import { getAvcCodec, getHvcCodec, getAv1Codec } from './codec-helpers.js'; // relevant specs for this parser: -// https://matroska-org.github.io/libebml/specs.html -// https://www.matroska.org/technical/elements.html -// https://www.webmproject.org/docs/container/ - -export var EBML_TAGS = { - EBML: toUint8([0x1A, 0x45, 0xDF, 0xA3]), - DocType: toUint8([0x42, 0x82]), - Segment: toUint8([0x18, 0x53, 0x80, 0x67]), - SegmentInfo: toUint8([0x15, 0x49, 0xA9, 0x66]), - Tracks: toUint8([0x16, 0x54, 0xAE, 0x6B]), - Track: toUint8([0xAE]), - TrackNumber: toUint8([0xd7]), - DefaultDuration: toUint8([0x23, 0xe3, 0x83]), - TrackEntry: toUint8([0xAE]), - TrackType: toUint8([0x83]), - FlagDefault: toUint8([0x88]), - CodecID: toUint8([0x86]), - CodecPrivate: toUint8([0x63, 0xA2]), - VideoTrack: toUint8([0xe0]), - AudioTrack: toUint8([0xe1]), - // Not used yet, but will be used for live webm/mkv - // see https://www.matroska.org/technical/basics.html#block-structure - // see https://www.matroska.org/technical/basics.html#simpleblock-structure - Cluster: toUint8([0x1F, 0x43, 0xB6, 0x75]), - Timestamp: toUint8([0xE7]), - TimestampScale: toUint8([0x2A, 0xD7, 0xB1]), - BlockGroup: toUint8([0xA0]), - BlockDuration: toUint8([0x9B]), - Block: toUint8([0xA1]), - SimpleBlock: toUint8([0xA3]) -}; -/** - * This is a simple table to determine the length - * of things in ebml. The length is one based (starts at 1, - * rather than zero) and for every zero bit before a one bit - * we add one to length. We also need this table because in some - * case we have to xor all the length bits from another value. - */ - -var LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1]; - -var getLength = function getLength(byte) { - var len = 1; - - for (var i = 0; i < LENGTH_TABLE.length; i++) { - if (byte & LENGTH_TABLE[i]) { - break; - } - - len++; - } - - return len; -}; // length in ebml is stored in the first 4 to 8 bits -// of the first byte. 4 for the id length and 8 for the -// data size length. Length is measured by converting the number to binary -// then 1 + the number of zeros before a 1 is encountered starting -// from the left. - - -var getvint = function getvint(bytes, offset, removeLength, signed) { - if (removeLength === void 0) { - removeLength = true; - } - - if (signed === void 0) { - signed = false; - } - - var length = getLength(bytes[offset]); - var valueBytes = bytes.subarray(offset, offset + length); // NOTE that we do **not** subarray here because we need to copy these bytes - // as they will be modified below to remove the dataSizeLen bits and we do not - // want to modify the original data. normally we could just call slice on - // uint8array but ie 11 does not support that... - - if (removeLength) { - valueBytes = Array.prototype.slice.call(bytes, offset, offset + length); - valueBytes[0] ^= LENGTH_TABLE[length - 1]; - } - - return { - length: length, - value: bytesToNumber(valueBytes, { - signed: signed - }), - bytes: valueBytes - }; -}; - -var normalizePath = function normalizePath(path) { - if (typeof path === 'string') { - return path.match(/.{1,2}/g).map(function (p) { - return normalizePath(p); - }); - } - - if (typeof path === 'number') { - return numberToBytes(path); - } - - return path; -}; - -var normalizePaths = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map(function (p) { - return normalizePath(p); - }); -}; - -var getInfinityDataSize = function getInfinityDataSize(id, bytes, offset) { - if (offset >= bytes.length) { - return bytes.length; - } - - var innerid = getvint(bytes, offset, false); - - if (bytesMatch(id.bytes, innerid.bytes)) { - return offset; - } - - var dataHeader = getvint(bytes, offset + innerid.length); - return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length); -}; -/** - * Notes on the EBLM format. - * - * EBLM uses "vints" tags. Every vint tag contains - * two parts - * - * 1. The length from the first byte. You get this by - * converting the byte to binary and counting the zeros - * before a 1. Then you add 1 to that. Examples - * 00011111 = length 4 because there are 3 zeros before a 1. - * 00100000 = length 3 because there are 2 zeros before a 1. - * 00000011 = length 7 because there are 6 zeros before a 1. - * - * 2. The bits used for length are removed from the first byte - * Then all the bytes are merged into a value. NOTE: this - * is not the case for id ebml tags as there id includes - * length bits. - * - */ - - -export var findEbml = function findEbml(bytes, paths) { - paths = normalizePaths(paths); - bytes = toUint8(bytes); - var results = []; - - if (!paths.length) { - return results; - } - - var i = 0; - - while (i < bytes.length) { - var id = getvint(bytes, i, false); - var dataHeader = getvint(bytes, i + id.length); - var dataStart = i + id.length + dataHeader.length; // dataSize is unknown or this is a live stream - - if (dataHeader.value === 0x7f) { - dataHeader.value = getInfinityDataSize(id, bytes, dataStart); - - if (dataHeader.value !== bytes.length) { - dataHeader.value -= dataStart; - } - } - - var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value; - var data = bytes.subarray(dataStart, dataEnd); - - if (bytesMatch(paths[0], id.bytes)) { - if (paths.length === 1) { - // this is the end of the paths and we've found the tag we were - // looking for - results.push(data); - } else { - // recursively search for the next tag inside of the data - // of this one - results = results.concat(findEbml(data, paths.slice(1))); - } - } - - var totalLength = id.length + dataHeader.length + data.length; // move past this tag entirely, we are not looking for it - - i += totalLength; - } - - return results; -}; // see https://www.matroska.org/technical/basics.html#block-structure - -export var decodeBlock = function decodeBlock(block, type, timestampScale, clusterTimestamp) { - var duration; - - if (type === 'group') { - duration = findEbml(block, [EBML_TAGS.BlockDuration])[0]; - - if (duration) { - duration = bytesToNumber(duration); - duration = 1 / timestampScale * duration * timestampScale / 1000; - } - - block = findEbml(block, [EBML_TAGS.Block])[0]; - type = 'block'; // treat data as a block after this point - } - - var dv = new DataView(block.buffer, block.byteOffset, block.byteLength); - var trackNumber = getvint(block, 0); - var timestamp = dv.getInt16(trackNumber.length, false); - var flags = block[trackNumber.length + 2]; - var data = block.subarray(trackNumber.length + 3); // pts/dts in seconds - - var ptsdts = 1 / timestampScale * (clusterTimestamp + timestamp) * timestampScale / 1000; // return the frame - - var parsed = { - duration: duration, - trackNumber: trackNumber.value, - keyframe: type === 'simple' && flags >> 7 === 1, - invisible: (flags & 0x08) >> 3 === 1, - lacing: (flags & 0x06) >> 1, - discardable: type === 'simple' && (flags & 0x01) === 1, - frames: [], - pts: ptsdts, - dts: ptsdts, - timestamp: timestamp - }; - - if (!parsed.lacing) { - parsed.frames.push(data); - return parsed; - } - - var numberOfFrames = data[0] + 1; - var frameSizes = []; - var offset = 1; // Fixed - - if (parsed.lacing === 2) { - var sizeOfFrame = (data.length - offset) / numberOfFrames; - - for (var i = 0; i < numberOfFrames; i++) { - frameSizes.push(sizeOfFrame); - } - } // xiph - - - if (parsed.lacing === 1) { - for (var _i = 0; _i < numberOfFrames - 1; _i++) { - var size = 0; - - do { - size += data[offset]; - offset++; - } while (data[offset - 1] === 0xFF); - - frameSizes.push(size); - } - } // ebml - - - if (parsed.lacing === 3) { - // first vint is unsinged - // after that vints are singed and - // based on a compounding size - var _size = 0; - - for (var _i2 = 0; _i2 < numberOfFrames - 1; _i2++) { - var vint = _i2 === 0 ? getvint(data, offset) : getvint(data, offset, true, true); - _size += vint.value; - frameSizes.push(_size); - offset += vint.length; - } - } - - frameSizes.forEach(function (size) { - parsed.frames.push(data.subarray(offset, offset + size)); - offset += size; - }); - return parsed; -}; // VP9 Codec Feature Metadata (CodecPrivate) -// https://www.webmproject.org/docs/container/ - -var parseVp9Private = function parseVp9Private(bytes) { - var i = 0; - var params = {}; - - while (i < bytes.length) { - var id = bytes[i] & 0x7f; - var len = bytes[i + 1]; - var val = void 0; - - if (len === 1) { - val = bytes[i + 2]; - } else { - val = bytes.subarray(i + 2, i + 2 + len); - } - - if (id === 1) { - params.profile = val; - } else if (id === 2) { - params.level = val; - } else if (id === 3) { - params.bitDepth = val; - } else if (id === 4) { - params.chromaSubsampling = val; - } else { - params[id] = val; - } - - i += 2 + len; - } - - return params; -}; - -export var parseTracks = function parseTracks(bytes) { - bytes = toUint8(bytes); - var decodedTracks = []; - var tracks = findEbml(bytes, [EBML_TAGS.Segment, EBML_TAGS.Tracks, EBML_TAGS.Track]); - - if (!tracks.length) { - tracks = findEbml(bytes, [EBML_TAGS.Tracks, EBML_TAGS.Track]); - } - - if (!tracks.length) { - tracks = findEbml(bytes, [EBML_TAGS.Track]); - } - - if (!tracks.length) { - return decodedTracks; - } - - tracks.forEach(function (track) { - var trackType = findEbml(track, EBML_TAGS.TrackType)[0]; - - if (!trackType || !trackType.length) { - return; - } // 1 is video, 2 is audio, 17 is subtitle - // other values are unimportant in this context - - - if (trackType[0] === 1) { - trackType = 'video'; - } else if (trackType[0] === 2) { - trackType = 'audio'; - } else if (trackType[0] === 17) { - trackType = 'subtitle'; - } else { - return; - } // todo parse language - - - var decodedTrack = { - rawCodec: bytesToString(findEbml(track, [EBML_TAGS.CodecID])[0]), - type: trackType, - codecPrivate: findEbml(track, [EBML_TAGS.CodecPrivate])[0], - number: bytesToNumber(findEbml(track, [EBML_TAGS.TrackNumber])[0]), - defaultDuration: bytesToNumber(findEbml(track, [EBML_TAGS.DefaultDuration])[0]), - default: findEbml(track, [EBML_TAGS.FlagDefault])[0], - rawData: track - }; - var codec = ''; - - if (/V_MPEG4\/ISO\/AVC/.test(decodedTrack.rawCodec)) { - codec = "avc1." + getAvcCodec(decodedTrack.codecPrivate); - } else if (/V_MPEGH\/ISO\/HEVC/.test(decodedTrack.rawCodec)) { - codec = "hev1." + getHvcCodec(decodedTrack.codecPrivate); - } else if (/V_MPEG4\/ISO\/ASP/.test(decodedTrack.rawCodec)) { - if (decodedTrack.codecPrivate) { - codec = 'mp4v.20.' + decodedTrack.codecPrivate[4].toString(); - } else { - codec = 'mp4v.20.9'; - } - } else if (/^V_THEORA/.test(decodedTrack.rawCodec)) { - codec = 'theora'; - } else if (/^V_VP8/.test(decodedTrack.rawCodec)) { - codec = 'vp8'; - } else if (/^V_VP9/.test(decodedTrack.rawCodec)) { - if (decodedTrack.codecPrivate) { - var _parseVp9Private = parseVp9Private(decodedTrack.codecPrivate), - profile = _parseVp9Private.profile, - level = _parseVp9Private.level, - bitDepth = _parseVp9Private.bitDepth, - chromaSubsampling = _parseVp9Private.chromaSubsampling; - - codec = 'vp09.'; - codec += padStart(profile, 2, '0') + "."; - codec += padStart(level, 2, '0') + "."; - codec += padStart(bitDepth, 2, '0') + "."; - codec += "" + padStart(chromaSubsampling, 2, '0'); // Video -> Colour -> Ebml name - - var matrixCoefficients = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xB1]])[0] || []; - var videoFullRangeFlag = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xB9]])[0] || []; - var transferCharacteristics = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xBA]])[0] || []; - var colourPrimaries = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xBB]])[0] || []; // if we find any optional codec parameter specify them all. - - if (matrixCoefficients.length || videoFullRangeFlag.length || transferCharacteristics.length || colourPrimaries.length) { - codec += "." + padStart(colourPrimaries[0], 2, '0'); - codec += "." + padStart(transferCharacteristics[0], 2, '0'); - codec += "." + padStart(matrixCoefficients[0], 2, '0'); - codec += "." + padStart(videoFullRangeFlag[0], 2, '0'); - } - } else { - codec = 'vp9'; - } - } else if (/^V_AV1/.test(decodedTrack.rawCodec)) { - codec = "av01." + getAv1Codec(decodedTrack.codecPrivate); - } else if (/A_ALAC/.test(decodedTrack.rawCodec)) { - codec = 'alac'; - } else if (/A_MPEG\/L2/.test(decodedTrack.rawCodec)) { - codec = 'mp2'; - } else if (/A_MPEG\/L3/.test(decodedTrack.rawCodec)) { - codec = 'mp3'; - } else if (/^A_AAC/.test(decodedTrack.rawCodec)) { - if (decodedTrack.codecPrivate) { - codec = 'mp4a.40.' + (decodedTrack.codecPrivate[0] >>> 3).toString(); - } else { - codec = 'mp4a.40.2'; - } - } else if (/^A_AC3/.test(decodedTrack.rawCodec)) { - codec = 'ac-3'; - } else if (/^A_PCM/.test(decodedTrack.rawCodec)) { - codec = 'pcm'; - } else if (/^A_MS\/ACM/.test(decodedTrack.rawCodec)) { - codec = 'speex'; - } else if (/^A_EAC3/.test(decodedTrack.rawCodec)) { - codec = 'ec-3'; - } else if (/^A_VORBIS/.test(decodedTrack.rawCodec)) { - codec = 'vorbis'; - } else if (/^A_FLAC/.test(decodedTrack.rawCodec)) { - codec = 'flac'; - } else if (/^A_OPUS/.test(decodedTrack.rawCodec)) { - codec = 'opus'; - } - - decodedTrack.codec = codec; - decodedTracks.push(decodedTrack); - }); - return decodedTracks.sort(function (a, b) { - return a.number - b.number; - }); -}; -export var parseData = function parseData(data, tracks) { - var allBlocks = []; - var segment = findEbml(data, [EBML_TAGS.Segment])[0]; - var timestampScale = findEbml(segment, [EBML_TAGS.SegmentInfo, EBML_TAGS.TimestampScale])[0]; // in nanoseconds, defaults to 1ms - - if (timestampScale && timestampScale.length) { - timestampScale = bytesToNumber(timestampScale); - } else { - timestampScale = 1000000; - } - - var clusters = findEbml(segment, [EBML_TAGS.Cluster]); - - if (!tracks) { - tracks = parseTracks(segment); - } - - clusters.forEach(function (cluster, ci) { - var simpleBlocks = findEbml(cluster, [EBML_TAGS.SimpleBlock]).map(function (b) { - return { - type: 'simple', - data: b - }; - }); - var blockGroups = findEbml(cluster, [EBML_TAGS.BlockGroup]).map(function (b) { - return { - type: 'group', - data: b - }; - }); - var timestamp = findEbml(cluster, [EBML_TAGS.Timestamp])[0] || 0; - - if (timestamp && timestamp.length) { - timestamp = bytesToNumber(timestamp); - } // get all blocks then sort them into the correct order - - - var blocks = simpleBlocks.concat(blockGroups).sort(function (a, b) { - return a.data.byteOffset - b.data.byteOffset; - }); - blocks.forEach(function (block, bi) { - var decoded = decodeBlock(block.data, block.type, timestampScale, timestamp); - allBlocks.push(decoded); - }); - }); - return { - tracks: tracks, - blocks: allBlocks - }; -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/format-parser.js b/node_modules/@videojs/vhs-utils/es/format-parser.js deleted file mode 100644 index 7560c01..0000000 --- a/node_modules/@videojs/vhs-utils/es/format-parser.js +++ /dev/null @@ -1,388 +0,0 @@ -import { bytesToString, toUint8, toHexString, bytesMatch } from './byte-helpers.js'; -import { parseTracks as parseEbmlTracks } from './ebml-helpers.js'; -import { parseTracks as parseMp4Tracks } from './mp4-helpers.js'; -import { findFourCC } from './riff-helpers.js'; -import { getPages } from './ogg-helpers.js'; -import { detectContainerForBytes } from './containers.js'; -import { findH264Nal, findH265Nal } from './nal-helpers.js'; -import { parseTs } from './m2ts-helpers.js'; -import { getAvcCodec, getHvcCodec } from './codec-helpers.js'; -import { getId3Offset } from './id3-helpers.js'; // https://docs.microsoft.com/en-us/windows/win32/medfound/audio-subtype-guids -// https://tools.ietf.org/html/rfc2361 - -var wFormatTagCodec = function wFormatTagCodec(wFormatTag) { - wFormatTag = toUint8(wFormatTag); - - if (bytesMatch(wFormatTag, [0x00, 0x55])) { - return 'mp3'; - } else if (bytesMatch(wFormatTag, [0x16, 0x00]) || bytesMatch(wFormatTag, [0x00, 0xFF])) { - return 'aac'; - } else if (bytesMatch(wFormatTag, [0x70, 0x4f])) { - return 'opus'; - } else if (bytesMatch(wFormatTag, [0x6C, 0x61])) { - return 'alac'; - } else if (bytesMatch(wFormatTag, [0xF1, 0xAC])) { - return 'flac'; - } else if (bytesMatch(wFormatTag, [0x20, 0x00])) { - return 'ac-3'; - } else if (bytesMatch(wFormatTag, [0xFF, 0xFE])) { - return 'ec-3'; - } else if (bytesMatch(wFormatTag, [0x00, 0x50])) { - return 'mp2'; - } else if (bytesMatch(wFormatTag, [0x56, 0x6f])) { - return 'vorbis'; - } else if (bytesMatch(wFormatTag, [0xA1, 0x09])) { - return 'speex'; - } - - return ''; -}; - -var formatMimetype = function formatMimetype(name, codecs) { - var codecString = ['video', 'audio'].reduce(function (acc, type) { - if (codecs[type]) { - acc += (acc.length ? ',' : '') + codecs[type]; - } - - return acc; - }, ''); - return (codecs.video ? 'video' : 'audio') + "/" + name + (codecString ? ";codecs=\"" + codecString + "\"" : ''); -}; - -var parseCodecFrom = { - mov: function mov(bytes) { - // mov and mp4 both use a nearly identical box structure. - var retval = parseCodecFrom.mp4(bytes); - - if (retval.mimetype) { - retval.mimetype = retval.mimetype.replace('mp4', 'quicktime'); - } - - return retval; - }, - mp4: function mp4(bytes) { - bytes = toUint8(bytes); - var codecs = {}; - var tracks = parseMp4Tracks(bytes); - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - if (track.type === 'audio' && !codecs.audio) { - codecs.audio = track.codec; - } - - if (track.type === 'video' && !codecs.video) { - codecs.video = track.codec; - } - } - - return { - codecs: codecs, - mimetype: formatMimetype('mp4', codecs) - }; - }, - '3gp': function gp(bytes) { - return { - codecs: {}, - mimetype: 'video/3gpp' - }; - }, - ogg: function ogg(bytes) { - var pages = getPages(bytes, 0, 4); - var codecs = {}; - pages.forEach(function (page) { - if (bytesMatch(page, [0x4F, 0x70, 0x75, 0x73], { - offset: 28 - })) { - codecs.audio = 'opus'; - } else if (bytesMatch(page, [0x56, 0x50, 0x38, 0x30], { - offset: 29 - })) { - codecs.video = 'vp8'; - } else if (bytesMatch(page, [0x74, 0x68, 0x65, 0x6F, 0x72, 0x61], { - offset: 29 - })) { - codecs.video = 'theora'; - } else if (bytesMatch(page, [0x46, 0x4C, 0x41, 0x43], { - offset: 29 - })) { - codecs.audio = 'flac'; - } else if (bytesMatch(page, [0x53, 0x70, 0x65, 0x65, 0x78], { - offset: 28 - })) { - codecs.audio = 'speex'; - } else if (bytesMatch(page, [0x76, 0x6F, 0x72, 0x62, 0x69, 0x73], { - offset: 29 - })) { - codecs.audio = 'vorbis'; - } - }); - return { - codecs: codecs, - mimetype: formatMimetype('ogg', codecs) - }; - }, - wav: function wav(bytes) { - var format = findFourCC(bytes, ['WAVE', 'fmt'])[0]; - var wFormatTag = Array.prototype.slice.call(format, 0, 2).reverse(); - var mimetype = 'audio/vnd.wave'; - var codecs = { - audio: wFormatTagCodec(wFormatTag) - }; - var codecString = wFormatTag.reduce(function (acc, v) { - if (v) { - acc += toHexString(v); - } - - return acc; - }, ''); - - if (codecString) { - mimetype += ";codec=" + codecString; - } - - if (codecString && !codecs.audio) { - codecs.audio = codecString; - } - - return { - codecs: codecs, - mimetype: mimetype - }; - }, - avi: function avi(bytes) { - var movi = findFourCC(bytes, ['AVI', 'movi'])[0]; - var strls = findFourCC(bytes, ['AVI', 'hdrl', 'strl']); - var codecs = {}; - strls.forEach(function (strl) { - var strh = findFourCC(strl, ['strh'])[0]; - var strf = findFourCC(strl, ['strf'])[0]; // now parse AVIStreamHeader to get codec and type: - // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/api/avifmt/ns-avifmt-avistreamheader - - var type = bytesToString(strh.subarray(0, 4)); - var codec; - var codecType; - - if (type === 'vids') { - // https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapinfoheader - var handler = bytesToString(strh.subarray(4, 8)); - var compression = bytesToString(strf.subarray(16, 20)); // look for 00dc (compressed video fourcc code) or 00db (uncompressed video fourcc code) - - var videoData = findFourCC(movi, ['00dc'])[0] || findFourCC(movi, ['00db'][0]); - - if (handler === 'H264' || compression === 'H264') { - if (videoData && videoData.length) { - codec = parseCodecFrom.h264(videoData).codecs.video; - } else { - codec = 'avc1'; - } - } else if (handler === 'HEVC' || compression === 'HEVC') { - if (videoData && videoData.length) { - codec = parseCodecFrom.h265(videoData).codecs.video; - } else { - codec = 'hev1'; - } - } else if (handler === 'FMP4' || compression === 'FMP4') { - if (movi.length) { - codec = 'mp4v.20.' + movi[12].toString(); - } else { - codec = 'mp4v.20'; - } - } else if (handler === 'VP80' || compression === 'VP80') { - codec = 'vp8'; - } else if (handler === 'VP90' || compression === 'VP90') { - codec = 'vp9'; - } else if (handler === 'AV01' || compression === 'AV01') { - codec = 'av01'; - } else if (handler === 'theo' || compression === 'theora') { - codec = 'theora'; - } else { - if (videoData && videoData.length) { - var result = detectContainerForBytes(videoData); - - if (result === 'h264') { - codec = parseCodecFrom.h264(movi).codecs.video; - } - - if (result === 'h265') { - codec = parseCodecFrom.h265(movi).codecs.video; - } - } - - if (!codec) { - codec = handler || compression; - } - } - - codecType = 'video'; - } else if (type === 'auds') { - codecType = 'audio'; // look for 00wb (audio data fourcc) - // const audioData = findFourCC(movi, ['01wb']); - - var wFormatTag = Array.prototype.slice.call(strf, 0, 2).reverse(); - codecs.audio = wFormatTagCodec(wFormatTag); - } else { - return; - } - - if (codec) { - codecs[codecType] = codec; - } - }); - return { - codecs: codecs, - mimetype: formatMimetype('avi', codecs) - }; - }, - ts: function ts(bytes) { - var result = parseTs(bytes, 2); - var codecs = {}; - Object.keys(result.streams).forEach(function (esPid) { - var stream = result.streams[esPid]; - - if (stream.codec === 'avc1' && stream.packets.length) { - stream.codec = parseCodecFrom.h264(stream.packets[0]).codecs.video; - } else if (stream.codec === 'hev1' && stream.packets.length) { - stream.codec = parseCodecFrom.h265(stream.packets[0]).codecs.video; - } - - codecs[stream.type] = stream.codec; - }); - return { - codecs: codecs, - mimetype: formatMimetype('mp2t', codecs) - }; - }, - webm: function webm(bytes) { - // mkv and webm both use ebml to store code info - var retval = parseCodecFrom.mkv(bytes); - - if (retval.mimetype) { - retval.mimetype = retval.mimetype.replace('x-matroska', 'webm'); - } - - return retval; - }, - mkv: function mkv(bytes) { - var codecs = {}; - var tracks = parseEbmlTracks(bytes); - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - if (track.type === 'audio' && !codecs.audio) { - codecs.audio = track.codec; - } - - if (track.type === 'video' && !codecs.video) { - codecs.video = track.codec; - } - } - - return { - codecs: codecs, - mimetype: formatMimetype('x-matroska', codecs) - }; - }, - aac: function aac(bytes) { - return { - codecs: { - audio: 'aac' - }, - mimetype: 'audio/aac' - }; - }, - ac3: function ac3(bytes) { - // past id3 and syncword - var offset = getId3Offset(bytes) + 2; // default to ac-3 - - var codec = 'ac-3'; - - if (bytesMatch(bytes, [0xB8, 0xE0], { - offset: offset - })) { - codec = 'ac-3'; // 0x01, 0x7F - } else if (bytesMatch(bytes, [0x01, 0x7f], { - offset: offset - })) { - codec = 'ec-3'; - } - - return { - codecs: { - audio: codec - }, - mimetype: 'audio/vnd.dolby.dd-raw' - }; - }, - mp3: function mp3(bytes) { - return { - codecs: { - audio: 'mp3' - }, - mimetype: 'audio/mpeg' - }; - }, - flac: function flac(bytes) { - return { - codecs: { - audio: 'flac' - }, - mimetype: 'audio/flac' - }; - }, - 'h264': function h264(bytes) { - // find seq_parameter_set_rbsp to get encoding settings for codec - var nal = findH264Nal(bytes, 7, 3); - var retval = { - codecs: { - video: 'avc1' - }, - mimetype: 'video/h264' - }; - - if (nal.length) { - retval.codecs.video += "." + getAvcCodec(nal); - } - - return retval; - }, - 'h265': function h265(bytes) { - var retval = { - codecs: { - video: 'hev1' - }, - mimetype: 'video/h265' - }; // find video_parameter_set_rbsp or seq_parameter_set_rbsp - // to get encoding settings for codec - - var nal = findH265Nal(bytes, [32, 33], 3); - - if (nal.length) { - var type = nal[0] >> 1 & 0x3F; // profile_tier_level starts at byte 5 for video_parameter_set_rbsp - // byte 2 for seq_parameter_set_rbsp - - retval.codecs.video += "." + getHvcCodec(nal.subarray(type === 32 ? 5 : 2)); - } - - return retval; - } -}; -export var parseFormatForBytes = function parseFormatForBytes(bytes) { - bytes = toUint8(bytes); - var result = { - codecs: {}, - container: detectContainerForBytes(bytes), - mimetype: '' - }; - var parseCodecFn = parseCodecFrom[result.container]; - - if (parseCodecFn) { - var parsed = parseCodecFn ? parseCodecFn(bytes) : {}; - result.codecs = parsed.codecs || {}; - result.mimetype = parsed.mimetype || ''; - } - - return result; -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/id3-helpers.js b/node_modules/@videojs/vhs-utils/es/id3-helpers.js deleted file mode 100644 index 36904d8..0000000 --- a/node_modules/@videojs/vhs-utils/es/id3-helpers.js +++ /dev/null @@ -1,37 +0,0 @@ -import { toUint8, bytesMatch } from './byte-helpers.js'; -var ID3 = toUint8([0x49, 0x44, 0x33]); -export var getId3Size = function getId3Size(bytes, offset) { - if (offset === void 0) { - offset = 0; - } - - bytes = toUint8(bytes); - var flags = bytes[offset + 5]; - var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9]; - var footerPresent = (flags & 16) >> 4; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; -}; -export var getId3Offset = function getId3Offset(bytes, offset) { - if (offset === void 0) { - offset = 0; - } - - bytes = toUint8(bytes); - - if (bytes.length - offset < 10 || !bytesMatch(bytes, ID3, { - offset: offset - })) { - return offset; - } - - offset += getId3Size(bytes, offset); // recursive check for id3 tags as some files - // have multiple ID3 tag sections even though - // they should not. - - return getId3Offset(bytes, offset); -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/index.js b/node_modules/@videojs/vhs-utils/es/index.js deleted file mode 100644 index adbae4b..0000000 --- a/node_modules/@videojs/vhs-utils/es/index.js +++ /dev/null @@ -1,16 +0,0 @@ -import * as codecs from './codecs'; -import * as byteHelpers from './byte-helpers.js'; -import * as containers from './containers.js'; -import decodeB64ToUint8Array from './decode-b64-to-uint8-array.js'; -import * as mediaGroups from './media-groups.js'; -import resolveUrl from './resolve-url.js'; -import Stream from './stream.js'; -export default { - codecs: codecs, - byteHelpers: byteHelpers, - containers: containers, - decodeB64ToUint8Array: decodeB64ToUint8Array, - mediaGroups: mediaGroups, - resolveUrl: resolveUrl, - Stream: Stream -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/m2ts-helpers.js b/node_modules/@videojs/vhs-utils/es/m2ts-helpers.js deleted file mode 100644 index aa4c1a5..0000000 --- a/node_modules/@videojs/vhs-utils/es/m2ts-helpers.js +++ /dev/null @@ -1,105 +0,0 @@ -import { bytesMatch, toUint8 } from './byte-helpers.js'; -var SYNC_BYTE = 0x47; -export var parseTs = function parseTs(bytes, maxPes) { - if (maxPes === void 0) { - maxPes = Infinity; - } - - bytes = toUint8(bytes); - var startIndex = 0; - var endIndex = 188; - var pmt = {}; - var pesCount = 0; - - while (endIndex < bytes.byteLength && pesCount < maxPes) { - if (bytes[startIndex] !== SYNC_BYTE && bytes[endIndex] !== SYNC_BYTE) { - endIndex += 1; - startIndex += 1; - continue; - } - - var packet = bytes.subarray(startIndex, endIndex); - var pid = (packet[1] & 0x1f) << 8 | packet[2]; - var hasPusi = !!(packet[1] & 0x40); - var hasAdaptationHeader = (packet[3] & 0x30) >>> 4 > 0x01; - var payloadOffset = 4 + (hasAdaptationHeader ? packet[4] + 1 : 0); - - if (hasPusi) { - payloadOffset += packet[payloadOffset] + 1; - } - - if (pid === 0 && !pmt.pid) { - pmt.pid = (packet[payloadOffset + 10] & 0x1f) << 8 | packet[payloadOffset + 11]; - } else if (pmt.pid && pid === pmt.pid && !pmt.streams) { - var isNotForward = packet[payloadOffset + 5] & 0x01; // ignore forward pmt delarations - - if (!isNotForward) { - continue; - } - - pmt.streams = {}; - var sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - var tableEnd = 3 + sectionLength - 4; - var programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - // add an entry that maps the elementary_pid to the stream_type - var i = payloadOffset + offset; - var type = packet[i]; - var esPid = (packet[i + 1] & 0x1F) << 8 | packet[i + 2]; - var esLength = (packet[i + 3] & 0x0f) << 8 | packet[i + 4]; - var esInfo = packet.subarray(i + 5, i + 5 + esLength); - var stream = pmt.streams[esPid] = { - esInfo: esInfo, - typeNumber: type, - packets: [], - type: '', - codec: '' - }; - - if (type === 0x06 && bytesMatch(esInfo, [0x4F, 0x70, 0x75, 0x73], { - offset: 2 - })) { - stream.type = 'audio'; - stream.codec = 'opus'; - } else if (type === 0x1B || type === 0x20) { - stream.type = 'video'; - stream.codec = 'avc1'; - } else if (type === 0x24) { - stream.type = 'video'; - stream.codec = 'hev1'; - } else if (type === 0x10) { - stream.type = 'video'; - stream.codec = 'mp4v.20'; - } else if (type === 0x0F) { - stream.type = 'audio'; - stream.codec = 'aac'; - } else if (type === 0x81) { - stream.type = 'audio'; - stream.codec = 'ac-3'; - } else if (type === 0x87) { - stream.type = 'audio'; - stream.codec = 'ec-3'; - } else if (type === 0x03 || type === 0x04) { - stream.type = 'audio'; - stream.codec = 'mp3'; - } - - offset += esLength + 5; - } - } else if (pmt.pid && pmt.streams) { - pmt.streams[pid].packets.push(packet.subarray(payloadOffset)); - pesCount++; - } - - startIndex += 188; - endIndex += 188; - } - - if (!pmt.streams) { - pmt.streams = {}; - } - - return pmt; -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/media-groups.js b/node_modules/@videojs/vhs-utils/es/media-groups.js deleted file mode 100644 index 87de53e..0000000 --- a/node_modules/@videojs/vhs-utils/es/media-groups.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Loops through all supported media groups in master and calls the provided - * callback for each group - * - * @param {Object} master - * The parsed master manifest object - * @param {string[]} groups - * The media groups to call the callback for - * @param {Function} callback - * Callback to call for each media group - */ -export var forEachMediaGroup = function forEachMediaGroup(master, groups, callback) { - groups.forEach(function (mediaType) { - for (var groupKey in master.mediaGroups[mediaType]) { - for (var labelKey in master.mediaGroups[mediaType][groupKey]) { - var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey]; - callback(mediaProperties, mediaType, groupKey, labelKey); - } - } - }); -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/media-types.js b/node_modules/@videojs/vhs-utils/es/media-types.js deleted file mode 100644 index e4f86f1..0000000 --- a/node_modules/@videojs/vhs-utils/es/media-types.js +++ /dev/null @@ -1,36 +0,0 @@ -var MPEGURL_REGEX = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i; -var DASH_REGEX = /^application\/dash\+xml/i; -/** - * Returns a string that describes the type of source based on a video source object's - * media type. - * - * @see {@link https://dev.w3.org/html5/pf-summary/video.html#dom-source-type|Source Type} - * - * @param {string} type - * Video source object media type - * @return {('hls'|'dash'|'vhs-json'|null)} - * VHS source type string - */ - -export var simpleTypeFromSourceType = function simpleTypeFromSourceType(type) { - if (MPEGURL_REGEX.test(type)) { - return 'hls'; - } - - if (DASH_REGEX.test(type)) { - return 'dash'; - } // Denotes the special case of a manifest object passed to http-streaming instead of a - // source URL. - // - // See https://en.wikipedia.org/wiki/Media_type for details on specifying media types. - // - // In this case, vnd stands for vendor, video.js for the organization, VHS for this - // project, and the +json suffix identifies the structure of the media type. - - - if (type === 'application/vnd.videojs.vhs+json') { - return 'vhs-json'; - } - - return null; -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/mp4-helpers.js b/node_modules/@videojs/vhs-utils/es/mp4-helpers.js deleted file mode 100644 index ae84aa4..0000000 --- a/node_modules/@videojs/vhs-utils/es/mp4-helpers.js +++ /dev/null @@ -1,553 +0,0 @@ -import { stringToBytes, toUint8, bytesMatch, bytesToString, toHexString, padStart, bytesToNumber } from './byte-helpers.js'; -import { getAvcCodec, getHvcCodec, getAv1Codec } from './codec-helpers.js'; -import { parseOpusHead } from './opus-helpers.js'; - -var normalizePath = function normalizePath(path) { - if (typeof path === 'string') { - return stringToBytes(path); - } - - if (typeof path === 'number') { - return path; - } - - return path; -}; - -var normalizePaths = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map(function (p) { - return normalizePath(p); - }); -}; - -var DESCRIPTORS; -export var parseDescriptors = function parseDescriptors(bytes) { - bytes = toUint8(bytes); - var results = []; - var i = 0; - - while (bytes.length > i) { - var tag = bytes[i]; - var size = 0; - var headerSize = 0; // tag - - headerSize++; - var byte = bytes[headerSize]; // first byte - - headerSize++; - - while (byte & 0x80) { - size = (byte & 0x7F) << 7; - byte = bytes[headerSize]; - headerSize++; - } - - size += byte & 0x7F; - - for (var z = 0; z < DESCRIPTORS.length; z++) { - var _DESCRIPTORS$z = DESCRIPTORS[z], - id = _DESCRIPTORS$z.id, - parser = _DESCRIPTORS$z.parser; - - if (tag === id) { - results.push(parser(bytes.subarray(headerSize, headerSize + size))); - break; - } - } - - i += size + headerSize; - } - - return results; -}; -DESCRIPTORS = [{ - id: 0x03, - parser: function parser(bytes) { - var desc = { - tag: 0x03, - id: bytes[0] << 8 | bytes[1], - flags: bytes[2], - size: 3, - dependsOnEsId: 0, - ocrEsId: 0, - descriptors: [], - url: '' - }; // depends on es id - - if (desc.flags & 0x80) { - desc.dependsOnEsId = bytes[desc.size] << 8 | bytes[desc.size + 1]; - desc.size += 2; - } // url - - - if (desc.flags & 0x40) { - var len = bytes[desc.size]; - desc.url = bytesToString(bytes.subarray(desc.size + 1, desc.size + 1 + len)); - desc.size += len; - } // ocr es id - - - if (desc.flags & 0x20) { - desc.ocrEsId = bytes[desc.size] << 8 | bytes[desc.size + 1]; - desc.size += 2; - } - - desc.descriptors = parseDescriptors(bytes.subarray(desc.size)) || []; - return desc; - } -}, { - id: 0x04, - parser: function parser(bytes) { - // DecoderConfigDescriptor - var desc = { - tag: 0x04, - oti: bytes[0], - streamType: bytes[1], - bufferSize: bytes[2] << 16 | bytes[3] << 8 | bytes[4], - maxBitrate: bytes[5] << 24 | bytes[6] << 16 | bytes[7] << 8 | bytes[8], - avgBitrate: bytes[9] << 24 | bytes[10] << 16 | bytes[11] << 8 | bytes[12], - descriptors: parseDescriptors(bytes.subarray(13)) - }; - return desc; - } -}, { - id: 0x05, - parser: function parser(bytes) { - // DecoderSpecificInfo - return { - tag: 0x05, - bytes: bytes - }; - } -}, { - id: 0x06, - parser: function parser(bytes) { - // SLConfigDescriptor - return { - tag: 0x06, - bytes: bytes - }; - } -}]; -/** - * find any number of boxes by name given a path to it in an iso bmff - * such as mp4. - * - * @param {TypedArray} bytes - * bytes for the iso bmff to search for boxes in - * - * @param {Uint8Array[]|string[]|string|Uint8Array} name - * An array of paths or a single path representing the name - * of boxes to search through in bytes. Paths may be - * uint8 (character codes) or strings. - * - * @param {boolean} [complete=false] - * Should we search only for complete boxes on the final path. - * This is very useful when you do not want to get back partial boxes - * in the case of streaming files. - * - * @return {Uint8Array[]} - * An array of the end paths that we found. - */ - -export var findBox = function findBox(bytes, paths, complete) { - if (complete === void 0) { - complete = false; - } - - paths = normalizePaths(paths); - bytes = toUint8(bytes); - var results = []; - - if (!paths.length) { - // short-circuit the search for empty paths - return results; - } - - var i = 0; - - while (i < bytes.length) { - var size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0; - var type = bytes.subarray(i + 4, i + 8); // invalid box format. - - if (size === 0) { - break; - } - - var end = i + size; - - if (end > bytes.length) { - // this box is bigger than the number of bytes we have - // and complete is set, we cannot find any more boxes. - if (complete) { - break; - } - - end = bytes.length; - } - - var data = bytes.subarray(i + 8, end); - - if (bytesMatch(type, paths[0])) { - if (paths.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data); - } else { - // recursively search for the next box along the path - results.push.apply(results, findBox(data, paths.slice(1), complete)); - } - } - - i = end; - } // we've finished searching all of bytes - - - return results; -}; -/** - * Search for a single matching box by name in an iso bmff format like - * mp4. This function is useful for finding codec boxes which - * can be placed arbitrarily in sample descriptions depending - * on the version of the file or file type. - * - * @param {TypedArray} bytes - * bytes for the iso bmff to search for boxes in - * - * @param {string|Uint8Array} name - * The name of the box to find. - * - * @return {Uint8Array[]} - * a subarray of bytes representing the name boxed we found. - */ - -export var findNamedBox = function findNamedBox(bytes, name) { - name = normalizePath(name); - - if (!name.length) { - // short-circuit the search for empty paths - return bytes.subarray(bytes.length); - } - - var i = 0; - - while (i < bytes.length) { - if (bytesMatch(bytes.subarray(i, i + name.length), name)) { - var size = (bytes[i - 4] << 24 | bytes[i - 3] << 16 | bytes[i - 2] << 8 | bytes[i - 1]) >>> 0; - var end = size > 1 ? i + size : bytes.byteLength; - return bytes.subarray(i + 4, end); - } - - i++; - } // we've finished searching all of bytes - - - return bytes.subarray(bytes.length); -}; - -var parseSamples = function parseSamples(data, entrySize, parseEntry) { - if (entrySize === void 0) { - entrySize = 4; - } - - if (parseEntry === void 0) { - parseEntry = function parseEntry(d) { - return bytesToNumber(d); - }; - } - - var entries = []; - - if (!data || !data.length) { - return entries; - } - - var entryCount = bytesToNumber(data.subarray(4, 8)); - - for (var i = 8; entryCount; i += entrySize, entryCount--) { - entries.push(parseEntry(data.subarray(i, i + entrySize))); - } - - return entries; -}; - -export var buildFrameTable = function buildFrameTable(stbl, timescale) { - var keySamples = parseSamples(findBox(stbl, ['stss'])[0]); - var chunkOffsets = parseSamples(findBox(stbl, ['stco'])[0]); - var timeToSamples = parseSamples(findBox(stbl, ['stts'])[0], 8, function (entry) { - return { - sampleCount: bytesToNumber(entry.subarray(0, 4)), - sampleDelta: bytesToNumber(entry.subarray(4, 8)) - }; - }); - var samplesToChunks = parseSamples(findBox(stbl, ['stsc'])[0], 12, function (entry) { - return { - firstChunk: bytesToNumber(entry.subarray(0, 4)), - samplesPerChunk: bytesToNumber(entry.subarray(4, 8)), - sampleDescriptionIndex: bytesToNumber(entry.subarray(8, 12)) - }; - }); - var stsz = findBox(stbl, ['stsz'])[0]; // stsz starts with a 4 byte sampleSize which we don't need - - var sampleSizes = parseSamples(stsz && stsz.length && stsz.subarray(4) || null); - var frames = []; - - for (var chunkIndex = 0; chunkIndex < chunkOffsets.length; chunkIndex++) { - var samplesInChunk = void 0; - - for (var i = 0; i < samplesToChunks.length; i++) { - var sampleToChunk = samplesToChunks[i]; - var isThisOne = chunkIndex + 1 >= sampleToChunk.firstChunk && (i + 1 >= samplesToChunks.length || chunkIndex + 1 < samplesToChunks[i + 1].firstChunk); - - if (isThisOne) { - samplesInChunk = sampleToChunk.samplesPerChunk; - break; - } - } - - var chunkOffset = chunkOffsets[chunkIndex]; - - for (var _i = 0; _i < samplesInChunk; _i++) { - var frameEnd = sampleSizes[frames.length]; // if we don't have key samples every frame is a keyframe - - var keyframe = !keySamples.length; - - if (keySamples.length && keySamples.indexOf(frames.length + 1) !== -1) { - keyframe = true; - } - - var frame = { - keyframe: keyframe, - start: chunkOffset, - end: chunkOffset + frameEnd - }; - - for (var k = 0; k < timeToSamples.length; k++) { - var _timeToSamples$k = timeToSamples[k], - sampleCount = _timeToSamples$k.sampleCount, - sampleDelta = _timeToSamples$k.sampleDelta; - - if (frames.length <= sampleCount) { - // ms to ns - var lastTimestamp = frames.length ? frames[frames.length - 1].timestamp : 0; - frame.timestamp = lastTimestamp + sampleDelta / timescale * 1000; - frame.duration = sampleDelta; - break; - } - } - - frames.push(frame); - chunkOffset += frameEnd; - } - } - - return frames; -}; -export var addSampleDescription = function addSampleDescription(track, bytes) { - var codec = bytesToString(bytes.subarray(0, 4)); - - if (track.type === 'video') { - track.info = track.info || {}; - track.info.width = bytes[28] << 8 | bytes[29]; - track.info.height = bytes[30] << 8 | bytes[31]; - } else if (track.type === 'audio') { - track.info = track.info || {}; - track.info.channels = bytes[20] << 8 | bytes[21]; - track.info.bitDepth = bytes[22] << 8 | bytes[23]; - track.info.sampleRate = bytes[28] << 8 | bytes[29]; - } - - if (codec === 'avc1') { - var avcC = findNamedBox(bytes, 'avcC'); // AVCDecoderConfigurationRecord - - codec += "." + getAvcCodec(avcC); - track.info.avcC = avcC; // TODO: do we need to parse all this? - - /* { - configurationVersion: avcC[0], - profile: avcC[1], - profileCompatibility: avcC[2], - level: avcC[3], - lengthSizeMinusOne: avcC[4] & 0x3 - }; - let spsNalUnitCount = avcC[5] & 0x1F; - const spsNalUnits = track.info.avc.spsNalUnits = []; - // past spsNalUnitCount - let offset = 6; - while (spsNalUnitCount--) { - const nalLen = avcC[offset] << 8 | avcC[offset + 1]; - spsNalUnits.push(avcC.subarray(offset + 2, offset + 2 + nalLen)); - offset += nalLen + 2; - } - let ppsNalUnitCount = avcC[offset]; - const ppsNalUnits = track.info.avc.ppsNalUnits = []; - // past ppsNalUnitCount - offset += 1; - while (ppsNalUnitCount--) { - const nalLen = avcC[offset] << 8 | avcC[offset + 1]; - ppsNalUnits.push(avcC.subarray(offset + 2, offset + 2 + nalLen)); - offset += nalLen + 2; - }*/ - // HEVCDecoderConfigurationRecord - } else if (codec === 'hvc1' || codec === 'hev1') { - codec += "." + getHvcCodec(findNamedBox(bytes, 'hvcC')); - } else if (codec === 'mp4a' || codec === 'mp4v') { - var esds = findNamedBox(bytes, 'esds'); - var esDescriptor = parseDescriptors(esds.subarray(4))[0]; - var decoderConfig = esDescriptor && esDescriptor.descriptors.filter(function (_ref) { - var tag = _ref.tag; - return tag === 0x04; - })[0]; - - if (decoderConfig) { - // most codecs do not have a further '.' - // such as 0xa5 for ac-3 and 0xa6 for e-ac-3 - codec += '.' + toHexString(decoderConfig.oti); - - if (decoderConfig.oti === 0x40) { - codec += '.' + (decoderConfig.descriptors[0].bytes[0] >> 3).toString(); - } else if (decoderConfig.oti === 0x20) { - codec += '.' + decoderConfig.descriptors[0].bytes[4].toString(); - } else if (decoderConfig.oti === 0xdd) { - codec = 'vorbis'; - } - } else if (track.type === 'audio') { - codec += '.40.2'; - } else { - codec += '.20.9'; - } - } else if (codec === 'av01') { - // AV1DecoderConfigurationRecord - codec += "." + getAv1Codec(findNamedBox(bytes, 'av1C')); - } else if (codec === 'vp09') { - // VPCodecConfigurationRecord - var vpcC = findNamedBox(bytes, 'vpcC'); // https://www.webmproject.org/vp9/mp4/ - - var profile = vpcC[0]; - var level = vpcC[1]; - var bitDepth = vpcC[2] >> 4; - var chromaSubsampling = (vpcC[2] & 0x0F) >> 1; - var videoFullRangeFlag = (vpcC[2] & 0x0F) >> 3; - var colourPrimaries = vpcC[3]; - var transferCharacteristics = vpcC[4]; - var matrixCoefficients = vpcC[5]; - codec += "." + padStart(profile, 2, '0'); - codec += "." + padStart(level, 2, '0'); - codec += "." + padStart(bitDepth, 2, '0'); - codec += "." + padStart(chromaSubsampling, 2, '0'); - codec += "." + padStart(colourPrimaries, 2, '0'); - codec += "." + padStart(transferCharacteristics, 2, '0'); - codec += "." + padStart(matrixCoefficients, 2, '0'); - codec += "." + padStart(videoFullRangeFlag, 2, '0'); - } else if (codec === 'theo') { - codec = 'theora'; - } else if (codec === 'spex') { - codec = 'speex'; - } else if (codec === '.mp3') { - codec = 'mp4a.40.34'; - } else if (codec === 'msVo') { - codec = 'vorbis'; - } else if (codec === 'Opus') { - codec = 'opus'; - var dOps = findNamedBox(bytes, 'dOps'); - track.info.opus = parseOpusHead(dOps); // TODO: should this go into the webm code?? - // Firefox requires a codecDelay for opus playback - // see https://bugzilla.mozilla.org/show_bug.cgi?id=1276238 - - track.info.codecDelay = 6500000; - } else { - codec = codec.toLowerCase(); - } - /* eslint-enable */ - // flac, ac-3, ec-3, opus - - - track.codec = codec; -}; -export var parseTracks = function parseTracks(bytes, frameTable) { - if (frameTable === void 0) { - frameTable = true; - } - - bytes = toUint8(bytes); - var traks = findBox(bytes, ['moov', 'trak'], true); - var tracks = []; - traks.forEach(function (trak) { - var track = { - bytes: trak - }; - var mdia = findBox(trak, ['mdia'])[0]; - var hdlr = findBox(mdia, ['hdlr'])[0]; - var trakType = bytesToString(hdlr.subarray(8, 12)); - - if (trakType === 'soun') { - track.type = 'audio'; - } else if (trakType === 'vide') { - track.type = 'video'; - } else { - track.type = trakType; - } - - var tkhd = findBox(trak, ['tkhd'])[0]; - - if (tkhd) { - var view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - var tkhdVersion = view.getUint8(0); - track.number = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var mdhd = findBox(mdia, ['mdhd'])[0]; - - if (mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - track.timescale = (mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]) >>> 0; - } - - var stbl = findBox(mdia, ['minf', 'stbl'])[0]; - var stsd = findBox(stbl, ['stsd'])[0]; - var descriptionCount = bytesToNumber(stsd.subarray(4, 8)); - var offset = 8; // add codec and codec info - - while (descriptionCount--) { - var len = bytesToNumber(stsd.subarray(offset, offset + 4)); - var sampleDescriptor = stsd.subarray(offset + 4, offset + 4 + len); - addSampleDescription(track, sampleDescriptor); - offset += 4 + len; - } - - if (frameTable) { - track.frameTable = buildFrameTable(stbl, track.timescale); - } // codec has no sub parameters - - - tracks.push(track); - }); - return tracks; -}; -export var parseMediaInfo = function parseMediaInfo(bytes) { - var mvhd = findBox(bytes, ['moov', 'mvhd'], true)[0]; - - if (!mvhd || !mvhd.length) { - return; - } - - var info = {}; // ms to ns - // mvhd v1 has 8 byte duration and other fields too - - if (mvhd[0] === 1) { - info.timestampScale = bytesToNumber(mvhd.subarray(20, 24)); - info.duration = bytesToNumber(mvhd.subarray(24, 32)); - } else { - info.timestampScale = bytesToNumber(mvhd.subarray(12, 16)); - info.duration = bytesToNumber(mvhd.subarray(16, 20)); - } - - info.bytes = mvhd; - return info; -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/nal-helpers.js b/node_modules/@videojs/vhs-utils/es/nal-helpers.js deleted file mode 100644 index 29d5a67..0000000 --- a/node_modules/@videojs/vhs-utils/es/nal-helpers.js +++ /dev/null @@ -1,112 +0,0 @@ -import { bytesMatch, toUint8 } from './byte-helpers.js'; -export var NAL_TYPE_ONE = toUint8([0x00, 0x00, 0x00, 0x01]); -export var NAL_TYPE_TWO = toUint8([0x00, 0x00, 0x01]); -export var EMULATION_PREVENTION = toUint8([0x00, 0x00, 0x03]); -/** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - -export var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(bytes) { - var positions = []; - var i = 1; // Find all `Emulation Prevention Bytes` - - while (i < bytes.length - 2) { - if (bytesMatch(bytes.subarray(i, i + 3), EMULATION_PREVENTION)) { - positions.push(i + 2); - i++; - } - - i++; - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (positions.length === 0) { - return bytes; - } // Create a new array to hold the NAL unit data - - - var newLength = bytes.length - positions.length; - var newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === positions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - positions.shift(); - } - - newData[i] = bytes[sourceIndex]; - } - - return newData; -}; -export var findNal = function findNal(bytes, dataType, types, nalLimit) { - if (nalLimit === void 0) { - nalLimit = Infinity; - } - - bytes = toUint8(bytes); - types = [].concat(types); - var i = 0; - var nalStart; - var nalsFound = 0; // keep searching until: - // we reach the end of bytes - // we reach the maximum number of nals they want to seach - // NOTE: that we disregard nalLimit when we have found the start - // of the nal we want so that we can find the end of the nal we want. - - while (i < bytes.length && (nalsFound < nalLimit || nalStart)) { - var nalOffset = void 0; - - if (bytesMatch(bytes.subarray(i), NAL_TYPE_ONE)) { - nalOffset = 4; - } else if (bytesMatch(bytes.subarray(i), NAL_TYPE_TWO)) { - nalOffset = 3; - } // we are unsynced, - // find the next nal unit - - - if (!nalOffset) { - i++; - continue; - } - - nalsFound++; - - if (nalStart) { - return discardEmulationPreventionBytes(bytes.subarray(nalStart, i)); - } - - var nalType = void 0; - - if (dataType === 'h264') { - nalType = bytes[i + nalOffset] & 0x1f; - } else if (dataType === 'h265') { - nalType = bytes[i + nalOffset] >> 1 & 0x3f; - } - - if (types.indexOf(nalType) !== -1) { - nalStart = i + nalOffset; - } // nal header is 1 length for h264, and 2 for h265 - - - i += nalOffset + (dataType === 'h264' ? 1 : 2); - } - - return bytes.subarray(0, 0); -}; -export var findH264Nal = function findH264Nal(bytes, type, nalLimit) { - return findNal(bytes, 'h264', type, nalLimit); -}; -export var findH265Nal = function findH265Nal(bytes, type, nalLimit) { - return findNal(bytes, 'h265', type, nalLimit); -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/ogg-helpers.js b/node_modules/@videojs/vhs-utils/es/ogg-helpers.js deleted file mode 100644 index 78a6752..0000000 --- a/node_modules/@videojs/vhs-utils/es/ogg-helpers.js +++ /dev/null @@ -1,28 +0,0 @@ -import { bytesMatch, toUint8 } from './byte-helpers'; -var SYNC_WORD = toUint8([0x4f, 0x67, 0x67, 0x53]); -export var getPages = function getPages(bytes, start, end) { - if (end === void 0) { - end = Infinity; - } - - bytes = toUint8(bytes); - var pages = []; - var i = 0; - - while (i < bytes.length && pages.length < end) { - // we are unsynced, - // find the next syncword - if (!bytesMatch(bytes, SYNC_WORD, { - offset: i - })) { - i++; - continue; - } - - var segmentLength = bytes[i + 27]; - pages.push(bytes.subarray(i, i + 28 + segmentLength)); - i += pages[pages.length - 1].length; - } - - return pages.slice(start, end); -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/opus-helpers.js b/node_modules/@videojs/vhs-utils/es/opus-helpers.js deleted file mode 100644 index 45cc64e..0000000 --- a/node_modules/@videojs/vhs-utils/es/opus-helpers.js +++ /dev/null @@ -1,52 +0,0 @@ -export var OPUS_HEAD = new Uint8Array([// O, p, u, s -0x4f, 0x70, 0x75, 0x73, // H, e, a, d -0x48, 0x65, 0x61, 0x64]); // https://wiki.xiph.org/OggOpus -// https://vfrmaniac.fushizen.eu/contents/opus_in_isobmff.html -// https://opus-codec.org/docs/opusfile_api-0.7/structOpusHead.html - -export var parseOpusHead = function parseOpusHead(bytes) { - var view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); - var version = view.getUint8(0); // version 0, from mp4, does not use littleEndian. - - var littleEndian = version !== 0; - var config = { - version: version, - channels: view.getUint8(1), - preSkip: view.getUint16(2, littleEndian), - sampleRate: view.getUint32(4, littleEndian), - outputGain: view.getUint16(8, littleEndian), - channelMappingFamily: view.getUint8(10) - }; - - if (config.channelMappingFamily > 0 && bytes.length > 10) { - config.streamCount = view.getUint8(11); - config.twoChannelStreamCount = view.getUint8(12); - config.channelMapping = []; - - for (var c = 0; c < config.channels; c++) { - config.channelMapping.push(view.getUint8(13 + c)); - } - } - - return config; -}; -export var setOpusHead = function setOpusHead(config) { - var size = config.channelMappingFamily <= 0 ? 11 : 12 + config.channels; - var view = new DataView(new ArrayBuffer(size)); - var littleEndian = config.version !== 0; - view.setUint8(0, config.version); - view.setUint8(1, config.channels); - view.setUint16(2, config.preSkip, littleEndian); - view.setUint32(4, config.sampleRate, littleEndian); - view.setUint16(8, config.outputGain, littleEndian); - view.setUint8(10, config.channelMappingFamily); - - if (config.channelMappingFamily > 0) { - view.setUint8(11, config.streamCount); - config.channelMapping.foreach(function (cm, i) { - view.setUint8(12 + i, cm); - }); - } - - return new Uint8Array(view.buffer); -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/resolve-url.js b/node_modules/@videojs/vhs-utils/es/resolve-url.js deleted file mode 100644 index c3b0326..0000000 --- a/node_modules/@videojs/vhs-utils/es/resolve-url.js +++ /dev/null @@ -1,47 +0,0 @@ -import URLToolkit from 'url-toolkit'; -import window from 'global/window'; -var DEFAULT_LOCATION = 'http://example.com'; - -var resolveUrl = function resolveUrl(baseUrl, relativeUrl) { - // return early if we don't need to resolve - if (/^[a-z]+:/i.test(relativeUrl)) { - return relativeUrl; - } // if baseUrl is a data URI, ignore it and resolve everything relative to window.location - - - if (/^data:/.test(baseUrl)) { - baseUrl = window.location && window.location.href || ''; - } // IE11 supports URL but not the URL constructor - // feature detect the behavior we want - - - var nativeURL = typeof window.URL === 'function'; - var protocolLess = /^\/\//.test(baseUrl); // remove location if window.location isn't available (i.e. we're in node) - // and if baseUrl isn't an absolute url - - var removeLocation = !window.location && !/\/\//i.test(baseUrl); // if the base URL is relative then combine with the current location - - if (nativeURL) { - baseUrl = new window.URL(baseUrl, window.location || DEFAULT_LOCATION); - } else if (!/\/\//i.test(baseUrl)) { - baseUrl = URLToolkit.buildAbsoluteURL(window.location && window.location.href || '', baseUrl); - } - - if (nativeURL) { - var newUrl = new URL(relativeUrl, baseUrl); // if we're a protocol-less url, remove the protocol - // and if we're location-less, remove the location - // otherwise, return the url unmodified - - if (removeLocation) { - return newUrl.href.slice(DEFAULT_LOCATION.length); - } else if (protocolLess) { - return newUrl.href.slice(newUrl.protocol.length); - } - - return newUrl.href; - } - - return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl); -}; - -export default resolveUrl; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/riff-helpers.js b/node_modules/@videojs/vhs-utils/es/riff-helpers.js deleted file mode 100644 index 9129c13..0000000 --- a/node_modules/@videojs/vhs-utils/es/riff-helpers.js +++ /dev/null @@ -1,74 +0,0 @@ -import { toUint8, stringToBytes, bytesMatch } from './byte-helpers.js'; -var CONSTANTS = { - LIST: toUint8([0x4c, 0x49, 0x53, 0x54]), - RIFF: toUint8([0x52, 0x49, 0x46, 0x46]), - WAVE: toUint8([0x57, 0x41, 0x56, 0x45]) -}; - -var normalizePath = function normalizePath(path) { - if (typeof path === 'string') { - return stringToBytes(path); - } - - if (typeof path === 'number') { - return path; - } - - return path; -}; - -var normalizePaths = function normalizePaths(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map(function (p) { - return normalizePath(p); - }); -}; - -export var findFourCC = function findFourCC(bytes, paths) { - paths = normalizePaths(paths); - bytes = toUint8(bytes); - var results = []; - - if (!paths.length) { - // short-circuit the search for empty paths - return results; - } - - var i = 0; - - while (i < bytes.length) { - var type = bytes.subarray(i, i + 4); - var size = (bytes[i + 7] << 24 | bytes[i + 6] << 16 | bytes[i + 5] << 8 | bytes[i + 4]) >>> 0; // skip LIST/RIFF and get the actual type - - if (bytesMatch(type, CONSTANTS.LIST) || bytesMatch(type, CONSTANTS.RIFF) || bytesMatch(type, CONSTANTS.WAVE)) { - type = bytes.subarray(i + 8, i + 12); - i += 4; - size -= 4; - } - - var data = bytes.subarray(i + 8, i + 8 + size); - - if (bytesMatch(type, paths[0])) { - if (paths.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data); - } else { - // recursively search for the next box along the path - var subresults = findFourCC(data, paths.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i += 8 + data.length; - } // we've finished searching all of bytes - - - return results; -}; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/es/stream.js b/node_modules/@videojs/vhs-utils/es/stream.js deleted file mode 100644 index 8a3cc02..0000000 --- a/node_modules/@videojs/vhs-utils/es/stream.js +++ /dev/null @@ -1,121 +0,0 @@ -/** - * @file stream.js - */ - -/** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ -var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; -}(); - -export { Stream as default }; \ No newline at end of file diff --git a/node_modules/@videojs/vhs-utils/index.html b/node_modules/@videojs/vhs-utils/index.html deleted file mode 100644 index e3c7925..0000000 --- a/node_modules/@videojs/vhs-utils/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - @videojs/vhs-utils Demo - - - -

Test things with window.vhsUtils.* in the console

- - - - - diff --git a/node_modules/@videojs/vhs-utils/package.json b/node_modules/@videojs/vhs-utils/package.json deleted file mode 100644 index 42dcf81..0000000 --- a/node_modules/@videojs/vhs-utils/package.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "_from": "@videojs/vhs-utils@^3.0.2", - "_id": "@videojs/vhs-utils@3.0.2", - "_inBundle": false, - "_integrity": "sha512-r8Yas1/tNGsGRNoIaDJuiWiQgM0P2yaEnobgzw5JcBiEqxnS8EXoUm4QtKH7nJtnppZ1yqBx1agBZCvBMKXA2w==", - "_location": "/@videojs/vhs-utils", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@videojs/vhs-utils@^3.0.2", - "name": "@videojs/vhs-utils", - "escapedName": "@videojs%2fvhs-utils", - "scope": "@videojs", - "rawSpec": "^3.0.2", - "saveSpec": null, - "fetchSpec": "^3.0.2" - }, - "_requiredBy": [ - "/@videojs/http-streaming", - "/aes-decrypter", - "/m3u8-parser", - "/mpd-parser", - "/video.js" - ], - "_resolved": "https://registry.npmjs.org/@videojs/vhs-utils/-/vhs-utils-3.0.2.tgz", - "_shasum": "0203418ecaaff29bc33c69b6ad707787347b7614", - "_spec": "@videojs/vhs-utils@^3.0.2", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js", - "author": { - "name": "brandonocasey", - "email": "brandonocasey@gmail.com" - }, - "browser": "./dist/vhs-utils.js", - "browserslist": [ - "defaults", - "ie 11" - ], - "bugs": { - "url": "https://github.com/videojs/vhs-utils/issues" - }, - "bundleDependencies": false, - "dependencies": { - "@babel/runtime": "^7.12.5", - "global": "^4.4.0", - "url-toolkit": "^2.2.1" - }, - "deprecated": false, - "description": "Objects and functions shared throughtout @videojs/http-streaming code", - "devDependencies": { - "@babel/cli": "^7.12.8", - "@videojs/babel-config": "^0.2.0", - "@videojs/generator-helpers": "~2.0.1", - "karma": "^5.2.3", - "rollup": "^2.28.2", - "videojs-generate-karma-config": "~7.0.0", - "videojs-generate-rollup-config": "~6.0.0", - "videojs-generator-verify": "~3.0.3", - "videojs-standard": "^8.0.4" - }, - "engines": { - "node": ">=8", - "npm": ">=5" - }, - "files": [ - "CONTRIBUTING.md", - "es/", - "cjs/", - "dist/", - "docs/", - "index.html", - "scripts/", - "src/", - "test/" - ], - "generator-videojs-plugin": { - "version": "7.7.1" - }, - "homepage": "https://github.com/videojs/vhs-utils#readme", - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "keywords": [ - "videojs", - "videojs-plugin" - ], - "license": "MIT", - "lint-staged": { - "*.js": "vjsstandard --fix", - "README.md": "doctoc --notitle" - }, - "main": "./cjs/index.js", - "module": "./es/index.js", - "name": "@videojs/vhs-utils", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/videojs/vhs-utils.git" - }, - "scripts": { - "build": "npm-run-all -s clean -p build:*", - "build-prod": "cross-env-shell NO_TEST_BUNDLE=1 'npm run build'", - "build-test": "cross-env-shell TEST_BUNDLE_ONLY=1 'npm run build'", - "build:cjs": "babel-config-cjs -d ./cjs ./src", - "build:es": "babel-config-es -d ./es ./src", - "build:js": "rollup -c scripts/rollup.config.js", - "clean": "shx rm -rf ./dist ./test/dist ./cjs ./es && shx mkdir -p ./test/dist ./cjs ./es", - "lint": "vjsstandard", - "posttest": "shx cat test/dist/coverage/text.txt", - "prepublishOnly": "npm-run-all build-prod && vjsverify --verbose", - "preversion": "npm test", - "server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch", - "start": "npm-run-all -p server watch", - "test": "npm-run-all lint build-test && npm-run-all test:*", - "test:browser": "karma start scripts/karma.conf.js", - "test:node": "qunit test/dist/bundle.js", - "update-changelog": "conventional-changelog -p videojs -i CHANGELOG.md -s", - "version": "is-prerelease || npm run update-changelog && git add CHANGELOG.md", - "watch": "npm-run-all -p watch:*", - "watch:cjs": "npm run build:cjs -- -w", - "watch:es": "npm run build:es -- -w", - "watch:js": "npm run build:js -- -w" - }, - "version": "3.0.2", - "vjsstandard": { - "ignore": [ - "dist", - "cjs", - "es", - "docs", - "test/dist" - ] - } -} diff --git a/node_modules/@videojs/vhs-utils/scripts/create-test-data.js b/node_modules/@videojs/vhs-utils/scripts/create-test-data.js deleted file mode 100644 index cc2009c..0000000 --- a/node_modules/@videojs/vhs-utils/scripts/create-test-data.js +++ /dev/null @@ -1,96 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const baseDir = path.join(__dirname, '..'); -const formatDir = path.join(baseDir, 'test', 'fixtures', 'formats'); -const parsingDir = path.join(baseDir, 'test', 'fixtures', 'parsing'); - -const getFiles = (dir) => (fs.readdirSync(dir) || []).reduce((acc, d) => { - d = path.resolve(dir, d); - - const stat = fs.statSync(d); - - if (!stat.isDirectory()) { - return acc; - } - - const subfiles = fs.readdirSync(d).map((f) => path.resolve(d, f)); - - return acc.concat(subfiles); -}, []); - -const buildDataString = function(files, id) { - const data = {}; - - files.forEach((file) => { - // read the file directly as a buffer before converting to base64 - const base64 = fs.readFileSync(file).toString('base64'); - - data[path.basename(file)] = base64; - }); - - const dataExportStrings = Object.keys(data).reduce((acc, key) => { - // use a function since the segment may be cleared out on usage - acc.push(`${id}Files['${key}'] = () => { - cache['${key}'] = cache['${key}'] || base64ToUint8Array('${data[key]}'); - const dest = new Uint8Array(cache['${key}'].byteLength); - dest.set(cache['${key}']); - return dest; - };`); - return acc; - }, []); - - const file = - '/* istanbul ignore file */\n' + - '\n' + - `import base64ToUint8Array from "${path.resolve(baseDir, 'src/decode-b64-to-uint8-array.js')}";\n` + - 'const cache = {};\n' + - `const ${id}Files = {};\n` + - dataExportStrings.join('\n') + - `export default ${id}Files`; - - return file; -}; - -/* we refer to them as .js, so that babel and other plugins can work on them */ -const formatsKey = 'create-test-data!formats.js'; -const parsingKey = 'create-test-data!parsing.js'; - -module.exports = function() { - return { - name: 'createTestData', - buildStart() { - this.addWatchFile(formatDir); - this.addWatchFile(parsingDir); - - getFiles(formatDir).forEach((file) => this.addWatchFile(file)); - getFiles(parsingDir).forEach((file) => this.addWatchFile(file)); - }, - resolveId(importee, importer) { - // if this is not an id we can resolve return - if (importee.indexOf('create-test-data!') !== 0) { - return; - } - - const name = importee.split('!')[1]; - - if (name.indexOf('formats') !== -1) { - return formatsKey; - } - - if (name.indexOf('parsing') !== -1) { - return parsingKey; - } - - return null; - }, - load(id) { - if (id === formatsKey) { - return buildDataString.call(this, getFiles(formatDir), 'format'); - } - - if (id === parsingKey) { - return buildDataString.call(this, getFiles(parsingDir), 'parsing'); - } - } - }; -}; diff --git a/node_modules/@videojs/vhs-utils/scripts/karma.conf.js b/node_modules/@videojs/vhs-utils/scripts/karma.conf.js deleted file mode 100644 index da8e7f6..0000000 --- a/node_modules/@videojs/vhs-utils/scripts/karma.conf.js +++ /dev/null @@ -1,16 +0,0 @@ -const generate = require('videojs-generate-karma-config'); - -module.exports = function(config) { - - // see https://github.com/videojs/videojs-generate-karma-config - // for options - const options = { - serverBrowsers() { - return []; - } - }; - - config = generate(config, options); - - // any other custom stuff not supported by options here! -}; diff --git a/node_modules/@videojs/vhs-utils/scripts/rollup.config.js b/node_modules/@videojs/vhs-utils/scripts/rollup.config.js deleted file mode 100644 index e3e15a7..0000000 --- a/node_modules/@videojs/vhs-utils/scripts/rollup.config.js +++ /dev/null @@ -1,28 +0,0 @@ -const createTestData = require('./create-test-data.js'); -const generate = require('videojs-generate-rollup-config'); -// see https://github.com/videojs/videojs-generate-rollup-config -// for options -const options = { - input: 'src/index.js', - exportName: 'vhsUtils', - distName: 'vhs-utils', - primedPlugins(defaults) { - return Object.assign(defaults, { - createTestData: createTestData() - }); - }, - plugins(defaults) { - defaults.test.splice(0, 0, 'createTestData'); - return defaults; - } -}; -const config = generate(options); - -if (config.builds.module) { - delete config.builds.module; -} - -// Add additonal builds/customization here! - -// export the builds to rollup -export default Object.values(config.builds); diff --git a/node_modules/@videojs/vhs-utils/src/byte-helpers.js b/node_modules/@videojs/vhs-utils/src/byte-helpers.js deleted file mode 100644 index d33200c..0000000 --- a/node_modules/@videojs/vhs-utils/src/byte-helpers.js +++ /dev/null @@ -1,272 +0,0 @@ -import window from 'global/window'; - -// const log2 = Math.log2 ? Math.log2 : (x) => (Math.log(x) / Math.log(2)); - -const repeat = function(str, len) { - let acc = ''; - - while (len--) { - acc += str; - } - - return acc; -}; - -// count the number of bits it would take to represent a number -// we used to do this with log2 but BigInt does not support builtin math -// Math.ceil(log2(x)); -export const countBits = (x) => x.toString(2).length; -// count the number of whole bytes it would take to represent a number -export const countBytes = (x) => Math.ceil(countBits(x) / 8); -export const padStart = (b, len, str = ' ') => (repeat(str, len) + b.toString()).slice(-len); -export const isTypedArray = (obj) => ArrayBuffer.isView(obj); - -export const toUint8 = function(bytes) { - if (bytes instanceof Uint8Array) { - return bytes; - } - - if (!Array.isArray(bytes) && !isTypedArray(bytes) && !(bytes instanceof ArrayBuffer)) { - // any non-number or NaN leads to empty uint8array - // eslint-disable-next-line - if (typeof bytes !== 'number' || (typeof bytes === 'number' && bytes !== bytes)) { - bytes = 0; - } else { - bytes = [bytes]; - } - } - - return new Uint8Array( - bytes && bytes.buffer || bytes, - bytes && bytes.byteOffset || 0, - bytes && bytes.byteLength || 0 - ); -}; - -export const toHexString = function(bytes) { - bytes = toUint8(bytes); - let str = ''; - - for (let i = 0; i < bytes.length; i++) { - str += padStart(bytes[i].toString(16), 2, '0'); - } - - return str; -}; - -export const toBinaryString = function(bytes) { - bytes = toUint8(bytes); - let str = ''; - - for (let i = 0; i < bytes.length; i++) { - str += padStart(bytes[i].toString(2), 8, '0'); - } - - return str; -}; -const BigInt = window.BigInt || Number; - -const BYTE_TABLE = [ - BigInt('0x1'), - BigInt('0x100'), - BigInt('0x10000'), - BigInt('0x1000000'), - BigInt('0x100000000'), - BigInt('0x10000000000'), - BigInt('0x1000000000000'), - BigInt('0x100000000000000'), - BigInt('0x10000000000000000') -]; - -export const ENDIANNESS = (function() { - const a = new Uint16Array([0xFFCC]); - const b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength); - - if (b[0] === 0xFF) { - return 'big'; - } - - if (b[0] === 0xCC) { - return 'little'; - } - - return 'unknown'; -})(); - -export const IS_BIG_ENDIAN = ENDIANNESS === 'big'; -export const IS_LITTLE_ENDIAN = ENDIANNESS === 'little'; - -export const bytesToNumber = function(bytes, {signed = false, le = false} = {}) { - bytes = toUint8(bytes); - - const fn = le ? 'reduce' : 'reduceRight'; - const obj = bytes[fn] ? bytes[fn] : Array.prototype[fn]; - - let number = obj.call(bytes, function(total, byte, i) { - const exponent = le ? i : Math.abs(i + 1 - bytes.length); - - return total + (BigInt(byte) * BYTE_TABLE[exponent]); - }, BigInt(0)); - - if (signed) { - const max = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1); - - number = BigInt(number); - - if (number > max) { - number -= max; - number -= max; - number -= BigInt(2); - } - } - - return Number(number); -}; - -export const numberToBytes = function(number, {le = false} = {}) { - // eslint-disable-next-line - if ((typeof number !== 'bigint' && typeof number !== 'number') || (typeof number === 'number' && number !== number)) { - number = 0; - } - - number = BigInt(number); - - const byteCount = countBytes(number); - - const bytes = new Uint8Array(new ArrayBuffer(byteCount)); - - for (let i = 0; i < byteCount; i++) { - const byteIndex = le ? i : Math.abs(i + 1 - bytes.length); - - bytes[byteIndex] = Number((number / BYTE_TABLE[i]) & BigInt(0xFF)); - - if (number < 0) { - bytes[byteIndex] = Math.abs(~bytes[byteIndex]); - bytes[byteIndex] -= i === 0 ? 1 : 2; - } - } - - return bytes; -}; -export const bytesToString = (bytes) => { - if (!bytes) { - return ''; - } - - // TODO: should toUint8 handle cases where we only have 8 bytes - // but report more since this is a Uint16+ Array? - bytes = Array.prototype.slice.call(bytes); - - const string = String.fromCharCode.apply(null, toUint8(bytes)); - - try { - return decodeURIComponent(escape(string)); - } catch (e) { - // if decodeURIComponent/escape fails, we are dealing with partial - // or full non string data. Just return the potentially garbled string. - } - - return string; -}; - -export const stringToBytes = (string, stringIsBytes) => { - if (typeof string !== 'string' && string && typeof string.toString === 'function') { - string = string.toString(); - } - - if (typeof string !== 'string') { - return new Uint8Array(); - } - - // If the string already is bytes, we don't have to do this - // otherwise we do this so that we split multi length characters - // into individual bytes - if (!stringIsBytes) { - string = unescape(encodeURIComponent(string)); - } - - const view = new Uint8Array(string.length); - - for (let i = 0; i < string.length; i++) { - view[i] = string.charCodeAt(i); - } - return view; -}; - -export const concatTypedArrays = (...buffers) => { - buffers = buffers.filter((b) => b && (b.byteLength || b.length) && typeof b !== 'string'); - - if (buffers.length <= 1) { - // for 0 length we will return empty uint8 - // for 1 length we return the first uint8 - return toUint8(buffers[0]); - } - - const totalLen = buffers.reduce((total, buf, i) => total + (buf.byteLength || buf.length), 0); - const tempBuffer = new Uint8Array(totalLen); - - let offset = 0; - - buffers.forEach(function(buf) { - buf = toUint8(buf); - - tempBuffer.set(buf, offset); - offset += buf.byteLength; - }); - - return tempBuffer; -}; - -/** - * Check if the bytes "b" are contained within bytes "a". - * - * @param {Uint8Array|Array} a - * Bytes to check in - * - * @param {Uint8Array|Array} b - * Bytes to check for - * - * @param {Object} options - * options - * - * @param {Array|Uint8Array} [offset=0] - * offset to use when looking at bytes in a - * - * @param {Array|Uint8Array} [mask=[]] - * mask to use on bytes before comparison. - * - * @return {boolean} - * If all bytes in b are inside of a, taking into account - * bit masks. - */ -export const bytesMatch = (a, b, {offset = 0, mask = []} = {}) => { - a = toUint8(a); - b = toUint8(b); - - // ie 11 does not support uint8 every - const fn = b.every ? b.every : Array.prototype.every; - - return b.length && - a.length - offset >= b.length && - // ie 11 doesn't support every on uin8 - fn.call(b, (bByte, i) => { - const aByte = (mask[i] ? (mask[i] & a[offset + i]) : a[offset + i]); - - return bByte === aByte; - }); -}; - -export const sliceBytes = function(src, start, end) { - if (Uint8Array.prototype.slice) { - return Uint8Array.prototype.slice.call(src, start, end); - } - return new Uint8Array(Array.prototype.slice.call(src, start, end)); -}; - -export const reverseBytes = function(src) { - if (src.reverse) { - return src.reverse(); - } - - return Array.prototype.reverse.call(src); -}; diff --git a/node_modules/@videojs/vhs-utils/src/codec-helpers.js b/node_modules/@videojs/vhs-utils/src/codec-helpers.js deleted file mode 100644 index 372869d..0000000 --- a/node_modules/@videojs/vhs-utils/src/codec-helpers.js +++ /dev/null @@ -1,106 +0,0 @@ -import {padStart, toHexString, toBinaryString} from './byte-helpers.js'; - -// https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax -// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/codecs_parameter#AV1 -export const getAv1Codec = function(bytes) { - let codec = ''; - const profile = bytes[1] >>> 3; - const level = bytes[1] & 0x1F; - const tier = bytes[2] >>> 7; - const highBitDepth = (bytes[2] & 0x40) >> 6; - const twelveBit = (bytes[2] & 0x20) >> 5; - const monochrome = (bytes[2] & 0x10) >> 4; - const chromaSubsamplingX = (bytes[2] & 0x08) >> 3; - const chromaSubsamplingY = (bytes[2] & 0x04) >> 2; - const chromaSamplePosition = bytes[2] & 0x03; - - codec += `${profile}.${padStart(level, 2, '0')}`; - - if (tier === 0) { - codec += 'M'; - } else if (tier === 1) { - codec += 'H'; - } - - let bitDepth; - - if (profile === 2 && highBitDepth) { - bitDepth = twelveBit ? 12 : 10; - } else { - bitDepth = highBitDepth ? 10 : 8; - } - - codec += `.${padStart(bitDepth, 2, '0')}`; - - // TODO: can we parse color range?? - codec += `.${monochrome}`; - codec += `.${chromaSubsamplingX}${chromaSubsamplingY}${chromaSamplePosition}`; - - return codec; -}; - -export const getAvcCodec = function(bytes) { - const profileId = toHexString(bytes[1]); - const constraintFlags = toHexString(bytes[2] & 0xFC); - const levelId = toHexString(bytes[3]); - - return `${profileId}${constraintFlags}${levelId}`; -}; - -export const getHvcCodec = function(bytes) { - let codec = ''; - const profileSpace = bytes[1] >> 6; - const profileId = bytes[1] & 0x1F; - const tierFlag = (bytes[1] & 0x20) >> 5; - - const profileCompat = bytes.subarray(2, 6); - const constraintIds = bytes.subarray(6, 12); - const levelId = bytes[12]; - - if (profileSpace === 1) { - codec += 'A'; - } else if (profileSpace === 2) { - codec += 'B'; - } else if (profileSpace === 3) { - codec += 'C'; - } - - codec += `${profileId}.`; - - // ffmpeg does this in big endian - let profileCompatVal = parseInt(toBinaryString(profileCompat).split('').reverse().join(''), 2); - - // apple does this in little endian... - if (profileCompatVal > 255) { - profileCompatVal = parseInt(toBinaryString(profileCompat), 2); - } - - codec += `${profileCompatVal.toString(16)}.`; - - if (tierFlag === 0) { - codec += 'L'; - } else { - codec += 'H'; - } - - codec += levelId; - - let constraints = ''; - - for (let i = 0; i < constraintIds.length; i++) { - const v = constraintIds[i]; - - if (v) { - if (constraints) { - constraints += '.'; - } - constraints += v.toString(16); - } - } - - if (constraints) { - codec += `.${constraints}`; - } - - return codec; -}; diff --git a/node_modules/@videojs/vhs-utils/src/codecs.js b/node_modules/@videojs/vhs-utils/src/codecs.js deleted file mode 100644 index 7974142..0000000 --- a/node_modules/@videojs/vhs-utils/src/codecs.js +++ /dev/null @@ -1,225 +0,0 @@ -import window from 'global/window'; - -const regexs = { - // to determine mime types - mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/, - webm: /^(vp0?[89]|av0?1|opus|vorbis)/, - ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/, - - // to determine if a codec is audio or video - video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/, - audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/, - text: /^(stpp.ttml.im1t)/, - - // mux.js support regex - muxerVideo: /^(avc0?1)/, - muxerAudio: /^(mp4a)/, - // match nothing as muxer does not support text right now. - // there cannot never be a character before the start of a string - // so this matches nothing. - muxerText: /a^/ -}; - -const mediaTypes = ['video', 'audio', 'text']; -const upperMediaTypes = ['Video', 'Audio', 'Text']; - -/** - * Replace the old apple-style `avc1.
.
` codec string with the standard - * `avc1.` - * - * @param {string} codec - * Codec string to translate - * @return {string} - * The translated codec string - */ -export const translateLegacyCodec = function(codec) { - if (!codec) { - return codec; - } - - return codec.replace(/avc1\.(\d+)\.(\d+)/i, function(orig, profile, avcLevel) { - const profileHex = ('00' + Number(profile).toString(16)).slice(-2); - const avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2); - - return 'avc1.' + profileHex + '00' + avcLevelHex; - }); -}; - -/** - * Replace the old apple-style `avc1.
.
` codec strings with the standard - * `avc1.` - * - * @param {string[]} codecs - * An array of codec strings to translate - * @return {string[]} - * The translated array of codec strings - */ -export const translateLegacyCodecs = function(codecs) { - return codecs.map(translateLegacyCodec); -}; - -/** - * Replace codecs in the codec string with the old apple-style `avc1.
.
` to the - * standard `avc1.`. - * - * @param {string} codecString - * The codec string - * @return {string} - * The codec string with old apple-style codecs replaced - * - * @private - */ -export const mapLegacyAvcCodecs = function(codecString) { - return codecString.replace(/avc1\.(\d+)\.(\d+)/i, (match) => { - return translateLegacyCodecs([match])[0]; - }); -}; - -/** - * @typedef {Object} ParsedCodecInfo - * @property {number} codecCount - * Number of codecs parsed - * @property {string} [videoCodec] - * Parsed video codec (if found) - * @property {string} [videoObjectTypeIndicator] - * Video object type indicator (if found) - * @property {string|null} audioProfile - * Audio profile - */ - -/** - * Parses a codec string to retrieve the number of codecs specified, the video codec and - * object type indicator, and the audio profile. - * - * @param {string} [codecString] - * The codec string to parse - * @return {ParsedCodecInfo} - * Parsed codec info - */ -export const parseCodecs = function(codecString = '') { - const codecs = codecString.split(','); - const result = []; - - codecs.forEach(function(codec) { - codec = codec.trim(); - let codecType; - - mediaTypes.forEach(function(name) { - const match = regexs[name].exec(codec.toLowerCase()); - - if (!match || match.length <= 1) { - return; - } - codecType = name; - - // maintain codec case - const type = codec.substring(0, match[1].length); - const details = codec.replace(type, ''); - - result.push({type, details, mediaType: name}); - }); - - if (!codecType) { - result.push({type: codec, details: '', mediaType: 'unknown'}); - } - }); - - return result; -}; - -/** - * Returns a ParsedCodecInfo object for the default alternate audio playlist if there is - * a default alternate audio playlist for the provided audio group. - * - * @param {Object} master - * The master playlist - * @param {string} audioGroupId - * ID of the audio group for which to find the default codec info - * @return {ParsedCodecInfo} - * Parsed codec info - */ -export const codecsFromDefault = (master, audioGroupId) => { - if (!master.mediaGroups.AUDIO || !audioGroupId) { - return null; - } - - const audioGroup = master.mediaGroups.AUDIO[audioGroupId]; - - if (!audioGroup) { - return null; - } - - for (const name in audioGroup) { - const audioType = audioGroup[name]; - - if (audioType.default && audioType.playlists) { - // codec should be the same for all playlists within the audio type - return parseCodecs(audioType.playlists[0].attributes.CODECS); - } - } - - return null; -}; - -export const isVideoCodec = (codec = '') => regexs.video.test(codec.trim().toLowerCase()); -export const isAudioCodec = (codec = '') => regexs.audio.test(codec.trim().toLowerCase()); -export const isTextCodec = (codec = '') => regexs.text.test(codec.trim().toLowerCase()); - -export const getMimeForCodec = (codecString) => { - if (!codecString || typeof codecString !== 'string') { - return; - } - const codecs = codecString - .toLowerCase() - .split(',') - .map((c) => translateLegacyCodec(c.trim())); - - // default to video type - let type = 'video'; - - // only change to audio type if the only codec we have is - // audio - if (codecs.length === 1 && isAudioCodec(codecs[0])) { - type = 'audio'; - } else if (codecs.length === 1 && isTextCodec(codecs[0])) { - // text uses application/ for now - type = 'application'; - } - - // default the container to mp4 - let container = 'mp4'; - - // every codec must be able to go into the container - // for that container to be the correct one - if (codecs.every((c) => regexs.mp4.test(c))) { - container = 'mp4'; - } else if (codecs.every((c) => regexs.webm.test(c))) { - container = 'webm'; - } else if (codecs.every((c) => regexs.ogg.test(c))) { - container = 'ogg'; - } - - return `${type}/${container};codecs="${codecString}"`; -}; - -export const browserSupportsCodec = (codecString = '') => window.MediaSource && - window.MediaSource.isTypeSupported && - window.MediaSource.isTypeSupported(getMimeForCodec(codecString)) || false; - -export const muxerSupportsCodec = (codecString = '') => codecString.toLowerCase().split(',').every((codec) => { - codec = codec.trim(); - - // any match is supported. - for (let i = 0; i < upperMediaTypes.length; i++) { - const type = upperMediaTypes[i]; - - if (regexs[`muxer${type}`].test(codec)) { - return true; - } - } - - return false; -}); - -export const DEFAULT_AUDIO_CODEC = 'mp4a.40.2'; -export const DEFAULT_VIDEO_CODEC = 'avc1.4d400d'; diff --git a/node_modules/@videojs/vhs-utils/src/containers.js b/node_modules/@videojs/vhs-utils/src/containers.js deleted file mode 100644 index ae90fef..0000000 --- a/node_modules/@videojs/vhs-utils/src/containers.js +++ /dev/null @@ -1,172 +0,0 @@ -import {toUint8, bytesMatch} from './byte-helpers.js'; -import {findBox} from './mp4-helpers.js'; -import {findEbml, EBML_TAGS} from './ebml-helpers.js'; -import {getId3Offset} from './id3-helpers.js'; -import {findH264Nal, findH265Nal} from './nal-helpers.js'; - -const CONSTANTS = { - // "webm" string literal in hex - 'webm': toUint8([0x77, 0x65, 0x62, 0x6d]), - - // "matroska" string literal in hex - 'matroska': toUint8([0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61]), - - // "fLaC" string literal in hex - 'flac': toUint8([0x66, 0x4c, 0x61, 0x43]), - - // "OggS" string literal in hex - 'ogg': toUint8([0x4f, 0x67, 0x67, 0x53]), - - // ac-3 sync byte, also works for ec-3 as that is simply a codec - // of ac-3 - 'ac3': toUint8([0x0b, 0x77]), - - // "RIFF" string literal in hex used for wav and avi - 'riff': toUint8([0x52, 0x49, 0x46, 0x46]), - - // "AVI" string literal in hex - 'avi': toUint8([0x41, 0x56, 0x49]), - - // "WAVE" string literal in hex - 'wav': toUint8([0x57, 0x41, 0x56, 0x45]), - - // "ftyp3g" string literal in hex - '3gp': toUint8([0x66, 0x74, 0x79, 0x70, 0x33, 0x67]), - - // "ftyp" string literal in hex - 'mp4': toUint8([0x66, 0x74, 0x79, 0x70]), - - // "styp" string literal in hex - 'fmp4': toUint8([0x73, 0x74, 0x79, 0x70]), - - // "ftyp" string literal in hex - 'mov': toUint8([0x66, 0x74, 0x79, 0x70, 0x71, 0x74]) -}; - -const _isLikely = { - aac(bytes) { - const offset = getId3Offset(bytes); - - return bytesMatch(bytes, [0xFF, 0x10], {offset, mask: [0xFF, 0x16]}); - }, - - mp3(bytes) { - const offset = getId3Offset(bytes); - - return bytesMatch(bytes, [0xFF, 0x02], {offset, mask: [0xFF, 0x06]}); - }, - - webm(bytes) { - const docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; - - // check if DocType EBML tag is webm - return bytesMatch(docType, CONSTANTS.webm); - }, - - mkv(bytes) { - const docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; - - // check if DocType EBML tag is matroska - return bytesMatch(docType, CONSTANTS.matroska); - }, - - mp4(bytes) { - return !_isLikely['3gp'](bytes) && !_isLikely.mov(bytes) && - (bytesMatch(bytes, CONSTANTS.mp4, {offset: 4}) || - bytesMatch(bytes, CONSTANTS.fmp4, {offset: 4})); - }, - mov(bytes) { - return bytesMatch(bytes, CONSTANTS.mov, {offset: 4}); - }, - '3gp'(bytes) { - return bytesMatch(bytes, CONSTANTS['3gp'], {offset: 4}); - }, - ac3(bytes) { - const offset = getId3Offset(bytes); - - return bytesMatch(bytes, CONSTANTS.ac3, {offset}); - }, - - ts(bytes) { - if (bytes.length < 189 && bytes.length >= 1) { - return bytes[0] === 0x47; - } - - let i = 0; - - // check the first 376 bytes for two matching sync bytes - while (i + 188 < bytes.length && i < 188) { - if (bytes[i] === 0x47 && bytes[i + 188] === 0x47) { - return true; - } - i += 1; - } - - return false; - }, - - flac(bytes) { - const offset = getId3Offset(bytes); - - return bytesMatch(bytes, CONSTANTS.flac, {offset}); - }, - ogg(bytes) { - return bytesMatch(bytes, CONSTANTS.ogg); - }, - avi(bytes) { - return bytesMatch(bytes, CONSTANTS.riff) && - bytesMatch(bytes, CONSTANTS.avi, {offset: 8}); - }, - wav(bytes) { - return bytesMatch(bytes, CONSTANTS.riff) && - bytesMatch(bytes, CONSTANTS.wav, {offset: 8}); - }, - 'h264'(bytes) { - // find seq_parameter_set_rbsp - return findH264Nal(bytes, 7, 3).length; - }, - 'h265'(bytes) { - // find video_parameter_set_rbsp or seq_parameter_set_rbsp - return findH265Nal(bytes, [32, 33], 3).length; - } -}; - -// get all the isLikely functions -// but make sure 'ts' is above h264 and h265 -// but below everything else as it is the least specific -const isLikelyTypes = Object.keys(_isLikely) - // remove ts, h264, h265 - .filter((t) => t !== 'ts' && t !== 'h264' && t !== 'h265') - // add it back to the bottom - .concat(['ts', 'h264', 'h265']); - -// make sure we are dealing with uint8 data. -isLikelyTypes.forEach(function(type) { - const isLikelyFn = _isLikely[type]; - - _isLikely[type] = (bytes) => isLikelyFn(toUint8(bytes)); -}); - -// export after wrapping -export const isLikely = _isLikely; - -// A useful list of file signatures can be found here -// https://en.wikipedia.org/wiki/List_of_file_signatures -export const detectContainerForBytes = (bytes) => { - bytes = toUint8(bytes); - - for (let i = 0; i < isLikelyTypes.length; i++) { - const type = isLikelyTypes[i]; - - if (isLikely[type](bytes)) { - return type; - } - } - - return ''; -}; - -// fmp4 is not a container -export const isLikelyFmp4MediaSegment = (bytes) => { - return findBox(bytes, ['moof']).length > 0; -}; diff --git a/node_modules/@videojs/vhs-utils/src/decode-b64-to-uint8-array.js b/node_modules/@videojs/vhs-utils/src/decode-b64-to-uint8-array.js deleted file mode 100644 index 8948b3d..0000000 --- a/node_modules/@videojs/vhs-utils/src/decode-b64-to-uint8-array.js +++ /dev/null @@ -1,13 +0,0 @@ -import window from 'global/window'; - -const atob = (s) => window.atob ? window.atob(s) : Buffer.from(s, 'base64').toString('binary'); - -export default function decodeB64ToUint8Array(b64Text) { - const decodedString = atob(b64Text); - const array = new Uint8Array(decodedString.length); - - for (let i = 0; i < decodedString.length; i++) { - array[i] = decodedString.charCodeAt(i); - } - return array; -} diff --git a/node_modules/@videojs/vhs-utils/src/ebml-helpers.js b/node_modules/@videojs/vhs-utils/src/ebml-helpers.js deleted file mode 100644 index 0c47c19..0000000 --- a/node_modules/@videojs/vhs-utils/src/ebml-helpers.js +++ /dev/null @@ -1,503 +0,0 @@ -import { - toUint8, - bytesToNumber, - bytesMatch, - bytesToString, - numberToBytes, - padStart -} from './byte-helpers'; -import {getAvcCodec, getHvcCodec, getAv1Codec} from './codec-helpers.js'; - -// relevant specs for this parser: -// https://matroska-org.github.io/libebml/specs.html -// https://www.matroska.org/technical/elements.html -// https://www.webmproject.org/docs/container/ - -export const EBML_TAGS = { - EBML: toUint8([0x1A, 0x45, 0xDF, 0xA3]), - DocType: toUint8([0x42, 0x82]), - Segment: toUint8([0x18, 0x53, 0x80, 0x67]), - SegmentInfo: toUint8([0x15, 0x49, 0xA9, 0x66]), - Tracks: toUint8([0x16, 0x54, 0xAE, 0x6B]), - Track: toUint8([0xAE]), - TrackNumber: toUint8([0xd7]), - DefaultDuration: toUint8([0x23, 0xe3, 0x83]), - TrackEntry: toUint8([0xAE]), - TrackType: toUint8([0x83]), - FlagDefault: toUint8([0x88]), - CodecID: toUint8([0x86]), - CodecPrivate: toUint8([0x63, 0xA2]), - VideoTrack: toUint8([0xe0]), - AudioTrack: toUint8([0xe1]), - - // Not used yet, but will be used for live webm/mkv - // see https://www.matroska.org/technical/basics.html#block-structure - // see https://www.matroska.org/technical/basics.html#simpleblock-structure - Cluster: toUint8([0x1F, 0x43, 0xB6, 0x75]), - Timestamp: toUint8([0xE7]), - TimestampScale: toUint8([0x2A, 0xD7, 0xB1]), - BlockGroup: toUint8([0xA0]), - BlockDuration: toUint8([0x9B]), - Block: toUint8([0xA1]), - SimpleBlock: toUint8([0xA3]) -}; - -/** - * This is a simple table to determine the length - * of things in ebml. The length is one based (starts at 1, - * rather than zero) and for every zero bit before a one bit - * we add one to length. We also need this table because in some - * case we have to xor all the length bits from another value. - */ -const LENGTH_TABLE = [ - 0b10000000, - 0b01000000, - 0b00100000, - 0b00010000, - 0b00001000, - 0b00000100, - 0b00000010, - 0b00000001 -]; - -const getLength = function(byte) { - let len = 1; - - for (let i = 0; i < LENGTH_TABLE.length; i++) { - if (byte & LENGTH_TABLE[i]) { - break; - } - - len++; - } - - return len; -}; - -// length in ebml is stored in the first 4 to 8 bits -// of the first byte. 4 for the id length and 8 for the -// data size length. Length is measured by converting the number to binary -// then 1 + the number of zeros before a 1 is encountered starting -// from the left. -const getvint = function(bytes, offset, removeLength = true, signed = false) { - const length = getLength(bytes[offset]); - let valueBytes = bytes.subarray(offset, offset + length); - - // NOTE that we do **not** subarray here because we need to copy these bytes - // as they will be modified below to remove the dataSizeLen bits and we do not - // want to modify the original data. normally we could just call slice on - // uint8array but ie 11 does not support that... - if (removeLength) { - valueBytes = Array.prototype.slice.call(bytes, offset, offset + length); - valueBytes[0] ^= LENGTH_TABLE[length - 1]; - } - - return { - length, - value: bytesToNumber(valueBytes, {signed}), - bytes: valueBytes - }; -}; - -const normalizePath = function(path) { - if (typeof path === 'string') { - return path.match(/.{1,2}/g).map((p) => normalizePath(p)); - } - - if (typeof path === 'number') { - return numberToBytes(path); - } - - return path; -}; - -const normalizePaths = function(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map((p) => normalizePath(p)); -}; - -const getInfinityDataSize = (id, bytes, offset) => { - if (offset >= bytes.length) { - return bytes.length; - } - const innerid = getvint(bytes, offset, false); - - if (bytesMatch(id.bytes, innerid.bytes)) { - return offset; - } - - const dataHeader = getvint(bytes, offset + innerid.length); - - return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length); -}; - -/** - * Notes on the EBLM format. - * - * EBLM uses "vints" tags. Every vint tag contains - * two parts - * - * 1. The length from the first byte. You get this by - * converting the byte to binary and counting the zeros - * before a 1. Then you add 1 to that. Examples - * 00011111 = length 4 because there are 3 zeros before a 1. - * 00100000 = length 3 because there are 2 zeros before a 1. - * 00000011 = length 7 because there are 6 zeros before a 1. - * - * 2. The bits used for length are removed from the first byte - * Then all the bytes are merged into a value. NOTE: this - * is not the case for id ebml tags as there id includes - * length bits. - * - */ -export const findEbml = function(bytes, paths) { - paths = normalizePaths(paths); - bytes = toUint8(bytes); - let results = []; - - if (!paths.length) { - return results; - } - - let i = 0; - - while (i < bytes.length) { - const id = getvint(bytes, i, false); - const dataHeader = getvint(bytes, i + id.length); - const dataStart = i + id.length + dataHeader.length; - - // dataSize is unknown or this is a live stream - if (dataHeader.value === 0x7f) { - dataHeader.value = getInfinityDataSize(id, bytes, dataStart); - - if (dataHeader.value !== bytes.length) { - dataHeader.value -= dataStart; - } - } - const dataEnd = (dataStart + dataHeader.value) > bytes.length ? bytes.length : (dataStart + dataHeader.value); - const data = bytes.subarray(dataStart, dataEnd); - - if (bytesMatch(paths[0], id.bytes)) { - if (paths.length === 1) { - // this is the end of the paths and we've found the tag we were - // looking for - results.push(data); - } else { - // recursively search for the next tag inside of the data - // of this one - results = results.concat(findEbml(data, paths.slice(1))); - } - } - - const totalLength = id.length + dataHeader.length + data.length; - - // move past this tag entirely, we are not looking for it - i += totalLength; - } - - return results; -}; - -// see https://www.matroska.org/technical/basics.html#block-structure -export const decodeBlock = function(block, type, timestampScale, clusterTimestamp) { - let duration; - - if (type === 'group') { - duration = findEbml(block, [EBML_TAGS.BlockDuration])[0]; - if (duration) { - duration = bytesToNumber(duration); - duration = (((1 / timestampScale) * (duration)) * timestampScale) / 1000; - } - block = findEbml(block, [EBML_TAGS.Block])[0]; - type = 'block'; - // treat data as a block after this point - } - const dv = new DataView(block.buffer, block.byteOffset, block.byteLength); - const trackNumber = getvint(block, 0); - const timestamp = dv.getInt16(trackNumber.length, false); - const flags = block[trackNumber.length + 2]; - const data = block.subarray(trackNumber.length + 3); - // pts/dts in seconds - const ptsdts = (((1 / timestampScale) * (clusterTimestamp + timestamp)) * timestampScale) / 1000; - - // return the frame - const parsed = { - duration, - trackNumber: trackNumber.value, - keyframe: type === 'simple' && (flags >> 7) === 1, - invisible: ((flags & 0x08) >> 3) === 1, - lacing: ((flags & 0x06) >> 1), - discardable: type === 'simple' && (flags & 0x01) === 1, - frames: [], - pts: ptsdts, - dts: ptsdts, - timestamp - }; - - if (!parsed.lacing) { - parsed.frames.push(data); - return parsed; - } - - const numberOfFrames = data[0] + 1; - - const frameSizes = []; - let offset = 1; - - // Fixed - if (parsed.lacing === 2) { - const sizeOfFrame = (data.length - offset) / numberOfFrames; - - for (let i = 0; i < numberOfFrames; i++) { - frameSizes.push(sizeOfFrame); - } - } - - // xiph - if (parsed.lacing === 1) { - for (let i = 0; i < numberOfFrames - 1; i++) { - let size = 0; - - do { - size += data[offset]; - offset++; - } while (data[offset - 1] === 0xFF); - - frameSizes.push(size); - } - } - - // ebml - if (parsed.lacing === 3) { - // first vint is unsinged - // after that vints are singed and - // based on a compounding size - let size = 0; - - for (let i = 0; i < numberOfFrames - 1; i++) { - const vint = i === 0 ? getvint(data, offset) : getvint(data, offset, true, true); - - size += vint.value; - frameSizes.push(size); - offset += vint.length; - } - } - - frameSizes.forEach(function(size) { - parsed.frames.push(data.subarray(offset, offset + size)); - offset += size; - }); - - return parsed; -}; - -// VP9 Codec Feature Metadata (CodecPrivate) -// https://www.webmproject.org/docs/container/ -const parseVp9Private = (bytes) => { - let i = 0; - const params = {}; - - while (i < bytes.length) { - const id = bytes[i] & 0x7f; - const len = bytes[i + 1]; - let val; - - if (len === 1) { - val = bytes[i + 2]; - } else { - val = bytes.subarray(i + 2, i + 2 + len); - } - - if (id === 1) { - params.profile = val; - } else if (id === 2) { - params.level = val; - } else if (id === 3) { - params.bitDepth = val; - } else if (id === 4) { - params.chromaSubsampling = val; - } else { - params[id] = val; - } - - i += 2 + len; - } - - return params; -}; - -export const parseTracks = function(bytes) { - bytes = toUint8(bytes); - const decodedTracks = []; - let tracks = findEbml(bytes, [EBML_TAGS.Segment, EBML_TAGS.Tracks, EBML_TAGS.Track]); - - if (!tracks.length) { - tracks = findEbml(bytes, [EBML_TAGS.Tracks, EBML_TAGS.Track]); - } - - if (!tracks.length) { - tracks = findEbml(bytes, [EBML_TAGS.Track]); - } - - if (!tracks.length) { - return decodedTracks; - } - - tracks.forEach(function(track) { - let trackType = findEbml(track, EBML_TAGS.TrackType)[0]; - - if (!trackType || !trackType.length) { - return; - } - - // 1 is video, 2 is audio, 17 is subtitle - // other values are unimportant in this context - if (trackType[0] === 1) { - trackType = 'video'; - } else if (trackType[0] === 2) { - trackType = 'audio'; - } else if (trackType[0] === 17) { - trackType = 'subtitle'; - } else { - return; - } - - // todo parse language - const decodedTrack = { - rawCodec: bytesToString(findEbml(track, [EBML_TAGS.CodecID])[0]), - type: trackType, - codecPrivate: findEbml(track, [EBML_TAGS.CodecPrivate])[0], - number: bytesToNumber(findEbml(track, [EBML_TAGS.TrackNumber])[0]), - defaultDuration: bytesToNumber(findEbml(track, [EBML_TAGS.DefaultDuration])[0]), - default: findEbml(track, [EBML_TAGS.FlagDefault])[0], - rawData: track - }; - - let codec = ''; - - if ((/V_MPEG4\/ISO\/AVC/).test(decodedTrack.rawCodec)) { - codec = `avc1.${getAvcCodec(decodedTrack.codecPrivate)}`; - } else if ((/V_MPEGH\/ISO\/HEVC/).test(decodedTrack.rawCodec)) { - codec = `hev1.${getHvcCodec(decodedTrack.codecPrivate)}`; - } else if ((/V_MPEG4\/ISO\/ASP/).test(decodedTrack.rawCodec)) { - if (decodedTrack.codecPrivate) { - codec = 'mp4v.20.' + decodedTrack.codecPrivate[4].toString(); - } else { - codec = 'mp4v.20.9'; - } - } else if ((/^V_THEORA/).test(decodedTrack.rawCodec)) { - codec = 'theora'; - } else if ((/^V_VP8/).test(decodedTrack.rawCodec)) { - codec = 'vp8'; - } else if ((/^V_VP9/).test(decodedTrack.rawCodec)) { - if (decodedTrack.codecPrivate) { - const {profile, level, bitDepth, chromaSubsampling} = parseVp9Private(decodedTrack.codecPrivate); - - codec = 'vp09.'; - codec += `${padStart(profile, 2, '0')}.`; - codec += `${padStart(level, 2, '0')}.`; - codec += `${padStart(bitDepth, 2, '0')}.`; - codec += `${padStart(chromaSubsampling, 2, '0')}`; - - // Video -> Colour -> Ebml name - const matrixCoefficients = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xB1]])[0] || []; - const videoFullRangeFlag = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xB9]])[0] || []; - const transferCharacteristics = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xBA]])[0] || []; - const colourPrimaries = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xBB]])[0] || []; - - // if we find any optional codec parameter specify them all. - if (matrixCoefficients.length || - videoFullRangeFlag.length || - transferCharacteristics.length || - colourPrimaries.length) { - codec += `.${padStart(colourPrimaries[0], 2, '0')}`; - codec += `.${padStart(transferCharacteristics[0], 2, '0')}`; - codec += `.${padStart(matrixCoefficients[0], 2, '0')}`; - codec += `.${padStart(videoFullRangeFlag[0], 2, '0')}`; - } - - } else { - codec = 'vp9'; - } - } else if ((/^V_AV1/).test(decodedTrack.rawCodec)) { - codec = `av01.${getAv1Codec(decodedTrack.codecPrivate)}`; - } else if ((/A_ALAC/).test(decodedTrack.rawCodec)) { - codec = 'alac'; - } else if ((/A_MPEG\/L2/).test(decodedTrack.rawCodec)) { - codec = 'mp2'; - } else if ((/A_MPEG\/L3/).test(decodedTrack.rawCodec)) { - codec = 'mp3'; - } else if ((/^A_AAC/).test(decodedTrack.rawCodec)) { - if (decodedTrack.codecPrivate) { - codec = 'mp4a.40.' + (decodedTrack.codecPrivate[0] >>> 3).toString(); - } else { - codec = 'mp4a.40.2'; - } - } else if ((/^A_AC3/).test(decodedTrack.rawCodec)) { - codec = 'ac-3'; - } else if ((/^A_PCM/).test(decodedTrack.rawCodec)) { - codec = 'pcm'; - } else if ((/^A_MS\/ACM/).test(decodedTrack.rawCodec)) { - codec = 'speex'; - } else if ((/^A_EAC3/).test(decodedTrack.rawCodec)) { - codec = 'ec-3'; - } else if ((/^A_VORBIS/).test(decodedTrack.rawCodec)) { - codec = 'vorbis'; - } else if ((/^A_FLAC/).test(decodedTrack.rawCodec)) { - codec = 'flac'; - } else if ((/^A_OPUS/).test(decodedTrack.rawCodec)) { - codec = 'opus'; - } - - decodedTrack.codec = codec; - decodedTracks.push(decodedTrack); - }); - - return decodedTracks.sort((a, b) => a.number - b.number); -}; - -export const parseData = function(data, tracks) { - const allBlocks = []; - - const segment = findEbml(data, [EBML_TAGS.Segment])[0]; - let timestampScale = findEbml(segment, [EBML_TAGS.SegmentInfo, EBML_TAGS.TimestampScale])[0]; - - // in nanoseconds, defaults to 1ms - if (timestampScale && timestampScale.length) { - timestampScale = bytesToNumber(timestampScale); - } else { - timestampScale = 1000000; - } - - const clusters = findEbml(segment, [EBML_TAGS.Cluster]); - - if (!tracks) { - tracks = parseTracks(segment); - } - - clusters.forEach(function(cluster, ci) { - const simpleBlocks = findEbml(cluster, [EBML_TAGS.SimpleBlock]).map((b) => ({type: 'simple', data: b})); - const blockGroups = findEbml(cluster, [EBML_TAGS.BlockGroup]).map((b) => ({type: 'group', data: b})); - let timestamp = findEbml(cluster, [EBML_TAGS.Timestamp])[0] || 0; - - if (timestamp && timestamp.length) { - timestamp = bytesToNumber(timestamp); - } - - // get all blocks then sort them into the correct order - const blocks = simpleBlocks - .concat(blockGroups) - .sort((a, b) => a.data.byteOffset - b.data.byteOffset); - - blocks.forEach(function(block, bi) { - const decoded = decodeBlock(block.data, block.type, timestampScale, timestamp); - - allBlocks.push(decoded); - }); - }); - - return {tracks, blocks: allBlocks}; -}; diff --git a/node_modules/@videojs/vhs-utils/src/format-parser.js b/node_modules/@videojs/vhs-utils/src/format-parser.js deleted file mode 100644 index 96fef04..0000000 --- a/node_modules/@videojs/vhs-utils/src/format-parser.js +++ /dev/null @@ -1,338 +0,0 @@ -import {bytesToString, toUint8, toHexString, bytesMatch} from './byte-helpers.js'; -import {parseTracks as parseEbmlTracks} from './ebml-helpers.js'; -import {parseTracks as parseMp4Tracks} from './mp4-helpers.js'; -import {findFourCC} from './riff-helpers.js'; -import {getPages} from './ogg-helpers.js'; -import {detectContainerForBytes} from './containers.js'; -import {findH264Nal, findH265Nal} from './nal-helpers.js'; -import {parseTs} from './m2ts-helpers.js'; -import {getAvcCodec, getHvcCodec} from './codec-helpers.js'; -import {getId3Offset} from './id3-helpers.js'; - -// https://docs.microsoft.com/en-us/windows/win32/medfound/audio-subtype-guids -// https://tools.ietf.org/html/rfc2361 -const wFormatTagCodec = function(wFormatTag) { - wFormatTag = toUint8(wFormatTag); - - if (bytesMatch(wFormatTag, [0x00, 0x55])) { - return 'mp3'; - } else if (bytesMatch(wFormatTag, [0x16, 0x00]) || bytesMatch(wFormatTag, [0x00, 0xFF])) { - return 'aac'; - } else if (bytesMatch(wFormatTag, [0x70, 0x4f])) { - return 'opus'; - } else if (bytesMatch(wFormatTag, [0x6C, 0x61])) { - return 'alac'; - } else if (bytesMatch(wFormatTag, [0xF1, 0xAC])) { - return 'flac'; - } else if (bytesMatch(wFormatTag, [0x20, 0x00])) { - return 'ac-3'; - } else if (bytesMatch(wFormatTag, [0xFF, 0xFE])) { - return 'ec-3'; - } else if (bytesMatch(wFormatTag, [0x00, 0x50])) { - return 'mp2'; - } else if (bytesMatch(wFormatTag, [0x56, 0x6f])) { - return 'vorbis'; - } else if (bytesMatch(wFormatTag, [0xA1, 0x09])) { - return 'speex'; - } - - return ''; -}; - -const formatMimetype = (name, codecs) => { - const codecString = ['video', 'audio'].reduce((acc, type) => { - if (codecs[type]) { - acc += (acc.length ? ',' : '') + codecs[type]; - } - - return acc; - }, ''); - - return `${(codecs.video ? 'video' : 'audio')}/${name}${codecString ? `;codecs="${codecString}"` : ''}`; -}; - -const parseCodecFrom = { - mov(bytes) { - // mov and mp4 both use a nearly identical box structure. - const retval = parseCodecFrom.mp4(bytes); - - if (retval.mimetype) { - retval.mimetype = retval.mimetype.replace('mp4', 'quicktime'); - } - - return retval; - }, - mp4(bytes) { - bytes = toUint8(bytes); - const codecs = {}; - const tracks = parseMp4Tracks(bytes); - - for (let i = 0; i < tracks.length; i++) { - const track = tracks[i]; - - if (track.type === 'audio' && !codecs.audio) { - codecs.audio = track.codec; - } - - if (track.type === 'video' && !codecs.video) { - codecs.video = track.codec; - } - } - - return {codecs, mimetype: formatMimetype('mp4', codecs)}; - }, - '3gp'(bytes) { - return {codecs: {}, mimetype: 'video/3gpp'}; - }, - ogg(bytes) { - const pages = getPages(bytes, 0, 4); - const codecs = {}; - - pages.forEach(function(page) { - if (bytesMatch(page, [0x4F, 0x70, 0x75, 0x73], {offset: 28})) { - codecs.audio = 'opus'; - } else if (bytesMatch(page, [0x56, 0x50, 0x38, 0x30], {offset: 29})) { - codecs.video = 'vp8'; - } else if (bytesMatch(page, [0x74, 0x68, 0x65, 0x6F, 0x72, 0x61], {offset: 29})) { - codecs.video = 'theora'; - } else if (bytesMatch(page, [0x46, 0x4C, 0x41, 0x43], {offset: 29})) { - codecs.audio = 'flac'; - } else if (bytesMatch(page, [0x53, 0x70, 0x65, 0x65, 0x78], {offset: 28})) { - codecs.audio = 'speex'; - } else if (bytesMatch(page, [0x76, 0x6F, 0x72, 0x62, 0x69, 0x73], {offset: 29})) { - codecs.audio = 'vorbis'; - } - }); - - return {codecs, mimetype: formatMimetype('ogg', codecs)}; - }, - wav(bytes) { - const format = findFourCC(bytes, ['WAVE', 'fmt'])[0]; - const wFormatTag = Array.prototype.slice.call(format, 0, 2).reverse(); - let mimetype = 'audio/vnd.wave'; - const codecs = { - audio: wFormatTagCodec(wFormatTag) - }; - - const codecString = wFormatTag.reduce(function(acc, v) { - if (v) { - acc += toHexString(v); - } - return acc; - }, ''); - - if (codecString) { - mimetype += `;codec=${codecString}`; - } - - if (codecString && !codecs.audio) { - codecs.audio = codecString; - } - - return {codecs, mimetype}; - }, - avi(bytes) { - const movi = findFourCC(bytes, ['AVI', 'movi'])[0]; - const strls = findFourCC(bytes, ['AVI', 'hdrl', 'strl']); - const codecs = {}; - - strls.forEach(function(strl) { - const strh = findFourCC(strl, ['strh'])[0]; - const strf = findFourCC(strl, ['strf'])[0]; - - // now parse AVIStreamHeader to get codec and type: - // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/api/avifmt/ns-avifmt-avistreamheader - const type = bytesToString(strh.subarray(0, 4)); - let codec; - let codecType; - - if (type === 'vids') { - // https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapinfoheader - const handler = bytesToString(strh.subarray(4, 8)); - const compression = bytesToString(strf.subarray(16, 20)); - // look for 00dc (compressed video fourcc code) or 00db (uncompressed video fourcc code) - const videoData = findFourCC(movi, ['00dc'])[0] || findFourCC(movi, ['00db'][0]); - - if (handler === 'H264' || compression === 'H264') { - if (videoData && videoData.length) { - codec = parseCodecFrom.h264(videoData).codecs.video; - } else { - codec = 'avc1'; - } - } else if (handler === 'HEVC' || compression === 'HEVC') { - if (videoData && videoData.length) { - codec = parseCodecFrom.h265(videoData).codecs.video; - } else { - codec = 'hev1'; - } - } else if (handler === 'FMP4' || compression === 'FMP4') { - if (movi.length) { - codec = 'mp4v.20.' + movi[12].toString(); - } else { - codec = 'mp4v.20'; - } - } else if (handler === 'VP80' || compression === 'VP80') { - codec = 'vp8'; - } else if (handler === 'VP90' || compression === 'VP90') { - codec = 'vp9'; - } else if (handler === 'AV01' || compression === 'AV01') { - codec = 'av01'; - } else if (handler === 'theo' || compression === 'theora') { - codec = 'theora'; - } else { - if (videoData && videoData.length) { - const result = detectContainerForBytes(videoData); - - if (result === 'h264') { - codec = parseCodecFrom.h264(movi).codecs.video; - } - if (result === 'h265') { - codec = parseCodecFrom.h265(movi).codecs.video; - } - } - - if (!codec) { - codec = handler || compression; - } - } - - codecType = 'video'; - } else if (type === 'auds') { - codecType = 'audio'; - // look for 00wb (audio data fourcc) - // const audioData = findFourCC(movi, ['01wb']); - const wFormatTag = Array.prototype.slice.call(strf, 0, 2).reverse(); - - codecs.audio = wFormatTagCodec(wFormatTag); - - } else { - return; - } - - if (codec) { - codecs[codecType] = codec; - } - }); - - return {codecs, mimetype: formatMimetype('avi', codecs)}; - }, - - ts(bytes) { - const result = parseTs(bytes, 2); - const codecs = {}; - - Object.keys(result.streams).forEach(function(esPid) { - const stream = result.streams[esPid]; - - if (stream.codec === 'avc1' && stream.packets.length) { - stream.codec = parseCodecFrom.h264(stream.packets[0]).codecs.video; - } else if (stream.codec === 'hev1' && stream.packets.length) { - stream.codec = parseCodecFrom.h265(stream.packets[0]).codecs.video; - } - - codecs[stream.type] = stream.codec; - }); - - return {codecs, mimetype: formatMimetype('mp2t', codecs)}; - }, - webm(bytes) { - // mkv and webm both use ebml to store code info - const retval = parseCodecFrom.mkv(bytes); - - if (retval.mimetype) { - retval.mimetype = retval.mimetype.replace('x-matroska', 'webm'); - } - - return retval; - }, - mkv(bytes) { - const codecs = {}; - const tracks = parseEbmlTracks(bytes); - - for (let i = 0; i < tracks.length; i++) { - const track = tracks[i]; - - if (track.type === 'audio' && !codecs.audio) { - codecs.audio = track.codec; - } - - if (track.type === 'video' && !codecs.video) { - codecs.video = track.codec; - } - } - - return {codecs, mimetype: formatMimetype('x-matroska', codecs)}; - }, - aac(bytes) { - return {codecs: {audio: 'aac'}, mimetype: 'audio/aac'}; - }, - ac3(bytes) { - // past id3 and syncword - const offset = getId3Offset(bytes) + 2; - // default to ac-3 - let codec = 'ac-3'; - - if (bytesMatch(bytes, [0xB8, 0xE0], {offset})) { - codec = 'ac-3'; - // 0x01, 0x7F - } else if (bytesMatch(bytes, [0x01, 0x7f], {offset})) { - codec = 'ec-3'; - } - return {codecs: {audio: codec}, mimetype: 'audio/vnd.dolby.dd-raw'}; - }, - mp3(bytes) { - return {codecs: {audio: 'mp3'}, mimetype: 'audio/mpeg'}; - }, - flac(bytes) { - return {codecs: {audio: 'flac'}, mimetype: 'audio/flac'}; - }, - 'h264'(bytes) { - // find seq_parameter_set_rbsp to get encoding settings for codec - const nal = findH264Nal(bytes, 7, 3); - const retval = {codecs: {video: 'avc1'}, mimetype: 'video/h264'}; - - if (nal.length) { - retval.codecs.video += `.${getAvcCodec(nal)}`; - } - - return retval; - }, - 'h265'(bytes) { - const retval = {codecs: {video: 'hev1'}, mimetype: 'video/h265'}; - - // find video_parameter_set_rbsp or seq_parameter_set_rbsp - // to get encoding settings for codec - const nal = findH265Nal(bytes, [32, 33], 3); - - if (nal.length) { - const type = (nal[0] >> 1) & 0x3F; - - // profile_tier_level starts at byte 5 for video_parameter_set_rbsp - // byte 2 for seq_parameter_set_rbsp - retval.codecs.video += `.${getHvcCodec(nal.subarray(type === 32 ? 5 : 2))}`; - } - - return retval; - } -}; - -export const parseFormatForBytes = (bytes) => { - bytes = toUint8(bytes); - const result = { - codecs: {}, - container: detectContainerForBytes(bytes), - mimetype: '' - }; - - const parseCodecFn = parseCodecFrom[result.container]; - - if (parseCodecFn) { - const parsed = parseCodecFn ? parseCodecFn(bytes) : {}; - - result.codecs = parsed.codecs || {}; - result.mimetype = parsed.mimetype || ''; - } - - return result; -}; - diff --git a/node_modules/@videojs/vhs-utils/src/id3-helpers.js b/node_modules/@videojs/vhs-utils/src/id3-helpers.js deleted file mode 100644 index 95f2a72..0000000 --- a/node_modules/@videojs/vhs-utils/src/id3-helpers.js +++ /dev/null @@ -1,35 +0,0 @@ -import {toUint8, bytesMatch} from './byte-helpers.js'; -const ID3 = toUint8([0x49, 0x44, 0x33]); - -export const getId3Size = function(bytes, offset = 0) { - bytes = toUint8(bytes); - - const flags = bytes[offset + 5]; - const returnSize = (bytes[offset + 6] << 21) | - (bytes[offset + 7] << 14) | - (bytes[offset + 8] << 7) | - (bytes[offset + 9]); - const footerPresent = (flags & 16) >> 4; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; -}; - -export const getId3Offset = function(bytes, offset = 0) { - bytes = toUint8(bytes); - - if ((bytes.length - offset) < 10 || !bytesMatch(bytes, ID3, {offset})) { - return offset; - } - - offset += getId3Size(bytes, offset); - - // recursive check for id3 tags as some files - // have multiple ID3 tag sections even though - // they should not. - return getId3Offset(bytes, offset); -}; - diff --git a/node_modules/@videojs/vhs-utils/src/index.js b/node_modules/@videojs/vhs-utils/src/index.js deleted file mode 100644 index f491489..0000000 --- a/node_modules/@videojs/vhs-utils/src/index.js +++ /dev/null @@ -1,17 +0,0 @@ -import * as codecs from './codecs'; -import * as byteHelpers from './byte-helpers.js'; -import * as containers from './containers.js'; -import decodeB64ToUint8Array from './decode-b64-to-uint8-array.js'; -import * as mediaGroups from './media-groups.js'; -import resolveUrl from './resolve-url.js'; -import Stream from './stream.js'; - -export default { - codecs, - byteHelpers, - containers, - decodeB64ToUint8Array, - mediaGroups, - resolveUrl, - Stream -}; diff --git a/node_modules/@videojs/vhs-utils/src/m2ts-helpers.js b/node_modules/@videojs/vhs-utils/src/m2ts-helpers.js deleted file mode 100644 index 038dea4..0000000 --- a/node_modules/@videojs/vhs-utils/src/m2ts-helpers.js +++ /dev/null @@ -1,101 +0,0 @@ -import {bytesMatch, toUint8} from './byte-helpers.js'; -const SYNC_BYTE = 0x47; - -export const parseTs = function(bytes, maxPes = Infinity) { - bytes = toUint8(bytes); - - let startIndex = 0; - let endIndex = 188; - const pmt = {}; - let pesCount = 0; - - while (endIndex < bytes.byteLength && pesCount < maxPes) { - if (bytes[startIndex] !== SYNC_BYTE && bytes[endIndex] !== SYNC_BYTE) { - endIndex += 1; - startIndex += 1; - continue; - } - const packet = bytes.subarray(startIndex, endIndex); - const pid = (((packet[1] & 0x1f) << 8) | packet[2]); - const hasPusi = !!(packet[1] & 0x40); - const hasAdaptationHeader = (((packet[3] & 0x30) >>> 4) > 0x01); - let payloadOffset = 4 + (hasAdaptationHeader ? (packet[4] + 1) : 0); - - if (hasPusi) { - payloadOffset += packet[payloadOffset] + 1; - } - - if (pid === 0 && !pmt.pid) { - pmt.pid = (packet[payloadOffset + 10] & 0x1f) << 8 | packet[payloadOffset + 11]; - } else if (pmt.pid && pid === pmt.pid && !pmt.streams) { - const isNotForward = packet[payloadOffset + 5] & 0x01; - - // ignore forward pmt delarations - if (!isNotForward) { - continue; - } - pmt.streams = {}; - - const sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - const tableEnd = 3 + sectionLength - 4; - const programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; - let offset = 12 + programInfoLength; - - while (offset < tableEnd) { - // add an entry that maps the elementary_pid to the stream_type - const i = payloadOffset + offset; - const type = packet[i]; - const esPid = (packet[i + 1] & 0x1F) << 8 | packet[i + 2]; - const esLength = ((packet[i + 3] & 0x0f) << 8 | (packet[i + 4])); - const esInfo = packet.subarray(i + 5, i + 5 + esLength); - const stream = pmt.streams[esPid] = { - esInfo, - typeNumber: type, - packets: [], - type: '', - codec: '' - }; - - if (type === 0x06 && bytesMatch(esInfo, [0x4F, 0x70, 0x75, 0x73], {offset: 2})) { - stream.type = 'audio'; - stream.codec = 'opus'; - } else if (type === 0x1B || type === 0x20) { - stream.type = 'video'; - stream.codec = 'avc1'; - } else if (type === 0x24) { - stream.type = 'video'; - stream.codec = 'hev1'; - } else if (type === 0x10) { - stream.type = 'video'; - stream.codec = 'mp4v.20'; - } else if (type === 0x0F) { - stream.type = 'audio'; - stream.codec = 'aac'; - } else if (type === 0x81) { - stream.type = 'audio'; - stream.codec = 'ac-3'; - } else if (type === 0x87) { - stream.type = 'audio'; - stream.codec = 'ec-3'; - } else if (type === 0x03 || type === 0x04) { - stream.type = 'audio'; - stream.codec = 'mp3'; - } - - offset += esLength + 5; - } - } else if (pmt.pid && pmt.streams) { - pmt.streams[pid].packets.push(packet.subarray(payloadOffset)); - pesCount++; - } - - startIndex += 188; - endIndex += 188; - } - - if (!pmt.streams) { - pmt.streams = {}; - } - - return pmt; -}; diff --git a/node_modules/@videojs/vhs-utils/src/media-groups.js b/node_modules/@videojs/vhs-utils/src/media-groups.js deleted file mode 100644 index 3cbc903..0000000 --- a/node_modules/@videojs/vhs-utils/src/media-groups.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Loops through all supported media groups in master and calls the provided - * callback for each group - * - * @param {Object} master - * The parsed master manifest object - * @param {string[]} groups - * The media groups to call the callback for - * @param {Function} callback - * Callback to call for each media group - */ -export const forEachMediaGroup = (master, groups, callback) => { - groups.forEach((mediaType) => { - for (const groupKey in master.mediaGroups[mediaType]) { - for (const labelKey in master.mediaGroups[mediaType][groupKey]) { - const mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey]; - - callback(mediaProperties, mediaType, groupKey, labelKey); - } - } - }); -}; diff --git a/node_modules/@videojs/vhs-utils/src/media-types.js b/node_modules/@videojs/vhs-utils/src/media-types.js deleted file mode 100644 index 148f241..0000000 --- a/node_modules/@videojs/vhs-utils/src/media-types.js +++ /dev/null @@ -1,36 +0,0 @@ -const MPEGURL_REGEX = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i; -const DASH_REGEX = /^application\/dash\+xml/i; - -/** - * Returns a string that describes the type of source based on a video source object's - * media type. - * - * @see {@link https://dev.w3.org/html5/pf-summary/video.html#dom-source-type|Source Type} - * - * @param {string} type - * Video source object media type - * @return {('hls'|'dash'|'vhs-json'|null)} - * VHS source type string - */ -export const simpleTypeFromSourceType = (type) => { - if (MPEGURL_REGEX.test(type)) { - return 'hls'; - } - - if (DASH_REGEX.test(type)) { - return 'dash'; - } - - // Denotes the special case of a manifest object passed to http-streaming instead of a - // source URL. - // - // See https://en.wikipedia.org/wiki/Media_type for details on specifying media types. - // - // In this case, vnd stands for vendor, video.js for the organization, VHS for this - // project, and the +json suffix identifies the structure of the media type. - if (type === 'application/vnd.videojs.vhs+json') { - return 'vhs-json'; - } - - return null; -}; diff --git a/node_modules/@videojs/vhs-utils/src/mp4-helpers.js b/node_modules/@videojs/vhs-utils/src/mp4-helpers.js deleted file mode 100644 index 2b100f5..0000000 --- a/node_modules/@videojs/vhs-utils/src/mp4-helpers.js +++ /dev/null @@ -1,564 +0,0 @@ -import { - stringToBytes, - toUint8, - bytesMatch, - bytesToString, - toHexString, - padStart, - bytesToNumber -} from './byte-helpers.js'; -import {getAvcCodec, getHvcCodec, getAv1Codec} from './codec-helpers.js'; -import {parseOpusHead} from './opus-helpers.js'; - -const normalizePath = function(path) { - if (typeof path === 'string') { - return stringToBytes(path); - } - - if (typeof path === 'number') { - return path; - } - - return path; -}; - -const normalizePaths = function(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map((p) => normalizePath(p)); -}; - -let DESCRIPTORS; - -export const parseDescriptors = function(bytes) { - bytes = toUint8(bytes); - const results = []; - let i = 0; - - while (bytes.length > i) { - const tag = bytes[i]; - let size = 0; - let headerSize = 0; - - // tag - headerSize++; - - let byte = bytes[headerSize]; - - // first byte - headerSize++; - - while (byte & 0x80) { - size = (byte & 0x7F) << 7; - byte = bytes[headerSize]; - headerSize++; - } - - size += byte & 0x7F; - - for (let z = 0; z < DESCRIPTORS.length; z++) { - const {id, parser} = DESCRIPTORS[z]; - - if (tag === id) { - results.push(parser(bytes.subarray(headerSize, headerSize + size))); - break; - } - } - - i += size + headerSize; - } - - return results; - -}; - -DESCRIPTORS = [ - {id: 0x03, parser(bytes) { - const desc = { - tag: 0x03, - id: bytes[0] << 8 | bytes[1], - flags: bytes[2], - size: 3, - dependsOnEsId: 0, - ocrEsId: 0, - descriptors: [], - url: '' - }; - - // depends on es id - if (desc.flags & 0x80) { - desc.dependsOnEsId = bytes[desc.size] << 8 | bytes[desc.size + 1]; - desc.size += 2; - } - - // url - if (desc.flags & 0x40) { - const len = bytes[desc.size]; - - desc.url = bytesToString(bytes.subarray(desc.size + 1, desc.size + 1 + len)); - - desc.size += len; - } - - // ocr es id - if (desc.flags & 0x20) { - desc.ocrEsId = bytes[desc.size] << 8 | bytes[desc.size + 1]; - desc.size += 2; - } - - desc.descriptors = parseDescriptors(bytes.subarray(desc.size)) || []; - - return desc; - }}, - {id: 0x04, parser(bytes) { - // DecoderConfigDescriptor - const desc = { - tag: 0x04, - oti: bytes[0], - streamType: bytes[1], - bufferSize: bytes[2] << 16 | bytes [3] << 8 | bytes[4], - maxBitrate: bytes[5] << 24 | bytes[6] << 16 | bytes [7] << 8 | bytes[8], - avgBitrate: bytes[9] << 24 | bytes[10] << 16 | bytes [11] << 8 | bytes[12], - descriptors: parseDescriptors(bytes.subarray(13)) - }; - - return desc; - }}, - {id: 0x05, parser(bytes) { - // DecoderSpecificInfo - - return {tag: 0x05, bytes}; - }}, - {id: 0x06, parser(bytes) { - // SLConfigDescriptor - - return {tag: 0x06, bytes}; - }} -]; - -/** - * find any number of boxes by name given a path to it in an iso bmff - * such as mp4. - * - * @param {TypedArray} bytes - * bytes for the iso bmff to search for boxes in - * - * @param {Uint8Array[]|string[]|string|Uint8Array} name - * An array of paths or a single path representing the name - * of boxes to search through in bytes. Paths may be - * uint8 (character codes) or strings. - * - * @param {boolean} [complete=false] - * Should we search only for complete boxes on the final path. - * This is very useful when you do not want to get back partial boxes - * in the case of streaming files. - * - * @return {Uint8Array[]} - * An array of the end paths that we found. - */ -export const findBox = function(bytes, paths, complete = false) { - paths = normalizePaths(paths); - bytes = toUint8(bytes); - - const results = []; - - if (!paths.length) { - // short-circuit the search for empty paths - return results; - } - let i = 0; - - while (i < bytes.length) { - const size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0; - const type = bytes.subarray(i + 4, i + 8); - - // invalid box format. - if (size === 0) { - break; - } - let end = i + size; - - if (end > bytes.length) { - // this box is bigger than the number of bytes we have - // and complete is set, we cannot find any more boxes. - if (complete) { - break; - } - - end = bytes.length; - } - - const data = bytes.subarray(i + 8, end); - - if (bytesMatch(type, paths[0])) { - if (paths.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data); - } else { - // recursively search for the next box along the path - results.push.apply(results, findBox(data, paths.slice(1), complete)); - } - } - - i = end; - } - - // we've finished searching all of bytes - return results; -}; - -/** - * Search for a single matching box by name in an iso bmff format like - * mp4. This function is useful for finding codec boxes which - * can be placed arbitrarily in sample descriptions depending - * on the version of the file or file type. - * - * @param {TypedArray} bytes - * bytes for the iso bmff to search for boxes in - * - * @param {string|Uint8Array} name - * The name of the box to find. - * - * @return {Uint8Array[]} - * a subarray of bytes representing the name boxed we found. - */ -export const findNamedBox = function(bytes, name) { - name = normalizePath(name); - - if (!name.length) { - // short-circuit the search for empty paths - return bytes.subarray(bytes.length); - } - - let i = 0; - - while (i < bytes.length) { - if (bytesMatch(bytes.subarray(i, i + name.length), name)) { - const size = (bytes[i - 4] << 24 | bytes[i - 3] << 16 | bytes[i - 2] << 8 | bytes[i - 1]) >>> 0; - const end = size > 1 ? i + size : bytes.byteLength; - - return bytes.subarray(i + 4, end); - } - - i++; - } - - // we've finished searching all of bytes - return bytes.subarray(bytes.length); -}; - -const parseSamples = function(data, entrySize = 4, parseEntry = (d) => bytesToNumber(d)) { - const entries = []; - - if (!data || !data.length) { - return entries; - } - - let entryCount = bytesToNumber(data.subarray(4, 8)); - - for (let i = 8; entryCount; i += entrySize, entryCount--) { - entries.push(parseEntry(data.subarray(i, i + entrySize))); - } - - return entries; -}; - -export const buildFrameTable = function(stbl, timescale) { - const keySamples = parseSamples(findBox(stbl, ['stss'])[0]); - const chunkOffsets = parseSamples(findBox(stbl, ['stco'])[0]); - const timeToSamples = parseSamples(findBox(stbl, ['stts'])[0], 8, (entry) => ({ - sampleCount: bytesToNumber(entry.subarray(0, 4)), - sampleDelta: bytesToNumber(entry.subarray(4, 8)) - })); - const samplesToChunks = parseSamples(findBox(stbl, ['stsc'])[0], 12, (entry) => ({ - firstChunk: bytesToNumber(entry.subarray(0, 4)), - samplesPerChunk: bytesToNumber(entry.subarray(4, 8)), - sampleDescriptionIndex: bytesToNumber(entry.subarray(8, 12)) - })); - - const stsz = findBox(stbl, ['stsz'])[0]; - - // stsz starts with a 4 byte sampleSize which we don't need - const sampleSizes = parseSamples(stsz && stsz.length && stsz.subarray(4) || null); - const frames = []; - - for (let chunkIndex = 0; chunkIndex < chunkOffsets.length; chunkIndex++) { - let samplesInChunk; - - for (let i = 0; i < samplesToChunks.length; i++) { - const sampleToChunk = samplesToChunks[i]; - const isThisOne = (chunkIndex + 1) >= sampleToChunk.firstChunk && - (i + 1 >= samplesToChunks.length || (chunkIndex + 1) < samplesToChunks[i + 1].firstChunk); - - if (isThisOne) { - samplesInChunk = sampleToChunk.samplesPerChunk; - break; - } - } - - let chunkOffset = chunkOffsets[chunkIndex]; - - for (let i = 0; i < samplesInChunk; i++) { - const frameEnd = sampleSizes[frames.length]; - - // if we don't have key samples every frame is a keyframe - let keyframe = !keySamples.length; - - if (keySamples.length && keySamples.indexOf(frames.length + 1) !== -1) { - keyframe = true; - } - - const frame = { - keyframe, - start: chunkOffset, - end: chunkOffset + frameEnd - }; - - for (let k = 0; k < timeToSamples.length; k++) { - const {sampleCount, sampleDelta} = timeToSamples[k]; - - if ((frames.length) <= sampleCount) { - // ms to ns - const lastTimestamp = frames.length ? frames[frames.length - 1].timestamp : 0; - - frame.timestamp = lastTimestamp + ((sampleDelta / timescale) * 1000); - frame.duration = sampleDelta; - break; - } - } - - frames.push(frame); - - chunkOffset += frameEnd; - } - } - - return frames; -}; - -export const addSampleDescription = function(track, bytes) { - let codec = bytesToString(bytes.subarray(0, 4)); - - if (track.type === 'video') { - track.info = track.info || {}; - track.info.width = bytes[28] << 8 | bytes[29]; - track.info.height = bytes[30] << 8 | bytes[31]; - } else if (track.type === 'audio') { - track.info = track.info || {}; - track.info.channels = bytes[20] << 8 | bytes[21]; - track.info.bitDepth = bytes[22] << 8 | bytes[23]; - track.info.sampleRate = bytes[28] << 8 | bytes[29]; - } - - if (codec === 'avc1') { - const avcC = findNamedBox(bytes, 'avcC'); - - // AVCDecoderConfigurationRecord - codec += `.${getAvcCodec(avcC)}`; - track.info.avcC = avcC; - // TODO: do we need to parse all this? - /* { - configurationVersion: avcC[0], - profile: avcC[1], - profileCompatibility: avcC[2], - level: avcC[3], - lengthSizeMinusOne: avcC[4] & 0x3 - }; - - let spsNalUnitCount = avcC[5] & 0x1F; - const spsNalUnits = track.info.avc.spsNalUnits = []; - - // past spsNalUnitCount - let offset = 6; - - while (spsNalUnitCount--) { - const nalLen = avcC[offset] << 8 | avcC[offset + 1]; - - spsNalUnits.push(avcC.subarray(offset + 2, offset + 2 + nalLen)); - - offset += nalLen + 2; - } - let ppsNalUnitCount = avcC[offset]; - const ppsNalUnits = track.info.avc.ppsNalUnits = []; - - // past ppsNalUnitCount - offset += 1; - - while (ppsNalUnitCount--) { - const nalLen = avcC[offset] << 8 | avcC[offset + 1]; - - ppsNalUnits.push(avcC.subarray(offset + 2, offset + 2 + nalLen)); - - offset += nalLen + 2; - }*/ - - // HEVCDecoderConfigurationRecord - } else if (codec === 'hvc1' || codec === 'hev1') { - codec += `.${getHvcCodec(findNamedBox(bytes, 'hvcC'))}`; - } else if (codec === 'mp4a' || codec === 'mp4v') { - const esds = findNamedBox(bytes, 'esds'); - const esDescriptor = parseDescriptors(esds.subarray(4))[0]; - const decoderConfig = esDescriptor && esDescriptor.descriptors.filter(({tag}) => tag === 0x04)[0]; - - if (decoderConfig) { - // most codecs do not have a further '.' - // such as 0xa5 for ac-3 and 0xa6 for e-ac-3 - codec += '.' + toHexString(decoderConfig.oti); - if (decoderConfig.oti === 0x40) { - codec += '.' + (decoderConfig.descriptors[0].bytes[0] >> 3).toString(); - } else if (decoderConfig.oti === 0x20) { - codec += '.' + (decoderConfig.descriptors[0].bytes[4]).toString(); - } else if (decoderConfig.oti === 0xdd) { - codec = 'vorbis'; - } - } else if (track.type === 'audio') { - codec += '.40.2'; - } else { - codec += '.20.9'; - } - } else if (codec === 'av01') { - // AV1DecoderConfigurationRecord - codec += `.${getAv1Codec(findNamedBox(bytes, 'av1C'))}`; - } else if (codec === 'vp09') { - // VPCodecConfigurationRecord - const vpcC = findNamedBox(bytes, 'vpcC'); - - // https://www.webmproject.org/vp9/mp4/ - const profile = vpcC[0]; - const level = vpcC[1]; - const bitDepth = vpcC[2] >> 4; - const chromaSubsampling = (vpcC[2] & 0x0F) >> 1; - const videoFullRangeFlag = (vpcC[2] & 0x0F) >> 3; - const colourPrimaries = vpcC[3]; - const transferCharacteristics = vpcC[4]; - const matrixCoefficients = vpcC[5]; - - codec += `.${padStart(profile, 2, '0')}`; - codec += `.${padStart(level, 2, '0')}`; - codec += `.${padStart(bitDepth, 2, '0')}`; - codec += `.${padStart(chromaSubsampling, 2, '0')}`; - codec += `.${padStart(colourPrimaries, 2, '0')}`; - codec += `.${padStart(transferCharacteristics, 2, '0')}`; - codec += `.${padStart(matrixCoefficients, 2, '0')}`; - codec += `.${padStart(videoFullRangeFlag, 2, '0')}`; - } else if (codec === 'theo') { - codec = 'theora'; - } else if (codec === 'spex') { - codec = 'speex'; - } else if (codec === '.mp3') { - codec = 'mp4a.40.34'; - } else if (codec === 'msVo') { - codec = 'vorbis'; - } else if (codec === 'Opus') { - codec = 'opus'; - const dOps = findNamedBox(bytes, 'dOps'); - - track.info.opus = parseOpusHead(dOps); - - // TODO: should this go into the webm code?? - // Firefox requires a codecDelay for opus playback - // see https://bugzilla.mozilla.org/show_bug.cgi?id=1276238 - track.info.codecDelay = 6500000; - } else { - codec = codec.toLowerCase(); - } - /* eslint-enable */ - // flac, ac-3, ec-3, opus - track.codec = codec; -}; - -export const parseTracks = function(bytes, frameTable = true) { - bytes = toUint8(bytes); - - const traks = findBox(bytes, ['moov', 'trak'], true); - const tracks = []; - - traks.forEach(function(trak) { - const track = {bytes: trak}; - const mdia = findBox(trak, ['mdia'])[0]; - - const hdlr = findBox(mdia, ['hdlr'])[0]; - const trakType = bytesToString(hdlr.subarray(8, 12)); - - if (trakType === 'soun') { - track.type = 'audio'; - } else if (trakType === 'vide') { - track.type = 'video'; - } else { - track.type = trakType; - } - - const tkhd = findBox(trak, ['tkhd'])[0]; - - if (tkhd) { - const view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - const tkhdVersion = view.getUint8(0); - - track.number = (tkhdVersion === 0) ? view.getUint32(12) : view.getUint32(20); - } - - const mdhd = findBox(mdia, ['mdhd'])[0]; - - if (mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - const version = mdhd[0]; - const index = version === 0 ? 12 : 20; - - track.timescale = ( - mdhd[index] << 24 | - mdhd[index + 1] << 16 | - mdhd[index + 2] << 8 | - mdhd[index + 3] - ) >>> 0; - } - - const stbl = findBox(mdia, ['minf', 'stbl'])[0]; - const stsd = findBox(stbl, ['stsd'])[0]; - let descriptionCount = bytesToNumber(stsd.subarray(4, 8)); - let offset = 8; - - // add codec and codec info - while (descriptionCount--) { - const len = bytesToNumber(stsd.subarray(offset, offset + 4)); - const sampleDescriptor = stsd.subarray(offset + 4, offset + 4 + len); - - addSampleDescription(track, sampleDescriptor); - - offset += 4 + len; - } - - if (frameTable) { - track.frameTable = buildFrameTable(stbl, track.timescale); - } - - // codec has no sub parameters - tracks.push(track); - }); - - return tracks; -}; - -export const parseMediaInfo = function(bytes) { - const mvhd = findBox(bytes, ['moov', 'mvhd'], true)[0]; - - if (!mvhd || !mvhd.length) { - return; - } - const info = {}; - - // ms to ns - // mvhd v1 has 8 byte duration and other fields too - if (mvhd[0] === 1) { - info.timestampScale = bytesToNumber(mvhd.subarray(20, 24)); - info.duration = bytesToNumber(mvhd.subarray(24, 32)); - } else { - info.timestampScale = bytesToNumber(mvhd.subarray(12, 16)); - info.duration = bytesToNumber(mvhd.subarray(16, 20)); - } - info.bytes = mvhd; - - return info; -}; diff --git a/node_modules/@videojs/vhs-utils/src/nal-helpers.js b/node_modules/@videojs/vhs-utils/src/nal-helpers.js deleted file mode 100644 index af27dc6..0000000 --- a/node_modules/@videojs/vhs-utils/src/nal-helpers.js +++ /dev/null @@ -1,109 +0,0 @@ -import {bytesMatch, toUint8} from './byte-helpers.js'; - -export const NAL_TYPE_ONE = toUint8([0x00, 0x00, 0x00, 0x01]); -export const NAL_TYPE_TWO = toUint8([0x00, 0x00, 0x01]); -export const EMULATION_PREVENTION = toUint8([0x00, 0x00, 0x03]); - -/** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ -export const discardEmulationPreventionBytes = function(bytes) { - const positions = []; - - let i = 1; - - // Find all `Emulation Prevention Bytes` - while (i < bytes.length - 2) { - if (bytesMatch(bytes.subarray(i, i + 3), EMULATION_PREVENTION)) { - positions.push(i + 2); - i++; - } - - i++; - } - - // If no Emulation Prevention Bytes were found just return the original - // array - if (positions.length === 0) { - return bytes; - } - - // Create a new array to hold the NAL unit data - const newLength = bytes.length - positions.length; - const newData = new Uint8Array(newLength); - let sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === positions[0]) { - // Skip this byte - sourceIndex++; - // Remove this position index - positions.shift(); - } - newData[i] = bytes[sourceIndex]; - } - - return newData; -}; - -export const findNal = function(bytes, dataType, types, nalLimit = Infinity) { - bytes = toUint8(bytes); - types = [].concat(types); - - let i = 0; - let nalStart; - let nalsFound = 0; - - // keep searching until: - // we reach the end of bytes - // we reach the maximum number of nals they want to seach - // NOTE: that we disregard nalLimit when we have found the start - // of the nal we want so that we can find the end of the nal we want. - while (i < bytes.length && (nalsFound < nalLimit || nalStart)) { - let nalOffset; - - if (bytesMatch(bytes.subarray(i), NAL_TYPE_ONE)) { - nalOffset = 4; - } else if (bytesMatch(bytes.subarray(i), NAL_TYPE_TWO)) { - nalOffset = 3; - } - - // we are unsynced, - // find the next nal unit - if (!nalOffset) { - i++; - continue; - } - nalsFound++; - - if (nalStart) { - return discardEmulationPreventionBytes(bytes.subarray(nalStart, i)); - } - - let nalType; - - if (dataType === 'h264') { - nalType = (bytes[i + nalOffset] & 0x1f); - } else if (dataType === 'h265') { - nalType = (bytes[i + nalOffset] >> 1) & 0x3f; - } - - if (types.indexOf(nalType) !== -1) { - nalStart = i + nalOffset; - } - - // nal header is 1 length for h264, and 2 for h265 - i += nalOffset + (dataType === 'h264' ? 1 : 2); - } - - return bytes.subarray(0, 0); -}; - -export const findH264Nal = (bytes, type, nalLimit) => findNal(bytes, 'h264', type, nalLimit); -export const findH265Nal = (bytes, type, nalLimit) => findNal(bytes, 'h265', type, nalLimit); diff --git a/node_modules/@videojs/vhs-utils/src/ogg-helpers.js b/node_modules/@videojs/vhs-utils/src/ogg-helpers.js deleted file mode 100644 index 2868eb8..0000000 --- a/node_modules/@videojs/vhs-utils/src/ogg-helpers.js +++ /dev/null @@ -1,27 +0,0 @@ -import {bytesMatch, toUint8} from './byte-helpers'; - -const SYNC_WORD = toUint8([0x4f, 0x67, 0x67, 0x53]); - -export const getPages = function(bytes, start, end = Infinity) { - bytes = toUint8(bytes); - - const pages = []; - let i = 0; - - while (i < bytes.length && pages.length < end) { - // we are unsynced, - // find the next syncword - if (!bytesMatch(bytes, SYNC_WORD, {offset: i})) { - i++; - continue; - } - - const segmentLength = bytes[i + 27]; - - pages.push(bytes.subarray(i, i + 28 + segmentLength)); - - i += pages[pages.length - 1].length; - } - - return pages.slice(start, end); -}; diff --git a/node_modules/@videojs/vhs-utils/src/opus-helpers.js b/node_modules/@videojs/vhs-utils/src/opus-helpers.js deleted file mode 100644 index a5572c4..0000000 --- a/node_modules/@videojs/vhs-utils/src/opus-helpers.js +++ /dev/null @@ -1,61 +0,0 @@ -export const OPUS_HEAD = new Uint8Array([ - // O, p, u, s - 0x4f, 0x70, 0x75, 0x73, - // H, e, a, d - 0x48, 0x65, 0x61, 0x64 -]); - -// https://wiki.xiph.org/OggOpus -// https://vfrmaniac.fushizen.eu/contents/opus_in_isobmff.html -// https://opus-codec.org/docs/opusfile_api-0.7/structOpusHead.html -export const parseOpusHead = function(bytes) { - const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); - - const version = view.getUint8(0); - // version 0, from mp4, does not use littleEndian. - const littleEndian = version !== 0; - - const config = { - version, - channels: view.getUint8(1), - preSkip: view.getUint16(2, littleEndian), - sampleRate: view.getUint32(4, littleEndian), - outputGain: view.getUint16(8, littleEndian), - channelMappingFamily: view.getUint8(10) - }; - - if (config.channelMappingFamily > 0 && bytes.length > 10) { - config.streamCount = view.getUint8(11); - config.twoChannelStreamCount = view.getUint8(12); - config.channelMapping = []; - - for (let c = 0; c < config.channels; c++) { - config.channelMapping.push(view.getUint8(13 + c)); - } - } - - return config; -}; - -export const setOpusHead = function(config) { - const size = config.channelMappingFamily <= 0 ? 11 : (12 + config.channels); - const view = new DataView(new ArrayBuffer(size)); - const littleEndian = config.version !== 0; - - view.setUint8(0, config.version); - view.setUint8(1, config.channels); - view.setUint16(2, config.preSkip, littleEndian); - view.setUint32(4, config.sampleRate, littleEndian); - view.setUint16(8, config.outputGain, littleEndian); - view.setUint8(10, config.channelMappingFamily); - - if (config.channelMappingFamily > 0) { - view.setUint8(11, config.streamCount); - - config.channelMapping.foreach(function(cm, i) { - view.setUint8(12 + i, cm); - }); - } - - return new Uint8Array(view.buffer); -}; diff --git a/node_modules/@videojs/vhs-utils/src/resolve-url.js b/node_modules/@videojs/vhs-utils/src/resolve-url.js deleted file mode 100644 index 006b00d..0000000 --- a/node_modules/@videojs/vhs-utils/src/resolve-url.js +++ /dev/null @@ -1,51 +0,0 @@ -import URLToolkit from 'url-toolkit'; -import window from 'global/window'; - -const DEFAULT_LOCATION = 'http://example.com'; - -const resolveUrl = (baseUrl, relativeUrl) => { - // return early if we don't need to resolve - if ((/^[a-z]+:/i).test(relativeUrl)) { - return relativeUrl; - } - - // if baseUrl is a data URI, ignore it and resolve everything relative to window.location - if ((/^data:/).test(baseUrl)) { - baseUrl = window.location && window.location.href || ''; - } - - // IE11 supports URL but not the URL constructor - // feature detect the behavior we want - const nativeURL = typeof window.URL === 'function'; - - const protocolLess = (/^\/\//.test(baseUrl)); - // remove location if window.location isn't available (i.e. we're in node) - // and if baseUrl isn't an absolute url - const removeLocation = !window.location && !(/\/\//i).test(baseUrl); - - // if the base URL is relative then combine with the current location - if (nativeURL) { - baseUrl = new window.URL(baseUrl, window.location || DEFAULT_LOCATION); - } else if (!(/\/\//i).test(baseUrl)) { - baseUrl = URLToolkit.buildAbsoluteURL(window.location && window.location.href || '', baseUrl); - } - - if (nativeURL) { - const newUrl = new URL(relativeUrl, baseUrl); - - // if we're a protocol-less url, remove the protocol - // and if we're location-less, remove the location - // otherwise, return the url unmodified - if (removeLocation) { - return newUrl.href.slice(DEFAULT_LOCATION.length); - } else if (protocolLess) { - return newUrl.href.slice(newUrl.protocol.length); - } - - return newUrl.href; - } - return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl); - -}; - -export default resolveUrl; diff --git a/node_modules/@videojs/vhs-utils/src/riff-helpers.js b/node_modules/@videojs/vhs-utils/src/riff-helpers.js deleted file mode 100644 index db016a8..0000000 --- a/node_modules/@videojs/vhs-utils/src/riff-helpers.js +++ /dev/null @@ -1,75 +0,0 @@ -import {toUint8, stringToBytes, bytesMatch} from './byte-helpers.js'; - -const CONSTANTS = { - LIST: toUint8([0x4c, 0x49, 0x53, 0x54]), - RIFF: toUint8([0x52, 0x49, 0x46, 0x46]), - WAVE: toUint8([0x57, 0x41, 0x56, 0x45]) -}; - -const normalizePath = function(path) { - if (typeof path === 'string') { - return stringToBytes(path); - } - - if (typeof path === 'number') { - return path; - } - - return path; -}; - -const normalizePaths = function(paths) { - if (!Array.isArray(paths)) { - return [normalizePath(paths)]; - } - - return paths.map((p) => normalizePath(p)); -}; - -export const findFourCC = function(bytes, paths) { - paths = normalizePaths(paths); - bytes = toUint8(bytes); - - let results = []; - - if (!paths.length) { - // short-circuit the search for empty paths - return results; - } - - let i = 0; - - while (i < bytes.length) { - let type = bytes.subarray(i, i + 4); - let size = ((bytes[i + 7] << 24 | bytes[i + 6] << 16 | bytes[i + 5] << 8 | bytes[i + 4]) >>> 0); - - // skip LIST/RIFF and get the actual type - if (bytesMatch(type, CONSTANTS.LIST) || bytesMatch(type, CONSTANTS.RIFF) || bytesMatch(type, CONSTANTS.WAVE)) { - type = bytes.subarray(i + 8, i + 12); - i += 4; - size -= 4; - } - - const data = bytes.subarray(i + 8, i + 8 + size); - - if (bytesMatch(type, paths[0])) { - if (paths.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data); - } else { - // recursively search for the next box along the path - const subresults = findFourCC(data, paths.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i += 8 + data.length; - } - - // we've finished searching all of bytes - return results; -}; diff --git a/node_modules/@videojs/vhs-utils/src/stream.js b/node_modules/@videojs/vhs-utils/src/stream.js deleted file mode 100644 index 64f9238..0000000 --- a/node_modules/@videojs/vhs-utils/src/stream.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @file stream.js - */ -/** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ -export default class Stream { - constructor() { - this.listeners = {}; - } - - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - this.listeners[type].push(listener); - } - - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - const index = this.listeners[type].indexOf(listener); - - // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - trigger(type) { - const callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } - - // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - if (arguments.length === 2) { - const length = callbacks.length; - - for (let i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - const args = Array.prototype.slice.call(arguments, 1); - const length = callbacks.length; - - for (let i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - } - - /** - * Destroys the stream and cleans up. - */ - dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - pipe(destination) { - this.on('data', function(data) { - destination.push(data); - }); - } -} diff --git a/node_modules/@videojs/vhs-utils/test/byte-helpers.test.js b/node_modules/@videojs/vhs-utils/test/byte-helpers.test.js deleted file mode 100644 index 2defac2..0000000 --- a/node_modules/@videojs/vhs-utils/test/byte-helpers.test.js +++ /dev/null @@ -1,321 +0,0 @@ -import QUnit from 'qunit'; -import { - bytesToString, - stringToBytes, - toUint8, - concatTypedArrays, - toHexString, - toBinaryString, - bytesToNumber, - numberToBytes, - bytesMatch -} from '../src/byte-helpers.js'; -import window from 'global/window'; - -const arrayNames = []; -const BigInt = window.BigInt; - -[ - 'Array', - 'Int8Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'Int16Array', - 'Uint16Array', - 'Int32Array', - 'Uint32Array', - 'Float32Array', - 'Float64Array' -].forEach(function(name) { - if (window[name]) { - arrayNames.push(name); - } -}); - -QUnit.module('bytesToString'); - -const testString = 'hello竜'; -const testBytes = toUint8([ - // h - 0x68, - // e - 0x65, - // l - 0x6c, - // l - 0x6c, - // o - 0x6f, - // 竜 - 0xe7, 0xab, 0x9c -]); - -const rawBytes = toUint8([0x47, 0x40, 0x00, 0x10, 0x00, 0x00, 0xb0, 0x0d, 0x00, 0x01]); - -QUnit.test('should function as expected', function(assert) { - arrayNames.forEach(function(name) { - const testObj = name === 'Array' ? testBytes : new window[name](testBytes); - - assert.equal(bytesToString(testObj), testString, `testString work as a string arg with ${name}`); - assert.equal(bytesToString(new window[name]()), '', `empty ${name} returns empty string`); - }); - - assert.equal(bytesToString(), '', 'undefined returns empty string'); - assert.equal(bytesToString(null), '', 'null returns empty string'); - assert.equal(bytesToString(stringToBytes(testString)), testString, 'stringToBytes -> bytesToString works'); -}); - -QUnit.module('stringToBytes'); - -QUnit.test('should function as expected', function(assert) { - assert.deepEqual(stringToBytes(testString), testBytes, 'returns an array of bytes'); - assert.deepEqual(stringToBytes(), toUint8(), 'empty array for undefined'); - assert.deepEqual(stringToBytes(null), toUint8(), 'empty array for null'); - assert.deepEqual(stringToBytes(''), toUint8(), 'empty array for empty string'); - assert.deepEqual(stringToBytes(10), toUint8([0x31, 0x30]), 'converts numbers to strings'); - assert.deepEqual(stringToBytes(bytesToString(testBytes)), testBytes, 'bytesToString -> stringToBytes works'); - assert.deepEqual(stringToBytes(bytesToString(rawBytes), true), rawBytes, 'equal to original with raw bytes mode'); - assert.notDeepEqual(stringToBytes(bytesToString(rawBytes)), rawBytes, 'without raw byte mode works, not equal'); -}); - -QUnit.module('toUint8'); - -QUnit.test('should function as expected', function(assert) { - const tests = { - undef: { - data: undefined, - expected: new Uint8Array() - }, - null: { - data: null, - expected: new Uint8Array() - }, - string: { - data: 'foo', - expected: new Uint8Array() - }, - NaN: { - data: NaN, - expected: new Uint8Array() - }, - object: { - data: {}, - expected: new Uint8Array() - }, - number: { - data: 0x11, - expected: new Uint8Array([0x11]) - } - }; - - Object.keys(tests).forEach(function(name) { - const {data, expected} = tests[name]; - const result = toUint8(data); - - assert.ok(result instanceof Uint8Array, `obj is a Uint8Array for ${name}`); - assert.deepEqual(result, expected, `data is as expected for ${name}`); - }); - - arrayNames.forEach(function(name) { - const testObj = name === 'Array' ? testBytes : new window[name](testBytes); - const uint = toUint8(testObj); - - assert.ok(uint instanceof Uint8Array && uint.length > 0, `converted ${name} to Uint8Array`); - }); - -}); - -QUnit.module('concatTypedArrays'); - -QUnit.test('should function as expected', function(assert) { - const tests = { - undef: { - data: concatTypedArrays(), - expected: toUint8([]) - }, - empty: { - data: concatTypedArrays(toUint8([])), - expected: toUint8([]) - }, - single: { - data: concatTypedArrays([0x01]), - expected: toUint8([0x01]) - }, - array: { - data: concatTypedArrays([0x01], [0x02]), - expected: toUint8([0x01, 0x02]) - }, - uint: { - data: concatTypedArrays(toUint8([0x01]), toUint8([0x02])), - expected: toUint8([0x01, 0x02]) - }, - buffer: { - data: concatTypedArrays(toUint8([0x01]).buffer, toUint8([0x02]).buffer), - expected: toUint8([0x01, 0x02]) - }, - manyarray: { - data: concatTypedArrays([0x01], [0x02], [0x03], [0x04]), - expected: toUint8([0x01, 0x02, 0x03, 0x04]) - }, - manyuint: { - data: concatTypedArrays(toUint8([0x01]), toUint8([0x02]), toUint8([0x03]), toUint8([0x04])), - expected: toUint8([0x01, 0x02, 0x03, 0x04]) - } - }; - - Object.keys(tests).forEach(function(name) { - const {data, expected} = tests[name]; - - assert.ok(data instanceof Uint8Array, `obj is a Uint8Array for ${name}`); - assert.deepEqual(data, expected, `data is as expected for ${name}`); - }); -}); - -QUnit.module('toHexString'); -QUnit.test('should function as expected', function(assert) { - assert.equal(toHexString(0xFF), 'ff', 'works with single value'); - assert.equal(toHexString([0xFF, 0xaa]), 'ffaa', 'works with array'); - assert.equal(toHexString(toUint8([0xFF, 0xaa])), 'ffaa', 'works with uint8'); - assert.equal(toHexString(toUint8([0xFF, 0xaa]).buffer), 'ffaa', 'works with buffer'); - assert.equal(toHexString(toUint8([0xFF, 0xaa, 0xbb]).subarray(1, 3)), 'aabb', 'works with subarray'); - assert.equal(toHexString([0x01, 0x02, 0x03]), '010203', 'works with single digits'); -}); - -QUnit.module('toBinaryString'); -QUnit.test('should function as expected', function(assert) { - const ff = '11111111'; - const aa = '10101010'; - const bb = '10111011'; - const zerof = '00001111'; - const one = '00000001'; - const zero = '00000000'; - const fzero = '11110000'; - - assert.equal(toBinaryString(0xFF), ff, 'works with single value'); - assert.equal(toBinaryString([0xFF, 0xaa]), ff + aa, 'works with array'); - assert.equal(toBinaryString(toUint8([0xFF, 0xbb])), ff + bb, 'works with uint8'); - assert.equal(toBinaryString(toUint8([0xFF, 0xaa]).buffer), ff + aa, 'works with buffer'); - assert.equal(toBinaryString(toUint8([0xFF, 0xaa, 0xbb]).subarray(1, 3)), aa + bb, 'works with subarray'); - assert.equal(toBinaryString([0x0F, 0x01, 0xF0, 0x00]), zerof + one + fzero + zero, 'works with varying digits digits'); -}); - -QUnit.module('bytesToNumber'); -QUnit.test('sanity', function(assert) { - assert.equal(bytesToNumber(0xFF), 0xFF, 'single value'); - assert.equal(bytesToNumber([0xFF, 0x01]), 0xFF01, 'works with array'); - assert.equal(bytesToNumber(toUint8([0xFF, 0xbb])), 0xFFBB, 'works with uint8'); - assert.equal(bytesToNumber(toUint8([0xFF, 0xaa]).buffer), 0xFFAA, 'works with buffer'); - assert.equal(bytesToNumber(toUint8([0xFF, 0xaa, 0xbb]).subarray(1, 3)), 0xAABB, 'works with subarray'); -}); -QUnit.test('unsigned and littleEndian work', function(assert) { - // works with any number of bits - assert.equal(bytesToNumber([0xFF]), 0xFF, 'u8'); - assert.equal(bytesToNumber([0xFF, 0xAA]), 0xFFAA, 'u16'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB]), 0xFFAABB, 'u24'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB, 0xCC]), 0xFFAABBCC, 'u32'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB, 0xCC, 0xDD]), 0xFFAABBCCDD, 'u40'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE]), 0xFFAABBCCDDEE, 'u48'); - - assert.equal(bytesToNumber([0xFF], {le: true}), 0xFF, 'u8 le'); - assert.equal(bytesToNumber([0xFF, 0xAA], {le: true}), 0xAAFF, 'u16 le'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB], {le: true}), 0xBBAAFF, 'u24 le'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB, 0xCC], {le: true}), 0xCCBBAAFF, 'u32 le'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB, 0xCC, 0xDD], {le: true}), 0xDDCCBBAAFF, 'u40 le'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE], {le: true}), 0xEEDDCCBBAAFF, 'u48 le'); - - if (BigInt) { - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0x99]), 0xFFAABBCCDDEE99, 'u56'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0x99, 0x88]), 0xFFAABBCCDDEE9988, 'u64'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0x99], {le: true}), 0x99EEDDCCBBAAFF, 'u56 le'); - assert.equal(bytesToNumber([0xFF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0x99, 0x88], {le: true}), 0x8899EEDDCCBBAAFF, 'u64 le'); - } -}); - -QUnit.test('signed and littleEndian work', function(assert) { - assert.equal(bytesToNumber([0xF0], {signed: true}), -16, 'i8'); - assert.equal(bytesToNumber([0x80, 0x70], {signed: true}), -32656, 'i16'); - assert.equal(bytesToNumber([0x80, 0x70, 0x9f], {signed: true}), -8359777, 'i24'); - assert.equal(bytesToNumber([0x80, 0x70, 0x9f, 0xFF], {signed: true}), -2140102657, 'i32'); - assert.equal(bytesToNumber([0x80, 0x70, 0x9f, 0xFF, 0x10], {signed: true}), -547866280176, 'i40'); - assert.equal(bytesToNumber([0x80, 0x70, 0x9f, 0xFF, 0x10, 0x89], {signed: true}), -140253767724919, 'i48'); - - assert.equal(bytesToNumber([0xF0], {signed: true, le: true}), -16, 'i8 le'); - assert.equal(bytesToNumber([0x80, 0x70], {signed: true, le: true}), 0x7080, 'i16 le'); - assert.equal(bytesToNumber([0x80, 0x70, 0x9f], {signed: true, le: true}), -6328192, 'i24 le'); - assert.equal(bytesToNumber([0x80, 0x70, 0x9f, 0xFF], {signed: true, le: true}), -6328192, 'i32 le'); - assert.equal(bytesToNumber([0x80, 0x70, 0x9f, 0xFF, 0x10], {signed: true, le: true}), 73008115840, 'i40 le'); - assert.equal(bytesToNumber([0x80, 0x70, 0x9f, 0xFF, 0x10, 0x89], {signed: true, le: true}), -130768875589504, 'i48 le'); - - if (BigInt) { - assert.equal(bytesToNumber([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], {signed: true}), -1, 'i56'); - assert.equal(bytesToNumber([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], {signed: true}), -1, 'i64'); - assert.equal(bytesToNumber([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], {signed: true, le: true}), -1, 'i56 le'); - assert.equal(bytesToNumber([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], {signed: true, le: true}), -1, 'i64 le'); - } -}); - -QUnit.module('numberToBytes'); - -QUnit.test('unsigned negative and positive', function(assert) { - assert.deepEqual(numberToBytes(), toUint8([0x00]), 'no bytes'); - assert.deepEqual(numberToBytes(0xFF), toUint8([0xFF]), 'u8'); - assert.deepEqual(numberToBytes(0xFFaa), toUint8([0xFF, 0xaa]), 'u16'); - assert.deepEqual(numberToBytes(0xFFaabb), toUint8([0xFF, 0xaa, 0xbb]), 'u24'); - assert.deepEqual(numberToBytes(0xFFaabbcc), toUint8([0xFF, 0xaa, 0xbb, 0xcc]), 'u32'); - assert.deepEqual(numberToBytes(0xFFaabbccdd), toUint8([0xFF, 0xaa, 0xbb, 0xcc, 0xdd]), 'u40'); - assert.deepEqual(numberToBytes(0xFFaabbccddee), toUint8([0xFF, 0xaa, 0xbb, 0xcc, 0xdd, 0xee]), 'u48'); - - assert.deepEqual(numberToBytes(-16), toUint8([0xF0]), 'negative to u8'); - assert.deepEqual(numberToBytes(-32640), toUint8([0x80, 0x80]), 'negative to u16'); - assert.deepEqual(numberToBytes(-3264062), toUint8([0xce, 0x31, 0xc2]), 'negative to u24'); - assert.deepEqual(numberToBytes(-2139062144), toUint8([0x80, 0x80, 0x80, 0x80]), 'negative to u32'); - assert.deepEqual(numberToBytes(-3139062144), toUint8([0xff, 0x44, 0xe5, 0xb6, 0x80]), 'negative u40'); - assert.deepEqual(numberToBytes(-3139062144444), toUint8([0xfd, 0x25, 0x21, 0x50, 0xe2, 0x44]), 'negative u48'); - - if (BigInt) { - assert.deepEqual(numberToBytes(BigInt('0xFFaabbccddee99')), toUint8([0xFF, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0x99]), 'u56'); - assert.deepEqual(numberToBytes(BigInt('0xFFaabbccddee9988')), toUint8([0xFF, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0x99, 0x88]), 'u64'); - assert.deepEqual(numberToBytes(BigInt('-31390621444448812')), toUint8([0x90, 0x7a, 0x65, 0x67, 0x86, 0x5d, 0xd4]), 'negative to u56'); - assert.deepEqual(numberToBytes(BigInt('-9187201950435737472')), toUint8([0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80]), 'u64'); - } -}); - -QUnit.test('unsigned littleEndian negative and positive', function(assert) { - assert.deepEqual(numberToBytes(0xFF, {le: true}), toUint8([0xFF]), 'u8'); - assert.deepEqual(numberToBytes(0xFFaa, {le: true}), toUint8([0xaa, 0xFF]), 'u16'); - assert.deepEqual(numberToBytes(0xFFaabb, {le: true}), toUint8([0xbb, 0xaa, 0xFF]), 'u24'); - assert.deepEqual(numberToBytes(0xFFaabbcc, {le: true}), toUint8([0xcc, 0xbb, 0xaa, 0xff]), 'u32'); - assert.deepEqual(numberToBytes(0xFFaabbccdd, {le: true}), toUint8([0xdd, 0xcc, 0xbb, 0xaa, 0xff]), 'u40'); - assert.deepEqual(numberToBytes(0xFFaabbccddee, {le: true}), toUint8([0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0xff]), 'u48'); - - assert.deepEqual(numberToBytes(-16, {le: true}), toUint8([0xF0]), 'negative to u8'); - assert.deepEqual(numberToBytes(-32640, {le: true}), toUint8([0x80, 0x80]), 'negative to u16'); - assert.deepEqual(numberToBytes(-3264062, {le: true}), toUint8([0xc2, 0x31, 0xce]), 'negative to u24'); - assert.deepEqual(numberToBytes(-2139062144, {le: true}), toUint8([0x80, 0x80, 0x80, 0x80]), 'negative to u32'); - assert.deepEqual(numberToBytes(-3139062144, {le: true}), toUint8([0x80, 0xb6, 0xe5, 0x44, 0xff]), 'negative u40'); - assert.deepEqual(numberToBytes(-3139062144444, {le: true}), toUint8([0x44, 0xe2, 0x50, 0x21, 0x25, 0xfd]), 'negative u48'); - - if (BigInt) { - assert.deepEqual(numberToBytes(BigInt('0xFFaabbccddee99'), {le: true}), toUint8([0x99, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0xff]), 'u56'); - assert.deepEqual(numberToBytes(BigInt('0xFFaabbccddee9988'), {le: true}), toUint8([0x88, 0x99, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0xff]), 'u64'); - assert.deepEqual(numberToBytes(BigInt('-31390621444448812'), {le: true}), toUint8([0xd4, 0x5d, 0x86, 0x67, 0x65, 0x7a, 0x90]), 'negative to u56'); - assert.deepEqual(numberToBytes(BigInt('-9187201950435737472'), {le: true}), toUint8([0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80]), 'u64'); - } -}); - -QUnit.module('bytesMatch'); -QUnit.test('should function as expected', function(assert) { - assert.equal(bytesMatch(), false, 'no a or b bytes, false'); - assert.equal(bytesMatch(null, []), false, 'no a bytes, false'); - assert.equal(bytesMatch([]), false, 'no b bytes, false'); - assert.equal(bytesMatch([0x00], [0x00, 0x02]), false, 'not enough bytes'); - assert.equal(bytesMatch([0x00], [0x00], {offset: 1}), false, 'not due to offset'); - assert.equal(bytesMatch([0xbb, 0xaa], [0xaa]), false, 'bytes do not match'); - assert.equal(bytesMatch([0xaa], [0xaa], {mask: [0x10]}), false, 'bytes do not match due to mask'); - assert.equal(bytesMatch([0xaa], [0xaa]), true, 'bytes match'); - assert.equal(bytesMatch([0xbb, 0xaa], [0xbb]), true, 'bytes match more a'); - assert.equal(bytesMatch([0xbb, 0xaa], [0xaa], {offset: 1}), true, 'bytes match with offset'); - assert.equal(bytesMatch([0xaa], [0x20], {mask: [0x20]}), true, 'bytes match with mask'); - assert.equal(bytesMatch([0xbb, 0xaa], [0x20], {mask: [0x20], offset: 1}), true, 'bytes match with mask and offset'); - assert.equal(bytesMatch([0xbb, 0xaa, 0xaa], [0x20, 0x20], {mask: [0x20, 0x20], offset: 1}), true, 'bytes match with many masks and offset'); -}); diff --git a/node_modules/@videojs/vhs-utils/test/codecs.test.js b/node_modules/@videojs/vhs-utils/test/codecs.test.js deleted file mode 100644 index 895bd60..0000000 --- a/node_modules/@videojs/vhs-utils/test/codecs.test.js +++ /dev/null @@ -1,472 +0,0 @@ -import window from 'global/window'; -import QUnit from 'qunit'; -import { - mapLegacyAvcCodecs, - translateLegacyCodecs, - parseCodecs, - codecsFromDefault, - isVideoCodec, - isAudioCodec, - muxerSupportsCodec, - browserSupportsCodec, - getMimeForCodec -} from '../src/codecs'; - -const supportedMuxerCodecs = [ - 'mp4a', - 'avc1' -]; - -const unsupportedMuxerCodecs = [ - 'hvc1', - 'ac-3', - 'ec-3', - 'mp3' -]; - -QUnit.module('Legacy Codecs'); - -QUnit.test('maps legacy AVC codecs', function(assert) { - assert.equal( - mapLegacyAvcCodecs('avc1.deadbeef'), - 'avc1.deadbeef', - 'does nothing for non legacy pattern' - ); - assert.equal( - mapLegacyAvcCodecs('avc1.dead.beef, mp4a.something'), - 'avc1.dead.beef, mp4a.something', - 'does nothing for non legacy pattern' - ); - assert.equal( - mapLegacyAvcCodecs('avc1.dead.beef,mp4a.something'), - 'avc1.dead.beef,mp4a.something', - 'does nothing for non legacy pattern' - ); - assert.equal( - mapLegacyAvcCodecs('mp4a.something,avc1.dead.beef'), - 'mp4a.something,avc1.dead.beef', - 'does nothing for non legacy pattern' - ); - assert.equal( - mapLegacyAvcCodecs('mp4a.something, avc1.dead.beef'), - 'mp4a.something, avc1.dead.beef', - 'does nothing for non legacy pattern' - ); - assert.equal( - mapLegacyAvcCodecs('avc1.42001e'), - 'avc1.42001e', - 'does nothing for non legacy pattern' - ); - assert.equal( - mapLegacyAvcCodecs('avc1.4d0020,mp4a.40.2'), - 'avc1.4d0020,mp4a.40.2', - 'does nothing for non legacy pattern' - ); - assert.equal( - mapLegacyAvcCodecs('mp4a.40.2,avc1.4d0020'), - 'mp4a.40.2,avc1.4d0020', - 'does nothing for non legacy pattern' - ); - assert.equal( - mapLegacyAvcCodecs('mp4a.40.40'), - 'mp4a.40.40', - 'does nothing for non video codecs' - ); - - assert.equal( - mapLegacyAvcCodecs('avc1.66.30'), - 'avc1.42001e', - 'translates legacy video codec alone' - ); - assert.equal( - mapLegacyAvcCodecs('avc1.66.30, mp4a.40.2'), - 'avc1.42001e, mp4a.40.2', - 'translates legacy video codec when paired with audio' - ); - assert.equal( - mapLegacyAvcCodecs('mp4a.40.2, avc1.66.30'), - 'mp4a.40.2, avc1.42001e', - 'translates video codec when specified second' - ); -}); - -QUnit.test('translates legacy codecs', function(assert) { - assert.deepEqual( - translateLegacyCodecs(['avc1.66.30', 'avc1.66.30']), - ['avc1.42001e', 'avc1.42001e'], - 'translates legacy avc1.66.30 codec' - ); - - assert.deepEqual( - translateLegacyCodecs(['avc1.42C01E', 'avc1.42C01E']), - ['avc1.42C01E', 'avc1.42C01E'], - 'does not translate modern codecs' - ); - - assert.deepEqual( - translateLegacyCodecs(['avc1.42C01E', 'avc1.66.30']), - ['avc1.42C01E', 'avc1.42001e'], - 'only translates legacy codecs when mixed' - ); - - assert.deepEqual( - translateLegacyCodecs(['avc1.4d0020', 'avc1.100.41', 'avc1.77.41', - 'avc1.77.32', 'avc1.77.31', 'avc1.77.30', - 'avc1.66.30', 'avc1.66.21', 'avc1.42C01e']), - ['avc1.4d0020', 'avc1.640029', 'avc1.4d0029', - 'avc1.4d0020', 'avc1.4d001f', 'avc1.4d001e', - 'avc1.42001e', 'avc1.420015', 'avc1.42C01e'], - 'translates a whole bunch' - ); -}); - -QUnit.module('parseCodecs'); - -QUnit.test('parses text only codec string', function(assert) { - assert.deepEqual( - parseCodecs('stpp.ttml.im1t'), - [{mediaType: 'text', type: 'stpp.ttml.im1t', details: ''}], - 'parsed text only codec string' - ); -}); - -QUnit.test('parses video only codec string', function(assert) { - assert.deepEqual( - parseCodecs('avc1.42001e'), - [{mediaType: 'video', type: 'avc1', details: '.42001e'}], - 'parsed video only codec string' - ); -}); - -QUnit.test('parses audio only codec string', function(assert) { - assert.deepEqual( - parseCodecs('mp4a.40.2'), - [{mediaType: 'audio', type: 'mp4a', details: '.40.2'}], - 'parsed audio only codec string' - ); -}); - -QUnit.test('parses video, audio, and text codec string', function(assert) { - assert.deepEqual( - parseCodecs('avc1.42001e, mp4a.40.2, stpp.ttml.im1t'), - [ - {mediaType: 'video', type: 'avc1', details: '.42001e'}, - {mediaType: 'audio', type: 'mp4a', details: '.40.2'}, - {mediaType: 'text', type: 'stpp.ttml.im1t', details: ''} - ], - 'parsed video, audio, and text codec string' - ); -}); - -QUnit.test('parses video, audio, and text codec with mixed case', function(assert) { - assert.deepEqual( - parseCodecs('AvC1.42001E, Mp4A.40.E, stpp.TTML.im1T'), - [ - {mediaType: 'video', type: 'AvC1', details: '.42001E'}, - {mediaType: 'audio', type: 'Mp4A', details: '.40.E'}, - {mediaType: 'text', type: 'stpp.TTML.im1T', details: ''} - ], - 'parsed video, audio, and text codec string' - ); -}); - -QUnit.test('parses two unknown codec', function(assert) { - assert.deepEqual( - parseCodecs('fake.codec, other-fake'), - [ - {mediaType: 'unknown', type: 'fake.codec', details: ''}, - {mediaType: 'unknown', type: 'other-fake', details: ''} - ], - 'parsed faked codecs as video/audio' - ); -}); - -QUnit.test('parses an unknown codec with a known audio', function(assert) { - assert.deepEqual( - parseCodecs('fake.codec, mp4a.40.2'), - [ - {mediaType: 'unknown', type: 'fake.codec', details: ''}, - {mediaType: 'audio', type: 'mp4a', details: '.40.2'} - ], - 'parsed audio and unknwon' - ); -}); - -QUnit.test('parses an unknown codec with a known video', function(assert) { - assert.deepEqual( - parseCodecs('avc1.42001e, other-fake'), - [ - {mediaType: 'video', type: 'avc1', details: '.42001e'}, - {mediaType: 'unknown', type: 'other-fake', details: ''} - ], - 'parsed video and unknown' - ); -}); - -QUnit.test('parses an unknown codec with a known text', function(assert) { - assert.deepEqual( - parseCodecs('stpp.ttml.im1t, other-fake'), - [ - {mediaType: 'text', type: 'stpp.ttml.im1t', details: ''}, - {mediaType: 'unknown', type: 'other-fake', details: ''} - ], - 'parsed text and unknown' - ); -}); - -QUnit.test('parses an unknown codec with a known audio/video/text', function(assert) { - assert.deepEqual( - parseCodecs('fake.codec, avc1.42001e, mp4a.40.2, stpp.ttml.im1t'), - [ - {mediaType: 'unknown', type: 'fake.codec', details: ''}, - {mediaType: 'video', type: 'avc1', details: '.42001e'}, - {mediaType: 'audio', type: 'mp4a', details: '.40.2'}, - {mediaType: 'text', type: 'stpp.ttml.im1t', details: ''} - ], - 'parsed video/audio/text and unknown codecs' - ); -}); - -QUnit.module('codecsFromDefault'); - -QUnit.test('returns falsey when no audio group ID', function(assert) { - assert.notOk( - codecsFromDefault( - { mediaGroups: { AUDIO: {} } }, - '', - ), - 'returns falsey when no audio group ID' - ); -}); - -QUnit.test('returns falsey when no matching audio group', function(assert) { - assert.notOk( - codecsFromDefault( - { - mediaGroups: { - AUDIO: { - au1: { - en: { - default: false, - playlists: [{ - attributes: { CODECS: 'mp4a.40.2' } - }] - }, - es: { - default: true, - playlists: [{ - attributes: { CODECS: 'mp4a.40.5' } - }] - } - } - } - } - }, - 'au2' - ), - 'returned falsey when no matching audio group' - ); -}); - -QUnit.test('returns falsey when no default for audio group', function(assert) { - assert.notOk( - codecsFromDefault( - { - mediaGroups: { - AUDIO: { - au1: { - en: { - default: false, - playlists: [{ - attributes: { CODECS: 'mp4a.40.2' } - }] - }, - es: { - default: false, - playlists: [{ - attributes: { CODECS: 'mp4a.40.5' } - }] - } - } - } - } - }, - 'au1' - ), - 'returned falsey when no default for audio group' - ); -}); - -QUnit.test('returns parsed audio codecs for default in audio group', function(assert) { - assert.deepEqual( - codecsFromDefault( - { - mediaGroups: { - AUDIO: { - au1: { - en: { - default: false, - playlists: [{ - attributes: { CODECS: 'mp4a.40.2, mp4a.40.20' } - }] - }, - es: { - default: true, - playlists: [{ - attributes: { CODECS: 'mp4a.40.5, mp4a.40.7' } - }] - } - } - } - } - }, - 'au1' - ), - [ - {mediaType: 'audio', type: 'mp4a', details: '.40.5'}, - {mediaType: 'audio', type: 'mp4a', details: '.40.7'} - ], - 'returned parsed codec audio profile' - ); -}); - -QUnit.module('isVideoCodec'); -QUnit.test('works as expected', function(assert) { - [ - 'av1', - 'avc01', - 'avc1', - 'avc02', - 'avc2', - 'vp09', - 'vp9', - 'vp8', - 'vp08', - 'hvc1', - 'hev1', - 'theora', - 'mp4v' - ].forEach(function(codec) { - assert.ok(isVideoCodec(codec), `"${codec}" is seen as a video codec`); - assert.ok(isVideoCodec(` ${codec} `), `" ${codec} " is seen as video codec`); - assert.ok(isVideoCodec(codec.toUpperCase()), `"${codec.toUpperCase()}" is seen as video codec`); - }); - - ['invalid', 'foo', 'mp4a', 'opus', 'vorbis'].forEach(function(codec) { - assert.notOk(isVideoCodec(codec), `${codec} is not a video codec`); - }); - -}); - -QUnit.module('isAudioCodec'); -QUnit.test('works as expected', function(assert) { - [ - 'mp4a', - 'flac', - 'vorbis', - 'opus', - 'ac-3', - 'ac-4', - 'ec-3', - 'alac', - 'speex', - 'aac', - 'mp3' - ].forEach(function(codec) { - assert.ok(isAudioCodec(codec), `"${codec}" is seen as an audio codec`); - assert.ok(isAudioCodec(` ${codec} `), `" ${codec} " is seen as an audio codec`); - assert.ok(isAudioCodec(codec.toUpperCase()), `"${codec.toUpperCase()}" is seen as an audio codec`); - }); - - ['invalid', 'foo', 'bar', 'avc1', 'av1'].forEach(function(codec) { - assert.notOk(isAudioCodec(codec), `${codec} is not an audio codec`); - }); -}); - -QUnit.module('muxerSupportsCodec'); -QUnit.test('works as expected', function(assert) { - const validMuxerCodecs = []; - const invalidMuxerCodecs = []; - - unsupportedMuxerCodecs.forEach(function(badCodec) { - invalidMuxerCodecs.push(badCodec); - supportedMuxerCodecs.forEach(function(goodCodec) { - invalidMuxerCodecs.push(`${goodCodec}, ${badCodec}`); - }); - }); - - // generate all combinations of valid codecs - supportedMuxerCodecs.forEach(function(codec, i) { - validMuxerCodecs.push(codec); - - supportedMuxerCodecs.forEach(function(_codec, z) { - if (z === i) { - return; - } - validMuxerCodecs.push(`${codec}, ${_codec}`); - validMuxerCodecs.push(`${codec},${_codec}`); - }); - }); - - validMuxerCodecs.forEach(function(codec) { - assert.ok(muxerSupportsCodec(codec), `"${codec}" is supported`); - assert.ok(muxerSupportsCodec(` ${codec} `), `" ${codec} " is supported`); - assert.ok(muxerSupportsCodec(codec.toUpperCase()), `"${codec.toUpperCase()}" is supported`); - }); - - invalidMuxerCodecs.forEach(function(codec) { - assert.notOk(muxerSupportsCodec(codec), `${codec} not supported`); - }); -}); - -QUnit.module('browserSupportsCodec', { - beforeEach() { - this.oldMediaSource = window.MediaSource; - }, - afterEach() { - window.MediaSource = this.oldMediaSource; - } -}); - -QUnit.test('works as expected', function(assert) { - window.MediaSource = {isTypeSupported: () => true}; - assert.ok(browserSupportsCodec('test'), 'isTypeSupported true, browser does support codec'); - - window.MediaSource = {isTypeSupported: () => false}; - assert.notOk(browserSupportsCodec('test'), 'isTypeSupported false, browser does not support codec'); - - window.MediaSource = null; - assert.notOk(browserSupportsCodec('test'), 'no MediaSource, browser does not support codec'); - - window.MediaSource = {isTypeSupported: null}; - assert.notOk(browserSupportsCodec('test'), 'no isTypeSupported, browser does not support codec'); -}); - -QUnit.module('getMimeForCodec'); - -QUnit.test('works as expected', function(assert) { - // mp4 - assert.equal(getMimeForCodec('vp9,mp4a'), 'video/mp4;codecs="vp9,mp4a"', 'mp4 video/audio works'); - assert.equal(getMimeForCodec('vp9'), 'video/mp4;codecs="vp9"', 'mp4 video works'); - assert.equal(getMimeForCodec('mp4a'), 'audio/mp4;codecs="mp4a"', 'mp4 audio works'); - - // webm - assert.equal(getMimeForCodec('vp8,opus'), 'video/webm;codecs="vp8,opus"', 'webm video/audio works'); - assert.equal(getMimeForCodec('vp8'), 'video/webm;codecs="vp8"', 'webm video works'); - assert.equal(getMimeForCodec('vorbis'), 'audio/webm;codecs="vorbis"', 'webm audio works'); - - // ogg - assert.equal(getMimeForCodec('theora,vorbis'), 'video/ogg;codecs="theora,vorbis"', 'ogg video/audio works'); - assert.equal(getMimeForCodec('theora'), 'video/ogg;codecs="theora"', 'ogg video works'); - // ogg will never be selected for audio only - - // mixed - assert.equal(getMimeForCodec('opus'), 'audio/mp4;codecs="opus"', 'mp4 takes priority over everything'); - assert.equal(getMimeForCodec('vorbis'), 'audio/webm;codecs="vorbis"', 'webm takes priority over ogg'); - assert.equal(getMimeForCodec('foo'), 'video/mp4;codecs="foo"', 'mp4 is the default'); - - assert.notOk(getMimeForCodec(), 'invalid codec returns undefined'); - - assert.equal(getMimeForCodec('Mp4A.40.2,AvC1.42001E'), 'video/mp4;codecs="Mp4A.40.2,AvC1.42001E"', 'case is preserved'); - assert.equal(getMimeForCodec('stpp.ttml.im1t'), 'application/mp4;codecs="stpp.ttml.im1t"', 'text is parsed'); -}); diff --git a/node_modules/@videojs/vhs-utils/test/container.test.js b/node_modules/@videojs/vhs-utils/test/container.test.js deleted file mode 100644 index cf4e2c6..0000000 --- a/node_modules/@videojs/vhs-utils/test/container.test.js +++ /dev/null @@ -1,197 +0,0 @@ -import QUnit from 'qunit'; -import {detectContainerForBytes, isLikelyFmp4MediaSegment} from '../src/containers.js'; -import {stringToBytes, concatTypedArrays, toUint8} from '../src/byte-helpers.js'; - -const filler = (size) => { - const view = new Uint8Array(size); - - for (let i = 0; i < size; i++) { - view[i] = 0; - } - - return view; -}; - -const otherMp4Data = concatTypedArrays([0x00, 0x00, 0x00, 0x00], stringToBytes('stypiso')); -const id3Data = Array.prototype.slice.call(concatTypedArrays( - stringToBytes('ID3'), - // id3 header is 10 bytes without footer - // 10th byte is length 0x23 or 35 in decimal - // so a total length of 45 - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23], - // add in the id3 content - filler(35) -)); - -const id3DataWithFooter = Array.prototype.slice.call(concatTypedArrays( - stringToBytes('ID3'), - // id3 header is 20 bytes with footer - // "we have a footer" is the sixth byte - // 10th byte is length of 0x23 or 35 in decimal - // so a total length of 55 - [0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x23], - // add in the id3 content - filler(45) -)); - -const testData = { - // EBML tag + dataSize - // followed by DocType + dataSize and then actual data for that tag - 'mkv': concatTypedArrays([0x1a, 0x45, 0xdf, 0xa3, 0x99, 0x42, 0x82, 0x88], stringToBytes('matroska')), - 'webm': concatTypedArrays([0x1a, 0x45, 0xdf, 0xa3, 0x99, 0x42, 0x82, 0x88], stringToBytes('webm')), - 'flac': stringToBytes('fLaC'), - 'ogg': stringToBytes('OggS'), - 'aac': toUint8([0xFF, 0xF1]), - 'ac3': toUint8([0x0B, 0x77]), - 'mp3': toUint8([0xFF, 0xFB]), - '3gp': concatTypedArrays([0x00, 0x00, 0x00, 0x00], stringToBytes('ftyp3g')), - 'mp4': concatTypedArrays([0x00, 0x00, 0x00, 0x00], stringToBytes('ftypiso')), - 'mov': concatTypedArrays([0x00, 0x00, 0x00, 0x00], stringToBytes('ftypqt')), - 'avi': toUint8([0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x41, 0x56, 0x49]), - 'wav': toUint8([0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45]), - 'ts': toUint8([0x47]), - // seq_parameter_set_rbsp - 'h264': toUint8([0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0xc0, 0x0d, 0xd9, 0x01, 0xa1, 0xfa, 0x10, 0x00, 0x00, 0x03, 0x20, 0x00, 0x00, 0x95, 0xe0, 0xf1, 0x42, 0xa4, 0x80, 0x00, 0x00, 0x00, 0x01]), - // video_parameter_set_rbsp - 'h265': toUint8([0x00, 0x00, 0x00, 0x01, 0x40, 0x01, 0x0c, 0x01, 0xff, 0xff, 0x24, 0x08, 0x00, 0x00, 0x00, 0x9c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x78, 0x95, 0x98, 0x09, 0x00, 0x00, 0x00, 0x01]) -}; - -// seq_parameter_set_rbsp -const h265seq = toUint8([ - 0x00, 0x00, 0x00, 0x01, - 0x42, 0x01, 0x01, 0x21, - 0x60, 0x00, 0x00, 0x00, - 0x90, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x78, 0xa0, - 0x0d, 0x08, 0x0f, 0x16, - 0x59, 0x59, 0xa4, 0x93, - 0x2b, 0x9a, 0x02, 0x00, - 0x00, 0x00, 0x64, 0x00, - 0x00, 0x09, 0x5e, 0x10, - 0x00, 0x00, 0x00, 0x01 -]); - -const h264shortnal = Array.prototype.slice.call(testData.h264); - -// remove 0x00 from the front -h264shortnal.splice(0, 1); -// remove 0x00 from the back -h264shortnal.splice(h264shortnal.length - 2, 1); - -const h265shortnal = Array.prototype.slice.call(testData.h265); - -// remove 0x00 from the front -h265shortnal.splice(0, 1); -// remove 0x00 from the back -h265shortnal.splice(h265shortnal.length - 2, 1); - -QUnit.module('detectContainerForBytes'); - -QUnit.test('should identify known types', function(assert) { - Object.keys(testData).forEach(function(key) { - const data = new Uint8Array(testData[key]); - - assert.equal(detectContainerForBytes(testData[key]), key, `found ${key} with Array`); - assert.equal(detectContainerForBytes(data.buffer), key, `found ${key} with ArrayBuffer`); - assert.equal(detectContainerForBytes(data), key, `found ${key} with Uint8Array`); - }); - - const mp4Bytes = concatTypedArrays([0x00, 0x00, 0x00, 0x00], stringToBytes('styp')); - - assert.equal(detectContainerForBytes(mp4Bytes), 'mp4', 'styp mp4 detected as mp4'); - - // mp3/aac/flac/ac3 audio can have id3 data before the - // signature for the file, so we need to handle that. - ['mp3', 'aac', 'flac', 'ac3'].forEach(function(type) { - const dataWithId3 = concatTypedArrays(id3Data, testData[type]); - const dataWithId3Footer = concatTypedArrays(id3DataWithFooter, testData[type]); - const recursiveDataWithId3 = concatTypedArrays( - id3Data, - id3Data, - id3Data, - testData[type] - ); - const recursiveDataWithId3Footer = concatTypedArrays( - id3DataWithFooter, - id3DataWithFooter, - id3DataWithFooter, - testData[type] - ); - - const differentId3Sections = concatTypedArrays( - id3DataWithFooter, - id3Data, - id3DataWithFooter, - id3Data, - testData[type] - ); - - assert.equal(detectContainerForBytes(dataWithId3), type, `id3 skipped and ${type} detected`); - assert.equal(detectContainerForBytes(dataWithId3Footer), type, `id3 + footer skipped and ${type} detected`); - - assert.equal(detectContainerForBytes(recursiveDataWithId3), type, `id3 x3 skipped and ${type} detected`); - assert.equal(detectContainerForBytes(recursiveDataWithId3Footer), type, `id3 + footer x3 skipped and ${type} detected`); - assert.equal(detectContainerForBytes(differentId3Sections), type, `id3 with/without footer skipped and ${type} detected`); - - }); - - const notTs = concatTypedArrays(testData.ts, filler(188)); - const longTs = concatTypedArrays(testData.ts, filler(187), testData.ts); - const unsyncTs = concatTypedArrays(filler(187), testData.ts, filler(187), testData.ts); - const badTs = concatTypedArrays(filler(188), testData.ts, filler(187), testData.ts); - - assert.equal(detectContainerForBytes(longTs), 'ts', 'long ts data is detected'); - assert.equal(detectContainerForBytes(unsyncTs), 'ts', 'unsynced ts is detected'); - assert.equal(detectContainerForBytes(badTs), '', 'ts without a sync byte in 188 bytes is not detected'); - assert.equal(detectContainerForBytes(notTs), '', 'ts missing 0x47 at 188 is not ts at all'); - assert.equal(detectContainerForBytes(otherMp4Data), 'mp4', 'fmp4 detected as mp4'); - assert.equal(detectContainerForBytes(new Uint8Array()), '', 'no type'); - assert.equal(detectContainerForBytes(), '', 'no type'); - - assert.equal(detectContainerForBytes(h265seq), 'h265', 'h265 with only seq_parameter_set_rbsp, works'); - assert.equal(detectContainerForBytes(h265shortnal), 'h265', 'h265 with short nals works'); - assert.equal(detectContainerForBytes(h264shortnal), 'h264', 'h265 with short nals works'); -}); - -const createBox = function(type) { - const size = 0x20; - - return concatTypedArrays( - // size bytes - [0x00, 0x00, 0x00, size], - // box identfier styp - stringToBytes(type), - // filler data for size minus identfier and size bytes - filler(size - 8) - ); -}; - -QUnit.module('isLikelyFmp4MediaSegment'); -QUnit.test('works as expected', function(assert) { - const fmp4Data = concatTypedArrays( - createBox('styp'), - createBox('sidx'), - createBox('moof') - ); - - const mp4Data = concatTypedArrays( - createBox('ftyp'), - createBox('sidx'), - createBox('moov') - ); - - const fmp4Fake = concatTypedArrays( - createBox('test'), - createBox('moof'), - createBox('fooo'), - createBox('bar') - ); - - assert.ok(isLikelyFmp4MediaSegment(fmp4Data), 'fmp4 is recognized as fmp4'); - assert.ok(isLikelyFmp4MediaSegment(fmp4Fake), 'fmp4 with moof and unknown boxes is still fmp4'); - assert.ok(isLikelyFmp4MediaSegment(createBox('moof')), 'moof alone is recognized as fmp4'); - assert.notOk(isLikelyFmp4MediaSegment(mp4Data), 'mp4 is not recognized'); - assert.notOk(isLikelyFmp4MediaSegment(concatTypedArrays(id3DataWithFooter, testData.mp3)), 'bad data is not recognized'); - assert.notOk(isLikelyFmp4MediaSegment(new Uint8Array()), 'no errors on empty data'); - assert.notOk(isLikelyFmp4MediaSegment(), 'no errors on empty data'); -}); diff --git a/node_modules/@videojs/vhs-utils/test/decode-b64-to-uint8-array.test.js b/node_modules/@videojs/vhs-utils/test/decode-b64-to-uint8-array.test.js deleted file mode 100644 index e54401e..0000000 --- a/node_modules/@videojs/vhs-utils/test/decode-b64-to-uint8-array.test.js +++ /dev/null @@ -1,13 +0,0 @@ -import QUnit from 'qunit'; -import decodeB64ToUint8Array from '../src/decode-b64-to-uint8-array.js'; - -QUnit.module('decodeB64ToUint8Array'); - -// slightly modified version of m3u8 test -// 'parses Widevine #EXT-X-KEY attributes and attaches to manifest' -QUnit.test('can decode', function(assert) { - const b64 = 'AAAAPnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAB4iFnNoYWthX2NlYzJmNjRhYTc4OTBhMTFI49yVmwY'; - const result = decodeB64ToUint8Array(b64); - - assert.deepEqual(result.byteLength, 62, 'decoded'); -}); diff --git a/node_modules/@videojs/vhs-utils/test/ebml-helpers.test.js b/node_modules/@videojs/vhs-utils/test/ebml-helpers.test.js deleted file mode 100644 index 21b8db7..0000000 --- a/node_modules/@videojs/vhs-utils/test/ebml-helpers.test.js +++ /dev/null @@ -1,57 +0,0 @@ -import QUnit from 'qunit'; -import formatFiles from 'create-test-data!formats'; -import parsingFiles from 'create-test-data!parsing'; -import {parseData} from '../src/ebml-helpers.js'; -import {doesCodecMatch, codecsFromFile} from './test-helpers.js'; - -const files = []; - -// seperate files into modules by extension -Object.keys(formatFiles).forEach((file) => { - const extension = file.split('.').pop(); - - if (extension === 'webm' || extension === 'mkv') { - files.push(file); - } - -}); - -QUnit.module('parseData'); - -files.forEach((file) => QUnit.test(`${file} can be parsed for tracks and blocks`, function(assert) { - const {blocks, tracks} = parseData(formatFiles[file]()); - const codecs = codecsFromFile(file); - - assert.equal(tracks.length, Object.keys(codecs).length, 'tracks as expected'); - - tracks.forEach(function(track) { - assert.ok(doesCodecMatch(track.codec, codecs[track.type]), `${track.codec} is ${codecs[track.type]}`); - }); - - assert.ok(blocks.length, `has ${blocks.length} blocks`); - assert.notOk(blocks.filter((b) => !b.frames.length).length, 'all blocks have frame data'); -})); - -QUnit.test('xiph and ebml lacing', function(assert) { - const {blocks} = parseData(parsingFiles['xiph-ebml-lacing.mkv']()); - - assert.ok(blocks.length, `has ${blocks.length} blocks`); - assert.notOk(blocks.filter((b) => !b.frames.length).length, 'all blocks have frame data'); - assert.equal(blocks[1].lacing, 1, 'xiph lacing'); - assert.equal(blocks[2].lacing, 3, 'ebml lacing'); -}); - -QUnit.test('fixed lacing', function(assert) { - const {blocks} = parseData(parsingFiles['fixed-lacing.mkv']()); - - assert.ok(blocks.length, `has ${blocks.length} blocks`); - assert.notOk(blocks.filter((b) => !b.frames.length).length, 'all blocks have frame data'); - assert.equal(blocks[12].lacing, 2, 'fixed lacing'); -}); - -QUnit.test('live data', function(assert) { - const {blocks} = parseData(parsingFiles['live.mkv']()); - - assert.ok(blocks.length, 6, 'has 6 blocks, even with "infinite" cluster dataSize'); - assert.notOk(blocks.filter((b) => !b.frames.length).length, 'all blocks have frame data'); -}); diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/aac/aac.aac b/node_modules/@videojs/vhs-utils/test/fixtures/formats/aac/aac.aac deleted file mode 100644 index 4efda7e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/aac/aac.aac and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ac3/ac-3.ac3 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ac3/ac-3.ac3 deleted file mode 100644 index 93f630a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ac3/ac-3.ac3 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ac3/ec-3.ac3 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ac3/ec-3.ac3 deleted file mode 100644 index c291fb4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ac3/ec-3.ac3 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/aac.avi deleted file mode 100644 index e6b18c2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/ac-3.avi deleted file mode 100644 index 15e30cc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,aac.avi deleted file mode 100644 index 5495010..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,ac-3.avi deleted file mode 100644 index 91351b7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,ec-3.avi deleted file mode 100644 index 5898eec..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,flac.avi deleted file mode 100644 index 006a9fe..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp3.avi deleted file mode 100644 index 4f25e96..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.2.avi deleted file mode 100644 index 131ce1d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.29.avi deleted file mode 100644 index 95f5891..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.34.avi deleted file mode 100644 index 08f82e4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.5.avi deleted file mode 100644 index c1556da..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,speex.avi deleted file mode 100644 index 1f39297..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,vorbis.avi deleted file mode 100644 index 1bea933..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01.avi deleted file mode 100644 index bb2e36f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/av01.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,aac.avi deleted file mode 100644 index bc6255d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,ac-3.avi deleted file mode 100644 index 58f9f17..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,ec-3.avi deleted file mode 100644 index 300255b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,flac.avi deleted file mode 100644 index 2c657e3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp3.avi deleted file mode 100644 index bfda3dc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.2.avi deleted file mode 100644 index 1c324c6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.29.avi deleted file mode 100644 index ae05a38..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.34.avi deleted file mode 100644 index 65142dd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.5.avi deleted file mode 100644 index 309be08..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,speex.avi deleted file mode 100644 index b05b583..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,vorbis.avi deleted file mode 100644 index 1bca43f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d.avi deleted file mode 100644 index 3bde18d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.42c00d.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,aac.avi deleted file mode 100644 index b255ccd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,ac-3.avi deleted file mode 100644 index 30d4fd0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,ec-3.avi deleted file mode 100644 index 6180b70..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,flac.avi deleted file mode 100644 index 9bb22fc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp3.avi deleted file mode 100644 index affe531..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.2.avi deleted file mode 100644 index ccfeb95..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.29.avi deleted file mode 100644 index 0b940bf..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.34.avi deleted file mode 100644 index 4d3a449..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.5.avi deleted file mode 100644 index aea1066..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,speex.avi deleted file mode 100644 index fe1a330..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,vorbis.avi deleted file mode 100644 index 5ccaec0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e.avi deleted file mode 100644 index c5b745e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.4d401e.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,aac.avi deleted file mode 100644 index 4ac453d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,ac-3.avi deleted file mode 100644 index 8c0ceac..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,ec-3.avi deleted file mode 100644 index 6f6fcdc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,flac.avi deleted file mode 100644 index f47274c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp3.avi deleted file mode 100644 index 3166317..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.2.avi deleted file mode 100644 index 55d3e4a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.29.avi deleted file mode 100644 index d9d887c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.34.avi deleted file mode 100644 index 6d9ea11..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.5.avi deleted file mode 100644 index 60bbbe2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,speex.avi deleted file mode 100644 index 373a463..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,vorbis.avi deleted file mode 100644 index 53c73eb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028.avi deleted file mode 100644 index 63d61ff..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/avc1.640028.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/ec-3.avi deleted file mode 100644 index f584e12..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/flac.avi deleted file mode 100644 index 797b82a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,aac.avi deleted file mode 100644 index 77218a3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,ac-3.avi deleted file mode 100644 index e19cf0e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,ec-3.avi deleted file mode 100644 index 37f38cd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,flac.avi deleted file mode 100644 index 2bce16b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp3.avi deleted file mode 100644 index 3280052..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.2.avi deleted file mode 100644 index fd8d93e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.29.avi deleted file mode 100644 index 2d99cf8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.34.avi deleted file mode 100644 index 4d1699f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.5.avi deleted file mode 100644 index fb845ee..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,speex.avi deleted file mode 100644 index 6b43a31..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,vorbis.avi deleted file mode 100644 index 67a3ca3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90.avi deleted file mode 100644 index ce82fe3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H120.90.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,aac.avi deleted file mode 100644 index 960ba38..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,ac-3.avi deleted file mode 100644 index 3976f15..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,ec-3.avi deleted file mode 100644 index 7e5dad0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,flac.avi deleted file mode 100644 index 6db1d25..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp3.avi deleted file mode 100644 index 88e94d6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.2.avi deleted file mode 100644 index 7e3fcbc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.29.avi deleted file mode 100644 index 1bd1a80..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.34.avi deleted file mode 100644 index 08e533f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.5.avi deleted file mode 100644 index 360e1a7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,speex.avi deleted file mode 100644 index 3c2a773..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,vorbis.avi deleted file mode 100644 index 8150b14..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90.avi deleted file mode 100644 index 6c4d848..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.H150.90.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,aac.avi deleted file mode 100644 index 1685f8c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,ac-3.avi deleted file mode 100644 index 01f71fb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,ec-3.avi deleted file mode 100644 index f7ae8fa..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,flac.avi deleted file mode 100644 index 999a68d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp3.avi deleted file mode 100644 index 80fc9a7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.2.avi deleted file mode 100644 index d2e79ba..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.29.avi deleted file mode 100644 index 2cfd953..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.34.avi deleted file mode 100644 index 079edf6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.5.avi deleted file mode 100644 index 9178bbc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,speex.avi deleted file mode 100644 index 0b23a20..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,vorbis.avi deleted file mode 100644 index e709273..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90.avi deleted file mode 100644 index 6109d8b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.1.6.L60.90.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,aac.avi deleted file mode 100644 index 5666cd0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,ac-3.avi deleted file mode 100644 index ec91b3e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,ec-3.avi deleted file mode 100644 index 91e08f6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,flac.avi deleted file mode 100644 index b5276d7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp3.avi deleted file mode 100644 index 805215f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.2.avi deleted file mode 100644 index 7c0becd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.29.avi deleted file mode 100644 index 1569697..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.34.avi deleted file mode 100644 index a67caf4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.5.avi deleted file mode 100644 index ab7972d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,speex.avi deleted file mode 100644 index f5d5c07..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,vorbis.avi deleted file mode 100644 index 9282fc8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8.avi deleted file mode 100644 index 80e31b6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/hev1.4.10.H120.9c.8.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp3.avi deleted file mode 100644 index 0daf1ba..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.2.avi deleted file mode 100644 index a69240f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.29.avi deleted file mode 100644 index 37c2fb1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.34.avi deleted file mode 100644 index c2c98d8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.5.avi deleted file mode 100644 index d671149..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,aac.avi deleted file mode 100644 index ecbbcaa..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,ac-3.avi deleted file mode 100644 index 5939cc4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,ec-3.avi deleted file mode 100644 index 3c236ce..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,flac.avi deleted file mode 100644 index f8dbe8e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp3.avi deleted file mode 100644 index bf841e5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.2.avi deleted file mode 100644 index 1b661ff..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.29.avi deleted file mode 100644 index 9ee1993..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.34.avi deleted file mode 100644 index ed1ce64..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.5.avi deleted file mode 100644 index fa6685d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,speex.avi deleted file mode 100644 index 47f4330..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,vorbis.avi deleted file mode 100644 index 2dfbd07..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240.avi deleted file mode 100644 index f53257b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.240.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,aac.avi deleted file mode 100644 index 274483e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,ac-3.avi deleted file mode 100644 index cbcb80d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,ec-3.avi deleted file mode 100644 index fe67034..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,flac.avi deleted file mode 100644 index b8882f9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp3.avi deleted file mode 100644 index e8d3fcc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.2.avi deleted file mode 100644 index 99afdaf..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.29.avi deleted file mode 100644 index 7cc1cf6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.34.avi deleted file mode 100644 index 3ba78c5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.5.avi deleted file mode 100644 index 7f59b65..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,speex.avi deleted file mode 100644 index 5074e16..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,vorbis.avi deleted file mode 100644 index f25ab97..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9.avi deleted file mode 100644 index a8a8ebf..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/mp4v.20.9.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/speex.avi deleted file mode 100644 index e3332f3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,aac.avi deleted file mode 100644 index 8695004..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,ac-3.avi deleted file mode 100644 index 903816a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,ec-3.avi deleted file mode 100644 index 7085d01..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,flac.avi deleted file mode 100644 index db561b3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp3.avi deleted file mode 100644 index 274c02e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.2.avi deleted file mode 100644 index a37c112..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.29.avi deleted file mode 100644 index 07077b5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.34.avi deleted file mode 100644 index 722c716..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.5.avi deleted file mode 100644 index f460a98..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,speex.avi deleted file mode 100644 index ea53f51..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,vorbis.avi deleted file mode 100644 index 375c17c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora.avi deleted file mode 100644 index 0b30b97..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/theora.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vorbis.avi deleted file mode 100644 index 1bb0033..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,aac.avi deleted file mode 100644 index 34c0888..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,ac-3.avi deleted file mode 100644 index 99b747b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,ec-3.avi deleted file mode 100644 index 4611c57..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,flac.avi deleted file mode 100644 index 251cc25..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp3.avi deleted file mode 100644 index b216f27..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.2.avi deleted file mode 100644 index 4a0a8d9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.29.avi deleted file mode 100644 index de854df..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.34.avi deleted file mode 100644 index 4173363..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.5.avi deleted file mode 100644 index 62550ab..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,speex.avi deleted file mode 100644 index 5a8524e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,vorbis.avi deleted file mode 100644 index 8e64f12..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8.avi deleted file mode 100644 index 8a85c6e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp8.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,aac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,aac.avi deleted file mode 100644 index 8204dce..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,aac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,ac-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,ac-3.avi deleted file mode 100644 index 851d252..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,ac-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,ec-3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,ec-3.avi deleted file mode 100644 index 634580b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,ec-3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,flac.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,flac.avi deleted file mode 100644 index c2c6a6e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,flac.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp3.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp3.avi deleted file mode 100644 index ad6527c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp3.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.2.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.2.avi deleted file mode 100644 index 7ee42d7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.2.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.29.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.29.avi deleted file mode 100644 index 18f551e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.29.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.34.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.34.avi deleted file mode 100644 index 51eb1b0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.34.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.5.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.5.avi deleted file mode 100644 index 1cbd268..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,mp4a.40.5.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,speex.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,speex.avi deleted file mode 100644 index 68b311d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,speex.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,vorbis.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,vorbis.avi deleted file mode 100644 index 57bf528..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9,vorbis.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9.avi b/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9.avi deleted file mode 100644 index 36480f1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/avi/vp9.avi and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/flac/flac.flac b/node_modules/@videojs/vhs-utils/test/fixtures/formats/flac/flac.flac deleted file mode 100644 index c9e3071..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/flac/flac.flac and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h264/avc1.42c00d.h264 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/h264/avc1.42c00d.h264 deleted file mode 100644 index 3ed90ad..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h264/avc1.42c00d.h264 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h264/avc1.4d401e.h264 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/h264/avc1.4d401e.h264 deleted file mode 100644 index 85be2e9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h264/avc1.4d401e.h264 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h264/avc1.640028.h264 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/h264/avc1.640028.h264 deleted file mode 100644 index 4e4595d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h264/avc1.640028.h264 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.1.6.H120.90.h265 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.1.6.H120.90.h265 deleted file mode 100644 index a00b400..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.1.6.H120.90.h265 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.1.6.H150.90.h265 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.1.6.H150.90.h265 deleted file mode 100644 index 3b56444..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.1.6.H150.90.h265 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.1.6.L60.90.h265 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.1.6.L60.90.h265 deleted file mode 100644 index 2ee6623..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.1.6.L60.90.h265 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.4.10.H120.9c.8.h265 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.4.10.H120.9c.8.h265 deleted file mode 100644 index 38f914e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/h265/hev1.4.10.H120.9c.8.h265 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/aac.mkv deleted file mode 100644 index 82e3b4e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/ac-3.mkv deleted file mode 100644 index 3960f3f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/alac.mkv deleted file mode 100644 index 8869111..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,aac.mkv deleted file mode 100644 index 3654fbb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,ac-3.mkv deleted file mode 100644 index 19d53c6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,alac.mkv deleted file mode 100644 index 4b4e725..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,ec-3.mkv deleted file mode 100644 index 90454e6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,flac.mkv deleted file mode 100644 index 3c5b3e2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp3.mkv deleted file mode 100644 index 5ee256d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.2.mkv deleted file mode 100644 index ad75cb8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.29.mkv deleted file mode 100644 index ee630eb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.34.mkv deleted file mode 100644 index f8da68e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.5.mkv deleted file mode 100644 index 857f4aa..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,opus.mkv deleted file mode 100644 index 9146aa3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,speex.mkv deleted file mode 100644 index fe9e08b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,vorbis.mkv deleted file mode 100644 index cad9612..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110.mkv deleted file mode 100644 index 195d33b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/av01.0.00M.08.0.110.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,aac.mkv deleted file mode 100644 index 928f2d8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,ac-3.mkv deleted file mode 100644 index ea8bd4a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,alac.mkv deleted file mode 100644 index 6b58426..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,ec-3.mkv deleted file mode 100644 index 45f6b73..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,flac.mkv deleted file mode 100644 index 26e39d3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp3.mkv deleted file mode 100644 index da45c37..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.2.mkv deleted file mode 100644 index 6a8d030..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.29.mkv deleted file mode 100644 index 5349913..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.34.mkv deleted file mode 100644 index 38b8ee0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.5.mkv deleted file mode 100644 index 0473385..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,opus.mkv deleted file mode 100644 index 8610cf1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,speex.mkv deleted file mode 100644 index 0285d9b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,vorbis.mkv deleted file mode 100644 index cd0f1a9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d.mkv deleted file mode 100644 index 514d82e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.42c00d.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,aac.mkv deleted file mode 100644 index 829030b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,ac-3.mkv deleted file mode 100644 index 42e34a8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,alac.mkv deleted file mode 100644 index ac2d67b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,ec-3.mkv deleted file mode 100644 index 83a5339..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,flac.mkv deleted file mode 100644 index b03e9d3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp3.mkv deleted file mode 100644 index 2c80abd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.2.mkv deleted file mode 100644 index 18b94db..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.29.mkv deleted file mode 100644 index 9fe709c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.34.mkv deleted file mode 100644 index d54fbac..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.5.mkv deleted file mode 100644 index bdda1ea..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,opus.mkv deleted file mode 100644 index 543c467..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,speex.mkv deleted file mode 100644 index 810c162..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,vorbis.mkv deleted file mode 100644 index f195163..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e.mkv deleted file mode 100644 index 002bba4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.4d401e.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,aac.mkv deleted file mode 100644 index fd1ef6d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,ac-3.mkv deleted file mode 100644 index 15a57e5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,alac.mkv deleted file mode 100644 index e0f6bcb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,ec-3.mkv deleted file mode 100644 index 2e279ae..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,flac.mkv deleted file mode 100644 index aabcba9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp3.mkv deleted file mode 100644 index fcc197b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.2.mkv deleted file mode 100644 index 41e1a44..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.29.mkv deleted file mode 100644 index 3cfb5f3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.34.mkv deleted file mode 100644 index d069ebb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.5.mkv deleted file mode 100644 index d6da7df..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,opus.mkv deleted file mode 100644 index fc681cf..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,speex.mkv deleted file mode 100644 index 0e7f9d8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,vorbis.mkv deleted file mode 100644 index 786a985..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028.mkv deleted file mode 100644 index e4b9d71..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/avc1.640028.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/ec-3.mkv deleted file mode 100644 index 7ea403a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/flac.mkv deleted file mode 100644 index bfdc469..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,aac.mkv deleted file mode 100644 index 0e7154f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,ac-3.mkv deleted file mode 100644 index c86432a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,alac.mkv deleted file mode 100644 index 8c7b0e8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,ec-3.mkv deleted file mode 100644 index 73d0697..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,flac.mkv deleted file mode 100644 index 2a4dc80..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp3.mkv deleted file mode 100644 index 6e7aa68..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.2.mkv deleted file mode 100644 index 9ff689e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.29.mkv deleted file mode 100644 index eadc0c6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.34.mkv deleted file mode 100644 index 9a41aff..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.5.mkv deleted file mode 100644 index 4e922d5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,opus.mkv deleted file mode 100644 index b545f6a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,speex.mkv deleted file mode 100644 index d46518f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,vorbis.mkv deleted file mode 100644 index f69c627..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90.mkv deleted file mode 100644 index e160a39..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H120.90.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,aac.mkv deleted file mode 100644 index 70578dd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,ac-3.mkv deleted file mode 100644 index bbdae55..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,alac.mkv deleted file mode 100644 index 77ef2d6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,ec-3.mkv deleted file mode 100644 index a1a22c9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,flac.mkv deleted file mode 100644 index 5e7fce9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp3.mkv deleted file mode 100644 index d9ca04d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.2.mkv deleted file mode 100644 index a79a9ba..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.29.mkv deleted file mode 100644 index 6b4b899..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.34.mkv deleted file mode 100644 index ba6b378..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.5.mkv deleted file mode 100644 index ebd1319..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,opus.mkv deleted file mode 100644 index 31fa7ab..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,speex.mkv deleted file mode 100644 index 98bdbee..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,vorbis.mkv deleted file mode 100644 index 6e5ad77..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90.mkv deleted file mode 100644 index d58287c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.H150.90.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,aac.mkv deleted file mode 100644 index a8e8a7d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,ac-3.mkv deleted file mode 100644 index 9149a49..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,alac.mkv deleted file mode 100644 index 0d7b3cd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,ec-3.mkv deleted file mode 100644 index dc04fad..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,flac.mkv deleted file mode 100644 index 9b329c4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp3.mkv deleted file mode 100644 index 43a280a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.2.mkv deleted file mode 100644 index 5a353f1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.29.mkv deleted file mode 100644 index fc9d1fb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.34.mkv deleted file mode 100644 index 02be2a9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.5.mkv deleted file mode 100644 index 2ef7a0d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,opus.mkv deleted file mode 100644 index 0767e36..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,speex.mkv deleted file mode 100644 index 38f9490..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,vorbis.mkv deleted file mode 100644 index d487ee5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90.mkv deleted file mode 100644 index f815abe..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.1.6.L60.90.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,aac.mkv deleted file mode 100644 index 1dbfdad..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,ac-3.mkv deleted file mode 100644 index de875b1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,alac.mkv deleted file mode 100644 index 1e2d6c0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,ec-3.mkv deleted file mode 100644 index 0e26fe3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,flac.mkv deleted file mode 100644 index 3a81be4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp3.mkv deleted file mode 100644 index f0f9a3e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.2.mkv deleted file mode 100644 index 56d0af6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.29.mkv deleted file mode 100644 index 8604e68..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.34.mkv deleted file mode 100644 index 78a59fd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.5.mkv deleted file mode 100644 index 5e54f99..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,opus.mkv deleted file mode 100644 index 33d2ea8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,speex.mkv deleted file mode 100644 index 2190b27..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,vorbis.mkv deleted file mode 100644 index aa17036..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8.mkv deleted file mode 100644 index ee33c79..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/hev1.4.10.H120.9c.8.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp3.mkv deleted file mode 100644 index 0ddfde8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.2.mkv deleted file mode 100644 index dec5724..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.29.mkv deleted file mode 100644 index 96e3772..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.34.mkv deleted file mode 100644 index 22311ad..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.5.mkv deleted file mode 100644 index d0480e7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,aac.mkv deleted file mode 100644 index a8acc02..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,ac-3.mkv deleted file mode 100644 index c075f02..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,alac.mkv deleted file mode 100644 index 14d9f8f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,ec-3.mkv deleted file mode 100644 index be496d9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,flac.mkv deleted file mode 100644 index f4aafdc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp3.mkv deleted file mode 100644 index e8ecaf8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.2.mkv deleted file mode 100644 index cb99186..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.29.mkv deleted file mode 100644 index 49174e9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.34.mkv deleted file mode 100644 index 0d9231b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.5.mkv deleted file mode 100644 index 4ea9835..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,opus.mkv deleted file mode 100644 index 9726f80..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,speex.mkv deleted file mode 100644 index 2fba245..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,vorbis.mkv deleted file mode 100644 index 266ace8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240.mkv deleted file mode 100644 index 6e031b2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.240.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,aac.mkv deleted file mode 100644 index d26bcfb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,ac-3.mkv deleted file mode 100644 index 33589b5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,alac.mkv deleted file mode 100644 index 10feefb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,ec-3.mkv deleted file mode 100644 index db07063..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,flac.mkv deleted file mode 100644 index 1d3cc6e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp3.mkv deleted file mode 100644 index 64626a8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.2.mkv deleted file mode 100644 index 7cf9bc4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.29.mkv deleted file mode 100644 index 56b9805..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.34.mkv deleted file mode 100644 index 6cf21b9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.5.mkv deleted file mode 100644 index 0127293..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,opus.mkv deleted file mode 100644 index 8b89a10..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,speex.mkv deleted file mode 100644 index 6d19bc1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,vorbis.mkv deleted file mode 100644 index c9b02d9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9.mkv deleted file mode 100644 index bdc1bfb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/mp4v.20.9.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/opus.mkv deleted file mode 100644 index 1d4e7d5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/speex.mkv deleted file mode 100644 index b30919c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,aac.mkv deleted file mode 100644 index 5843852..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,ac-3.mkv deleted file mode 100644 index 2a7b8ee..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,alac.mkv deleted file mode 100644 index 2b6d610..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,ec-3.mkv deleted file mode 100644 index d263cb8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,flac.mkv deleted file mode 100644 index d7da5cf..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp3.mkv deleted file mode 100644 index d02b22b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.2.mkv deleted file mode 100644 index bff36ac..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.29.mkv deleted file mode 100644 index 1c742fa..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.34.mkv deleted file mode 100644 index b4d5d31..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.5.mkv deleted file mode 100644 index 674a75c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,opus.mkv deleted file mode 100644 index 0ef7839..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,speex.mkv deleted file mode 100644 index 848ed1a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,vorbis.mkv deleted file mode 100644 index 4f01d38..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora.mkv deleted file mode 100644 index 3bc731c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/theora.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vorbis.mkv deleted file mode 100644 index 29469a2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,aac.mkv deleted file mode 100644 index af2ae4c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,ac-3.mkv deleted file mode 100644 index 5bd4359..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,alac.mkv deleted file mode 100644 index c9e577c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,ec-3.mkv deleted file mode 100644 index c0a849e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,flac.mkv deleted file mode 100644 index 1686db5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp3.mkv deleted file mode 100644 index 3d31915..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.2.mkv deleted file mode 100644 index f36099c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.29.mkv deleted file mode 100644 index 043effa..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.34.mkv deleted file mode 100644 index 35495b4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.5.mkv deleted file mode 100644 index 21e3d8e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,opus.mkv deleted file mode 100644 index 2768a82..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,speex.mkv deleted file mode 100644 index 7bc8cb6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,vorbis.mkv deleted file mode 100644 index 8d3528c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8.mkv deleted file mode 100644 index b36192b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp8.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,aac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,aac.mkv deleted file mode 100644 index 65d09e0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,aac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,ac-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,ac-3.mkv deleted file mode 100644 index e75a429..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,ac-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,alac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,alac.mkv deleted file mode 100644 index 2fc891e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,alac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,ec-3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,ec-3.mkv deleted file mode 100644 index 10d40df..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,ec-3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,flac.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,flac.mkv deleted file mode 100644 index a8b1960..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,flac.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp3.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp3.mkv deleted file mode 100644 index 993088f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp3.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.2.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.2.mkv deleted file mode 100644 index 6179d0b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.2.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.29.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.29.mkv deleted file mode 100644 index 2366e84..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.29.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.34.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.34.mkv deleted file mode 100644 index 978d985..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.34.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.5.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.5.mkv deleted file mode 100644 index b15e0b7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,mp4a.40.5.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,opus.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,opus.mkv deleted file mode 100644 index 63017f5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,opus.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,speex.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,speex.mkv deleted file mode 100644 index d647cbc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,speex.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,vorbis.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,vorbis.mkv deleted file mode 100644 index a023107..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9,vorbis.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9.mkv deleted file mode 100644 index 7f93565..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mkv/vp9.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/aac.mov deleted file mode 100644 index 3bc8e60..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/ac-3.mov deleted file mode 100644 index ab9dbb2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/alac.mov deleted file mode 100644 index b1c03e2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,aac.mov deleted file mode 100644 index 7883e16..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,ac-3.mov deleted file mode 100644 index 15d2fcc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,alac.mov deleted file mode 100644 index 3a3844a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,ec-3.mov deleted file mode 100644 index bbab6fa..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp3.mov deleted file mode 100644 index 531cd77..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.2.mov deleted file mode 100644 index f0a611b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.29.mov deleted file mode 100644 index 63b6ff5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.34.mov deleted file mode 100644 index 57adc83..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.5.mov deleted file mode 100644 index 64d0db6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,speex.mov deleted file mode 100644 index 07c6b79..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,vorbis.mov deleted file mode 100644 index d4fe67b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d.mov deleted file mode 100644 index 0888fb2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.42c00d.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,aac.mov deleted file mode 100644 index ca79cce..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,ac-3.mov deleted file mode 100644 index 37be85f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,alac.mov deleted file mode 100644 index e32754f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,ec-3.mov deleted file mode 100644 index 5713650..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp3.mov deleted file mode 100644 index 9341a6d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.2.mov deleted file mode 100644 index 0aed412..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.29.mov deleted file mode 100644 index bb567e3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.34.mov deleted file mode 100644 index 35028e7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.5.mov deleted file mode 100644 index ce4b914..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,speex.mov deleted file mode 100644 index ef74351..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,vorbis.mov deleted file mode 100644 index 5148d43..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e.mov deleted file mode 100644 index 17f659c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.4d401e.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,aac.mov deleted file mode 100644 index b16553d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,ac-3.mov deleted file mode 100644 index cb3b187..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,alac.mov deleted file mode 100644 index 48fca00..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,ec-3.mov deleted file mode 100644 index d82c962..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp3.mov deleted file mode 100644 index 6fe1b8a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.2.mov deleted file mode 100644 index f9ca03a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.29.mov deleted file mode 100644 index 37c1730..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.34.mov deleted file mode 100644 index 18d8849..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.5.mov deleted file mode 100644 index 70b7e1a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,speex.mov deleted file mode 100644 index 44bffa4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,vorbis.mov deleted file mode 100644 index d4b4361..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028.mov deleted file mode 100644 index f2c9865..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/avc1.640028.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/ec-3.mov deleted file mode 100644 index 26b3277..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,aac.mov deleted file mode 100644 index d718756..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,ac-3.mov deleted file mode 100644 index 07f34cb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,alac.mov deleted file mode 100644 index 2b57e2c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,ec-3.mov deleted file mode 100644 index 8f94c27..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp3.mov deleted file mode 100644 index d37971d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.2.mov deleted file mode 100644 index 382e65d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.29.mov deleted file mode 100644 index 76d8cc4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.34.mov deleted file mode 100644 index d39c0e8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.5.mov deleted file mode 100644 index 887810f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,speex.mov deleted file mode 100644 index b4daa1d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,vorbis.mov deleted file mode 100644 index 884062c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90.mov deleted file mode 100644 index 8a4cab3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H120.90.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,aac.mov deleted file mode 100644 index a5aafe6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,ac-3.mov deleted file mode 100644 index 24afcf9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,alac.mov deleted file mode 100644 index 02a33b4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,ec-3.mov deleted file mode 100644 index bed1971..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp3.mov deleted file mode 100644 index 29aeb08..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.2.mov deleted file mode 100644 index bb623cb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.29.mov deleted file mode 100644 index 43a18db..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.34.mov deleted file mode 100644 index ee2bdbc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.5.mov deleted file mode 100644 index 544a73a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,speex.mov deleted file mode 100644 index 845172b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,vorbis.mov deleted file mode 100644 index d3f345b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90.mov deleted file mode 100644 index 2cb6758..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.H150.90.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,aac.mov deleted file mode 100644 index 388e2e8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,ac-3.mov deleted file mode 100644 index b72fc24..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,alac.mov deleted file mode 100644 index 56706e4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,ec-3.mov deleted file mode 100644 index a4ec394..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp3.mov deleted file mode 100644 index 16c28ad..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.2.mov deleted file mode 100644 index d8a552a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.29.mov deleted file mode 100644 index 5a30926..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.34.mov deleted file mode 100644 index 163212c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.5.mov deleted file mode 100644 index 94c5ebc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,speex.mov deleted file mode 100644 index f3ca4ab..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,vorbis.mov deleted file mode 100644 index 66c4753..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90.mov deleted file mode 100644 index f439e43..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.1.6.L60.90.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,aac.mov deleted file mode 100644 index f9eb0d8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,ac-3.mov deleted file mode 100644 index 2483796..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,alac.mov deleted file mode 100644 index d457c23..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,ec-3.mov deleted file mode 100644 index 637ee70..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp3.mov deleted file mode 100644 index 6f2ecee..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.2.mov deleted file mode 100644 index 732d65f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.29.mov deleted file mode 100644 index 3216fe4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.34.mov deleted file mode 100644 index 76983d4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.5.mov deleted file mode 100644 index 25e2ee9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,speex.mov deleted file mode 100644 index 527175f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,vorbis.mov deleted file mode 100644 index 90a7f0b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8.mov deleted file mode 100644 index 7e81e2a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hev1.4.10.H120.9c.8.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,aac.mov deleted file mode 100644 index 8e65d0e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,ac-3.mov deleted file mode 100644 index 11a14c7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,alac.mov deleted file mode 100644 index 0cf0876..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,ec-3.mov deleted file mode 100644 index 326b8ca..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp3.mov deleted file mode 100644 index cd8679a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.2.mov deleted file mode 100644 index 97af4db..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.29.mov deleted file mode 100644 index 8de01d2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.34.mov deleted file mode 100644 index b1cfd68..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.5.mov deleted file mode 100644 index e8b4d9e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,speex.mov deleted file mode 100644 index f19150a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,vorbis.mov deleted file mode 100644 index 77c36c2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90.mov deleted file mode 100644 index 92ca284..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/hvc1.1.6.H120.90.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp3.mov deleted file mode 100644 index e7e4be5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.2.mov deleted file mode 100644 index 3622df1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.29.mov deleted file mode 100644 index 0003a30..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.34.mov deleted file mode 100644 index 4f92bec..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.5.mov deleted file mode 100644 index bc50c89..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,aac.mov deleted file mode 100644 index d12ea74..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,ac-3.mov deleted file mode 100644 index 29346c0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,alac.mov deleted file mode 100644 index d0b1e8d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,ec-3.mov deleted file mode 100644 index 69d8cf5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp3.mov deleted file mode 100644 index 80b0a40..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.2.mov deleted file mode 100644 index 71e6974..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.29.mov deleted file mode 100644 index 311202e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.34.mov deleted file mode 100644 index e581858..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.5.mov deleted file mode 100644 index 9ebad60..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,speex.mov deleted file mode 100644 index 970b608..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,vorbis.mov deleted file mode 100644 index d008294..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240.mov deleted file mode 100644 index 24368d1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.240.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,aac.mov deleted file mode 100644 index 126d2e6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,ac-3.mov deleted file mode 100644 index 879463e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,alac.mov deleted file mode 100644 index 16a0ad3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,ec-3.mov deleted file mode 100644 index bb81387..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp3.mov deleted file mode 100644 index 89bca50..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.2.mov deleted file mode 100644 index 6d8de75..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.29.mov deleted file mode 100644 index 7f64e91..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.34.mov deleted file mode 100644 index 296fc08..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.5.mov deleted file mode 100644 index c72000a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,speex.mov deleted file mode 100644 index 0eb4959..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,vorbis.mov deleted file mode 100644 index 07d84c1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9.mov deleted file mode 100644 index c0a8051..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/mp4v.20.9.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/speex.mov deleted file mode 100644 index fb7af3b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,aac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,aac.mov deleted file mode 100644 index 54a838c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,aac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,ac-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,ac-3.mov deleted file mode 100644 index 59f473e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,ac-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,alac.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,alac.mov deleted file mode 100644 index 91a92bc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,alac.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,ec-3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,ec-3.mov deleted file mode 100644 index 6ca71cd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,ec-3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp3.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp3.mov deleted file mode 100644 index 4d0225f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp3.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.2.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.2.mov deleted file mode 100644 index d669632..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.2.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.29.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.29.mov deleted file mode 100644 index 6342ed7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.29.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.34.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.34.mov deleted file mode 100644 index 7de2d52..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.34.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.5.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.5.mov deleted file mode 100644 index 1929aca..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,mp4a.40.5.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,speex.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,speex.mov deleted file mode 100644 index 5d5d69e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,speex.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,vorbis.mov deleted file mode 100644 index 6b038e6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora,vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora.mov deleted file mode 100644 index 5a028f6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/theora.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/vorbis.mov b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/vorbis.mov deleted file mode 100644 index 29821a0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mov/vorbis.mov and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp3/mp3.mp3 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp3/mp3.mp3 deleted file mode 100644 index 4cd329f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp3/mp3.mp3 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/aac.mp4 deleted file mode 100644 index 9d98de6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/ac-3.mp4 deleted file mode 100644 index 6f486eb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,aac.mp4 deleted file mode 100644 index 062d8a3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,ac-3.mp4 deleted file mode 100644 index 49ea24e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,ec-3.mp4 deleted file mode 100644 index fd91f71..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp3.mp4 deleted file mode 100644 index 14d04ec..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.2.mp4 deleted file mode 100644 index e1da7dc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.29.mp4 deleted file mode 100644 index d6c6f3b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.34.mp4 deleted file mode 100644 index 6631f73..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.5.mp4 deleted file mode 100644 index addc621..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,vorbis.mp4 deleted file mode 100644 index 7f1009c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110.mp4 deleted file mode 100644 index 80c25e9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/av01.0.00M.08.0.110.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,aac.mp4 deleted file mode 100644 index 8279e1d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,ac-3.mp4 deleted file mode 100644 index 4250bb4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,ec-3.mp4 deleted file mode 100644 index fa3232a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp3.mp4 deleted file mode 100644 index 19b028d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.2.mp4 deleted file mode 100644 index 2540e75..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.29.mp4 deleted file mode 100644 index 7fe4505..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.34.mp4 deleted file mode 100644 index a2e8721..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.5.mp4 deleted file mode 100644 index e293ff3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,vorbis.mp4 deleted file mode 100644 index dbee69a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d.mp4 deleted file mode 100644 index 9684a6e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.42c00d.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,aac.mp4 deleted file mode 100644 index dfdd5b6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,ac-3.mp4 deleted file mode 100644 index 3986746..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,ec-3.mp4 deleted file mode 100644 index f6030f6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp3.mp4 deleted file mode 100644 index 10fb78e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.2.mp4 deleted file mode 100644 index 47636e0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.29.mp4 deleted file mode 100644 index 72f20a1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.34.mp4 deleted file mode 100644 index 16497b1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.5.mp4 deleted file mode 100644 index 396ca34..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,vorbis.mp4 deleted file mode 100644 index 366e1ef..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e.mp4 deleted file mode 100644 index f8bfde5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.4d401e.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,aac.mp4 deleted file mode 100644 index 3c47662..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,ac-3.mp4 deleted file mode 100644 index b003a21..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,ec-3.mp4 deleted file mode 100644 index 36b6572..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp3.mp4 deleted file mode 100644 index e184fe2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.2.mp4 deleted file mode 100644 index 8005a54..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.29.mp4 deleted file mode 100644 index 7cd1ca9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.34.mp4 deleted file mode 100644 index 10d5bde..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.5.mp4 deleted file mode 100644 index 5a8f9d1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,vorbis.mp4 deleted file mode 100644 index c605f3a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028.mp4 deleted file mode 100644 index e04376a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/avc1.640028.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/ec-3.mp4 deleted file mode 100644 index 17ef4ad..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,aac.mp4 deleted file mode 100644 index 01b7d7b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,ac-3.mp4 deleted file mode 100644 index 5636671..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,ec-3.mp4 deleted file mode 100644 index 2697f41..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp3.mp4 deleted file mode 100644 index f6506af..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.2.mp4 deleted file mode 100644 index 7b8cb7b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.29.mp4 deleted file mode 100644 index 455bc01..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.34.mp4 deleted file mode 100644 index 846e089..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.5.mp4 deleted file mode 100644 index 4305418..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,vorbis.mp4 deleted file mode 100644 index 0b544f6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90.mp4 deleted file mode 100644 index 552ff1e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H120.90.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,aac.mp4 deleted file mode 100644 index 8538261..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,ac-3.mp4 deleted file mode 100644 index d22d988..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,ec-3.mp4 deleted file mode 100644 index f7c33b4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp3.mp4 deleted file mode 100644 index eecba3f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.2.mp4 deleted file mode 100644 index 2845399..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.29.mp4 deleted file mode 100644 index 50c1767..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.34.mp4 deleted file mode 100644 index f5ff59d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.5.mp4 deleted file mode 100644 index a470ddd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,vorbis.mp4 deleted file mode 100644 index cc311c5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90.mp4 deleted file mode 100644 index 3341d7f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.H150.90.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,aac.mp4 deleted file mode 100644 index fb5bc56..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,ac-3.mp4 deleted file mode 100644 index c2f6818..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,ec-3.mp4 deleted file mode 100644 index 5c6eb01..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp3.mp4 deleted file mode 100644 index 47aca13..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.2.mp4 deleted file mode 100644 index 39e73f9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.29.mp4 deleted file mode 100644 index 55aacd8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.34.mp4 deleted file mode 100644 index 43e902c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.5.mp4 deleted file mode 100644 index db5a9f7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,vorbis.mp4 deleted file mode 100644 index 2663973..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90.mp4 deleted file mode 100644 index 40e9bd8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.1.6.L60.90.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,aac.mp4 deleted file mode 100644 index 3ba03a0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,ac-3.mp4 deleted file mode 100644 index 9cc79b5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,ec-3.mp4 deleted file mode 100644 index 538b603..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp3.mp4 deleted file mode 100644 index faf477b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.2.mp4 deleted file mode 100644 index 9709051..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.29.mp4 deleted file mode 100644 index 0d2bf22..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.34.mp4 deleted file mode 100644 index 7c828bd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.5.mp4 deleted file mode 100644 index 0775571..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,vorbis.mp4 deleted file mode 100644 index e1a45fc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8.mp4 deleted file mode 100644 index 26b0860..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hev1.4.10.H120.9c.8.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,aac.mp4 deleted file mode 100644 index aea34d7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,ac-3.mp4 deleted file mode 100644 index e211f35..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,ec-3.mp4 deleted file mode 100644 index ae7f68a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp3.mp4 deleted file mode 100644 index 09870ae..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.2.mp4 deleted file mode 100644 index 17f4ab9..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.29.mp4 deleted file mode 100644 index 533a853..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.34.mp4 deleted file mode 100644 index 504fa97..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.5.mp4 deleted file mode 100644 index 4cd9c6a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,vorbis.mp4 deleted file mode 100644 index 6eaa579..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90.mp4 deleted file mode 100644 index fbffeb3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/hvc1.1.6.H120.90.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp3.mp4 deleted file mode 100644 index 0cb4e2c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.2.mp4 deleted file mode 100644 index a943882..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.29.mp4 deleted file mode 100644 index bc3d0a2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.34.mp4 deleted file mode 100644 index 4e88863..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.5.mp4 deleted file mode 100644 index 2155a15..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,aac.mp4 deleted file mode 100644 index bec9ce2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,ac-3.mp4 deleted file mode 100644 index 08850a4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,ec-3.mp4 deleted file mode 100644 index 15c0117..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp3.mp4 deleted file mode 100644 index 03fdcb7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.2.mp4 deleted file mode 100644 index 80267ee..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.29.mp4 deleted file mode 100644 index c9e662b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.34.mp4 deleted file mode 100644 index 88fa3ea..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.5.mp4 deleted file mode 100644 index 84ecb92..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,vorbis.mp4 deleted file mode 100644 index 13d5c82..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240.mp4 deleted file mode 100644 index 6069793..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.240.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,aac.mp4 deleted file mode 100644 index 23777ac..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,ac-3.mp4 deleted file mode 100644 index abf7e8b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,ec-3.mp4 deleted file mode 100644 index 8651ced..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp3.mp4 deleted file mode 100644 index d55b2bc..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.2.mp4 deleted file mode 100644 index c73605a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.29.mp4 deleted file mode 100644 index e9d41cb..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.34.mp4 deleted file mode 100644 index 1558463..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.5.mp4 deleted file mode 100644 index beecc39..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,vorbis.mp4 deleted file mode 100644 index 25d249c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9.mp4 deleted file mode 100644 index 28ecb23..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/mp4v.20.9.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vorbis.mp4 deleted file mode 100644 index 6110a88..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,aac.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,aac.mp4 deleted file mode 100644 index c05f050..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,aac.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,ac-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,ac-3.mp4 deleted file mode 100644 index a425440..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,ac-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,ec-3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,ec-3.mp4 deleted file mode 100644 index 6cc2116..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,ec-3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp3.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp3.mp4 deleted file mode 100644 index 7c2344c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp3.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.2.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.2.mp4 deleted file mode 100644 index b3f08ee..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.2.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.29.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.29.mp4 deleted file mode 100644 index f72e284..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.29.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.34.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.34.mp4 deleted file mode 100644 index 7a2107f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.34.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.5.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.5.mp4 deleted file mode 100644 index 8ebf010..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,mp4a.40.5.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,vorbis.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,vorbis.mp4 deleted file mode 100644 index d1c480a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00,vorbis.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00.mp4 b/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00.mp4 deleted file mode 100644 index ed2e5c6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/mp4/vp09.01.00.00.00.00.00.20.00.mp4 and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/flac.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/flac.ogg deleted file mode 100644 index ee91eb6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/flac.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/opus.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/opus.ogg deleted file mode 100644 index c529813..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/opus.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/speex.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/speex.ogg deleted file mode 100644 index 21853af..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/speex.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,flac.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,flac.ogg deleted file mode 100644 index 3ada65b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,flac.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,opus.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,opus.ogg deleted file mode 100644 index 142f9b5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,opus.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,speex.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,speex.ogg deleted file mode 100644 index 5b0343f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,speex.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,vorbis.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,vorbis.ogg deleted file mode 100644 index 0068dab..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora,vorbis.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora.ogg deleted file mode 100644 index e8503f1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/theora.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vorbis.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vorbis.ogg deleted file mode 100644 index 6fd59c1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vorbis.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,flac.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,flac.ogg deleted file mode 100644 index f1f52ce..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,flac.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,opus.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,opus.ogg deleted file mode 100644 index 6288248..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,opus.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,speex.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,speex.ogg deleted file mode 100644 index e1f5ce7..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,speex.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,vorbis.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,vorbis.ogg deleted file mode 100644 index 30e9e33..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8,vorbis.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8.ogg b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8.ogg deleted file mode 100644 index 2c5069a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ogg/vp8.ogg and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/aac.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/aac.ts deleted file mode 100644 index 6b59e12..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/aac.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/ac-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/ac-3.ts deleted file mode 100644 index 550fc17..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/ac-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,aac.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,aac.ts deleted file mode 100644 index c0a2922..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,aac.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,ac-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,ac-3.ts deleted file mode 100644 index 8a1da14..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,ac-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,ec-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,ec-3.ts deleted file mode 100644 index 6c5bea3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,ec-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,mp3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,mp3.ts deleted file mode 100644 index dfb9b5f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,mp3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,mp4a.40.2.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,mp4a.40.2.ts deleted file mode 100644 index 78f5996..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,mp4a.40.2.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,mp4a.40.34.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,mp4a.40.34.ts deleted file mode 100644 index 89ce256..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,mp4a.40.34.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,opus.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,opus.ts deleted file mode 100644 index 25a39d8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d,opus.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d.ts deleted file mode 100644 index a574be4..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.42c00d.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,aac.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,aac.ts deleted file mode 100644 index 9678801..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,aac.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,ac-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,ac-3.ts deleted file mode 100644 index 56288e6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,ac-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,ec-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,ec-3.ts deleted file mode 100644 index 3c07267..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,ec-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,mp3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,mp3.ts deleted file mode 100644 index ef31fd5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,mp3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,mp4a.40.2.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,mp4a.40.2.ts deleted file mode 100644 index a7fd9fe..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,mp4a.40.2.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,mp4a.40.34.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,mp4a.40.34.ts deleted file mode 100644 index 2f103a8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,mp4a.40.34.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,opus.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,opus.ts deleted file mode 100644 index ec697c6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e,opus.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e.ts deleted file mode 100644 index afc51c0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.4d401e.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,aac.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,aac.ts deleted file mode 100644 index 05de94f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,aac.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,ac-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,ac-3.ts deleted file mode 100644 index 020ddb3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,ac-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,ec-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,ec-3.ts deleted file mode 100644 index 2d64a6a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,ec-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,mp3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,mp3.ts deleted file mode 100644 index 058ffe1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,mp3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,mp4a.40.2.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,mp4a.40.2.ts deleted file mode 100644 index 881da13..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,mp4a.40.2.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,mp4a.40.34.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,mp4a.40.34.ts deleted file mode 100644 index a53ec6d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,mp4a.40.34.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,opus.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,opus.ts deleted file mode 100644 index 0e51e4f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028,opus.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028.ts deleted file mode 100644 index bac5a36..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/avc1.640028.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/ec-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/ec-3.ts deleted file mode 100644 index c2e24ae..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/ec-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,aac.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,aac.ts deleted file mode 100644 index 31e3cf8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,aac.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,ac-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,ac-3.ts deleted file mode 100644 index 5823056..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,ac-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,ec-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,ec-3.ts deleted file mode 100644 index 9322f72..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,ec-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,mp3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,mp3.ts deleted file mode 100644 index 34b534e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,mp3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,mp4a.40.2.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,mp4a.40.2.ts deleted file mode 100644 index 1d651f8..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,mp4a.40.2.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,mp4a.40.34.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,mp4a.40.34.ts deleted file mode 100644 index 98e7fda..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,mp4a.40.34.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,opus.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,opus.ts deleted file mode 100644 index 0fdb695..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90,opus.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90.ts deleted file mode 100644 index 7cab747..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H120.90.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,aac.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,aac.ts deleted file mode 100644 index e256157..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,aac.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,ac-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,ac-3.ts deleted file mode 100644 index fc2ae0b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,ac-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,ec-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,ec-3.ts deleted file mode 100644 index ae320bd..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,ec-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,mp3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,mp3.ts deleted file mode 100644 index 2844184..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,mp3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,mp4a.40.2.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,mp4a.40.2.ts deleted file mode 100644 index 6461237..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,mp4a.40.2.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,mp4a.40.34.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,mp4a.40.34.ts deleted file mode 100644 index db60431..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,mp4a.40.34.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,opus.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,opus.ts deleted file mode 100644 index 3bfe317..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90,opus.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90.ts deleted file mode 100644 index 9ce0e25..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.H150.90.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,aac.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,aac.ts deleted file mode 100644 index c48f7db..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,aac.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,ac-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,ac-3.ts deleted file mode 100644 index 6f0d850..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,ac-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,ec-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,ec-3.ts deleted file mode 100644 index 571352c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,ec-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,mp3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,mp3.ts deleted file mode 100644 index 84d877a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,mp3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,mp4a.40.2.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,mp4a.40.2.ts deleted file mode 100644 index 969ed1e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,mp4a.40.2.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,mp4a.40.34.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,mp4a.40.34.ts deleted file mode 100644 index 65652e2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,mp4a.40.34.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,opus.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,opus.ts deleted file mode 100644 index e2f46f6..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90,opus.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90.ts deleted file mode 100644 index bb5bb20..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.1.6.L60.90.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,aac.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,aac.ts deleted file mode 100644 index cf66d90..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,aac.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,ac-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,ac-3.ts deleted file mode 100644 index 043e75f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,ac-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,ec-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,ec-3.ts deleted file mode 100644 index 155be5a..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,ec-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,mp3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,mp3.ts deleted file mode 100644 index c04ea74..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,mp3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,mp4a.40.2.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,mp4a.40.2.ts deleted file mode 100644 index 70085d0..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,mp4a.40.2.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,mp4a.40.34.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,mp4a.40.34.ts deleted file mode 100644 index 9639d18..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,mp4a.40.34.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,opus.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,opus.ts deleted file mode 100644 index bbe0f33..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8,opus.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8.ts deleted file mode 100644 index 9502f20..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/hev1.4.10.H120.9c.8.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp3.ts deleted file mode 100644 index 089f35d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4a.40.2.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4a.40.2.ts deleted file mode 100644 index 139682b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4a.40.2.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4a.40.34.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4a.40.34.ts deleted file mode 100644 index 9673370..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4a.40.34.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,aac.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,aac.ts deleted file mode 100644 index ebd9dda..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,aac.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,ac-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,ac-3.ts deleted file mode 100644 index e2a3834..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,ac-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,ec-3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,ec-3.ts deleted file mode 100644 index 960a19f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,ec-3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,mp3.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,mp3.ts deleted file mode 100644 index 48bd9b5..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,mp3.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,mp4a.40.2.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,mp4a.40.2.ts deleted file mode 100644 index ac92b8c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,mp4a.40.2.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,mp4a.40.34.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,mp4a.40.34.ts deleted file mode 100644 index 65a5c1f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,mp4a.40.34.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,opus.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,opus.ts deleted file mode 100644 index c5f038b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20,opus.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20.ts deleted file mode 100644 index 3ad6a03..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/mp4v.20.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/opus.ts b/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/opus.ts deleted file mode 100644 index 3da26c1..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/ts/opus.ts and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/aac.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/aac.wav deleted file mode 100644 index 2c3ebbf..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/aac.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/ac-3.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/ac-3.wav deleted file mode 100644 index 82297d2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/ac-3.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/ec-3.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/ec-3.wav deleted file mode 100644 index 1faa4ee..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/ec-3.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/flac.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/flac.wav deleted file mode 100644 index 3831175..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/flac.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp3.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp3.wav deleted file mode 100644 index 940fe81..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp3.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.2.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.2.wav deleted file mode 100644 index cf0c355..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.2.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.29.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.29.wav deleted file mode 100644 index 6fb6e90..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.29.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.34.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.34.wav deleted file mode 100644 index 166ae59..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.34.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.5.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.5.wav deleted file mode 100644 index 0ac807b..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/mp4a.40.5.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/speex.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/speex.wav deleted file mode 100644 index 70a75b2..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/speex.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/vorbis.wav b/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/vorbis.wav deleted file mode 100644 index 1ccec6f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/wav/vorbis.wav and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/av01.0.00M.08.0.110,opus.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/av01.0.00M.08.0.110,opus.webm deleted file mode 100644 index 25abf06..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/av01.0.00M.08.0.110,opus.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/av01.0.00M.08.0.110,vorbis.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/av01.0.00M.08.0.110,vorbis.webm deleted file mode 100644 index dfe8f32..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/av01.0.00M.08.0.110,vorbis.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/av01.0.00M.08.0.110.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/av01.0.00M.08.0.110.webm deleted file mode 100644 index 509d826..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/av01.0.00M.08.0.110.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/opus.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/opus.webm deleted file mode 100644 index 34bb047..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/opus.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vorbis.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vorbis.webm deleted file mode 100644 index 49a9d71..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vorbis.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp8,opus.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp8,opus.webm deleted file mode 100644 index b180c4f..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp8,opus.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp8,vorbis.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp8,vorbis.webm deleted file mode 100644 index 1d0153e..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp8,vorbis.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp8.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp8.webm deleted file mode 100644 index bc87542..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp8.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp9,opus.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp9,opus.webm deleted file mode 100644 index ce4f64d..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp9,opus.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp9,vorbis.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp9,vorbis.webm deleted file mode 100644 index c2a3f36..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp9,vorbis.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp9.webm b/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp9.webm deleted file mode 100644 index 2981d53..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/formats/webm/vp9.webm and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/parsing/mkv/fixed-lacing.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/parsing/mkv/fixed-lacing.mkv deleted file mode 100644 index acf0bc3..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/parsing/mkv/fixed-lacing.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/parsing/mkv/live.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/parsing/mkv/live.mkv deleted file mode 100644 index 4b7ec7c..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/parsing/mkv/live.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/fixtures/parsing/mkv/xiph-ebml-lacing.mkv b/node_modules/@videojs/vhs-utils/test/fixtures/parsing/mkv/xiph-ebml-lacing.mkv deleted file mode 100644 index 65a7a83..0000000 Binary files a/node_modules/@videojs/vhs-utils/test/fixtures/parsing/mkv/xiph-ebml-lacing.mkv and /dev/null differ diff --git a/node_modules/@videojs/vhs-utils/test/format-parser.test.js b/node_modules/@videojs/vhs-utils/test/format-parser.test.js deleted file mode 100644 index 5058085..0000000 --- a/node_modules/@videojs/vhs-utils/test/format-parser.test.js +++ /dev/null @@ -1,33 +0,0 @@ -import QUnit from 'qunit'; -import formatFiles from 'create-test-data!formats'; -import {parseFormatForBytes} from '../src/format-parser.js'; -import {doesCodecMatch, codecsFromFile} from './test-helpers.js'; - -const modules = {}; - -// seperate files into modules by extension -Object.keys(formatFiles).forEach((file) => { - const extension = file.split('.').pop(); - - modules[extension] = modules[extension] || []; - modules[extension].push(file); -}); - -QUnit.module('parseFormatForBytes', () => Object.keys(modules).forEach(function(module) { - const files = modules[module]; - - QUnit.module(module); - - files.forEach((file) => QUnit.test(`${file} can be identified`, function(assert) { - const {codecs, container} = parseFormatForBytes(formatFiles[file]()); - const expectedCodecs = codecsFromFile(file); - - assert.equal(container, module, module); - Object.keys(expectedCodecs).forEach(function(type) { - const expectedCodec = expectedCodecs[type]; - const codec = codecs[type]; - - assert.ok(doesCodecMatch(codec, expectedCodec), `${codec} is ${expectedCodec}`); - }); - })); -})); diff --git a/node_modules/@videojs/vhs-utils/test/media-groups.test.js b/node_modules/@videojs/vhs-utils/test/media-groups.test.js deleted file mode 100644 index 4d16b86..0000000 --- a/node_modules/@videojs/vhs-utils/test/media-groups.test.js +++ /dev/null @@ -1,171 +0,0 @@ -import QUnit from 'qunit'; -import { forEachMediaGroup } from '../src/media-groups'; - -QUnit.module('forEachMediaGroup'); - -QUnit.test('runs callback for each audio media group', function(assert) { - const master = { - mediaGroups: { - AUDIO: { - au1: { - en: { en: 'en' }, - es: { es: 'es' } - }, - au2: { - de: { de: 'de' }, - fr: { fr: 'fr' } - } - }, - OTHER: { - other1: { - other11: { other11: 'other11' }, - other12: { other12: 'other12' } - }, - other2: { - other21: { other21: 'other21' }, - other22: { other22: 'other22' } - } - } - } - }; - const iteratedMediaGroups = []; - - forEachMediaGroup( - master, - ['AUDIO'], - (mediaGroup) => iteratedMediaGroups.push(mediaGroup) - ); - - assert.deepEqual( - iteratedMediaGroups, - [ - { en: 'en' }, - { es: 'es' }, - { de: 'de' }, - { fr: 'fr' } - ], - 'iterated audio media groups' - ); -}); - -QUnit.test('runs callback for each subtitle media group', function(assert) { - const master = { - mediaGroups: { - SUBTITLES: { - sub1: { - en: { en: 'en' }, - es: { es: 'es' } - }, - sub2: { - de: { de: 'de' }, - fr: { fr: 'fr' } - } - }, - OTHER: { - other1: { - other11: { other11: 'other11' }, - other12: { other12: 'other12' } - }, - other2: { - other21: { other21: 'other21' }, - other22: { other22: 'other22' } - } - } - } - }; - const iteratedMediaGroups = []; - - forEachMediaGroup( - master, - ['SUBTITLES'], - (mediaGroup) => iteratedMediaGroups.push(mediaGroup) - ); - - assert.deepEqual( - iteratedMediaGroups, - [ - { en: 'en' }, - { es: 'es' }, - { de: 'de' }, - { fr: 'fr' } - ], - 'iterated subtitles media groups' - ); -}); - -QUnit.test('runs callback for each audio and subtitles media group', function(assert) { - const master = { - mediaGroups: { - AUDIO: { - au1: { - en: { en: 'en' }, - es: { es: 'es' } - }, - au2: { - de: { de: 'de' }, - fr: { fr: 'fr' } - } - }, - SUBTITLES: { - sub1: { - enS: { enS: 'enS' }, - esS: { esS: 'esS' } - }, - sub2: { - deS: { deS: 'deS' }, - frS: { frS: 'frS' } - } - }, - OTHER: { - other1: { - other11: { other11: 'other11' }, - other12: { other12: 'other12' } - }, - other2: { - other21: { other21: 'other21' }, - other22: { other22: 'other22' } - } - } - } - }; - const iteratedMediaGroups = []; - - forEachMediaGroup( - master, - ['AUDIO', 'SUBTITLES'], - (mediaGroup) => iteratedMediaGroups.push(mediaGroup) - ); - - assert.deepEqual( - iteratedMediaGroups, - [ - { en: 'en' }, - { es: 'es' }, - { de: 'de' }, - { fr: 'fr' }, - { enS: 'enS' }, - { esS: 'esS' }, - { deS: 'deS' }, - { frS: 'frS' } - ], - 'iterated audio and subtitles media groups' - ); -}); - -QUnit.test('does not run callback for non specified media groups', function(assert) { - const master = { - mediaGroups: { - 'VIDEO': { v1: { en: { en: 'en' } } }, - 'CLOSED-CAPTIONS': { cc1: { en: { en: 'en' } } } - } - }; - const iteratedMediaGroups = []; - - forEachMediaGroup( - master, - ['AUDIO', 'SUBTITLES'], - (mediaGroup) => iteratedMediaGroups.push(mediaGroup) - ); - - assert.deepEqual(iteratedMediaGroups, [], 'did not iterate non specified media groups'); -}); diff --git a/node_modules/@videojs/vhs-utils/test/media-types.test.js b/node_modules/@videojs/vhs-utils/test/media-types.test.js deleted file mode 100644 index 9997d5d..0000000 --- a/node_modules/@videojs/vhs-utils/test/media-types.test.js +++ /dev/null @@ -1,41 +0,0 @@ -import QUnit from 'qunit'; -import { simpleTypeFromSourceType } from '../src/media-types'; - -QUnit.module('simpleTypeFromSourceType'); - -QUnit.test('simpleTypeFromSourceType converts HLS mime types to hls', function(assert) { - assert.equal( - simpleTypeFromSourceType('aPplicatiOn/x-MPegUrl'), - 'hls', - 'supports application/x-mpegurl' - ); - assert.equal( - simpleTypeFromSourceType('aPplicatiOn/VnD.aPPle.MpEgUrL'), - 'hls', - 'supports application/vnd.apple.mpegurl' - ); -}); - -QUnit.test('simpleTypeFromSourceType converts DASH mime type to dash', function(assert) { - assert.equal( - simpleTypeFromSourceType('aPplication/dAsh+xMl'), - 'dash', - 'supports application/dash+xml' - ); -}); - -QUnit.test( - 'simpleTypeFromSourceType does not convert non HLS/DASH mime types', - function(assert) { - assert.notOk(simpleTypeFromSourceType('video/mp4'), 'does not support video/mp4'); - assert.notOk(simpleTypeFromSourceType('video/x-flv'), 'does not support video/x-flv'); - } -); - -QUnit.test('simpleTypeFromSourceType converts VHS media type to vhs-json', function(assert) { - assert.equal( - simpleTypeFromSourceType('application/vnd.videojs.vhs+json'), - 'vhs-json', - 'supports application/vnd.videojs.vhs+json' - ); -}); diff --git a/node_modules/@videojs/vhs-utils/test/resolve-url.test.js b/node_modules/@videojs/vhs-utils/test/resolve-url.test.js deleted file mode 100644 index 7a1f8a0..0000000 --- a/node_modules/@videojs/vhs-utils/test/resolve-url.test.js +++ /dev/null @@ -1,49 +0,0 @@ -import QUnit from 'qunit'; -import window from 'global/window'; -import resolveUrl from '../src/resolve-url'; - -// A modified subset of tests from https://github.com/tjenkinson/url-toolkit - -QUnit.module('URL resolver'); - -QUnit.test('works with a selection of valid urls', function(assert) { - let currentLocation = ''; - let currentPath = ''; - - if (window.location && window.location.protocol) { - currentLocation = window.location.protocol + '//' + window.location.host; - currentPath = window.location.pathname.split('/').slice(0, -1).join('/'); - } - - assert.equal( - resolveUrl('http://a.com/b/cd/e.m3u8', 'https://example.com/z.ts'), - 'https://example.com/z.ts' - ); - assert.equal(resolveUrl('http://a.com/b/cd/e.m3u8', 'z.ts'), 'http://a.com/b/cd/z.ts'); - assert.equal(resolveUrl('//a.com/b/cd/e.m3u8', 'z.ts'), '//a.com/b/cd/z.ts'); - assert.equal( - resolveUrl('/a/b/cd/e.m3u8', 'https://example.com:8080/z.ts'), - 'https://example.com:8080/z.ts' - ); - assert.equal(resolveUrl('/a/b/cd/e.m3u8', 'z.ts'), currentLocation + '/a/b/cd/z.ts'); - assert.equal(resolveUrl('/a/b/cd/e.m3u8', '../../../z.ts'), currentLocation + '/z.ts'); - - assert.equal( - resolveUrl('data:application/dash+xml;charset=utf-8,http%3A%2F%2Fexample.com', 'hello.m3u8'), - // we need to add the currentPath because we're actually working relative to window.location - currentLocation + currentPath + '/hello.m3u8', - 'resolves urls relative to window when given a data base url' - ); - - assert.equal( - resolveUrl('data:application/dash+xml;charset=utf-8,http%3A%2F%2Fexample.com', 'http://example.com/hello.m3u8'), - 'http://example.com/hello.m3u8', - 'absolute urls should still be absolute even with a data uri' - ); - - assert.equal( - resolveUrl('http://example.com', 'data:application/dash+xml;charset=utf-8,http%3A%2F%2Fexample.com'), - 'data:application/dash+xml;charset=utf-8,http%3A%2F%2Fexample.com', - 'data uri is treated as an absolute url' - ); -}); diff --git a/node_modules/@videojs/vhs-utils/test/stream.test.js b/node_modules/@videojs/vhs-utils/test/stream.test.js deleted file mode 100644 index ed38dc7..0000000 --- a/node_modules/@videojs/vhs-utils/test/stream.test.js +++ /dev/null @@ -1,51 +0,0 @@ -import QUnit from 'qunit'; -import Stream from '../src/stream'; - -QUnit.module('stream', { - - beforeEach() { - this.stream = new Stream(); - }, - - afterEach() { - this.stream.dispose(); - } -}); - -QUnit.test('trigger calls listeners', function(assert) { - const args = []; - - this.stream.on('test', function(data) { - args.push(data); - }); - - this.stream.trigger('test', 1); - this.stream.trigger('test', 2); - - assert.deepEqual(args, [1, 2]); -}); - -QUnit.test('callbacks can remove themselves', function(assert) { - const args1 = []; - const args2 = []; - const args3 = []; - const arg2Fn = (event) => { - args2.push(event); - this.stream.off('test', arg2Fn); - }; - - this.stream.on('test', (event) => { - args1.push(event); - }); - this.stream.on('test', arg2Fn); - this.stream.on('test', (event) => { - args3.push(event); - }); - - this.stream.trigger('test', 1); - this.stream.trigger('test', 2); - - assert.deepEqual(args1, [1, 2], 'first callback ran all times'); - assert.deepEqual(args2, [1], 'second callback removed after first run'); - assert.deepEqual(args3, [1, 2], 'third callback ran all times'); -}); diff --git a/node_modules/@videojs/vhs-utils/test/test-helpers.js b/node_modules/@videojs/vhs-utils/test/test-helpers.js deleted file mode 100644 index 4b35865..0000000 --- a/node_modules/@videojs/vhs-utils/test/test-helpers.js +++ /dev/null @@ -1,42 +0,0 @@ -import {isVideoCodec, isAudioCodec} from '../src/codecs.js'; - -const codecAliasMap = { - mp3: ['mp3', 'mp4a.40.34', 'mp4a.6b'], - aac: ['aac', 'mp4a.40.2', 'mp4a.40.5', 'mp4a.40.29'] -}; - -Object.keys(codecAliasMap).forEach((alias) => { - // map aliases as keys so that everything is linked to each other - codecAliasMap[alias].forEach((subalias) => { - codecAliasMap[subalias] = codecAliasMap[alias]; - }); -}); - -export const doesCodecMatch = function(a, b) { - if (!a) { - return false; - } - if (codecAliasMap[b]) { - return codecAliasMap[a].indexOf(b) !== -1; - } - - return a === b; -}; - -export const codecsFromFile = function(file) { - const codecs = {}; - const extension = file.split('.').pop(); - const codecStr = file.replace(`.${extension}`, ''); - - codecStr.split(',').forEach((codec) => { - if (isVideoCodec(codec)) { - codecs.video = codec; - } else if (isAudioCodec(codec)) { - codecs.audio = codec; - } else { - throw new Error(`${codec} is not detected as audio or video`); - } - }); - - return codecs; -}; diff --git a/node_modules/@videojs/xhr/CONTRIBUTING.md b/node_modules/@videojs/xhr/CONTRIBUTING.md deleted file mode 100644 index 3d4053b..0000000 --- a/node_modules/@videojs/xhr/CONTRIBUTING.md +++ /dev/null @@ -1,27 +0,0 @@ -# XHR is an OPEN Open Source Project - ------------------------------------------ - -## What? - -Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. - -## Rules - -There are a few basic ground-rules for contributors: - -1. **No `--force` pushes** or modifying the Git history in any way. -1. **Non-master branches** ought to be used for ongoing work. -1. **External API changes and significant modifications** ought to be subject to an **internal pull-request** to solicit feedback from other contributors. -1. Internal pull-requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor. -1. Contributors should attempt to adhere to the prevailing code-style. - -## Releases - -Declaring formal releases remains the prerogative of the project maintainer. - -## Changes to this arrangement - -This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change. - ------------------------------------------ diff --git a/node_modules/@videojs/xhr/LICENCE b/node_modules/@videojs/xhr/LICENCE deleted file mode 100644 index a23e08a..0000000 --- a/node_modules/@videojs/xhr/LICENCE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Raynos. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. \ No newline at end of file diff --git a/node_modules/@videojs/xhr/README.md b/node_modules/@videojs/xhr/README.md deleted file mode 100644 index 19fe36a..0000000 --- a/node_modules/@videojs/xhr/README.md +++ /dev/null @@ -1,255 +0,0 @@ -# xhr - -[![Join the chat at https://gitter.im/naugtur-xhr/Lobby](https://badges.gitter.im/naugtur-xhr/Lobby.svg)](https://gitter.im/naugtur-xhr/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -[![Greenkeeper badge](https://badges.greenkeeper.io/naugtur/xhr.svg)](https://greenkeeper.io/) - -A small XMLHttpRequest wrapper. Designed for use with [browserify](http://browserify.org/), [webpack](https://webpack.github.io/) etc. - -API is a subset of [request](https://github.com/request/request) so you can write code that works in both node.js and the browser by using `require('request')` in your code and telling your browser bundler to load `xhr` instead of `request`. - -For browserify, add a [browser](https://github.com/substack/node-browserify#browser-field) field to your `package.json`: - -``` -"browser": { - "request": "@videojs/xhr" -} -``` - -For webpack, add a [resolve.alias](http://webpack.github.io/docs/configuration.html#resolve-alias) field to your configuration: - -``` -"resolve": { - "alias": { - "request$": "@videojs/xhr" - } -} -``` - -Browser support: IE8+ and everything else. - -## Installation - -``` -npm install @videojs/xhr -``` - -## Example - -```js -var xhr = require("@videojs/xhr") - -xhr({ - method: "post", - body: someJSONString, - uri: "/foo", - headers: { - "Content-Type": "application/json" - } -}, function (err, resp, body) { - // check resp.statusCode -}) -``` - -## `var req = xhr(options, callback)` - -```js -type XhrOptions = String | { - useXDR: Boolean?, - sync: Boolean?, - uri: String, - url: String, - method: String?, - timeout: Number?, - headers: Object?, - body: String? | Object?, - json: Boolean? | Object?, - username: String?, - password: String?, - withCredentials: Boolean?, - responseType: String?, - beforeSend: Function? -} -xhr := (XhrOptions, Callback) => Request -``` -the returned object is either an [`XMLHttpRequest`][3] instance - or an [`XDomainRequest`][4] instance (if on IE8/IE9 && - `options.useXDR` is set to `true`) - -Your callback will be called once with the arguments - ( [`Error`][5], `response` , `body` ) where the response is an object: -```js -{ - body: Object||String, - statusCode: Number, - method: String, - headers: {}, - url: String, - rawRequest: xhr -} -``` - - `body`: HTTP response body - [`XMLHttpRequest.response`][6], [`XMLHttpRequest.responseText`][7] or - [`XMLHttpRequest.responseXML`][8] depending on the request type. - - `rawRequest`: Original [`XMLHttpRequest`][3] instance - or [`XDomainRequest`][4] instance (if on IE8/IE9 && - `options.useXDR` is set to `true`) - - `headers`: A collection of headers where keys are header names converted to lowercase - - -Your callback will be called with an [`Error`][5] if there is an error in the browser that prevents sending the request. -A HTTP 500 response is not going to cause an error to be returned. - -## Other signatures - -* `var req = xhr(url, callback)` - -a simple string instead of the options. In this case, a GET request will be made to that url. - -* `var req = xhr(url, options, callback)` - -the above may also be called with the standard set of options. - -### Convience methods -* `var req = xhr.{post, put, patch, del, head, get}(url, callback)` -* `var req = xhr.{post, put, patch, del, head, get}(options, callback)` -* `var req = xhr.{post, put, patch, del, head, get}(url, options, callback)` - -The `xhr` module has convience functions attached that will make requests with the given method. -Each function is named after its method, with the exception of `DELETE` which is called `xhr.del` for compatibility. - -The method shorthands may be combined with the url-first form of `xhr` for succinct and descriptive requests. For example, - -```js -xhr.post('/post-to-me', function(err, resp) { - console.log(resp.body) -}) -``` - -or - -```js -xhr.del('/delete-me', { headers: { my: 'auth' } }, function (err, resp) { - console.log(resp.statusCode); -}) -``` - -## Options - -### `options.method` - -Specify the method the [`XMLHttpRequest`][3] should be opened - with. Passed to [`XMLHttpRequest.open`][2]. Defaults to "GET" - -### `options.useXDR` - -Specify whether this is a cross origin (CORS) request for IE<10. - Switches IE to use [`XDomainRequest`][4] instead of `XMLHttpRequest`. - Ignored in other browsers. - -Note that headers cannot be set on an XDomainRequest instance. - -### `options.sync` - -Specify whether this is a synchrounous request. Note that when - this is true the callback will be called synchronously. In - most cases this option should not be used. Only use if you - know what you are doing! - -### `options.body` - -Pass in body to be send across the [`XMLHttpRequest`][3]. - Generally should be a string. But anything that's valid as - a parameter to [`XMLHttpRequest.send`][1] should work (Buffer for file, etc.). - -If `options.json` is `true`, then this must be a JSON-serializable object. `options.body` is passed to `JSON.stringify` and sent. - -### `options.uri` or `options.url` - -The uri to send a request to. Passed to [`XMLHttpRequest.open`][2]. `options.url` and `options.uri` are aliases for each other. - -### `options.headers` - -An object of headers that should be set on the request. The - key, value pair is passed to [`XMLHttpRequest.setRequestHeader`][9] - -### `options.timeout` - -Number of miliseconds to wait for response. Defaults to 0 (no timeout). Ignored when `options.sync` is true. - -### `options.json` - -Set to `true` to send request as `application/json` (see `options.body`) and parse response from JSON. - -For backwards compatibility `options.json` can also be a valid JSON-serializable value to be sent to the server. Additionally the response body is still parsed as JSON - -For sending booleans as JSON body see FAQ - -### `options.withCredentials` - -Specify whether user credentials are to be included in a cross-origin - request. Sets [`XMLHttpRequest.withCredentials`][10]. Defaults to false. - -A wildcard `*` cannot be used in the `Access-Control-Allow-Origin` header when `withCredentials` is true. - The header needs to specify your origin explicitly or browser will abort the request. - -### `options.responseType` - -Determines the data type of the `response`. Sets [`XMLHttpRequest.responseType`][11]. For example, a `responseType` of `document` will return a parsed `Document` object as the `response.body` for an XML resource. - -### `options.beforeSend` - -A function being called right before the `send` method of the `XMLHttpRequest` or `XDomainRequest` instance is called. The `XMLHttpRequest` or `XDomainRequest` instance is passed as an argument. - -### `options.xhr` - -Pass an `XMLHttpRequest` object (or something that acts like one) to use instead of constructing a new one using the `XMLHttpRequest` or `XDomainRequest` constructors. Useful for testing. - -## FAQ - -- Why is my server's JSON response not parsed? I returned the right content-type. - - See `options.json` - you can set it to `true` on a GET request to tell `xhr` to parse the response body. - - Without `options.json` body is returned as-is (a string or when `responseType` is set and the browser supports it - a result of parsing JSON or XML) -- How do I send an object or array as POST body? - - `options.body` should be a string. You need to serialize your object before passing to `xhr` for sending. - - To serialize to JSON you can use - `options.json:true` with `options.body` for convenience - then `xhr` will do the serialization and set content-type accordingly. -- Where's stream API? `.pipe()` etc. - - Not implemented. You can't reasonably have that in the browser. -- Why can't I send `"true"` as body by passing it as `options.json` anymore? - - Accepting `true` as a value was a bug. Despite what `JSON.stringify` does, the string `"true"` is not valid JSON. If you're sending booleans as JSON, please consider wrapping them in an object or array to save yourself from more trouble in the future. To bring back the old behavior, hardcode `options.json` to `true` and set `options.body` to your boolean value. -- How do I add an `onprogress` listener? - - use `beforeSend` function for non-standard things that are browser specific. In this case: - ```js - xhr({ - ... - beforeSend: function(xhrObject){ - xhrObject.onprogress = function(){} - } - }) - ``` - -## Mocking Requests -You can override the constructor used to create new requests for testing. When you're making a new request: - -```js -xhr({ xhr: new MockXMLHttpRequest() }) -``` - -or you can override the constructors used to create requests at the module level: - -```js -xhr.XMLHttpRequest = MockXMLHttpRequest -xhr.XDomainRequest = MockXDomainRequest -``` - -## MIT Licenced - - [1]: http://xhr.spec.whatwg.org/#the-send()-method - [2]: http://xhr.spec.whatwg.org/#the-open()-method - [3]: http://xhr.spec.whatwg.org/#interface-xmlhttprequest - [4]: http://msdn.microsoft.com/en-us/library/ie/cc288060(v=vs.85).aspx - [5]: http://es5.github.com/#x15.11 - [6]: http://xhr.spec.whatwg.org/#the-response-attribute - [7]: http://xhr.spec.whatwg.org/#the-responsetext-attribute - [8]: http://xhr.spec.whatwg.org/#the-responsexml-attribute - [9]: http://xhr.spec.whatwg.org/#the-setrequestheader()-method - [10]: http://xhr.spec.whatwg.org/#the-withcredentials-attribute - [11]: https://xhr.spec.whatwg.org/#the-responsetype-attribute diff --git a/node_modules/@videojs/xhr/index.d.ts b/node_modules/@videojs/xhr/index.d.ts deleted file mode 100644 index 3dbd5ba..0000000 --- a/node_modules/@videojs/xhr/index.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -export type XhrCallback = ( - error: Error, - response: XhrResponse, - body: any -) => void; - -export interface XhrResponse { - body: Object | string; - statusCode: number; - method: string; - headers: XhrHeaders; - url: string; - rawRequest: XMLHttpRequest; -} - -export interface XhrHeaders { - [key: string]: string; -} - -export interface XhrBaseConfig { - useXDR?: boolean; - sync?: boolean; - method?: 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'POST' | 'PUT'; - timeout?: number; - headers?: XhrHeaders; - body?: string | any; - json?: boolean; - username?: string; - password?: string; - withCredentials?: boolean; - responseType?: '' | 'arraybuffer' | 'blob' | 'document' | 'json' | 'text'; - beforeSend?: (xhrObject: XMLHttpRequest) => void; - xhr?: XMLHttpRequest; -} - -export interface XhrUriConfig extends XhrBaseConfig { - uri: string; -} - -export interface XhrUrlConfig extends XhrBaseConfig { - url: string; -} - -export interface XhrInstance { - (options: XhrUriConfig | XhrUrlConfig, callback: XhrCallback): any; - (url: string, callback: XhrCallback): any; - (url: string, options: XhrBaseConfig, callback: XhrCallback): any; -} - -export interface XhrStatic extends XhrInstance { - del: XhrInstance; - get: XhrInstance; - head: XhrInstance; - patch: XhrInstance; - post: XhrInstance; - put: XhrInstance; -} - -declare const Xhr: XhrStatic; - -export default Xhr; diff --git a/node_modules/@videojs/xhr/index.js b/node_modules/@videojs/xhr/index.js deleted file mode 100644 index e2ca108..0000000 --- a/node_modules/@videojs/xhr/index.js +++ /dev/null @@ -1,278 +0,0 @@ -"use strict"; -var window = require("global/window") -var _extends = require("@babel/runtime/helpers/extends"); -var isFunction = require('is-function'); - -/** - * @license - * slighly modified parse-headers 2.0.2 - * Copyright (c) 2014 David Björklund - * Available under the MIT license - * - */ - -var parseHeaders = function(headers) { - var result = {}; - - if (!headers) { - return result; - } - - headers.trim().split('\n').forEach(function(row) { - var index = row.indexOf(':'); - var key = row.slice(0, index).trim().toLowerCase(); - var value = row.slice(index + 1).trim(); - - if (typeof(result[key]) === 'undefined') { - result[key] = value - } else if (Array.isArray(result[key])) { - result[key].push(value) - } else { - result[key] = [ result[key], value ] - } - }); - - return result; -}; - -module.exports = createXHR -// Allow use of default import syntax in TypeScript -module.exports.default = createXHR; -createXHR.XMLHttpRequest = window.XMLHttpRequest || noop -createXHR.XDomainRequest = "withCredentials" in (new createXHR.XMLHttpRequest()) ? createXHR.XMLHttpRequest : window.XDomainRequest - -forEachArray(["get", "put", "post", "patch", "head", "delete"], function(method) { - createXHR[method === "delete" ? "del" : method] = function(uri, options, callback) { - options = initParams(uri, options, callback) - options.method = method.toUpperCase() - return _createXHR(options) - } -}) - -function forEachArray(array, iterator) { - for (var i = 0; i < array.length; i++) { - iterator(array[i]) - } -} - -function isEmpty(obj){ - for(var i in obj){ - if(obj.hasOwnProperty(i)) return false - } - return true -} - -function initParams(uri, options, callback) { - var params = uri - - if (isFunction(options)) { - callback = options - if (typeof uri === "string") { - params = {uri:uri} - } - } else { - params = _extends({}, options, {uri: uri}) - } - - params.callback = callback - return params -} - -function createXHR(uri, options, callback) { - options = initParams(uri, options, callback) - return _createXHR(options) -} - -function _createXHR(options) { - if(typeof options.callback === "undefined"){ - throw new Error("callback argument missing") - } - - var called = false - var callback = function cbOnce(err, response, body){ - if(!called){ - called = true - options.callback(err, response, body) - } - } - - function readystatechange() { - if (xhr.readyState === 4) { - setTimeout(loadFunc, 0) - } - } - - function getBody() { - // Chrome with requestType=blob throws errors arround when even testing access to responseText - var body = undefined - - if (xhr.response) { - body = xhr.response - } else { - body = xhr.responseText || getXml(xhr) - } - - if (isJson) { - try { - body = JSON.parse(body) - } catch (e) {} - } - - return body - } - - function errorFunc(evt) { - clearTimeout(timeoutTimer) - if(!(evt instanceof Error)){ - evt = new Error("" + (evt || "Unknown XMLHttpRequest Error") ) - } - evt.statusCode = 0 - return callback(evt, failureResponse) - } - - // will load the data & process the response in a special response object - function loadFunc() { - if (aborted) return - var status - clearTimeout(timeoutTimer) - if(options.useXDR && xhr.status===undefined) { - //IE8 CORS GET successful response doesn't have a status field, but body is fine - status = 200 - } else { - status = (xhr.status === 1223 ? 204 : xhr.status) - } - var response = failureResponse - var err = null - - if (status !== 0){ - response = { - body: getBody(), - statusCode: status, - method: method, - headers: {}, - url: uri, - rawRequest: xhr - } - if(xhr.getAllResponseHeaders){ //remember xhr can in fact be XDR for CORS in IE - response.headers = parseHeaders(xhr.getAllResponseHeaders()) - } - } else { - err = new Error("Internal XMLHttpRequest Error") - } - return callback(err, response, response.body) - } - - var xhr = options.xhr || null - - if (!xhr) { - if (options.cors || options.useXDR) { - xhr = new createXHR.XDomainRequest() - }else{ - xhr = new createXHR.XMLHttpRequest() - } - } - - var key - var aborted - var uri = xhr.url = options.uri || options.url - var method = xhr.method = options.method || "GET" - var body = options.body || options.data - var headers = xhr.headers = options.headers || {} - var sync = !!options.sync - var isJson = false - var timeoutTimer - var failureResponse = { - body: undefined, - headers: {}, - statusCode: 0, - method: method, - url: uri, - rawRequest: xhr - } - - if ("json" in options && options.json !== false) { - isJson = true - headers["accept"] || headers["Accept"] || (headers["Accept"] = "application/json") //Don't override existing accept header declared by user - if (method !== "GET" && method !== "HEAD") { - headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json") //Don't override existing accept header declared by user - body = JSON.stringify(options.json === true ? body : options.json) - } - } - - xhr.onreadystatechange = readystatechange - xhr.onload = loadFunc - xhr.onerror = errorFunc - // IE9 must have onprogress be set to a unique function. - xhr.onprogress = function () { - // IE must die - } - xhr.onabort = function(){ - aborted = true; - } - xhr.ontimeout = errorFunc - xhr.open(method, uri, !sync, options.username, options.password) - //has to be after open - if(!sync) { - xhr.withCredentials = !!options.withCredentials - } - // Cannot set timeout with sync request - // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly - // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent - if (!sync && options.timeout > 0 ) { - timeoutTimer = setTimeout(function(){ - if (aborted) return - aborted = true//IE9 may still call readystatechange - xhr.abort("timeout") - var e = new Error("XMLHttpRequest timeout") - e.code = "ETIMEDOUT" - errorFunc(e) - }, options.timeout ) - } - - if (xhr.setRequestHeader) { - for(key in headers){ - if(headers.hasOwnProperty(key)){ - xhr.setRequestHeader(key, headers[key]) - } - } - } else if (options.headers && !isEmpty(options.headers)) { - throw new Error("Headers cannot be set on an XDomainRequest object") - } - - if ("responseType" in options) { - xhr.responseType = options.responseType - } - - if ("beforeSend" in options && - typeof options.beforeSend === "function" - ) { - options.beforeSend(xhr) - } - - // Microsoft Edge browser sends "undefined" when send is called with undefined value. - // XMLHttpRequest spec says to pass null as body to indicate no body - // See https://github.com/naugtur/xhr/issues/100. - xhr.send(body || null) - - return xhr - - -} - -function getXml(xhr) { - // xhr.responseXML will throw Exception "InvalidStateError" or "DOMException" - // See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseXML. - try { - if (xhr.responseType === "document") { - return xhr.responseXML - } - var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror" - if (xhr.responseType === "" && !firefoxBugTakenEffect) { - return xhr.responseXML - } - } catch (e) {} - - return null -} - -function noop() {} diff --git a/node_modules/@videojs/xhr/package.json b/node_modules/@videojs/xhr/package.json deleted file mode 100644 index 1428519..0000000 --- a/node_modules/@videojs/xhr/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "_from": "@videojs/xhr@2.5.1", - "_id": "@videojs/xhr@2.5.1", - "_inBundle": false, - "_integrity": "sha512-wV9nGESHseSK+S9ePEru2+OJZ1jq/ZbbzniGQ4weAmTIepuBMSYPx5zrxxQA0E786T5ykpO8ts+LayV+3/oI2w==", - "_location": "/@videojs/xhr", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "@videojs/xhr@2.5.1", - "name": "@videojs/xhr", - "escapedName": "@videojs%2fxhr", - "scope": "@videojs", - "rawSpec": "2.5.1", - "saveSpec": null, - "fetchSpec": "2.5.1" - }, - "_requiredBy": [ - "/video.js" - ], - "_resolved": "https://registry.npmjs.org/@videojs/xhr/-/xhr-2.5.1.tgz", - "_shasum": "26bc5a79dbb3b03bfb13742c6ce559f89e90719e", - "_spec": "@videojs/xhr@2.5.1", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js", - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "bugs": { - "url": "https://github.com/naugtur/xhr/issues", - "email": "naugtur@gmail.com" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Jake Verbaten" - }, - { - "name": "Zbyszek Tenerowicz", - "email": "naugtur@gmail.com" - } - ], - "dependencies": { - "@babel/runtime": "^7.5.5", - "global": "~4.4.0", - "is-function": "^1.0.1" - }, - "deprecated": false, - "description": "small xhr abstraction", - "devDependencies": { - "for-each": "^0.3.2", - "pre-commit": "1.2.2", - "run-browser": "github:naugtur/run-browser", - "tap-spec": "^4.0.2", - "tape": "^4.0.0" - }, - "homepage": "https://github.com/naugtur/xhr", - "keywords": [ - "xhr", - "http", - "xmlhttprequest", - "xhr2", - "browserify" - ], - "license": "MIT", - "main": "index", - "name": "@videojs/xhr", - "repository": { - "type": "git", - "url": "git://github.com/naugtur/xhr.git" - }, - "scripts": { - "browser": "run-browser -m test/mock-server.js test/index.js", - "test": "run-browser test/index.js -b -m test/mock-server.js | tap-spec" - }, - "typings": "./index.d.ts", - "version": "2.5.1" -} diff --git a/node_modules/aes-decrypter/CHANGELOG.md b/node_modules/aes-decrypter/CHANGELOG.md deleted file mode 100644 index 969c26c..0000000 --- a/node_modules/aes-decrypter/CHANGELOG.md +++ /dev/null @@ -1,76 +0,0 @@ - -## [3.1.2](https://github.com/videojs/aes-decrypter/compare/v3.1.1...v3.1.2) (2021-01-12) - -### Bug Fixes - -* cjs dist should only import cjs ([#83](https://github.com/videojs/aes-decrypter/issues/83)) ([a8a5fbf](https://github.com/videojs/aes-decrypter/commit/a8a5fbf)) - - -## [3.1.1](https://github.com/videojs/aes-decrypter/compare/v3.1.0...v3.1.1) (2021-01-11) - -### Chores - -* update to use vhs-utils 3 ([#81](https://github.com/videojs/aes-decrypter/issues/81)) ([8ead5d9](https://github.com/videojs/aes-decrypter/commit/8ead5d9)) - - -# [3.1.0](https://github.com/videojs/aes-decrypter/compare/v3.0.2...v3.1.0) (2020-11-03) - -### Chores - -* **package:** update to vhs-utils[@2](https://github.com/2) ([#80](https://github.com/videojs/aes-decrypter/issues/80)) ([63b9cb9](https://github.com/videojs/aes-decrypter/commit/63b9cb9)) - - -## [3.0.2](https://github.com/videojs/aes-decrypter/compare/v3.0.1...v3.0.2) (2020-09-09) - -### Chores - -* **package:** update pkcs7 to remove engine check ([062c952](https://github.com/videojs/aes-decrypter/commit/062c952)) - - -## [3.0.1](https://github.com/videojs/aes-decrypter/compare/v3.0.0...v3.0.1) (2019-08-21) - -### Chores - -* **package:** update rollup to version 0.66.0 ([#38](https://github.com/videojs/aes-decrypter/issues/38)) ([634556b](https://github.com/videojs/aes-decrypter/commit/634556b)) -* bump videojs-generate-karma-config version ([#51](https://github.com/videojs/aes-decrypter/issues/51)) ([195b923](https://github.com/videojs/aes-decrypter/commit/195b923)) -* **package:** update videojs-generate-karma-config to version 5.0.2 ([#57](https://github.com/videojs/aes-decrypter/issues/57)) ([be8bd81](https://github.com/videojs/aes-decrypter/commit/be8bd81)) -* update generator version and use [@videojs](https://github.com/videojs)/vhs-utils ([#68](https://github.com/videojs/aes-decrypter/issues/68)) ([9a6ab2f](https://github.com/videojs/aes-decrypter/commit/9a6ab2f)) -* Update to generator v7 standards ([#37](https://github.com/videojs/aes-decrypter/issues/37)) ([fcf96c4](https://github.com/videojs/aes-decrypter/commit/fcf96c4)) -* Update videojs-generate-karma-config to the latest version 🚀 ([#42](https://github.com/videojs/aes-decrypter/issues/42)) ([2b16de3](https://github.com/videojs/aes-decrypter/commit/2b16de3)) -* Update videojs-generate-karma-config to the latest version 🚀 ([#43](https://github.com/videojs/aes-decrypter/issues/43)) ([cb63ccd](https://github.com/videojs/aes-decrypter/commit/cb63ccd)) - - -# [3.0.0](https://github.com/videojs/aes-decrypter/compare/v2.0.0...v3.0.0) (2017-07-24) - -### Features - -* Use Rollup for packaging ([bda57ab](https://github.com/videojs/aes-decrypter/commit/bda57ab)) - -### Chores - -* prepare CHANGELOG for new process ([1a5175c](https://github.com/videojs/aes-decrypter/commit/1a5175c)) - - -### BREAKING CHANGES - -* revert to 1.x and stop using web crypto. - -## 2.0.0 (2016-11-15) -* Use webcrypto for aes-cbc segment decryption when supported (#4) -* Lock the linter to a specific version - -## 1.1.1 (2016-11-17) -* version to revert 1.1.0 - -## 1.0.3 (2016-06-16) -* dont do browserify-shim globally since we only use it in tests (#1) - -## 1.0.2 (2016-06-16) -* specify browserify transform globally - -## 1.0.1 (2016-06-16) -* fixing the build pipeline - -## 1.0.0 (2016-06-16) -* initial - diff --git a/node_modules/aes-decrypter/CONTRIBUTING.md b/node_modules/aes-decrypter/CONTRIBUTING.md deleted file mode 100644 index 7840f8c..0000000 --- a/node_modules/aes-decrypter/CONTRIBUTING.md +++ /dev/null @@ -1,30 +0,0 @@ -# CONTRIBUTING - -We welcome contributions from everyone! - -## Getting Started - -Make sure you have Node.js 4.8 or higher and npm installed. - -1. Fork this repository and clone your fork -1. Install dependencies: `npm install` -1. Run a development server: `npm start` - -### Making Changes - -Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship. - -When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository. - -### Running Tests - -Testing is a crucial part of any software project. For all but the most trivial changes (typos, etc) test cases are expected. Tests are run in actual browsers using [Karma][karma]. - -- In all available and supported browsers: `npm test` -- In a specific browser: `npm run test:chrome`, `npm run test:firefox`, etc. -- While development server is running (`npm start`), navigate to [`http://localhost:9999/test/`][local] - - -[karma]: http://karma-runner.github.io/ -[local]: http://localhost:9999/test/ -[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md diff --git a/node_modules/aes-decrypter/LICENSE b/node_modules/aes-decrypter/LICENSE deleted file mode 100644 index 50c17f4..0000000 --- a/node_modules/aes-decrypter/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright Brightcove, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/node_modules/aes-decrypter/README.md b/node_modules/aes-decrypter/README.md deleted file mode 100644 index 843f4c0..0000000 --- a/node_modules/aes-decrypter/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# aes-decrypter - -[![Build Status](https://travis-ci.org/videojs/aes-decrypter.svg?branch=master)](https://travis-ci.org/videojs/aes-decrypter) -[![Greenkeeper badge](https://badges.greenkeeper.io/videojs/aes-decrypter.svg)](https://greenkeeper.io/) -[![Slack Status](http://slack.videojs.com/badge.svg)](http://slack.videojs.com) - -[![NPM](https://nodei.co/npm/aes-decrypter.png?downloads=true&downloadRank=true)](https://nodei.co/npm/aes-decrypter/) - - - - - -- [Installation](#installation) -- [Usage](#usage) -- [License](#license) - - -## Installation - -```sh -npm install --save aes-decrypter -``` - -Also available to install globally: - -```sh -npm install --global aes-decrypter -``` - -The npm installation is preferred, but Bower works, too. - -```sh -bower install --save aes-decrypter -``` - -## Usage - -To include decrypter on your website or npm application, use any of the following methods. -```js -var Decrypter = require('aes-decrypter').Decrypter; -var fs = require('fs'); -var keyContent = fs.readFileSync('something.key'); -var encryptedBytes = fs.readFileSync('somithing.txt'); - -// keyContent is a string of the aes-keys content -var keyContent = fs.readFileSync(keyFile); - -var view = new DataView(keyContent.buffer); -var key.bytes = new Uint32Array([ - view.getUint32(0), - view.getUint32(4), - view.getUint32(8), - view.getUint32(12) -]); - -key.iv = new Uint32Array([ - 0, 0, 0, 0 -]); - -var d = new Decrypter( - encryptedBytes, - key.bytes, - key.iv, - function(err, decryptedBytes) { - // err always null -}); -``` - -## [License](LICENSE) - -Apache-2.0. Copyright (c) Brightcove, Inc. - diff --git a/node_modules/aes-decrypter/dist/aes-decrypter.cjs.js b/node_modules/aes-decrypter/dist/aes-decrypter.cjs.js deleted file mode 100644 index 081f5d3..0000000 --- a/node_modules/aes-decrypter/dist/aes-decrypter.cjs.js +++ /dev/null @@ -1,442 +0,0 @@ -/*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var _createClass = require('@babel/runtime/helpers/createClass'); -var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose'); -var Stream = require('@videojs/vhs-utils/cjs/stream.js'); -var pkcs7 = require('pkcs7'); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass); -var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose); -var Stream__default = /*#__PURE__*/_interopDefaultLegacy(Stream); - -/** - * @file aes.js - * - * This file contains an adaptation of the AES decryption algorithm - * from the Standford Javascript Cryptography Library. That work is - * covered by the following copyright and permissions notice: - * - * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 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. - * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing - * official policies, either expressed or implied, of the authors. - */ - -/** - * Expand the S-box tables. - * - * @private - */ -var precompute = function precompute() { - var tables = [[[], [], [], [], []], [[], [], [], [], []]]; - var encTable = tables[0]; - var decTable = tables[1]; - var sbox = encTable[4]; - var sboxInv = decTable[4]; - var i; - var x; - var xInv; - var d = []; - var th = []; - var x2; - var x4; - var x8; - var s; - var tEnc; - var tDec; // Compute double and third tables - - for (i = 0; i < 256; i++) { - th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i; - } - - for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) { - // Compute sbox - s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4; - s = s >> 8 ^ s & 255 ^ 99; - sbox[x] = s; - sboxInv[s] = x; // Compute MixColumns - - x8 = d[x4 = d[x2 = d[x]]]; - tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - tEnc = d[s] * 0x101 ^ s * 0x1010100; - - for (i = 0; i < 4; i++) { - encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8; - decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8; - } - } // Compactify. Considerable speedup on Firefox. - - - for (i = 0; i < 5; i++) { - encTable[i] = encTable[i].slice(0); - decTable[i] = decTable[i].slice(0); - } - - return tables; -}; - -var aesTables = null; -/** - * Schedule out an AES key for both encryption and decryption. This - * is a low-level class. Use a cipher mode to do bulk encryption. - * - * @class AES - * @param key {Array} The key as an array of 4, 6 or 8 words. - */ - -var AES = /*#__PURE__*/function () { - function AES(key) { - /** - * The expanded S-box and inverse S-box tables. These will be computed - * on the client so that we don't have to send them down the wire. - * - * There are two tables, _tables[0] is for encryption and - * _tables[1] is for decryption. - * - * The first 4 sub-tables are the expanded S-box with MixColumns. The - * last (_tables[01][4]) is the S-box itself. - * - * @private - */ - // if we have yet to precompute the S-box tables - // do so now - if (!aesTables) { - aesTables = precompute(); - } // then make a copy of that object for use - - - this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]]; - var i; - var j; - var tmp; - var sbox = this._tables[0][4]; - var decTable = this._tables[1]; - var keyLen = key.length; - var rcon = 1; - - if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) { - throw new Error('Invalid aes key size'); - } - - var encKey = key.slice(0); - var decKey = []; - this._key = [encKey, decKey]; // schedule encryption keys - - for (i = keyLen; i < 4 * keyLen + 28; i++) { - tmp = encKey[i - 1]; // apply sbox - - if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) { - tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; // shift rows and add rcon - - if (i % keyLen === 0) { - tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24; - rcon = rcon << 1 ^ (rcon >> 7) * 283; - } - } - - encKey[i] = encKey[i - keyLen] ^ tmp; - } // schedule decryption keys - - - for (j = 0; i; j++, i--) { - tmp = encKey[j & 3 ? i : i - 4]; - - if (i <= 4 || j < 4) { - decKey[j] = tmp; - } else { - decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]]; - } - } - } - /** - * Decrypt 16 bytes, specified as four 32-bit words. - * - * @param {number} encrypted0 the first word to decrypt - * @param {number} encrypted1 the second word to decrypt - * @param {number} encrypted2 the third word to decrypt - * @param {number} encrypted3 the fourth word to decrypt - * @param {Int32Array} out the array to write the decrypted words - * into - * @param {number} offset the offset into the output array to start - * writing results - * @return {Array} The plaintext. - */ - - - var _proto = AES.prototype; - - _proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) { - var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data - - var a = encrypted0 ^ key[0]; - var b = encrypted3 ^ key[1]; - var c = encrypted2 ^ key[2]; - var d = encrypted1 ^ key[3]; - var a2; - var b2; - var c2; // key.length === 2 ? - - var nInnerRounds = key.length / 4 - 2; - var i; - var kIndex = 4; - var table = this._tables[1]; // load up the tables - - var table0 = table[0]; - var table1 = table[1]; - var table2 = table[2]; - var table3 = table[3]; - var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL. - - for (i = 0; i < nInnerRounds; i++) { - a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex]; - b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1]; - c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2]; - d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3]; - kIndex += 4; - a = a2; - b = b2; - c = c2; - } // Last round. - - - for (i = 0; i < 4; i++) { - out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++]; - a2 = a; - a = b; - b = c; - c = d; - d = a2; - } - }; - - return AES; -}(); - -/** - * A wrapper around the Stream class to use setTimeout - * and run stream "jobs" Asynchronously - * - * @class AsyncStream - * @extends Stream - */ - -var AsyncStream = /*#__PURE__*/function (_Stream) { - _inheritsLoose__default['default'](AsyncStream, _Stream); - - function AsyncStream() { - var _this; - - _this = _Stream.call(this, Stream__default['default']) || this; - _this.jobs = []; - _this.delay = 1; - _this.timeout_ = null; - return _this; - } - /** - * process an async job - * - * @private - */ - - - var _proto = AsyncStream.prototype; - - _proto.processJob_ = function processJob_() { - this.jobs.shift()(); - - if (this.jobs.length) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } else { - this.timeout_ = null; - } - } - /** - * push a job into the stream - * - * @param {Function} job the job to push into the stream - */ - ; - - _proto.push = function push(job) { - this.jobs.push(job); - - if (!this.timeout_) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } - }; - - return AsyncStream; -}(Stream__default['default']); - -/** - * Convert network-order (big-endian) bytes into their little-endian - * representation. - */ - -var ntoh = function ntoh(word) { - return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24; -}; -/** - * Decrypt bytes using AES-128 with CBC and PKCS#7 padding. - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * use for the first round of CBC. - * @return {Uint8Array} the decrypted bytes - * - * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard - * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29 - * @see https://tools.ietf.org/html/rfc2315 - */ - - -var decrypt = function decrypt(encrypted, key, initVector) { - // word-level access to the encrypted bytes - var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2); - var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output - - var decrypted = new Uint8Array(encrypted.byteLength); - var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and - // decrypted data - - var init0; - var init1; - var init2; - var init3; - var encrypted0; - var encrypted1; - var encrypted2; - var encrypted3; // iteration variable - - var wordIx; // pull out the words of the IV to ensure we don't modify the - // passed-in reference and easier access - - init0 = initVector[0]; - init1 = initVector[1]; - init2 = initVector[2]; - init3 = initVector[3]; // decrypt four word sequences, applying cipher-block chaining (CBC) - // to each decrypted block - - for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { - // convert big-endian (network order) words into little-endian - // (javascript order) - encrypted0 = ntoh(encrypted32[wordIx]); - encrypted1 = ntoh(encrypted32[wordIx + 1]); - encrypted2 = ntoh(encrypted32[wordIx + 2]); - encrypted3 = ntoh(encrypted32[wordIx + 3]); // decrypt the block - - decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); // XOR with the IV, and restore network byte-order to obtain the - // plaintext - - decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0); - decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1); - decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2); - decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); // setup the IV for the next round - - init0 = encrypted0; - init1 = encrypted1; - init2 = encrypted2; - init3 = encrypted3; - } - - return decrypted; -}; -/** - * The `Decrypter` class that manages decryption of AES - * data through `AsyncStream` objects and the `decrypt` - * function - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * @param {Function} done the function to run when done - * @class Decrypter - */ - - -var Decrypter = /*#__PURE__*/function () { - function Decrypter(encrypted, key, initVector, done) { - var step = Decrypter.STEP; - var encrypted32 = new Int32Array(encrypted.buffer); - var decrypted = new Uint8Array(encrypted.byteLength); - var i = 0; - this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously - - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - - for (i = step; i < encrypted32.length; i += step) { - initVector = new Uint32Array([ntoh(encrypted32[i - 4]), ntoh(encrypted32[i - 3]), ntoh(encrypted32[i - 2]), ntoh(encrypted32[i - 1])]); - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - } // invoke the done() callback when everything is finished - - - this.asyncStream_.push(function () { - // remove pkcs#7 padding from the decrypted bytes - done(null, pkcs7.unpad(decrypted)); - }); - } - /** - * a getter for step the maximum number of bytes to process at one time - * - * @return {number} the value of step 32000 - */ - - - var _proto = Decrypter.prototype; - - /** - * @private - */ - _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) { - return function () { - var bytes = decrypt(encrypted, key, initVector); - decrypted.set(bytes, encrypted.byteOffset); - }; - }; - - _createClass__default['default'](Decrypter, null, [{ - key: "STEP", - get: function get() { - // 4 * 8000; - return 32000; - } - }]); - - return Decrypter; -}(); - -exports.AsyncStream = AsyncStream; -exports.Decrypter = Decrypter; -exports.decrypt = decrypt; diff --git a/node_modules/aes-decrypter/dist/aes-decrypter.es.js b/node_modules/aes-decrypter/dist/aes-decrypter.es.js deleted file mode 100644 index 622e8a3..0000000 --- a/node_modules/aes-decrypter/dist/aes-decrypter.es.js +++ /dev/null @@ -1,430 +0,0 @@ -/*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */ -import _createClass from '@babel/runtime/helpers/createClass'; -import _inheritsLoose from '@babel/runtime/helpers/inheritsLoose'; -import Stream from '@videojs/vhs-utils/es/stream.js'; -import { unpad } from 'pkcs7'; - -/** - * @file aes.js - * - * This file contains an adaptation of the AES decryption algorithm - * from the Standford Javascript Cryptography Library. That work is - * covered by the following copyright and permissions notice: - * - * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 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. - * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing - * official policies, either expressed or implied, of the authors. - */ - -/** - * Expand the S-box tables. - * - * @private - */ -var precompute = function precompute() { - var tables = [[[], [], [], [], []], [[], [], [], [], []]]; - var encTable = tables[0]; - var decTable = tables[1]; - var sbox = encTable[4]; - var sboxInv = decTable[4]; - var i; - var x; - var xInv; - var d = []; - var th = []; - var x2; - var x4; - var x8; - var s; - var tEnc; - var tDec; // Compute double and third tables - - for (i = 0; i < 256; i++) { - th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i; - } - - for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) { - // Compute sbox - s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4; - s = s >> 8 ^ s & 255 ^ 99; - sbox[x] = s; - sboxInv[s] = x; // Compute MixColumns - - x8 = d[x4 = d[x2 = d[x]]]; - tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - tEnc = d[s] * 0x101 ^ s * 0x1010100; - - for (i = 0; i < 4; i++) { - encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8; - decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8; - } - } // Compactify. Considerable speedup on Firefox. - - - for (i = 0; i < 5; i++) { - encTable[i] = encTable[i].slice(0); - decTable[i] = decTable[i].slice(0); - } - - return tables; -}; - -var aesTables = null; -/** - * Schedule out an AES key for both encryption and decryption. This - * is a low-level class. Use a cipher mode to do bulk encryption. - * - * @class AES - * @param key {Array} The key as an array of 4, 6 or 8 words. - */ - -var AES = /*#__PURE__*/function () { - function AES(key) { - /** - * The expanded S-box and inverse S-box tables. These will be computed - * on the client so that we don't have to send them down the wire. - * - * There are two tables, _tables[0] is for encryption and - * _tables[1] is for decryption. - * - * The first 4 sub-tables are the expanded S-box with MixColumns. The - * last (_tables[01][4]) is the S-box itself. - * - * @private - */ - // if we have yet to precompute the S-box tables - // do so now - if (!aesTables) { - aesTables = precompute(); - } // then make a copy of that object for use - - - this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]]; - var i; - var j; - var tmp; - var sbox = this._tables[0][4]; - var decTable = this._tables[1]; - var keyLen = key.length; - var rcon = 1; - - if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) { - throw new Error('Invalid aes key size'); - } - - var encKey = key.slice(0); - var decKey = []; - this._key = [encKey, decKey]; // schedule encryption keys - - for (i = keyLen; i < 4 * keyLen + 28; i++) { - tmp = encKey[i - 1]; // apply sbox - - if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) { - tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; // shift rows and add rcon - - if (i % keyLen === 0) { - tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24; - rcon = rcon << 1 ^ (rcon >> 7) * 283; - } - } - - encKey[i] = encKey[i - keyLen] ^ tmp; - } // schedule decryption keys - - - for (j = 0; i; j++, i--) { - tmp = encKey[j & 3 ? i : i - 4]; - - if (i <= 4 || j < 4) { - decKey[j] = tmp; - } else { - decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]]; - } - } - } - /** - * Decrypt 16 bytes, specified as four 32-bit words. - * - * @param {number} encrypted0 the first word to decrypt - * @param {number} encrypted1 the second word to decrypt - * @param {number} encrypted2 the third word to decrypt - * @param {number} encrypted3 the fourth word to decrypt - * @param {Int32Array} out the array to write the decrypted words - * into - * @param {number} offset the offset into the output array to start - * writing results - * @return {Array} The plaintext. - */ - - - var _proto = AES.prototype; - - _proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) { - var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data - - var a = encrypted0 ^ key[0]; - var b = encrypted3 ^ key[1]; - var c = encrypted2 ^ key[2]; - var d = encrypted1 ^ key[3]; - var a2; - var b2; - var c2; // key.length === 2 ? - - var nInnerRounds = key.length / 4 - 2; - var i; - var kIndex = 4; - var table = this._tables[1]; // load up the tables - - var table0 = table[0]; - var table1 = table[1]; - var table2 = table[2]; - var table3 = table[3]; - var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL. - - for (i = 0; i < nInnerRounds; i++) { - a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex]; - b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1]; - c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2]; - d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3]; - kIndex += 4; - a = a2; - b = b2; - c = c2; - } // Last round. - - - for (i = 0; i < 4; i++) { - out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++]; - a2 = a; - a = b; - b = c; - c = d; - d = a2; - } - }; - - return AES; -}(); - -/** - * A wrapper around the Stream class to use setTimeout - * and run stream "jobs" Asynchronously - * - * @class AsyncStream - * @extends Stream - */ - -var AsyncStream = /*#__PURE__*/function (_Stream) { - _inheritsLoose(AsyncStream, _Stream); - - function AsyncStream() { - var _this; - - _this = _Stream.call(this, Stream) || this; - _this.jobs = []; - _this.delay = 1; - _this.timeout_ = null; - return _this; - } - /** - * process an async job - * - * @private - */ - - - var _proto = AsyncStream.prototype; - - _proto.processJob_ = function processJob_() { - this.jobs.shift()(); - - if (this.jobs.length) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } else { - this.timeout_ = null; - } - } - /** - * push a job into the stream - * - * @param {Function} job the job to push into the stream - */ - ; - - _proto.push = function push(job) { - this.jobs.push(job); - - if (!this.timeout_) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } - }; - - return AsyncStream; -}(Stream); - -/** - * Convert network-order (big-endian) bytes into their little-endian - * representation. - */ - -var ntoh = function ntoh(word) { - return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24; -}; -/** - * Decrypt bytes using AES-128 with CBC and PKCS#7 padding. - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * use for the first round of CBC. - * @return {Uint8Array} the decrypted bytes - * - * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard - * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29 - * @see https://tools.ietf.org/html/rfc2315 - */ - - -var decrypt = function decrypt(encrypted, key, initVector) { - // word-level access to the encrypted bytes - var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2); - var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output - - var decrypted = new Uint8Array(encrypted.byteLength); - var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and - // decrypted data - - var init0; - var init1; - var init2; - var init3; - var encrypted0; - var encrypted1; - var encrypted2; - var encrypted3; // iteration variable - - var wordIx; // pull out the words of the IV to ensure we don't modify the - // passed-in reference and easier access - - init0 = initVector[0]; - init1 = initVector[1]; - init2 = initVector[2]; - init3 = initVector[3]; // decrypt four word sequences, applying cipher-block chaining (CBC) - // to each decrypted block - - for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { - // convert big-endian (network order) words into little-endian - // (javascript order) - encrypted0 = ntoh(encrypted32[wordIx]); - encrypted1 = ntoh(encrypted32[wordIx + 1]); - encrypted2 = ntoh(encrypted32[wordIx + 2]); - encrypted3 = ntoh(encrypted32[wordIx + 3]); // decrypt the block - - decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); // XOR with the IV, and restore network byte-order to obtain the - // plaintext - - decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0); - decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1); - decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2); - decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); // setup the IV for the next round - - init0 = encrypted0; - init1 = encrypted1; - init2 = encrypted2; - init3 = encrypted3; - } - - return decrypted; -}; -/** - * The `Decrypter` class that manages decryption of AES - * data through `AsyncStream` objects and the `decrypt` - * function - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * @param {Function} done the function to run when done - * @class Decrypter - */ - - -var Decrypter = /*#__PURE__*/function () { - function Decrypter(encrypted, key, initVector, done) { - var step = Decrypter.STEP; - var encrypted32 = new Int32Array(encrypted.buffer); - var decrypted = new Uint8Array(encrypted.byteLength); - var i = 0; - this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously - - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - - for (i = step; i < encrypted32.length; i += step) { - initVector = new Uint32Array([ntoh(encrypted32[i - 4]), ntoh(encrypted32[i - 3]), ntoh(encrypted32[i - 2]), ntoh(encrypted32[i - 1])]); - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - } // invoke the done() callback when everything is finished - - - this.asyncStream_.push(function () { - // remove pkcs#7 padding from the decrypted bytes - done(null, unpad(decrypted)); - }); - } - /** - * a getter for step the maximum number of bytes to process at one time - * - * @return {number} the value of step 32000 - */ - - - var _proto = Decrypter.prototype; - - /** - * @private - */ - _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) { - return function () { - var bytes = decrypt(encrypted, key, initVector); - decrypted.set(bytes, encrypted.byteOffset); - }; - }; - - _createClass(Decrypter, null, [{ - key: "STEP", - get: function get() { - // 4 * 8000; - return 32000; - } - }]); - - return Decrypter; -}(); - -export { AsyncStream, Decrypter, decrypt }; diff --git a/node_modules/aes-decrypter/dist/aes-decrypter.js b/node_modules/aes-decrypter/dist/aes-decrypter.js deleted file mode 100644 index 39213b8..0000000 --- a/node_modules/aes-decrypter/dist/aes-decrypter.js +++ /dev/null @@ -1,596 +0,0 @@ -/*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.aesDecrypter = {})); -}(this, (function (exports) { 'use strict'; - - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - var createClass = _createClass; - - /** - * @file aes.js - * - * This file contains an adaptation of the AES decryption algorithm - * from the Standford Javascript Cryptography Library. That work is - * covered by the following copyright and permissions notice: - * - * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 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. - * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing - * official policies, either expressed or implied, of the authors. - */ - - /** - * Expand the S-box tables. - * - * @private - */ - var precompute = function precompute() { - var tables = [[[], [], [], [], []], [[], [], [], [], []]]; - var encTable = tables[0]; - var decTable = tables[1]; - var sbox = encTable[4]; - var sboxInv = decTable[4]; - var i; - var x; - var xInv; - var d = []; - var th = []; - var x2; - var x4; - var x8; - var s; - var tEnc; - var tDec; // Compute double and third tables - - for (i = 0; i < 256; i++) { - th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i; - } - - for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) { - // Compute sbox - s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4; - s = s >> 8 ^ s & 255 ^ 99; - sbox[x] = s; - sboxInv[s] = x; // Compute MixColumns - - x8 = d[x4 = d[x2 = d[x]]]; - tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - tEnc = d[s] * 0x101 ^ s * 0x1010100; - - for (i = 0; i < 4; i++) { - encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8; - decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8; - } - } // Compactify. Considerable speedup on Firefox. - - - for (i = 0; i < 5; i++) { - encTable[i] = encTable[i].slice(0); - decTable[i] = decTable[i].slice(0); - } - - return tables; - }; - - var aesTables = null; - /** - * Schedule out an AES key for both encryption and decryption. This - * is a low-level class. Use a cipher mode to do bulk encryption. - * - * @class AES - * @param key {Array} The key as an array of 4, 6 or 8 words. - */ - - var AES = /*#__PURE__*/function () { - function AES(key) { - /** - * The expanded S-box and inverse S-box tables. These will be computed - * on the client so that we don't have to send them down the wire. - * - * There are two tables, _tables[0] is for encryption and - * _tables[1] is for decryption. - * - * The first 4 sub-tables are the expanded S-box with MixColumns. The - * last (_tables[01][4]) is the S-box itself. - * - * @private - */ - // if we have yet to precompute the S-box tables - // do so now - if (!aesTables) { - aesTables = precompute(); - } // then make a copy of that object for use - - - this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]]; - var i; - var j; - var tmp; - var sbox = this._tables[0][4]; - var decTable = this._tables[1]; - var keyLen = key.length; - var rcon = 1; - - if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) { - throw new Error('Invalid aes key size'); - } - - var encKey = key.slice(0); - var decKey = []; - this._key = [encKey, decKey]; // schedule encryption keys - - for (i = keyLen; i < 4 * keyLen + 28; i++) { - tmp = encKey[i - 1]; // apply sbox - - if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) { - tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; // shift rows and add rcon - - if (i % keyLen === 0) { - tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24; - rcon = rcon << 1 ^ (rcon >> 7) * 283; - } - } - - encKey[i] = encKey[i - keyLen] ^ tmp; - } // schedule decryption keys - - - for (j = 0; i; j++, i--) { - tmp = encKey[j & 3 ? i : i - 4]; - - if (i <= 4 || j < 4) { - decKey[j] = tmp; - } else { - decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]]; - } - } - } - /** - * Decrypt 16 bytes, specified as four 32-bit words. - * - * @param {number} encrypted0 the first word to decrypt - * @param {number} encrypted1 the second word to decrypt - * @param {number} encrypted2 the third word to decrypt - * @param {number} encrypted3 the fourth word to decrypt - * @param {Int32Array} out the array to write the decrypted words - * into - * @param {number} offset the offset into the output array to start - * writing results - * @return {Array} The plaintext. - */ - - - var _proto = AES.prototype; - - _proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) { - var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data - - var a = encrypted0 ^ key[0]; - var b = encrypted3 ^ key[1]; - var c = encrypted2 ^ key[2]; - var d = encrypted1 ^ key[3]; - var a2; - var b2; - var c2; // key.length === 2 ? - - var nInnerRounds = key.length / 4 - 2; - var i; - var kIndex = 4; - var table = this._tables[1]; // load up the tables - - var table0 = table[0]; - var table1 = table[1]; - var table2 = table[2]; - var table3 = table[3]; - var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL. - - for (i = 0; i < nInnerRounds; i++) { - a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex]; - b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1]; - c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2]; - d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3]; - kIndex += 4; - a = a2; - b = b2; - c = c2; - } // Last round. - - - for (i = 0; i < 4; i++) { - out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++]; - a2 = a; - a = b; - b = c; - c = d; - d = a2; - } - }; - - return AES; - }(); - - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; - } - - var inheritsLoose = _inheritsLoose; - - /** - * @file stream.js - */ - - /** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ - var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; - }(); - - /** - * A wrapper around the Stream class to use setTimeout - * and run stream "jobs" Asynchronously - * - * @class AsyncStream - * @extends Stream - */ - - var AsyncStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(AsyncStream, _Stream); - - function AsyncStream() { - var _this; - - _this = _Stream.call(this, Stream) || this; - _this.jobs = []; - _this.delay = 1; - _this.timeout_ = null; - return _this; - } - /** - * process an async job - * - * @private - */ - - - var _proto = AsyncStream.prototype; - - _proto.processJob_ = function processJob_() { - this.jobs.shift()(); - - if (this.jobs.length) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } else { - this.timeout_ = null; - } - } - /** - * push a job into the stream - * - * @param {Function} job the job to push into the stream - */ - ; - - _proto.push = function push(job) { - this.jobs.push(job); - - if (!this.timeout_) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } - }; - - return AsyncStream; - }(Stream); - - /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ - /** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - - function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); - } - - /** - * Convert network-order (big-endian) bytes into their little-endian - * representation. - */ - - var ntoh = function ntoh(word) { - return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24; - }; - /** - * Decrypt bytes using AES-128 with CBC and PKCS#7 padding. - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * use for the first round of CBC. - * @return {Uint8Array} the decrypted bytes - * - * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard - * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29 - * @see https://tools.ietf.org/html/rfc2315 - */ - - - var decrypt = function decrypt(encrypted, key, initVector) { - // word-level access to the encrypted bytes - var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2); - var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output - - var decrypted = new Uint8Array(encrypted.byteLength); - var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and - // decrypted data - - var init0; - var init1; - var init2; - var init3; - var encrypted0; - var encrypted1; - var encrypted2; - var encrypted3; // iteration variable - - var wordIx; // pull out the words of the IV to ensure we don't modify the - // passed-in reference and easier access - - init0 = initVector[0]; - init1 = initVector[1]; - init2 = initVector[2]; - init3 = initVector[3]; // decrypt four word sequences, applying cipher-block chaining (CBC) - // to each decrypted block - - for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { - // convert big-endian (network order) words into little-endian - // (javascript order) - encrypted0 = ntoh(encrypted32[wordIx]); - encrypted1 = ntoh(encrypted32[wordIx + 1]); - encrypted2 = ntoh(encrypted32[wordIx + 2]); - encrypted3 = ntoh(encrypted32[wordIx + 3]); // decrypt the block - - decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); // XOR with the IV, and restore network byte-order to obtain the - // plaintext - - decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0); - decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1); - decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2); - decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); // setup the IV for the next round - - init0 = encrypted0; - init1 = encrypted1; - init2 = encrypted2; - init3 = encrypted3; - } - - return decrypted; - }; - /** - * The `Decrypter` class that manages decryption of AES - * data through `AsyncStream` objects and the `decrypt` - * function - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * @param {Function} done the function to run when done - * @class Decrypter - */ - - - var Decrypter = /*#__PURE__*/function () { - function Decrypter(encrypted, key, initVector, done) { - var step = Decrypter.STEP; - var encrypted32 = new Int32Array(encrypted.buffer); - var decrypted = new Uint8Array(encrypted.byteLength); - var i = 0; - this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously - - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - - for (i = step; i < encrypted32.length; i += step) { - initVector = new Uint32Array([ntoh(encrypted32[i - 4]), ntoh(encrypted32[i - 3]), ntoh(encrypted32[i - 2]), ntoh(encrypted32[i - 1])]); - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - } // invoke the done() callback when everything is finished - - - this.asyncStream_.push(function () { - // remove pkcs#7 padding from the decrypted bytes - done(null, unpad(decrypted)); - }); - } - /** - * a getter for step the maximum number of bytes to process at one time - * - * @return {number} the value of step 32000 - */ - - - var _proto = Decrypter.prototype; - - /** - * @private - */ - _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) { - return function () { - var bytes = decrypt(encrypted, key, initVector); - decrypted.set(bytes, encrypted.byteOffset); - }; - }; - - createClass(Decrypter, null, [{ - key: "STEP", - get: function get() { - // 4 * 8000; - return 32000; - } - }]); - - return Decrypter; - }(); - - exports.AsyncStream = AsyncStream; - exports.Decrypter = Decrypter; - exports.decrypt = decrypt; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/aes-decrypter/dist/aes-decrypter.min.js b/node_modules/aes-decrypter/dist/aes-decrypter.min.js deleted file mode 100644 index 55d207b..0000000 --- a/node_modules/aes-decrypter/dist/aes-decrypter.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).aesDecrypter={})}(this,(function(t){"use strict";function e(t,e){for(var n=0;n>7))^t]=t;for(e=n=0;!a[e];e^=r||1,n=p[n]||1)for(s=(s=n^n<<1^n<<2^n<<3^n<<4)>>8^255&s^99,a[e]=s,h[s]=e,u=16843009*y[i=y[r=y[e]]]^65537*i^257*r^16843008*e,o=257*y[s]^16843008*s,t=0;t<4;t++)c[t][e]=o=o<<24^o>>>8,f[t][s]=u=u<<24^u>>>8;for(t=0;t<5;t++)c[t]=c[t].slice(0),f[t]=f[t].slice(0);return l}()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];var s=this._tables[0][4],o=this._tables[1],u=t.length,l=1;if(4!==u&&6!==u&&8!==u)throw new Error("Invalid aes key size");var c=t.slice(0),f=[];for(this._key=[c,f],e=u;e<4*u+28;e++)i=c[e-1],(e%u==0||8===u&&e%u==4)&&(i=s[i>>>24]<<24^s[i>>16&255]<<16^s[i>>8&255]<<8^s[255&i],e%u==0&&(i=i<<8^i>>>24^l<<24,l=l<<1^283*(l>>7))),c[e]=c[e-u]^i;for(n=0;e;n++,e--)i=c[3&n?e:e-4],f[n]=e<=4||n<4?i:o[0][s[i>>>24]]^o[1][s[i>>16&255]]^o[2][s[i>>8&255]]^o[3][s[255&i]]}return t.prototype.decrypt=function(t,e,n,r,i,s){var o,u,l,c,f=this._key[1],a=t^f[0],h=r^f[1],y=n^f[2],p=e^f[3],b=f.length/4-2,d=4,_=this._tables[1],v=_[0],g=_[1],m=_[2],w=_[3],A=_[4];for(c=0;c>>24]^g[h>>16&255]^m[y>>8&255]^w[255&p]^f[d],u=v[h>>>24]^g[y>>16&255]^m[p>>8&255]^w[255&a]^f[d+1],l=v[y>>>24]^g[p>>16&255]^m[a>>8&255]^w[255&h]^f[d+2],p=v[p>>>24]^g[a>>16&255]^m[h>>8&255]^w[255&y]^f[d+3],d+=4,a=o,h=u,y=l;for(c=0;c<4;c++)i[(3&-c)+s]=A[a>>>24]<<24^A[h>>16&255]<<16^A[y>>8&255]<<8^A[255&p]^f[d++],o=a,a=h,h=y,y=p,p=o},t}();var s=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e},o=function(){function t(){this.listeners={}}var e=t.prototype;return e.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},e.off=function(t,e){if(!this.listeners[t])return!1;var n=this.listeners[t].indexOf(e);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(n,1),n>-1},e.trigger=function(t){var e=this.listeners[t];if(e)if(2===arguments.length)for(var n=e.length,r=0;r>8|t>>>24},c=function(t,e,n){var r,s,o,u,c,f,a,h,y,p=new Int32Array(t.buffer,t.byteOffset,t.byteLength>>2),b=new i(Array.prototype.slice.call(e)),d=new Uint8Array(t.byteLength),_=new Int32Array(d.buffer);for(r=n[0],s=n[1],o=n[2],u=n[3],y=0;y - - - - aes-decrypter Demo - - - -

To test this out, open up your developer console.

- - - diff --git a/node_modules/aes-decrypter/package.json b/node_modules/aes-decrypter/package.json deleted file mode 100644 index 2ea438f..0000000 --- a/node_modules/aes-decrypter/package.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "_from": "aes-decrypter@3.1.2", - "_id": "aes-decrypter@3.1.2", - "_inBundle": false, - "_integrity": "sha512-42nRwfQuPRj9R1zqZBdoxnaAmnIFyDi0MNyTVhjdFOd8fifXKKRfwIHIZ6AMn1or4x5WONzjwRTbTWcsIQ0O4A==", - "_location": "/aes-decrypter", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "aes-decrypter@3.1.2", - "name": "aes-decrypter", - "escapedName": "aes-decrypter", - "rawSpec": "3.1.2", - "saveSpec": null, - "fetchSpec": "3.1.2" - }, - "_requiredBy": [ - "/@videojs/http-streaming", - "/video.js" - ], - "_resolved": "https://registry.npmjs.org/aes-decrypter/-/aes-decrypter-3.1.2.tgz", - "_shasum": "3545546f8e9f6b878640339a242efe221ba7a7cb", - "_spec": "aes-decrypter@3.1.2", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js", - "author": { - "name": "Brightcove, Inc." - }, - "browserslist": [ - "defaults", - "ie 11" - ], - "bugs": { - "url": "https://github.com/videojs/aes-decrypter/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "gkatsev" - }, - { - "name": "imbcmdth" - }, - { - "name": "dmlap" - }, - { - "name": "bcasey" - } - ], - "dependencies": { - "@babel/runtime": "^7.12.5", - "@videojs/vhs-utils": "^3.0.0", - "global": "^4.4.0", - "pkcs7": "^1.0.4" - }, - "deprecated": false, - "description": "decrypt aes-128 content using a key", - "devDependencies": { - "@rollup/plugin-replace": "^2.3.4", - "@videojs/generator-helpers": "~2.0.1", - "karma": "^5.2.3", - "rollup": "^2.36.1", - "sinon": "^9.2.3", - "videojs-generate-karma-config": "~7.0.0", - "videojs-generate-rollup-config": "~6.1.0", - "videojs-generator-verify": "~3.0.1", - "videojs-standard": "^8.0.4" - }, - "directories": { - "test": "test" - }, - "files": [ - "CONTRIBUTING.md", - "dist/", - "docs/", - "index.html", - "scripts/", - "src/", - "test/" - ], - "generator-videojs-plugin": { - "version": "7.7.3" - }, - "homepage": "https://github.com/videojs/aes-decrypter#readme", - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "keywords": [ - "videojs", - "videojs-plugin" - ], - "license": "Apache-2.0", - "lint-staged": { - "*.js": "vjsstandard --fix", - "README.md": "doctoc --notitle" - }, - "main": "dist/aes-decrypter.cjs.js", - "module": "dist/aes-decrypter.es.js", - "name": "aes-decrypter", - "repository": { - "type": "git", - "url": "git+https://github.com/videojs/aes-decrypter.git" - }, - "scripts": { - "build": "npm-run-all -s clean -p build:*", - "build-prod": "cross-env-shell NO_TEST_BUNDLE=1 'npm run build'", - "build-test": "cross-env-shell TEST_BUNDLE_ONLY=1 'npm run build'", - "build:js": "rollup -c scripts/rollup.config.js", - "clean": "shx rm -rf ./dist ./test/dist && shx mkdir -p ./dist ./test/dist", - "lint": "vjsstandard", - "posttest": "shx cat test/dist/coverage/text.txt", - "prepublishOnly": "npm-run-all build-prod && vjsverify --verbose", - "preversion": "npm test", - "server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch", - "start": "npm-run-all -p server watch", - "test": "npm-run-all lint build-test && karma start scripts/karma.conf.js", - "update-changelog": "conventional-changelog -p videojs -i CHANGELOG.md -s", - "version": "is-prerelease || npm run update-changelog && git add CHANGELOG.md", - "watch": "npm-run-all -p watch:*", - "watch:js": "npm run build:js -- -w" - }, - "version": "3.1.2", - "vjsstandard": { - "ignore": [ - "dist", - "docs", - "test/dist" - ] - } -} diff --git a/node_modules/aes-decrypter/scripts/karma.conf.js b/node_modules/aes-decrypter/scripts/karma.conf.js deleted file mode 100644 index ac53a18..0000000 --- a/node_modules/aes-decrypter/scripts/karma.conf.js +++ /dev/null @@ -1,12 +0,0 @@ -const generate = require('videojs-generate-karma-config'); - -module.exports = function(config) { - - // see https://github.com/videojs/videojs-generate-karma-config - // for options - const options = {}; - - config = generate(config, options); - - // any other custom stuff not supported by options here! -}; diff --git a/node_modules/aes-decrypter/scripts/rollup.config.js b/node_modules/aes-decrypter/scripts/rollup.config.js deleted file mode 100644 index 8641ab2..0000000 --- a/node_modules/aes-decrypter/scripts/rollup.config.js +++ /dev/null @@ -1,36 +0,0 @@ -const generate = require('videojs-generate-rollup-config'); -const replace = require('@rollup/plugin-replace'); - -// see https://github.com/videojs/videojs-generate-rollup-config -// for options -const options = { - input: 'src/index.js', - externals(defaults) { - defaults.module.push('pkcs7'); - defaults.module.push('@videojs/vhs-utils'); - return defaults; - }, - primedPlugins(defaults) { - // when using "require" rather than import - // require cjs module - defaults.replace = replace({ - // single quote replace - "require('@videojs/vhs-utils/es": "require('@videojs/vhs-utils/cjs", - // double quote replace - 'require("@videojs/vhs-utils/es': 'require("@videojs/vhs-utils/cjs' - }); - - return defaults; - }, - plugins(defaults) { - defaults.module.unshift('replace'); - - return defaults; - } -}; -const config = generate(options); - -// Add additonal builds/customization here! - -// export the builds to rollup -export default Object.values(config.builds); diff --git a/node_modules/aes-decrypter/src/aes.js b/node_modules/aes-decrypter/src/aes.js deleted file mode 100644 index 5ca850e..0000000 --- a/node_modules/aes-decrypter/src/aes.js +++ /dev/null @@ -1,258 +0,0 @@ -/** - * @file aes.js - * - * This file contains an adaptation of the AES decryption algorithm - * from the Standford Javascript Cryptography Library. That work is - * covered by the following copyright and permissions notice: - * - * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 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. - * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing - * official policies, either expressed or implied, of the authors. - */ - -/** - * Expand the S-box tables. - * - * @private - */ -const precompute = function() { - const tables = [[[], [], [], [], []], [[], [], [], [], []]]; - const encTable = tables[0]; - const decTable = tables[1]; - const sbox = encTable[4]; - const sboxInv = decTable[4]; - let i; - let x; - let xInv; - const d = []; - const th = []; - let x2; - let x4; - let x8; - let s; - let tEnc; - let tDec; - - // Compute double and third tables - for (i = 0; i < 256; i++) { - th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i; - } - - for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) { - // Compute sbox - s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4; - s = s >> 8 ^ s & 255 ^ 99; - sbox[x] = s; - sboxInv[s] = x; - - // Compute MixColumns - x8 = d[x4 = d[x2 = d[x]]]; - tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - tEnc = d[s] * 0x101 ^ s * 0x1010100; - - for (i = 0; i < 4; i++) { - encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8; - decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8; - } - } - - // Compactify. Considerable speedup on Firefox. - for (i = 0; i < 5; i++) { - encTable[i] = encTable[i].slice(0); - decTable[i] = decTable[i].slice(0); - } - return tables; -}; -let aesTables = null; - -/** - * Schedule out an AES key for both encryption and decryption. This - * is a low-level class. Use a cipher mode to do bulk encryption. - * - * @class AES - * @param key {Array} The key as an array of 4, 6 or 8 words. - */ -export default class AES { - constructor(key) { - /** - * The expanded S-box and inverse S-box tables. These will be computed - * on the client so that we don't have to send them down the wire. - * - * There are two tables, _tables[0] is for encryption and - * _tables[1] is for decryption. - * - * The first 4 sub-tables are the expanded S-box with MixColumns. The - * last (_tables[01][4]) is the S-box itself. - * - * @private - */ - // if we have yet to precompute the S-box tables - // do so now - if (!aesTables) { - aesTables = precompute(); - } - // then make a copy of that object for use - this._tables = [[aesTables[0][0].slice(), - aesTables[0][1].slice(), - aesTables[0][2].slice(), - aesTables[0][3].slice(), - aesTables[0][4].slice()], - [aesTables[1][0].slice(), - aesTables[1][1].slice(), - aesTables[1][2].slice(), - aesTables[1][3].slice(), - aesTables[1][4].slice()]]; - let i; - let j; - let tmp; - const sbox = this._tables[0][4]; - const decTable = this._tables[1]; - const keyLen = key.length; - let rcon = 1; - - if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) { - throw new Error('Invalid aes key size'); - } - - const encKey = key.slice(0); - const decKey = []; - - this._key = [encKey, decKey]; - - // schedule encryption keys - for (i = keyLen; i < 4 * keyLen + 28; i++) { - tmp = encKey[i - 1]; - - // apply sbox - if (i % keyLen === 0 || (keyLen === 8 && i % keyLen === 4)) { - tmp = sbox[tmp >>> 24] << 24 ^ - sbox[tmp >> 16 & 255] << 16 ^ - sbox[tmp >> 8 & 255] << 8 ^ - sbox[tmp & 255]; - - // shift rows and add rcon - if (i % keyLen === 0) { - tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24; - rcon = rcon << 1 ^ (rcon >> 7) * 283; - } - } - - encKey[i] = encKey[i - keyLen] ^ tmp; - } - - // schedule decryption keys - for (j = 0; i; j++, i--) { - tmp = encKey[j & 3 ? i : i - 4]; - if (i <= 4 || j < 4) { - decKey[j] = tmp; - } else { - decKey[j] = decTable[0][sbox[tmp >>> 24 ]] ^ - decTable[1][sbox[tmp >> 16 & 255]] ^ - decTable[2][sbox[tmp >> 8 & 255]] ^ - decTable[3][sbox[tmp & 255]]; - } - } - } - - /** - * Decrypt 16 bytes, specified as four 32-bit words. - * - * @param {number} encrypted0 the first word to decrypt - * @param {number} encrypted1 the second word to decrypt - * @param {number} encrypted2 the third word to decrypt - * @param {number} encrypted3 the fourth word to decrypt - * @param {Int32Array} out the array to write the decrypted words - * into - * @param {number} offset the offset into the output array to start - * writing results - * @return {Array} The plaintext. - */ - decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) { - const key = this._key[1]; - // state variables a,b,c,d are loaded with pre-whitened data - let a = encrypted0 ^ key[0]; - let b = encrypted3 ^ key[1]; - let c = encrypted2 ^ key[2]; - let d = encrypted1 ^ key[3]; - let a2; - let b2; - let c2; - - // key.length === 2 ? - const nInnerRounds = key.length / 4 - 2; - let i; - let kIndex = 4; - const table = this._tables[1]; - - // load up the tables - const table0 = table[0]; - const table1 = table[1]; - const table2 = table[2]; - const table3 = table[3]; - const sbox = table[4]; - - // Inner rounds. Cribbed from OpenSSL. - for (i = 0; i < nInnerRounds; i++) { - a2 = table0[a >>> 24] ^ - table1[b >> 16 & 255] ^ - table2[c >> 8 & 255] ^ - table3[d & 255] ^ - key[kIndex]; - b2 = table0[b >>> 24] ^ - table1[c >> 16 & 255] ^ - table2[d >> 8 & 255] ^ - table3[a & 255] ^ - key[kIndex + 1]; - c2 = table0[c >>> 24] ^ - table1[d >> 16 & 255] ^ - table2[a >> 8 & 255] ^ - table3[b & 255] ^ - key[kIndex + 2]; - d = table0[d >>> 24] ^ - table1[a >> 16 & 255] ^ - table2[b >> 8 & 255] ^ - table3[c & 255] ^ - key[kIndex + 3]; - kIndex += 4; - a = a2; b = b2; c = c2; - } - - // Last round. - for (i = 0; i < 4; i++) { - out[(3 & -i) + offset] = - sbox[a >>> 24] << 24 ^ - sbox[b >> 16 & 255] << 16 ^ - sbox[c >> 8 & 255] << 8 ^ - sbox[d & 255] ^ - key[kIndex++]; - a2 = a; a = b; b = c; c = d; d = a2; - } - } -} diff --git a/node_modules/aes-decrypter/src/async-stream.js b/node_modules/aes-decrypter/src/async-stream.js deleted file mode 100644 index b8acf08..0000000 --- a/node_modules/aes-decrypter/src/async-stream.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file async-stream.js - */ -import Stream from '@videojs/vhs-utils/es/stream.js'; - -/** - * A wrapper around the Stream class to use setTimeout - * and run stream "jobs" Asynchronously - * - * @class AsyncStream - * @extends Stream - */ -export default class AsyncStream extends Stream { - constructor() { - super(Stream); - this.jobs = []; - this.delay = 1; - this.timeout_ = null; - } - - /** - * process an async job - * - * @private - */ - processJob_() { - this.jobs.shift()(); - if (this.jobs.length) { - this.timeout_ = setTimeout( - this.processJob_.bind(this), - this.delay - ); - } else { - this.timeout_ = null; - } - } - - /** - * push a job into the stream - * - * @param {Function} job the job to push into the stream - */ - push(job) { - this.jobs.push(job); - if (!this.timeout_) { - this.timeout_ = setTimeout( - this.processJob_.bind(this), - this.delay - ); - } - } -} - diff --git a/node_modules/aes-decrypter/src/decrypter.js b/node_modules/aes-decrypter/src/decrypter.js deleted file mode 100644 index d887d62..0000000 --- a/node_modules/aes-decrypter/src/decrypter.js +++ /dev/null @@ -1,179 +0,0 @@ -/** - * @file decrypter.js - * - * An asynchronous implementation of AES-128 CBC decryption with - * PKCS#7 padding. - */ - -import AES from './aes'; -import AsyncStream from './async-stream'; -import {unpad} from 'pkcs7'; - -/** - * Convert network-order (big-endian) bytes into their little-endian - * representation. - */ -const ntoh = function(word) { - return (word << 24) | - ((word & 0xff00) << 8) | - ((word & 0xff0000) >> 8) | - (word >>> 24); -}; - -/** - * Decrypt bytes using AES-128 with CBC and PKCS#7 padding. - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * use for the first round of CBC. - * @return {Uint8Array} the decrypted bytes - * - * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard - * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29 - * @see https://tools.ietf.org/html/rfc2315 - */ -const decrypt = function(encrypted, key, initVector) { - // word-level access to the encrypted bytes - const encrypted32 = new Int32Array( - encrypted.buffer, - encrypted.byteOffset, - encrypted.byteLength >> 2 - ); - - const decipher = new AES(Array.prototype.slice.call(key)); - - // byte and word-level access for the decrypted output - const decrypted = new Uint8Array(encrypted.byteLength); - const decrypted32 = new Int32Array(decrypted.buffer); - - // temporary variables for working with the IV, encrypted, and - // decrypted data - let init0; - let init1; - let init2; - let init3; - let encrypted0; - let encrypted1; - let encrypted2; - let encrypted3; - - // iteration variable - let wordIx; - - // pull out the words of the IV to ensure we don't modify the - // passed-in reference and easier access - init0 = initVector[0]; - init1 = initVector[1]; - init2 = initVector[2]; - init3 = initVector[3]; - - // decrypt four word sequences, applying cipher-block chaining (CBC) - // to each decrypted block - for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { - // convert big-endian (network order) words into little-endian - // (javascript order) - encrypted0 = ntoh(encrypted32[wordIx]); - encrypted1 = ntoh(encrypted32[wordIx + 1]); - encrypted2 = ntoh(encrypted32[wordIx + 2]); - encrypted3 = ntoh(encrypted32[wordIx + 3]); - - // decrypt the block - decipher.decrypt( - encrypted0, - encrypted1, - encrypted2, - encrypted3, - decrypted32, - wordIx - ); - - // XOR with the IV, and restore network byte-order to obtain the - // plaintext - decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0); - decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1); - decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2); - decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); - - // setup the IV for the next round - init0 = encrypted0; - init1 = encrypted1; - init2 = encrypted2; - init3 = encrypted3; - } - - return decrypted; -}; - -/** - * The `Decrypter` class that manages decryption of AES - * data through `AsyncStream` objects and the `decrypt` - * function - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * @param {Function} done the function to run when done - * @class Decrypter - */ -class Decrypter { - constructor(encrypted, key, initVector, done) { - const step = Decrypter.STEP; - const encrypted32 = new Int32Array(encrypted.buffer); - const decrypted = new Uint8Array(encrypted.byteLength); - let i = 0; - - this.asyncStream_ = new AsyncStream(); - - // split up the encryption job and do the individual chunks asynchronously - this.asyncStream_.push(this.decryptChunk_( - encrypted32.subarray(i, i + step), - key, - initVector, - decrypted - )); - for (i = step; i < encrypted32.length; i += step) { - initVector = new Uint32Array([ntoh(encrypted32[i - 4]), - ntoh(encrypted32[i - 3]), - ntoh(encrypted32[i - 2]), - ntoh(encrypted32[i - 1])]); - this.asyncStream_.push(this.decryptChunk_( - encrypted32.subarray(i, i + step), - key, - initVector, - decrypted - )); - } - // invoke the done() callback when everything is finished - this.asyncStream_.push(function() { - // remove pkcs#7 padding from the decrypted bytes - done(null, unpad(decrypted)); - }); - } - - /** - * a getter for step the maximum number of bytes to process at one time - * - * @return {number} the value of step 32000 - */ - static get STEP() { - // 4 * 8000; - return 32000; - } - - /** - * @private - */ - decryptChunk_(encrypted, key, initVector, decrypted) { - return function() { - const bytes = decrypt(encrypted, key, initVector); - - decrypted.set(bytes, encrypted.byteOffset); - }; - } -} - -export { - Decrypter, - decrypt -}; diff --git a/node_modules/aes-decrypter/src/index.js b/node_modules/aes-decrypter/src/index.js deleted file mode 100644 index dd75764..0000000 --- a/node_modules/aes-decrypter/src/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @file index.js - * - * Index module to easily import the primary components of AES-128 - * decryption. Like this: - * - * ```js - * import {Decrypter, decrypt, AsyncStream} from 'aes-decrypter'; - * ``` - */ -import {decrypt, Decrypter} from './decrypter'; -import AsyncStream from './async-stream'; - -export { - decrypt, - Decrypter, - AsyncStream -}; diff --git a/node_modules/aes-decrypter/test/decrypter.test.js b/node_modules/aes-decrypter/test/decrypter.test.js deleted file mode 100644 index b050ebd..0000000 --- a/node_modules/aes-decrypter/test/decrypter.test.js +++ /dev/null @@ -1,198 +0,0 @@ -// see docs/hlse.md for instructions on how test data was generated -import QUnit from 'qunit'; -import {unpad} from 'pkcs7'; -import sinon from 'sinon'; -import {decrypt, Decrypter, AsyncStream} from '../src'; - -// see docs/hlse.md for instructions on how test data was generated -const stringFromBytes = function(bytes) { - let result = ''; - - for (let i = 0; i < bytes.length; i++) { - result += String.fromCharCode(bytes[i]); - } - return result; -}; - -QUnit.module('Decryption'); -QUnit.test('decrypts a single AES-128 with PKCS7 block', function(assert) { - const key = new Uint32Array([0, 0, 0, 0]); - const initVector = key; - // the string "howdy folks" encrypted - const encrypted = new Uint8Array([ - 0xce, 0x90, 0x97, 0xd0, - 0x08, 0x46, 0x4d, 0x18, - 0x4f, 0xae, 0x01, 0x1c, - 0x82, 0xa8, 0xf0, 0x67 - ]); - - assert.deepEqual( - 'howdy folks', - stringFromBytes(unpad(decrypt(encrypted, key, initVector))), - 'decrypted with a byte array key' - ); -}); - -QUnit.test('decrypts multiple AES-128 blocks with CBC', function(assert) { - const key = new Uint32Array([0, 0, 0, 0]); - const initVector = key; - // the string "0123456789abcdef01234" encrypted - const encrypted = new Uint8Array([ - 0x14, 0xf5, 0xfe, 0x74, - 0x69, 0x66, 0xf2, 0x92, - 0x65, 0x1c, 0x22, 0x88, - 0xbb, 0xff, 0x46, 0x09, - - 0x0b, 0xde, 0x5e, 0x71, - 0x77, 0x87, 0xeb, 0x84, - 0xa9, 0x54, 0xc2, 0x45, - 0xe9, 0x4e, 0x29, 0xb3 - ]); - - assert.deepEqual( - '0123456789abcdef01234', - stringFromBytes(unpad(decrypt(encrypted, key, initVector))), - 'decrypted multiple blocks' - ); -}); - -QUnit.test( - 'verify that the deepcopy works by doing two decrypts in the same test', - function(assert) { - const key = new Uint32Array([0, 0, 0, 0]); - const initVector = key; - // the string "howdy folks" encrypted - const pkcs7Block = new Uint8Array([ - 0xce, 0x90, 0x97, 0xd0, - 0x08, 0x46, 0x4d, 0x18, - 0x4f, 0xae, 0x01, 0x1c, - 0x82, 0xa8, 0xf0, 0x67 - ]); - - assert.deepEqual( - 'howdy folks', - stringFromBytes(unpad(decrypt(pkcs7Block, key, initVector))), - 'decrypted with a byte array key' - ); - - // the string "0123456789abcdef01234" encrypted - const cbcBlocks = new Uint8Array([ - 0x14, 0xf5, 0xfe, 0x74, - 0x69, 0x66, 0xf2, 0x92, - 0x65, 0x1c, 0x22, 0x88, - 0xbb, 0xff, 0x46, 0x09, - - 0x0b, 0xde, 0x5e, 0x71, - 0x77, 0x87, 0xeb, 0x84, - 0xa9, 0x54, 0xc2, 0x45, - 0xe9, 0x4e, 0x29, 0xb3 - ]); - - assert.deepEqual( - '0123456789abcdef01234', - stringFromBytes(unpad(decrypt(cbcBlocks, key, initVector))), - 'decrypted multiple blocks' - ); - - } -); - -QUnit.module('Incremental Processing', { - beforeEach() { - this.clock = sinon.useFakeTimers(); - }, - afterEach() { - this.clock.restore(); - } -}); - -QUnit.test('executes a callback after a timeout', function(assert) { - const asyncStream = new AsyncStream(); - let calls = ''; - - asyncStream.push(function() { - calls += 'a'; - }); - - this.clock.tick(asyncStream.delay); - assert.equal(calls, 'a', 'invoked the callback once'); - this.clock.tick(asyncStream.delay); - assert.equal(calls, 'a', 'only invoked the callback once'); -}); - -QUnit.test('executes callback in series', function(assert) { - const asyncStream = new AsyncStream(); - let calls = ''; - - asyncStream.push(function() { - calls += 'a'; - }); - asyncStream.push(function() { - calls += 'b'; - }); - - this.clock.tick(asyncStream.delay); - assert.equal(calls, 'a', 'invoked the first callback'); - this.clock.tick(asyncStream.delay); - assert.equal(calls, 'ab', 'invoked the second'); -}); - -QUnit.module('Incremental Decryption', { - beforeEach() { - this.clock = sinon.useFakeTimers(); - }, - afterEach() { - this.clock.restore(); - } -}); - -QUnit.test('asynchronously decrypts a 4-word block', function(assert) { - const key = new Uint32Array([0, 0, 0, 0]); - const initVector = key; - // the string "howdy folks" encrypted - const encrypted = new Uint8Array([0xce, 0x90, 0x97, 0xd0, - 0x08, 0x46, 0x4d, 0x18, - 0x4f, 0xae, 0x01, 0x1c, - 0x82, 0xa8, 0xf0, 0x67]); - let decrypted; - const decrypter = new Decrypter( - encrypted, - key, - initVector, - function(error, result) { - if (error) { - throw new Error(error); - } - decrypted = result; - } - ); - - assert.ok(!decrypted, 'asynchronously decrypts'); - this.clock.tick(decrypter.asyncStream_.delay * 2); - - assert.ok(decrypted, 'completed decryption'); - assert.deepEqual( - 'howdy folks', - stringFromBytes(decrypted), - 'decrypts and unpads the result' - ); -}); - -QUnit.test('breaks up input greater than the step value', function(assert) { - const encrypted = new Int32Array(Decrypter.STEP + 4); - let done = false; - const decrypter = new Decrypter( - encrypted, - new Uint32Array(4), - new Uint32Array(4), - function() { - done = true; - } - ); - - this.clock.tick(decrypter.asyncStream_.delay * 2); - assert.ok(!done, 'not finished after two ticks'); - - this.clock.tick(decrypter.asyncStream_.delay); - assert.ok(done, 'finished after the last chunk is decrypted'); -}); diff --git a/node_modules/cssgram/.npmignore b/node_modules/cssgram/.npmignore deleted file mode 100644 index d444c16..0000000 --- a/node_modules/cssgram/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -assets/ \ No newline at end of file diff --git a/node_modules/cssgram/LICENSE b/node_modules/cssgram/LICENSE deleted file mode 100644 index fb81747..0000000 --- a/node_modules/cssgram/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Una Kravets - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/cssgram/README.md b/node_modules/cssgram/README.md deleted file mode 100644 index 484a6d7..0000000 --- a/node_modules/cssgram/README.md +++ /dev/null @@ -1,149 +0,0 @@ -![](http://una.im/CSSgram/img/cssgram-logo.png) - -# CSSgram - -Instagram filter library in Sass and CSS. - -## What is This? - -Simply put, CSSgram is a library for editing your images with Instagram-like filters directly in CSS. What we’re doing here is adding filters to the images as well as applying color and/or gradient overlays via various blending techniques to mimic these effects. This means *less manual image processing* and more fun filter effects on the web! - -We are using pseudo-elements (i.e. `::before` and `::after`) to create the filter effects, so you must apply these filters on a containing element (i.e. not a *replaced element* like ``). The recommendation is to wrap your images in a `
` tag. More about the tag [here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure). - -## Browser Support - -This library uses [CSS Filters](https://developer.mozilla.org/en-US/docs/Web/CSS/filter) and [CSS Blend Modes](https://css-tricks.com/basics-css-blend-modes/). These features are supported in the following browsers: - -| Chrome logo | Firefox logo | Internet Explorer logo | Opera logo | Safari logo | -|:---:|:---:|:---:|:---:|:---:| -| 43+ ✔ | 38+ ✔ | Nope ✘ | 32+ ✔ | 8+ ✔ | - -For more information, check on [Can I Use](http://caniuse.com/). - -## Usage - -**There are currently 2 ways to consume this library:** - -### Use CSS classes - -When using CSS classes, you can simply add the class with the filter name to the element containing your image. - - 1. Include the CDN link in your `` tag: `` - * Alternatively, you can [download the CSSgram library](https://raw.githubusercontent.com/una/CSSgram/master/source/css/cssgram.min.css) locally and link to the it within your project: `` - * Add a class to your image element with the name of the filter you would like to use - -For example: - -``` - -
- -
-``` - -Alternatively, you can just download and link to any individual css file (e.g. ``), if you’re just using one of the styles. - -### Available Classes - -_For use in HTML markup:_ - -* Aden: `class="aden"` -* Reyes: `class="reyes"` -* Perpetua: `class="perpetua"` -* Inkwell: `class="inkwell"` -* Toaster: `class="toaster"` -* Walden: `class="walden"` -* Hudson: `class="hudson"` -* Gingham: `class="gingham"` -* Mayfair: `class="mayfair"` -* Lo-fi: `class="lofi"` -* X-Pro II: `class="xpro2"` -* 1977: `class="_1977"` -* Brooklyn: `class="brooklyn"` -* Nashville: `class="nashville"` - -* * * - -### Use Sass `@extend` - -If you use custom naming in your CSS architecture, you can add the `.scss` files for the provided styles within your project and then `@extend` the filter effects within your style definitions. If you think extends are stupid, I will fight you 😊. - -1. [Download the `scss/` folder contents](https://github.com/una/CSSgram/tree/master/source/scss) -* Include a link to `scss/cssgram.scss` via an `@import` statement in your Sass manifest file (i.e. `main.scss`). It may look like: `@import 'vendor/cssgram'` -* Extend the placeholder selector (e.g. `@extend %aden`) in your element. - -For example: - -``` - -
- -
-``` - -``` -// Sass -.viz--beautiful { - @extend %aden; -} -``` - -Alternatively, you can just download and link any individual `.scss` file in your Sass manifest (i.e. `scss/aden.scss`), if you're just using one of the styles. - -### Available Placeholders - -_For use in Sass stylesheets:_ - -* Aden: `@extend %aden` -* Reyes: `@extend %reyes` -* Perpetua: `@extend %perpetua` -* Inkwell: `@extend %inkwell` -* Toaster: `@extend %toaster` -* Walden: `@extend %walden` -* Hudson: `@extend %hudson` -* Gingham: `@extend %gingham` -* Mayfair: `@extend %mayfair` -* Lo-fi: `@extend %lofi` -* X-Pro II: `@extend %xpro2` -* 1977: `@extend %_1977` -* Brooklyn: `@extend %brooklyn` -* Nashville: `@extend %nashville` - -## Contributing - -Either: - -1. Create an [issue](https://github.com/una/CSSgram/issues) - -Or: - -1. Fork this repository -2. Clone the fork onto your system -3. `npm install` dependencies (must have Node installed) -4. Run `gulp` to compile CSS and the test site -5. Make changes and check the test site with your changes (see file structure outline below) -6. Submit a PR referencing the issue with a smile :smile: - -If you’d like to contribute, the following filters are yet to be added: - -- [ ] [Charmes](https://github.com/una/CSSgram/issues/22) -- [ ] [Stinsen](https://github.com/una/CSSgram/issues/21) -- [ ] [Kelvin](https://github.com/una/CSSgram/issues/20) -- [ ] [Sutro](https://github.com/una/CSSgram/issues/19) -- [ ] [Hefe](https://github.com/una/CSSgram/issues/17) -- [ ] [Valencia](https://github.com/una/CSSgram/issues/16) -- [ ] [Rise](https://github.com/una/CSSgram/issues/15) -- [ ] [Sierra](https://github.com/una/CSSgram/issues/14) -- [ ] [Amaro](https://github.com/una/CSSgram/issues/13) -- [ ] [Crema](https://github.com/una/CSSgram/issues/12) - -Filters are really fun to create! Reference photos created by [Miles Croxford](https://twitter.com/milescroxford) can be found [here](https://instagram.com/cssgram/). - -## File Structure Outline - -- `source/css/cssgram.css` contains each of the CSS classes you can apply to your `` to give it the filter. You should use `source/css/cssgram.min.css` for production if you want access to all of the library -- `source/scss/` contains the source files for individual classes and placeholder selectors you can use to extend CSS classes in Sass -- `site/` is the public facing website -- `site/test` is how you test filters if you're developing, remember to change `is_done` for the filter you're creating in `site/test/index.twig` whilst gulp is running. - -Note: this will also have mixin options and a PostCSS Component. diff --git a/node_modules/cssgram/bower.json b/node_modules/cssgram/bower.json deleted file mode 100644 index da11277..0000000 --- a/node_modules/cssgram/bower.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "cssgram", - "description": "Instagram filter library in Sass and CSS.", - "main": [ - "source/css/cssgram.min.css", - "source/scss/cssgram.scss" - ], - "authors": [ - "Una Kravets" - ], - "license": "MIT", - "keywords": [ - "cssgram", - "filters", - "CSS", - "library", - "photo", - "effects" - ], - "homepage": "http://una.im/CSSgram/", - "moduleType": [], - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests", - "site" - ] -} diff --git a/node_modules/cssgram/gulpfile.js b/node_modules/cssgram/gulpfile.js deleted file mode 100644 index 6ab6b95..0000000 --- a/node_modules/cssgram/gulpfile.js +++ /dev/null @@ -1,111 +0,0 @@ -var gulp = require('gulp'), - sass = require('gulp-sass'), - rename = require('gulp-rename'), - cssmin = require('gulp-minify-css'), - concat = require('gulp-concat'), - uglify = require('gulp-uglify'), - cache = require('gulp-cached'), - prefix = require('gulp-autoprefixer'), - browserSync = require('browser-sync'), - reload = browserSync.reload, - size = require('gulp-size'), - imagemin = require('gulp-imagemin'), - minifyHTML = require('gulp-minify-html'), - pngquant = require('imagemin-pngquant'), - plumber = require('gulp-plumber'), - deploy = require('gulp-gh-pages'), - notify = require('gulp-notify'), - sassLint = require('gulp-sass-lint'), - twig = require('gulp-twig'); - - -gulp.task('lib-scss', function() { - var onError = function(err) { - notify.onError({ - title: "Gulp", - subtitle: "Failure!", - message: "Error: <%= error.message %>", - sound: "Beep" - })(err); - this.emit('end'); - }; - - return gulp.src('source/scss/**/*.scss') - .pipe(plumber({errorHandler: onError})) - .pipe(sass()) - .pipe(size({ gzip: true, showFiles: true })) - .pipe(prefix()) - .pipe(gulp.dest('source/css')) - .pipe(reload({stream:true})) - .pipe(cssmin()) - .pipe(size({ gzip: true, showFiles: true })) - .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('source/css')) - .pipe(gulp.dest('site/css')); -}); - -gulp.task('site-scss', function() { - var onError = function(err) { - notify.onError({ - title: "Gulp", - subtitle: "Failure!", - message: "Error: <%= error.message %>", - sound: "Beep" - })(err); - this.emit('end'); - }; - - return gulp.src('site/scss/**/*.scss') - .pipe(plumber({errorHandler: onError})) - .pipe(sass()) - .pipe(size({ gzip: true, showFiles: true })) - .pipe(prefix()) - .pipe(gulp.dest('site/css')) - .pipe(reload({stream:true})) - .pipe(cssmin()) - .pipe(size({ gzip: true, showFiles: true })) - .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('site/css')); -}); - -gulp.task('browser-sync', function() { - browserSync({ - server: { - baseDir: "site" - } - }); -}); - -gulp.task('deploy', function () { - return gulp.src('site/**/*') - .pipe(deploy()); -}); - -gulp.task('sass-lint', function () { - gulp.src('scss/**/*.scss') - .pipe(sassLint()) - .pipe(sassLint.format()) - .pipe(sassLint.failOnError()); -}); - -gulp.task('twig', function () { - gulp.src('site/**/*.twig', {base: './'}) - .pipe(twig()) - .pipe(gulp.dest('./')); -}); - - -gulp.task('watch', function() { - gulp.watch('source/scss/**/*.scss', ['lib-scss', 'site-scss', 'sass-lint']); - gulp.watch('source/scss/**/*.html', ['minify-html']); - gulp.watch('site/**/*.twig', ['twig']); -}); - - -gulp.task('jshint', function() { - gulp.src('js/*.js') - .pipe(jshint()) - .pipe(jshint.reporter('default')); -}); - -gulp.task('default', ['browser-sync', 'twig', 'lib-scss', 'site-scss', 'watch']); diff --git a/node_modules/cssgram/package.json b/node_modules/cssgram/package.json deleted file mode 100644 index d42e05a..0000000 --- a/node_modules/cssgram/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "_args": [ - [ - "cssgram@0.1.3", - "F:\\Documents\\websites\\BMM" - ] - ], - "_from": "cssgram@0.1.3", - "_id": "cssgram@0.1.3", - "_inBundle": false, - "_integrity": "sha1-zIBiLOrqyhjUoqqFz4U8RCA0ol4=", - "_location": "/cssgram", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "cssgram@0.1.3", - "name": "cssgram", - "escapedName": "cssgram", - "rawSpec": "0.1.3", - "saveSpec": null, - "fetchSpec": "0.1.3" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/cssgram/-/cssgram-0.1.3.tgz", - "_spec": "0.1.3", - "_where": "F:\\Documents\\websites\\BMM", - "author": { - "name": "Una Kravets", - "email": "una.kravets@gmail.com", - "url": "http://una.im" - }, - "bugs": { - "url": "https://github.com/una/CSSgram/issues" - }, - "dependencies": {}, - "description": "![](http://una.im/CSSgram/img/cssgram-logo.png)", - "devDependencies": { - "browser-sync": "^2.0.0-rc4", - "gulp": "^3.8.10", - "gulp-autoprefixer": "^2.1.0", - "gulp-cached": "^1.0.2", - "gulp-concat": "^2.4.3", - "gulp-gh-pages": "^0.4.0", - "gulp-imagemin": "^2.1.0", - "gulp-minify-css": "^0.3.12", - "gulp-minify-html": "^0.1.8", - "gulp-notify": "^2.2.0", - "gulp-plumber": "^0.6.6", - "gulp-rename": "^1.2.0", - "gulp-sass": "^1.3.2", - "gulp-sass-lint": "0.1.0-beta.2", - "gulp-size": "^1.2.0", - "gulp-twig": "~0.4.0", - "gulp-uglify": "^1.0.2", - "imagemin-pngquant": "^4.0.0" - }, - "homepage": "https://github.com/una/CSSgram#readme", - "keywords": [ - "cssgram", - "filters", - "CSS", - "library", - "photo", - "effects" - ], - "license": "MIT", - "name": "cssgram", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/una/CSSgram.git" - }, - "style": "source/css/cssgram.css", - "version": "0.1.3" -} diff --git a/node_modules/cssgram/sass-lint.yml b/node_modules/cssgram/sass-lint.yml deleted file mode 100644 index fb64bba..0000000 --- a/node_modules/cssgram/sass-lint.yml +++ /dev/null @@ -1,34 +0,0 @@ -files: - include: '**/*.s+(a|c)ss' - ignore: -rules: - # Consistency Rules - extends-before-mixins: 1 - extends-before-declarations: 1 - mixins-before-declarations: 1 - # Require an empty line between blocks - empty-line-between-blocks: 1 - no-empty-rulesets: 1 - no-extends: 0 - final-newline: 1 - no-ids: 1 - indentation: 1 - no-important: 1 - leading-zero: 1 - nesting-depth: 1 - placeholder-in-extend: 1 - property-sort-order: 1 - one-declaration-per-line: 1 - single-line-per-selector: 1 - space-after-comma: 1 - # Space surrounding colons - space-before-colon: 1 - space-after-colon: 1 - - space-before-brace: 1 - - space-before-bang: 1 - space-after-bang: 1 - - space-between-parens: 1 - trailing-semicolon: 1 \ No newline at end of file diff --git a/node_modules/cssgram/site/css/1977.min.css b/node_modules/cssgram/site/css/1977.min.css deleted file mode 100644 index ee34123..0000000 --- a/node_modules/cssgram/site/css/1977.min.css +++ /dev/null @@ -1 +0,0 @@ -._1977:after,._1977:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}._1977{position:relative}._1977 img{width:100%;z-index:1}._1977:before{z-index:2}._1977:after{z-index:3}._1977{-webkit-filter:contrast(1.1) brightness(1.1) saturate(1.3);filter:contrast(1.1) brightness(1.1) saturate(1.3)}._1977:after{background:rgba(243,106,188,.3);mix-blend-mode:screen} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/aden.min.css b/node_modules/cssgram/site/css/aden.min.css deleted file mode 100644 index 9cb969e..0000000 --- a/node_modules/cssgram/site/css/aden.min.css +++ /dev/null @@ -1 +0,0 @@ -.aden:after,.aden:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.aden{position:relative}.aden img{width:100%;z-index:1}.aden:before{z-index:2}.aden:after{z-index:3}.aden{-webkit-filter:hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2);filter:hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2)}.aden:after{background:-webkit-linear-gradient(left,rgba(66,10,14,.2),transparent);background:linear-gradient(to right,rgba(66,10,14,.2),transparent);mix-blend-mode:darken} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/brooklyn.min.css b/node_modules/cssgram/site/css/brooklyn.min.css deleted file mode 100644 index d7adc6b..0000000 --- a/node_modules/cssgram/site/css/brooklyn.min.css +++ /dev/null @@ -1 +0,0 @@ -.brooklyn:after,.brooklyn:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.brooklyn{position:relative}.brooklyn img{width:100%;z-index:1}.brooklyn:before{z-index:2}.brooklyn:after{z-index:3}.brooklyn{-webkit-filter:contrast(.9) brightness(1.1);filter:contrast(.9) brightness(1.1)}.brooklyn:after{background:-webkit-radial-gradient(circle,rgba(168,223,193,.4) 70%,#c4b7c8);background:radial-gradient(circle,rgba(168,223,193,.4) 70%,#c4b7c8);mix-blend-mode:overlay} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/cssgram.min.css b/node_modules/cssgram/site/css/cssgram.min.css deleted file mode 100644 index 90f673d..0000000 --- a/node_modules/cssgram/site/css/cssgram.min.css +++ /dev/null @@ -1 +0,0 @@ -.aden{-webkit-filter:hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2);filter:hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2)}.aden:after{background:-webkit-linear-gradient(left,rgba(66,10,14,.2),transparent);background:linear-gradient(to right,rgba(66,10,14,.2),transparent);mix-blend-mode:darken}.inkwell{-webkit-filter:sepia(.3) contrast(1.1) brightness(1.1) grayscale(1);filter:sepia(.3) contrast(1.1) brightness(1.1) grayscale(1)}.perpetua:after{background:-webkit-linear-gradient(top,#005b9a,#e6c13d);background:linear-gradient(to bottom,#005b9a,#e6c13d);mix-blend-mode:soft-light;opacity:.5}.reyes{-webkit-filter:sepia(.22) brightness(1.1) contrast(.85) saturate(.75);filter:sepia(.22) brightness(1.1) contrast(.85) saturate(.75)}.reyes:after{background:#efcdad;mix-blend-mode:soft-light;opacity:.5}.gingham{-webkit-filter:brightness(1.05) hue-rotate(-10deg);filter:brightness(1.05) hue-rotate(-10deg)}.gingham:after{background:-webkit-linear-gradient(left,rgba(66,10,14,.2),transparent);background:linear-gradient(to right,rgba(66,10,14,.2),transparent);mix-blend-mode:darken}.toaster{-webkit-filter:contrast(1.5) brightness(.9);filter:contrast(1.5) brightness(.9)}.toaster:after{background:-webkit-radial-gradient(circle,#804e0f,#3b003b);background:radial-gradient(circle,#804e0f,#3b003b);mix-blend-mode:screen}.walden{-webkit-filter:brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6);filter:brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6)}.walden:after{background:#04c;mix-blend-mode:screen;opacity:.3}.hudson{-webkit-filter:brightness(1.2) contrast(.9) saturate(1.1);filter:brightness(1.2) contrast(.9) saturate(1.1)}.hudson:after{background:-webkit-radial-gradient(circle,#a6b1ff 50%,#342134);background:radial-gradient(circle,#a6b1ff 50%,#342134);mix-blend-mode:multiply;opacity:.5}.earlybird{-webkit-filter:contrast(.9) sepia(.2);filter:contrast(.9) sepia(.2)}.earlybird:after{background:-webkit-radial-gradient(circle,#d0ba8e 20%,#360309 85%,#1d0210 100%);background:radial-gradient(circle,#d0ba8e 20%,#360309 85%,#1d0210 100%);mix-blend-mode:overlay}.mayfair{-webkit-filter:contrast(1.1) saturate(1.1);filter:contrast(1.1) saturate(1.1)}.mayfair:after{background:-webkit-radial-gradient(40% 40%,circle,rgba(255,255,255,.8),rgba(255,200,200,.6),#111 60%);background:radial-gradient(circle at 40% 40%,rgba(255,255,255,.8),rgba(255,200,200,.6),#111 60%);mix-blend-mode:overlay;opacity:.4}.lofi{-webkit-filter:saturate(1.1) contrast(1.5);filter:saturate(1.1) contrast(1.5)}.lofi:after{background:-webkit-radial-gradient(circle,transparent 70%,#222 150%);background:radial-gradient(circle,transparent 70%,#222 150%);mix-blend-mode:multiply}._1977{-webkit-filter:contrast(1.1) brightness(1.1) saturate(1.3);filter:contrast(1.1) brightness(1.1) saturate(1.3)}._1977:after{background:rgba(243,106,188,.3);mix-blend-mode:screen}.brooklyn{-webkit-filter:contrast(.9) brightness(1.1);filter:contrast(.9) brightness(1.1)}.brooklyn:after{background:-webkit-radial-gradient(circle,rgba(168,223,193,.4) 70%,#c4b7c8);background:radial-gradient(circle,rgba(168,223,193,.4) 70%,#c4b7c8);mix-blend-mode:overlay}.xpro2{-webkit-filter:sepia(.3);filter:sepia(.3)}.xpro2:after{background:-webkit-radial-gradient(circle,#E6E7E0 40%,rgba(43,42,161,.6) 110%);background:radial-gradient(circle,#E6E7E0 40%,rgba(43,42,161,.6) 110%);mix-blend-mode:color-burn}._1977:after,._1977:before,.aden:after,.aden:before,.brooklyn:after,.brooklyn:before,.earlybird:after,.earlybird:before,.gingham:after,.gingham:before,.hudson:after,.hudson:before,.inkwell:after,.inkwell:before,.lofi:after,.lofi:before,.mayfair:after,.mayfair:before,.nashville:after,.nashville:before,.perpetua:after,.perpetua:before,.reyes:after,.reyes:before,.toaster:after,.toaster:before,.walden:after,.walden:before,.xpro2:after,.xpro2:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}._1977,.aden,.brooklyn,.earlybird,.gingham,.hudson,.inkwell,.lofi,.mayfair,.nashville,.perpetua,.reyes,.toaster,.walden,.xpro2{position:relative}._1977 img,.aden img,.brooklyn img,.earlybird img,.gingham img,.hudson img,.inkwell img,.lofi img,.mayfair img,.nashville img,.perpetua img,.reyes img,.toaster img,.walden img,.xpro2 img{width:100%;z-index:1}._1977:before,.aden:before,.brooklyn:before,.earlybird:before,.gingham:before,.hudson:before,.inkwell:before,.lofi:before,.mayfair:before,.nashville:before,.perpetua:before,.reyes:before,.toaster:before,.walden:before,.xpro2:before{z-index:2}._1977:after,.aden:after,.brooklyn:after,.earlybird:after,.gingham:after,.hudson:after,.inkwell:after,.lofi:after,.mayfair:after,.nashville:after,.perpetua:after,.reyes:after,.toaster:after,.walden:after,.xpro2:after{z-index:3}.nashville{-webkit-filter:sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2);filter:sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2)}.nashville::after{background:rgba(0,70,150,.4);mix-blend-mode:lighten}.nashville::before{background:rgba(247,176,153,.56);mix-blend-mode:darken} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/demo-site.css b/node_modules/cssgram/site/css/demo-site.css deleted file mode 100644 index 5489a80..0000000 --- a/node_modules/cssgram/site/css/demo-site.css +++ /dev/null @@ -1,746 +0,0 @@ -@charset "UTF-8"; -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -/* - * - * Aden - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.aden { - -webkit-filter: hue-rotate(-20deg) contrast(.9) saturate(0.85) brightness(1.2); - filter: hue-rotate(-20deg) contrast(.9) saturate(0.85) brightness(1.2); } - .aden:after { - background: -webkit-linear-gradient(left, rgba(66, 10, 14, 0.2), transparent); - background: linear-gradient(to right, rgba(66, 10, 14, 0.2), transparent); - mix-blend-mode: darken; } - -/* - * - * Inkwell - * - */ -.inkwell { - -webkit-filter: sepia(.3) contrast(1.1) brightness(1.1) grayscale(1); - filter: sepia(.3) contrast(1.1) brightness(1.1) grayscale(1); } - -/* - * - * Perpetua - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.perpetua:after { - background: -webkit-linear-gradient(top, #005b9a, #e6c13d); - background: linear-gradient(to bottom, #005b9a, #e6c13d); - mix-blend-mode: soft-light; - opacity: .5; } - -/* - * - * Reyes - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.reyes { - -webkit-filter: sepia(.22) brightness(1.1) contrast(.85) saturate(0.75); - filter: sepia(.22) brightness(1.1) contrast(.85) saturate(0.75); } - .reyes:after { - background: #efcdad; - mix-blend-mode: soft-light; - opacity: .5; } - -/* - * - * Gingham - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.gingham { - -webkit-filter: brightness(1.05) hue-rotate(-10deg); - filter: brightness(1.05) hue-rotate(-10deg); } - .gingham:after { - background: -webkit-linear-gradient(left, rgba(66, 10, 14, 0.2), transparent); - background: linear-gradient(to right, rgba(66, 10, 14, 0.2), transparent); - mix-blend-mode: darken; } - -/* - * - * Toaster - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.toaster { - -webkit-filter: contrast(1.5) brightness(.9); - filter: contrast(1.5) brightness(.9); } - .toaster:after { - background: -webkit-radial-gradient(circle, #804e0f, #3b003b); - background: radial-gradient(circle, #804e0f, #3b003b); - mix-blend-mode: screen; } - -/* - * - * Walden - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.walden { - -webkit-filter: brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6); - filter: brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6); } - .walden:after { - background: #04c; - mix-blend-mode: screen; - opacity: .3; } - -/* - * - * Hudson - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.hudson { - -webkit-filter: brightness(1.2) contrast(.9) saturate(1.1); - filter: brightness(1.2) contrast(.9) saturate(1.1); } - .hudson:after { - background: -webkit-radial-gradient(circle, #a6b1ff 50%, #342134); - background: radial-gradient(circle, #a6b1ff 50%, #342134); - mix-blend-mode: multiply; - opacity: .5; } - -/* - * - * Earlybird - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.earlybird { - -webkit-filter: contrast(.9) sepia(.2); - filter: contrast(.9) sepia(.2); } - .earlybird:after { - background: -webkit-radial-gradient(circle, #d0ba8e 20%, #360309 85%, #1d0210 100%); - background: radial-gradient(circle, #d0ba8e 20%, #360309 85%, #1d0210 100%); - mix-blend-mode: overlay; } - -/* - * - * Mayfair - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.mayfair { - -webkit-filter: contrast(1.1) saturate(1.1); - filter: contrast(1.1) saturate(1.1); } - .mayfair:after { - background: -webkit-radial-gradient(40% 40%, circle, rgba(255, 255, 255, 0.8), rgba(255, 200, 200, 0.6), #111 60%); - background: radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.8), rgba(255, 200, 200, 0.6), #111 60%); - mix-blend-mode: overlay; - opacity: .4; } - -/* - * Lo-fi - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.lofi { - -webkit-filter: saturate(1.1) contrast(1.5); - filter: saturate(1.1) contrast(1.5); } - .lofi:after { - background: -webkit-radial-gradient(circle, transparent 70%, #222 150%); - background: radial-gradient(circle, transparent 70%, #222 150%); - mix-blend-mode: multiply; } - -/* - * 1977 - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -._1977 { - -webkit-filter: contrast(1.1) brightness(1.1) saturate(1.3); - filter: contrast(1.1) brightness(1.1) saturate(1.3); } - ._1977:after { - background: rgba(243, 106, 188, 0.3); - mix-blend-mode: screen; } - -/* - * - * Brooklyn - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.brooklyn { - -webkit-filter: contrast(.9) brightness(1.1); - filter: contrast(.9) brightness(1.1); } - .brooklyn:after { - background: -webkit-radial-gradient(circle, rgba(168, 223, 193, 0.4) 70%, #c4b7c8); - background: radial-gradient(circle, rgba(168, 223, 193, 0.4) 70%, #c4b7c8); - mix-blend-mode: overlay; } - -/* - * - * X-Pro II - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.xpro2 { - -webkit-filter: sepia(.3); - filter: sepia(.3); } - .xpro2:after { - background: -webkit-radial-gradient(circle, #E6E7E0 40%, rgba(43, 42, 161, 0.6) 110%); - background: radial-gradient(circle, #E6E7E0 40%, rgba(43, 42, 161, 0.6) 110%); - mix-blend-mode: color-burn; } - -/* - * - * Nashville - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.nashville { - -webkit-filter: sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2); - filter: sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2); } - .nashville::after { - background: rgba(0, 70, 150, 0.4); - mix-blend-mode: lighten; } - .nashville::before { - background: rgba(247, 176, 153, 0.56); - mix-blend-mode: darken; } - -::-moz-selection { - background: #9b1c9b; - color: white; } - -::selection { - background: #9b1c9b; - color: white; } - -body { - font-family: 'Open Sans', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; - margin: 0 auto; - padding: 0 2em; - max-width: 1200px; - line-height: 1.5; - font-size: 1.1em; - overflow-x: hidden; } - @media (max-width: 500px) { - body { - font-size: .9em; } } - -section { - overflow-x: hidden; } - -h1, h2 { - color: #9b1c9b; } - @media (max-width: 500px) { - h1, h2 { - text-align: center; } } - -h3, em { - color: #c63082; } - -pre, code { - background: #eff1ef; } - pre code, code code { - border: none; - background: none; } - -code { - font-family: monospace; - padding: 0; - padding: .25em .5em; } - -.highlight { - color: #c63082; - font-weight: 800; } - -.comment { - color: #abb1ad; } - -ul { - width: 100%; - margin: 0; - padding: 0; } - -ul, ol { - line-height: 1.8; } - -a { - text-decoration: none; - color: #9b1c9b; - -webkit-transition-duration: .35s; - transition-duration: .35s; - border-bottom: 1px solid #c63082; - padding-bottom: .05em; } - a:hover, a:focus { - color: #e297c0; - border-color: #e297c0; } - -figure { - max-width: 350px; - max-height: 350px; - overflow: hidden; - position: relative; - margin: 0; - padding: 0; - -webkit-transition-duration: .35s; - transition-duration: .35s; } - @media (max-width: 1240px) { - figure { - max-width: 300px; - max-height: 300px; } } - @media (max-width: 992px) { - figure { - max-width: 250px; - max-height: 250px; } } - @media (max-width: 768px) { - figure { - max-width: 300px; - max-height: 300px; } } - @media (max-width: 500px) { - figure { - max-width: 400px; - max-height: 400px; } } - figure:hover, figure:focus { - -webkit-filter: none !important; - filter: none !important; } - figure:hover::after, figure:focus::after, figure:hover::before, figure:focus::before { - opacity: 0 !important; } - -figcaption { - position: absolute; - bottom: 1em; - right: 0; - padding: .25em 1em .25em .25em; - background: #000; - color: white; - font-weight: 200; } - -hr { - clear: both; - float: none; - border: 1px solid #eff1ef; - margin: 2em auto; - display: block; } - -img { - display: block; - margin: auto; - height: auto; - max-height: 100%; - width: auto; - max-width: 100%; } - -.demo__section { - font-weight: 300; - font-size: 1.2em; } -.demo__subtitle { - font-size: 2em; - text-align: center; } -.demo__note { - font-style: italic; - text-align: center; - display: block; - margin: 2em auto 0; } -.demo__input-area { - display: block; - font-size: 1em; - text-align: center; - font-weight: 300; - margin: 1em auto; - padding: 1em 0; } - @media (max-width: 500px) { - .demo__input-area { - margin: 0; - font-size: .8em; } } -.demo__input-label { - text-align: center; - color: #9b1c9b; } -.demo__input-img { - max-width: 16em; - font-size: 1em; - padding: .5em; - border: 2px solid #9b1c9b; - outline: none; - margin: .5em; - font-weight: 200; - -webkit-transition-duration: .35s; - transition-duration: .35s; } - .demo__input-img:hover { - background: #f5e8f5; } - .demo__input-img:focus { - background: #e6c6e6; } -.demo__option-field { - color: #9b1c9b; - border: 1px solid #cad1cc; - min-width: 200px; } -.demo__option-img { - max-width: 150px; - height: 150px; - display: inline-block; - cursor: pointer; } - @media (max-width: 768px) { - .demo__option-img { - height: 100px; } } - @media (max-width: 500px) { - .demo__option-img { - height: 60px; } } -.demo__list { - width: 100%; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; - flex-wrap: wrap; } -.demo__item { - margin: .75em; - list-style: none; } - @media (max-width: 992px) { - .demo__item { - margin: .5em; } } - @media (max-width: 500px) { - .demo__item { - margin: .5em 0; } } - -.title-section { - width: 100%; - text-align: center; } -.title--logo { - max-width: 400px; } -.title--top-sub { - font-weight: 200; - margin: 0 auto; - text-align: center; - max-width: 26em; } - @media (max-width: 500px) { - .title--top-sub { - font-size: 1.2em; } } - -.how-to-section, .explanation-section { - font-size: 1.2em; - font-weight: 300; - max-width: 40em; - margin: 0 auto; - display: block; } - -.attribution { - padding: 1em 0 4em; - text-align: center; } - -.callout { - max-width: 14em; - background: #eff1ef; - padding: 2em; - margin: -.5em 2em 0; - display: block; - font-weight: 200; - float: right; } - @media (max-width: 768px) { - .callout { - max-width: 28em; - margin: 1em auto; - float: none; - font-size: .8em; } } - -.available-classes, .available-extends, .supported-browsers { - -webkit-columns: 15em 2; - -moz-columns: 15em 2; - columns: 15em 2; } - -.supported:after { - content: '✔'; - color: #62B859; - margin-left: .5em; } - -.not-supported:after { - content: '✘'; - color: #c63082; - margin-left: .5em; } diff --git a/node_modules/cssgram/site/css/demo-site.min.css b/node_modules/cssgram/site/css/demo-site.min.css deleted file mode 100644 index 9a0a6f5..0000000 --- a/node_modules/cssgram/site/css/demo-site.min.css +++ /dev/null @@ -1 +0,0 @@ -@charset "UTF-8";.aden{-webkit-filter:hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2);filter:hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2)}.aden:after{background:-webkit-linear-gradient(left,rgba(66,10,14,.2),transparent);background:linear-gradient(to right,rgba(66,10,14,.2),transparent);mix-blend-mode:darken}.inkwell{-webkit-filter:sepia(.3) contrast(1.1) brightness(1.1) grayscale(1);filter:sepia(.3) contrast(1.1) brightness(1.1) grayscale(1)}.perpetua:after{background:-webkit-linear-gradient(top,#005b9a,#e6c13d);background:linear-gradient(to bottom,#005b9a,#e6c13d);mix-blend-mode:soft-light;opacity:.5}.reyes{-webkit-filter:sepia(.22) brightness(1.1) contrast(.85) saturate(.75);filter:sepia(.22) brightness(1.1) contrast(.85) saturate(.75)}.reyes:after{background:#efcdad;mix-blend-mode:soft-light;opacity:.5}.gingham{-webkit-filter:brightness(1.05) hue-rotate(-10deg);filter:brightness(1.05) hue-rotate(-10deg)}.gingham:after{background:-webkit-linear-gradient(left,rgba(66,10,14,.2),transparent);background:linear-gradient(to right,rgba(66,10,14,.2),transparent);mix-blend-mode:darken}.toaster{-webkit-filter:contrast(1.5) brightness(.9);filter:contrast(1.5) brightness(.9)}.toaster:after{background:-webkit-radial-gradient(circle,#804e0f,#3b003b);background:radial-gradient(circle,#804e0f,#3b003b);mix-blend-mode:screen}.walden{-webkit-filter:brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6);filter:brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6)}.walden:after{background:#04c;mix-blend-mode:screen;opacity:.3}.hudson{-webkit-filter:brightness(1.2) contrast(.9) saturate(1.1);filter:brightness(1.2) contrast(.9) saturate(1.1)}.hudson:after{background:-webkit-radial-gradient(circle,#a6b1ff 50%,#342134);background:radial-gradient(circle,#a6b1ff 50%,#342134);mix-blend-mode:multiply;opacity:.5}.earlybird{-webkit-filter:contrast(.9) sepia(.2);filter:contrast(.9) sepia(.2)}.earlybird:after{background:-webkit-radial-gradient(circle,#d0ba8e 20%,#360309 85%,#1d0210 100%);background:radial-gradient(circle,#d0ba8e 20%,#360309 85%,#1d0210 100%);mix-blend-mode:overlay}.mayfair{-webkit-filter:contrast(1.1) saturate(1.1);filter:contrast(1.1) saturate(1.1)}.mayfair:after{background:-webkit-radial-gradient(40% 40%,circle,rgba(255,255,255,.8),rgba(255,200,200,.6),#111 60%);background:radial-gradient(circle at 40% 40%,rgba(255,255,255,.8),rgba(255,200,200,.6),#111 60%);mix-blend-mode:overlay;opacity:.4}.lofi{-webkit-filter:saturate(1.1) contrast(1.5);filter:saturate(1.1) contrast(1.5)}.lofi:after{background:-webkit-radial-gradient(circle,transparent 70%,#222 150%);background:radial-gradient(circle,transparent 70%,#222 150%);mix-blend-mode:multiply}._1977{-webkit-filter:contrast(1.1) brightness(1.1) saturate(1.3);filter:contrast(1.1) brightness(1.1) saturate(1.3)}._1977:after{background:rgba(243,106,188,.3);mix-blend-mode:screen}.brooklyn{-webkit-filter:contrast(.9) brightness(1.1);filter:contrast(.9) brightness(1.1)}.brooklyn:after{background:-webkit-radial-gradient(circle,rgba(168,223,193,.4) 70%,#c4b7c8);background:radial-gradient(circle,rgba(168,223,193,.4) 70%,#c4b7c8);mix-blend-mode:overlay}.xpro2{-webkit-filter:sepia(.3);filter:sepia(.3)}.xpro2:after{background:-webkit-radial-gradient(circle,#E6E7E0 40%,rgba(43,42,161,.6) 110%);background:radial-gradient(circle,#E6E7E0 40%,rgba(43,42,161,.6) 110%);mix-blend-mode:color-burn}._1977:after,._1977:before,.aden:after,.aden:before,.brooklyn:after,.brooklyn:before,.earlybird:after,.earlybird:before,.gingham:after,.gingham:before,.hudson:after,.hudson:before,.inkwell:after,.inkwell:before,.lofi:after,.lofi:before,.mayfair:after,.mayfair:before,.nashville:after,.nashville:before,.perpetua:after,.perpetua:before,.reyes:after,.reyes:before,.toaster:after,.toaster:before,.walden:after,.walden:before,.xpro2:after,.xpro2:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}._1977,.aden,.brooklyn,.earlybird,.gingham,.hudson,.inkwell,.lofi,.mayfair,.nashville,.perpetua,.reyes,.toaster,.walden,.xpro2{position:relative}._1977 img,.aden img,.brooklyn img,.earlybird img,.gingham img,.hudson img,.inkwell img,.lofi img,.mayfair img,.nashville img,.perpetua img,.reyes img,.toaster img,.walden img,.xpro2 img{width:100%;z-index:1}._1977:before,.aden:before,.brooklyn:before,.earlybird:before,.gingham:before,.hudson:before,.inkwell:before,.lofi:before,.mayfair:before,.nashville:before,.perpetua:before,.reyes:before,.toaster:before,.walden:before,.xpro2:before{z-index:2}._1977:after,.aden:after,.brooklyn:after,.earlybird:after,.gingham:after,.hudson:after,.inkwell:after,.lofi:after,.mayfair:after,.nashville:after,.perpetua:after,.reyes:after,.toaster:after,.walden:after,.xpro2:after{z-index:3}.nashville{-webkit-filter:sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2);filter:sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2)}.nashville::after{background:rgba(0,70,150,.4);mix-blend-mode:lighten}.nashville::before{background:rgba(247,176,153,.56);mix-blend-mode:darken}::-moz-selection{background:#9b1c9b;color:#fff}::selection{background:#9b1c9b;color:#fff}body{font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;margin:0 auto;padding:0 2em;max-width:1200px;line-height:1.5;font-size:1.1em;overflow-x:hidden}@media (max-width:500px){body{font-size:.9em}}section{overflow-x:hidden}h1,h2{color:#9b1c9b}@media (max-width:500px){h1,h2{text-align:center}}em,h3{color:#c63082}code,pre{background:#eff1ef}code code,pre code{border:none;background:0 0}code{font-family:monospace;padding:.25em .5em}.highlight{color:#c63082;font-weight:800}.comment{color:#abb1ad}ul{width:100%;margin:0;padding:0}ol,ul{line-height:1.8}a{text-decoration:none;color:#9b1c9b;-webkit-transition-duration:.35s;transition-duration:.35s;border-bottom:1px solid #c63082;padding-bottom:.05em}a:focus,a:hover{color:#e297c0;border-color:#e297c0}figure{max-width:350px;max-height:350px;overflow:hidden;position:relative;margin:0;padding:0;-webkit-transition-duration:.35s;transition-duration:.35s}@media (max-width:1240px){figure{max-width:300px;max-height:300px}}@media (max-width:992px){figure{max-width:250px;max-height:250px}}@media (max-width:768px){figure{max-width:300px;max-height:300px}}@media (max-width:500px){figure{max-width:400px;max-height:400px}}figure:focus,figure:hover{-webkit-filter:none!important;filter:none!important}figure:focus::after,figure:focus::before,figure:hover::after,figure:hover::before{opacity:0!important}figcaption{position:absolute;bottom:1em;right:0;padding:.25em 1em .25em .25em;background:#000;color:#fff;font-weight:200}hr{clear:both;float:none;border:1px solid #eff1ef;margin:2em auto;display:block}img{display:block;margin:auto;height:auto;max-height:100%;width:auto;max-width:100%}.demo__section{font-weight:300;font-size:1.2em}.demo__subtitle{font-size:2em;text-align:center}.demo__note{font-style:italic;text-align:center;display:block;margin:2em auto 0}.demo__input-area{display:block;font-size:1em;text-align:center;font-weight:300;margin:1em auto;padding:1em 0}@media (max-width:500px){.demo__input-area{margin:0;font-size:.8em}}.demo__input-label{text-align:center;color:#9b1c9b}.demo__input-img{max-width:16em;font-size:1em;padding:.5em;border:2px solid #9b1c9b;outline:0;margin:.5em;font-weight:200;-webkit-transition-duration:.35s;transition-duration:.35s}.demo__input-img:hover{background:#f5e8f5}.demo__input-img:focus{background:#e6c6e6}.demo__option-field{color:#9b1c9b;border:1px solid #cad1cc;min-width:200px}.demo__option-img{max-width:150px;height:150px;display:inline-block;cursor:pointer}@media (max-width:768px){.demo__option-img{height:100px}}@media (max-width:500px){.demo__option-img{height:60px}}.demo__list{width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.demo__item{margin:.75em;list-style:none}@media (max-width:992px){.demo__item{margin:.5em}}@media (max-width:500px){.demo__item{margin:.5em 0}}.title-section{width:100%;text-align:center}.title--logo{max-width:400px}.title--top-sub{font-weight:200;margin:0 auto;text-align:center;max-width:26em}@media (max-width:500px){.title--top-sub{font-size:1.2em}}.explanation-section,.how-to-section{font-size:1.2em;font-weight:300;max-width:40em;margin:0 auto;display:block}.attribution{padding:1em 0 4em;text-align:center}.callout{max-width:14em;background:#eff1ef;padding:2em;margin:-.5em 2em 0;display:block;font-weight:200;float:right}@media (max-width:768px){.callout{max-width:28em;margin:1em auto;float:none;font-size:.8em}}.available-classes,.available-extends,.supported-browsers{-webkit-columns:15em 2;-moz-columns:15em 2;columns:15em 2}.supported:after{content:'✔';color:#62B859;margin-left:.5em}.not-supported:after{content:'✘';color:#c63082;margin-left:.5em} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/earlybird.min.css b/node_modules/cssgram/site/css/earlybird.min.css deleted file mode 100644 index 3abe93a..0000000 --- a/node_modules/cssgram/site/css/earlybird.min.css +++ /dev/null @@ -1 +0,0 @@ -.earlybird:after,.earlybird:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.earlybird{position:relative}.earlybird img{width:100%;z-index:1}.earlybird:before{z-index:2}.earlybird:after{z-index:3}.earlybird{-webkit-filter:contrast(.9) sepia(.2);filter:contrast(.9) sepia(.2)}.earlybird:after{background:-webkit-radial-gradient(circle,#d0ba8e 20%,#360309 85%,#1d0210 100%);background:radial-gradient(circle,#d0ba8e 20%,#360309 85%,#1d0210 100%);mix-blend-mode:overlay} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/gingham.min.css b/node_modules/cssgram/site/css/gingham.min.css deleted file mode 100644 index 4a1572a..0000000 --- a/node_modules/cssgram/site/css/gingham.min.css +++ /dev/null @@ -1 +0,0 @@ -.gingham:after,.gingham:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.gingham{position:relative}.gingham img{width:100%;z-index:1}.gingham:before{z-index:2}.gingham:after{z-index:3}.gingham{-webkit-filter:brightness(1.05) hue-rotate(-10deg);filter:brightness(1.05) hue-rotate(-10deg)}.gingham:after{background:-webkit-linear-gradient(left,rgba(66,10,14,.2),transparent);background:linear-gradient(to right,rgba(66,10,14,.2),transparent);mix-blend-mode:darken} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/hudson.min.css b/node_modules/cssgram/site/css/hudson.min.css deleted file mode 100644 index 99dbd08..0000000 --- a/node_modules/cssgram/site/css/hudson.min.css +++ /dev/null @@ -1 +0,0 @@ -.hudson:after,.hudson:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.hudson{position:relative}.hudson img{width:100%;z-index:1}.hudson:before{z-index:2}.hudson:after{z-index:3}.hudson{-webkit-filter:brightness(1.2) contrast(.9) saturate(1.1);filter:brightness(1.2) contrast(.9) saturate(1.1)}.hudson:after{background:-webkit-radial-gradient(circle,#a6b1ff 50%,#342134);background:radial-gradient(circle,#a6b1ff 50%,#342134);mix-blend-mode:multiply;opacity:.5} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/inkwell.min.css b/node_modules/cssgram/site/css/inkwell.min.css deleted file mode 100644 index 97b3451..0000000 --- a/node_modules/cssgram/site/css/inkwell.min.css +++ /dev/null @@ -1 +0,0 @@ -.inkwell{-webkit-filter:sepia(.3) contrast(1.1) brightness(1.1) grayscale(1);filter:sepia(.3) contrast(1.1) brightness(1.1) grayscale(1)} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/lofi.min.css b/node_modules/cssgram/site/css/lofi.min.css deleted file mode 100644 index c5a3534..0000000 --- a/node_modules/cssgram/site/css/lofi.min.css +++ /dev/null @@ -1 +0,0 @@ -.lofi:after,.lofi:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.lofi{position:relative}.lofi img{width:100%;z-index:1}.lofi:before{z-index:2}.lofi:after{z-index:3}.lofi{-webkit-filter:saturate(1.1) contrast(1.5);filter:saturate(1.1) contrast(1.5)}.lofi:after{background:-webkit-radial-gradient(circle,transparent 70%,#222 150%);background:radial-gradient(circle,transparent 70%,#222 150%);mix-blend-mode:multiply} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/mayfair.min.css b/node_modules/cssgram/site/css/mayfair.min.css deleted file mode 100644 index 9d19697..0000000 --- a/node_modules/cssgram/site/css/mayfair.min.css +++ /dev/null @@ -1 +0,0 @@ -.mayfair:after,.mayfair:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.mayfair{position:relative}.mayfair img{width:100%;z-index:1}.mayfair:before{z-index:2}.mayfair:after{z-index:3}.mayfair{-webkit-filter:contrast(1.1) saturate(1.1);filter:contrast(1.1) saturate(1.1)}.mayfair:after{background:-webkit-radial-gradient(40% 40%,circle,rgba(255,255,255,.8),rgba(255,200,200,.6),#111 60%);background:radial-gradient(circle at 40% 40%,rgba(255,255,255,.8),rgba(255,200,200,.6),#111 60%);mix-blend-mode:overlay;opacity:.4} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/nashville.min.css b/node_modules/cssgram/site/css/nashville.min.css deleted file mode 100644 index 8fae499..0000000 --- a/node_modules/cssgram/site/css/nashville.min.css +++ /dev/null @@ -1 +0,0 @@ -.nashville:after,.nashville:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.nashville{position:relative}.nashville img{width:100%;z-index:1}.nashville:before{z-index:2}.nashville:after{z-index:3}.nashville{-webkit-filter:sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2);filter:sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2)}.nashville::after{background:rgba(0,70,150,.4);mix-blend-mode:lighten}.nashville::before{background:rgba(247,176,153,.56);mix-blend-mode:darken} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/perpetua.min.css b/node_modules/cssgram/site/css/perpetua.min.css deleted file mode 100644 index 8c4341b..0000000 --- a/node_modules/cssgram/site/css/perpetua.min.css +++ /dev/null @@ -1 +0,0 @@ -.perpetua:after,.perpetua:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.perpetua{position:relative}.perpetua img{width:100%;z-index:1}.perpetua:before{z-index:2}.perpetua:after{z-index:3;background:-webkit-linear-gradient(top,#005b9a,#e6c13d);background:linear-gradient(to bottom,#005b9a,#e6c13d);mix-blend-mode:soft-light;opacity:.5} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/reyes.min.css b/node_modules/cssgram/site/css/reyes.min.css deleted file mode 100644 index 8a7ad26..0000000 --- a/node_modules/cssgram/site/css/reyes.min.css +++ /dev/null @@ -1 +0,0 @@ -.reyes:after,.reyes:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.reyes{position:relative}.reyes img{width:100%;z-index:1}.reyes:before{z-index:2}.reyes:after{z-index:3}.reyes{-webkit-filter:sepia(.22) brightness(1.1) contrast(.85) saturate(.75);filter:sepia(.22) brightness(1.1) contrast(.85) saturate(.75)}.reyes:after{background:#efcdad;mix-blend-mode:soft-light;opacity:.5} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/toaster.min.css b/node_modules/cssgram/site/css/toaster.min.css deleted file mode 100644 index 9c35195..0000000 --- a/node_modules/cssgram/site/css/toaster.min.css +++ /dev/null @@ -1 +0,0 @@ -.toaster:after,.toaster:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.toaster{position:relative}.toaster img{width:100%;z-index:1}.toaster:before{z-index:2}.toaster:after{z-index:3}.toaster{-webkit-filter:contrast(1.5) brightness(.9);filter:contrast(1.5) brightness(.9)}.toaster:after{background:-webkit-radial-gradient(circle,#804e0f,#3b003b);background:radial-gradient(circle,#804e0f,#3b003b);mix-blend-mode:screen} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/walden.min.css b/node_modules/cssgram/site/css/walden.min.css deleted file mode 100644 index 0c7e769..0000000 --- a/node_modules/cssgram/site/css/walden.min.css +++ /dev/null @@ -1 +0,0 @@ -.walden:after,.walden:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.walden{position:relative}.walden img{width:100%;z-index:1}.walden:before{z-index:2}.walden:after{z-index:3}.walden{-webkit-filter:brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6);filter:brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6)}.walden:after{background:#04c;mix-blend-mode:screen;opacity:.3} \ No newline at end of file diff --git a/node_modules/cssgram/site/css/xpro2.min.css b/node_modules/cssgram/site/css/xpro2.min.css deleted file mode 100644 index ac56684..0000000 --- a/node_modules/cssgram/site/css/xpro2.min.css +++ /dev/null @@ -1 +0,0 @@ -.xpro2:after,.xpro2:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.xpro2{position:relative}.xpro2 img{width:100%;z-index:1}.xpro2:before{z-index:2}.xpro2:after{z-index:3}.xpro2{-webkit-filter:sepia(.3);filter:sepia(.3)}.xpro2:after{background:-webkit-radial-gradient(circle,#E6E7E0 40%,rgba(43,42,161,.6) 110%);background:radial-gradient(circle,#E6E7E0 40%,rgba(43,42,161,.6) 110%);mix-blend-mode:color-burn} \ No newline at end of file diff --git a/node_modules/cssgram/site/img/atx.jpg b/node_modules/cssgram/site/img/atx.jpg deleted file mode 100644 index 0c71453..0000000 Binary files a/node_modules/cssgram/site/img/atx.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/img/bike.jpg b/node_modules/cssgram/site/img/bike.jpg deleted file mode 100644 index 5c072b9..0000000 Binary files a/node_modules/cssgram/site/img/bike.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/img/cacti.jpg b/node_modules/cssgram/site/img/cacti.jpg deleted file mode 100644 index ff909fe..0000000 Binary files a/node_modules/cssgram/site/img/cacti.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/img/cssgram-logo.png b/node_modules/cssgram/site/img/cssgram-logo.png deleted file mode 100644 index a12cfdf..0000000 Binary files a/node_modules/cssgram/site/img/cssgram-logo.png and /dev/null differ diff --git a/node_modules/cssgram/site/img/cssgram-logo.svg b/node_modules/cssgram/site/img/cssgram-logo.svg deleted file mode 100644 index 9691b24..0000000 --- a/node_modules/cssgram/site/img/cssgram-logo.svg +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - CSS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/node_modules/cssgram/site/img/lakegeneva.jpg b/node_modules/cssgram/site/img/lakegeneva.jpg deleted file mode 100644 index d288621..0000000 Binary files a/node_modules/cssgram/site/img/lakegeneva.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/img/logo-temp.png b/node_modules/cssgram/site/img/logo-temp.png deleted file mode 100644 index 0064f8e..0000000 Binary files a/node_modules/cssgram/site/img/logo-temp.png and /dev/null differ diff --git a/node_modules/cssgram/site/img/tahoe.jpg b/node_modules/cssgram/site/img/tahoe.jpg deleted file mode 100644 index b75fd30..0000000 Binary files a/node_modules/cssgram/site/img/tahoe.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/index.html b/node_modules/cssgram/site/index.html deleted file mode 100644 index 3bd2118..0000000 --- a/node_modules/cssgram/site/index.html +++ /dev/null @@ -1,300 +0,0 @@ - - - - - CSSGram - - - - - - -
- -

A tiny (<1kb gzipped!) library for recreating Instagram filters with CSS filters and blend modes.

-
- - -
-
-
- Choose a sample image: - atx image - bike image - cacti image - lakegeneva image - tahoe image -
- -
- - Hovering over any of these images (or clicking on mobile) will remove the filter effect to visualize the changes. -
-
    -
  • -
    - -
    #nofilter
    -
    -
  • -
  • -
    - -
    Aden
    -
    -
  • -
  • -
    - -
    Reyes
    -
    -
  • -
  • -
    - -
    Perpetua
    -
    -
  • -
  • -
    - -
    Inkwell
    -
    -
  • -
  • -
    - -
    Earlybird
    -
    -
  • -
  • -
    - -
    Toaster
    -
    -
  • -
  • -
    - -
    Walden
    -
    -
  • -
  • -
    - -
    Hudson
    -
    -
  • -
  • -
    - -
    Gingham
    -
    -
  • -
  • -
    - -
    Mayfair
    -
    -
  • -
  • -
    - -
    Lo-fi
    -
    -
  • -
  • -
    - -
    X-Pro II
    -
    -
  • -
  • -
    - -
    1977
    -
    -
  • -
  • -
    - -
    Brooklyn
    -
    -
  • -
  • -
    - -
    Nashville
    -
    -
  • -
-
- -
-

What is This?

- -

For more background on CSS Image Effects, you can check out my blog series here, or watch my video from CSS Conf EU, which gives a baseline on blend modes and filters.

- -

Simply put, CSSgram is a library for editing your images with Instagram-like filters directly in CSS. What we're doing here is adding filters to the images as well as applying color and/or gradient overlays via various blending techniques to mimic these effects. This means less manual image processing and more fun filter effects on the web!

- -

We are using pseudo-elements (i.e. :before and :after) to create the filter effects, so you must apply these filters on a containing element (i.e. not a content-block like <img>. The recommendation is to wrap your images in a <figure> tag. More about the tag here.

- -

Browser Support

- -

This library uses CSS Filters and CSS Blend Modes. This features are supported in the following browsers:

- -
    -
  • Google Chrome: 43+
  • -
  • Mozilla Firefox: 38+
  • -
  • Internet Explorer: Nope
  • -
  • Opera: 32+
  • -
  • Safari: 8+
  • -
- -

For more information, check on Can I Use.

-
-
- -
-

Usage

- -

There are currently 2 ways to consume this library:

- -

Use CSS classes

- -

When using CSS classes, you can simply add the class with the filter name to the element containing your image.

- -

The quickest way to do this is to link to our CDN in your <head> tag: <link rel="stylesheet" href="https://cssgram-cssgram.netdna-ssl.com/cssgram.min.css">. Then, add a class to your figure element with the name of the filter you would like to use (shown below)

- -

If you want to work locally, do the following:

- -
    -
  1. Download the CSSgram Library
  2. -
  3. Link to the CSSgram library within your project:
    <link rel="stylesheet" href="css/vendor/cssgram.min.css">
  4. -
  5. Add a class to your figure element with the name of the filter you would like to use
  6. -
- -

For example:

- -

-      <!-- HTML -->
-      <figure class="aden">
-        <img src="../img.png">
-      </figure>
-    
- - Alternatively, you can just download and link to any individual css file:
<link rel="stylesheet" href="css/vendor/aden.min.css">, if you're just using one of the styles.
- -

Available Classes

- For use in HTML markup: -
    -
  • Aden: class="aden"
  • -
  • Reyes: class="reyes"
  • -
  • Perpetua: class="perpetua"
  • -
  • Inkwell: class="inkwell"
  • -
  • Toaster: class="toaster"
  • -
  • Walden: class="walden"
  • -
  • Hudson: class="hudson"
  • -
  • Gingham: class="gingham"
  • -
  • Mayfair: class="mayfair"
  • -
  • Lo-fi: class="lofi"
  • -
  • X-Pro II: class="xpro2"
  • -
  • 1977: class="_1977"
  • -
  • Brooklyn: class="brooklyn"
  • -
  • Nashville: class="nashville"
  • -
- -
- -

Use Sass @extends

- -

If you use custom naming in your CSS architecture, you can add the .scss files for the provided styles within your project and then @extend the filter effects within your style definitions. If you think extends are stupid, I will fight you 😊.

- -
    -
  1. Download the /scss folder contents
  2. -
  3. Include a link to scss/cssgram.scss via an import statement in your Sass manifest file (i.e. main.scss). It may look like: @import 'vendor/cssgram';
  4. -
  5. Extend the silent placeholder selector @extend %aden; in your element.
  6. -
- -

For example:

- -

-      <!-- HTML -->
-      <figure class="viz--beautiful">
-        <img src="../img.png">
-      </figure>
-    
- -

-      // Sass
-      .viz--beautiful {
-        @extend %aden;
-      }
-    
- - Alternatively, you can just download and link any individual .scss file in your Sass manifest:
(i.e. scss/aden.scss), if you're just using one of the styles.
- -

Available Extends

- For use in Sass elements: -
    -
  • Aden: @extend %aden;
  • -
  • Reyes: @extend %reyes;
  • -
  • Perpetua: @extend %perpetua;
  • -
  • Inkwell: @extend %inkwell;
  • -
  • Toaster: @extend %toaster;
  • -
  • Walden: @extend %walden;
  • -
  • Hudson: @extend %hudson;
  • -
  • Gingham: @extend %gingham;
  • -
  • Mayfair: @extend %mayfair;
  • -
  • Lo-fi: @extend %lofi;
  • -
  • X-Pro II: @extend %xpro2;
  • -
  • 1977: @extend %_1977;
  • -
  • Brooklyn: @extend %brooklyn;
  • -
  • Nashville: @extend %nashville;
  • -
-
-
- - - - - - diff --git a/node_modules/cssgram/site/index.twig b/node_modules/cssgram/site/index.twig deleted file mode 100644 index 24a826f..0000000 --- a/node_modules/cssgram/site/index.twig +++ /dev/null @@ -1,299 +0,0 @@ - - - - - CSSGram - - - - - - -
- -

A tiny (<1kb gzipped!) library for recreating Instagram filters with CSS filters and blend modes.

-
- - {% set images = ['atx', 'bike', 'cacti', 'lakegeneva', 'tahoe'] %} - -
-
-
- Choose a sample image: - {% for i in images %} - {{i}} image - {% endfor %} -
- -
- - Hovering over any of these images (or clicking on mobile) will remove the filter effect to visualize the changes. -
-
    -
  • -
    - -
    #nofilter
    -
    -
  • -
  • -
    - -
    Aden
    -
    -
  • -
  • -
    - -
    Reyes
    -
    -
  • -
  • -
    - -
    Perpetua
    -
    -
  • -
  • -
    - -
    Inkwell
    -
    -
  • -
  • -
    - -
    Earlybird
    -
    -
  • -
  • -
    - -
    Toaster
    -
    -
  • -
  • -
    - -
    Walden
    -
    -
  • -
  • -
    - -
    Hudson
    -
    -
  • -
  • -
    - -
    Gingham
    -
    -
  • -
  • -
    - -
    Mayfair
    -
    -
  • -
  • -
    - -
    Lo-fi
    -
    -
  • -
  • -
    - -
    X-Pro II
    -
    -
  • -
  • -
    - -
    1977
    -
    -
  • -
  • -
    - -
    Brooklyn
    -
    -
  • -
  • -
    - -
    Nashville
    -
    -
  • -
-
- -
-

What is This?

- -

For more background on CSS Image Effects, you can check out my blog series here, or watch my video from CSS Conf EU, which gives a baseline on blend modes and filters.

- -

Simply put, CSSgram is a library for editing your images with Instagram-like filters directly in CSS. What we're doing here is adding filters to the images as well as applying color and/or gradient overlays via various blending techniques to mimic these effects. This means less manual image processing and more fun filter effects on the web!

- -

We are using pseudo-elements (i.e. :before and :after) to create the filter effects, so you must apply these filters on a containing element (i.e. not a content-block like <img>. The recommendation is to wrap your images in a <figure> tag. More about the tag here.

- -

Browser Support

- -

This library uses CSS Filters and CSS Blend Modes. This features are supported in the following browsers:

- -
    -
  • Google Chrome: 43+
  • -
  • Mozilla Firefox: 38+
  • -
  • Internet Explorer: Nope
  • -
  • Opera: 32+
  • -
  • Safari: 8+
  • -
- -

For more information, check on Can I Use.

-
-
- -
-

Usage

- -

There are currently 2 ways to consume this library:

- -

Use CSS classes

- -

When using CSS classes, you can simply add the class with the filter name to the element containing your image.

- -

The quickest way to do this is to link to our CDN in your <head> tag: <link rel="stylesheet" href="https://cssgram-cssgram.netdna-ssl.com/cssgram.min.css">. Then, add a class to your figure element with the name of the filter you would like to use (shown below)

- -

If you want to work locally, do the following:

- -
    -
  1. Download the CSSgram Library
  2. -
  3. Link to the CSSgram library within your project:
    <link rel="stylesheet" href="css/vendor/cssgram.min.css">
  4. -
  5. Add a class to your figure element with the name of the filter you would like to use
  6. -
- -

For example:

- -

-      <!-- HTML -->
-      <figure class="aden">
-        <img src="../img.png">
-      </figure>
-    
- - Alternatively, you can just download and link to any individual css file:
<link rel="stylesheet" href="css/vendor/aden.min.css">, if you're just using one of the styles.
- -

Available Classes

- For use in HTML markup: -
    -
  • Aden: class="aden"
  • -
  • Reyes: class="reyes"
  • -
  • Perpetua: class="perpetua"
  • -
  • Inkwell: class="inkwell"
  • -
  • Toaster: class="toaster"
  • -
  • Walden: class="walden"
  • -
  • Hudson: class="hudson"
  • -
  • Gingham: class="gingham"
  • -
  • Mayfair: class="mayfair"
  • -
  • Lo-fi: class="lofi"
  • -
  • X-Pro II: class="xpro2"
  • -
  • 1977: class="_1977"
  • -
  • Brooklyn: class="brooklyn"
  • -
  • Nashville: class="nashville"
  • -
- -
- -

Use Sass @extends

- -

If you use custom naming in your CSS architecture, you can add the .scss files for the provided styles within your project and then @extend the filter effects within your style definitions. If you think extends are stupid, I will fight you 😊.

- -
    -
  1. Download the /scss folder contents
  2. -
  3. Include a link to scss/cssgram.scss via an import statement in your Sass manifest file (i.e. main.scss). It may look like: @import 'vendor/cssgram';
  4. -
  5. Extend the silent placeholder selector @extend %aden; in your element.
  6. -
- -

For example:

- -

-      <!-- HTML -->
-      <figure class="viz--beautiful">
-        <img src="../img.png">
-      </figure>
-    
- -

-      // Sass
-      .viz--beautiful {
-        @extend %aden;
-      }
-    
- - Alternatively, you can just download and link any individual .scss file in your Sass manifest:
(i.e. scss/aden.scss), if you're just using one of the styles.
- -

Available Extends

- For use in Sass elements: -
    -
  • Aden: @extend %aden;
  • -
  • Reyes: @extend %reyes;
  • -
  • Perpetua: @extend %perpetua;
  • -
  • Inkwell: @extend %inkwell;
  • -
  • Toaster: @extend %toaster;
  • -
  • Walden: @extend %walden;
  • -
  • Hudson: @extend %hudson;
  • -
  • Gingham: @extend %gingham;
  • -
  • Mayfair: @extend %mayfair;
  • -
  • Lo-fi: @extend %lofi;
  • -
  • X-Pro II: @extend %xpro2;
  • -
  • 1977: @extend %_1977;
  • -
  • Brooklyn: @extend %brooklyn;
  • -
  • Nashville: @extend %nashville;
  • -
-
-
- - - - - - diff --git a/node_modules/cssgram/site/scss/_home.scss b/node_modules/cssgram/site/scss/_home.scss deleted file mode 100644 index 7df0077..0000000 --- a/node_modules/cssgram/site/scss/_home.scss +++ /dev/null @@ -1,329 +0,0 @@ -&::selection { - background: $accent; - color: white; -} - -body { - font-family: 'Open Sans', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; - margin: 0 auto; - padding: 0 2em; - max-width: 1200px; - line-height: 1.5; - font-size: 1.1em; - overflow-x: hidden; - - @include breakpoint(xs) { - font-size: .9em; - } -} - -section { - overflow-x: hidden; -} - -h1, -h2 { - color: $accent; - - @include breakpoint(xs) { - text-align: center; - } -} - -h3, -em { - color: $secondary; -} - -pre, code { - background: $lightergrey; - - code { - border: none; - background: none; - } -} - -code { - font-family: monospace; - padding: 0; - padding: .25em .5em; -} - -.highlight { - color: $secondary; - font-weight: 800; -} - -.comment { - color: $midgrey; -} - -ul { - width: 100%; - margin: 0; - padding: 0; -} - -ul, -ol { - line-height: 1.8; -} - -a { - text-decoration: none; - color: $accent; - transition-duration: .35s; - border-bottom: 1px solid $secondary; - padding-bottom: .05em; - - &:hover, - &:focus { - color: mix(white, $secondary, 50%); - border-color: mix(white, $secondary, 50%); - } -} - -figure { - max-width: 350px; - max-height: 350px; - overflow: hidden; - position: relative; - margin: 0; - padding: 0; - transition-duration: .35s; - - @include breakpoint(lg) { - max-width: 300px; - max-height: 300px; - } - - @include breakpoint(md) { - max-width: 250px; - max-height: 250px; - } - - @include breakpoint(sm) { - max-width: 300px; - max-height: 300px; - } - - @include breakpoint(xs) { - max-width: 400px; - max-height: 400px; - } - - &:hover, - &:focus { - filter: none !important; - } - - &:hover::after, - &:focus::after, - &:hover::before, - &:focus::before { - opacity: 0 !important; - } -} - -figcaption { - position: absolute; - bottom: 1em; - right: 0; - padding: .25em 1em .25em .25em; - background: $black; - color: white; - font-weight: 200; -} - -hr { - clear: both; - float: none; - border: 1px solid $lightergrey; - margin: 2em auto; - display: block; -} - -img { - display: block; - margin: auto; - - height: auto; - max-height: 100%; - - width: auto; - max-width: 100%; -} - -.demo { - &__section { - font-weight: 300; - font-size: 1.2em; - } - - &__subtitle { - font-size: 2em; - text-align: center; - } - - &__note { - font-style: italic; - text-align: center; - display: block; - margin: 2em auto 0; - } - - &__input-area { - display: block; - font-size: 1em; - text-align: center; - font-weight: 300; - margin: 1em auto; - padding: 1em 0; - - @include breakpoint(xs) { - margin: 0; - font-size: .8em; - } - } - - &__input-label { - text-align: center; - color: $accent; - } - - &__input-img { - max-width: 16em; - font-size: 1em; - padding: .5em; - border: 2px solid $accent; - outline: none; - margin: .5em; - font-weight: 200; - transition-duration: .35s; - - &:hover { - background: mix(white, $accent, 90%); - } - - &:focus { - background: mix(white, $accent, 75%); - } - } - - &__option-field { - color: $accent; - border: 1px solid $lightgrey; - min-width: 200px; - } - - &__option-img { - max-width: 150px; - height: 150px; - display: inline-block; - cursor: pointer; - - @include breakpoint(sm) { - height: 100px; - } - - @include breakpoint(xs) { - height: 60px; - } - } - - &__list { - width: 100%; - display: flex; - justify-content: center; - flex-wrap: wrap; - } - - &__item { - margin: .75em; - list-style: none; - - @include breakpoint(md) { - margin: .5em; - } - - @include breakpoint(xs) { - margin: .5em 0; - } - } -} - -.title { - &-section { - width: 100%; - text-align: center; - } - - &--logo { - max-width: 400px; - } - - &--top-sub { - font-weight: 200; - margin: 0 auto; - text-align: center; - max-width: 26em; - - @include breakpoint(xs) { - font-size: 1.2em; - } - } -} - -.how-to-section, -.explanation-section { - font-size: 1.2em; - font-weight: 300; - max-width: 40em; - margin: 0 auto; - display: block; -} - -.attribution { - padding: 1em 0 4em; - text-align: center; -} - -.callout { - max-width: 14em; - background: $lightergrey; - padding: 2em; - margin: -.5em 2em 0; - display: block; - font-weight: 200; - float: right; - - @include breakpoint(sm) { - max-width: 28em; - margin: 1em auto; - float: none; - font-size: .8em; - } -} - -.available-classes, -.available-extends, -.supported-browsers { - columns: 15em 2; -} - -.supported { - &:after { - content: '✔'; - color: $green; - margin-left: .5em; - } -} - -.not-supported { - &:after { - content: '✘'; - color: $maroon; - margin-left: .5em; - } -} diff --git a/node_modules/cssgram/site/scss/_mixins.scss b/node_modules/cssgram/site/scss/_mixins.scss deleted file mode 100644 index 5c29c64..0000000 --- a/node_modules/cssgram/site/scss/_mixins.scss +++ /dev/null @@ -1,23 +0,0 @@ -// Grid Mixin - -@mixin breakpoint($class) { - @if $class == xs { - @media (max-width: 500px) { @content; } - } - - @else if $class == sm { - @media (max-width: 768px) { @content; } - } - - @else if $class == md { - @media (max-width: 992px) { @content; } - } - - @else if $class == lg { - @media (max-width: 1240px) { @content; } - } - - @else { - @warn "Breakpoint mixin supports: xs, sm, md, lg"; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/site/scss/_vars.scss b/node_modules/cssgram/site/scss/_vars.scss deleted file mode 100644 index 2adffbb..0000000 --- a/node_modules/cssgram/site/scss/_vars.scss +++ /dev/null @@ -1,11 +0,0 @@ -$dusky-blue: #649CA7; -$maroon: #c63082; -$purple: #9b1c9b; -$lightgrey: #cad1cc; -$black: #000; -$green: #62B859; -$midgrey: mix($black, $lightgrey, 15%); -$lightergrey: mix(white, $lightgrey, 70%); - -$accent: $purple; -$secondary: $maroon; \ No newline at end of file diff --git a/node_modules/cssgram/site/scss/demo-site.scss b/node_modules/cssgram/site/scss/demo-site.scss deleted file mode 100644 index cbf5dcf..0000000 --- a/node_modules/cssgram/site/scss/demo-site.scss +++ /dev/null @@ -1,4 +0,0 @@ -@import 'source/scss/cssgram'; -@import 'vars'; -@import 'mixins'; -@import 'home'; \ No newline at end of file diff --git a/node_modules/cssgram/site/test/css/test-site.css b/node_modules/cssgram/site/test/css/test-site.css deleted file mode 100644 index 50aab46..0000000 --- a/node_modules/cssgram/site/test/css/test-site.css +++ /dev/null @@ -1,64 +0,0 @@ -.test-page { - max-width: 650px; - line-height: 1.5; - font-size: 1.1em; - text-align: center; -} - -.test-page a { - border-bottom: none; -} - -.test-page .logo { - display: block; - float: left; - height: 100px; - width: auto; -} - -.test-page .blurb { - display: block; - float: left; - -} - -.test-page section { - display: block; - margin-bottom: 10px; - overflow: hidden; - width: 100%; -} - -.filter-header a { - color: #9b1c9b; - text-decoration: none; -} - -.filter-header .done.done--yep{ - color: #62B859; -} - -.filter-header .done.done--nope{ - color: #c63082; -} - -.headers h3{ - float: left; - width: 50%; -} - -.test-images>div { - float: left; - width: 50%; -} - -.test-images figure { - margin: 10px; - padding: 0; -} - -.test-images img { - display: block; - height: auto; - width: 100%; -} diff --git a/node_modules/cssgram/site/test/index.html b/node_modules/cssgram/site/test/index.html deleted file mode 100644 index eead659..0000000 --- a/node_modules/cssgram/site/test/index.html +++ /dev/null @@ -1,2116 +0,0 @@ - - - - - - - - - - CSSgram test sheet - - - - - - - -
-

– Test sheet

-
- -
-

Aden

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of aden -
-
- - -
-
- CSSgram version of aden
-
-
- - -
- - -
-
- Instagram version of aden -
-
- - -
-
- CSSgram version of aden
- -
- - -
- - -
-
- Instagram version of aden -
-
- - -
-
- CSSgram version of aden
- - - -
-
- - -
-
- Instagram version of aden -
-
- - -
-
- CSSgram version of aden
- - - -
-
- - -
-
- Instagram version of aden -
-
- - -
-
- CSSgram version of aden
- - - -
- - -
-

Amaro

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of amaro -
-
- - -
-
- CSSgram version of amaro
- - - -
-
- - -
-
- Instagram version of amaro -
-
- - -
-
- CSSgram version of amaro
- - - -
-
- - -
-
- Instagram version of amaro -
-
- - -
-
- CSSgram version of amaro
- - - -
-
- - -
-
- Instagram version of amaro -
-
- - -
-
- CSSgram version of amaro
- - - -
-
- - -
-
- Instagram version of amaro -
-
- - -
-
- CSSgram version of amaro
- - - -
- -
-
-

Brannan

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of brannan -
-
- - -
-
- CSSgram version of brannan
- - - -
-
- - -
-
- Instagram version of brannan -
-
- - -
-
- CSSgram version of brannan
- - - -
-
- - -
-
- Instagram version of brannan -
-
- - -
-
- CSSgram version of brannan
- - - -
-
- - -
-
- Instagram version of brannan -
-
- - -
-
- CSSgram version of brannan
- - - -
-
- - -
-
- Instagram version of brannan -
-
- - -
-
- CSSgram version of brannan
- - - -
- -
-
-

Crema

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of crema -
-
- - -
-
- CSSgram version of crema
- - - -
-
- - -
-
- Instagram version of crema -
-
- - -
-
- CSSgram version of crema
- - - -
-
- - -
-
- Instagram version of crema -
-
- - -
-
- CSSgram version of crema
- - - -
-
- - -
-
- Instagram version of crema -
-
- - -
-
- CSSgram version of crema
- - - -
-
- - -
-
- Instagram version of crema -
-
- - -
-
- CSSgram version of crema
- - - -
- -
-
-

Earlybird

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of earlybird -
-
- - -
-
- CSSgram version of earlybird
- - - -
-
- - -
-
- Instagram version of earlybird -
-
- - -
-
- CSSgram version of earlybird
- - - -
-
- - -
-
- Instagram version of earlybird -
-
- - -
-
- CSSgram version of earlybird
- - - -
-
- - -
-
- Instagram version of earlybird -
-
- - -
-
- CSSgram version of earlybird
- - - -
-
- - -
-
- Instagram version of earlybird -
-
- - -
-
- CSSgram version of earlybird
- - - -
- -
-
-

Hefe

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of hefe -
-
- - -
-
- CSSgram version of hefe
- - - -
-
- - -
-
- Instagram version of hefe -
-
- - -
-
- CSSgram version of hefe
- - - -
-
- - -
-
- Instagram version of hefe -
-
- - -
-
- CSSgram version of hefe
- - - -
-
- - -
-
- Instagram version of hefe -
-
- - -
-
- CSSgram version of hefe
- - - -
-
- - -
-
- Instagram version of hefe -
-
- - -
-
- CSSgram version of hefe
- - - -
- -
-
-

Hudson

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of hudson -
-
- - -
-
- CSSgram version of hudson
- - - -
-
- - -
-
- Instagram version of hudson -
-
- - -
-
- CSSgram version of hudson
- - - -
-
- - -
-
- Instagram version of hudson -
-
- - -
-
- CSSgram version of hudson
- - - -
-
- - -
-
- Instagram version of hudson -
-
- - -
-
- CSSgram version of hudson
- - - -
-
- - -
-
- Instagram version of hudson -
-
- - -
-
- CSSgram version of hudson
- - - -
- -
-
-

Inkwell

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of inkwell -
-
- - -
-
- CSSgram version of inkwell
- - - -
-
- - -
-
- Instagram version of inkwell -
-
- - -
-
- CSSgram version of inkwell
- - - -
-
- - -
-
- Instagram version of inkwell -
-
- - -
-
- CSSgram version of inkwell
- - - -
-
- - -
-
- Instagram version of inkwell -
-
- - -
-
- CSSgram version of inkwell
- - - -
-
- - -
-
- Instagram version of inkwell -
-
- - -
-
- CSSgram version of inkwell
- - - -
- -
-
-

Juno

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of juno -
-
- - -
-
- CSSgram version of juno
- - - -
-
- - -
-
- Instagram version of juno -
-
- - -
-
- CSSgram version of juno
- - - -
-
- - -
-
- Instagram version of juno -
-
- - -
-
- CSSgram version of juno
- - - -
-
- - -
-
- Instagram version of juno -
-
- - -
-
- CSSgram version of juno
- - - -
-
- - -
-
- Instagram version of juno -
-
- - -
-
- CSSgram version of juno
- - - -
- -
-
-

Lark

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of lark -
-
- - -
-
- CSSgram version of lark
- - - -
-
- - -
-
- Instagram version of lark -
-
- - -
-
- CSSgram version of lark
- - - -
-
- - -
-
- Instagram version of lark -
-
- - -
-
- CSSgram version of lark
- - - -
-
- - -
-
- Instagram version of lark -
-
- - -
-
- CSSgram version of lark
- - - -
-
- - -
-
- Instagram version of lark -
-
- - -
-
- CSSgram version of lark
- - - -
- -
-
-

Lofi

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of lofi -
-
- - -
-
- CSSgram version of lofi
- - - -
-
- - -
-
- Instagram version of lofi -
-
- - -
-
- CSSgram version of lofi
- - - -
-
- - -
-
- Instagram version of lofi -
-
- - -
-
- CSSgram version of lofi
- - - -
-
- - -
-
- Instagram version of lofi -
-
- - -
-
- CSSgram version of lofi
- - - -
-
- - -
-
- Instagram version of lofi -
-
- - -
-
- CSSgram version of lofi
- - - -
- -
-
-

Ludwig

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of ludwig -
-
- - -
-
- CSSgram version of ludwig
- - - -
-
- - -
-
- Instagram version of ludwig -
-
- - -
-
- CSSgram version of ludwig
- - - -
-
- - -
-
- Instagram version of ludwig -
-
- - -
-
- CSSgram version of ludwig
- - - -
-
- - -
-
- Instagram version of ludwig -
-
- - -
-
- CSSgram version of ludwig
- - - -
-
- - -
-
- Instagram version of ludwig -
-
- - -
-
- CSSgram version of ludwig
- - - -
- -
-
-

Mayfair

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of mayfair -
-
- - -
-
- CSSgram version of mayfair
- - - -
-
- - -
-
- Instagram version of mayfair -
-
- - -
-
- CSSgram version of mayfair
- - - -
-
- - -
-
- Instagram version of mayfair -
-
- - -
-
- CSSgram version of mayfair
- - - -
-
- - -
-
- Instagram version of mayfair -
-
- - -
-
- CSSgram version of mayfair
- - - -
-
- - -
-
- Instagram version of mayfair -
-
- - -
-
- CSSgram version of mayfair
- - - -
- -
-
-

Nashville

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of nashville -
-
- - -
-
- CSSgram version of nashville
- - - -
-
- - -
-
- Instagram version of nashville -
-
- - -
-
- CSSgram version of nashville
- - - -
-
- - -
-
- Instagram version of nashville -
-
- - -
-
- CSSgram version of nashville
- - - -
-
- - -
-
- Instagram version of nashville -
-
- - -
-
- CSSgram version of nashville
- - - -
-
- - -
-
- Instagram version of nashville -
-
- - -
-
- CSSgram version of nashville
- - - -
- -
-
-

Perpetua

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of perpetua -
-
- - -
-
- CSSgram version of perpetua
- - - -
-
- - -
-
- Instagram version of perpetua -
-
- - -
-
- CSSgram version of perpetua
- - - -
-
- - -
-
- Instagram version of perpetua -
-
- - -
-
- CSSgram version of perpetua
- - - -
-
- - -
-
- Instagram version of perpetua -
-
- - -
-
- CSSgram version of perpetua
- - - -
-
- - -
-
- Instagram version of perpetua -
-
- - -
-
- CSSgram version of perpetua
- - - -
- -
-
-

Reyes

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of reyes -
-
- - -
-
- CSSgram version of reyes
- - - -
-
- - -
-
- Instagram version of reyes -
-
- - -
-
- CSSgram version of reyes
- - - -
-
- - -
-
- Instagram version of reyes -
-
- - -
-
- CSSgram version of reyes
- - - -
-
- - -
-
- Instagram version of reyes -
-
- - -
-
- CSSgram version of reyes
- - - -
-
- - -
-
- Instagram version of reyes -
-
- - -
-
- CSSgram version of reyes
- - - -
- -
-
-

Rise

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of rise -
-
- - -
-
- CSSgram version of rise
- - - -
-
- - -
-
- Instagram version of rise -
-
- - -
-
- CSSgram version of rise
- - - -
-
- - -
-
- Instagram version of rise -
-
- - -
-
- CSSgram version of rise
- - - -
-
- - -
-
- Instagram version of rise -
-
- - -
-
- CSSgram version of rise
- - - -
-
- - -
-
- Instagram version of rise -
-
- - -
-
- CSSgram version of rise
- - - -
- -
-
-

Sierra

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of sierra -
-
- - -
-
- CSSgram version of sierra
- - - -
-
- - -
-
- Instagram version of sierra -
-
- - -
-
- CSSgram version of sierra
- - - -
-
- - -
-
- Instagram version of sierra -
-
- - -
-
- CSSgram version of sierra
- - - -
-
- - -
-
- Instagram version of sierra -
-
- - -
-
- CSSgram version of sierra
- - - -
-
- - -
-
- Instagram version of sierra -
-
- - -
-
- CSSgram version of sierra
- - - -
- -
-
-

Slumber

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of slumber -
-
- - -
-
- CSSgram version of slumber
- - - -
-
- - -
-
- Instagram version of slumber -
-
- - -
-
- CSSgram version of slumber
- - - -
-
- - -
-
- Instagram version of slumber -
-
- - -
-
- CSSgram version of slumber
- - - -
-
- - -
-
- Instagram version of slumber -
-
- - -
-
- CSSgram version of slumber
- - - -
-
- - -
-
- Instagram version of slumber -
-
- - -
-
- CSSgram version of slumber
- - - -
- -
-
-

Valencia

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of valencia -
-
- - -
-
- CSSgram version of valencia
- - - -
-
- - -
-
- Instagram version of valencia -
-
- - -
-
- CSSgram version of valencia
- - - -
-
- - -
-
- Instagram version of valencia -
-
- - -
-
- CSSgram version of valencia
- - - -
-
- - -
-
- Instagram version of valencia -
-
- - -
-
- CSSgram version of valencia
- - - -
-
- - -
-
- Instagram version of valencia -
-
- - -
-
- CSSgram version of valencia
- - - -
- -
-
-

Willow

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of willow -
-
- - -
-
- CSSgram version of willow
- - - -
-
- - -
-
- Instagram version of willow -
-
- - -
-
- CSSgram version of willow
- - - -
-
- - -
-
- Instagram version of willow -
-
- - -
-
- CSSgram version of willow
- - - -
-
- - -
-
- Instagram version of willow -
-
- - -
-
- CSSgram version of willow
- - - -
-
- - -
-
- Instagram version of willow -
-
- - -
-
- CSSgram version of willow
- - - -
- -
-
-

Xpro2

- -
-

Instagram

-

CSSgram

-
- -
- - -
-
- Instagram version of xpro2 -
-
- - -
-
- CSSgram version of xpro2
- - - -
-
- - -
-
- Instagram version of xpro2 -
-
- - -
-
- CSSgram version of xpro2
- - - -
-
- - -
-
- Instagram version of xpro2 -
-
- - -
-
- CSSgram version of xpro2
- - - -
-
- - -
-
- Instagram version of xpro2 -
-
- - -
-
- CSSgram version of xpro2
- - - -
-
- - -
-
- Instagram version of xpro2 -
-
- - -
-
- CSSgram version of xpro2
- - - -
- -
- - - - - diff --git a/node_modules/cssgram/site/test/index.twig b/node_modules/cssgram/site/test/index.twig deleted file mode 100644 index c75dee1..0000000 --- a/node_modules/cssgram/site/test/index.twig +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - CSSgram test sheet - - - - - - {% set filters = [ - {name: 'aden', is_done: true}, - {name: 'amaro', is_done: false}, - {name: 'brannan', is_done: false}, - {name: 'crema', is_done: false}, - {name: 'earlybird', is_done: true}, - {name: 'hefe', is_done: false}, - {name: 'hudson', is_done: true}, - {name: 'inkwell', is_done: true}, - {name: 'juno', is_done: false}, - {name: 'lark', is_done: false}, - {name: 'lofi', is_done: true}, - {name: 'ludwig', is_done: false}, - {name: 'mayfair', is_done: true}, - {name: 'nashville', is_done: true}, - {name: 'perpetua', is_done: true}, - {name: 'reyes', is_done: true}, - {name: 'rise', is_done: false}, - {name: 'sierra', is_done: false}, - {name: 'slumber', is_done: false}, - {name: 'valencia', is_done: false}, - {name: 'willow', is_done: false}, - {name: 'xpro2', is_done: true}, - ] %} - - {% set images = ['atx', 'bike', 'cacti', 'lakegeneva', 'tahoe'] %} - -
-

– Test sheet

-
- - {% for f in filters %} -
-

{{f.name|title}} {{f.is_done ? '✓' : '✗'}}

- -
-

Instagram

-

CSSgram

-
- - {% for i in images %} -
- - {# ig #} -
-
- Instagram version of {{f.name}} -
-
- - {# cssgram #} -
-
- CSSgram version of {{f.name}}
- - - -
- {% endfor %} - -
- {% endfor %} - - - - - diff --git a/node_modules/cssgram/site/test/ref/atx-aden.jpg b/node_modules/cssgram/site/test/ref/atx-aden.jpg deleted file mode 100644 index 18ea48b..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-aden.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-amaro.jpg b/node_modules/cssgram/site/test/ref/atx-amaro.jpg deleted file mode 100644 index 60ddc4f..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-amaro.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-brannan.jpg b/node_modules/cssgram/site/test/ref/atx-brannan.jpg deleted file mode 100644 index efce4e9..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-brannan.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-crema.jpg b/node_modules/cssgram/site/test/ref/atx-crema.jpg deleted file mode 100644 index b4ac3ce..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-crema.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-earlybird.jpg b/node_modules/cssgram/site/test/ref/atx-earlybird.jpg deleted file mode 100644 index d3f4d55..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-earlybird.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-hefe.jpg b/node_modules/cssgram/site/test/ref/atx-hefe.jpg deleted file mode 100644 index b617306..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-hefe.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-hudson.jpg b/node_modules/cssgram/site/test/ref/atx-hudson.jpg deleted file mode 100644 index df98096..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-hudson.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-inkwell.jpg b/node_modules/cssgram/site/test/ref/atx-inkwell.jpg deleted file mode 100644 index 1169939..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-inkwell.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-juno.jpg b/node_modules/cssgram/site/test/ref/atx-juno.jpg deleted file mode 100644 index 81082f9..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-juno.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-lark.jpg b/node_modules/cssgram/site/test/ref/atx-lark.jpg deleted file mode 100644 index bf4678a..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-lark.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-lofi.jpg b/node_modules/cssgram/site/test/ref/atx-lofi.jpg deleted file mode 100644 index f2324c2..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-lofi.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-ludwig.jpg b/node_modules/cssgram/site/test/ref/atx-ludwig.jpg deleted file mode 100644 index 6027f1c..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-ludwig.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-mayfair.jpg b/node_modules/cssgram/site/test/ref/atx-mayfair.jpg deleted file mode 100644 index dd964e0..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-mayfair.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-nashville.jpg b/node_modules/cssgram/site/test/ref/atx-nashville.jpg deleted file mode 100644 index 6351e81..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-nashville.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-perpetua.jpg b/node_modules/cssgram/site/test/ref/atx-perpetua.jpg deleted file mode 100644 index 15aa12b..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-perpetua.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-reyes.jpg b/node_modules/cssgram/site/test/ref/atx-reyes.jpg deleted file mode 100644 index 7b30f50..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-reyes.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-rise.jpg b/node_modules/cssgram/site/test/ref/atx-rise.jpg deleted file mode 100644 index 3e151a5..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-rise.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-sierra.jpg b/node_modules/cssgram/site/test/ref/atx-sierra.jpg deleted file mode 100644 index ab99565..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-sierra.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-slumber.jpg b/node_modules/cssgram/site/test/ref/atx-slumber.jpg deleted file mode 100644 index 5050c24..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-slumber.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-valencia.jpg b/node_modules/cssgram/site/test/ref/atx-valencia.jpg deleted file mode 100644 index 03a90c0..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-valencia.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-willow.jpg b/node_modules/cssgram/site/test/ref/atx-willow.jpg deleted file mode 100644 index cad12b5..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-willow.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/atx-xpro2.jpg b/node_modules/cssgram/site/test/ref/atx-xpro2.jpg deleted file mode 100644 index 76e226d..0000000 Binary files a/node_modules/cssgram/site/test/ref/atx-xpro2.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-aden.jpg b/node_modules/cssgram/site/test/ref/bike-aden.jpg deleted file mode 100644 index 5f50ab9..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-aden.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-amaro.jpg b/node_modules/cssgram/site/test/ref/bike-amaro.jpg deleted file mode 100644 index 96bdf95..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-amaro.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-brannan.jpg b/node_modules/cssgram/site/test/ref/bike-brannan.jpg deleted file mode 100644 index 5cabe9b..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-brannan.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-crema.jpg b/node_modules/cssgram/site/test/ref/bike-crema.jpg deleted file mode 100644 index e3e46ca..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-crema.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-earlybird.jpg b/node_modules/cssgram/site/test/ref/bike-earlybird.jpg deleted file mode 100644 index 7e4fb83..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-earlybird.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-hefe.jpg b/node_modules/cssgram/site/test/ref/bike-hefe.jpg deleted file mode 100644 index 60de273..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-hefe.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-hudson.jpg b/node_modules/cssgram/site/test/ref/bike-hudson.jpg deleted file mode 100644 index 4563b2d..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-hudson.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-inkwell.jpg b/node_modules/cssgram/site/test/ref/bike-inkwell.jpg deleted file mode 100644 index f6776d2..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-inkwell.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-juno.jpg b/node_modules/cssgram/site/test/ref/bike-juno.jpg deleted file mode 100644 index 9797f09..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-juno.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-lark.jpg b/node_modules/cssgram/site/test/ref/bike-lark.jpg deleted file mode 100644 index 936a7eb..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-lark.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-lofi.jpg b/node_modules/cssgram/site/test/ref/bike-lofi.jpg deleted file mode 100644 index ee66548..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-lofi.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-ludwig.jpg b/node_modules/cssgram/site/test/ref/bike-ludwig.jpg deleted file mode 100644 index ecc43c7..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-ludwig.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-mayfair.jpg b/node_modules/cssgram/site/test/ref/bike-mayfair.jpg deleted file mode 100644 index f0cc45c..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-mayfair.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-nashville.jpg b/node_modules/cssgram/site/test/ref/bike-nashville.jpg deleted file mode 100644 index 4ed6606..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-nashville.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-perpetua.jpg b/node_modules/cssgram/site/test/ref/bike-perpetua.jpg deleted file mode 100644 index c52abd2..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-perpetua.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-reyes.jpg b/node_modules/cssgram/site/test/ref/bike-reyes.jpg deleted file mode 100644 index 03a6e45..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-reyes.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-rise.jpg b/node_modules/cssgram/site/test/ref/bike-rise.jpg deleted file mode 100644 index 5794ead..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-rise.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-sierra.jpg b/node_modules/cssgram/site/test/ref/bike-sierra.jpg deleted file mode 100644 index a62f9cb..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-sierra.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-slumber.jpg b/node_modules/cssgram/site/test/ref/bike-slumber.jpg deleted file mode 100644 index bc84f5b..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-slumber.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-valencia.jpg b/node_modules/cssgram/site/test/ref/bike-valencia.jpg deleted file mode 100644 index 89f3757..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-valencia.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-willow.jpg b/node_modules/cssgram/site/test/ref/bike-willow.jpg deleted file mode 100644 index 374fb29..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-willow.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/bike-xpro2.jpg b/node_modules/cssgram/site/test/ref/bike-xpro2.jpg deleted file mode 100644 index 6f2a9f1..0000000 Binary files a/node_modules/cssgram/site/test/ref/bike-xpro2.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-aden.jpg b/node_modules/cssgram/site/test/ref/cacti-aden.jpg deleted file mode 100644 index 4dc9aef..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-aden.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-amaro.jpg b/node_modules/cssgram/site/test/ref/cacti-amaro.jpg deleted file mode 100644 index e9b0a11..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-amaro.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-brannan.jpg b/node_modules/cssgram/site/test/ref/cacti-brannan.jpg deleted file mode 100644 index 55d22cd..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-brannan.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-crema.jpg b/node_modules/cssgram/site/test/ref/cacti-crema.jpg deleted file mode 100644 index 21ca321..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-crema.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-earlybird.jpg b/node_modules/cssgram/site/test/ref/cacti-earlybird.jpg deleted file mode 100644 index 4fc1014..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-earlybird.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-hefe.jpg b/node_modules/cssgram/site/test/ref/cacti-hefe.jpg deleted file mode 100644 index 9d087c4..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-hefe.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-hudson.jpg b/node_modules/cssgram/site/test/ref/cacti-hudson.jpg deleted file mode 100644 index 3040949..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-hudson.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-inkwell.jpg b/node_modules/cssgram/site/test/ref/cacti-inkwell.jpg deleted file mode 100644 index 7fd85b1..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-inkwell.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-juno.jpg b/node_modules/cssgram/site/test/ref/cacti-juno.jpg deleted file mode 100644 index 4e9c2a4..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-juno.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-lark.jpg b/node_modules/cssgram/site/test/ref/cacti-lark.jpg deleted file mode 100644 index bbe7a9a..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-lark.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-lofi.jpg b/node_modules/cssgram/site/test/ref/cacti-lofi.jpg deleted file mode 100644 index d8a2c84..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-lofi.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-ludwig.jpg b/node_modules/cssgram/site/test/ref/cacti-ludwig.jpg deleted file mode 100644 index 352e0db..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-ludwig.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-mayfair.jpg b/node_modules/cssgram/site/test/ref/cacti-mayfair.jpg deleted file mode 100644 index 3654294..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-mayfair.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-nashville.jpg b/node_modules/cssgram/site/test/ref/cacti-nashville.jpg deleted file mode 100644 index 1f7d358..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-nashville.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-perpetua.jpg b/node_modules/cssgram/site/test/ref/cacti-perpetua.jpg deleted file mode 100644 index 58fc543..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-perpetua.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-reyes.jpg b/node_modules/cssgram/site/test/ref/cacti-reyes.jpg deleted file mode 100644 index cfd8549..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-reyes.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-rise.jpg b/node_modules/cssgram/site/test/ref/cacti-rise.jpg deleted file mode 100644 index 3b8d8e3..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-rise.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-sierra.jpg b/node_modules/cssgram/site/test/ref/cacti-sierra.jpg deleted file mode 100644 index 37759a5..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-sierra.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-slumber.jpg b/node_modules/cssgram/site/test/ref/cacti-slumber.jpg deleted file mode 100644 index 550bda6..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-slumber.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-valencia.jpg b/node_modules/cssgram/site/test/ref/cacti-valencia.jpg deleted file mode 100644 index 61b2c8f..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-valencia.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-willow.jpg b/node_modules/cssgram/site/test/ref/cacti-willow.jpg deleted file mode 100644 index 759d356..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-willow.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/cacti-xpro2.jpg b/node_modules/cssgram/site/test/ref/cacti-xpro2.jpg deleted file mode 100644 index cb839d6..0000000 Binary files a/node_modules/cssgram/site/test/ref/cacti-xpro2.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-aden.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-aden.jpg deleted file mode 100644 index 99e8223..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-aden.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-amaro.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-amaro.jpg deleted file mode 100644 index 7ec13e1..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-amaro.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-brannan.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-brannan.jpg deleted file mode 100644 index 68f1594..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-brannan.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-crema.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-crema.jpg deleted file mode 100644 index 2e88e48..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-crema.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-earlybird.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-earlybird.jpg deleted file mode 100644 index cd29e29..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-earlybird.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-hefe.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-hefe.jpg deleted file mode 100644 index c914fb3..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-hefe.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-hudson.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-hudson.jpg deleted file mode 100644 index f6c1b5e..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-hudson.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-inkwell.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-inkwell.jpg deleted file mode 100644 index ccbd678..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-inkwell.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-juno.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-juno.jpg deleted file mode 100644 index 1073b0e..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-juno.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-lark.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-lark.jpg deleted file mode 100644 index 17f9dec..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-lark.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-lofi.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-lofi.jpg deleted file mode 100644 index 5971d25..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-lofi.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-ludwig.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-ludwig.jpg deleted file mode 100644 index c162208..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-ludwig.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-mayfair.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-mayfair.jpg deleted file mode 100644 index 948b23a..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-mayfair.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-nashville.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-nashville.jpg deleted file mode 100644 index 71c5929..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-nashville.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-perpetua.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-perpetua.jpg deleted file mode 100644 index b6891a5..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-perpetua.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-reyes.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-reyes.jpg deleted file mode 100644 index 5addceb..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-reyes.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-rise.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-rise.jpg deleted file mode 100644 index 2a798d8..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-rise.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-sierra.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-sierra.jpg deleted file mode 100644 index 1192972..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-sierra.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-slumber.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-slumber.jpg deleted file mode 100644 index 75ac543..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-slumber.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-valencia.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-valencia.jpg deleted file mode 100644 index 34cc38e..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-valencia.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-willow.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-willow.jpg deleted file mode 100644 index fbc0445..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-willow.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/lakegeneva-xpro2.jpg b/node_modules/cssgram/site/test/ref/lakegeneva-xpro2.jpg deleted file mode 100644 index 4c02810..0000000 Binary files a/node_modules/cssgram/site/test/ref/lakegeneva-xpro2.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-aden.jpg b/node_modules/cssgram/site/test/ref/tahoe-aden.jpg deleted file mode 100644 index 93d9ec9..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-aden.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-amaro.jpg b/node_modules/cssgram/site/test/ref/tahoe-amaro.jpg deleted file mode 100644 index 64404da..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-amaro.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-brannan.jpg b/node_modules/cssgram/site/test/ref/tahoe-brannan.jpg deleted file mode 100644 index 9678da8..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-brannan.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-crema.jpg b/node_modules/cssgram/site/test/ref/tahoe-crema.jpg deleted file mode 100644 index 8a93970..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-crema.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-earlybird.jpg b/node_modules/cssgram/site/test/ref/tahoe-earlybird.jpg deleted file mode 100644 index 6b02870..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-earlybird.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-hefe.jpg b/node_modules/cssgram/site/test/ref/tahoe-hefe.jpg deleted file mode 100644 index 430bdfc..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-hefe.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-hudson.jpg b/node_modules/cssgram/site/test/ref/tahoe-hudson.jpg deleted file mode 100644 index 761e255..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-hudson.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-inkwell.jpg b/node_modules/cssgram/site/test/ref/tahoe-inkwell.jpg deleted file mode 100644 index 8184c89..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-inkwell.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-juno.jpg b/node_modules/cssgram/site/test/ref/tahoe-juno.jpg deleted file mode 100644 index 01915bd..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-juno.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-lark.jpg b/node_modules/cssgram/site/test/ref/tahoe-lark.jpg deleted file mode 100644 index 502fa12..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-lark.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-lofi.jpg b/node_modules/cssgram/site/test/ref/tahoe-lofi.jpg deleted file mode 100644 index fc1fcdf..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-lofi.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-ludwig.jpg b/node_modules/cssgram/site/test/ref/tahoe-ludwig.jpg deleted file mode 100644 index a29e439..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-ludwig.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-mayfair.jpg b/node_modules/cssgram/site/test/ref/tahoe-mayfair.jpg deleted file mode 100644 index efdce13..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-mayfair.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-nashville.jpg b/node_modules/cssgram/site/test/ref/tahoe-nashville.jpg deleted file mode 100644 index ef6e20e..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-nashville.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-perpetua.jpg b/node_modules/cssgram/site/test/ref/tahoe-perpetua.jpg deleted file mode 100644 index d0d29ad..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-perpetua.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-reyes.jpg b/node_modules/cssgram/site/test/ref/tahoe-reyes.jpg deleted file mode 100644 index 3381862..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-reyes.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-rise.jpg b/node_modules/cssgram/site/test/ref/tahoe-rise.jpg deleted file mode 100644 index 0e3f716..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-rise.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-sierra.jpg b/node_modules/cssgram/site/test/ref/tahoe-sierra.jpg deleted file mode 100644 index 41de972..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-sierra.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-slumber.jpg b/node_modules/cssgram/site/test/ref/tahoe-slumber.jpg deleted file mode 100644 index bacb4f8..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-slumber.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-valencia.jpg b/node_modules/cssgram/site/test/ref/tahoe-valencia.jpg deleted file mode 100644 index 4ee1018..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-valencia.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-willow.jpg b/node_modules/cssgram/site/test/ref/tahoe-willow.jpg deleted file mode 100644 index ffca4c9..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-willow.jpg and /dev/null differ diff --git a/node_modules/cssgram/site/test/ref/tahoe-xpro2.jpg b/node_modules/cssgram/site/test/ref/tahoe-xpro2.jpg deleted file mode 100644 index a47bd15..0000000 Binary files a/node_modules/cssgram/site/test/ref/tahoe-xpro2.jpg and /dev/null differ diff --git a/node_modules/cssgram/source/css/1977.css b/node_modules/cssgram/source/css/1977.css deleted file mode 100644 index 813123b..0000000 --- a/node_modules/cssgram/source/css/1977.css +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 1977 - * - */ -._1977:before, ._1977:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -._1977 { - position: relative; } - ._1977 img { - width: 100%; - z-index: 1; } - ._1977:before { - z-index: 2; } - ._1977:after { - z-index: 3; } - -._1977 { - -webkit-filter: contrast(1.1) brightness(1.1) saturate(1.3); - filter: contrast(1.1) brightness(1.1) saturate(1.3); } - ._1977:after { - background: rgba(243, 106, 188, 0.3); - mix-blend-mode: screen; } diff --git a/node_modules/cssgram/source/css/1977.min.css b/node_modules/cssgram/source/css/1977.min.css deleted file mode 100644 index ee34123..0000000 --- a/node_modules/cssgram/source/css/1977.min.css +++ /dev/null @@ -1 +0,0 @@ -._1977:after,._1977:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}._1977{position:relative}._1977 img{width:100%;z-index:1}._1977:before{z-index:2}._1977:after{z-index:3}._1977{-webkit-filter:contrast(1.1) brightness(1.1) saturate(1.3);filter:contrast(1.1) brightness(1.1) saturate(1.3)}._1977:after{background:rgba(243,106,188,.3);mix-blend-mode:screen} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/aden.css b/node_modules/cssgram/source/css/aden.css deleted file mode 100644 index 87091bb..0000000 --- a/node_modules/cssgram/source/css/aden.css +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Aden - * - */ -.aden:before, .aden:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden { - position: relative; } - .aden img { - width: 100%; - z-index: 1; } - .aden:before { - z-index: 2; } - .aden:after { - z-index: 3; } - -.aden { - -webkit-filter: hue-rotate(-20deg) contrast(.9) saturate(0.85) brightness(1.2); - filter: hue-rotate(-20deg) contrast(.9) saturate(0.85) brightness(1.2); } - .aden:after { - background: -webkit-linear-gradient(left, rgba(66, 10, 14, 0.2), transparent); - background: linear-gradient(to right, rgba(66, 10, 14, 0.2), transparent); - mix-blend-mode: darken; } diff --git a/node_modules/cssgram/source/css/aden.min.css b/node_modules/cssgram/source/css/aden.min.css deleted file mode 100644 index 9cb969e..0000000 --- a/node_modules/cssgram/source/css/aden.min.css +++ /dev/null @@ -1 +0,0 @@ -.aden:after,.aden:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.aden{position:relative}.aden img{width:100%;z-index:1}.aden:before{z-index:2}.aden:after{z-index:3}.aden{-webkit-filter:hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2);filter:hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2)}.aden:after{background:-webkit-linear-gradient(left,rgba(66,10,14,.2),transparent);background:linear-gradient(to right,rgba(66,10,14,.2),transparent);mix-blend-mode:darken} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/brooklyn.css b/node_modules/cssgram/source/css/brooklyn.css deleted file mode 100644 index 3e39352..0000000 --- a/node_modules/cssgram/source/css/brooklyn.css +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Brooklyn - * - */ -.brooklyn:before, .brooklyn:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.brooklyn { - position: relative; } - .brooklyn img { - width: 100%; - z-index: 1; } - .brooklyn:before { - z-index: 2; } - .brooklyn:after { - z-index: 3; } - -.brooklyn { - -webkit-filter: contrast(.9) brightness(1.1); - filter: contrast(.9) brightness(1.1); } - .brooklyn:after { - background: -webkit-radial-gradient(circle, rgba(168, 223, 193, 0.4) 70%, #c4b7c8); - background: radial-gradient(circle, rgba(168, 223, 193, 0.4) 70%, #c4b7c8); - mix-blend-mode: overlay; } diff --git a/node_modules/cssgram/source/css/brooklyn.min.css b/node_modules/cssgram/source/css/brooklyn.min.css deleted file mode 100644 index d7adc6b..0000000 --- a/node_modules/cssgram/source/css/brooklyn.min.css +++ /dev/null @@ -1 +0,0 @@ -.brooklyn:after,.brooklyn:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.brooklyn{position:relative}.brooklyn img{width:100%;z-index:1}.brooklyn:before{z-index:2}.brooklyn:after{z-index:3}.brooklyn{-webkit-filter:contrast(.9) brightness(1.1);filter:contrast(.9) brightness(1.1)}.brooklyn:after{background:-webkit-radial-gradient(circle,rgba(168,223,193,.4) 70%,#c4b7c8);background:radial-gradient(circle,rgba(168,223,193,.4) 70%,#c4b7c8);mix-blend-mode:overlay} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/cssgram.css b/node_modules/cssgram/source/css/cssgram.css deleted file mode 100644 index ab6347a..0000000 --- a/node_modules/cssgram/source/css/cssgram.css +++ /dev/null @@ -1,489 +0,0 @@ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -/* - * - * Aden - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.aden { - -webkit-filter: hue-rotate(-20deg) contrast(.9) saturate(0.85) brightness(1.2); - filter: hue-rotate(-20deg) contrast(.9) saturate(0.85) brightness(1.2); } - .aden:after { - background: -webkit-linear-gradient(left, rgba(66, 10, 14, 0.2), transparent); - background: linear-gradient(to right, rgba(66, 10, 14, 0.2), transparent); - mix-blend-mode: darken; } - -/* - * - * Inkwell - * - */ -.inkwell { - -webkit-filter: sepia(.3) contrast(1.1) brightness(1.1) grayscale(1); - filter: sepia(.3) contrast(1.1) brightness(1.1) grayscale(1); } - -/* - * - * Perpetua - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.perpetua:after { - background: -webkit-linear-gradient(top, #005b9a, #e6c13d); - background: linear-gradient(to bottom, #005b9a, #e6c13d); - mix-blend-mode: soft-light; - opacity: .5; } - -/* - * - * Reyes - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.reyes { - -webkit-filter: sepia(.22) brightness(1.1) contrast(.85) saturate(0.75); - filter: sepia(.22) brightness(1.1) contrast(.85) saturate(0.75); } - .reyes:after { - background: #efcdad; - mix-blend-mode: soft-light; - opacity: .5; } - -/* - * - * Gingham - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.gingham { - -webkit-filter: brightness(1.05) hue-rotate(-10deg); - filter: brightness(1.05) hue-rotate(-10deg); } - .gingham:after { - background: -webkit-linear-gradient(left, rgba(66, 10, 14, 0.2), transparent); - background: linear-gradient(to right, rgba(66, 10, 14, 0.2), transparent); - mix-blend-mode: darken; } - -/* - * - * Toaster - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.toaster { - -webkit-filter: contrast(1.5) brightness(.9); - filter: contrast(1.5) brightness(.9); } - .toaster:after { - background: -webkit-radial-gradient(circle, #804e0f, #3b003b); - background: radial-gradient(circle, #804e0f, #3b003b); - mix-blend-mode: screen; } - -/* - * - * Walden - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.walden { - -webkit-filter: brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6); - filter: brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6); } - .walden:after { - background: #04c; - mix-blend-mode: screen; - opacity: .3; } - -/* - * - * Hudson - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.hudson { - -webkit-filter: brightness(1.2) contrast(.9) saturate(1.1); - filter: brightness(1.2) contrast(.9) saturate(1.1); } - .hudson:after { - background: -webkit-radial-gradient(circle, #a6b1ff 50%, #342134); - background: radial-gradient(circle, #a6b1ff 50%, #342134); - mix-blend-mode: multiply; - opacity: .5; } - -/* - * - * Earlybird - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.earlybird { - -webkit-filter: contrast(.9) sepia(.2); - filter: contrast(.9) sepia(.2); } - .earlybird:after { - background: -webkit-radial-gradient(circle, #d0ba8e 20%, #360309 85%, #1d0210 100%); - background: radial-gradient(circle, #d0ba8e 20%, #360309 85%, #1d0210 100%); - mix-blend-mode: overlay; } - -/* - * - * Mayfair - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.mayfair { - -webkit-filter: contrast(1.1) saturate(1.1); - filter: contrast(1.1) saturate(1.1); } - .mayfair:after { - background: -webkit-radial-gradient(40% 40%, circle, rgba(255, 255, 255, 0.8), rgba(255, 200, 200, 0.6), #111 60%); - background: radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.8), rgba(255, 200, 200, 0.6), #111 60%); - mix-blend-mode: overlay; - opacity: .4; } - -/* - * Lo-fi - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.lofi { - -webkit-filter: saturate(1.1) contrast(1.5); - filter: saturate(1.1) contrast(1.5); } - .lofi:after { - background: -webkit-radial-gradient(circle, transparent 70%, #222 150%); - background: radial-gradient(circle, transparent 70%, #222 150%); - mix-blend-mode: multiply; } - -/* - * 1977 - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -._1977 { - -webkit-filter: contrast(1.1) brightness(1.1) saturate(1.3); - filter: contrast(1.1) brightness(1.1) saturate(1.3); } - ._1977:after { - background: rgba(243, 106, 188, 0.3); - mix-blend-mode: screen; } - -/* - * - * Brooklyn - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.brooklyn { - -webkit-filter: contrast(.9) brightness(1.1); - filter: contrast(.9) brightness(1.1); } - .brooklyn:after { - background: -webkit-radial-gradient(circle, rgba(168, 223, 193, 0.4) 70%, #c4b7c8); - background: radial-gradient(circle, rgba(168, 223, 193, 0.4) 70%, #c4b7c8); - mix-blend-mode: overlay; } - -/* - * - * X-Pro II - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.xpro2 { - -webkit-filter: sepia(.3); - filter: sepia(.3); } - .xpro2:after { - background: -webkit-radial-gradient(circle, #E6E7E0 40%, rgba(43, 42, 161, 0.6) 110%); - background: radial-gradient(circle, #E6E7E0 40%, rgba(43, 42, 161, 0.6) 110%); - mix-blend-mode: color-burn; } - -/* - * - * Nashville - * - */ -.aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before, .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.aden, .inkwell, .perpetua, .reyes, .gingham, .toaster, .walden, .hudson, .earlybird, .mayfair, .lofi, ._1977, .brooklyn, .xpro2, .nashville { - position: relative; } - .aden img, .inkwell img, .perpetua img, .reyes img, .gingham img, .toaster img, .walden img, .hudson img, .earlybird img, .mayfair img, .lofi img, ._1977 img, .brooklyn img, .xpro2 img, .nashville img { - width: 100%; - z-index: 1; } - .aden:before, .inkwell:before, .perpetua:before, .reyes:before, .gingham:before, .toaster:before, .walden:before, .hudson:before, .earlybird:before, .mayfair:before, .lofi:before, ._1977:before, .brooklyn:before, .xpro2:before, .nashville:before { - z-index: 2; } - .aden:after, .inkwell:after, .perpetua:after, .reyes:after, .gingham:after, .toaster:after, .walden:after, .hudson:after, .earlybird:after, .mayfair:after, .lofi:after, ._1977:after, .brooklyn:after, .xpro2:after, .nashville:after { - z-index: 3; } - -.nashville { - -webkit-filter: sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2); - filter: sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2); } - .nashville::after { - background: rgba(0, 70, 150, 0.4); - mix-blend-mode: lighten; } - .nashville::before { - background: rgba(247, 176, 153, 0.56); - mix-blend-mode: darken; } diff --git a/node_modules/cssgram/source/css/cssgram.min.css b/node_modules/cssgram/source/css/cssgram.min.css deleted file mode 100644 index 90f673d..0000000 --- a/node_modules/cssgram/source/css/cssgram.min.css +++ /dev/null @@ -1 +0,0 @@ -.aden{-webkit-filter:hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2);filter:hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2)}.aden:after{background:-webkit-linear-gradient(left,rgba(66,10,14,.2),transparent);background:linear-gradient(to right,rgba(66,10,14,.2),transparent);mix-blend-mode:darken}.inkwell{-webkit-filter:sepia(.3) contrast(1.1) brightness(1.1) grayscale(1);filter:sepia(.3) contrast(1.1) brightness(1.1) grayscale(1)}.perpetua:after{background:-webkit-linear-gradient(top,#005b9a,#e6c13d);background:linear-gradient(to bottom,#005b9a,#e6c13d);mix-blend-mode:soft-light;opacity:.5}.reyes{-webkit-filter:sepia(.22) brightness(1.1) contrast(.85) saturate(.75);filter:sepia(.22) brightness(1.1) contrast(.85) saturate(.75)}.reyes:after{background:#efcdad;mix-blend-mode:soft-light;opacity:.5}.gingham{-webkit-filter:brightness(1.05) hue-rotate(-10deg);filter:brightness(1.05) hue-rotate(-10deg)}.gingham:after{background:-webkit-linear-gradient(left,rgba(66,10,14,.2),transparent);background:linear-gradient(to right,rgba(66,10,14,.2),transparent);mix-blend-mode:darken}.toaster{-webkit-filter:contrast(1.5) brightness(.9);filter:contrast(1.5) brightness(.9)}.toaster:after{background:-webkit-radial-gradient(circle,#804e0f,#3b003b);background:radial-gradient(circle,#804e0f,#3b003b);mix-blend-mode:screen}.walden{-webkit-filter:brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6);filter:brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6)}.walden:after{background:#04c;mix-blend-mode:screen;opacity:.3}.hudson{-webkit-filter:brightness(1.2) contrast(.9) saturate(1.1);filter:brightness(1.2) contrast(.9) saturate(1.1)}.hudson:after{background:-webkit-radial-gradient(circle,#a6b1ff 50%,#342134);background:radial-gradient(circle,#a6b1ff 50%,#342134);mix-blend-mode:multiply;opacity:.5}.earlybird{-webkit-filter:contrast(.9) sepia(.2);filter:contrast(.9) sepia(.2)}.earlybird:after{background:-webkit-radial-gradient(circle,#d0ba8e 20%,#360309 85%,#1d0210 100%);background:radial-gradient(circle,#d0ba8e 20%,#360309 85%,#1d0210 100%);mix-blend-mode:overlay}.mayfair{-webkit-filter:contrast(1.1) saturate(1.1);filter:contrast(1.1) saturate(1.1)}.mayfair:after{background:-webkit-radial-gradient(40% 40%,circle,rgba(255,255,255,.8),rgba(255,200,200,.6),#111 60%);background:radial-gradient(circle at 40% 40%,rgba(255,255,255,.8),rgba(255,200,200,.6),#111 60%);mix-blend-mode:overlay;opacity:.4}.lofi{-webkit-filter:saturate(1.1) contrast(1.5);filter:saturate(1.1) contrast(1.5)}.lofi:after{background:-webkit-radial-gradient(circle,transparent 70%,#222 150%);background:radial-gradient(circle,transparent 70%,#222 150%);mix-blend-mode:multiply}._1977{-webkit-filter:contrast(1.1) brightness(1.1) saturate(1.3);filter:contrast(1.1) brightness(1.1) saturate(1.3)}._1977:after{background:rgba(243,106,188,.3);mix-blend-mode:screen}.brooklyn{-webkit-filter:contrast(.9) brightness(1.1);filter:contrast(.9) brightness(1.1)}.brooklyn:after{background:-webkit-radial-gradient(circle,rgba(168,223,193,.4) 70%,#c4b7c8);background:radial-gradient(circle,rgba(168,223,193,.4) 70%,#c4b7c8);mix-blend-mode:overlay}.xpro2{-webkit-filter:sepia(.3);filter:sepia(.3)}.xpro2:after{background:-webkit-radial-gradient(circle,#E6E7E0 40%,rgba(43,42,161,.6) 110%);background:radial-gradient(circle,#E6E7E0 40%,rgba(43,42,161,.6) 110%);mix-blend-mode:color-burn}._1977:after,._1977:before,.aden:after,.aden:before,.brooklyn:after,.brooklyn:before,.earlybird:after,.earlybird:before,.gingham:after,.gingham:before,.hudson:after,.hudson:before,.inkwell:after,.inkwell:before,.lofi:after,.lofi:before,.mayfair:after,.mayfair:before,.nashville:after,.nashville:before,.perpetua:after,.perpetua:before,.reyes:after,.reyes:before,.toaster:after,.toaster:before,.walden:after,.walden:before,.xpro2:after,.xpro2:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}._1977,.aden,.brooklyn,.earlybird,.gingham,.hudson,.inkwell,.lofi,.mayfair,.nashville,.perpetua,.reyes,.toaster,.walden,.xpro2{position:relative}._1977 img,.aden img,.brooklyn img,.earlybird img,.gingham img,.hudson img,.inkwell img,.lofi img,.mayfair img,.nashville img,.perpetua img,.reyes img,.toaster img,.walden img,.xpro2 img{width:100%;z-index:1}._1977:before,.aden:before,.brooklyn:before,.earlybird:before,.gingham:before,.hudson:before,.inkwell:before,.lofi:before,.mayfair:before,.nashville:before,.perpetua:before,.reyes:before,.toaster:before,.walden:before,.xpro2:before{z-index:2}._1977:after,.aden:after,.brooklyn:after,.earlybird:after,.gingham:after,.hudson:after,.inkwell:after,.lofi:after,.mayfair:after,.nashville:after,.perpetua:after,.reyes:after,.toaster:after,.walden:after,.xpro2:after{z-index:3}.nashville{-webkit-filter:sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2);filter:sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2)}.nashville::after{background:rgba(0,70,150,.4);mix-blend-mode:lighten}.nashville::before{background:rgba(247,176,153,.56);mix-blend-mode:darken} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/earlybird.css b/node_modules/cssgram/source/css/earlybird.css deleted file mode 100644 index b7c5560..0000000 --- a/node_modules/cssgram/source/css/earlybird.css +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Earlybird - * - */ -.earlybird:before, .earlybird:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.earlybird { - position: relative; } - .earlybird img { - width: 100%; - z-index: 1; } - .earlybird:before { - z-index: 2; } - .earlybird:after { - z-index: 3; } - -.earlybird { - -webkit-filter: contrast(.9) sepia(.2); - filter: contrast(.9) sepia(.2); } - .earlybird:after { - background: -webkit-radial-gradient(circle, #d0ba8e 20%, #360309 85%, #1d0210 100%); - background: radial-gradient(circle, #d0ba8e 20%, #360309 85%, #1d0210 100%); - mix-blend-mode: overlay; } diff --git a/node_modules/cssgram/source/css/earlybird.min.css b/node_modules/cssgram/source/css/earlybird.min.css deleted file mode 100644 index 3abe93a..0000000 --- a/node_modules/cssgram/source/css/earlybird.min.css +++ /dev/null @@ -1 +0,0 @@ -.earlybird:after,.earlybird:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.earlybird{position:relative}.earlybird img{width:100%;z-index:1}.earlybird:before{z-index:2}.earlybird:after{z-index:3}.earlybird{-webkit-filter:contrast(.9) sepia(.2);filter:contrast(.9) sepia(.2)}.earlybird:after{background:-webkit-radial-gradient(circle,#d0ba8e 20%,#360309 85%,#1d0210 100%);background:radial-gradient(circle,#d0ba8e 20%,#360309 85%,#1d0210 100%);mix-blend-mode:overlay} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/gingham.css b/node_modules/cssgram/source/css/gingham.css deleted file mode 100644 index b5cc327..0000000 --- a/node_modules/cssgram/source/css/gingham.css +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Gingham - * - */ -.gingham:before, .gingham:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.gingham { - position: relative; } - .gingham img { - width: 100%; - z-index: 1; } - .gingham:before { - z-index: 2; } - .gingham:after { - z-index: 3; } - -.gingham { - -webkit-filter: brightness(1.05) hue-rotate(-10deg); - filter: brightness(1.05) hue-rotate(-10deg); } - .gingham:after { - background: -webkit-linear-gradient(left, rgba(66, 10, 14, 0.2), transparent); - background: linear-gradient(to right, rgba(66, 10, 14, 0.2), transparent); - mix-blend-mode: darken; } diff --git a/node_modules/cssgram/source/css/gingham.min.css b/node_modules/cssgram/source/css/gingham.min.css deleted file mode 100644 index 4a1572a..0000000 --- a/node_modules/cssgram/source/css/gingham.min.css +++ /dev/null @@ -1 +0,0 @@ -.gingham:after,.gingham:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.gingham{position:relative}.gingham img{width:100%;z-index:1}.gingham:before{z-index:2}.gingham:after{z-index:3}.gingham{-webkit-filter:brightness(1.05) hue-rotate(-10deg);filter:brightness(1.05) hue-rotate(-10deg)}.gingham:after{background:-webkit-linear-gradient(left,rgba(66,10,14,.2),transparent);background:linear-gradient(to right,rgba(66,10,14,.2),transparent);mix-blend-mode:darken} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/hudson.css b/node_modules/cssgram/source/css/hudson.css deleted file mode 100644 index 46ff030..0000000 --- a/node_modules/cssgram/source/css/hudson.css +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Hudson - * - */ -.hudson:before, .hudson:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.hudson { - position: relative; } - .hudson img { - width: 100%; - z-index: 1; } - .hudson:before { - z-index: 2; } - .hudson:after { - z-index: 3; } - -.hudson { - -webkit-filter: brightness(1.2) contrast(.9) saturate(1.1); - filter: brightness(1.2) contrast(.9) saturate(1.1); } - .hudson:after { - background: -webkit-radial-gradient(circle, #a6b1ff 50%, #342134); - background: radial-gradient(circle, #a6b1ff 50%, #342134); - mix-blend-mode: multiply; - opacity: .5; } diff --git a/node_modules/cssgram/source/css/hudson.min.css b/node_modules/cssgram/source/css/hudson.min.css deleted file mode 100644 index 99dbd08..0000000 --- a/node_modules/cssgram/source/css/hudson.min.css +++ /dev/null @@ -1 +0,0 @@ -.hudson:after,.hudson:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.hudson{position:relative}.hudson img{width:100%;z-index:1}.hudson:before{z-index:2}.hudson:after{z-index:3}.hudson{-webkit-filter:brightness(1.2) contrast(.9) saturate(1.1);filter:brightness(1.2) contrast(.9) saturate(1.1)}.hudson:after{background:-webkit-radial-gradient(circle,#a6b1ff 50%,#342134);background:radial-gradient(circle,#a6b1ff 50%,#342134);mix-blend-mode:multiply;opacity:.5} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/inkwell.css b/node_modules/cssgram/source/css/inkwell.css deleted file mode 100644 index 6d147c1..0000000 --- a/node_modules/cssgram/source/css/inkwell.css +++ /dev/null @@ -1,8 +0,0 @@ -/* - * - * Inkwell - * - */ -.inkwell { - -webkit-filter: sepia(.3) contrast(1.1) brightness(1.1) grayscale(1); - filter: sepia(.3) contrast(1.1) brightness(1.1) grayscale(1); } diff --git a/node_modules/cssgram/source/css/inkwell.min.css b/node_modules/cssgram/source/css/inkwell.min.css deleted file mode 100644 index 97b3451..0000000 --- a/node_modules/cssgram/source/css/inkwell.min.css +++ /dev/null @@ -1 +0,0 @@ -.inkwell{-webkit-filter:sepia(.3) contrast(1.1) brightness(1.1) grayscale(1);filter:sepia(.3) contrast(1.1) brightness(1.1) grayscale(1)} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/lofi.css b/node_modules/cssgram/source/css/lofi.css deleted file mode 100644 index 4e9b2f2..0000000 --- a/node_modules/cssgram/source/css/lofi.css +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Lo-fi - * - */ -.lofi:before, .lofi:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.lofi { - position: relative; } - .lofi img { - width: 100%; - z-index: 1; } - .lofi:before { - z-index: 2; } - .lofi:after { - z-index: 3; } - -.lofi { - -webkit-filter: saturate(1.1) contrast(1.5); - filter: saturate(1.1) contrast(1.5); } - .lofi:after { - background: -webkit-radial-gradient(circle, transparent 70%, #222 150%); - background: radial-gradient(circle, transparent 70%, #222 150%); - mix-blend-mode: multiply; } diff --git a/node_modules/cssgram/source/css/lofi.min.css b/node_modules/cssgram/source/css/lofi.min.css deleted file mode 100644 index c5a3534..0000000 --- a/node_modules/cssgram/source/css/lofi.min.css +++ /dev/null @@ -1 +0,0 @@ -.lofi:after,.lofi:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.lofi{position:relative}.lofi img{width:100%;z-index:1}.lofi:before{z-index:2}.lofi:after{z-index:3}.lofi{-webkit-filter:saturate(1.1) contrast(1.5);filter:saturate(1.1) contrast(1.5)}.lofi:after{background:-webkit-radial-gradient(circle,transparent 70%,#222 150%);background:radial-gradient(circle,transparent 70%,#222 150%);mix-blend-mode:multiply} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/mayfair.css b/node_modules/cssgram/source/css/mayfair.css deleted file mode 100644 index 1dec639..0000000 --- a/node_modules/cssgram/source/css/mayfair.css +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Mayfair - * - */ -.mayfair:before, .mayfair:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.mayfair { - position: relative; } - .mayfair img { - width: 100%; - z-index: 1; } - .mayfair:before { - z-index: 2; } - .mayfair:after { - z-index: 3; } - -.mayfair { - -webkit-filter: contrast(1.1) saturate(1.1); - filter: contrast(1.1) saturate(1.1); } - .mayfair:after { - background: -webkit-radial-gradient(40% 40%, circle, rgba(255, 255, 255, 0.8), rgba(255, 200, 200, 0.6), #111 60%); - background: radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.8), rgba(255, 200, 200, 0.6), #111 60%); - mix-blend-mode: overlay; - opacity: .4; } diff --git a/node_modules/cssgram/source/css/mayfair.min.css b/node_modules/cssgram/source/css/mayfair.min.css deleted file mode 100644 index 9d19697..0000000 --- a/node_modules/cssgram/source/css/mayfair.min.css +++ /dev/null @@ -1 +0,0 @@ -.mayfair:after,.mayfair:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.mayfair{position:relative}.mayfair img{width:100%;z-index:1}.mayfair:before{z-index:2}.mayfair:after{z-index:3}.mayfair{-webkit-filter:contrast(1.1) saturate(1.1);filter:contrast(1.1) saturate(1.1)}.mayfair:after{background:-webkit-radial-gradient(40% 40%,circle,rgba(255,255,255,.8),rgba(255,200,200,.6),#111 60%);background:radial-gradient(circle at 40% 40%,rgba(255,255,255,.8),rgba(255,200,200,.6),#111 60%);mix-blend-mode:overlay;opacity:.4} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/nashville.css b/node_modules/cssgram/source/css/nashville.css deleted file mode 100644 index fc9ef64..0000000 --- a/node_modules/cssgram/source/css/nashville.css +++ /dev/null @@ -1,34 +0,0 @@ -/* - * - * Nashville - * - */ -.nashville:before, .nashville:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.nashville { - position: relative; } - .nashville img { - width: 100%; - z-index: 1; } - .nashville:before { - z-index: 2; } - .nashville:after { - z-index: 3; } - -.nashville { - -webkit-filter: sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2); - filter: sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2); } - .nashville::after { - background: rgba(0, 70, 150, 0.4); - mix-blend-mode: lighten; } - .nashville::before { - background: rgba(247, 176, 153, 0.56); - mix-blend-mode: darken; } diff --git a/node_modules/cssgram/source/css/nashville.min.css b/node_modules/cssgram/source/css/nashville.min.css deleted file mode 100644 index 8fae499..0000000 --- a/node_modules/cssgram/source/css/nashville.min.css +++ /dev/null @@ -1 +0,0 @@ -.nashville:after,.nashville:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.nashville{position:relative}.nashville img{width:100%;z-index:1}.nashville:before{z-index:2}.nashville:after{z-index:3}.nashville{-webkit-filter:sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2);filter:sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2)}.nashville::after{background:rgba(0,70,150,.4);mix-blend-mode:lighten}.nashville::before{background:rgba(247,176,153,.56);mix-blend-mode:darken} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/perpetua.css b/node_modules/cssgram/source/css/perpetua.css deleted file mode 100644 index 8d28441..0000000 --- a/node_modules/cssgram/source/css/perpetua.css +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * Perpetua - * - */ -.perpetua:before, .perpetua:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.perpetua { - position: relative; } - .perpetua img { - width: 100%; - z-index: 1; } - .perpetua:before { - z-index: 2; } - .perpetua:after { - z-index: 3; } - -.perpetua:after { - background: -webkit-linear-gradient(top, #005b9a, #e6c13d); - background: linear-gradient(to bottom, #005b9a, #e6c13d); - mix-blend-mode: soft-light; - opacity: .5; } diff --git a/node_modules/cssgram/source/css/perpetua.min.css b/node_modules/cssgram/source/css/perpetua.min.css deleted file mode 100644 index 8c4341b..0000000 --- a/node_modules/cssgram/source/css/perpetua.min.css +++ /dev/null @@ -1 +0,0 @@ -.perpetua:after,.perpetua:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.perpetua{position:relative}.perpetua img{width:100%;z-index:1}.perpetua:before{z-index:2}.perpetua:after{z-index:3;background:-webkit-linear-gradient(top,#005b9a,#e6c13d);background:linear-gradient(to bottom,#005b9a,#e6c13d);mix-blend-mode:soft-light;opacity:.5} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/reyes.css b/node_modules/cssgram/source/css/reyes.css deleted file mode 100644 index a2361ed..0000000 --- a/node_modules/cssgram/source/css/reyes.css +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Reyes - * - */ -.reyes:before, .reyes:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.reyes { - position: relative; } - .reyes img { - width: 100%; - z-index: 1; } - .reyes:before { - z-index: 2; } - .reyes:after { - z-index: 3; } - -.reyes { - -webkit-filter: sepia(.22) brightness(1.1) contrast(.85) saturate(0.75); - filter: sepia(.22) brightness(1.1) contrast(.85) saturate(0.75); } - .reyes:after { - background: #efcdad; - mix-blend-mode: soft-light; - opacity: .5; } diff --git a/node_modules/cssgram/source/css/reyes.min.css b/node_modules/cssgram/source/css/reyes.min.css deleted file mode 100644 index 8a7ad26..0000000 --- a/node_modules/cssgram/source/css/reyes.min.css +++ /dev/null @@ -1 +0,0 @@ -.reyes:after,.reyes:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.reyes{position:relative}.reyes img{width:100%;z-index:1}.reyes:before{z-index:2}.reyes:after{z-index:3}.reyes{-webkit-filter:sepia(.22) brightness(1.1) contrast(.85) saturate(.75);filter:sepia(.22) brightness(1.1) contrast(.85) saturate(.75)}.reyes:after{background:#efcdad;mix-blend-mode:soft-light;opacity:.5} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/toaster.css b/node_modules/cssgram/source/css/toaster.css deleted file mode 100644 index 46b77c2..0000000 --- a/node_modules/cssgram/source/css/toaster.css +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Toaster - * - */ -.toaster:before, .toaster:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.toaster { - position: relative; } - .toaster img { - width: 100%; - z-index: 1; } - .toaster:before { - z-index: 2; } - .toaster:after { - z-index: 3; } - -.toaster { - -webkit-filter: contrast(1.5) brightness(.9); - filter: contrast(1.5) brightness(.9); } - .toaster:after { - background: -webkit-radial-gradient(circle, #804e0f, #3b003b); - background: radial-gradient(circle, #804e0f, #3b003b); - mix-blend-mode: screen; } diff --git a/node_modules/cssgram/source/css/toaster.min.css b/node_modules/cssgram/source/css/toaster.min.css deleted file mode 100644 index 9c35195..0000000 --- a/node_modules/cssgram/source/css/toaster.min.css +++ /dev/null @@ -1 +0,0 @@ -.toaster:after,.toaster:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.toaster{position:relative}.toaster img{width:100%;z-index:1}.toaster:before{z-index:2}.toaster:after{z-index:3}.toaster{-webkit-filter:contrast(1.5) brightness(.9);filter:contrast(1.5) brightness(.9)}.toaster:after{background:-webkit-radial-gradient(circle,#804e0f,#3b003b);background:radial-gradient(circle,#804e0f,#3b003b);mix-blend-mode:screen} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/walden.css b/node_modules/cssgram/source/css/walden.css deleted file mode 100644 index bfd4c34..0000000 --- a/node_modules/cssgram/source/css/walden.css +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Walden - * - */ -.walden:before, .walden:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.walden { - position: relative; } - .walden img { - width: 100%; - z-index: 1; } - .walden:before { - z-index: 2; } - .walden:after { - z-index: 3; } - -.walden { - -webkit-filter: brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6); - filter: brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6); } - .walden:after { - background: #04c; - mix-blend-mode: screen; - opacity: .3; } diff --git a/node_modules/cssgram/source/css/walden.min.css b/node_modules/cssgram/source/css/walden.min.css deleted file mode 100644 index 0c7e769..0000000 --- a/node_modules/cssgram/source/css/walden.min.css +++ /dev/null @@ -1 +0,0 @@ -.walden:after,.walden:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.walden{position:relative}.walden img{width:100%;z-index:1}.walden:before{z-index:2}.walden:after{z-index:3}.walden{-webkit-filter:brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6);filter:brightness(1.1) hue-rotate(-10deg) sepia(.3) saturate(1.6)}.walden:after{background:#04c;mix-blend-mode:screen;opacity:.3} \ No newline at end of file diff --git a/node_modules/cssgram/source/css/xpro2.css b/node_modules/cssgram/source/css/xpro2.css deleted file mode 100644 index 4a58af4..0000000 --- a/node_modules/cssgram/source/css/xpro2.css +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * X-Pro II - * - */ -.xpro2:before, .xpro2:after { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; } - -.xpro2 { - position: relative; } - .xpro2 img { - width: 100%; - z-index: 1; } - .xpro2:before { - z-index: 2; } - .xpro2:after { - z-index: 3; } - -.xpro2 { - -webkit-filter: sepia(.3); - filter: sepia(.3); } - .xpro2:after { - background: -webkit-radial-gradient(circle, #E6E7E0 40%, rgba(43, 42, 161, 0.6) 110%); - background: radial-gradient(circle, #E6E7E0 40%, rgba(43, 42, 161, 0.6) 110%); - mix-blend-mode: color-burn; } diff --git a/node_modules/cssgram/source/css/xpro2.min.css b/node_modules/cssgram/source/css/xpro2.min.css deleted file mode 100644 index ac56684..0000000 --- a/node_modules/cssgram/source/css/xpro2.min.css +++ /dev/null @@ -1 +0,0 @@ -.xpro2:after,.xpro2:before{content:'';display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none}.xpro2{position:relative}.xpro2 img{width:100%;z-index:1}.xpro2:before{z-index:2}.xpro2:after{z-index:3}.xpro2{-webkit-filter:sepia(.3);filter:sepia(.3)}.xpro2:after{background:-webkit-radial-gradient(circle,#E6E7E0 40%,rgba(43,42,161,.6) 110%);background:radial-gradient(circle,#E6E7E0 40%,rgba(43,42,161,.6) 110%);mix-blend-mode:color-burn} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/1977.scss b/node_modules/cssgram/source/scss/1977.scss deleted file mode 100644 index 55458b7..0000000 --- a/node_modules/cssgram/source/scss/1977.scss +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 1977 - * - */ -@import 'shared'; - -%_1977, -._1977 { - @extend %filter-base; - filter: contrast(1.1) brightness(1.1) saturate(1.3); - - &:after{ - background: rgba(243, 106, 188, .3); - mix-blend-mode: screen; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/_shared.scss b/node_modules/cssgram/source/scss/_shared.scss deleted file mode 100644 index af97dfd..0000000 --- a/node_modules/cssgram/source/scss/_shared.scss +++ /dev/null @@ -1,29 +0,0 @@ -%pseudo-elem { - content: ''; - display: block; - height: 100%; - width: 100%; - top: 0; - left: 0; - position: absolute; - pointer-events: none; -} - -%filter-base { - position: relative; - - img { - width: 100%; - z-index: 1; - } - - &:before { - @extend %pseudo-elem; - z-index: 2; - } - - &:after { - @extend %pseudo-elem; - z-index: 3; - } -} diff --git a/node_modules/cssgram/source/scss/aden.scss b/node_modules/cssgram/source/scss/aden.scss deleted file mode 100644 index 3d4b566..0000000 --- a/node_modules/cssgram/source/scss/aden.scss +++ /dev/null @@ -1,18 +0,0 @@ -/* - * - * Aden - * - */ - -@import 'shared'; - -%aden, -.aden { - @extend %filter-base; - filter: hue-rotate(-20deg) contrast(.9) saturate(.85) brightness(1.2); - - &:after{ - background: linear-gradient(to right, rgba(66, 10, 14, 0.2), transparent); - mix-blend-mode: darken; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/brooklyn.scss b/node_modules/cssgram/source/scss/brooklyn.scss deleted file mode 100644 index 11d7691..0000000 --- a/node_modules/cssgram/source/scss/brooklyn.scss +++ /dev/null @@ -1,17 +0,0 @@ -/* - * - * Brooklyn - * - */ -@import 'shared'; - -%brooklyn, -.brooklyn { - @extend %filter-base; - filter: contrast(.9) brightness(1.1); - - &:after{ - background: radial-gradient(circle,rgba(168, 223, 193, .4) 70%, rgb(196, 183, 200)); - mix-blend-mode: overlay; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/cssgram.scss b/node_modules/cssgram/source/scss/cssgram.scss deleted file mode 100644 index d49d85f..0000000 --- a/node_modules/cssgram/source/scss/cssgram.scss +++ /dev/null @@ -1,16 +0,0 @@ -@import 'shared'; -@import 'aden'; -@import 'inkwell'; -@import 'perpetua'; -@import 'reyes'; -@import 'gingham'; -@import 'toaster'; -@import 'walden'; -@import 'hudson'; -@import 'earlybird'; -@import 'mayfair'; -@import 'lofi'; -@import '1977'; -@import 'brooklyn'; -@import 'xpro2'; -@import 'nashville'; diff --git a/node_modules/cssgram/source/scss/earlybird.scss b/node_modules/cssgram/source/scss/earlybird.scss deleted file mode 100644 index be3d93c..0000000 --- a/node_modules/cssgram/source/scss/earlybird.scss +++ /dev/null @@ -1,17 +0,0 @@ -/* - * - * Earlybird - * - */ -@import 'shared'; - -%earlybird, -.earlybird { - @extend %filter-base; - filter: contrast(.9) sepia(.2); - - &:after{ - background: radial-gradient(circle, #d0ba8e 20%, #360309 85%, #1d0210 100%); - mix-blend-mode: overlay; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/gingham.scss b/node_modules/cssgram/source/scss/gingham.scss deleted file mode 100644 index 937a19c..0000000 --- a/node_modules/cssgram/source/scss/gingham.scss +++ /dev/null @@ -1,17 +0,0 @@ -/* - * - * Gingham - * - */ -@import 'shared'; - -%gingham, -.gingham { - @extend %filter-base; - filter: brightness(1.05) hue-rotate(-10deg); - - &:after{ - background: linear-gradient(to right, rgba(66, 10, 14, .2), transparent); - mix-blend-mode: darken; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/hudson.scss b/node_modules/cssgram/source/scss/hudson.scss deleted file mode 100644 index 4da8fea..0000000 --- a/node_modules/cssgram/source/scss/hudson.scss +++ /dev/null @@ -1,18 +0,0 @@ -/* - * - * Hudson - * - */ -@import 'shared'; - -%hudson, //needs work! -.hudson { - @extend %filter-base; - filter: brightness(1.2) contrast(.9) saturate(1.1); - - &:after{ - background: radial-gradient(circle, #a6b1ff 50%, #342134); - mix-blend-mode: multiply; - opacity: .5; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/inkwell.scss b/node_modules/cssgram/source/scss/inkwell.scss deleted file mode 100644 index fbb267b..0000000 --- a/node_modules/cssgram/source/scss/inkwell.scss +++ /dev/null @@ -1,11 +0,0 @@ -/* - * - * Inkwell - * - */ - -%inkwell, -.inkwell { - @extend %filter-base; - filter: sepia(.3) contrast(1.1) brightness(1.1) grayscale(1); -} diff --git a/node_modules/cssgram/source/scss/lofi.scss b/node_modules/cssgram/source/scss/lofi.scss deleted file mode 100644 index 9eca059..0000000 --- a/node_modules/cssgram/source/scss/lofi.scss +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Lo-fi - * - */ -@import 'shared'; - -%lofi, -.lofi { - @extend %filter-base; - filter: saturate(1.1) contrast(1.5); - - &:after{ - background: radial-gradient(circle, transparent 70%, #222 150%); - mix-blend-mode: multiply; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/mayfair.scss b/node_modules/cssgram/source/scss/mayfair.scss deleted file mode 100644 index de3a61f..0000000 --- a/node_modules/cssgram/source/scss/mayfair.scss +++ /dev/null @@ -1,18 +0,0 @@ -/* - * - * Mayfair - * - */ -@import 'shared'; - -%mayfair, -.mayfair { - @extend %filter-base; - filter: contrast(1.1) saturate(1.1); - - &:after{ - background: radial-gradient(circle at 40% 40%, rgba(255,255,255, .8), rgba(255,200,200,.6), #111 60%); - mix-blend-mode: overlay; - opacity: .4; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/nashville.scss b/node_modules/cssgram/source/scss/nashville.scss deleted file mode 100644 index a78c4ae..0000000 --- a/node_modules/cssgram/source/scss/nashville.scss +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Nashville - * - */ -@import 'shared'; - -%nashville, -.nashville { - @extend %filter-base; - filter: sepia(.2) contrast(1.2) brightness(1.05) saturate(1.2); - - &::after { - background: rgba(0, 70, 150, .4); - mix-blend-mode: lighten; - } - - &::before { - background: rgba(247, 176, 153, .56); - mix-blend-mode: darken; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/perpetua.scss b/node_modules/cssgram/source/scss/perpetua.scss deleted file mode 100644 index 67a8322..0000000 --- a/node_modules/cssgram/source/scss/perpetua.scss +++ /dev/null @@ -1,17 +0,0 @@ -/* - * - * Perpetua - * - */ -@import 'shared'; - -%perpetua, -.perpetua { - @extend %filter-base; - - &:after{ - background: linear-gradient(to bottom, #005b9a, #e6c13d); - mix-blend-mode: soft-light; - opacity: .5; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/reyes.scss b/node_modules/cssgram/source/scss/reyes.scss deleted file mode 100644 index 6b59d34..0000000 --- a/node_modules/cssgram/source/scss/reyes.scss +++ /dev/null @@ -1,18 +0,0 @@ -/* - * - * Reyes - * - */ -@import 'shared'; - -%reyes, -.reyes { - @extend %filter-base; - filter: sepia(.22) brightness(1.1) contrast(.85) saturate(.75); - - &:after{ - background: #efcdad; - mix-blend-mode: soft-light; - opacity: .5; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/toaster.scss b/node_modules/cssgram/source/scss/toaster.scss deleted file mode 100644 index a00e312..0000000 --- a/node_modules/cssgram/source/scss/toaster.scss +++ /dev/null @@ -1,17 +0,0 @@ -/* - * - * Toaster - * - */ -@import 'shared'; - -%toaster, -.toaster { - @extend %filter-base; - filter: contrast(1.5) brightness(.9); - - &:after{ - background: radial-gradient(circle, #804e0f, #3b003b); - mix-blend-mode: screen; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/walden.scss b/node_modules/cssgram/source/scss/walden.scss deleted file mode 100644 index 30f36bd..0000000 --- a/node_modules/cssgram/source/scss/walden.scss +++ /dev/null @@ -1,18 +0,0 @@ -/* - * - * Walden - * - */ -@import 'shared'; - -%walden, -.walden { - @extend %filter-base; - filter: brightness(1.1) hue-rotate(-10deg)sepia(.3) saturate(1.6); - - &:after{ - background: #04c; - mix-blend-mode: screen; - opacity: .3; - } -} \ No newline at end of file diff --git a/node_modules/cssgram/source/scss/xpro2.scss b/node_modules/cssgram/source/scss/xpro2.scss deleted file mode 100644 index 3d05f08..0000000 --- a/node_modules/cssgram/source/scss/xpro2.scss +++ /dev/null @@ -1,17 +0,0 @@ -/* - * - * X-Pro II - * - */ -@import 'shared'; - -%xpro2, -.xpro2 { - @extend %filter-base; - filter: sepia(.3); - - &:after{ - background: radial-gradient(circle, #E6E7E0 40%, rgba(43, 42, 161, .6) 110%); - mix-blend-mode: color-burn; - } -} \ No newline at end of file diff --git a/node_modules/dom-walk/LICENCE b/node_modules/dom-walk/LICENCE deleted file mode 100644 index a23e08a..0000000 --- a/node_modules/dom-walk/LICENCE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Raynos. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. \ No newline at end of file diff --git a/node_modules/dom-walk/Makefile b/node_modules/dom-walk/Makefile deleted file mode 100644 index 132d3a3..0000000 --- a/node_modules/dom-walk/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -run: - ./node_modules/.bin/browserify-server --cwd example \ No newline at end of file diff --git a/node_modules/dom-walk/README.md b/node_modules/dom-walk/README.md deleted file mode 100644 index 9e33dd1..0000000 --- a/node_modules/dom-walk/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# dom-walk - -iteratively walk a DOM node - -## Example - -``` js -var walk = require("dom-walk") - -walk(document.body.childNodes, function (node) { - console.log("node", node) -}) -``` - -## Installation - -`npm install dom-walk` - -## Contributors - - - Raynos - -## MIT Licenced \ No newline at end of file diff --git a/node_modules/dom-walk/example/index.js b/node_modules/dom-walk/example/index.js deleted file mode 100644 index 2c8162d..0000000 --- a/node_modules/dom-walk/example/index.js +++ /dev/null @@ -1,5 +0,0 @@ -var walk = require("../index") - -walk(document, function (node) { - console.log("node", node) -}) diff --git a/node_modules/dom-walk/index.js b/node_modules/dom-walk/index.js deleted file mode 100644 index 9c2402d..0000000 --- a/node_modules/dom-walk/index.js +++ /dev/null @@ -1,24 +0,0 @@ -var slice = Array.prototype.slice - -module.exports = iterativelyWalk - -function iterativelyWalk(nodes, cb) { - if (!('length' in nodes)) { - nodes = [nodes] - } - - nodes = slice.call(nodes) - - while(nodes.length) { - var node = nodes.shift(), - ret = cb(node) - - if (ret) { - return ret - } - - if (node.childNodes && node.childNodes.length) { - nodes = slice.call(node.childNodes).concat(nodes) - } - } -} diff --git a/node_modules/dom-walk/package.json b/node_modules/dom-walk/package.json deleted file mode 100644 index ad8e02d..0000000 --- a/node_modules/dom-walk/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "_from": "dom-walk@^0.1.0", - "_id": "dom-walk@0.1.2", - "_inBundle": false, - "_integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==", - "_location": "/dom-walk", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "dom-walk@^0.1.0", - "name": "dom-walk", - "escapedName": "dom-walk", - "rawSpec": "^0.1.0", - "saveSpec": null, - "fetchSpec": "^0.1.0" - }, - "_requiredBy": [ - "/min-document" - ], - "_resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", - "_shasum": "0c548bef048f4d1f2a97249002236060daa3fd84", - "_spec": "dom-walk@^0.1.0", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\min-document", - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "bugs": { - "url": "https://github.com/Raynos/dom-walk/issues", - "email": "raynos2@gmail.com" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Jake Verbaten" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "iteratively walk a DOM node", - "devDependencies": { - "budo": "11.6.3" - }, - "homepage": "https://github.com/Raynos/dom-walk", - "keywords": [], - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/Raynos/dom-walk/raw/master/LICENSE" - } - ], - "main": "index", - "name": "dom-walk", - "repository": { - "type": "git", - "url": "git://github.com/Raynos/dom-walk.git" - }, - "scripts": { - "example": "budo example/index.js" - }, - "version": "0.1.2" -} diff --git a/node_modules/github-markdown-css/github-markdown.css b/node_modules/github-markdown-css/github-markdown.css deleted file mode 100644 index 7c6cd78..0000000 --- a/node_modules/github-markdown-css/github-markdown.css +++ /dev/null @@ -1,985 +0,0 @@ -.markdown-body .octicon { - display: inline-block; - fill: currentColor; - vertical-align: text-bottom; -} - -.markdown-body .anchor { - float: left; - line-height: 1; - margin-left: -20px; - padding-right: 4px; -} - -.markdown-body .anchor:focus { - outline: none; -} - -.markdown-body h1 .octicon-link, -.markdown-body h2 .octicon-link, -.markdown-body h3 .octicon-link, -.markdown-body h4 .octicon-link, -.markdown-body h5 .octicon-link, -.markdown-body h6 .octicon-link { - color: #1b1f23; - vertical-align: middle; - visibility: hidden; -} - -.markdown-body h1:hover .anchor, -.markdown-body h2:hover .anchor, -.markdown-body h3:hover .anchor, -.markdown-body h4:hover .anchor, -.markdown-body h5:hover .anchor, -.markdown-body h6:hover .anchor { - text-decoration: none; -} - -.markdown-body h1:hover .anchor .octicon-link, -.markdown-body h2:hover .anchor .octicon-link, -.markdown-body h3:hover .anchor .octicon-link, -.markdown-body h4:hover .anchor .octicon-link, -.markdown-body h5:hover .anchor .octicon-link, -.markdown-body h6:hover .anchor .octicon-link { - visibility: visible; -} - -.markdown-body h1:hover .anchor .octicon-link:before, -.markdown-body h2:hover .anchor .octicon-link:before, -.markdown-body h3:hover .anchor .octicon-link:before, -.markdown-body h4:hover .anchor .octicon-link:before, -.markdown-body h5:hover .anchor .octicon-link:before, -.markdown-body h6:hover .anchor .octicon-link:before { - width: 16px; - height: 16px; - content: ' '; - display: inline-block; - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' width='16' height='16' aria-hidden='true'%3E%3Cpath fill-rule='evenodd' d='M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z'%3E%3C/path%3E%3C/svg%3E"); -}.markdown-body { - -ms-text-size-adjust: 100%; - -webkit-text-size-adjust: 100%; - line-height: 1.5; - color: #24292e; - font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji; - font-size: 16px; - line-height: 1.5; - word-wrap: break-word; -} - -.markdown-body details { - display: block; -} - -.markdown-body summary { - display: list-item; -} - -.markdown-body a { - background-color: initial; -} - -.markdown-body a:active, -.markdown-body a:hover { - outline-width: 0; -} - -.markdown-body strong { - font-weight: inherit; - font-weight: bolder; -} - -.markdown-body h1 { - font-size: 2em; - margin: .67em 0; -} - -.markdown-body img { - border-style: none; -} - -.markdown-body code, -.markdown-body kbd, -.markdown-body pre { - font-family: monospace,monospace; - font-size: 1em; -} - -.markdown-body hr { - box-sizing: initial; - height: 0; - overflow: visible; -} - -.markdown-body input { - font: inherit; - margin: 0; -} - -.markdown-body input { - overflow: visible; -} - -.markdown-body [type=checkbox] { - box-sizing: border-box; - padding: 0; -} - -.markdown-body * { - box-sizing: border-box; -} - -.markdown-body input { - font-family: inherit; - font-size: inherit; - line-height: inherit; -} - -.markdown-body a { - color: #0366d6; - text-decoration: none; -} - -.markdown-body a:hover { - text-decoration: underline; -} - -.markdown-body strong { - font-weight: 600; -} - -.markdown-body hr { - height: 0; - margin: 15px 0; - overflow: hidden; - background: transparent; - border: 0; - border-bottom: 1px solid #dfe2e5; -} - -.markdown-body hr:after, -.markdown-body hr:before { - display: table; - content: ""; -} - -.markdown-body hr:after { - clear: both; -} - -.markdown-body table { - border-spacing: 0; - border-collapse: collapse; -} - -.markdown-body td, -.markdown-body th { - padding: 0; -} - -.markdown-body details summary { - cursor: pointer; -} - -.markdown-body kbd { - display: inline-block; - padding: 3px 5px; - font: 11px SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace; - line-height: 10px; - color: #444d56; - vertical-align: middle; - background-color: #fafbfc; - border: 1px solid #d1d5da; - border-radius: 3px; - box-shadow: inset 0 -1px 0 #d1d5da; -} - -.markdown-body h1, -.markdown-body h2, -.markdown-body h3, -.markdown-body h4, -.markdown-body h5, -.markdown-body h6 { - margin-top: 0; - margin-bottom: 0; -} - -.markdown-body h1 { - font-size: 32px; -} - -.markdown-body h1, -.markdown-body h2 { - font-weight: 600; -} - -.markdown-body h2 { - font-size: 24px; -} - -.markdown-body h3 { - font-size: 20px; -} - -.markdown-body h3, -.markdown-body h4 { - font-weight: 600; -} - -.markdown-body h4 { - font-size: 16px; -} - -.markdown-body h5 { - font-size: 14px; -} - -.markdown-body h5, -.markdown-body h6 { - font-weight: 600; -} - -.markdown-body h6 { - font-size: 12px; -} - -.markdown-body p { - margin-top: 0; - margin-bottom: 10px; -} - -.markdown-body blockquote { - margin: 0; -} - -.markdown-body ol, -.markdown-body ul { - padding-left: 0; - margin-top: 0; - margin-bottom: 0; -} - -.markdown-body ol ol, -.markdown-body ul ol { - list-style-type: lower-roman; -} - -.markdown-body ol ol ol, -.markdown-body ol ul ol, -.markdown-body ul ol ol, -.markdown-body ul ul ol { - list-style-type: lower-alpha; -} - -.markdown-body dd { - margin-left: 0; -} - -.markdown-body code, -.markdown-body pre { - font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace; - font-size: 12px; -} - -.markdown-body pre { - margin-top: 0; - margin-bottom: 0; -} - -.markdown-body input::-webkit-inner-spin-button, -.markdown-body input::-webkit-outer-spin-button { - margin: 0; - -webkit-appearance: none; - appearance: none; -} - -.markdown-body :checked+.radio-label { - position: relative; - z-index: 1; - border-color: #0366d6; -} - -.markdown-body .border { - border: 1px solid #e1e4e8!important; -} - -.markdown-body .border-0 { - border: 0!important; -} - -.markdown-body .border-bottom { - border-bottom: 1px solid #e1e4e8!important; -} - -.markdown-body .rounded-1 { - border-radius: 3px!important; -} - -.markdown-body .bg-white { - background-color: #fff!important; -} - -.markdown-body .bg-gray-light { - background-color: #fafbfc!important; -} - -.markdown-body .text-gray-light { - color: #6a737d!important; -} - -.markdown-body .mb-0 { - margin-bottom: 0!important; -} - -.markdown-body .my-2 { - margin-top: 8px!important; - margin-bottom: 8px!important; -} - -.markdown-body .pl-0 { - padding-left: 0!important; -} - -.markdown-body .py-0 { - padding-top: 0!important; - padding-bottom: 0!important; -} - -.markdown-body .pl-1 { - padding-left: 4px!important; -} - -.markdown-body .pl-2 { - padding-left: 8px!important; -} - -.markdown-body .py-2 { - padding-top: 8px!important; - padding-bottom: 8px!important; -} - -.markdown-body .pl-3, -.markdown-body .px-3 { - padding-left: 16px!important; -} - -.markdown-body .px-3 { - padding-right: 16px!important; -} - -.markdown-body .pl-4 { - padding-left: 24px!important; -} - -.markdown-body .pl-5 { - padding-left: 32px!important; -} - -.markdown-body .pl-6 { - padding-left: 40px!important; -} - -.markdown-body .f6 { - font-size: 12px!important; -} - -.markdown-body .lh-condensed { - line-height: 1.25!important; -} - -.markdown-body .text-bold { - font-weight: 600!important; -} - -.markdown-body .pl-c { - color: #6a737d; -} - -.markdown-body .pl-c1, -.markdown-body .pl-s .pl-v { - color: #005cc5; -} - -.markdown-body .pl-e, -.markdown-body .pl-en { - color: #6f42c1; -} - -.markdown-body .pl-s .pl-s1, -.markdown-body .pl-smi { - color: #24292e; -} - -.markdown-body .pl-ent { - color: #22863a; -} - -.markdown-body .pl-k { - color: #d73a49; -} - -.markdown-body .pl-pds, -.markdown-body .pl-s, -.markdown-body .pl-s .pl-pse .pl-s1, -.markdown-body .pl-sr, -.markdown-body .pl-sr .pl-cce, -.markdown-body .pl-sr .pl-sra, -.markdown-body .pl-sr .pl-sre { - color: #032f62; -} - -.markdown-body .pl-smw, -.markdown-body .pl-v { - color: #e36209; -} - -.markdown-body .pl-bu { - color: #b31d28; -} - -.markdown-body .pl-ii { - color: #fafbfc; - background-color: #b31d28; -} - -.markdown-body .pl-c2 { - color: #fafbfc; - background-color: #d73a49; -} - -.markdown-body .pl-c2:before { - content: "^M"; -} - -.markdown-body .pl-sr .pl-cce { - font-weight: 700; - color: #22863a; -} - -.markdown-body .pl-ml { - color: #735c0f; -} - -.markdown-body .pl-mh, -.markdown-body .pl-mh .pl-en, -.markdown-body .pl-ms { - font-weight: 700; - color: #005cc5; -} - -.markdown-body .pl-mi { - font-style: italic; - color: #24292e; -} - -.markdown-body .pl-mb { - font-weight: 700; - color: #24292e; -} - -.markdown-body .pl-md { - color: #b31d28; - background-color: #ffeef0; -} - -.markdown-body .pl-mi1 { - color: #22863a; - background-color: #f0fff4; -} - -.markdown-body .pl-mc { - color: #e36209; - background-color: #ffebda; -} - -.markdown-body .pl-mi2 { - color: #f6f8fa; - background-color: #005cc5; -} - -.markdown-body .pl-mdr { - font-weight: 700; - color: #6f42c1; -} - -.markdown-body .pl-ba { - color: #586069; -} - -.markdown-body .pl-sg { - color: #959da5; -} - -.markdown-body .pl-corl { - text-decoration: underline; - color: #032f62; -} - -.markdown-body .mb-0 { - margin-bottom: 0!important; -} - -.markdown-body .my-2 { - margin-bottom: 8px!important; -} - -.markdown-body .my-2 { - margin-top: 8px!important; -} - -.markdown-body .pl-0 { - padding-left: 0!important; -} - -.markdown-body .py-0 { - padding-top: 0!important; - padding-bottom: 0!important; -} - -.markdown-body .pl-1 { - padding-left: 4px!important; -} - -.markdown-body .pl-2 { - padding-left: 8px!important; -} - -.markdown-body .py-2 { - padding-top: 8px!important; - padding-bottom: 8px!important; -} - -.markdown-body .pl-3 { - padding-left: 16px!important; -} - -.markdown-body .pl-4 { - padding-left: 24px!important; -} - -.markdown-body .pl-5 { - padding-left: 32px!important; -} - -.markdown-body .pl-6 { - padding-left: 40px!important; -} - -.markdown-body .pl-7 { - padding-left: 48px!important; -} - -.markdown-body .pl-8 { - padding-left: 64px!important; -} - -.markdown-body .pl-9 { - padding-left: 80px!important; -} - -.markdown-body .pl-10 { - padding-left: 96px!important; -} - -.markdown-body .pl-11 { - padding-left: 112px!important; -} - -.markdown-body .pl-12 { - padding-left: 128px!important; -} - -.markdown-body hr { - border-bottom-color: #eee; -} - -.markdown-body kbd { - display: inline-block; - padding: 3px 5px; - font: 11px SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace; - line-height: 10px; - color: #444d56; - vertical-align: middle; - background-color: #fafbfc; - border: 1px solid #d1d5da; - border-radius: 3px; - box-shadow: inset 0 -1px 0 #d1d5da; -} - -.markdown-body:after, -.markdown-body:before { - display: table; - content: ""; -} - -.markdown-body:after { - clear: both; -} - -.markdown-body>:first-child { - margin-top: 0!important; -} - -.markdown-body>:last-child { - margin-bottom: 0!important; -} - -.markdown-body a:not([href]) { - color: inherit; - text-decoration: none; -} - -.markdown-body blockquote, -.markdown-body details, -.markdown-body dl, -.markdown-body ol, -.markdown-body p, -.markdown-body pre, -.markdown-body table, -.markdown-body ul { - margin-top: 0; - margin-bottom: 16px; -} - -.markdown-body hr { - height: .25em; - padding: 0; - margin: 24px 0; - background-color: #e1e4e8; - border: 0; -} - -.markdown-body blockquote { - padding: 0 1em; - color: #6a737d; - border-left: .25em solid #dfe2e5; -} - -.markdown-body blockquote>:first-child { - margin-top: 0; -} - -.markdown-body blockquote>:last-child { - margin-bottom: 0; -} - -.markdown-body h1, -.markdown-body h2, -.markdown-body h3, -.markdown-body h4, -.markdown-body h5, -.markdown-body h6 { - margin-top: 24px; - margin-bottom: 16px; - font-weight: 600; - line-height: 1.25; -} - -.markdown-body h1 { - font-size: 2em; -} - -.markdown-body h1, -.markdown-body h2 { - padding-bottom: .3em; - border-bottom: 1px solid #eaecef; -} - -.markdown-body h2 { - font-size: 1.5em; -} - -.markdown-body h3 { - font-size: 1.25em; -} - -.markdown-body h4 { - font-size: 1em; -} - -.markdown-body h5 { - font-size: .875em; -} - -.markdown-body h6 { - font-size: .85em; - color: #6a737d; -} - -.markdown-body ol, -.markdown-body ul { - padding-left: 2em; -} - -.markdown-body ol ol, -.markdown-body ol ul, -.markdown-body ul ol, -.markdown-body ul ul { - margin-top: 0; - margin-bottom: 0; -} - -.markdown-body li { - word-wrap: break-all; -} - -.markdown-body li>p { - margin-top: 16px; -} - -.markdown-body li+li { - margin-top: .25em; -} - -.markdown-body dl { - padding: 0; -} - -.markdown-body dl dt { - padding: 0; - margin-top: 16px; - font-size: 1em; - font-style: italic; - font-weight: 600; -} - -.markdown-body dl dd { - padding: 0 16px; - margin-bottom: 16px; -} - -.markdown-body table { - display: block; - width: 100%; - overflow: auto; -} - -.markdown-body table th { - font-weight: 600; -} - -.markdown-body table td, -.markdown-body table th { - padding: 6px 13px; - border: 1px solid #dfe2e5; -} - -.markdown-body table tr { - background-color: #fff; - border-top: 1px solid #c6cbd1; -} - -.markdown-body table tr:nth-child(2n) { - background-color: #f6f8fa; -} - -.markdown-body img { - max-width: 100%; - box-sizing: initial; - background-color: #fff; -} - -.markdown-body img[align=right] { - padding-left: 20px; -} - -.markdown-body img[align=left] { - padding-right: 20px; -} - -.markdown-body code { - padding: .2em .4em; - margin: 0; - font-size: 85%; - background-color: rgba(27,31,35,.05); - border-radius: 3px; -} - -.markdown-body pre { - word-wrap: normal; -} - -.markdown-body pre>code { - padding: 0; - margin: 0; - font-size: 100%; - word-break: normal; - white-space: pre; - background: transparent; - border: 0; -} - -.markdown-body .highlight { - margin-bottom: 16px; -} - -.markdown-body .highlight pre { - margin-bottom: 0; - word-break: normal; -} - -.markdown-body .highlight pre, -.markdown-body pre { - padding: 16px; - overflow: auto; - font-size: 85%; - line-height: 1.45; - background-color: #f6f8fa; - border-radius: 3px; -} - -.markdown-body pre code { - display: inline; - max-width: auto; - padding: 0; - margin: 0; - overflow: visible; - line-height: inherit; - word-wrap: normal; - background-color: initial; - border: 0; -} - -.markdown-body .commit-tease-sha { - display: inline-block; - font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace; - font-size: 90%; - color: #444d56; -} - -.markdown-body .full-commit .btn-outline:not(:disabled):hover { - color: #005cc5; - border-color: #005cc5; -} - -.markdown-body .blob-wrapper { - overflow-x: auto; - overflow-y: hidden; -} - -.markdown-body .blob-wrapper-embedded { - max-height: 240px; - overflow-y: auto; -} - -.markdown-body .blob-num { - width: 1%; - min-width: 50px; - padding-right: 10px; - padding-left: 10px; - font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace; - font-size: 12px; - line-height: 20px; - color: rgba(27,31,35,.3); - text-align: right; - white-space: nowrap; - vertical-align: top; - cursor: pointer; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.markdown-body .blob-num:hover { - color: rgba(27,31,35,.6); -} - -.markdown-body .blob-num:before { - content: attr(data-line-number); -} - -.markdown-body .blob-code { - position: relative; - padding-right: 10px; - padding-left: 10px; - line-height: 20px; - vertical-align: top; -} - -.markdown-body .blob-code-inner { - overflow: visible; - font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace; - font-size: 12px; - color: #24292e; - word-wrap: normal; - white-space: pre; -} - -.markdown-body .pl-token.active, -.markdown-body .pl-token:hover { - cursor: pointer; - background: #ffea7f; -} - -.markdown-body .tab-size[data-tab-size="1"] { - -moz-tab-size: 1; - tab-size: 1; -} - -.markdown-body .tab-size[data-tab-size="2"] { - -moz-tab-size: 2; - tab-size: 2; -} - -.markdown-body .tab-size[data-tab-size="3"] { - -moz-tab-size: 3; - tab-size: 3; -} - -.markdown-body .tab-size[data-tab-size="4"] { - -moz-tab-size: 4; - tab-size: 4; -} - -.markdown-body .tab-size[data-tab-size="5"] { - -moz-tab-size: 5; - tab-size: 5; -} - -.markdown-body .tab-size[data-tab-size="6"] { - -moz-tab-size: 6; - tab-size: 6; -} - -.markdown-body .tab-size[data-tab-size="7"] { - -moz-tab-size: 7; - tab-size: 7; -} - -.markdown-body .tab-size[data-tab-size="8"] { - -moz-tab-size: 8; - tab-size: 8; -} - -.markdown-body .tab-size[data-tab-size="9"] { - -moz-tab-size: 9; - tab-size: 9; -} - -.markdown-body .tab-size[data-tab-size="10"] { - -moz-tab-size: 10; - tab-size: 10; -} - -.markdown-body .tab-size[data-tab-size="11"] { - -moz-tab-size: 11; - tab-size: 11; -} - -.markdown-body .tab-size[data-tab-size="12"] { - -moz-tab-size: 12; - tab-size: 12; -} - -.markdown-body .task-list-item { - list-style-type: none; -} - -.markdown-body .task-list-item+.task-list-item { - margin-top: 3px; -} - -.markdown-body .task-list-item input { - margin: 0 .2em .25em -1.6em; - vertical-align: middle; -} diff --git a/node_modules/github-markdown-css/license b/node_modules/github-markdown-css/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/github-markdown-css/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 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. diff --git a/node_modules/github-markdown-css/package.json b/node_modules/github-markdown-css/package.json deleted file mode 100644 index 797fc09..0000000 --- a/node_modules/github-markdown-css/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "_args": [ - [ - "github-markdown-css@4.0.0", - "F:\\Documents\\websites\\BMM" - ] - ], - "_from": "github-markdown-css@4.0.0", - "_id": "github-markdown-css@4.0.0", - "_inBundle": false, - "_integrity": "sha512-mH0bcIKv4XAN0mQVokfTdKo2OD5K8WJE9+lbMdM32/q0Ie5tXgVN/2o+zvToRMxSTUuiTRcLg5hzkFfOyBYreg==", - "_location": "/github-markdown-css", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "github-markdown-css@4.0.0", - "name": "github-markdown-css", - "escapedName": "github-markdown-css", - "rawSpec": "4.0.0", - "saveSpec": null, - "fetchSpec": "4.0.0" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/github-markdown-css/-/github-markdown-css-4.0.0.tgz", - "_spec": "4.0.0", - "_where": "F:\\Documents\\websites\\BMM", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/github-markdown-css/issues" - }, - "description": "The minimal amount of CSS to replicate the GitHub Markdown style", - "devDependencies": { - "generate-github-markdown-css": "^4.0.0" - }, - "files": [ - "github-markdown.css" - ], - "funding": "https://github.com/sponsors/sindresorhus", - "homepage": "https://github.com/sindresorhus/github-markdown-css#readme", - "keywords": [ - "browser", - "github", - "markdown", - "md", - "css", - "style", - "stylesheet" - ], - "license": "MIT", - "main": "github-markdown.css", - "name": "github-markdown-css", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/github-markdown-css.git" - }, - "scripts": { - "make": "github-markdown-css > github-markdown.css" - }, - "version": "4.0.0" -} diff --git a/node_modules/github-markdown-css/readme.md b/node_modules/github-markdown-css/readme.md deleted file mode 100644 index bc73f37..0000000 --- a/node_modules/github-markdown-css/readme.md +++ /dev/null @@ -1,53 +0,0 @@ -# github-markdown-css - -> The minimal amount of CSS to replicate the GitHub Markdown style - -[](http://sindresorhus.com/github-markdown-css) - -## [Demo](https://sindresorhus.com/github-markdown-css) - -## Install - -Download [manually](https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css), from [CDNJS](https://cdnjs.com/libraries/github-markdown-css), or with npm: - -``` -$ npm install github-markdown-css -``` - -## Usage - -Import the `github-markdown.css` file and add a `markdown-body` class to the container of your rendered Markdown and set a width for it. GitHub uses `980px` width and `45px` padding, and `15px` padding for mobile. - -```html - - - -
-

Unicorns

-

All the things

-
-``` - -If you want code syntax highlighted, use GitHub Flavored Markdown rendered from [GitHub's `/markdown` API](https://developer.github.com/v3/markdown/). - -## How - -See [`generate-github-markdown-css`](https://github.com/sindresorhus/generate-github-markdown-css) for how it's generated and ability to generate your own. - -## Dev - -Run `npm run make` to update the CSS. diff --git a/node_modules/global/.travis.yml b/node_modules/global/.travis.yml deleted file mode 100644 index ed178f6..0000000 --- a/node_modules/global/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.8 - - 0.9 diff --git a/node_modules/global/LICENSE b/node_modules/global/LICENSE deleted file mode 100644 index 822d880..0000000 --- a/node_modules/global/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Colingo. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/global/README.md b/node_modules/global/README.md deleted file mode 100644 index 289d305..0000000 --- a/node_modules/global/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# global - - - -Require global variables - -## Example - -```js -var global = require("global") -var document = require("global/document") -var window = require("global/window") -``` - -## Installation - -`npm install global` - -## Contributors - - - Raynos - -## MIT Licenced - - [1]: https://secure.travis-ci.org/Colingo/global.png - [2]: http://travis-ci.org/Colingo/global - [3]: http://ci.testling.com/Colingo/global.png - [4]: http://ci.testling.com/Colingo/global diff --git a/node_modules/global/console.js b/node_modules/global/console.js deleted file mode 100644 index 5cb1dfa..0000000 --- a/node_modules/global/console.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = console; diff --git a/node_modules/global/document.js b/node_modules/global/document.js deleted file mode 100644 index 7c0f50d..0000000 --- a/node_modules/global/document.js +++ /dev/null @@ -1,17 +0,0 @@ -var topLevel = typeof global !== 'undefined' ? global : - typeof window !== 'undefined' ? window : {} -var minDoc = require('min-document'); - -var doccy; - -if (typeof document !== 'undefined') { - doccy = document; -} else { - doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; - - if (!doccy) { - doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; - } -} - -module.exports = doccy; diff --git a/node_modules/global/package.json b/node_modules/global/package.json deleted file mode 100644 index 1142fed..0000000 --- a/node_modules/global/package.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "_from": "global@^4.4.0", - "_id": "global@4.4.0", - "_inBundle": false, - "_integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", - "_location": "/global", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "global@^4.4.0", - "name": "global", - "escapedName": "global", - "rawSpec": "^4.4.0", - "saveSpec": null, - "fetchSpec": "^4.4.0" - }, - "_requiredBy": [ - "/@videojs/http-streaming", - "/@videojs/vhs-utils", - "/@videojs/xhr", - "/aes-decrypter", - "/m3u8-parser", - "/mpd-parser", - "/video.js", - "/videojs-vtt.js" - ], - "_resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", - "_shasum": "3e7b105179006a323ed71aafca3e9c57a5cc6406", - "_spec": "global@^4.4.0", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js", - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "browser": { - "min-document": false, - "individual": false - }, - "bugs": { - "url": "https://github.com/Raynos/global/issues", - "email": "raynos2@gmail.com" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Raynos" - } - ], - "dependencies": { - "min-document": "^2.19.0", - "process": "^0.11.10" - }, - "deprecated": false, - "description": "Require global variables", - "devDependencies": { - "tape": "^2.12.0" - }, - "homepage": "https://github.com/Raynos/global", - "keywords": [], - "license": "MIT", - "main": "window.js", - "name": "global", - "repository": { - "type": "git", - "url": "git://github.com/Raynos/global.git" - }, - "scripts": { - "build": "browserify test/index.js -o test/static/bundle.js", - "test": "node ./test", - "testem": "testem" - }, - "testling": { - "files": "test/index.js", - "browsers": { - "ie": [ - "8", - "9", - "10" - ], - "firefox": [ - "16", - "17", - "nightly" - ], - "chrome": [ - "22", - "23", - "canary" - ], - "opera": [ - "12", - "next" - ], - "safari": [ - "5.1" - ] - } - }, - "version": "4.4.0" -} diff --git a/node_modules/global/process.js b/node_modules/global/process.js deleted file mode 100644 index 00a8e37..0000000 --- a/node_modules/global/process.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('process'); diff --git a/node_modules/global/window.js b/node_modules/global/window.js deleted file mode 100644 index ae6c11c..0000000 --- a/node_modules/global/window.js +++ /dev/null @@ -1,13 +0,0 @@ -var win; - -if (typeof window !== "undefined") { - win = window; -} else if (typeof global !== "undefined") { - win = global; -} else if (typeof self !== "undefined"){ - win = self; -} else { - win = {}; -} - -module.exports = win; diff --git a/node_modules/hint.css/.editorconfig b/node_modules/hint.css/.editorconfig deleted file mode 100644 index 0876270..0000000 --- a/node_modules/hint.css/.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -# editorconfig.org - -root = true - -[*] -charset = utf-8 -end_of_line = lf -indent_style = tab -insert_final_newline = true -trim_trailing_whitespace = true diff --git a/node_modules/hint.css/.prettierignore b/node_modules/hint.css/.prettierignore deleted file mode 100644 index 6c93ff1..0000000 --- a/node_modules/hint.css/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -hint.css -hint.min.css -hint.base.css -hint.base.min.css \ No newline at end of file diff --git a/node_modules/hint.css/CONTRIBUTING.md b/node_modules/hint.css/CONTRIBUTING.md deleted file mode 100644 index 0674378..0000000 --- a/node_modules/hint.css/CONTRIBUTING.md +++ /dev/null @@ -1,40 +0,0 @@ -**Hint** is written in [SASS](http://sass-lang.com/). - -#Setup -1. [Fork **Hint.css**](https://help.github.com/articles/fork-a-repo) and clone it on your system. -2. Create a new branch out off `master` for your fix/feature. `git checkout new-feature master` - -#Building - -**Hint.css** uses [Grunt](http://gruntjs.com/) for the build process which you need to have installed on your system. - -Also there are four additional Grunt tasks required to build the library: - -1. [grunt-contrib-cssmin](https://npmjs.org/package/grunt-contrib-cssmin) - -2. [grunt-sass](https://www.npmjs.com/package/grunt-sass) - -3. [grunt-contrib-concat](https://www.npmjs.com/package/grunt-contrib-concat) - -4. [grunt-contrib-watch](https://www.npmjs.com/package/grunt-contrib-watch) - -To install all the dependencies, run `npm install`. - -Once you have the dependencies installed, run `grunt` from the project directory. This will run the default grunt task which compiles the SCSS files into `hint.css` file. - -Though this should be sufficient for building the library for testing, in case you want to build the minified version as well you can run the `grunt deploy` command instead. - -#Things to remember -- Do not fix multiple issues in a single commit. Keep them one thing per commit so that they can be picked easily incase only few commits require to be merged. - -- For every new modifier (example `hint--success`, `hint--top`) added, make a separate file unless it fits into a current modifier file. - -- Before submitting a patch, rebase your branch on upstream `master` to make life easier for the merger. - -- **DO NOT** add the library builds (`hint.css` & `hint.min.css`) in your commits. - -#Stay in touch - -To catch all updates and discussion, join the mailing list: **hintcss@googlegroups.com**. - -To subscribe: **hintcss+subscribe@googlegroups.com** or visit [here](https://groups.google.com/forum/?fromgroups=#!forum/hintcss). diff --git a/node_modules/hint.css/Gruntfile.js b/node_modules/hint.css/Gruntfile.js deleted file mode 100644 index 1a36cd6..0000000 --- a/node_modules/hint.css/Gruntfile.js +++ /dev/null @@ -1,92 +0,0 @@ -/*global module:false*/ - -const sass = require("node-sass"); - -module.exports = function(grunt) { - // Project configuration. - grunt.initConfig({ - pkg: grunt.file.readJSON("package.json"), - - meta: { - getBanner: function() { - return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= meta.banner %>"; - }, - getBannerForBaseVersion: function() { - return "/*! <%= pkg.title || pkg.name %> (base version) - v<%= pkg.version %> - <%= meta.banner %>"; - }, - banner: - '<%= grunt.template.today("yyyy-mm-dd") + "\\n" %>' + - '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + - '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> */\n\n' - }, - - sass: { - options: { - implementation: sass, - sourceMap: false - }, - dist: { - files: { - "<%= pkg.name %>.css": "src/<%= pkg.name %>.scss", - "<%= pkg.name %>.base.css": "src/<%= pkg.name %>.base.scss" - } - } - }, - - cssmin: { - options: { - sourceMap: false - }, - compress: { - files: { - "<%= pkg.name %>.min.css": ["<%= pkg.name %>.css"], - "<%= pkg.name %>.base.min.css": ["<%= pkg.name %>.base.css"] - } - } - }, - - // concat banner to final lib files - concat: { - options: { - banner: "<%= meta.getBanner() %>" - }, - lib: { - src: ["<%= pkg.name %>.css"], - dest: "<%= pkg.name %>.css" - }, - minLib: { - src: ["<%= pkg.name %>.min.css"], - dest: "<%= pkg.name %>.min.css" - }, - baseLib: { - options: { - banner: "<%= meta.getBannerForBaseVersion() %>" - }, - src: ["<%= pkg.name %>.base.css"], - dest: "<%= pkg.name %>.base.css" - }, - baseMinLib: { - options: { - banner: "<%= meta.getBannerForBaseVersion() %>" - }, - src: ["<%= pkg.name %>.base.min.css"], - dest: "<%= pkg.name %>.base.min.css" - } - }, - - watch: { - files: "src/*.scss", - tasks: "default" - } - }); - - // Dependencies - grunt.loadNpmTasks("grunt-sass"); - grunt.loadNpmTasks("grunt-contrib-cssmin"); - grunt.loadNpmTasks("grunt-contrib-concat"); - grunt.loadNpmTasks("grunt-contrib-watch"); - - // Default task. - grunt.registerTask("default", "sass"); - grunt.registerTask("deploy", ["sass", "cssmin", "concat"]); -}; diff --git a/node_modules/hint.css/LICENSE.md b/node_modules/hint.css/LICENSE.md deleted file mode 100644 index ffd5e28..0000000 --- a/node_modules/hint.css/LICENSE.md +++ /dev/null @@ -1,673 +0,0 @@ -## License - -### Commercial License - -If you want to use Hint.css for business, commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary. Purchase a Hint.css Commercial License at https://site.uplabs.com/posts/hint-css - -### Open-source License - -Hint.css is free for personal use under the GNU AGPLv3. - -> Copyright (c) 2013-2016 Kushagra Gour - - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -. diff --git a/node_modules/hint.css/README.md b/node_modules/hint.css/README.md deleted file mode 100644 index fc3ec4f..0000000 --- a/node_modules/hint.css/README.md +++ /dev/null @@ -1,125 +0,0 @@ -# Hint.css [![npm version](https://badge.fury.io/js/hint.css.svg)](https://badge.fury.io/js/hint.css) ![downloads/month](https://img.shields.io/npm/dm/hint.css.svg) [![Join the chat at https://gitter.im/chinchang/hint.css](https://badges.gitter.im/chinchang/hint.css.svg)](https://gitter.im/chinchang/hint.css?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ![gzip size](http://img.badgesize.io/https://unpkg.com/hint.css/hint.min.css?compression=gzip&label=gzip%20size) -*A tooltip library in CSS for your lovely websites* - -[Demo](https://kushagragour.in/lab/hint/) • [Get started](#get-started) • [Who's using this?](#whos-using-this) • [Browser support](#browser-support) • [FAQs](#faqs) • [Contributing](#contributing) • [License](#license) - -`hint.css` is written as a pure CSS resource using which you can create cool accessible tooltips for your web app. It does not rely on JavaScript but rather uses **aria-label**/**data-* attribute**, **pseudo elements**, **content property** and **CSS3 transitions** to create the tooltips. Also it uses **BEM** naming convention particularly for the modifiers. - - - -## Get Started - -Get the library using one of the following ways: - -1. **GitHub** - - Full build - - [unminified] : https://raw.github.com/chinchang/hint.css/master/hint.css - - [minified] : https://raw.github.com/chinchang/hint.css/master/hint.min.css - - Base build *(Does not include color themes and fancy effects)* - - [unminified] : https://raw.github.com/chinchang/hint.css/master/hint.base.css - - [minified] : https://raw.github.com/chinchang/hint.css/master/hint.base.min.css - -2. **Bower** : `bower install hint.css` - -3. **npm**: `npm install --save hint.css` - -4. **CDN**: [http://www.jsdelivr.com/#!hint.css](http://www.jsdelivr.com/#!hint.css) or [https://cdnjs.com/libraries/hint.css](https://cdnjs.com/libraries/hint.css) - -Now include the library in the ``HEAD`` tag of your page: - -```html - -``` -or - -```html - -``` - -Now, all you need to do is give your element any position class and tooltip text using the `aria-label` attribute. -Note, if you don't want to use `aria-label` attribute, you can also specify the tooltip text using the `data-hint` attribute, but its recommended to use `aria-label` in support of accessibility. [Read more about aria-label](https://webaccessibility.withgoogle.com/unit?unit=6&lesson=10). - - -```html -Hello Sir, hover me. -``` - -Use it with other available modifiers in various combinations. Available modifiers: -- *Colors* - `hint--error`, `hint--info`, `hint--warning`, `hint--success` -- *Sizes* - `hint--small`, `hint--medium`, `hint--large` -- `hint--always` -- `hint--rounded` -- `hint--no-animate` -- `hint--bounce` - -## Upgrading from v1.x - -If you are already using v1.x, you may need to tweak certain position classes because of the way tooltips are positioned in v2. - -## Changing the prefix for class names - -Don't like BEM naming (`hint--`) or want to use your own prefix for the class names? - -Simply update `src/hint-variables.scss` and change the `$hintPrefix` variable. -To generate the css file, please read the [contributing page](./CONTRIBUTING.md). - -## Who's Using This? -- [Webflow Playground](http://playground.webflow.com/) -- [Panda chrome app](http://usepanda.com/) -- [Fiverr](https://www.fiverr.com/) -- [Stackshare](http://stackshare.io/) -- [Siftery](https://siftery.com/) -- [LessPass](https://lesspass.com/#/) -- [Tridiv](http://tridiv.com/) -- [Alm - TypeScript IDE](http://alm.tools/) -- [Prototyp](http://prototyp.in/) -- [Tradus](http://tradus.com/) -- [Web Maker](https://webmakerapp.com) -- [Tolks](https://tolks.io) -- [Formspree](http://formspree.io/) -- [codeMagic](http://codemagic.gr/) - -Are you using **hint.css** in your awesome project too? Just tweet it out to [@hint_css](https://twitter.com/hint_css) or let us know on the [mailing list](mailto:hintcss@googlegroups.com). - -## Browser Support -**hint.css** works on all latest browsers, though the transition effect is supported only on IE10+, Chrome 26+ and FF4+ at present. - -- Chrome - basic + transition effects -- Firefox - basic + transition effects -- Opera - basic -- Safari - basic -- IE 10+ - basic + transition effects -- IE 8 & 9 - basic - -### FAQs - -Checkout the [FAQ Wiki](https://github.com/chinchang/hint.css/wiki/Frequently-Asked-Questions) for some common gotchas to be aware of while using **hint.css**. - -## Contributing -`hint.css` is developed in SASS and the source files can be found in the `src/` directory. - -If you would like to create more types of tooltips/ fix bugs/ enhance the library etc. you are more than welcome to submit your pull requests. - -[Read more on contributing](./CONTRIBUTING.md). - -## Changelog & Updates -See the [Changelog](https://github.com/chinchang/hint.css/wiki/Changelog). - -To catch all updates and discussion, join the mailing list: [**hintcss@googlegroups.com**](https://groups.google.com/forum/?fromgroups=#!forum/hintcss). - -Or follow on twitter: [**@hint_css**](https://twitter.com/hint_css) - -## License - -### Commercial License - -If you want to use Hint.css for business, commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary. Purchase a Hint.css Commercial License at https://kushagragour.in/lab/hint/#commercial - -### Open-source License - -Hint.css is free for personal use under the GNU AGPLv3. - -## Credits -This doesn't make use of a lot of BEM methodology but big thanks to [@csswizardry](https://twitter.com/csswizardry), [@necolas](https://twitter.com/necolas) for their awesome articles on BEM and to [@joshnh](https://twitter.com/_joshnh) through whose work I came to know about it :) diff --git a/node_modules/hint.css/bower.json b/node_modules/hint.css/bower.json deleted file mode 100644 index 3dfd13d..0000000 --- a/node_modules/hint.css/bower.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "hint.css", - "main": "hint.min.css", - "author": "Kushagra Gour", - "ignore": [ - "CONTRIBUTING.md", - "Gruntfile.js" - ], - "keywords": [ - "hint", - "tooltip", - "tooltips", - "ui" - ] -} diff --git a/node_modules/hint.css/component.json b/node_modules/hint.css/component.json deleted file mode 100644 index 4430d7b..0000000 --- a/node_modules/hint.css/component.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "hint.css", - "repo": "chinchang/hint.css", - "description": "A tooltip library in CSS for your lovely websites.", - "version": "2.6.0", - "keywords": ["tooltip", "css"], - "dependencies": {}, - "development": {}, - "styles": [ - "hint.min.css" - ] -} - diff --git a/node_modules/hint.css/demo.html b/node_modules/hint.css/demo.html deleted file mode 100644 index f2fcd45..0000000 --- a/node_modules/hint.css/demo.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - Hint.css - A tooltip library in CSS - - - - - - - - - - - -
- -

Hint.css 2.0

-

A pure CSS tooltip library for your lovely websites

-
-
- -
-

Tryout

- -
-
-
- - - -
- Try hovering over different things -
- -
- -
- Upgrading from v1.x: If you are already using v1.x, you may need to tweak certain position classes because of the way tooltips are positioned in v2. -
- Its recommended to use aria-label attribute to specify your tooltip text in support of accessibility. Though, you can always use data-hint attribute instead. Read more about aria-label here. - -
-
- - - - - diff --git a/node_modules/hint.css/hint.base.css b/node_modules/hint.css/hint.base.css deleted file mode 100644 index c7647b9..0000000 --- a/node_modules/hint.css/hint.base.css +++ /dev/null @@ -1,466 +0,0 @@ -/*! Hint.css (base version) - v2.6.0 - 2019-04-27 -* http://kushagragour.in/lab/hint/ -* Copyright (c) 2019 Kushagra Gour */ - -/*-------------------------------------*\ - HINT.css - A CSS tooltip library -\*-------------------------------------*/ -/** - * HINT.css is a tooltip library made in pure CSS. - * - * Source: https://github.com/chinchang/hint.css - * Demo: http://kushagragour.in/lab/hint/ - * - */ -/** - * source: hint-core.scss - * - * Defines the basic styling for the tooltip. - * Each tooltip is made of 2 parts: - * 1) body (:after) - * 2) arrow (:before) - * - * Classes added: - * 1) hint - */ -[class*="hint--"] { - position: relative; - display: inline-block; - /** - * tooltip arrow - */ - /** - * tooltip body - */ } - [class*="hint--"]:before, [class*="hint--"]:after { - position: absolute; - -webkit-transform: translate3d(0, 0, 0); - -moz-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - visibility: hidden; - opacity: 0; - z-index: 1000000; - pointer-events: none; - -webkit-transition: 0.3s ease; - -moz-transition: 0.3s ease; - transition: 0.3s ease; - -webkit-transition-delay: 0ms; - -moz-transition-delay: 0ms; - transition-delay: 0ms; } - [class*="hint--"]:hover:before, [class*="hint--"]:hover:after { - visibility: visible; - opacity: 1; } - [class*="hint--"]:hover:before, [class*="hint--"]:hover:after { - -webkit-transition-delay: 100ms; - -moz-transition-delay: 100ms; - transition-delay: 100ms; } - [class*="hint--"]:before { - content: ''; - position: absolute; - background: transparent; - border: 6px solid transparent; - z-index: 1000001; } - [class*="hint--"]:after { - background: #383838; - color: white; - padding: 8px 10px; - font-size: 12px; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 12px; - white-space: nowrap; } - [class*="hint--"][aria-label]:after { - content: attr(aria-label); } - [class*="hint--"][data-hint]:after { - content: attr(data-hint); } - -[aria-label='']:before, [aria-label='']:after, -[data-hint='']:before, -[data-hint='']:after { - display: none !important; } - -/** - * source: hint-position.scss - * - * Defines the positoning logic for the tooltips. - * - * Classes added: - * 1) hint--top - * 2) hint--bottom - * 3) hint--left - * 4) hint--right - */ -/** - * set default color for tooltip arrows - */ -.hint--top-left:before { - border-top-color: #383838; } - -.hint--top-right:before { - border-top-color: #383838; } - -.hint--top:before { - border-top-color: #383838; } - -.hint--bottom-left:before { - border-bottom-color: #383838; } - -.hint--bottom-right:before { - border-bottom-color: #383838; } - -.hint--bottom:before { - border-bottom-color: #383838; } - -.hint--left:before { - border-left-color: #383838; } - -.hint--right:before { - border-right-color: #383838; } - -/** - * top tooltip - */ -.hint--top:before { - margin-bottom: -11px; } - -.hint--top:before, .hint--top:after { - bottom: 100%; - left: 50%; } - -.hint--top:before { - left: calc(50% - 6px); } - -.hint--top:after { - -webkit-transform: translateX(-50%); - -moz-transform: translateX(-50%); - transform: translateX(-50%); } - -.hint--top:hover:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--top:hover:after { - -webkit-transform: translateX(-50%) translateY(-8px); - -moz-transform: translateX(-50%) translateY(-8px); - transform: translateX(-50%) translateY(-8px); } - -/** - * bottom tooltip - */ -.hint--bottom:before { - margin-top: -11px; } - -.hint--bottom:before, .hint--bottom:after { - top: 100%; - left: 50%; } - -.hint--bottom:before { - left: calc(50% - 6px); } - -.hint--bottom:after { - -webkit-transform: translateX(-50%); - -moz-transform: translateX(-50%); - transform: translateX(-50%); } - -.hint--bottom:hover:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--bottom:hover:after { - -webkit-transform: translateX(-50%) translateY(8px); - -moz-transform: translateX(-50%) translateY(8px); - transform: translateX(-50%) translateY(8px); } - -/** - * right tooltip - */ -.hint--right:before { - margin-left: -11px; - margin-bottom: -6px; } - -.hint--right:after { - margin-bottom: -14px; } - -.hint--right:before, .hint--right:after { - left: 100%; - bottom: 50%; } - -.hint--right:hover:before { - -webkit-transform: translateX(8px); - -moz-transform: translateX(8px); - transform: translateX(8px); } - -.hint--right:hover:after { - -webkit-transform: translateX(8px); - -moz-transform: translateX(8px); - transform: translateX(8px); } - -/** - * left tooltip - */ -.hint--left:before { - margin-right: -11px; - margin-bottom: -6px; } - -.hint--left:after { - margin-bottom: -14px; } - -.hint--left:before, .hint--left:after { - right: 100%; - bottom: 50%; } - -.hint--left:hover:before { - -webkit-transform: translateX(-8px); - -moz-transform: translateX(-8px); - transform: translateX(-8px); } - -.hint--left:hover:after { - -webkit-transform: translateX(-8px); - -moz-transform: translateX(-8px); - transform: translateX(-8px); } - -/** - * top-left tooltip - */ -.hint--top-left:before { - margin-bottom: -11px; } - -.hint--top-left:before, .hint--top-left:after { - bottom: 100%; - left: 50%; } - -.hint--top-left:before { - left: calc(50% - 6px); } - -.hint--top-left:after { - -webkit-transform: translateX(-100%); - -moz-transform: translateX(-100%); - transform: translateX(-100%); } - -.hint--top-left:after { - margin-left: 12px; } - -.hint--top-left:hover:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--top-left:hover:after { - -webkit-transform: translateX(-100%) translateY(-8px); - -moz-transform: translateX(-100%) translateY(-8px); - transform: translateX(-100%) translateY(-8px); } - -/** - * top-right tooltip - */ -.hint--top-right:before { - margin-bottom: -11px; } - -.hint--top-right:before, .hint--top-right:after { - bottom: 100%; - left: 50%; } - -.hint--top-right:before { - left: calc(50% - 6px); } - -.hint--top-right:after { - -webkit-transform: translateX(0); - -moz-transform: translateX(0); - transform: translateX(0); } - -.hint--top-right:after { - margin-left: -12px; } - -.hint--top-right:hover:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--top-right:hover:after { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -/** - * bottom-left tooltip - */ -.hint--bottom-left:before { - margin-top: -11px; } - -.hint--bottom-left:before, .hint--bottom-left:after { - top: 100%; - left: 50%; } - -.hint--bottom-left:before { - left: calc(50% - 6px); } - -.hint--bottom-left:after { - -webkit-transform: translateX(-100%); - -moz-transform: translateX(-100%); - transform: translateX(-100%); } - -.hint--bottom-left:after { - margin-left: 12px; } - -.hint--bottom-left:hover:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--bottom-left:hover:after { - -webkit-transform: translateX(-100%) translateY(8px); - -moz-transform: translateX(-100%) translateY(8px); - transform: translateX(-100%) translateY(8px); } - -/** - * bottom-right tooltip - */ -.hint--bottom-right:before { - margin-top: -11px; } - -.hint--bottom-right:before, .hint--bottom-right:after { - top: 100%; - left: 50%; } - -.hint--bottom-right:before { - left: calc(50% - 6px); } - -.hint--bottom-right:after { - -webkit-transform: translateX(0); - -moz-transform: translateX(0); - transform: translateX(0); } - -.hint--bottom-right:after { - margin-left: -12px; } - -.hint--bottom-right:hover:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--bottom-right:hover:after { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -/** - * source: hint-sizes.scss - * - * Defines width restricted tooltips that can span - * across multiple lines. - * - * Classes added: - * 1) hint--small - * 2) hint--medium - * 3) hint--large - * - */ -.hint--small:after, -.hint--medium:after, -.hint--large:after { - white-space: normal; - line-height: 1.4em; - word-wrap: break-word; } - -.hint--small:after { - width: 80px; } - -.hint--medium:after { - width: 150px; } - -.hint--large:after { - width: 300px; } - -/** - * source: hint-always.scss - * - * Defines a persisted tooltip which shows always. - * - * Classes added: - * 1) hint--always - * - */ -.hint--always:after, .hint--always:before { - opacity: 1; - visibility: visible; } - -.hint--always.hint--top:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--always.hint--top:after { - -webkit-transform: translateX(-50%) translateY(-8px); - -moz-transform: translateX(-50%) translateY(-8px); - transform: translateX(-50%) translateY(-8px); } - -.hint--always.hint--top-left:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--always.hint--top-left:after { - -webkit-transform: translateX(-100%) translateY(-8px); - -moz-transform: translateX(-100%) translateY(-8px); - transform: translateX(-100%) translateY(-8px); } - -.hint--always.hint--top-right:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--always.hint--top-right:after { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--always.hint--bottom:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--always.hint--bottom:after { - -webkit-transform: translateX(-50%) translateY(8px); - -moz-transform: translateX(-50%) translateY(8px); - transform: translateX(-50%) translateY(8px); } - -.hint--always.hint--bottom-left:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--always.hint--bottom-left:after { - -webkit-transform: translateX(-100%) translateY(8px); - -moz-transform: translateX(-100%) translateY(8px); - transform: translateX(-100%) translateY(8px); } - -.hint--always.hint--bottom-right:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--always.hint--bottom-right:after { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--always.hint--left:before { - -webkit-transform: translateX(-8px); - -moz-transform: translateX(-8px); - transform: translateX(-8px); } - -.hint--always.hint--left:after { - -webkit-transform: translateX(-8px); - -moz-transform: translateX(-8px); - transform: translateX(-8px); } - -.hint--always.hint--right:before { - -webkit-transform: translateX(8px); - -moz-transform: translateX(8px); - transform: translateX(8px); } - -.hint--always.hint--right:after { - -webkit-transform: translateX(8px); - -moz-transform: translateX(8px); - transform: translateX(8px); } diff --git a/node_modules/hint.css/hint.base.min.css b/node_modules/hint.css/hint.base.min.css deleted file mode 100644 index ef1a3d0..0000000 --- a/node_modules/hint.css/hint.base.min.css +++ /dev/null @@ -1,5 +0,0 @@ -/*! Hint.css (base version) - v2.6.0 - 2019-04-27 -* http://kushagragour.in/lab/hint/ -* Copyright (c) 2019 Kushagra Gour */ - -[class*=hint--]{position:relative;display:inline-block}[class*=hint--]:after,[class*=hint--]:before{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translate3d(0,0,0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0s;-moz-transition-delay:0s;transition-delay:0s}[class*=hint--]:hover:after,[class*=hint--]:hover:before{visibility:visible;opacity:1;-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}[class*=hint--]:before{content:'';position:absolute;background:0 0;border:6px solid transparent;z-index:1000001}[class*=hint--]:after{background:#383838;color:#fff;padding:8px 10px;font-size:12px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}[class*=hint--][aria-label]:after{content:attr(aria-label)}[class*=hint--][data-hint]:after{content:attr(data-hint)}[aria-label='']:after,[aria-label='']:before,[data-hint='']:after,[data-hint='']:before{display:none!important}.hint--top-left:before,.hint--top-right:before,.hint--top:before{border-top-color:#383838}.hint--bottom-left:before,.hint--bottom-right:before,.hint--bottom:before{border-bottom-color:#383838}.hint--top:after,.hint--top:before{bottom:100%;left:50%}.hint--top:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translateX(-50%)}.hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translateX(-50%) translateY(-8px)}.hint--bottom:after,.hint--bottom:before{top:100%;left:50%}.hint--bottom:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translateX(-50%)}.hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translateX(-50%) translateY(8px)}.hint--right:before{border-right-color:#383838;margin-left:-11px;margin-bottom:-6px}.hint--right:after{margin-bottom:-14px}.hint--right:after,.hint--right:before{left:100%;bottom:50%}.hint--right:hover:after,.hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translateX(8px)}.hint--left:before{border-left-color:#383838;margin-right:-11px;margin-bottom:-6px}.hint--left:after{margin-bottom:-14px}.hint--left:after,.hint--left:before{right:100%;bottom:50%}.hint--left:hover:after,.hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translateX(-8px)}.hint--top-left:after,.hint--top-left:before{bottom:100%;left:50%}.hint--top-left:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translateX(-100%);margin-left:12px}.hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translateX(-100%) translateY(-8px)}.hint--top-right:after,.hint--top-right:before{bottom:100%;left:50%}.hint--top-right:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translateX(0);margin-left:-12px}.hint--top-right:hover:after,.hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--bottom-left:after,.hint--bottom-left:before{top:100%;left:50%}.hint--bottom-left:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translateX(-100%);margin-left:12px}.hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translateX(-100%) translateY(8px)}.hint--bottom-right:after,.hint--bottom-right:before{top:100%;left:50%}.hint--bottom-right:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translateX(0);margin-left:-12px}.hint--bottom-right:hover:after,.hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--large:after,.hint--medium:after,.hint--small:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.hint--small:after{width:80px}.hint--medium:after{width:150px}.hint--large:after{width:300px}.hint--always:after,.hint--always:before{opacity:1;visibility:visible}.hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translateX(-50%) translateY(-8px)}.hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translateX(-100%) translateY(-8px)}.hint--always.hint--top-right:after,.hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translateX(-50%) translateY(8px)}.hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translateX(-100%) translateY(8px)}.hint--always.hint--bottom-right:after,.hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--left:after,.hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translateX(-8px)}.hint--always.hint--right:after,.hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translateX(8px)} \ No newline at end of file diff --git a/node_modules/hint.css/hint.css b/node_modules/hint.css/hint.css deleted file mode 100644 index 68df0f1..0000000 --- a/node_modules/hint.css/hint.css +++ /dev/null @@ -1,652 +0,0 @@ -/*! Hint.css - v2.6.0 - 2019-04-27 -* http://kushagragour.in/lab/hint/ -* Copyright (c) 2019 Kushagra Gour */ - -/*-------------------------------------*\ - HINT.css - A CSS tooltip library -\*-------------------------------------*/ -/** - * HINT.css is a tooltip library made in pure CSS. - * - * Source: https://github.com/chinchang/hint.css - * Demo: http://kushagragour.in/lab/hint/ - * - */ -/** - * source: hint-core.scss - * - * Defines the basic styling for the tooltip. - * Each tooltip is made of 2 parts: - * 1) body (:after) - * 2) arrow (:before) - * - * Classes added: - * 1) hint - */ -[class*="hint--"] { - position: relative; - display: inline-block; - /** - * tooltip arrow - */ - /** - * tooltip body - */ } - [class*="hint--"]:before, [class*="hint--"]:after { - position: absolute; - -webkit-transform: translate3d(0, 0, 0); - -moz-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - visibility: hidden; - opacity: 0; - z-index: 1000000; - pointer-events: none; - -webkit-transition: 0.3s ease; - -moz-transition: 0.3s ease; - transition: 0.3s ease; - -webkit-transition-delay: 0ms; - -moz-transition-delay: 0ms; - transition-delay: 0ms; } - [class*="hint--"]:hover:before, [class*="hint--"]:hover:after { - visibility: visible; - opacity: 1; } - [class*="hint--"]:hover:before, [class*="hint--"]:hover:after { - -webkit-transition-delay: 100ms; - -moz-transition-delay: 100ms; - transition-delay: 100ms; } - [class*="hint--"]:before { - content: ''; - position: absolute; - background: transparent; - border: 6px solid transparent; - z-index: 1000001; } - [class*="hint--"]:after { - background: #383838; - color: white; - padding: 8px 10px; - font-size: 12px; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 12px; - white-space: nowrap; } - [class*="hint--"][aria-label]:after { - content: attr(aria-label); } - [class*="hint--"][data-hint]:after { - content: attr(data-hint); } - -[aria-label='']:before, [aria-label='']:after, -[data-hint='']:before, -[data-hint='']:after { - display: none !important; } - -/** - * source: hint-position.scss - * - * Defines the positoning logic for the tooltips. - * - * Classes added: - * 1) hint--top - * 2) hint--bottom - * 3) hint--left - * 4) hint--right - */ -/** - * set default color for tooltip arrows - */ -.hint--top-left:before { - border-top-color: #383838; } - -.hint--top-right:before { - border-top-color: #383838; } - -.hint--top:before { - border-top-color: #383838; } - -.hint--bottom-left:before { - border-bottom-color: #383838; } - -.hint--bottom-right:before { - border-bottom-color: #383838; } - -.hint--bottom:before { - border-bottom-color: #383838; } - -.hint--left:before { - border-left-color: #383838; } - -.hint--right:before { - border-right-color: #383838; } - -/** - * top tooltip - */ -.hint--top:before { - margin-bottom: -11px; } - -.hint--top:before, .hint--top:after { - bottom: 100%; - left: 50%; } - -.hint--top:before { - left: calc(50% - 6px); } - -.hint--top:after { - -webkit-transform: translateX(-50%); - -moz-transform: translateX(-50%); - transform: translateX(-50%); } - -.hint--top:hover:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--top:hover:after { - -webkit-transform: translateX(-50%) translateY(-8px); - -moz-transform: translateX(-50%) translateY(-8px); - transform: translateX(-50%) translateY(-8px); } - -/** - * bottom tooltip - */ -.hint--bottom:before { - margin-top: -11px; } - -.hint--bottom:before, .hint--bottom:after { - top: 100%; - left: 50%; } - -.hint--bottom:before { - left: calc(50% - 6px); } - -.hint--bottom:after { - -webkit-transform: translateX(-50%); - -moz-transform: translateX(-50%); - transform: translateX(-50%); } - -.hint--bottom:hover:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--bottom:hover:after { - -webkit-transform: translateX(-50%) translateY(8px); - -moz-transform: translateX(-50%) translateY(8px); - transform: translateX(-50%) translateY(8px); } - -/** - * right tooltip - */ -.hint--right:before { - margin-left: -11px; - margin-bottom: -6px; } - -.hint--right:after { - margin-bottom: -14px; } - -.hint--right:before, .hint--right:after { - left: 100%; - bottom: 50%; } - -.hint--right:hover:before { - -webkit-transform: translateX(8px); - -moz-transform: translateX(8px); - transform: translateX(8px); } - -.hint--right:hover:after { - -webkit-transform: translateX(8px); - -moz-transform: translateX(8px); - transform: translateX(8px); } - -/** - * left tooltip - */ -.hint--left:before { - margin-right: -11px; - margin-bottom: -6px; } - -.hint--left:after { - margin-bottom: -14px; } - -.hint--left:before, .hint--left:after { - right: 100%; - bottom: 50%; } - -.hint--left:hover:before { - -webkit-transform: translateX(-8px); - -moz-transform: translateX(-8px); - transform: translateX(-8px); } - -.hint--left:hover:after { - -webkit-transform: translateX(-8px); - -moz-transform: translateX(-8px); - transform: translateX(-8px); } - -/** - * top-left tooltip - */ -.hint--top-left:before { - margin-bottom: -11px; } - -.hint--top-left:before, .hint--top-left:after { - bottom: 100%; - left: 50%; } - -.hint--top-left:before { - left: calc(50% - 6px); } - -.hint--top-left:after { - -webkit-transform: translateX(-100%); - -moz-transform: translateX(-100%); - transform: translateX(-100%); } - -.hint--top-left:after { - margin-left: 12px; } - -.hint--top-left:hover:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--top-left:hover:after { - -webkit-transform: translateX(-100%) translateY(-8px); - -moz-transform: translateX(-100%) translateY(-8px); - transform: translateX(-100%) translateY(-8px); } - -/** - * top-right tooltip - */ -.hint--top-right:before { - margin-bottom: -11px; } - -.hint--top-right:before, .hint--top-right:after { - bottom: 100%; - left: 50%; } - -.hint--top-right:before { - left: calc(50% - 6px); } - -.hint--top-right:after { - -webkit-transform: translateX(0); - -moz-transform: translateX(0); - transform: translateX(0); } - -.hint--top-right:after { - margin-left: -12px; } - -.hint--top-right:hover:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--top-right:hover:after { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -/** - * bottom-left tooltip - */ -.hint--bottom-left:before { - margin-top: -11px; } - -.hint--bottom-left:before, .hint--bottom-left:after { - top: 100%; - left: 50%; } - -.hint--bottom-left:before { - left: calc(50% - 6px); } - -.hint--bottom-left:after { - -webkit-transform: translateX(-100%); - -moz-transform: translateX(-100%); - transform: translateX(-100%); } - -.hint--bottom-left:after { - margin-left: 12px; } - -.hint--bottom-left:hover:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--bottom-left:hover:after { - -webkit-transform: translateX(-100%) translateY(8px); - -moz-transform: translateX(-100%) translateY(8px); - transform: translateX(-100%) translateY(8px); } - -/** - * bottom-right tooltip - */ -.hint--bottom-right:before { - margin-top: -11px; } - -.hint--bottom-right:before, .hint--bottom-right:after { - top: 100%; - left: 50%; } - -.hint--bottom-right:before { - left: calc(50% - 6px); } - -.hint--bottom-right:after { - -webkit-transform: translateX(0); - -moz-transform: translateX(0); - transform: translateX(0); } - -.hint--bottom-right:after { - margin-left: -12px; } - -.hint--bottom-right:hover:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--bottom-right:hover:after { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -/** - * source: hint-sizes.scss - * - * Defines width restricted tooltips that can span - * across multiple lines. - * - * Classes added: - * 1) hint--small - * 2) hint--medium - * 3) hint--large - * - */ -.hint--small:after, -.hint--medium:after, -.hint--large:after { - white-space: normal; - line-height: 1.4em; - word-wrap: break-word; } - -.hint--small:after { - width: 80px; } - -.hint--medium:after { - width: 150px; } - -.hint--large:after { - width: 300px; } - -/** - * source: hint-theme.scss - * - * Defines basic theme for tooltips. - * - */ -[class*="hint--"] { - /** - * tooltip body - */ } - [class*="hint--"]:after { - text-shadow: 0 -1px 0px black; - box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3); } - -/** - * source: hint-color-types.scss - * - * Contains tooltips of various types based on color differences. - * - * Classes added: - * 1) hint--error - * 2) hint--warning - * 3) hint--info - * 4) hint--success - * - */ -/** - * Error - */ -.hint--error:after { - background-color: #b34e4d; - text-shadow: 0 -1px 0px #592726; } - -.hint--error.hint--top-left:before { - border-top-color: #b34e4d; } - -.hint--error.hint--top-right:before { - border-top-color: #b34e4d; } - -.hint--error.hint--top:before { - border-top-color: #b34e4d; } - -.hint--error.hint--bottom-left:before { - border-bottom-color: #b34e4d; } - -.hint--error.hint--bottom-right:before { - border-bottom-color: #b34e4d; } - -.hint--error.hint--bottom:before { - border-bottom-color: #b34e4d; } - -.hint--error.hint--left:before { - border-left-color: #b34e4d; } - -.hint--error.hint--right:before { - border-right-color: #b34e4d; } - -/** - * Warning - */ -.hint--warning:after { - background-color: #c09854; - text-shadow: 0 -1px 0px #6c5328; } - -.hint--warning.hint--top-left:before { - border-top-color: #c09854; } - -.hint--warning.hint--top-right:before { - border-top-color: #c09854; } - -.hint--warning.hint--top:before { - border-top-color: #c09854; } - -.hint--warning.hint--bottom-left:before { - border-bottom-color: #c09854; } - -.hint--warning.hint--bottom-right:before { - border-bottom-color: #c09854; } - -.hint--warning.hint--bottom:before { - border-bottom-color: #c09854; } - -.hint--warning.hint--left:before { - border-left-color: #c09854; } - -.hint--warning.hint--right:before { - border-right-color: #c09854; } - -/** - * Info - */ -.hint--info:after { - background-color: #3986ac; - text-shadow: 0 -1px 0px #1a3c4d; } - -.hint--info.hint--top-left:before { - border-top-color: #3986ac; } - -.hint--info.hint--top-right:before { - border-top-color: #3986ac; } - -.hint--info.hint--top:before { - border-top-color: #3986ac; } - -.hint--info.hint--bottom-left:before { - border-bottom-color: #3986ac; } - -.hint--info.hint--bottom-right:before { - border-bottom-color: #3986ac; } - -.hint--info.hint--bottom:before { - border-bottom-color: #3986ac; } - -.hint--info.hint--left:before { - border-left-color: #3986ac; } - -.hint--info.hint--right:before { - border-right-color: #3986ac; } - -/** - * Success - */ -.hint--success:after { - background-color: #458746; - text-shadow: 0 -1px 0px #1a321a; } - -.hint--success.hint--top-left:before { - border-top-color: #458746; } - -.hint--success.hint--top-right:before { - border-top-color: #458746; } - -.hint--success.hint--top:before { - border-top-color: #458746; } - -.hint--success.hint--bottom-left:before { - border-bottom-color: #458746; } - -.hint--success.hint--bottom-right:before { - border-bottom-color: #458746; } - -.hint--success.hint--bottom:before { - border-bottom-color: #458746; } - -.hint--success.hint--left:before { - border-left-color: #458746; } - -.hint--success.hint--right:before { - border-right-color: #458746; } - -/** - * source: hint-always.scss - * - * Defines a persisted tooltip which shows always. - * - * Classes added: - * 1) hint--always - * - */ -.hint--always:after, .hint--always:before { - opacity: 1; - visibility: visible; } - -.hint--always.hint--top:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--always.hint--top:after { - -webkit-transform: translateX(-50%) translateY(-8px); - -moz-transform: translateX(-50%) translateY(-8px); - transform: translateX(-50%) translateY(-8px); } - -.hint--always.hint--top-left:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--always.hint--top-left:after { - -webkit-transform: translateX(-100%) translateY(-8px); - -moz-transform: translateX(-100%) translateY(-8px); - transform: translateX(-100%) translateY(-8px); } - -.hint--always.hint--top-right:before { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--always.hint--top-right:after { - -webkit-transform: translateY(-8px); - -moz-transform: translateY(-8px); - transform: translateY(-8px); } - -.hint--always.hint--bottom:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--always.hint--bottom:after { - -webkit-transform: translateX(-50%) translateY(8px); - -moz-transform: translateX(-50%) translateY(8px); - transform: translateX(-50%) translateY(8px); } - -.hint--always.hint--bottom-left:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--always.hint--bottom-left:after { - -webkit-transform: translateX(-100%) translateY(8px); - -moz-transform: translateX(-100%) translateY(8px); - transform: translateX(-100%) translateY(8px); } - -.hint--always.hint--bottom-right:before { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--always.hint--bottom-right:after { - -webkit-transform: translateY(8px); - -moz-transform: translateY(8px); - transform: translateY(8px); } - -.hint--always.hint--left:before { - -webkit-transform: translateX(-8px); - -moz-transform: translateX(-8px); - transform: translateX(-8px); } - -.hint--always.hint--left:after { - -webkit-transform: translateX(-8px); - -moz-transform: translateX(-8px); - transform: translateX(-8px); } - -.hint--always.hint--right:before { - -webkit-transform: translateX(8px); - -moz-transform: translateX(8px); - transform: translateX(8px); } - -.hint--always.hint--right:after { - -webkit-transform: translateX(8px); - -moz-transform: translateX(8px); - transform: translateX(8px); } - -/** - * source: hint-rounded.scss - * - * Defines rounded corner tooltips. - * - * Classes added: - * 1) hint--rounded - * - */ -.hint--rounded:after { - border-radius: 4px; } - -/** - * source: hint-effects.scss - * - * Defines various transition effects for the tooltips. - * - * Classes added: - * 1) hint--no-animate - * 2) hint--bounce - * - */ -.hint--no-animate:before, .hint--no-animate:after { - -webkit-transition-duration: 0ms; - -moz-transition-duration: 0ms; - transition-duration: 0ms; } - -.hint--bounce:before, .hint--bounce:after { - -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24); - -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24); - transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24); } - -.hint--no-shadow:before, .hint--no-shadow:after { - text-shadow: initial; - box-shadow: initial; } diff --git a/node_modules/hint.css/hint.min.css b/node_modules/hint.css/hint.min.css deleted file mode 100644 index 76edc4e..0000000 --- a/node_modules/hint.css/hint.min.css +++ /dev/null @@ -1,5 +0,0 @@ -/*! Hint.css - v2.6.0 - 2019-04-27 -* http://kushagragour.in/lab/hint/ -* Copyright (c) 2019 Kushagra Gour */ - -[class*=hint--]{position:relative;display:inline-block}[class*=hint--]:after,[class*=hint--]:before{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translate3d(0,0,0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0s;-moz-transition-delay:0s;transition-delay:0s}[class*=hint--]:hover:after,[class*=hint--]:hover:before{visibility:visible;opacity:1;-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}[class*=hint--]:before{content:'';position:absolute;background:0 0;border:6px solid transparent;z-index:1000001}[class*=hint--]:after{background:#383838;color:#fff;padding:8px 10px;font-size:12px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap;text-shadow:0 -1px 0 #000;box-shadow:4px 4px 8px rgba(0,0,0,.3)}[class*=hint--][aria-label]:after{content:attr(aria-label)}[class*=hint--][data-hint]:after{content:attr(data-hint)}[aria-label='']:after,[aria-label='']:before,[data-hint='']:after,[data-hint='']:before{display:none!important}.hint--top-left:before,.hint--top-right:before,.hint--top:before{border-top-color:#383838}.hint--bottom-left:before,.hint--bottom-right:before,.hint--bottom:before{border-bottom-color:#383838}.hint--top:after,.hint--top:before{bottom:100%;left:50%}.hint--top:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translateX(-50%)}.hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translateX(-50%) translateY(-8px)}.hint--bottom:after,.hint--bottom:before{top:100%;left:50%}.hint--bottom:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translateX(-50%)}.hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translateX(-50%) translateY(8px)}.hint--right:before{border-right-color:#383838;margin-left:-11px;margin-bottom:-6px}.hint--right:after{margin-bottom:-14px}.hint--right:after,.hint--right:before{left:100%;bottom:50%}.hint--right:hover:after,.hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translateX(8px)}.hint--left:before{border-left-color:#383838;margin-right:-11px;margin-bottom:-6px}.hint--left:after{margin-bottom:-14px}.hint--left:after,.hint--left:before{right:100%;bottom:50%}.hint--left:hover:after,.hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translateX(-8px)}.hint--top-left:after,.hint--top-left:before{bottom:100%;left:50%}.hint--top-left:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translateX(-100%);margin-left:12px}.hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translateX(-100%) translateY(-8px)}.hint--top-right:after,.hint--top-right:before{bottom:100%;left:50%}.hint--top-right:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translateX(0);margin-left:-12px}.hint--top-right:hover:after,.hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--bottom-left:after,.hint--bottom-left:before{top:100%;left:50%}.hint--bottom-left:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translateX(-100%);margin-left:12px}.hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translateX(-100%) translateY(8px)}.hint--bottom-right:after,.hint--bottom-right:before{top:100%;left:50%}.hint--bottom-right:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translateX(0);margin-left:-12px}.hint--bottom-right:hover:after,.hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--large:after,.hint--medium:after,.hint--small:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.hint--small:after{width:80px}.hint--medium:after{width:150px}.hint--large:after{width:300px}.hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0 #592726}.hint--error.hint--top-left:before,.hint--error.hint--top-right:before,.hint--error.hint--top:before{border-top-color:#b34e4d}.hint--error.hint--bottom-left:before,.hint--error.hint--bottom-right:before,.hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.hint--error.hint--left:before{border-left-color:#b34e4d}.hint--error.hint--right:before{border-right-color:#b34e4d}.hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0 #6c5328}.hint--warning.hint--top-left:before,.hint--warning.hint--top-right:before,.hint--warning.hint--top:before{border-top-color:#c09854}.hint--warning.hint--bottom-left:before,.hint--warning.hint--bottom-right:before,.hint--warning.hint--bottom:before{border-bottom-color:#c09854}.hint--warning.hint--left:before{border-left-color:#c09854}.hint--warning.hint--right:before{border-right-color:#c09854}.hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0 #1a3c4d}.hint--info.hint--top-left:before,.hint--info.hint--top-right:before,.hint--info.hint--top:before{border-top-color:#3986ac}.hint--info.hint--bottom-left:before,.hint--info.hint--bottom-right:before,.hint--info.hint--bottom:before{border-bottom-color:#3986ac}.hint--info.hint--left:before{border-left-color:#3986ac}.hint--info.hint--right:before{border-right-color:#3986ac}.hint--success:after{background-color:#458746;text-shadow:0 -1px 0 #1a321a}.hint--success.hint--top-left:before,.hint--success.hint--top-right:before,.hint--success.hint--top:before{border-top-color:#458746}.hint--success.hint--bottom-left:before,.hint--success.hint--bottom-right:before,.hint--success.hint--bottom:before{border-bottom-color:#458746}.hint--success.hint--left:before{border-left-color:#458746}.hint--success.hint--right:before{border-right-color:#458746}.hint--always:after,.hint--always:before{opacity:1;visibility:visible}.hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translateX(-50%) translateY(-8px)}.hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translateX(-100%) translateY(-8px)}.hint--always.hint--top-right:after,.hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translateX(-50%) translateY(8px)}.hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translateX(-100%) translateY(8px)}.hint--always.hint--bottom-right:after,.hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--left:after,.hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translateX(-8px)}.hint--always.hint--right:after,.hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translateX(8px)}.hint--rounded:after{border-radius:4px}.hint--no-animate:after,.hint--no-animate:before{-webkit-transition-duration:0s;-moz-transition-duration:0s;transition-duration:0s}.hint--bounce:after,.hint--bounce:before{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.hint--no-shadow:after,.hint--no-shadow:before{text-shadow:initial;box-shadow:initial} \ No newline at end of file diff --git a/node_modules/hint.css/package.json b/node_modules/hint.css/package.json deleted file mode 100644 index 8dc895d..0000000 --- a/node_modules/hint.css/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "_args": [ - [ - "hint.css@2.6.0", - "F:\\Documents\\websites\\BMM" - ] - ], - "_from": "hint.css@2.6.0", - "_id": "hint.css@2.6.0", - "_inBundle": false, - "_integrity": "sha512-SnCLQOoPQt4fuHbOOvEL3UZwL0SPFtKMN4YIxAvBTe4oFUtBAT4R2Kk1uk3x5hgN+0xzOb6LFEQf5StbYfNm8w==", - "_location": "/hint.css", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "hint.css@2.6.0", - "name": "hint.css", - "escapedName": "hint.css", - "rawSpec": "2.6.0", - "saveSpec": null, - "fetchSpec": "2.6.0" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/hint.css/-/hint.css-2.6.0.tgz", - "_spec": "2.6.0", - "_where": "F:\\Documents\\websites\\BMM", - "author": { - "name": "Kushagra Gour", - "email": "chinchang457@gmail.com", - "url": "http://kushagragour.in" - }, - "bugs": { - "url": "https://github.com/chinchang/hint.css/issues" - }, - "description": "A tooltip library in CSS for your lovely websites.", - "devDependencies": { - "grunt": "~0.4.1", - "grunt-contrib-concat": "~0.3.0", - "grunt-contrib-cssmin": "~0.12.3", - "grunt-contrib-watch": "~0.5.3", - "grunt-sass": "^3.0.2", - "node-sass": "^4.10.0" - }, - "homepage": "http://kushagragour.in/lab/hint/", - "keywords": [ - "tooltip", - "ui", - "sass", - "css", - "help", - "hint" - ], - "license": "See LICENSE.md", - "main": "hint.css", - "name": "hint.css", - "repository": { - "type": "git", - "url": "git://github.com/chinchang/hint.css.git" - }, - "style": "hint.css", - "title": "Hint.css", - "version": "2.6.0" -} diff --git a/node_modules/hint.css/src/hint-always.scss b/node_modules/hint.css/src/hint-always.scss deleted file mode 100644 index 87c06d4..0000000 --- a/node_modules/hint.css/src/hint-always.scss +++ /dev/null @@ -1,46 +0,0 @@ -/** - * source: hint-always.scss - * - * Defines a persisted tooltip which shows always. - * - * Classes added: - * 1) hint--always - * - */ - -.#{$hintPrefix}always { - &:after, &:before { - opacity: 1; - visibility: visible; - } - - &.#{$hintPrefix}top { - @include set-margin('translateY', -1, -50%); - - &-left { - @include set-margin('translateY', -1, -100%); - } - &-right { - @include set-margin('translateY', -1, 0); - } - } - - &.#{$hintPrefix}bottom { - @include set-margin('translateY', 1, -50%); - &-left { - @include set-margin('translateY', 1, -100%); - } - &-right { - @include set-margin('translateY', 1, 0); - } - } - - &.#{$hintPrefix}left { - @include set-margin('translateX', -1); - } - - &.#{$hintPrefix}right { - @include set-margin('translateX', 1); - } -} - diff --git a/node_modules/hint.css/src/hint-color-types.scss b/node_modules/hint.css/src/hint-color-types.scss deleted file mode 100644 index 15de885..0000000 --- a/node_modules/hint.css/src/hint-color-types.scss +++ /dev/null @@ -1,52 +0,0 @@ -/** - * source: hint-color-types.scss - * - * Contains tooltips of various types based on color differences. - * - * Classes added: - * 1) hint--error - * 2) hint--warning - * 3) hint--info - * 4) hint--success - * - */ - - -// mixin to generate different color style tooltips -@mixin hint-type($color) { - &:after { - background-color: $color; - text-shadow: 0 -1px 0px darken($color, $hintTextShadowDarkenAmount); - } - - // generate arrow color style - @include arrow-border-color($color); -} - -/** - * Error - */ -.#{$hintPrefix}error { - @include hint-type($hintErrorColor); -} - -/** - * Warning - */ -.#{$hintPrefix}warning { - @include hint-type($hintWarningColor) -} - -/** - * Info - */ -.#{$hintPrefix}info { - @include hint-type($hintInfoColor) -} - -/** - * Success - */ -.#{$hintPrefix}success { - @include hint-type($hintSuccessColor) -} diff --git a/node_modules/hint.css/src/hint-core.scss b/node_modules/hint.css/src/hint-core.scss deleted file mode 100644 index 9a33998..0000000 --- a/node_modules/hint.css/src/hint-core.scss +++ /dev/null @@ -1,88 +0,0 @@ -/** - * source: hint-core.scss - * - * Defines the basic styling for the tooltip. - * Each tooltip is made of 2 parts: - * 1) body (:after) - * 2) arrow (:before) - * - * Classes added: - * 1) hint - */ - -[class*="#{$hintPrefix}"] { - position: relative; - display: inline-block; - - &:before, &:after { - position: absolute; - - // HACK: Trigger hardware accelerated rendering, otherwise transform was not - // working on a hidden element - @include vendor('transform', translate3d(0, 0, 0)); - - // HACK: visibility is set to hidden because IE & Opera don't support - // pointer-events on HTML content yet because of which hovering a hidden tooltip - // shows the tooltip. - visibility: hidden; - opacity: 0; - z-index: $hintZIndex; - // shouldn't receive pointer events, otherwise even hovering tooltip will make it appear - pointer-events: none; - - @include vendor('transition', $hintTransitionDuration ease); - @include vendor('transition-delay', $hintHideDelay); - } - - &:hover:before, &:hover:after { - visibility: visible; - opacity: 1; - } - - &:hover:before, &:hover:after { - // $hintShowDelay will apply as soon as element is hovered. - @include vendor('transition-delay', $hintShowDelay); - } - - /** - * tooltip arrow - */ - &:before { - content: ''; - position: absolute; - background: transparent; - border: $hintArrowBorderWidth solid transparent; - // move z-index 1 up than :after so that it shows over box-shadow - z-index: $hintZIndex + 1; - } - - /** - * tooltip body - */ - &:after { - background: $hintDefaultColor; - color: white; - padding: $hintVerticalPadding $hintHorizontalPadding; - font-size: $hintFontSize; - font-family: $hintFontFamily; - line-height: $hintFontSize; // Vertical centering. - white-space: nowrap; // Prevent breaking to new line. - } - // Always get content from aria-label attribute. - &[aria-label]:after { - content: attr(aria-label); // The magic! - } - // If the `data-hint` attribute is present, use it. - // This might be deprecated in future in support of a11y. - &[data-hint]:after { - content: attr(data-hint); // The magic! - } -} - -// Hide tooltips if any of the supported attributes is empty. -[aria-label=''], -[data-hint=''] { - &:before, &:after { - display: none !important; - } -} diff --git a/node_modules/hint.css/src/hint-effects.scss b/node_modules/hint.css/src/hint-effects.scss deleted file mode 100644 index c57e1d4..0000000 --- a/node_modules/hint.css/src/hint-effects.scss +++ /dev/null @@ -1,34 +0,0 @@ -/** - * source: hint-effects.scss - * - * Defines various transition effects for the tooltips. - * - * Classes added: - * 1) hint--no-animate - * 2) hint--bounce - * - */ - -// Remove animation from tooltips. -.#{$hintPrefix}no-animate { - &:before, &:after { - @include vendor('transition-duration', 0ms); - } -} - -// Bounce effect in tooltips. -.#{$hintPrefix}bounce { - &:before, &:after { - -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(.71,1.7,.77,1.24); - -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(.71,1.7,.77,1.24); - transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(.71,1.7,.77,1.24); - } -} - -// Remove shadows from tooltips. -.#{$hintPrefix}no-shadow { - &:before, &:after { - text-shadow: initial; - box-shadow: initial; - } -} \ No newline at end of file diff --git a/node_modules/hint.css/src/hint-mixins.scss b/node_modules/hint.css/src/hint-mixins.scss deleted file mode 100644 index e25774c..0000000 --- a/node_modules/hint.css/src/hint-mixins.scss +++ /dev/null @@ -1,46 +0,0 @@ -// hint-mixins.scss -// -// Place to store common mixins. - -// Vendor prefixer mixin. -@mixin vendor($property, $value) { - -webkit-#{$property}: $value; - -moz-#{$property}: $value; - #{$property}: $value; -} - -// Generates border-color rules for all possible positions -@mixin arrow-border-color($color) { - @each $position in top, bottom, left, right { - @if $position == top or $position == bottom { - // Loop further for classes like .top-left, bottom-right etc - @each $xDir in left, right { - #{if(&, "&", "")}.#{$hintPrefix}#{$position}-#{$xDir}:before { - border-#{$position}-color: $color; - } - } - } - #{if(&, "&", "")}.#{$hintPrefix}#{$position}:before { - border-#{$position}-color: $color; - } - } -} - -// mixin to set margin on tooltip using translate transform -// $property -@mixin set-margin($property, $transitionDirection, $translateX: 0) { - $value: unquote("#{$property}(#{$hintTransitionDistance * $transitionDirection})"); - &:before { - @include vendor('transform', $value); - } - &:after { - @if $translateX != 0 { - // For vertical tooltips, we need to animate in y-direction - // retaining its x-transform. - @include vendor('transform', translateX($translateX) $value); - } - @else { - @include vendor('transform', $value); - } - } -} diff --git a/node_modules/hint.css/src/hint-position.scss b/node_modules/hint.css/src/hint-position.scss deleted file mode 100644 index 8677bcf..0000000 --- a/node_modules/hint.css/src/hint-position.scss +++ /dev/null @@ -1,138 +0,0 @@ -/** - * source: hint-position.scss - * - * Defines the positoning logic for the tooltips. - * - * Classes added: - * 1) hint--top - * 2) hint--bottom - * 3) hint--left - * 4) hint--right - */ - -@mixin vertical-positioned-tooltip($propertyY, $transitionDirection, $xDirection:0) { - &:before { - // bring arrow inside so that it animates to normal position when shown. - // HACK: +1px to avoid the 1 px white space between arrow and body during transition. - margin-#{$propertyY}: -2 * $hintArrowBorderWidth + 1px; - } - - &:before, &:after { - #{$propertyY}: 100%; - left: 50%; // get top-left corner in center - } - - &:before { - left: calc(50% - #{$hintArrowBorderWidth}); // get arrow center aligned with content - } - - $translateX: -50%; - @if $xDirection == -1 { - $translateX: -100%; - } @else if $xDirection == 1 { - $translateX: 0; - } - - &:after { - @include vendor('transform', translateX($translateX)); - } - - &:after { - @if $xDirection != 0 { - // bring back the tooltip by some offset so that arrow doesn't stick at end - margin-left: -$xDirection * $hintArrowOffsetX; - } - } - - &:hover { - @include set-margin('translateY', $transitionDirection, $translateX); - } -} - -@mixin horizontal-positioned-tooltip($propertyX, $transitionDirection) { - &:before { - // bring arrow inside so that it animates to normal position when shown - // HACK: +1px to avoid the 1 px white space between arrow and body during transition. - margin-#{$propertyX}: -2 * $hintArrowBorderWidth + 1px; - // bring back to center vertically - margin-bottom: -1 * $hintArrowBorderWidth; - } - - &:after { - // bring back to center - margin-bottom: -1 * floor($hintTooltipHeight / 2); - } - - &:before, &:after { - #{$propertyX}: 100%; - bottom: 50%; - } - - &:hover { - @include set-margin('translateX', $transitionDirection); - } -} - - -/** - * set default color for tooltip arrows - */ -@include arrow-border-color($hintDefaultColor); - -/** - * top tooltip - */ -.#{$hintPrefix}top { - @include vertical-positioned-tooltip('bottom', -1); -} - -/** - * bottom tooltip - */ -.#{$hintPrefix}bottom { - @include vertical-positioned-tooltip('top', 1); -} - -/** - * right tooltip - */ -.#{$hintPrefix}right { - @include horizontal-positioned-tooltip('left', 1); -} - -/** - * left tooltip - */ -.#{$hintPrefix}left { - @include horizontal-positioned-tooltip('right', -1); -} - -/** - * top-left tooltip - */ -.#{$hintPrefix}top-left { - @include vertical-positioned-tooltip('bottom', -1, -1); -} - - -/** - * top-right tooltip - */ -.#{$hintPrefix}top-right { - @include vertical-positioned-tooltip('bottom', -1, 1); -} - -/** - * bottom-left tooltip - */ -.#{$hintPrefix}bottom-left { - @include vertical-positioned-tooltip('top', 1, -1); -} - - -/** - * bottom-right tooltip - */ -.#{$hintPrefix}bottom-right { - @include vertical-positioned-tooltip('top', 1, 1); -} \ No newline at end of file diff --git a/node_modules/hint.css/src/hint-rounded.scss b/node_modules/hint.css/src/hint-rounded.scss deleted file mode 100644 index 0588dd9..0000000 --- a/node_modules/hint.css/src/hint-rounded.scss +++ /dev/null @@ -1,15 +0,0 @@ -/** - * source: hint-rounded.scss - * - * Defines rounded corner tooltips. - * - * Classes added: - * 1) hint--rounded - * - */ - -.#{$hintPrefix}rounded { - &:after { - border-radius: 4px; - } -} diff --git a/node_modules/hint.css/src/hint-sizes.scss b/node_modules/hint.css/src/hint-sizes.scss deleted file mode 100644 index ee44b50..0000000 --- a/node_modules/hint.css/src/hint-sizes.scss +++ /dev/null @@ -1,39 +0,0 @@ -/** - * source: hint-sizes.scss - * - * Defines width restricted tooltips that can span - * across multiple lines. - * - * Classes added: - * 1) hint--small - * 2) hint--medium - * 3) hint--large - * - */ - - -.#{$hintPrefix}small, -.#{$hintPrefix}medium, -.#{$hintPrefix}large { - &:after { - white-space: normal; - line-height: 1.4em; - word-wrap: break-word; // Ensure long words do not overflow. - } -} - -.#{$hintPrefix}small { - &:after { - width: $hintSizeSmall; - } -} -.#{$hintPrefix}medium { - &:after { - width: $hintSizeMedium; - } -} -.#{$hintPrefix}large { - &:after { - width: $hintSizeLarge; - } -} diff --git a/node_modules/hint.css/src/hint-theme.scss b/node_modules/hint.css/src/hint-theme.scss deleted file mode 100644 index d201d5e..0000000 --- a/node_modules/hint.css/src/hint-theme.scss +++ /dev/null @@ -1,16 +0,0 @@ -/** - * source: hint-theme.scss - * - * Defines basic theme for tooltips. - * - */ - -[class*="#{$hintPrefix}"] { - /** - * tooltip body - */ - &:after { - text-shadow: 0 -1px 0px darken($hintDefaultColor, $hintTextShadowDarkenAmount); - box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3); - } -} \ No newline at end of file diff --git a/node_modules/hint.css/src/hint-variables.scss b/node_modules/hint.css/src/hint-variables.scss deleted file mode 100644 index 59cee83..0000000 --- a/node_modules/hint.css/src/hint-variables.scss +++ /dev/null @@ -1,64 +0,0 @@ -// hint-variables.scss -// -// Declares some variables used within the library. - -// Prefix for all classes. By default, BEM naming convention is used -$hintPrefix: 'hint--' !default; - -// font size -$hintFontSize: 12px !default; - -// default font family -$hintFontFamily: 'Helvetica Neue', Helvetica, Arial, sans-serif !default; - -// paddings -$hintVerticalPadding: 8px !default; -$hintHorizontalPadding: 10px !default; - -// default tooltip height -$hintTooltipHeight: $hintFontSize + 2 * $hintVerticalPadding !default; - -// border-width for tooltip arrow -$hintArrowBorderWidth: 6px !default; - -// horizontal arrow offset -$hintArrowOffsetX: 2 * $hintArrowBorderWidth !default; - -// text-shadow darken percentage -$hintTextShadowDarkenAmount: 25% !default; - -// transition distance -$hintTransitionDistance: 8px !default; - -// Transition Duration -$hintTransitionDuration: 0.3s !default; - -// Delay in showing the tooltips. -$hintShowDelay: 100ms !default; - -// Delay in hiding the tooltips. -$hintHideDelay: 0ms !default; - -// z-index for tooltips -$hintZIndex: 1000000 !default; - -// Size options -$hintSizeSmall: 80px !default; -$hintSizeMedium: 150px !default; -$hintSizeLarge: 300px !default; - -// Various colors -// Default color is blackish -$hintDefaultColor: hsl(0, 0%, 22%) !default; - -// Error color -$hintErrorColor: hsl(1, 40%, 50%) !default; - -// Warning color -$hintWarningColor: hsl(38, 46%, 54%) !default; - -// Info Color -$hintInfoColor: hsl(200, 50%, 45%) !default; - -// Success Color -$hintSuccessColor: hsl(121, 32%, 40%) !default; diff --git a/node_modules/hint.css/src/hint.base.scss b/node_modules/hint.css/src/hint.base.scss deleted file mode 100644 index 7c8ce9a..0000000 --- a/node_modules/hint.css/src/hint.base.scss +++ /dev/null @@ -1,24 +0,0 @@ -// hint.base.scss -// -// Aggregates all other sass files to create a basic functional tooltip. -// This doesn't have any of the cosmetic features of the library. - -/*-------------------------------------*\ - HINT.css - A CSS tooltip library -\*-------------------------------------*/ - - -/** - * HINT.css is a tooltip library made in pure CSS. - * - * Source: https://github.com/chinchang/hint.css - * Demo: http://kushagragour.in/lab/hint/ - * - */ - -@import "hint-variables"; -@import "hint-mixins"; -@import "hint-core"; -@import "hint-position"; -@import "hint-sizes"; -@import "hint-always"; \ No newline at end of file diff --git a/node_modules/hint.css/src/hint.scss b/node_modules/hint.css/src/hint.scss deleted file mode 100644 index 279449e..0000000 --- a/node_modules/hint.css/src/hint.scss +++ /dev/null @@ -1,27 +0,0 @@ -// hint.scss -// -// Aggregates all other sass files. - -/*-------------------------------------*\ - HINT.css - A CSS tooltip library -\*-------------------------------------*/ - - -/** - * HINT.css is a tooltip library made in pure CSS. - * - * Source: https://github.com/chinchang/hint.css - * Demo: http://kushagragour.in/lab/hint/ - * - */ - -@import "hint-variables"; -@import "hint-mixins"; -@import "hint-core"; -@import "hint-position"; -@import "hint-sizes"; -@import "hint-theme"; -@import "hint-color-types"; -@import "hint-always"; -@import "hint-rounded"; -@import "hint-effects"; diff --git a/node_modules/hint.css/yarn.lock b/node_modules/hint.css/yarn.lock deleted file mode 100644 index 6790d8a..0000000 --- a/node_modules/hint.css/yarn.lock +++ /dev/null @@ -1,1403 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -abbrev@1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" - -ajv@^6.5.5: - version "6.5.5" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.5.tgz#cf97cdade71c6399a92c6d6c4177381291b781a1" - dependencies: - fast-deep-equal "^2.0.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - -aproba@^1.0.3: - version "1.2.0" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" - -are-we-there-yet@~1.1.2: - version "1.1.5" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - -"argparse@~ 0.1.11": - version "0.1.16" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-0.1.16.tgz#cfd01e0fbba3d6caed049fbd758d40f65196f57c" - dependencies: - underscore "~1.7.0" - underscore.string "~2.4.0" - -array-find-index@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" - -asn1@~0.2.3: - version "0.2.4" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - -async-foreach@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542" - -async@~0.1.22: - version "0.1.22" - resolved "http://registry.npmjs.org/async/-/async-0.1.22.tgz#0fc1aaa088a0e3ef0ebe2d8831bab0dcf8845061" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - -aws4@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - dependencies: - tweetnacl "^0.14.3" - -block-stream@*: - version "0.0.9" - resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" - dependencies: - inherits "~2.0.0" - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -browserify-zlib@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.1.4.tgz#bb35f8a519f600e0fa6b8485241c979d0141fb2d" - dependencies: - pako "~0.2.0" - -buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - -builtin-modules@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - -camelcase-keys@^2.0.0: - version "2.1.0" - resolved "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" - dependencies: - camelcase "^2.0.0" - map-obj "^1.0.0" - -camelcase@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" - -camelcase@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" - -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - -chalk@^1.0.0, chalk@^1.1.1: - version "1.1.3" - resolved "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -clean-css@^3.1.0: - version "3.4.28" - resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-3.4.28.tgz#bf1945e82fc808f55695e6ddeaec01400efd03ff" - dependencies: - commander "2.8.x" - source-map "0.4.x" - -cliui@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - wrap-ansi "^2.0.0" - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - -coffee-script@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/coffee-script/-/coffee-script-1.3.3.tgz#150d6b4cb522894369efed6a2101c20bc7f4a4f4" - -colors@~0.6.2: - version "0.6.2" - resolved "http://registry.npmjs.org/colors/-/colors-0.6.2.tgz#2423fe6678ac0c5dae8852e5d0e5be08c997abcc" - -combined-stream@^1.0.6, combined-stream@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828" - dependencies: - delayed-stream "~1.0.0" - -commander@2.8.x: - version "2.8.1" - resolved "http://registry.npmjs.org/commander/-/commander-2.8.1.tgz#06be367febfda0c330aa1e2a072d3dc9762425d4" - dependencies: - graceful-readlink ">= 1.0.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -concat-stream@^1.4.1: - version "1.6.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - -core-util-is@1.0.2, core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - -cross-spawn@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-3.0.1.tgz#1256037ecb9f0c5f79e3d6ef135e30770184b982" - dependencies: - lru-cache "^4.0.1" - which "^1.2.9" - -currently-unhandled@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" - dependencies: - array-find-index "^1.0.1" - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - dependencies: - assert-plus "^1.0.0" - -dateformat@1.0.2-1.2.3: - version "1.0.2-1.2.3" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-1.0.2-1.2.3.tgz#b0220c02de98617433b72851cf47de3df2cdbee9" - -debug@~0.7.0: - version "0.7.4" - resolved "http://registry.npmjs.org/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39" - -decamelize@^1.1.1, decamelize@^1.1.2: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - -error-ex@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - dependencies: - is-arrayish "^0.2.1" - -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - -"esprima@~ 1.0.2": - version "1.0.4" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad" - -eventemitter2@~0.4.13: - version "0.4.14" - resolved "http://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz#8f61b75cde012b2e9eb284d4545583b5643b61ab" - -exit@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - -extsprintf@^1.2.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" - -fast-deep-equal@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" - -fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - -faye-websocket@~0.4.3: - version "0.4.4" - resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.4.4.tgz#c14c5b3bf14d7417ffbfd990c0a7495cd9f337bc" - -figures@^1.0.1: - version "1.7.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" - dependencies: - escape-string-regexp "^1.0.5" - object-assign "^4.1.0" - -find-up@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" - dependencies: - path-exists "^2.0.0" - pinkie-promise "^2.0.0" - -findup-sync@~0.1.2: - version "0.1.3" - resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-0.1.3.tgz#7f3e7a97b82392c653bf06589bd85190e93c3683" - dependencies: - glob "~3.2.9" - lodash "~2.4.1" - -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -fstream@^1.0.0, fstream@^1.0.2: - version "1.0.11" - resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" - dependencies: - graceful-fs "^4.1.2" - inherits "~2.0.0" - mkdirp ">=0.5 0" - rimraf "2" - -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - -gaze@^1.0.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/gaze/-/gaze-1.1.3.tgz#c441733e13b927ac8c0ff0b4c3b033f28812924a" - dependencies: - globule "^1.0.0" - -gaze@~0.4.0: - version "0.4.3" - resolved "https://registry.yarnpkg.com/gaze/-/gaze-0.4.3.tgz#e538f4ff5e4fe648f473a97e1ebb253d2de127b5" - dependencies: - globule "~0.1.0" - -get-caller-file@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" - -get-stdin@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" - -getobject@~0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/getobject/-/getobject-0.1.0.tgz#047a449789fa160d018f5486ed91320b6ec7885c" - -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - dependencies: - assert-plus "^1.0.0" - -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@~7.1.1: - version "7.1.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@~3.1.21: - version "3.1.21" - resolved "https://registry.yarnpkg.com/glob/-/glob-3.1.21.tgz#d29e0a055dea5138f4d07ed40e8982e83c2066cd" - dependencies: - graceful-fs "~1.2.0" - inherits "1" - minimatch "~0.2.11" - -glob@~3.2.9: - version "3.2.11" - resolved "https://registry.yarnpkg.com/glob/-/glob-3.2.11.tgz#4a973f635b9190f715d10987d5c00fd2815ebe3d" - dependencies: - inherits "2" - minimatch "0.3" - -globule@^1.0.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/globule/-/globule-1.2.1.tgz#5dffb1b191f22d20797a9369b49eab4e9839696d" - dependencies: - glob "~7.1.1" - lodash "~4.17.10" - minimatch "~3.0.2" - -globule@~0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/globule/-/globule-0.1.0.tgz#d9c8edde1da79d125a151b79533b978676346ae5" - dependencies: - glob "~3.1.21" - lodash "~1.0.1" - minimatch "~0.2.11" - -graceful-fs@^4.1.2: - version "4.1.15" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" - -graceful-fs@~1.2.0: - version "1.2.3" - resolved "http://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz#15a4806a57547cb2d2dbf27f42e89a8c3451b364" - -"graceful-readlink@>= 1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" - -grunt-contrib-concat@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/grunt-contrib-concat/-/grunt-contrib-concat-0.3.0.tgz#48fa0d4336d29b653ad8225a6bd6f856b4483e32" - -grunt-contrib-cssmin@~0.12.3: - version "0.12.3" - resolved "http://registry.npmjs.org/grunt-contrib-cssmin/-/grunt-contrib-cssmin-0.12.3.tgz#4157596096fb7656fc464b4cc7b0746de1f39014" - dependencies: - chalk "^1.0.0" - clean-css "^3.1.0" - maxmin "^1.1.0" - -grunt-contrib-watch@~0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/grunt-contrib-watch/-/grunt-contrib-watch-0.5.3.tgz#7d9eb5465d506fa14faaca47e6e8790a82c1c9ee" - dependencies: - gaze "~0.4.0" - tiny-lr "0.0.4" - -grunt-legacy-log-utils@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/grunt-legacy-log-utils/-/grunt-legacy-log-utils-0.1.1.tgz#c0706b9dd9064e116f36f23fe4e6b048672c0f7e" - dependencies: - colors "~0.6.2" - lodash "~2.4.1" - underscore.string "~2.3.3" - -grunt-legacy-log@~0.1.0: - version "0.1.3" - resolved "https://registry.yarnpkg.com/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz#ec29426e803021af59029f87d2f9cd7335a05531" - dependencies: - colors "~0.6.2" - grunt-legacy-log-utils "~0.1.1" - hooker "~0.2.3" - lodash "~2.4.1" - underscore.string "~2.3.3" - -grunt-legacy-util@~0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/grunt-legacy-util/-/grunt-legacy-util-0.2.0.tgz#93324884dbf7e37a9ff7c026dff451d94a9e554b" - dependencies: - async "~0.1.22" - exit "~0.1.1" - getobject "~0.1.0" - hooker "~0.2.3" - lodash "~0.9.2" - underscore.string "~2.2.1" - which "~1.0.5" - -grunt-sass@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/grunt-sass/-/grunt-sass-3.0.2.tgz#b4f01567ce3df4460fcc788e9e5e4c65263425ed" - -grunt@~0.4.1: - version "0.4.5" - resolved "https://registry.yarnpkg.com/grunt/-/grunt-0.4.5.tgz#56937cd5194324adff6d207631832a9d6ba4e7f0" - dependencies: - async "~0.1.22" - coffee-script "~1.3.3" - colors "~0.6.2" - dateformat "1.0.2-1.2.3" - eventemitter2 "~0.4.13" - exit "~0.1.1" - findup-sync "~0.1.2" - getobject "~0.1.0" - glob "~3.1.21" - grunt-legacy-log "~0.1.0" - grunt-legacy-util "~0.2.0" - hooker "~0.2.3" - iconv-lite "~0.2.11" - js-yaml "~2.0.5" - lodash "~0.9.2" - minimatch "~0.2.12" - nopt "~1.0.10" - rimraf "~2.2.8" - underscore.string "~2.2.1" - which "~1.0.5" - -gzip-size@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-1.0.0.tgz#66cf8b101047227b95bace6ea1da0c177ed5c22f" - dependencies: - browserify-zlib "^0.1.4" - concat-stream "^1.4.1" - -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - -har-validator@~5.1.0: - version "5.1.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" - dependencies: - ajv "^6.5.5" - har-schema "^2.0.0" - -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - dependencies: - ansi-regex "^2.0.0" - -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - -hooker@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/hooker/-/hooker-0.2.3.tgz#b834f723cc4a242aa65963459df6d984c5d3d959" - -hosted-git-info@^2.1.4: - version "2.7.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -iconv-lite@~0.2.11: - version "0.2.11" - resolved "http://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz#1ce60a3a57864a292d1321ff4609ca4bb965adc8" - -in-publish@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/in-publish/-/in-publish-2.0.0.tgz#e20ff5e3a2afc2690320b6dc552682a9c7fadf51" - -indent-string@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" - dependencies: - repeating "^2.0.0" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-1.0.2.tgz#ca4309dadee6b54cc0b8d247e8d7c7a0975bdc9b" - -inherits@2, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -invert-kv@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - -is-builtin-module@^1.0.0: - version "1.0.0" - resolved "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" - dependencies: - builtin-modules "^1.0.0" - -is-finite@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - -is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - -is-utf8@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - -js-base64@^2.1.8: - version "2.4.9" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.9.tgz#748911fb04f48a60c4771b375cac45a80df11c03" - -js-yaml@~2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-2.0.5.tgz#a25ae6509999e97df278c6719da11bd0687743a8" - dependencies: - argparse "~ 0.1.11" - esprima "~ 1.0.2" - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - -jsprim@^1.2.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.2.3" - verror "1.10.0" - -lcid@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" - dependencies: - invert-kv "^1.0.0" - -load-json-file@^1.0.0: - version "1.1.0" - resolved "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" - dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - pinkie-promise "^2.0.0" - strip-bom "^2.0.0" - -lodash.assign@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" - -lodash.clonedeep@^4.3.2: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" - -lodash.mergewith@^4.6.0: - version "4.6.1" - resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927" - -lodash@^4.0.0, lodash@~4.17.10: - version "4.17.11" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" - -lodash@~0.9.2: - version "0.9.2" - resolved "http://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz#8f3499c5245d346d682e5b0d3b40767e09f1a92c" - -lodash@~1.0.1: - version "1.0.2" - resolved "http://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz#8f57560c83b59fc270bd3d561b690043430e2551" - -lodash@~2.4.1: - version "2.4.2" - resolved "http://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz#fadd834b9683073da179b3eae6d9c0d15053f73e" - -loud-rejection@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" - dependencies: - currently-unhandled "^0.4.1" - signal-exit "^3.0.0" - -lru-cache@2: - version "2.7.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" - -lru-cache@^4.0.1: - version "4.1.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - -map-obj@^1.0.0, map-obj@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" - -maxmin@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/maxmin/-/maxmin-1.1.0.tgz#71365e84a99dd8f8b3f7d5fde2f00d1e7f73be61" - dependencies: - chalk "^1.0.0" - figures "^1.0.1" - gzip-size "^1.0.0" - pretty-bytes "^1.0.0" - -meow@^3.1.0, meow@^3.7.0: - version "3.7.0" - resolved "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" - dependencies: - camelcase-keys "^2.0.0" - decamelize "^1.1.2" - loud-rejection "^1.0.0" - map-obj "^1.0.1" - minimist "^1.1.3" - normalize-package-data "^2.3.4" - object-assign "^4.0.1" - read-pkg-up "^1.0.1" - redent "^1.0.0" - trim-newlines "^1.0.0" - -mime-db@~1.37.0: - version "1.37.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.37.0.tgz#0b6a0ce6fdbe9576e25f1f2d2fde8830dc0ad0d8" - -mime-types@^2.1.12, mime-types@~2.1.19: - version "2.1.21" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.21.tgz#28995aa1ecb770742fe6ae7e58f9181c744b3f96" - dependencies: - mime-db "~1.37.0" - -minimatch@0.3: - version "0.3.0" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.3.0.tgz#275d8edaac4f1bb3326472089e7949c8394699dd" - dependencies: - lru-cache "2" - sigmund "~1.0.0" - -minimatch@^3.0.4, minimatch@~3.0.2: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - dependencies: - brace-expansion "^1.1.7" - -minimatch@~0.2.11, minimatch@~0.2.12: - version "0.2.14" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.2.14.tgz#c74e780574f63c6f9a090e90efbe6ef53a6a756a" - dependencies: - lru-cache "2" - sigmund "~1.0.0" - -minimist@0.0.8: - version "0.0.8" - resolved "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@^1.1.3: - version "1.2.0" - resolved "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - -"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1: - version "0.5.1" - resolved "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - dependencies: - minimist "0.0.8" - -nan@^2.10.0: - version "2.11.1" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.11.1.tgz#90e22bccb8ca57ea4cd37cc83d3819b52eea6766" - -node-gyp@^3.8.0: - version "3.8.0" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.8.0.tgz#540304261c330e80d0d5edce253a68cb3964218c" - dependencies: - fstream "^1.0.0" - glob "^7.0.3" - graceful-fs "^4.1.2" - mkdirp "^0.5.0" - nopt "2 || 3" - npmlog "0 || 1 || 2 || 3 || 4" - osenv "0" - request "^2.87.0" - rimraf "2" - semver "~5.3.0" - tar "^2.0.0" - which "1" - -node-sass@^4.10.0: - version "4.10.0" - resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.10.0.tgz#dcc2b364c0913630945ccbf7a2bbf1f926effca4" - dependencies: - async-foreach "^0.1.3" - chalk "^1.1.1" - cross-spawn "^3.0.0" - gaze "^1.0.0" - get-stdin "^4.0.1" - glob "^7.0.3" - in-publish "^2.0.0" - lodash.assign "^4.2.0" - lodash.clonedeep "^4.3.2" - lodash.mergewith "^4.6.0" - meow "^3.7.0" - mkdirp "^0.5.1" - nan "^2.10.0" - node-gyp "^3.8.0" - npmlog "^4.0.0" - request "^2.88.0" - sass-graph "^2.2.4" - stdout-stream "^1.4.0" - "true-case-path" "^1.0.2" - -"nopt@2 || 3": - version "3.0.6" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" - dependencies: - abbrev "1" - -nopt@~1.0.10: - version "1.0.10" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" - dependencies: - abbrev "1" - -nopt@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-2.0.0.tgz#ca7416f20a5e3f9c3b86180f96295fa3d0b52e0d" - dependencies: - abbrev "1" - -noptify@latest: - version "0.0.3" - resolved "https://registry.yarnpkg.com/noptify/-/noptify-0.0.3.tgz#58f654a73d9753df0c51d9686dc92104a67f4bbb" - dependencies: - nopt "~2.0.0" - -normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: - version "2.4.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" - dependencies: - hosted-git-info "^2.1.4" - is-builtin-module "^1.0.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" - -"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - -object-assign@^4.0.1, object-assign@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -os-homedir@^1.0.0: - version "1.0.2" - resolved "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - -os-locale@^1.4.0: - version "1.4.0" - resolved "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" - dependencies: - lcid "^1.0.0" - -os-tmpdir@^1.0.0: - version "1.0.2" - resolved "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - -osenv@0: - version "0.1.5" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - -pako@~0.2.0: - version "0.2.9" - resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" - -parse-json@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" - dependencies: - error-ex "^1.2.0" - -path-exists@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" - dependencies: - pinkie-promise "^2.0.0" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -path-type@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" - dependencies: - graceful-fs "^4.1.2" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - -pify@^2.0.0: - version "2.3.0" - resolved "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - dependencies: - pinkie "^2.0.0" - -pinkie@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - -pretty-bytes@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-1.0.4.tgz#0a22e8210609ad35542f8c8d5d2159aff0751c84" - dependencies: - get-stdin "^4.0.1" - meow "^3.1.0" - -process-nextick-args@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" - -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - -psl@^1.1.24: - version "1.1.29" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.29.tgz#60f580d360170bb722a797cc704411e6da850c67" - -punycode@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - -punycode@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - -qs@~0.5.2: - version "0.5.6" - resolved "https://registry.yarnpkg.com/qs/-/qs-0.5.6.tgz#31b1ad058567651c526921506b9a8793911a0384" - -qs@~6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" - -read-pkg-up@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" - dependencies: - find-up "^1.0.0" - read-pkg "^1.0.0" - -read-pkg@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" - dependencies: - load-json-file "^1.0.0" - normalize-package-data "^2.3.2" - path-type "^1.0.0" - -readable-stream@^2.0.1, readable-stream@^2.0.6, readable-stream@^2.2.2: - version "2.3.6" - resolved "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -redent@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" - dependencies: - indent-string "^2.1.0" - strip-indent "^1.0.1" - -repeating@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" - dependencies: - is-finite "^1.0.0" - -request@^2.87.0, request@^2.88.0: - version "2.88.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.0" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.4.3" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - -require-main-filename@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" - -rimraf@2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" - dependencies: - glob "^7.0.5" - -rimraf@~2.2.8: - version "2.2.8" - resolved "http://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582" - -safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - -safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - -sass-graph@^2.2.4: - version "2.2.4" - resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.2.4.tgz#13fbd63cd1caf0908b9fd93476ad43a51d1e0b49" - dependencies: - glob "^7.0.0" - lodash "^4.0.0" - scss-tokenizer "^0.2.3" - yargs "^7.0.0" - -scss-tokenizer@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz#8eb06db9a9723333824d3f5530641149847ce5d1" - dependencies: - js-base64 "^2.1.8" - source-map "^0.4.2" - -"semver@2 || 3 || 4 || 5": - version "5.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" - -semver@~5.3.0: - version "5.3.0" - resolved "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - -set-blocking@^2.0.0, set-blocking@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - -sigmund@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" - -signal-exit@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - -source-map@0.4.x, source-map@^0.4.2: - version "0.4.4" - resolved "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" - dependencies: - amdefine ">=0.0.4" - -spdx-correct@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.2.tgz#19bb409e91b47b1ad54159243f7312a858db3c2e" - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids "^3.0.0" - -spdx-exceptions@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" - -spdx-expression-parse@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" - dependencies: - spdx-exceptions "^2.1.0" - spdx-license-ids "^3.0.0" - -spdx-license-ids@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.2.tgz#a59efc09784c2a5bada13cfeaf5c75dd214044d2" - -sshpk@^1.7.0: - version "1.15.2" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.15.2.tgz#c946d6bd9b1a39d0e8635763f5242d6ed6dcb629" - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - -stdout-stream@^1.4.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/stdout-stream/-/stdout-stream-1.4.1.tgz#5ac174cdd5cd726104aa0c0b2bd83815d8d535de" - dependencies: - readable-stream "^2.0.1" - -string-width@^1.0.1, string-width@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -"string-width@^1.0.2 || 2": - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - dependencies: - safe-buffer "~5.1.0" - -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - dependencies: - ansi-regex "^2.0.0" - -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - dependencies: - ansi-regex "^3.0.0" - -strip-bom@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" - dependencies: - is-utf8 "^0.2.0" - -strip-indent@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" - dependencies: - get-stdin "^4.0.1" - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - -tar@^2.0.0: - version "2.2.1" - resolved "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" - dependencies: - block-stream "*" - fstream "^1.0.2" - inherits "2" - -tiny-lr@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/tiny-lr/-/tiny-lr-0.0.4.tgz#80618547f63f697d05cb40c4c2c4b083521aefb6" - dependencies: - debug "~0.7.0" - faye-websocket "~0.4.3" - noptify latest - qs "~0.5.2" - -tough-cookie@~2.4.3: - version "2.4.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" - dependencies: - psl "^1.1.24" - punycode "^1.4.1" - -trim-newlines@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" - -"true-case-path@^1.0.2": - version "1.0.3" - resolved "https://registry.yarnpkg.com/true-case-path/-/true-case-path-1.0.3.tgz#f813b5a8c86b40da59606722b144e3225799f47d" - dependencies: - glob "^7.1.2" - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - -underscore.string@~2.2.1: - version "2.2.1" - resolved "http://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz#d7c0fa2af5d5a1a67f4253daee98132e733f0f19" - -underscore.string@~2.3.3: - version "2.3.3" - resolved "http://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz#71c08bf6b428b1133f37e78fa3a21c82f7329b0d" - -underscore.string@~2.4.0: - version "2.4.0" - resolved "http://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz#8cdd8fbac4e2d2ea1e7e2e8097c42f442280f85b" - -underscore@~1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.7.0.tgz#6bbaf0877500d36be34ecaa584e0db9fef035209" - -uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - dependencies: - punycode "^2.1.0" - -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - -uuid@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" - -validate-npm-package-license@^3.0.1: - version "3.0.4" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" - dependencies: - spdx-correct "^3.0.0" - spdx-expression-parse "^3.0.0" - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - -which-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" - -which@1, which@^1.2.9: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - dependencies: - isexe "^2.0.0" - -which@~1.0.5: - version "1.0.9" - resolved "https://registry.yarnpkg.com/which/-/which-1.0.9.tgz#460c1da0f810103d0321a9b633af9e575e64486f" - -wide-align@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" - dependencies: - string-width "^1.0.2 || 2" - -wrap-ansi@^2.0.0: - version "2.1.0" - resolved "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -y18n@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" - -yallist@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" - -yargs-parser@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" - dependencies: - camelcase "^3.0.0" - -yargs@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" - dependencies: - camelcase "^3.0.0" - cliui "^3.2.0" - decamelize "^1.1.1" - get-caller-file "^1.0.1" - os-locale "^1.4.0" - read-pkg-up "^1.0.1" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^1.0.2" - which-module "^1.0.0" - y18n "^3.2.1" - yargs-parser "^5.0.0" diff --git a/node_modules/individual/.npmignore b/node_modules/individual/.npmignore deleted file mode 100644 index 7ce4923..0000000 --- a/node_modules/individual/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -*.log -*.err -coverage diff --git a/node_modules/individual/.travis.yml b/node_modules/individual/.travis.yml deleted file mode 100644 index c6314e1..0000000 --- a/node_modules/individual/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" - - "0.11" -before_install: npm i npm@latest -g -script: npm run travis diff --git a/node_modules/individual/LICENCE b/node_modules/individual/LICENCE deleted file mode 100644 index a23e08a..0000000 --- a/node_modules/individual/LICENCE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Raynos. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. \ No newline at end of file diff --git a/node_modules/individual/README.md b/node_modules/individual/README.md deleted file mode 100644 index 5ff4088..0000000 --- a/node_modules/individual/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# individual - -[![build status][build-png]][build] [![Coverage Status][cover-png]][cover] [![Davis Dependency status][dep-png]][dep] - -[![NPM][npm-png]][npm] - -[![browser support][test-png]][test] - -Garantueed individual values - -## Example - -```js -var Individual = require("individual") - -var moduleCache = Individual("__MY_MODULE_CACHE", {}) - -// moduleCache is a individual variable local to this file. -// It will always be the same value and defaults to {}. -``` - -This gives you a singleton value by a unique name (it stores it -as a global variable). - -## Use cases - -Your module has an internal cache. If your module is loaded - twice, (someone didn't npm dedup and has two copies of your - module) you would have two seperate caches that dont talk - to each other. - -Best case your cache is less efficient. Worst case you have a - cache because the native C++ extension you talk to crashes - if you instantiate something twice. - -You need a garantuee that this value is an individual, there is - only one of it. - -I use it myself because opening a SockJS websocket to the same - URI twice causes an infinite loop. I need a garantuee that - I have an individual value for the SockJS connection so I - can see whether I already have an open connection. - -## WHY GLOBALS >:( - -I can't imagine any other way to do it. I hate it too. Make a - pull request if you know the real solution - -## Installation - -`npm install individual` - -## Contributors - - - Raynos - -## MIT Licenced - - [build-png]: https://secure.travis-ci.org/Raynos/individual.png - [build]: https://travis-ci.org/Raynos/individual - [cover-png]: https://coveralls.io/repos/Raynos/individual/badge.png - [cover]: https://coveralls.io/r/Raynos/individual - [dep-png]: https://david-dm.org/Raynos/individual.png - [dep]: https://david-dm.org/Raynos/individual - [test-png]: https://ci.testling.com/Raynos/individual.png - [test]: https://ci.testling.com/Raynos/individual - [npm-png]: https://nodei.co/npm/individual.png?stars&downloads - [npm]: https://nodei.co/npm/individual - diff --git a/node_modules/individual/index.js b/node_modules/individual/index.js deleted file mode 100644 index 637be8b..0000000 --- a/node_modules/individual/index.js +++ /dev/null @@ -1,18 +0,0 @@ -var root = typeof window !== 'undefined' ? - window : typeof global !== 'undefined' ? - global : {}; - -module.exports = Individual - -function Individual(key, value) { - if (root[key]) { - return root[key] - } - - Object.defineProperty(root, key, { - value: value - , configurable: true - }) - - return value -} diff --git a/node_modules/individual/package.json b/node_modules/individual/package.json deleted file mode 100644 index e07a085..0000000 --- a/node_modules/individual/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "_from": "individual@^2.0.0", - "_id": "individual@2.0.0", - "_inBundle": false, - "_integrity": "sha1-gzsJfa0jKU52EXqY+zjg2a1hu5c=", - "_location": "/individual", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "individual@^2.0.0", - "name": "individual", - "escapedName": "individual", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/rust-result" - ], - "_resolved": "https://registry.npmjs.org/individual/-/individual-2.0.0.tgz", - "_shasum": "833b097dad23294e76117a98fb38e0d9ad61bb97", - "_spec": "individual@^2.0.0", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\rust-result", - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "bugs": { - "url": "https://github.com/Raynos/individual/issues", - "email": "raynos2@gmail.com" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Jake Verbaten" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "Garantueed individual values", - "devDependencies": { - "coveralls": "^2.10.0", - "istanbul": "^0.2.7", - "run-browser": "^1.3.1", - "tape": "^2.12.3" - }, - "homepage": "https://github.com/Raynos/individual", - "keywords": [], - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/Raynos/individual/raw/master/LICENSE" - } - ], - "main": "index", - "name": "individual", - "repository": { - "type": "git", - "url": "git://github.com/Raynos/individual.git" - }, - "scripts": { - "cover": "istanbul cover --report none --print detail test.js", - "test": "node test.js", - "travis": "npm run cover -s && istanbul report lcov && ((cat coverage/lcov.info | coveralls) || exit 0)" - }, - "testling": { - "files": "test.js", - "browsers": [ - "ie/8..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "2.0.0" -} diff --git a/node_modules/individual/test.js b/node_modules/individual/test.js deleted file mode 100644 index bf593db..0000000 --- a/node_modules/individual/test.js +++ /dev/null @@ -1,25 +0,0 @@ -var test = require('tape'); - -var Individual = require('./index.js'); - -test('can create Individual', function (assert) { - var obj = Individual('someName', 42); - - assert.equal(obj, 42); - - var obj2 = Individual('someName', 50); - - assert.equal(obj, 42); - - assert.end(); -}); - -test('different keys', function (assert) { - var obj = Individual('someName2', 42); - var obj2 = Individual('otherName2', 50); - - assert.equal(obj, 42); - assert.equal(obj2, 50); - - assert.end(); -}); diff --git a/node_modules/is-function/LICENSE b/node_modules/is-function/LICENSE deleted file mode 100644 index 0b4aed1..0000000 --- a/node_modules/is-function/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Stephen Sugden - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/is-function/README.md b/node_modules/is-function/README.md deleted file mode 100644 index 0a67128..0000000 --- a/node_modules/is-function/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# is-function - -[![browser support](https://ci.testling.com/grncdr/js-is-function.png)](https://ci.testling.com/grncdr/js-is-function) - -Is that thing a function? Use this module to find out. - -## API - -### module.exports = function isFunction(fn) -> Boolean - -Return `true` if `fn` is a function, otherwise `false`. - -## Why not typeof fn === 'function' - -Because certain old browsers misreport the type of `RegExp` objects as functions. - -## Acknowledgements - -I stole this from https://github.com/ljharb/object-keys - -## License - -MIT diff --git a/node_modules/is-function/index.js b/node_modules/is-function/index.js deleted file mode 100644 index 3e64897..0000000 --- a/node_modules/is-function/index.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = isFunction - -var toString = Object.prototype.toString - -function isFunction (fn) { - if (!fn) { - return false - } - var string = toString.call(fn) - return string === '[object Function]' || - (typeof fn === 'function' && string !== '[object RegExp]') || - (typeof window !== 'undefined' && - // IE8 and below - (fn === window.setTimeout || - fn === window.alert || - fn === window.confirm || - fn === window.prompt)) -}; diff --git a/node_modules/is-function/package.json b/node_modules/is-function/package.json deleted file mode 100644 index 8b53da4..0000000 --- a/node_modules/is-function/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "is-function@^1.0.1", - "_id": "is-function@1.0.2", - "_inBundle": false, - "_integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==", - "_location": "/is-function", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "is-function@^1.0.1", - "name": "is-function", - "escapedName": "is-function", - "rawSpec": "^1.0.1", - "saveSpec": null, - "fetchSpec": "^1.0.1" - }, - "_requiredBy": [ - "/@videojs/xhr" - ], - "_resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", - "_shasum": "4f097f30abf6efadac9833b17ca5dc03f8144e08", - "_spec": "is-function@^1.0.1", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\@videojs\\xhr", - "author": { - "name": "Stephen Sugden", - "email": "me@stephensugden.com" - }, - "bugs": { - "url": "https://github.com/grncdr/js-is-function/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "is that thing a function? Use this module to find out", - "devDependencies": { - "tape": "~2.3.2" - }, - "homepage": "https://github.com/grncdr/js-is-function", - "keywords": [ - "polyfill", - "is-function", - "ie6" - ], - "license": "MIT", - "main": "index.js", - "name": "is-function", - "repository": { - "type": "git", - "url": "git://github.com/grncdr/js-is-function.git" - }, - "scripts": { - "test": "tape test.js" - }, - "testling": { - "files": "test.js", - "browsers": [ - "iexplore/6.0..latest", - "firefox/3.0..6.0", - "firefox/15.0..latest", - "firefox/nightly", - "chrome/4.0..10.0", - "chrome/20.0..latest", - "chrome/canary", - "opera/10.0..latest", - "opera/next", - "safari/4.0..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2" - ] - }, - "version": "1.0.2" -} diff --git a/node_modules/is-function/test.js b/node_modules/is-function/test.js deleted file mode 100644 index b3ac5e4..0000000 --- a/node_modules/is-function/test.js +++ /dev/null @@ -1,37 +0,0 @@ -var test = require('tape') -var isFunction = require('./index.js') - -test('isFunction', function (t) { - t.ok(!isFunction(), 'undefined is not a function') - t.ok(!isFunction(null), 'null is not a function') - t.ok(!isFunction(''), 'string is not a function') - t.ok(!isFunction(/a/), 'regex is not a function') - t.ok(!isFunction(true), 'true is not a function') - t.ok(!isFunction(false), 'false is not a function') - t.ok(!isFunction(NaN), 'NaN is not a function') - t.ok(!isFunction(42), '42 is not a function') - t.ok(isFunction(function () {}), 'function is a function') - t.ok(isFunction(setTimeout), 'setTimeout is a function') - t.end() -}) - -if (typeof window !== 'undefined') { - test('browser quirks', function (t) { - t.plan(2) - - t.ok(isFunction(window.alert), 'alert is a function') - - window.testRegExpFromIframe = function (regexp) { - t.ok(!isFunction(regexp)) - } - - var iframe = document.createElement('iframe') - document.body.appendChild(iframe) - - iframe.contentWindow.document.write([ - "" - ].join("\n")); - }) -} diff --git a/node_modules/keycode/.npmignore b/node_modules/keycode/.npmignore deleted file mode 100644 index 665aa21..0000000 --- a/node_modules/keycode/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -components -build -node_modules diff --git a/node_modules/keycode/.travis.yml b/node_modules/keycode/.travis.yml deleted file mode 100644 index ecc4978..0000000 --- a/node_modules/keycode/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "8" - - "6" - - "4" diff --git a/node_modules/keycode/LICENSE b/node_modules/keycode/LICENSE deleted file mode 100644 index a8ee83f..0000000 --- a/node_modules/keycode/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Tim Oxley - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/keycode/Makefile b/node_modules/keycode/Makefile deleted file mode 100644 index 84395cd..0000000 --- a/node_modules/keycode/Makefile +++ /dev/null @@ -1,11 +0,0 @@ - -build: components index.js - @component build --dev - -components: - @component install --dev - -clean: - rm -fr build components template.js - -.PHONY: clean diff --git a/node_modules/keycode/Readme.md b/node_modules/keycode/Readme.md deleted file mode 100644 index 53cef4f..0000000 --- a/node_modules/keycode/Readme.md +++ /dev/null @@ -1,136 +0,0 @@ -# keycode - - Simple map of keyboard codes. - -[![Build Status](https://travis-ci.org/timoxley/keycode.png?branch=master)](https://travis-ci.org/timoxley/keycode) - -## Installation - -#### npm - -```sh -$ npm install keycode -``` - -#### component -```sh -$ component install timoxley/keycode -``` - -## Example - -```js -var keycode = require('keycode'); -document.addEventListener('keydown', function(e) { - console.log("You pressed", keycode(e)) -}) -``` - -## API - -`keycode` tries to make an intelligent guess as to what -you're trying to discover based on the type of argument -you supply. - -### keycode(keycode:Event) - -Returns the name of the key associated with this event. - -```js -document.body.addEventListener('keyup', function(e) { - console.log(keycode(e)) // prints name of key -}) -``` - -[Due to the keypress event being weird](https://github.com/timoxley/keycode/wiki/wtf%3F-keydown,-keyup-vs-keypress),`keycode `currently does not support the `keypress` event, but this should not be an issue as `keydown` and `keyup` work perfectly fine. - -### keycode(keycode:Number) - -Returns the lowercase name of a given numeric keycode. - -```js -keycode(13) // => 'enter' -``` - -### keycode(name:String) - -Returns the numeric keycode for given key name. - -```js -keycode('Enter') // => 13 - -// keycode is not case sensitive -keycode('eNtEr') // => 13 -``` - -### Name Aliases - -Common aliases are also supplied: - -```js -> for (var alias in keycode.aliases) { console.log(alias, keycode(keycode(alias))) } -ctl ctrl -pause pause/break -break pause/break -caps caps lock -escape esc -pgup page up -pgdn page down -ins insert -del delete -spc space -``` - -## keycode.isEventKey(event: Event, nameOrCode: String | Number) - -Tests if an keyboard event against a given name or keycode. -Will return `true` if the event matches the given name or keycode, `false` otherwise. - -```js -// assume event is an keydown event with key 'enter' -keycode.isEventKey(event, 'enter') // => true -keycode.isEventKey(event, 'down') // => false - -keycode.isEventKey(event, 13) // => true -keycode.isEventKey(event, 40) // => false -``` - - -## Maps - -Key code/name maps are available directly as `keycode.codes` and `keycode.names` respectively. - -```js -keycode.names[13] // => 'enter' -keycode.codes['Enter'] // => 13 -``` - -## Credit - -``` - project : keycode - repo age : 3 years, 8 months - active : 29 days - commits : 66 - files : 13 - authors : - 49 Tim Oxley 74.3% - 4 jkroso 6.1% - 3 Amir Abu Shareb 4.5% - 1 Greg Reimer 1.5% - 1 Kenan Yildirim 1.5% - 1 Abel Toledano 1.5% - 1 Sam 1.5% - 1 TJ Holowaychuk 1.5% - 1 Yoshua Wuyts 1.5% - 1 Nathan Zadoks 1.5% - 1 Brenton Simpson 1.5% - 1 Brian Noguchi 1.5% - 1 Gilad Peleg 1.5% -``` - -Original key mappings lifted from http://jsfiddle.net/vWx8V/ via http://stackoverflow.com/questions/5603195/full-list-of-javascript-keycodes - -## License - -[MIT](http://opensource.org/licenses/mit-license.php) diff --git a/node_modules/keycode/component.json b/node_modules/keycode/component.json deleted file mode 100644 index da4fc4d..0000000 --- a/node_modules/keycode/component.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "keycode", - "repo": "timoxley/keycode", - "description": "Map of keyboard codes", - "version": "2.2.0", - "development": { - "timoxley/assert": "*" - }, - "scripts": [ - "index.js" - ], - "license": "MIT", - "keywords": [ - "keyboard", - "keycode", - "keyboardevent", - "ascii", - "keydown", - "keyup", - "metakey", - "keyname", - "keypress" - ] -} diff --git a/node_modules/keycode/examples/index.html b/node_modules/keycode/examples/index.html deleted file mode 100644 index 6f2357e..0000000 --- a/node_modules/keycode/examples/index.html +++ /dev/null @@ -1,13 +0,0 @@ - -
Press any key.
- - diff --git a/node_modules/keycode/index.d.ts b/node_modules/keycode/index.d.ts deleted file mode 100644 index 52c0229..0000000 --- a/node_modules/keycode/index.d.ts +++ /dev/null @@ -1,145 +0,0 @@ -export = keycode; -export as namespace keycode; - -declare const keycode: Keycode; - -declare interface CodesMap { - 'backspace': number; - 'tab': number; - 'enter': number; - 'shift': number; - 'ctrl': number; - 'alt': number; - 'pause/break': number; - 'caps lock': number; - 'esc': number; - 'space': number; - 'page up': number; - 'page down': number; - 'end': number; - 'home': number; - 'left': number; - 'up': number; - 'right': number; - 'down': number; - 'insert': number; - 'delete': number; - 'command': number; - 'left command': number; - 'right command': number; - 'numpad *': number; - 'numpad +': number; - 'numpad -': number; - 'numpad .': number; - 'numpad /': number; - 'num lock': number; - 'scroll lock': number; - 'my computer': number; - 'my calculator': number; - ';': number; - '=': number; - ',': number; - '-': number; - '.': number; - '/': number; - '`': number; - '[': number; - '\\': number; - ']': number; - "'": number; - 'a': number; - 'b': number; - 'c': number; - 'd': number; - 'e': number; - 'f': number; - 'g': number; - 'h': number; - 'i': number; - 'j': number; - 'k': number; - 'l': number; - 'm': number; - 'n': number; - 'o': number; - 'p': number; - 'q': number; - 'r': number; - 's': number; - 't': number; - 'u': number; - 'v': number; - 'w': number; - 'x': number; - 'y': number; - 'z': number; - '0': number; - '1': number; - '2': number; - '3': number; - '4': number; - '5': number; - '6': number; - '7': number; - '8': number; - '9': number; - 'f1': number; - 'f2': number; - 'f3': number; - 'f4': number; - 'f5': number; - 'f6': number; - 'f7': number; - 'f8': number; - 'f9': number; - 'f10': number; - 'f11': number; - 'f12': number; - 'numpad 0': number; - 'numpad 1': number; - 'numpad 2': number; - 'numpad 3': number; - 'numpad 4': number; - 'numpad 5': number; - 'numpad 6': number; - 'numpad 7': number; - 'numpad 8': number; - 'numpad 9': number; -} - -declare interface AliasesMap { - 'windows': number; - '⇧': number; - '⌥': number; - '⌃': number; - '⌘': number; - 'ctl': number; - 'control': number; - 'option': number; - 'pause': number; - 'break': number; - 'caps': number; - 'return': number; - 'escape': number; - 'spc': number; - 'spacebar': number; - 'pgup': number; - 'pgdn': number; - 'ins': number; - 'del': number; - 'cmd': number; -} - -declare interface InverseCodesMap { - [key: number]: string; -} - -declare interface Keycode { - (event: Event): string; - (keycode: number): string; - (name: string): number; - codes: CodesMap; - aliases: AliasesMap; - names: InverseCodesMap; - isEventKey: (event: Event, nameOrCode: number | string) => boolean; -} diff --git a/node_modules/keycode/index.js b/node_modules/keycode/index.js deleted file mode 100644 index 9dc7ce1..0000000 --- a/node_modules/keycode/index.js +++ /dev/null @@ -1,175 +0,0 @@ -// Source: http://jsfiddle.net/vWx8V/ -// http://stackoverflow.com/questions/5603195/full-list-of-javascript-keycodes - -/** - * Conenience method returns corresponding value for given keyName or keyCode. - * - * @param {Mixed} keyCode {Number} or keyName {String} - * @return {Mixed} - * @api public - */ - -function keyCode(searchInput) { - // Keyboard Events - if (searchInput && 'object' === typeof searchInput) { - var hasKeyCode = searchInput.which || searchInput.keyCode || searchInput.charCode - if (hasKeyCode) searchInput = hasKeyCode - } - - // Numbers - if ('number' === typeof searchInput) return names[searchInput] - - // Everything else (cast to string) - var search = String(searchInput) - - // check codes - var foundNamedKey = codes[search.toLowerCase()] - if (foundNamedKey) return foundNamedKey - - // check aliases - var foundNamedKey = aliases[search.toLowerCase()] - if (foundNamedKey) return foundNamedKey - - // weird character? - if (search.length === 1) return search.charCodeAt(0) - - return undefined -} - -/** - * Compares a keyboard event with a given keyCode or keyName. - * - * @param {Event} event Keyboard event that should be tested - * @param {Mixed} keyCode {Number} or keyName {String} - * @return {Boolean} - * @api public - */ -keyCode.isEventKey = function isEventKey(event, nameOrCode) { - if (event && 'object' === typeof event) { - var keyCode = event.which || event.keyCode || event.charCode - if (keyCode === null || keyCode === undefined) { return false; } - if (typeof nameOrCode === 'string') { - // check codes - var foundNamedKey = codes[nameOrCode.toLowerCase()] - if (foundNamedKey) { return foundNamedKey === keyCode; } - - // check aliases - var foundNamedKey = aliases[nameOrCode.toLowerCase()] - if (foundNamedKey) { return foundNamedKey === keyCode; } - } else if (typeof nameOrCode === 'number') { - return nameOrCode === keyCode; - } - return false; - } -} - -exports = module.exports = keyCode; - -/** - * Get by name - * - * exports.code['enter'] // => 13 - */ - -var codes = exports.code = exports.codes = { - 'backspace': 8, - 'tab': 9, - 'enter': 13, - 'shift': 16, - 'ctrl': 17, - 'alt': 18, - 'pause/break': 19, - 'caps lock': 20, - 'esc': 27, - 'space': 32, - 'page up': 33, - 'page down': 34, - 'end': 35, - 'home': 36, - 'left': 37, - 'up': 38, - 'right': 39, - 'down': 40, - 'insert': 45, - 'delete': 46, - 'command': 91, - 'left command': 91, - 'right command': 93, - 'numpad *': 106, - 'numpad +': 107, - 'numpad -': 109, - 'numpad .': 110, - 'numpad /': 111, - 'num lock': 144, - 'scroll lock': 145, - 'my computer': 182, - 'my calculator': 183, - ';': 186, - '=': 187, - ',': 188, - '-': 189, - '.': 190, - '/': 191, - '`': 192, - '[': 219, - '\\': 220, - ']': 221, - "'": 222 -} - -// Helper aliases - -var aliases = exports.aliases = { - 'windows': 91, - '⇧': 16, - '⌥': 18, - '⌃': 17, - '⌘': 91, - 'ctl': 17, - 'control': 17, - 'option': 18, - 'pause': 19, - 'break': 19, - 'caps': 20, - 'return': 13, - 'escape': 27, - 'spc': 32, - 'spacebar': 32, - 'pgup': 33, - 'pgdn': 34, - 'ins': 45, - 'del': 46, - 'cmd': 91 -} - -/*! - * Programatically add the following - */ - -// lower case chars -for (i = 97; i < 123; i++) codes[String.fromCharCode(i)] = i - 32 - -// numbers -for (var i = 48; i < 58; i++) codes[i - 48] = i - -// function keys -for (i = 1; i < 13; i++) codes['f'+i] = i + 111 - -// numpad keys -for (i = 0; i < 10; i++) codes['numpad '+i] = i + 96 - -/** - * Get by code - * - * exports.name[13] // => 'Enter' - */ - -var names = exports.names = exports.title = {} // title for backward compat - -// Create reverse mapping -for (i in codes) names[codes[i]] = i - -// Add aliases -for (var alias in aliases) { - codes[alias] = aliases[alias] -} diff --git a/node_modules/keycode/package.json b/node_modules/keycode/package.json deleted file mode 100644 index 6e3cbde..0000000 --- a/node_modules/keycode/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "_from": "keycode@^2.2.0", - "_id": "keycode@2.2.0", - "_inBundle": false, - "_integrity": "sha1-PQr1bce4uOXLqNCpfxByBO7CKwQ=", - "_location": "/keycode", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "keycode@^2.2.0", - "name": "keycode", - "escapedName": "keycode", - "rawSpec": "^2.2.0", - "saveSpec": null, - "fetchSpec": "^2.2.0" - }, - "_requiredBy": [ - "/video.js" - ], - "_resolved": "https://registry.npmjs.org/keycode/-/keycode-2.2.0.tgz", - "_shasum": "3d0af56dc7b8b8e5cba8d0a97f107204eec22b04", - "_spec": "keycode@^2.2.0", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js", - "author": { - "name": "Tim Oxley", - "email": "secoif@gmail.com" - }, - "bugs": { - "url": "https://github.com/timoxley/keycode/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Convert between keyboard keycodes and keynames and vice versa.", - "devDependencies": { - "mocha": "^3.0.2" - }, - "directories": { - "example": "examples", - "test": "test" - }, - "homepage": "https://github.com/timoxley/keycode", - "keywords": [ - "keyboard", - "keycode", - "keyboardevent", - "ascii", - "keydown", - "keyup", - "metakey", - "keyname", - "keypress" - ], - "license": "MIT", - "main": "index.js", - "name": "keycode", - "repository": { - "type": "git", - "url": "git://github.com/timoxley/keycode.git" - }, - "scripts": { - "test": "mocha test/keycode.js" - }, - "typings": "./keycode.d.ts", - "version": "2.2.0" -} diff --git a/node_modules/keycode/test/keycode.js b/node_modules/keycode/test/keycode.js deleted file mode 100644 index bd10f2c..0000000 --- a/node_modules/keycode/test/keycode.js +++ /dev/null @@ -1,134 +0,0 @@ -"use strict" - -// check if is component -if (require.modules) { - var keycode = require('keycode') - var assert = require('timoxley-assert') -} else { - var keycode = require('../') - var assert = require('assert') -} - -it('can return a charcode from a letter', function() { - assert.strictEqual(keycode('0'), 48); - assert.strictEqual(keycode('B'), 66); - assert.strictEqual(keycode('f1'), 112); - assert.strictEqual(keycode('9'), 57); - assert.strictEqual(keycode('numpad 0'), 96); -}) - - -it('can use aliases from a letter', function() { - assert.strictEqual(keycode('ctl'), keycode('ctrl')); -}) - -it('does not use alias name when mapping back from a number', function() { - for (var key in keycode.aliases) { - assert.notStrictEqual(keycode(keycode(key)), key); - } -}) - -it('is case insensitive', function() { - assert.strictEqual(keycode('a'), 65); - assert.strictEqual(keycode('A'), 65); - assert.strictEqual(keycode('enter'), 13); - assert.strictEqual(keycode('ENTER'), 13); - assert.strictEqual(keycode('enTeR'), 13); - assert.strictEqual(keycode('Spacebar'), 32); -}) - -it('returns char code for strange chars', function() { - // TODO: not sure if this is sensible behaviour - assert.strictEqual(keycode('∆'), 8710); - assert.strictEqual(keycode('漢'), 28450); -}) - -it('returns undefined for unknown strings', function() { - assert.strictEqual(keycode('ants'), undefined); - assert.strictEqual(keycode('Bagels'), undefined); - assert.strictEqual(keycode(''), undefined); - assert.strictEqual(keycode('JKHG KJG LSDF'), undefined); -}) - -it('returns undefined for unknown numbers', function() { - assert.strictEqual(keycode(-1), undefined); - assert.strictEqual(keycode(Infinity), undefined); - assert.strictEqual(keycode(0.3), undefined); - assert.strictEqual(keycode(9999999), undefined); -}) - -it('returns code for objects implementing toString function', function() { - var obj = {} - obj.toString = function() { - return 'a' - } - assert.strictEqual(keycode(obj), 65); -}) - -it('returns char for objects with a keyCode property', function() { - var obj = { keyCode: 65 } - assert.strictEqual(keycode(obj), 'a'); -}) - -it('returns undefined for any other passed in type', function() { - assert.strictEqual(keycode({}), undefined); - assert.strictEqual(keycode([]), undefined); - assert.strictEqual(keycode([1,2]), undefined); - assert.strictEqual(keycode(null), undefined); - assert.strictEqual(keycode(undefined), undefined); - assert.strictEqual(keycode(/.*/), undefined); - assert.strictEqual(keycode(), undefined); -}) - -it('is commutative', function() { - for (var key in keycode.code) { - assert.strictEqual(keycode(key), keycode(keycode(keycode(key)))) - } -}) - -it('exposes keycode/name maps', function() { - for (var code in keycode.codes) { - assert.strictEqual(keycode(code), keycode(keycode.names[keycode.codes[code]])) - } -}) - -it('should return shift, ctrl, and alt for 16, 17, and 18', function() { - assert.strictEqual(keycode(16), 'shift') - assert.strictEqual(keycode(17), 'ctrl') - assert.strictEqual(keycode(18), 'alt') -}) - -describe('isEventKey', function() { - - it('should allow to compare events to their names', function() { - var event = { which: 13, keyCode: 13, charCode: 13 }; - assert.strictEqual(keycode.isEventKey(event, 'enter'), true); - assert.strictEqual(keycode.isEventKey(event, 'down'), false); - }); - - it('should allow to compare events to their names (case insensitive)', function() { - var event = { which: 13, keyCode: 13, charCode: 13 }; - assert.strictEqual(keycode.isEventKey(event, 'eNtER'), true); - assert.strictEqual(keycode.isEventKey(event, 'dOWN'), false); - }); - - it('should return false if a ', function() { - var event = { which: 13, keyCode: 13, charCode: 13 }; - assert.strictEqual(keycode.isEventKey(event, 'eNtER'), true); - assert.strictEqual(keycode.isEventKey(event, 'dOWN'), false); - }); - - it('should allow to compare events to their keyCodes)', function() { - var event = { which: 13, keyCode: 13, charCode: 13 }; - assert.strictEqual(keycode.isEventKey(event, 13), true); - assert.strictEqual(keycode.isEventKey(event, 14), false); - }); - - it('should not break when invalid key codes are entered, instead false should be returned', function() { - var event = { which: -1, keyCode: -1, charCode: -1 }; - assert.strictEqual(keycode.isEventKey(event, 'enter'), false); - assert.strictEqual(keycode.isEventKey(event, 'down'), false); - }); - -}); - diff --git a/node_modules/keycode/test/mocha.css b/node_modules/keycode/test/mocha.css deleted file mode 100644 index 0588391..0000000 --- a/node_modules/keycode/test/mocha.css +++ /dev/null @@ -1,203 +0,0 @@ -@charset "UTF-8"; -body { - font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; - padding: 60px 50px; -} - -#mocha ul, #mocha li { - margin: 0; - padding: 0; -} - -#mocha ul { - list-style: none; -} - -#mocha h1, #mocha h2 { - margin: 0; -} - -#mocha h1 { - margin-top: 15px; - font-size: 1em; - font-weight: 200; -} - -#mocha h1 a { - text-decoration: none; - color: inherit; -} - -#mocha h1 a:hover { - text-decoration: underline; -} - -#mocha .suite .suite h1 { - margin-top: 0; - font-size: .8em; -} - -.hidden { - display: none; -} - -#mocha h2 { - font-size: 12px; - font-weight: normal; - cursor: pointer; -} - -#mocha .suite { - margin-left: 15px; -} - -#mocha .test { - margin-left: 15px; -} - -#mocha .test:hover h2::after { - position: relative; - top: 0; - right: -10px; - content: '(view source)'; - font-size: 12px; - font-family: arial; - color: #888; -} - -#mocha .test.pending:hover h2::after { - content: '(pending)'; - font-family: arial; -} - -#mocha .test.pass.medium .duration { - background: #C09853; -} - -#mocha .test.pass.slow .duration { - background: #B94A48; -} - -#mocha .test.pass::before { - content: '✓'; - font-size: 12px; - display: block; - float: left; - margin-right: 5px; - color: #00d6b2; -} - -#mocha .test.pass .duration { - font-size: 9px; - margin-left: 5px; - padding: 2px 5px; - color: white; - -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2); - -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2); - box-shadow: inset 0 1px 1px rgba(0,0,0,.2); - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -ms-border-radius: 5px; - -o-border-radius: 5px; - border-radius: 5px; -} - -#mocha .test.pass.fast .duration { - display: none; -} - -#mocha .test.pending { - color: #0b97c4; -} - -#mocha .test.pending::before { - content: '◦'; - color: #0b97c4; -} - -#mocha .test.fail { - color: #c00; -} - -#mocha .test.fail pre { - color: black; -} - -#mocha .test.fail::before { - content: '✖'; - font-size: 12px; - display: block; - float: left; - margin-right: 5px; - color: #c00; -} - -#mocha .test pre.error { - color: #c00; -} - -#mocha .test pre { - display: inline-block; - font: 12px/1.5 monaco, monospace; - margin: 5px; - padding: 15px; - border: 1px solid #eee; - border-bottom-color: #ddd; - -webkit-border-radius: 3px; - -webkit-box-shadow: 0 1px 3px #eee; -} - -#report.pass .test.fail { - display: none; -} - -#report.fail .test.pass { - display: none; -} - -#error { - color: #c00; - font-size: 1.5 em; - font-weight: 100; - letter-spacing: 1px; -} - -#stats { - position: fixed; - top: 15px; - right: 10px; - font-size: 12px; - margin: 0; - color: #888; -} - -#stats .progress { - float: right; - padding-top: 0; -} - -#stats em { - color: black; -} - -#stats a { - text-decoration: none; - color: inherit; -} - -#stats a:hover { - border-bottom: 1px solid #eee; -} - -#stats li { - display: inline-block; - margin: 0 5px; - list-style: none; - padding-top: 11px; -} - -code .comment { color: #ddd } -code .init { color: #2F6FAD } -code .string { color: #5890AD } -code .keyword { color: #8A6343 } -code .number { color: #2F6FAD } diff --git a/node_modules/keycode/test/mocha.js b/node_modules/keycode/test/mocha.js deleted file mode 100644 index b27c2df..0000000 --- a/node_modules/keycode/test/mocha.js +++ /dev/null @@ -1,4906 +0,0 @@ -;(function(){ - - -// CommonJS require() - -function require(p){ - var path = require.resolve(p) - , mod = require.modules[path]; - if (!mod) throw new Error('failed to require "' + p + '"'); - if (!mod.exports) { - mod.exports = {}; - mod.call(mod.exports, mod, mod.exports, require.relative(path)); - } - return mod.exports; - } - -require.modules = {}; - -require.resolve = function (path){ - var orig = path - , reg = path + '.js' - , index = path + '/index.js'; - return require.modules[reg] && reg - || require.modules[index] && index - || orig; - }; - -require.register = function (path, fn){ - require.modules[path] = fn; - }; - -require.relative = function (parent) { - return function(p){ - if ('.' != p.charAt(0)) return require(p); - - var path = parent.split('/') - , segs = p.split('/'); - path.pop(); - - for (var i = 0; i < segs.length; i++) { - var seg = segs[i]; - if ('..' == seg) path.pop(); - else if ('.' != seg) path.push(seg); - } - - return require(path.join('/')); - }; - }; - - -require.register("browser/debug.js", function(module, exports, require){ - -module.exports = function(type){ - return function(){ - - } -}; -}); // module: browser/debug.js - -require.register("browser/diff.js", function(module, exports, require){ - -}); // module: browser/diff.js - -require.register("browser/events.js", function(module, exports, require){ - -/** - * Module exports. - */ - -exports.EventEmitter = EventEmitter; - -/** - * Check if `obj` is an array. - */ - -function isArray(obj) { - return '[object Array]' == {}.toString.call(obj); -} - -/** - * Event emitter constructor. - * - * @api public - */ - -function EventEmitter(){}; - -/** - * Adds a listener. - * - * @api public - */ - -EventEmitter.prototype.on = function (name, fn) { - if (!this.$events) { - this.$events = {}; - } - - if (!this.$events[name]) { - this.$events[name] = fn; - } else if (isArray(this.$events[name])) { - this.$events[name].push(fn); - } else { - this.$events[name] = [this.$events[name], fn]; - } - - return this; -}; - -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -/** - * Adds a volatile listener. - * - * @api public - */ - -EventEmitter.prototype.once = function (name, fn) { - var self = this; - - function on () { - self.removeListener(name, on); - fn.apply(this, arguments); - }; - - on.listener = fn; - this.on(name, on); - - return this; -}; - -/** - * Removes a listener. - * - * @api public - */ - -EventEmitter.prototype.removeListener = function (name, fn) { - if (this.$events && this.$events[name]) { - var list = this.$events[name]; - - if (isArray(list)) { - var pos = -1; - - for (var i = 0, l = list.length; i < l; i++) { - if (list[i] === fn || (list[i].listener && list[i].listener === fn)) { - pos = i; - break; - } - } - - if (pos < 0) { - return this; - } - - list.splice(pos, 1); - - if (!list.length) { - delete this.$events[name]; - } - } else if (list === fn || (list.listener && list.listener === fn)) { - delete this.$events[name]; - } - } - - return this; -}; - -/** - * Removes all listeners for an event. - * - * @api public - */ - -EventEmitter.prototype.removeAllListeners = function (name) { - if (name === undefined) { - this.$events = {}; - return this; - } - - if (this.$events && this.$events[name]) { - this.$events[name] = null; - } - - return this; -}; - -/** - * Gets all listeners for a certain event. - * - * @api public - */ - -EventEmitter.prototype.listeners = function (name) { - if (!this.$events) { - this.$events = {}; - } - - if (!this.$events[name]) { - this.$events[name] = []; - } - - if (!isArray(this.$events[name])) { - this.$events[name] = [this.$events[name]]; - } - - return this.$events[name]; -}; - -/** - * Emits an event. - * - * @api public - */ - -EventEmitter.prototype.emit = function (name) { - if (!this.$events) { - return false; - } - - var handler = this.$events[name]; - - if (!handler) { - return false; - } - - var args = [].slice.call(arguments, 1); - - if ('function' == typeof handler) { - handler.apply(this, args); - } else if (isArray(handler)) { - var listeners = handler.slice(); - - for (var i = 0, l = listeners.length; i < l; i++) { - listeners[i].apply(this, args); - } - } else { - return false; - } - - return true; -}; -}); // module: browser/events.js - -require.register("browser/fs.js", function(module, exports, require){ - -}); // module: browser/fs.js - -require.register("browser/path.js", function(module, exports, require){ - -}); // module: browser/path.js - -require.register("browser/progress.js", function(module, exports, require){ - -/** - * Expose `Progress`. - */ - -module.exports = Progress; - -/** - * Initialize a new `Progress` indicator. - */ - -function Progress() { - this.percent = 0; - this.size(0); - this.fontSize(11); - this.font('helvetica, arial, sans-serif'); -} - -/** - * Set progress size to `n`. - * - * @param {Number} n - * @return {Progress} for chaining - * @api public - */ - -Progress.prototype.size = function(n){ - this._size = n; - return this; -}; - -/** - * Set text to `str`. - * - * @param {String} str - * @return {Progress} for chaining - * @api public - */ - -Progress.prototype.text = function(str){ - this._text = str; - return this; -}; - -/** - * Set font size to `n`. - * - * @param {Number} n - * @return {Progress} for chaining - * @api public - */ - -Progress.prototype.fontSize = function(n){ - this._fontSize = n; - return this; -}; - -/** - * Set font `family`. - * - * @param {String} family - * @return {Progress} for chaining - */ - -Progress.prototype.font = function(family){ - this._font = family; - return this; -}; - -/** - * Update percentage to `n`. - * - * @param {Number} n - * @return {Progress} for chaining - */ - -Progress.prototype.update = function(n){ - this.percent = n; - return this; -}; - -/** - * Draw on `ctx`. - * - * @param {CanvasRenderingContext2d} ctx - * @return {Progress} for chaining - */ - -Progress.prototype.draw = function(ctx){ - var percent = Math.min(this.percent, 100) - , size = this._size - , half = size / 2 - , x = half - , y = half - , rad = half - 1 - , fontSize = this._fontSize; - - ctx.font = fontSize + 'px ' + this._font; - - var angle = Math.PI * 2 * (percent / 100); - ctx.clearRect(0, 0, size, size); - - // outer circle - ctx.strokeStyle = '#9f9f9f'; - ctx.beginPath(); - ctx.arc(x, y, rad, 0, angle, false); - ctx.stroke(); - - // inner circle - ctx.strokeStyle = '#eee'; - ctx.beginPath(); - ctx.arc(x, y, rad - 1, 0, angle, true); - ctx.stroke(); - - // text - var text = this._text || (percent | 0) + '%' - , w = ctx.measureText(text).width; - - ctx.fillText( - text - , x - w / 2 + 1 - , y + fontSize / 2 - 1); - - return this; -}; - -}); // module: browser/progress.js - -require.register("browser/tty.js", function(module, exports, require){ - -exports.isatty = function(){ - return true; -}; - -exports.getWindowSize = function(){ - return [window.innerHeight, window.innerWidth]; -}; -}); // module: browser/tty.js - -require.register("context.js", function(module, exports, require){ - -/** - * Expose `Context`. - */ - -module.exports = Context; - -/** - * Initialize a new `Context`. - * - * @api private - */ - -function Context(){} - -/** - * Set or get the context `Runnable` to `runnable`. - * - * @param {Runnable} runnable - * @return {Context} - * @api private - */ - -Context.prototype.runnable = function(runnable){ - if (0 == arguments.length) return this._runnable; - this.test = this._runnable = runnable; - return this; -}; - -/** - * Set test timeout `ms`. - * - * @param {Number} ms - * @return {Context} self - * @api private - */ - -Context.prototype.timeout = function(ms){ - this.runnable().timeout(ms); - return this; -}; - -/** - * Set test slowness threshold `ms`. - * - * @param {Number} ms - * @return {Context} self - * @api private - */ - -Context.prototype.slow = function(ms){ - this.runnable().slow(ms); - return this; -}; - -/** - * Inspect the context void of `._runnable`. - * - * @return {String} - * @api private - */ - -Context.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ - if ('_runnable' == key) return; - if ('test' == key) return; - return val; - }, 2); -}; - -}); // module: context.js - -require.register("hook.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Runnable = require('./runnable'); - -/** - * Expose `Hook`. - */ - -module.exports = Hook; - -/** - * Initialize a new `Hook` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - */ - -function Hook(title, fn) { - Runnable.call(this, title, fn); - this.type = 'hook'; -} - -/** - * Inherit from `Runnable.prototype`. - */ - -Hook.prototype = new Runnable; -Hook.prototype.constructor = Hook; - - -/** - * Get or set the test `err`. - * - * @param {Error} err - * @return {Error} - * @api public - */ - -Hook.prototype.error = function(err){ - if (0 == arguments.length) { - var err = this._error; - this._error = null; - return err; - } - - this._error = err; -}; - - -}); // module: hook.js - -require.register("interfaces/bdd.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test'); - -/** - * BDD-style interface: - * - * describe('Array', function(){ - * describe('#indexOf()', function(){ - * it('should return -1 when not present', function(){ - * - * }); - * - * it('should return the index when present', function(){ - * - * }); - * }); - * }); - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ - - /** - * Execute before running tests. - */ - - context.before = function(fn){ - suites[0].beforeAll(fn); - }; - - /** - * Execute after running tests. - */ - - context.after = function(fn){ - suites[0].afterAll(fn); - }; - - /** - * Execute before each test case. - */ - - context.beforeEach = function(fn){ - suites[0].beforeEach(fn); - }; - - /** - * Execute after each test case. - */ - - context.afterEach = function(fn){ - suites[0].afterEach(fn); - }; - - /** - * Describe a "suite" with the given `title` - * and callback `fn` containing nested suites - * and/or tests. - */ - - context.describe = context.context = function(title, fn){ - var suite = Suite.create(suites[0], title); - suites.unshift(suite); - fn(); - suites.shift(); - return suite; - }; - - /** - * Pending describe. - */ - - context.xdescribe = - context.xcontext = - context.describe.skip = function(title, fn){ - var suite = Suite.create(suites[0], title); - suite.pending = true; - suites.unshift(suite); - fn(); - suites.shift(); - }; - - /** - * Exclusive suite. - */ - - context.describe.only = function(title, fn){ - var suite = context.describe(title, fn); - mocha.grep(suite.fullTitle()); - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.it = context.specify = function(title, fn){ - var suite = suites[0]; - if (suite.pending) var fn = null; - var test = new Test(title, fn); - suite.addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.it.only = function(title, fn){ - var test = context.it(title, fn); - mocha.grep(test.fullTitle()); - }; - - /** - * Pending test case. - */ - - context.xit = - context.xspecify = - context.it.skip = function(title){ - context.it(title); - }; - }); -}; - -}); // module: interfaces/bdd.js - -require.register("interfaces/exports.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test'); - -/** - * TDD-style interface: - * - * exports.Array = { - * '#indexOf()': { - * 'should return -1 when the value is not present': function(){ - * - * }, - * - * 'should return the correct index when the value is present': function(){ - * - * } - * } - * }; - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('require', visit); - - function visit(obj) { - var suite; - for (var key in obj) { - if ('function' == typeof obj[key]) { - var fn = obj[key]; - switch (key) { - case 'before': - suites[0].beforeAll(fn); - break; - case 'after': - suites[0].afterAll(fn); - break; - case 'beforeEach': - suites[0].beforeEach(fn); - break; - case 'afterEach': - suites[0].afterEach(fn); - break; - default: - suites[0].addTest(new Test(key, fn)); - } - } else { - var suite = Suite.create(suites[0], key); - suites.unshift(suite); - visit(obj[key]); - suites.shift(); - } - } - } -}; -}); // module: interfaces/exports.js - -require.register("interfaces/index.js", function(module, exports, require){ - -exports.bdd = require('./bdd'); -exports.tdd = require('./tdd'); -exports.qunit = require('./qunit'); -exports.exports = require('./exports'); - -}); // module: interfaces/index.js - -require.register("interfaces/qunit.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test'); - -/** - * QUnit-style interface: - * - * suite('Array'); - * - * test('#length', function(){ - * var arr = [1,2,3]; - * ok(arr.length == 3); - * }); - * - * test('#indexOf()', function(){ - * var arr = [1,2,3]; - * ok(arr.indexOf(1) == 0); - * ok(arr.indexOf(2) == 1); - * ok(arr.indexOf(3) == 2); - * }); - * - * suite('String'); - * - * test('#length', function(){ - * ok('foo'.length == 3); - * }); - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context){ - - /** - * Execute before running tests. - */ - - context.before = function(fn){ - suites[0].beforeAll(fn); - }; - - /** - * Execute after running tests. - */ - - context.after = function(fn){ - suites[0].afterAll(fn); - }; - - /** - * Execute before each test case. - */ - - context.beforeEach = function(fn){ - suites[0].beforeEach(fn); - }; - - /** - * Execute after each test case. - */ - - context.afterEach = function(fn){ - suites[0].afterEach(fn); - }; - - /** - * Describe a "suite" with the given `title`. - */ - - context.suite = function(title){ - if (suites.length > 1) suites.shift(); - var suite = Suite.create(suites[0], title); - suites.unshift(suite); - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.test = function(title, fn){ - suites[0].addTest(new Test(title, fn)); - }; - }); -}; - -}); // module: interfaces/qunit.js - -require.register("interfaces/tdd.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test'); - -/** - * TDD-style interface: - * - * suite('Array', function(){ - * suite('#indexOf()', function(){ - * suiteSetup(function(){ - * - * }); - * - * test('should return -1 when not present', function(){ - * - * }); - * - * test('should return the index when present', function(){ - * - * }); - * - * suiteTeardown(function(){ - * - * }); - * }); - * }); - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ - - /** - * Execute before each test case. - */ - - context.setup = function(fn){ - suites[0].beforeEach(fn); - }; - - /** - * Execute after each test case. - */ - - context.teardown = function(fn){ - suites[0].afterEach(fn); - }; - - /** - * Execute before the suite. - */ - - context.suiteSetup = function(fn){ - suites[0].beforeAll(fn); - }; - - /** - * Execute after the suite. - */ - - context.suiteTeardown = function(fn){ - suites[0].afterAll(fn); - }; - - /** - * Describe a "suite" with the given `title` - * and callback `fn` containing nested suites - * and/or tests. - */ - - context.suite = function(title, fn){ - var suite = Suite.create(suites[0], title); - suites.unshift(suite); - fn(); - suites.shift(); - return suite; - }; - - /** - * Exclusive test-case. - */ - - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.test = function(title, fn){ - var test = new Test(title, fn); - suites[0].addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.test.only = function(title, fn){ - var test = context.test(title, fn); - mocha.grep(test.fullTitle()); - }; - }); -}; - -}); // module: interfaces/tdd.js - -require.register("mocha.js", function(module, exports, require){ -/*! - * mocha - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var path = require('browser/path') - , utils = require('./utils'); - -/** - * Expose `Mocha`. - */ - -exports = module.exports = Mocha; - -/** - * Expose internals. - */ - -exports.utils = utils; -exports.interfaces = require('./interfaces'); -exports.reporters = require('./reporters'); -exports.Runnable = require('./runnable'); -exports.Context = require('./context'); -exports.Runner = require('./runner'); -exports.Suite = require('./suite'); -exports.Hook = require('./hook'); -exports.Test = require('./test'); - -/** - * Return image `name` path. - * - * @param {String} name - * @return {String} - * @api private - */ - -function image(name) { - return __dirname + '/../images/' + name + '.png'; -} - -/** - * Setup mocha with `options`. - * - * Options: - * - * - `ui` name "bdd", "tdd", "exports" etc - * - `reporter` reporter instance, defaults to `mocha.reporters.Dot` - * - `globals` array of accepted globals - * - `timeout` timeout in milliseconds - * - `slow` milliseconds to wait before considering a test slow - * - `ignoreLeaks` ignore global leaks - * - `grep` string or regexp to filter tests with - * - * @param {Object} options - * @api public - */ - -function Mocha(options) { - options = options || {}; - this.files = []; - this.options = options; - this.grep(options.grep); - this.suite = new exports.Suite('', new exports.Context); - this.ui(options.ui); - this.reporter(options.reporter); - if (options.timeout) this.timeout(options.timeout); - if (options.slow) this.slow(options.slow); -} - -/** - * Add test `file`. - * - * @param {String} file - * @api public - */ - -Mocha.prototype.addFile = function(file){ - this.files.push(file); - return this; -}; - -/** - * Set reporter to `reporter`, defaults to "dot". - * - * @param {String|Function} reporter name of a reporter or a reporter constructor - * @api public - */ - -Mocha.prototype.reporter = function(reporter){ - if ('function' == typeof reporter) { - this._reporter = reporter; - } else { - reporter = reporter || 'dot'; - try { - this._reporter = require('./reporters/' + reporter); - } catch (err) { - this._reporter = require(reporter); - } - if (!this._reporter) throw new Error('invalid reporter "' + reporter + '"'); - } - return this; -}; - -/** - * Set test UI `name`, defaults to "bdd". - * - * @param {String} bdd - * @api public - */ - -Mocha.prototype.ui = function(name){ - name = name || 'bdd'; - this._ui = exports.interfaces[name]; - if (!this._ui) throw new Error('invalid interface "' + name + '"'); - this._ui = this._ui(this.suite); - return this; -}; - -/** - * Load registered files. - * - * @api private - */ - -Mocha.prototype.loadFiles = function(fn){ - var self = this; - var suite = this.suite; - var pending = this.files.length; - this.files.forEach(function(file){ - file = path.resolve(file); - suite.emit('pre-require', global, file, self); - suite.emit('require', require(file), file, self); - suite.emit('post-require', global, file, self); - --pending || (fn && fn()); - }); -}; - -/** - * Enable growl support. - * - * @api private - */ - -Mocha.prototype._growl = function(runner, reporter) { - var notify = require('growl'); - - runner.on('end', function(){ - var stats = reporter.stats; - if (stats.failures) { - var msg = stats.failures + ' of ' + runner.total + ' tests failed'; - notify(msg, { name: 'mocha', title: 'Failed', image: image('error') }); - } else { - notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', { - name: 'mocha' - , title: 'Passed' - , image: image('ok') - }); - } - }); -}; - -/** - * Add regexp to grep, if `re` is a string it is escaped. - * - * @param {RegExp|String} re - * @return {Mocha} - * @api public - */ - -Mocha.prototype.grep = function(re){ - this.options.grep = 'string' == typeof re - ? new RegExp(utils.escapeRegexp(re)) - : re; - return this; -}; - -/** - * Invert `.grep()` matches. - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.invert = function(){ - this.options.invert = true; - return this; -}; - -/** - * Ignore global leaks. - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.ignoreLeaks = function(){ - this.options.ignoreLeaks = true; - return this; -}; - -/** - * Enable global leak checking. - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.checkLeaks = function(){ - this.options.ignoreLeaks = false; - return this; -}; - -/** - * Enable growl support. - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.growl = function(){ - this.options.growl = true; - return this; -}; - -/** - * Ignore `globals` array or string. - * - * @param {Array|String} globals - * @return {Mocha} - * @api public - */ - -Mocha.prototype.globals = function(globals){ - this.options.globals = (this.options.globals || []).concat(globals); - return this; -}; - -/** - * Set the timeout in milliseconds. - * - * @param {Number} timeout - * @return {Mocha} - * @api public - */ - -Mocha.prototype.timeout = function(timeout){ - this.suite.timeout(timeout); - return this; -}; - -/** - * Set slowness threshold in milliseconds. - * - * @param {Number} slow - * @return {Mocha} - * @api public - */ - -Mocha.prototype.slow = function(slow){ - this.suite.slow(slow); - return this; -}; - -/** - * Run tests and invoke `fn()` when complete. - * - * @param {Function} fn - * @return {Runner} - * @api public - */ - -Mocha.prototype.run = function(fn){ - if (this.files.length) this.loadFiles(); - var suite = this.suite; - var options = this.options; - var runner = new exports.Runner(suite); - var reporter = new this._reporter(runner); - runner.ignoreLeaks = options.ignoreLeaks; - if (options.grep) runner.grep(options.grep, options.invert); - if (options.globals) runner.globals(options.globals); - if (options.growl) this._growl(runner, reporter); - return runner.run(fn); -}; - -}); // module: mocha.js - -require.register("ms.js", function(module, exports, require){ - -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; - -/** - * Parse or format the given `val`. - * - * @param {String|Number} val - * @return {String|Number} - * @api public - */ - -module.exports = function(val){ - if ('string' == typeof val) return parse(val); - return format(val); -} - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - var m = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); - if (!m) return; - var n = parseFloat(m[1]); - var type = (m[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'y': - return n * 31557600000; - case 'days': - case 'day': - case 'd': - return n * 86400000; - case 'hours': - case 'hour': - case 'h': - return n * 3600000; - case 'minutes': - case 'minute': - case 'm': - return n * 60000; - case 'seconds': - case 'second': - case 's': - return n * 1000; - case 'ms': - return n; - } -} - -/** - * Format the given `ms`. - * - * @param {Number} ms - * @return {String} - * @api public - */ - -function format(ms) { - if (ms == d) return (ms / d) + ' day'; - if (ms > d) return (ms / d) + ' days'; - if (ms == h) return (ms / h) + ' hour'; - if (ms > h) return (ms / h) + ' hours'; - if (ms == m) return (ms / m) + ' minute'; - if (ms > m) return (ms / m) + ' minutes'; - if (ms == s) return (ms / s) + ' second'; - if (ms > s) return (ms / s) + ' seconds'; - return ms + ' ms'; -} -}); // module: ms.js - -require.register("reporters/base.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var tty = require('browser/tty') - , diff = require('browser/diff') - , ms = require('../ms'); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Check if both stdio streams are associated with a tty. - */ - -var isatty = tty.isatty(1) && tty.isatty(2); - -/** - * Expose `Base`. - */ - -exports = module.exports = Base; - -/** - * Enable coloring by default. - */ - -exports.useColors = isatty; - -/** - * Default color map. - */ - -exports.colors = { - 'pass': 90 - , 'fail': 31 - , 'bright pass': 92 - , 'bright fail': 91 - , 'bright yellow': 93 - , 'pending': 36 - , 'suite': 0 - , 'error title': 0 - , 'error message': 31 - , 'error stack': 90 - , 'checkmark': 32 - , 'fast': 90 - , 'medium': 33 - , 'slow': 31 - , 'green': 32 - , 'light': 90 - , 'diff gutter': 90 - , 'diff added': 42 - , 'diff removed': 41 -}; - -/** - * Color `str` with the given `type`, - * allowing colors to be disabled, - * as well as user-defined color - * schemes. - * - * @param {String} type - * @param {String} str - * @return {String} - * @api private - */ - -var color = exports.color = function(type, str) { - if (!exports.useColors) return str; - return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; -}; - -/** - * Expose term window size, with some - * defaults for when stderr is not a tty. - */ - -exports.window = { - width: isatty - ? process.stdout.getWindowSize - ? process.stdout.getWindowSize(1)[0] - : tty.getWindowSize()[1] - : 75 -}; - -/** - * Expose some basic cursor interactions - * that are common among reporters. - */ - -exports.cursor = { - hide: function(){ - process.stdout.write('\u001b[?25l'); - }, - - show: function(){ - process.stdout.write('\u001b[?25h'); - }, - - deleteLine: function(){ - process.stdout.write('\u001b[2K'); - }, - - beginningOfLine: function(){ - process.stdout.write('\u001b[0G'); - }, - - CR: function(){ - exports.cursor.deleteLine(); - exports.cursor.beginningOfLine(); - } -}; - -/** - * Outut the given `failures` as a list. - * - * @param {Array} failures - * @api public - */ - -exports.list = function(failures){ - console.error(); - failures.forEach(function(test, i){ - // format - var fmt = color('error title', ' %s) %s:\n') - + color('error message', ' %s') - + color('error stack', '\n%s\n'); - - // msg - var err = test.err - , message = err.message || '' - , stack = err.stack || message - , index = stack.indexOf(message) + message.length - , msg = stack.slice(0, index) - , actual = err.actual - , expected = err.expected - , escape = true; - - // explicitly show diff - if (err.showDiff) { - escape = false; - err.actual = actual = JSON.stringify(actual, null, 2); - err.expected = expected = JSON.stringify(expected, null, 2); - } - - // actual / expected diff - if ('string' == typeof actual && 'string' == typeof expected) { - var len = Math.max(actual.length, expected.length); - - if (len < 20) msg = errorDiff(err, 'Chars', escape); - else msg = errorDiff(err, 'Words', escape); - - // linenos - var lines = msg.split('\n'); - if (lines.length > 4) { - var width = String(lines.length).length; - msg = lines.map(function(str, i){ - return pad(++i, width) + ' |' + ' ' + str; - }).join('\n'); - } - - // legend - msg = '\n' - + color('diff removed', 'actual') - + ' ' - + color('diff added', 'expected') - + '\n\n' - + msg - + '\n'; - - // indent - msg = msg.replace(/^/gm, ' '); - - fmt = color('error title', ' %s) %s:\n%s') - + color('error stack', '\n%s\n'); - } - - // indent stack trace without msg - stack = stack.slice(index ? index + 1 : index) - .replace(/^/gm, ' '); - - console.error(fmt, (i + 1), test.fullTitle(), msg, stack); - }); -}; - -/** - * Initialize a new `Base` reporter. - * - * All other reporters generally - * inherit from this reporter, providing - * stats such as test duration, number - * of tests passed / failed etc. - * - * @param {Runner} runner - * @api public - */ - -function Base(runner) { - var self = this - , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 } - , failures = this.failures = []; - - if (!runner) return; - this.runner = runner; - - runner.on('start', function(){ - stats.start = new Date; - }); - - runner.on('suite', function(suite){ - stats.suites = stats.suites || 0; - suite.root || stats.suites++; - }); - - runner.on('test end', function(test){ - stats.tests = stats.tests || 0; - stats.tests++; - }); - - runner.on('pass', function(test){ - stats.passes = stats.passes || 0; - - var medium = test.slow() / 2; - test.speed = test.duration > test.slow() - ? 'slow' - : test.duration > medium - ? 'medium' - : 'fast'; - - stats.passes++; - }); - - runner.on('fail', function(test, err){ - stats.failures = stats.failures || 0; - stats.failures++; - test.err = err; - failures.push(test); - }); - - runner.on('end', function(){ - stats.end = new Date; - stats.duration = new Date - stats.start; - }); - - runner.on('pending', function(){ - stats.pending++; - }); -} - -/** - * Output common epilogue used by many of - * the bundled reporters. - * - * @api public - */ - -Base.prototype.epilogue = function(){ - var stats = this.stats - , fmt - , tests; - - console.log(); - - function pluralize(n) { - return 1 == n ? 'test' : 'tests'; - } - - // failure - if (stats.failures) { - fmt = color('bright fail', ' ✖') - + color('fail', ' %d of %d %s failed') - + color('light', ':') - - console.error(fmt, - stats.failures, - this.runner.total, - pluralize(this.runner.total)); - - Base.list(this.failures); - console.error(); - return; - } - - // pass - fmt = color('bright pass', ' ✔') - + color('green', ' %d %s complete') - + color('light', ' (%s)'); - - console.log(fmt, - stats.tests || 0, - pluralize(stats.tests), - ms(stats.duration)); - - // pending - if (stats.pending) { - fmt = color('pending', ' •') - + color('pending', ' %d %s pending'); - - console.log(fmt, stats.pending, pluralize(stats.pending)); - } - - console.log(); -}; - -/** - * Pad the given `str` to `len`. - * - * @param {String} str - * @param {String} len - * @return {String} - * @api private - */ - -function pad(str, len) { - str = String(str); - return Array(len - str.length + 1).join(' ') + str; -} - -/** - * Return a character diff for `err`. - * - * @param {Error} err - * @return {String} - * @api private - */ - -function errorDiff(err, type, escape) { - return diff['diff' + type](err.actual, err.expected).map(function(str){ - if (escape) { - str.value = str.value - .replace(/\t/g, '') - .replace(/\r/g, '') - .replace(/\n/g, '\n'); - } - if (str.added) return colorLines('diff added', str.value); - if (str.removed) return colorLines('diff removed', str.value); - return str.value; - }).join(''); -} - -/** - * Color lines for `str`, using the color `name`. - * - * @param {String} name - * @param {String} str - * @return {String} - * @api private - */ - -function colorLines(name, str) { - return str.split('\n').map(function(str){ - return color(name, str); - }).join('\n'); -} - -}); // module: reporters/base.js - -require.register("reporters/doc.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils'); - -/** - * Expose `Doc`. - */ - -exports = module.exports = Doc; - -/** - * Initialize a new `Doc` reporter. - * - * @param {Runner} runner - * @api public - */ - -function Doc(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total - , indents = 2; - - function indent() { - return Array(indents).join(' '); - } - - runner.on('suite', function(suite){ - if (suite.root) return; - ++indents; - console.log('%s
', indent()); - ++indents; - console.log('%s

%s

', indent(), suite.title); - console.log('%s
', indent()); - }); - - runner.on('suite end', function(suite){ - if (suite.root) return; - console.log('%s
', indent()); - --indents; - console.log('%s
', indent()); - --indents; - }); - - runner.on('pass', function(test){ - console.log('%s
%s
', indent(), test.title); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
%s
', indent(), code); - }); -} - -}); // module: reporters/doc.js - -require.register("reporters/dot.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , color = Base.color; - -/** - * Expose `Dot`. - */ - -exports = module.exports = Dot; - -/** - * Initialize a new `Dot` matrix test reporter. - * - * @param {Runner} runner - * @api public - */ - -function Dot(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , c = '․' - , n = 0; - - runner.on('start', function(){ - process.stdout.write('\n '); - }); - - runner.on('pending', function(test){ - process.stdout.write(color('pending', c)); - }); - - runner.on('pass', function(test){ - if (++n % width == 0) process.stdout.write('\n '); - if ('slow' == test.speed) { - process.stdout.write(color('bright yellow', c)); - } else { - process.stdout.write(color(test.speed, c)); - } - }); - - runner.on('fail', function(test, err){ - if (++n % width == 0) process.stdout.write('\n '); - process.stdout.write(color('fail', c)); - }); - - runner.on('end', function(){ - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -Dot.prototype = new Base; -Dot.prototype.constructor = Dot; - -}); // module: reporters/dot.js - -require.register("reporters/html-cov.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var JSONCov = require('./json-cov') - , fs = require('browser/fs'); - -/** - * Expose `HTMLCov`. - */ - -exports = module.exports = HTMLCov; - -/** - * Initialize a new `JsCoverage` reporter. - * - * @param {Runner} runner - * @api public - */ - -function HTMLCov(runner) { - var jade = require('jade') - , file = __dirname + '/templates/coverage.jade' - , str = fs.readFileSync(file, 'utf8') - , fn = jade.compile(str, { filename: file }) - , self = this; - - JSONCov.call(this, runner, false); - - runner.on('end', function(){ - process.stdout.write(fn({ - cov: self.cov - , coverageClass: coverageClass - })); - }); -} - -/** - * Return coverage class for `n`. - * - * @return {String} - * @api private - */ - -function coverageClass(n) { - if (n >= 75) return 'high'; - if (n >= 50) return 'medium'; - if (n >= 25) return 'low'; - return 'terrible'; -} -}); // module: reporters/html-cov.js - -require.register("reporters/html.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils') - , Progress = require('../browser/progress') - , escape = utils.escape; - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Expose `Doc`. - */ - -exports = module.exports = HTML; - -/** - * Stats template. - */ - -var statsTemplate = ''; - -/** - * Initialize a new `Doc` reporter. - * - * @param {Runner} runner - * @api public - */ - -function HTML(runner, root) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total - , stat = fragment(statsTemplate) - , items = stat.getElementsByTagName('li') - , passes = items[1].getElementsByTagName('em')[0] - , passesLink = items[1].getElementsByTagName('a')[0] - , failures = items[2].getElementsByTagName('em')[0] - , failuresLink = items[2].getElementsByTagName('a')[0] - , duration = items[3].getElementsByTagName('em')[0] - , canvas = stat.getElementsByTagName('canvas')[0] - , report = fragment('
    ') - , stack = [report] - , progress - , ctx - - root = root || document.getElementById('mocha'); - - if (canvas.getContext) { - var ratio = window.devicePixelRatio || 1; - canvas.style.width = canvas.width; - canvas.style.height = canvas.height; - canvas.width *= ratio; - canvas.height *= ratio; - ctx = canvas.getContext('2d'); - ctx.scale(ratio, ratio); - progress = new Progress; - } - - if (!root) return error('#mocha div missing, add it to your document'); - - // pass toggle - on(passesLink, 'click', function(){ - unhide(); - var name = /pass/.test(report.className) ? '' : ' pass'; - report.className = report.className.replace(/fail|pass/g, '') + name; - if (report.className.trim()) hideSuitesWithout('test pass'); - }); - - // failure toggle - on(failuresLink, 'click', function(){ - unhide(); - var name = /fail/.test(report.className) ? '' : ' fail'; - report.className = report.className.replace(/fail|pass/g, '') + name; - if (report.className.trim()) hideSuitesWithout('test fail'); - }); - - root.appendChild(stat); - root.appendChild(report); - - if (progress) progress.size(40); - - runner.on('suite', function(suite){ - if (suite.root) return; - - // suite - var url = '?grep=' + encodeURIComponent(suite.fullTitle()); - var el = fragment('
  • %s

  • ', url, escape(suite.title)); - - // container - stack[0].appendChild(el); - stack.unshift(document.createElement('ul')); - el.appendChild(stack[0]); - }); - - runner.on('suite end', function(suite){ - if (suite.root) return; - stack.shift(); - }); - - runner.on('fail', function(test, err){ - if ('hook' == test.type || err.uncaught) runner.emit('test end', test); - }); - - runner.on('test end', function(test){ - window.scrollTo(0, document.body.scrollHeight); - - // TODO: add to stats - var percent = stats.tests / total * 100 | 0; - if (progress) progress.update(percent).draw(ctx); - - // update stats - var ms = new Date - stats.start; - text(passes, stats.passes); - text(failures, stats.failures); - text(duration, (ms / 1000).toFixed(2)); - - // test - if ('passed' == test.state) { - var el = fragment('
  • %e%ems

  • ', test.speed, test.title, test.duration); - } else if (test.pending) { - var el = fragment('
  • %e

  • ', test.title); - } else { - var el = fragment('
  • %e

  • ', test.title); - var str = test.err.stack || test.err.toString(); - - // FF / Opera do not add the message - if (!~str.indexOf(test.err.message)) { - str = test.err.message + '\n' + str; - } - - // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we - // check for the result of the stringifying. - if ('[object Error]' == str) str = test.err.message; - - // Safari doesn't give you a stack. Let's at least provide a source line. - if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) { - str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")"; - } - - el.appendChild(fragment('
    %e
    ', str)); - } - - // toggle code - // TODO: defer - if (!test.pending) { - var h2 = el.getElementsByTagName('h2')[0]; - - on(h2, 'click', function(){ - pre.style.display = 'none' == pre.style.display - ? 'inline-block' - : 'none'; - }); - - var pre = fragment('
    %e
    ', utils.clean(test.fn.toString())); - el.appendChild(pre); - pre.style.display = 'none'; - } - - stack[0].appendChild(el); - }); -} - -/** - * Display error `msg`. - */ - -function error(msg) { - document.body.appendChild(fragment('
    %s
    ', msg)); -} - -/** - * Return a DOM fragment from `html`. - */ - -function fragment(html) { - var args = arguments - , div = document.createElement('div') - , i = 1; - - div.innerHTML = html.replace(/%([se])/g, function(_, type){ - switch (type) { - case 's': return String(args[i++]); - case 'e': return escape(args[i++]); - } - }); - - return div.firstChild; -} - -/** - * Check for suites that do not have elements - * with `classname`, and hide them. - */ - -function hideSuitesWithout(classname) { - var suites = document.getElementsByClassName('suite'); - for (var i = 0; i < suites.length; i++) { - var els = suites[i].getElementsByClassName(classname); - if (0 == els.length) suites[i].className += ' hidden'; - } -} - -/** - * Unhide .hidden suites. - */ - -function unhide() { - var els = document.getElementsByClassName('suite hidden'); - for (var i = 0; i < els.length; ++i) { - els[i].className = els[i].className.replace('suite hidden', 'suite'); - } -} - -/** - * Set `el` text to `str`. - */ - -function text(el, str) { - if (el.textContent) { - el.textContent = str; - } else { - el.innerText = str; - } -} - -/** - * Listen on `event` with callback `fn`. - */ - -function on(el, event, fn) { - if (el.addEventListener) { - el.addEventListener(event, fn, false); - } else { - el.attachEvent('on' + event, fn); - } -} - -}); // module: reporters/html.js - -require.register("reporters/index.js", function(module, exports, require){ - -exports.Base = require('./base'); -exports.Dot = require('./dot'); -exports.Doc = require('./doc'); -exports.TAP = require('./tap'); -exports.JSON = require('./json'); -exports.HTML = require('./html'); -exports.List = require('./list'); -exports.Min = require('./min'); -exports.Spec = require('./spec'); -exports.Nyan = require('./nyan'); -exports.XUnit = require('./xunit'); -exports.Markdown = require('./markdown'); -exports.Progress = require('./progress'); -exports.Landing = require('./landing'); -exports.JSONCov = require('./json-cov'); -exports.HTMLCov = require('./html-cov'); -exports.JSONStream = require('./json-stream'); -exports.Teamcity = require('./teamcity'); - -}); // module: reporters/index.js - -require.register("reporters/json-cov.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `JSONCov`. - */ - -exports = module.exports = JSONCov; - -/** - * Initialize a new `JsCoverage` reporter. - * - * @param {Runner} runner - * @param {Boolean} output - * @api public - */ - -function JSONCov(runner, output) { - var self = this - , output = 1 == arguments.length ? true : output; - - Base.call(this, runner); - - var tests = [] - , failures = [] - , passes = []; - - runner.on('test end', function(test){ - tests.push(test); - }); - - runner.on('pass', function(test){ - passes.push(test); - }); - - runner.on('fail', function(test){ - failures.push(test); - }); - - runner.on('end', function(){ - var cov = global._$jscoverage || {}; - var result = self.cov = map(cov); - result.stats = self.stats; - result.tests = tests.map(clean); - result.failures = failures.map(clean); - result.passes = passes.map(clean); - if (!output) return; - process.stdout.write(JSON.stringify(result, null, 2 )); - }); -} - -/** - * Map jscoverage data to a JSON structure - * suitable for reporting. - * - * @param {Object} cov - * @return {Object} - * @api private - */ - -function map(cov) { - var ret = { - instrumentation: 'node-jscoverage' - , sloc: 0 - , hits: 0 - , misses: 0 - , coverage: 0 - , files: [] - }; - - for (var filename in cov) { - var data = coverage(filename, cov[filename]); - ret.files.push(data); - ret.hits += data.hits; - ret.misses += data.misses; - ret.sloc += data.sloc; - } - - if (ret.sloc > 0) { - ret.coverage = (ret.hits / ret.sloc) * 100; - } - - return ret; -}; - -/** - * Map jscoverage data for a single source file - * to a JSON structure suitable for reporting. - * - * @param {String} filename name of the source file - * @param {Object} data jscoverage coverage data - * @return {Object} - * @api private - */ - -function coverage(filename, data) { - var ret = { - filename: filename, - coverage: 0, - hits: 0, - misses: 0, - sloc: 0, - source: {} - }; - - data.source.forEach(function(line, num){ - num++; - - if (data[num] === 0) { - ret.misses++; - ret.sloc++; - } else if (data[num] !== undefined) { - ret.hits++; - ret.sloc++; - } - - ret.source[num] = { - source: line - , coverage: data[num] === undefined - ? '' - : data[num] - }; - }); - - ret.coverage = ret.hits / ret.sloc * 100; - - return ret; -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @param {Object} test - * @return {Object} - * @api private - */ - -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} - -}); // module: reporters/json-cov.js - -require.register("reporters/json-stream.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , color = Base.color; - -/** - * Expose `List`. - */ - -exports = module.exports = List; - -/** - * Initialize a new `List` test reporter. - * - * @param {Runner} runner - * @api public - */ - -function List(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total; - - runner.on('start', function(){ - console.log(JSON.stringify(['start', { total: total }])); - }); - - runner.on('pass', function(test){ - console.log(JSON.stringify(['pass', clean(test)])); - }); - - runner.on('fail', function(test, err){ - console.log(JSON.stringify(['fail', clean(test)])); - }); - - runner.on('end', function(){ - process.stdout.write(JSON.stringify(['end', self.stats])); - }); -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @param {Object} test - * @return {Object} - * @api private - */ - -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} -}); // module: reporters/json-stream.js - -require.register("reporters/json.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `JSON`. - */ - -exports = module.exports = JSONReporter; - -/** - * Initialize a new `JSON` reporter. - * - * @param {Runner} runner - * @api public - */ - -function JSONReporter(runner) { - var self = this; - Base.call(this, runner); - - var tests = [] - , failures = [] - , passes = []; - - runner.on('test end', function(test){ - tests.push(test); - }); - - runner.on('pass', function(test){ - passes.push(test); - }); - - runner.on('fail', function(test){ - failures.push(test); - }); - - runner.on('end', function(){ - var obj = { - stats: self.stats - , tests: tests.map(clean) - , failures: failures.map(clean) - , passes: passes.map(clean) - }; - - process.stdout.write(JSON.stringify(obj, null, 2)); - }); -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @param {Object} test - * @return {Object} - * @api private - */ - -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} -}); // module: reporters/json.js - -require.register("reporters/landing.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `Landing`. - */ - -exports = module.exports = Landing; - -/** - * Airplane color. - */ - -Base.colors.plane = 0; - -/** - * Airplane crash color. - */ - -Base.colors['plane crash'] = 31; - -/** - * Runway color. - */ - -Base.colors.runway = 90; - -/** - * Initialize a new `Landing` reporter. - * - * @param {Runner} runner - * @api public - */ - -function Landing(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , total = runner.total - , stream = process.stdout - , plane = color('plane', '✈') - , crashed = -1 - , n = 0; - - function runway() { - var buf = Array(width).join('-'); - return ' ' + color('runway', buf); - } - - runner.on('start', function(){ - stream.write('\n '); - cursor.hide(); - }); - - runner.on('test end', function(test){ - // check if the plane crashed - var col = -1 == crashed - ? width * ++n / total | 0 - : crashed; - - // show the crash - if ('failed' == test.state) { - plane = color('plane crash', '✈'); - crashed = col; - } - - // render landing strip - stream.write('\u001b[4F\n\n'); - stream.write(runway()); - stream.write('\n '); - stream.write(color('runway', Array(col).join('⋅'))); - stream.write(plane) - stream.write(color('runway', Array(width - col).join('⋅') + '\n')); - stream.write(runway()); - stream.write('\u001b[0m'); - }); - - runner.on('end', function(){ - cursor.show(); - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -Landing.prototype = new Base; -Landing.prototype.constructor = Landing; - -}); // module: reporters/landing.js - -require.register("reporters/list.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `List`. - */ - -exports = module.exports = List; - -/** - * Initialize a new `List` test reporter. - * - * @param {Runner} runner - * @api public - */ - -function List(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , n = 0; - - runner.on('start', function(){ - console.log(); - }); - - runner.on('test', function(test){ - process.stdout.write(color('pass', ' ' + test.fullTitle() + ': ')); - }); - - runner.on('pending', function(test){ - var fmt = color('checkmark', ' -') - + color('pending', ' %s'); - console.log(fmt, test.fullTitle()); - }); - - runner.on('pass', function(test){ - var fmt = color('checkmark', ' ✓') - + color('pass', ' %s: ') - + color(test.speed, '%dms'); - cursor.CR(); - console.log(fmt, test.fullTitle(), test.duration); - }); - - runner.on('fail', function(test, err){ - cursor.CR(); - console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); - }); - - runner.on('end', self.epilogue.bind(self)); -} - -/** - * Inherit from `Base.prototype`. - */ - -List.prototype = new Base; -List.prototype.constructor = List; - - -}); // module: reporters/list.js - -require.register("reporters/markdown.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils'); - -/** - * Expose `Markdown`. - */ - -exports = module.exports = Markdown; - -/** - * Initialize a new `Markdown` reporter. - * - * @param {Runner} runner - * @api public - */ - -function Markdown(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total - , level = 0 - , buf = ''; - - function title(str) { - return Array(level).join('#') + ' ' + str; - } - - function indent() { - return Array(level).join(' '); - } - - function mapTOC(suite, obj) { - var ret = obj; - obj = obj[suite.title] = obj[suite.title] || { suite: suite }; - suite.suites.forEach(function(suite){ - mapTOC(suite, obj); - }); - return ret; - } - - function stringifyTOC(obj, level) { - ++level; - var buf = ''; - var link; - for (var key in obj) { - if ('suite' == key) continue; - if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; - if (key) buf += Array(level).join(' ') + link; - buf += stringifyTOC(obj[key], level); - } - --level; - return buf; - } - - function generateTOC(suite) { - var obj = mapTOC(suite, {}); - return stringifyTOC(obj, 0); - } - - generateTOC(runner.suite); - - runner.on('suite', function(suite){ - ++level; - var slug = utils.slug(suite.fullTitle()); - buf += '' + '\n'; - buf += title(suite.title) + '\n'; - }); - - runner.on('suite end', function(suite){ - --level; - }); - - runner.on('pass', function(test){ - var code = utils.clean(test.fn.toString()); - buf += test.title + '.\n'; - buf += '\n```js\n'; - buf += code + '\n'; - buf += '```\n\n'; - }); - - runner.on('end', function(){ - process.stdout.write('# TOC\n'); - process.stdout.write(generateTOC(runner.suite)); - process.stdout.write(buf); - }); -} -}); // module: reporters/markdown.js - -require.register("reporters/min.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `Min`. - */ - -exports = module.exports = Min; - -/** - * Initialize a new `Min` minimal test reporter (best used with --watch). - * - * @param {Runner} runner - * @api public - */ - -function Min(runner) { - Base.call(this, runner); - - runner.on('start', function(){ - // clear screen - process.stdout.write('\u001b[2J'); - // set cursor position - process.stdout.write('\u001b[1;3H'); - }); - - runner.on('end', this.epilogue.bind(this)); -} - -/** - * Inherit from `Base.prototype`. - */ - -Min.prototype = new Base; -Min.prototype.constructor = Min; - -}); // module: reporters/min.js - -require.register("reporters/nyan.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , color = Base.color; - -/** - * Expose `Dot`. - */ - -exports = module.exports = NyanCat; - -/** - * Initialize a new `Dot` matrix test reporter. - * - * @param {Runner} runner - * @api public - */ - -function NyanCat(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , rainbowColors = this.rainbowColors = self.generateColors() - , colorIndex = this.colorIndex = 0 - , numerOfLines = this.numberOfLines = 4 - , trajectories = this.trajectories = [[], [], [], []] - , nyanCatWidth = this.nyanCatWidth = 11 - , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) - , scoreboardWidth = this.scoreboardWidth = 5 - , tick = this.tick = 0 - , n = 0; - - runner.on('start', function(){ - Base.cursor.hide(); - self.draw('start'); - }); - - runner.on('pending', function(test){ - self.draw('pending'); - }); - - runner.on('pass', function(test){ - self.draw('pass'); - }); - - runner.on('fail', function(test, err){ - self.draw('fail'); - }); - - runner.on('end', function(){ - Base.cursor.show(); - for (var i = 0; i < self.numberOfLines; i++) write('\n'); - self.epilogue(); - }); -} - -/** - * Draw the nyan cat with runner `status`. - * - * @param {String} status - * @api private - */ - -NyanCat.prototype.draw = function(status){ - this.appendRainbow(); - this.drawScoreboard(); - this.drawRainbow(); - this.drawNyanCat(status); - this.tick = !this.tick; -}; - -/** - * Draw the "scoreboard" showing the number - * of passes, failures and pending tests. - * - * @api private - */ - -NyanCat.prototype.drawScoreboard = function(){ - var stats = this.stats; - var colors = Base.colors; - - function draw(color, n) { - write(' '); - write('\u001b[' + color + 'm' + n + '\u001b[0m'); - write('\n'); - } - - draw(colors.green, stats.passes); - draw(colors.fail, stats.failures); - draw(colors.pending, stats.pending); - write('\n'); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Append the rainbow. - * - * @api private - */ - -NyanCat.prototype.appendRainbow = function(){ - var segment = this.tick ? '_' : '-'; - var rainbowified = this.rainbowify(segment); - - for (var index = 0; index < this.numberOfLines; index++) { - var trajectory = this.trajectories[index]; - if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift(); - trajectory.push(rainbowified); - } -}; - -/** - * Draw the rainbow. - * - * @api private - */ - -NyanCat.prototype.drawRainbow = function(){ - var self = this; - - this.trajectories.forEach(function(line, index) { - write('\u001b[' + self.scoreboardWidth + 'C'); - write(line.join('')); - write('\n'); - }); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Draw the nyan cat with `status`. - * - * @param {String} status - * @api private - */ - -NyanCat.prototype.drawNyanCat = function(status) { - var self = this; - var startWidth = this.scoreboardWidth + this.trajectories[0].length; - - [0, 1, 2, 3].forEach(function(index) { - write('\u001b[' + startWidth + 'C'); - - switch (index) { - case 0: - write('_,------,'); - write('\n'); - break; - case 1: - var padding = self.tick ? ' ' : ' '; - write('_|' + padding + '/\\_/\\ '); - write('\n'); - break; - case 2: - var padding = self.tick ? '_' : '__'; - var tail = self.tick ? '~' : '^'; - var face; - switch (status) { - case 'pass': - face = '( ^ .^)'; - break; - case 'fail': - face = '( o .o)'; - break; - default: - face = '( - .-)'; - } - write(tail + '|' + padding + face + ' '); - write('\n'); - break; - case 3: - var padding = self.tick ? ' ' : ' '; - write(padding + '"" "" '); - write('\n'); - break; - } - }); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Move cursor up `n`. - * - * @param {Number} n - * @api private - */ - -NyanCat.prototype.cursorUp = function(n) { - write('\u001b[' + n + 'A'); -}; - -/** - * Move cursor down `n`. - * - * @param {Number} n - * @api private - */ - -NyanCat.prototype.cursorDown = function(n) { - write('\u001b[' + n + 'B'); -}; - -/** - * Generate rainbow colors. - * - * @return {Array} - * @api private - */ - -NyanCat.prototype.generateColors = function(){ - var colors = []; - - for (var i = 0; i < (6 * 7); i++) { - var pi3 = Math.floor(Math.PI / 3); - var n = (i * (1.0 / 6)); - var r = Math.floor(3 * Math.sin(n) + 3); - var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3); - var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3); - colors.push(36 * r + 6 * g + b + 16); - } - - return colors; -}; - -/** - * Apply rainbow to the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -NyanCat.prototype.rainbowify = function(str){ - var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; - this.colorIndex += 1; - return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; -}; - -/** - * Stdout helper. - */ - -function write(string) { - process.stdout.write(string); -} - -/** - * Inherit from `Base.prototype`. - */ - -NyanCat.prototype = new Base; -NyanCat.prototype.constructor = NyanCat; - - -}); // module: reporters/nyan.js - -require.register("reporters/progress.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `Progress`. - */ - -exports = module.exports = Progress; - -/** - * General progress bar color. - */ - -Base.colors.progress = 90; - -/** - * Initialize a new `Progress` bar test reporter. - * - * @param {Runner} runner - * @param {Object} options - * @api public - */ - -function Progress(runner, options) { - Base.call(this, runner); - - var self = this - , options = options || {} - , stats = this.stats - , width = Base.window.width * .50 | 0 - , total = runner.total - , complete = 0 - , max = Math.max; - - // default chars - options.open = options.open || '['; - options.complete = options.complete || '▬'; - options.incomplete = options.incomplete || '⋅'; - options.close = options.close || ']'; - options.verbose = false; - - // tests started - runner.on('start', function(){ - console.log(); - cursor.hide(); - }); - - // tests complete - runner.on('test end', function(){ - complete++; - var incomplete = total - complete - , percent = complete / total - , n = width * percent | 0 - , i = width - n; - - cursor.CR(); - process.stdout.write('\u001b[J'); - process.stdout.write(color('progress', ' ' + options.open)); - process.stdout.write(Array(n).join(options.complete)); - process.stdout.write(Array(i).join(options.incomplete)); - process.stdout.write(color('progress', options.close)); - if (options.verbose) { - process.stdout.write(color('progress', ' ' + complete + ' of ' + total)); - } - }); - - // tests are complete, output some stats - // and the failures if any - runner.on('end', function(){ - cursor.show(); - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -Progress.prototype = new Base; -Progress.prototype.constructor = Progress; - - -}); // module: reporters/progress.js - -require.register("reporters/spec.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `Spec`. - */ - -exports = module.exports = Spec; - -/** - * Initialize a new `Spec` test reporter. - * - * @param {Runner} runner - * @api public - */ - -function Spec(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , indents = 0 - , n = 0; - - function indent() { - return Array(indents).join(' ') - } - - runner.on('start', function(){ - console.log(); - }); - - runner.on('suite', function(suite){ - ++indents; - console.log(color('suite', '%s%s'), indent(), suite.title); - }); - - runner.on('suite end', function(suite){ - --indents; - if (1 == indents) console.log(); - }); - - runner.on('test', function(test){ - process.stdout.write(indent() + color('pass', ' ◦ ' + test.title + ': ')); - }); - - runner.on('pending', function(test){ - var fmt = indent() + color('pending', ' - %s'); - console.log(fmt, test.title); - }); - - runner.on('pass', function(test){ - if ('fast' == test.speed) { - var fmt = indent() - + color('checkmark', ' ✓') - + color('pass', ' %s '); - cursor.CR(); - console.log(fmt, test.title); - } else { - var fmt = indent() - + color('checkmark', ' ✓') - + color('pass', ' %s ') - + color(test.speed, '(%dms)'); - cursor.CR(); - console.log(fmt, test.title, test.duration); - } - }); - - runner.on('fail', function(test, err){ - cursor.CR(); - console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); - }); - - runner.on('end', self.epilogue.bind(self)); -} - -/** - * Inherit from `Base.prototype`. - */ - -Spec.prototype = new Base; -Spec.prototype.constructor = Spec; - - -}); // module: reporters/spec.js - -require.register("reporters/tap.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `TAP`. - */ - -exports = module.exports = TAP; - -/** - * Initialize a new `TAP` reporter. - * - * @param {Runner} runner - * @api public - */ - -function TAP(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , n = 1; - - runner.on('start', function(){ - var total = runner.grepTotal(runner.suite); - console.log('%d..%d', 1, total); - }); - - runner.on('test end', function(){ - ++n; - }); - - runner.on('pending', function(test){ - console.log('ok %d %s # SKIP -', n, title(test)); - }); - - runner.on('pass', function(test){ - console.log('ok %d %s', n, title(test)); - }); - - runner.on('fail', function(test, err){ - console.log('not ok %d %s', n, title(test)); - console.log(err.stack.replace(/^/gm, ' ')); - }); -} - -/** - * Return a TAP-safe title of `test` - * - * @param {Object} test - * @return {String} - * @api private - */ - -function title(test) { - return test.fullTitle().replace(/#/g, ''); -} - -}); // module: reporters/tap.js - -require.register("reporters/teamcity.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `Teamcity`. - */ - -exports = module.exports = Teamcity; - -/** - * Initialize a new `Teamcity` reporter. - * - * @param {Runner} runner - * @api public - */ - -function Teamcity(runner) { - Base.call(this, runner); - var stats = this.stats; - - runner.on('start', function() { - console.log("##teamcity[testSuiteStarted name='mocha.suite']"); - }); - - runner.on('test', function(test) { - console.log("##teamcity[testStarted name='" + escape(test.fullTitle()) + "']"); - }); - - runner.on('fail', function(test, err) { - console.log("##teamcity[testFailed name='" + escape(test.fullTitle()) + "' message='" + escape(err.message) + "']"); - }); - - runner.on('pending', function(test) { - console.log("##teamcity[testIgnored name='" + escape(test.fullTitle()) + "' message='pending']"); - }); - - runner.on('test end', function(test) { - console.log("##teamcity[testFinished name='" + escape(test.fullTitle()) + "' duration='" + test.duration + "']"); - }); - - runner.on('end', function() { - console.log("##teamcity[testSuiteFinished name='mocha.suite' duration='" + stats.duration + "']"); - }); -} - -/** - * Escape the given `str`. - */ - -function escape(str) { - return str - .replace(/\|/g, "||") - .replace(/\n/g, "|n") - .replace(/\r/g, "|r") - .replace(/\[/g, "|[") - .replace(/\]/g, "|]") - .replace(/\u0085/g, "|x") - .replace(/\u2028/g, "|l") - .replace(/\u2029/g, "|p") - .replace(/'/g, "|'"); -} - -}); // module: reporters/teamcity.js - -require.register("reporters/xunit.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils') - , escape = utils.escape; - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Expose `XUnit`. - */ - -exports = module.exports = XUnit; - -/** - * Initialize a new `XUnit` reporter. - * - * @param {Runner} runner - * @api public - */ - -function XUnit(runner) { - Base.call(this, runner); - var stats = this.stats - , tests = [] - , self = this; - - runner.on('pass', function(test){ - tests.push(test); - }); - - runner.on('fail', function(test){ - tests.push(test); - }); - - runner.on('end', function(){ - console.log(tag('testsuite', { - name: 'Mocha Tests' - , tests: stats.tests - , failures: stats.failures - , errors: stats.failures - , skip: stats.tests - stats.failures - stats.passes - , timestamp: (new Date).toUTCString() - , time: stats.duration / 1000 - }, false)); - - tests.forEach(test); - console.log(''); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -XUnit.prototype = new Base; -XUnit.prototype.constructor = XUnit; - - -/** - * Output tag for the given `test.` - */ - -function test(test) { - var attrs = { - classname: test.parent.fullTitle() - , name: test.title - , time: test.duration / 1000 - }; - - if ('failed' == test.state) { - var err = test.err; - attrs.message = escape(err.message); - console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack)))); - } else if (test.pending) { - console.log(tag('testcase', attrs, false, tag('skipped', {}, true))); - } else { - console.log(tag('testcase', attrs, true) ); - } -} - -/** - * HTML tag helper. - */ - -function tag(name, attrs, close, content) { - var end = close ? '/>' : '>' - , pairs = [] - , tag; - - for (var key in attrs) { - pairs.push(key + '="' + escape(attrs[key]) + '"'); - } - - tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; - if (content) tag += content + ''; -} - -}); // module: reporters/xunit.js - -require.register("runnable.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:runnable'); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Expose `Runnable`. - */ - -module.exports = Runnable; - -/** - * Initialize a new `Runnable` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - */ - -function Runnable(title, fn) { - this.title = title; - this.fn = fn; - this.async = fn && fn.length; - this.sync = ! this.async; - this._timeout = 2000; - this._slow = 75; - this.timedOut = false; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Runnable.prototype = new EventEmitter; -Runnable.prototype.constructor = Runnable; - - -/** - * Set & get timeout `ms`. - * - * @param {Number} ms - * @return {Runnable|Number} ms or self - * @api private - */ - -Runnable.prototype.timeout = function(ms){ - if (0 == arguments.length) return this._timeout; - debug('timeout %d', ms); - this._timeout = ms; - if (this.timer) this.resetTimeout(); - return this; -}; - -/** - * Set & get slow `ms`. - * - * @param {Number} ms - * @return {Runnable|Number} ms or self - * @api private - */ - -Runnable.prototype.slow = function(ms){ - if (0 === arguments.length) return this._slow; - debug('timeout %d', ms); - this._slow = ms; - return this; -}; - -/** - * Return the full title generated by recursively - * concatenating the parent's full title. - * - * @return {String} - * @api public - */ - -Runnable.prototype.fullTitle = function(){ - return this.parent.fullTitle() + ' ' + this.title; -}; - -/** - * Clear the timeout. - * - * @api private - */ - -Runnable.prototype.clearTimeout = function(){ - clearTimeout(this.timer); -}; - -/** - * Inspect the runnable void of private properties. - * - * @return {String} - * @api private - */ - -Runnable.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ - if ('_' == key[0]) return; - if ('parent' == key) return '#'; - if ('ctx' == key) return '#'; - return val; - }, 2); -}; - -/** - * Reset the timeout. - * - * @api private - */ - -Runnable.prototype.resetTimeout = function(){ - var self = this - , ms = this.timeout(); - - this.clearTimeout(); - if (ms) { - this.timer = setTimeout(function(){ - self.callback(new Error('timeout of ' + ms + 'ms exceeded')); - self.timedOut = true; - }, ms); - } -}; - -/** - * Run the test and invoke `fn(err)`. - * - * @param {Function} fn - * @api private - */ - -Runnable.prototype.run = function(fn){ - var self = this - , ms = this.timeout() - , start = new Date - , ctx = this.ctx - , finished - , emitted; - - if (ctx) ctx.runnable(this); - - // timeout - if (this.async) { - if (ms) { - this.timer = setTimeout(function(){ - done(new Error('timeout of ' + ms + 'ms exceeded')); - self.timedOut = true; - }, ms); - } - } - - // called multiple times - function multiple(err) { - if (emitted) return; - emitted = true; - self.emit('error', err || new Error('done() called multiple times')); - } - - // finished - function done(err) { - if (self.timedOut) return; - if (finished) return multiple(err); - self.clearTimeout(); - self.duration = new Date - start; - finished = true; - fn(err); - } - - // for .resetTimeout() - this.callback = done; - - // async - if (this.async) { - try { - this.fn.call(ctx, function(err){ - if (err instanceof Error) return done(err); - if (null != err) return done(new Error('done() invoked with non-Error: ' + err)); - done(); - }); - } catch (err) { - done(err); - } - return; - } - - // sync - try { - if (!this.pending) this.fn.call(ctx); - this.duration = new Date - start; - fn(); - } catch (err) { - fn(err); - } -}; - -}); // module: runnable.js - -require.register("runner.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:runner') - , Test = require('./test') - , utils = require('./utils') - , filter = utils.filter - , keys = utils.keys - , noop = function(){}; - -/** - * Expose `Runner`. - */ - -module.exports = Runner; - -/** - * Initialize a `Runner` for the given `suite`. - * - * Events: - * - * - `start` execution started - * - `end` execution complete - * - `suite` (suite) test suite execution started - * - `suite end` (suite) all tests (and sub-suites) have finished - * - `test` (test) test execution started - * - `test end` (test) test completed - * - `hook` (hook) hook execution started - * - `hook end` (hook) hook complete - * - `pass` (test) test passed - * - `fail` (test, err) test failed - * - * @api public - */ - -function Runner(suite) { - var self = this; - this._globals = []; - this.suite = suite; - this.total = suite.total(); - this.failures = 0; - this.on('test end', function(test){ self.checkGlobals(test); }); - this.on('hook end', function(hook){ self.checkGlobals(hook); }); - this.grep(/.*/); - this.globals(utils.keys(global).concat(['errno'])); -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Runner.prototype = new EventEmitter; -Runner.prototype.constructor = Runner; - - -/** - * Run tests with full titles matching `re`. Updates runner.total - * with number of tests matched. - * - * @param {RegExp} re - * @param {Boolean} invert - * @return {Runner} for chaining - * @api public - */ - -Runner.prototype.grep = function(re, invert){ - debug('grep %s', re); - this._grep = re; - this._invert = invert; - this.total = this.grepTotal(this.suite); - return this; -}; - -/** - * Returns the number of tests matching the grep search for the - * given suite. - * - * @param {Suite} suite - * @return {Number} - * @api public - */ - -Runner.prototype.grepTotal = function(suite) { - var self = this; - var total = 0; - - suite.eachTest(function(test){ - var match = self._grep.test(test.fullTitle()); - if (self._invert) match = !match; - if (match) total++; - }); - - return total; -}; - -/** - * Allow the given `arr` of globals. - * - * @param {Array} arr - * @return {Runner} for chaining - * @api public - */ - -Runner.prototype.globals = function(arr){ - if (0 == arguments.length) return this._globals; - debug('globals %j', arr); - utils.forEach(arr, function(arr){ - this._globals.push(arr); - }, this); - return this; -}; - -/** - * Check for global variable leaks. - * - * @api private - */ - -Runner.prototype.checkGlobals = function(test){ - if (this.ignoreLeaks) return; - var ok = this._globals; - var globals = keys(global); - var isNode = process.kill; - var leaks; - - // check length - 2 ('errno' and 'location' globals) - if (isNode && 1 == ok.length - globals.length) return - else if (2 == ok.length - globals.length) return; - - leaks = filterLeaks(ok, globals); - this._globals = this._globals.concat(leaks); - - if (leaks.length > 1) { - this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + '')); - } else if (leaks.length) { - this.fail(test, new Error('global leak detected: ' + leaks[0])); - } -}; - -/** - * Fail the given `test`. - * - * @param {Test} test - * @param {Error} err - * @api private - */ - -Runner.prototype.fail = function(test, err){ - ++this.failures; - test.state = 'failed'; - if ('string' == typeof err) { - err = new Error('the string "' + err + '" was thrown, throw an Error :)'); - } - this.emit('fail', test, err); -}; - -/** - * Fail the given `hook` with `err`. - * - * Hook failures (currently) hard-end due - * to that fact that a failing hook will - * surely cause subsequent tests to fail, - * causing jumbled reporting. - * - * @param {Hook} hook - * @param {Error} err - * @api private - */ - -Runner.prototype.failHook = function(hook, err){ - this.fail(hook, err); - this.emit('end'); -}; - -/** - * Run hook `name` callbacks and then invoke `fn()`. - * - * @param {String} name - * @param {Function} function - * @api private - */ - -Runner.prototype.hook = function(name, fn){ - var suite = this.suite - , hooks = suite['_' + name] - , self = this - , timer; - - function next(i) { - var hook = hooks[i]; - if (!hook) return fn(); - self.currentRunnable = hook; - - self.emit('hook', hook); - - hook.on('error', function(err){ - self.failHook(hook, err); - }); - - hook.run(function(err){ - hook.removeAllListeners('error'); - var testError = hook.error(); - if (testError) self.fail(self.test, testError); - if (err) return self.failHook(hook, err); - self.emit('hook end', hook); - next(++i); - }); - } - - process.nextTick(function(){ - next(0); - }); -}; - -/** - * Run hook `name` for the given array of `suites` - * in order, and callback `fn(err)`. - * - * @param {String} name - * @param {Array} suites - * @param {Function} fn - * @api private - */ - -Runner.prototype.hooks = function(name, suites, fn){ - var self = this - , orig = this.suite; - - function next(suite) { - self.suite = suite; - - if (!suite) { - self.suite = orig; - return fn(); - } - - self.hook(name, function(err){ - if (err) { - self.suite = orig; - return fn(err); - } - - next(suites.pop()); - }); - } - - next(suites.pop()); -}; - -/** - * Run hooks from the top level down. - * - * @param {String} name - * @param {Function} fn - * @api private - */ - -Runner.prototype.hookUp = function(name, fn){ - var suites = [this.suite].concat(this.parents()).reverse(); - this.hooks(name, suites, fn); -}; - -/** - * Run hooks from the bottom up. - * - * @param {String} name - * @param {Function} fn - * @api private - */ - -Runner.prototype.hookDown = function(name, fn){ - var suites = [this.suite].concat(this.parents()); - this.hooks(name, suites, fn); -}; - -/** - * Return an array of parent Suites from - * closest to furthest. - * - * @return {Array} - * @api private - */ - -Runner.prototype.parents = function(){ - var suite = this.suite - , suites = []; - while (suite = suite.parent) suites.push(suite); - return suites; -}; - -/** - * Run the current test and callback `fn(err)`. - * - * @param {Function} fn - * @api private - */ - -Runner.prototype.runTest = function(fn){ - var test = this.test - , self = this; - - try { - test.on('error', function(err){ - self.fail(test, err); - }); - test.run(fn); - } catch (err) { - fn(err); - } -}; - -/** - * Run tests in the given `suite` and invoke - * the callback `fn()` when complete. - * - * @param {Suite} suite - * @param {Function} fn - * @api private - */ - -Runner.prototype.runTests = function(suite, fn){ - var self = this - , tests = suite.tests - , test; - - function next(err) { - // if we bail after first err - if (self.failures && suite._bail) return fn(); - - // next test - test = tests.shift(); - - // all done - if (!test) return fn(); - - // grep - var match = self._grep.test(test.fullTitle()); - if (self._invert) match = !match; - if (!match) return next(); - - // pending - if (test.pending) { - self.emit('pending', test); - self.emit('test end', test); - return next(); - } - - // execute test and hook(s) - self.emit('test', self.test = test); - self.hookDown('beforeEach', function(){ - self.currentRunnable = self.test; - self.runTest(function(err){ - test = self.test; - - if (err) { - self.fail(test, err); - self.emit('test end', test); - return self.hookUp('afterEach', next); - } - - test.state = 'passed'; - self.emit('pass', test); - self.emit('test end', test); - self.hookUp('afterEach', next); - }); - }); - } - - this.next = next; - next(); -}; - -/** - * Run the given `suite` and invoke the - * callback `fn()` when complete. - * - * @param {Suite} suite - * @param {Function} fn - * @api private - */ - -Runner.prototype.runSuite = function(suite, fn){ - var total = this.grepTotal(suite) - , self = this - , i = 0; - - debug('run suite %s', suite.fullTitle()); - - if (!total) return fn(); - - this.emit('suite', this.suite = suite); - - function next() { - var curr = suite.suites[i++]; - if (!curr) return done(); - self.runSuite(curr, next); - } - - function done() { - self.suite = suite; - self.hook('afterAll', function(){ - self.emit('suite end', suite); - fn(); - }); - } - - this.hook('beforeAll', function(){ - self.runTests(suite, next); - }); -}; - -/** - * Handle uncaught exceptions. - * - * @param {Error} err - * @api private - */ - -Runner.prototype.uncaught = function(err){ - debug('uncaught exception %s', err.message); - var runnable = this.currentRunnable; - if (!runnable || 'failed' == runnable.state) return; - runnable.clearTimeout(); - err.uncaught = true; - this.fail(runnable, err); - - // recover from test - if ('test' == runnable.type) { - this.emit('test end', runnable); - this.hookUp('afterEach', this.next); - return; - } - - // bail on hooks - this.emit('end'); -}; - -/** - * Run the root suite and invoke `fn(failures)` - * on completion. - * - * @param {Function} fn - * @return {Runner} for chaining - * @api public - */ - -Runner.prototype.run = function(fn){ - var self = this - , fn = fn || function(){}; - - debug('start'); - - // uncaught callback - function uncaught(err) { - self.uncaught(err); - } - - // callback - this.on('end', function(){ - debug('end'); - process.removeListener('uncaughtException', uncaught); - fn(self.failures); - }); - - // run suites - this.emit('start'); - this.runSuite(this.suite, function(){ - debug('finished running'); - self.emit('end'); - }); - - // uncaught exception - process.on('uncaughtException', uncaught); - - return this; -}; - -/** - * Filter leaks with the given globals flagged as `ok`. - * - * @param {Array} ok - * @param {Array} globals - * @return {Array} - * @api private - */ - -function filterLeaks(ok, globals) { - return filter(globals, function(key){ - var matched = filter(ok, function(ok){ - if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]); - return key == ok; - }); - return matched.length == 0 && (!global.navigator || 'onerror' !== key); - }); -} - -}); // module: runner.js - -require.register("suite.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:suite') - , milliseconds = require('./ms') - , utils = require('./utils') - , Hook = require('./hook'); - -/** - * Expose `Suite`. - */ - -exports = module.exports = Suite; - -/** - * Create a new `Suite` with the given `title` - * and parent `Suite`. When a suite with the - * same title is already present, that suite - * is returned to provide nicer reporter - * and more flexible meta-testing. - * - * @param {Suite} parent - * @param {String} title - * @return {Suite} - * @api public - */ - -exports.create = function(parent, title){ - var suite = new Suite(title, parent.ctx); - suite.parent = parent; - if (parent.pending) suite.pending = true; - title = suite.fullTitle(); - parent.addSuite(suite); - return suite; -}; - -/** - * Initialize a new `Suite` with the given - * `title` and `ctx`. - * - * @param {String} title - * @param {Context} ctx - * @api private - */ - -function Suite(title, ctx) { - this.title = title; - this.ctx = ctx; - this.suites = []; - this.tests = []; - this.pending = false; - this._beforeEach = []; - this._beforeAll = []; - this._afterEach = []; - this._afterAll = []; - this.root = !title; - this._timeout = 2000; - this._slow = 75; - this._bail = false; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Suite.prototype = new EventEmitter; -Suite.prototype.constructor = Suite; - - -/** - * Return a clone of this `Suite`. - * - * @return {Suite} - * @api private - */ - -Suite.prototype.clone = function(){ - var suite = new Suite(this.title); - debug('clone'); - suite.ctx = this.ctx; - suite.timeout(this.timeout()); - suite.slow(this.slow()); - suite.bail(this.bail()); - return suite; -}; - -/** - * Set timeout `ms` or short-hand such as "2s". - * - * @param {Number|String} ms - * @return {Suite|Number} for chaining - * @api private - */ - -Suite.prototype.timeout = function(ms){ - if (0 == arguments.length) return this._timeout; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._timeout = parseInt(ms, 10); - return this; -}; - -/** - * Set slow `ms` or short-hand such as "2s". - * - * @param {Number|String} ms - * @return {Suite|Number} for chaining - * @api private - */ - -Suite.prototype.slow = function(ms){ - if (0 === arguments.length) return this._slow; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('slow %d', ms); - this._slow = ms; - return this; -}; - -/** - * Sets whether to bail after first error. - * - * @parma {Boolean} bail - * @return {Suite|Number} for chaining - * @api private - */ - -Suite.prototype.bail = function(bail){ - if (0 == arguments.length) return this._bail; - debug('bail %s', bail); - this._bail = bail; - return this; -}; - -/** - * Run `fn(test[, done])` before running tests. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.beforeAll = function(fn){ - if (this.pending) return this; - var hook = new Hook('"before all" hook', fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeAll.push(hook); - this.emit('beforeAll', hook); - return this; -}; - -/** - * Run `fn(test[, done])` after running tests. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.afterAll = function(fn){ - if (this.pending) return this; - var hook = new Hook('"after all" hook', fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterAll.push(hook); - this.emit('afterAll', hook); - return this; -}; - -/** - * Run `fn(test[, done])` before each test case. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.beforeEach = function(fn){ - if (this.pending) return this; - var hook = new Hook('"before each" hook', fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeEach.push(hook); - this.emit('beforeEach', hook); - return this; -}; - -/** - * Run `fn(test[, done])` after each test case. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.afterEach = function(fn){ - if (this.pending) return this; - var hook = new Hook('"after each" hook', fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterEach.push(hook); - this.emit('afterEach', hook); - return this; -}; - -/** - * Add a test `suite`. - * - * @param {Suite} suite - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.addSuite = function(suite){ - suite.parent = this; - suite.timeout(this.timeout()); - suite.slow(this.slow()); - suite.bail(this.bail()); - this.suites.push(suite); - this.emit('suite', suite); - return this; -}; - -/** - * Add a `test` to this suite. - * - * @param {Test} test - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.addTest = function(test){ - test.parent = this; - test.timeout(this.timeout()); - test.slow(this.slow()); - test.ctx = this.ctx; - this.tests.push(test); - this.emit('test', test); - return this; -}; - -/** - * Return the full title generated by recursively - * concatenating the parent's full title. - * - * @return {String} - * @api public - */ - -Suite.prototype.fullTitle = function(){ - if (this.parent) { - var full = this.parent.fullTitle(); - if (full) return full + ' ' + this.title; - } - return this.title; -}; - -/** - * Return the total number of tests. - * - * @return {Number} - * @api public - */ - -Suite.prototype.total = function(){ - return utils.reduce(this.suites, function(sum, suite){ - return sum + suite.total(); - }, 0) + this.tests.length; -}; - -/** - * Iterates through each suite recursively to find - * all tests. Applies a function in the format - * `fn(test)`. - * - * @param {Function} fn - * @return {Suite} - * @api private - */ - -Suite.prototype.eachTest = function(fn){ - utils.forEach(this.tests, fn); - utils.forEach(this.suites, function(suite){ - suite.eachTest(fn); - }); - return this; -}; - -}); // module: suite.js - -require.register("test.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Runnable = require('./runnable'); - -/** - * Expose `Test`. - */ - -module.exports = Test; - -/** - * Initialize a new `Test` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - */ - -function Test(title, fn) { - Runnable.call(this, title, fn); - this.pending = !fn; - this.type = 'test'; -} - -/** - * Inherit from `Runnable.prototype`. - */ - -Test.prototype = new Runnable; -Test.prototype.constructor = Test; - - -}); // module: test.js - -require.register("utils.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var fs = require('browser/fs') - , path = require('browser/path') - , join = path.join - , debug = require('browser/debug')('mocha:watch'); - -/** - * Ignored directories. - */ - -var ignore = ['node_modules', '.git']; - -/** - * Escape special characters in the given string of html. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function(html){ - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -}; - -/** - * Array#forEach (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @param {Object} scope - * @api private - */ - -exports.forEach = function(arr, fn, scope){ - for (var i = 0, l = arr.length; i < l; i++) - fn.call(scope, arr[i], i); -}; - -/** - * Array#indexOf (<=IE8) - * - * @parma {Array} arr - * @param {Object} obj to find index of - * @param {Number} start - * @api private - */ - -exports.indexOf = function(arr, obj, start){ - for (var i = start || 0, l = arr.length; i < l; i++) { - if (arr[i] === obj) - return i; - } - return -1; -}; - -/** - * Array#reduce (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @param {Object} initial value - * @api private - */ - -exports.reduce = function(arr, fn, val){ - var rval = val; - - for (var i = 0, l = arr.length; i < l; i++) { - rval = fn(rval, arr[i], i, arr); - } - - return rval; -}; - -/** - * Array#filter (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @api private - */ - -exports.filter = function(arr, fn){ - var ret = []; - - for (var i = 0, l = arr.length; i < l; i++) { - var val = arr[i]; - if (fn(val, i, arr)) ret.push(val); - } - - return ret; -}; - -/** - * Object.keys (<=IE8) - * - * @param {Object} obj - * @return {Array} keys - * @api private - */ - -exports.keys = Object.keys || function(obj) { - var keys = [] - , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 - - for (var key in obj) { - if (has.call(obj, key)) { - keys.push(key); - } - } - - return keys; -}; - -/** - * Watch the given `files` for changes - * and invoke `fn(file)` on modification. - * - * @param {Array} files - * @param {Function} fn - * @api private - */ - -exports.watch = function(files, fn){ - var options = { interval: 100 }; - files.forEach(function(file){ - debug('file %s', file); - fs.watchFile(file, options, function(curr, prev){ - if (prev.mtime < curr.mtime) fn(file); - }); - }); -}; - -/** - * Ignored files. - */ - -function ignored(path){ - return !~ignore.indexOf(path); -} - -/** - * Lookup files in the given `dir`. - * - * @return {Array} - * @api private - */ - -exports.files = function(dir, ret){ - ret = ret || []; - - fs.readdirSync(dir) - .filter(ignored) - .forEach(function(path){ - path = join(dir, path); - if (fs.statSync(path).isDirectory()) { - exports.files(path, ret); - } else if (path.match(/\.(js|coffee)$/)) { - ret.push(path); - } - }); - - return ret; -}; - -/** - * Compute a slug from the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.slug = function(str){ - return str - .toLowerCase() - .replace(/ +/g, '-') - .replace(/[^-\w]/g, ''); -}; - -/** - * Strip the function definition from `str`, - * and re-indent for pre whitespace. - */ - -exports.clean = function(str) { - str = str - .replace(/^function *\(.*\) *{/, '') - .replace(/\s+\}$/, ''); - - var spaces = str.match(/^\n?( *)/)[1].length - , re = new RegExp('^ {' + spaces + '}', 'gm'); - - str = str.replace(re, ''); - - return exports.trim(str); -}; - -/** - * Escape regular expression characters in `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.escapeRegexp = function(str){ - return str.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); -}; - -/** - * Trim the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.trim = function(str){ - return str.replace(/^\s+|\s+$/g, ''); -}; - -/** - * Parse the given `qs`. - * - * @param {String} qs - * @return {Object} - * @api private - */ - -exports.parseQuery = function(qs){ - return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){ - var i = pair.indexOf('=') - , key = pair.slice(0, i) - , val = pair.slice(++i); - - obj[key] = decodeURIComponent(val); - return obj; - }, {}); -}; - -/** - * Highlight the given string of `js`. - * - * @param {String} js - * @return {String} - * @api private - */ - -function highlight(js) { - return js - .replace(//g, '>') - .replace(/\/\/(.*)/gm, '//$1') - .replace(/('.*?')/gm, '$1') - .replace(/(\d+\.\d+)/gm, '$1') - .replace(/(\d+)/gm, '$1') - .replace(/\bnew *(\w+)/gm, 'new $1') - .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1') -} - -/** - * Highlight the contents of tag `name`. - * - * @param {String} name - * @api private - */ - -exports.highlightTags = function(name) { - var code = document.getElementsByTagName(name); - for (var i = 0, len = code.length; i < len; ++i) { - code[i].innerHTML = highlight(code[i].innerHTML); - } -}; - -}); // module: utils.js -/** - * Node shims. - * - * These are meant only to allow - * mocha.js to run untouched, not - * to allow running node code in - * the browser. - */ - -process = {}; -process.exit = function(status){}; -process.stdout = {}; -global = window; - -/** - * next tick implementation. - */ - -process.nextTick = (function(){ - // postMessage behaves badly on IE8 - if (window.ActiveXObject || !window.postMessage) { - return function(fn){ fn() }; - } - - // based on setZeroTimeout by David Baron - // - http://dbaron.org/log/20100309-faster-timeouts - var timeouts = [] - , name = 'mocha-zero-timeout' - - window.addEventListener('message', function(e){ - if (e.source == window && e.data == name) { - if (e.stopPropagation) e.stopPropagation(); - if (timeouts.length) timeouts.shift()(); - } - }, true); - - return function(fn){ - timeouts.push(fn); - window.postMessage(name, '*'); - } -})(); - -/** - * Remove uncaughtException listener. - */ - -process.removeListener = function(e){ - if ('uncaughtException' == e) { - window.onerror = null; - } -}; - -/** - * Implements uncaughtException listener. - */ - -process.on = function(e, fn){ - if ('uncaughtException' == e) { - window.onerror = fn; - } -}; - -// boot -;(function(){ - - /** - * Expose mocha. - */ - - var Mocha = window.Mocha = require('mocha'), - mocha = window.mocha = new Mocha({ reporter: 'html' }); - - /** - * Override ui to ensure that the ui functions are initialized. - * Normally this would happen in Mocha.prototype.loadFiles. - */ - - mocha.ui = function(ui){ - Mocha.prototype.ui.call(this, ui); - this.suite.emit('pre-require', window, null, this); - return this; - }; - - /** - * Setup mocha with the given setting options. - */ - - mocha.setup = function(opts){ - if ('string' == typeof opts) opts = { ui: opts }; - for (var opt in opts) this[opt](opts[opt]); - return this; - }; - - /** - * Run mocha, returning the Runner. - */ - - mocha.run = function(fn){ - var options = mocha.options; - mocha.globals('location'); - - var query = Mocha.utils.parseQuery(window.location.search || ''); - if (query.grep) mocha.grep(query.grep); - - return Mocha.prototype.run.call(mocha, function(){ - Mocha.utils.highlightTags('code'); - if (fn) fn(); - }); - }; -})(); -})(); \ No newline at end of file diff --git a/node_modules/keycode/test/tests.html b/node_modules/keycode/test/tests.html deleted file mode 100644 index 5b54133..0000000 --- a/node_modules/keycode/test/tests.html +++ /dev/null @@ -1,17 +0,0 @@ - - - Mocha - - - - -
    - - - - - - - diff --git a/node_modules/m3u8-parser/CHANGELOG.md b/node_modules/m3u8-parser/CHANGELOG.md deleted file mode 100644 index 632d12c..0000000 --- a/node_modules/m3u8-parser/CHANGELOG.md +++ /dev/null @@ -1,169 +0,0 @@ -
    -# [4.7.0](https://github.com/videojs/m3u8-parser/compare/v4.6.0...v4.7.0) (2021-05-19) - -### Features - -* add key property to init segment/map ([#141](https://github.com/videojs/m3u8-parser/issues/141)) ([ae5fa64](https://github.com/videojs/m3u8-parser/commit/ae5fa64)) - -### Bug Fixes - -* ignore fairplay content protection ([#140](https://github.com/videojs/m3u8-parser/issues/140)) ([9f62c85](https://github.com/videojs/m3u8-parser/commit/9f62c85)) - - -# [4.6.0](https://github.com/videojs/m3u8-parser/compare/v4.5.2...v4.6.0) (2021-03-04) - -### Features - -* add support for #EXT-X-PART ([#127](https://github.com/videojs/m3u8-parser/issues/127)) ([9f5a224](https://github.com/videojs/m3u8-parser/commit/9f5a224)), closes [/developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls#3282436](https://github.com//developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls/issues/3282436) [/tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08#section-4](https://github.com//tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08/issues/section-4) -* add support for #EXT-X-PART-INF ([#126](https://github.com/videojs/m3u8-parser/issues/126)) ([985ab68](https://github.com/videojs/m3u8-parser/commit/985ab68)), closes [/developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls#3282434](https://github.com//developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls/issues/3282434) [/tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08#section-4](https://github.com//tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08/issues/section-4) -* add support for #EXT-X-PRELOAD-HINT ([#123](https://github.com/videojs/m3u8-parser/issues/123)) ([4fd693a](https://github.com/videojs/m3u8-parser/commit/4fd693a)), closes [/developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls#3526694](https://github.com//developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls/issues/3526694) [/tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08#section-4](https://github.com//tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08/issues/section-4) -* add support for #EXT-X-RENDITION-REPORT ([#124](https://github.com/videojs/m3u8-parser/issues/124)) ([03f4345](https://github.com/videojs/m3u8-parser/commit/03f4345)), closes [/developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls#3282435](https://github.com//developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls/issues/3282435) [/tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08#section-4](https://github.com//tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08/issues/section-4) -* add support for #EXT-X-SERVER-CONTROL ([#121](https://github.com/videojs/m3u8-parser/issues/121)) ([7f82f53](https://github.com/videojs/m3u8-parser/commit/7f82f53)), closes [/developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls#3281374](https://github.com//developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls/issues/3281374) [/tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08#section-4](https://github.com//tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08/issues/section-4) -* add support for #EXT-X-SKIP ([#122](https://github.com/videojs/m3u8-parser/issues/122)) ([9cebc86](https://github.com/videojs/m3u8-parser/commit/9cebc86)), closes [/developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls#3282433](https://github.com//developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls/issues/3282433) [/tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08#section-4](https://github.com//tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08/issues/section-4) -* add version parsing and remove totalduration ([#135](https://github.com/videojs/m3u8-parser/issues/135)) ([98f0421](https://github.com/videojs/m3u8-parser/commit/98f0421)) -* add warn/info triggers and defaults for ll-hls tags ([#131](https://github.com/videojs/m3u8-parser/issues/131)) ([4f4da3d](https://github.com/videojs/m3u8-parser/commit/4f4da3d)) -* **llhls:** preloadSegment, associate parts/preloadHints with segments, unify byterange handling ([#137](https://github.com/videojs/m3u8-parser/issues/137)) ([2c2dffe](https://github.com/videojs/m3u8-parser/commit/2c2dffe)) - -### Chores - -* lint fixtures ([#134](https://github.com/videojs/m3u8-parser/issues/134)) ([e09c7ed](https://github.com/videojs/m3u8-parser/commit/e09c7ed)) -* remove unused and non-standard tag #ZEN-TOTAL-DURATION ([#133](https://github.com/videojs/m3u8-parser/issues/133)) ([fb3b629](https://github.com/videojs/m3u8-parser/commit/fb3b629)) -* switch to rollup-plugin-data-files ([#130](https://github.com/videojs/m3u8-parser/issues/130)) ([8f69b45](https://github.com/videojs/m3u8-parser/commit/8f69b45)) - -### Code Refactoring - -* llhls attributes to camel case ([#138](https://github.com/videojs/m3u8-parser/issues/138)) ([31ed052](https://github.com/videojs/m3u8-parser/commit/31ed052)) - -### Tests - -* add llhls manifests for incoming features ([#125](https://github.com/videojs/m3u8-parser/issues/125)) ([0823ea8](https://github.com/videojs/m3u8-parser/commit/0823ea8)) -* move tests around ([#129](https://github.com/videojs/m3u8-parser/issues/129)) ([e86dcae](https://github.com/videojs/m3u8-parser/commit/e86dcae)) - - -## [4.5.2](https://github.com/videojs/m3u8-parser/compare/v4.5.1...v4.5.2) (2021-01-12) - -### Bug Fixes - -* cjs dist should import only cjs ([#120](https://github.com/videojs/m3u8-parser/issues/120)) ([a58149d](https://github.com/videojs/m3u8-parser/commit/a58149d)) - - -## [4.5.1](https://github.com/videojs/m3u8-parser/compare/v4.5.0...v4.5.1) (2021-01-11) - -### Chores - -* update to vhs-utils[@3](https://github.com/3) ([#118](https://github.com/videojs/m3u8-parser/issues/118)) ([f701c0f](https://github.com/videojs/m3u8-parser/commit/f701c0f)) - - -# [4.5.0](https://github.com/videojs/m3u8-parser/compare/v4.4.3...v4.5.0) (2020-11-03) - -### Chores - -* **package:** update to vhs-utils[@2](https://github.com/2) ([#117](https://github.com/videojs/m3u8-parser/issues/117)) ([57ac9d2](https://github.com/videojs/m3u8-parser/commit/57ac9d2)) - - -## [4.4.3](https://github.com/videojs/m3u8-parser/compare/v4.4.2...v4.4.3) (2020-08-12) - -### Bug Fixes - -* fix default EXT-X-BYTERANGE offset to start after the previous segment ([#98](https://github.com/videojs/m3u8-parser/issues/98)) ([08aca73](https://github.com/videojs/m3u8-parser/commit/08aca73)) - -### Tests - -* run tests on node ([#97](https://github.com/videojs/m3u8-parser/issues/97)) ([4ad5c2d](https://github.com/videojs/m3u8-parser/commit/4ad5c2d)) - - -## [4.4.2](https://github.com/videojs/m3u8-parser/compare/v4.4.1...v4.4.2) (2019-08-30) - -### Chores - -* **package:** update [@videojs](https://github.com/videojs)/vhs-utils ([651b4ae](https://github.com/videojs/m3u8-parser/commit/651b4ae)) - - -## [4.4.1](https://github.com/videojs/m3u8-parser/compare/v4.4.0...v4.4.1) (2019-08-21) - -### Chores - -* update generator version and use [@videojs](https://github.com/videojs)/vhs-utils ([#95](https://github.com/videojs/m3u8-parser/issues/95)) ([7985794](https://github.com/videojs/m3u8-parser/commit/7985794)) - - -# [4.4.0](https://github.com/videojs/m3u8-parser/compare/v4.3.0...v4.4.0) (2019-06-25) - -### Features - -* parse key attributes for Widevine HLS ([#88](https://github.com/videojs/m3u8-parser/issues/88)) ([d835fa8](https://github.com/videojs/m3u8-parser/commit/d835fa8)) - -### Chores - -* **package:** update all dev dependencies ([#89](https://github.com/videojs/m3u8-parser/issues/89)) ([e991447](https://github.com/videojs/m3u8-parser/commit/e991447)) - - -# [4.3.0](https://github.com/videojs/m3u8-parser/compare/v4.2.0...v4.3.0) (2019-01-10) - -### Features - -* custom tag mapping ([#73](https://github.com/videojs/m3u8-parser/issues/73)) ([0ef040a](https://github.com/videojs/m3u8-parser/commit/0ef040a)) - -### Chores - -* Update to plugin generator 7 standards ([#53](https://github.com/videojs/m3u8-parser/issues/53)) ([35ff471](https://github.com/videojs/m3u8-parser/commit/35ff471)) -* **package:** update rollup to version 0.66.0 ([#55](https://github.com/videojs/m3u8-parser/issues/55)) ([2407466](https://github.com/videojs/m3u8-parser/commit/2407466)) -* Update videojs-generate-karma-config to the latest version 🚀 ([#59](https://github.com/videojs/m3u8-parser/issues/59)) ([023c6c9](https://github.com/videojs/m3u8-parser/commit/023c6c9)) -* Update videojs-generate-karma-config to the latest version 🚀 ([#60](https://github.com/videojs/m3u8-parser/issues/60)) ([2773819](https://github.com/videojs/m3u8-parser/commit/2773819)) -* Update videojs-generate-rollup-config to the latest version 🚀 ([#58](https://github.com/videojs/m3u8-parser/issues/58)) ([8c28a8b](https://github.com/videojs/m3u8-parser/commit/8c28a8b)) - - -# [4.2.0](https://github.com/videojs/m3u8-parser/compare/v4.1.0...v4.2.0) (2018-02-23) - -### Features - -* add program-date-time tag info to parsed segments ([#27](https://github.com/videojs/m3u8-parser/issues/27)) ([44fc6f8](https://github.com/videojs/m3u8-parser/commit/44fc6f8)) - - -# [4.1.0](https://github.com/videojs/m3u8-parser/compare/v4.0.0...v4.1.0) (2018-01-24) - - -# [4.0.0](https://github.com/videojs/m3u8-parser/compare/v3.0.0...v4.0.0) (2017-11-21) - -### Features - -* added ability to parse EXT-X-START tags [#31](https://github.com/videojs/m3u8-parser/pull/31) - -### BREAKING CHANGES - -* camel case module name in rollup config to work with latest rollup [#32](https://github.com/videojs/m3u8-parser/pull/32) - - -# 3.0.0 (2017-06-09) - -### Features - -* Rollup ([#24](https://github.com/videojs/m3u8-parser/issues/24)) ([47ef11f](https://github.com/videojs/m3u8-parser/commit/47ef11f)) - - -### BREAKING CHANGES - -* drop bower support. - -## 2.1.0 (2017-02-23) -* parse FORCED attribute of media-groups [#15](https://github.com/videojs/m3u8-parser/pull/15) -* Pass any CHARACTERISTICS value of a track with the track object [#14](https://github.com/videojs/m3u8-parser/pull/14) - -## 2.0.1 (2017-01-20) -* Fix: Include the babel ES3 tranform to support IE8 [#13](https://github.com/videojs/m3u8-parser/pull/13) - -## 2.0.0 (2017-01-13) -* Manifest object is now initialized with an empty segments arrays -* moved to latest videojs-standard version, brought code into -compliance with the latest eslint rules. - -## 1.0.2 (2016-06-07) -* fix the build pipeline -* removed video.js css/js inclusion during tests - -## 1.0.1 (2016-06-07) -* remove dependence on video.js -* added contributors to package.json - -## 1.0.0 (2016-06-03) -Initial Release - diff --git a/node_modules/m3u8-parser/CONTRIBUTING.md b/node_modules/m3u8-parser/CONTRIBUTING.md deleted file mode 100644 index 7840f8c..0000000 --- a/node_modules/m3u8-parser/CONTRIBUTING.md +++ /dev/null @@ -1,30 +0,0 @@ -# CONTRIBUTING - -We welcome contributions from everyone! - -## Getting Started - -Make sure you have Node.js 4.8 or higher and npm installed. - -1. Fork this repository and clone your fork -1. Install dependencies: `npm install` -1. Run a development server: `npm start` - -### Making Changes - -Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship. - -When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository. - -### Running Tests - -Testing is a crucial part of any software project. For all but the most trivial changes (typos, etc) test cases are expected. Tests are run in actual browsers using [Karma][karma]. - -- In all available and supported browsers: `npm test` -- In a specific browser: `npm run test:chrome`, `npm run test:firefox`, etc. -- While development server is running (`npm start`), navigate to [`http://localhost:9999/test/`][local] - - -[karma]: http://karma-runner.github.io/ -[local]: http://localhost:9999/test/ -[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md diff --git a/node_modules/m3u8-parser/LICENSE b/node_modules/m3u8-parser/LICENSE deleted file mode 100644 index 23d0fbb..0000000 --- a/node_modules/m3u8-parser/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright Brightcove, Inc - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/node_modules/m3u8-parser/README.md b/node_modules/m3u8-parser/README.md deleted file mode 100644 index a7dec81..0000000 --- a/node_modules/m3u8-parser/README.md +++ /dev/null @@ -1,388 +0,0 @@ -# m3u8-parser -[![Build Status](https://travis-ci.org/videojs/m3u8-parser.svg?branch=master)](https://travis-ci.org/videojs/m3u8-parser) -[![Greenkeeper badge](https://badges.greenkeeper.io/videojs/m3u8-parser.svg)](https://greenkeeper.io/) -[![Slack Status](http://slack.videojs.com/badge.svg)](http://slack.videojs.com) - -[![NPM](https://nodei.co/npm/m3u8-parser.png?downloads=true&downloadRank=true)](https://nodei.co/npm/m3u8-parser/) - -m3u8 parser - - - - - -- [Installation](#installation) -- [Usage](#usage) - - [Parsed Output](#parsed-output) -- [Supported Tags](#supported-tags) - - [Basic Playlist Tags](#basic-playlist-tags) - - [Media Segment Tags](#media-segment-tags) - - [Media Playlist Tags](#media-playlist-tags) - - [Master Playlist Tags](#master-playlist-tags) - - [Experimental Tags](#experimental-tags) - - [EXT-X-CUE-OUT](#ext-x-cue-out) - - [EXT-X-CUE-OUT-CONT](#ext-x-cue-out-cont) - - [EXT-X-CUE-IN](#ext-x-cue-in) - - [Not Yet Supported](#not-yet-supported) - - [Custom Parsers](#custom-parsers) -- [Including the Parser](#including-the-parser) - - [` - -``` - -### Browserify - -When using with Browserify, install m3u8-parser via npm and `require` the parser as you would any other module. - -```js -var m3u8Parser = require('m3u8-parser'); - -var parser = new m3u8Parser.Parser(); -``` - -With ES6: -```js -import { Parser } from 'm3u8-parser'; - -const parser = new Parser(); -``` - -### RequireJS/AMD - -When using with RequireJS (or another AMD library), get the script in whatever way you prefer and `require` the parser as you normally would: - -```js -require(['m3u8-parser'], function(m3u8Parser) { - var parser = new m3u8Parser.Parser(); -}); -``` - -## License - -Apache-2.0. Copyright (c) Brightcove, Inc diff --git a/node_modules/m3u8-parser/dist/m3u8-parser.cjs.js b/node_modules/m3u8-parser/dist/m3u8-parser.cjs.js deleted file mode 100644 index f2b5b01..0000000 --- a/node_modules/m3u8-parser/dist/m3u8-parser.cjs.js +++ /dev/null @@ -1,1543 +0,0 @@ -/*! @name m3u8-parser @version 4.7.0 @license Apache-2.0 */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose'); -var Stream = require('@videojs/vhs-utils/cjs/stream.js'); -var _extends = require('@babel/runtime/helpers/extends'); -var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized'); -var decodeB64ToUint8Array = require('@videojs/vhs-utils/cjs/decode-b64-to-uint8-array.js'); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose); -var Stream__default = /*#__PURE__*/_interopDefaultLegacy(Stream); -var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends); -var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized); -var decodeB64ToUint8Array__default = /*#__PURE__*/_interopDefaultLegacy(decodeB64ToUint8Array); - -/** - * A stream that buffers string input and generates a `data` event for each - * line. - * - * @class LineStream - * @extends Stream - */ - -var LineStream = /*#__PURE__*/function (_Stream) { - _inheritsLoose__default['default'](LineStream, _Stream); - - function LineStream() { - var _this; - - _this = _Stream.call(this) || this; - _this.buffer = ''; - return _this; - } - /** - * Add new data to be parsed. - * - * @param {string} data the text to process - */ - - - var _proto = LineStream.prototype; - - _proto.push = function push(data) { - var nextNewline; - this.buffer += data; - nextNewline = this.buffer.indexOf('\n'); - - for (; nextNewline > -1; nextNewline = this.buffer.indexOf('\n')) { - this.trigger('data', this.buffer.substring(0, nextNewline)); - this.buffer = this.buffer.substring(nextNewline + 1); - } - }; - - return LineStream; -}(Stream__default['default']); - -var TAB = String.fromCharCode(0x09); - -var parseByterange = function parseByterange(byterangeString) { - // optionally match and capture 0+ digits before `@` - // optionally match and capture 0+ digits after `@` - var match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || ''); - var result = {}; - - if (match[1]) { - result.length = parseInt(match[1], 10); - } - - if (match[2]) { - result.offset = parseInt(match[2], 10); - } - - return result; -}; -/** - * "forgiving" attribute list psuedo-grammar: - * attributes -> keyvalue (',' keyvalue)* - * keyvalue -> key '=' value - * key -> [^=]* - * value -> '"' [^"]* '"' | [^,]* - */ - - -var attributeSeparator = function attributeSeparator() { - var key = '[^=]*'; - var value = '"[^"]*"|[^,]*'; - var keyvalue = '(?:' + key + ')=(?:' + value + ')'; - return new RegExp('(?:^|,)(' + keyvalue + ')'); -}; -/** - * Parse attributes from a line given the separator - * - * @param {string} attributes the attribute line to parse - */ - - -var parseAttributes = function parseAttributes(attributes) { - // split the string using attributes as the separator - var attrs = attributes.split(attributeSeparator()); - var result = {}; - var i = attrs.length; - var attr; - - while (i--) { - // filter out unmatched portions of the string - if (attrs[i] === '') { - continue; - } // split the key and value - - - attr = /([^=]*)=(.*)/.exec(attrs[i]).slice(1); // trim whitespace and remove optional quotes around the value - - attr[0] = attr[0].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^['"](.*)['"]$/g, '$1'); - result[attr[0]] = attr[1]; - } - - return result; -}; -/** - * A line-level M3U8 parser event stream. It expects to receive input one - * line at a time and performs a context-free parse of its contents. A stream - * interpretation of a manifest can be useful if the manifest is expected to - * be too large to fit comfortably into memory or the entirety of the input - * is not immediately available. Otherwise, it's probably much easier to work - * with a regular `Parser` object. - * - * Produces `data` events with an object that captures the parser's - * interpretation of the input. That object has a property `tag` that is one - * of `uri`, `comment`, or `tag`. URIs only have a single additional - * property, `line`, which captures the entirety of the input without - * interpretation. Comments similarly have a single additional property - * `text` which is the input without the leading `#`. - * - * Tags always have a property `tagType` which is the lower-cased version of - * the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance, - * `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized - * tags are given the tag type `unknown` and a single additional property - * `data` with the remainder of the input. - * - * @class ParseStream - * @extends Stream - */ - - -var ParseStream = /*#__PURE__*/function (_Stream) { - _inheritsLoose__default['default'](ParseStream, _Stream); - - function ParseStream() { - var _this; - - _this = _Stream.call(this) || this; - _this.customParsers = []; - _this.tagMappers = []; - return _this; - } - /** - * Parses an additional line of input. - * - * @param {string} line a single line of an M3U8 file to parse - */ - - - var _proto = ParseStream.prototype; - - _proto.push = function push(line) { - var _this2 = this; - - var match; - var event; // strip whitespace - - line = line.trim(); - - if (line.length === 0) { - // ignore empty lines - return; - } // URIs - - - if (line[0] !== '#') { - this.trigger('data', { - type: 'uri', - uri: line - }); - return; - } // map tags - - - var newLines = this.tagMappers.reduce(function (acc, mapper) { - var mappedLine = mapper(line); // skip if unchanged - - if (mappedLine === line) { - return acc; - } - - return acc.concat([mappedLine]); - }, [line]); - newLines.forEach(function (newLine) { - for (var i = 0; i < _this2.customParsers.length; i++) { - if (_this2.customParsers[i].call(_this2, newLine)) { - return; - } - } // Comments - - - if (newLine.indexOf('#EXT') !== 0) { - _this2.trigger('data', { - type: 'comment', - text: newLine.slice(1) - }); - - return; - } // strip off any carriage returns here so the regex matching - // doesn't have to account for them. - - - newLine = newLine.replace('\r', ''); // Tags - - match = /^#EXTM3U/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'm3u' - }); - - return; - } - - match = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'inf' - }; - - if (match[1]) { - event.duration = parseFloat(match[1]); - } - - if (match[2]) { - event.title = match[2]; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'targetduration' - }; - - if (match[1]) { - event.duration = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'version' - }; - - if (match[1]) { - event.version = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'media-sequence' - }; - - if (match[1]) { - event.number = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'discontinuity-sequence' - }; - - if (match[1]) { - event.number = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'playlist-type' - }; - - if (match[1]) { - event.playlistType = match[1]; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-BYTERANGE:?(.*)?$/.exec(newLine); - - if (match) { - event = _extends__default['default'](parseByterange(match[1]), { - type: 'tag', - tagType: 'byterange' - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'allow-cache' - }; - - if (match[1]) { - event.allowed = !/NO/.test(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MAP:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'map' - }; - - if (match[1]) { - var attributes = parseAttributes(match[1]); - - if (attributes.URI) { - event.uri = attributes.URI; - } - - if (attributes.BYTERANGE) { - event.byterange = parseByterange(attributes.BYTERANGE); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'stream-inf' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); - - if (event.attributes.RESOLUTION) { - var split = event.attributes.RESOLUTION.split('x'); - var resolution = {}; - - if (split[0]) { - resolution.width = parseInt(split[0], 10); - } - - if (split[1]) { - resolution.height = parseInt(split[1], 10); - } - - event.attributes.RESOLUTION = resolution; - } - - if (event.attributes.BANDWIDTH) { - event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10); - } - - if (event.attributes['PROGRAM-ID']) { - event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MEDIA:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'media' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-ENDLIST/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'endlist' - }); - - return; - } - - match = /^#EXT-X-DISCONTINUITY/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'discontinuity' - }); - - return; - } - - match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'program-date-time' - }; - - if (match[1]) { - event.dateTimeString = match[1]; - event.dateTimeObject = new Date(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-KEY:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'key' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); // parse the IV string into a Uint32Array - - if (event.attributes.IV) { - if (event.attributes.IV.substring(0, 2).toLowerCase() === '0x') { - event.attributes.IV = event.attributes.IV.substring(2); - } - - event.attributes.IV = event.attributes.IV.match(/.{8}/g); - event.attributes.IV[0] = parseInt(event.attributes.IV[0], 16); - event.attributes.IV[1] = parseInt(event.attributes.IV[1], 16); - event.attributes.IV[2] = parseInt(event.attributes.IV[2], 16); - event.attributes.IV[3] = parseInt(event.attributes.IV[3], 16); - event.attributes.IV = new Uint32Array(event.attributes.IV); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-START:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'start' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); - event.attributes['TIME-OFFSET'] = parseFloat(event.attributes['TIME-OFFSET']); - event.attributes.PRECISE = /YES/.test(event.attributes.PRECISE); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-out-cont' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-out' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-in' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-SKIP:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'skip' - }; - event.attributes = parseAttributes(match[1]); - - if (event.attributes.hasOwnProperty('SKIPPED-SEGMENTS')) { - event.attributes['SKIPPED-SEGMENTS'] = parseInt(event.attributes['SKIPPED-SEGMENTS'], 10); - } - - if (event.attributes.hasOwnProperty('RECENTLY-REMOVED-DATERANGES')) { - event.attributes['RECENTLY-REMOVED-DATERANGES'] = event.attributes['RECENTLY-REMOVED-DATERANGES'].split(TAB); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PART:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part' - }; - event.attributes = parseAttributes(match[1]); - ['DURATION'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - ['INDEPENDENT', 'GAP'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = /YES/.test(event.attributes[key]); - } - }); - - if (event.attributes.hasOwnProperty('BYTERANGE')) { - event.attributes.byterange = parseByterange(event.attributes.BYTERANGE); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'server-control' - }; - event.attributes = parseAttributes(match[1]); - ['CAN-SKIP-UNTIL', 'PART-HOLD-BACK', 'HOLD-BACK'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - ['CAN-SKIP-DATERANGES', 'CAN-BLOCK-RELOAD'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = /YES/.test(event.attributes[key]); - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part-inf' - }; - event.attributes = parseAttributes(match[1]); - ['PART-TARGET'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'preload-hint' - }; - event.attributes = parseAttributes(match[1]); - ['BYTERANGE-START', 'BYTERANGE-LENGTH'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - var subkey = key === 'BYTERANGE-LENGTH' ? 'length' : 'offset'; - event.attributes.byterange = event.attributes.byterange || {}; - event.attributes.byterange[subkey] = event.attributes[key]; // only keep the parsed byterange object. - - delete event.attributes[key]; - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'rendition-report' - }; - event.attributes = parseAttributes(match[1]); - ['LAST-MSN', 'LAST-PART'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - } - }); - - _this2.trigger('data', event); - - return; - } // unknown tag type - - - _this2.trigger('data', { - type: 'tag', - data: newLine.slice(4) - }); - }); - } - /** - * Add a parser for custom headers - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.customType the custom type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - ; - - _proto.addParser = function addParser(_ref) { - var _this3 = this; - - var expression = _ref.expression, - customType = _ref.customType, - dataParser = _ref.dataParser, - segment = _ref.segment; - - if (typeof dataParser !== 'function') { - dataParser = function dataParser(line) { - return line; - }; - } - - this.customParsers.push(function (line) { - var match = expression.exec(line); - - if (match) { - _this3.trigger('data', { - type: 'custom', - data: dataParser(line), - customType: customType, - segment: segment - }); - - return true; - } - }); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - ; - - _proto.addTagMapper = function addTagMapper(_ref2) { - var expression = _ref2.expression, - map = _ref2.map; - - var mapFn = function mapFn(line) { - if (expression.test(line)) { - return map(line); - } - - return line; - }; - - this.tagMappers.push(mapFn); - }; - - return ParseStream; -}(Stream__default['default']); - -var camelCase = function camelCase(str) { - return str.toLowerCase().replace(/-(\w)/g, function (a) { - return a[1].toUpperCase(); - }); -}; - -var camelCaseKeys = function camelCaseKeys(attributes) { - var result = {}; - Object.keys(attributes).forEach(function (key) { - result[camelCase(key)] = attributes[key]; - }); - return result; -}; // set SERVER-CONTROL hold back based upon targetDuration and partTargetDuration -// we need this helper because defaults are based upon targetDuration and -// partTargetDuration being set, but they may not be if SERVER-CONTROL appears before -// target durations are set. - - -var setHoldBack = function setHoldBack(manifest) { - var serverControl = manifest.serverControl, - targetDuration = manifest.targetDuration, - partTargetDuration = manifest.partTargetDuration; - - if (!serverControl) { - return; - } - - var tag = '#EXT-X-SERVER-CONTROL'; - var hb = 'holdBack'; - var phb = 'partHoldBack'; - var minTargetDuration = targetDuration && targetDuration * 3; - var minPartDuration = partTargetDuration && partTargetDuration * 2; - - if (targetDuration && !serverControl.hasOwnProperty(hb)) { - serverControl[hb] = minTargetDuration; - this.trigger('info', { - message: tag + " defaulting HOLD-BACK to targetDuration * 3 (" + minTargetDuration + ")." - }); - } - - if (minTargetDuration && serverControl[hb] < minTargetDuration) { - this.trigger('warn', { - message: tag + " clamping HOLD-BACK (" + serverControl[hb] + ") to targetDuration * 3 (" + minTargetDuration + ")" - }); - serverControl[hb] = minTargetDuration; - } // default no part hold back to part target duration * 3 - - - if (partTargetDuration && !serverControl.hasOwnProperty(phb)) { - serverControl[phb] = partTargetDuration * 3; - this.trigger('info', { - message: tag + " defaulting PART-HOLD-BACK to partTargetDuration * 3 (" + serverControl[phb] + ")." - }); - } // if part hold back is too small default it to part target duration * 2 - - - if (partTargetDuration && serverControl[phb] < minPartDuration) { - this.trigger('warn', { - message: tag + " clamping PART-HOLD-BACK (" + serverControl[phb] + ") to partTargetDuration * 2 (" + minPartDuration + ")." - }); - serverControl[phb] = minPartDuration; - } -}; -/** - * A parser for M3U8 files. The current interpretation of the input is - * exposed as a property `manifest` on parser objects. It's just two lines to - * create and parse a manifest once you have the contents available as a string: - * - * ```js - * var parser = new m3u8.Parser(); - * parser.push(xhr.responseText); - * ``` - * - * New input can later be applied to update the manifest object by calling - * `push` again. - * - * The parser attempts to create a usable manifest object even if the - * underlying input is somewhat nonsensical. It emits `info` and `warning` - * events during the parse if it encounters input that seems invalid or - * requires some property of the manifest object to be defaulted. - * - * @class Parser - * @extends Stream - */ - - -var Parser = /*#__PURE__*/function (_Stream) { - _inheritsLoose__default['default'](Parser, _Stream); - - function Parser() { - var _this; - - _this = _Stream.call(this) || this; - _this.lineStream = new LineStream(); - _this.parseStream = new ParseStream(); - - _this.lineStream.pipe(_this.parseStream); - /* eslint-disable consistent-this */ - - - var self = _assertThisInitialized__default['default'](_this); - /* eslint-enable consistent-this */ - - - var uris = []; - var currentUri = {}; // if specified, the active EXT-X-MAP definition - - var currentMap; // if specified, the active decryption key - - var _key; - - var hasParts = false; - - var noop = function noop() {}; - - var defaultMediaGroups = { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }; // This is the Widevine UUID from DASH IF IOP. The same exact string is - // used in MPDs with Widevine encrypted streams. - - var widevineUuid = 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'; // group segments into numbered timelines delineated by discontinuities - - var currentTimeline = 0; // the manifest is empty until the parse stream begins delivering data - - _this.manifest = { - allowCache: true, - discontinuityStarts: [], - segments: [] - }; // keep track of the last seen segment's byte range end, as segments are not required - // to provide the offset, in which case it defaults to the next byte after the - // previous segment - - var lastByterangeEnd = 0; // keep track of the last seen part's byte range end. - - var lastPartByterangeEnd = 0; - - _this.on('end', function () { - // only add preloadSegment if we don't yet have a uri for it. - // and we actually have parts/preloadHints - if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) { - return; - } - - if (!currentUri.map && currentMap) { - currentUri.map = currentMap; - } - - if (!currentUri.key && _key) { - currentUri.key = _key; - } - - if (!currentUri.timeline && typeof currentTimeline === 'number') { - currentUri.timeline = currentTimeline; - } - - _this.manifest.preloadSegment = currentUri; - }); // update the manifest with the m3u8 entry from the parse stream - - - _this.parseStream.on('data', function (entry) { - var mediaGroup; - var rendition; - ({ - tag: function tag() { - // switch based on the tag type - (({ - version: function version() { - if (entry.version) { - this.manifest.version = entry.version; - } - }, - 'allow-cache': function allowCache() { - this.manifest.allowCache = entry.allowed; - - if (!('allowed' in entry)) { - this.trigger('info', { - message: 'defaulting allowCache to YES' - }); - this.manifest.allowCache = true; - } - }, - byterange: function byterange() { - var byterange = {}; - - if ('length' in entry) { - currentUri.byterange = byterange; - byterange.length = entry.length; - - if (!('offset' in entry)) { - /* - * From the latest spec (as of this writing): - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.2 - * - * Same text since EXT-X-BYTERANGE's introduction in draft 7: - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-07#section-3.3.1) - * - * "If o [offset] is not present, the sub-range begins at the next byte - * following the sub-range of the previous media segment." - */ - entry.offset = lastByterangeEnd; - } - } - - if ('offset' in entry) { - currentUri.byterange = byterange; - byterange.offset = entry.offset; - } - - lastByterangeEnd = byterange.offset + byterange.length; - }, - endlist: function endlist() { - this.manifest.endList = true; - }, - inf: function inf() { - if (!('mediaSequence' in this.manifest)) { - this.manifest.mediaSequence = 0; - this.trigger('info', { - message: 'defaulting media sequence to zero' - }); - } - - if (!('discontinuitySequence' in this.manifest)) { - this.manifest.discontinuitySequence = 0; - this.trigger('info', { - message: 'defaulting discontinuity sequence to zero' - }); - } - - if (entry.duration > 0) { - currentUri.duration = entry.duration; - } - - if (entry.duration === 0) { - currentUri.duration = 0.01; - this.trigger('info', { - message: 'updating zero segment duration to a small value' - }); - } - - this.manifest.segments = uris; - }, - key: function key() { - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring key declaration without attribute list' - }); - return; - } // clear the active encryption key - - - if (entry.attributes.METHOD === 'NONE') { - _key = null; - return; - } - - if (!entry.attributes.URI) { - this.trigger('warn', { - message: 'ignoring key declaration without URI' - }); - return; - } - - if (entry.attributes.KEYFORMAT === 'com.apple.streamingkeydelivery') { - this.manifest.contentProtection = this.manifest.contentProtection || {}; // TODO: add full support for this. - - this.manifest.contentProtection['com.apple.fps.1_0'] = { - attributes: entry.attributes - }; - return; - } // check if the content is encrypted for Widevine - // Widevine/HLS spec: https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf - - - if (entry.attributes.KEYFORMAT === widevineUuid) { - var VALID_METHODS = ['SAMPLE-AES', 'SAMPLE-AES-CTR', 'SAMPLE-AES-CENC']; - - if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) { - this.trigger('warn', { - message: 'invalid key method provided for Widevine' - }); - return; - } - - if (entry.attributes.METHOD === 'SAMPLE-AES-CENC') { - this.trigger('warn', { - message: 'SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead' - }); - } - - if (entry.attributes.URI.substring(0, 23) !== 'data:text/plain;base64,') { - this.trigger('warn', { - message: 'invalid key URI provided for Widevine' - }); - return; - } - - if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === '0x')) { - this.trigger('warn', { - message: 'invalid key ID provided for Widevine' - }); - return; - } // if Widevine key attributes are valid, store them as `contentProtection` - // on the manifest to emulate Widevine tag structure in a DASH mpd - - - this.manifest.contentProtection = this.manifest.contentProtection || {}; - this.manifest.contentProtection['com.widevine.alpha'] = { - attributes: { - schemeIdUri: entry.attributes.KEYFORMAT, - // remove '0x' from the key id string - keyId: entry.attributes.KEYID.substring(2) - }, - // decode the base64-encoded PSSH box - pssh: decodeB64ToUint8Array__default['default'](entry.attributes.URI.split(',')[1]) - }; - return; - } - - if (!entry.attributes.METHOD) { - this.trigger('warn', { - message: 'defaulting key method to AES-128' - }); - } // setup an encryption key for upcoming segments - - - _key = { - method: entry.attributes.METHOD || 'AES-128', - uri: entry.attributes.URI - }; - - if (typeof entry.attributes.IV !== 'undefined') { - _key.iv = entry.attributes.IV; - } - }, - 'media-sequence': function mediaSequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid media sequence: ' + entry.number - }); - return; - } - - this.manifest.mediaSequence = entry.number; - }, - 'discontinuity-sequence': function discontinuitySequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid discontinuity sequence: ' + entry.number - }); - return; - } - - this.manifest.discontinuitySequence = entry.number; - currentTimeline = entry.number; - }, - 'playlist-type': function playlistType() { - if (!/VOD|EVENT/.test(entry.playlistType)) { - this.trigger('warn', { - message: 'ignoring unknown playlist type: ' + entry.playlist - }); - return; - } - - this.manifest.playlistType = entry.playlistType; - }, - map: function map() { - currentMap = {}; - - if (entry.uri) { - currentMap.uri = entry.uri; - } - - if (entry.byterange) { - currentMap.byterange = entry.byterange; - } - - if (_key) { - currentMap.key = _key; - } - }, - 'stream-inf': function streamInf() { - this.manifest.playlists = uris; - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring empty stream-inf attributes' - }); - return; - } - - if (!currentUri.attributes) { - currentUri.attributes = {}; - } - - _extends__default['default'](currentUri.attributes, entry.attributes); - }, - media: function media() { - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!(entry.attributes && entry.attributes.TYPE && entry.attributes['GROUP-ID'] && entry.attributes.NAME)) { - this.trigger('warn', { - message: 'ignoring incomplete or missing media group' - }); - return; - } // find the media group, creating defaults as necessary - - - var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE]; - mediaGroupType[entry.attributes['GROUP-ID']] = mediaGroupType[entry.attributes['GROUP-ID']] || {}; - mediaGroup = mediaGroupType[entry.attributes['GROUP-ID']]; // collect the rendition metadata - - rendition = { - default: /yes/i.test(entry.attributes.DEFAULT) - }; - - if (rendition.default) { - rendition.autoselect = true; - } else { - rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT); - } - - if (entry.attributes.LANGUAGE) { - rendition.language = entry.attributes.LANGUAGE; - } - - if (entry.attributes.URI) { - rendition.uri = entry.attributes.URI; - } - - if (entry.attributes['INSTREAM-ID']) { - rendition.instreamId = entry.attributes['INSTREAM-ID']; - } - - if (entry.attributes.CHARACTERISTICS) { - rendition.characteristics = entry.attributes.CHARACTERISTICS; - } - - if (entry.attributes.FORCED) { - rendition.forced = /yes/i.test(entry.attributes.FORCED); - } // insert the new rendition - - - mediaGroup[entry.attributes.NAME] = rendition; - }, - discontinuity: function discontinuity() { - currentTimeline += 1; - currentUri.discontinuity = true; - this.manifest.discontinuityStarts.push(uris.length); - }, - 'program-date-time': function programDateTime() { - if (typeof this.manifest.dateTimeString === 'undefined') { - // PROGRAM-DATE-TIME is a media-segment tag, but for backwards - // compatibility, we add the first occurence of the PROGRAM-DATE-TIME tag - // to the manifest object - // TODO: Consider removing this in future major version - this.manifest.dateTimeString = entry.dateTimeString; - this.manifest.dateTimeObject = entry.dateTimeObject; - } - - currentUri.dateTimeString = entry.dateTimeString; - currentUri.dateTimeObject = entry.dateTimeObject; - }, - targetduration: function targetduration() { - if (!isFinite(entry.duration) || entry.duration < 0) { - this.trigger('warn', { - message: 'ignoring invalid target duration: ' + entry.duration - }); - return; - } - - this.manifest.targetDuration = entry.duration; - setHoldBack.call(this, this.manifest); - }, - start: function start() { - if (!entry.attributes || isNaN(entry.attributes['TIME-OFFSET'])) { - this.trigger('warn', { - message: 'ignoring start declaration without appropriate attribute list' - }); - return; - } - - this.manifest.start = { - timeOffset: entry.attributes['TIME-OFFSET'], - precise: entry.attributes.PRECISE - }; - }, - 'cue-out': function cueOut() { - currentUri.cueOut = entry.data; - }, - 'cue-out-cont': function cueOutCont() { - currentUri.cueOutCont = entry.data; - }, - 'cue-in': function cueIn() { - currentUri.cueIn = entry.data; - }, - 'skip': function skip() { - this.manifest.skip = camelCaseKeys(entry.attributes); - this.warnOnMissingAttributes_('#EXT-X-SKIP', entry.attributes, ['SKIPPED-SEGMENTS']); - }, - 'part': function part() { - var _this2 = this; - - hasParts = true; // parts are always specifed before a segment - - var segmentIndex = this.manifest.segments.length; - var part = camelCaseKeys(entry.attributes); - currentUri.parts = currentUri.parts || []; - currentUri.parts.push(part); - - if (part.byterange) { - if (!part.byterange.hasOwnProperty('offset')) { - part.byterange.offset = lastPartByterangeEnd; - } - - lastPartByterangeEnd = part.byterange.offset + part.byterange.length; - } - - var partIndex = currentUri.parts.length - 1; - this.warnOnMissingAttributes_("#EXT-X-PART #" + partIndex + " for segment #" + segmentIndex, entry.attributes, ['URI', 'DURATION']); - - if (this.manifest.renditionReports) { - this.manifest.renditionReports.forEach(function (r, i) { - if (!r.hasOwnProperty('lastPart')) { - _this2.trigger('warn', { - message: "#EXT-X-RENDITION-REPORT #" + i + " lacks required attribute(s): LAST-PART" - }); - } - }); - } - }, - 'server-control': function serverControl() { - var attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes); - - if (!attrs.hasOwnProperty('canBlockReload')) { - attrs.canBlockReload = false; - this.trigger('info', { - message: '#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false' - }); - } - - setHoldBack.call(this, this.manifest); - - if (attrs.canSkipDateranges && !attrs.hasOwnProperty('canSkipUntil')) { - this.trigger('warn', { - message: '#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set' - }); - } - }, - 'preload-hint': function preloadHint() { - // parts are always specifed before a segment - var segmentIndex = this.manifest.segments.length; - var hint = camelCaseKeys(entry.attributes); - var isPart = hint.type && hint.type === 'PART'; - currentUri.preloadHints = currentUri.preloadHints || []; - currentUri.preloadHints.push(hint); - - if (hint.byterange) { - if (!hint.byterange.hasOwnProperty('offset')) { - // use last part byterange end or zero if not a part. - hint.byterange.offset = isPart ? lastPartByterangeEnd : 0; - - if (isPart) { - lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length; - } - } - } - - var index = currentUri.preloadHints.length - 1; - this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #" + index + " for segment #" + segmentIndex, entry.attributes, ['TYPE', 'URI']); - - if (!hint.type) { - return; - } // search through all preload hints except for the current one for - // a duplicate type. - - - for (var i = 0; i < currentUri.preloadHints.length - 1; i++) { - var otherHint = currentUri.preloadHints[i]; - - if (!otherHint.type) { - continue; - } - - if (otherHint.type === hint.type) { - this.trigger('warn', { - message: "#EXT-X-PRELOAD-HINT #" + index + " for segment #" + segmentIndex + " has the same TYPE " + hint.type + " as preload hint #" + i - }); - } - } - }, - 'rendition-report': function renditionReport() { - var report = camelCaseKeys(entry.attributes); - this.manifest.renditionReports = this.manifest.renditionReports || []; - this.manifest.renditionReports.push(report); - var index = this.manifest.renditionReports.length - 1; - var required = ['LAST-MSN', 'URI']; - - if (hasParts) { - required.push('LAST-PART'); - } - - this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #" + index, entry.attributes, required); - }, - 'part-inf': function partInf() { - this.manifest.partInf = camelCaseKeys(entry.attributes); - this.warnOnMissingAttributes_('#EXT-X-PART-INF', entry.attributes, ['PART-TARGET']); - - if (this.manifest.partInf.partTarget) { - this.manifest.partTargetDuration = this.manifest.partInf.partTarget; - } - - setHoldBack.call(this, this.manifest); - } - })[entry.tagType] || noop).call(self); - }, - uri: function uri() { - currentUri.uri = entry.uri; - uris.push(currentUri); // if no explicit duration was declared, use the target duration - - if (this.manifest.targetDuration && !('duration' in currentUri)) { - this.trigger('warn', { - message: 'defaulting segment duration to the target duration' - }); - currentUri.duration = this.manifest.targetDuration; - } // annotate with encryption information, if necessary - - - if (_key) { - currentUri.key = _key; - } - - currentUri.timeline = currentTimeline; // annotate with initialization segment information, if necessary - - if (currentMap) { - currentUri.map = currentMap; - } // reset the last byterange end as it needs to be 0 between parts - - - lastPartByterangeEnd = 0; // prepare for the next URI - - currentUri = {}; - }, - comment: function comment() {// comments are not important for playback - }, - custom: function custom() { - // if this is segment-level data attach the output to the segment - if (entry.segment) { - currentUri.custom = currentUri.custom || {}; - currentUri.custom[entry.customType] = entry.data; // if this is manifest-level data attach to the top level manifest object - } else { - this.manifest.custom = this.manifest.custom || {}; - this.manifest.custom[entry.customType] = entry.data; - } - } - })[entry.type].call(self); - }); - - return _this; - } - - var _proto = Parser.prototype; - - _proto.warnOnMissingAttributes_ = function warnOnMissingAttributes_(identifier, attributes, required) { - var missing = []; - required.forEach(function (key) { - if (!attributes.hasOwnProperty(key)) { - missing.push(key); - } - }); - - if (missing.length) { - this.trigger('warn', { - message: identifier + " lacks required attribute(s): " + missing.join(', ') - }); - } - } - /** - * Parse the input string and update the manifest object. - * - * @param {string} chunk a potentially incomplete portion of the manifest - */ - ; - - _proto.push = function push(chunk) { - this.lineStream.push(chunk); - } - /** - * Flush any remaining input. This can be handy if the last line of an M3U8 - * manifest did not contain a trailing newline but the file has been - * completely received. - */ - ; - - _proto.end = function end() { - // flush any buffered input - this.lineStream.push('\n'); - this.trigger('end'); - } - /** - * Add an additional parser for non-standard tags - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.type the type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - ; - - _proto.addParser = function addParser(options) { - this.parseStream.addParser(options); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - ; - - _proto.addTagMapper = function addTagMapper(options) { - this.parseStream.addTagMapper(options); - }; - - return Parser; -}(Stream__default['default']); - -exports.LineStream = LineStream; -exports.ParseStream = ParseStream; -exports.Parser = Parser; diff --git a/node_modules/m3u8-parser/dist/m3u8-parser.es.js b/node_modules/m3u8-parser/dist/m3u8-parser.es.js deleted file mode 100644 index 3fd26fb..0000000 --- a/node_modules/m3u8-parser/dist/m3u8-parser.es.js +++ /dev/null @@ -1,1529 +0,0 @@ -/*! @name m3u8-parser @version 4.7.0 @license Apache-2.0 */ -import _inheritsLoose from '@babel/runtime/helpers/inheritsLoose'; -import Stream from '@videojs/vhs-utils/es/stream.js'; -import _extends from '@babel/runtime/helpers/extends'; -import _assertThisInitialized from '@babel/runtime/helpers/assertThisInitialized'; -import decodeB64ToUint8Array from '@videojs/vhs-utils/es/decode-b64-to-uint8-array.js'; - -/** - * A stream that buffers string input and generates a `data` event for each - * line. - * - * @class LineStream - * @extends Stream - */ - -var LineStream = /*#__PURE__*/function (_Stream) { - _inheritsLoose(LineStream, _Stream); - - function LineStream() { - var _this; - - _this = _Stream.call(this) || this; - _this.buffer = ''; - return _this; - } - /** - * Add new data to be parsed. - * - * @param {string} data the text to process - */ - - - var _proto = LineStream.prototype; - - _proto.push = function push(data) { - var nextNewline; - this.buffer += data; - nextNewline = this.buffer.indexOf('\n'); - - for (; nextNewline > -1; nextNewline = this.buffer.indexOf('\n')) { - this.trigger('data', this.buffer.substring(0, nextNewline)); - this.buffer = this.buffer.substring(nextNewline + 1); - } - }; - - return LineStream; -}(Stream); - -var TAB = String.fromCharCode(0x09); - -var parseByterange = function parseByterange(byterangeString) { - // optionally match and capture 0+ digits before `@` - // optionally match and capture 0+ digits after `@` - var match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || ''); - var result = {}; - - if (match[1]) { - result.length = parseInt(match[1], 10); - } - - if (match[2]) { - result.offset = parseInt(match[2], 10); - } - - return result; -}; -/** - * "forgiving" attribute list psuedo-grammar: - * attributes -> keyvalue (',' keyvalue)* - * keyvalue -> key '=' value - * key -> [^=]* - * value -> '"' [^"]* '"' | [^,]* - */ - - -var attributeSeparator = function attributeSeparator() { - var key = '[^=]*'; - var value = '"[^"]*"|[^,]*'; - var keyvalue = '(?:' + key + ')=(?:' + value + ')'; - return new RegExp('(?:^|,)(' + keyvalue + ')'); -}; -/** - * Parse attributes from a line given the separator - * - * @param {string} attributes the attribute line to parse - */ - - -var parseAttributes = function parseAttributes(attributes) { - // split the string using attributes as the separator - var attrs = attributes.split(attributeSeparator()); - var result = {}; - var i = attrs.length; - var attr; - - while (i--) { - // filter out unmatched portions of the string - if (attrs[i] === '') { - continue; - } // split the key and value - - - attr = /([^=]*)=(.*)/.exec(attrs[i]).slice(1); // trim whitespace and remove optional quotes around the value - - attr[0] = attr[0].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^['"](.*)['"]$/g, '$1'); - result[attr[0]] = attr[1]; - } - - return result; -}; -/** - * A line-level M3U8 parser event stream. It expects to receive input one - * line at a time and performs a context-free parse of its contents. A stream - * interpretation of a manifest can be useful if the manifest is expected to - * be too large to fit comfortably into memory or the entirety of the input - * is not immediately available. Otherwise, it's probably much easier to work - * with a regular `Parser` object. - * - * Produces `data` events with an object that captures the parser's - * interpretation of the input. That object has a property `tag` that is one - * of `uri`, `comment`, or `tag`. URIs only have a single additional - * property, `line`, which captures the entirety of the input without - * interpretation. Comments similarly have a single additional property - * `text` which is the input without the leading `#`. - * - * Tags always have a property `tagType` which is the lower-cased version of - * the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance, - * `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized - * tags are given the tag type `unknown` and a single additional property - * `data` with the remainder of the input. - * - * @class ParseStream - * @extends Stream - */ - - -var ParseStream = /*#__PURE__*/function (_Stream) { - _inheritsLoose(ParseStream, _Stream); - - function ParseStream() { - var _this; - - _this = _Stream.call(this) || this; - _this.customParsers = []; - _this.tagMappers = []; - return _this; - } - /** - * Parses an additional line of input. - * - * @param {string} line a single line of an M3U8 file to parse - */ - - - var _proto = ParseStream.prototype; - - _proto.push = function push(line) { - var _this2 = this; - - var match; - var event; // strip whitespace - - line = line.trim(); - - if (line.length === 0) { - // ignore empty lines - return; - } // URIs - - - if (line[0] !== '#') { - this.trigger('data', { - type: 'uri', - uri: line - }); - return; - } // map tags - - - var newLines = this.tagMappers.reduce(function (acc, mapper) { - var mappedLine = mapper(line); // skip if unchanged - - if (mappedLine === line) { - return acc; - } - - return acc.concat([mappedLine]); - }, [line]); - newLines.forEach(function (newLine) { - for (var i = 0; i < _this2.customParsers.length; i++) { - if (_this2.customParsers[i].call(_this2, newLine)) { - return; - } - } // Comments - - - if (newLine.indexOf('#EXT') !== 0) { - _this2.trigger('data', { - type: 'comment', - text: newLine.slice(1) - }); - - return; - } // strip off any carriage returns here so the regex matching - // doesn't have to account for them. - - - newLine = newLine.replace('\r', ''); // Tags - - match = /^#EXTM3U/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'm3u' - }); - - return; - } - - match = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'inf' - }; - - if (match[1]) { - event.duration = parseFloat(match[1]); - } - - if (match[2]) { - event.title = match[2]; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'targetduration' - }; - - if (match[1]) { - event.duration = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'version' - }; - - if (match[1]) { - event.version = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'media-sequence' - }; - - if (match[1]) { - event.number = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'discontinuity-sequence' - }; - - if (match[1]) { - event.number = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'playlist-type' - }; - - if (match[1]) { - event.playlistType = match[1]; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-BYTERANGE:?(.*)?$/.exec(newLine); - - if (match) { - event = _extends(parseByterange(match[1]), { - type: 'tag', - tagType: 'byterange' - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'allow-cache' - }; - - if (match[1]) { - event.allowed = !/NO/.test(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MAP:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'map' - }; - - if (match[1]) { - var attributes = parseAttributes(match[1]); - - if (attributes.URI) { - event.uri = attributes.URI; - } - - if (attributes.BYTERANGE) { - event.byterange = parseByterange(attributes.BYTERANGE); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'stream-inf' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); - - if (event.attributes.RESOLUTION) { - var split = event.attributes.RESOLUTION.split('x'); - var resolution = {}; - - if (split[0]) { - resolution.width = parseInt(split[0], 10); - } - - if (split[1]) { - resolution.height = parseInt(split[1], 10); - } - - event.attributes.RESOLUTION = resolution; - } - - if (event.attributes.BANDWIDTH) { - event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10); - } - - if (event.attributes['PROGRAM-ID']) { - event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MEDIA:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'media' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-ENDLIST/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'endlist' - }); - - return; - } - - match = /^#EXT-X-DISCONTINUITY/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'discontinuity' - }); - - return; - } - - match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'program-date-time' - }; - - if (match[1]) { - event.dateTimeString = match[1]; - event.dateTimeObject = new Date(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-KEY:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'key' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); // parse the IV string into a Uint32Array - - if (event.attributes.IV) { - if (event.attributes.IV.substring(0, 2).toLowerCase() === '0x') { - event.attributes.IV = event.attributes.IV.substring(2); - } - - event.attributes.IV = event.attributes.IV.match(/.{8}/g); - event.attributes.IV[0] = parseInt(event.attributes.IV[0], 16); - event.attributes.IV[1] = parseInt(event.attributes.IV[1], 16); - event.attributes.IV[2] = parseInt(event.attributes.IV[2], 16); - event.attributes.IV[3] = parseInt(event.attributes.IV[3], 16); - event.attributes.IV = new Uint32Array(event.attributes.IV); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-START:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'start' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); - event.attributes['TIME-OFFSET'] = parseFloat(event.attributes['TIME-OFFSET']); - event.attributes.PRECISE = /YES/.test(event.attributes.PRECISE); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-out-cont' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-out' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-in' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-SKIP:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'skip' - }; - event.attributes = parseAttributes(match[1]); - - if (event.attributes.hasOwnProperty('SKIPPED-SEGMENTS')) { - event.attributes['SKIPPED-SEGMENTS'] = parseInt(event.attributes['SKIPPED-SEGMENTS'], 10); - } - - if (event.attributes.hasOwnProperty('RECENTLY-REMOVED-DATERANGES')) { - event.attributes['RECENTLY-REMOVED-DATERANGES'] = event.attributes['RECENTLY-REMOVED-DATERANGES'].split(TAB); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PART:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part' - }; - event.attributes = parseAttributes(match[1]); - ['DURATION'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - ['INDEPENDENT', 'GAP'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = /YES/.test(event.attributes[key]); - } - }); - - if (event.attributes.hasOwnProperty('BYTERANGE')) { - event.attributes.byterange = parseByterange(event.attributes.BYTERANGE); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'server-control' - }; - event.attributes = parseAttributes(match[1]); - ['CAN-SKIP-UNTIL', 'PART-HOLD-BACK', 'HOLD-BACK'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - ['CAN-SKIP-DATERANGES', 'CAN-BLOCK-RELOAD'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = /YES/.test(event.attributes[key]); - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part-inf' - }; - event.attributes = parseAttributes(match[1]); - ['PART-TARGET'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'preload-hint' - }; - event.attributes = parseAttributes(match[1]); - ['BYTERANGE-START', 'BYTERANGE-LENGTH'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - var subkey = key === 'BYTERANGE-LENGTH' ? 'length' : 'offset'; - event.attributes.byterange = event.attributes.byterange || {}; - event.attributes.byterange[subkey] = event.attributes[key]; // only keep the parsed byterange object. - - delete event.attributes[key]; - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'rendition-report' - }; - event.attributes = parseAttributes(match[1]); - ['LAST-MSN', 'LAST-PART'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - } - }); - - _this2.trigger('data', event); - - return; - } // unknown tag type - - - _this2.trigger('data', { - type: 'tag', - data: newLine.slice(4) - }); - }); - } - /** - * Add a parser for custom headers - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.customType the custom type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - ; - - _proto.addParser = function addParser(_ref) { - var _this3 = this; - - var expression = _ref.expression, - customType = _ref.customType, - dataParser = _ref.dataParser, - segment = _ref.segment; - - if (typeof dataParser !== 'function') { - dataParser = function dataParser(line) { - return line; - }; - } - - this.customParsers.push(function (line) { - var match = expression.exec(line); - - if (match) { - _this3.trigger('data', { - type: 'custom', - data: dataParser(line), - customType: customType, - segment: segment - }); - - return true; - } - }); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - ; - - _proto.addTagMapper = function addTagMapper(_ref2) { - var expression = _ref2.expression, - map = _ref2.map; - - var mapFn = function mapFn(line) { - if (expression.test(line)) { - return map(line); - } - - return line; - }; - - this.tagMappers.push(mapFn); - }; - - return ParseStream; -}(Stream); - -var camelCase = function camelCase(str) { - return str.toLowerCase().replace(/-(\w)/g, function (a) { - return a[1].toUpperCase(); - }); -}; - -var camelCaseKeys = function camelCaseKeys(attributes) { - var result = {}; - Object.keys(attributes).forEach(function (key) { - result[camelCase(key)] = attributes[key]; - }); - return result; -}; // set SERVER-CONTROL hold back based upon targetDuration and partTargetDuration -// we need this helper because defaults are based upon targetDuration and -// partTargetDuration being set, but they may not be if SERVER-CONTROL appears before -// target durations are set. - - -var setHoldBack = function setHoldBack(manifest) { - var serverControl = manifest.serverControl, - targetDuration = manifest.targetDuration, - partTargetDuration = manifest.partTargetDuration; - - if (!serverControl) { - return; - } - - var tag = '#EXT-X-SERVER-CONTROL'; - var hb = 'holdBack'; - var phb = 'partHoldBack'; - var minTargetDuration = targetDuration && targetDuration * 3; - var minPartDuration = partTargetDuration && partTargetDuration * 2; - - if (targetDuration && !serverControl.hasOwnProperty(hb)) { - serverControl[hb] = minTargetDuration; - this.trigger('info', { - message: tag + " defaulting HOLD-BACK to targetDuration * 3 (" + minTargetDuration + ")." - }); - } - - if (minTargetDuration && serverControl[hb] < minTargetDuration) { - this.trigger('warn', { - message: tag + " clamping HOLD-BACK (" + serverControl[hb] + ") to targetDuration * 3 (" + minTargetDuration + ")" - }); - serverControl[hb] = minTargetDuration; - } // default no part hold back to part target duration * 3 - - - if (partTargetDuration && !serverControl.hasOwnProperty(phb)) { - serverControl[phb] = partTargetDuration * 3; - this.trigger('info', { - message: tag + " defaulting PART-HOLD-BACK to partTargetDuration * 3 (" + serverControl[phb] + ")." - }); - } // if part hold back is too small default it to part target duration * 2 - - - if (partTargetDuration && serverControl[phb] < minPartDuration) { - this.trigger('warn', { - message: tag + " clamping PART-HOLD-BACK (" + serverControl[phb] + ") to partTargetDuration * 2 (" + minPartDuration + ")." - }); - serverControl[phb] = minPartDuration; - } -}; -/** - * A parser for M3U8 files. The current interpretation of the input is - * exposed as a property `manifest` on parser objects. It's just two lines to - * create and parse a manifest once you have the contents available as a string: - * - * ```js - * var parser = new m3u8.Parser(); - * parser.push(xhr.responseText); - * ``` - * - * New input can later be applied to update the manifest object by calling - * `push` again. - * - * The parser attempts to create a usable manifest object even if the - * underlying input is somewhat nonsensical. It emits `info` and `warning` - * events during the parse if it encounters input that seems invalid or - * requires some property of the manifest object to be defaulted. - * - * @class Parser - * @extends Stream - */ - - -var Parser = /*#__PURE__*/function (_Stream) { - _inheritsLoose(Parser, _Stream); - - function Parser() { - var _this; - - _this = _Stream.call(this) || this; - _this.lineStream = new LineStream(); - _this.parseStream = new ParseStream(); - - _this.lineStream.pipe(_this.parseStream); - /* eslint-disable consistent-this */ - - - var self = _assertThisInitialized(_this); - /* eslint-enable consistent-this */ - - - var uris = []; - var currentUri = {}; // if specified, the active EXT-X-MAP definition - - var currentMap; // if specified, the active decryption key - - var _key; - - var hasParts = false; - - var noop = function noop() {}; - - var defaultMediaGroups = { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }; // This is the Widevine UUID from DASH IF IOP. The same exact string is - // used in MPDs with Widevine encrypted streams. - - var widevineUuid = 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'; // group segments into numbered timelines delineated by discontinuities - - var currentTimeline = 0; // the manifest is empty until the parse stream begins delivering data - - _this.manifest = { - allowCache: true, - discontinuityStarts: [], - segments: [] - }; // keep track of the last seen segment's byte range end, as segments are not required - // to provide the offset, in which case it defaults to the next byte after the - // previous segment - - var lastByterangeEnd = 0; // keep track of the last seen part's byte range end. - - var lastPartByterangeEnd = 0; - - _this.on('end', function () { - // only add preloadSegment if we don't yet have a uri for it. - // and we actually have parts/preloadHints - if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) { - return; - } - - if (!currentUri.map && currentMap) { - currentUri.map = currentMap; - } - - if (!currentUri.key && _key) { - currentUri.key = _key; - } - - if (!currentUri.timeline && typeof currentTimeline === 'number') { - currentUri.timeline = currentTimeline; - } - - _this.manifest.preloadSegment = currentUri; - }); // update the manifest with the m3u8 entry from the parse stream - - - _this.parseStream.on('data', function (entry) { - var mediaGroup; - var rendition; - ({ - tag: function tag() { - // switch based on the tag type - (({ - version: function version() { - if (entry.version) { - this.manifest.version = entry.version; - } - }, - 'allow-cache': function allowCache() { - this.manifest.allowCache = entry.allowed; - - if (!('allowed' in entry)) { - this.trigger('info', { - message: 'defaulting allowCache to YES' - }); - this.manifest.allowCache = true; - } - }, - byterange: function byterange() { - var byterange = {}; - - if ('length' in entry) { - currentUri.byterange = byterange; - byterange.length = entry.length; - - if (!('offset' in entry)) { - /* - * From the latest spec (as of this writing): - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.2 - * - * Same text since EXT-X-BYTERANGE's introduction in draft 7: - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-07#section-3.3.1) - * - * "If o [offset] is not present, the sub-range begins at the next byte - * following the sub-range of the previous media segment." - */ - entry.offset = lastByterangeEnd; - } - } - - if ('offset' in entry) { - currentUri.byterange = byterange; - byterange.offset = entry.offset; - } - - lastByterangeEnd = byterange.offset + byterange.length; - }, - endlist: function endlist() { - this.manifest.endList = true; - }, - inf: function inf() { - if (!('mediaSequence' in this.manifest)) { - this.manifest.mediaSequence = 0; - this.trigger('info', { - message: 'defaulting media sequence to zero' - }); - } - - if (!('discontinuitySequence' in this.manifest)) { - this.manifest.discontinuitySequence = 0; - this.trigger('info', { - message: 'defaulting discontinuity sequence to zero' - }); - } - - if (entry.duration > 0) { - currentUri.duration = entry.duration; - } - - if (entry.duration === 0) { - currentUri.duration = 0.01; - this.trigger('info', { - message: 'updating zero segment duration to a small value' - }); - } - - this.manifest.segments = uris; - }, - key: function key() { - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring key declaration without attribute list' - }); - return; - } // clear the active encryption key - - - if (entry.attributes.METHOD === 'NONE') { - _key = null; - return; - } - - if (!entry.attributes.URI) { - this.trigger('warn', { - message: 'ignoring key declaration without URI' - }); - return; - } - - if (entry.attributes.KEYFORMAT === 'com.apple.streamingkeydelivery') { - this.manifest.contentProtection = this.manifest.contentProtection || {}; // TODO: add full support for this. - - this.manifest.contentProtection['com.apple.fps.1_0'] = { - attributes: entry.attributes - }; - return; - } // check if the content is encrypted for Widevine - // Widevine/HLS spec: https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf - - - if (entry.attributes.KEYFORMAT === widevineUuid) { - var VALID_METHODS = ['SAMPLE-AES', 'SAMPLE-AES-CTR', 'SAMPLE-AES-CENC']; - - if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) { - this.trigger('warn', { - message: 'invalid key method provided for Widevine' - }); - return; - } - - if (entry.attributes.METHOD === 'SAMPLE-AES-CENC') { - this.trigger('warn', { - message: 'SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead' - }); - } - - if (entry.attributes.URI.substring(0, 23) !== 'data:text/plain;base64,') { - this.trigger('warn', { - message: 'invalid key URI provided for Widevine' - }); - return; - } - - if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === '0x')) { - this.trigger('warn', { - message: 'invalid key ID provided for Widevine' - }); - return; - } // if Widevine key attributes are valid, store them as `contentProtection` - // on the manifest to emulate Widevine tag structure in a DASH mpd - - - this.manifest.contentProtection = this.manifest.contentProtection || {}; - this.manifest.contentProtection['com.widevine.alpha'] = { - attributes: { - schemeIdUri: entry.attributes.KEYFORMAT, - // remove '0x' from the key id string - keyId: entry.attributes.KEYID.substring(2) - }, - // decode the base64-encoded PSSH box - pssh: decodeB64ToUint8Array(entry.attributes.URI.split(',')[1]) - }; - return; - } - - if (!entry.attributes.METHOD) { - this.trigger('warn', { - message: 'defaulting key method to AES-128' - }); - } // setup an encryption key for upcoming segments - - - _key = { - method: entry.attributes.METHOD || 'AES-128', - uri: entry.attributes.URI - }; - - if (typeof entry.attributes.IV !== 'undefined') { - _key.iv = entry.attributes.IV; - } - }, - 'media-sequence': function mediaSequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid media sequence: ' + entry.number - }); - return; - } - - this.manifest.mediaSequence = entry.number; - }, - 'discontinuity-sequence': function discontinuitySequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid discontinuity sequence: ' + entry.number - }); - return; - } - - this.manifest.discontinuitySequence = entry.number; - currentTimeline = entry.number; - }, - 'playlist-type': function playlistType() { - if (!/VOD|EVENT/.test(entry.playlistType)) { - this.trigger('warn', { - message: 'ignoring unknown playlist type: ' + entry.playlist - }); - return; - } - - this.manifest.playlistType = entry.playlistType; - }, - map: function map() { - currentMap = {}; - - if (entry.uri) { - currentMap.uri = entry.uri; - } - - if (entry.byterange) { - currentMap.byterange = entry.byterange; - } - - if (_key) { - currentMap.key = _key; - } - }, - 'stream-inf': function streamInf() { - this.manifest.playlists = uris; - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring empty stream-inf attributes' - }); - return; - } - - if (!currentUri.attributes) { - currentUri.attributes = {}; - } - - _extends(currentUri.attributes, entry.attributes); - }, - media: function media() { - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!(entry.attributes && entry.attributes.TYPE && entry.attributes['GROUP-ID'] && entry.attributes.NAME)) { - this.trigger('warn', { - message: 'ignoring incomplete or missing media group' - }); - return; - } // find the media group, creating defaults as necessary - - - var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE]; - mediaGroupType[entry.attributes['GROUP-ID']] = mediaGroupType[entry.attributes['GROUP-ID']] || {}; - mediaGroup = mediaGroupType[entry.attributes['GROUP-ID']]; // collect the rendition metadata - - rendition = { - default: /yes/i.test(entry.attributes.DEFAULT) - }; - - if (rendition.default) { - rendition.autoselect = true; - } else { - rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT); - } - - if (entry.attributes.LANGUAGE) { - rendition.language = entry.attributes.LANGUAGE; - } - - if (entry.attributes.URI) { - rendition.uri = entry.attributes.URI; - } - - if (entry.attributes['INSTREAM-ID']) { - rendition.instreamId = entry.attributes['INSTREAM-ID']; - } - - if (entry.attributes.CHARACTERISTICS) { - rendition.characteristics = entry.attributes.CHARACTERISTICS; - } - - if (entry.attributes.FORCED) { - rendition.forced = /yes/i.test(entry.attributes.FORCED); - } // insert the new rendition - - - mediaGroup[entry.attributes.NAME] = rendition; - }, - discontinuity: function discontinuity() { - currentTimeline += 1; - currentUri.discontinuity = true; - this.manifest.discontinuityStarts.push(uris.length); - }, - 'program-date-time': function programDateTime() { - if (typeof this.manifest.dateTimeString === 'undefined') { - // PROGRAM-DATE-TIME is a media-segment tag, but for backwards - // compatibility, we add the first occurence of the PROGRAM-DATE-TIME tag - // to the manifest object - // TODO: Consider removing this in future major version - this.manifest.dateTimeString = entry.dateTimeString; - this.manifest.dateTimeObject = entry.dateTimeObject; - } - - currentUri.dateTimeString = entry.dateTimeString; - currentUri.dateTimeObject = entry.dateTimeObject; - }, - targetduration: function targetduration() { - if (!isFinite(entry.duration) || entry.duration < 0) { - this.trigger('warn', { - message: 'ignoring invalid target duration: ' + entry.duration - }); - return; - } - - this.manifest.targetDuration = entry.duration; - setHoldBack.call(this, this.manifest); - }, - start: function start() { - if (!entry.attributes || isNaN(entry.attributes['TIME-OFFSET'])) { - this.trigger('warn', { - message: 'ignoring start declaration without appropriate attribute list' - }); - return; - } - - this.manifest.start = { - timeOffset: entry.attributes['TIME-OFFSET'], - precise: entry.attributes.PRECISE - }; - }, - 'cue-out': function cueOut() { - currentUri.cueOut = entry.data; - }, - 'cue-out-cont': function cueOutCont() { - currentUri.cueOutCont = entry.data; - }, - 'cue-in': function cueIn() { - currentUri.cueIn = entry.data; - }, - 'skip': function skip() { - this.manifest.skip = camelCaseKeys(entry.attributes); - this.warnOnMissingAttributes_('#EXT-X-SKIP', entry.attributes, ['SKIPPED-SEGMENTS']); - }, - 'part': function part() { - var _this2 = this; - - hasParts = true; // parts are always specifed before a segment - - var segmentIndex = this.manifest.segments.length; - var part = camelCaseKeys(entry.attributes); - currentUri.parts = currentUri.parts || []; - currentUri.parts.push(part); - - if (part.byterange) { - if (!part.byterange.hasOwnProperty('offset')) { - part.byterange.offset = lastPartByterangeEnd; - } - - lastPartByterangeEnd = part.byterange.offset + part.byterange.length; - } - - var partIndex = currentUri.parts.length - 1; - this.warnOnMissingAttributes_("#EXT-X-PART #" + partIndex + " for segment #" + segmentIndex, entry.attributes, ['URI', 'DURATION']); - - if (this.manifest.renditionReports) { - this.manifest.renditionReports.forEach(function (r, i) { - if (!r.hasOwnProperty('lastPart')) { - _this2.trigger('warn', { - message: "#EXT-X-RENDITION-REPORT #" + i + " lacks required attribute(s): LAST-PART" - }); - } - }); - } - }, - 'server-control': function serverControl() { - var attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes); - - if (!attrs.hasOwnProperty('canBlockReload')) { - attrs.canBlockReload = false; - this.trigger('info', { - message: '#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false' - }); - } - - setHoldBack.call(this, this.manifest); - - if (attrs.canSkipDateranges && !attrs.hasOwnProperty('canSkipUntil')) { - this.trigger('warn', { - message: '#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set' - }); - } - }, - 'preload-hint': function preloadHint() { - // parts are always specifed before a segment - var segmentIndex = this.manifest.segments.length; - var hint = camelCaseKeys(entry.attributes); - var isPart = hint.type && hint.type === 'PART'; - currentUri.preloadHints = currentUri.preloadHints || []; - currentUri.preloadHints.push(hint); - - if (hint.byterange) { - if (!hint.byterange.hasOwnProperty('offset')) { - // use last part byterange end or zero if not a part. - hint.byterange.offset = isPart ? lastPartByterangeEnd : 0; - - if (isPart) { - lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length; - } - } - } - - var index = currentUri.preloadHints.length - 1; - this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #" + index + " for segment #" + segmentIndex, entry.attributes, ['TYPE', 'URI']); - - if (!hint.type) { - return; - } // search through all preload hints except for the current one for - // a duplicate type. - - - for (var i = 0; i < currentUri.preloadHints.length - 1; i++) { - var otherHint = currentUri.preloadHints[i]; - - if (!otherHint.type) { - continue; - } - - if (otherHint.type === hint.type) { - this.trigger('warn', { - message: "#EXT-X-PRELOAD-HINT #" + index + " for segment #" + segmentIndex + " has the same TYPE " + hint.type + " as preload hint #" + i - }); - } - } - }, - 'rendition-report': function renditionReport() { - var report = camelCaseKeys(entry.attributes); - this.manifest.renditionReports = this.manifest.renditionReports || []; - this.manifest.renditionReports.push(report); - var index = this.manifest.renditionReports.length - 1; - var required = ['LAST-MSN', 'URI']; - - if (hasParts) { - required.push('LAST-PART'); - } - - this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #" + index, entry.attributes, required); - }, - 'part-inf': function partInf() { - this.manifest.partInf = camelCaseKeys(entry.attributes); - this.warnOnMissingAttributes_('#EXT-X-PART-INF', entry.attributes, ['PART-TARGET']); - - if (this.manifest.partInf.partTarget) { - this.manifest.partTargetDuration = this.manifest.partInf.partTarget; - } - - setHoldBack.call(this, this.manifest); - } - })[entry.tagType] || noop).call(self); - }, - uri: function uri() { - currentUri.uri = entry.uri; - uris.push(currentUri); // if no explicit duration was declared, use the target duration - - if (this.manifest.targetDuration && !('duration' in currentUri)) { - this.trigger('warn', { - message: 'defaulting segment duration to the target duration' - }); - currentUri.duration = this.manifest.targetDuration; - } // annotate with encryption information, if necessary - - - if (_key) { - currentUri.key = _key; - } - - currentUri.timeline = currentTimeline; // annotate with initialization segment information, if necessary - - if (currentMap) { - currentUri.map = currentMap; - } // reset the last byterange end as it needs to be 0 between parts - - - lastPartByterangeEnd = 0; // prepare for the next URI - - currentUri = {}; - }, - comment: function comment() {// comments are not important for playback - }, - custom: function custom() { - // if this is segment-level data attach the output to the segment - if (entry.segment) { - currentUri.custom = currentUri.custom || {}; - currentUri.custom[entry.customType] = entry.data; // if this is manifest-level data attach to the top level manifest object - } else { - this.manifest.custom = this.manifest.custom || {}; - this.manifest.custom[entry.customType] = entry.data; - } - } - })[entry.type].call(self); - }); - - return _this; - } - - var _proto = Parser.prototype; - - _proto.warnOnMissingAttributes_ = function warnOnMissingAttributes_(identifier, attributes, required) { - var missing = []; - required.forEach(function (key) { - if (!attributes.hasOwnProperty(key)) { - missing.push(key); - } - }); - - if (missing.length) { - this.trigger('warn', { - message: identifier + " lacks required attribute(s): " + missing.join(', ') - }); - } - } - /** - * Parse the input string and update the manifest object. - * - * @param {string} chunk a potentially incomplete portion of the manifest - */ - ; - - _proto.push = function push(chunk) { - this.lineStream.push(chunk); - } - /** - * Flush any remaining input. This can be handy if the last line of an M3U8 - * manifest did not contain a trailing newline but the file has been - * completely received. - */ - ; - - _proto.end = function end() { - // flush any buffered input - this.lineStream.push('\n'); - this.trigger('end'); - } - /** - * Add an additional parser for non-standard tags - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.type the type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - ; - - _proto.addParser = function addParser(options) { - this.parseStream.addParser(options); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - ; - - _proto.addTagMapper = function addTagMapper(options) { - this.parseStream.addTagMapper(options); - }; - - return Parser; -}(Stream); - -export { LineStream, ParseStream, Parser }; diff --git a/node_modules/m3u8-parser/dist/m3u8-parser.js b/node_modules/m3u8-parser/dist/m3u8-parser.js deleted file mode 100644 index 89f523c..0000000 --- a/node_modules/m3u8-parser/dist/m3u8-parser.js +++ /dev/null @@ -1,1728 +0,0 @@ -/*! @name m3u8-parser @version 4.7.0 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('global/window')) : - typeof define === 'function' && define.amd ? define(['exports', 'global/window'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.m3u8Parser = {}, global.window)); -}(this, (function (exports, window) { 'use strict'; - - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - - var window__default = /*#__PURE__*/_interopDefaultLegacy(window); - - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; - } - - var inheritsLoose = _inheritsLoose; - - /** - * @file stream.js - */ - - /** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ - var Stream = /*#__PURE__*/function () { - function Stream() { - this.listeners = {}; - } - /** - * Add a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - var _proto = Stream.prototype; - - _proto.on = function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - - this.listeners[type].push(listener); - } - /** - * Remove a listener for a specified event type. - * - * @param {string} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {boolean} if we could turn it off or not - */ - ; - - _proto.off = function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); // TODO: which is better? - // In Video.js we slice listener functions - // on trigger so that it does not mess up the order - // while we loop through. - // - // Here we slice on off so that the loop in trigger - // can continue using it's old reference to loop without - // messing up the order. - - this.listeners[type] = this.listeners[type].slice(0); - this.listeners[type].splice(index, 1); - return index > -1; - } - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {string} type the event name - */ - ; - - _proto.trigger = function trigger(type) { - var callbacks = this.listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - var length = callbacks.length; - - for (var i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - var _length = callbacks.length; - - for (var _i = 0; _i < _length; ++_i) { - callbacks[_i].apply(this, args); - } - } - } - /** - * Destroys the stream and cleans up. - */ - ; - - _proto.dispose = function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - ; - - _proto.pipe = function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - }; - - return Stream; - }(); - - /** - * A stream that buffers string input and generates a `data` event for each - * line. - * - * @class LineStream - * @extends Stream - */ - - var LineStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(LineStream, _Stream); - - function LineStream() { - var _this; - - _this = _Stream.call(this) || this; - _this.buffer = ''; - return _this; - } - /** - * Add new data to be parsed. - * - * @param {string} data the text to process - */ - - - var _proto = LineStream.prototype; - - _proto.push = function push(data) { - var nextNewline; - this.buffer += data; - nextNewline = this.buffer.indexOf('\n'); - - for (; nextNewline > -1; nextNewline = this.buffer.indexOf('\n')) { - this.trigger('data', this.buffer.substring(0, nextNewline)); - this.buffer = this.buffer.substring(nextNewline + 1); - } - }; - - return LineStream; - }(Stream); - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function (path, base) { - return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var _extends_1 = createCommonjsModule(function (module) { - function _extends() { - module.exports = _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - return _extends.apply(this, arguments); - } - - module.exports = _extends; - }); - - var TAB = String.fromCharCode(0x09); - - var parseByterange = function parseByterange(byterangeString) { - // optionally match and capture 0+ digits before `@` - // optionally match and capture 0+ digits after `@` - var match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || ''); - var result = {}; - - if (match[1]) { - result.length = parseInt(match[1], 10); - } - - if (match[2]) { - result.offset = parseInt(match[2], 10); - } - - return result; - }; - /** - * "forgiving" attribute list psuedo-grammar: - * attributes -> keyvalue (',' keyvalue)* - * keyvalue -> key '=' value - * key -> [^=]* - * value -> '"' [^"]* '"' | [^,]* - */ - - - var attributeSeparator = function attributeSeparator() { - var key = '[^=]*'; - var value = '"[^"]*"|[^,]*'; - var keyvalue = '(?:' + key + ')=(?:' + value + ')'; - return new RegExp('(?:^|,)(' + keyvalue + ')'); - }; - /** - * Parse attributes from a line given the separator - * - * @param {string} attributes the attribute line to parse - */ - - - var parseAttributes = function parseAttributes(attributes) { - // split the string using attributes as the separator - var attrs = attributes.split(attributeSeparator()); - var result = {}; - var i = attrs.length; - var attr; - - while (i--) { - // filter out unmatched portions of the string - if (attrs[i] === '') { - continue; - } // split the key and value - - - attr = /([^=]*)=(.*)/.exec(attrs[i]).slice(1); // trim whitespace and remove optional quotes around the value - - attr[0] = attr[0].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^['"](.*)['"]$/g, '$1'); - result[attr[0]] = attr[1]; - } - - return result; - }; - /** - * A line-level M3U8 parser event stream. It expects to receive input one - * line at a time and performs a context-free parse of its contents. A stream - * interpretation of a manifest can be useful if the manifest is expected to - * be too large to fit comfortably into memory or the entirety of the input - * is not immediately available. Otherwise, it's probably much easier to work - * with a regular `Parser` object. - * - * Produces `data` events with an object that captures the parser's - * interpretation of the input. That object has a property `tag` that is one - * of `uri`, `comment`, or `tag`. URIs only have a single additional - * property, `line`, which captures the entirety of the input without - * interpretation. Comments similarly have a single additional property - * `text` which is the input without the leading `#`. - * - * Tags always have a property `tagType` which is the lower-cased version of - * the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance, - * `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized - * tags are given the tag type `unknown` and a single additional property - * `data` with the remainder of the input. - * - * @class ParseStream - * @extends Stream - */ - - - var ParseStream = /*#__PURE__*/function (_Stream) { - inheritsLoose(ParseStream, _Stream); - - function ParseStream() { - var _this; - - _this = _Stream.call(this) || this; - _this.customParsers = []; - _this.tagMappers = []; - return _this; - } - /** - * Parses an additional line of input. - * - * @param {string} line a single line of an M3U8 file to parse - */ - - - var _proto = ParseStream.prototype; - - _proto.push = function push(line) { - var _this2 = this; - - var match; - var event; // strip whitespace - - line = line.trim(); - - if (line.length === 0) { - // ignore empty lines - return; - } // URIs - - - if (line[0] !== '#') { - this.trigger('data', { - type: 'uri', - uri: line - }); - return; - } // map tags - - - var newLines = this.tagMappers.reduce(function (acc, mapper) { - var mappedLine = mapper(line); // skip if unchanged - - if (mappedLine === line) { - return acc; - } - - return acc.concat([mappedLine]); - }, [line]); - newLines.forEach(function (newLine) { - for (var i = 0; i < _this2.customParsers.length; i++) { - if (_this2.customParsers[i].call(_this2, newLine)) { - return; - } - } // Comments - - - if (newLine.indexOf('#EXT') !== 0) { - _this2.trigger('data', { - type: 'comment', - text: newLine.slice(1) - }); - - return; - } // strip off any carriage returns here so the regex matching - // doesn't have to account for them. - - - newLine = newLine.replace('\r', ''); // Tags - - match = /^#EXTM3U/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'm3u' - }); - - return; - } - - match = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'inf' - }; - - if (match[1]) { - event.duration = parseFloat(match[1]); - } - - if (match[2]) { - event.title = match[2]; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'targetduration' - }; - - if (match[1]) { - event.duration = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'version' - }; - - if (match[1]) { - event.version = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'media-sequence' - }; - - if (match[1]) { - event.number = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'discontinuity-sequence' - }; - - if (match[1]) { - event.number = parseInt(match[1], 10); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'playlist-type' - }; - - if (match[1]) { - event.playlistType = match[1]; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-BYTERANGE:?(.*)?$/.exec(newLine); - - if (match) { - event = _extends_1(parseByterange(match[1]), { - type: 'tag', - tagType: 'byterange' - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'allow-cache' - }; - - if (match[1]) { - event.allowed = !/NO/.test(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MAP:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'map' - }; - - if (match[1]) { - var attributes = parseAttributes(match[1]); - - if (attributes.URI) { - event.uri = attributes.URI; - } - - if (attributes.BYTERANGE) { - event.byterange = parseByterange(attributes.BYTERANGE); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'stream-inf' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); - - if (event.attributes.RESOLUTION) { - var split = event.attributes.RESOLUTION.split('x'); - var resolution = {}; - - if (split[0]) { - resolution.width = parseInt(split[0], 10); - } - - if (split[1]) { - resolution.height = parseInt(split[1], 10); - } - - event.attributes.RESOLUTION = resolution; - } - - if (event.attributes.BANDWIDTH) { - event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10); - } - - if (event.attributes['PROGRAM-ID']) { - event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-MEDIA:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'media' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-ENDLIST/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'endlist' - }); - - return; - } - - match = /^#EXT-X-DISCONTINUITY/.exec(newLine); - - if (match) { - _this2.trigger('data', { - type: 'tag', - tagType: 'discontinuity' - }); - - return; - } - - match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'program-date-time' - }; - - if (match[1]) { - event.dateTimeString = match[1]; - event.dateTimeObject = new Date(match[1]); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-KEY:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'key' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); // parse the IV string into a Uint32Array - - if (event.attributes.IV) { - if (event.attributes.IV.substring(0, 2).toLowerCase() === '0x') { - event.attributes.IV = event.attributes.IV.substring(2); - } - - event.attributes.IV = event.attributes.IV.match(/.{8}/g); - event.attributes.IV[0] = parseInt(event.attributes.IV[0], 16); - event.attributes.IV[1] = parseInt(event.attributes.IV[1], 16); - event.attributes.IV[2] = parseInt(event.attributes.IV[2], 16); - event.attributes.IV[3] = parseInt(event.attributes.IV[3], 16); - event.attributes.IV = new Uint32Array(event.attributes.IV); - } - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-START:?(.*)$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'start' - }; - - if (match[1]) { - event.attributes = parseAttributes(match[1]); - event.attributes['TIME-OFFSET'] = parseFloat(event.attributes['TIME-OFFSET']); - event.attributes.PRECISE = /YES/.test(event.attributes.PRECISE); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-out-cont' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-out' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(newLine); - - if (match) { - event = { - type: 'tag', - tagType: 'cue-in' - }; - - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-SKIP:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'skip' - }; - event.attributes = parseAttributes(match[1]); - - if (event.attributes.hasOwnProperty('SKIPPED-SEGMENTS')) { - event.attributes['SKIPPED-SEGMENTS'] = parseInt(event.attributes['SKIPPED-SEGMENTS'], 10); - } - - if (event.attributes.hasOwnProperty('RECENTLY-REMOVED-DATERANGES')) { - event.attributes['RECENTLY-REMOVED-DATERANGES'] = event.attributes['RECENTLY-REMOVED-DATERANGES'].split(TAB); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PART:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part' - }; - event.attributes = parseAttributes(match[1]); - ['DURATION'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - ['INDEPENDENT', 'GAP'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = /YES/.test(event.attributes[key]); - } - }); - - if (event.attributes.hasOwnProperty('BYTERANGE')) { - event.attributes.byterange = parseByterange(event.attributes.BYTERANGE); - } - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'server-control' - }; - event.attributes = parseAttributes(match[1]); - ['CAN-SKIP-UNTIL', 'PART-HOLD-BACK', 'HOLD-BACK'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - ['CAN-SKIP-DATERANGES', 'CAN-BLOCK-RELOAD'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = /YES/.test(event.attributes[key]); - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part-inf' - }; - event.attributes = parseAttributes(match[1]); - ['PART-TARGET'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'preload-hint' - }; - event.attributes = parseAttributes(match[1]); - ['BYTERANGE-START', 'BYTERANGE-LENGTH'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - var subkey = key === 'BYTERANGE-LENGTH' ? 'length' : 'offset'; - event.attributes.byterange = event.attributes.byterange || {}; - event.attributes.byterange[subkey] = event.attributes[key]; // only keep the parsed byterange object. - - delete event.attributes[key]; - } - }); - - _this2.trigger('data', event); - - return; - } - - match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine); - - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'rendition-report' - }; - event.attributes = parseAttributes(match[1]); - ['LAST-MSN', 'LAST-PART'].forEach(function (key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - } - }); - - _this2.trigger('data', event); - - return; - } // unknown tag type - - - _this2.trigger('data', { - type: 'tag', - data: newLine.slice(4) - }); - }); - } - /** - * Add a parser for custom headers - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.customType the custom type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - ; - - _proto.addParser = function addParser(_ref) { - var _this3 = this; - - var expression = _ref.expression, - customType = _ref.customType, - dataParser = _ref.dataParser, - segment = _ref.segment; - - if (typeof dataParser !== 'function') { - dataParser = function dataParser(line) { - return line; - }; - } - - this.customParsers.push(function (line) { - var match = expression.exec(line); - - if (match) { - _this3.trigger('data', { - type: 'custom', - data: dataParser(line), - customType: customType, - segment: segment - }); - - return true; - } - }); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - ; - - _proto.addTagMapper = function addTagMapper(_ref2) { - var expression = _ref2.expression, - map = _ref2.map; - - var mapFn = function mapFn(line) { - if (expression.test(line)) { - return map(line); - } - - return line; - }; - - this.tagMappers.push(mapFn); - }; - - return ParseStream; - }(Stream); - - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; - } - - var assertThisInitialized = _assertThisInitialized; - - var atob = function atob(s) { - return window__default['default'].atob ? window__default['default'].atob(s) : Buffer.from(s, 'base64').toString('binary'); - }; - - function decodeB64ToUint8Array(b64Text) { - var decodedString = atob(b64Text); - var array = new Uint8Array(decodedString.length); - - for (var i = 0; i < decodedString.length; i++) { - array[i] = decodedString.charCodeAt(i); - } - - return array; - } - - var camelCase = function camelCase(str) { - return str.toLowerCase().replace(/-(\w)/g, function (a) { - return a[1].toUpperCase(); - }); - }; - - var camelCaseKeys = function camelCaseKeys(attributes) { - var result = {}; - Object.keys(attributes).forEach(function (key) { - result[camelCase(key)] = attributes[key]; - }); - return result; - }; // set SERVER-CONTROL hold back based upon targetDuration and partTargetDuration - // we need this helper because defaults are based upon targetDuration and - // partTargetDuration being set, but they may not be if SERVER-CONTROL appears before - // target durations are set. - - - var setHoldBack = function setHoldBack(manifest) { - var serverControl = manifest.serverControl, - targetDuration = manifest.targetDuration, - partTargetDuration = manifest.partTargetDuration; - - if (!serverControl) { - return; - } - - var tag = '#EXT-X-SERVER-CONTROL'; - var hb = 'holdBack'; - var phb = 'partHoldBack'; - var minTargetDuration = targetDuration && targetDuration * 3; - var minPartDuration = partTargetDuration && partTargetDuration * 2; - - if (targetDuration && !serverControl.hasOwnProperty(hb)) { - serverControl[hb] = minTargetDuration; - this.trigger('info', { - message: tag + " defaulting HOLD-BACK to targetDuration * 3 (" + minTargetDuration + ")." - }); - } - - if (minTargetDuration && serverControl[hb] < minTargetDuration) { - this.trigger('warn', { - message: tag + " clamping HOLD-BACK (" + serverControl[hb] + ") to targetDuration * 3 (" + minTargetDuration + ")" - }); - serverControl[hb] = minTargetDuration; - } // default no part hold back to part target duration * 3 - - - if (partTargetDuration && !serverControl.hasOwnProperty(phb)) { - serverControl[phb] = partTargetDuration * 3; - this.trigger('info', { - message: tag + " defaulting PART-HOLD-BACK to partTargetDuration * 3 (" + serverControl[phb] + ")." - }); - } // if part hold back is too small default it to part target duration * 2 - - - if (partTargetDuration && serverControl[phb] < minPartDuration) { - this.trigger('warn', { - message: tag + " clamping PART-HOLD-BACK (" + serverControl[phb] + ") to partTargetDuration * 2 (" + minPartDuration + ")." - }); - serverControl[phb] = minPartDuration; - } - }; - /** - * A parser for M3U8 files. The current interpretation of the input is - * exposed as a property `manifest` on parser objects. It's just two lines to - * create and parse a manifest once you have the contents available as a string: - * - * ```js - * var parser = new m3u8.Parser(); - * parser.push(xhr.responseText); - * ``` - * - * New input can later be applied to update the manifest object by calling - * `push` again. - * - * The parser attempts to create a usable manifest object even if the - * underlying input is somewhat nonsensical. It emits `info` and `warning` - * events during the parse if it encounters input that seems invalid or - * requires some property of the manifest object to be defaulted. - * - * @class Parser - * @extends Stream - */ - - - var Parser = /*#__PURE__*/function (_Stream) { - inheritsLoose(Parser, _Stream); - - function Parser() { - var _this; - - _this = _Stream.call(this) || this; - _this.lineStream = new LineStream(); - _this.parseStream = new ParseStream(); - - _this.lineStream.pipe(_this.parseStream); - /* eslint-disable consistent-this */ - - - var self = assertThisInitialized(_this); - /* eslint-enable consistent-this */ - - - var uris = []; - var currentUri = {}; // if specified, the active EXT-X-MAP definition - - var currentMap; // if specified, the active decryption key - - var _key; - - var hasParts = false; - - var noop = function noop() {}; - - var defaultMediaGroups = { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }; // This is the Widevine UUID from DASH IF IOP. The same exact string is - // used in MPDs with Widevine encrypted streams. - - var widevineUuid = 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'; // group segments into numbered timelines delineated by discontinuities - - var currentTimeline = 0; // the manifest is empty until the parse stream begins delivering data - - _this.manifest = { - allowCache: true, - discontinuityStarts: [], - segments: [] - }; // keep track of the last seen segment's byte range end, as segments are not required - // to provide the offset, in which case it defaults to the next byte after the - // previous segment - - var lastByterangeEnd = 0; // keep track of the last seen part's byte range end. - - var lastPartByterangeEnd = 0; - - _this.on('end', function () { - // only add preloadSegment if we don't yet have a uri for it. - // and we actually have parts/preloadHints - if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) { - return; - } - - if (!currentUri.map && currentMap) { - currentUri.map = currentMap; - } - - if (!currentUri.key && _key) { - currentUri.key = _key; - } - - if (!currentUri.timeline && typeof currentTimeline === 'number') { - currentUri.timeline = currentTimeline; - } - - _this.manifest.preloadSegment = currentUri; - }); // update the manifest with the m3u8 entry from the parse stream - - - _this.parseStream.on('data', function (entry) { - var mediaGroup; - var rendition; - ({ - tag: function tag() { - // switch based on the tag type - (({ - version: function version() { - if (entry.version) { - this.manifest.version = entry.version; - } - }, - 'allow-cache': function allowCache() { - this.manifest.allowCache = entry.allowed; - - if (!('allowed' in entry)) { - this.trigger('info', { - message: 'defaulting allowCache to YES' - }); - this.manifest.allowCache = true; - } - }, - byterange: function byterange() { - var byterange = {}; - - if ('length' in entry) { - currentUri.byterange = byterange; - byterange.length = entry.length; - - if (!('offset' in entry)) { - /* - * From the latest spec (as of this writing): - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.2 - * - * Same text since EXT-X-BYTERANGE's introduction in draft 7: - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-07#section-3.3.1) - * - * "If o [offset] is not present, the sub-range begins at the next byte - * following the sub-range of the previous media segment." - */ - entry.offset = lastByterangeEnd; - } - } - - if ('offset' in entry) { - currentUri.byterange = byterange; - byterange.offset = entry.offset; - } - - lastByterangeEnd = byterange.offset + byterange.length; - }, - endlist: function endlist() { - this.manifest.endList = true; - }, - inf: function inf() { - if (!('mediaSequence' in this.manifest)) { - this.manifest.mediaSequence = 0; - this.trigger('info', { - message: 'defaulting media sequence to zero' - }); - } - - if (!('discontinuitySequence' in this.manifest)) { - this.manifest.discontinuitySequence = 0; - this.trigger('info', { - message: 'defaulting discontinuity sequence to zero' - }); - } - - if (entry.duration > 0) { - currentUri.duration = entry.duration; - } - - if (entry.duration === 0) { - currentUri.duration = 0.01; - this.trigger('info', { - message: 'updating zero segment duration to a small value' - }); - } - - this.manifest.segments = uris; - }, - key: function key() { - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring key declaration without attribute list' - }); - return; - } // clear the active encryption key - - - if (entry.attributes.METHOD === 'NONE') { - _key = null; - return; - } - - if (!entry.attributes.URI) { - this.trigger('warn', { - message: 'ignoring key declaration without URI' - }); - return; - } - - if (entry.attributes.KEYFORMAT === 'com.apple.streamingkeydelivery') { - this.manifest.contentProtection = this.manifest.contentProtection || {}; // TODO: add full support for this. - - this.manifest.contentProtection['com.apple.fps.1_0'] = { - attributes: entry.attributes - }; - return; - } // check if the content is encrypted for Widevine - // Widevine/HLS spec: https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf - - - if (entry.attributes.KEYFORMAT === widevineUuid) { - var VALID_METHODS = ['SAMPLE-AES', 'SAMPLE-AES-CTR', 'SAMPLE-AES-CENC']; - - if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) { - this.trigger('warn', { - message: 'invalid key method provided for Widevine' - }); - return; - } - - if (entry.attributes.METHOD === 'SAMPLE-AES-CENC') { - this.trigger('warn', { - message: 'SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead' - }); - } - - if (entry.attributes.URI.substring(0, 23) !== 'data:text/plain;base64,') { - this.trigger('warn', { - message: 'invalid key URI provided for Widevine' - }); - return; - } - - if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === '0x')) { - this.trigger('warn', { - message: 'invalid key ID provided for Widevine' - }); - return; - } // if Widevine key attributes are valid, store them as `contentProtection` - // on the manifest to emulate Widevine tag structure in a DASH mpd - - - this.manifest.contentProtection = this.manifest.contentProtection || {}; - this.manifest.contentProtection['com.widevine.alpha'] = { - attributes: { - schemeIdUri: entry.attributes.KEYFORMAT, - // remove '0x' from the key id string - keyId: entry.attributes.KEYID.substring(2) - }, - // decode the base64-encoded PSSH box - pssh: decodeB64ToUint8Array(entry.attributes.URI.split(',')[1]) - }; - return; - } - - if (!entry.attributes.METHOD) { - this.trigger('warn', { - message: 'defaulting key method to AES-128' - }); - } // setup an encryption key for upcoming segments - - - _key = { - method: entry.attributes.METHOD || 'AES-128', - uri: entry.attributes.URI - }; - - if (typeof entry.attributes.IV !== 'undefined') { - _key.iv = entry.attributes.IV; - } - }, - 'media-sequence': function mediaSequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid media sequence: ' + entry.number - }); - return; - } - - this.manifest.mediaSequence = entry.number; - }, - 'discontinuity-sequence': function discontinuitySequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid discontinuity sequence: ' + entry.number - }); - return; - } - - this.manifest.discontinuitySequence = entry.number; - currentTimeline = entry.number; - }, - 'playlist-type': function playlistType() { - if (!/VOD|EVENT/.test(entry.playlistType)) { - this.trigger('warn', { - message: 'ignoring unknown playlist type: ' + entry.playlist - }); - return; - } - - this.manifest.playlistType = entry.playlistType; - }, - map: function map() { - currentMap = {}; - - if (entry.uri) { - currentMap.uri = entry.uri; - } - - if (entry.byterange) { - currentMap.byterange = entry.byterange; - } - - if (_key) { - currentMap.key = _key; - } - }, - 'stream-inf': function streamInf() { - this.manifest.playlists = uris; - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring empty stream-inf attributes' - }); - return; - } - - if (!currentUri.attributes) { - currentUri.attributes = {}; - } - - _extends_1(currentUri.attributes, entry.attributes); - }, - media: function media() { - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!(entry.attributes && entry.attributes.TYPE && entry.attributes['GROUP-ID'] && entry.attributes.NAME)) { - this.trigger('warn', { - message: 'ignoring incomplete or missing media group' - }); - return; - } // find the media group, creating defaults as necessary - - - var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE]; - mediaGroupType[entry.attributes['GROUP-ID']] = mediaGroupType[entry.attributes['GROUP-ID']] || {}; - mediaGroup = mediaGroupType[entry.attributes['GROUP-ID']]; // collect the rendition metadata - - rendition = { - default: /yes/i.test(entry.attributes.DEFAULT) - }; - - if (rendition.default) { - rendition.autoselect = true; - } else { - rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT); - } - - if (entry.attributes.LANGUAGE) { - rendition.language = entry.attributes.LANGUAGE; - } - - if (entry.attributes.URI) { - rendition.uri = entry.attributes.URI; - } - - if (entry.attributes['INSTREAM-ID']) { - rendition.instreamId = entry.attributes['INSTREAM-ID']; - } - - if (entry.attributes.CHARACTERISTICS) { - rendition.characteristics = entry.attributes.CHARACTERISTICS; - } - - if (entry.attributes.FORCED) { - rendition.forced = /yes/i.test(entry.attributes.FORCED); - } // insert the new rendition - - - mediaGroup[entry.attributes.NAME] = rendition; - }, - discontinuity: function discontinuity() { - currentTimeline += 1; - currentUri.discontinuity = true; - this.manifest.discontinuityStarts.push(uris.length); - }, - 'program-date-time': function programDateTime() { - if (typeof this.manifest.dateTimeString === 'undefined') { - // PROGRAM-DATE-TIME is a media-segment tag, but for backwards - // compatibility, we add the first occurence of the PROGRAM-DATE-TIME tag - // to the manifest object - // TODO: Consider removing this in future major version - this.manifest.dateTimeString = entry.dateTimeString; - this.manifest.dateTimeObject = entry.dateTimeObject; - } - - currentUri.dateTimeString = entry.dateTimeString; - currentUri.dateTimeObject = entry.dateTimeObject; - }, - targetduration: function targetduration() { - if (!isFinite(entry.duration) || entry.duration < 0) { - this.trigger('warn', { - message: 'ignoring invalid target duration: ' + entry.duration - }); - return; - } - - this.manifest.targetDuration = entry.duration; - setHoldBack.call(this, this.manifest); - }, - start: function start() { - if (!entry.attributes || isNaN(entry.attributes['TIME-OFFSET'])) { - this.trigger('warn', { - message: 'ignoring start declaration without appropriate attribute list' - }); - return; - } - - this.manifest.start = { - timeOffset: entry.attributes['TIME-OFFSET'], - precise: entry.attributes.PRECISE - }; - }, - 'cue-out': function cueOut() { - currentUri.cueOut = entry.data; - }, - 'cue-out-cont': function cueOutCont() { - currentUri.cueOutCont = entry.data; - }, - 'cue-in': function cueIn() { - currentUri.cueIn = entry.data; - }, - 'skip': function skip() { - this.manifest.skip = camelCaseKeys(entry.attributes); - this.warnOnMissingAttributes_('#EXT-X-SKIP', entry.attributes, ['SKIPPED-SEGMENTS']); - }, - 'part': function part() { - var _this2 = this; - - hasParts = true; // parts are always specifed before a segment - - var segmentIndex = this.manifest.segments.length; - var part = camelCaseKeys(entry.attributes); - currentUri.parts = currentUri.parts || []; - currentUri.parts.push(part); - - if (part.byterange) { - if (!part.byterange.hasOwnProperty('offset')) { - part.byterange.offset = lastPartByterangeEnd; - } - - lastPartByterangeEnd = part.byterange.offset + part.byterange.length; - } - - var partIndex = currentUri.parts.length - 1; - this.warnOnMissingAttributes_("#EXT-X-PART #" + partIndex + " for segment #" + segmentIndex, entry.attributes, ['URI', 'DURATION']); - - if (this.manifest.renditionReports) { - this.manifest.renditionReports.forEach(function (r, i) { - if (!r.hasOwnProperty('lastPart')) { - _this2.trigger('warn', { - message: "#EXT-X-RENDITION-REPORT #" + i + " lacks required attribute(s): LAST-PART" - }); - } - }); - } - }, - 'server-control': function serverControl() { - var attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes); - - if (!attrs.hasOwnProperty('canBlockReload')) { - attrs.canBlockReload = false; - this.trigger('info', { - message: '#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false' - }); - } - - setHoldBack.call(this, this.manifest); - - if (attrs.canSkipDateranges && !attrs.hasOwnProperty('canSkipUntil')) { - this.trigger('warn', { - message: '#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set' - }); - } - }, - 'preload-hint': function preloadHint() { - // parts are always specifed before a segment - var segmentIndex = this.manifest.segments.length; - var hint = camelCaseKeys(entry.attributes); - var isPart = hint.type && hint.type === 'PART'; - currentUri.preloadHints = currentUri.preloadHints || []; - currentUri.preloadHints.push(hint); - - if (hint.byterange) { - if (!hint.byterange.hasOwnProperty('offset')) { - // use last part byterange end or zero if not a part. - hint.byterange.offset = isPart ? lastPartByterangeEnd : 0; - - if (isPart) { - lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length; - } - } - } - - var index = currentUri.preloadHints.length - 1; - this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #" + index + " for segment #" + segmentIndex, entry.attributes, ['TYPE', 'URI']); - - if (!hint.type) { - return; - } // search through all preload hints except for the current one for - // a duplicate type. - - - for (var i = 0; i < currentUri.preloadHints.length - 1; i++) { - var otherHint = currentUri.preloadHints[i]; - - if (!otherHint.type) { - continue; - } - - if (otherHint.type === hint.type) { - this.trigger('warn', { - message: "#EXT-X-PRELOAD-HINT #" + index + " for segment #" + segmentIndex + " has the same TYPE " + hint.type + " as preload hint #" + i - }); - } - } - }, - 'rendition-report': function renditionReport() { - var report = camelCaseKeys(entry.attributes); - this.manifest.renditionReports = this.manifest.renditionReports || []; - this.manifest.renditionReports.push(report); - var index = this.manifest.renditionReports.length - 1; - var required = ['LAST-MSN', 'URI']; - - if (hasParts) { - required.push('LAST-PART'); - } - - this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #" + index, entry.attributes, required); - }, - 'part-inf': function partInf() { - this.manifest.partInf = camelCaseKeys(entry.attributes); - this.warnOnMissingAttributes_('#EXT-X-PART-INF', entry.attributes, ['PART-TARGET']); - - if (this.manifest.partInf.partTarget) { - this.manifest.partTargetDuration = this.manifest.partInf.partTarget; - } - - setHoldBack.call(this, this.manifest); - } - })[entry.tagType] || noop).call(self); - }, - uri: function uri() { - currentUri.uri = entry.uri; - uris.push(currentUri); // if no explicit duration was declared, use the target duration - - if (this.manifest.targetDuration && !('duration' in currentUri)) { - this.trigger('warn', { - message: 'defaulting segment duration to the target duration' - }); - currentUri.duration = this.manifest.targetDuration; - } // annotate with encryption information, if necessary - - - if (_key) { - currentUri.key = _key; - } - - currentUri.timeline = currentTimeline; // annotate with initialization segment information, if necessary - - if (currentMap) { - currentUri.map = currentMap; - } // reset the last byterange end as it needs to be 0 between parts - - - lastPartByterangeEnd = 0; // prepare for the next URI - - currentUri = {}; - }, - comment: function comment() {// comments are not important for playback - }, - custom: function custom() { - // if this is segment-level data attach the output to the segment - if (entry.segment) { - currentUri.custom = currentUri.custom || {}; - currentUri.custom[entry.customType] = entry.data; // if this is manifest-level data attach to the top level manifest object - } else { - this.manifest.custom = this.manifest.custom || {}; - this.manifest.custom[entry.customType] = entry.data; - } - } - })[entry.type].call(self); - }); - - return _this; - } - - var _proto = Parser.prototype; - - _proto.warnOnMissingAttributes_ = function warnOnMissingAttributes_(identifier, attributes, required) { - var missing = []; - required.forEach(function (key) { - if (!attributes.hasOwnProperty(key)) { - missing.push(key); - } - }); - - if (missing.length) { - this.trigger('warn', { - message: identifier + " lacks required attribute(s): " + missing.join(', ') - }); - } - } - /** - * Parse the input string and update the manifest object. - * - * @param {string} chunk a potentially incomplete portion of the manifest - */ - ; - - _proto.push = function push(chunk) { - this.lineStream.push(chunk); - } - /** - * Flush any remaining input. This can be handy if the last line of an M3U8 - * manifest did not contain a trailing newline but the file has been - * completely received. - */ - ; - - _proto.end = function end() { - // flush any buffered input - this.lineStream.push('\n'); - this.trigger('end'); - } - /** - * Add an additional parser for non-standard tags - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.type the type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - ; - - _proto.addParser = function addParser(options) { - this.parseStream.addParser(options); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - ; - - _proto.addTagMapper = function addTagMapper(options) { - this.parseStream.addTagMapper(options); - }; - - return Parser; - }(Stream); - - exports.LineStream = LineStream; - exports.ParseStream = ParseStream; - exports.Parser = Parser; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/m3u8-parser/dist/m3u8-parser.min.js b/node_modules/m3u8-parser/dist/m3u8-parser.min.js deleted file mode 100644 index 1ec76ed..0000000 --- a/node_modules/m3u8-parser/dist/m3u8-parser.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name m3u8-parser @version 4.7.0 @license Apache-2.0 */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("global/window")):"function"==typeof define&&define.amd?define(["exports","global/window"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).m3u8Parser={},t.window)}(this,(function(t,e){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=i(e);var a=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e},s=function(){function t(){this.listeners={}}var e=t.prototype;return e.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},e.off=function(t,e){if(!this.listeners[t])return!1;var i=this.listeners[t].indexOf(e);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(i,1),i>-1},e.trigger=function(t){var e=this.listeners[t];if(e)if(2===arguments.length)for(var i=e.length,r=0;r-1;e=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)},e}(s);var u=function(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}((function(t){function e(){return t.exports=e=Object.assign||function(t){for(var e=1;e0&&(o.duration=t.duration),0===t.duration&&(o.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=s},key:function(){if(t.attributes)if("NONE"!==t.attributes.METHOD)if(t.attributes.URI){if("com.apple.streamingkeydelivery"===t.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:t.attributes});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===t.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(t.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===t.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==t.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):t.attributes.KEYID&&"0x"===t.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:t.attributes.KEYFORMAT,keyId:t.attributes.KEYID.substring(2)},pssh:d(t.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}t.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),r={method:t.attributes.METHOD||"AES-128",uri:t.attributes.URI},void 0!==t.attributes.IV&&(r.iv=t.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else r=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(t.number)?this.manifest.mediaSequence=t.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+t.number})},"discontinuity-sequence":function(){isFinite(t.number)?(this.manifest.discontinuitySequence=t.number,b=t.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+t.number})},"playlist-type":function(){/VOD|EVENT/.test(t.playlistType)?this.manifest.playlistType=t.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+t.playlist})},map:function(){i={},t.uri&&(i.uri=t.uri),t.byterange&&(i.byterange=t.byterange),r&&(i.key=r)},"stream-inf":function(){this.manifest.playlists=s,this.manifest.mediaGroups=this.manifest.mediaGroups||E,t.attributes?(o.attributes||(o.attributes={}),u(o.attributes,t.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||E,t.attributes&&t.attributes.TYPE&&t.attributes["GROUP-ID"]&&t.attributes.NAME){var i=this.manifest.mediaGroups[t.attributes.TYPE];i[t.attributes["GROUP-ID"]]=i[t.attributes["GROUP-ID"]]||{},e=i[t.attributes["GROUP-ID"]],(n={default:/yes/i.test(t.attributes.DEFAULT)}).default?n.autoselect=!0:n.autoselect=/yes/i.test(t.attributes.AUTOSELECT),t.attributes.LANGUAGE&&(n.language=t.attributes.LANGUAGE),t.attributes.URI&&(n.uri=t.attributes.URI),t.attributes["INSTREAM-ID"]&&(n.instreamId=t.attributes["INSTREAM-ID"]),t.attributes.CHARACTERISTICS&&(n.characteristics=t.attributes.CHARACTERISTICS),t.attributes.FORCED&&(n.forced=/yes/i.test(t.attributes.FORCED)),e[t.attributes.NAME]=n}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){b+=1,o.discontinuity=!0,this.manifest.discontinuityStarts.push(s.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=t.dateTimeString,this.manifest.dateTimeObject=t.dateTimeObject),o.dateTimeString=t.dateTimeString,o.dateTimeObject=t.dateTimeObject},targetduration:function(){!isFinite(t.duration)||t.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+t.duration}):(this.manifest.targetDuration=t.duration,l.call(this,this.manifest))},start:function(){t.attributes&&!isNaN(t.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:t.attributes["TIME-OFFSET"],precise:t.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){o.cueOut=t.data},"cue-out-cont":function(){o.cueOutCont=t.data},"cue-in":function(){o.cueIn=t.data},skip:function(){this.manifest.skip=h(t.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",t.attributes,["SKIPPED-SEGMENTS"])},part:function(){var e=this;g=!0;var i=this.manifest.segments.length,r=h(t.attributes);o.parts=o.parts||[],o.parts.push(r),r.byterange&&(r.byterange.hasOwnProperty("offset")||(r.byterange.offset=m),m=r.byterange.offset+r.byterange.length);var a=o.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+a+" for segment #"+i,t.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((function(t,i){t.hasOwnProperty("lastPart")||e.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+i+" lacks required attribute(s): LAST-PART"})}))},"server-control":function(){var e=this.manifest.serverControl=h(t.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),l.call(this,this.manifest),e.canSkipDateranges&&!e.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var e=this.manifest.segments.length,i=h(t.attributes),r=i.type&&"PART"===i.type;o.preloadHints=o.preloadHints||[],o.preloadHints.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=r?m:0,r&&(m=i.byterange.offset+i.byterange.length)));var a=o.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+a+" for segment #"+e,t.attributes,["TYPE","URI"]),i.type)for(var s=0;s - - - - m3u8-parser Demo - - -

    Open dev tools to try it out

    - - - - diff --git a/node_modules/m3u8-parser/package.json b/node_modules/m3u8-parser/package.json deleted file mode 100644 index c0e70ad..0000000 --- a/node_modules/m3u8-parser/package.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "_from": "m3u8-parser@4.7.0", - "_id": "m3u8-parser@4.7.0", - "_inBundle": false, - "_integrity": "sha512-48l/OwRyjBm+QhNNigEEcRcgbRvnUjL7rxs597HmW9QSNbyNvt+RcZ9T/d9vxi9A9z7EZrB1POtZYhdRlwYQkQ==", - "_location": "/m3u8-parser", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "m3u8-parser@4.7.0", - "name": "m3u8-parser", - "escapedName": "m3u8-parser", - "rawSpec": "4.7.0", - "saveSpec": null, - "fetchSpec": "4.7.0" - }, - "_requiredBy": [ - "/@videojs/http-streaming", - "/video.js" - ], - "_resolved": "https://registry.npmjs.org/m3u8-parser/-/m3u8-parser-4.7.0.tgz", - "_shasum": "e01e8ce136098ade1b14ee691ea20fc4dc60abf6", - "_spec": "m3u8-parser@4.7.0", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js", - "author": { - "name": "Brightcove, Inc" - }, - "browserslist": [ - "defaults", - "ie 11" - ], - "bugs": { - "url": "https://github.com/videojs/m3u8-parser/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "gkatsev" - }, - { - "name": "imbcmdth" - }, - { - "name": "dmlap" - } - ], - "dependencies": { - "@babel/runtime": "^7.12.5", - "@videojs/vhs-utils": "^3.0.0", - "global": "^4.4.0" - }, - "deprecated": false, - "description": "m3u8 parser", - "devDependencies": { - "@rollup/plugin-replace": "^2.3.4", - "@videojs/generator-helpers": "~2.0.1", - "karma": "^5.2.3", - "rollup": "^2.37.1", - "rollup-plugin-data-files": "^0.1.0", - "sinon": "^9.2.3", - "videojs-generate-karma-config": "~7.1.0", - "videojs-generate-rollup-config": "~6.2.0", - "videojs-generator-verify": "~3.0.1", - "videojs-standard": "^8.0.4" - }, - "files": [ - "CONTRIBUTING.md", - "dist/", - "docs/", - "index.html", - "scripts/", - "src/", - "test/" - ], - "generator-videojs-plugin": { - "version": "7.7.3" - }, - "homepage": "https://github.com/videojs/m3u8-parser#readme", - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "keywords": [ - "videojs", - "videojs-plugin" - ], - "license": "Apache-2.0", - "lint-staged": { - "*.js": "vjsstandard --fix", - "README.md": "doctoc --notitle" - }, - "main": "dist/m3u8-parser.cjs.js", - "module": "dist/m3u8-parser.es.js", - "name": "m3u8-parser", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/videojs/m3u8-parser.git" - }, - "scripts": { - "build": "npm-run-all -s clean -p build:*", - "build-prod": "cross-env-shell NO_TEST_BUNDLE=1 'npm run build'", - "build-test": "cross-env-shell TEST_BUNDLE_ONLY=1 'npm run build'", - "build:js": "rollup -c scripts/rollup.config.js", - "clean": "shx rm -rf ./dist ./test/dist && shx mkdir -p ./dist ./test/dist", - "lint": "vjsstandard", - "posttest": "shx cat test/dist/coverage/text.txt", - "prepublishOnly": "npm-run-all build-prod && vjsverify --verbose", - "preversion": "npm test", - "server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch", - "start": "npm-run-all -p server watch", - "test": "npm-run-all lint build-test test:*", - "test:browser": "karma start scripts/karma.conf.js", - "test:node": "qunit test/dist/bundle.js", - "update-changelog": "conventional-changelog -p videojs -i CHANGELOG.md -s", - "version": "is-prerelease || npm run update-changelog && git add CHANGELOG.md", - "watch": "npm-run-all -p watch:*", - "watch:js": "npm run build:js -- -w" - }, - "version": "4.7.0", - "vjsstandard": { - "ignore": [ - "dist", - "docs", - "test/dist" - ] - } -} diff --git a/node_modules/m3u8-parser/scripts/karma.conf.js b/node_modules/m3u8-parser/scripts/karma.conf.js deleted file mode 100644 index ac53a18..0000000 --- a/node_modules/m3u8-parser/scripts/karma.conf.js +++ /dev/null @@ -1,12 +0,0 @@ -const generate = require('videojs-generate-karma-config'); - -module.exports = function(config) { - - // see https://github.com/videojs/videojs-generate-karma-config - // for options - const options = {}; - - config = generate(config, options); - - // any other custom stuff not supported by options here! -}; diff --git a/node_modules/m3u8-parser/scripts/rollup.config.js b/node_modules/m3u8-parser/scripts/rollup.config.js deleted file mode 100644 index 3fbc276..0000000 --- a/node_modules/m3u8-parser/scripts/rollup.config.js +++ /dev/null @@ -1,47 +0,0 @@ -const generate = require('videojs-generate-rollup-config'); -const replace = require('@rollup/plugin-replace'); -const dataFiles = require('rollup-plugin-data-files'); - -// see https://github.com/videojs/videojs-generate-rollup-config -// for options -const options = { - input: 'src/index.js', - externals(defaults) { - defaults.module.push('@videojs/vhs-utils'); - - return defaults; - }, - primedPlugins(defaults) { - // when using "require" rather than import - // require cjs module - defaults.replace = replace({ - // single quote replace - "require('@videojs/vhs-utils/es": "require('@videojs/vhs-utils/cjs", - // double quote replace - 'require("@videojs/vhs-utils/es': 'require("@videojs/vhs-utils/cjs' - }); - - defaults.dataFiles = dataFiles({ - expecteds: {include: 'test/fixtures/integration/*.js', transform: 'js', extensions: false}, - manifests: {include: 'test/fixtures/integration/*.m3u8', transform: 'string', extensions: false} - }); - - return defaults; - }, - plugins(defaults) { - defaults.module.unshift('replace'); - defaults.test.unshift('dataFiles'); - - return defaults; - } -}; -const config = generate(options); - -if (config.builds.test) { - config.builds.test.output[0].format = 'umd'; -} - -// Add additonal builds/customization here! - -// export the builds to rollup -export default Object.values(config.builds); diff --git a/node_modules/m3u8-parser/src/index.js b/node_modules/m3u8-parser/src/index.js deleted file mode 100644 index 2f03907..0000000 --- a/node_modules/m3u8-parser/src/index.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @file m3u8/index.js - * - * Utilities for parsing M3U8 files. If the entire manifest is available, - * `Parser` will create an object representation with enough detail for managing - * playback. `ParseStream` and `LineStream` are lower-level parsing primitives - * that do not assume the entirety of the manifest is ready and expose a - * ReadableStream-like interface. - */ - -import LineStream from './line-stream'; -import ParseStream from './parse-stream'; -import Parser from './parser'; - -export { - LineStream, - ParseStream, - Parser -}; diff --git a/node_modules/m3u8-parser/src/line-stream.js b/node_modules/m3u8-parser/src/line-stream.js deleted file mode 100644 index 23ac4a1..0000000 --- a/node_modules/m3u8-parser/src/line-stream.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file m3u8/line-stream.js - */ -import Stream from '@videojs/vhs-utils/es/stream.js'; - -/** - * A stream that buffers string input and generates a `data` event for each - * line. - * - * @class LineStream - * @extends Stream - */ -export default class LineStream extends Stream { - constructor() { - super(); - this.buffer = ''; - } - - /** - * Add new data to be parsed. - * - * @param {string} data the text to process - */ - push(data) { - let nextNewline; - - this.buffer += data; - nextNewline = this.buffer.indexOf('\n'); - - for (; nextNewline > -1; nextNewline = this.buffer.indexOf('\n')) { - this.trigger('data', this.buffer.substring(0, nextNewline)); - this.buffer = this.buffer.substring(nextNewline + 1); - } - } -} diff --git a/node_modules/m3u8-parser/src/parse-stream.js b/node_modules/m3u8-parser/src/parse-stream.js deleted file mode 100644 index bee4b33..0000000 --- a/node_modules/m3u8-parser/src/parse-stream.js +++ /dev/null @@ -1,617 +0,0 @@ -/** - * @file m3u8/parse-stream.js - */ -import Stream from '@videojs/vhs-utils/es/stream.js'; - -const TAB = String.fromCharCode(0x09); - -const parseByterange = function(byterangeString) { - // optionally match and capture 0+ digits before `@` - // optionally match and capture 0+ digits after `@` - const match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || ''); - const result = {}; - - if (match[1]) { - result.length = parseInt(match[1], 10); - } - - if (match[2]) { - result.offset = parseInt(match[2], 10); - } - - return result; -}; - -/** - * "forgiving" attribute list psuedo-grammar: - * attributes -> keyvalue (',' keyvalue)* - * keyvalue -> key '=' value - * key -> [^=]* - * value -> '"' [^"]* '"' | [^,]* - */ -const attributeSeparator = function() { - const key = '[^=]*'; - const value = '"[^"]*"|[^,]*'; - const keyvalue = '(?:' + key + ')=(?:' + value + ')'; - - return new RegExp('(?:^|,)(' + keyvalue + ')'); -}; - -/** - * Parse attributes from a line given the separator - * - * @param {string} attributes the attribute line to parse - */ -const parseAttributes = function(attributes) { - // split the string using attributes as the separator - const attrs = attributes.split(attributeSeparator()); - const result = {}; - let i = attrs.length; - let attr; - - while (i--) { - // filter out unmatched portions of the string - if (attrs[i] === '') { - continue; - } - - // split the key and value - attr = (/([^=]*)=(.*)/).exec(attrs[i]).slice(1); - // trim whitespace and remove optional quotes around the value - attr[0] = attr[0].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^['"](.*)['"]$/g, '$1'); - result[attr[0]] = attr[1]; - } - return result; -}; - -/** - * A line-level M3U8 parser event stream. It expects to receive input one - * line at a time and performs a context-free parse of its contents. A stream - * interpretation of a manifest can be useful if the manifest is expected to - * be too large to fit comfortably into memory or the entirety of the input - * is not immediately available. Otherwise, it's probably much easier to work - * with a regular `Parser` object. - * - * Produces `data` events with an object that captures the parser's - * interpretation of the input. That object has a property `tag` that is one - * of `uri`, `comment`, or `tag`. URIs only have a single additional - * property, `line`, which captures the entirety of the input without - * interpretation. Comments similarly have a single additional property - * `text` which is the input without the leading `#`. - * - * Tags always have a property `tagType` which is the lower-cased version of - * the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance, - * `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized - * tags are given the tag type `unknown` and a single additional property - * `data` with the remainder of the input. - * - * @class ParseStream - * @extends Stream - */ -export default class ParseStream extends Stream { - constructor() { - super(); - this.customParsers = []; - this.tagMappers = []; - } - - /** - * Parses an additional line of input. - * - * @param {string} line a single line of an M3U8 file to parse - */ - push(line) { - let match; - let event; - - // strip whitespace - line = line.trim(); - - if (line.length === 0) { - // ignore empty lines - return; - } - - // URIs - if (line[0] !== '#') { - this.trigger('data', { - type: 'uri', - uri: line - }); - return; - } - - // map tags - const newLines = this.tagMappers.reduce((acc, mapper) => { - const mappedLine = mapper(line); - - // skip if unchanged - if (mappedLine === line) { - return acc; - } - - return acc.concat([mappedLine]); - }, [line]); - - newLines.forEach(newLine => { - for (let i = 0; i < this.customParsers.length; i++) { - if (this.customParsers[i].call(this, newLine)) { - return; - } - } - - // Comments - if (newLine.indexOf('#EXT') !== 0) { - this.trigger('data', { - type: 'comment', - text: newLine.slice(1) - }); - return; - } - - // strip off any carriage returns here so the regex matching - // doesn't have to account for them. - newLine = newLine.replace('\r', ''); - - // Tags - match = (/^#EXTM3U/).exec(newLine); - if (match) { - this.trigger('data', { - type: 'tag', - tagType: 'm3u' - }); - return; - } - match = (/^#EXTINF:?([0-9\.]*)?,?(.*)?$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'inf' - }; - if (match[1]) { - event.duration = parseFloat(match[1]); - } - if (match[2]) { - event.title = match[2]; - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-TARGETDURATION:?([0-9.]*)?/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'targetduration' - }; - if (match[1]) { - event.duration = parseInt(match[1], 10); - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-VERSION:?([0-9.]*)?/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'version' - }; - if (match[1]) { - event.version = parseInt(match[1], 10); - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'media-sequence' - }; - if (match[1]) { - event.number = parseInt(match[1], 10); - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'discontinuity-sequence' - }; - if (match[1]) { - event.number = parseInt(match[1], 10); - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'playlist-type' - }; - if (match[1]) { - event.playlistType = match[1]; - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-BYTERANGE:?(.*)?$/).exec(newLine); - if (match) { - event = Object.assign(parseByterange(match[1]), { - type: 'tag', - tagType: 'byterange' - }); - this.trigger('data', event); - return; - } - match = (/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'allow-cache' - }; - if (match[1]) { - event.allowed = !(/NO/).test(match[1]); - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-MAP:?(.*)$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'map' - }; - - if (match[1]) { - const attributes = parseAttributes(match[1]); - - if (attributes.URI) { - event.uri = attributes.URI; - } - if (attributes.BYTERANGE) { - event.byterange = parseByterange(attributes.BYTERANGE); - } - } - - this.trigger('data', event); - return; - } - match = (/^#EXT-X-STREAM-INF:?(.*)$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'stream-inf' - }; - if (match[1]) { - event.attributes = parseAttributes(match[1]); - - if (event.attributes.RESOLUTION) { - const split = event.attributes.RESOLUTION.split('x'); - const resolution = {}; - - if (split[0]) { - resolution.width = parseInt(split[0], 10); - } - if (split[1]) { - resolution.height = parseInt(split[1], 10); - } - event.attributes.RESOLUTION = resolution; - } - if (event.attributes.BANDWIDTH) { - event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10); - } - if (event.attributes['PROGRAM-ID']) { - event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10); - } - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-MEDIA:?(.*)$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'media' - }; - if (match[1]) { - event.attributes = parseAttributes(match[1]); - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-ENDLIST/).exec(newLine); - if (match) { - this.trigger('data', { - type: 'tag', - tagType: 'endlist' - }); - return; - } - match = (/^#EXT-X-DISCONTINUITY/).exec(newLine); - if (match) { - this.trigger('data', { - type: 'tag', - tagType: 'discontinuity' - }); - return; - } - match = (/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'program-date-time' - }; - if (match[1]) { - event.dateTimeString = match[1]; - event.dateTimeObject = new Date(match[1]); - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-KEY:?(.*)$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'key' - }; - if (match[1]) { - event.attributes = parseAttributes(match[1]); - // parse the IV string into a Uint32Array - if (event.attributes.IV) { - if (event.attributes.IV.substring(0, 2).toLowerCase() === '0x') { - event.attributes.IV = event.attributes.IV.substring(2); - } - - event.attributes.IV = event.attributes.IV.match(/.{8}/g); - event.attributes.IV[0] = parseInt(event.attributes.IV[0], 16); - event.attributes.IV[1] = parseInt(event.attributes.IV[1], 16); - event.attributes.IV[2] = parseInt(event.attributes.IV[2], 16); - event.attributes.IV[3] = parseInt(event.attributes.IV[3], 16); - event.attributes.IV = new Uint32Array(event.attributes.IV); - } - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-START:?(.*)$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'start' - }; - if (match[1]) { - event.attributes = parseAttributes(match[1]); - - event.attributes['TIME-OFFSET'] = parseFloat(event.attributes['TIME-OFFSET']); - event.attributes.PRECISE = (/YES/).test(event.attributes.PRECISE); - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-CUE-OUT-CONT:?(.*)?$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'cue-out-cont' - }; - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-CUE-OUT:?(.*)?$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'cue-out' - }; - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-CUE-IN:?(.*)?$/).exec(newLine); - if (match) { - event = { - type: 'tag', - tagType: 'cue-in' - }; - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - this.trigger('data', event); - return; - } - match = (/^#EXT-X-SKIP:(.*)$/).exec(newLine); - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'skip' - }; - event.attributes = parseAttributes(match[1]); - - if (event.attributes.hasOwnProperty('SKIPPED-SEGMENTS')) { - event.attributes['SKIPPED-SEGMENTS'] = parseInt(event.attributes['SKIPPED-SEGMENTS'], 10); - } - - if (event.attributes.hasOwnProperty('RECENTLY-REMOVED-DATERANGES')) { - event.attributes['RECENTLY-REMOVED-DATERANGES'] = - event.attributes['RECENTLY-REMOVED-DATERANGES'].split(TAB); - } - - this.trigger('data', event); - return; - } - match = (/^#EXT-X-PART:(.*)$/).exec(newLine); - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part' - }; - event.attributes = parseAttributes(match[1]); - ['DURATION'].forEach(function(key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - - ['INDEPENDENT', 'GAP'].forEach(function(key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = (/YES/).test(event.attributes[key]); - } - }); - - if (event.attributes.hasOwnProperty('BYTERANGE')) { - event.attributes.byterange = parseByterange(event.attributes.BYTERANGE); - } - - this.trigger('data', event); - return; - } - match = (/^#EXT-X-SERVER-CONTROL:(.*)$/).exec(newLine); - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'server-control' - }; - event.attributes = parseAttributes(match[1]); - ['CAN-SKIP-UNTIL', 'PART-HOLD-BACK', 'HOLD-BACK'].forEach(function(key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - - ['CAN-SKIP-DATERANGES', 'CAN-BLOCK-RELOAD'].forEach(function(key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = (/YES/).test(event.attributes[key]); - } - }); - - this.trigger('data', event); - return; - } - match = (/^#EXT-X-PART-INF:(.*)$/).exec(newLine); - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'part-inf' - }; - event.attributes = parseAttributes(match[1]); - ['PART-TARGET'].forEach(function(key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseFloat(event.attributes[key]); - } - }); - - this.trigger('data', event); - return; - } - - match = (/^#EXT-X-PRELOAD-HINT:(.*)$/).exec(newLine); - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'preload-hint' - }; - event.attributes = parseAttributes(match[1]); - ['BYTERANGE-START', 'BYTERANGE-LENGTH'].forEach(function(key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - - const subkey = key === 'BYTERANGE-LENGTH' ? 'length' : 'offset'; - - event.attributes.byterange = event.attributes.byterange || {}; - event.attributes.byterange[subkey] = event.attributes[key]; - // only keep the parsed byterange object. - delete event.attributes[key]; - } - }); - - this.trigger('data', event); - return; - } - match = (/^#EXT-X-RENDITION-REPORT:(.*)$/).exec(newLine); - if (match && match[1]) { - event = { - type: 'tag', - tagType: 'rendition-report' - }; - event.attributes = parseAttributes(match[1]); - ['LAST-MSN', 'LAST-PART'].forEach(function(key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - } - }); - - this.trigger('data', event); - return; - } - - // unknown tag type - this.trigger('data', { - type: 'tag', - data: newLine.slice(4) - }); - }); - } - - /** - * Add a parser for custom headers - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.customType the custom type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - addParser({expression, customType, dataParser, segment}) { - if (typeof dataParser !== 'function') { - dataParser = (line) => line; - } - this.customParsers.push(line => { - const match = expression.exec(line); - - if (match) { - this.trigger('data', { - type: 'custom', - data: dataParser(line), - customType, - segment - }); - return true; - } - }); - } - - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - addTagMapper({expression, map}) { - const mapFn = line => { - if (expression.test(line)) { - return map(line); - } - - return line; - }; - - this.tagMappers.push(mapFn); - } -} diff --git a/node_modules/m3u8-parser/src/parser.js b/node_modules/m3u8-parser/src/parser.js deleted file mode 100644 index a922f74..0000000 --- a/node_modules/m3u8-parser/src/parser.js +++ /dev/null @@ -1,727 +0,0 @@ -/** - * @file m3u8/parser.js - */ -import Stream from '@videojs/vhs-utils/es/stream.js'; -import decodeB64ToUint8Array from '@videojs/vhs-utils/es/decode-b64-to-uint8-array.js'; -import LineStream from './line-stream'; -import ParseStream from './parse-stream'; - -const camelCase = (str) => str - .toLowerCase() - .replace(/-(\w)/g, (a) => a[1].toUpperCase()); - -const camelCaseKeys = function(attributes) { - const result = {}; - - Object.keys(attributes).forEach(function(key) { - result[camelCase(key)] = attributes[key]; - }); - - return result; -}; - -// set SERVER-CONTROL hold back based upon targetDuration and partTargetDuration -// we need this helper because defaults are based upon targetDuration and -// partTargetDuration being set, but they may not be if SERVER-CONTROL appears before -// target durations are set. -const setHoldBack = function(manifest) { - const {serverControl, targetDuration, partTargetDuration} = manifest; - - if (!serverControl) { - return; - } - - const tag = '#EXT-X-SERVER-CONTROL'; - const hb = 'holdBack'; - const phb = 'partHoldBack'; - const minTargetDuration = targetDuration && targetDuration * 3; - const minPartDuration = partTargetDuration && partTargetDuration * 2; - - if (targetDuration && !serverControl.hasOwnProperty(hb)) { - serverControl[hb] = minTargetDuration; - this.trigger('info', { - message: `${tag} defaulting HOLD-BACK to targetDuration * 3 (${minTargetDuration}).` - }); - } - - if (minTargetDuration && serverControl[hb] < minTargetDuration) { - this.trigger('warn', { - message: `${tag} clamping HOLD-BACK (${serverControl[hb]}) to targetDuration * 3 (${minTargetDuration})` - }); - serverControl[hb] = minTargetDuration; - } - - // default no part hold back to part target duration * 3 - if (partTargetDuration && !serverControl.hasOwnProperty(phb)) { - serverControl[phb] = partTargetDuration * 3; - this.trigger('info', { - message: `${tag} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${serverControl[phb]}).` - }); - } - - // if part hold back is too small default it to part target duration * 2 - if (partTargetDuration && serverControl[phb] < (minPartDuration)) { - this.trigger('warn', { - message: `${tag} clamping PART-HOLD-BACK (${serverControl[phb]}) to partTargetDuration * 2 (${minPartDuration}).` - }); - - serverControl[phb] = minPartDuration; - } -}; - -/** - * A parser for M3U8 files. The current interpretation of the input is - * exposed as a property `manifest` on parser objects. It's just two lines to - * create and parse a manifest once you have the contents available as a string: - * - * ```js - * var parser = new m3u8.Parser(); - * parser.push(xhr.responseText); - * ``` - * - * New input can later be applied to update the manifest object by calling - * `push` again. - * - * The parser attempts to create a usable manifest object even if the - * underlying input is somewhat nonsensical. It emits `info` and `warning` - * events during the parse if it encounters input that seems invalid or - * requires some property of the manifest object to be defaulted. - * - * @class Parser - * @extends Stream - */ -export default class Parser extends Stream { - constructor() { - super(); - this.lineStream = new LineStream(); - this.parseStream = new ParseStream(); - this.lineStream.pipe(this.parseStream); - - /* eslint-disable consistent-this */ - const self = this; - /* eslint-enable consistent-this */ - const uris = []; - let currentUri = {}; - // if specified, the active EXT-X-MAP definition - let currentMap; - // if specified, the active decryption key - let key; - let hasParts = false; - const noop = function() {}; - const defaultMediaGroups = { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }; - // This is the Widevine UUID from DASH IF IOP. The same exact string is - // used in MPDs with Widevine encrypted streams. - const widevineUuid = 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'; - // group segments into numbered timelines delineated by discontinuities - let currentTimeline = 0; - - // the manifest is empty until the parse stream begins delivering data - this.manifest = { - allowCache: true, - discontinuityStarts: [], - segments: [] - }; - // keep track of the last seen segment's byte range end, as segments are not required - // to provide the offset, in which case it defaults to the next byte after the - // previous segment - let lastByterangeEnd = 0; - // keep track of the last seen part's byte range end. - let lastPartByterangeEnd = 0; - - this.on('end', () => { - // only add preloadSegment if we don't yet have a uri for it. - // and we actually have parts/preloadHints - if (currentUri.uri || (!currentUri.parts && !currentUri.preloadHints)) { - return; - } - if (!currentUri.map && currentMap) { - currentUri.map = currentMap; - } - - if (!currentUri.key && key) { - currentUri.key = key; - } - - if (!currentUri.timeline && typeof currentTimeline === 'number') { - currentUri.timeline = currentTimeline; - } - - this.manifest.preloadSegment = currentUri; - }); - - // update the manifest with the m3u8 entry from the parse stream - this.parseStream.on('data', function(entry) { - let mediaGroup; - let rendition; - - ({ - tag() { - // switch based on the tag type - (({ - version() { - if (entry.version) { - this.manifest.version = entry.version; - } - }, - 'allow-cache'() { - this.manifest.allowCache = entry.allowed; - if (!('allowed' in entry)) { - this.trigger('info', { - message: 'defaulting allowCache to YES' - }); - this.manifest.allowCache = true; - } - }, - byterange() { - const byterange = {}; - - if ('length' in entry) { - currentUri.byterange = byterange; - byterange.length = entry.length; - - if (!('offset' in entry)) { - /* - * From the latest spec (as of this writing): - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.2 - * - * Same text since EXT-X-BYTERANGE's introduction in draft 7: - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-07#section-3.3.1) - * - * "If o [offset] is not present, the sub-range begins at the next byte - * following the sub-range of the previous media segment." - */ - entry.offset = lastByterangeEnd; - } - } - if ('offset' in entry) { - currentUri.byterange = byterange; - byterange.offset = entry.offset; - } - lastByterangeEnd = byterange.offset + byterange.length; - }, - endlist() { - this.manifest.endList = true; - }, - inf() { - if (!('mediaSequence' in this.manifest)) { - this.manifest.mediaSequence = 0; - this.trigger('info', { - message: 'defaulting media sequence to zero' - }); - } - if (!('discontinuitySequence' in this.manifest)) { - this.manifest.discontinuitySequence = 0; - this.trigger('info', { - message: 'defaulting discontinuity sequence to zero' - }); - } - if (entry.duration > 0) { - currentUri.duration = entry.duration; - } - - if (entry.duration === 0) { - currentUri.duration = 0.01; - this.trigger('info', { - message: 'updating zero segment duration to a small value' - }); - } - - this.manifest.segments = uris; - }, - key() { - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring key declaration without attribute list' - }); - return; - } - // clear the active encryption key - if (entry.attributes.METHOD === 'NONE') { - key = null; - return; - } - if (!entry.attributes.URI) { - this.trigger('warn', { - message: 'ignoring key declaration without URI' - }); - return; - } - - if (entry.attributes.KEYFORMAT === 'com.apple.streamingkeydelivery') { - this.manifest.contentProtection = this.manifest.contentProtection || {}; - - // TODO: add full support for this. - this.manifest.contentProtection['com.apple.fps.1_0'] = { - attributes: entry.attributes - }; - - return; - } - - // check if the content is encrypted for Widevine - // Widevine/HLS spec: https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf - if (entry.attributes.KEYFORMAT === widevineUuid) { - const VALID_METHODS = ['SAMPLE-AES', 'SAMPLE-AES-CTR', 'SAMPLE-AES-CENC']; - - if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) { - this.trigger('warn', { - message: 'invalid key method provided for Widevine' - }); - return; - } - - if (entry.attributes.METHOD === 'SAMPLE-AES-CENC') { - this.trigger('warn', { - message: 'SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead' - }); - } - - if (entry.attributes.URI.substring(0, 23) !== 'data:text/plain;base64,') { - this.trigger('warn', { - message: 'invalid key URI provided for Widevine' - }); - return; - } - - if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === '0x')) { - this.trigger('warn', { - message: 'invalid key ID provided for Widevine' - }); - return; - } - - // if Widevine key attributes are valid, store them as `contentProtection` - // on the manifest to emulate Widevine tag structure in a DASH mpd - this.manifest.contentProtection = this.manifest.contentProtection || {}; - this.manifest.contentProtection['com.widevine.alpha'] = { - attributes: { - schemeIdUri: entry.attributes.KEYFORMAT, - // remove '0x' from the key id string - keyId: entry.attributes.KEYID.substring(2) - }, - // decode the base64-encoded PSSH box - pssh: decodeB64ToUint8Array(entry.attributes.URI.split(',')[1]) - }; - return; - } - - if (!entry.attributes.METHOD) { - this.trigger('warn', { - message: 'defaulting key method to AES-128' - }); - } - - // setup an encryption key for upcoming segments - key = { - method: entry.attributes.METHOD || 'AES-128', - uri: entry.attributes.URI - }; - - if (typeof entry.attributes.IV !== 'undefined') { - key.iv = entry.attributes.IV; - } - }, - 'media-sequence'() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid media sequence: ' + entry.number - }); - return; - } - this.manifest.mediaSequence = entry.number; - }, - 'discontinuity-sequence'() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid discontinuity sequence: ' + entry.number - }); - return; - } - this.manifest.discontinuitySequence = entry.number; - currentTimeline = entry.number; - }, - 'playlist-type'() { - if (!(/VOD|EVENT/).test(entry.playlistType)) { - this.trigger('warn', { - message: 'ignoring unknown playlist type: ' + entry.playlist - }); - return; - } - this.manifest.playlistType = entry.playlistType; - }, - map() { - currentMap = {}; - if (entry.uri) { - currentMap.uri = entry.uri; - } - if (entry.byterange) { - currentMap.byterange = entry.byterange; - } - - if (key) { - currentMap.key = key; - } - }, - 'stream-inf'() { - this.manifest.playlists = uris; - this.manifest.mediaGroups = - this.manifest.mediaGroups || defaultMediaGroups; - - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring empty stream-inf attributes' - }); - return; - } - - if (!currentUri.attributes) { - currentUri.attributes = {}; - } - Object.assign(currentUri.attributes, entry.attributes); - }, - media() { - this.manifest.mediaGroups = - this.manifest.mediaGroups || defaultMediaGroups; - - if (!(entry.attributes && - entry.attributes.TYPE && - entry.attributes['GROUP-ID'] && - entry.attributes.NAME)) { - this.trigger('warn', { - message: 'ignoring incomplete or missing media group' - }); - return; - } - - // find the media group, creating defaults as necessary - const mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE]; - - mediaGroupType[entry.attributes['GROUP-ID']] = - mediaGroupType[entry.attributes['GROUP-ID']] || {}; - mediaGroup = mediaGroupType[entry.attributes['GROUP-ID']]; - - // collect the rendition metadata - rendition = { - default: (/yes/i).test(entry.attributes.DEFAULT) - }; - if (rendition.default) { - rendition.autoselect = true; - } else { - rendition.autoselect = (/yes/i).test(entry.attributes.AUTOSELECT); - } - if (entry.attributes.LANGUAGE) { - rendition.language = entry.attributes.LANGUAGE; - } - if (entry.attributes.URI) { - rendition.uri = entry.attributes.URI; - } - if (entry.attributes['INSTREAM-ID']) { - rendition.instreamId = entry.attributes['INSTREAM-ID']; - } - if (entry.attributes.CHARACTERISTICS) { - rendition.characteristics = entry.attributes.CHARACTERISTICS; - } - if (entry.attributes.FORCED) { - rendition.forced = (/yes/i).test(entry.attributes.FORCED); - } - - // insert the new rendition - mediaGroup[entry.attributes.NAME] = rendition; - }, - discontinuity() { - currentTimeline += 1; - currentUri.discontinuity = true; - this.manifest.discontinuityStarts.push(uris.length); - }, - 'program-date-time'() { - if (typeof this.manifest.dateTimeString === 'undefined') { - // PROGRAM-DATE-TIME is a media-segment tag, but for backwards - // compatibility, we add the first occurence of the PROGRAM-DATE-TIME tag - // to the manifest object - // TODO: Consider removing this in future major version - this.manifest.dateTimeString = entry.dateTimeString; - this.manifest.dateTimeObject = entry.dateTimeObject; - } - - currentUri.dateTimeString = entry.dateTimeString; - currentUri.dateTimeObject = entry.dateTimeObject; - }, - targetduration() { - if (!isFinite(entry.duration) || entry.duration < 0) { - this.trigger('warn', { - message: 'ignoring invalid target duration: ' + entry.duration - }); - return; - } - this.manifest.targetDuration = entry.duration; - - setHoldBack.call(this, this.manifest); - }, - start() { - if (!entry.attributes || isNaN(entry.attributes['TIME-OFFSET'])) { - this.trigger('warn', { - message: 'ignoring start declaration without appropriate attribute list' - }); - return; - } - this.manifest.start = { - timeOffset: entry.attributes['TIME-OFFSET'], - precise: entry.attributes.PRECISE - }; - }, - 'cue-out'() { - currentUri.cueOut = entry.data; - }, - 'cue-out-cont'() { - currentUri.cueOutCont = entry.data; - }, - 'cue-in'() { - currentUri.cueIn = entry.data; - }, - 'skip'() { - this.manifest.skip = camelCaseKeys(entry.attributes); - - this.warnOnMissingAttributes_( - '#EXT-X-SKIP', - entry.attributes, - ['SKIPPED-SEGMENTS'] - ); - }, - 'part'() { - hasParts = true; - // parts are always specifed before a segment - const segmentIndex = this.manifest.segments.length; - const part = camelCaseKeys(entry.attributes); - - currentUri.parts = currentUri.parts || []; - currentUri.parts.push(part); - - if (part.byterange) { - if (!part.byterange.hasOwnProperty('offset')) { - part.byterange.offset = lastPartByterangeEnd; - } - lastPartByterangeEnd = part.byterange.offset + part.byterange.length; - } - - const partIndex = currentUri.parts.length - 1; - - this.warnOnMissingAttributes_( - `#EXT-X-PART #${partIndex} for segment #${segmentIndex}`, - entry.attributes, - ['URI', 'DURATION'] - ); - - if (this.manifest.renditionReports) { - this.manifest.renditionReports.forEach((r, i) => { - if (!r.hasOwnProperty('lastPart')) { - this.trigger('warn', { - message: `#EXT-X-RENDITION-REPORT #${i} lacks required attribute(s): LAST-PART` - }); - } - }); - } - }, - 'server-control'() { - const attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes); - - if (!attrs.hasOwnProperty('canBlockReload')) { - attrs.canBlockReload = false; - this.trigger('info', { - message: '#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false' - }); - } - setHoldBack.call(this, this.manifest); - - if (attrs.canSkipDateranges && !attrs.hasOwnProperty('canSkipUntil')) { - this.trigger('warn', { - message: '#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set' - }); - } - }, - 'preload-hint'() { - // parts are always specifed before a segment - const segmentIndex = this.manifest.segments.length; - const hint = camelCaseKeys(entry.attributes); - const isPart = hint.type && hint.type === 'PART'; - - currentUri.preloadHints = currentUri.preloadHints || []; - currentUri.preloadHints.push(hint); - - if (hint.byterange) { - - if (!hint.byterange.hasOwnProperty('offset')) { - // use last part byterange end or zero if not a part. - hint.byterange.offset = isPart ? lastPartByterangeEnd : 0; - if (isPart) { - lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length; - } - } - } - const index = currentUri.preloadHints.length - 1; - - this.warnOnMissingAttributes_( - `#EXT-X-PRELOAD-HINT #${index} for segment #${segmentIndex}`, - entry.attributes, - ['TYPE', 'URI'] - ); - - if (!hint.type) { - return; - } - // search through all preload hints except for the current one for - // a duplicate type. - for (let i = 0; i < currentUri.preloadHints.length - 1; i++) { - const otherHint = currentUri.preloadHints[i]; - - if (!otherHint.type) { - continue; - } - - if (otherHint.type === hint.type) { - this.trigger('warn', { - message: `#EXT-X-PRELOAD-HINT #${index} for segment #${segmentIndex} has the same TYPE ${hint.type} as preload hint #${i}` - }); - } - } - }, - 'rendition-report'() { - const report = camelCaseKeys(entry.attributes); - - this.manifest.renditionReports = this.manifest.renditionReports || []; - this.manifest.renditionReports.push(report); - const index = this.manifest.renditionReports.length - 1; - const required = ['LAST-MSN', 'URI']; - - if (hasParts) { - required.push('LAST-PART'); - } - - this.warnOnMissingAttributes_( - `#EXT-X-RENDITION-REPORT #${index}`, - entry.attributes, - required - ); - }, - 'part-inf'() { - this.manifest.partInf = camelCaseKeys(entry.attributes); - - this.warnOnMissingAttributes_( - '#EXT-X-PART-INF', - entry.attributes, - ['PART-TARGET'] - ); - if (this.manifest.partInf.partTarget) { - this.manifest.partTargetDuration = this.manifest.partInf.partTarget; - } - - setHoldBack.call(this, this.manifest); - } - })[entry.tagType] || noop).call(self); - }, - uri() { - currentUri.uri = entry.uri; - uris.push(currentUri); - - // if no explicit duration was declared, use the target duration - if (this.manifest.targetDuration && !('duration' in currentUri)) { - this.trigger('warn', { - message: 'defaulting segment duration to the target duration' - }); - currentUri.duration = this.manifest.targetDuration; - } - // annotate with encryption information, if necessary - if (key) { - currentUri.key = key; - } - currentUri.timeline = currentTimeline; - // annotate with initialization segment information, if necessary - if (currentMap) { - currentUri.map = currentMap; - } - - // reset the last byterange end as it needs to be 0 between parts - lastPartByterangeEnd = 0; - - // prepare for the next URI - currentUri = {}; - }, - comment() { - // comments are not important for playback - }, - custom() { - // if this is segment-level data attach the output to the segment - if (entry.segment) { - currentUri.custom = currentUri.custom || {}; - currentUri.custom[entry.customType] = entry.data; - // if this is manifest-level data attach to the top level manifest object - } else { - this.manifest.custom = this.manifest.custom || {}; - this.manifest.custom[entry.customType] = entry.data; - } - } - })[entry.type].call(self); - }); - } - - warnOnMissingAttributes_(identifier, attributes, required) { - const missing = []; - - required.forEach(function(key) { - if (!attributes.hasOwnProperty(key)) { - missing.push(key); - } - }); - - if (missing.length) { - this.trigger('warn', {message: `${identifier} lacks required attribute(s): ${missing.join(', ')}`}); - } - } - - /** - * Parse the input string and update the manifest object. - * - * @param {string} chunk a potentially incomplete portion of the manifest - */ - push(chunk) { - this.lineStream.push(chunk); - } - - /** - * Flush any remaining input. This can be handy if the last line of an M3U8 - * manifest did not contain a trailing newline but the file has been - * completely received. - */ - end() { - // flush any buffered input - this.lineStream.push('\n'); - - this.trigger('end'); - } - /** - * Add an additional parser for non-standard tags - * - * @param {Object} options a map of options for the added parser - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {string} options.type the type to register to the output - * @param {Function} [options.dataParser] function to parse the line into an object - * @param {boolean} [options.segment] should tag data be attached to the segment object - */ - addParser(options) { - this.parseStream.addParser(options); - } - /** - * Add a custom header mapper - * - * @param {Object} options - * @param {RegExp} options.expression a regular expression to match the custom header - * @param {Function} options.map function to translate tag into a different tag - */ - addTagMapper(options) { - this.parseStream.addTagMapper(options); - } -} diff --git a/node_modules/m3u8-parser/test/fixtures/integration/absoluteUris.js b/node_modules/m3u8-parser/test/fixtures/integration/absoluteUris.js deleted file mode 100644 index 370c8c1..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/absoluteUris.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 10, - timeline: 0, - uri: 'http://example.com/00001.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'https://example.com/00002.ts' - }, - { - duration: 10, - timeline: 0, - uri: '//example.com/00003.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'http://example.com/00004.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/absoluteUris.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/absoluteUris.m3u8 deleted file mode 100644 index 6fbaf05..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/absoluteUris.m3u8 +++ /dev/null @@ -1,12 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-TARGETDURATION:10 -#EXTINF:10, -http://example.com/00001.ts -#EXTINF:10, -https://example.com/00002.ts -#EXTINF:10, -//example.com/00003.ts -#EXTINF:10, -http://example.com/00004.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/allowCache.js b/node_modules/m3u8-parser/test/fixtures/integration/allowCache.js deleted file mode 100644 index b034613..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/allowCache.js +++ /dev/null @@ -1,165 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - byterange: { - length: 522828, - offset: 0 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 587500, - offset: 522828 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 713084, - offset: 1110328 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 476580, - offset: 1823412 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 535612, - offset: 2299992 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 207176, - offset: 2835604 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 455900, - offset: 3042780 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 657248, - offset: 3498680 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 571708, - offset: 4155928 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 485040, - offset: 4727636 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 709136, - offset: 5212676 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 730004, - offset: 5921812 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 456276, - offset: 6651816 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 468684, - offset: 7108092 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 444996, - offset: 7576776 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 331444, - offset: 8021772 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 44556, - offset: 8353216 - }, - duration: 1.4167, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - version: 4 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/allowCache.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/allowCache.m3u8 deleted file mode 100644 index b661c38..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/allowCache.m3u8 +++ /dev/null @@ -1,58 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:4 -#EXT-X-ALLOW-CACHE:YES -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -#EXT-X-BYTERANGE:522828@0 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:587500@522828 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:713084@1110328 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:476580@1823412 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:535612@2299992 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:207176@2835604 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:455900@3042780 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:657248@3498680 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:571708@4155928 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:485040@4727636 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:709136@5212676 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:730004@5921812 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:456276@6651816 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:468684@7108092 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:444996@7576776 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:331444@8021772 -hls_450k_video.ts -#EXTINF:1.4167, -#EXT-X-BYTERANGE:44556@8353216 -hls_450k_video.ts -#EXT-X-ENDLIST \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/allowCacheInvalid.js b/node_modules/m3u8-parser/test/fixtures/integration/allowCacheInvalid.js deleted file mode 100644 index 0ecbdc1..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/allowCacheInvalid.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - byterange: { - length: 522828, - offset: 0 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - version: 4 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/allowCacheInvalid.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/allowCacheInvalid.m3u8 deleted file mode 100644 index 04ad5fe..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/allowCacheInvalid.m3u8 +++ /dev/null @@ -1,10 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:4 -#EXT-X-ALLOW-CACHE:0 -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -#EXT-X-BYTERANGE:522828@0 -hls_450k_video.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/alternateAudio.js b/node_modules/m3u8-parser/test/fixtures/integration/alternateAudio.js deleted file mode 100644 index 9ea9638..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/alternateAudio.js +++ /dev/null @@ -1,56 +0,0 @@ -module.exports = { - allowCache: true, - discontinuityStarts: [], - mediaGroups: { - // TYPE - 'AUDIO': { - // GROUP-ID - audio: { - // NAME - English: { - language: 'eng', - autoselect: true, - default: true, - uri: 'eng/prog_index.m3u8' - }, - // NAME - Français: { - language: 'fre', - autoselect: true, - default: false, - uri: 'fre/prog_index.m3u8' - }, - // NAME - Espanol: { - language: 'sp', - autoselect: true, - default: false, - uri: 'sp/prog_index.m3u8' - } - } - }, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - playlists: [{ - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 195023, - 'CODECS': 'avc1.42e00a,mp4a.40.2', - 'AUDIO': 'audio' - }, - timeline: 0, - uri: 'lo/prog_index.m3u8' - }, { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 591680, - 'CODECS': 'avc1.42e01e,mp4a.40.2', - 'AUDIO': 'audio' - }, - timeline: 0, - uri: 'hi/prog_index.m3u8' - }], - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/alternateAudio.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/alternateAudio.m3u8 deleted file mode 100644 index a8a7f64..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/alternateAudio.m3u8 +++ /dev/null @@ -1,9 +0,0 @@ -#EXTM3U -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="eng",NAME="English",AUTOSELECT=YES, DEFAULT=YES,URI="eng/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="fre",NAME="Français",AUTOSELECT=YES, DEFAULT=NO,URI="fre/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="sp",NAME="Espanol",AUTOSELECT=YES, DEFAULT=NO,URI="sp/prog_index.m3u8" - -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=195023,CODECS="avc1.42e00a,mp4a.40.2",AUDIO="audio" -lo/prog_index.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=591680,CODECS="avc1.42e01e,mp4a.40.2",AUDIO="audio" -hi/prog_index.m3u8 \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/alternateVideo.js b/node_modules/m3u8-parser/test/fixtures/integration/alternateVideo.js deleted file mode 100644 index e786777..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/alternateVideo.js +++ /dev/null @@ -1,48 +0,0 @@ -module.exports = { - allowCache: true, - discontinuityStarts: [], - mediaGroups: { - 'AUDIO': { - aac: { - English: { - autoselect: true, - default: true, - language: 'eng', - uri: 'eng/prog_index.m3u8' - } - } - }, - 'VIDEO': { - '500kbs': { - Angle1: { - autoselect: true, - default: true - }, - Angle2: { - autoselect: true, - default: false, - uri: 'Angle2/500kbs/prog_index.m3u8' - }, - Angle3: { - autoselect: true, - default: false, - uri: 'Angle3/500kbs/prog_index.m3u8' - } - } - }, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - playlists: [{ - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 754857, - 'CODECS': 'mp4a.40.2,avc1.4d401e', - 'AUDIO': 'aac', - 'VIDEO': '500kbs' - }, - timeline: 0, - uri: 'Angle1/500kbs/prog_index.m3u8' - }], - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/alternateVideo.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/alternateVideo.m3u8 deleted file mode 100644 index 96c1842..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/alternateVideo.m3u8 +++ /dev/null @@ -1,8 +0,0 @@ -#EXTM3U -#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle1",AUTOSELECT=YES,DEFAULT=YES -#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle2",AUTOSELECT=YES,DEFAULT=NO,URI="Angle2/500kbs/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle3",AUTOSELECT=YES,DEFAULT=NO,URI="Angle3/500kbs/prog_index.m3u8" - -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="eng/prog_index.m3u8" -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=754857,CODECS="mp4a.40.2,avc1.4d401e",VIDEO="500kbs",AUDIO="aac" -Angle1/500kbs/prog_index.m3u8 \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/brightcove.js b/node_modules/m3u8-parser/test/fixtures/integration/brightcove.js deleted file mode 100644 index 67b155c..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/brightcove.js +++ /dev/null @@ -1,57 +0,0 @@ -module.exports = { - allowCache: true, - playlists: [ - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 240000, - 'RESOLUTION': { - width: 396, - height: 224 - } - }, - timeline: 0, - uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001' - }, - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 40000 - }, - timeline: 0, - uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001' - }, - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 440000, - 'RESOLUTION': { - width: 396, - height: 224 - } - }, - timeline: 0, - uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001' - }, - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 1928000, - 'RESOLUTION': { - width: 960, - height: 540 - } - }, - timeline: 0, - uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001' - } - ], - discontinuityStarts: [], - mediaGroups: { - 'VIDEO': {}, - 'AUDIO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/brightcove.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/brightcove.m3u8 deleted file mode 100644 index cdd1226..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/brightcove.m3u8 +++ /dev/null @@ -1,9 +0,0 @@ -#EXTM3U -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000,RESOLUTION=396x224 -http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=40000 -http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000,RESOLUTION=396x224 -http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540 -http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/byteRange.js b/node_modules/m3u8-parser/test/fixtures/integration/byteRange.js deleted file mode 100644 index 6be4760..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/byteRange.js +++ /dev/null @@ -1,161 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 587500, - offset: 522828 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 713084, - offset: 1110328 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video2.ts' - }, - { - byterange: { - length: 476580, - offset: 1823412 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 535612, - offset: 2299992 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 207176, - offset: 2835604 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 455900, - offset: 3042780 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 657248, - offset: 3498680 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 571708, - offset: 4155928 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 485040, - offset: 4727636 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 709136, - offset: 5212676 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 730004, - offset: 5921812 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 456276, - offset: 6651816 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 468684, - offset: 7108092 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 444996, - offset: 7576776 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 331444, - offset: 8021772 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 44556, - offset: 8353216 - }, - duration: 1.4167, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - version: 3 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/byteRange.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/byteRange.m3u8 deleted file mode 100644 index 3b1be99..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/byteRange.m3u8 +++ /dev/null @@ -1,56 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:3 -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:587500@522828 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:713084 -hls_450k_video2.ts -#EXTINF:10, -#EXT-X-BYTERANGE:476580@1823412 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:535612@2299992 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:207176@2835604 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:455900@3042780 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:657248@3498680 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:571708@4155928 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:485040@4727636 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:709136@5212676 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:730004@5921812 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:456276@6651816 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:468684@7108092 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:444996@7576776 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:331444@8021772 -hls_450k_video.ts -#EXTINF:1.4167, -#EXT-X-BYTERANGE:44556@8353216 -hls_450k_video.ts -#EXT-X-ENDLIST \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/dateTime.js b/node_modules/m3u8-parser/test/fixtures/integration/dateTime.js deleted file mode 100644 index 698d5a1..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/dateTime.js +++ /dev/null @@ -1,27 +0,0 @@ -module.exports = { - allowCache: false, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - dateTimeString: '2016-06-22T09:20:16.166-04:00', - dateTimeObject: new Date('2016-06-22T09:20:16.166-04:00'), - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - dateTimeString: '2016-06-22T09:20:26.166-04:00', - dateTimeObject: new Date('2016-06-22T09:20:26.166-04:00'), - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - dateTimeString: '2016-06-22T09:20:16.166-04:00', - dateTimeObject: new Date('2016-06-22T09:20:16.166-04:00'), - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/dateTime.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/dateTime.m3u8 deleted file mode 100644 index f3b8f6c..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/dateTime.m3u8 +++ /dev/null @@ -1,12 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-ALLOW-CACHE:NO -#EXT-X-TARGETDURATION:10 -#EXT-X-PROGRAM-DATE-TIME:2016-06-22T09:20:16.166-04:00 -#EXTINF:10 -hls_450k_video.ts -#EXT-X-PROGRAM-DATE-TIME:2016-06-22T09:20:26.166-04:00 -#EXTINF:10 -hls_450k_video.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/diff-init-key.js b/node_modules/m3u8-parser/test/fixtures/integration/diff-init-key.js deleted file mode 100644 index d407939..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/diff-init-key.js +++ /dev/null @@ -1,164 +0,0 @@ -module.exports = { - allowCache: true, - discontinuitySequence: 0, - discontinuityStarts: [], - mediaSequence: 7794, - segments: [ - { - duration: 2.833, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=52' - }, - map: { - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=52' - }, - uri: 'http://media.example.com/init52.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence52-A.m4s' - }, - { - duration: 15, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=52' - }, - map: { - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=52' - }, - uri: 'http://media.example.com/init52.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence52-B.m4s' - }, - { - duration: 13.333, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=52' - }, - map: { - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=52' - }, - uri: 'http://media.example.com/init52.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence52-C.m4s' - }, - { - duration: 15, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=53' - }, - map: { - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=53' - }, - uri: 'http://media.example.com/init53-A.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence53-A.m4s' - }, - { - duration: 14, - key: { - iv: new Uint32Array([0, 0, 331, 3063767524]), - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=53' - }, - map: { - key: { - iv: new Uint32Array([0, 0, 331, 3063767524]), - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=53' - }, - uri: 'http://media.example.com/init53-B.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence53-B.m4s' - }, - { - duration: 12, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=54' - }, - map: { - uri: 'http://media.example.com/init54-A.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence54-A.m4s' - }, - { - duration: 13, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=54' - }, - map: { - uri: 'http://media.example.com/init54-A.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence54-B.m4s' - }, - { - duration: 10, - map: { - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=54' - }, - uri: 'http://media.example.com/init54-B.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence54-A.m4s' - }, - { - duration: 11, - map: { - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=54' - }, - uri: 'http://media.example.com/init54-B.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence54-B.m4s' - }, - { - duration: 4, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=54-b' - }, - map: { - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=54-a' - }, - uri: 'http://media.example.com/init54-D.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence54-A.m4s' - }, - { - duration: 12, - map: { - uri: 'http://media.example.com/init54-E.mp4' - }, - timeline: 0, - uri: 'http://media.example.com/fileSequence54-A.m4s' - } - ], - targetDuration: 15, - version: 7 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/diff-init-key.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/diff-init-key.m3u8 deleted file mode 100644 index 608ca13..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/diff-init-key.m3u8 +++ /dev/null @@ -1,57 +0,0 @@ -#EXTM3U -#EXT-X-VERSION:7 -#EXT-X-MEDIA-SEQUENCE:7794 -#EXT-X-TARGETDURATION:15 - -#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52" -#EXT-X-MAP:URI="http://media.example.com/init52.mp4" - -#EXTINF:2.833, -http://media.example.com/fileSequence52-A.m4s -#EXTINF:15.0, -http://media.example.com/fileSequence52-B.m4s -#EXTINF:13.333, -http://media.example.com/fileSequence52-C.m4s - -#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53" -#EXT-X-MAP:URI="http://media.example.com/init53-A.mp4" - -#EXTINF:15.0, -http://media.example.com/fileSequence53-A.m4s - -#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53",IV=0x00000000000000000000014BB69D61E4 -#EXT-X-MAP:URI="http://media.example.com/init53-B.mp4" - -#EXTINF:14.0, -http://media.example.com/fileSequence53-B.m4s - -#EXT-X-KEY:METHOD=NONE -#EXT-X-MAP:URI="http://media.example.com/init54-A.mp4" -#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=54" - -#EXTINF:12.0, -http://media.example.com/fileSequence54-A.m4s -#EXTINF:13.0, -http://media.example.com/fileSequence54-B.m4s - -#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=54" -#EXT-X-MAP:URI="http://media.example.com/init54-B.mp4" -#EXT-X-KEY:METHOD=NONE - -#EXTINF:10.0, -http://media.example.com/fileSequence54-A.m4s -#EXTINF:11.0, -http://media.example.com/fileSequence54-B.m4s - -#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=54-a" -#EXT-X-MAP:URI="http://media.example.com/init54-D.mp4" -#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=54-b" - -#EXTINF:4.0, -http://media.example.com/fileSequence54-A.m4s - -#EXT-X-KEY:METHOD=NONE -#EXT-X-MAP:URI="http://media.example.com/init54-E.mp4" - -#EXTINF:12.0, -http://media.example.com/fileSequence54-A.m4s diff --git a/node_modules/m3u8-parser/test/fixtures/integration/disallowCache.js b/node_modules/m3u8-parser/test/fixtures/integration/disallowCache.js deleted file mode 100644 index c5433df..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/disallowCache.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - allowCache: false, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - byterange: { - length: 522828, - offset: 0 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - version: 4 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/disallowCache.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/disallowCache.m3u8 deleted file mode 100644 index a3a40f9..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/disallowCache.m3u8 +++ /dev/null @@ -1,10 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:4 -#EXT-X-ALLOW-CACHE:NO -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -#EXT-X-BYTERANGE:522828@0 -hls_450k_video.ts -#EXT-X-ENDLIST \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/disc-sequence.js b/node_modules/m3u8-parser/test/fixtures/integration/disc-sequence.js deleted file mode 100644 index 8ce90fa..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/disc-sequence.js +++ /dev/null @@ -1,32 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - discontinuitySequence: 3, - segments: [ - { - duration: 10, - timeline: 3, - uri: '001.ts' - }, - { - duration: 19, - timeline: 3, - uri: '002.ts' - }, - { - discontinuity: true, - duration: 10, - timeline: 4, - uri: '003.ts' - }, - { - duration: 11, - timeline: 4, - uri: '004.ts' - } - ], - targetDuration: 19, - endList: true, - discontinuityStarts: [2], - version: 3 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/disc-sequence.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/disc-sequence.m3u8 deleted file mode 100644 index 5ac89ba..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/disc-sequence.m3u8 +++ /dev/null @@ -1,15 +0,0 @@ -#EXTM3U -#EXT-X-VERSION:3 -#EXT-X-TARGETDURATION:19 -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-DISCONTINUITY-SEQUENCE:3 -#EXTINF:10,0 -001.ts -#EXTINF:19,0 -002.ts -#EXT-X-DISCONTINUITY -#EXTINF:10,0 -003.ts -#EXTINF:11,0 -004.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/discontinuity.js b/node_modules/m3u8-parser/test/fixtures/integration/discontinuity.js deleted file mode 100644 index 7cdd8df..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/discontinuity.js +++ /dev/null @@ -1,59 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - discontinuitySequence: 0, - segments: [ - { - duration: 10, - timeline: 0, - uri: '001.ts' - }, - { - duration: 19, - timeline: 0, - uri: '002.ts' - }, - { - discontinuity: true, - duration: 10, - timeline: 1, - uri: '003.ts' - }, - { - duration: 11, - timeline: 1, - uri: '004.ts' - }, - { - discontinuity: true, - duration: 10, - timeline: 2, - uri: '005.ts' - }, - { - duration: 10, - timeline: 2, - uri: '006.ts' - }, - { - duration: 10, - timeline: 2, - uri: '007.ts' - }, - { - discontinuity: true, - duration: 10, - timeline: 3, - uri: '008.ts' - }, - { - duration: 16, - timeline: 3, - uri: '009.ts' - } - ], - targetDuration: 19, - endList: true, - discontinuityStarts: [2, 4, 7], - version: 3 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/discontinuity.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/discontinuity.m3u8 deleted file mode 100644 index 46a0cc9..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/discontinuity.m3u8 +++ /dev/null @@ -1,26 +0,0 @@ -#EXTM3U -#EXT-X-VERSION:3 -#EXT-X-TARGETDURATION:19 -#EXT-X-MEDIA-SEQUENCE:0 -#EXTINF:10,0 -001.ts -#EXTINF:19,0 -002.ts -#EXT-X-DISCONTINUITY -#EXTINF:10,0 -003.ts -#EXTINF:11,0 -004.ts -#EXT-X-DISCONTINUITY -#EXTINF:10,0 -005.ts -#EXTINF:10,0 -006.ts -#EXTINF:10,0 -007.ts -#EXT-X-DISCONTINUITY -#EXTINF:10,0 -008.ts -#EXTINF:16,0 -009.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/domainUris.js b/node_modules/m3u8-parser/test/fixtures/integration/domainUris.js deleted file mode 100644 index 06b3524..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/domainUris.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 10, - timeline: 0, - uri: '/00001.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/subdir/00002.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/00003.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/00004.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/domainUris.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/domainUris.m3u8 deleted file mode 100644 index 8134d07..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/domainUris.m3u8 +++ /dev/null @@ -1,12 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-TARGETDURATION:10 -#EXTINF:10, -/00001.ts -#EXTINF:10, -/subdir/00002.ts -#EXTINF:10, -/00003.ts -#EXTINF:10, -/00004.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/empty.js b/node_modules/m3u8-parser/test/fixtures/integration/empty.js deleted file mode 100644 index 4c9fc43..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/empty.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - allowCache: true, - discontinuityStarts: [], - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/empty.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/empty.m3u8 deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/emptyAllowCache.js b/node_modules/m3u8-parser/test/fixtures/integration/emptyAllowCache.js deleted file mode 100644 index 0ecbdc1..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/emptyAllowCache.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - byterange: { - length: 522828, - offset: 0 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - version: 4 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/emptyAllowCache.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/emptyAllowCache.m3u8 deleted file mode 100644 index d9e6bd7..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/emptyAllowCache.m3u8 +++ /dev/null @@ -1,10 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:4 -#EXT-X-ALLOW-CACHE: -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -#EXT-X-BYTERANGE:522828@0 -hls_450k_video.ts -#EXT-X-ENDLIST \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/emptyMediaSequence.js b/node_modules/m3u8-parser/test/fixtures/integration/emptyMediaSequence.js deleted file mode 100644 index d927c98..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/emptyMediaSequence.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 6.64, - timeline: 0, - uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' - }, - { - duration: 6.08, - timeline: 0, - uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' - }, - { - duration: 6.6, - timeline: 0, - uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' - }, - { - duration: 5, - timeline: 0, - uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' - } - ], - targetDuration: 8, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/emptyMediaSequence.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/emptyMediaSequence.m3u8 deleted file mode 100644 index 3c39e87..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/emptyMediaSequence.m3u8 +++ /dev/null @@ -1,14 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MEDIA-SEQUENCE: -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:8 -#EXTINF:6.640,{} -/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts -#EXTINF:6.080,{} -/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts -#EXTINF:6.600,{} -/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts -#EXTINF:5.000,{} -/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/emptyPlaylistType.js b/node_modules/m3u8-parser/test/fixtures/integration/emptyPlaylistType.js deleted file mode 100644 index ebed6e8..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/emptyPlaylistType.js +++ /dev/null @@ -1,40 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - segments: [ - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' - }, - { - duration: 8, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/emptyPlaylistType.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/emptyPlaylistType.m3u8 deleted file mode 100644 index 0396ca4..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/emptyPlaylistType.m3u8 +++ /dev/null @@ -1,16 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE: -#EXT-X-TARGETDURATION:10 -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts -#EXTINF:8, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/emptyTargetDuration.js b/node_modules/m3u8-parser/test/fixtures/integration/emptyTargetDuration.js deleted file mode 100644 index 67b155c..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/emptyTargetDuration.js +++ /dev/null @@ -1,57 +0,0 @@ -module.exports = { - allowCache: true, - playlists: [ - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 240000, - 'RESOLUTION': { - width: 396, - height: 224 - } - }, - timeline: 0, - uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001' - }, - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 40000 - }, - timeline: 0, - uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001' - }, - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 440000, - 'RESOLUTION': { - width: 396, - height: 224 - } - }, - timeline: 0, - uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001' - }, - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 1928000, - 'RESOLUTION': { - width: 960, - height: 540 - } - }, - timeline: 0, - uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001' - } - ], - discontinuityStarts: [], - mediaGroups: { - 'VIDEO': {}, - 'AUDIO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/emptyTargetDuration.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/emptyTargetDuration.m3u8 deleted file mode 100644 index 0bb62a6..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/emptyTargetDuration.m3u8 +++ /dev/null @@ -1,10 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION: -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000,RESOLUTION=396x224 -http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=40000 -http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000,RESOLUTION=396x224 -http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540 -http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/encrypted.js b/node_modules/m3u8-parser/test/fixtures/integration/encrypted.js deleted file mode 100644 index e0ed64c..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/encrypted.js +++ /dev/null @@ -1,61 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 7794, - discontinuitySequence: 0, - discontinuityStarts: [], - segments: [ - { - duration: 2.833, - timeline: 0, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=52' - }, - uri: 'http://media.example.com/fileSequence52-A.ts' - }, - { - duration: 15, - timeline: 0, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=52' - }, - uri: 'http://media.example.com/fileSequence52-B.ts' - }, - { - duration: 13.333, - timeline: 0, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=52' - }, - uri: 'http://media.example.com/fileSequence52-C.ts' - }, - { - duration: 15, - timeline: 0, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=53' - }, - uri: 'http://media.example.com/fileSequence53-A.ts' - }, - { - duration: 14, - timeline: 0, - key: { - method: 'AES-128', - uri: 'https://priv.example.com/key.php?r=54', - iv: new Uint32Array([0, 0, 331, 3063767524]) - }, - uri: 'http://media.example.com/fileSequence53-B.ts' - }, - { - duration: 15, - timeline: 0, - uri: 'http://media.example.com/fileSequence53-B.ts' - } - ], - targetDuration: 15, - version: 3 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/encrypted.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/encrypted.m3u8 deleted file mode 100644 index 2f12209..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/encrypted.m3u8 +++ /dev/null @@ -1,28 +0,0 @@ -#EXTM3U -#EXT-X-VERSION:3 -#EXT-X-MEDIA-SEQUENCE:7794 -#EXT-X-TARGETDURATION:15 - -#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52" - -#EXTINF:2.833, -http://media.example.com/fileSequence52-A.ts -#EXTINF:15.0, -http://media.example.com/fileSequence52-B.ts -#EXTINF:13.333, -http://media.example.com/fileSequence52-C.ts - -#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53" - -#EXTINF:15.0, -http://media.example.com/fileSequence53-A.ts - -#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=54",IV=0x00000000000000000000014BB69D61E4 - -#EXTINF:14.0, -http://media.example.com/fileSequence53-B.ts - -#EXT-X-KEY:METHOD=NONE - -#EXTINF:15.0, -http://media.example.com/fileSequence53-B.ts \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/event.js b/node_modules/m3u8-parser/test/fixtures/integration/event.js deleted file mode 100644 index 57be0d5..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/event.js +++ /dev/null @@ -1,41 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'EVENT', - segments: [ - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' - }, - { - duration: 8, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/event.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/event.m3u8 deleted file mode 100644 index cb6381d..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/event.m3u8 +++ /dev/null @@ -1,16 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:EVENT -#EXT-X-TARGETDURATION:10 -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts -#EXTINF:8, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.js b/node_modules/m3u8-parser/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.js deleted file mode 100644 index bb2eb8b..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.js +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 1, - segments: [ - { - duration: 6.64, - timeline: 0, - uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' - } - ], - targetDuration: 8, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.m3u8 deleted file mode 100644 index f2a777a..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.m3u8 +++ /dev/null @@ -1,8 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:STRING -#EXT-X-MEDIA-SEQUENCE:1 -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:8 -#EXTINF:6.640,{} -/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/extinf.js b/node_modules/m3u8-parser/test/fixtures/integration/extinf.js deleted file mode 100644 index efa8418..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/extinf.js +++ /dev/null @@ -1,165 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - byterange: { - length: 522828, - offset: 0 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 587500, - offset: 522828 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 713084, - offset: 1110328 - }, - duration: 5, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 476580, - offset: 1823412 - }, - duration: 9.7, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 535612, - offset: 2299992 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 207176, - offset: 2835604 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 455900, - offset: 3042780 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 657248, - offset: 3498680 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 571708, - offset: 4155928 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 485040, - offset: 4727636 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 709136, - offset: 5212676 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 730004, - offset: 5921812 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 456276, - offset: 6651816 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 468684, - offset: 7108092 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 444996, - offset: 7576776 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 331444, - offset: 8021772 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 44556, - offset: 8353216 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - version: 3 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/extinf.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/extinf.m3u8 deleted file mode 100644 index d080361..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/extinf.m3u8 +++ /dev/null @@ -1,57 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:3 -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10 -#EXT-X-BYTERANGE:522828@0 -hls_450k_video.ts -#EXTINF:;asljasdfii11)))00, -#EXT-X-BYTERANGE:587500@522828 -hls_450k_video.ts -#EXTINF:5, -#EXT-X-BYTERANGE:713084@1110328 -hls_450k_video.ts -#EXTINF:9.7, -#EXT-X-BYTERANGE:476580@1823412 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:535612@2299992 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:207176@2835604 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:455900@3042780 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:657248@3498680 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:571708@4155928 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:485040@4727636 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:709136@5212676 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:730004@5921812 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:456276@6651816 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:468684@7108092 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:444996@7576776 -hls_450k_video.ts -#EXTINF:22, -#EXTINF:10, -#EXT-X-BYTERANGE:331444@8021772 -hls_450k_video.ts -#EXT-X-BYTERANGE:44556@8353216 -hls_450k_video.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/fmp4.js b/node_modules/m3u8-parser/test/fixtures/integration/fmp4.js deleted file mode 100644 index 5618ab8..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/fmp4.js +++ /dev/null @@ -1,44 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 1, - playlistType: 'VOD', - targetDuration: 6, - discontinuitySequence: 0, - discontinuityStarts: [], - segments: [ - { - byterange: { - length: 5666510, - offset: 720 - }, - duration: 6.006, - timeline: 0, - uri: 'main.mp4', - map: { - byterange: { - length: 720, - offset: 0 - }, - uri: 'main.mp4' - } - }, - { - byterange: { - length: 5861577, - offset: 5667230 - }, - duration: 6.006, - timeline: 0, - uri: 'main.mp4', - map: { - byterange: { - length: 720, - offset: 0 - }, - uri: 'main.mp4' - } - } - ], - endList: true, - version: 7 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/fmp4.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/fmp4.m3u8 deleted file mode 100644 index 8da75c7..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/fmp4.m3u8 +++ /dev/null @@ -1,14 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:6 -#EXT-X-VERSION:7 -#EXT-X-MEDIA-SEQUENCE:1 -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-INDEPENDENT-SEGMENTS -#EXT-X-MAP:URI="main.mp4",BYTERANGE="720@0" -#EXTINF:6.00600, -#EXT-X-BYTERANGE:5666510@720 -main.mp4 -#EXTINF:6.00600, -#EXT-X-BYTERANGE:5861577@5667230 -main.mp4 -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/headerOnly.js b/node_modules/m3u8-parser/test/fixtures/integration/headerOnly.js deleted file mode 100644 index 4c9fc43..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/headerOnly.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - allowCache: true, - discontinuityStarts: [], - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/headerOnly.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/headerOnly.m3u8 deleted file mode 100644 index fcd7187..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/headerOnly.m3u8 +++ /dev/null @@ -1 +0,0 @@ -#EXTM3U diff --git a/node_modules/m3u8-parser/test/fixtures/integration/invalidAllowCache.js b/node_modules/m3u8-parser/test/fixtures/integration/invalidAllowCache.js deleted file mode 100644 index 0ecbdc1..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/invalidAllowCache.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - byterange: { - length: 522828, - offset: 0 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - version: 4 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/invalidAllowCache.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/invalidAllowCache.m3u8 deleted file mode 100644 index 09a1efb..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/invalidAllowCache.m3u8 +++ /dev/null @@ -1,10 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:4 -#EXT-X-ALLOW-CACHE:MAYBE -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -#EXT-X-BYTERANGE:522828@0 -hls_450k_video.ts -#EXT-X-ENDLIST \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/invalidMediaSequence.js b/node_modules/m3u8-parser/test/fixtures/integration/invalidMediaSequence.js deleted file mode 100644 index d927c98..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/invalidMediaSequence.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 6.64, - timeline: 0, - uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' - }, - { - duration: 6.08, - timeline: 0, - uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' - }, - { - duration: 6.6, - timeline: 0, - uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' - }, - { - duration: 5, - timeline: 0, - uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' - } - ], - targetDuration: 8, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/invalidMediaSequence.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/invalidMediaSequence.m3u8 deleted file mode 100644 index e6831f1..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/invalidMediaSequence.m3u8 +++ /dev/null @@ -1,14 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MEDIA-SEQUENCE:gobblegobble -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:8 -#EXTINF:6.640,{} -/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts -#EXTINF:6.080,{} -/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts -#EXTINF:6.600,{} -/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts -#EXTINF:5.000,{} -/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/invalidPlaylistType.js b/node_modules/m3u8-parser/test/fixtures/integration/invalidPlaylistType.js deleted file mode 100644 index ebed6e8..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/invalidPlaylistType.js +++ /dev/null @@ -1,40 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - segments: [ - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' - }, - { - duration: 8, - timeline: 0, - uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/invalidPlaylistType.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/invalidPlaylistType.m3u8 deleted file mode 100644 index 8b95bed..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/invalidPlaylistType.m3u8 +++ /dev/null @@ -1,16 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:asdRASDfasdR -#EXT-X-TARGETDURATION:10 -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts -#EXTINF:10, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts -#EXTINF:8, -/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/invalidTargetDuration.js b/node_modules/m3u8-parser/test/fixtures/integration/invalidTargetDuration.js deleted file mode 100644 index 2d5b5ff..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/invalidTargetDuration.js +++ /dev/null @@ -1,164 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - byterange: { - length: 522828, - offset: 0 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 587500, - offset: 522828 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 713084, - offset: 1110328 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 476580, - offset: 1823412 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 535612, - offset: 2299992 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 207176, - offset: 2835604 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 455900, - offset: 3042780 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 657248, - offset: 3498680 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 571708, - offset: 4155928 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 485040, - offset: 4727636 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 709136, - offset: 5212676 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 730004, - offset: 5921812 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 456276, - offset: 6651816 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 468684, - offset: 7108092 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 444996, - offset: 7576776 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 331444, - offset: 8021772 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 44556, - offset: 8353216 - }, - duration: 1.4167, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - version: 4 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/invalidTargetDuration.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/invalidTargetDuration.m3u8 deleted file mode 100644 index 28b043b..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/invalidTargetDuration.m3u8 +++ /dev/null @@ -1,57 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:NaN -#EXT-X-VERSION:4 -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -#EXT-X-BYTERANGE:522828@0 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:587500@522828 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:713084@1110328 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:476580@1823412 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:535612@2299992 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:207176@2835604 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:455900@3042780 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:657248@3498680 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:571708@4155928 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:485040@4727636 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:709136@5212676 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:730004@5921812 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:456276@6651816 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:468684@7108092 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:444996@7576776 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:331444@8021772 -hls_450k_video.ts -#EXTINF:1.4167, -#EXT-X-BYTERANGE:44556@8353216 -hls_450k_video.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/liveMissingSegmentDuration.js b/node_modules/m3u8-parser/test/fixtures/integration/liveMissingSegmentDuration.js deleted file mode 100644 index 3dafc55..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/liveMissingSegmentDuration.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 6.64, - timeline: 0, - uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' - }, - { - duration: 8, - timeline: 0, - uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' - }, - { - duration: 8, - timeline: 0, - uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' - } - ], - targetDuration: 8, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/liveMissingSegmentDuration.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/liveMissingSegmentDuration.m3u8 deleted file mode 100644 index eef755d..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/liveMissingSegmentDuration.m3u8 +++ /dev/null @@ -1,9 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:8 -#EXTINF:6.640,{} -/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts -/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts -/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts diff --git a/node_modules/m3u8-parser/test/fixtures/integration/liveStart30sBefore.js b/node_modules/m3u8-parser/test/fixtures/integration/liveStart30sBefore.js deleted file mode 100644 index de41765..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/liveStart30sBefore.js +++ /dev/null @@ -1,54 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - segments: [ - { - duration: 10, - timeline: 0, - uri: '001.ts' - }, - { - duration: 19, - timeline: 0, - uri: '002.ts' - }, - { - duration: 10, - timeline: 0, - uri: '003.ts' - }, - { - duration: 11, - timeline: 0, - uri: '004.ts' - }, - { - duration: 10, - timeline: 0, - uri: '005.ts' - }, - { - duration: 10, - timeline: 0, - uri: '006.ts' - }, - { - duration: 10, - timeline: 0, - uri: '007.ts' - }, - { - duration: 10, - timeline: 0, - uri: '008.ts' - }, - { - duration: 16, - timeline: 0, - uri: '009.ts' - } - ], - targetDuration: 10, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/liveStart30sBefore.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/liveStart30sBefore.m3u8 deleted file mode 100644 index 79abf59..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/liveStart30sBefore.m3u8 +++ /dev/null @@ -1,22 +0,0 @@ -#EXTM3U -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:10 -#EXTINF:10,0 -001.ts -#EXTINF:19,0 -002.ts -#EXTINF:10,0 -003.ts -#EXTINF:11,0 -004.ts -#EXTINF:10,0 -005.ts -#EXTINF:10,0 -006.ts -#EXTINF:10,0 -007.ts -#EXTINF:10,0 -008.ts -#EXTINF:16,0 -009.ts \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/llhls-byte-range.js b/node_modules/m3u8-parser/test/fixtures/integration/llhls-byte-range.js deleted file mode 100644 index 52e6e02..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/llhls-byte-range.js +++ /dev/null @@ -1,253 +0,0 @@ -module.exports = { - allowCache: true, - discontinuitySequence: 0, - discontinuityStarts: [], - mediaSequence: 0, - playlistType: 'VOD', - preloadSegment: { - preloadHints: [ - { - type: 'PART', - uri: 'filePart273.1.mp4', - byterange: { - length: 2000, - offset: 0 - } - }, - { - type: 'MAP', - uri: 'file-init.mp4', - byterange: { - length: 5000, - offset: 8355216 - } - }, - { - type: 'FOO', - uri: 'foo.mp4', - byterange: { - length: 5000, - offset: 0 - } - } - ], - timeline: 0 - }, - segments: [ - { - byterange: { - length: 587500, - offset: 0 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 587500, - offset: 522828 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 713084, - offset: 1110328 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video2.ts' - }, - { - byterange: { - length: 476580, - offset: 1823412 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 535612, - offset: 2299992 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 207176, - offset: 2835604 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 455900, - offset: 3042780 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 657248, - offset: 3498680 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 571708, - offset: 4155928 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 485040, - offset: 4727636 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 709136, - offset: 5212676 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 730004, - offset: 5921812 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 456276, - offset: 6651816 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 468684, - offset: 7108092 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 444996, - offset: 7576776 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 331444, - offset: 8021772 - }, - duration: 10, - parts: [ - { - duration: 0.33334, - uri: 'hls_450k_video.part.ts', - byterange: { - length: 45553, - offset: 0 - } - }, - { - duration: 0.33334, - uri: 'hls_450k_video.part.ts', - byterange: { - length: 28823, - offset: 7622329 - } - }, - { - duration: 0.33334, - uri: 'hls_450k_video.part.ts', - byterange: { - length: 22444, - offset: 7651152 - } - }, - { - duration: 0.33334, - uri: 'hls_450k_video.part.ts', - byterange: { - length: 22444, - offset: 7673596 - } - } - ], - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 44556, - offset: 8353216 - }, - duration: 1.4167, - parts: [ - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 45553, - offset: 8021772 - } - }, - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 28823, - offset: 8067325 - } - }, - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 22444, - offset: 8096148 - } - } - ], - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - version: 3 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/llhls-byte-range.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/llhls-byte-range.m3u8 deleted file mode 100644 index 15b18f7..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/llhls-byte-range.m3u8 +++ /dev/null @@ -1,66 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:3 -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -#EXT-X-BYTERANGE:587500@ -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:587500@522828 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:713084 -hls_450k_video2.ts -#EXTINF:10, -#EXT-X-BYTERANGE:476580@1823412 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:535612@2299992 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:207176@2835604 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:455900@3042780 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:657248@3498680 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:571708@4155928 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:485040@4727636 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:709136@5212676 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:730004@5921812 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:456276@6651816 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:468684@7108092 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:444996@7576776 -hls_450k_video.ts -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.part.ts",BYTERANGE=45553 -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.part.ts",BYTERANGE=28823@7622329 -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.part.ts",BYTERANGE=22444 -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.part.ts",BYTERANGE=22444 -#EXTINF:10, -#EXT-X-BYTERANGE:331444@8021772 -hls_450k_video.ts -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=45553@8021772 -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=28823 -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=22444 -#EXTINF:1.4167, -#EXT-X-BYTERANGE:44556@8353216 -hls_450k_video.ts -#EXT-X-PRELOAD-HINT:TYPE=PART,URI="filePart273.1.mp4",BYTERANGE-LENGTH=2000 -#EXT-X-PRELOAD-HINT:TYPE=MAP,URI="file-init.mp4",BYTERANGE-LENGTH=5000,BYTERANGE-START=8355216 -#EXT-X-PRELOAD-HINT:TYPE=FOO,URI="foo.mp4",BYTERANGE-LENGTH=5000 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/llhls-delta-byte-range.js b/node_modules/m3u8-parser/test/fixtures/integration/llhls-delta-byte-range.js deleted file mode 100644 index 908f4ca..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/llhls-delta-byte-range.js +++ /dev/null @@ -1,149 +0,0 @@ -module.exports = { - allowCache: true, - discontinuitySequence: 0, - discontinuityStarts: [], - mediaSequence: 0, - playlistType: 'VOD', - preloadSegment: { - parts: [ - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 22444, - offset: 0 - } - } - ], - preloadHints: [ - { - type: 'PART', - uri: 'filePart273.1.mp4', - byterange: { - length: 2000, - offset: 22444 - } - }, - { - type: 'MAP', - uri: 'file-init.mp4', - byterange: { - length: 5000, - offset: 8377660 - } - }, - { - type: 'FOO', - uri: 'foo.mp4', - byterange: { - length: 5000, - offset: 0 - } - } - ], - timeline: 0 - }, - segments: [ - { - byterange: { - length: 468684, - offset: 7108092 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 444996, - offset: 7576776 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 331444, - offset: 8021772 - }, - duration: 10, - parts: [ - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 45553, - offset: 0 - } - }, - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 28823, - offset: 7622329 - } - }, - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 22444, - offset: 7651152 - } - }, - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 22444, - offset: 7673596 - } - } - ], - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 44556, - offset: 8353216 - }, - duration: 1.4167, - parts: [ - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 45553, - offset: 8021772 - } - }, - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 28823, - offset: 8067325 - } - }, - { - duration: 0.33334, - uri: 'hls_450k_video.ts', - byterange: { - length: 22444, - offset: 8096148 - } - } - ], - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - skip: { - skippedSegments: 3 - }, - targetDuration: 10, - version: 3 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/llhls-delta-byte-range.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/llhls-delta-byte-range.m3u8 deleted file mode 100644 index d884ccc..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/llhls-delta-byte-range.m3u8 +++ /dev/null @@ -1,30 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:3 -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -#EXT-X-SKIP:SKIPPED-SEGMENTS=3 -#EXTINF:10, -#EXT-X-BYTERANGE:468684@7108092 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:444996@7576776 -hls_450k_video.ts -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=45553 -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=28823@7622329 -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=22444 -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=22444 -#EXTINF:10, -#EXT-X-BYTERANGE:331444@8021772 -hls_450k_video.ts -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=45553@8021772 -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=28823 -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=22444 -#EXTINF:1.4167, -#EXT-X-BYTERANGE:44556@8353216 -hls_450k_video.ts -#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=22444 -#EXT-X-PRELOAD-HINT:TYPE=PART,URI="filePart273.1.mp4",BYTERANGE-LENGTH=2000 -#EXT-X-PRELOAD-HINT:TYPE=MAP,URI="file-init.mp4",BYTERANGE-LENGTH=5000,BYTERANGE-START=8377660 -#EXT-X-PRELOAD-HINT:TYPE=FOO,URI="foo.mp4",BYTERANGE-LENGTH=5000 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/llhls.js b/node_modules/m3u8-parser/test/fixtures/integration/llhls.js deleted file mode 100644 index 5358830..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/llhls.js +++ /dev/null @@ -1,214 +0,0 @@ -module.exports = { - allowCache: true, - dateTimeObject: new Date('2019-02-14T02:13:36.106Z'), - dateTimeString: '2019-02-14T02:13:36.106Z', - discontinuitySequence: 0, - discontinuityStarts: [], - mediaSequence: 266, - preloadSegment: { - map: {uri: 'init.mp4'}, - parts: [ - { - duration: 0.33334, - independent: true, - uri: 'filePart273.0.mp4' - }, - { - duration: 0.33334, - uri: 'filePart273.1.mp4' - }, - { - duration: 0.33334, - uri: 'filePart273.2.mp4' - } - ], - preloadHints: [ - {type: 'PART', uri: 'filePart273.3.mp4'}, - {type: 'MAP', uri: 'file-init.mp4'} - ], - timeline: 0 - }, - renditionReports: [ - {lastMsn: 273, lastPart: 2, uri: '../1M/waitForMSN.php'}, - {lastMsn: 273, lastPart: 1, uri: '../4M/waitForMSN.php'} - ], - partInf: { - partTarget: 0.33334 - }, - partTargetDuration: 0.33334, - segments: [ - { - dateTimeObject: new Date('2019-02-14T02:13:36.106Z'), - dateTimeString: '2019-02-14T02:13:36.106Z', - duration: 4.00008, - map: { - uri: 'init.mp4' - }, - timeline: 0, - uri: 'fileSequence266.mp4' - }, - { - duration: 4.00008, - map: { - uri: 'init.mp4' - }, - timeline: 0, - uri: 'fileSequence267.mp4' - }, - { - duration: 4.00008, - map: { - uri: 'init.mp4' - }, - timeline: 0, - uri: 'fileSequence268.mp4' - }, - { - duration: 4.00008, - map: { - uri: 'init.mp4' - }, - timeline: 0, - uri: 'fileSequence269.mp4' - }, - { - duration: 4.00008, - map: { - uri: 'init.mp4' - }, - timeline: 0, - uri: 'fileSequence270.mp4' - }, - { - duration: 4.00008, - map: { - uri: 'init.mp4' - }, - timeline: 0, - uri: 'fileSequence271.mp4', - parts: [ - { - duration: 0.33334, - uri: 'filePart271.0.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.1.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.2.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.3.mp4' - }, - { - duration: 0.33334, - independent: true, - uri: 'filePart271.4.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.5.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.6.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.7.mp4' - }, - { - duration: 0.33334, - independent: true, - uri: 'filePart271.8.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.9.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.10.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.11.mp4' - } - ] - }, - { - dateTimeObject: new Date('2019-02-14T02:14:00.106Z'), - dateTimeString: '2019-02-14T02:14:00.106Z', - duration: 4.00008, - map: { - uri: 'init.mp4' - }, - timeline: 0, - uri: 'fileSequence272.mp4', - parts: [ - { - duration: 0.33334, - gap: true, - uri: 'filePart272.a.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.b.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.c.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.d.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.e.mp4' - }, - { - duration: 0.33334, - independent: true, - uri: 'filePart272.f.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.g.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.h.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.i.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.j.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.k.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.l.mp4' - } - ] - } - ], - serverControl: { - canSkipDateranges: true, - canBlockReload: true, - canSkipUntil: 12, - partHoldBack: 1, - holdBack: 12 - }, - targetDuration: 4, - version: 6 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/llhls.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/llhls.m3u8 deleted file mode 100644 index 40fe352..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/llhls.m3u8 +++ /dev/null @@ -1,56 +0,0 @@ -#EXTM3U -# This Playlist is a response to: GET https://example.com/2M/waitForMSN.php?_HLS_msn=273&_HLS_part=2 -#EXT-X-TARGETDURATION:4 -#EXT-X-VERSION:6 -#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,CAN-SKIP-DATERANGES=YES,PART-HOLD-BACK=1.0,CAN-SKIP-UNTIL=12.0,HOLD-BACK=12.0 -#EXT-X-PART-INF:PART-TARGET=0.33334 -#EXT-X-MEDIA-SEQUENCE:266 -#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:13:36.106Z -#EXT-X-MAP:URI="init.mp4" -#EXTINF:4.00008, -fileSequence266.mp4 -#EXTINF:4.00008, -fileSequence267.mp4 -#EXTINF:4.00008, -fileSequence268.mp4 -#EXTINF:4.00008, -fileSequence269.mp4 -#EXTINF:4.00008, -fileSequence270.mp4 -#EXT-X-PART:DURATION=0.33334,URI="filePart271.0.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.1.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.2.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.3.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.4.mp4",INDEPENDENT=YES -#EXT-X-PART:DURATION=0.33334,URI="filePart271.5.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.6.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.7.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.8.mp4",INDEPENDENT=YES -#EXT-X-PART:DURATION=0.33334,URI="filePart271.9.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.10.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.11.mp4" -#EXTINF:4.00008, -fileSequence271.mp4 -#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:14:00.106Z -#EXT-X-PART:GAP=YES,DURATION=0.33334,URI="filePart272.a.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.b.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.c.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.d.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.e.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.f.mp4",INDEPENDENT=YES -#EXT-X-PART:DURATION=0.33334,URI="filePart272.g.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.h.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.i.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.j.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.k.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.l.mp4" -#EXTINF:4.00008, -fileSequence272.mp4 -#EXT-X-PART:DURATION=0.33334,URI="filePart273.0.mp4",INDEPENDENT=YES -#EXT-X-PART:DURATION=0.33334,URI="filePart273.1.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart273.2.mp4" -#EXT-X-PRELOAD-HINT:TYPE=PART,URI="filePart273.3.mp4" -#EXT-X-PRELOAD-HINT:TYPE=MAP,URI="file-init.mp4" - -#EXT-X-RENDITION-REPORT:URI="../1M/waitForMSN.php",LAST-MSN=273,LAST-PART=2 -#EXT-X-RENDITION-REPORT:URI="../4M/waitForMSN.php",LAST-MSN=273,LAST-PART=1 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/llhlsDelta.js b/node_modules/m3u8-parser/test/fixtures/integration/llhlsDelta.js deleted file mode 100644 index 089b723..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/llhlsDelta.js +++ /dev/null @@ -1,186 +0,0 @@ -module.exports = { - allowCache: true, - dateTimeObject: new Date('2019-02-14T02:14:00.106Z'), - dateTimeString: '2019-02-14T02:14:00.106Z', - discontinuitySequence: 0, - discontinuityStarts: [], - mediaSequence: 266, - preloadSegment: { - timeline: 0, - preloadHints: [ - {type: 'PART', uri: 'filePart273.4.mp4'}, - {type: 'MAP', uri: 'file-init.mp4'} - ], - parts: [ - { - duration: 0.33334, - independent: true, - uri: 'filePart273.0.mp4' - }, - { - duration: 0.33334, - uri: 'filePart273.1.mp4' - }, - { - duration: 0.33334, - uri: 'filePart273.2.mp4' - }, - { - duration: 0.33334, - uri: 'filePart273.3.mp4' - } - ] - }, - renditionReports: [ - {lastMsn: 273, lastPart: 3, uri: '../1M/waitForMSN.php'}, - {lastMsn: 273, lastPart: 3, uri: '../4M/waitForMSN.php'} - ], - partInf: { - partTarget: 0.33334 - }, - partTargetDuration: 0.33334, - segments: [ - { - duration: 4.00008, - timeline: 0, - uri: 'fileSequence269.mp4' - }, - { - duration: 4.00008, - timeline: 0, - uri: 'fileSequence270.mp4' - }, - { - duration: 4.00008, - timeline: 0, - uri: 'fileSequence271.mp4', - parts: [ - { - duration: 0.33334, - uri: 'filePart271.0.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.1.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.2.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.3.mp4' - }, - { - duration: 0.33334, - independent: true, - uri: 'filePart271.4.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.5.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.6.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.7.mp4' - }, - { - duration: 0.33334, - independent: true, - uri: 'filePart271.8.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.9.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.10.mp4' - }, - { - duration: 0.33334, - uri: 'filePart271.11.mp4' - } - ] - }, - { - dateTimeObject: new Date('2019-02-14T02:14:00.106Z'), - dateTimeString: '2019-02-14T02:14:00.106Z', - duration: 4.00008, - timeline: 0, - uri: 'fileSequence272.mp4', - parts: [ - { - duration: 0.33334, - gap: true, - uri: 'filePart272.a.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.b.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.c.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.d.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.e.mp4' - }, - { - duration: 0.33334, - independent: true, - uri: 'filePart272.f.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.g.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.h.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.i.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.j.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.k.mp4' - }, - { - duration: 0.33334, - uri: 'filePart272.l.mp4' - } - ] - } - ], - skip: { - skippedSegments: 3, - recentlyRemovedDateranges: [ - 'foo', - 'bar' - ] - }, - serverControl: { - canSkipDateranges: true, - canBlockReload: true, - canSkipUntil: 12, - partHoldBack: 1, - holdBack: 12 - }, - targetDuration: 4, - version: 9 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/llhlsDelta.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/llhlsDelta.m3u8 deleted file mode 100644 index 2aedcdb..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/llhlsDelta.m3u8 +++ /dev/null @@ -1,50 +0,0 @@ -#EXTM3U -# Following the example above, this Playlist is a response to: GET https://example.com/2M/waitForMSN.php?_HLS_msn=273&_HLS_part=3 &_HLS_skip=YES -#EXT-X-TARGETDURATION:4 -#EXT-X-VERSION:9 -#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,CAN-SKIP-DATERANGES=YES,PART-HOLD-BACK=1.0,CAN-SKIP-UNTIL=12.0,HOLD-BACK=12.0 -#EXT-X-PART-INF:PART-TARGET=0.33334 -#EXT-X-MEDIA-SEQUENCE:266 -#EXT-X-SKIP:SKIPPED-SEGMENTS=3,RECENTLY-REMOVED-DATERANGES=foo bar -#EXTINF:4.00008, -fileSequence269.mp4 -#EXTINF:4.00008, -fileSequence270.mp4 -#EXT-X-PART:DURATION=0.33334,URI="filePart271.0.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.1.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.2.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.3.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.4.mp4",INDEPENDENT=YES -#EXT-X-PART:DURATION=0.33334,URI="filePart271.5.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.6.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.7.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.8.mp4",INDEPENDENT=YES -#EXT-X-PART:DURATION=0.33334,URI="filePart271.9.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.10.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart271.11.mp4" -#EXTINF:4.00008, -fileSequence271.mp4 -#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:14:00.106Z -#EXT-X-PART:GAP=YES,DURATION=0.33334,URI="filePart272.a.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.b.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.c.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.d.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.e.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.f.mp4",INDEPENDENT=YES -#EXT-X-PART:DURATION=0.33334,URI="filePart272.g.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.h.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.i.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.j.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.k.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart272.l.mp4" -#EXTINF:4.00008, -fileSequence272.mp4 -#EXT-X-PART:DURATION=0.33334,URI="filePart273.0.mp4",INDEPENDENT=YES -#EXT-X-PART:DURATION=0.33334,URI="filePart273.1.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart273.2.mp4" -#EXT-X-PART:DURATION=0.33334,URI="filePart273.3.mp4" -#EXT-X-PRELOAD-HINT:TYPE=PART,URI="filePart273.4.mp4" -#EXT-X-PRELOAD-HINT:TYPE=MAP,URI="file-init.mp4" - -#EXT-X-RENDITION-REPORT:URI="../1M/waitForMSN.php",LAST-MSN=273,LAST-PART=3 -#EXT-X-RENDITION-REPORT:URI="../4M/waitForMSN.php",LAST-MSN=273,LAST-PART=3 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/manifestExtTTargetdurationNegative.js b/node_modules/m3u8-parser/test/fixtures/integration/manifestExtTTargetdurationNegative.js deleted file mode 100644 index cfdf211..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/manifestExtTTargetdurationNegative.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - segments: [ - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/gogo/00001.ts' - } - ], - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/manifestExtTTargetdurationNegative.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/manifestExtTTargetdurationNegative.m3u8 deleted file mode 100644 index 7b3d10e..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/manifestExtTTargetdurationNegative.m3u8 +++ /dev/null @@ -1,5 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:-10 -#EXTINF:10, -/test/ts-files/zencoder/gogo/00001.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/manifestExtXEndlistEarly.js b/node_modules/m3u8-parser/test/fixtures/integration/manifestExtXEndlistEarly.js deleted file mode 100644 index 69b5bc6..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/manifestExtXEndlistEarly.js +++ /dev/null @@ -1,35 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - segments: [ - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/gogo/00001.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/gogo/00002.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/gogo/00003.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/gogo/00004.ts' - }, - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/gogo/00005.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/manifestExtXEndlistEarly.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/manifestExtXEndlistEarly.m3u8 deleted file mode 100644 index dd19745..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/manifestExtXEndlistEarly.m3u8 +++ /dev/null @@ -1,14 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXTINF:10, -/test/ts-files/zencoder/gogo/00001.ts -#EXTINF:10, -/test/ts-files/zencoder/gogo/00002.ts -#EXTINF:10, -/test/ts-files/zencoder/gogo/00003.ts -#EXT-X-ENDLIST -#EXTINF:10, -/test/ts-files/zencoder/gogo/00004.ts -#EXTINF:10, -/test/ts-files/zencoder/gogo/00005.ts - diff --git a/node_modules/m3u8-parser/test/fixtures/integration/manifestNoExtM3u.js b/node_modules/m3u8-parser/test/fixtures/integration/manifestNoExtM3u.js deleted file mode 100644 index d041da0..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/manifestNoExtM3u.js +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - segments: [ - { - duration: 10, - timeline: 0, - uri: '/test/ts-files/zencoder/gogo/00001.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/manifestNoExtM3u.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/manifestNoExtM3u.m3u8 deleted file mode 100644 index 2058c16..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/manifestNoExtM3u.m3u8 +++ /dev/null @@ -1,4 +0,0 @@ -#EXT-X-TARGETDURATION:10 -#EXTINF:10, -/test/ts-files/zencoder/gogo/00001.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/master-fmp4.js b/node_modules/m3u8-parser/test/fixtures/integration/master-fmp4.js deleted file mode 100644 index 1c45e52..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/master-fmp4.js +++ /dev/null @@ -1,465 +0,0 @@ -module.exports = { - allowCache: true, - discontinuityStarts: [], - mediaGroups: { - 'AUDIO': { - aud1: { - English: { - autoselect: true, - default: true, - language: 'eng', - uri: 'a1/prog_index.m3u8' - } - }, - aud2: { - English: { - autoselect: true, - default: true, - language: 'eng', - uri: 'a2/prog_index.m3u8' - } - }, - aud3: { - English: { - autoselect: true, - default: true, - language: 'eng', - uri: 'a3/prog_index.m3u8' - } - } - }, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': { - cc1: { - English: { - autoselect: true, - default: true, - language: 'eng', - instreamId: 'CC1' - } - } - }, - 'SUBTITLES': { - sub1: { - English: { - autoselect: true, - default: true, - language: 'eng', - uri: 's1/eng/prog_index.m3u8', - forced: false - } - } - } - }, - playlists: [{ - attributes: { - 'AVERAGE-BANDWIDTH': '2165224', - 'BANDWIDTH': 2215219, - 'CODECS': 'avc1.640020,mp4a.40.2', - 'RESOLUTION': { - width: 960, - height: 540 - }, - 'FRAME-RATE': '59.940', - 'CLOSED-CAPTIONS': 'cc1', - 'AUDIO': 'aud1', - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v4/prog_index.m3u8' - }, - - { - attributes: { - 'AUDIO': 'aud1', - 'AVERAGE-BANDWIDTH': '7962844', - 'BANDWIDTH': 7976430, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64002a,mp4a.40.2', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 1080, - width: 1920 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v8/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud1', - 'AVERAGE-BANDWIDTH': '6165024', - 'BANDWIDTH': 6181885, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64002a,mp4a.40.2', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 1080, - width: 1920 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v7/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud1', - 'AVERAGE-BANDWIDTH': '4664459', - 'BANDWIDTH': 4682666, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64002a,mp4a.40.2', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 1080, - width: 1920 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v6/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud1', - 'AVERAGE-BANDWIDTH': '3164759', - 'BANDWIDTH': 3170746, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.640020,mp4a.40.2', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 720, - width: 1280 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v5/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud1', - 'AVERAGE-BANDWIDTH': '1262552', - 'BANDWIDTH': 1276223, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64001e,mp4a.40.2', - 'FRAME-RATE': '29.970', - 'RESOLUTION': { - height: 432, - width: 768 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v3/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud1', - 'AVERAGE-BANDWIDTH': '893243', - 'BANDWIDTH': 904744, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64001e,mp4a.40.2', - 'FRAME-RATE': '29.970', - 'RESOLUTION': { - height: 360, - width: 640 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v2/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud1', - 'AVERAGE-BANDWIDTH': '527673', - 'BANDWIDTH': 538201, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.640015,mp4a.40.2', - 'FRAME-RATE': '29.970', - 'RESOLUTION': { - height: 270, - width: 480 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v1/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud2', - 'AVERAGE-BANDWIDTH': '2390334', - 'BANDWIDTH': 2440329, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.640020,ac-3', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 540, - width: 960 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v4/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud2', - 'AVERAGE-BANDWIDTH': '8187954', - 'BANDWIDTH': 8201540, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64002a,ac-3', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 1080, - width: 1920 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v8/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud2', - 'AVERAGE-BANDWIDTH': '6390134', - 'BANDWIDTH': 6406995, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64002a,ac-3', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 1080, - width: 1920 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v7/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud2', - 'AVERAGE-BANDWIDTH': '4889569', - 'BANDWIDTH': 4907776, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64002a,ac-3', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 1080, - width: 1920 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v6/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud2', - 'AVERAGE-BANDWIDTH': '3389869', - 'BANDWIDTH': 3395856, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.640020,ac-3', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 720, - width: 1280 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v5/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud2', - 'AVERAGE-BANDWIDTH': '1487662', - 'BANDWIDTH': 1501333, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64001e,ac-3', - 'FRAME-RATE': '29.970', - 'RESOLUTION': { - height: 432, - width: 768 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v3/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud2', - 'AVERAGE-BANDWIDTH': '1118353', - 'BANDWIDTH': 1129854, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64001e,ac-3', - 'FRAME-RATE': '29.970', - 'RESOLUTION': { - height: 360, - width: 640 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v2/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud2', - 'AVERAGE-BANDWIDTH': '752783', - 'BANDWIDTH': 763311, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.640015,ac-3', - 'FRAME-RATE': '29.970', - 'RESOLUTION': { - height: 270, - width: 480 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v1/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud3', - 'AVERAGE-BANDWIDTH': '2198334', - 'BANDWIDTH': 2248329, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.640020,ec-3', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 540, - width: 960 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v4/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud3', - 'AVERAGE-BANDWIDTH': '7995954', - 'BANDWIDTH': 8009540, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64002a,ec-3', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 1080, - width: 1920 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v8/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud3', - 'AVERAGE-BANDWIDTH': '6198134', - 'BANDWIDTH': 6214995, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64002a,ec-3', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 1080, - width: 1920 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v7/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud3', - 'AVERAGE-BANDWIDTH': '4697569', - 'BANDWIDTH': 4715776, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64002a,ec-3', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 1080, - width: 1920 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v6/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud3', - 'AVERAGE-BANDWIDTH': '3197869', - 'BANDWIDTH': 3203856, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.640020,ec-3', - 'FRAME-RATE': '59.940', - 'RESOLUTION': { - height: 720, - width: 1280 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v5/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud3', - 'AVERAGE-BANDWIDTH': '1295662', - 'BANDWIDTH': 1309333, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64001e,ec-3', - 'FRAME-RATE': '29.970', - 'RESOLUTION': { - height: 432, - width: 768 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v3/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud3', - 'AVERAGE-BANDWIDTH': '926353', - 'BANDWIDTH': 937854, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.64001e,ec-3', - 'FRAME-RATE': '29.970', - 'RESOLUTION': { - height: 360, - width: 640 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v2/prog_index.m3u8' - }, - { - attributes: { - 'AUDIO': 'aud3', - 'AVERAGE-BANDWIDTH': '560783', - 'BANDWIDTH': 571311, - 'CLOSED-CAPTIONS': 'cc1', - 'CODECS': 'avc1.640015,ec-3', - 'FRAME-RATE': '29.970', - 'RESOLUTION': { - height: 270, - width: 480 - }, - 'SUBTITLES': 'sub1' - }, - timeline: 0, - uri: 'v1/prog_index.m3u8' - }], - segments: [], - version: 6 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/master-fmp4.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/master-fmp4.m3u8 deleted file mode 100644 index 8646943..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/master-fmp4.m3u8 +++ /dev/null @@ -1,76 +0,0 @@ -#EXTM3U -#EXT-X-VERSION:6 -#EXT-X-INDEPENDENT-SEGMENTS - - -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud1",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="a1/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud2",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="a2/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud3",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="a3/prog_index.m3u8" - - -#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="sub1",NAME="English",LANGUAGE="eng",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,URI="s1/eng/prog_index.m3u8" - - -#EXT-X-MEDIA:TYPE=CLOSED-CAPTIONS,GROUP-ID="cc1",NAME="English",LANGUAGE="eng",DEFAULT=YES,AUTOSELECT=YES,INSTREAM-ID="CC1" - - -#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=163198,BANDWIDTH=166942,CODECS="avc1.64002a",RESOLUTION=1920x1080,URI="v6/iframe_index.m3u8" -#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=131314,BANDWIDTH=139041,CODECS="avc1.640020",RESOLUTION=1280x720,URI="v5/iframe_index.m3u8" -#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=100233,BANDWIDTH=101724,CODECS="avc1.640020",RESOLUTION=960x540,URI="v4/iframe_index.m3u8" -#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=81002,BANDWIDTH=84112,CODECS="avc1.64001e",RESOLUTION=768x432,URI="v3/iframe_index.m3u8" -#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=64987,BANDWIDTH=65835,CODECS="avc1.64001e",RESOLUTION=640x360,URI="v2/iframe_index.m3u8" -#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=41547,BANDWIDTH=42106,CODECS="avc1.640015",RESOLUTION=480x270,URI="v1/iframe_index.m3u8" - - -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2165224,BANDWIDTH=2215219,CODECS="avc1.640020,mp4a.40.2",RESOLUTION=960x540,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" -v4/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=7962844,BANDWIDTH=7976430,CODECS="avc1.64002a,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" -v8/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6165024,BANDWIDTH=6181885,CODECS="avc1.64002a,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" -v7/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4664459,BANDWIDTH=4682666,CODECS="avc1.64002a,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" -v6/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3164759,BANDWIDTH=3170746,CODECS="avc1.640020,mp4a.40.2",RESOLUTION=1280x720,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" -v5/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1262552,BANDWIDTH=1276223,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=768x432,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" -v3/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=893243,BANDWIDTH=904744,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" -v2/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=527673,BANDWIDTH=538201,CODECS="avc1.640015,mp4a.40.2",RESOLUTION=480x270,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" -v1/prog_index.m3u8 - - -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2390334,BANDWIDTH=2440329,CODECS="avc1.640020,ac-3",RESOLUTION=960x540,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" -v4/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=8187954,BANDWIDTH=8201540,CODECS="avc1.64002a,ac-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" -v8/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6390134,BANDWIDTH=6406995,CODECS="avc1.64002a,ac-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" -v7/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4889569,BANDWIDTH=4907776,CODECS="avc1.64002a,ac-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" -v6/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3389869,BANDWIDTH=3395856,CODECS="avc1.640020,ac-3",RESOLUTION=1280x720,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" -v5/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1487662,BANDWIDTH=1501333,CODECS="avc1.64001e,ac-3",RESOLUTION=768x432,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" -v3/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1118353,BANDWIDTH=1129854,CODECS="avc1.64001e,ac-3",RESOLUTION=640x360,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" -v2/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=752783,BANDWIDTH=763311,CODECS="avc1.640015,ac-3",RESOLUTION=480x270,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" -v1/prog_index.m3u8 - - -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2198334,BANDWIDTH=2248329,CODECS="avc1.640020,ec-3",RESOLUTION=960x540,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" -v4/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=7995954,BANDWIDTH=8009540,CODECS="avc1.64002a,ec-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" -v8/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6198134,BANDWIDTH=6214995,CODECS="avc1.64002a,ec-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" -v7/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4697569,BANDWIDTH=4715776,CODECS="avc1.64002a,ec-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" -v6/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3197869,BANDWIDTH=3203856,CODECS="avc1.640020,ec-3",RESOLUTION=1280x720,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" -v5/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1295662,BANDWIDTH=1309333,CODECS="avc1.64001e,ec-3",RESOLUTION=768x432,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" -v3/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=926353,BANDWIDTH=937854,CODECS="avc1.64001e,ec-3",RESOLUTION=640x360,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" -v2/prog_index.m3u8 -#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=560783,BANDWIDTH=571311,CODECS="avc1.640015,ec-3",RESOLUTION=480x270,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" -v1/prog_index.m3u8 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/master.js b/node_modules/m3u8-parser/test/fixtures/integration/master.js deleted file mode 100644 index 62cedc5..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/master.js +++ /dev/null @@ -1,57 +0,0 @@ -module.exports = { - allowCache: true, - playlists: [ - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 240000, - 'RESOLUTION': { - width: 396, - height: 224 - } - }, - timeline: 0, - uri: 'media.m3u8' - }, - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 40000 - }, - timeline: 0, - uri: 'media1.m3u8' - }, - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 440000, - 'RESOLUTION': { - width: 396, - height: 224 - } - }, - timeline: 0, - uri: 'media2.m3u8' - }, - { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 1928000, - 'RESOLUTION': { - width: 960, - height: 540 - } - }, - timeline: 0, - uri: 'media3.m3u8' - } - ], - discontinuityStarts: [], - mediaGroups: { - 'VIDEO': {}, - 'AUDIO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/master.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/master.m3u8 deleted file mode 100644 index 338f060..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/master.m3u8 +++ /dev/null @@ -1,10 +0,0 @@ -# A simple master playlist with multiple variant streams -#EXTM3U -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000,RESOLUTION=396x224 -media.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000 -media1.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000,RESOLUTION=396x224 -media2.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540 -media3.m3u8 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/media.js b/node_modules/m3u8-parser/test/fixtures/integration/media.js deleted file mode 100644 index cb31c67..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/media.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 10, - timeline: 0, - uri: 'media-00001.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'media-00002.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'media-00003.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'media-00004.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/media.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/media.m3u8 deleted file mode 100644 index f191b7f..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/media.m3u8 +++ /dev/null @@ -1,12 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-TARGETDURATION:10 -#EXTINF:10, -media-00001.ts -#EXTINF:10, -media-00002.ts -#EXTINF:10, -media-00003.ts -#EXTINF:10, -media-00004.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/mediaSequence.js b/node_modules/m3u8-parser/test/fixtures/integration/mediaSequence.js deleted file mode 100644 index d927c98..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/mediaSequence.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 6.64, - timeline: 0, - uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' - }, - { - duration: 6.08, - timeline: 0, - uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' - }, - { - duration: 6.6, - timeline: 0, - uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' - }, - { - duration: 5, - timeline: 0, - uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' - } - ], - targetDuration: 8, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/mediaSequence.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/mediaSequence.m3u8 deleted file mode 100644 index 5c94847..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/mediaSequence.m3u8 +++ /dev/null @@ -1,14 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:8 -#EXTINF:6.640,{} -/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts -#EXTINF:6.080,{} -/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts -#EXTINF:6.600,{} -/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts -#EXTINF:5.000,{} -/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/missingEndlist.js b/node_modules/m3u8-parser/test/fixtures/integration/missingEndlist.js deleted file mode 100644 index 6683786..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/missingEndlist.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - segments: [ - { - duration: 10, - timeline: 0, - uri: '00001.ts' - }, - { - duration: 10, - timeline: 0, - uri: '00002.ts' - } - ], - targetDuration: 10, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/missingEndlist.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/missingEndlist.m3u8 deleted file mode 100644 index 7f9a186..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/missingEndlist.m3u8 +++ /dev/null @@ -1,6 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXTINF:10, -00001.ts -#EXTINF:10, -00002.ts diff --git a/node_modules/m3u8-parser/test/fixtures/integration/missingExtinf.js b/node_modules/m3u8-parser/test/fixtures/integration/missingExtinf.js deleted file mode 100644 index 670de8d..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/missingExtinf.js +++ /dev/null @@ -1,27 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - version: 3 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/missingExtinf.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/missingExtinf.m3u8 deleted file mode 100644 index e8a142c..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/missingExtinf.m3u8 +++ /dev/null @@ -1,11 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:3 -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10 -hls_450k_video.ts -hls_450k_video.ts -#EXTINF:10, -hls_450k_video.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/missingMediaSequence.js b/node_modules/m3u8-parser/test/fixtures/integration/missingMediaSequence.js deleted file mode 100644 index d927c98..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/missingMediaSequence.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 6.64, - timeline: 0, - uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' - }, - { - duration: 6.08, - timeline: 0, - uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' - }, - { - duration: 6.6, - timeline: 0, - uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' - }, - { - duration: 5, - timeline: 0, - uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' - } - ], - targetDuration: 8, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/missingMediaSequence.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/missingMediaSequence.m3u8 deleted file mode 100644 index 875b93e..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/missingMediaSequence.m3u8 +++ /dev/null @@ -1,13 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:8 -#EXTINF:6.640,{} -/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts -#EXTINF:6.080,{} -/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts -#EXTINF:6.600,{} -/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts -#EXTINF:5.000,{} -/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/missingSegmentDuration.js b/node_modules/m3u8-parser/test/fixtures/integration/missingSegmentDuration.js deleted file mode 100644 index a5889a9..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/missingSegmentDuration.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 6.64, - timeline: 0, - uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' - }, - { - duration: 8, - timeline: 0, - uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' - }, - { - duration: 8, - timeline: 0, - uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' - }, - { - duration: 8, - timeline: 0, - uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' - } - ], - targetDuration: 8, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/missingSegmentDuration.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/missingSegmentDuration.m3u8 deleted file mode 100644 index 441934b..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/missingSegmentDuration.m3u8 +++ /dev/null @@ -1,11 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:8 -#EXTINF:6.640,{} -/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts -/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts -/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts -/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroups.js b/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroups.js deleted file mode 100644 index c5dc8e4..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroups.js +++ /dev/null @@ -1,89 +0,0 @@ -module.exports = { - allowCache: true, - discontinuityStarts: [], - mediaGroups: { - 'AUDIO': { - 'audio-lo': { - English: { - autoselect: true, - default: true, - language: 'eng', - uri: 'englo/prog_index.m3u8' - }, - Français: { - autoselect: true, - default: false, - language: 'fre', - uri: 'frelo/prog_index.m3u8' - }, - Espanol: { - autoselect: true, - default: false, - language: 'sp', - uri: 'splo/prog_index.m3u8' - } - }, - 'audio-hi': { - English: { - autoselect: true, - default: true, - language: 'eng', - uri: 'eng/prog_index.m3u8' - }, - Français: { - autoselect: true, - default: false, - language: 'fre', - uri: 'fre/prog_index.m3u8' - }, - Espanol: { - autoselect: true, - default: false, - language: 'sp', - uri: 'sp/prog_index.m3u8' - } - } - }, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - playlists: [{ - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 195023, - 'CODECS': 'mp4a.40.5', - 'AUDIO': 'audio-lo' - }, - timeline: 0, - uri: 'lo/prog_index.m3u8' - }, { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 260000, - 'CODECS': 'avc1.42e01e,mp4a.40.2', - 'AUDIO': 'audio-lo' - }, - timeline: 0, - uri: 'lo2/prog_index.m3u8' - }, { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 591680, - 'CODECS': 'mp4a.40.2, avc1.64001e', - 'AUDIO': 'audio-hi' - }, - timeline: 0, - uri: 'hi/prog_index.m3u8' - }, { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 650000, - 'CODECS': 'avc1.42e01e,mp4a.40.2', - 'AUDIO': 'audio-hi' - }, - timeline: 0, - uri: 'hi2/prog_index.m3u8' - }], - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroups.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroups.m3u8 deleted file mode 100644 index c16a8ba..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroups.m3u8 +++ /dev/null @@ -1,17 +0,0 @@ -#EXTM3U -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="eng",NAME="English",AUTOSELECT=YES, DEFAULT=YES,URI="englo/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="fre",NAME="Français",AUTOSELECT=YES, DEFAULT=NO,URI="frelo/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="sp",NAME="Espanol",AUTOSELECT=YES, DEFAULT=NO,URI="splo/prog_index.m3u8" - -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="eng",NAME="English",AUTOSELECT=YES, DEFAULT=YES,URI="eng/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="fre",NAME="Français",AUTOSELECT=YES, DEFAULT=NO,URI="fre/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="sp",NAME="Espanol",AUTOSELECT=YES, DEFAULT=NO,URI="sp/prog_index.m3u8" - -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=195023,CODECS="mp4a.40.5", AUDIO="audio-lo" -lo/prog_index.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=260000,CODECS="avc1.42e01e,mp4a.40.2", AUDIO="audio-lo" -lo2/prog_index.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=591680,CODECS="mp4a.40.2, avc1.64001e", AUDIO="audio-hi" -hi/prog_index.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=650000,CODECS="avc1.42e01e,mp4a.40.2", AUDIO="audio-hi" -hi2/prog_index.m3u8 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroupsCombinedMain.js b/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroupsCombinedMain.js deleted file mode 100644 index 42ece74..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroupsCombinedMain.js +++ /dev/null @@ -1,88 +0,0 @@ -module.exports = { - allowCache: true, - discontinuityStarts: [], - mediaGroups: { - 'AUDIO': { - 'audio-lo': { - English: { - autoselect: true, - default: true, - language: 'eng' - }, - Français: { - autoselect: true, - default: false, - language: 'fre', - uri: 'frelo/prog_index.m3u8' - }, - Espanol: { - autoselect: true, - default: false, - language: 'sp', - uri: 'splo/prog_index.m3u8' - } - }, - 'audio-hi': { - English: { - autoselect: true, - default: true, - language: 'eng', - uri: 'eng/prog_index.m3u8' - }, - Français: { - autoselect: true, - default: false, - language: 'fre', - uri: 'fre/prog_index.m3u8' - }, - Espanol: { - autoselect: true, - default: false, - language: 'sp', - uri: 'sp/prog_index.m3u8' - } - } - }, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - playlists: [{ - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 195023, - 'CODECS': 'mp4a.40.5', - 'AUDIO': 'audio-lo' - }, - timeline: 0, - uri: 'lo/prog_index.m3u8' - }, { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 260000, - 'CODECS': 'avc1.42e01e,mp4a.40.2', - 'AUDIO': 'audio-lo' - }, - timeline: 0, - uri: 'lo2/prog_index.m3u8' - }, { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 591680, - 'CODECS': 'mp4a.40.2, avc1.64001e', - 'AUDIO': 'audio-hi' - }, - timeline: 0, - uri: 'hi/prog_index.m3u8' - }, { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 650000, - 'CODECS': 'avc1.42e01e,mp4a.40.2', - 'AUDIO': 'audio-hi' - }, - timeline: 0, - uri: 'hi2/prog_index.m3u8' - }], - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroupsCombinedMain.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroupsCombinedMain.m3u8 deleted file mode 100644 index f348428..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/multipleAudioGroupsCombinedMain.m3u8 +++ /dev/null @@ -1,17 +0,0 @@ -#EXTM3U -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="eng",NAME="English",AUTOSELECT=YES, DEFAULT=YES -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="fre",NAME="Français",AUTOSELECT=YES, DEFAULT=NO,URI="frelo/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="sp",NAME="Espanol",AUTOSELECT=YES, DEFAULT=NO,URI="splo/prog_index.m3u8" - -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="eng",NAME="English",AUTOSELECT=YES, DEFAULT=YES,URI="eng/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="fre",NAME="Français",AUTOSELECT=YES, DEFAULT=NO,URI="fre/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="sp",NAME="Espanol",AUTOSELECT=YES, DEFAULT=NO,URI="sp/prog_index.m3u8" - -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=195023,CODECS="mp4a.40.5", AUDIO="audio-lo" -lo/prog_index.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=260000,CODECS="avc1.42e01e,mp4a.40.2", AUDIO="audio-lo" -lo2/prog_index.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=591680,CODECS="mp4a.40.2, avc1.64001e", AUDIO="audio-hi" -hi/prog_index.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=650000,CODECS="avc1.42e01e,mp4a.40.2", AUDIO="audio-hi" -hi2/prog_index.m3u8 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/multipleTargetDurations.js b/node_modules/m3u8-parser/test/fixtures/integration/multipleTargetDurations.js deleted file mode 100644 index 70a1f37..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/multipleTargetDurations.js +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - targetDuration: 10, - segments: [ - { - uri: '001.ts', - timeline: 0 - }, - { - uri: '002.ts', - duration: 9, - timeline: 0 - }, - { - uri: '003.ts', - duration: 7, - timeline: 0 - }, - { - uri: '004.ts', - duration: 10, - timeline: 0 - } - ], - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/multipleTargetDurations.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/multipleTargetDurations.m3u8 deleted file mode 100644 index 9898ce6..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/multipleTargetDurations.m3u8 +++ /dev/null @@ -1,8 +0,0 @@ -#EXTM3U -001.ts -#EXT-X-TARGETDURATION:9 -002.ts -#EXTINF:7 -003.ts -#EXT-X-TARGETDURATION:10 -004.ts \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/multipleVideo.js b/node_modules/m3u8-parser/test/fixtures/integration/multipleVideo.js deleted file mode 100644 index d5beda5..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/multipleVideo.js +++ /dev/null @@ -1,74 +0,0 @@ -module.exports = { - allowCache: true, - discontinuityStarts: [], - mediaGroups: { - 'AUDIO': { - aac: { - English: { - autoselect: true, - default: true, - language: 'eng', - uri: 'eng/prog_index.m3u8' - } - } - }, - 'VIDEO': { - '200kbs': { - Angle1: { - autoselect: true, - default: true - }, - Angle2: { - autoselect: true, - default: false, - uri: 'Angle2/200kbs/prog_index.m3u8' - }, - Angle3: { - autoselect: true, - default: false, - uri: 'Angle3/200kbs/prog_index.m3u8' - } - }, - '500kbs': { - Angle1: { - autoselect: true, - default: true - }, - Angle2: { - autoselect: true, - default: false, - uri: 'Angle2/500kbs/prog_index.m3u8' - }, - Angle3: { - autoselect: true, - default: false, - uri: 'Angle3/500kbs/prog_index.m3u8' - } - } - }, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - playlists: [{ - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 300000, - 'CODECS': 'mp4a.40.2,avc1.4d401e', - 'AUDIO': 'aac', - 'VIDEO': '200kbs' - }, - timeline: 0, - uri: 'Angle1/200kbs/prog_index.m3u' - }, { - attributes: { - 'PROGRAM-ID': 1, - 'BANDWIDTH': 754857, - 'CODECS': 'mp4a.40.2,avc1.4d401e', - 'AUDIO': 'aac', - 'VIDEO': '500kbs' - }, - timeline: 0, - uri: 'Angle1/500kbs/prog_index.m3u8' - }], - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/multipleVideo.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/multipleVideo.m3u8 deleted file mode 100644 index ad9695e..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/multipleVideo.m3u8 +++ /dev/null @@ -1,16 +0,0 @@ -#EXTM3U -#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="200kbs",NAME="Angle1",AUTOSELECT=YES,DEFAULT=YES -#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="200kbs",NAME="Angle2",AUTOSELECT=YES,DEFAULT=NO,URI="Angle2/200kbs/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="200kbs",NAME="Angle3",AUTOSELECT=YES,DEFAULT=NO,URI="Angle3/200kbs/prog_index.m3u8" - -#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle1",AUTOSELECT=YES,DEFAULT=YES -#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle2",AUTOSELECT=YES,DEFAULT=NO,URI="Angle2/500kbs/prog_index.m3u8" -#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle3",AUTOSELECT=YES,DEFAULT=NO,URI="Angle3/500kbs/prog_index.m3u8" - -#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="eng/prog_index.m3u8" - -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=300000,CODECS="mp4a.40.2,avc1.4d401e",VIDEO="200kbs",AUDIO="aac" -Angle1/200kbs/prog_index.m3u - -#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=754857,CODECS="mp4a.40.2,avc1.4d401e",VIDEO="500kbs",AUDIO="aac" -Angle1/500kbs/prog_index.m3u8 \ No newline at end of file diff --git a/node_modules/m3u8-parser/test/fixtures/integration/negativeMediaSequence.js b/node_modules/m3u8-parser/test/fixtures/integration/negativeMediaSequence.js deleted file mode 100644 index 7069dde..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/negativeMediaSequence.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: -11, - playlistType: 'VOD', - segments: [ - { - duration: 6.64, - timeline: 0, - uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' - }, - { - duration: 6.08, - timeline: 0, - uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' - }, - { - duration: 6.6, - timeline: 0, - uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' - }, - { - duration: 5, - timeline: 0, - uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' - } - ], - targetDuration: 8, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/negativeMediaSequence.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/negativeMediaSequence.m3u8 deleted file mode 100644 index 4af6186..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/negativeMediaSequence.m3u8 +++ /dev/null @@ -1,14 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MEDIA-SEQUENCE:-11 -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:8 -#EXTINF:6.640,{} -/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts -#EXTINF:6.080,{} -/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts -#EXTINF:6.600,{} -/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts -#EXTINF:5.000,{} -/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/playlist.js b/node_modules/m3u8-parser/test/fixtures/integration/playlist.js deleted file mode 100644 index b034613..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/playlist.js +++ /dev/null @@ -1,165 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - byterange: { - length: 522828, - offset: 0 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 587500, - offset: 522828 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 713084, - offset: 1110328 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 476580, - offset: 1823412 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 535612, - offset: 2299992 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 207176, - offset: 2835604 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 455900, - offset: 3042780 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 657248, - offset: 3498680 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 571708, - offset: 4155928 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 485040, - offset: 4727636 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 709136, - offset: 5212676 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 730004, - offset: 5921812 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 456276, - offset: 6651816 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 468684, - offset: 7108092 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 444996, - offset: 7576776 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 331444, - offset: 8021772 - }, - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - }, - { - byterange: { - length: 44556, - offset: 8353216 - }, - duration: 1.4167, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - version: 4 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/playlist.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/playlist.m3u8 deleted file mode 100644 index b1060b6..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/playlist.m3u8 +++ /dev/null @@ -1,57 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:4 -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -#EXT-X-BYTERANGE:522828@0 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:587500@522828 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:713084@1110328 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:476580@1823412 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:535612@2299992 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:207176@2835604 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:455900@3042780 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:657248@3498680 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:571708@4155928 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:485040@4727636 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:709136@5212676 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:730004@5921812 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:456276@6651816 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:468684@7108092 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:444996@7576776 -hls_450k_video.ts -#EXTINF:10, -#EXT-X-BYTERANGE:331444@8021772 -hls_450k_video.ts -#EXTINF:1.4167, -#EXT-X-BYTERANGE:44556@8353216 -hls_450k_video.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/playlistMediaSequenceHigher.js b/node_modules/m3u8-parser/test/fixtures/integration/playlistMediaSequenceHigher.js deleted file mode 100644 index 6a29b03..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/playlistMediaSequenceHigher.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 17, - playlistType: 'VOD', - segments: [ - { - duration: 6.64, - timeline: 0, - uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' - } - ], - targetDuration: 8, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/playlistMediaSequenceHigher.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/playlistMediaSequenceHigher.m3u8 deleted file mode 100644 index 01aeac7..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/playlistMediaSequenceHigher.m3u8 +++ /dev/null @@ -1,8 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MEDIA-SEQUENCE:17 -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:8 -#EXTINF:6.640,{} -/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/start.js b/node_modules/m3u8-parser/test/fixtures/integration/start.js deleted file mode 100644 index c864bfc..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/start.js +++ /dev/null @@ -1,36 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 10, - timeline: 0, - uri: 'media-00001.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'media-00002.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'media-00003.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'media-00004.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [], - start: { - timeOffset: 10.3, - precise: false - }, - version: 3 -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/start.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/start.m3u8 deleted file mode 100644 index d340b90..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/start.m3u8 +++ /dev/null @@ -1,13 +0,0 @@ -#EXT-X-VERSION:3 -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-TARGETDURATION:10 -#EXT-X-START:TIME-OFFSET=10.3 -#EXTINF:10, -media-00001.ts -#EXTINF:10, -media-00002.ts -#EXTINF:10, -media-00003.ts -#EXTINF:10, -media-00004.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/streamInfInvalid.js b/node_modules/m3u8-parser/test/fixtures/integration/streamInfInvalid.js deleted file mode 100644 index 4fbecf0..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/streamInfInvalid.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - allowCache: true, - playlists: [ - { - attributes: { - 'PROGRAM-ID': 1 - }, - timeline: 0, - uri: 'media.m3u8' - }, - { - timeline: 0, - uri: 'media1.m3u8' - } - ], - discontinuityStarts: [], - mediaGroups: { - 'VIDEO': {}, - 'AUDIO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - segments: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/streamInfInvalid.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/streamInfInvalid.m3u8 deleted file mode 100644 index 37deba4..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/streamInfInvalid.m3u8 +++ /dev/null @@ -1,6 +0,0 @@ -# A simple master playlist with multiple variant streams -#EXTM3U -#EXT-X-STREAM-INF:PROGRAM-ID=1 -media.m3u8 -#EXT-X-STREAM-INF: -media1.m3u8 diff --git a/node_modules/m3u8-parser/test/fixtures/integration/twoMediaSequences.js b/node_modules/m3u8-parser/test/fixtures/integration/twoMediaSequences.js deleted file mode 100644 index 46b73bb..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/twoMediaSequences.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 11, - playlistType: 'VOD', - segments: [ - { - duration: 6.64, - timeline: 0, - uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' - }, - { - duration: 6.08, - timeline: 0, - uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' - }, - { - duration: 6.6, - timeline: 0, - uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' - }, - { - duration: 5, - timeline: 0, - uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' - } - ], - targetDuration: 8, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/twoMediaSequences.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/twoMediaSequences.m3u8 deleted file mode 100644 index bf802f9..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/twoMediaSequences.m3u8 +++ /dev/null @@ -1,15 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-MEDIA-SEQUENCE:11 -#EXT-X-ALLOW-CACHE:YES -#EXT-X-TARGETDURATION:8 -#EXTINF:6.640,{} -/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts -#EXTINF:6.080,{} -/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts -#EXTINF:6.600,{} -/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts -#EXTINF:5.000,{} -/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/versionInvalid.js b/node_modules/m3u8-parser/test/fixtures/integration/versionInvalid.js deleted file mode 100644 index ba78123..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/versionInvalid.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 10, - timeline: 0, - uri: 'hls_450k_video.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/versionInvalid.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/versionInvalid.m3u8 deleted file mode 100644 index 53c1bb2..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/versionInvalid.m3u8 +++ /dev/null @@ -1,8 +0,0 @@ -#EXTM3U -#EXT-X-TARGETDURATION:10 -#EXT-X-VERSION:NaN -#EXT-X-MEDIA-SEQUENCE:0 -#EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:10, -hls_450k_video.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/whiteSpace.js b/node_modules/m3u8-parser/test/fixtures/integration/whiteSpace.js deleted file mode 100644 index 370c8c1..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/whiteSpace.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 10, - timeline: 0, - uri: 'http://example.com/00001.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'https://example.com/00002.ts' - }, - { - duration: 10, - timeline: 0, - uri: '//example.com/00003.ts' - }, - { - duration: 10, - timeline: 0, - uri: 'http://example.com/00004.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/whiteSpace.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/whiteSpace.m3u8 deleted file mode 100644 index 62e0c4c..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/whiteSpace.m3u8 +++ /dev/null @@ -1,13 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-TARGETDURATION:10 - -#EXTINF:10, -http://example.com/00001.ts -#EXTINF:10, - https://example.com/00002.ts -#EXTINF:10, - //example.com/00003.ts -#EXTINF:10, - http://example.com/00004.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/fixtures/integration/zeroDuration.js b/node_modules/m3u8-parser/test/fixtures/integration/zeroDuration.js deleted file mode 100644 index d5ecdaf..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/zeroDuration.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = { - allowCache: true, - mediaSequence: 0, - playlistType: 'VOD', - segments: [ - { - duration: 0.01, - timeline: 0, - uri: 'http://example.com/00001.ts' - } - ], - targetDuration: 10, - endList: true, - discontinuitySequence: 0, - discontinuityStarts: [] -}; diff --git a/node_modules/m3u8-parser/test/fixtures/integration/zeroDuration.m3u8 b/node_modules/m3u8-parser/test/fixtures/integration/zeroDuration.m3u8 deleted file mode 100644 index 2245b98..0000000 --- a/node_modules/m3u8-parser/test/fixtures/integration/zeroDuration.m3u8 +++ /dev/null @@ -1,7 +0,0 @@ -#EXTM3U -#EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-TARGETDURATION:10 - -#EXTINF:0, -http://example.com/00001.ts -#EXT-X-ENDLIST diff --git a/node_modules/m3u8-parser/test/line-stream.test.js b/node_modules/m3u8-parser/test/line-stream.test.js deleted file mode 100644 index 32cde92..0000000 --- a/node_modules/m3u8-parser/test/line-stream.test.js +++ /dev/null @@ -1,80 +0,0 @@ -import {LineStream} from '../src'; -import QUnit from 'qunit'; - -QUnit.module('LineStream', { - beforeEach() { - this.lineStream = new LineStream(); - } -}); -QUnit.test('empty inputs produce no tokens', function(assert) { - let data = false; - - this.lineStream.on('data', function() { - data = true; - }); - this.lineStream.push(''); - assert.ok(!data, 'no tokens were produced'); -}); -QUnit.test('splits on newlines', function(assert) { - const lines = []; - - this.lineStream.on('data', function(line) { - lines.push(line); - }); - this.lineStream.push('#EXTM3U\nmovie.ts\n'); - - assert.strictEqual(2, lines.length, 'two lines are ready'); - assert.strictEqual('#EXTM3U', lines.shift(), 'the first line is the first token'); - assert.strictEqual('movie.ts', lines.shift(), 'the second line is the second token'); -}); -QUnit.test('empty lines become empty strings', function(assert) { - const lines = []; - - this.lineStream.on('data', function(line) { - lines.push(line); - }); - this.lineStream.push('\n\n'); - - assert.strictEqual(2, lines.length, 'two lines are ready'); - assert.strictEqual('', lines.shift(), 'the first line is empty'); - assert.strictEqual('', lines.shift(), 'the second line is empty'); -}); -QUnit.test('handles lines broken across appends', function(assert) { - const lines = []; - - this.lineStream.on('data', function(line) { - lines.push(line); - }); - this.lineStream.push('#EXTM'); - assert.strictEqual(0, lines.length, 'no lines are ready'); - - this.lineStream.push('3U\nmovie.ts\n'); - assert.strictEqual(2, lines.length, 'two lines are ready'); - assert.strictEqual('#EXTM3U', lines.shift(), 'the first line is the first token'); - assert.strictEqual('movie.ts', lines.shift(), 'the second line is the second token'); -}); -QUnit.test('stops sending events after deregistering', function(assert) { - const temporaryLines = []; - const temporary = function(line) { - temporaryLines.push(line); - }; - const permanentLines = []; - const permanent = function(line) { - permanentLines.push(line); - }; - - this.lineStream.on('data', temporary); - this.lineStream.on('data', permanent); - this.lineStream.push('line one\n'); - assert.strictEqual( - temporaryLines.length, - permanentLines.length, - 'both callbacks receive the event' - ); - - assert.ok(this.lineStream.off('data', temporary), 'a listener was removed'); - this.lineStream.push('line two\n'); - assert.strictEqual(1, temporaryLines.length, 'no new events are received'); - assert.strictEqual(2, permanentLines.length, 'new events are still received'); -}); - diff --git a/node_modules/m3u8-parser/test/parse-stream.test.js b/node_modules/m3u8-parser/test/parse-stream.test.js deleted file mode 100644 index c9cf912..0000000 --- a/node_modules/m3u8-parser/test/parse-stream.test.js +++ /dev/null @@ -1,903 +0,0 @@ -import {LineStream, ParseStream} from '../src'; -import QUnit from 'qunit'; -import sinon from 'sinon'; - -QUnit.module('ParseStream', { - beforeEach() { - this.lineStream = new LineStream(); - this.parseStream = new ParseStream(); - this.lineStream.pipe(this.parseStream); - } -}); - -QUnit.test('parses custom tags', function(assert) { - const manifest = '#VOD-STARTTIMESTAMP:1501533337573\n'; - let element; - - this.parseStream.addParser({ - expression: /^#VOD-STARTTIMESTAMP/, - customType: 'startTimestamp' - }); - - this.parseStream.on('data', function(elem) { - element = elem; - }); - - this.lineStream.push(manifest); - assert.ok(element, 'element'); - assert.strictEqual(element.type, 'custom', 'the type of the data is custom'); - assert.strictEqual( - element.customType, - 'startTimestamp', - 'the customType is startTimestamp' - ); -}); - -QUnit.test('mapper does not conflict with parser', function(assert) { - const manifest = '#EXAMPLE\n'; - const commentMapper = sinon.spy(line => '#NEW-COMMENT'); - const commentMapper2 = sinon.spy(line => '#SOMETHING-ELSE'); - const dataCallback = sinon.spy(); - - this.parseStream.addTagMapper({ - expression: /^#EXAMPLE/, - map: commentMapper - }); - this.parseStream.addTagMapper({ - expression: /^#EXAMPLE/, - map: commentMapper2 - }); - - this.parseStream.addParser({ - expression: /^#EXAMPLE/, - customType: 'test' - }); - this.parseStream.addParser({ - expression: /^#NEW-COMMENT/, - customType: 'test2' - }); - - this.parseStream.on('data', dataCallback); - this.lineStream.push(manifest); - - assert.ok(commentMapper.called); - assert.ok(commentMapper2.called); - assert.strictEqual(dataCallback.callCount, 3); - - assert.deepEqual(dataCallback.getCall(0).args[0], { - data: '#EXAMPLE', - type: 'custom', - customType: 'test', - segment: undefined - }); - assert.deepEqual(dataCallback.getCall(1).args[0], { - data: '#NEW-COMMENT', - type: 'custom', - customType: 'test2', - segment: undefined - }); - assert.deepEqual(dataCallback.getCall(2).args[0], { - text: 'SOMETHING-ELSE', - type: 'comment' - }); -}); - -QUnit.test('maps custom tags', function(assert) { - const manifest = '#EXAMPLE\n'; - const commentMapper = sinon.spy(line => '#NEW-COMMENT'); - const dataCallback = sinon.spy(); - - this.parseStream.addTagMapper({ - expression: /^#EXAMPLE/, - map: commentMapper - }); - - this.parseStream.on('data', dataCallback); - this.lineStream.push(manifest); - - assert.ok(commentMapper.called); - assert.strictEqual(dataCallback.callCount, 2); - - assert.deepEqual(dataCallback.getCall(0).args[0], { - text: 'EXAMPLE', - type: 'comment' - }); - assert.deepEqual(dataCallback.getCall(1).args[0], { - text: 'NEW-COMMENT', - type: 'comment' - }); -}); - -QUnit.test('maps multiple custom tags', function(assert) { - const manifest = '#VOD-STARTTIMESTAMP:1501533337573\n'; - const commentMapper = sinon.spy(line => '#NEW-COMMENT'); - const pdtMapper = sinon.spy((line) => { - const match = /#VOD-STARTTIMESTAMP:(\d+)/g.exec(line)[1]; - const ISOdate = new Date(Number(match)).toISOString(); - - return `#EXT-X-PROGRAM-DATE-TIME:${ISOdate}`; - }); - const dataCallback = sinon.spy(); - - this.parseStream.addTagMapper({ - expression: /^#VOD-STARTTIMESTAMP/, - map: commentMapper - }); - this.parseStream.addTagMapper({ - expression: /^#VOD-STARTTIMESTAMP/, - map: pdtMapper - }); - - this.parseStream.on('data', dataCallback); - this.lineStream.push(manifest); - - assert.ok(commentMapper.called); - assert.ok(pdtMapper.called); - assert.strictEqual(dataCallback.callCount, 3); - - assert.deepEqual(dataCallback.getCall(0).args[0], { - text: 'VOD-STARTTIMESTAMP:1501533337573', - type: 'comment' - }); - - assert.deepEqual(dataCallback.getCall(1).args[0], { - text: 'NEW-COMMENT', - type: 'comment' - }); - - const dateTag = dataCallback.getCall(2).args[0]; - - assert.strictEqual(dateTag.dateTimeString, '2017-07-31T20:35:37.573Z'); - assert.strictEqual(dateTag.tagType, 'program-date-time'); - assert.strictEqual(dateTag.type, 'tag'); -}); - -QUnit.test('mapper ignores tags', function(assert) { - const manifest = '#TAG\n'; - const dataCallback = sinon.spy(); - - this.parseStream.addTagMapper({ - expression: /^#NO-MATCH/, - map(line) { - return '#MAPPED'; - } - }); - - this.parseStream.on('data', dataCallback); - this.lineStream.push(manifest); - - assert.strictEqual(dataCallback.callCount, 1); - assert.deepEqual(dataCallback.getCall(0).args[0], { - text: 'TAG', - type: 'comment' - }); -}); - -QUnit.test('parses comment lines', function(assert) { - const manifest = '# a line that starts with a hash mark without "EXT" is a comment\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'comment', 'the type is comment'); - assert.strictEqual( - element.text, - manifest.slice(1, manifest.length - 1), - 'the comment text is parsed' - ); -}); -QUnit.test('parses uri lines', function(assert) { - const manifest = 'any non-blank line that does not start with a hash-mark is a URI\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'uri', 'the type is uri'); - assert.strictEqual( - element.uri, - manifest.substring(0, manifest.length - 1), - 'the uri text is parsed' - ); -}); -QUnit.test('parses unknown tag types', function(assert) { - const manifest = '#EXT-X-EXAMPLE-TAG:some,additional,stuff\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the type is tag'); - assert.strictEqual( - element.data, - manifest.slice(4, manifest.length - 1), - 'unknown tag data is preserved' - ); -}); - -// #EXTM3U -QUnit.test('parses #EXTM3U tags', function(assert) { - const manifest = '#EXTM3U\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'm3u', 'the tag type is m3u'); -}); - -// #EXTINF -QUnit.test('parses minimal #EXTINF tags', function(assert) { - const manifest = '#EXTINF\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); -}); -QUnit.test('parses #EXTINF tags with durations', function(assert) { - let manifest = '#EXTINF:15\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); - assert.strictEqual(element.duration, 15, 'the duration is parsed'); - assert.ok(!('title' in element), 'no title is parsed'); - - manifest = '#EXTINF:21,\n'; - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); - assert.strictEqual(element.duration, 21, 'the duration is parsed'); - assert.ok(!('title' in element), 'no title is parsed'); -}); -QUnit.test('parses #EXTINF tags with a duration and title', function(assert) { - const manifest = '#EXTINF:13,Does anyone really use the title attribute?\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); - assert.strictEqual(element.duration, 13, 'the duration is parsed'); - assert.strictEqual( - element.title, - manifest.substring(manifest.indexOf(',') + 1, manifest.length - 1), - 'the title is parsed' - ); -}); -QUnit.test('parses #EXTINF tags with carriage returns', function(assert) { - const manifest = '#EXTINF:13,Does anyone really use the title attribute?\r\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); - assert.strictEqual(element.duration, 13, 'the duration is parsed'); - assert.strictEqual( - element.title, - manifest.substring(manifest.indexOf(',') + 1, manifest.length - 2), - 'the title is parsed' - ); -}); - -// #EXT-X-TARGETDURATION -QUnit.test('parses minimal #EXT-X-TARGETDURATION tags', function(assert) { - const manifest = '#EXT-X-TARGETDURATION\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'targetduration', 'the tag type is targetduration'); - assert.ok(!('duration' in element), 'no duration is parsed'); -}); -QUnit.test('parses #EXT-X-TARGETDURATION with duration', function(assert) { - const manifest = '#EXT-X-TARGETDURATION:47\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'targetduration', 'the tag type is targetduration'); - assert.strictEqual(element.duration, 47, 'the duration is parsed'); -}); - -// #EXT-X-VERSION -QUnit.test('parses minimal #EXT-X-VERSION tags', function(assert) { - const manifest = '#EXT-X-VERSION:\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'version', 'the tag type is version'); - assert.ok(!('version' in element), 'no version is present'); -}); -QUnit.test('parses #EXT-X-VERSION with a version', function(assert) { - const manifest = '#EXT-X-VERSION:99\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'version', 'the tag type is version'); - assert.strictEqual(element.version, 99, 'the version is parsed'); -}); - -// #EXT-X-MEDIA-SEQUENCE -QUnit.test('parses minimal #EXT-X-MEDIA-SEQUENCE tags', function(assert) { - const manifest = '#EXT-X-MEDIA-SEQUENCE\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'media-sequence', 'the tag type is media-sequence'); - assert.ok(!('number' in element), 'no number is present'); -}); -QUnit.test('parses #EXT-X-MEDIA-SEQUENCE with sequence numbers', function(assert) { - const manifest = '#EXT-X-MEDIA-SEQUENCE:109\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'media-sequence', 'the tag type is media-sequence'); - assert.ok(element.number, 109, 'the number is parsed'); -}); - -// #EXT-X-PLAYLIST-TYPE -QUnit.test('parses minimal #EXT-X-PLAYLIST-TYPE tags', function(assert) { - const manifest = '#EXT-X-PLAYLIST-TYPE:\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); - assert.ok(!('playlistType' in element), 'no playlist type is present'); -}); -QUnit.test('parses #EXT-X-PLAYLIST-TYPE with mutability info', function(assert) { - let manifest = '#EXT-X-PLAYLIST-TYPE:EVENT\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); - assert.strictEqual(element.playlistType, 'EVENT', 'the playlist type is EVENT'); - - manifest = '#EXT-X-PLAYLIST-TYPE:VOD\n'; - this.lineStream.push(manifest); - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); - assert.strictEqual(element.playlistType, 'VOD', 'the playlist type is VOD'); - - manifest = '#EXT-X-PLAYLIST-TYPE:nonsense\n'; - this.lineStream.push(manifest); - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); - assert.strictEqual(element.playlistType, 'nonsense', 'the playlist type is parsed'); -}); - -// #EXT-X-BYTERANGE -QUnit.test('parses minimal #EXT-X-BYTERANGE tags', function(assert) { - const manifest = '#EXT-X-BYTERANGE\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'byterange', 'the tag type is byterange'); - assert.ok(!('length' in element), 'no length is present'); - assert.ok(!('offset' in element), 'no offset is present'); -}); -QUnit.test('parses #EXT-X-BYTERANGE with length and offset', function(assert) { - let manifest = '#EXT-X-BYTERANGE:45\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'byterange', 'the tag type is byterange'); - assert.strictEqual(element.length, 45, 'length is parsed'); - assert.ok(!('offset' in element), 'no offset is present'); - - manifest = '#EXT-X-BYTERANGE:108@16\n'; - this.lineStream.push(manifest); - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'byterange', 'the tag type is byterange'); - assert.strictEqual(element.length, 108, 'length is parsed'); - assert.strictEqual(element.offset, 16, 'offset is parsed'); -}); - -// #EXT-X-ALLOW-CACHE -QUnit.test('parses minimal #EXT-X-ALLOW-CACHE tags', function(assert) { - const manifest = '#EXT-X-ALLOW-CACHE:\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'allow-cache', 'the tag type is allow-cache'); - assert.ok(!('allowed' in element), 'no allowed is present'); -}); -QUnit.test('parses valid #EXT-X-ALLOW-CACHE tags', function(assert) { - let manifest = '#EXT-X-ALLOW-CACHE:YES\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'allow-cache', 'the tag type is allow-cache'); - assert.ok(element.allowed, 'allowed is parsed'); - - manifest = '#EXT-X-ALLOW-CACHE:NO\n'; - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'allow-cache', 'the tag type is allow-cache'); - assert.ok(!element.allowed, 'allowed is parsed'); -}); -// #EXT-X-MAP -QUnit.test('parses minimal #EXT-X-MAP tags', function(assert) { - const manifest = '#EXT-X-MAP:URI="init.m4s"\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - - this.lineStream.push(manifest); - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'map', 'the tag type is map'); - assert.strictEqual(element.uri, 'init.m4s', 'parsed the uri'); -}); -QUnit.test('parses #EXT-X-MAP tags with a byterange', function(assert) { - const manifest = '#EXT-X-MAP:URI="0.m4s", BYTERANGE="1000@23"\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - - this.lineStream.push(manifest); - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.uri, '0.m4s', 'parsed the uri'); - assert.strictEqual( - element.byterange.length, - 1000, - 'parsed the byterange length' - ); - assert.strictEqual( - element.byterange.offset, - 23, - 'parsed the byterange offset' - ); -}); -QUnit.test('parses #EXT-X-MAP tags with arbitrary attributes', function(assert) { - const manifest = '#EXT-X-MAP:URI="init.mp4", SOMETHING=YES,BYTERANGE="720@0"\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - - this.lineStream.push(manifest); - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.uri, 'init.mp4', 'parsed the uri'); - assert.strictEqual( - element.byterange.length, - 720, - 'parsed the byterange length' - ); - assert.strictEqual( - element.byterange.offset, - 0, - 'parsed the byterange offset' - ); -}); -// #EXT-X-STREAM-INF -QUnit.test('parses minimal #EXT-X-STREAM-INF tags', function(assert) { - const manifest = '#EXT-X-STREAM-INF\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - assert.ok(!('attributes' in element), 'no attributes are present'); -}); -// #EXT-X-PROGRAM-DATE-TIME -QUnit.test('parses minimal EXT-X-PROGRAM-DATE-TIME tags', function(assert) { - const manifest = '#EXT-X-PROGRAM-DATE-TIME\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'program-date-time', 'the tag type is date-time'); - assert.ok(!('dateTimeString' in element), 'no dateTime is present'); -}); -QUnit.test( - 'parses EXT-X-PROGRAM-DATE-TIME tags with valid date-time formats', - function(assert) { - let manifest = '#EXT-X-PROGRAM-DATE-TIME:2016-06-22T09:20:16.166-04:00\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'program-date-time', 'the tag type is date-time'); - assert.strictEqual( - element.dateTimeString, '2016-06-22T09:20:16.166-04:00', - 'dateTimeString is parsed' - ); - assert.deepEqual( - element.dateTimeObject, new Date('2016-06-22T09:20:16.166-04:00'), - 'dateTimeObject is parsed' - ); - - manifest = '#EXT-X-PROGRAM-DATE-TIME:2016-06-22T09:20:16.16389Z\n'; - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'program-date-time', 'the tag type is date-time'); - assert.strictEqual( - element.dateTimeString, '2016-06-22T09:20:16.16389Z', - 'dateTimeString is parsed' - ); - assert.deepEqual( - element.dateTimeObject, new Date('2016-06-22T09:20:16.16389Z'), - 'dateTimeObject is parsed' - ); - } -); -QUnit.test('parses #EXT-X-STREAM-INF with common attributes', function(assert) { - let manifest = '#EXT-X-STREAM-INF:BANDWIDTH=14400\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - assert.strictEqual(element.attributes.BANDWIDTH, 14400, 'bandwidth is parsed'); - - manifest = '#EXT-X-STREAM-INF:PROGRAM-ID=7\n'; - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - assert.strictEqual(element.attributes['PROGRAM-ID'], 7, 'program-id is parsed'); - - manifest = '#EXT-X-STREAM-INF:RESOLUTION=396x224\n'; - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - assert.strictEqual(element.attributes.RESOLUTION.width, 396, 'width is parsed'); - assert.strictEqual(element.attributes.RESOLUTION.height, 224, 'heigth is parsed'); - - manifest = '#EXT-X-STREAM-INF:CODECS="avc1.4d400d, mp4a.40.2"\n'; - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - assert.strictEqual( - element.attributes.CODECS, - 'avc1.4d400d, mp4a.40.2', - 'codecs are parsed' - ); -}); -QUnit.test('parses #EXT-X-STREAM-INF with arbitrary attributes', function(assert) { - const manifest = '#EXT-X-STREAM-INF:NUMERIC=24,ALPHA=Value,MIXED=123abc\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - assert.strictEqual(element.attributes.NUMERIC, '24', 'numeric attributes are parsed'); - assert.strictEqual( - element.attributes.ALPHA, - 'Value', - 'alphabetic attributes are parsed' - ); - assert.strictEqual(element.attributes.MIXED, '123abc', 'mixed attributes are parsed'); -}); -// #EXT-X-ENDLIST -QUnit.test('parses #EXT-X-ENDLIST tags', function(assert) { - const manifest = '#EXT-X-ENDLIST\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'endlist', 'the tag type is stream-inf'); -}); - -// #EXT-X-KEY -QUnit.test('parses valid #EXT-X-KEY tags', function(assert) { - let manifest = - '#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52"\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.deepEqual(element, { - type: 'tag', - tagType: 'key', - attributes: { - METHOD: 'AES-128', - URI: 'https://priv.example.com/key.php?r=52' - } - }, 'parsed a valid key'); - - manifest = '#EXT-X-KEY:URI="https://example.com/key#1",METHOD=FutureType-1024\n'; - this.lineStream.push(manifest); - assert.ok(element, 'an event was triggered'); - assert.deepEqual(element, { - type: 'tag', - tagType: 'key', - attributes: { - METHOD: 'FutureType-1024', - URI: 'https://example.com/key#1' - } - }, 'parsed the attribute list independent of order'); - - manifest = '#EXT-X-KEY:IV=1234567890abcdef1234567890abcdef\n'; - this.lineStream.push(manifest); - assert.ok(element.attributes.IV, 'detected an IV attribute'); - assert.deepEqual(element.attributes.IV, new Uint32Array([ - 0x12345678, - 0x90abcdef, - 0x12345678, - 0x90abcdef - ]), 'parsed an IV value'); -}); - -QUnit.test('parses minimal #EXT-X-KEY tags', function(assert) { - const manifest = '#EXT-X-KEY:\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.deepEqual(element, { - type: 'tag', - tagType: 'key' - }, 'parsed a minimal key tag'); -}); - -QUnit.test('parses lightly-broken #EXT-X-KEY tags', function(assert) { - let manifest = '#EXT-X-KEY:URI=\'https://example.com/single-quote\',METHOD=AES-128\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.strictEqual( - element.attributes.URI, - 'https://example.com/single-quote', - 'parsed a single-quoted uri' - ); - - element = null; - manifest = '#EXT-X-KEYURI="https://example.com/key",METHOD=AES-128\n'; - this.lineStream.push(manifest); - assert.strictEqual(element.tagType, 'key', 'parsed the tag type'); - assert.strictEqual( - element.attributes.URI, - 'https://example.com/key', - 'inferred a colon after the tag type' - ); - - element = null; - manifest = '#EXT-X-KEY: URI = "https://example.com/key",METHOD=AES-128\n'; - this.lineStream.push(manifest); - assert.strictEqual( - element.attributes.URI, - 'https://example.com/key', - 'trims and removes quotes around the URI' - ); -}); - -QUnit.test('parses prefixed with 0x or 0X #EXT-X-KEY:IV tags', function(assert) { - let manifest; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - - manifest = '#EXT-X-KEY:IV=0x1234567890abcdef1234567890abcdef\n'; - this.lineStream.push(manifest); - assert.ok(element.attributes.IV, 'detected an IV attribute'); - assert.deepEqual(element.attributes.IV, new Uint32Array([ - 0x12345678, - 0x90abcdef, - 0x12345678, - 0x90abcdef - ]), 'parsed an IV value with 0x'); - - manifest = '#EXT-X-KEY:IV=0X1234567890abcdef1234567890abcdef\n'; - this.lineStream.push(manifest); - assert.ok(element.attributes.IV, 'detected an IV attribute'); - assert.deepEqual(element.attributes.IV, new Uint32Array([ - 0x12345678, - 0x90abcdef, - 0x12345678, - 0x90abcdef - ]), 'parsed an IV value with 0X'); -}); - -// #EXT-X-START -QUnit.test('parses EXT-X-START tags', function(assert) { - const manifest = '#EXT-X-START:TIME-OFFSET=1.1\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'start', 'the tag type is start'); - assert.strictEqual(element.attributes['TIME-OFFSET'], 1.1, 'parses time offset'); - assert.strictEqual(element.attributes.PRECISE, false, 'precise defaults to false'); -}); -QUnit.test('parses EXT-X-START PRECISE attribute', function(assert) { - const manifest = '#EXT-X-START:TIME-OFFSET=1.4,PRECISE=YES\n'; - let element; - - this.parseStream.on('data', function(elem) { - element = elem; - }); - this.lineStream.push(manifest); - - assert.ok(element, 'an event was triggered'); - assert.strictEqual(element.type, 'tag', 'the line type is tag'); - assert.strictEqual(element.tagType, 'start', 'the tag type is start'); - assert.strictEqual(element.attributes['TIME-OFFSET'], 1.4, 'parses time offset'); - assert.strictEqual(element.attributes.PRECISE, true, 'parses precise attribute'); -}); - -QUnit.test('ignores empty lines', function(assert) { - const manifest = '\n'; - let event = false; - - this.parseStream.on('data', function() { - event = true; - }); - this.lineStream.push(manifest); - - assert.ok(!event, 'no event is triggered'); -}); diff --git a/node_modules/m3u8-parser/test/parser.test.js b/node_modules/m3u8-parser/test/parser.test.js deleted file mode 100644 index 6b35bf8..0000000 --- a/node_modules/m3u8-parser/test/parser.test.js +++ /dev/null @@ -1,883 +0,0 @@ -import QUnit from 'qunit'; -import testDataExpected from 'data-files!expecteds'; -import testDataManifests from 'data-files!manifests'; -import {Parser} from '../src'; - -QUnit.module('m3u8s', function(hooks) { - hooks.beforeEach(function() { - this.parser = new Parser(); - QUnit.dump.maxDepth = 8; - }); - - QUnit.module('general'); - - QUnit.test('can be constructed', function(assert) { - assert.notStrictEqual(this.parser, 'undefined', 'parser is defined'); - }); - - QUnit.test('can set custom parsers', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXT-X-VERSION:3', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-PROGRAM-DATE-TIME:2017-07-31T20:35:35.053+00:00', - '#VOD-STARTTIMESTAMP:1501533337573', - '#VOD-TOTALDELETEDDURATION:0.0', - '#VOD-FRAMERATE:29.97', - '' - ].join('\n'); - - this.parser.addParser({ - expression: /^#VOD-STARTTIMESTAMP/, - customType: 'startTimestamp' - }); - this.parser.addParser({ - expression: /^#VOD-TOTALDELETEDDURATION/, - customType: 'totalDeleteDuration' - }); - this.parser.addParser({ - expression: /^#VOD-FRAMERATE/, - customType: 'framerate', - dataParser: (line) => (line.split(':')[1]) - }); - - this.parser.push(manifest); - this.parser.end(); - assert.strictEqual( - this.parser.manifest.custom.startTimestamp, - '#VOD-STARTTIMESTAMP:1501533337573', - 'sets custom timestamp line' - ); - - assert.strictEqual( - this.parser.manifest.custom.totalDeleteDuration, - '#VOD-TOTALDELETEDDURATION:0.0', - 'sets custom delete duration' - ); - - assert.strictEqual(this.parser.manifest.custom.framerate, '29.97', 'sets framerate'); - }); - - QUnit.test('segment level custom data', function(assert) { - const manifest = [ - '#EXTM3U', - '#VOD-TIMING:1511816599485', - '#COMMENT', - '#EXTINF:8.0,', - 'ex1.ts', - '#VOD-TIMING', - '#EXTINF:8.0,', - 'ex2.ts', - '#VOD-TIMING:1511816615485', - '#EXT-UNKNOWN', - '#EXTINF:8.0,', - 'ex3.ts', - '#VOD-TIMING:1511816623485', - '#EXTINF:8.0,', - 'ex3.ts', - '#EXT-X-ENDLIST' - ].join('\n'); - - this.parser.addParser({ - expression: /^#VOD-TIMING/, - customType: 'vodTiming', - segment: true - }); - - this.parser.push(manifest); - this.parser.end(); - assert.equal( - this.parser.manifest.segments[0].custom.vodTiming, - '#VOD-TIMING:1511816599485', - 'parser attached segment level custom data' - ); - assert.equal( - this.parser.manifest.segments[1].custom.vodTiming, - '#VOD-TIMING', - 'parser got segment level custom data without :' - ); - }); - - QUnit.test('attaches cue-out data to segment', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXTINF:5,', - '#COMMENT', - 'ex1.ts', - '#EXT-X-CUE-OUT:10', - '#EXTINF:5,', - 'ex2.ts', - '#EXT-X-CUE-OUT15', - '#EXT-UKNOWN-TAG', - '#EXTINF:5,', - 'ex3.ts', - '#EXT-X-CUE-OUT', - '#EXTINF:5,', - 'ex3.ts', - '#EXT-X-ENDLIST' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.equal(this.parser.manifest.segments[1].cueOut, '10', 'parser attached cue out tag'); - assert.equal(this.parser.manifest.segments[2].cueOut, '15', 'cue out without : seperator'); - assert.equal(this.parser.manifest.segments[3].cueOut, '', 'cue out without data'); - }); - - QUnit.test('attaches cue-out-cont data to segment', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXTINF:5,', - '#COMMENT', - 'ex1.ts', - '#EXT-X-CUE-OUT-CONT:10/60', - '#EXTINF:5,', - 'ex2.ts', - '#EXT-X-CUE-OUT-CONT15/30', - '#EXT-UKNOWN-TAG', - '#EXTINF:5,', - 'ex3.ts', - '#EXT-X-CUE-OUT-CONT', - '#EXTINF:5,', - 'ex3.ts', - '#EXT-X-ENDLIST' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.equal( - this.parser.manifest.segments[1].cueOutCont, '10/60', - 'parser attached cue out cont tag' - ); - assert.equal( - this.parser.manifest.segments[2].cueOutCont, '15/30', - 'cue out cont without : seperator' - ); - assert.equal(this.parser.manifest.segments[3].cueOutCont, '', 'cue out cont without data'); - }); - - QUnit.test('attaches cue-in data to segment', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXTINF:5,', - '#COMMENT', - 'ex1.ts', - '#EXT-X-CUE-IN', - '#EXTINF:5,', - 'ex2.ts', - '#EXT-X-CUE-IN:15', - '#EXT-UKNOWN-TAG', - '#EXTINF:5,', - 'ex3.ts', - '#EXT-X-CUE-IN=abc', - '#EXTINF:5,', - 'ex3.ts', - '#EXT-X-ENDLIST' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.equal(this.parser.manifest.segments[1].cueIn, '', 'parser attached cue in tag'); - assert.equal(this.parser.manifest.segments[2].cueIn, '15', 'cue in with data'); - assert.equal( - this.parser.manifest.segments[3].cueIn, '=abc', - 'cue in without colon seperator' - ); - }); - - QUnit.test('parses characteristics attribute', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",CHARACTERISTICS="char",NAME="test"', - '#EXT-X-STREAM-INF:BANDWIDTH=1,CODECS="mp4a.40.2, avc1.4d400d",SUBTITLES="subs"', - 'index.m3u8' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.equal( - this.parser.manifest.mediaGroups.SUBTITLES.subs.test.characteristics, - 'char', - 'parsed CHARACTERISTICS attribute' - ); - }); - - QUnit.test('parses FORCED attribute', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",CHARACTERISTICS="char",NAME="test",FORCED=YES', - '#EXT-X-STREAM-INF:BANDWIDTH=1,CODECS="mp4a.40.2, avc1.4d400d",SUBTITLES="subs"', - 'index.m3u8' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.ok( - this.parser.manifest.mediaGroups.SUBTITLES.subs.test.forced, - 'parsed FORCED attribute' - ); - }); - - QUnit.test('parses Widevine #EXT-X-KEY attributes and attaches to manifest', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,' + - 'URI="data:text/plain;base64,AAAAPnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAB4iFnN' + - 'oYWthX2NlYzJmNjRhYTc4OTBhMTFI49yVmwY=",KEYID=0x800AACAA522958AE888062B5695DB6BF,' + - 'KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"', - '#EXTINF:5,', - 'ex1.ts', - '#EXT-X-ENDLIST' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.ok(this.parser.manifest.contentProtection, 'contentProtection property added'); - assert.equal( - this.parser.manifest.contentProtection['com.widevine.alpha'].attributes.schemeIdUri, - 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed', - 'schemeIdUri set correctly' - ); - assert.equal( - this.parser.manifest.contentProtection['com.widevine.alpha'].attributes.keyId, - '800AACAA522958AE888062B5695DB6BF', - 'keyId set correctly' - ); - assert.equal( - this.parser.manifest.contentProtection['com.widevine.alpha'].pssh.byteLength, - 62, - 'base64 URI decoded to TypedArray' - ); - }); - - QUnit.test('Widevine #EXT-X-KEY attributes not attached to manifest if METHOD is invalid', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXT-X-KEY:METHOD=NONE,' + - 'URI="data:text/plain;base64,AAAAPnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAB4iFnN' + - 'oYWthX2NlYzJmNjRhYTc4OTBhMTFI49yVmwY=",KEYID=0x800AACAA522958AE888062B5695DB6BF,' + - 'KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"', - '#EXTINF:5,', - 'ex1.ts', - '#EXT-X-ENDLIST' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.notOk(this.parser.manifest.contentProtection, 'contentProtection not added'); - }); - - QUnit.test('Widevine #EXT-X-KEY attributes not attached to manifest if URI is invalid', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,' + - 'URI="AAAAPnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAB4iFnN' + - 'oYWthX2NlYzJmNjRhYTc4OTBhMTFI49yVmwY=",KEYID=0x800AACAA522958AE888062B5695DB6BF,' + - 'KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"', - '#EXTINF:5,', - 'ex1.ts', - '#EXT-X-ENDLIST' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.notOk(this.parser.manifest.contentProtection, 'contentProtection not added'); - }); - - QUnit.test('Widevine #EXT-X-KEY attributes not attached to manifest if KEYID is invalid', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,' + - 'URI="data:text/plain;base64,AAAAPnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAB4iFnN' + - 'oYWthX2NlYzJmNjRhYTc4OTBhMTFI49yVmwY=",KEYID=800AACAA522958AE888062B5695DB6BF,' + - 'KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"', - '#EXTINF:5,', - 'ex1.ts', - '#EXT-X-ENDLIST' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.notOk(this.parser.manifest.contentProtection, 'contentProtection not added'); - }); - - QUnit.test('Widevine #EXT-X-KEY attributes not attached to manifest if KEYFORMAT is not Widevine UUID', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,' + - 'URI="data:text/plain;base64,AAAAPnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAB4iFnN' + - 'oYWthX2NlYzJmNjRhYTc4OTBhMTFI49yVmwY=",KEYID=0x800AACAA522958AE888062B5695DB6BF,' + - 'KEYFORMATVERSIONS="1",KEYFORMAT="invalid-keyformat"', - '#EXTINF:5,', - 'ex1.ts', - '#EXT-X-ENDLIST' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.notOk(this.parser.manifest.contentProtection, 'contentProtection not added'); - }); - - QUnit.test('byterange offset defaults to next byte', function(assert) { - const manifest = [ - '#EXTM3U', - '#EXTINF:5,', - '#EXT-X-BYTERANGE:10@5', - 'segment.ts', - '#EXTINF:5,', - '#EXT-X-BYTERANGE:20', - 'segment.ts', - '#EXTINF:5,', - '#EXT-X-BYTERANGE:30', - 'segment.ts', - '#EXTINF:5,', - 'segment2.ts', - '#EXT-X-BYTERANGE:15@100', - 'segment.ts', - '#EXT-X-BYTERANGE:17', - 'segment.ts', - '#EXT-X-ENDLIST' - ].join('\n'); - - this.parser.push(manifest); - this.parser.end(); - - assert.deepEqual( - this.parser.manifest.segments[0].byterange, - { length: 10, offset: 5 }, - 'first segment has correct byterange' - ); - assert.deepEqual( - this.parser.manifest.segments[1].byterange, - { length: 20, offset: 15 }, - 'second segment has correct byterange' - ); - assert.deepEqual( - this.parser.manifest.segments[2].byterange, - { length: 30, offset: 35 }, - 'third segment has correct byterange' - ); - assert.notOk(this.parser.manifest.segments[3].byterange, 'fourth segment has no byterange'); - assert.deepEqual( - this.parser.manifest.segments[4].byterange, - { length: 15, offset: 100 }, - 'fifth segment has correct byterange' - ); - // not tested is a segment with no offset coming after a segment that isn't a sub range, - // as the spec requires that a byterange without an offset must follow a segment that - // is a sub range of the same media resource - assert.deepEqual( - this.parser.manifest.segments[5].byterange, - { length: 17, offset: 115 }, - 'sixth segment has correct byterange' - ); - }); - - QUnit.module('warn/info', { - beforeEach() { - this.warnings = []; - this.infos = []; - - this.parser.on('warn', (warn) => this.warnings.push(warn.message)); - this.parser.on('info', (info) => this.infos.push(info.message)); - - } - }); - QUnit.test('warn when #EXT-X-TARGETDURATION is invalid', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:foo', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const warnings = [ - 'ignoring invalid target duration: undefined' - ]; - - assert.deepEqual( - this.warnings, - warnings, - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('warns when #EXT-X-START missing TIME-OFFSET attribute', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-START:PRECISE=YES', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - assert.deepEqual( - this.warnings, - ['ignoring start declaration without appropriate attribute list'], - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - - assert.strictEqual(typeof this.parser.manifest.start, 'undefined', 'does not parse start'); - }); - - QUnit.test('warning when #EXT-X-SKIP missing SKIPPED-SEGMENTS attribute', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-SKIP:foo=bar', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - assert.deepEqual( - this.warnings, - ['#EXT-X-SKIP lacks required attribute(s): SKIPPED-SEGMENTS'], - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('warns when #EXT-X-PART missing URI/DURATION attributes', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-PART:DURATION=1', - '#EXT-X-PART:URI=2', - '#EXT-X-PART:foo=bar', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const warnings = [ - '#EXT-X-PART #0 for segment #0 lacks required attribute(s): URI', - '#EXT-X-PART #1 for segment #0 lacks required attribute(s): DURATION', - '#EXT-X-PART #2 for segment #0 lacks required attribute(s): URI, DURATION' - ]; - - assert.deepEqual( - this.warnings, - warnings, - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('warns when #EXT-X-PRELOAD-HINT missing TYPE/URI attribute', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-PRELOAD-HINT:TYPE=foo', - '#EXT-X-PRELOAD-HINT:URI=foo', - '#EXT-X-PRELOAD-HINT:foo=bar', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const warnings = [ - '#EXT-X-PRELOAD-HINT #0 for segment #0 lacks required attribute(s): URI', - '#EXT-X-PRELOAD-HINT #1 for segment #0 lacks required attribute(s): TYPE', - '#EXT-X-PRELOAD-HINT #2 for segment #0 lacks required attribute(s): TYPE, URI' - ]; - - assert.deepEqual( - this.warnings, - warnings, - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('warns when we get #EXT-X-PRELOAD-HINT with the same TYPE', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-PRELOAD-HINT:TYPE=foo,URI=foo1', - '#EXT-X-PRELOAD-HINT:TYPE=foo,URI=foo2', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const warnings = [ - '#EXT-X-PRELOAD-HINT #1 for segment #0 has the same TYPE foo as preload hint #0' - ]; - - assert.deepEqual( - this.warnings, - warnings, - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('warn when #EXT-X-RENDITION-REPORT missing LAST-MSN/URI attribute', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-RENDITION-REPORT:URI=foo', - '#EXT-X-RENDITION-REPORT:LAST-MSN=2', - '#EXT-X-RENDITION-REPORT:foo=bar', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const warnings = [ - '#EXT-X-RENDITION-REPORT #0 lacks required attribute(s): LAST-MSN', - '#EXT-X-RENDITION-REPORT #1 lacks required attribute(s): URI', - '#EXT-X-RENDITION-REPORT #2 lacks required attribute(s): LAST-MSN, URI' - ]; - - assert.deepEqual( - this.warnings, - warnings, - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('warns when #EXT-X-RENDITION-REPORT missing LAST-PART attribute with parts', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-RENDITION-REPORT:URI=foo,LAST-MSN=4', - '#EXT-X-PART:URI=foo,DURATION=10', - '#EXT-X-RENDITION-REPORT:URI=foo,LAST-MSN=4', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const warnings = [ - '#EXT-X-RENDITION-REPORT #0 lacks required attribute(s): LAST-PART', - '#EXT-X-RENDITION-REPORT #1 lacks required attribute(s): LAST-PART' - ]; - - assert.deepEqual( - this.warnings, - warnings, - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('warns when #EXT-X-PART-INF missing PART-TARGET attribute', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-PART-INF:URI=foo', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const warnings = [ - '#EXT-X-PART-INF lacks required attribute(s): PART-TARGET' - ]; - - assert.deepEqual( - this.warnings, - warnings, - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('warns when #EXT-X-SERVER-CONTROL missing CAN-SKIP-UNTIL with CAN-SKIP-DATERANGES attribute', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=NO,HOLD-BACK=30,CAN-SKIP-DATERANGES=YES', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const warnings = [ - '#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set' - ]; - - assert.deepEqual( - this.warnings, - warnings, - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('warn when #EXT-X-SERVER-CONTROL HOLD-BACK and PART-HOLD-BACK too low', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-PART-INF:PART-TARGET=1', - '#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,HOLD-BACK=1,PART-HOLD-BACK=0.5', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const warnings = [ - '#EXT-X-SERVER-CONTROL clamping HOLD-BACK (1) to targetDuration * 3 (30)', - '#EXT-X-SERVER-CONTROL clamping PART-HOLD-BACK (0.5) to partTargetDuration * 2 (2).' - ]; - - assert.deepEqual( - this.warnings, - warnings, - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('warn when #EXT-X-SERVER-CONTROL before target durations HOLD-BACK/PART-HOLD-BACK too low', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,HOLD-BACK=1,PART-HOLD-BACK=0.5', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-PART-INF:PART-TARGET=1', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const warnings = [ - '#EXT-X-SERVER-CONTROL clamping HOLD-BACK (1) to targetDuration * 3 (30)', - '#EXT-X-SERVER-CONTROL clamping PART-HOLD-BACK (0.5) to partTargetDuration * 2 (2).' - ]; - - assert.deepEqual( - this.warnings, - warnings, - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - [], - 'info as expected' - ); - }); - - QUnit.test('info when #EXT-X-SERVER-CONTROL sets defaults', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-PART-INF:PART-TARGET=1', - '#EXT-X-SERVER-CONTROL:foo=bar', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const infos = [ - '#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false', - '#EXT-X-SERVER-CONTROL defaulting HOLD-BACK to targetDuration * 3 (30).', - '#EXT-X-SERVER-CONTROL defaulting PART-HOLD-BACK to partTargetDuration * 3 (3).' - ]; - - assert.deepEqual( - this.warnings, - [], - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - infos, - 'info as expected' - ); - }); - - QUnit.test('info when #EXT-X-SERVER-CONTROL before target durations and sets defaults', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-SERVER-CONTROL:foo=bar', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-PART-INF:PART-TARGET=1', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - const infos = [ - '#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false', - '#EXT-X-SERVER-CONTROL defaulting HOLD-BACK to targetDuration * 3 (30).', - '#EXT-X-SERVER-CONTROL defaulting PART-HOLD-BACK to partTargetDuration * 3 (3).' - ]; - - assert.deepEqual( - this.warnings, - [], - 'warnings as expected' - ); - - assert.deepEqual( - this.infos, - infos, - 'info as expected' - ); - }); - - QUnit.test('Can understand widevine/safari drm ext-x-key', function(assert) { - this.parser.push([ - '#EXT-X-VERSION:3', - '#EXT-X-MEDIA-SEQUENCE:0', - '#EXT-X-DISCONTINUITY-SEQUENCE:0', - '#EXT-X-TARGETDURATION:10', - '#EXT-X-PART-INF:PART-TARGET=1', - '#EXT-X-SERVER-CONTROL:foo=bar', - '#EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,foo",KEYID=0x555777,IV=1234567890abcdef1234567890abcdef,KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"', - '#EXT-X-KEY:METHOD=SAMPLE-AES,URI="skd://foo",KEYFORMATVERSIONS="1",KEYFORMAT="com.apple.streamingkeydelivery"', - '#EXTINF:10,', - 'media-00001.ts', - '#EXT-X-ENDLIST' - ].join('\n')); - this.parser.end(); - - assert.deepEqual( - Object.keys(this.parser.manifest.contentProtection), - ['com.widevine.alpha', 'com.apple.fps.1_0'], - 'info as expected' - ); - }); - - QUnit.module('integration'); - - for (const key in testDataExpected) { - if (!testDataManifests[key]) { - throw new Error(`${key}.js does not have an equivelent m3u8 manifest to test against`); - } - } - - for (const key in testDataManifests) { - if (!testDataExpected[key]) { - throw new Error(`${key}.m3u8 does not have an equivelent expected js file to test against`); - } - QUnit.test(`parses ${key}.m3u8 as expected in ${key}.js`, function(assert) { - this.parser.push(testDataManifests[key]()); - this.parser.end(); - - assert.deepEqual( - this.parser.manifest, - testDataExpected[key](), - key + '.m3u8 was parsed correctly' - ); - }); - } - -}); diff --git a/node_modules/min-document/.jshintrc b/node_modules/min-document/.jshintrc deleted file mode 100644 index 77887b5..0000000 --- a/node_modules/min-document/.jshintrc +++ /dev/null @@ -1,30 +0,0 @@ -{ - "maxdepth": 4, - "maxstatements": 200, - "maxcomplexity": 12, - "maxlen": 80, - "maxparams": 5, - - "curly": true, - "eqeqeq": true, - "immed": true, - "latedef": false, - "noarg": true, - "noempty": true, - "nonew": true, - "undef": true, - "unused": "vars", - "trailing": true, - - "quotmark": true, - "expr": true, - "asi": true, - - "browser": false, - "esnext": true, - "devel": false, - "node": false, - "nonstandard": false, - - "predef": ["require", "module", "__dirname", "__filename"] -} diff --git a/node_modules/min-document/.npmignore b/node_modules/min-document/.npmignore deleted file mode 100644 index fd31f5e..0000000 --- a/node_modules/min-document/.npmignore +++ /dev/null @@ -1,15 +0,0 @@ -.DS_Store -.monitor -.*.swp -.nodemonignore -releases -*.log -*.err -fleet.json -public/browserify -bin/*.json -.bin -build -compile -.lock-wscript -node_modules diff --git a/node_modules/min-document/.testem.json b/node_modules/min-document/.testem.json deleted file mode 100644 index 41ab90e..0000000 --- a/node_modules/min-document/.testem.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "launchers": { - "node": { - "command": "node ./test" - } - }, - "src_files": [ - "./**/*.js" - ], - "before_tests": "npm run build-test", - "on_exit": "rm test/static/bundle.js", - "test_page": "test/static/index.html", - "launch_in_dev": ["node", "phantomjs"] -} diff --git a/node_modules/min-document/.travis.yml b/node_modules/min-document/.travis.yml deleted file mode 100644 index 52424f8..0000000 --- a/node_modules/min-document/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - 0.8 - - 0.9 - - 0.10 -script: node ./test/index.js diff --git a/node_modules/min-document/CONTRIBUTION.md b/node_modules/min-document/CONTRIBUTION.md deleted file mode 100644 index 4e78bdf..0000000 --- a/node_modules/min-document/CONTRIBUTION.md +++ /dev/null @@ -1,48 +0,0 @@ -# This is an OPEN Open Source Project - -## What? - -Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. - -## Rules - -There are a few basic ground-rules for contributors: - - - No --force pushes or modifying the Git history in any way. - - Non-master branches ought to be used for ongoing work. - - External API changes and significant modifications ought to be subject to an internal pull-request to solicit feedback from other contributors. - - Internal pull-requests to solicit feedback are encouraged for any other non-trivial contribution but left to the discretion of the contributor. - - For significant changes wait a full 24 hours before merging so that active contributors who are distributed throughout the world have a chance to weigh in. - - Contributors should attempt to adhere to the prevailing code-style. -Releases - -Declaring formal releases requires peer review. - - - A reviewer of a pull request should recommend a new version number (patch, minor or major). - - Once your change is merged feel free to bump the version as recommended by the reviewer. - - A new version number should not be cut without peer review unless done by the project maintainer. - -## Want to contribute? - -Even though collaborators may contribute as they see fit, if you are not sure what to do, here's a suggested process: - -## Cutting a new version - - - Get your branch merged on master - - Run `npm version major` or `npm version minor` or `npm version patch` - - `git push origin master --tags` - - If you are a project owner, then `npm publish` - -## If you want to have a bug fixed or a feature added: - - - Check open issues for what you want. - - If there is an open issue, comment on it, otherwise open an issue describing your bug or feature with use cases. - - Discussion happens on the issue about how to solve your problem. - - You or a core contributor opens a pull request solving the issue with tests and documentation. - - The pull requests gets reviewed and then merged. - - A new release version get's cut. - - (Disclaimer: Your feature might get rejected.) - -### Changes to this arrangement - -This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change. diff --git a/node_modules/min-document/LICENCE b/node_modules/min-document/LICENCE deleted file mode 100644 index 72d356c..0000000 --- a/node_modules/min-document/LICENCE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Colingo. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/min-document/README.md b/node_modules/min-document/README.md deleted file mode 100644 index 970b47d..0000000 --- a/node_modules/min-document/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# min-document - -[![build status][1]][2] [![dependency status][3]][4] - - - -A minimal DOM implementation - -## Example - -```js -var document = require("min-document") - -var div = document.createElement("div") -div.className = "foo bar" - -var span = document.createElement("span") -div.appendChild(span) -span.textContent = "Hello!" - -/*
    - Hello! -
    -*/ -var html = String(div) -``` - -## Installation - -`npm install min-document` - -## Contributors - - - Raynos - -## MIT Licenced - - [1]: https://secure.travis-ci.org/Raynos/min-document.png - [2]: https://travis-ci.org/Raynos/min-document - [3]: https://david-dm.org/Raynos/min-document.png - [4]: https://david-dm.org/Raynos/min-document - [5]: https://ci.testling.com/Raynos/min-document.png - [6]: https://ci.testling.com/Raynos/min-document diff --git a/node_modules/min-document/docs.mli b/node_modules/min-document/docs.mli deleted file mode 100644 index ad17b4a..0000000 --- a/node_modules/min-document/docs.mli +++ /dev/null @@ -1,156 +0,0 @@ -type Comment := { - data: String, - length: Number, - nodeName: "#comment", - nodeType: 8, - nodeValue: String, - ownerDoucment: null | Document, - - toString: (this: Comment) => String -} - -type DOMText := { - data: String, - type: "DOMTextNode", - length: Number, - nodeType: 3, - - toString: (this: DOMText) => String, - replaceChild: ( - this: DOMText, - index: Number, - length: Number, - value: String - ) => void -} - -type DOMNode := DOMText | DOMElement | DocumentFragment -type DOMChild := DOMText | DOMElement - -type DOMElement := { - tagName: String, - className: String, - dataset: Object, - childNodes: Array, - parentNode: null | DOMElement, - style: Object, - type: "DOMElement", - nodeType: 1, - ownerDoucment: null | Document, - namespaceURI: null | String, - - appendChild: (this: DOMElement, child: DOMChild) => DOMChild, - replaceChild:( - this: DOMElement, - elem: DOMChild, - needle: DOMChild - ) => DOMChild, - removeChild: (this: DOMElement, child: DOMChild) => DOMChild, - insertBefore: ( - this: DOMElement, - elem: DOMChild, - needle: DOMChild | null | undefined - ) => DOMChild, - addEventListener: addEventListener, - dispatchEvent: dispatchEvent, - focus: () => void, - toString: (this: DOMElement) => String, - getElementsByClassName: ( - this: DOMElement, - className: String - ) => Array, - getElementsByTagName: ( - this: DOMElement, - tagName: String - ) => Array, -} - -type DocumentFragment := { - childNodes: Array, - parentNode: null | DOMElement, - type: "DocumentFragment", - nodeType: 11, - nodeName: "#document-fragment", - ownerDoucment: Document | null, - - appendChild: (this: DocumentFragment, child: DOMChild), - replaceChild: - (this: DocumentFragment, elem: DOMChild, needle: DOMChild), - removeChild: (this: DocumentFragment, child: DOMChild), - toString: (this: DocumentFragment) => String -} - -type Document := { - body: DOMElement, - childNodes: Array, - documentElement: DOMElement, - nodeType: 9, - - createComment: (this: Document, data: String) => Commment, - createTextNode: (this: Document, value: String) => DOMText, - createElement: (this: Document, tagName: String) => DOMElement, - createElementNS: ( - this: Document, - namespace: String | null, - tagName: String - ) => DOMElement, - createDocumentFragment: (this: Document) => DocumentFragment, - createEvent: () => Event, - getElementById: ( - this: Document, - id: String, - ) => null | DOMElement, - getElementsByClassName: ( - this: Document, - className: String - ) => Array, - getElementsByTagName: ( - this: Document, - tagName: String - ) => Array -} - -type Event := { - type: String, - bubbles: Boolean, - cancelable: Boolean, - - initEvent: ( - this: Event, - type: String, - bubbles: Boolean, - cancelable: Boolean - ) => void -} - -type addEventListener := ( - this: DOMElement, - type: String, - listener: Listener -) => void - -type dispatchEvent := ( - this: DOMElement, - ev: Event -) - -min-document/event/add-event-listener := addEventListener - -min-document/event/dispatch-event := dispatchEvent - -min-document/document := () => Document - -min-document/dom-element := - (tagName: String, owner?: Document, namespace?: String | null) => DOMElement - -min-document/dom-fragment := - (owner?: Document) => DocumentFragment - -min-document/dom-text := - (value: String, owner?: Document) => DOMText - -min-document/event := () => Event - -min-document/serialize := (DOMElement) => String - -min-document := Document diff --git a/node_modules/min-document/document.js b/node_modules/min-document/document.js deleted file mode 100644 index d929cbd..0000000 --- a/node_modules/min-document/document.js +++ /dev/null @@ -1,72 +0,0 @@ -var domWalk = require("dom-walk") - -var Comment = require("./dom-comment.js") -var DOMText = require("./dom-text.js") -var DOMElement = require("./dom-element.js") -var DocumentFragment = require("./dom-fragment.js") -var Event = require("./event.js") -var dispatchEvent = require("./event/dispatch-event.js") -var addEventListener = require("./event/add-event-listener.js") -var removeEventListener = require("./event/remove-event-listener.js") - -module.exports = Document; - -function Document() { - if (!(this instanceof Document)) { - return new Document(); - } - - this.head = this.createElement("head") - this.body = this.createElement("body") - this.documentElement = this.createElement("html") - this.documentElement.appendChild(this.head) - this.documentElement.appendChild(this.body) - this.childNodes = [this.documentElement] - this.nodeType = 9 -} - -var proto = Document.prototype; -proto.createTextNode = function createTextNode(value) { - return new DOMText(value, this) -} - -proto.createElementNS = function createElementNS(namespace, tagName) { - var ns = namespace === null ? null : String(namespace) - return new DOMElement(tagName, this, ns) -} - -proto.createElement = function createElement(tagName) { - return new DOMElement(tagName, this) -} - -proto.createDocumentFragment = function createDocumentFragment() { - return new DocumentFragment(this) -} - -proto.createEvent = function createEvent(family) { - return new Event(family) -} - -proto.createComment = function createComment(data) { - return new Comment(data, this) -} - -proto.getElementById = function getElementById(id) { - id = String(id) - - var result = domWalk(this.childNodes, function (node) { - if (String(node.id) === id) { - return node - } - }) - - return result || null -} - -proto.getElementsByClassName = DOMElement.prototype.getElementsByClassName -proto.getElementsByTagName = DOMElement.prototype.getElementsByTagName -proto.contains = DOMElement.prototype.contains - -proto.removeEventListener = removeEventListener -proto.addEventListener = addEventListener -proto.dispatchEvent = dispatchEvent diff --git a/node_modules/min-document/dom-comment.js b/node_modules/min-document/dom-comment.js deleted file mode 100644 index 132ea37..0000000 --- a/node_modules/min-document/dom-comment.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = Comment - -function Comment(data, owner) { - if (!(this instanceof Comment)) { - return new Comment(data, owner) - } - - this.data = data - this.nodeValue = data - this.length = data.length - this.ownerDocument = owner || null -} - -Comment.prototype.nodeType = 8 -Comment.prototype.nodeName = "#comment" - -Comment.prototype.toString = function _Comment_toString() { - return "[object Comment]" -} diff --git a/node_modules/min-document/dom-element.js b/node_modules/min-document/dom-element.js deleted file mode 100644 index 73ff10e..0000000 --- a/node_modules/min-document/dom-element.js +++ /dev/null @@ -1,209 +0,0 @@ -var domWalk = require("dom-walk") -var dispatchEvent = require("./event/dispatch-event.js") -var addEventListener = require("./event/add-event-listener.js") -var removeEventListener = require("./event/remove-event-listener.js") -var serializeNode = require("./serialize.js") - -var htmlns = "http://www.w3.org/1999/xhtml" - -module.exports = DOMElement - -function DOMElement(tagName, owner, namespace) { - if (!(this instanceof DOMElement)) { - return new DOMElement(tagName) - } - - var ns = namespace === undefined ? htmlns : (namespace || null) - - this.tagName = ns === htmlns ? String(tagName).toUpperCase() : tagName - this.nodeName = this.tagName - this.className = "" - this.dataset = {} - this.childNodes = [] - this.parentNode = null - this.style = {} - this.ownerDocument = owner || null - this.namespaceURI = ns - this._attributes = {} - - if (this.tagName === 'INPUT') { - this.type = 'text' - } -} - -DOMElement.prototype.type = "DOMElement" -DOMElement.prototype.nodeType = 1 - -DOMElement.prototype.appendChild = function _Element_appendChild(child) { - if (child.parentNode) { - child.parentNode.removeChild(child) - } - - this.childNodes.push(child) - child.parentNode = this - - return child -} - -DOMElement.prototype.replaceChild = - function _Element_replaceChild(elem, needle) { - // TODO: Throw NotFoundError if needle.parentNode !== this - - if (elem.parentNode) { - elem.parentNode.removeChild(elem) - } - - var index = this.childNodes.indexOf(needle) - - needle.parentNode = null - this.childNodes[index] = elem - elem.parentNode = this - - return needle - } - -DOMElement.prototype.removeChild = function _Element_removeChild(elem) { - // TODO: Throw NotFoundError if elem.parentNode !== this - - var index = this.childNodes.indexOf(elem) - this.childNodes.splice(index, 1) - - elem.parentNode = null - return elem -} - -DOMElement.prototype.insertBefore = - function _Element_insertBefore(elem, needle) { - // TODO: Throw NotFoundError if referenceElement is a dom node - // and parentNode !== this - - if (elem.parentNode) { - elem.parentNode.removeChild(elem) - } - - var index = needle === null || needle === undefined ? - -1 : - this.childNodes.indexOf(needle) - - if (index > -1) { - this.childNodes.splice(index, 0, elem) - } else { - this.childNodes.push(elem) - } - - elem.parentNode = this - return elem - } - -DOMElement.prototype.setAttributeNS = - function _Element_setAttributeNS(namespace, name, value) { - var prefix = null - var localName = name - var colonPosition = name.indexOf(":") - if (colonPosition > -1) { - prefix = name.substr(0, colonPosition) - localName = name.substr(colonPosition + 1) - } - if (this.tagName === 'INPUT' && name === 'type') { - this.type = value; - } - else { - var attributes = this._attributes[namespace] || (this._attributes[namespace] = {}) - attributes[localName] = {value: value, prefix: prefix} - } - } - -DOMElement.prototype.getAttributeNS = - function _Element_getAttributeNS(namespace, name) { - var attributes = this._attributes[namespace]; - var value = attributes && attributes[name] && attributes[name].value - if (this.tagName === 'INPUT' && name === 'type') { - return this.type; - } - if (typeof value !== "string") { - return null - } - return value - } - -DOMElement.prototype.removeAttributeNS = - function _Element_removeAttributeNS(namespace, name) { - var attributes = this._attributes[namespace]; - if (attributes) { - delete attributes[name] - } - } - -DOMElement.prototype.hasAttributeNS = - function _Element_hasAttributeNS(namespace, name) { - var attributes = this._attributes[namespace] - return !!attributes && name in attributes; - } - -DOMElement.prototype.setAttribute = function _Element_setAttribute(name, value) { - return this.setAttributeNS(null, name, value) -} - -DOMElement.prototype.getAttribute = function _Element_getAttribute(name) { - return this.getAttributeNS(null, name) -} - -DOMElement.prototype.removeAttribute = function _Element_removeAttribute(name) { - return this.removeAttributeNS(null, name) -} - -DOMElement.prototype.hasAttribute = function _Element_hasAttribute(name) { - return this.hasAttributeNS(null, name) -} - -DOMElement.prototype.removeEventListener = removeEventListener -DOMElement.prototype.addEventListener = addEventListener -DOMElement.prototype.dispatchEvent = dispatchEvent - -// Un-implemented -DOMElement.prototype.focus = function _Element_focus() { - return void 0 -} - -DOMElement.prototype.toString = function _Element_toString() { - return serializeNode(this) -} - -DOMElement.prototype.getElementsByClassName = function _Element_getElementsByClassName(classNames) { - var classes = classNames.split(" "); - var elems = [] - - domWalk(this, function (node) { - if (node.nodeType === 1) { - var nodeClassName = node.className || "" - var nodeClasses = nodeClassName.split(" ") - - if (classes.every(function (item) { - return nodeClasses.indexOf(item) !== -1 - })) { - elems.push(node) - } - } - }) - - return elems -} - -DOMElement.prototype.getElementsByTagName = function _Element_getElementsByTagName(tagName) { - tagName = tagName.toLowerCase() - var elems = [] - - domWalk(this.childNodes, function (node) { - if (node.nodeType === 1 && (tagName === '*' || node.tagName.toLowerCase() === tagName)) { - elems.push(node) - } - }) - - return elems -} - -DOMElement.prototype.contains = function _Element_contains(element) { - return domWalk(this, function (node) { - return element === node - }) || false -} diff --git a/node_modules/min-document/dom-fragment.js b/node_modules/min-document/dom-fragment.js deleted file mode 100644 index d4bac92..0000000 --- a/node_modules/min-document/dom-fragment.js +++ /dev/null @@ -1,28 +0,0 @@ -var DOMElement = require("./dom-element.js") - -module.exports = DocumentFragment - -function DocumentFragment(owner) { - if (!(this instanceof DocumentFragment)) { - return new DocumentFragment() - } - - this.childNodes = [] - this.parentNode = null - this.ownerDocument = owner || null -} - -DocumentFragment.prototype.type = "DocumentFragment" -DocumentFragment.prototype.nodeType = 11 -DocumentFragment.prototype.nodeName = "#document-fragment" - -DocumentFragment.prototype.appendChild = DOMElement.prototype.appendChild -DocumentFragment.prototype.replaceChild = DOMElement.prototype.replaceChild -DocumentFragment.prototype.removeChild = DOMElement.prototype.removeChild - -DocumentFragment.prototype.toString = - function _DocumentFragment_toString() { - return this.childNodes.map(function (node) { - return String(node) - }).join("") - } diff --git a/node_modules/min-document/dom-text.js b/node_modules/min-document/dom-text.js deleted file mode 100644 index 4a6c6b9..0000000 --- a/node_modules/min-document/dom-text.js +++ /dev/null @@ -1,27 +0,0 @@ -module.exports = DOMText - -function DOMText(value, owner) { - if (!(this instanceof DOMText)) { - return new DOMText(value) - } - - this.data = value || "" - this.length = this.data.length - this.ownerDocument = owner || null -} - -DOMText.prototype.type = "DOMTextNode" -DOMText.prototype.nodeType = 3 -DOMText.prototype.nodeName = "#text" - -DOMText.prototype.toString = function _Text_toString() { - return this.data -} - -DOMText.prototype.replaceData = function replaceData(index, length, value) { - var current = this.data - var left = current.substring(0, index) - var right = current.substring(index + length, current.length) - this.data = left + value + right - this.length = this.data.length -} diff --git a/node_modules/min-document/event.js b/node_modules/min-document/event.js deleted file mode 100644 index 0a989c3..0000000 --- a/node_modules/min-document/event.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = Event - -function Event(family) {} - -Event.prototype.initEvent = function _Event_initEvent(type, bubbles, cancelable) { - this.type = type - this.bubbles = bubbles - this.cancelable = cancelable -} - -Event.prototype.preventDefault = function _Event_preventDefault() { - -} diff --git a/node_modules/min-document/event/add-event-listener.js b/node_modules/min-document/event/add-event-listener.js deleted file mode 100644 index 022c7ef..0000000 --- a/node_modules/min-document/event/add-event-listener.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = addEventListener - -function addEventListener(type, listener) { - var elem = this - - if (!elem.listeners) { - elem.listeners = {} - } - - if (!elem.listeners[type]) { - elem.listeners[type] = [] - } - - if (elem.listeners[type].indexOf(listener) === -1) { - elem.listeners[type].push(listener) - } -} diff --git a/node_modules/min-document/event/dispatch-event.js b/node_modules/min-document/event/dispatch-event.js deleted file mode 100644 index 8febc99..0000000 --- a/node_modules/min-document/event/dispatch-event.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = dispatchEvent - -function dispatchEvent(ev) { - var elem = this - var type = ev.type - - if (!ev.target) { - ev.target = elem - } - - if (!elem.listeners) { - elem.listeners = {} - } - - var listeners = elem.listeners[type] - - if (listeners) { - return listeners.forEach(function (listener) { - ev.currentTarget = elem - if (typeof listener === 'function') { - listener(ev) - } else { - listener.handleEvent(ev) - } - }) - } - - if (elem.parentNode) { - elem.parentNode.dispatchEvent(ev) - } -} diff --git a/node_modules/min-document/event/remove-event-listener.js b/node_modules/min-document/event/remove-event-listener.js deleted file mode 100644 index d96091b..0000000 --- a/node_modules/min-document/event/remove-event-listener.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = removeEventListener - -function removeEventListener(type, listener) { - var elem = this - - if (!elem.listeners) { - return - } - - if (!elem.listeners[type]) { - return - } - - var list = elem.listeners[type] - var index = list.indexOf(listener) - if (index !== -1) { - list.splice(index, 1) - } -} diff --git a/node_modules/min-document/index.js b/node_modules/min-document/index.js deleted file mode 100644 index 0d97e8e..0000000 --- a/node_modules/min-document/index.js +++ /dev/null @@ -1,3 +0,0 @@ -var Document = require('./document.js'); - -module.exports = new Document(); diff --git a/node_modules/min-document/package.json b/node_modules/min-document/package.json deleted file mode 100644 index 99933d5..0000000 --- a/node_modules/min-document/package.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "_from": "min-document@^2.19.0", - "_id": "min-document@2.19.0", - "_inBundle": false, - "_integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", - "_location": "/min-document", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "min-document@^2.19.0", - "name": "min-document", - "escapedName": "min-document", - "rawSpec": "^2.19.0", - "saveSpec": null, - "fetchSpec": "^2.19.0" - }, - "_requiredBy": [ - "/global" - ], - "_resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "_shasum": "7bd282e3f5842ed295bb748cdd9f1ffa2c824685", - "_spec": "min-document@^2.19.0", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\global", - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "bugs": { - "url": "https://github.com/Raynos/min-document/issues", - "email": "raynos2@gmail.com" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Raynos" - } - ], - "dependencies": { - "dom-walk": "^0.1.0" - }, - "deprecated": false, - "description": "A minimal DOM implementation", - "devDependencies": { - "run-browser": "git://github.com/Raynos/run-browser.git", - "tap-dot": "^0.2.1", - "tap-spec": "^0.1.8", - "tape": "^2.12.3" - }, - "homepage": "https://github.com/Raynos/min-document", - "keywords": [], - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/Raynos/min-document/raw/master/LICENSE" - } - ], - "main": "index", - "name": "min-document", - "repository": { - "type": "git", - "url": "git://github.com/Raynos/min-document.git" - }, - "scripts": { - "browser": "run-browser test/index.js", - "cover": "istanbul cover --report none --print detail ./test/index.js", - "dot": "node ./test/index.js | tap-dot", - "phantom": "run-browser test/index.js -b | tap-spec", - "test": "node ./test/index.js | tap-spec", - "view-cover": "istanbul report html && google-chrome ./coverage/index.html" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "ie/8..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "2.19.0" -} diff --git a/node_modules/min-document/serialize.js b/node_modules/min-document/serialize.js deleted file mode 100644 index 4411d3c..0000000 --- a/node_modules/min-document/serialize.js +++ /dev/null @@ -1,139 +0,0 @@ -module.exports = serializeNode - -var voidElements = ["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]; - -function serializeNode(node) { - switch (node.nodeType) { - case 3: - return escapeText(node.data) - case 8: - return "" - default: - return serializeElement(node) - } -} - -function serializeElement(elem) { - var strings = [] - - var tagname = elem.tagName - - if (elem.namespaceURI === "http://www.w3.org/1999/xhtml") { - tagname = tagname.toLowerCase() - } - - strings.push("<" + tagname + properties(elem) + datasetify(elem)) - - if (voidElements.indexOf(tagname) > -1) { - strings.push(" />") - } else { - strings.push(">") - - if (elem.childNodes.length) { - strings.push.apply(strings, elem.childNodes.map(serializeNode)) - } else if (elem.textContent || elem.innerText) { - strings.push(escapeText(elem.textContent || elem.innerText)) - } else if (elem.innerHTML) { - strings.push(elem.innerHTML) - } - - strings.push("") - } - - return strings.join("") -} - -function isProperty(elem, key) { - var type = typeof elem[key] - - if (key === "style" && Object.keys(elem.style).length > 0) { - return true - } - - return elem.hasOwnProperty(key) && - (type === "string" || type === "boolean" || type === "number") && - key !== "nodeName" && key !== "className" && key !== "tagName" && - key !== "textContent" && key !== "innerText" && key !== "namespaceURI" && key !== "innerHTML" -} - -function stylify(styles) { - if (typeof styles === 'string') return styles - var attr = "" - Object.keys(styles).forEach(function (key) { - var value = styles[key] - key = key.replace(/[A-Z]/g, function(c) { - return "-" + c.toLowerCase(); - }) - attr += key + ":" + value + ";" - }) - return attr -} - -function datasetify(elem) { - var ds = elem.dataset - var props = [] - - for (var key in ds) { - props.push({ name: "data-" + key, value: ds[key] }) - } - - return props.length ? stringify(props) : "" -} - -function stringify(list) { - var attributes = [] - list.forEach(function (tuple) { - var name = tuple.name - var value = tuple.value - - if (name === "style") { - value = stylify(value) - } - - attributes.push(name + "=" + "\"" + escapeAttributeValue(value) + "\"") - }) - - return attributes.length ? " " + attributes.join(" ") : "" -} - -function properties(elem) { - var props = [] - for (var key in elem) { - if (isProperty(elem, key)) { - props.push({ name: key, value: elem[key] }) - } - } - - for (var ns in elem._attributes) { - for (var attribute in elem._attributes[ns]) { - var prop = elem._attributes[ns][attribute] - var name = (prop.prefix ? prop.prefix + ":" : "") + attribute - props.push({ name: name, value: prop.value }) - } - } - - if (elem.className) { - props.push({ name: "class", value: elem.className }) - } - - return props.length ? stringify(props) : "" -} - -function escapeText(s) { - var str = ''; - - if (typeof(s) === 'string') { - str = s; - } else if (s) { - str = s.toString(); - } - - return str - .replace(/&/g, "&") - .replace(//g, ">") -} - -function escapeAttributeValue(str) { - return escapeText(str).replace(/"/g, """) -} diff --git a/node_modules/min-document/test/cleanup.js b/node_modules/min-document/test/cleanup.js deleted file mode 100644 index d3ae66a..0000000 --- a/node_modules/min-document/test/cleanup.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = Cleanup - -function Cleanup (document) { - - return cleanup - - function cleanup () { - var childNodes = document.body.childNodes - for (var i = 0; i < childNodes.length; i++) { - document.body.removeChild(childNodes[i]) - } - } -} diff --git a/node_modules/min-document/test/index.js b/node_modules/min-document/test/index.js deleted file mode 100644 index 14b736a..0000000 --- a/node_modules/min-document/test/index.js +++ /dev/null @@ -1,14 +0,0 @@ -var testDocument = require("./test-document") -var testDomElement = require("./test-dom-element") -var testDomComment = require("./test-dom-comment") -var document = require("../index") - -testDocument(document) -testDomElement(document) -testDomComment(document) - -if (typeof window !== "undefined" && window.document) { - testDocument(window.document) - testDomElement(window.document) - testDomComment(window.document) -} diff --git a/node_modules/min-document/test/static/index.html b/node_modules/min-document/test/static/index.html deleted file mode 100644 index 60f6ef8..0000000 --- a/node_modules/min-document/test/static/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - TAPE Example - - - - - - - diff --git a/node_modules/min-document/test/static/test-adapter.js b/node_modules/min-document/test/static/test-adapter.js deleted file mode 100644 index c512792..0000000 --- a/node_modules/min-document/test/static/test-adapter.js +++ /dev/null @@ -1,49 +0,0 @@ -(function () { - var Testem = window.Testem - var regex = /^((?:not )?ok) (\d+) (.+)$/ - - Testem.useCustomAdapter(tapAdapter) - - function tapAdapter(socket){ - var results = { - failed: 0 - , passed: 0 - , total: 0 - , tests: [] - } - - socket.emit('tests-start') - - Testem.handleConsoleMessage = function(msg){ - var m = msg.match(regex) - if (m) { - var passed = m[1] === 'ok' - var test = { - passed: passed ? 1 : 0, - failed: passed ? 0 : 1, - total: 1, - id: m[2], - name: m[3], - items: [] - } - - if (passed) { - results.passed++ - } else { - results.failed++ - } - - results.total++ - - socket.emit('test-result', test) - results.tests.push(test) - } else if (msg === '# ok' || msg.match(/^# tests \d+/)){ - socket.emit('all-test-results', results) - } - - // return false if you want to prevent the console message from - // going to the console - // return false - } - } -}()) diff --git a/node_modules/min-document/test/test-document.js b/node_modules/min-document/test/test-document.js deleted file mode 100644 index 282d9df..0000000 --- a/node_modules/min-document/test/test-document.js +++ /dev/null @@ -1,564 +0,0 @@ -var test = require("tape") - -module.exports = testDocument - -function testDocument(document) { - var cleanup = require('./cleanup')(document) - var Event = require('../event'); - - test("document is a Document", function (assert) { - assert.equal(typeof document.createTextNode, "function") - assert.equal(typeof document.createElement, "function") - assert.equal(typeof document.createDocumentFragment, "function") - - assert.end() - }) - - test("document has a head property", function(assert) { - assert.equal(document.head.tagName, "HEAD") - assert.end() - }) - - test("document has nodeType 9", function (assert) { - assert.equal(document.nodeType, 9) - assert.end() - }) - - test("can do stuff", function (assert) { - var div = document.createElement("div") - div.className = "foo bar" - - var span = document.createElement("span") - div.appendChild(span) - span.textContent = "Hello! <&>" - - var html = String(div.outerHTML || div) - - assert.equal(html, "
    " + - "Hello! <&>
    ") - - cleanup() - assert.end() - }) - - test("can createDocumentFragment", function (assert) { - var frag = document.createDocumentFragment() - - assert.equal(frag.nodeType, 11) - - var h1 = document.createElement("h1") - var h2 = document.createElement("h2") - - assert.equal(h1.nodeType, 1) - assert.equal(h1.nodeType, 1) - - frag.appendChild(h1) - assert.equal(fragString(frag), "

    ") - - frag.appendChild(h2) - assert.equal(fragString(frag), "

    ") - - frag.removeChild(h1) - assert.equal(fragString(frag), "

    ") - - frag.replaceChild(h1, h2) - assert.equal(fragString(frag), "

    ") - - cleanup() - assert.end() - }) - - test("can getElementById", function (assert) { - - function append_div(id, parent) { - var div = document.createElement("div") - div.id = id - parent.appendChild(div) - return div - } - - var div1 = append_div(1, document.body) - var div2 = append_div(2, document.body) - var div3 = append_div(3, document.body) - - var div11 = append_div(11, div1) - var div12 = append_div(12, div1) - var div21 = append_div(21, div2) - var div22 = append_div(22, div2) - var div221 = append_div(221, div22) - var div222 = append_div(222, div22) - - assert.equal(document.getElementById(1), div1) - assert.equal(document.getElementById("2"), div2) - assert.equal(document.getElementById(3), div3) - assert.equal(document.getElementById(11), div11) - assert.equal(document.getElementById(12), div12) - assert.equal(document.getElementById(21), div21) - assert.equal(document.getElementById(22), div22) - assert.equal(document.getElementById(221), div221) - assert.equal(document.getElementById(222), div222) - - cleanup() - assert.end() - }) - - test("can getElementsByClassName for a single class", function(assert) { - function append_div(className, parent) { - var div = document.createElement("div") - div.className = className - parent.appendChild(div) - return div - } - - function assertSingleMatch(className, expectedElement) { - var result = document.getElementsByClassName(className) - assert.equal(result.length, 1) - assert.equal(result[0], expectedElement) - } - - var divA = append_div("A", document.body) - var divB = append_div("B", document.body) - var divC = append_div("C", document.body) - - var divA1 = append_div("A1", divA) - var divA2 = append_div("A2", divA) - var divB1 = append_div("B1", divB) - var divB2 = append_div("B2", divB) - var divB2a = append_div("B2a", divB2) - var divB2b = append_div("B2b", divB2) - - assertSingleMatch("A", divA) - assertSingleMatch("B", divB) - assertSingleMatch("C", divC) - assertSingleMatch("A1", divA1) - assertSingleMatch("A2", divA2) - assertSingleMatch("B1", divB1) - assertSingleMatch("B2", divB2) - assertSingleMatch("B2a", divB2a) - assertSingleMatch("B2b", divB2b) - - cleanup() - assert.end() - }) - - test("can getElementsByClassName for many elements", function (assert) { - function h(className) { - var div = document.createElement("div") - div.className = className - return div - } - - document.body.appendChild(h("multi-class-bar")) - document.body.appendChild(h("multi-class-bar")) - - var elems = document.getElementsByClassName("multi-class-bar") - assert.equal(elems.length, 2) - - cleanup() - assert.end() - }) - - test("can getElementsByClassName for many classes", function(assert) { - function append_div(classNames, parent) { - var div = document.createElement("div") - div.className = classNames - parent.appendChild(div) - return div - } - - function assertMatch(classNames, expectedElements) { - var result = document.getElementsByClassName(classNames) - assert.equal(result.length, expectedElements.length) - for (var i = 0; i < expectedElements.length; i++) { - assert.notEqual(expectedElements.indexOf(result[i]), -1) - } - } - - var divXYZ = append_div("X Y Z", document.body) - var divYZ = append_div("Y Z", document.body) - var divZX = append_div("Z X", document.body) - - var divX1X2 = append_div("X1 X2", divXYZ) - var divX1X2Y1 = append_div("X1 X2 Y1", divXYZ) - - - assertMatch("X", [divXYZ, divZX]) - assertMatch("Y Z", [divXYZ, divYZ]) - assertMatch("X Y Z", [divXYZ]) - assertMatch("X1 X2", [divX1X2, divX1X2Y1]) - - cleanup() - assert.end() - }) - - test("can create/manipulate textnodes", function (assert) { - var textnode = document.createTextNode("hello") - - assert.equal(textnode.nodeType, 3) - assert.equal(textnode.data, "hello") - assert.equal(typeof textnode.replaceData, "function") - - textnode.replaceData(0, 7, "nightly") - assert.equal(textnode.nodeType, 3) - assert.equal(textnode.data, "nightly") - assert.equal(typeof textnode.replaceData, "function") - - textnode.replaceData(1, 1, "ou") - assert.equal(textnode.nodeType, 3) - assert.equal(textnode.data, "noughtly") - - assert.end() - }) - - test("owner document is set", function (assert) { - var textnode = document.createTextNode("hello") - var domnode = document.createElement("div") - var fragment = document.createDocumentFragment() - - assert.equal(textnode.ownerDocument, document) - assert.equal(domnode.ownerDocument, document) - assert.equal(fragment.ownerDocument, document) - - assert.end() - }) - - test("Create namespaced nodes", function (assert) { - var svgURI = "http://www.w3.org/2000/svg" - var htmlURI = "http://www.w3.org/1999/xhtml" - - var noNS = document.createElement("div") - var svgNS = document.createElementNS(svgURI, "svg") - var emptyNS = document.createElementNS("", "div") - var nullNS = document.createElementNS(null, "div") - var undefNS = document.createElementNS(undefined, "div") - var caseNS = document.createElementNS("Oops", "AbC") - var htmlNS = document.createElement("div") - - assert.equal(noNS.tagName, "DIV") - assert.equal(noNS.namespaceURI, htmlURI) - assert.equal(elemString(noNS), "
    ") - - assert.equal(svgNS.tagName, "svg") - assert.equal(svgNS.namespaceURI, svgURI) - assert.equal(elemString(svgNS), "") - - assert.equal(emptyNS.tagName, "div") - assert.equal(emptyNS.namespaceURI, null) - assert.equal(elemString(emptyNS), "
    ") - - assert.equal(nullNS.tagName, "div") - assert.equal(nullNS.namespaceURI, null) - assert.equal(elemString(nullNS), "
    ") - - assert.equal(undefNS.tagName, "div") - assert.equal(undefNS.namespaceURI, "undefined") - assert.equal(elemString(undefNS), "
    ") - - assert.equal(caseNS.tagName, "AbC") - assert.equal(caseNS.namespaceURI, "Oops") - assert.equal(elemString(caseNS), "") - - assert.equal(htmlNS.tagName, "DIV") - assert.equal(htmlNS.namespaceURI, htmlURI) - assert.equal(elemString(htmlNS), "
    ") - - assert.end() - }) - - test("Can insert before", function (assert) { - var rootNode = document.createElement("div") - var child = document.createElement("div") - var newElement = document.createElement("div") - rootNode.appendChild(child) - var el = rootNode.insertBefore(newElement, child) - assert.equal(el, newElement) - assert.equal(rootNode.childNodes.length, 2) - assert.equal(rootNode.childNodes[0], newElement) - assert.equal(rootNode.childNodes[1], child) - cleanup() - assert.end() - }) - - test("Insert before null appends to end", function (assert) { - var rootNode = document.createElement("div") - var child = document.createElement("div") - var newElement = document.createElement("div") - rootNode.appendChild(child) - var el = rootNode.insertBefore(newElement, null) - assert.equal(el, newElement) - assert.equal(rootNode.childNodes.length, 2) - assert.equal(rootNode.childNodes[0], child) - assert.equal(rootNode.childNodes[1], newElement) - cleanup() - assert.end() - }) - - test("Node insertions remove node from parent", function (assert) { - var parent = document.createElement("div") - var c1 = document.createElement("div") - var c2 = document.createElement("div") - var c3 = document.createElement("div") - parent.appendChild(c1) - parent.appendChild(c2) - parent.appendChild(c3) - - var rootNode = document.createElement("div") - - var node1 = rootNode.appendChild(c1) - assert.equal(node1, c1) - assert.equal(parent.childNodes.length, 2) - assert.equal(c1.parentNode, rootNode) - - var node2 = rootNode.insertBefore(c2, c1) - assert.equal(node2, c2) - assert.equal(parent.childNodes.length, 1) - assert.equal(c2.parentNode, rootNode) - - var node3 = rootNode.replaceChild(c3, c2) - assert.equal(node3, c2) - assert.equal(parent.childNodes.length, 0) - assert.equal(c3.parentNode, rootNode) - assert.equal(c2.parentNode, null) - - cleanup() - assert.end() - }) - - test("input has type=text by default", function (assert) { - var elem = document.createElement("input") - assert.equal(elem.getAttribute("type"), "text"); - assert.equal(elemString(elem), "") - assert.end() - }) - - test("input type=text can be overridden", function (assert) { - var elem = document.createElement("input") - elem.setAttribute("type", "hidden") - assert.equal(elem.getAttribute("type"), "hidden"); - assert.equal(elemString(elem), "") - assert.end() - }) - - test("can set and get attributes", function (assert) { - var elem = document.createElement("div") - assert.equal(elem.getAttribute("foo"), null) - assert.equal(elemString(elem), "
    ") - assert.notOk(elem.hasAttribute('foo')) - - elem.setAttribute("foo", "bar") - assert.equal(elem.getAttribute("foo"), "bar") - assert.equal(elemString(elem), "
    ") - assert.ok(elem.hasAttribute('foo')) - - elem.removeAttribute("foo") - assert.equal(elem.getAttribute("foo"), null) - assert.equal(elemString(elem), "
    ") - assert.notOk(elem.hasAttribute('foo')) - - assert.end() - }) - - test("can set and set style properties", function(assert) { - var elem = document.createElement("div") - assert.equal(elemString(elem), "
    ") - - elem.style.color = "red"; - assert.equal(elem.style.color, "red") - assert.equal(elemString(elem), "
    ") - - elem.style.background = "blue"; - assert.equal(elem.style.color, "red") - assert.equal(elem.style.background, "blue") - assert.equal(elemString(elem), - "
    ") - - assert.end() - }) - - test("can set and get namespaced attributes", function(assert) { - var elem = document.createElement("div") - - var ns = "http://ns.com/my" - assert.equal(elem.getAttributeNS(ns, "myattr"), blankAttributeNS()) - elem.setAttributeNS(ns, "myns:myattr", "the value") - assert.equal(elem.getAttributeNS(ns, "myattr"), "the value") - assert.equal(elemString(elem), '
    ') - elem.removeAttributeNS(ns, "myattr") - assert.equal(elem.getAttributeNS(ns, "myattr"), blankAttributeNS()) - - // Should work much like get/setAttribute when namespace is null. - assert.equal(elem.getAttributeNS(null, "foo"), blankAttributeNS()) - assert.equal(elem.getAttribute("foo"), null) - elem.setAttributeNS(null, "foo", "bar") - assert.equal(elem.getAttributeNS(null, "foo"), "bar") - assert.equal(elem.getAttribute("foo"), "bar") - elem.removeAttributeNS(null, "foo") - assert.equal(elem.getAttributeNS(null, "foo"), blankAttributeNS()) - assert.equal(elem.getAttribute("foo"), null) - assert.end() - }) - - test("can getElementsByTagName", function(assert) { - var parent = document.createElement("div") - var child1 = document.createElement("span") - var child2 = document.createElement("span") - - child1.id = "foo" - child2.id = "bar" - - child1.appendChild(child2) - parent.appendChild(child1) - document.body.appendChild(parent) - - var elems = document.getElementsByTagName("SPAN") - - assert.equal(elems.length, 2) - assert.equal(elems[0].id, "foo") - assert.equal(elems[1].id, "bar") - - cleanup() - assert.end() - }) - - test("can getElementsByTagName with *", function(assert) { - document.body.appendChild(document.createElement("div")) - - var elems = document.getElementsByTagName("*") - - assert.equal(elems.length, 4) - assert.equal(elems[0].tagName, "HTML") - assert.equal(elems[1].tagName, "HEAD") - assert.equal(elems[2].tagName, "BODY") - assert.equal(elems[3].tagName, "DIV") - - cleanup() - assert.end() - }) - - test("getElement* methods search outside the body", function(assert) { - var html = document.documentElement; - assert.equal(document.getElementsByTagName("html")[0], html) - - html.id = "foo" - assert.equal(document.getElementById("foo"), html) - - html.className = "bar" - assert.equal(document.getElementsByClassName("bar")[0], html) - - // cleanup - html.id = "" - html.className = "" - - cleanup() - assert.end() - }) - - test("getElement* methods can be passed to map()", function(assert) { - var e1 = document.createElement("div") - var e2 = document.createElement("span") - - document.body.appendChild(e1) - document.body.appendChild(e2) - - assert.deepEqual( - ["div", "span"].map(document.getElementsByTagName.bind(document)), - [[e1], [e2]] - ) - - e1.id = "1" - e2.id = "2" - - assert.deepEqual( - ["1", "2"].map(document.getElementById.bind(document)), - [e1, e2] - ) - - e1.className = "foo" - e2.className = "bar" - - assert.deepEqual( - ["foo", "bar"].map(document.getElementsByClassName.bind(document)), - [[e1], [e2]] - ) - - cleanup() - assert.end() - }) - - test("can check if it contains an element", function(assert) { - var el = document.createElement("div") - document.body.appendChild(el) - - assert.equals(document.contains(document.body), true) - assert.equals(document.contains(el), true) - - cleanup() - assert.end() - }) - - test("can do events", function (assert) { - var x = 1 - function incx() { x++ } - - var ev = new Event(); - ev.initEvent("click"); - document.addEventListener("click", incx) - document.dispatchEvent(ev) - - assert.equal(x, 2) - - document.removeEventListener("click", incx) - document.dispatchEvent(ev) - - assert.equal(x, 2) - assert.end() - }) - - function blankAttributeNS() { - // Most browsers conform to the latest version of the DOM spec, - // which requires `getAttributeNS` to return `null` when the attribute - // doesn't exist, but some browsers (including phantomjs) implement the - // old version of the spec and return an empty string instead, see: - // https://developer.mozilla.org/en-US/docs/Web/API/element.getAttributeNS#Return_value - var div = document.createElement("div") - var blank = div.getAttributeNS(null, "foo") - if (!(blank === null || blank === "")) { - throw "Expected blank attribute to be either null or empty string" - } - return blank; - } - - function elemString(element) { - var html = String(element) || "[]" - - if (html.charAt(0) === "[") { - html = element.outerHTML - if (!html && !element.parentNode) { - var div = document.createElement("div") - div.appendChild(element) - html = div.innerHTML - div.removeChild(element) - } - } - - return html - } - - function fragString(fragment) { - var html = String(fragment) - - - if (html === "[object DocumentFragment]") { - var innerHTML = [] - for (var i = 0; i < fragment.childNodes.length; i++) { - var node = fragment.childNodes[i] - innerHTML.push(String(node.outerHTML || node)) - } - html = innerHTML.join("") - } - - return html - } -} - - diff --git a/node_modules/min-document/test/test-dom-comment.js b/node_modules/min-document/test/test-dom-comment.js deleted file mode 100644 index 7ecf175..0000000 --- a/node_modules/min-document/test/test-dom-comment.js +++ /dev/null @@ -1,20 +0,0 @@ -var test = require("tape") - -module.exports = testDomComment - -function testDomComment(document) { - var cleanup = require('./cleanup')(document) - - test("can createComment", function(assert) { - var comment = document.createComment("test") - assert.equal(comment.data, "test") - assert.equal(comment.length, 4) - assert.equal(comment.nodeName, "#comment") - assert.equal(comment.nodeType, 8) - assert.equal(comment.nodeValue, "test") - assert.equal(comment.ownerDocument, document) - assert.equal(comment.toString(), "[object Comment]") - cleanup() - assert.end() - }) -} diff --git a/node_modules/min-document/test/test-dom-element.js b/node_modules/min-document/test/test-dom-element.js deleted file mode 100644 index b7f2baa..0000000 --- a/node_modules/min-document/test/test-dom-element.js +++ /dev/null @@ -1,219 +0,0 @@ -var test = require("tape") - -module.exports = testDomElement - -function testDomElement(document) { - - var cleanup = require('./cleanup')(document) - - test("can getElementsByClassName", function(assert) { - function append_div(classNames, parent) { - var div = document.createElement("div") - div.className = classNames - parent.appendChild(div) - return div - } - - function assertMatch(classNames, expectedElements, parent) { - var parent = parent || document - var result = parent.getElementsByClassName(classNames) - assert.equal(result.length, expectedElements.length) - for (var i = 0; i < expectedElements.length; i++) { - assert.notEqual(expectedElements.indexOf(result[i]), -1) - } - } - - var divA = append_div("A", document.body) - var divB = append_div("B", document.body) - var divC = append_div("C", document.body) - - var divA1 = append_div("A1", divA) - var divA2 = append_div("A2", divA) - var divB1 = append_div("B1", divB) - var divB2 = append_div("B2", divB) - var divB2a = append_div("B2a", divB2) - var divB2b = append_div("B2b", divB2) - - assertMatch("A", [divA]) - assertMatch("B", [divB]) - assertMatch("C", [divC]) - assertMatch("A1", [divA1]) - assertMatch("A2", [divA2]) - assertMatch("B1", [divB1]) - assertMatch("B2", [divB2]) - assertMatch("B2a", [divB2a]) - assertMatch("B2b", [divB2b]) - - assertMatch("A1", [divA1], divA) - assertMatch("A2", [divA2], divA) - assertMatch("A1", [], divB) - assertMatch("A2", [], divC) - assertMatch("B1", [divB1], divB) - assertMatch("B2", [divB2], divB) - assertMatch("B2a", [divB2a], divB) - assertMatch("B2a", [divB2a], divB2) - assertMatch("B2b", [], divA) - - cleanup() - assert.end() - }) - - test("does not serialize innerText as an attribute", function(assert) { - var div = document.createElement("div") - div.innerText = "Test <&>" - assert.equal(div.toString(), "
    Test <&>
    ") - cleanup() - assert.end() - }) - - test("does not serialize innerHTML as an attribute", function(assert) { - var div = document.createElement("div") - div.innerHTML = "Test " - assert.equal(div.toString(), "
    Test
    ") - cleanup() - assert.end() - }) - - test("can getElementsByTagName", function(assert) { - var parent = document.createElement("div") - var child1 = document.createElement("span") - var child2 = document.createElement("span") - - child1.id = "foo" - child2.id = "bar" - - child1.appendChild(child2) - parent.appendChild(child1) - - var elems = parent.getElementsByTagName("SPAN") - - assert.equal(elems.length, 2) - assert.equal(elems[0].id, "foo") - assert.equal(elems[1].id, "bar") - - cleanup() - assert.end() - }) - - test("can getElementsByTagName with *", function(assert) { - var e1 = document.createElement("div") - var e2 = document.createElement("p") - var e3 = document.createElement("span") - - e1.appendChild(e2) - e2.appendChild(e3) - // non-elements should be ignored - e3.appendChild(document.createTextNode('foo')) - e3.appendChild(document.createComment('bar')) - - var elems = e1.getElementsByTagName("*") - - assert.equal(elems.length, 2) - assert.equal(elems[0].tagName, "P") - assert.equal(elems[1].tagName, "SPAN") - - cleanup() - assert.end() - }) - - test("getElement* methods can be passed to map()", function(assert) { - var container = document.createElement("div") - var e1 = document.createElement("div") - var e2 = document.createElement("span") - container.appendChild(e1) - container.appendChild(e2) - - assert.deepEqual( - ["div", "span"].map(container.getElementsByTagName.bind(container)), - [[e1], [e2]] - ) - - e1.className = "foo" - e2.className = "bar" - - assert.deepEqual( - ["foo", "bar"].map(container.getElementsByClassName.bind(container)), - [[e1], [e2]] - ) - - cleanup() - assert.end() - }) - - test("can serialize comment nodes", function(assert) { - var div = document.createElement("div") - div.appendChild(document.createComment("test")) - assert.equal(div.toString(), "
    ") - cleanup() - assert.end() - }) - - test("can serialize style property", function(assert) { - var div = document.createElement("div") - div.style.fontSize = "16px" - assert.equal(div.toString(), "
    ") - cleanup(); - assert.end() - }) - - test("can serialize style as a string", function(assert) { - var div = document.createElement("div") - div.setAttribute('style', 'display: none') - assert.equal(div.toString(), "
    ") - cleanup() - assert.end() - }) - - test("can serialize text nodes", function(assert) { - var div = document.createElement("div") - div.appendChild(document.createTextNode(' "&')) - assert.equal(div.toString(), '
    <test> "&
    ') - cleanup() - assert.end() - }) - - test("escapes serialized attribute values", function(assert) { - var div = document.createElement("div") - div.setAttribute("data-foo", '

    "&') - assert.equal(div.toString(), '

    ') - cleanup() - assert.end() - }) - - test("can check if an element contains another", function(assert) { - var parent = document.createElement("div") - var sibling = document.createElement("div") - var child1 = document.createElement("div") - var child2 = document.createElement("div") - - child1.appendChild(child2) - parent.appendChild(child1) - - assert.equal(parent.contains(parent), true) - assert.equal(parent.contains(sibling), false) - assert.equal(parent.contains(child1), true) - assert.equal(parent.contains(child2), true) - - cleanup() - assert.end() - }) - - test("can handle non string attribute values", function(assert) { - var div = document.createElement("div") - div.setAttribute("data-number", 100) - div.setAttribute("data-boolean", true) - div.setAttribute("data-null", null) - assert.equal(div.toString(), '
    ') - cleanup() - assert.end() - }) - - test("can serialize textarea correctly", function(assert) { - var input = document.createElement("textarea") - input.setAttribute("name", "comment") - input.innerHTML = "user input here" - assert.equal(input.toString(), '') - cleanup() - assert.end() - }) -} diff --git a/node_modules/mpd-parser/CHANGELOG.md b/node_modules/mpd-parser/CHANGELOG.md deleted file mode 100644 index 39a3b01..0000000 --- a/node_modules/mpd-parser/CHANGELOG.md +++ /dev/null @@ -1,261 +0,0 @@ - -# [0.17.0](https://github.com/videojs/mpd-parser/compare/v0.16.0...v0.17.0) (2021-05-28) - -### Features - -* caption services metadata support ([#131](https://github.com/videojs/mpd-parser/issues/131)) ([75ecbc2](https://github.com/videojs/mpd-parser/commit/75ecbc2)) - -### Chores - -* **package:** update to vhs-utils[@3](https://github.com/3).0.2 ([#134](https://github.com/videojs/mpd-parser/issues/134)) ([744142d](https://github.com/videojs/mpd-parser/commit/744142d)) - - -# [0.16.0](https://github.com/videojs/mpd-parser/compare/v0.15.4...v0.16.0) (2021-03-26) - -### Features - -* add a binary to convert mpd to m3u8 json in node ([#129](https://github.com/videojs/mpd-parser/issues/129)) ([608aa9d](https://github.com/videojs/mpd-parser/commit/608aa9d)) -* expose presentationTimeOffset on segments that have it ([#81](https://github.com/videojs/mpd-parser/issues/81)) ([8b58b39](https://github.com/videojs/mpd-parser/commit/8b58b39)) -* parse Label element and use as m3u8 group label ([#113](https://github.com/videojs/mpd-parser/issues/113)) ([5dde0e9](https://github.com/videojs/mpd-parser/commit/5dde0e9)) - -### Bug Fixes - -* bump xmldom to prevent npm security issue ([#122](https://github.com/videojs/mpd-parser/issues/122)) ([e132e40](https://github.com/videojs/mpd-parser/commit/e132e40)) -* support multiple audio/subtitle playlists and export generateSidxKey ([#123](https://github.com/videojs/mpd-parser/issues/123)) ([f7105d8](https://github.com/videojs/mpd-parser/commit/f7105d8)) - -### Chores - -* fix publish, add bin to files, update vjsverify ([cb4d772](https://github.com/videojs/mpd-parser/commit/cb4d772)) - -### Documentation - -* better explain how to update the JS manifest files ([#130](https://github.com/videojs/mpd-parser/issues/130)) ([21aa91c](https://github.com/videojs/mpd-parser/commit/21aa91c)) -* update usage example in README ([#127](https://github.com/videojs/mpd-parser/issues/127)) ([f0da2cc](https://github.com/videojs/mpd-parser/commit/f0da2cc)) - - -## [0.15.4](https://github.com/videojs/mpd-parser/compare/v0.15.3...v0.15.4) (2021-02-24) -An accidental republish of 0.15.3 with no changes. - - -## [0.15.3](https://github.com/videojs/mpd-parser/compare/v0.15.2...v0.15.3) (2021-02-24) - -### Features - -* add support for endNumber in template duration parsing ([#120](https://github.com/videojs/mpd-parser/issues/120)) ([0a75d62](https://github.com/videojs/mpd-parser/commit/0a75d62)) - - -## [0.15.2](https://github.com/videojs/mpd-parser/compare/v0.15.1...v0.15.2) (2021-01-12) - -### Bug Fixes - -* cjs dist should only import cjs ([#118](https://github.com/videojs/mpd-parser/issues/118)) ([0529e62](https://github.com/videojs/mpd-parser/commit/0529e62)) - - -## [0.15.1](https://github.com/videojs/mpd-parser/compare/v0.15.0...v0.15.1) (2021-01-11) - -### Chores - -* update to vhs-utils[@3](https://github.com/3) ([#115](https://github.com/videojs/mpd-parser/issues/115)) ([3240031](https://github.com/videojs/mpd-parser/commit/3240031)) - - -# [0.15.0](https://github.com/videojs/mpd-parser/compare/v0.14.0...v0.15.0) (2020-11-17) - -### Features - -* expose add addSidxSegmentsToPlaylist ([#109](https://github.com/videojs/mpd-parser/issues/109)) ([880c139](https://github.com/videojs/mpd-parser/commit/880c139)) -* recognize webm segments as video ([#79](https://github.com/videojs/mpd-parser/issues/79)) ([aa1bbf1](https://github.com/videojs/mpd-parser/commit/aa1bbf1)) - -### Bug Fixes - -* edge case error handling on ie 11 ([#112](https://github.com/videojs/mpd-parser/issues/112)) ([23040c1](https://github.com/videojs/mpd-parser/commit/23040c1)) - -### Chores - -* switch from travis ci to github ci ([#111](https://github.com/videojs/mpd-parser/issues/111)) ([1dc9090](https://github.com/videojs/mpd-parser/commit/1dc9090)) - -### Tests - -* fix tests introduced in [#79](https://github.com/videojs/mpd-parser/issues/79) that was not rebased on [#103](https://github.com/videojs/mpd-parser/issues/103) ([#110](https://github.com/videojs/mpd-parser/issues/110)) ([1a6abbf](https://github.com/videojs/mpd-parser/commit/1a6abbf)) - - -# [0.14.0](https://github.com/videojs/mpd-parser/compare/v0.13.0...v0.14.0) (2020-11-03) - -### Chores - -* **package:** update to vhs-utils[@2](https://github.com/2) ([#108](https://github.com/videojs/mpd-parser/issues/108)) ([8337333](https://github.com/videojs/mpd-parser/commit/8337333)) - - -# [0.13.0](https://github.com/videojs/mpd-parser/compare/v0.12.0...v0.13.0) (2020-09-29) - -### Features - -* add CODECS attribute to subtitle playlists if it exists ([#106](https://github.com/videojs/mpd-parser/issues/106)) ([bc0872a](https://github.com/videojs/mpd-parser/commit/bc0872a)) - - -# [0.12.0](https://github.com/videojs/mpd-parser/compare/v0.11.0...v0.12.0) (2020-09-03) - -### Features - -* remove default value of 0 for minimumUpdatePeriod ([#103](https://github.com/videojs/mpd-parser/issues/103)) ([38ca9ad](https://github.com/videojs/mpd-parser/commit/38ca9ad)) - - -### BREAKING CHANGES - -* The minimumUpdatePeriod property is now omitted from parsed output if it is not present in the manifest, rather than using a default value of 0. This is to allow differentiation between cases when a value of 0 is present in the manifest and when no value is provided. - - -# [0.11.0](https://github.com/videojs/mpd-parser/compare/v0.10.1...v0.11.0) (2020-08-12) - -### Features - -* parse out Location elements ([#102](https://github.com/videojs/mpd-parser/issues/102)) ([967e5e6](https://github.com/videojs/mpd-parser/commit/967e5e6)) - - -## [0.10.1](https://github.com/videojs/mpd-parser/compare/v0.10.0...v0.10.1) (2020-03-31) - -### Bug Fixes - -* don't adjust mediaPresentationDuration by timescale for segment duration when using SegmentBase ([#94](https://github.com/videojs/mpd-parser/issues/94)) ([40cdd00](https://github.com/videojs/mpd-parser/commit/40cdd00)) - - -# [0.10.0](https://github.com/videojs/mpd-parser/compare/v0.9.0...v0.10.0) (2020-02-04) - -### Features - -* expose suggestPresentationDelay if the type is dynamic ([#82](https://github.com/videojs/mpd-parser/issues/82)) ([cd27003](https://github.com/videojs/mpd-parser/commit/cd27003)) - - -# [0.9.0](https://github.com/videojs/mpd-parser/compare/v0.8.2...v0.9.0) (2019-08-30) - -### Features - -* node support ([#75](https://github.com/videojs/mpd-parser/issues/75)) ([58b43b0](https://github.com/videojs/mpd-parser/commit/58b43b0)) - - -## [0.8.2](https://github.com/videojs/mpd-parser/compare/v0.8.1...v0.8.2) (2019-08-22) - -### Chores - -* update generator and use [@videojs](https://github.com/videojs)/vhs-utils ([#76](https://github.com/videojs/mpd-parser/issues/76)) ([1238749](https://github.com/videojs/mpd-parser/commit/1238749)) - - -## [0.8.1](https://github.com/videojs/mpd-parser/compare/v0.8.0...v0.8.1) (2019-05-01) - -### Bug Fixes - -* skip playlists without sidx ([#73](https://github.com/videojs/mpd-parser/issues/73)) ([67d2bad](https://github.com/videojs/mpd-parser/commit/67d2bad)), closes [videojs/video.js#5289](https://github.com/videojs/video.js/issues/5289) - - -# [0.8.0](https://github.com/videojs/mpd-parser/compare/v0.7.0...v0.8.0) (2019-04-11) - -### Features - -* add sidx information to segment base playlists ([#41](https://github.com/videojs/mpd-parser/issues/41)) ([1176109](https://github.com/videojs/mpd-parser/commit/1176109)) - -### Bug Fixes - -* make byteRange.length inclusive ([#43](https://github.com/videojs/mpd-parser/issues/43)) ([28d217a](https://github.com/videojs/mpd-parser/commit/28d217a)) - -### Chores - -* add netlify for testing ([#45](https://github.com/videojs/mpd-parser/issues/45)) ([a78a7be](https://github.com/videojs/mpd-parser/commit/a78a7be)) -* Update videojs-generate-karma-config to the latest version 🚀 ([#37](https://github.com/videojs/mpd-parser/issues/37)) ([a18c660](https://github.com/videojs/mpd-parser/commit/a18c660)) -* Update videojs-generate-karma-config to the latest version 🚀 ([#38](https://github.com/videojs/mpd-parser/issues/38)) ([3aaabac](https://github.com/videojs/mpd-parser/commit/3aaabac)) -* Update videojs-generate-rollup-config to the latest version 🚀 ([#36](https://github.com/videojs/mpd-parser/issues/36)) ([3f6ccbd](https://github.com/videojs/mpd-parser/commit/3f6ccbd)) -* **package:** update videojs-generate-karma-config to 5.0.2 ([#54](https://github.com/videojs/mpd-parser/issues/54)) ([fcbabc3](https://github.com/videojs/mpd-parser/commit/fcbabc3)) -* **package:** videojs-generate-karma-config[@4](https://github.com/4).0.0 does not exist ([#44](https://github.com/videojs/mpd-parser/issues/44)) ([bc361b5](https://github.com/videojs/mpd-parser/commit/bc361b5)) - - -# [0.7.0](https://github.com/videojs/mpd-parser/compare/v0.6.1...v0.7.0) (2018-10-24) - -### Features - -* limited multiperiod support ([#35](https://github.com/videojs/mpd-parser/issues/35)) ([aee87a0](https://github.com/videojs/mpd-parser/commit/aee87a0)) - -### Bug Fixes - -* fixed segment timeline parsing when duration is present ([#34](https://github.com/videojs/mpd-parser/issues/34)) ([90feb2d](https://github.com/videojs/mpd-parser/commit/90feb2d)) -* Remove the postinstall script to prevent install issues ([#29](https://github.com/videojs/mpd-parser/issues/29)) ([ae458f4](https://github.com/videojs/mpd-parser/commit/ae458f4)) - -### Chores - -* Update to generator-videojs-plugin[@7](https://github.com/7).2.0 ([#28](https://github.com/videojs/mpd-parser/issues/28)) ([909cf08](https://github.com/videojs/mpd-parser/commit/909cf08)) -* **package:** Update dependencies to enable Greenkeeper 🌴 ([#30](https://github.com/videojs/mpd-parser/issues/30)) ([0593c2c](https://github.com/videojs/mpd-parser/commit/0593c2c)) - - -## [0.6.1](https://github.com/videojs/mpd-parser/compare/v0.6.0...v0.6.1) (2018-05-17) - -### Bug Fixes - -* babel es module ([#25](https://github.com/videojs/mpd-parser/issues/25)) ([9a84461](https://github.com/videojs/mpd-parser/commit/9a84461)) - - -# [0.6.0](https://github.com/videojs/mpd-parser/compare/v0.5.0...v0.6.0) (2018-03-30) - -### Features - -* support in-manifest DRM data ([#23](https://github.com/videojs/mpd-parser/issues/23)) ([7ce9aca](https://github.com/videojs/mpd-parser/commit/7ce9aca)) - - -# [0.5.0](https://github.com/videojs/mpd-parser/compare/v0.4.0...v0.5.0) (2018-03-15) - -### Features - -* live support with SegmentTemplate[@duration](https://github.com/duration) and more ([#22](https://github.com/videojs/mpd-parser/issues/22)) ([f1cee87](https://github.com/videojs/mpd-parser/commit/f1cee87)) - - -# [0.4.0](https://github.com/videojs/mpd-parser/compare/v0.3.0...v0.4.0) (2018-02-26) - -### Features - -* Adding support for segments in Period and Representation. ([#19](https://github.com/videojs/mpd-parser/issues/19)) ([8e59b38](https://github.com/videojs/mpd-parser/commit/8e59b38)) - - -# [0.3.0](https://github.com/videojs/mpd-parser/compare/v0.2.1...v0.3.0) (2018-02-06) - -### Features - -* Parse and ([#18](https://github.com/videojs/mpd-parser/issues/18)) ([71b8976](https://github.com/videojs/mpd-parser/commit/71b8976)) -* Support for inheriting BaseURL and alternate BaseURLs ([#17](https://github.com/videojs/mpd-parser/issues/17)) ([7dad5d5](https://github.com/videojs/mpd-parser/commit/7dad5d5)) -* add support for SegmentTemplate padding format string and SegmentTimeline ([#16](https://github.com/videojs/mpd-parser/issues/16)) ([87933f6](https://github.com/videojs/mpd-parser/commit/87933f6)) - - -## [0.2.1](https://github.com/videojs/mpd-parser/compare/v0.2.0...v0.2.1) (2017-12-15) - -### Bug Fixes - -* access HTMLCollections with IE11 compatibility ([#15](https://github.com/videojs/mpd-parser/issues/15)) ([5612984](https://github.com/videojs/mpd-parser/commit/5612984)) - - -# [0.2.0](https://github.com/videojs/mpd-parser/compare/v0.1.1...v0.2.0) (2017-12-12) - -### Features - -* Support for vtt ([#13](https://github.com/videojs/mpd-parser/issues/13)) ([96fc406](https://github.com/videojs/mpd-parser/commit/96fc406)) - -### Tests - -* add more tests for vtt ([#14](https://github.com/videojs/mpd-parser/issues/14)) ([4068790](https://github.com/videojs/mpd-parser/commit/4068790)) - - -## [0.1.1](https://github.com/videojs/mpd-parser/compare/v0.1.0...v0.1.1) (2017-12-07) - -### Bug Fixes - -* avoid using Array.prototype.fill for IE support ([#11](https://github.com/videojs/mpd-parser/issues/11)) ([5c444de](https://github.com/videojs/mpd-parser/commit/5c444de)) - - -# 0.1.0 (2017-11-29) - -### Bug Fixes - -* switch off in-manifest caption support ([#8](https://github.com/videojs/mpd-parser/issues/8)) ([15712c6](https://github.com/videojs/mpd-parser/commit/15712c6)) - -CHANGELOG -========= - -## HEAD (Unreleased) -_(none)_ - --------------------- - diff --git a/node_modules/mpd-parser/CONTRIBUTING.md b/node_modules/mpd-parser/CONTRIBUTING.md deleted file mode 100644 index 6658164..0000000 --- a/node_modules/mpd-parser/CONTRIBUTING.md +++ /dev/null @@ -1,34 +0,0 @@ -# CONTRIBUTING - -We welcome contributions from everyone! - -## Getting Started - -Make sure you have NodeJS 4.0 or higher and npm installed. - -1. Fork this repository and clone your fork -1. Install dependencies: `npm install` -1. Run a development server: `npm start` - -### Making Changes - -Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship. - -When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository. - -#### Updating test expecations - -You can regenerate the JS manifest files by running `mpd-to-m3u8-json` binary (or via the web page) but you'll need to update the `pssh` properties to be converted into a `new Uint8Array`. - -### Running Tests - -Testing is a crucial part of any software project. For all but the most trivial changes (typos, etc) test cases are expected. Tests are run in actual browsers using [Karma][karma]. - -- In all available and supported browsers: `npm test` -- In a specific browser: `npm run test:chrome`, `npm run test:firefox`, etc. -- While development server is running (`npm start`), navigate to [`http://localhost:9999/test/`][local] - - -[karma]: http://karma-runner.github.io/ -[local]: http://localhost:9999/test/ -[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md diff --git a/node_modules/mpd-parser/LICENSE b/node_modules/mpd-parser/LICENSE deleted file mode 100644 index 23d0fbb..0000000 --- a/node_modules/mpd-parser/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright Brightcove, Inc - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/node_modules/mpd-parser/README.md b/node_modules/mpd-parser/README.md deleted file mode 100644 index 05279ca..0000000 --- a/node_modules/mpd-parser/README.md +++ /dev/null @@ -1,161 +0,0 @@ -# mpd-parser - -[![Build Status](https://travis-ci.org/videojs/mpd-parser.svg?branch=master)](https://travis-ci.org/videojs/mpd-parser) -[![Greenkeeper badge](https://badges.greenkeeper.io/videojs/mpd-parser.svg)](https://greenkeeper.io/) -[![Slack Status](http://slack.videojs.com/badge.svg)](http://slack.videojs.com) - -[![NPM](https://nodei.co/npm/mpd-parser.png?downloads=true&downloadRank=true)](https://nodei.co/npm/mpd-parser/) - -mpd parser - -## Table of Contents - - - - - -- [Installation](#installation) -- [Usage](#usage) - - [Parsed Output](#parsed-output) -- [Including the Parser](#including-the-parser) - - [` - -``` - -### Browserify - -When using with Browserify, install mpd-parser via npm and `require` the parser as you would any other module. - -```js -var mpdParser = require('mpd-parser'); - -var parsedManifest = mpdParser.parse(manifest, manifestUrl); -``` - -With ES6: -```js -import { parse } from 'mpd-parser'; - -const parsedManifest = parse(manifest, manifestUrl); -``` - -### RequireJS/AMD - -When using with RequireJS (or another AMD library), get the script in whatever way you prefer and `require` the parser as you normally would: - -```js -require(['mpd-parser'], function(mpdParser) { - var parsedManifest = mpdParser.parse(manifest, manifestUrl); -}); -``` - -## License - -Apache-2.0. Copyright (c) Brightcove, Inc diff --git a/node_modules/mpd-parser/bin/parse.js b/node_modules/mpd-parser/bin/parse.js deleted file mode 100644 index eb8fc8f..0000000 --- a/node_modules/mpd-parser/bin/parse.js +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env node -/* eslint-disable no-console */ -const fs = require('fs'); -const path = require('path'); -const {parse} = require('../dist/mpd-parser.cjs.js'); - -const file = path.resolve(process.cwd(), process.argv[2]); -const result = parse(fs.readFileSync(file, 'utf8'), { - manifestUri: '' -}); - -console.log(JSON.stringify(result, null, 2)); diff --git a/node_modules/mpd-parser/dist/mpd-parser.cjs.js b/node_modules/mpd-parser/dist/mpd-parser.cjs.js deleted file mode 100644 index b4afd18..0000000 --- a/node_modules/mpd-parser/dist/mpd-parser.cjs.js +++ /dev/null @@ -1,2092 +0,0 @@ -/*! @name mpd-parser @version 0.17.0 @license Apache-2.0 */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var resolveUrl = require('@videojs/vhs-utils/cjs/resolve-url'); -var window = require('global/window'); -var decodeB64ToUint8Array = require('@videojs/vhs-utils/cjs/decode-b64-to-uint8-array'); -var xmldom = require('xmldom'); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var resolveUrl__default = /*#__PURE__*/_interopDefaultLegacy(resolveUrl); -var window__default = /*#__PURE__*/_interopDefaultLegacy(window); -var decodeB64ToUint8Array__default = /*#__PURE__*/_interopDefaultLegacy(decodeB64ToUint8Array); - -var version = "0.17.0"; - -var isObject = function isObject(obj) { - return !!obj && typeof obj === 'object'; -}; - -var merge = function merge() { - for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) { - objects[_key] = arguments[_key]; - } - - return objects.reduce(function (result, source) { - if (typeof source !== 'object') { - return result; - } - - Object.keys(source).forEach(function (key) { - if (Array.isArray(result[key]) && Array.isArray(source[key])) { - result[key] = result[key].concat(source[key]); - } else if (isObject(result[key]) && isObject(source[key])) { - result[key] = merge(result[key], source[key]); - } else { - result[key] = source[key]; - } - }); - return result; - }, {}); -}; -var values = function values(o) { - return Object.keys(o).map(function (k) { - return o[k]; - }); -}; - -var range = function range(start, end) { - var result = []; - - for (var i = start; i < end; i++) { - result.push(i); - } - - return result; -}; -var flatten = function flatten(lists) { - return lists.reduce(function (x, y) { - return x.concat(y); - }, []); -}; -var from = function from(list) { - if (!list.length) { - return []; - } - - var result = []; - - for (var i = 0; i < list.length; i++) { - result.push(list[i]); - } - - return result; -}; -var findIndexes = function findIndexes(l, key) { - return l.reduce(function (a, e, i) { - if (e[key]) { - a.push(i); - } - - return a; - }, []); -}; - -var errors = { - INVALID_NUMBER_OF_PERIOD: 'INVALID_NUMBER_OF_PERIOD', - DASH_EMPTY_MANIFEST: 'DASH_EMPTY_MANIFEST', - DASH_INVALID_XML: 'DASH_INVALID_XML', - NO_BASE_URL: 'NO_BASE_URL', - MISSING_SEGMENT_INFORMATION: 'MISSING_SEGMENT_INFORMATION', - SEGMENT_TIME_UNSPECIFIED: 'SEGMENT_TIME_UNSPECIFIED', - UNSUPPORTED_UTC_TIMING_SCHEME: 'UNSUPPORTED_UTC_TIMING_SCHEME' -}; - -/** - * @typedef {Object} SingleUri - * @property {string} uri - relative location of segment - * @property {string} resolvedUri - resolved location of segment - * @property {Object} byterange - Object containing information on how to make byte range - * requests following byte-range-spec per RFC2616. - * @property {String} byterange.length - length of range request - * @property {String} byterange.offset - byte offset of range request - * - * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 - */ - -/** - * Converts a URLType node (5.3.9.2.3 Table 13) to a segment object - * that conforms to how m3u8-parser is structured - * - * @see https://github.com/videojs/m3u8-parser - * - * @param {string} baseUrl - baseUrl provided by nodes - * @param {string} source - source url for segment - * @param {string} range - optional range used for range calls, - * follows RFC 2616, Clause 14.35.1 - * @return {SingleUri} full segment information transformed into a format similar - * to m3u8-parser - */ - -var urlTypeToSegment = function urlTypeToSegment(_ref) { - var _ref$baseUrl = _ref.baseUrl, - baseUrl = _ref$baseUrl === void 0 ? '' : _ref$baseUrl, - _ref$source = _ref.source, - source = _ref$source === void 0 ? '' : _ref$source, - _ref$range = _ref.range, - range = _ref$range === void 0 ? '' : _ref$range, - _ref$indexRange = _ref.indexRange, - indexRange = _ref$indexRange === void 0 ? '' : _ref$indexRange; - var segment = { - uri: source, - resolvedUri: resolveUrl__default['default'](baseUrl || '', source) - }; - - if (range || indexRange) { - var rangeStr = range ? range : indexRange; - var ranges = rangeStr.split('-'); - var startRange = parseInt(ranges[0], 10); - var endRange = parseInt(ranges[1], 10); // byterange should be inclusive according to - // RFC 2616, Clause 14.35.1 - - segment.byterange = { - length: endRange - startRange + 1, - offset: startRange - }; - } - - return segment; -}; -var byteRangeToString = function byteRangeToString(byterange) { - // `endRange` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - var endRange = byterange.offset + byterange.length - 1; - return byterange.offset + "-" + endRange; -}; - -/** - * parse the end number attribue that can be a string - * number, or undefined. - * - * @param {string|number|undefined} endNumber - * The end number attribute. - * - * @return {number|null} - * The result of parsing the end number. - */ - -var parseEndNumber = function parseEndNumber(endNumber) { - if (endNumber && typeof endNumber !== 'number') { - endNumber = parseInt(endNumber, 10); - } - - if (isNaN(endNumber)) { - return null; - } - - return endNumber; -}; -/** - * Functions for calculating the range of available segments in static and dynamic - * manifests. - */ - - -var segmentRange = { - /** - * Returns the entire range of available segments for a static MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - static: function _static(attributes) { - var duration = attributes.duration, - _attributes$timescale = attributes.timescale, - timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale, - sourceDuration = attributes.sourceDuration; - var endNumber = parseEndNumber(attributes.endNumber); - return { - start: 0, - end: typeof endNumber === 'number' ? endNumber : Math.ceil(sourceDuration / (duration / timescale)) - }; - }, - - /** - * Returns the current live window range of available segments for a dynamic MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - dynamic: function dynamic(attributes) { - var NOW = attributes.NOW, - clientOffset = attributes.clientOffset, - availabilityStartTime = attributes.availabilityStartTime, - _attributes$timescale2 = attributes.timescale, - timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, - duration = attributes.duration, - _attributes$start = attributes.start, - start = _attributes$start === void 0 ? 0 : _attributes$start, - _attributes$minimumUp = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp, - _attributes$timeShift = attributes.timeShiftBufferDepth, - timeShiftBufferDepth = _attributes$timeShift === void 0 ? Infinity : _attributes$timeShift; - var endNumber = parseEndNumber(attributes.endNumber); - var now = (NOW + clientOffset) / 1000; - var periodStartWC = availabilityStartTime + start; - var periodEndWC = now + minimumUpdatePeriod; - var periodDuration = periodEndWC - periodStartWC; - var segmentCount = Math.ceil(periodDuration * timescale / duration); - var availableStart = Math.floor((now - periodStartWC - timeShiftBufferDepth) * timescale / duration); - var availableEnd = Math.floor((now - periodStartWC) * timescale / duration); - return { - start: Math.max(0, availableStart), - end: typeof endNumber === 'number' ? endNumber : Math.min(segmentCount, availableEnd) - }; - } -}; -/** - * Maps a range of numbers to objects with information needed to build the corresponding - * segment list - * - * @name toSegmentsCallback - * @function - * @param {number} number - * Number of the segment - * @param {number} index - * Index of the number in the range list - * @return {{ number: Number, duration: Number, timeline: Number, time: Number }} - * Object with segment timing and duration info - */ - -/** - * Returns a callback for Array.prototype.map for mapping a range of numbers to - * information needed to build the segment list. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {toSegmentsCallback} - * Callback map function - */ - -var toSegments = function toSegments(attributes) { - return function (number, index) { - var duration = attributes.duration, - _attributes$timescale3 = attributes.timescale, - timescale = _attributes$timescale3 === void 0 ? 1 : _attributes$timescale3, - periodIndex = attributes.periodIndex, - _attributes$startNumb = attributes.startNumber, - startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb; - return { - number: startNumber + number, - duration: duration / timescale, - timeline: periodIndex, - time: index * duration - }; - }; -}; -/** - * Returns a list of objects containing segment timing and duration info used for - * building the list of segments. This uses the @duration attribute specified - * in the MPD manifest to derive the range of segments. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - -var parseByDuration = function parseByDuration(attributes) { - var _attributes$type = attributes.type, - type = _attributes$type === void 0 ? 'static' : _attributes$type, - duration = attributes.duration, - _attributes$timescale4 = attributes.timescale, - timescale = _attributes$timescale4 === void 0 ? 1 : _attributes$timescale4, - sourceDuration = attributes.sourceDuration; - - var _segmentRange$type = segmentRange[type](attributes), - start = _segmentRange$type.start, - end = _segmentRange$type.end; - - var segments = range(start, end).map(toSegments(attributes)); - - if (type === 'static') { - var index = segments.length - 1; // final segment may be less than full segment duration - - segments[index].duration = sourceDuration - duration / timescale * index; - } - - return segments; -}; - -/** - * Translates SegmentBase into a set of segments. - * (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @return {Object.} list of segments - */ - -var segmentsFromBase = function segmentsFromBase(attributes) { - var baseUrl = attributes.baseUrl, - _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ, - sourceDuration = attributes.sourceDuration, - _attributes$indexRang = attributes.indexRange, - indexRange = _attributes$indexRang === void 0 ? '' : _attributes$indexRang, - duration = attributes.duration; // base url is required for SegmentBase to work, per spec (Section 5.3.9.2.1) - - if (!baseUrl) { - throw new Error(errors.NO_BASE_URL); - } - - var initSegment = urlTypeToSegment({ - baseUrl: baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - var segment = urlTypeToSegment({ - baseUrl: baseUrl, - source: baseUrl, - indexRange: indexRange - }); - segment.map = initSegment; // If there is a duration, use it, otherwise use the given duration of the source - // (since SegmentBase is only for one total segment) - - if (duration) { - var segmentTimeInfo = parseByDuration(attributes); - - if (segmentTimeInfo.length) { - segment.duration = segmentTimeInfo[0].duration; - segment.timeline = segmentTimeInfo[0].timeline; - } - } else if (sourceDuration) { - segment.duration = sourceDuration; - segment.timeline = 0; - } // This is used for mediaSequence - - - segment.number = 0; - return [segment]; -}; -/** - * Given a playlist, a sidx box, and a baseUrl, update the segment list of the playlist - * according to the sidx information given. - * - * playlist.sidx has metadadata about the sidx where-as the sidx param - * is the parsed sidx box itself. - * - * @param {Object} playlist the playlist to update the sidx information for - * @param {Object} sidx the parsed sidx box - * @return {Object} the playlist object with the updated sidx information - */ - -var addSidxSegmentsToPlaylist = function addSidxSegmentsToPlaylist(playlist, sidx, baseUrl) { - // Retain init segment information - var initSegment = playlist.sidx.map ? playlist.sidx.map : null; // Retain source duration from initial master manifest parsing - - var sourceDuration = playlist.sidx.duration; // Retain source timeline - - var timeline = playlist.timeline || 0; - var sidxByteRange = playlist.sidx.byterange; - var sidxEnd = sidxByteRange.offset + sidxByteRange.length; // Retain timescale of the parsed sidx - - var timescale = sidx.timescale; // referenceType 1 refers to other sidx boxes - - var mediaReferences = sidx.references.filter(function (r) { - return r.referenceType !== 1; - }); - var segments = []; // firstOffset is the offset from the end of the sidx box - - var startIndex = sidxEnd + sidx.firstOffset; - - for (var i = 0; i < mediaReferences.length; i++) { - var reference = sidx.references[i]; // size of the referenced (sub)segment - - var size = reference.referencedSize; // duration of the referenced (sub)segment, in the timescale - // this will be converted to seconds when generating segments - - var duration = reference.subsegmentDuration; // should be an inclusive range - - var endIndex = startIndex + size - 1; - var indexRange = startIndex + "-" + endIndex; - var attributes = { - baseUrl: baseUrl, - timescale: timescale, - timeline: timeline, - // this is used in parseByDuration - periodIndex: timeline, - duration: duration, - sourceDuration: sourceDuration, - indexRange: indexRange - }; - var segment = segmentsFromBase(attributes)[0]; - - if (initSegment) { - segment.map = initSegment; - } - - segments.push(segment); - startIndex += size; - } - - playlist.segments = segments; - return playlist; -}; - -var generateSidxKey = function generateSidxKey(sidx) { - return sidx && sidx.uri + '-' + byteRangeToString(sidx.byterange); -}; - -var mergeDiscontiguousPlaylists = function mergeDiscontiguousPlaylists(playlists) { - var mergedPlaylists = values(playlists.reduce(function (acc, playlist) { - // assuming playlist IDs are the same across periods - // TODO: handle multiperiod where representation sets are not the same - // across periods - var name = playlist.attributes.id + (playlist.attributes.lang || ''); // Periods after first - - if (acc[name]) { - var _acc$name$segments; - - // first segment of subsequent periods signal a discontinuity - if (playlist.segments[0]) { - playlist.segments[0].discontinuity = true; - } - - (_acc$name$segments = acc[name].segments).push.apply(_acc$name$segments, playlist.segments); // bubble up contentProtection, this assumes all DRM content - // has the same contentProtection - - - if (playlist.attributes.contentProtection) { - acc[name].attributes.contentProtection = playlist.attributes.contentProtection; - } - } else { - // first Period - acc[name] = playlist; - } - - return acc; - }, {})); - return mergedPlaylists.map(function (playlist) { - playlist.discontinuityStarts = findIndexes(playlist.segments, 'discontinuity'); - return playlist; - }); -}; - -var addSidxSegmentsToPlaylist$1 = function addSidxSegmentsToPlaylist$1(playlist, sidxMapping) { - var sidxKey = generateSidxKey(playlist.sidx); - var sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx; - - if (sidxMatch) { - addSidxSegmentsToPlaylist(playlist, sidxMatch, playlist.sidx.resolvedUri); - } - - return playlist; -}; -var addSidxSegmentsToPlaylists = function addSidxSegmentsToPlaylists(playlists, sidxMapping) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (!Object.keys(sidxMapping).length) { - return playlists; - } - - for (var i in playlists) { - playlists[i] = addSidxSegmentsToPlaylist$1(playlists[i], sidxMapping); - } - - return playlists; -}; -var formatAudioPlaylist = function formatAudioPlaylist(_ref, isAudioOnly) { - var _attributes; - - var attributes = _ref.attributes, - segments = _ref.segments, - sidx = _ref.sidx; - var playlist = { - attributes: (_attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth, - CODECS: attributes.codecs - }, _attributes['PROGRAM-ID'] = 1, _attributes), - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - if (isAudioOnly) { - playlist.attributes.AUDIO = 'audio'; - playlist.attributes.SUBTITLES = 'subs'; - } - - return playlist; -}; -var formatVttPlaylist = function formatVttPlaylist(_ref2) { - var _m3u8Attributes; - - var attributes = _ref2.attributes, - segments = _ref2.segments; - - if (typeof segments === 'undefined') { - // vtt tracks may use single file in BaseURL - segments = [{ - uri: attributes.baseUrl, - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - duration: attributes.sourceDuration, - number: 0 - }]; // targetDuration should be the same duration as the only segment - - attributes.duration = attributes.sourceDuration; - } - - var m3u8Attributes = (_m3u8Attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth - }, _m3u8Attributes['PROGRAM-ID'] = 1, _m3u8Attributes); - - if (attributes.codecs) { - m3u8Attributes.CODECS = attributes.codecs; - } - - return { - attributes: m3u8Attributes, - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; -}; -var organizeAudioPlaylists = function organizeAudioPlaylists(playlists, sidxMapping, isAudioOnly) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (isAudioOnly === void 0) { - isAudioOnly = false; - } - - var mainPlaylist; - var formattedPlaylists = playlists.reduce(function (a, playlist) { - var role = playlist.attributes.role && playlist.attributes.role.value || ''; - var language = playlist.attributes.lang || ''; - var label = playlist.attributes.label || 'main'; - - if (language && !playlist.attributes.label) { - var roleLabel = role ? " (" + role + ")" : ''; - label = "" + playlist.attributes.lang + roleLabel; - } - - if (!a[label]) { - a[label] = { - language: language, - autoselect: true, - default: role === 'main', - playlists: [], - uri: '' - }; - } - - var formatted = addSidxSegmentsToPlaylist$1(formatAudioPlaylist(playlist, isAudioOnly), sidxMapping); - a[label].playlists.push(formatted); - - if (typeof mainPlaylist === 'undefined' && role === 'main') { - mainPlaylist = playlist; - mainPlaylist.default = true; - } - - return a; - }, {}); // if no playlists have role "main", mark the first as main - - if (!mainPlaylist) { - var firstLabel = Object.keys(formattedPlaylists)[0]; - formattedPlaylists[firstLabel].default = true; - } - - return formattedPlaylists; -}; -var organizeVttPlaylists = function organizeVttPlaylists(playlists, sidxMapping) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - return playlists.reduce(function (a, playlist) { - var label = playlist.attributes.lang || 'text'; - - if (!a[label]) { - a[label] = { - language: label, - default: false, - autoselect: false, - playlists: [], - uri: '' - }; - } - - a[label].playlists.push(addSidxSegmentsToPlaylist$1(formatVttPlaylist(playlist), sidxMapping)); - return a; - }, {}); -}; - -var organizeCaptionServices = function organizeCaptionServices(captionServices) { - return captionServices.reduce(function (svcObj, svc) { - if (!svc) { - return svcObj; - } - - svc.forEach(function (service) { - var channel = service.channel, - language = service.language; - svcObj[language] = { - autoselect: false, - default: false, - instreamId: channel, - language: language - }; - - if (service.hasOwnProperty('aspectRatio')) { - svcObj[language].aspectRatio = service.aspectRatio; - } - - if (service.hasOwnProperty('easyReader')) { - svcObj[language].easyReader = service.easyReader; - } - - if (service.hasOwnProperty('3D')) { - svcObj[language]['3D'] = service['3D']; - } - }); - return svcObj; - }, {}); -}; - -var formatVideoPlaylist = function formatVideoPlaylist(_ref3) { - var _attributes2; - - var attributes = _ref3.attributes, - segments = _ref3.segments, - sidx = _ref3.sidx; - var playlist = { - attributes: (_attributes2 = { - NAME: attributes.id, - AUDIO: 'audio', - SUBTITLES: 'subs', - RESOLUTION: { - width: attributes.width, - height: attributes.height - }, - CODECS: attributes.codecs, - BANDWIDTH: attributes.bandwidth - }, _attributes2['PROGRAM-ID'] = 1, _attributes2), - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - return playlist; -}; - -var videoOnly = function videoOnly(_ref4) { - var attributes = _ref4.attributes; - return attributes.mimeType === 'video/mp4' || attributes.mimeType === 'video/webm' || attributes.contentType === 'video'; -}; - -var audioOnly = function audioOnly(_ref5) { - var attributes = _ref5.attributes; - return attributes.mimeType === 'audio/mp4' || attributes.mimeType === 'audio/webm' || attributes.contentType === 'audio'; -}; - -var vttOnly = function vttOnly(_ref6) { - var attributes = _ref6.attributes; - return attributes.mimeType === 'text/vtt' || attributes.contentType === 'text'; -}; - -var toM3u8 = function toM3u8(dashPlaylists, locations, sidxMapping) { - var _mediaGroups; - - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (!dashPlaylists.length) { - return {}; - } // grab all master attributes - - - var _dashPlaylists$0$attr = dashPlaylists[0].attributes, - duration = _dashPlaylists$0$attr.sourceDuration, - _dashPlaylists$0$attr2 = _dashPlaylists$0$attr.type, - type = _dashPlaylists$0$attr2 === void 0 ? 'static' : _dashPlaylists$0$attr2, - suggestedPresentationDelay = _dashPlaylists$0$attr.suggestedPresentationDelay, - minimumUpdatePeriod = _dashPlaylists$0$attr.minimumUpdatePeriod; - var videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist); - var audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly)); - var vttPlaylists = dashPlaylists.filter(vttOnly); - var captions = dashPlaylists.map(function (playlist) { - return playlist.attributes.captionServices; - }).filter(Boolean); - var master = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: (_mediaGroups = { - AUDIO: {}, - VIDEO: {} - }, _mediaGroups['CLOSED-CAPTIONS'] = {}, _mediaGroups.SUBTITLES = {}, _mediaGroups), - uri: '', - duration: duration, - playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping) - }; - - if (minimumUpdatePeriod >= 0) { - master.minimumUpdatePeriod = minimumUpdatePeriod * 1000; - } - - if (locations) { - master.locations = locations; - } - - if (type === 'dynamic') { - master.suggestedPresentationDelay = suggestedPresentationDelay; - } - - var isAudioOnly = master.playlists.length === 0; - - if (audioPlaylists.length) { - master.mediaGroups.AUDIO.audio = organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly); - } - - if (vttPlaylists.length) { - master.mediaGroups.SUBTITLES.subs = organizeVttPlaylists(vttPlaylists, sidxMapping); - } - - if (captions.length) { - master.mediaGroups['CLOSED-CAPTIONS'].cc = organizeCaptionServices(captions); - } - - return master; -}; - -/** - * Calculates the R (repetition) value for a live stream (for the final segment - * in a manifest where the r value is negative 1) - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {number} time - * current time (typically the total time up until the final segment) - * @param {number} duration - * duration property for the given - * - * @return {number} - * R value to reach the end of the given period - */ -var getLiveRValue = function getLiveRValue(attributes, time, duration) { - var NOW = attributes.NOW, - clientOffset = attributes.clientOffset, - availabilityStartTime = attributes.availabilityStartTime, - _attributes$timescale = attributes.timescale, - timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale, - _attributes$start = attributes.start, - start = _attributes$start === void 0 ? 0 : _attributes$start, - _attributes$minimumUp = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp; - var now = (NOW + clientOffset) / 1000; - var periodStartWC = availabilityStartTime + start; - var periodEndWC = now + minimumUpdatePeriod; - var periodDuration = periodEndWC - periodStartWC; - return Math.ceil((periodDuration * timescale - time) / duration); -}; -/** - * Uses information provided by SegmentTemplate.SegmentTimeline to determine segment - * timing and duration - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]} segmentTimeline - * List of objects representing the attributes of each S element contained within - * - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - -var parseByTimeline = function parseByTimeline(attributes, segmentTimeline) { - var _attributes$type = attributes.type, - type = _attributes$type === void 0 ? 'static' : _attributes$type, - _attributes$minimumUp2 = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp2 === void 0 ? 0 : _attributes$minimumUp2, - _attributes$media = attributes.media, - media = _attributes$media === void 0 ? '' : _attributes$media, - sourceDuration = attributes.sourceDuration, - _attributes$timescale2 = attributes.timescale, - timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, - _attributes$startNumb = attributes.startNumber, - startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb, - timeline = attributes.periodIndex; - var segments = []; - var time = -1; - - for (var sIndex = 0; sIndex < segmentTimeline.length; sIndex++) { - var S = segmentTimeline[sIndex]; - var duration = S.d; - var repeat = S.r || 0; - var segmentTime = S.t || 0; - - if (time < 0) { - // first segment - time = segmentTime; - } - - if (segmentTime && segmentTime > time) { - // discontinuity - // TODO: How to handle this type of discontinuity - // timeline++ here would treat it like HLS discontuity and content would - // get appended without gap - // E.G. - // - // - // - // - // would have $Time$ values of [0, 1, 2, 5] - // should this be appened at time positions [0, 1, 2, 3],(#EXT-X-DISCONTINUITY) - // or [0, 1, 2, gap, gap, 5]? (#EXT-X-GAP) - // does the value of sourceDuration consider this when calculating arbitrary - // negative @r repeat value? - // E.G. Same elements as above with this added at the end - // - // with a sourceDuration of 10 - // Would the 2 gaps be included in the time duration calculations resulting in - // 8 segments with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9] or 10 segments - // with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9, 10, 11] ? - time = segmentTime; - } - - var count = void 0; - - if (repeat < 0) { - var nextS = sIndex + 1; - - if (nextS === segmentTimeline.length) { - // last segment - if (type === 'dynamic' && minimumUpdatePeriod > 0 && media.indexOf('$Number$') > 0) { - count = getLiveRValue(attributes, time, duration); - } else { - // TODO: This may be incorrect depending on conclusion of TODO above - count = (sourceDuration * timescale - time) / duration; - } - } else { - count = (segmentTimeline[nextS].t - time) / duration; - } - } else { - count = repeat + 1; - } - - var end = startNumber + segments.length + count; - var number = startNumber + segments.length; - - while (number < end) { - segments.push({ - number: number, - duration: duration / timescale, - time: time, - timeline: timeline - }); - time += duration; - number++; - } - } - - return segments; -}; - -var identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g; -/** - * Replaces template identifiers with corresponding values. To be used as the callback - * for String.prototype.replace - * - * @name replaceCallback - * @function - * @param {string} match - * Entire match of identifier - * @param {string} identifier - * Name of matched identifier - * @param {string} format - * Format tag string. Its presence indicates that padding is expected - * @param {string} width - * Desired length of the replaced value. Values less than this width shall be left - * zero padded - * @return {string} - * Replacement for the matched identifier - */ - -/** - * Returns a function to be used as a callback for String.prototype.replace to replace - * template identifiers - * - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {replaceCallback} - * Callback to be used with String.prototype.replace to replace identifiers - */ - -var identifierReplacement = function identifierReplacement(values) { - return function (match, identifier, format, width) { - if (match === '$$') { - // escape sequence - return '$'; - } - - if (typeof values[identifier] === 'undefined') { - return match; - } - - var value = '' + values[identifier]; - - if (identifier === 'RepresentationID') { - // Format tag shall not be present with RepresentationID - return value; - } - - if (!format) { - width = 1; - } else { - width = parseInt(width, 10); - } - - if (value.length >= width) { - return value; - } - - return "" + new Array(width - value.length + 1).join('0') + value; - }; -}; -/** - * Constructs a segment url from a template string - * - * @param {string} url - * Template string to construct url from - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {string} - * Segment url with identifiers replaced - */ - -var constructTemplateUrl = function constructTemplateUrl(url, values) { - return url.replace(identifierPattern, identifierReplacement(values)); -}; -/** - * Generates a list of objects containing timing and duration information about each - * segment needed to generate segment uris and the complete segment object - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - -var parseTemplateInfo = function parseTemplateInfo(attributes, segmentTimeline) { - if (!attributes.duration && !segmentTimeline) { - // if neither @duration or SegmentTimeline are present, then there shall be exactly - // one media segment - return [{ - number: attributes.startNumber || 1, - duration: attributes.sourceDuration, - time: 0, - timeline: attributes.periodIndex - }]; - } - - if (attributes.duration) { - return parseByDuration(attributes); - } - - return parseByTimeline(attributes, segmentTimeline); -}; -/** - * Generates a list of segments using information provided by the SegmentTemplate element - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object[]} - * List of segment objects - */ - -var segmentsFromTemplate = function segmentsFromTemplate(attributes, segmentTimeline) { - var templateValues = { - RepresentationID: attributes.id, - Bandwidth: attributes.bandwidth || 0 - }; - var _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? { - sourceURL: '', - range: '' - } : _attributes$initializ; - var mapSegment = urlTypeToSegment({ - baseUrl: attributes.baseUrl, - source: constructTemplateUrl(initialization.sourceURL, templateValues), - range: initialization.range - }); - var segments = parseTemplateInfo(attributes, segmentTimeline); - return segments.map(function (segment) { - templateValues.Number = segment.number; - templateValues.Time = segment.time; - var uri = constructTemplateUrl(attributes.media || '', templateValues); - var map = { - uri: uri, - timeline: segment.timeline, - duration: segment.duration, - resolvedUri: resolveUrl__default['default'](attributes.baseUrl || '', uri), - map: mapSegment, - number: segment.number - }; - - if (attributes.presentationTimeOffset) { - map.presentationTimeOffset = attributes.presentationTimeOffset; - } - - return map; - }); -}; - -/** - * Converts a (of type URLType from the DASH spec 5.3.9.2 Table 14) - * to an object that matches the output of a segment in videojs/mpd-parser - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object} segmentUrl - * node to translate into a segment object - * @return {Object} translated segment object - */ - -var SegmentURLToSegmentObject = function SegmentURLToSegmentObject(attributes, segmentUrl) { - var baseUrl = attributes.baseUrl, - _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ; - var initSegment = urlTypeToSegment({ - baseUrl: baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - var segment = urlTypeToSegment({ - baseUrl: baseUrl, - source: segmentUrl.media, - range: segmentUrl.mediaRange - }); - segment.map = initSegment; - return segment; -}; -/** - * Generates a list of segments using information provided by the SegmentList element - * SegmentList (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object.} list of segments - */ - - -var segmentsFromList = function segmentsFromList(attributes, segmentTimeline) { - var duration = attributes.duration, - _attributes$segmentUr = attributes.segmentUrls, - segmentUrls = _attributes$segmentUr === void 0 ? [] : _attributes$segmentUr; // Per spec (5.3.9.2.1) no way to determine segment duration OR - // if both SegmentTimeline and @duration are defined, it is outside of spec. - - if (!duration && !segmentTimeline || duration && segmentTimeline) { - throw new Error(errors.SEGMENT_TIME_UNSPECIFIED); - } - - var segmentUrlMap = segmentUrls.map(function (segmentUrlObject) { - return SegmentURLToSegmentObject(attributes, segmentUrlObject); - }); - var segmentTimeInfo; - - if (duration) { - segmentTimeInfo = parseByDuration(attributes); - } - - if (segmentTimeline) { - segmentTimeInfo = parseByTimeline(attributes, segmentTimeline); - } - - var segments = segmentTimeInfo.map(function (segmentTime, index) { - if (segmentUrlMap[index]) { - var segment = segmentUrlMap[index]; - segment.timeline = segmentTime.timeline; - segment.duration = segmentTime.duration; - segment.number = segmentTime.number; - return segment; - } // Since we're mapping we should get rid of any blank segments (in case - // the given SegmentTimeline is handling for more elements than we have - // SegmentURLs for). - - }).filter(function (segment) { - return segment; - }); - return segments; -}; - -var generateSegments = function generateSegments(_ref) { - var attributes = _ref.attributes, - segmentInfo = _ref.segmentInfo; - var segmentAttributes; - var segmentsFn; - - if (segmentInfo.template) { - segmentsFn = segmentsFromTemplate; - segmentAttributes = merge(attributes, segmentInfo.template); - - if (segmentInfo.template.presentationTimeOffset) { - segmentAttributes.presentationTimeOffset = segmentInfo.template.presentationTimeOffset / segmentInfo.template.timescale; - } - } else if (segmentInfo.base) { - segmentsFn = segmentsFromBase; - segmentAttributes = merge(attributes, segmentInfo.base); - } else if (segmentInfo.list) { - segmentsFn = segmentsFromList; - segmentAttributes = merge(attributes, segmentInfo.list); - } - - var segmentsInfo = { - attributes: attributes - }; - - if (!segmentsFn) { - return segmentsInfo; - } - - var segments = segmentsFn(segmentAttributes, segmentInfo.timeline); // The @duration attribute will be used to determin the playlist's targetDuration which - // must be in seconds. Since we've generated the segment list, we no longer need - // @duration to be in @timescale units, so we can convert it here. - - if (segmentAttributes.duration) { - var _segmentAttributes = segmentAttributes, - duration = _segmentAttributes.duration, - _segmentAttributes$ti = _segmentAttributes.timescale, - timescale = _segmentAttributes$ti === void 0 ? 1 : _segmentAttributes$ti; - segmentAttributes.duration = duration / timescale; - } else if (segments.length) { - // if there is no @duration attribute, use the largest segment duration as - // as target duration - segmentAttributes.duration = segments.reduce(function (max, segment) { - return Math.max(max, Math.ceil(segment.duration)); - }, 0); - } else { - segmentAttributes.duration = 0; - } - - segmentsInfo.attributes = segmentAttributes; - segmentsInfo.segments = segments; // This is a sidx box without actual segment information - - if (segmentInfo.base && segmentAttributes.indexRange) { - segmentsInfo.sidx = segments[0]; - segmentsInfo.segments = []; - } - - return segmentsInfo; -}; -var toPlaylists = function toPlaylists(representations) { - return representations.map(generateSegments); -}; - -var findChildren = function findChildren(element, name) { - return from(element.childNodes).filter(function (_ref) { - var tagName = _ref.tagName; - return tagName === name; - }); -}; -var getContent = function getContent(element) { - return element.textContent.trim(); -}; - -var parseDuration = function parseDuration(str) { - var SECONDS_IN_YEAR = 365 * 24 * 60 * 60; - var SECONDS_IN_MONTH = 30 * 24 * 60 * 60; - var SECONDS_IN_DAY = 24 * 60 * 60; - var SECONDS_IN_HOUR = 60 * 60; - var SECONDS_IN_MIN = 60; // P10Y10M10DT10H10M10.1S - - var durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/; - var match = durationRegex.exec(str); - - if (!match) { - return 0; - } - - var _match$slice = match.slice(1), - year = _match$slice[0], - month = _match$slice[1], - day = _match$slice[2], - hour = _match$slice[3], - minute = _match$slice[4], - second = _match$slice[5]; - - return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0); -}; -var parseDate = function parseDate(str) { - // Date format without timezone according to ISO 8601 - // YYY-MM-DDThh:mm:ss.ssssss - var dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/; // If the date string does not specifiy a timezone, we must specifiy UTC. This is - // expressed by ending with 'Z' - - if (dateRegex.test(str)) { - str += 'Z'; - } - - return Date.parse(str); -}; - -var parsers = { - /** - * Specifies the duration of the entire Media Presentation. Format is a duration string - * as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - mediaPresentationDuration: function mediaPresentationDuration(value) { - return parseDuration(value); - }, - - /** - * Specifies the Segment availability start time for all Segments referred to in this - * MPD. For a dynamic manifest, it specifies the anchor for the earliest availability - * time. Format is a date string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The date as seconds from unix epoch - */ - availabilityStartTime: function availabilityStartTime(value) { - return parseDate(value) / 1000; - }, - - /** - * Specifies the smallest period between potential changes to the MPD. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - minimumUpdatePeriod: function minimumUpdatePeriod(value) { - return parseDuration(value); - }, - - /** - * Specifies the suggested presentation delay. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - suggestedPresentationDelay: function suggestedPresentationDelay(value) { - return parseDuration(value); - }, - - /** - * specifices the type of mpd. Can be either "static" or "dynamic" - * - * @param {string} value - * value of attribute as a string - * - * @return {string} - * The type as a string - */ - type: function type(value) { - return value; - }, - - /** - * Specifies the duration of the smallest time shifting buffer for any Representation - * in the MPD. Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - timeShiftBufferDepth: function timeShiftBufferDepth(value) { - return parseDuration(value); - }, - - /** - * Specifies the PeriodStart time of the Period relative to the availabilityStarttime. - * Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - start: function start(value) { - return parseDuration(value); - }, - - /** - * Specifies the width of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed width - */ - width: function width(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the height of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed height - */ - height: function height(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the bitrate of the representation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed bandwidth - */ - bandwidth: function bandwidth(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the number of the first Media Segment in this Representation in the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - startNumber: function startNumber(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the timescale in units per seconds - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed timescale - */ - timescale: function timescale(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the presentationTimeOffset. - * - * @param {string} value - * value of the attribute as a string - * - * @return {number} - * The parsed presentationTimeOffset - */ - presentationTimeOffset: function presentationTimeOffset(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the constant approximate Segment duration - * NOTE: The element also contains an @duration attribute. This duration - * specifies the duration of the Period. This attribute is currently not - * supported by the rest of the parser, however we still check for it to prevent - * errors. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - duration: function duration(value) { - var parsedValue = parseInt(value, 10); - - if (isNaN(parsedValue)) { - return parseDuration(value); - } - - return parsedValue; - }, - - /** - * Specifies the Segment duration, in units of the value of the @timescale. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - d: function d(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the MPD start time, in @timescale units, the first Segment in the series - * starts relative to the beginning of the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed time - */ - t: function t(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the repeat count of the number of following contiguous Segments with the - * same duration expressed by the value of @d - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - r: function r(value) { - return parseInt(value, 10); - }, - - /** - * Default parser for all other attributes. Acts as a no-op and just returns the value - * as a string - * - * @param {string} value - * value of attribute as a string - * @return {string} - * Unparsed value - */ - DEFAULT: function DEFAULT(value) { - return value; - } -}; -/** - * Gets all the attributes and values of the provided node, parses attributes with known - * types, and returns an object with attribute names mapped to values. - * - * @param {Node} el - * The node to parse attributes from - * @return {Object} - * Object with all attributes of el parsed - */ - -var parseAttributes = function parseAttributes(el) { - if (!(el && el.attributes)) { - return {}; - } - - return from(el.attributes).reduce(function (a, e) { - var parseFn = parsers[e.name] || parsers.DEFAULT; - a[e.name] = parseFn(e.value); - return a; - }, {}); -}; - -var keySystemsMap = { - 'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b': 'org.w3.clearkey', - 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed': 'com.widevine.alpha', - 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95': 'com.microsoft.playready', - 'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime' -}; -/** - * Builds a list of urls that is the product of the reference urls and BaseURL values - * - * @param {string[]} referenceUrls - * List of reference urls to resolve to - * @param {Node[]} baseUrlElements - * List of BaseURL nodes from the mpd - * @return {string[]} - * List of resolved urls - */ - -var buildBaseUrls = function buildBaseUrls(referenceUrls, baseUrlElements) { - if (!baseUrlElements.length) { - return referenceUrls; - } - - return flatten(referenceUrls.map(function (reference) { - return baseUrlElements.map(function (baseUrlElement) { - return resolveUrl__default['default'](reference, getContent(baseUrlElement)); - }); - })); -}; -/** - * Contains all Segment information for its containing AdaptationSet - * - * @typedef {Object} SegmentInformation - * @property {Object|undefined} template - * Contains the attributes for the SegmentTemplate node - * @property {Object[]|undefined} timeline - * Contains a list of atrributes for each S node within the SegmentTimeline node - * @property {Object|undefined} list - * Contains the attributes for the SegmentList node - * @property {Object|undefined} base - * Contains the attributes for the SegmentBase node - */ - -/** - * Returns all available Segment information contained within the AdaptationSet node - * - * @param {Node} adaptationSet - * The AdaptationSet node to get Segment information from - * @return {SegmentInformation} - * The Segment information contained within the provided AdaptationSet - */ - -var getSegmentInformation = function getSegmentInformation(adaptationSet) { - var segmentTemplate = findChildren(adaptationSet, 'SegmentTemplate')[0]; - var segmentList = findChildren(adaptationSet, 'SegmentList')[0]; - var segmentUrls = segmentList && findChildren(segmentList, 'SegmentURL').map(function (s) { - return merge({ - tag: 'SegmentURL' - }, parseAttributes(s)); - }); - var segmentBase = findChildren(adaptationSet, 'SegmentBase')[0]; - var segmentTimelineParentNode = segmentList || segmentTemplate; - var segmentTimeline = segmentTimelineParentNode && findChildren(segmentTimelineParentNode, 'SegmentTimeline')[0]; - var segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate; - var segmentInitialization = segmentInitializationParentNode && findChildren(segmentInitializationParentNode, 'Initialization')[0]; // SegmentTemplate is handled slightly differently, since it can have both - // @initialization and an node. @initialization can be templated, - // while the node can have a url and range specified. If the has - // both @initialization and an subelement we opt to override with - // the node, as this interaction is not defined in the spec. - - var template = segmentTemplate && parseAttributes(segmentTemplate); - - if (template && segmentInitialization) { - template.initialization = segmentInitialization && parseAttributes(segmentInitialization); - } else if (template && template.initialization) { - // If it is @initialization we convert it to an object since this is the format that - // later functions will rely on for the initialization segment. This is only valid - // for - template.initialization = { - sourceURL: template.initialization - }; - } - - var segmentInfo = { - template: template, - timeline: segmentTimeline && findChildren(segmentTimeline, 'S').map(function (s) { - return parseAttributes(s); - }), - list: segmentList && merge(parseAttributes(segmentList), { - segmentUrls: segmentUrls, - initialization: parseAttributes(segmentInitialization) - }), - base: segmentBase && merge(parseAttributes(segmentBase), { - initialization: parseAttributes(segmentInitialization) - }) - }; - Object.keys(segmentInfo).forEach(function (key) { - if (!segmentInfo[key]) { - delete segmentInfo[key]; - } - }); - return segmentInfo; -}; -/** - * Contains Segment information and attributes needed to construct a Playlist object - * from a Representation - * - * @typedef {Object} RepresentationInformation - * @property {SegmentInformation} segmentInfo - * Segment information for this Representation - * @property {Object} attributes - * Inherited attributes for this Representation - */ - -/** - * Maps a Representation node to an object containing Segment information and attributes - * - * @name inheritBaseUrlsCallback - * @function - * @param {Node} representation - * Representation node from the mpd - * @return {RepresentationInformation} - * Representation information needed to construct a Playlist object - */ - -/** - * Returns a callback for Array.prototype.map for mapping Representation nodes to - * Segment information and attributes using inherited BaseURL nodes. - * - * @param {Object} adaptationSetAttributes - * Contains attributes inherited by the AdaptationSet - * @param {string[]} adaptationSetBaseUrls - * Contains list of resolved base urls inherited by the AdaptationSet - * @param {SegmentInformation} adaptationSetSegmentInfo - * Contains Segment information for the AdaptationSet - * @return {inheritBaseUrlsCallback} - * Callback map function - */ - -var inheritBaseUrls = function inheritBaseUrls(adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) { - return function (representation) { - var repBaseUrlElements = findChildren(representation, 'BaseURL'); - var repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements); - var attributes = merge(adaptationSetAttributes, parseAttributes(representation)); - var representationSegmentInfo = getSegmentInformation(representation); - return repBaseUrls.map(function (baseUrl) { - return { - segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo), - attributes: merge(attributes, { - baseUrl: baseUrl - }) - }; - }); - }; -}; -/** - * Tranforms a series of content protection nodes to - * an object containing pssh data by key system - * - * @param {Node[]} contentProtectionNodes - * Content protection nodes - * @return {Object} - * Object containing pssh data by key system - */ - -var generateKeySystemInformation = function generateKeySystemInformation(contentProtectionNodes) { - return contentProtectionNodes.reduce(function (acc, node) { - var attributes = parseAttributes(node); - var keySystem = keySystemsMap[attributes.schemeIdUri]; - - if (keySystem) { - acc[keySystem] = { - attributes: attributes - }; - var psshNode = findChildren(node, 'cenc:pssh')[0]; - - if (psshNode) { - var pssh = getContent(psshNode); - var psshBuffer = pssh && decodeB64ToUint8Array__default['default'](pssh); - acc[keySystem].pssh = psshBuffer; - } - } - - return acc; - }, {}); -}; // defined in ANSI_SCTE 214-1 2016 - - -var parseCaptionServiceMetadata = function parseCaptionServiceMetadata(service) { - // 608 captions - if (service.schemeIdUri === 'urn:scte:dash:cc:cea-608:2015') { - var values = service.value.split(';'); - return values.map(function (value) { - var channel; - var language; // default language to value - - language = value; - - if (/^CC\d=/.test(value)) { - var _value$split = value.split('='); - - channel = _value$split[0]; - language = _value$split[1]; - } else if (/^CC\d$/.test(value)) { - channel = value; - } - - return { - channel: channel, - language: language - }; - }); - } else if (service.schemeIdUri === 'urn:scte:dash:cc:cea-708:2015') { - var _values = service.value.split(';'); - - return _values.map(function (value) { - var flags = { - // service or channel number 1-63 - 'channel': undefined, - // language is a 3ALPHA per ISO 639.2/B - // field is required - 'language': undefined, - // BIT 1/0 or ? - // default value is 1, meaning 16:9 aspect ratio, 0 is 4:3, ? is unknown - 'aspectRatio': 1, - // BIT 1/0 - // easy reader flag indicated the text is tailed to the needs of beginning readers - // default 0, or off - 'easyReader': 0, - // BIT 1/0 - // If 3d metadata is present (CEA-708.1) then 1 - // default 0 - '3D': 0 - }; - - if (/=/.test(value)) { - var _value$split2 = value.split('='), - channel = _value$split2[0], - _value$split2$ = _value$split2[1], - opts = _value$split2$ === void 0 ? '' : _value$split2$; - - flags.channel = channel; - flags.language = value; - opts.split(',').forEach(function (opt) { - var _opt$split = opt.split(':'), - name = _opt$split[0], - val = _opt$split[1]; - - if (name === 'lang') { - flags.language = val; // er for easyReadery - } else if (name === 'er') { - flags.easyReader = Number(val); // war for wide aspect ratio - } else if (name === 'war') { - flags.aspectRatio = Number(val); - } else if (name === '3D') { - flags['3D'] = Number(val); - } - }); - } else { - flags.language = value; - } - - if (flags.channel) { - flags.channel = 'SERVICE' + flags.channel; - } - - return flags; - }); - } -}; -/** - * Maps an AdaptationSet node to a list of Representation information objects - * - * @name toRepresentationsCallback - * @function - * @param {Node} adaptationSet - * AdaptationSet node from the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - -/** - * Returns a callback for Array.prototype.map for mapping AdaptationSet nodes to a list of - * Representation information objects - * - * @param {Object} periodAttributes - * Contains attributes inherited by the Period - * @param {string[]} periodBaseUrls - * Contains list of resolved base urls inherited by the Period - * @param {string[]} periodSegmentInfo - * Contains Segment Information at the period level - * @return {toRepresentationsCallback} - * Callback map function - */ - -var toRepresentations = function toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo) { - return function (adaptationSet) { - var adaptationSetAttributes = parseAttributes(adaptationSet); - var adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls, findChildren(adaptationSet, 'BaseURL')); - var role = findChildren(adaptationSet, 'Role')[0]; - var roleAttributes = { - role: parseAttributes(role) - }; - var attrs = merge(periodAttributes, adaptationSetAttributes, roleAttributes); - var accessibility = findChildren(adaptationSet, 'Accessibility')[0]; - var captionServices = parseCaptionServiceMetadata(parseAttributes(accessibility)); - - if (captionServices) { - attrs = merge(attrs, { - captionServices: captionServices - }); - } - - var label = findChildren(adaptationSet, 'Label')[0]; - - if (label && label.childNodes.length) { - var labelVal = label.childNodes[0].nodeValue.trim(); - attrs = merge(attrs, { - label: labelVal - }); - } - - var contentProtection = generateKeySystemInformation(findChildren(adaptationSet, 'ContentProtection')); - - if (Object.keys(contentProtection).length) { - attrs = merge(attrs, { - contentProtection: contentProtection - }); - } - - var segmentInfo = getSegmentInformation(adaptationSet); - var representations = findChildren(adaptationSet, 'Representation'); - var adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo); - return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo))); - }; -}; -/** - * Maps an Period node to a list of Representation inforamtion objects for all - * AdaptationSet nodes contained within the Period - * - * @name toAdaptationSetsCallback - * @function - * @param {Node} period - * Period node from the mpd - * @param {number} periodIndex - * Index of the Period within the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - -/** - * Returns a callback for Array.prototype.map for mapping Period nodes to a list of - * Representation information objects - * - * @param {Object} mpdAttributes - * Contains attributes inherited by the mpd - * @param {string[]} mpdBaseUrls - * Contains list of resolved base urls inherited by the mpd - * @return {toAdaptationSetsCallback} - * Callback map function - */ - -var toAdaptationSets = function toAdaptationSets(mpdAttributes, mpdBaseUrls) { - return function (period, index) { - var periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period, 'BaseURL')); - var periodAtt = parseAttributes(period); - var parsedPeriodId = parseInt(periodAtt.id, 10); // fallback to mapping index if Period@id is not a number - - var periodIndex = window__default['default'].isNaN(parsedPeriodId) ? index : parsedPeriodId; - var periodAttributes = merge(mpdAttributes, { - periodIndex: periodIndex - }); - var adaptationSets = findChildren(period, 'AdaptationSet'); - var periodSegmentInfo = getSegmentInformation(period); - return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo))); - }; -}; -/** - * Traverses the mpd xml tree to generate a list of Representation information objects - * that have inherited attributes from parent nodes - * - * @param {Node} mpd - * The root node of the mpd - * @param {Object} options - * Available options for inheritAttributes - * @param {string} options.manifestUri - * The uri source of the mpd - * @param {number} options.NOW - * Current time per DASH IOP. Default is current time in ms since epoch - * @param {number} options.clientOffset - * Client time difference from NOW (in milliseconds) - * @return {RepresentationInformation[]} - * List of objects containing Representation information - */ - -var inheritAttributes = function inheritAttributes(mpd, options) { - if (options === void 0) { - options = {}; - } - - var _options = options, - _options$manifestUri = _options.manifestUri, - manifestUri = _options$manifestUri === void 0 ? '' : _options$manifestUri, - _options$NOW = _options.NOW, - NOW = _options$NOW === void 0 ? Date.now() : _options$NOW, - _options$clientOffset = _options.clientOffset, - clientOffset = _options$clientOffset === void 0 ? 0 : _options$clientOffset; - var periods = findChildren(mpd, 'Period'); - - if (!periods.length) { - throw new Error(errors.INVALID_NUMBER_OF_PERIOD); - } - - var locations = findChildren(mpd, 'Location'); - var mpdAttributes = parseAttributes(mpd); - var mpdBaseUrls = buildBaseUrls([manifestUri], findChildren(mpd, 'BaseURL')); - mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0; - mpdAttributes.NOW = NOW; - mpdAttributes.clientOffset = clientOffset; - - if (locations.length) { - mpdAttributes.locations = locations.map(getContent); - } - - return { - locations: mpdAttributes.locations, - representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls))) - }; -}; - -var stringToMpdXml = function stringToMpdXml(manifestString) { - if (manifestString === '') { - throw new Error(errors.DASH_EMPTY_MANIFEST); - } - - var parser = new xmldom.DOMParser(); - var xml; - var mpd; - - try { - xml = parser.parseFromString(manifestString, 'application/xml'); - mpd = xml && xml.documentElement.tagName === 'MPD' ? xml.documentElement : null; - } catch (e) {// ie 11 throwsw on invalid xml - } - - if (!mpd || mpd && mpd.getElementsByTagName('parsererror').length > 0) { - throw new Error(errors.DASH_INVALID_XML); - } - - return mpd; -}; - -/** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} mpd - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ - -var parseUTCTimingScheme = function parseUTCTimingScheme(mpd) { - var UTCTimingNode = findChildren(mpd, 'UTCTiming')[0]; - - if (!UTCTimingNode) { - return null; - } - - var attributes = parseAttributes(UTCTimingNode); - - switch (attributes.schemeIdUri) { - case 'urn:mpeg:dash:utc:http-head:2014': - case 'urn:mpeg:dash:utc:http-head:2012': - attributes.method = 'HEAD'; - break; - - case 'urn:mpeg:dash:utc:http-xsdate:2014': - case 'urn:mpeg:dash:utc:http-iso:2014': - case 'urn:mpeg:dash:utc:http-xsdate:2012': - case 'urn:mpeg:dash:utc:http-iso:2012': - attributes.method = 'GET'; - break; - - case 'urn:mpeg:dash:utc:direct:2014': - case 'urn:mpeg:dash:utc:direct:2012': - attributes.method = 'DIRECT'; - attributes.value = Date.parse(attributes.value); - break; - - case 'urn:mpeg:dash:utc:http-ntp:2014': - case 'urn:mpeg:dash:utc:ntp:2014': - case 'urn:mpeg:dash:utc:sntp:2014': - default: - throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME); - } - - return attributes; -}; - -var VERSION = version; - -var parse = function parse(manifestString, options) { - if (options === void 0) { - options = {}; - } - - var parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options); - var playlists = toPlaylists(parsedManifestInfo.representationInfo); - return toM3u8(playlists, parsedManifestInfo.locations, options.sidxMapping); -}; -/** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} manifestString - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ - - -var parseUTCTiming = function parseUTCTiming(manifestString) { - return parseUTCTimingScheme(stringToMpdXml(manifestString)); -}; - -exports.VERSION = VERSION; -exports.addSidxSegmentsToPlaylist = addSidxSegmentsToPlaylist; -exports.generateSidxKey = generateSidxKey; -exports.inheritAttributes = inheritAttributes; -exports.parse = parse; -exports.parseUTCTiming = parseUTCTiming; -exports.stringToMpdXml = stringToMpdXml; -exports.toM3u8 = toM3u8; -exports.toPlaylists = toPlaylists; diff --git a/node_modules/mpd-parser/dist/mpd-parser.es.js b/node_modules/mpd-parser/dist/mpd-parser.es.js deleted file mode 100644 index 29f6851..0000000 --- a/node_modules/mpd-parser/dist/mpd-parser.es.js +++ /dev/null @@ -1,2074 +0,0 @@ -/*! @name mpd-parser @version 0.17.0 @license Apache-2.0 */ -import resolveUrl from '@videojs/vhs-utils/es/resolve-url'; -import window from 'global/window'; -import decodeB64ToUint8Array from '@videojs/vhs-utils/es/decode-b64-to-uint8-array'; -import { DOMParser } from 'xmldom'; - -var version = "0.17.0"; - -var isObject = function isObject(obj) { - return !!obj && typeof obj === 'object'; -}; - -var merge = function merge() { - for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) { - objects[_key] = arguments[_key]; - } - - return objects.reduce(function (result, source) { - if (typeof source !== 'object') { - return result; - } - - Object.keys(source).forEach(function (key) { - if (Array.isArray(result[key]) && Array.isArray(source[key])) { - result[key] = result[key].concat(source[key]); - } else if (isObject(result[key]) && isObject(source[key])) { - result[key] = merge(result[key], source[key]); - } else { - result[key] = source[key]; - } - }); - return result; - }, {}); -}; -var values = function values(o) { - return Object.keys(o).map(function (k) { - return o[k]; - }); -}; - -var range = function range(start, end) { - var result = []; - - for (var i = start; i < end; i++) { - result.push(i); - } - - return result; -}; -var flatten = function flatten(lists) { - return lists.reduce(function (x, y) { - return x.concat(y); - }, []); -}; -var from = function from(list) { - if (!list.length) { - return []; - } - - var result = []; - - for (var i = 0; i < list.length; i++) { - result.push(list[i]); - } - - return result; -}; -var findIndexes = function findIndexes(l, key) { - return l.reduce(function (a, e, i) { - if (e[key]) { - a.push(i); - } - - return a; - }, []); -}; - -var errors = { - INVALID_NUMBER_OF_PERIOD: 'INVALID_NUMBER_OF_PERIOD', - DASH_EMPTY_MANIFEST: 'DASH_EMPTY_MANIFEST', - DASH_INVALID_XML: 'DASH_INVALID_XML', - NO_BASE_URL: 'NO_BASE_URL', - MISSING_SEGMENT_INFORMATION: 'MISSING_SEGMENT_INFORMATION', - SEGMENT_TIME_UNSPECIFIED: 'SEGMENT_TIME_UNSPECIFIED', - UNSUPPORTED_UTC_TIMING_SCHEME: 'UNSUPPORTED_UTC_TIMING_SCHEME' -}; - -/** - * @typedef {Object} SingleUri - * @property {string} uri - relative location of segment - * @property {string} resolvedUri - resolved location of segment - * @property {Object} byterange - Object containing information on how to make byte range - * requests following byte-range-spec per RFC2616. - * @property {String} byterange.length - length of range request - * @property {String} byterange.offset - byte offset of range request - * - * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 - */ - -/** - * Converts a URLType node (5.3.9.2.3 Table 13) to a segment object - * that conforms to how m3u8-parser is structured - * - * @see https://github.com/videojs/m3u8-parser - * - * @param {string} baseUrl - baseUrl provided by nodes - * @param {string} source - source url for segment - * @param {string} range - optional range used for range calls, - * follows RFC 2616, Clause 14.35.1 - * @return {SingleUri} full segment information transformed into a format similar - * to m3u8-parser - */ - -var urlTypeToSegment = function urlTypeToSegment(_ref) { - var _ref$baseUrl = _ref.baseUrl, - baseUrl = _ref$baseUrl === void 0 ? '' : _ref$baseUrl, - _ref$source = _ref.source, - source = _ref$source === void 0 ? '' : _ref$source, - _ref$range = _ref.range, - range = _ref$range === void 0 ? '' : _ref$range, - _ref$indexRange = _ref.indexRange, - indexRange = _ref$indexRange === void 0 ? '' : _ref$indexRange; - var segment = { - uri: source, - resolvedUri: resolveUrl(baseUrl || '', source) - }; - - if (range || indexRange) { - var rangeStr = range ? range : indexRange; - var ranges = rangeStr.split('-'); - var startRange = parseInt(ranges[0], 10); - var endRange = parseInt(ranges[1], 10); // byterange should be inclusive according to - // RFC 2616, Clause 14.35.1 - - segment.byterange = { - length: endRange - startRange + 1, - offset: startRange - }; - } - - return segment; -}; -var byteRangeToString = function byteRangeToString(byterange) { - // `endRange` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - var endRange = byterange.offset + byterange.length - 1; - return byterange.offset + "-" + endRange; -}; - -/** - * parse the end number attribue that can be a string - * number, or undefined. - * - * @param {string|number|undefined} endNumber - * The end number attribute. - * - * @return {number|null} - * The result of parsing the end number. - */ - -var parseEndNumber = function parseEndNumber(endNumber) { - if (endNumber && typeof endNumber !== 'number') { - endNumber = parseInt(endNumber, 10); - } - - if (isNaN(endNumber)) { - return null; - } - - return endNumber; -}; -/** - * Functions for calculating the range of available segments in static and dynamic - * manifests. - */ - - -var segmentRange = { - /** - * Returns the entire range of available segments for a static MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - static: function _static(attributes) { - var duration = attributes.duration, - _attributes$timescale = attributes.timescale, - timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale, - sourceDuration = attributes.sourceDuration; - var endNumber = parseEndNumber(attributes.endNumber); - return { - start: 0, - end: typeof endNumber === 'number' ? endNumber : Math.ceil(sourceDuration / (duration / timescale)) - }; - }, - - /** - * Returns the current live window range of available segments for a dynamic MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - dynamic: function dynamic(attributes) { - var NOW = attributes.NOW, - clientOffset = attributes.clientOffset, - availabilityStartTime = attributes.availabilityStartTime, - _attributes$timescale2 = attributes.timescale, - timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, - duration = attributes.duration, - _attributes$start = attributes.start, - start = _attributes$start === void 0 ? 0 : _attributes$start, - _attributes$minimumUp = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp, - _attributes$timeShift = attributes.timeShiftBufferDepth, - timeShiftBufferDepth = _attributes$timeShift === void 0 ? Infinity : _attributes$timeShift; - var endNumber = parseEndNumber(attributes.endNumber); - var now = (NOW + clientOffset) / 1000; - var periodStartWC = availabilityStartTime + start; - var periodEndWC = now + minimumUpdatePeriod; - var periodDuration = periodEndWC - periodStartWC; - var segmentCount = Math.ceil(periodDuration * timescale / duration); - var availableStart = Math.floor((now - periodStartWC - timeShiftBufferDepth) * timescale / duration); - var availableEnd = Math.floor((now - periodStartWC) * timescale / duration); - return { - start: Math.max(0, availableStart), - end: typeof endNumber === 'number' ? endNumber : Math.min(segmentCount, availableEnd) - }; - } -}; -/** - * Maps a range of numbers to objects with information needed to build the corresponding - * segment list - * - * @name toSegmentsCallback - * @function - * @param {number} number - * Number of the segment - * @param {number} index - * Index of the number in the range list - * @return {{ number: Number, duration: Number, timeline: Number, time: Number }} - * Object with segment timing and duration info - */ - -/** - * Returns a callback for Array.prototype.map for mapping a range of numbers to - * information needed to build the segment list. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {toSegmentsCallback} - * Callback map function - */ - -var toSegments = function toSegments(attributes) { - return function (number, index) { - var duration = attributes.duration, - _attributes$timescale3 = attributes.timescale, - timescale = _attributes$timescale3 === void 0 ? 1 : _attributes$timescale3, - periodIndex = attributes.periodIndex, - _attributes$startNumb = attributes.startNumber, - startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb; - return { - number: startNumber + number, - duration: duration / timescale, - timeline: periodIndex, - time: index * duration - }; - }; -}; -/** - * Returns a list of objects containing segment timing and duration info used for - * building the list of segments. This uses the @duration attribute specified - * in the MPD manifest to derive the range of segments. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - -var parseByDuration = function parseByDuration(attributes) { - var _attributes$type = attributes.type, - type = _attributes$type === void 0 ? 'static' : _attributes$type, - duration = attributes.duration, - _attributes$timescale4 = attributes.timescale, - timescale = _attributes$timescale4 === void 0 ? 1 : _attributes$timescale4, - sourceDuration = attributes.sourceDuration; - - var _segmentRange$type = segmentRange[type](attributes), - start = _segmentRange$type.start, - end = _segmentRange$type.end; - - var segments = range(start, end).map(toSegments(attributes)); - - if (type === 'static') { - var index = segments.length - 1; // final segment may be less than full segment duration - - segments[index].duration = sourceDuration - duration / timescale * index; - } - - return segments; -}; - -/** - * Translates SegmentBase into a set of segments. - * (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @return {Object.} list of segments - */ - -var segmentsFromBase = function segmentsFromBase(attributes) { - var baseUrl = attributes.baseUrl, - _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ, - sourceDuration = attributes.sourceDuration, - _attributes$indexRang = attributes.indexRange, - indexRange = _attributes$indexRang === void 0 ? '' : _attributes$indexRang, - duration = attributes.duration; // base url is required for SegmentBase to work, per spec (Section 5.3.9.2.1) - - if (!baseUrl) { - throw new Error(errors.NO_BASE_URL); - } - - var initSegment = urlTypeToSegment({ - baseUrl: baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - var segment = urlTypeToSegment({ - baseUrl: baseUrl, - source: baseUrl, - indexRange: indexRange - }); - segment.map = initSegment; // If there is a duration, use it, otherwise use the given duration of the source - // (since SegmentBase is only for one total segment) - - if (duration) { - var segmentTimeInfo = parseByDuration(attributes); - - if (segmentTimeInfo.length) { - segment.duration = segmentTimeInfo[0].duration; - segment.timeline = segmentTimeInfo[0].timeline; - } - } else if (sourceDuration) { - segment.duration = sourceDuration; - segment.timeline = 0; - } // This is used for mediaSequence - - - segment.number = 0; - return [segment]; -}; -/** - * Given a playlist, a sidx box, and a baseUrl, update the segment list of the playlist - * according to the sidx information given. - * - * playlist.sidx has metadadata about the sidx where-as the sidx param - * is the parsed sidx box itself. - * - * @param {Object} playlist the playlist to update the sidx information for - * @param {Object} sidx the parsed sidx box - * @return {Object} the playlist object with the updated sidx information - */ - -var addSidxSegmentsToPlaylist = function addSidxSegmentsToPlaylist(playlist, sidx, baseUrl) { - // Retain init segment information - var initSegment = playlist.sidx.map ? playlist.sidx.map : null; // Retain source duration from initial master manifest parsing - - var sourceDuration = playlist.sidx.duration; // Retain source timeline - - var timeline = playlist.timeline || 0; - var sidxByteRange = playlist.sidx.byterange; - var sidxEnd = sidxByteRange.offset + sidxByteRange.length; // Retain timescale of the parsed sidx - - var timescale = sidx.timescale; // referenceType 1 refers to other sidx boxes - - var mediaReferences = sidx.references.filter(function (r) { - return r.referenceType !== 1; - }); - var segments = []; // firstOffset is the offset from the end of the sidx box - - var startIndex = sidxEnd + sidx.firstOffset; - - for (var i = 0; i < mediaReferences.length; i++) { - var reference = sidx.references[i]; // size of the referenced (sub)segment - - var size = reference.referencedSize; // duration of the referenced (sub)segment, in the timescale - // this will be converted to seconds when generating segments - - var duration = reference.subsegmentDuration; // should be an inclusive range - - var endIndex = startIndex + size - 1; - var indexRange = startIndex + "-" + endIndex; - var attributes = { - baseUrl: baseUrl, - timescale: timescale, - timeline: timeline, - // this is used in parseByDuration - periodIndex: timeline, - duration: duration, - sourceDuration: sourceDuration, - indexRange: indexRange - }; - var segment = segmentsFromBase(attributes)[0]; - - if (initSegment) { - segment.map = initSegment; - } - - segments.push(segment); - startIndex += size; - } - - playlist.segments = segments; - return playlist; -}; - -var generateSidxKey = function generateSidxKey(sidx) { - return sidx && sidx.uri + '-' + byteRangeToString(sidx.byterange); -}; - -var mergeDiscontiguousPlaylists = function mergeDiscontiguousPlaylists(playlists) { - var mergedPlaylists = values(playlists.reduce(function (acc, playlist) { - // assuming playlist IDs are the same across periods - // TODO: handle multiperiod where representation sets are not the same - // across periods - var name = playlist.attributes.id + (playlist.attributes.lang || ''); // Periods after first - - if (acc[name]) { - var _acc$name$segments; - - // first segment of subsequent periods signal a discontinuity - if (playlist.segments[0]) { - playlist.segments[0].discontinuity = true; - } - - (_acc$name$segments = acc[name].segments).push.apply(_acc$name$segments, playlist.segments); // bubble up contentProtection, this assumes all DRM content - // has the same contentProtection - - - if (playlist.attributes.contentProtection) { - acc[name].attributes.contentProtection = playlist.attributes.contentProtection; - } - } else { - // first Period - acc[name] = playlist; - } - - return acc; - }, {})); - return mergedPlaylists.map(function (playlist) { - playlist.discontinuityStarts = findIndexes(playlist.segments, 'discontinuity'); - return playlist; - }); -}; - -var addSidxSegmentsToPlaylist$1 = function addSidxSegmentsToPlaylist$1(playlist, sidxMapping) { - var sidxKey = generateSidxKey(playlist.sidx); - var sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx; - - if (sidxMatch) { - addSidxSegmentsToPlaylist(playlist, sidxMatch, playlist.sidx.resolvedUri); - } - - return playlist; -}; -var addSidxSegmentsToPlaylists = function addSidxSegmentsToPlaylists(playlists, sidxMapping) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (!Object.keys(sidxMapping).length) { - return playlists; - } - - for (var i in playlists) { - playlists[i] = addSidxSegmentsToPlaylist$1(playlists[i], sidxMapping); - } - - return playlists; -}; -var formatAudioPlaylist = function formatAudioPlaylist(_ref, isAudioOnly) { - var _attributes; - - var attributes = _ref.attributes, - segments = _ref.segments, - sidx = _ref.sidx; - var playlist = { - attributes: (_attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth, - CODECS: attributes.codecs - }, _attributes['PROGRAM-ID'] = 1, _attributes), - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - if (isAudioOnly) { - playlist.attributes.AUDIO = 'audio'; - playlist.attributes.SUBTITLES = 'subs'; - } - - return playlist; -}; -var formatVttPlaylist = function formatVttPlaylist(_ref2) { - var _m3u8Attributes; - - var attributes = _ref2.attributes, - segments = _ref2.segments; - - if (typeof segments === 'undefined') { - // vtt tracks may use single file in BaseURL - segments = [{ - uri: attributes.baseUrl, - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - duration: attributes.sourceDuration, - number: 0 - }]; // targetDuration should be the same duration as the only segment - - attributes.duration = attributes.sourceDuration; - } - - var m3u8Attributes = (_m3u8Attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth - }, _m3u8Attributes['PROGRAM-ID'] = 1, _m3u8Attributes); - - if (attributes.codecs) { - m3u8Attributes.CODECS = attributes.codecs; - } - - return { - attributes: m3u8Attributes, - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; -}; -var organizeAudioPlaylists = function organizeAudioPlaylists(playlists, sidxMapping, isAudioOnly) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (isAudioOnly === void 0) { - isAudioOnly = false; - } - - var mainPlaylist; - var formattedPlaylists = playlists.reduce(function (a, playlist) { - var role = playlist.attributes.role && playlist.attributes.role.value || ''; - var language = playlist.attributes.lang || ''; - var label = playlist.attributes.label || 'main'; - - if (language && !playlist.attributes.label) { - var roleLabel = role ? " (" + role + ")" : ''; - label = "" + playlist.attributes.lang + roleLabel; - } - - if (!a[label]) { - a[label] = { - language: language, - autoselect: true, - default: role === 'main', - playlists: [], - uri: '' - }; - } - - var formatted = addSidxSegmentsToPlaylist$1(formatAudioPlaylist(playlist, isAudioOnly), sidxMapping); - a[label].playlists.push(formatted); - - if (typeof mainPlaylist === 'undefined' && role === 'main') { - mainPlaylist = playlist; - mainPlaylist.default = true; - } - - return a; - }, {}); // if no playlists have role "main", mark the first as main - - if (!mainPlaylist) { - var firstLabel = Object.keys(formattedPlaylists)[0]; - formattedPlaylists[firstLabel].default = true; - } - - return formattedPlaylists; -}; -var organizeVttPlaylists = function organizeVttPlaylists(playlists, sidxMapping) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - return playlists.reduce(function (a, playlist) { - var label = playlist.attributes.lang || 'text'; - - if (!a[label]) { - a[label] = { - language: label, - default: false, - autoselect: false, - playlists: [], - uri: '' - }; - } - - a[label].playlists.push(addSidxSegmentsToPlaylist$1(formatVttPlaylist(playlist), sidxMapping)); - return a; - }, {}); -}; - -var organizeCaptionServices = function organizeCaptionServices(captionServices) { - return captionServices.reduce(function (svcObj, svc) { - if (!svc) { - return svcObj; - } - - svc.forEach(function (service) { - var channel = service.channel, - language = service.language; - svcObj[language] = { - autoselect: false, - default: false, - instreamId: channel, - language: language - }; - - if (service.hasOwnProperty('aspectRatio')) { - svcObj[language].aspectRatio = service.aspectRatio; - } - - if (service.hasOwnProperty('easyReader')) { - svcObj[language].easyReader = service.easyReader; - } - - if (service.hasOwnProperty('3D')) { - svcObj[language]['3D'] = service['3D']; - } - }); - return svcObj; - }, {}); -}; - -var formatVideoPlaylist = function formatVideoPlaylist(_ref3) { - var _attributes2; - - var attributes = _ref3.attributes, - segments = _ref3.segments, - sidx = _ref3.sidx; - var playlist = { - attributes: (_attributes2 = { - NAME: attributes.id, - AUDIO: 'audio', - SUBTITLES: 'subs', - RESOLUTION: { - width: attributes.width, - height: attributes.height - }, - CODECS: attributes.codecs, - BANDWIDTH: attributes.bandwidth - }, _attributes2['PROGRAM-ID'] = 1, _attributes2), - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - return playlist; -}; - -var videoOnly = function videoOnly(_ref4) { - var attributes = _ref4.attributes; - return attributes.mimeType === 'video/mp4' || attributes.mimeType === 'video/webm' || attributes.contentType === 'video'; -}; - -var audioOnly = function audioOnly(_ref5) { - var attributes = _ref5.attributes; - return attributes.mimeType === 'audio/mp4' || attributes.mimeType === 'audio/webm' || attributes.contentType === 'audio'; -}; - -var vttOnly = function vttOnly(_ref6) { - var attributes = _ref6.attributes; - return attributes.mimeType === 'text/vtt' || attributes.contentType === 'text'; -}; - -var toM3u8 = function toM3u8(dashPlaylists, locations, sidxMapping) { - var _mediaGroups; - - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (!dashPlaylists.length) { - return {}; - } // grab all master attributes - - - var _dashPlaylists$0$attr = dashPlaylists[0].attributes, - duration = _dashPlaylists$0$attr.sourceDuration, - _dashPlaylists$0$attr2 = _dashPlaylists$0$attr.type, - type = _dashPlaylists$0$attr2 === void 0 ? 'static' : _dashPlaylists$0$attr2, - suggestedPresentationDelay = _dashPlaylists$0$attr.suggestedPresentationDelay, - minimumUpdatePeriod = _dashPlaylists$0$attr.minimumUpdatePeriod; - var videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist); - var audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly)); - var vttPlaylists = dashPlaylists.filter(vttOnly); - var captions = dashPlaylists.map(function (playlist) { - return playlist.attributes.captionServices; - }).filter(Boolean); - var master = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: (_mediaGroups = { - AUDIO: {}, - VIDEO: {} - }, _mediaGroups['CLOSED-CAPTIONS'] = {}, _mediaGroups.SUBTITLES = {}, _mediaGroups), - uri: '', - duration: duration, - playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping) - }; - - if (minimumUpdatePeriod >= 0) { - master.minimumUpdatePeriod = minimumUpdatePeriod * 1000; - } - - if (locations) { - master.locations = locations; - } - - if (type === 'dynamic') { - master.suggestedPresentationDelay = suggestedPresentationDelay; - } - - var isAudioOnly = master.playlists.length === 0; - - if (audioPlaylists.length) { - master.mediaGroups.AUDIO.audio = organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly); - } - - if (vttPlaylists.length) { - master.mediaGroups.SUBTITLES.subs = organizeVttPlaylists(vttPlaylists, sidxMapping); - } - - if (captions.length) { - master.mediaGroups['CLOSED-CAPTIONS'].cc = organizeCaptionServices(captions); - } - - return master; -}; - -/** - * Calculates the R (repetition) value for a live stream (for the final segment - * in a manifest where the r value is negative 1) - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {number} time - * current time (typically the total time up until the final segment) - * @param {number} duration - * duration property for the given - * - * @return {number} - * R value to reach the end of the given period - */ -var getLiveRValue = function getLiveRValue(attributes, time, duration) { - var NOW = attributes.NOW, - clientOffset = attributes.clientOffset, - availabilityStartTime = attributes.availabilityStartTime, - _attributes$timescale = attributes.timescale, - timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale, - _attributes$start = attributes.start, - start = _attributes$start === void 0 ? 0 : _attributes$start, - _attributes$minimumUp = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp; - var now = (NOW + clientOffset) / 1000; - var periodStartWC = availabilityStartTime + start; - var periodEndWC = now + minimumUpdatePeriod; - var periodDuration = periodEndWC - periodStartWC; - return Math.ceil((periodDuration * timescale - time) / duration); -}; -/** - * Uses information provided by SegmentTemplate.SegmentTimeline to determine segment - * timing and duration - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]} segmentTimeline - * List of objects representing the attributes of each S element contained within - * - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - -var parseByTimeline = function parseByTimeline(attributes, segmentTimeline) { - var _attributes$type = attributes.type, - type = _attributes$type === void 0 ? 'static' : _attributes$type, - _attributes$minimumUp2 = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp2 === void 0 ? 0 : _attributes$minimumUp2, - _attributes$media = attributes.media, - media = _attributes$media === void 0 ? '' : _attributes$media, - sourceDuration = attributes.sourceDuration, - _attributes$timescale2 = attributes.timescale, - timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, - _attributes$startNumb = attributes.startNumber, - startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb, - timeline = attributes.periodIndex; - var segments = []; - var time = -1; - - for (var sIndex = 0; sIndex < segmentTimeline.length; sIndex++) { - var S = segmentTimeline[sIndex]; - var duration = S.d; - var repeat = S.r || 0; - var segmentTime = S.t || 0; - - if (time < 0) { - // first segment - time = segmentTime; - } - - if (segmentTime && segmentTime > time) { - // discontinuity - // TODO: How to handle this type of discontinuity - // timeline++ here would treat it like HLS discontuity and content would - // get appended without gap - // E.G. - // - // - // - // - // would have $Time$ values of [0, 1, 2, 5] - // should this be appened at time positions [0, 1, 2, 3],(#EXT-X-DISCONTINUITY) - // or [0, 1, 2, gap, gap, 5]? (#EXT-X-GAP) - // does the value of sourceDuration consider this when calculating arbitrary - // negative @r repeat value? - // E.G. Same elements as above with this added at the end - // - // with a sourceDuration of 10 - // Would the 2 gaps be included in the time duration calculations resulting in - // 8 segments with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9] or 10 segments - // with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9, 10, 11] ? - time = segmentTime; - } - - var count = void 0; - - if (repeat < 0) { - var nextS = sIndex + 1; - - if (nextS === segmentTimeline.length) { - // last segment - if (type === 'dynamic' && minimumUpdatePeriod > 0 && media.indexOf('$Number$') > 0) { - count = getLiveRValue(attributes, time, duration); - } else { - // TODO: This may be incorrect depending on conclusion of TODO above - count = (sourceDuration * timescale - time) / duration; - } - } else { - count = (segmentTimeline[nextS].t - time) / duration; - } - } else { - count = repeat + 1; - } - - var end = startNumber + segments.length + count; - var number = startNumber + segments.length; - - while (number < end) { - segments.push({ - number: number, - duration: duration / timescale, - time: time, - timeline: timeline - }); - time += duration; - number++; - } - } - - return segments; -}; - -var identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g; -/** - * Replaces template identifiers with corresponding values. To be used as the callback - * for String.prototype.replace - * - * @name replaceCallback - * @function - * @param {string} match - * Entire match of identifier - * @param {string} identifier - * Name of matched identifier - * @param {string} format - * Format tag string. Its presence indicates that padding is expected - * @param {string} width - * Desired length of the replaced value. Values less than this width shall be left - * zero padded - * @return {string} - * Replacement for the matched identifier - */ - -/** - * Returns a function to be used as a callback for String.prototype.replace to replace - * template identifiers - * - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {replaceCallback} - * Callback to be used with String.prototype.replace to replace identifiers - */ - -var identifierReplacement = function identifierReplacement(values) { - return function (match, identifier, format, width) { - if (match === '$$') { - // escape sequence - return '$'; - } - - if (typeof values[identifier] === 'undefined') { - return match; - } - - var value = '' + values[identifier]; - - if (identifier === 'RepresentationID') { - // Format tag shall not be present with RepresentationID - return value; - } - - if (!format) { - width = 1; - } else { - width = parseInt(width, 10); - } - - if (value.length >= width) { - return value; - } - - return "" + new Array(width - value.length + 1).join('0') + value; - }; -}; -/** - * Constructs a segment url from a template string - * - * @param {string} url - * Template string to construct url from - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {string} - * Segment url with identifiers replaced - */ - -var constructTemplateUrl = function constructTemplateUrl(url, values) { - return url.replace(identifierPattern, identifierReplacement(values)); -}; -/** - * Generates a list of objects containing timing and duration information about each - * segment needed to generate segment uris and the complete segment object - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - -var parseTemplateInfo = function parseTemplateInfo(attributes, segmentTimeline) { - if (!attributes.duration && !segmentTimeline) { - // if neither @duration or SegmentTimeline are present, then there shall be exactly - // one media segment - return [{ - number: attributes.startNumber || 1, - duration: attributes.sourceDuration, - time: 0, - timeline: attributes.periodIndex - }]; - } - - if (attributes.duration) { - return parseByDuration(attributes); - } - - return parseByTimeline(attributes, segmentTimeline); -}; -/** - * Generates a list of segments using information provided by the SegmentTemplate element - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object[]} - * List of segment objects - */ - -var segmentsFromTemplate = function segmentsFromTemplate(attributes, segmentTimeline) { - var templateValues = { - RepresentationID: attributes.id, - Bandwidth: attributes.bandwidth || 0 - }; - var _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? { - sourceURL: '', - range: '' - } : _attributes$initializ; - var mapSegment = urlTypeToSegment({ - baseUrl: attributes.baseUrl, - source: constructTemplateUrl(initialization.sourceURL, templateValues), - range: initialization.range - }); - var segments = parseTemplateInfo(attributes, segmentTimeline); - return segments.map(function (segment) { - templateValues.Number = segment.number; - templateValues.Time = segment.time; - var uri = constructTemplateUrl(attributes.media || '', templateValues); - var map = { - uri: uri, - timeline: segment.timeline, - duration: segment.duration, - resolvedUri: resolveUrl(attributes.baseUrl || '', uri), - map: mapSegment, - number: segment.number - }; - - if (attributes.presentationTimeOffset) { - map.presentationTimeOffset = attributes.presentationTimeOffset; - } - - return map; - }); -}; - -/** - * Converts a (of type URLType from the DASH spec 5.3.9.2 Table 14) - * to an object that matches the output of a segment in videojs/mpd-parser - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object} segmentUrl - * node to translate into a segment object - * @return {Object} translated segment object - */ - -var SegmentURLToSegmentObject = function SegmentURLToSegmentObject(attributes, segmentUrl) { - var baseUrl = attributes.baseUrl, - _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ; - var initSegment = urlTypeToSegment({ - baseUrl: baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - var segment = urlTypeToSegment({ - baseUrl: baseUrl, - source: segmentUrl.media, - range: segmentUrl.mediaRange - }); - segment.map = initSegment; - return segment; -}; -/** - * Generates a list of segments using information provided by the SegmentList element - * SegmentList (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object.} list of segments - */ - - -var segmentsFromList = function segmentsFromList(attributes, segmentTimeline) { - var duration = attributes.duration, - _attributes$segmentUr = attributes.segmentUrls, - segmentUrls = _attributes$segmentUr === void 0 ? [] : _attributes$segmentUr; // Per spec (5.3.9.2.1) no way to determine segment duration OR - // if both SegmentTimeline and @duration are defined, it is outside of spec. - - if (!duration && !segmentTimeline || duration && segmentTimeline) { - throw new Error(errors.SEGMENT_TIME_UNSPECIFIED); - } - - var segmentUrlMap = segmentUrls.map(function (segmentUrlObject) { - return SegmentURLToSegmentObject(attributes, segmentUrlObject); - }); - var segmentTimeInfo; - - if (duration) { - segmentTimeInfo = parseByDuration(attributes); - } - - if (segmentTimeline) { - segmentTimeInfo = parseByTimeline(attributes, segmentTimeline); - } - - var segments = segmentTimeInfo.map(function (segmentTime, index) { - if (segmentUrlMap[index]) { - var segment = segmentUrlMap[index]; - segment.timeline = segmentTime.timeline; - segment.duration = segmentTime.duration; - segment.number = segmentTime.number; - return segment; - } // Since we're mapping we should get rid of any blank segments (in case - // the given SegmentTimeline is handling for more elements than we have - // SegmentURLs for). - - }).filter(function (segment) { - return segment; - }); - return segments; -}; - -var generateSegments = function generateSegments(_ref) { - var attributes = _ref.attributes, - segmentInfo = _ref.segmentInfo; - var segmentAttributes; - var segmentsFn; - - if (segmentInfo.template) { - segmentsFn = segmentsFromTemplate; - segmentAttributes = merge(attributes, segmentInfo.template); - - if (segmentInfo.template.presentationTimeOffset) { - segmentAttributes.presentationTimeOffset = segmentInfo.template.presentationTimeOffset / segmentInfo.template.timescale; - } - } else if (segmentInfo.base) { - segmentsFn = segmentsFromBase; - segmentAttributes = merge(attributes, segmentInfo.base); - } else if (segmentInfo.list) { - segmentsFn = segmentsFromList; - segmentAttributes = merge(attributes, segmentInfo.list); - } - - var segmentsInfo = { - attributes: attributes - }; - - if (!segmentsFn) { - return segmentsInfo; - } - - var segments = segmentsFn(segmentAttributes, segmentInfo.timeline); // The @duration attribute will be used to determin the playlist's targetDuration which - // must be in seconds. Since we've generated the segment list, we no longer need - // @duration to be in @timescale units, so we can convert it here. - - if (segmentAttributes.duration) { - var _segmentAttributes = segmentAttributes, - duration = _segmentAttributes.duration, - _segmentAttributes$ti = _segmentAttributes.timescale, - timescale = _segmentAttributes$ti === void 0 ? 1 : _segmentAttributes$ti; - segmentAttributes.duration = duration / timescale; - } else if (segments.length) { - // if there is no @duration attribute, use the largest segment duration as - // as target duration - segmentAttributes.duration = segments.reduce(function (max, segment) { - return Math.max(max, Math.ceil(segment.duration)); - }, 0); - } else { - segmentAttributes.duration = 0; - } - - segmentsInfo.attributes = segmentAttributes; - segmentsInfo.segments = segments; // This is a sidx box without actual segment information - - if (segmentInfo.base && segmentAttributes.indexRange) { - segmentsInfo.sidx = segments[0]; - segmentsInfo.segments = []; - } - - return segmentsInfo; -}; -var toPlaylists = function toPlaylists(representations) { - return representations.map(generateSegments); -}; - -var findChildren = function findChildren(element, name) { - return from(element.childNodes).filter(function (_ref) { - var tagName = _ref.tagName; - return tagName === name; - }); -}; -var getContent = function getContent(element) { - return element.textContent.trim(); -}; - -var parseDuration = function parseDuration(str) { - var SECONDS_IN_YEAR = 365 * 24 * 60 * 60; - var SECONDS_IN_MONTH = 30 * 24 * 60 * 60; - var SECONDS_IN_DAY = 24 * 60 * 60; - var SECONDS_IN_HOUR = 60 * 60; - var SECONDS_IN_MIN = 60; // P10Y10M10DT10H10M10.1S - - var durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/; - var match = durationRegex.exec(str); - - if (!match) { - return 0; - } - - var _match$slice = match.slice(1), - year = _match$slice[0], - month = _match$slice[1], - day = _match$slice[2], - hour = _match$slice[3], - minute = _match$slice[4], - second = _match$slice[5]; - - return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0); -}; -var parseDate = function parseDate(str) { - // Date format without timezone according to ISO 8601 - // YYY-MM-DDThh:mm:ss.ssssss - var dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/; // If the date string does not specifiy a timezone, we must specifiy UTC. This is - // expressed by ending with 'Z' - - if (dateRegex.test(str)) { - str += 'Z'; - } - - return Date.parse(str); -}; - -var parsers = { - /** - * Specifies the duration of the entire Media Presentation. Format is a duration string - * as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - mediaPresentationDuration: function mediaPresentationDuration(value) { - return parseDuration(value); - }, - - /** - * Specifies the Segment availability start time for all Segments referred to in this - * MPD. For a dynamic manifest, it specifies the anchor for the earliest availability - * time. Format is a date string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The date as seconds from unix epoch - */ - availabilityStartTime: function availabilityStartTime(value) { - return parseDate(value) / 1000; - }, - - /** - * Specifies the smallest period between potential changes to the MPD. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - minimumUpdatePeriod: function minimumUpdatePeriod(value) { - return parseDuration(value); - }, - - /** - * Specifies the suggested presentation delay. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - suggestedPresentationDelay: function suggestedPresentationDelay(value) { - return parseDuration(value); - }, - - /** - * specifices the type of mpd. Can be either "static" or "dynamic" - * - * @param {string} value - * value of attribute as a string - * - * @return {string} - * The type as a string - */ - type: function type(value) { - return value; - }, - - /** - * Specifies the duration of the smallest time shifting buffer for any Representation - * in the MPD. Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - timeShiftBufferDepth: function timeShiftBufferDepth(value) { - return parseDuration(value); - }, - - /** - * Specifies the PeriodStart time of the Period relative to the availabilityStarttime. - * Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - start: function start(value) { - return parseDuration(value); - }, - - /** - * Specifies the width of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed width - */ - width: function width(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the height of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed height - */ - height: function height(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the bitrate of the representation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed bandwidth - */ - bandwidth: function bandwidth(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the number of the first Media Segment in this Representation in the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - startNumber: function startNumber(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the timescale in units per seconds - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed timescale - */ - timescale: function timescale(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the presentationTimeOffset. - * - * @param {string} value - * value of the attribute as a string - * - * @return {number} - * The parsed presentationTimeOffset - */ - presentationTimeOffset: function presentationTimeOffset(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the constant approximate Segment duration - * NOTE: The element also contains an @duration attribute. This duration - * specifies the duration of the Period. This attribute is currently not - * supported by the rest of the parser, however we still check for it to prevent - * errors. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - duration: function duration(value) { - var parsedValue = parseInt(value, 10); - - if (isNaN(parsedValue)) { - return parseDuration(value); - } - - return parsedValue; - }, - - /** - * Specifies the Segment duration, in units of the value of the @timescale. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - d: function d(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the MPD start time, in @timescale units, the first Segment in the series - * starts relative to the beginning of the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed time - */ - t: function t(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the repeat count of the number of following contiguous Segments with the - * same duration expressed by the value of @d - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - r: function r(value) { - return parseInt(value, 10); - }, - - /** - * Default parser for all other attributes. Acts as a no-op and just returns the value - * as a string - * - * @param {string} value - * value of attribute as a string - * @return {string} - * Unparsed value - */ - DEFAULT: function DEFAULT(value) { - return value; - } -}; -/** - * Gets all the attributes and values of the provided node, parses attributes with known - * types, and returns an object with attribute names mapped to values. - * - * @param {Node} el - * The node to parse attributes from - * @return {Object} - * Object with all attributes of el parsed - */ - -var parseAttributes = function parseAttributes(el) { - if (!(el && el.attributes)) { - return {}; - } - - return from(el.attributes).reduce(function (a, e) { - var parseFn = parsers[e.name] || parsers.DEFAULT; - a[e.name] = parseFn(e.value); - return a; - }, {}); -}; - -var keySystemsMap = { - 'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b': 'org.w3.clearkey', - 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed': 'com.widevine.alpha', - 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95': 'com.microsoft.playready', - 'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime' -}; -/** - * Builds a list of urls that is the product of the reference urls and BaseURL values - * - * @param {string[]} referenceUrls - * List of reference urls to resolve to - * @param {Node[]} baseUrlElements - * List of BaseURL nodes from the mpd - * @return {string[]} - * List of resolved urls - */ - -var buildBaseUrls = function buildBaseUrls(referenceUrls, baseUrlElements) { - if (!baseUrlElements.length) { - return referenceUrls; - } - - return flatten(referenceUrls.map(function (reference) { - return baseUrlElements.map(function (baseUrlElement) { - return resolveUrl(reference, getContent(baseUrlElement)); - }); - })); -}; -/** - * Contains all Segment information for its containing AdaptationSet - * - * @typedef {Object} SegmentInformation - * @property {Object|undefined} template - * Contains the attributes for the SegmentTemplate node - * @property {Object[]|undefined} timeline - * Contains a list of atrributes for each S node within the SegmentTimeline node - * @property {Object|undefined} list - * Contains the attributes for the SegmentList node - * @property {Object|undefined} base - * Contains the attributes for the SegmentBase node - */ - -/** - * Returns all available Segment information contained within the AdaptationSet node - * - * @param {Node} adaptationSet - * The AdaptationSet node to get Segment information from - * @return {SegmentInformation} - * The Segment information contained within the provided AdaptationSet - */ - -var getSegmentInformation = function getSegmentInformation(adaptationSet) { - var segmentTemplate = findChildren(adaptationSet, 'SegmentTemplate')[0]; - var segmentList = findChildren(adaptationSet, 'SegmentList')[0]; - var segmentUrls = segmentList && findChildren(segmentList, 'SegmentURL').map(function (s) { - return merge({ - tag: 'SegmentURL' - }, parseAttributes(s)); - }); - var segmentBase = findChildren(adaptationSet, 'SegmentBase')[0]; - var segmentTimelineParentNode = segmentList || segmentTemplate; - var segmentTimeline = segmentTimelineParentNode && findChildren(segmentTimelineParentNode, 'SegmentTimeline')[0]; - var segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate; - var segmentInitialization = segmentInitializationParentNode && findChildren(segmentInitializationParentNode, 'Initialization')[0]; // SegmentTemplate is handled slightly differently, since it can have both - // @initialization and an node. @initialization can be templated, - // while the node can have a url and range specified. If the has - // both @initialization and an subelement we opt to override with - // the node, as this interaction is not defined in the spec. - - var template = segmentTemplate && parseAttributes(segmentTemplate); - - if (template && segmentInitialization) { - template.initialization = segmentInitialization && parseAttributes(segmentInitialization); - } else if (template && template.initialization) { - // If it is @initialization we convert it to an object since this is the format that - // later functions will rely on for the initialization segment. This is only valid - // for - template.initialization = { - sourceURL: template.initialization - }; - } - - var segmentInfo = { - template: template, - timeline: segmentTimeline && findChildren(segmentTimeline, 'S').map(function (s) { - return parseAttributes(s); - }), - list: segmentList && merge(parseAttributes(segmentList), { - segmentUrls: segmentUrls, - initialization: parseAttributes(segmentInitialization) - }), - base: segmentBase && merge(parseAttributes(segmentBase), { - initialization: parseAttributes(segmentInitialization) - }) - }; - Object.keys(segmentInfo).forEach(function (key) { - if (!segmentInfo[key]) { - delete segmentInfo[key]; - } - }); - return segmentInfo; -}; -/** - * Contains Segment information and attributes needed to construct a Playlist object - * from a Representation - * - * @typedef {Object} RepresentationInformation - * @property {SegmentInformation} segmentInfo - * Segment information for this Representation - * @property {Object} attributes - * Inherited attributes for this Representation - */ - -/** - * Maps a Representation node to an object containing Segment information and attributes - * - * @name inheritBaseUrlsCallback - * @function - * @param {Node} representation - * Representation node from the mpd - * @return {RepresentationInformation} - * Representation information needed to construct a Playlist object - */ - -/** - * Returns a callback for Array.prototype.map for mapping Representation nodes to - * Segment information and attributes using inherited BaseURL nodes. - * - * @param {Object} adaptationSetAttributes - * Contains attributes inherited by the AdaptationSet - * @param {string[]} adaptationSetBaseUrls - * Contains list of resolved base urls inherited by the AdaptationSet - * @param {SegmentInformation} adaptationSetSegmentInfo - * Contains Segment information for the AdaptationSet - * @return {inheritBaseUrlsCallback} - * Callback map function - */ - -var inheritBaseUrls = function inheritBaseUrls(adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) { - return function (representation) { - var repBaseUrlElements = findChildren(representation, 'BaseURL'); - var repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements); - var attributes = merge(adaptationSetAttributes, parseAttributes(representation)); - var representationSegmentInfo = getSegmentInformation(representation); - return repBaseUrls.map(function (baseUrl) { - return { - segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo), - attributes: merge(attributes, { - baseUrl: baseUrl - }) - }; - }); - }; -}; -/** - * Tranforms a series of content protection nodes to - * an object containing pssh data by key system - * - * @param {Node[]} contentProtectionNodes - * Content protection nodes - * @return {Object} - * Object containing pssh data by key system - */ - -var generateKeySystemInformation = function generateKeySystemInformation(contentProtectionNodes) { - return contentProtectionNodes.reduce(function (acc, node) { - var attributes = parseAttributes(node); - var keySystem = keySystemsMap[attributes.schemeIdUri]; - - if (keySystem) { - acc[keySystem] = { - attributes: attributes - }; - var psshNode = findChildren(node, 'cenc:pssh')[0]; - - if (psshNode) { - var pssh = getContent(psshNode); - var psshBuffer = pssh && decodeB64ToUint8Array(pssh); - acc[keySystem].pssh = psshBuffer; - } - } - - return acc; - }, {}); -}; // defined in ANSI_SCTE 214-1 2016 - - -var parseCaptionServiceMetadata = function parseCaptionServiceMetadata(service) { - // 608 captions - if (service.schemeIdUri === 'urn:scte:dash:cc:cea-608:2015') { - var values = service.value.split(';'); - return values.map(function (value) { - var channel; - var language; // default language to value - - language = value; - - if (/^CC\d=/.test(value)) { - var _value$split = value.split('='); - - channel = _value$split[0]; - language = _value$split[1]; - } else if (/^CC\d$/.test(value)) { - channel = value; - } - - return { - channel: channel, - language: language - }; - }); - } else if (service.schemeIdUri === 'urn:scte:dash:cc:cea-708:2015') { - var _values = service.value.split(';'); - - return _values.map(function (value) { - var flags = { - // service or channel number 1-63 - 'channel': undefined, - // language is a 3ALPHA per ISO 639.2/B - // field is required - 'language': undefined, - // BIT 1/0 or ? - // default value is 1, meaning 16:9 aspect ratio, 0 is 4:3, ? is unknown - 'aspectRatio': 1, - // BIT 1/0 - // easy reader flag indicated the text is tailed to the needs of beginning readers - // default 0, or off - 'easyReader': 0, - // BIT 1/0 - // If 3d metadata is present (CEA-708.1) then 1 - // default 0 - '3D': 0 - }; - - if (/=/.test(value)) { - var _value$split2 = value.split('='), - channel = _value$split2[0], - _value$split2$ = _value$split2[1], - opts = _value$split2$ === void 0 ? '' : _value$split2$; - - flags.channel = channel; - flags.language = value; - opts.split(',').forEach(function (opt) { - var _opt$split = opt.split(':'), - name = _opt$split[0], - val = _opt$split[1]; - - if (name === 'lang') { - flags.language = val; // er for easyReadery - } else if (name === 'er') { - flags.easyReader = Number(val); // war for wide aspect ratio - } else if (name === 'war') { - flags.aspectRatio = Number(val); - } else if (name === '3D') { - flags['3D'] = Number(val); - } - }); - } else { - flags.language = value; - } - - if (flags.channel) { - flags.channel = 'SERVICE' + flags.channel; - } - - return flags; - }); - } -}; -/** - * Maps an AdaptationSet node to a list of Representation information objects - * - * @name toRepresentationsCallback - * @function - * @param {Node} adaptationSet - * AdaptationSet node from the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - -/** - * Returns a callback for Array.prototype.map for mapping AdaptationSet nodes to a list of - * Representation information objects - * - * @param {Object} periodAttributes - * Contains attributes inherited by the Period - * @param {string[]} periodBaseUrls - * Contains list of resolved base urls inherited by the Period - * @param {string[]} periodSegmentInfo - * Contains Segment Information at the period level - * @return {toRepresentationsCallback} - * Callback map function - */ - -var toRepresentations = function toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo) { - return function (adaptationSet) { - var adaptationSetAttributes = parseAttributes(adaptationSet); - var adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls, findChildren(adaptationSet, 'BaseURL')); - var role = findChildren(adaptationSet, 'Role')[0]; - var roleAttributes = { - role: parseAttributes(role) - }; - var attrs = merge(periodAttributes, adaptationSetAttributes, roleAttributes); - var accessibility = findChildren(adaptationSet, 'Accessibility')[0]; - var captionServices = parseCaptionServiceMetadata(parseAttributes(accessibility)); - - if (captionServices) { - attrs = merge(attrs, { - captionServices: captionServices - }); - } - - var label = findChildren(adaptationSet, 'Label')[0]; - - if (label && label.childNodes.length) { - var labelVal = label.childNodes[0].nodeValue.trim(); - attrs = merge(attrs, { - label: labelVal - }); - } - - var contentProtection = generateKeySystemInformation(findChildren(adaptationSet, 'ContentProtection')); - - if (Object.keys(contentProtection).length) { - attrs = merge(attrs, { - contentProtection: contentProtection - }); - } - - var segmentInfo = getSegmentInformation(adaptationSet); - var representations = findChildren(adaptationSet, 'Representation'); - var adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo); - return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo))); - }; -}; -/** - * Maps an Period node to a list of Representation inforamtion objects for all - * AdaptationSet nodes contained within the Period - * - * @name toAdaptationSetsCallback - * @function - * @param {Node} period - * Period node from the mpd - * @param {number} periodIndex - * Index of the Period within the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - -/** - * Returns a callback for Array.prototype.map for mapping Period nodes to a list of - * Representation information objects - * - * @param {Object} mpdAttributes - * Contains attributes inherited by the mpd - * @param {string[]} mpdBaseUrls - * Contains list of resolved base urls inherited by the mpd - * @return {toAdaptationSetsCallback} - * Callback map function - */ - -var toAdaptationSets = function toAdaptationSets(mpdAttributes, mpdBaseUrls) { - return function (period, index) { - var periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period, 'BaseURL')); - var periodAtt = parseAttributes(period); - var parsedPeriodId = parseInt(periodAtt.id, 10); // fallback to mapping index if Period@id is not a number - - var periodIndex = window.isNaN(parsedPeriodId) ? index : parsedPeriodId; - var periodAttributes = merge(mpdAttributes, { - periodIndex: periodIndex - }); - var adaptationSets = findChildren(period, 'AdaptationSet'); - var periodSegmentInfo = getSegmentInformation(period); - return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo))); - }; -}; -/** - * Traverses the mpd xml tree to generate a list of Representation information objects - * that have inherited attributes from parent nodes - * - * @param {Node} mpd - * The root node of the mpd - * @param {Object} options - * Available options for inheritAttributes - * @param {string} options.manifestUri - * The uri source of the mpd - * @param {number} options.NOW - * Current time per DASH IOP. Default is current time in ms since epoch - * @param {number} options.clientOffset - * Client time difference from NOW (in milliseconds) - * @return {RepresentationInformation[]} - * List of objects containing Representation information - */ - -var inheritAttributes = function inheritAttributes(mpd, options) { - if (options === void 0) { - options = {}; - } - - var _options = options, - _options$manifestUri = _options.manifestUri, - manifestUri = _options$manifestUri === void 0 ? '' : _options$manifestUri, - _options$NOW = _options.NOW, - NOW = _options$NOW === void 0 ? Date.now() : _options$NOW, - _options$clientOffset = _options.clientOffset, - clientOffset = _options$clientOffset === void 0 ? 0 : _options$clientOffset; - var periods = findChildren(mpd, 'Period'); - - if (!periods.length) { - throw new Error(errors.INVALID_NUMBER_OF_PERIOD); - } - - var locations = findChildren(mpd, 'Location'); - var mpdAttributes = parseAttributes(mpd); - var mpdBaseUrls = buildBaseUrls([manifestUri], findChildren(mpd, 'BaseURL')); - mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0; - mpdAttributes.NOW = NOW; - mpdAttributes.clientOffset = clientOffset; - - if (locations.length) { - mpdAttributes.locations = locations.map(getContent); - } - - return { - locations: mpdAttributes.locations, - representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls))) - }; -}; - -var stringToMpdXml = function stringToMpdXml(manifestString) { - if (manifestString === '') { - throw new Error(errors.DASH_EMPTY_MANIFEST); - } - - var parser = new DOMParser(); - var xml; - var mpd; - - try { - xml = parser.parseFromString(manifestString, 'application/xml'); - mpd = xml && xml.documentElement.tagName === 'MPD' ? xml.documentElement : null; - } catch (e) {// ie 11 throwsw on invalid xml - } - - if (!mpd || mpd && mpd.getElementsByTagName('parsererror').length > 0) { - throw new Error(errors.DASH_INVALID_XML); - } - - return mpd; -}; - -/** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} mpd - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ - -var parseUTCTimingScheme = function parseUTCTimingScheme(mpd) { - var UTCTimingNode = findChildren(mpd, 'UTCTiming')[0]; - - if (!UTCTimingNode) { - return null; - } - - var attributes = parseAttributes(UTCTimingNode); - - switch (attributes.schemeIdUri) { - case 'urn:mpeg:dash:utc:http-head:2014': - case 'urn:mpeg:dash:utc:http-head:2012': - attributes.method = 'HEAD'; - break; - - case 'urn:mpeg:dash:utc:http-xsdate:2014': - case 'urn:mpeg:dash:utc:http-iso:2014': - case 'urn:mpeg:dash:utc:http-xsdate:2012': - case 'urn:mpeg:dash:utc:http-iso:2012': - attributes.method = 'GET'; - break; - - case 'urn:mpeg:dash:utc:direct:2014': - case 'urn:mpeg:dash:utc:direct:2012': - attributes.method = 'DIRECT'; - attributes.value = Date.parse(attributes.value); - break; - - case 'urn:mpeg:dash:utc:http-ntp:2014': - case 'urn:mpeg:dash:utc:ntp:2014': - case 'urn:mpeg:dash:utc:sntp:2014': - default: - throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME); - } - - return attributes; -}; - -var VERSION = version; - -var parse = function parse(manifestString, options) { - if (options === void 0) { - options = {}; - } - - var parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options); - var playlists = toPlaylists(parsedManifestInfo.representationInfo); - return toM3u8(playlists, parsedManifestInfo.locations, options.sidxMapping); -}; -/** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} manifestString - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ - - -var parseUTCTiming = function parseUTCTiming(manifestString) { - return parseUTCTimingScheme(stringToMpdXml(manifestString)); -}; - -export { VERSION, addSidxSegmentsToPlaylist, generateSidxKey, inheritAttributes, parse, parseUTCTiming, stringToMpdXml, toM3u8, toPlaylists }; diff --git a/node_modules/mpd-parser/dist/mpd-parser.js b/node_modules/mpd-parser/dist/mpd-parser.js deleted file mode 100644 index dfd9220..0000000 --- a/node_modules/mpd-parser/dist/mpd-parser.js +++ /dev/null @@ -1,2334 +0,0 @@ -/*! @name mpd-parser @version 0.17.0 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('global/window'), require('xmldom')) : - typeof define === 'function' && define.amd ? define(['exports', 'global/window', 'xmldom'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.mpdParser = {}, global.window, global.window)); -}(this, (function (exports, window, xmldom) { 'use strict'; - - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - - var window__default = /*#__PURE__*/_interopDefaultLegacy(window); - - var version = "0.17.0"; - - var isObject = function isObject(obj) { - return !!obj && typeof obj === 'object'; - }; - - var merge = function merge() { - for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) { - objects[_key] = arguments[_key]; - } - - return objects.reduce(function (result, source) { - if (typeof source !== 'object') { - return result; - } - - Object.keys(source).forEach(function (key) { - if (Array.isArray(result[key]) && Array.isArray(source[key])) { - result[key] = result[key].concat(source[key]); - } else if (isObject(result[key]) && isObject(source[key])) { - result[key] = merge(result[key], source[key]); - } else { - result[key] = source[key]; - } - }); - return result; - }, {}); - }; - var values = function values(o) { - return Object.keys(o).map(function (k) { - return o[k]; - }); - }; - - var range = function range(start, end) { - var result = []; - - for (var i = start; i < end; i++) { - result.push(i); - } - - return result; - }; - var flatten = function flatten(lists) { - return lists.reduce(function (x, y) { - return x.concat(y); - }, []); - }; - var from = function from(list) { - if (!list.length) { - return []; - } - - var result = []; - - for (var i = 0; i < list.length; i++) { - result.push(list[i]); - } - - return result; - }; - var findIndexes = function findIndexes(l, key) { - return l.reduce(function (a, e, i) { - if (e[key]) { - a.push(i); - } - - return a; - }, []); - }; - - var errors = { - INVALID_NUMBER_OF_PERIOD: 'INVALID_NUMBER_OF_PERIOD', - DASH_EMPTY_MANIFEST: 'DASH_EMPTY_MANIFEST', - DASH_INVALID_XML: 'DASH_INVALID_XML', - NO_BASE_URL: 'NO_BASE_URL', - MISSING_SEGMENT_INFORMATION: 'MISSING_SEGMENT_INFORMATION', - SEGMENT_TIME_UNSPECIFIED: 'SEGMENT_TIME_UNSPECIFIED', - UNSUPPORTED_UTC_TIMING_SCHEME: 'UNSUPPORTED_UTC_TIMING_SCHEME' - }; - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function (path, base) { - return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var urlToolkit = createCommonjsModule(function (module, exports) { - // see https://tools.ietf.org/html/rfc1808 - (function (root) { - var URL_REGEX = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/; - var FIRST_SEGMENT_REGEX = /^([^\/?#]*)([^]*)$/; - var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g; - var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g; - var URLToolkit = { - // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or // - // E.g - // With opts.alwaysNormalize = false (default, spec compliant) - // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g - // With opts.alwaysNormalize = true (not spec compliant) - // http://a.com/b/cd + /e/f/../g => http://a.com/e/g - buildAbsoluteURL: function buildAbsoluteURL(baseURL, relativeURL, opts) { - opts = opts || {}; // remove any remaining space and CRLF - - baseURL = baseURL.trim(); - relativeURL = relativeURL.trim(); - - if (!relativeURL) { - // 2a) If the embedded URL is entirely empty, it inherits the - // entire base URL (i.e., is set equal to the base URL) - // and we are done. - if (!opts.alwaysNormalize) { - return baseURL; - } - - var basePartsForNormalise = URLToolkit.parseURL(baseURL); - - if (!basePartsForNormalise) { - throw new Error('Error trying to parse base URL.'); - } - - basePartsForNormalise.path = URLToolkit.normalizePath(basePartsForNormalise.path); - return URLToolkit.buildURLFromParts(basePartsForNormalise); - } - - var relativeParts = URLToolkit.parseURL(relativeURL); - - if (!relativeParts) { - throw new Error('Error trying to parse relative URL.'); - } - - if (relativeParts.scheme) { - // 2b) If the embedded URL starts with a scheme name, it is - // interpreted as an absolute URL and we are done. - if (!opts.alwaysNormalize) { - return relativeURL; - } - - relativeParts.path = URLToolkit.normalizePath(relativeParts.path); - return URLToolkit.buildURLFromParts(relativeParts); - } - - var baseParts = URLToolkit.parseURL(baseURL); - - if (!baseParts) { - throw new Error('Error trying to parse base URL.'); - } - - if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') { - // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc - // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a' - var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path); - baseParts.netLoc = pathParts[1]; - baseParts.path = pathParts[2]; - } - - if (baseParts.netLoc && !baseParts.path) { - baseParts.path = '/'; - } - - var builtParts = { - // 2c) Otherwise, the embedded URL inherits the scheme of - // the base URL. - scheme: baseParts.scheme, - netLoc: relativeParts.netLoc, - path: null, - params: relativeParts.params, - query: relativeParts.query, - fragment: relativeParts.fragment - }; - - if (!relativeParts.netLoc) { - // 3) If the embedded URL's is non-empty, we skip to - // Step 7. Otherwise, the embedded URL inherits the - // (if any) of the base URL. - builtParts.netLoc = baseParts.netLoc; // 4) If the embedded URL path is preceded by a slash "/", the - // path is not relative and we skip to Step 7. - - if (relativeParts.path[0] !== '/') { - if (!relativeParts.path) { - // 5) If the embedded URL path is empty (and not preceded by a - // slash), then the embedded URL inherits the base URL path - builtParts.path = baseParts.path; // 5a) if the embedded URL's is non-empty, we skip to - // step 7; otherwise, it inherits the of the base - // URL (if any) and - - if (!relativeParts.params) { - builtParts.params = baseParts.params; // 5b) if the embedded URL's is non-empty, we skip to - // step 7; otherwise, it inherits the of the base - // URL (if any) and we skip to step 7. - - if (!relativeParts.query) { - builtParts.query = baseParts.query; - } - } - } else { - // 6) The last segment of the base URL's path (anything - // following the rightmost slash "/", or the entire path if no - // slash is present) is removed and the embedded URL's path is - // appended in its place. - var baseURLPath = baseParts.path; - var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + relativeParts.path; - builtParts.path = URLToolkit.normalizePath(newPath); - } - } - } - - if (builtParts.path === null) { - builtParts.path = opts.alwaysNormalize ? URLToolkit.normalizePath(relativeParts.path) : relativeParts.path; - } - - return URLToolkit.buildURLFromParts(builtParts); - }, - parseURL: function parseURL(url) { - var parts = URL_REGEX.exec(url); - - if (!parts) { - return null; - } - - return { - scheme: parts[1] || '', - netLoc: parts[2] || '', - path: parts[3] || '', - params: parts[4] || '', - query: parts[5] || '', - fragment: parts[6] || '' - }; - }, - normalizePath: function normalizePath(path) { - // The following operations are - // then applied, in order, to the new path: - // 6a) All occurrences of "./", where "." is a complete path - // segment, are removed. - // 6b) If the path ends with "." as a complete path segment, - // that "." is removed. - path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, ''); // 6c) All occurrences of "/../", where is a - // complete path segment not equal to "..", are removed. - // Removal of these path segments is performed iteratively, - // removing the leftmost matching pattern on each iteration, - // until no matching pattern remains. - // 6d) If the path ends with "/..", where is a - // complete path segment not equal to "..", that - // "/.." is removed. - - while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length) {} - - return path.split('').reverse().join(''); - }, - buildURLFromParts: function buildURLFromParts(parts) { - return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment; - } - }; - module.exports = URLToolkit; - })(); - }); - - var DEFAULT_LOCATION = 'http://example.com'; - - var resolveUrl = function resolveUrl(baseUrl, relativeUrl) { - // return early if we don't need to resolve - if (/^[a-z]+:/i.test(relativeUrl)) { - return relativeUrl; - } // if baseUrl is a data URI, ignore it and resolve everything relative to window.location - - - if (/^data:/.test(baseUrl)) { - baseUrl = window__default['default'].location && window__default['default'].location.href || ''; - } // IE11 supports URL but not the URL constructor - // feature detect the behavior we want - - - var nativeURL = typeof window__default['default'].URL === 'function'; - var protocolLess = /^\/\//.test(baseUrl); // remove location if window.location isn't available (i.e. we're in node) - // and if baseUrl isn't an absolute url - - var removeLocation = !window__default['default'].location && !/\/\//i.test(baseUrl); // if the base URL is relative then combine with the current location - - if (nativeURL) { - baseUrl = new window__default['default'].URL(baseUrl, window__default['default'].location || DEFAULT_LOCATION); - } else if (!/\/\//i.test(baseUrl)) { - baseUrl = urlToolkit.buildAbsoluteURL(window__default['default'].location && window__default['default'].location.href || '', baseUrl); - } - - if (nativeURL) { - var newUrl = new URL(relativeUrl, baseUrl); // if we're a protocol-less url, remove the protocol - // and if we're location-less, remove the location - // otherwise, return the url unmodified - - if (removeLocation) { - return newUrl.href.slice(DEFAULT_LOCATION.length); - } else if (protocolLess) { - return newUrl.href.slice(newUrl.protocol.length); - } - - return newUrl.href; - } - - return urlToolkit.buildAbsoluteURL(baseUrl, relativeUrl); - }; - - /** - * @typedef {Object} SingleUri - * @property {string} uri - relative location of segment - * @property {string} resolvedUri - resolved location of segment - * @property {Object} byterange - Object containing information on how to make byte range - * requests following byte-range-spec per RFC2616. - * @property {String} byterange.length - length of range request - * @property {String} byterange.offset - byte offset of range request - * - * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 - */ - - /** - * Converts a URLType node (5.3.9.2.3 Table 13) to a segment object - * that conforms to how m3u8-parser is structured - * - * @see https://github.com/videojs/m3u8-parser - * - * @param {string} baseUrl - baseUrl provided by nodes - * @param {string} source - source url for segment - * @param {string} range - optional range used for range calls, - * follows RFC 2616, Clause 14.35.1 - * @return {SingleUri} full segment information transformed into a format similar - * to m3u8-parser - */ - - var urlTypeToSegment = function urlTypeToSegment(_ref) { - var _ref$baseUrl = _ref.baseUrl, - baseUrl = _ref$baseUrl === void 0 ? '' : _ref$baseUrl, - _ref$source = _ref.source, - source = _ref$source === void 0 ? '' : _ref$source, - _ref$range = _ref.range, - range = _ref$range === void 0 ? '' : _ref$range, - _ref$indexRange = _ref.indexRange, - indexRange = _ref$indexRange === void 0 ? '' : _ref$indexRange; - var segment = { - uri: source, - resolvedUri: resolveUrl(baseUrl || '', source) - }; - - if (range || indexRange) { - var rangeStr = range ? range : indexRange; - var ranges = rangeStr.split('-'); - var startRange = parseInt(ranges[0], 10); - var endRange = parseInt(ranges[1], 10); // byterange should be inclusive according to - // RFC 2616, Clause 14.35.1 - - segment.byterange = { - length: endRange - startRange + 1, - offset: startRange - }; - } - - return segment; - }; - var byteRangeToString = function byteRangeToString(byterange) { - // `endRange` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - var endRange = byterange.offset + byterange.length - 1; - return byterange.offset + "-" + endRange; - }; - - /** - * parse the end number attribue that can be a string - * number, or undefined. - * - * @param {string|number|undefined} endNumber - * The end number attribute. - * - * @return {number|null} - * The result of parsing the end number. - */ - - var parseEndNumber = function parseEndNumber(endNumber) { - if (endNumber && typeof endNumber !== 'number') { - endNumber = parseInt(endNumber, 10); - } - - if (isNaN(endNumber)) { - return null; - } - - return endNumber; - }; - /** - * Functions for calculating the range of available segments in static and dynamic - * manifests. - */ - - - var segmentRange = { - /** - * Returns the entire range of available segments for a static MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - static: function _static(attributes) { - var duration = attributes.duration, - _attributes$timescale = attributes.timescale, - timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale, - sourceDuration = attributes.sourceDuration; - var endNumber = parseEndNumber(attributes.endNumber); - return { - start: 0, - end: typeof endNumber === 'number' ? endNumber : Math.ceil(sourceDuration / (duration / timescale)) - }; - }, - - /** - * Returns the current live window range of available segments for a dynamic MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - dynamic: function dynamic(attributes) { - var NOW = attributes.NOW, - clientOffset = attributes.clientOffset, - availabilityStartTime = attributes.availabilityStartTime, - _attributes$timescale2 = attributes.timescale, - timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, - duration = attributes.duration, - _attributes$start = attributes.start, - start = _attributes$start === void 0 ? 0 : _attributes$start, - _attributes$minimumUp = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp, - _attributes$timeShift = attributes.timeShiftBufferDepth, - timeShiftBufferDepth = _attributes$timeShift === void 0 ? Infinity : _attributes$timeShift; - var endNumber = parseEndNumber(attributes.endNumber); - var now = (NOW + clientOffset) / 1000; - var periodStartWC = availabilityStartTime + start; - var periodEndWC = now + minimumUpdatePeriod; - var periodDuration = periodEndWC - periodStartWC; - var segmentCount = Math.ceil(periodDuration * timescale / duration); - var availableStart = Math.floor((now - periodStartWC - timeShiftBufferDepth) * timescale / duration); - var availableEnd = Math.floor((now - periodStartWC) * timescale / duration); - return { - start: Math.max(0, availableStart), - end: typeof endNumber === 'number' ? endNumber : Math.min(segmentCount, availableEnd) - }; - } - }; - /** - * Maps a range of numbers to objects with information needed to build the corresponding - * segment list - * - * @name toSegmentsCallback - * @function - * @param {number} number - * Number of the segment - * @param {number} index - * Index of the number in the range list - * @return {{ number: Number, duration: Number, timeline: Number, time: Number }} - * Object with segment timing and duration info - */ - - /** - * Returns a callback for Array.prototype.map for mapping a range of numbers to - * information needed to build the segment list. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {toSegmentsCallback} - * Callback map function - */ - - var toSegments = function toSegments(attributes) { - return function (number, index) { - var duration = attributes.duration, - _attributes$timescale3 = attributes.timescale, - timescale = _attributes$timescale3 === void 0 ? 1 : _attributes$timescale3, - periodIndex = attributes.periodIndex, - _attributes$startNumb = attributes.startNumber, - startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb; - return { - number: startNumber + number, - duration: duration / timescale, - timeline: periodIndex, - time: index * duration - }; - }; - }; - /** - * Returns a list of objects containing segment timing and duration info used for - * building the list of segments. This uses the @duration attribute specified - * in the MPD manifest to derive the range of segments. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - var parseByDuration = function parseByDuration(attributes) { - var _attributes$type = attributes.type, - type = _attributes$type === void 0 ? 'static' : _attributes$type, - duration = attributes.duration, - _attributes$timescale4 = attributes.timescale, - timescale = _attributes$timescale4 === void 0 ? 1 : _attributes$timescale4, - sourceDuration = attributes.sourceDuration; - - var _segmentRange$type = segmentRange[type](attributes), - start = _segmentRange$type.start, - end = _segmentRange$type.end; - - var segments = range(start, end).map(toSegments(attributes)); - - if (type === 'static') { - var index = segments.length - 1; // final segment may be less than full segment duration - - segments[index].duration = sourceDuration - duration / timescale * index; - } - - return segments; - }; - - /** - * Translates SegmentBase into a set of segments. - * (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @return {Object.} list of segments - */ - - var segmentsFromBase = function segmentsFromBase(attributes) { - var baseUrl = attributes.baseUrl, - _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ, - sourceDuration = attributes.sourceDuration, - _attributes$indexRang = attributes.indexRange, - indexRange = _attributes$indexRang === void 0 ? '' : _attributes$indexRang, - duration = attributes.duration; // base url is required for SegmentBase to work, per spec (Section 5.3.9.2.1) - - if (!baseUrl) { - throw new Error(errors.NO_BASE_URL); - } - - var initSegment = urlTypeToSegment({ - baseUrl: baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - var segment = urlTypeToSegment({ - baseUrl: baseUrl, - source: baseUrl, - indexRange: indexRange - }); - segment.map = initSegment; // If there is a duration, use it, otherwise use the given duration of the source - // (since SegmentBase is only for one total segment) - - if (duration) { - var segmentTimeInfo = parseByDuration(attributes); - - if (segmentTimeInfo.length) { - segment.duration = segmentTimeInfo[0].duration; - segment.timeline = segmentTimeInfo[0].timeline; - } - } else if (sourceDuration) { - segment.duration = sourceDuration; - segment.timeline = 0; - } // This is used for mediaSequence - - - segment.number = 0; - return [segment]; - }; - /** - * Given a playlist, a sidx box, and a baseUrl, update the segment list of the playlist - * according to the sidx information given. - * - * playlist.sidx has metadadata about the sidx where-as the sidx param - * is the parsed sidx box itself. - * - * @param {Object} playlist the playlist to update the sidx information for - * @param {Object} sidx the parsed sidx box - * @return {Object} the playlist object with the updated sidx information - */ - - var addSidxSegmentsToPlaylist = function addSidxSegmentsToPlaylist(playlist, sidx, baseUrl) { - // Retain init segment information - var initSegment = playlist.sidx.map ? playlist.sidx.map : null; // Retain source duration from initial master manifest parsing - - var sourceDuration = playlist.sidx.duration; // Retain source timeline - - var timeline = playlist.timeline || 0; - var sidxByteRange = playlist.sidx.byterange; - var sidxEnd = sidxByteRange.offset + sidxByteRange.length; // Retain timescale of the parsed sidx - - var timescale = sidx.timescale; // referenceType 1 refers to other sidx boxes - - var mediaReferences = sidx.references.filter(function (r) { - return r.referenceType !== 1; - }); - var segments = []; // firstOffset is the offset from the end of the sidx box - - var startIndex = sidxEnd + sidx.firstOffset; - - for (var i = 0; i < mediaReferences.length; i++) { - var reference = sidx.references[i]; // size of the referenced (sub)segment - - var size = reference.referencedSize; // duration of the referenced (sub)segment, in the timescale - // this will be converted to seconds when generating segments - - var duration = reference.subsegmentDuration; // should be an inclusive range - - var endIndex = startIndex + size - 1; - var indexRange = startIndex + "-" + endIndex; - var attributes = { - baseUrl: baseUrl, - timescale: timescale, - timeline: timeline, - // this is used in parseByDuration - periodIndex: timeline, - duration: duration, - sourceDuration: sourceDuration, - indexRange: indexRange - }; - var segment = segmentsFromBase(attributes)[0]; - - if (initSegment) { - segment.map = initSegment; - } - - segments.push(segment); - startIndex += size; - } - - playlist.segments = segments; - return playlist; - }; - - var generateSidxKey = function generateSidxKey(sidx) { - return sidx && sidx.uri + '-' + byteRangeToString(sidx.byterange); - }; - - var mergeDiscontiguousPlaylists = function mergeDiscontiguousPlaylists(playlists) { - var mergedPlaylists = values(playlists.reduce(function (acc, playlist) { - // assuming playlist IDs are the same across periods - // TODO: handle multiperiod where representation sets are not the same - // across periods - var name = playlist.attributes.id + (playlist.attributes.lang || ''); // Periods after first - - if (acc[name]) { - var _acc$name$segments; - - // first segment of subsequent periods signal a discontinuity - if (playlist.segments[0]) { - playlist.segments[0].discontinuity = true; - } - - (_acc$name$segments = acc[name].segments).push.apply(_acc$name$segments, playlist.segments); // bubble up contentProtection, this assumes all DRM content - // has the same contentProtection - - - if (playlist.attributes.contentProtection) { - acc[name].attributes.contentProtection = playlist.attributes.contentProtection; - } - } else { - // first Period - acc[name] = playlist; - } - - return acc; - }, {})); - return mergedPlaylists.map(function (playlist) { - playlist.discontinuityStarts = findIndexes(playlist.segments, 'discontinuity'); - return playlist; - }); - }; - - var addSidxSegmentsToPlaylist$1 = function addSidxSegmentsToPlaylist$1(playlist, sidxMapping) { - var sidxKey = generateSidxKey(playlist.sidx); - var sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx; - - if (sidxMatch) { - addSidxSegmentsToPlaylist(playlist, sidxMatch, playlist.sidx.resolvedUri); - } - - return playlist; - }; - var addSidxSegmentsToPlaylists = function addSidxSegmentsToPlaylists(playlists, sidxMapping) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (!Object.keys(sidxMapping).length) { - return playlists; - } - - for (var i in playlists) { - playlists[i] = addSidxSegmentsToPlaylist$1(playlists[i], sidxMapping); - } - - return playlists; - }; - var formatAudioPlaylist = function formatAudioPlaylist(_ref, isAudioOnly) { - var _attributes; - - var attributes = _ref.attributes, - segments = _ref.segments, - sidx = _ref.sidx; - var playlist = { - attributes: (_attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth, - CODECS: attributes.codecs - }, _attributes['PROGRAM-ID'] = 1, _attributes), - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - if (isAudioOnly) { - playlist.attributes.AUDIO = 'audio'; - playlist.attributes.SUBTITLES = 'subs'; - } - - return playlist; - }; - var formatVttPlaylist = function formatVttPlaylist(_ref2) { - var _m3u8Attributes; - - var attributes = _ref2.attributes, - segments = _ref2.segments; - - if (typeof segments === 'undefined') { - // vtt tracks may use single file in BaseURL - segments = [{ - uri: attributes.baseUrl, - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - duration: attributes.sourceDuration, - number: 0 - }]; // targetDuration should be the same duration as the only segment - - attributes.duration = attributes.sourceDuration; - } - - var m3u8Attributes = (_m3u8Attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth - }, _m3u8Attributes['PROGRAM-ID'] = 1, _m3u8Attributes); - - if (attributes.codecs) { - m3u8Attributes.CODECS = attributes.codecs; - } - - return { - attributes: m3u8Attributes, - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - }; - var organizeAudioPlaylists = function organizeAudioPlaylists(playlists, sidxMapping, isAudioOnly) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (isAudioOnly === void 0) { - isAudioOnly = false; - } - - var mainPlaylist; - var formattedPlaylists = playlists.reduce(function (a, playlist) { - var role = playlist.attributes.role && playlist.attributes.role.value || ''; - var language = playlist.attributes.lang || ''; - var label = playlist.attributes.label || 'main'; - - if (language && !playlist.attributes.label) { - var roleLabel = role ? " (" + role + ")" : ''; - label = "" + playlist.attributes.lang + roleLabel; - } - - if (!a[label]) { - a[label] = { - language: language, - autoselect: true, - default: role === 'main', - playlists: [], - uri: '' - }; - } - - var formatted = addSidxSegmentsToPlaylist$1(formatAudioPlaylist(playlist, isAudioOnly), sidxMapping); - a[label].playlists.push(formatted); - - if (typeof mainPlaylist === 'undefined' && role === 'main') { - mainPlaylist = playlist; - mainPlaylist.default = true; - } - - return a; - }, {}); // if no playlists have role "main", mark the first as main - - if (!mainPlaylist) { - var firstLabel = Object.keys(formattedPlaylists)[0]; - formattedPlaylists[firstLabel].default = true; - } - - return formattedPlaylists; - }; - var organizeVttPlaylists = function organizeVttPlaylists(playlists, sidxMapping) { - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - return playlists.reduce(function (a, playlist) { - var label = playlist.attributes.lang || 'text'; - - if (!a[label]) { - a[label] = { - language: label, - default: false, - autoselect: false, - playlists: [], - uri: '' - }; - } - - a[label].playlists.push(addSidxSegmentsToPlaylist$1(formatVttPlaylist(playlist), sidxMapping)); - return a; - }, {}); - }; - - var organizeCaptionServices = function organizeCaptionServices(captionServices) { - return captionServices.reduce(function (svcObj, svc) { - if (!svc) { - return svcObj; - } - - svc.forEach(function (service) { - var channel = service.channel, - language = service.language; - svcObj[language] = { - autoselect: false, - default: false, - instreamId: channel, - language: language - }; - - if (service.hasOwnProperty('aspectRatio')) { - svcObj[language].aspectRatio = service.aspectRatio; - } - - if (service.hasOwnProperty('easyReader')) { - svcObj[language].easyReader = service.easyReader; - } - - if (service.hasOwnProperty('3D')) { - svcObj[language]['3D'] = service['3D']; - } - }); - return svcObj; - }, {}); - }; - - var formatVideoPlaylist = function formatVideoPlaylist(_ref3) { - var _attributes2; - - var attributes = _ref3.attributes, - segments = _ref3.segments, - sidx = _ref3.sidx; - var playlist = { - attributes: (_attributes2 = { - NAME: attributes.id, - AUDIO: 'audio', - SUBTITLES: 'subs', - RESOLUTION: { - width: attributes.width, - height: attributes.height - }, - CODECS: attributes.codecs, - BANDWIDTH: attributes.bandwidth - }, _attributes2['PROGRAM-ID'] = 1, _attributes2), - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments: segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - return playlist; - }; - - var videoOnly = function videoOnly(_ref4) { - var attributes = _ref4.attributes; - return attributes.mimeType === 'video/mp4' || attributes.mimeType === 'video/webm' || attributes.contentType === 'video'; - }; - - var audioOnly = function audioOnly(_ref5) { - var attributes = _ref5.attributes; - return attributes.mimeType === 'audio/mp4' || attributes.mimeType === 'audio/webm' || attributes.contentType === 'audio'; - }; - - var vttOnly = function vttOnly(_ref6) { - var attributes = _ref6.attributes; - return attributes.mimeType === 'text/vtt' || attributes.contentType === 'text'; - }; - - var toM3u8 = function toM3u8(dashPlaylists, locations, sidxMapping) { - var _mediaGroups; - - if (sidxMapping === void 0) { - sidxMapping = {}; - } - - if (!dashPlaylists.length) { - return {}; - } // grab all master attributes - - - var _dashPlaylists$0$attr = dashPlaylists[0].attributes, - duration = _dashPlaylists$0$attr.sourceDuration, - _dashPlaylists$0$attr2 = _dashPlaylists$0$attr.type, - type = _dashPlaylists$0$attr2 === void 0 ? 'static' : _dashPlaylists$0$attr2, - suggestedPresentationDelay = _dashPlaylists$0$attr.suggestedPresentationDelay, - minimumUpdatePeriod = _dashPlaylists$0$attr.minimumUpdatePeriod; - var videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist); - var audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly)); - var vttPlaylists = dashPlaylists.filter(vttOnly); - var captions = dashPlaylists.map(function (playlist) { - return playlist.attributes.captionServices; - }).filter(Boolean); - var master = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: (_mediaGroups = { - AUDIO: {}, - VIDEO: {} - }, _mediaGroups['CLOSED-CAPTIONS'] = {}, _mediaGroups.SUBTITLES = {}, _mediaGroups), - uri: '', - duration: duration, - playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping) - }; - - if (minimumUpdatePeriod >= 0) { - master.minimumUpdatePeriod = minimumUpdatePeriod * 1000; - } - - if (locations) { - master.locations = locations; - } - - if (type === 'dynamic') { - master.suggestedPresentationDelay = suggestedPresentationDelay; - } - - var isAudioOnly = master.playlists.length === 0; - - if (audioPlaylists.length) { - master.mediaGroups.AUDIO.audio = organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly); - } - - if (vttPlaylists.length) { - master.mediaGroups.SUBTITLES.subs = organizeVttPlaylists(vttPlaylists, sidxMapping); - } - - if (captions.length) { - master.mediaGroups['CLOSED-CAPTIONS'].cc = organizeCaptionServices(captions); - } - - return master; - }; - - /** - * Calculates the R (repetition) value for a live stream (for the final segment - * in a manifest where the r value is negative 1) - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {number} time - * current time (typically the total time up until the final segment) - * @param {number} duration - * duration property for the given - * - * @return {number} - * R value to reach the end of the given period - */ - var getLiveRValue = function getLiveRValue(attributes, time, duration) { - var NOW = attributes.NOW, - clientOffset = attributes.clientOffset, - availabilityStartTime = attributes.availabilityStartTime, - _attributes$timescale = attributes.timescale, - timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale, - _attributes$start = attributes.start, - start = _attributes$start === void 0 ? 0 : _attributes$start, - _attributes$minimumUp = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp; - var now = (NOW + clientOffset) / 1000; - var periodStartWC = availabilityStartTime + start; - var periodEndWC = now + minimumUpdatePeriod; - var periodDuration = periodEndWC - periodStartWC; - return Math.ceil((periodDuration * timescale - time) / duration); - }; - /** - * Uses information provided by SegmentTemplate.SegmentTimeline to determine segment - * timing and duration - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]} segmentTimeline - * List of objects representing the attributes of each S element contained within - * - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - - var parseByTimeline = function parseByTimeline(attributes, segmentTimeline) { - var _attributes$type = attributes.type, - type = _attributes$type === void 0 ? 'static' : _attributes$type, - _attributes$minimumUp2 = attributes.minimumUpdatePeriod, - minimumUpdatePeriod = _attributes$minimumUp2 === void 0 ? 0 : _attributes$minimumUp2, - _attributes$media = attributes.media, - media = _attributes$media === void 0 ? '' : _attributes$media, - sourceDuration = attributes.sourceDuration, - _attributes$timescale2 = attributes.timescale, - timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, - _attributes$startNumb = attributes.startNumber, - startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb, - timeline = attributes.periodIndex; - var segments = []; - var time = -1; - - for (var sIndex = 0; sIndex < segmentTimeline.length; sIndex++) { - var S = segmentTimeline[sIndex]; - var duration = S.d; - var repeat = S.r || 0; - var segmentTime = S.t || 0; - - if (time < 0) { - // first segment - time = segmentTime; - } - - if (segmentTime && segmentTime > time) { - // discontinuity - // TODO: How to handle this type of discontinuity - // timeline++ here would treat it like HLS discontuity and content would - // get appended without gap - // E.G. - // - // - // - // - // would have $Time$ values of [0, 1, 2, 5] - // should this be appened at time positions [0, 1, 2, 3],(#EXT-X-DISCONTINUITY) - // or [0, 1, 2, gap, gap, 5]? (#EXT-X-GAP) - // does the value of sourceDuration consider this when calculating arbitrary - // negative @r repeat value? - // E.G. Same elements as above with this added at the end - // - // with a sourceDuration of 10 - // Would the 2 gaps be included in the time duration calculations resulting in - // 8 segments with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9] or 10 segments - // with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9, 10, 11] ? - time = segmentTime; - } - - var count = void 0; - - if (repeat < 0) { - var nextS = sIndex + 1; - - if (nextS === segmentTimeline.length) { - // last segment - if (type === 'dynamic' && minimumUpdatePeriod > 0 && media.indexOf('$Number$') > 0) { - count = getLiveRValue(attributes, time, duration); - } else { - // TODO: This may be incorrect depending on conclusion of TODO above - count = (sourceDuration * timescale - time) / duration; - } - } else { - count = (segmentTimeline[nextS].t - time) / duration; - } - } else { - count = repeat + 1; - } - - var end = startNumber + segments.length + count; - var number = startNumber + segments.length; - - while (number < end) { - segments.push({ - number: number, - duration: duration / timescale, - time: time, - timeline: timeline - }); - time += duration; - number++; - } - } - - return segments; - }; - - var identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g; - /** - * Replaces template identifiers with corresponding values. To be used as the callback - * for String.prototype.replace - * - * @name replaceCallback - * @function - * @param {string} match - * Entire match of identifier - * @param {string} identifier - * Name of matched identifier - * @param {string} format - * Format tag string. Its presence indicates that padding is expected - * @param {string} width - * Desired length of the replaced value. Values less than this width shall be left - * zero padded - * @return {string} - * Replacement for the matched identifier - */ - - /** - * Returns a function to be used as a callback for String.prototype.replace to replace - * template identifiers - * - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {replaceCallback} - * Callback to be used with String.prototype.replace to replace identifiers - */ - - var identifierReplacement = function identifierReplacement(values) { - return function (match, identifier, format, width) { - if (match === '$$') { - // escape sequence - return '$'; - } - - if (typeof values[identifier] === 'undefined') { - return match; - } - - var value = '' + values[identifier]; - - if (identifier === 'RepresentationID') { - // Format tag shall not be present with RepresentationID - return value; - } - - if (!format) { - width = 1; - } else { - width = parseInt(width, 10); - } - - if (value.length >= width) { - return value; - } - - return "" + new Array(width - value.length + 1).join('0') + value; - }; - }; - /** - * Constructs a segment url from a template string - * - * @param {string} url - * Template string to construct url from - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {string} - * Segment url with identifiers replaced - */ - - var constructTemplateUrl = function constructTemplateUrl(url, values) { - return url.replace(identifierPattern, identifierReplacement(values)); - }; - /** - * Generates a list of objects containing timing and duration information about each - * segment needed to generate segment uris and the complete segment object - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ - - var parseTemplateInfo = function parseTemplateInfo(attributes, segmentTimeline) { - if (!attributes.duration && !segmentTimeline) { - // if neither @duration or SegmentTimeline are present, then there shall be exactly - // one media segment - return [{ - number: attributes.startNumber || 1, - duration: attributes.sourceDuration, - time: 0, - timeline: attributes.periodIndex - }]; - } - - if (attributes.duration) { - return parseByDuration(attributes); - } - - return parseByTimeline(attributes, segmentTimeline); - }; - /** - * Generates a list of segments using information provided by the SegmentTemplate element - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object[]} - * List of segment objects - */ - - var segmentsFromTemplate = function segmentsFromTemplate(attributes, segmentTimeline) { - var templateValues = { - RepresentationID: attributes.id, - Bandwidth: attributes.bandwidth || 0 - }; - var _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? { - sourceURL: '', - range: '' - } : _attributes$initializ; - var mapSegment = urlTypeToSegment({ - baseUrl: attributes.baseUrl, - source: constructTemplateUrl(initialization.sourceURL, templateValues), - range: initialization.range - }); - var segments = parseTemplateInfo(attributes, segmentTimeline); - return segments.map(function (segment) { - templateValues.Number = segment.number; - templateValues.Time = segment.time; - var uri = constructTemplateUrl(attributes.media || '', templateValues); - var map = { - uri: uri, - timeline: segment.timeline, - duration: segment.duration, - resolvedUri: resolveUrl(attributes.baseUrl || '', uri), - map: mapSegment, - number: segment.number - }; - - if (attributes.presentationTimeOffset) { - map.presentationTimeOffset = attributes.presentationTimeOffset; - } - - return map; - }); - }; - - /** - * Converts a (of type URLType from the DASH spec 5.3.9.2 Table 14) - * to an object that matches the output of a segment in videojs/mpd-parser - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object} segmentUrl - * node to translate into a segment object - * @return {Object} translated segment object - */ - - var SegmentURLToSegmentObject = function SegmentURLToSegmentObject(attributes, segmentUrl) { - var baseUrl = attributes.baseUrl, - _attributes$initializ = attributes.initialization, - initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ; - var initSegment = urlTypeToSegment({ - baseUrl: baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - var segment = urlTypeToSegment({ - baseUrl: baseUrl, - source: segmentUrl.media, - range: segmentUrl.mediaRange - }); - segment.map = initSegment; - return segment; - }; - /** - * Generates a list of segments using information provided by the SegmentList element - * SegmentList (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object.} list of segments - */ - - - var segmentsFromList = function segmentsFromList(attributes, segmentTimeline) { - var duration = attributes.duration, - _attributes$segmentUr = attributes.segmentUrls, - segmentUrls = _attributes$segmentUr === void 0 ? [] : _attributes$segmentUr; // Per spec (5.3.9.2.1) no way to determine segment duration OR - // if both SegmentTimeline and @duration are defined, it is outside of spec. - - if (!duration && !segmentTimeline || duration && segmentTimeline) { - throw new Error(errors.SEGMENT_TIME_UNSPECIFIED); - } - - var segmentUrlMap = segmentUrls.map(function (segmentUrlObject) { - return SegmentURLToSegmentObject(attributes, segmentUrlObject); - }); - var segmentTimeInfo; - - if (duration) { - segmentTimeInfo = parseByDuration(attributes); - } - - if (segmentTimeline) { - segmentTimeInfo = parseByTimeline(attributes, segmentTimeline); - } - - var segments = segmentTimeInfo.map(function (segmentTime, index) { - if (segmentUrlMap[index]) { - var segment = segmentUrlMap[index]; - segment.timeline = segmentTime.timeline; - segment.duration = segmentTime.duration; - segment.number = segmentTime.number; - return segment; - } // Since we're mapping we should get rid of any blank segments (in case - // the given SegmentTimeline is handling for more elements than we have - // SegmentURLs for). - - }).filter(function (segment) { - return segment; - }); - return segments; - }; - - var generateSegments = function generateSegments(_ref) { - var attributes = _ref.attributes, - segmentInfo = _ref.segmentInfo; - var segmentAttributes; - var segmentsFn; - - if (segmentInfo.template) { - segmentsFn = segmentsFromTemplate; - segmentAttributes = merge(attributes, segmentInfo.template); - - if (segmentInfo.template.presentationTimeOffset) { - segmentAttributes.presentationTimeOffset = segmentInfo.template.presentationTimeOffset / segmentInfo.template.timescale; - } - } else if (segmentInfo.base) { - segmentsFn = segmentsFromBase; - segmentAttributes = merge(attributes, segmentInfo.base); - } else if (segmentInfo.list) { - segmentsFn = segmentsFromList; - segmentAttributes = merge(attributes, segmentInfo.list); - } - - var segmentsInfo = { - attributes: attributes - }; - - if (!segmentsFn) { - return segmentsInfo; - } - - var segments = segmentsFn(segmentAttributes, segmentInfo.timeline); // The @duration attribute will be used to determin the playlist's targetDuration which - // must be in seconds. Since we've generated the segment list, we no longer need - // @duration to be in @timescale units, so we can convert it here. - - if (segmentAttributes.duration) { - var _segmentAttributes = segmentAttributes, - duration = _segmentAttributes.duration, - _segmentAttributes$ti = _segmentAttributes.timescale, - timescale = _segmentAttributes$ti === void 0 ? 1 : _segmentAttributes$ti; - segmentAttributes.duration = duration / timescale; - } else if (segments.length) { - // if there is no @duration attribute, use the largest segment duration as - // as target duration - segmentAttributes.duration = segments.reduce(function (max, segment) { - return Math.max(max, Math.ceil(segment.duration)); - }, 0); - } else { - segmentAttributes.duration = 0; - } - - segmentsInfo.attributes = segmentAttributes; - segmentsInfo.segments = segments; // This is a sidx box without actual segment information - - if (segmentInfo.base && segmentAttributes.indexRange) { - segmentsInfo.sidx = segments[0]; - segmentsInfo.segments = []; - } - - return segmentsInfo; - }; - var toPlaylists = function toPlaylists(representations) { - return representations.map(generateSegments); - }; - - var findChildren = function findChildren(element, name) { - return from(element.childNodes).filter(function (_ref) { - var tagName = _ref.tagName; - return tagName === name; - }); - }; - var getContent = function getContent(element) { - return element.textContent.trim(); - }; - - var parseDuration = function parseDuration(str) { - var SECONDS_IN_YEAR = 365 * 24 * 60 * 60; - var SECONDS_IN_MONTH = 30 * 24 * 60 * 60; - var SECONDS_IN_DAY = 24 * 60 * 60; - var SECONDS_IN_HOUR = 60 * 60; - var SECONDS_IN_MIN = 60; // P10Y10M10DT10H10M10.1S - - var durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/; - var match = durationRegex.exec(str); - - if (!match) { - return 0; - } - - var _match$slice = match.slice(1), - year = _match$slice[0], - month = _match$slice[1], - day = _match$slice[2], - hour = _match$slice[3], - minute = _match$slice[4], - second = _match$slice[5]; - - return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0); - }; - var parseDate = function parseDate(str) { - // Date format without timezone according to ISO 8601 - // YYY-MM-DDThh:mm:ss.ssssss - var dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/; // If the date string does not specifiy a timezone, we must specifiy UTC. This is - // expressed by ending with 'Z' - - if (dateRegex.test(str)) { - str += 'Z'; - } - - return Date.parse(str); - }; - - var parsers = { - /** - * Specifies the duration of the entire Media Presentation. Format is a duration string - * as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - mediaPresentationDuration: function mediaPresentationDuration(value) { - return parseDuration(value); - }, - - /** - * Specifies the Segment availability start time for all Segments referred to in this - * MPD. For a dynamic manifest, it specifies the anchor for the earliest availability - * time. Format is a date string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The date as seconds from unix epoch - */ - availabilityStartTime: function availabilityStartTime(value) { - return parseDate(value) / 1000; - }, - - /** - * Specifies the smallest period between potential changes to the MPD. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - minimumUpdatePeriod: function minimumUpdatePeriod(value) { - return parseDuration(value); - }, - - /** - * Specifies the suggested presentation delay. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - suggestedPresentationDelay: function suggestedPresentationDelay(value) { - return parseDuration(value); - }, - - /** - * specifices the type of mpd. Can be either "static" or "dynamic" - * - * @param {string} value - * value of attribute as a string - * - * @return {string} - * The type as a string - */ - type: function type(value) { - return value; - }, - - /** - * Specifies the duration of the smallest time shifting buffer for any Representation - * in the MPD. Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - timeShiftBufferDepth: function timeShiftBufferDepth(value) { - return parseDuration(value); - }, - - /** - * Specifies the PeriodStart time of the Period relative to the availabilityStarttime. - * Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - start: function start(value) { - return parseDuration(value); - }, - - /** - * Specifies the width of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed width - */ - width: function width(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the height of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed height - */ - height: function height(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the bitrate of the representation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed bandwidth - */ - bandwidth: function bandwidth(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the number of the first Media Segment in this Representation in the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - startNumber: function startNumber(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the timescale in units per seconds - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed timescale - */ - timescale: function timescale(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the presentationTimeOffset. - * - * @param {string} value - * value of the attribute as a string - * - * @return {number} - * The parsed presentationTimeOffset - */ - presentationTimeOffset: function presentationTimeOffset(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the constant approximate Segment duration - * NOTE: The element also contains an @duration attribute. This duration - * specifies the duration of the Period. This attribute is currently not - * supported by the rest of the parser, however we still check for it to prevent - * errors. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - duration: function duration(value) { - var parsedValue = parseInt(value, 10); - - if (isNaN(parsedValue)) { - return parseDuration(value); - } - - return parsedValue; - }, - - /** - * Specifies the Segment duration, in units of the value of the @timescale. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - d: function d(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the MPD start time, in @timescale units, the first Segment in the series - * starts relative to the beginning of the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed time - */ - t: function t(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the repeat count of the number of following contiguous Segments with the - * same duration expressed by the value of @d - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - r: function r(value) { - return parseInt(value, 10); - }, - - /** - * Default parser for all other attributes. Acts as a no-op and just returns the value - * as a string - * - * @param {string} value - * value of attribute as a string - * @return {string} - * Unparsed value - */ - DEFAULT: function DEFAULT(value) { - return value; - } - }; - /** - * Gets all the attributes and values of the provided node, parses attributes with known - * types, and returns an object with attribute names mapped to values. - * - * @param {Node} el - * The node to parse attributes from - * @return {Object} - * Object with all attributes of el parsed - */ - - var parseAttributes = function parseAttributes(el) { - if (!(el && el.attributes)) { - return {}; - } - - return from(el.attributes).reduce(function (a, e) { - var parseFn = parsers[e.name] || parsers.DEFAULT; - a[e.name] = parseFn(e.value); - return a; - }, {}); - }; - - var atob = function atob(s) { - return window__default['default'].atob ? window__default['default'].atob(s) : Buffer.from(s, 'base64').toString('binary'); - }; - - function decodeB64ToUint8Array(b64Text) { - var decodedString = atob(b64Text); - var array = new Uint8Array(decodedString.length); - - for (var i = 0; i < decodedString.length; i++) { - array[i] = decodedString.charCodeAt(i); - } - - return array; - } - - var keySystemsMap = { - 'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b': 'org.w3.clearkey', - 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed': 'com.widevine.alpha', - 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95': 'com.microsoft.playready', - 'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime' - }; - /** - * Builds a list of urls that is the product of the reference urls and BaseURL values - * - * @param {string[]} referenceUrls - * List of reference urls to resolve to - * @param {Node[]} baseUrlElements - * List of BaseURL nodes from the mpd - * @return {string[]} - * List of resolved urls - */ - - var buildBaseUrls = function buildBaseUrls(referenceUrls, baseUrlElements) { - if (!baseUrlElements.length) { - return referenceUrls; - } - - return flatten(referenceUrls.map(function (reference) { - return baseUrlElements.map(function (baseUrlElement) { - return resolveUrl(reference, getContent(baseUrlElement)); - }); - })); - }; - /** - * Contains all Segment information for its containing AdaptationSet - * - * @typedef {Object} SegmentInformation - * @property {Object|undefined} template - * Contains the attributes for the SegmentTemplate node - * @property {Object[]|undefined} timeline - * Contains a list of atrributes for each S node within the SegmentTimeline node - * @property {Object|undefined} list - * Contains the attributes for the SegmentList node - * @property {Object|undefined} base - * Contains the attributes for the SegmentBase node - */ - - /** - * Returns all available Segment information contained within the AdaptationSet node - * - * @param {Node} adaptationSet - * The AdaptationSet node to get Segment information from - * @return {SegmentInformation} - * The Segment information contained within the provided AdaptationSet - */ - - var getSegmentInformation = function getSegmentInformation(adaptationSet) { - var segmentTemplate = findChildren(adaptationSet, 'SegmentTemplate')[0]; - var segmentList = findChildren(adaptationSet, 'SegmentList')[0]; - var segmentUrls = segmentList && findChildren(segmentList, 'SegmentURL').map(function (s) { - return merge({ - tag: 'SegmentURL' - }, parseAttributes(s)); - }); - var segmentBase = findChildren(adaptationSet, 'SegmentBase')[0]; - var segmentTimelineParentNode = segmentList || segmentTemplate; - var segmentTimeline = segmentTimelineParentNode && findChildren(segmentTimelineParentNode, 'SegmentTimeline')[0]; - var segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate; - var segmentInitialization = segmentInitializationParentNode && findChildren(segmentInitializationParentNode, 'Initialization')[0]; // SegmentTemplate is handled slightly differently, since it can have both - // @initialization and an node. @initialization can be templated, - // while the node can have a url and range specified. If the has - // both @initialization and an subelement we opt to override with - // the node, as this interaction is not defined in the spec. - - var template = segmentTemplate && parseAttributes(segmentTemplate); - - if (template && segmentInitialization) { - template.initialization = segmentInitialization && parseAttributes(segmentInitialization); - } else if (template && template.initialization) { - // If it is @initialization we convert it to an object since this is the format that - // later functions will rely on for the initialization segment. This is only valid - // for - template.initialization = { - sourceURL: template.initialization - }; - } - - var segmentInfo = { - template: template, - timeline: segmentTimeline && findChildren(segmentTimeline, 'S').map(function (s) { - return parseAttributes(s); - }), - list: segmentList && merge(parseAttributes(segmentList), { - segmentUrls: segmentUrls, - initialization: parseAttributes(segmentInitialization) - }), - base: segmentBase && merge(parseAttributes(segmentBase), { - initialization: parseAttributes(segmentInitialization) - }) - }; - Object.keys(segmentInfo).forEach(function (key) { - if (!segmentInfo[key]) { - delete segmentInfo[key]; - } - }); - return segmentInfo; - }; - /** - * Contains Segment information and attributes needed to construct a Playlist object - * from a Representation - * - * @typedef {Object} RepresentationInformation - * @property {SegmentInformation} segmentInfo - * Segment information for this Representation - * @property {Object} attributes - * Inherited attributes for this Representation - */ - - /** - * Maps a Representation node to an object containing Segment information and attributes - * - * @name inheritBaseUrlsCallback - * @function - * @param {Node} representation - * Representation node from the mpd - * @return {RepresentationInformation} - * Representation information needed to construct a Playlist object - */ - - /** - * Returns a callback for Array.prototype.map for mapping Representation nodes to - * Segment information and attributes using inherited BaseURL nodes. - * - * @param {Object} adaptationSetAttributes - * Contains attributes inherited by the AdaptationSet - * @param {string[]} adaptationSetBaseUrls - * Contains list of resolved base urls inherited by the AdaptationSet - * @param {SegmentInformation} adaptationSetSegmentInfo - * Contains Segment information for the AdaptationSet - * @return {inheritBaseUrlsCallback} - * Callback map function - */ - - var inheritBaseUrls = function inheritBaseUrls(adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) { - return function (representation) { - var repBaseUrlElements = findChildren(representation, 'BaseURL'); - var repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements); - var attributes = merge(adaptationSetAttributes, parseAttributes(representation)); - var representationSegmentInfo = getSegmentInformation(representation); - return repBaseUrls.map(function (baseUrl) { - return { - segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo), - attributes: merge(attributes, { - baseUrl: baseUrl - }) - }; - }); - }; - }; - /** - * Tranforms a series of content protection nodes to - * an object containing pssh data by key system - * - * @param {Node[]} contentProtectionNodes - * Content protection nodes - * @return {Object} - * Object containing pssh data by key system - */ - - var generateKeySystemInformation = function generateKeySystemInformation(contentProtectionNodes) { - return contentProtectionNodes.reduce(function (acc, node) { - var attributes = parseAttributes(node); - var keySystem = keySystemsMap[attributes.schemeIdUri]; - - if (keySystem) { - acc[keySystem] = { - attributes: attributes - }; - var psshNode = findChildren(node, 'cenc:pssh')[0]; - - if (psshNode) { - var pssh = getContent(psshNode); - var psshBuffer = pssh && decodeB64ToUint8Array(pssh); - acc[keySystem].pssh = psshBuffer; - } - } - - return acc; - }, {}); - }; // defined in ANSI_SCTE 214-1 2016 - - - var parseCaptionServiceMetadata = function parseCaptionServiceMetadata(service) { - // 608 captions - if (service.schemeIdUri === 'urn:scte:dash:cc:cea-608:2015') { - var values = service.value.split(';'); - return values.map(function (value) { - var channel; - var language; // default language to value - - language = value; - - if (/^CC\d=/.test(value)) { - var _value$split = value.split('='); - - channel = _value$split[0]; - language = _value$split[1]; - } else if (/^CC\d$/.test(value)) { - channel = value; - } - - return { - channel: channel, - language: language - }; - }); - } else if (service.schemeIdUri === 'urn:scte:dash:cc:cea-708:2015') { - var _values = service.value.split(';'); - - return _values.map(function (value) { - var flags = { - // service or channel number 1-63 - 'channel': undefined, - // language is a 3ALPHA per ISO 639.2/B - // field is required - 'language': undefined, - // BIT 1/0 or ? - // default value is 1, meaning 16:9 aspect ratio, 0 is 4:3, ? is unknown - 'aspectRatio': 1, - // BIT 1/0 - // easy reader flag indicated the text is tailed to the needs of beginning readers - // default 0, or off - 'easyReader': 0, - // BIT 1/0 - // If 3d metadata is present (CEA-708.1) then 1 - // default 0 - '3D': 0 - }; - - if (/=/.test(value)) { - var _value$split2 = value.split('='), - channel = _value$split2[0], - _value$split2$ = _value$split2[1], - opts = _value$split2$ === void 0 ? '' : _value$split2$; - - flags.channel = channel; - flags.language = value; - opts.split(',').forEach(function (opt) { - var _opt$split = opt.split(':'), - name = _opt$split[0], - val = _opt$split[1]; - - if (name === 'lang') { - flags.language = val; // er for easyReadery - } else if (name === 'er') { - flags.easyReader = Number(val); // war for wide aspect ratio - } else if (name === 'war') { - flags.aspectRatio = Number(val); - } else if (name === '3D') { - flags['3D'] = Number(val); - } - }); - } else { - flags.language = value; - } - - if (flags.channel) { - flags.channel = 'SERVICE' + flags.channel; - } - - return flags; - }); - } - }; - /** - * Maps an AdaptationSet node to a list of Representation information objects - * - * @name toRepresentationsCallback - * @function - * @param {Node} adaptationSet - * AdaptationSet node from the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - - /** - * Returns a callback for Array.prototype.map for mapping AdaptationSet nodes to a list of - * Representation information objects - * - * @param {Object} periodAttributes - * Contains attributes inherited by the Period - * @param {string[]} periodBaseUrls - * Contains list of resolved base urls inherited by the Period - * @param {string[]} periodSegmentInfo - * Contains Segment Information at the period level - * @return {toRepresentationsCallback} - * Callback map function - */ - - var toRepresentations = function toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo) { - return function (adaptationSet) { - var adaptationSetAttributes = parseAttributes(adaptationSet); - var adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls, findChildren(adaptationSet, 'BaseURL')); - var role = findChildren(adaptationSet, 'Role')[0]; - var roleAttributes = { - role: parseAttributes(role) - }; - var attrs = merge(periodAttributes, adaptationSetAttributes, roleAttributes); - var accessibility = findChildren(adaptationSet, 'Accessibility')[0]; - var captionServices = parseCaptionServiceMetadata(parseAttributes(accessibility)); - - if (captionServices) { - attrs = merge(attrs, { - captionServices: captionServices - }); - } - - var label = findChildren(adaptationSet, 'Label')[0]; - - if (label && label.childNodes.length) { - var labelVal = label.childNodes[0].nodeValue.trim(); - attrs = merge(attrs, { - label: labelVal - }); - } - - var contentProtection = generateKeySystemInformation(findChildren(adaptationSet, 'ContentProtection')); - - if (Object.keys(contentProtection).length) { - attrs = merge(attrs, { - contentProtection: contentProtection - }); - } - - var segmentInfo = getSegmentInformation(adaptationSet); - var representations = findChildren(adaptationSet, 'Representation'); - var adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo); - return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo))); - }; - }; - /** - * Maps an Period node to a list of Representation inforamtion objects for all - * AdaptationSet nodes contained within the Period - * - * @name toAdaptationSetsCallback - * @function - * @param {Node} period - * Period node from the mpd - * @param {number} periodIndex - * Index of the Period within the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - - /** - * Returns a callback for Array.prototype.map for mapping Period nodes to a list of - * Representation information objects - * - * @param {Object} mpdAttributes - * Contains attributes inherited by the mpd - * @param {string[]} mpdBaseUrls - * Contains list of resolved base urls inherited by the mpd - * @return {toAdaptationSetsCallback} - * Callback map function - */ - - var toAdaptationSets = function toAdaptationSets(mpdAttributes, mpdBaseUrls) { - return function (period, index) { - var periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period, 'BaseURL')); - var periodAtt = parseAttributes(period); - var parsedPeriodId = parseInt(periodAtt.id, 10); // fallback to mapping index if Period@id is not a number - - var periodIndex = window__default['default'].isNaN(parsedPeriodId) ? index : parsedPeriodId; - var periodAttributes = merge(mpdAttributes, { - periodIndex: periodIndex - }); - var adaptationSets = findChildren(period, 'AdaptationSet'); - var periodSegmentInfo = getSegmentInformation(period); - return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo))); - }; - }; - /** - * Traverses the mpd xml tree to generate a list of Representation information objects - * that have inherited attributes from parent nodes - * - * @param {Node} mpd - * The root node of the mpd - * @param {Object} options - * Available options for inheritAttributes - * @param {string} options.manifestUri - * The uri source of the mpd - * @param {number} options.NOW - * Current time per DASH IOP. Default is current time in ms since epoch - * @param {number} options.clientOffset - * Client time difference from NOW (in milliseconds) - * @return {RepresentationInformation[]} - * List of objects containing Representation information - */ - - var inheritAttributes = function inheritAttributes(mpd, options) { - if (options === void 0) { - options = {}; - } - - var _options = options, - _options$manifestUri = _options.manifestUri, - manifestUri = _options$manifestUri === void 0 ? '' : _options$manifestUri, - _options$NOW = _options.NOW, - NOW = _options$NOW === void 0 ? Date.now() : _options$NOW, - _options$clientOffset = _options.clientOffset, - clientOffset = _options$clientOffset === void 0 ? 0 : _options$clientOffset; - var periods = findChildren(mpd, 'Period'); - - if (!periods.length) { - throw new Error(errors.INVALID_NUMBER_OF_PERIOD); - } - - var locations = findChildren(mpd, 'Location'); - var mpdAttributes = parseAttributes(mpd); - var mpdBaseUrls = buildBaseUrls([manifestUri], findChildren(mpd, 'BaseURL')); - mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0; - mpdAttributes.NOW = NOW; - mpdAttributes.clientOffset = clientOffset; - - if (locations.length) { - mpdAttributes.locations = locations.map(getContent); - } - - return { - locations: mpdAttributes.locations, - representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls))) - }; - }; - - var stringToMpdXml = function stringToMpdXml(manifestString) { - if (manifestString === '') { - throw new Error(errors.DASH_EMPTY_MANIFEST); - } - - var parser = new xmldom.DOMParser(); - var xml; - var mpd; - - try { - xml = parser.parseFromString(manifestString, 'application/xml'); - mpd = xml && xml.documentElement.tagName === 'MPD' ? xml.documentElement : null; - } catch (e) {// ie 11 throwsw on invalid xml - } - - if (!mpd || mpd && mpd.getElementsByTagName('parsererror').length > 0) { - throw new Error(errors.DASH_INVALID_XML); - } - - return mpd; - }; - - /** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} mpd - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ - - var parseUTCTimingScheme = function parseUTCTimingScheme(mpd) { - var UTCTimingNode = findChildren(mpd, 'UTCTiming')[0]; - - if (!UTCTimingNode) { - return null; - } - - var attributes = parseAttributes(UTCTimingNode); - - switch (attributes.schemeIdUri) { - case 'urn:mpeg:dash:utc:http-head:2014': - case 'urn:mpeg:dash:utc:http-head:2012': - attributes.method = 'HEAD'; - break; - - case 'urn:mpeg:dash:utc:http-xsdate:2014': - case 'urn:mpeg:dash:utc:http-iso:2014': - case 'urn:mpeg:dash:utc:http-xsdate:2012': - case 'urn:mpeg:dash:utc:http-iso:2012': - attributes.method = 'GET'; - break; - - case 'urn:mpeg:dash:utc:direct:2014': - case 'urn:mpeg:dash:utc:direct:2012': - attributes.method = 'DIRECT'; - attributes.value = Date.parse(attributes.value); - break; - - case 'urn:mpeg:dash:utc:http-ntp:2014': - case 'urn:mpeg:dash:utc:ntp:2014': - case 'urn:mpeg:dash:utc:sntp:2014': - default: - throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME); - } - - return attributes; - }; - - var VERSION = version; - - var parse = function parse(manifestString, options) { - if (options === void 0) { - options = {}; - } - - var parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options); - var playlists = toPlaylists(parsedManifestInfo.representationInfo); - return toM3u8(playlists, parsedManifestInfo.locations, options.sidxMapping); - }; - /** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} manifestString - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ - - - var parseUTCTiming = function parseUTCTiming(manifestString) { - return parseUTCTimingScheme(stringToMpdXml(manifestString)); - }; - - exports.VERSION = VERSION; - exports.addSidxSegmentsToPlaylist = addSidxSegmentsToPlaylist; - exports.generateSidxKey = generateSidxKey; - exports.inheritAttributes = inheritAttributes; - exports.parse = parse; - exports.parseUTCTiming = parseUTCTiming; - exports.stringToMpdXml = stringToMpdXml; - exports.toM3u8 = toM3u8; - exports.toPlaylists = toPlaylists; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/mpd-parser/dist/mpd-parser.min.js b/node_modules/mpd-parser/dist/mpd-parser.min.js deleted file mode 100644 index 45bf71f..0000000 --- a/node_modules/mpd-parser/dist/mpd-parser.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name mpd-parser @version 0.17.0 @license Apache-2.0 */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("global/window"),require("xmldom")):"function"==typeof define&&define.amd?define(["exports","global/window","xmldom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).mpdParser={},e.window,e.window)}(this,(function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(t),a=function(e){return!!e&&"object"==typeof e},o=function e(){for(var t=arguments.length,r=new Array(t),n=0;n=0&&(p.minimumUpdatePeriod=1e3*c),t&&(p.locations=t),"dynamic"===u&&(p.suggestedPresentationDelay=s);var h=0===p.playlists.length;return l.length&&(p.mediaGroups.AUDIO.audio=function(e,t,r){var n;void 0===t&&(t={}),void 0===r&&(r=!1);var i=e.reduce((function(e,i){var a=i.attributes.role&&i.attributes.role.value||"",o=i.attributes.lang||"",u=i.attributes.label||"main";if(o&&!i.attributes.label){var s=a?" ("+a+")":"";u=""+i.attributes.lang+s}e[u]||(e[u]={language:o,autoselect:!0,default:"main"===a,playlists:[],uri:""});var c=w(function(e,t){var r,n=e.attributes,i=e.segments,a=e.sidx,o={attributes:(r={NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},r["PROGRAM-ID"]=1,r),uri:"",endList:"static"===(n.type||"static"),timeline:n.periodIndex,resolvedUri:"",targetDuration:n.duration,segments:i,mediaSequence:i.length?i[0].number:1};return n.contentProtection&&(o.contentProtection=n.contentProtection),a&&(o.sidx=a),t&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o}(i,r),t);return e[u].playlists.push(c),void 0===n&&"main"===a&&((n=i).default=!0),e}),{});return n||(i[Object.keys(i)[0]].default=!0),i}(l,r,h)),f.length&&(p.mediaGroups.SUBTITLES.subs=function(e,t){return void 0===t&&(t={}),e.reduce((function(e,r){var n=r.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),e[n].playlists.push(w(function(e){var t,r=e.attributes,n=e.segments;void 0===n&&(n=[{uri:r.baseUrl,timeline:r.periodIndex,resolvedUri:r.baseUrl||"",duration:r.sourceDuration,number:0}],r.duration=r.sourceDuration);var i=((t={NAME:r.id,BANDWIDTH:r.bandwidth})["PROGRAM-ID"]=1,t);return r.codecs&&(i.CODECS=r.codecs),{attributes:i,uri:"",endList:"static"===(r.type||"static"),timeline:r.periodIndex,resolvedUri:r.baseUrl||"",targetDuration:r.duration,segments:n,mediaSequence:n.length?n[0].number:1}}(r),t)),e}),{})}(f,r)),m.length&&(p.mediaGroups["CLOSED-CAPTIONS"].cc=m.reduce((function(e,t){return t?(t.forEach((function(t){var r=t.channel,n=t.language;e[n]={autoselect:!1,default:!1,instreamId:r,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e):e}),{})),p},A=function(e,t,r){var n=e.NOW,i=e.clientOffset,a=e.availabilityStartTime,o=e.timescale,u=void 0===o?1:o,s=e.start,c=void 0===s?0:s,d=e.minimumUpdatePeriod,l=(n+i)/1e3+(void 0===d?0:d)-(a+c);return Math.ceil((l*u-t)/r)},M=function(e,t){for(var r=e.type,n=void 0===r?"static":r,i=e.minimumUpdatePeriod,a=void 0===i?0:i,o=e.media,u=void 0===o?"":o,s=e.sourceDuration,c=e.timescale,d=void 0===c?1:c,l=e.startNumber,f=void 0===l?1:l,m=e.periodIndex,p=[],h=-1,v=0;vh&&(h=U);var I=void 0;if(y<0){var D=v+1;I=D===t.length?"dynamic"===n&&a>0&&u.indexOf("$Number$")>0?A(e,h,b):(s*d-h)/b:(t[D].t-h)/b}else I=y+1;for(var R=f+p.length+I,L=f+p.length;L=i?a:""+new Array(i-a.length+1).join("0")+a)}}(t))},B=function(e,t){var r={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,i=void 0===n?{sourceURL:"",range:""}:n,a=b({baseUrl:e.baseUrl,source:z(i.sourceURL,r),range:i.range});return function(e,t){return e.duration||t?e.duration?I(e):M(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}(e,t).map((function(t){r.Number=t.number,r.Time=t.time;var n=z(e.media||"",r),i={uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:g(e.baseUrl||"",n),map:a,number:t.number};return e.presentationTimeOffset&&(i.presentationTimeOffset=e.presentationTimeOffset),i}))},F=function(e,t){var r=e.duration,n=e.segmentUrls,i=void 0===n?[]:n;if(!r&&!t||r&&t)throw new Error(m);var a,o=i.map((function(t){return function(e,t){var r=e.baseUrl,n=e.initialization,i=void 0===n?{}:n,a=b({baseUrl:r,source:i.sourceURL,range:i.range}),o=b({baseUrl:r,source:t.media,range:t.mediaRange});return o.map=a,o}(e,t)}));return r&&(a=I(e)),t&&(a=M(e,t)),a.map((function(e,t){if(o[t]){var r=o[t];return r.timeline=e.timeline,r.duration=e.duration,r.number=e.number,r}})).filter((function(e){return e}))},_=function(e){var t,r,n=e.attributes,i=e.segmentInfo;i.template?(r=B,t=o(n,i.template),i.template.presentationTimeOffset&&(t.presentationTimeOffset=i.template.presentationTimeOffset/i.template.timescale)):i.base?(r=D,t=o(n,i.base)):i.list&&(r=F,t=o(n,i.list));var a={attributes:n};if(!r)return a;var u=r(t,i.timeline);if(t.duration){var s=t,c=s.duration,d=s.timescale,l=void 0===d?1:d;t.duration=c/l}else u.length?t.duration=u.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0;return a.attributes=t,a.segments=u,i.base&&t.indexRange&&(a.sidx=u[0],a.segments=[]),a},j=function(e){return e.map(_)},q=function(e,t){return s(e.childNodes).filter((function(e){return e.tagName===t}))},$=function(e){return e.textContent.trim()},k=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var r=t.slice(1),n=r[0],i=r[1],a=r[2],o=r[3],u=r[4],s=r[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(i||0)+86400*parseFloat(a||0)+3600*parseFloat(o||0)+60*parseFloat(u||0)+parseFloat(s||0)},G={mediaPresentationDuration:function(e){return k(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return k(e)},suggestedPresentationDelay:function(e){return k(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return k(e)},start:function(e){return k(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?k(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},H=function(e){return e&&e.attributes?s(e.attributes).reduce((function(e,t){var r=G[t.name]||G.DEFAULT;return e[t.name]=r(t.value),e}),{}):{}};function W(e){for(var t,r=(t=e,i.default.atob?i.default.atob(t):Buffer.from(t,"base64").toString("binary")),n=new Uint8Array(r.length),a=0;a0)throw new Error(l);return n};e.VERSION="0.17.0",e.addSidxSegmentsToPlaylist=R,e.generateSidxKey=L,e.inheritAttributes=J,e.parse=function(e,t){void 0===t&&(t={});var r=J(Q(e),t),n=j(r.representationInfo);return N(n,r.locations,t.sidxMapping)},e.parseUTCTiming=function(e){return function(e){var t=q(e,"UTCTiming")[0];if(!t)return null;var r=H(t);switch(r.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":r.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":r.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":r.method="DIRECT",r.value=Date.parse(r.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(p)}return r}(Q(e))},e.stringToMpdXml=Q,e.toM3u8=N,e.toPlaylists=j,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/node_modules/mpd-parser/index.html b/node_modules/mpd-parser/index.html deleted file mode 100644 index 0a281ee..0000000 --- a/node_modules/mpd-parser/index.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - mpd-parser Demo - - -

    Open dev tools to try it out

    - - -
    - - -
    - - - - - diff --git a/node_modules/mpd-parser/package.json b/node_modules/mpd-parser/package.json deleted file mode 100644 index c4686c9..0000000 --- a/node_modules/mpd-parser/package.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "_from": "mpd-parser@0.17.0", - "_id": "mpd-parser@0.17.0", - "_inBundle": false, - "_integrity": "sha512-oKS5G0jCcHHJ3sHYlcLeM9Xcbuixl08eAx7QW0Th7ChlZiI0YvLtGaHE/L0aKUBJFNvtkeksIr8XgJgSBBsS4g==", - "_location": "/mpd-parser", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "mpd-parser@0.17.0", - "name": "mpd-parser", - "escapedName": "mpd-parser", - "rawSpec": "0.17.0", - "saveSpec": null, - "fetchSpec": "0.17.0" - }, - "_requiredBy": [ - "/@videojs/http-streaming", - "/video.js" - ], - "_resolved": "https://registry.npmjs.org/mpd-parser/-/mpd-parser-0.17.0.tgz", - "_shasum": "d7f3002edcb706f98993ef75846a713d056d3332", - "_spec": "mpd-parser@0.17.0", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js", - "author": { - "name": "Brightcove, Inc" - }, - "bin": { - "mpd-to-m3u8-json": "bin/parse.js" - }, - "browserslist": [ - "defaults", - "ie 11" - ], - "bugs": { - "url": "https://github.com/videojs/mpd-parser/issues" - }, - "bundleDependencies": false, - "dependencies": { - "@babel/runtime": "^7.12.5", - "@videojs/vhs-utils": "^3.0.2", - "global": "^4.4.0", - "xmldom": "^0.5.0" - }, - "deprecated": false, - "description": "mpd parser", - "devDependencies": { - "@rollup/plugin-replace": "^2.3.4", - "@videojs/generator-helpers": "~2.0.1", - "jsdom": "^16.4.0", - "karma": "^5.2.3", - "rollup": "^2.36.1", - "rollup-plugin-string": "^3.0.0", - "sinon": "^9.2.3", - "videojs-generate-karma-config": "~7.0.0", - "videojs-generate-rollup-config": "~6.1.0", - "videojs-generator-verify": "~3.0.2", - "videojs-standard": "^8.0.4" - }, - "files": [ - "CONTRIBUTING.md", - "dist/", - "docs/", - "index.html", - "scripts/", - "src/", - "test/" - ], - "generator-videojs-plugin": { - "version": "7.7.3" - }, - "homepage": "https://github.com/videojs/mpd-parser#readme", - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "keywords": [ - "videojs", - "videojs-plugin" - ], - "license": "Apache-2.0", - "lint-staged": { - "*.js": "vjsstandard --fix", - "README.md": "doctoc --notitle" - }, - "main": "dist/mpd-parser.cjs.js", - "module": "dist/mpd-parser.es.js", - "name": "mpd-parser", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/videojs/mpd-parser.git" - }, - "scripts": { - "build": "npm-run-all -s clean -p build:*", - "build-prod": "cross-env-shell NO_TEST_BUNDLE=1 'npm run build'", - "build-test": "cross-env-shell TEST_BUNDLE_ONLY=1 'npm run build'", - "build:js": "rollup -c scripts/rollup.config.js", - "clean": "shx rm -rf ./dist ./test/dist && shx mkdir -p ./dist ./test/dist", - "lint": "vjsstandard", - "netlify": "node scripts/netlify.js", - "posttest": "shx cat test/dist/coverage/text.txt", - "prenetlify": "npm run build", - "prepublishOnly": "npm-run-all build-prod && vjsverify --verbose", - "preversion": "npm test", - "server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch", - "start": "npm-run-all -p server watch", - "test": "npm-run-all lint build-test && npm-run-all test:*", - "test:browser": "karma start scripts/karma.conf.js", - "test:node": "qunit test/dist/bundle-node.js", - "update-changelog": "conventional-changelog -p videojs -i CHANGELOG.md -s", - "version": "is-prerelease || npm run update-changelog && git add CHANGELOG.md", - "watch": "npm-run-all -p watch:*", - "watch:js": "npm run build:js -- -w" - }, - "version": "0.17.0", - "vjsstandard": { - "ignore": [ - "dist", - "docs", - "test/dist" - ] - } -} diff --git a/node_modules/mpd-parser/scripts/karma.conf.js b/node_modules/mpd-parser/scripts/karma.conf.js deleted file mode 100644 index 751e0cd..0000000 --- a/node_modules/mpd-parser/scripts/karma.conf.js +++ /dev/null @@ -1,13 +0,0 @@ -const generate = require('videojs-generate-karma-config'); - -module.exports = function(config) { - - // see https://github.com/videojs/videojs-generate-karma-config - // for options - const options = {}; - - config = generate(config, options); - - // any other custom stuff not supported by options here! -}; - diff --git a/node_modules/mpd-parser/scripts/netlify.js b/node_modules/mpd-parser/scripts/netlify.js deleted file mode 100644 index a2fca56..0000000 --- a/node_modules/mpd-parser/scripts/netlify.js +++ /dev/null @@ -1,14 +0,0 @@ -const path = require('path'); -const sh = require('shelljs'); - -const files = ['dist', 'index.html']; -const deployDir = 'deploy'; - -// cleanup previous deploy -sh.rm('-rf', deployDir); -// make sure the directory exists -sh.mkdir('-p', deployDir); - -// copy over dist, and html files -files - .forEach((file) => sh.cp('-r', file, path.join(deployDir, file))); diff --git a/node_modules/mpd-parser/scripts/rollup.config.js b/node_modules/mpd-parser/scripts/rollup.config.js deleted file mode 100644 index 7af0645..0000000 --- a/node_modules/mpd-parser/scripts/rollup.config.js +++ /dev/null @@ -1,66 +0,0 @@ -const generate = require('videojs-generate-rollup-config'); -const string = require('rollup-plugin-string').string; -const replace = require('@rollup/plugin-replace'); - -// see https://github.com/videojs/videojs-generate-rollup-config -// for options -const options = { - input: 'src/index.js', - plugins(defaults) { - defaults.test.unshift('string'); - defaults.module.unshift('replace'); - - return defaults; - }, - primedPlugins(defaults) { - defaults.string = string({include: ['test/manifests/*.mpd']}); - // when using "require" rather than import - // require cjs module - defaults.replace = replace({ - // single quote replace - "require('@videojs/vhs-utils/es": "require('@videojs/vhs-utils/cjs", - // double quote replace - 'require("@videojs/vhs-utils/es': 'require("@videojs/vhs-utils/cjs' - }); - - return defaults; - }, - externals(defaults) { - defaults.module.push('@videojs/vhs-utils'); - defaults.module.push('xmldom'); - defaults.module.push('atob'); - defaults.module.push('url-toolkit'); - return defaults; - }, - globals(defaults) { - defaults.browser.xmldom = 'window'; - defaults.browser.atob = 'window.atob'; - defaults.test.xmldom = 'window'; - defaults.test.atob = 'window.atob'; - defaults.test.jsdom = '{JSDOM: function() { return {window: window}; }}'; - return defaults; - } -}; -const config = generate(options); - -if (config.builds.test) { - config.builds.testNode = config.makeBuild('test', { - input: 'test/**/*.test.js', - output: [{ - name: `${config.settings.exportName}Tests`, - file: 'test/dist/bundle-node.js', - format: 'cjs' - }] - }); - - config.builds.testNode.output[0].globals = {}; - config.builds.testNode.external = [].concat(config.settings.externals.module).concat([ - 'jsdom', - 'qunit' - ]); -} - -// Add additonal builds/customization here! - -// export the builds to rollup -export default Object.values(config.builds); diff --git a/node_modules/mpd-parser/src/errors.js b/node_modules/mpd-parser/src/errors.js deleted file mode 100644 index 1fd0928..0000000 --- a/node_modules/mpd-parser/src/errors.js +++ /dev/null @@ -1,9 +0,0 @@ -export default { - INVALID_NUMBER_OF_PERIOD: 'INVALID_NUMBER_OF_PERIOD', - DASH_EMPTY_MANIFEST: 'DASH_EMPTY_MANIFEST', - DASH_INVALID_XML: 'DASH_INVALID_XML', - NO_BASE_URL: 'NO_BASE_URL', - MISSING_SEGMENT_INFORMATION: 'MISSING_SEGMENT_INFORMATION', - SEGMENT_TIME_UNSPECIFIED: 'SEGMENT_TIME_UNSPECIFIED', - UNSUPPORTED_UTC_TIMING_SCHEME: 'UNSUPPORTED_UTC_TIMING_SCHEME' -}; diff --git a/node_modules/mpd-parser/src/index.js b/node_modules/mpd-parser/src/index.js deleted file mode 100644 index 31924d8..0000000 --- a/node_modules/mpd-parser/src/index.js +++ /dev/null @@ -1,39 +0,0 @@ -import { version } from '../package.json'; -import { toM3u8, generateSidxKey } from './toM3u8'; -import { toPlaylists } from './toPlaylists'; -import { inheritAttributes } from './inheritAttributes'; -import { stringToMpdXml } from './stringToMpdXml'; -import { parseUTCTimingScheme } from './parseUTCTimingScheme'; -import {addSidxSegmentsToPlaylist} from './segment/segmentBase.js'; - -const VERSION = version; - -const parse = (manifestString, options = {}) => { - const parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options); - const playlists = toPlaylists(parsedManifestInfo.representationInfo); - - return toM3u8(playlists, parsedManifestInfo.locations, options.sidxMapping); -}; - -/** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} manifestString - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ -const parseUTCTiming = (manifestString) => - parseUTCTimingScheme(stringToMpdXml(manifestString)); - -export { - VERSION, - parse, - parseUTCTiming, - stringToMpdXml, - inheritAttributes, - toPlaylists, - toM3u8, - addSidxSegmentsToPlaylist, - generateSidxKey -}; diff --git a/node_modules/mpd-parser/src/inheritAttributes.js b/node_modules/mpd-parser/src/inheritAttributes.js deleted file mode 100644 index e534f75..0000000 --- a/node_modules/mpd-parser/src/inheritAttributes.js +++ /dev/null @@ -1,436 +0,0 @@ -import window from 'global/window'; -import { flatten } from './utils/list'; -import { merge } from './utils/object'; -import { findChildren, getContent } from './utils/xml'; -import { parseAttributes } from './parseAttributes'; -import errors from './errors'; -import resolveUrl from '@videojs/vhs-utils/es/resolve-url'; -import decodeB64ToUint8Array from '@videojs/vhs-utils/es/decode-b64-to-uint8-array'; - -const keySystemsMap = { - 'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b': 'org.w3.clearkey', - 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed': 'com.widevine.alpha', - 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95': 'com.microsoft.playready', - 'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime' -}; - -/** - * Builds a list of urls that is the product of the reference urls and BaseURL values - * - * @param {string[]} referenceUrls - * List of reference urls to resolve to - * @param {Node[]} baseUrlElements - * List of BaseURL nodes from the mpd - * @return {string[]} - * List of resolved urls - */ -export const buildBaseUrls = (referenceUrls, baseUrlElements) => { - if (!baseUrlElements.length) { - return referenceUrls; - } - - return flatten(referenceUrls.map(function(reference) { - return baseUrlElements.map(function(baseUrlElement) { - return resolveUrl(reference, getContent(baseUrlElement)); - }); - })); -}; - -/** - * Contains all Segment information for its containing AdaptationSet - * - * @typedef {Object} SegmentInformation - * @property {Object|undefined} template - * Contains the attributes for the SegmentTemplate node - * @property {Object[]|undefined} timeline - * Contains a list of atrributes for each S node within the SegmentTimeline node - * @property {Object|undefined} list - * Contains the attributes for the SegmentList node - * @property {Object|undefined} base - * Contains the attributes for the SegmentBase node - */ - -/** - * Returns all available Segment information contained within the AdaptationSet node - * - * @param {Node} adaptationSet - * The AdaptationSet node to get Segment information from - * @return {SegmentInformation} - * The Segment information contained within the provided AdaptationSet - */ -export const getSegmentInformation = (adaptationSet) => { - const segmentTemplate = findChildren(adaptationSet, 'SegmentTemplate')[0]; - const segmentList = findChildren(adaptationSet, 'SegmentList')[0]; - const segmentUrls = segmentList && findChildren(segmentList, 'SegmentURL') - .map(s => merge({ tag: 'SegmentURL' }, parseAttributes(s))); - const segmentBase = findChildren(adaptationSet, 'SegmentBase')[0]; - const segmentTimelineParentNode = segmentList || segmentTemplate; - const segmentTimeline = segmentTimelineParentNode && - findChildren(segmentTimelineParentNode, 'SegmentTimeline')[0]; - const segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate; - const segmentInitialization = segmentInitializationParentNode && - findChildren(segmentInitializationParentNode, 'Initialization')[0]; - - // SegmentTemplate is handled slightly differently, since it can have both - // @initialization and an node. @initialization can be templated, - // while the node can have a url and range specified. If the has - // both @initialization and an subelement we opt to override with - // the node, as this interaction is not defined in the spec. - const template = segmentTemplate && parseAttributes(segmentTemplate); - - if (template && segmentInitialization) { - template.initialization = - (segmentInitialization && parseAttributes(segmentInitialization)); - } else if (template && template.initialization) { - // If it is @initialization we convert it to an object since this is the format that - // later functions will rely on for the initialization segment. This is only valid - // for - template.initialization = { sourceURL: template.initialization }; - } - - const segmentInfo = { - template, - timeline: segmentTimeline && - findChildren(segmentTimeline, 'S').map(s => parseAttributes(s)), - list: segmentList && merge( - parseAttributes(segmentList), - { - segmentUrls, - initialization: parseAttributes(segmentInitialization) - } - ), - base: segmentBase && merge(parseAttributes(segmentBase), { - initialization: parseAttributes(segmentInitialization) - }) - }; - - Object.keys(segmentInfo).forEach(key => { - if (!segmentInfo[key]) { - delete segmentInfo[key]; - } - }); - - return segmentInfo; -}; - -/** - * Contains Segment information and attributes needed to construct a Playlist object - * from a Representation - * - * @typedef {Object} RepresentationInformation - * @property {SegmentInformation} segmentInfo - * Segment information for this Representation - * @property {Object} attributes - * Inherited attributes for this Representation - */ - -/** - * Maps a Representation node to an object containing Segment information and attributes - * - * @name inheritBaseUrlsCallback - * @function - * @param {Node} representation - * Representation node from the mpd - * @return {RepresentationInformation} - * Representation information needed to construct a Playlist object - */ - -/** - * Returns a callback for Array.prototype.map for mapping Representation nodes to - * Segment information and attributes using inherited BaseURL nodes. - * - * @param {Object} adaptationSetAttributes - * Contains attributes inherited by the AdaptationSet - * @param {string[]} adaptationSetBaseUrls - * Contains list of resolved base urls inherited by the AdaptationSet - * @param {SegmentInformation} adaptationSetSegmentInfo - * Contains Segment information for the AdaptationSet - * @return {inheritBaseUrlsCallback} - * Callback map function - */ -export const inheritBaseUrls = -(adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) => - (representation) => { - const repBaseUrlElements = findChildren(representation, 'BaseURL'); - const repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements); - const attributes = merge(adaptationSetAttributes, parseAttributes(representation)); - const representationSegmentInfo = getSegmentInformation(representation); - - return repBaseUrls.map(baseUrl => { - return { - segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo), - attributes: merge(attributes, { baseUrl }) - }; - }); - }; - -/** - * Tranforms a series of content protection nodes to - * an object containing pssh data by key system - * - * @param {Node[]} contentProtectionNodes - * Content protection nodes - * @return {Object} - * Object containing pssh data by key system - */ -const generateKeySystemInformation = (contentProtectionNodes) => { - return contentProtectionNodes.reduce((acc, node) => { - const attributes = parseAttributes(node); - const keySystem = keySystemsMap[attributes.schemeIdUri]; - - if (keySystem) { - acc[keySystem] = { attributes }; - - const psshNode = findChildren(node, 'cenc:pssh')[0]; - - if (psshNode) { - const pssh = getContent(psshNode); - const psshBuffer = pssh && decodeB64ToUint8Array(pssh); - - acc[keySystem].pssh = psshBuffer; - } - } - - return acc; - }, {}); -}; - -// defined in ANSI_SCTE 214-1 2016 -export const parseCaptionServiceMetadata = (service) => { - // 608 captions - if (service.schemeIdUri === 'urn:scte:dash:cc:cea-608:2015') { - const values = service.value.split(';'); - - return values.map((value) => { - let channel; - let language; - - // default language to value - language = value; - - if (/^CC\d=/.test(value)) { - [channel, language] = value.split('='); - } else if (/^CC\d$/.test(value)) { - channel = value; - } - - return {channel, language}; - }); - } else if (service.schemeIdUri === 'urn:scte:dash:cc:cea-708:2015') { - const values = service.value.split(';'); - - return values.map((value) => { - const flags = { - // service or channel number 1-63 - 'channel': undefined, - - // language is a 3ALPHA per ISO 639.2/B - // field is required - 'language': undefined, - - // BIT 1/0 or ? - // default value is 1, meaning 16:9 aspect ratio, 0 is 4:3, ? is unknown - 'aspectRatio': 1, - - // BIT 1/0 - // easy reader flag indicated the text is tailed to the needs of beginning readers - // default 0, or off - 'easyReader': 0, - - // BIT 1/0 - // If 3d metadata is present (CEA-708.1) then 1 - // default 0 - '3D': 0 - }; - - if (/=/.test(value)) { - - const [channel, opts = ''] = value.split('='); - - flags.channel = channel; - flags.language = value; - - opts.split(',').forEach((opt) => { - const [name, val] = opt.split(':'); - - if (name === 'lang') { - flags.language = val; - - // er for easyReadery - } else if (name === 'er') { - flags.easyReader = Number(val); - - // war for wide aspect ratio - } else if (name === 'war') { - flags.aspectRatio = Number(val); - - } else if (name === '3D') { - flags['3D'] = Number(val); - } - }); - } else { - flags.language = value; - } - - if (flags.channel) { - flags.channel = 'SERVICE' + flags.channel; - } - - return flags; - }); - } -}; - -/** - * Maps an AdaptationSet node to a list of Representation information objects - * - * @name toRepresentationsCallback - * @function - * @param {Node} adaptationSet - * AdaptationSet node from the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - -/** - * Returns a callback for Array.prototype.map for mapping AdaptationSet nodes to a list of - * Representation information objects - * - * @param {Object} periodAttributes - * Contains attributes inherited by the Period - * @param {string[]} periodBaseUrls - * Contains list of resolved base urls inherited by the Period - * @param {string[]} periodSegmentInfo - * Contains Segment Information at the period level - * @return {toRepresentationsCallback} - * Callback map function - */ -export const toRepresentations = -(periodAttributes, periodBaseUrls, periodSegmentInfo) => (adaptationSet) => { - const adaptationSetAttributes = parseAttributes(adaptationSet); - const adaptationSetBaseUrls = buildBaseUrls( - periodBaseUrls, - findChildren(adaptationSet, 'BaseURL') - ); - const role = findChildren(adaptationSet, 'Role')[0]; - const roleAttributes = { role: parseAttributes(role) }; - - let attrs = merge( - periodAttributes, - adaptationSetAttributes, - roleAttributes, - ); - - const accessibility = findChildren(adaptationSet, 'Accessibility')[0]; - const captionServices = parseCaptionServiceMetadata(parseAttributes(accessibility)); - - if (captionServices) { - attrs = merge(attrs, { captionServices }); - } - - const label = findChildren(adaptationSet, 'Label')[0]; - - if (label && label.childNodes.length) { - const labelVal = label.childNodes[0].nodeValue.trim(); - - attrs = merge(attrs, { label: labelVal }); - } - - const contentProtection = generateKeySystemInformation(findChildren(adaptationSet, 'ContentProtection')); - - if (Object.keys(contentProtection).length) { - attrs = merge(attrs, { contentProtection }); - } - - const segmentInfo = getSegmentInformation(adaptationSet); - const representations = findChildren(adaptationSet, 'Representation'); - const adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo); - - return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo))); -}; - -/** - * Maps an Period node to a list of Representation inforamtion objects for all - * AdaptationSet nodes contained within the Period - * - * @name toAdaptationSetsCallback - * @function - * @param {Node} period - * Period node from the mpd - * @param {number} periodIndex - * Index of the Period within the mpd - * @return {RepresentationInformation[]} - * List of objects containing Representaion information - */ - -/** - * Returns a callback for Array.prototype.map for mapping Period nodes to a list of - * Representation information objects - * - * @param {Object} mpdAttributes - * Contains attributes inherited by the mpd - * @param {string[]} mpdBaseUrls - * Contains list of resolved base urls inherited by the mpd - * @return {toAdaptationSetsCallback} - * Callback map function - */ -export const toAdaptationSets = (mpdAttributes, mpdBaseUrls) => (period, index) => { - const periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period, 'BaseURL')); - const periodAtt = parseAttributes(period); - const parsedPeriodId = parseInt(periodAtt.id, 10); - // fallback to mapping index if Period@id is not a number - const periodIndex = window.isNaN(parsedPeriodId) ? index : parsedPeriodId; - const periodAttributes = merge(mpdAttributes, { periodIndex }); - const adaptationSets = findChildren(period, 'AdaptationSet'); - const periodSegmentInfo = getSegmentInformation(period); - - return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo))); -}; - -/** - * Traverses the mpd xml tree to generate a list of Representation information objects - * that have inherited attributes from parent nodes - * - * @param {Node} mpd - * The root node of the mpd - * @param {Object} options - * Available options for inheritAttributes - * @param {string} options.manifestUri - * The uri source of the mpd - * @param {number} options.NOW - * Current time per DASH IOP. Default is current time in ms since epoch - * @param {number} options.clientOffset - * Client time difference from NOW (in milliseconds) - * @return {RepresentationInformation[]} - * List of objects containing Representation information - */ -export const inheritAttributes = (mpd, options = {}) => { - const { - manifestUri = '', - NOW = Date.now(), - clientOffset = 0 - } = options; - const periods = findChildren(mpd, 'Period'); - - if (!periods.length) { - throw new Error(errors.INVALID_NUMBER_OF_PERIOD); - } - - const locations = findChildren(mpd, 'Location'); - - const mpdAttributes = parseAttributes(mpd); - const mpdBaseUrls = buildBaseUrls([ manifestUri ], findChildren(mpd, 'BaseURL')); - - mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0; - mpdAttributes.NOW = NOW; - mpdAttributes.clientOffset = clientOffset; - - if (locations.length) { - mpdAttributes.locations = locations.map(getContent); - } - - return { - locations: mpdAttributes.locations, - representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls))) - }; -}; diff --git a/node_modules/mpd-parser/src/parseAttributes.js b/node_modules/mpd-parser/src/parseAttributes.js deleted file mode 100644 index 70dd20a..0000000 --- a/node_modules/mpd-parser/src/parseAttributes.js +++ /dev/null @@ -1,267 +0,0 @@ -import { from } from './utils/list'; -import { parseDuration, parseDate } from './utils/time'; - -// TODO: maybe order these in some way that makes it easy to find specific attributes -export const parsers = { - /** - * Specifies the duration of the entire Media Presentation. Format is a duration string - * as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - mediaPresentationDuration(value) { - return parseDuration(value); - }, - - /** - * Specifies the Segment availability start time for all Segments referred to in this - * MPD. For a dynamic manifest, it specifies the anchor for the earliest availability - * time. Format is a date string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The date as seconds from unix epoch - */ - availabilityStartTime(value) { - return parseDate(value) / 1000; - }, - - /** - * Specifies the smallest period between potential changes to the MPD. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - minimumUpdatePeriod(value) { - return parseDuration(value); - }, - - /** - * Specifies the suggested presentation delay. Format is a - * duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - suggestedPresentationDelay(value) { - return parseDuration(value); - }, - - /** - * specifices the type of mpd. Can be either "static" or "dynamic" - * - * @param {string} value - * value of attribute as a string - * - * @return {string} - * The type as a string - */ - type(value) { - return value; - }, - - /** - * Specifies the duration of the smallest time shifting buffer for any Representation - * in the MPD. Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - timeShiftBufferDepth(value) { - return parseDuration(value); - }, - - /** - * Specifies the PeriodStart time of the Period relative to the availabilityStarttime. - * Format is a duration string as specified in ISO 8601 - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The duration in seconds - */ - start(value) { - return parseDuration(value); - }, - - /** - * Specifies the width of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed width - */ - width(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the height of the visual presentation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed height - */ - height(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the bitrate of the representation - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed bandwidth - */ - bandwidth(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the number of the first Media Segment in this Representation in the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - startNumber(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the timescale in units per seconds - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed timescale - */ - timescale(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the presentationTimeOffset. - * - * @param {string} value - * value of the attribute as a string - * - * @return {number} - * The parsed presentationTimeOffset - */ - presentationTimeOffset(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the constant approximate Segment duration - * NOTE: The element also contains an @duration attribute. This duration - * specifies the duration of the Period. This attribute is currently not - * supported by the rest of the parser, however we still check for it to prevent - * errors. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - duration(value) { - const parsedValue = parseInt(value, 10); - - if (isNaN(parsedValue)) { - return parseDuration(value); - } - - return parsedValue; - }, - - /** - * Specifies the Segment duration, in units of the value of the @timescale. - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed duration - */ - d(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the MPD start time, in @timescale units, the first Segment in the series - * starts relative to the beginning of the Period - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed time - */ - t(value) { - return parseInt(value, 10); - }, - - /** - * Specifies the repeat count of the number of following contiguous Segments with the - * same duration expressed by the value of @d - * - * @param {string} value - * value of attribute as a string - * @return {number} - * The parsed number - */ - r(value) { - return parseInt(value, 10); - }, - - /** - * Default parser for all other attributes. Acts as a no-op and just returns the value - * as a string - * - * @param {string} value - * value of attribute as a string - * @return {string} - * Unparsed value - */ - DEFAULT(value) { - return value; - } -}; - -/** - * Gets all the attributes and values of the provided node, parses attributes with known - * types, and returns an object with attribute names mapped to values. - * - * @param {Node} el - * The node to parse attributes from - * @return {Object} - * Object with all attributes of el parsed - */ -export const parseAttributes = (el) => { - if (!(el && el.attributes)) { - return {}; - } - - return from(el.attributes) - .reduce((a, e) => { - const parseFn = parsers[e.name] || parsers.DEFAULT; - - a[e.name] = parseFn(e.value); - - return a; - }, {}); -}; diff --git a/node_modules/mpd-parser/src/parseUTCTimingScheme.js b/node_modules/mpd-parser/src/parseUTCTimingScheme.js deleted file mode 100644 index 5464be3..0000000 --- a/node_modules/mpd-parser/src/parseUTCTimingScheme.js +++ /dev/null @@ -1,46 +0,0 @@ -import { findChildren } from './utils/xml'; -import { parseAttributes } from './parseAttributes'; -import errors from './errors'; - -/** - * Parses the manifest for a UTCTiming node, returning the nodes attributes if found - * - * @param {string} mpd - * XML string of the MPD manifest - * @return {Object|null} - * Attributes of UTCTiming node specified in the manifest. Null if none found - */ -export const parseUTCTimingScheme = (mpd) => { - const UTCTimingNode = findChildren(mpd, 'UTCTiming')[0]; - - if (!UTCTimingNode) { - return null; - } - - const attributes = parseAttributes(UTCTimingNode); - - switch (attributes.schemeIdUri) { - case 'urn:mpeg:dash:utc:http-head:2014': - case 'urn:mpeg:dash:utc:http-head:2012': - attributes.method = 'HEAD'; - break; - case 'urn:mpeg:dash:utc:http-xsdate:2014': - case 'urn:mpeg:dash:utc:http-iso:2014': - case 'urn:mpeg:dash:utc:http-xsdate:2012': - case 'urn:mpeg:dash:utc:http-iso:2012': - attributes.method = 'GET'; - break; - case 'urn:mpeg:dash:utc:direct:2014': - case 'urn:mpeg:dash:utc:direct:2012': - attributes.method = 'DIRECT'; - attributes.value = Date.parse(attributes.value); - break; - case 'urn:mpeg:dash:utc:http-ntp:2014': - case 'urn:mpeg:dash:utc:ntp:2014': - case 'urn:mpeg:dash:utc:sntp:2014': - default: - throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME); - } - - return attributes; -}; diff --git a/node_modules/mpd-parser/src/segment/durationTimeParser.js b/node_modules/mpd-parser/src/segment/durationTimeParser.js deleted file mode 100644 index 72a8cbc..0000000 --- a/node_modules/mpd-parser/src/segment/durationTimeParser.js +++ /dev/null @@ -1,156 +0,0 @@ -import { range } from '../utils/list'; - -/** - * parse the end number attribue that can be a string - * number, or undefined. - * - * @param {string|number|undefined} endNumber - * The end number attribute. - * - * @return {number|null} - * The result of parsing the end number. - */ -const parseEndNumber = (endNumber) => { - if (endNumber && typeof endNumber !== 'number') { - endNumber = parseInt(endNumber, 10); - } - - if (isNaN(endNumber)) { - return null; - } - - return endNumber; -}; - -/** - * Functions for calculating the range of available segments in static and dynamic - * manifests. - */ -export const segmentRange = { - /** - * Returns the entire range of available segments for a static MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - static(attributes) { - const { - duration, - timescale = 1, - sourceDuration - } = attributes; - const endNumber = parseEndNumber(attributes.endNumber); - - return { - start: 0, - end: typeof endNumber === 'number' ? endNumber : Math.ceil(sourceDuration / (duration / timescale)) - }; - }, - - /** - * Returns the current live window range of available segments for a dynamic MPD - * - * @param {Object} attributes - * Inheritied MPD attributes - * @return {{ start: number, end: number }} - * The start and end numbers for available segments - */ - dynamic(attributes) { - const { - NOW, - clientOffset, - availabilityStartTime, - timescale = 1, - duration, - start = 0, - minimumUpdatePeriod = 0, - timeShiftBufferDepth = Infinity - } = attributes; - const endNumber = parseEndNumber(attributes.endNumber); - const now = (NOW + clientOffset) / 1000; - const periodStartWC = availabilityStartTime + start; - const periodEndWC = now + minimumUpdatePeriod; - const periodDuration = periodEndWC - periodStartWC; - const segmentCount = Math.ceil(periodDuration * timescale / duration); - const availableStart = - Math.floor((now - periodStartWC - timeShiftBufferDepth) * timescale / duration); - const availableEnd = Math.floor((now - periodStartWC) * timescale / duration); - - return { - start: Math.max(0, availableStart), - end: typeof endNumber === 'number' ? endNumber : Math.min(segmentCount, availableEnd) - }; - } -}; - -/** - * Maps a range of numbers to objects with information needed to build the corresponding - * segment list - * - * @name toSegmentsCallback - * @function - * @param {number} number - * Number of the segment - * @param {number} index - * Index of the number in the range list - * @return {{ number: Number, duration: Number, timeline: Number, time: Number }} - * Object with segment timing and duration info - */ - -/** - * Returns a callback for Array.prototype.map for mapping a range of numbers to - * information needed to build the segment list. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {toSegmentsCallback} - * Callback map function - */ -export const toSegments = (attributes) => (number, index) => { - const { - duration, - timescale = 1, - periodIndex, - startNumber = 1 - } = attributes; - - return { - number: startNumber + number, - duration: duration / timescale, - timeline: periodIndex, - time: index * duration - }; -}; - -/** - * Returns a list of objects containing segment timing and duration info used for - * building the list of segments. This uses the @duration attribute specified - * in the MPD manifest to derive the range of segments. - * - * @param {Object} attributes - * Inherited MPD attributes - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ -export const parseByDuration = (attributes) => { - const { - type = 'static', - duration, - timescale = 1, - sourceDuration - } = attributes; - - const { start, end } = segmentRange[type](attributes); - const segments = range(start, end).map(toSegments(attributes)); - - if (type === 'static') { - const index = segments.length - 1; - - // final segment may be less than full segment duration - segments[index].duration = sourceDuration - (duration / timescale * index); - } - - return segments; -}; diff --git a/node_modules/mpd-parser/src/segment/segmentBase.js b/node_modules/mpd-parser/src/segment/segmentBase.js deleted file mode 100644 index e68859f..0000000 --- a/node_modules/mpd-parser/src/segment/segmentBase.js +++ /dev/null @@ -1,123 +0,0 @@ -import errors from '../errors'; -import urlTypeConverter from './urlType'; -import { parseByDuration } from './durationTimeParser'; - -/** - * Translates SegmentBase into a set of segments. - * (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @return {Object.} list of segments - */ -export const segmentsFromBase = (attributes) => { - const { - baseUrl, - initialization = {}, - sourceDuration, - indexRange = '', - duration - } = attributes; - - // base url is required for SegmentBase to work, per spec (Section 5.3.9.2.1) - if (!baseUrl) { - throw new Error(errors.NO_BASE_URL); - } - - const initSegment = urlTypeConverter({ - baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - - const segment = urlTypeConverter({ baseUrl, source: baseUrl, indexRange }); - - segment.map = initSegment; - - // If there is a duration, use it, otherwise use the given duration of the source - // (since SegmentBase is only for one total segment) - if (duration) { - const segmentTimeInfo = parseByDuration(attributes); - - if (segmentTimeInfo.length) { - segment.duration = segmentTimeInfo[0].duration; - segment.timeline = segmentTimeInfo[0].timeline; - } - } else if (sourceDuration) { - segment.duration = sourceDuration; - segment.timeline = 0; - } - - // This is used for mediaSequence - segment.number = 0; - - return [segment]; -}; - -/** - * Given a playlist, a sidx box, and a baseUrl, update the segment list of the playlist - * according to the sidx information given. - * - * playlist.sidx has metadadata about the sidx where-as the sidx param - * is the parsed sidx box itself. - * - * @param {Object} playlist the playlist to update the sidx information for - * @param {Object} sidx the parsed sidx box - * @return {Object} the playlist object with the updated sidx information - */ -export const addSidxSegmentsToPlaylist = (playlist, sidx, baseUrl) => { - // Retain init segment information - const initSegment = playlist.sidx.map ? playlist.sidx.map : null; - // Retain source duration from initial master manifest parsing - const sourceDuration = playlist.sidx.duration; - // Retain source timeline - const timeline = playlist.timeline || 0; - const sidxByteRange = playlist.sidx.byterange; - const sidxEnd = sidxByteRange.offset + sidxByteRange.length; - // Retain timescale of the parsed sidx - const timescale = sidx.timescale; - // referenceType 1 refers to other sidx boxes - const mediaReferences = sidx.references.filter(r => r.referenceType !== 1); - const segments = []; - - // firstOffset is the offset from the end of the sidx box - let startIndex = sidxEnd + sidx.firstOffset; - - for (let i = 0; i < mediaReferences.length; i++) { - const reference = sidx.references[i]; - // size of the referenced (sub)segment - const size = reference.referencedSize; - // duration of the referenced (sub)segment, in the timescale - // this will be converted to seconds when generating segments - const duration = reference.subsegmentDuration; - // should be an inclusive range - const endIndex = startIndex + size - 1; - const indexRange = `${startIndex}-${endIndex}`; - - const attributes = { - baseUrl, - timescale, - timeline, - // this is used in parseByDuration - periodIndex: timeline, - duration, - sourceDuration, - indexRange - }; - - const segment = segmentsFromBase(attributes)[0]; - - if (initSegment) { - segment.map = initSegment; - } - - segments.push(segment); - startIndex += size; - } - - playlist.segments = segments; - - return playlist; -}; diff --git a/node_modules/mpd-parser/src/segment/segmentList.js b/node_modules/mpd-parser/src/segment/segmentList.js deleted file mode 100644 index a3bb1f8..0000000 --- a/node_modules/mpd-parser/src/segment/segmentList.js +++ /dev/null @@ -1,90 +0,0 @@ -import { parseByTimeline } from './timelineTimeParser'; -import { parseByDuration } from './durationTimeParser'; -import urlTypeConverter from './urlType'; -import errors from '../errors'; - -/** - * Converts a (of type URLType from the DASH spec 5.3.9.2 Table 14) - * to an object that matches the output of a segment in videojs/mpd-parser - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object} segmentUrl - * node to translate into a segment object - * @return {Object} translated segment object - */ -const SegmentURLToSegmentObject = (attributes, segmentUrl) => { - const { baseUrl, initialization = {} } = attributes; - - const initSegment = urlTypeConverter({ - baseUrl, - source: initialization.sourceURL, - range: initialization.range - }); - - const segment = urlTypeConverter({ - baseUrl, - source: segmentUrl.media, - range: segmentUrl.mediaRange - }); - - segment.map = initSegment; - - return segment; -}; - -/** - * Generates a list of segments using information provided by the SegmentList element - * SegmentList (DASH SPEC Section 5.3.9.3.2) contains a set of nodes. Each - * node should be translated into segment. - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object.} list of segments - */ -export const segmentsFromList = (attributes, segmentTimeline) => { - const { - duration, - segmentUrls = [] - } = attributes; - - // Per spec (5.3.9.2.1) no way to determine segment duration OR - // if both SegmentTimeline and @duration are defined, it is outside of spec. - if ((!duration && !segmentTimeline) || - (duration && segmentTimeline)) { - throw new Error(errors.SEGMENT_TIME_UNSPECIFIED); - } - - const segmentUrlMap = segmentUrls.map(segmentUrlObject => - SegmentURLToSegmentObject(attributes, segmentUrlObject)); - let segmentTimeInfo; - - if (duration) { - segmentTimeInfo = parseByDuration(attributes); - } - - if (segmentTimeline) { - segmentTimeInfo = parseByTimeline(attributes, segmentTimeline); - } - - const segments = segmentTimeInfo.map((segmentTime, index) => { - if (segmentUrlMap[index]) { - const segment = segmentUrlMap[index]; - - segment.timeline = segmentTime.timeline; - segment.duration = segmentTime.duration; - segment.number = segmentTime.number; - return segment; - } - // Since we're mapping we should get rid of any blank segments (in case - // the given SegmentTimeline is handling for more elements than we have - // SegmentURLs for). - }).filter(segment => segment); - - return segments; -}; diff --git a/node_modules/mpd-parser/src/segment/segmentTemplate.js b/node_modules/mpd-parser/src/segment/segmentTemplate.js deleted file mode 100644 index 5b55115..0000000 --- a/node_modules/mpd-parser/src/segment/segmentTemplate.js +++ /dev/null @@ -1,176 +0,0 @@ -import resolveUrl from '@videojs/vhs-utils/es/resolve-url'; -import urlTypeToSegment from './urlType'; -import { parseByTimeline } from './timelineTimeParser'; -import { parseByDuration } from './durationTimeParser'; - -const identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g; - -/** - * Replaces template identifiers with corresponding values. To be used as the callback - * for String.prototype.replace - * - * @name replaceCallback - * @function - * @param {string} match - * Entire match of identifier - * @param {string} identifier - * Name of matched identifier - * @param {string} format - * Format tag string. Its presence indicates that padding is expected - * @param {string} width - * Desired length of the replaced value. Values less than this width shall be left - * zero padded - * @return {string} - * Replacement for the matched identifier - */ - -/** - * Returns a function to be used as a callback for String.prototype.replace to replace - * template identifiers - * - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {replaceCallback} - * Callback to be used with String.prototype.replace to replace identifiers - */ -export const identifierReplacement = (values) => (match, identifier, format, width) => { - if (match === '$$') { - // escape sequence - return '$'; - } - - if (typeof values[identifier] === 'undefined') { - return match; - } - - const value = '' + values[identifier]; - - if (identifier === 'RepresentationID') { - // Format tag shall not be present with RepresentationID - return value; - } - - if (!format) { - width = 1; - } else { - width = parseInt(width, 10); - } - - if (value.length >= width) { - return value; - } - - return `${(new Array(width - value.length + 1)).join('0')}${value}`; -}; - -/** - * Constructs a segment url from a template string - * - * @param {string} url - * Template string to construct url from - * @param {Obect} values - * Object containing values that shall be used to replace known identifiers - * @param {number} values.RepresentationID - * Value of the Representation@id attribute - * @param {number} values.Number - * Number of the corresponding segment - * @param {number} values.Bandwidth - * Value of the Representation@bandwidth attribute. - * @param {number} values.Time - * Timestamp value of the corresponding segment - * @return {string} - * Segment url with identifiers replaced - */ -export const constructTemplateUrl = (url, values) => - url.replace(identifierPattern, identifierReplacement(values)); - -/** - * Generates a list of objects containing timing and duration information about each - * segment needed to generate segment uris and the complete segment object - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ -export const parseTemplateInfo = (attributes, segmentTimeline) => { - if (!attributes.duration && !segmentTimeline) { - // if neither @duration or SegmentTimeline are present, then there shall be exactly - // one media segment - return [{ - number: attributes.startNumber || 1, - duration: attributes.sourceDuration, - time: 0, - timeline: attributes.periodIndex - }]; - } - - if (attributes.duration) { - return parseByDuration(attributes); - } - - return parseByTimeline(attributes, segmentTimeline); -}; - -/** - * Generates a list of segments using information provided by the SegmentTemplate element - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]|undefined} segmentTimeline - * List of objects representing the attributes of each S element contained within - * the SegmentTimeline element - * @return {Object[]} - * List of segment objects - */ -export const segmentsFromTemplate = (attributes, segmentTimeline) => { - const templateValues = { - RepresentationID: attributes.id, - Bandwidth: attributes.bandwidth || 0 - }; - - const { initialization = { sourceURL: '', range: '' } } = attributes; - - const mapSegment = urlTypeToSegment({ - baseUrl: attributes.baseUrl, - source: constructTemplateUrl(initialization.sourceURL, templateValues), - range: initialization.range - }); - - const segments = parseTemplateInfo(attributes, segmentTimeline); - - return segments.map(segment => { - templateValues.Number = segment.number; - templateValues.Time = segment.time; - - const uri = constructTemplateUrl(attributes.media || '', templateValues); - - const map = { - uri, - timeline: segment.timeline, - duration: segment.duration, - resolvedUri: resolveUrl(attributes.baseUrl || '', uri), - map: mapSegment, - number: segment.number - }; - - if (attributes.presentationTimeOffset) { - map.presentationTimeOffset = attributes.presentationTimeOffset; - } - - return map; - }); -}; diff --git a/node_modules/mpd-parser/src/segment/timelineTimeParser.js b/node_modules/mpd-parser/src/segment/timelineTimeParser.js deleted file mode 100644 index bb1c46b..0000000 --- a/node_modules/mpd-parser/src/segment/timelineTimeParser.js +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Calculates the R (repetition) value for a live stream (for the final segment - * in a manifest where the r value is negative 1) - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {number} time - * current time (typically the total time up until the final segment) - * @param {number} duration - * duration property for the given - * - * @return {number} - * R value to reach the end of the given period - */ -const getLiveRValue = (attributes, time, duration) => { - const { - NOW, - clientOffset, - availabilityStartTime, - timescale = 1, - start = 0, - minimumUpdatePeriod = 0 - } = attributes; - const now = (NOW + clientOffset) / 1000; - const periodStartWC = availabilityStartTime + start; - const periodEndWC = now + minimumUpdatePeriod; - const periodDuration = periodEndWC - periodStartWC; - - return Math.ceil(((periodDuration * timescale) - time) / duration); -}; - -/** - * Uses information provided by SegmentTemplate.SegmentTimeline to determine segment - * timing and duration - * - * @param {Object} attributes - * Object containing all inherited attributes from parent elements with attribute - * names as keys - * @param {Object[]} segmentTimeline - * List of objects representing the attributes of each S element contained within - * - * @return {{number: number, duration: number, time: number, timeline: number}[]} - * List of Objects with segment timing and duration info - */ -export const parseByTimeline = (attributes, segmentTimeline) => { - const { - type = 'static', - minimumUpdatePeriod = 0, - media = '', - sourceDuration, - timescale = 1, - startNumber = 1, - periodIndex: timeline - } = attributes; - const segments = []; - let time = -1; - - for (let sIndex = 0; sIndex < segmentTimeline.length; sIndex++) { - const S = segmentTimeline[sIndex]; - const duration = S.d; - const repeat = S.r || 0; - const segmentTime = S.t || 0; - - if (time < 0) { - // first segment - time = segmentTime; - } - - if (segmentTime && segmentTime > time) { - // discontinuity - - // TODO: How to handle this type of discontinuity - // timeline++ here would treat it like HLS discontuity and content would - // get appended without gap - // E.G. - // - // - // - // - // would have $Time$ values of [0, 1, 2, 5] - // should this be appened at time positions [0, 1, 2, 3],(#EXT-X-DISCONTINUITY) - // or [0, 1, 2, gap, gap, 5]? (#EXT-X-GAP) - // does the value of sourceDuration consider this when calculating arbitrary - // negative @r repeat value? - // E.G. Same elements as above with this added at the end - // - // with a sourceDuration of 10 - // Would the 2 gaps be included in the time duration calculations resulting in - // 8 segments with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9] or 10 segments - // with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9, 10, 11] ? - - time = segmentTime; - } - - let count; - - if (repeat < 0) { - const nextS = sIndex + 1; - - if (nextS === segmentTimeline.length) { - // last segment - if (type === 'dynamic' && - minimumUpdatePeriod > 0 && - media.indexOf('$Number$') > 0) { - count = getLiveRValue(attributes, time, duration); - } else { - // TODO: This may be incorrect depending on conclusion of TODO above - count = ((sourceDuration * timescale) - time) / duration; - } - } else { - count = (segmentTimeline[nextS].t - time) / duration; - } - } else { - count = repeat + 1; - } - - const end = startNumber + segments.length + count; - let number = startNumber + segments.length; - - while (number < end) { - segments.push({ number, duration: duration / timescale, time, timeline }); - time += duration; - number++; - } - } - - return segments; -}; diff --git a/node_modules/mpd-parser/src/segment/urlType.js b/node_modules/mpd-parser/src/segment/urlType.js deleted file mode 100644 index 3f3f149..0000000 --- a/node_modules/mpd-parser/src/segment/urlType.js +++ /dev/null @@ -1,59 +0,0 @@ -import resolveUrl from '@videojs/vhs-utils/es/resolve-url'; - -/** - * @typedef {Object} SingleUri - * @property {string} uri - relative location of segment - * @property {string} resolvedUri - resolved location of segment - * @property {Object} byterange - Object containing information on how to make byte range - * requests following byte-range-spec per RFC2616. - * @property {String} byterange.length - length of range request - * @property {String} byterange.offset - byte offset of range request - * - * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 - */ - -/** - * Converts a URLType node (5.3.9.2.3 Table 13) to a segment object - * that conforms to how m3u8-parser is structured - * - * @see https://github.com/videojs/m3u8-parser - * - * @param {string} baseUrl - baseUrl provided by nodes - * @param {string} source - source url for segment - * @param {string} range - optional range used for range calls, - * follows RFC 2616, Clause 14.35.1 - * @return {SingleUri} full segment information transformed into a format similar - * to m3u8-parser - */ -export const urlTypeToSegment = ({ baseUrl = '', source = '', range = '', indexRange = '' }) => { - const segment = { - uri: source, - resolvedUri: resolveUrl(baseUrl || '', source) - }; - - if (range || indexRange) { - const rangeStr = range ? range : indexRange; - const ranges = rangeStr.split('-'); - const startRange = parseInt(ranges[0], 10); - const endRange = parseInt(ranges[1], 10); - - // byterange should be inclusive according to - // RFC 2616, Clause 14.35.1 - segment.byterange = { - length: endRange - startRange + 1, - offset: startRange - }; - } - - return segment; -}; - -export const byteRangeToString = (byterange) => { - // `endRange` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - const endRange = byterange.offset + byterange.length - 1; - - return `${byterange.offset}-${endRange}`; -}; - -export default urlTypeToSegment; diff --git a/node_modules/mpd-parser/src/stringToMpdXml.js b/node_modules/mpd-parser/src/stringToMpdXml.js deleted file mode 100644 index 1b77363..0000000 --- a/node_modules/mpd-parser/src/stringToMpdXml.js +++ /dev/null @@ -1,27 +0,0 @@ -import {DOMParser} from 'xmldom'; -import errors from './errors'; - -export const stringToMpdXml = (manifestString) => { - if (manifestString === '') { - throw new Error(errors.DASH_EMPTY_MANIFEST); - } - - const parser = new DOMParser(); - let xml; - let mpd; - - try { - xml = parser.parseFromString(manifestString, 'application/xml'); - mpd = xml && xml.documentElement.tagName === 'MPD' ? - xml.documentElement : null; - } catch (e) { - // ie 11 throwsw on invalid xml - } - - if (!mpd || mpd && - mpd.getElementsByTagName('parsererror').length > 0) { - throw new Error(errors.DASH_INVALID_XML); - } - - return mpd; -}; diff --git a/node_modules/mpd-parser/src/toM3u8.js b/node_modules/mpd-parser/src/toM3u8.js deleted file mode 100644 index 970b0ae..0000000 --- a/node_modules/mpd-parser/src/toM3u8.js +++ /dev/null @@ -1,339 +0,0 @@ -import { values } from './utils/object'; -import { findIndexes } from './utils/list'; -import { addSidxSegmentsToPlaylist as addSidxSegmentsToPlaylist_ } from './segment/segmentBase'; -import { byteRangeToString } from './segment/urlType'; - -export const generateSidxKey = (sidx) => sidx && - sidx.uri + '-' + byteRangeToString(sidx.byterange); - -const mergeDiscontiguousPlaylists = playlists => { - const mergedPlaylists = values(playlists.reduce((acc, playlist) => { - // assuming playlist IDs are the same across periods - // TODO: handle multiperiod where representation sets are not the same - // across periods - const name = playlist.attributes.id + (playlist.attributes.lang || ''); - - // Periods after first - if (acc[name]) { - // first segment of subsequent periods signal a discontinuity - if (playlist.segments[0]) { - playlist.segments[0].discontinuity = true; - } - acc[name].segments.push(...playlist.segments); - - // bubble up contentProtection, this assumes all DRM content - // has the same contentProtection - if (playlist.attributes.contentProtection) { - acc[name].attributes.contentProtection = - playlist.attributes.contentProtection; - } - } else { - // first Period - acc[name] = playlist; - } - - return acc; - }, {})); - - return mergedPlaylists.map(playlist => { - playlist.discontinuityStarts = - findIndexes(playlist.segments, 'discontinuity'); - - return playlist; - }); -}; - -export const addSidxSegmentsToPlaylist = (playlist, sidxMapping) => { - const sidxKey = generateSidxKey(playlist.sidx); - const sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx; - - if (sidxMatch) { - addSidxSegmentsToPlaylist_(playlist, sidxMatch, playlist.sidx.resolvedUri); - } - - return playlist; -}; - -export const addSidxSegmentsToPlaylists = (playlists, sidxMapping = {}) => { - if (!Object.keys(sidxMapping).length) { - return playlists; - } - - for (const i in playlists) { - playlists[i] = addSidxSegmentsToPlaylist(playlists[i], sidxMapping); - } - - return playlists; -}; - -export const formatAudioPlaylist = ({ attributes, segments, sidx }, isAudioOnly) => { - const playlist = { - attributes: { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth, - CODECS: attributes.codecs, - ['PROGRAM-ID']: 1 - }, - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - if (isAudioOnly) { - playlist.attributes.AUDIO = 'audio'; - playlist.attributes.SUBTITLES = 'subs'; - } - - return playlist; -}; - -export const formatVttPlaylist = ({ attributes, segments }) => { - if (typeof segments === 'undefined') { - // vtt tracks may use single file in BaseURL - segments = [{ - uri: attributes.baseUrl, - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - duration: attributes.sourceDuration, - number: 0 - }]; - // targetDuration should be the same duration as the only segment - attributes.duration = attributes.sourceDuration; - } - - const m3u8Attributes = { - NAME: attributes.id, - BANDWIDTH: attributes.bandwidth, - ['PROGRAM-ID']: 1 - }; - - if (attributes.codecs) { - m3u8Attributes.CODECS = attributes.codecs; - } - return { - attributes: m3u8Attributes, - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: attributes.baseUrl || '', - targetDuration: attributes.duration, - segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; -}; - -export const organizeAudioPlaylists = (playlists, sidxMapping = {}, isAudioOnly = false) => { - let mainPlaylist; - - const formattedPlaylists = playlists.reduce((a, playlist) => { - const role = playlist.attributes.role && - playlist.attributes.role.value || ''; - const language = playlist.attributes.lang || ''; - - let label = playlist.attributes.label || 'main'; - - if (language && !playlist.attributes.label) { - const roleLabel = role ? ` (${role})` : ''; - - label = `${playlist.attributes.lang}${roleLabel}`; - } - - if (!a[label]) { - a[label] = { - language, - autoselect: true, - default: role === 'main', - playlists: [], - uri: '' - }; - } - - const formatted = addSidxSegmentsToPlaylist(formatAudioPlaylist(playlist, isAudioOnly), sidxMapping); - - a[label].playlists.push(formatted); - - if (typeof mainPlaylist === 'undefined' && role === 'main') { - mainPlaylist = playlist; - mainPlaylist.default = true; - } - - return a; - }, {}); - - // if no playlists have role "main", mark the first as main - if (!mainPlaylist) { - const firstLabel = Object.keys(formattedPlaylists)[0]; - - formattedPlaylists[firstLabel].default = true; - } - - return formattedPlaylists; -}; - -export const organizeVttPlaylists = (playlists, sidxMapping = {}) => { - return playlists.reduce((a, playlist) => { - const label = playlist.attributes.lang || 'text'; - - if (!a[label]) { - a[label] = { - language: label, - default: false, - autoselect: false, - playlists: [], - uri: '' - }; - } - a[label].playlists.push(addSidxSegmentsToPlaylist(formatVttPlaylist(playlist), sidxMapping)); - - return a; - }, {}); -}; - -const organizeCaptionServices = (captionServices) => captionServices.reduce((svcObj, svc) => { - if (!svc) { - return svcObj; - } - - svc.forEach((service) => { - const { - channel, - language - } = service; - - svcObj[language] = { - autoselect: false, - default: false, - instreamId: channel, - language - }; - - if (service.hasOwnProperty('aspectRatio')) { - svcObj[language].aspectRatio = service.aspectRatio; - } - if (service.hasOwnProperty('easyReader')) { - svcObj[language].easyReader = service.easyReader; - } - if (service.hasOwnProperty('3D')) { - svcObj[language]['3D'] = service['3D']; - } - - }); - - return svcObj; -}, {}); - -export const formatVideoPlaylist = ({ attributes, segments, sidx }) => { - const playlist = { - attributes: { - NAME: attributes.id, - AUDIO: 'audio', - SUBTITLES: 'subs', - RESOLUTION: { - width: attributes.width, - height: attributes.height - }, - CODECS: attributes.codecs, - BANDWIDTH: attributes.bandwidth, - ['PROGRAM-ID']: 1 - }, - uri: '', - endList: (attributes.type || 'static') === 'static', - timeline: attributes.periodIndex, - resolvedUri: '', - targetDuration: attributes.duration, - segments, - mediaSequence: segments.length ? segments[0].number : 1 - }; - - if (attributes.contentProtection) { - playlist.contentProtection = attributes.contentProtection; - } - - if (sidx) { - playlist.sidx = sidx; - } - - return playlist; -}; - -const videoOnly = ({ attributes }) => - attributes.mimeType === 'video/mp4' || attributes.mimeType === 'video/webm' || attributes.contentType === 'video'; -const audioOnly = ({ attributes }) => - attributes.mimeType === 'audio/mp4' || attributes.mimeType === 'audio/webm' || attributes.contentType === 'audio'; -const vttOnly = ({ attributes }) => - attributes.mimeType === 'text/vtt' || attributes.contentType === 'text'; - -export const toM3u8 = (dashPlaylists, locations, sidxMapping = {}) => { - if (!dashPlaylists.length) { - return {}; - } - - // grab all master attributes - const { - sourceDuration: duration, - type = 'static', - suggestedPresentationDelay, - minimumUpdatePeriod - } = dashPlaylists[0].attributes; - - const videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist); - const audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly)); - const vttPlaylists = dashPlaylists.filter(vttOnly); - const captions = dashPlaylists.map((playlist) => playlist.attributes.captionServices).filter(Boolean); - - const master = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: { - AUDIO: {}, - VIDEO: {}, - ['CLOSED-CAPTIONS']: {}, - SUBTITLES: {} - }, - uri: '', - duration, - playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping) - }; - - if (minimumUpdatePeriod >= 0) { - master.minimumUpdatePeriod = minimumUpdatePeriod * 1000; - } - - if (locations) { - master.locations = locations; - } - - if (type === 'dynamic') { - master.suggestedPresentationDelay = suggestedPresentationDelay; - } - - const isAudioOnly = master.playlists.length === 0; - - if (audioPlaylists.length) { - master.mediaGroups.AUDIO.audio = organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly); - } - - if (vttPlaylists.length) { - master.mediaGroups.SUBTITLES.subs = organizeVttPlaylists(vttPlaylists, sidxMapping); - } - - if (captions.length) { - master.mediaGroups['CLOSED-CAPTIONS'].cc = organizeCaptionServices(captions); - } - - return master; -}; diff --git a/node_modules/mpd-parser/src/toPlaylists.js b/node_modules/mpd-parser/src/toPlaylists.js deleted file mode 100644 index de062e3..0000000 --- a/node_modules/mpd-parser/src/toPlaylists.js +++ /dev/null @@ -1,66 +0,0 @@ -import { merge } from './utils/object'; -import { segmentsFromTemplate } from './segment/segmentTemplate'; -import { segmentsFromList } from './segment/segmentList'; -import { segmentsFromBase } from './segment/segmentBase'; - -export const generateSegments = ({ attributes, segmentInfo }) => { - let segmentAttributes; - let segmentsFn; - - if (segmentInfo.template) { - segmentsFn = segmentsFromTemplate; - segmentAttributes = merge(attributes, segmentInfo.template); - - if (segmentInfo.template.presentationTimeOffset) { - segmentAttributes.presentationTimeOffset = - segmentInfo.template.presentationTimeOffset / segmentInfo.template.timescale; - } - - } else if (segmentInfo.base) { - segmentsFn = segmentsFromBase; - segmentAttributes = merge(attributes, segmentInfo.base); - } else if (segmentInfo.list) { - segmentsFn = segmentsFromList; - segmentAttributes = merge(attributes, segmentInfo.list); - } - - const segmentsInfo = { - attributes - }; - - if (!segmentsFn) { - return segmentsInfo; - } - - const segments = segmentsFn(segmentAttributes, segmentInfo.timeline); - - // The @duration attribute will be used to determin the playlist's targetDuration which - // must be in seconds. Since we've generated the segment list, we no longer need - // @duration to be in @timescale units, so we can convert it here. - if (segmentAttributes.duration) { - const { duration, timescale = 1 } = segmentAttributes; - - segmentAttributes.duration = duration / timescale; - } else if (segments.length) { - // if there is no @duration attribute, use the largest segment duration as - // as target duration - segmentAttributes.duration = segments.reduce((max, segment) => { - return Math.max(max, Math.ceil(segment.duration)); - }, 0); - } else { - segmentAttributes.duration = 0; - } - - segmentsInfo.attributes = segmentAttributes; - segmentsInfo.segments = segments; - - // This is a sidx box without actual segment information - if (segmentInfo.base && segmentAttributes.indexRange) { - segmentsInfo.sidx = segments[0]; - segmentsInfo.segments = []; - } - - return segmentsInfo; -}; - -export const toPlaylists = (representations) => representations.map(generateSegments); diff --git a/node_modules/mpd-parser/src/utils/list.js b/node_modules/mpd-parser/src/utils/list.js deleted file mode 100644 index d3c7d37..0000000 --- a/node_modules/mpd-parser/src/utils/list.js +++ /dev/null @@ -1,33 +0,0 @@ -export const range = (start, end) => { - const result = []; - - for (let i = start; i < end; i++) { - result.push(i); - } - - return result; -}; - -export const flatten = lists => lists.reduce((x, y) => x.concat(y), []); - -export const from = list => { - if (!list.length) { - return []; - } - - const result = []; - - for (let i = 0; i < list.length; i++) { - result.push(list[i]); - } - - return result; -}; - -export const findIndexes = (l, key) => l.reduce((a, e, i) => { - if (e[key]) { - a.push(i); - } - - return a; -}, []); diff --git a/node_modules/mpd-parser/src/utils/object.js b/node_modules/mpd-parser/src/utils/object.js deleted file mode 100644 index 1374aa9..0000000 --- a/node_modules/mpd-parser/src/utils/object.js +++ /dev/null @@ -1,27 +0,0 @@ -const isObject = (obj) => { - return !!obj && typeof obj === 'object'; -}; - -export const merge = (...objects) => { - - return objects.reduce((result, source) => { - - if (typeof source !== 'object') { - return result; - } - - Object.keys(source).forEach(key => { - - if (Array.isArray(result[key]) && Array.isArray(source[key])) { - result[key] = result[key].concat(source[key]); - } else if (isObject(result[key]) && isObject(source[key])) { - result[key] = merge(result[key], source[key]); - } else { - result[key] = source[key]; - } - }); - return result; - }, {}); -}; - -export const values = o => Object.keys(o).map(k => o[k]); diff --git a/node_modules/mpd-parser/src/utils/time.js b/node_modules/mpd-parser/src/utils/time.js deleted file mode 100644 index 3164670..0000000 --- a/node_modules/mpd-parser/src/utils/time.js +++ /dev/null @@ -1,39 +0,0 @@ -export const parseDuration = (str) => { - const SECONDS_IN_YEAR = 365 * 24 * 60 * 60; - const SECONDS_IN_MONTH = 30 * 24 * 60 * 60; - const SECONDS_IN_DAY = 24 * 60 * 60; - const SECONDS_IN_HOUR = 60 * 60; - const SECONDS_IN_MIN = 60; - - // P10Y10M10DT10H10M10.1S - const durationRegex = - /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/; - const match = durationRegex.exec(str); - - if (!match) { - return 0; - } - - const [year, month, day, hour, minute, second] = match.slice(1); - - return (parseFloat(year || 0) * SECONDS_IN_YEAR + - parseFloat(month || 0) * SECONDS_IN_MONTH + - parseFloat(day || 0) * SECONDS_IN_DAY + - parseFloat(hour || 0) * SECONDS_IN_HOUR + - parseFloat(minute || 0) * SECONDS_IN_MIN + - parseFloat(second || 0)); -}; - -export const parseDate = (str) => { - // Date format without timezone according to ISO 8601 - // YYY-MM-DDThh:mm:ss.ssssss - const dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/; - - // If the date string does not specifiy a timezone, we must specifiy UTC. This is - // expressed by ending with 'Z' - if (dateRegex.test(str)) { - str += 'Z'; - } - - return Date.parse(str); -}; diff --git a/node_modules/mpd-parser/src/utils/xml.js b/node_modules/mpd-parser/src/utils/xml.js deleted file mode 100644 index f9ea0aa..0000000 --- a/node_modules/mpd-parser/src/utils/xml.js +++ /dev/null @@ -1,6 +0,0 @@ -import { from } from './list'; - -export const findChildren = (element, name) => - from(element.childNodes).filter(({tagName}) => tagName === name); - -export const getContent = element => element.textContent.trim(); diff --git a/node_modules/mpd-parser/test/index.test.js b/node_modules/mpd-parser/test/index.test.js deleted file mode 100644 index 694405b..0000000 --- a/node_modules/mpd-parser/test/index.test.js +++ /dev/null @@ -1,122 +0,0 @@ -import { parse, VERSION } from '../src'; -import QUnit from 'qunit'; - -QUnit.dump.maxDepth = Infinity; - -// manifests -import vttCodecsTemplate from './manifests/vtt_codecs.mpd'; -import maatVttSegmentTemplate from './manifests/maat_vtt_segmentTemplate.mpd'; -import segmentBaseTemplate from './manifests/segmentBase.mpd'; -import segmentListTemplate from './manifests/segmentList.mpd'; -import cc608CaptionsTemplate from './manifests/608-captions.mpd'; -import cc708CaptionsTemplate from './manifests/708-captions.mpd'; -import locationTemplate from './manifests/location.mpd'; -import locationsTemplate from './manifests/locations.mpd'; -import multiperiod from './manifests/multiperiod.mpd'; -import webmsegments from './manifests/webmsegments.mpd'; -import multiperiodDynamic from './manifests/multiperiod-dynamic.mpd'; -import audioOnly from './manifests/audio-only.mpd'; -import { - parsedManifest as maatVttSegmentTemplateManifest -} from './manifests/maat_vtt_segmentTemplate.js'; -import { - parsedManifest as segmentBaseManifest -} from './manifests/segmentBase.js'; -import { - parsedManifest as segmentListManifest -} from './manifests/segmentList.js'; -import { - parsedManifest as cc608CaptionsManifest -} from './manifests/608-captions.js'; -import { - parsedManifest as cc708CaptionsManifest -} from './manifests/708-captions.js'; -import { - parsedManifest as multiperiodManifest -} from './manifests/multiperiod.js'; -import { - parsedManifest as webmsegmentsManifest -} from './manifests/webmsegments.js'; -import { - parsedManifest as multiperiodDynamicManifest -} from './manifests/multiperiod-dynamic.js'; -import { - parsedManifest as locationManifest -} from './manifests/location.js'; -import { - parsedManifest as locationsManifest -} from './manifests/locations.js'; - -import { - parsedManifest as vttCodecsManifest -} from './manifests/vtt_codecs.js'; - -import { - parsedManifest as audioOnlyManifest -} from './manifests/audio-only.js'; - -QUnit.module('mpd-parser'); - -QUnit.test('has VERSION', function(assert) { - assert.ok(VERSION); -}); - -QUnit.test('has parse', function(assert) { - assert.ok(parse); -}); - -[{ - name: 'maat_vtt_segmentTemplate', - input: maatVttSegmentTemplate, - expected: maatVttSegmentTemplateManifest -}, { - name: 'segmentBase', - input: segmentBaseTemplate, - expected: segmentBaseManifest -}, { - name: 'segmentList', - input: segmentListTemplate, - expected: segmentListManifest -}, { - name: '608-captions', - input: cc608CaptionsTemplate, - expected: cc608CaptionsManifest -}, { - name: '708-captions', - input: cc708CaptionsTemplate, - expected: cc708CaptionsManifest -}, { - name: 'multiperiod', - input: multiperiod, - expected: multiperiodManifest -}, { - name: 'webmsegments', - input: webmsegments, - expected: webmsegmentsManifest -}, { - name: 'multiperiod_dynamic', - input: multiperiodDynamic, - expected: multiperiodDynamicManifest -}, { - name: 'location', - input: locationTemplate, - expected: locationManifest -}, { - name: 'locations', - input: locationsTemplate, - expected: locationsManifest -}, { - name: 'vtt_codecs', - input: vttCodecsTemplate, - expected: vttCodecsManifest -}, { - name: 'audio-only', - input: audioOnly, - expected: audioOnlyManifest -}].forEach(({ name, input, expected }) => { - QUnit.test(`${name} test manifest`, function(assert) { - const actual = parse(input); - - assert.deepEqual(actual, expected); - }); -}); diff --git a/node_modules/mpd-parser/test/inheritAttributes.test.js b/node_modules/mpd-parser/test/inheritAttributes.test.js deleted file mode 100644 index 70317d2..0000000 --- a/node_modules/mpd-parser/test/inheritAttributes.test.js +++ /dev/null @@ -1,1758 +0,0 @@ -import { - inheritAttributes, - buildBaseUrls, - parseCaptionServiceMetadata, - getSegmentInformation -} from '../src/inheritAttributes'; -import { stringToMpdXml } from '../src/stringToMpdXml'; -import errors from '../src/errors'; -import QUnit from 'qunit'; -import { toPlaylists } from '../src/toPlaylists'; - -QUnit.module('buildBaseUrls'); - -QUnit.test('returns reference urls when no BaseURL nodes', function(assert) { - const reference = ['https://example.com/', 'https://foo.com/']; - - assert.deepEqual(buildBaseUrls(reference, []), reference, 'returns reference urls'); -}); - -QUnit.test('single reference url with single BaseURL node', function(assert) { - const reference = ['https://example.com']; - const node = [{ textContent: 'bar/' }]; - const expected = ['https://example.com/bar/']; - - assert.deepEqual(buildBaseUrls(reference, node), expected, 'builds base url'); -}); - -QUnit.test('multiple reference urls with single BaseURL node', function(assert) { - const reference = ['https://example.com/', 'https://foo.com/']; - const node = [{ textContent: 'bar/' }]; - const expected = ['https://example.com/bar/', 'https://foo.com/bar/']; - - assert.deepEqual( - buildBaseUrls(reference, node), expected, - 'base url for each reference url' - ); -}); - -QUnit.test('multiple BaseURL nodes with single reference url', function(assert) { - const reference = ['https://example.com/']; - const nodes = [{ textContent: 'bar/' }, { textContent: 'baz/' }]; - const expected = ['https://example.com/bar/', 'https://example.com/baz/']; - - assert.deepEqual(buildBaseUrls(reference, nodes), expected, 'base url for each node'); -}); - -QUnit.test('multiple reference urls with multiple BaseURL nodes', function(assert) { - const reference = ['https://example.com/', 'https://foo.com/', 'http://example.com']; - const nodes = - [{ textContent: 'bar/' }, { textContent: 'baz/' }, { textContent: 'buzz/' }]; - const expected = [ - 'https://example.com/bar/', - 'https://example.com/baz/', - 'https://example.com/buzz/', - 'https://foo.com/bar/', - 'https://foo.com/baz/', - 'https://foo.com/buzz/', - 'http://example.com/bar/', - 'http://example.com/baz/', - 'http://example.com/buzz/' - ]; - - assert.deepEqual(buildBaseUrls(reference, nodes), expected, 'creates all base urls'); -}); - -QUnit.test('absolute BaseURL overwrites reference', function(assert) { - const reference = ['https://example.com']; - const node = [{ textContent: 'https://foo.com/bar/' }]; - const expected = ['https://foo.com/bar/']; - - assert.deepEqual( - buildBaseUrls(reference, node), expected, - 'absolute url overwrites reference' - ); -}); - -QUnit.module('getSegmentInformation'); - -QUnit.test('undefined Segment information when no Segment nodes', function(assert) { - const adaptationSet = { childNodes: [] }; - const expected = {}; - - assert.deepEqual( - getSegmentInformation(adaptationSet), expected, - 'undefined segment info' - ); -}); - -QUnit.test('gets SegmentTemplate attributes', function(assert) { - const adaptationSet = { - childNodes: [{ - tagName: 'SegmentTemplate', - attributes: [{ name: 'media', value: 'video.mp4' }], - childNodes: [] - }] - }; - const expected = { - template: { media: 'video.mp4' } - }; - - assert.deepEqual( - getSegmentInformation(adaptationSet), expected, - 'SegmentTemplate info' - ); -}); - -QUnit.test('gets SegmentList attributes', function(assert) { - const adaptationSet = { - childNodes: [{ - tagName: 'SegmentList', - attributes: [{ name: 'duration', value: '10' }], - childNodes: [] - }] - }; - const expected = { - list: { - duration: 10, - segmentUrls: [], - initialization: {} - } - }; - - assert.deepEqual( - getSegmentInformation(adaptationSet), expected, - 'SegmentList info' - ); -}); - -QUnit.test('gets SegmentBase attributes', function(assert) { - const adaptationSet = { - childNodes: [{ - tagName: 'SegmentBase', - attributes: [{ name: 'duration', value: '10' }], - childNodes: [] - }] - }; - const expected = { - base: { duration: 10, initialization: {} } - }; - - assert.deepEqual( - getSegmentInformation(adaptationSet), expected, - 'SegmentBase info' - ); -}); - -QUnit.test('gets SegmentTemplate and SegmentTimeline attributes', function(assert) { - const adaptationSet = { - childNodes: [{ - tagName: 'SegmentTemplate', - attributes: [{ name: 'media', value: 'video.mp4' }], - childNodes: [{ - tagName: 'SegmentTimeline', - childNodes: [{ - tagName: 'S', - attributes: [{ name: 'd', value: '10' }] - }, { - tagName: 'S', - attributes: [{ name: 'd', value: '5' }] - }, { - tagName: 'S', - attributes: [{ name: 'd', value: '7' }] - }] - }] - }] - }; - const expected = { - template: { media: 'video.mp4' }, - timeline: [{ d: 10 }, { d: 5 }, { d: 7 }] - }; - - assert.deepEqual( - getSegmentInformation(adaptationSet), expected, - 'SegmentTemplate and SegmentTimeline info' - ); -}); - -QUnit.module('caption service metadata'); - -QUnit.test('parsed 608 metadata', function(assert) { - const getmd = (value) => ({ - schemeIdUri: 'urn:scte:dash:cc:cea-608:2015', - value - }); - - const assertServices = (services, expected, message) => { - if (!services) { - assert.notOk(expected, message); - return; - } - - services.forEach((service, i) => { - assert.deepEqual(service, expected[i], message); - }); - }; - - assertServices(parseCaptionServiceMetadata({ - schemeIdUri: 'random scheme', - value: 'CC1' - }), undefined, 'dont parse incorrect scheme ID for 608'); - assertServices(parseCaptionServiceMetadata(getmd('CC1')), [{ - channel: 'CC1', - language: 'CC1' - }], 'CC1'); - assertServices(parseCaptionServiceMetadata(getmd('CC2')), [{ - channel: 'CC2', - language: 'CC2' - }], 'CC2'); - assertServices(parseCaptionServiceMetadata(getmd('English')), [{ - channel: undefined, - language: 'English' - }], 'English'); - assertServices(parseCaptionServiceMetadata(getmd('CC1;CC2')), [{ - channel: 'CC1', - language: 'CC1' - }, { - channel: 'CC2', - language: 'CC2' - }], 'CC1;CC2'); - assertServices(parseCaptionServiceMetadata(getmd('CC1=eng;CC3=swe')), [{ - channel: 'CC1', - language: 'eng' - }, { - channel: 'CC3', - language: 'swe' - }], 'CC1=eng;CC3=swe'); - assertServices(parseCaptionServiceMetadata(getmd('CC1=Hello;CC3=World')), [{ - channel: 'CC1', - language: 'Hello' - }, { - channel: 'CC3', - language: 'World' - }], 'CC1=Hello;CC3=World'); - assertServices(parseCaptionServiceMetadata(getmd('eng;swe')), [{ - channel: undefined, - language: 'eng' - }, { - channel: undefined, - language: 'swe' - }], 'eng;CC3'); -}); - -QUnit.test('parsed 708 metadata', function(assert) { - const getmd = (value) => ({ - schemeIdUri: 'urn:scte:dash:cc:cea-708:2015', - value - }); - - const assertServices = (services, expected, message) => { - if (!services) { - assert.notOk(expected, message); - return; - } - - services.forEach((service, i) => { - assert.deepEqual(service, expected[i], message); - }); - }; - - assertServices(parseCaptionServiceMetadata({ - schemeIdUri: 'random scheme', - value: 'eng' - }), undefined, 'dont parse incorrect scheme for 708'); - - assertServices(parseCaptionServiceMetadata(getmd('eng')), [{ - 'channel': undefined, - 'language': 'eng', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }], 'simple eng'); - - assertServices(parseCaptionServiceMetadata(getmd('eng;swe')), [{ - 'channel': undefined, - 'language': 'eng', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'swe', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }], 'eng;swe'); - - assertServices(parseCaptionServiceMetadata(getmd('1=lang:eng;2=lang:swe')), [{ - 'channel': 'SERVICE1', - 'language': 'eng', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': 'SERVICE2', - 'language': 'swe', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }], '1=lang:eng;2=lang:swe'); - - assertServices(parseCaptionServiceMetadata(getmd('1=lang:eng;swe')), [{ - 'channel': 'SERVICE1', - 'language': 'eng', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'swe', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }], 'mixed 1=lang:eng;swe'); - - assertServices(parseCaptionServiceMetadata(getmd('1=lang:eng;2=lang:eng,war:1,er:1')), [{ - 'channel': 'SERVICE1', - 'language': 'eng', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': 'SERVICE2', - 'language': 'eng', - 'aspectRatio': 1, - 'easyReader': 1, - '3D': 0 - }], '1=lang:eng;2=lang:eng,war:1,er:1'); - - assertServices(parseCaptionServiceMetadata(getmd('1=lang:eng,war:0;2=lang:eng,3D:1,er:1')), [{ - 'channel': 'SERVICE1', - 'language': 'eng', - 'aspectRatio': 0, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': 'SERVICE2', - 'language': 'eng', - 'aspectRatio': 1, - 'easyReader': 1, - '3D': 1 - }], '1=lang:eng,war:0;2=lang:eng,3D:1,er:1'); - - assertServices(parseCaptionServiceMetadata(getmd('eng;fre;spa;jpn;deu;swe;kor;lat;zho;heb;rus;ara;hin;por;tur')), [{ - 'channel': undefined, - 'language': 'eng', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'fre', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'spa', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'jpn', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'deu', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'swe', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'kor', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'lat', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'zho', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'heb', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'rus', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'ara', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'hin', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'por', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }, { - 'channel': undefined, - 'language': 'tur', - 'aspectRatio': 1, - 'easyReader': 0, - '3D': 0 - }], 'make sure that parsing 15 services works'); -}); - -QUnit.module('inheritAttributes'); - -QUnit.test('needs at least one Period', function(assert) { - assert.throws( - () => inheritAttributes(stringToMpdXml('')), - new RegExp(errors.INVALID_NUMBER_OF_PERIOD) - ); -}); - -QUnit.test('end to end - basic', function(assert) { - const NOW = Date.now(); - - const actual = inheritAttributes(stringToMpdXml(` - - https://www.example.com/base/ - - - - - - - - - - https://example.com/en.vtt - - - - - `), { NOW }); - - const expected = { - locations: undefined, - representationInfo: [{ - attributes: { - bandwidth: 5000000, - baseUrl: 'https://www.example.com/base/', - codecs: 'avc1.64001e', - height: 404, - id: 'test', - mediaPresentationDuration: 30, - mimeType: 'video/mp4', - periodIndex: 0, - role: { - value: 'main' - }, - sourceDuration: 30, - width: 720, - NOW, - clientOffset: 0 - }, - segmentInfo: { - template: {} - } - }, { - attributes: { - bandwidth: 256, - baseUrl: 'https://example.com/en.vtt', - id: 'en', - lang: 'en', - mediaPresentationDuration: 30, - mimeType: 'text/vtt', - periodIndex: 0, - role: {}, - sourceDuration: 30, - NOW, - clientOffset: 0 - }, - segmentInfo: {} - }] - }; - - assert.equal(actual.representationInfo.length, 2); - assert.deepEqual(actual, expected); -}); - -QUnit.test('end to end - inherits BaseURL from all levels', function(assert) { - const NOW = Date.now(); - - const actual = inheritAttributes(stringToMpdXml(` - - https://www.example.com/base/ - - foo/ - - bar/ - - - - buzz/ - - - - - https://example.com/en.vtt - - - - - `), { NOW }); - - const expected = { - locations: undefined, - representationInfo: [{ - attributes: { - bandwidth: 5000000, - baseUrl: 'https://www.example.com/base/foo/bar/buzz/', - clientOffset: 0, - codecs: 'avc1.64001e', - height: 404, - id: 'test', - mediaPresentationDuration: 30, - mimeType: 'video/mp4', - periodIndex: 0, - role: { - value: 'main' - }, - sourceDuration: 30, - width: 720, - NOW - }, - segmentInfo: { - template: {} - } - }, { - attributes: { - bandwidth: 256, - baseUrl: 'https://example.com/en.vtt', - id: 'en', - lang: 'en', - mediaPresentationDuration: 30, - mimeType: 'text/vtt', - periodIndex: 0, - role: {}, - sourceDuration: 30, - NOW, - clientOffset: 0 - }, - segmentInfo: { } - }] - }; - - assert.equal(actual.representationInfo.length, 2); - assert.deepEqual(actual, expected); -}); - -QUnit.test('end to end - alternate BaseURLs', function(assert) { - const NOW = Date.now(); - const actual = inheritAttributes(stringToMpdXml(` - - https://www.example.com/base/ - https://www.test.com/base/ - - - segments/ - media/ - - - - - - - - https://example.com/en.vtt - - - - - `), { NOW }); - - const expected = { - locations: undefined, - representationInfo: [{ - attributes: { - bandwidth: 5000000, - baseUrl: 'https://www.example.com/base/segments/', - codecs: 'avc1.64001e', - height: 404, - id: 'test', - mediaPresentationDuration: 30, - mimeType: 'video/mp4', - periodIndex: 0, - role: { - value: 'main' - }, - sourceDuration: 30, - width: 720, - NOW, - clientOffset: 0 - }, - segmentInfo: { - template: {} - } - }, { - attributes: { - bandwidth: 5000000, - baseUrl: 'https://www.example.com/base/media/', - codecs: 'avc1.64001e', - height: 404, - id: 'test', - mediaPresentationDuration: 30, - mimeType: 'video/mp4', - periodIndex: 0, - role: { - value: 'main' - }, - sourceDuration: 30, - width: 720, - NOW, - clientOffset: 0 - }, - segmentInfo: { - template: {} - } - }, { - attributes: { - bandwidth: 5000000, - baseUrl: 'https://www.test.com/base/segments/', - codecs: 'avc1.64001e', - height: 404, - id: 'test', - mediaPresentationDuration: 30, - mimeType: 'video/mp4', - periodIndex: 0, - role: { - value: 'main' - }, - sourceDuration: 30, - width: 720, - NOW, - clientOffset: 0 - }, - segmentInfo: { - template: {} - } - }, { - attributes: { - bandwidth: 5000000, - baseUrl: 'https://www.test.com/base/media/', - codecs: 'avc1.64001e', - height: 404, - id: 'test', - mediaPresentationDuration: 30, - mimeType: 'video/mp4', - periodIndex: 0, - role: { - value: 'main' - }, - sourceDuration: 30, - width: 720, - NOW, - clientOffset: 0 - }, - segmentInfo: { - template: {} - } - }, { - attributes: { - bandwidth: 256, - baseUrl: 'https://example.com/en.vtt', - id: 'en', - lang: 'en', - mediaPresentationDuration: 30, - mimeType: 'text/vtt', - periodIndex: 0, - role: {}, - sourceDuration: 30, - NOW, - clientOffset: 0 - }, - segmentInfo: {} - }, { - attributes: { - bandwidth: 256, - baseUrl: 'https://example.com/en.vtt', - id: 'en', - lang: 'en', - mediaPresentationDuration: 30, - mimeType: 'text/vtt', - periodIndex: 0, - role: {}, - sourceDuration: 30, - NOW, - clientOffset: 0 - }, - segmentInfo: {} - }] - }; - - assert.equal(actual.representationInfo.length, 6); - assert.deepEqual(actual, expected); -}); - -QUnit.test( - ' End to End test for checking support of segments in representation', - function(assert) { - const NOW = Date.now(); - const actual = inheritAttributes(stringToMpdXml(` - - https://www.example.com/base/ - - - - - - - - - - - - - - - - - - https://example.com/en.vtt - - - - - `), { NOW }); - - const expected = { - locations: undefined, - representationInfo: [{ - attributes: { - bandwidth: 5000000, - baseUrl: 'https://www.example.com/base/', - codecs: 'avc1.64001e', - height: 404, - id: 'test', - mediaPresentationDuration: 30, - mimeType: 'video/mp6', - periodIndex: 0, - role: { - value: 'main' - }, - sourceDuration: 30, - width: 720, - NOW, - clientOffset: 0 - }, - segmentInfo: { - base: { - indexRange: '820-2087', - indexRangeExact: 'true', - initialization: { - range: '0-567' - } - } - } - }, { - attributes: { - baseUrl: 'https://www.example.com/base/', - mediaPresentationDuration: 30, - mimeType: 'video/mp4', - periodIndex: 0, - height: 545, - role: { - value: 'main' - }, - sourceDuration: 30, - NOW, - clientOffset: 0 - }, - segmentInfo: { - base: { - indexRange: '820-2087', - indexRangeExact: 'true', - initialization: { - range: '0-987' - } - } - } - }, { - attributes: { - bandwidth: 256, - baseUrl: 'https://example.com/en.vtt', - id: 'en', - lang: 'en', - mediaPresentationDuration: 30, - mimeType: 'text/vtt', - periodIndex: 0, - role: {}, - sourceDuration: 30, - NOW, - clientOffset: 0 - }, - segmentInfo: {} - }] - }; - - assert.equal(actual.representationInfo.length, 3); - assert.deepEqual(actual, expected); - } -); - -QUnit.test( - ' End to End test for checking support of segments in period ', - function(assert) { - const NOW = Date.now(); - const actual = inheritAttributes(stringToMpdXml(` - - https://www.example.com/base/ - - - - - - - - - - - - - - https://example.com/en.vtt - - - - - `), { NOW }); - - const expected = { - locations: undefined, - representationInfo: [{ - attributes: { - bandwidth: 5000000, - baseUrl: 'https://www.example.com/base/', - codecs: 'avc1.64001e', - height: 404, - id: 'test', - mediaPresentationDuration: 30, - mimeType: 'video/mp6', - periodIndex: 0, - role: { - value: 'main' - }, - sourceDuration: 30, - width: 720, - NOW, - clientOffset: 0 - }, - segmentInfo: { - base: { - indexRange: '9999', - indexRangeExact: 'false', - initialization: { - range: '0-1111' - } - } - } - }, { - attributes: { - baseUrl: 'https://www.example.com/base/', - mediaPresentationDuration: 30, - mimeType: 'video/mp4', - periodIndex: 0, - height: 545, - role: { - value: 'main' - }, - sourceDuration: 30, - NOW, - clientOffset: 0 - }, - segmentInfo: { - base: { - indexRange: '9999', - indexRangeExact: 'false', - initialization: { - range: '0-1111' - } - } - } - }, { - attributes: { - bandwidth: 256, - baseUrl: 'https://example.com/en.vtt', - id: 'en', - lang: 'en', - mediaPresentationDuration: 30, - mimeType: 'text/vtt', - periodIndex: 0, - role: {}, - sourceDuration: 30, - NOW, - clientOffset: 0 - }, - segmentInfo: { - base: { - indexRange: '9999', - indexRangeExact: 'false', - initialization: { - range: '0-1111' - } - } - } - }] - }; - - assert.equal(actual.representationInfo.length, 3); - assert.deepEqual(actual, expected); - } -); - -QUnit.test( - ' End to End test for checking support of Segments in Adaptation set', - function(assert) { - const NOW = Date.now(); - const actual = inheritAttributes(stringToMpdXml(` - - https://www.example.com/base/ - - - - - - - - - - - - - - https://example.com/en.vtt - - - - - `), { NOW }); - - const expected = { - locations: undefined, - representationInfo: [{ - attributes: { - bandwidth: 5000000, - baseUrl: 'https://www.example.com/base/', - codecs: 'avc1.64001e', - height: 404, - id: 'test', - mediaPresentationDuration: 30, - mimeType: 'video/mp6', - periodIndex: 0, - role: { - value: 'main' - }, - sourceDuration: 30, - width: 720, - NOW, - clientOffset: 0 - }, - segmentInfo: { - base: { - indexRange: '1212', - indexRangeExact: 'true', - initialization: { - range: '0-8888' - - } - } - } - }, { - attributes: { - baseUrl: 'https://www.example.com/base/', - mediaPresentationDuration: 30, - mimeType: 'video/mp4', - periodIndex: 0, - height: 545, - role: { - value: 'main' - }, - sourceDuration: 30, - NOW, - clientOffset: 0 - }, - segmentInfo: { - base: { - indexRange: '1212', - indexRangeExact: 'true', - initialization: { - range: '0-8888' - } - } - } - }, { - attributes: { - bandwidth: 256, - baseUrl: 'https://example.com/en.vtt', - id: 'en', - lang: 'en', - mediaPresentationDuration: 30, - mimeType: 'text/vtt', - periodIndex: 0, - role: {}, - sourceDuration: 30, - NOW, - clientOffset: 0 - }, - segmentInfo: {} - }] - }; - - assert.equal(actual.representationInfo.length, 3); - assert.deepEqual(actual, expected); - } -); - -// Although according to the Spec, at most one set of Segment information should be -// present at each level, this test would still handle the case and prevent errors if -// multiple set of segment information are present at any particular level. - -QUnit.test( - 'Test for checking use of only one set of Segment Information when multiple are present', - function(assert) { - const NOW = Date.now(); - const actual = toPlaylists(inheritAttributes(stringToMpdXml(` - - https://www.example.com/base - - - - - - - - - - - - - - - - - - - - - - `), { NOW }).representationInfo); - - const expected = [{ - attributes: { - NOW, - bandwidth: 5000000, - baseUrl: 'https://www.example.com/base', - duration: 1.984, - codecs: 'avc1.64001e', - height: 404, - id: '125000', - lang: 'es', - mediaPresentationDuration: 30, - mimeType: 'video/mp6', - periodIndex: 0, - startNumber: 0, - timescale: 48000, - role: { - value: 'main' - }, - clientOffset: 0, - initialization: { - sourceURL: '$RepresentationID$/es/init.m4f' - }, - media: '$RepresentationID$/es/$Number$.m4f', - segmentAlignment: 'true', - sourceDuration: 30, - width: 720, - startWithSAP: '1' - }, - segments: [{ - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/0.m4f', - timeline: 0, - uri: '125000/es/0.m4f', - number: 0 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/1.m4f', - timeline: 0, - uri: '125000/es/1.m4f', - number: 1 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/2.m4f', - timeline: 0, - uri: '125000/es/2.m4f', - number: 2 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/3.m4f', - timeline: 0, - uri: '125000/es/3.m4f', - number: 3 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/4.m4f', - timeline: 0, - uri: '125000/es/4.m4f', - number: 4 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/5.m4f', - timeline: 0, - uri: '125000/es/5.m4f', - number: 5 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/6.m4f', - timeline: 0, - uri: '125000/es/6.m4f', - number: 6 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/7.m4f', - timeline: 0, - uri: '125000/es/7.m4f', - number: 7 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/8.m4f', - timeline: 0, - uri: '125000/es/8.m4f', - number: 8 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/9.m4f', - timeline: 0, - uri: '125000/es/9.m4f', - number: 9 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/10.m4f', - timeline: 0, - uri: '125000/es/10.m4f', - number: 10 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/11.m4f', - timeline: 0, - uri: '125000/es/11.m4f', - number: 11 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/12.m4f', - timeline: 0, - uri: '125000/es/12.m4f', - number: 12 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/13.m4f', - timeline: 0, - uri: '125000/es/13.m4f', - number: 13 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/14.m4f', - timeline: 0, - uri: '125000/es/14.m4f', - number: 14 - }, { - duration: 0.240000000000002, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/15.m4f', - timeline: 0, - uri: '125000/es/15.m4f', - number: 15 - }] - }, { - attributes: { - NOW, - baseUrl: 'https://www.example.com/base', - duration: 1.984, - lang: 'es', - height: 545, - id: '125000', - mediaPresentationDuration: 30, - mimeType: 'video/mp4', - periodIndex: 0, - role: { - value: 'main' - }, - segmentAlignment: 'true', - sourceDuration: 30, - startWithSAP: '1', - clientOffset: 0, - initialization: { - sourceURL: '$RepresentationID$/es/init.m4f' - }, - media: '$RepresentationID$/es/$Number$.m4f', - startNumber: 0, - timescale: 48000 - }, - segments: [{ - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/0.m4f', - timeline: 0, - uri: '125000/es/0.m4f', - number: 0 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/1.m4f', - timeline: 0, - uri: '125000/es/1.m4f', - number: 1 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/2.m4f', - timeline: 0, - uri: '125000/es/2.m4f', - number: 2 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/3.m4f', - timeline: 0, - uri: '125000/es/3.m4f', - number: 3 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/4.m4f', - timeline: 0, - uri: '125000/es/4.m4f', - number: 4 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/5.m4f', - timeline: 0, - uri: '125000/es/5.m4f', - number: 5 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/6.m4f', - timeline: 0, - uri: '125000/es/6.m4f', - number: 6 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/7.m4f', - timeline: 0, - uri: '125000/es/7.m4f', - number: 7 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/8.m4f', - timeline: 0, - uri: '125000/es/8.m4f', - number: 8 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/9.m4f', - timeline: 0, - uri: '125000/es/9.m4f', - number: 9 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/10.m4f', - timeline: 0, - uri: '125000/es/10.m4f', - number: 10 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/11.m4f', - timeline: 0, - uri: '125000/es/11.m4f', - number: 11 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/12.m4f', - timeline: 0, - uri: '125000/es/12.m4f', - number: 12 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/13.m4f', - timeline: 0, - uri: '125000/es/13.m4f', - number: 13 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/14.m4f', - timeline: 0, - uri: '125000/es/14.m4f', - number: 14 - }, { - duration: 0.240000000000002, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/15.m4f', - timeline: 0, - uri: '125000/es/15.m4f', - number: 15 - }] - }]; - - assert.equal(actual.length, 2); - assert.deepEqual(actual, expected); - } -); - -// Although the Spec states that if SegmentTemplate or SegmentList is present on one -// level of the hierarchy the other one shall not be present on any lower level, this -// test would still handle the case if both are present in the hierarchy and would -// prevent throwing errors. - -QUnit.test('Test to check use of either Segment Template or Segment List when both are' + -' present in the hierarchy', function(assert) { - const NOW = Date.now(); - const actual = toPlaylists(inheritAttributes(stringToMpdXml(` - - https://www.example.com/base - - - - - - - - - - - - - - - - - - - - `), { NOW }).representationInfo); - - const expected = [{ - attributes: { - NOW, - clientOffset: 0, - initialization: { - sourceURL: '$RepresentationID$/es/init.m4f' - }, - media: '$RepresentationID$/es/$Number$.m4f', - bandwidth: 5000000, - baseUrl: 'https://www.example.com/base', - duration: 1.984, - codecs: 'avc1.64001e', - height: 404, - id: '125000', - lang: 'es', - mediaPresentationDuration: 30, - mimeType: 'video/mp6', - periodIndex: 0, - role: { - value: 'main' - }, - segmentAlignment: 'true', - sourceDuration: 30, - width: 720, - startWithSAP: '1', - startNumber: 0, - timescale: 48000 - }, - segments: [{ - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/0.m4f', - timeline: 0, - uri: '125000/es/0.m4f', - number: 0 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/1.m4f', - timeline: 0, - uri: '125000/es/1.m4f', - number: 1 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/2.m4f', - timeline: 0, - uri: '125000/es/2.m4f', - number: 2 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/3.m4f', - timeline: 0, - uri: '125000/es/3.m4f', - number: 3 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/4.m4f', - timeline: 0, - uri: '125000/es/4.m4f', - number: 4 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/5.m4f', - timeline: 0, - uri: '125000/es/5.m4f', - number: 5 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/6.m4f', - timeline: 0, - uri: '125000/es/6.m4f', - number: 6 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/7.m4f', - timeline: 0, - uri: '125000/es/7.m4f', - number: 7 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/8.m4f', - timeline: 0, - uri: '125000/es/8.m4f', - number: 8 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/9.m4f', - timeline: 0, - uri: '125000/es/9.m4f', - number: 9 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/10.m4f', - timeline: 0, - uri: '125000/es/10.m4f', - number: 10 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/11.m4f', - timeline: 0, - uri: '125000/es/11.m4f', - number: 11 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/12.m4f', - timeline: 0, - uri: '125000/es/12.m4f', - number: 12 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/13.m4f', - timeline: 0, - uri: '125000/es/13.m4f', - number: 13 - }, { - duration: 1.984, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/14.m4f', - timeline: 0, - uri: '125000/es/14.m4f', - number: 14 - }, { - duration: 0.240000000000002, - map: { - resolvedUri: 'https://www.example.com/125000/es/init.m4f', - uri: '125000/es/init.m4f' - }, - resolvedUri: 'https://www.example.com/125000/es/15.m4f', - timeline: 0, - uri: '125000/es/15.m4f', - number: 15 - }] - }]; - - assert.equal(actual.length, 1); - assert.deepEqual(actual, expected); -}); - diff --git a/node_modules/mpd-parser/test/manifests/608-captions.js b/node_modules/mpd-parser/test/manifests/608-captions.js deleted file mode 100644 index 1006178..0000000 --- a/node_modules/mpd-parser/test/manifests/608-captions.js +++ /dev/null @@ -1,70 +0,0 @@ -export const parsedManifest = { - allowCache: true, - discontinuityStarts: [], - duration: 6, - endList: true, - mediaGroups: { - 'AUDIO': {}, - 'CLOSED-CAPTIONS': { - cc: { - eng: { - autoselect: false, - default: false, - instreamId: 'CC1', - language: 'eng' - }, - swe: { - autoselect: false, - default: false, - instreamId: 'CC3', - language: 'swe' - }, - Hello: { - autoselect: false, - default: false, - instreamId: 'CC4', - language: 'Hello' - } - } - }, - 'SUBTITLES': {}, - 'VIDEO': {} - }, - playlists: [ - { - attributes: { - 'AUDIO': 'audio', - 'BANDWIDTH': 449000, - 'CODECS': 'avc1.420015', - 'NAME': '482', - 'PROGRAM-ID': 1, - 'RESOLUTION': { - height: 270, - width: 482 - }, - 'SUBTITLES': 'subs' - }, - endList: true, - resolvedUri: '', - targetDuration: 6, - mediaSequence: 0, - segments: [ - { - duration: 6, - timeline: 0, - number: 0, - map: { - uri: '', - resolvedUri: 'https://www.example.com/1080p.ts' - }, - resolvedUri: 'https://www.example.com/1080p.ts', - uri: 'https://www.example.com/1080p.ts' - } - ], - timeline: 0, - uri: '' - } - ], - segments: [], - uri: '' -}; diff --git a/node_modules/mpd-parser/test/manifests/608-captions.mpd b/node_modules/mpd-parser/test/manifests/608-captions.mpd deleted file mode 100644 index 499f72e..0000000 --- a/node_modules/mpd-parser/test/manifests/608-captions.mpd +++ /dev/null @@ -1,17 +0,0 @@ - - - https://www.example.com/base - - - - - - - - 1080p.ts - - - - - - diff --git a/node_modules/mpd-parser/test/manifests/708-captions.js b/node_modules/mpd-parser/test/manifests/708-captions.js deleted file mode 100644 index eae5dfd..0000000 --- a/node_modules/mpd-parser/test/manifests/708-captions.js +++ /dev/null @@ -1,71 +0,0 @@ -export const parsedManifest = { - allowCache: true, - discontinuityStarts: [], - duration: 6, - endList: true, - mediaGroups: { - 'AUDIO': {}, - 'CLOSED-CAPTIONS': { - cc: { - // eng: { - // autoselect: false, - // default: false, - // instreamId: '1', - // language: 'eng', - // aspectRatio: 1, - // easyReader: 0, - // '3D': 0 - // }, - // TODO only this one ends up being represented and not both - eng: { - 'autoselect': false, - 'default': false, - 'instreamId': 'SERVICE2', - 'language': 'eng', - 'aspectRatio': 1, - 'easyReader': 1, - '3D': 0 - } - } - }, - 'SUBTITLES': {}, - 'VIDEO': {} - }, - playlists: [ - { - attributes: { - 'AUDIO': 'audio', - 'BANDWIDTH': 449000, - 'CODECS': 'avc1.420015', - 'NAME': '482', - 'PROGRAM-ID': 1, - 'RESOLUTION': { - height: 270, - width: 482 - }, - 'SUBTITLES': 'subs' - }, - endList: true, - resolvedUri: '', - targetDuration: 6, - mediaSequence: 0, - segments: [ - { - duration: 6, - timeline: 0, - number: 0, - map: { - uri: '', - resolvedUri: 'https://www.example.com/1080p.ts' - }, - resolvedUri: 'https://www.example.com/1080p.ts', - uri: 'https://www.example.com/1080p.ts' - } - ], - timeline: 0, - uri: '' - } - ], - segments: [], - uri: '' -}; diff --git a/node_modules/mpd-parser/test/manifests/708-captions.mpd b/node_modules/mpd-parser/test/manifests/708-captions.mpd deleted file mode 100644 index fc71f2b..0000000 --- a/node_modules/mpd-parser/test/manifests/708-captions.mpd +++ /dev/null @@ -1,17 +0,0 @@ - - - https://www.example.com/base - - - - - - - - 1080p.ts - - - - - - diff --git a/node_modules/mpd-parser/test/manifests/audio-only.js b/node_modules/mpd-parser/test/manifests/audio-only.js deleted file mode 100644 index 74ecc87..0000000 --- a/node_modules/mpd-parser/test/manifests/audio-only.js +++ /dev/null @@ -1,106 +0,0 @@ -export const parsedManifest = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: { - 'AUDIO': { - audio: { - en: { - language: 'en', - autoselect: true, - default: true, - playlists: [ - { - attributes: { - 'NAME': '0', - 'BANDWIDTH': 130803, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1, - 'AUDIO': 'audio', - 'SUBTITLES': 'subs' - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 60, - segments: [], - mediaSequence: 1, - sidx: { - uri: 'http://example.com/audio_en_2c_128k_aac.mp4', - resolvedUri: 'http://example.com/audio_en_2c_128k_aac.mp4', - byterange: { - length: 224, - offset: 786 - }, - map: { - uri: '', - resolvedUri: 'http://example.com/audio_en_2c_128k_aac.mp4', - byterange: { - length: 786, - offset: 0 - } - }, - duration: 60, - timeline: 0, - number: 0 - } - } - ], - uri: '' - }, - es: { - language: 'es', - autoselect: true, - default: false, - playlists: [ - { - attributes: { - 'NAME': '1', - 'BANDWIDTH': 130405, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1, - 'AUDIO': 'audio', - 'SUBTITLES': 'subs' - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 60, - segments: [], - mediaSequence: 1, - sidx: { - uri: 'http://example.com/audio_es_2c_128k_aac.mp4', - resolvedUri: 'http://example.com/audio_es_2c_128k_aac.mp4', - byterange: { - length: 224, - offset: 786 - }, - map: { - uri: '', - resolvedUri: 'http://example.com/audio_es_2c_128k_aac.mp4', - byterange: { - length: 786, - offset: 0 - } - }, - duration: 60, - timeline: 0, - number: 0 - } - } - ], - uri: '' - } - } - }, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - uri: '', - duration: 60, - playlists: [] -}; diff --git a/node_modules/mpd-parser/test/manifests/audio-only.mpd b/node_modules/mpd-parser/test/manifests/audio-only.mpd deleted file mode 100644 index bb12b3d..0000000 --- a/node_modules/mpd-parser/test/manifests/audio-only.mpd +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - http://example.com/audio_en_2c_128k_aac.mp4 - - - - - - - - - http://example.com/audio_es_2c_128k_aac.mp4 - - - - - - - - diff --git a/node_modules/mpd-parser/test/manifests/location.js b/node_modules/mpd-parser/test/manifests/location.js deleted file mode 100644 index 5108de7..0000000 --- a/node_modules/mpd-parser/test/manifests/location.js +++ /dev/null @@ -1,52 +0,0 @@ -export const parsedManifest = { - locations: [ - 'https://www.example.com/updates' - ], - allowCache: true, - discontinuityStarts: [], - duration: 6, - endList: true, - mediaGroups: { - 'AUDIO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {}, - 'VIDEO': {} - }, - playlists: [ - { - attributes: { - 'AUDIO': 'audio', - 'BANDWIDTH': 449000, - 'CODECS': 'avc1.420015', - 'NAME': '482', - 'PROGRAM-ID': 1, - 'RESOLUTION': { - height: 270, - width: 482 - }, - 'SUBTITLES': 'subs' - }, - endList: true, - resolvedUri: '', - targetDuration: 6, - mediaSequence: 0, - segments: [ - { - duration: 6, - timeline: 0, - number: 0, - map: { - uri: '', - resolvedUri: 'https://www.example.com/1080p.ts' - }, - resolvedUri: 'https://www.example.com/1080p.ts', - uri: 'https://www.example.com/1080p.ts' - } - ], - timeline: 0, - uri: '' - } - ], - segments: [], - uri: '' -}; diff --git a/node_modules/mpd-parser/test/manifests/location.mpd b/node_modules/mpd-parser/test/manifests/location.mpd deleted file mode 100644 index d686b6f..0000000 --- a/node_modules/mpd-parser/test/manifests/location.mpd +++ /dev/null @@ -1,17 +0,0 @@ - - - https://www.example.com/base - https://www.example.com/updates - - - - - - - 1080p.ts - - - - - - diff --git a/node_modules/mpd-parser/test/manifests/locations.js b/node_modules/mpd-parser/test/manifests/locations.js deleted file mode 100644 index d3e4076..0000000 --- a/node_modules/mpd-parser/test/manifests/locations.js +++ /dev/null @@ -1,53 +0,0 @@ -export const parsedManifest = { - locations: [ - 'https://www.example.com/updates', - 'https://www.example.com/updates2' - ], - allowCache: true, - discontinuityStarts: [], - duration: 6, - endList: true, - mediaGroups: { - 'AUDIO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {}, - 'VIDEO': {} - }, - playlists: [ - { - attributes: { - 'AUDIO': 'audio', - 'BANDWIDTH': 449000, - 'CODECS': 'avc1.420015', - 'NAME': '482', - 'PROGRAM-ID': 1, - 'RESOLUTION': { - height: 270, - width: 482 - }, - 'SUBTITLES': 'subs' - }, - endList: true, - resolvedUri: '', - targetDuration: 6, - mediaSequence: 0, - segments: [ - { - duration: 6, - timeline: 0, - number: 0, - map: { - uri: '', - resolvedUri: 'https://www.example.com/1080p.ts' - }, - resolvedUri: 'https://www.example.com/1080p.ts', - uri: 'https://www.example.com/1080p.ts' - } - ], - timeline: 0, - uri: '' - } - ], - segments: [], - uri: '' -}; diff --git a/node_modules/mpd-parser/test/manifests/locations.mpd b/node_modules/mpd-parser/test/manifests/locations.mpd deleted file mode 100644 index 9bd635f..0000000 --- a/node_modules/mpd-parser/test/manifests/locations.mpd +++ /dev/null @@ -1,18 +0,0 @@ - - - https://www.example.com/base - https://www.example.com/updates - https://www.example.com/updates2 - - - - - - - 1080p.ts - - - - - - diff --git a/node_modules/mpd-parser/test/manifests/maat_vtt_segmentTemplate.js b/node_modules/mpd-parser/test/manifests/maat_vtt_segmentTemplate.js deleted file mode 100644 index 0f628d0..0000000 --- a/node_modules/mpd-parser/test/manifests/maat_vtt_segmentTemplate.js +++ /dev/null @@ -1,518 +0,0 @@ -export const parsedManifest = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: { - 'AUDIO': { - audio: { - 'en (main)': { - language: 'en', - autoselect: true, - default: true, - playlists: [ - { - attributes: { - 'NAME': '63000', - 'BANDWIDTH': 63000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.984, - segments: [ - { - uri: '63000/0.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/0.m4f', - map: { - uri: '63000/init.m4f', - resolvedUri: 'https://www.example.com/63000/init.m4f' - }, - number: 0 - }, - { - uri: '63000/1.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/1.m4f', - map: { - uri: '63000/init.m4f', - resolvedUri: 'https://www.example.com/63000/init.m4f' - }, - number: 1 - }, - { - uri: '63000/2.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/2.m4f', - map: { - uri: '63000/init.m4f', - resolvedUri: 'https://www.example.com/63000/init.m4f' - }, - number: 2 - }, - { - uri: '63000/3.m4f', - timeline: 0, - duration: 0.04800000000000004, - resolvedUri: 'https://www.example.com/63000/3.m4f', - map: { - uri: '63000/init.m4f', - resolvedUri: 'https://www.example.com/63000/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': '125000', - 'BANDWIDTH': 125000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.984, - segments: [ - { - uri: '125000/0.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/0.m4f', - map: { - uri: '125000/init.m4f', - resolvedUri: 'https://www.example.com/125000/init.m4f' - }, - number: 0 - }, - { - uri: '125000/1.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/1.m4f', - map: { - uri: '125000/init.m4f', - resolvedUri: 'https://www.example.com/125000/init.m4f' - }, - number: 1 - }, - { - uri: '125000/2.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/2.m4f', - map: { - uri: '125000/init.m4f', - resolvedUri: 'https://www.example.com/125000/init.m4f' - }, - number: 2 - }, - { - uri: '125000/3.m4f', - timeline: 0, - duration: 0.04800000000000004, - resolvedUri: 'https://www.example.com/125000/3.m4f', - map: { - uri: '125000/init.m4f', - resolvedUri: 'https://www.example.com/125000/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - } - ], - uri: '' - }, - 'es': { - language: 'es', - autoselect: true, - default: false, - playlists: [ - { - attributes: { - 'NAME': '63000', - 'BANDWIDTH': 63000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.984, - segments: [ - { - uri: '63000/es/0.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/es/0.m4f', - map: { - uri: '63000/es/init.m4f', - resolvedUri: 'https://www.example.com/63000/es/init.m4f' - }, - number: 0 - }, - { - uri: '63000/es/1.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/es/1.m4f', - map: { - uri: '63000/es/init.m4f', - resolvedUri: 'https://www.example.com/63000/es/init.m4f' - }, - number: 1 - }, - { - uri: '63000/es/2.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/es/2.m4f', - map: { - uri: '63000/es/init.m4f', - resolvedUri: 'https://www.example.com/63000/es/init.m4f' - }, - number: 2 - }, - { - uri: '63000/es/3.m4f', - timeline: 0, - duration: 0.04800000000000004, - resolvedUri: 'https://www.example.com/63000/es/3.m4f', - map: { - uri: '63000/es/init.m4f', - resolvedUri: 'https://www.example.com/63000/es/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': '125000', - 'BANDWIDTH': 125000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.984, - segments: [ - { - uri: '125000/es/0.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/es/0.m4f', - map: { - uri: '125000/es/init.m4f', - resolvedUri: 'https://www.example.com/125000/es/init.m4f' - }, - number: 0 - }, - { - uri: '125000/es/1.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/es/1.m4f', - map: { - uri: '125000/es/init.m4f', - resolvedUri: 'https://www.example.com/125000/es/init.m4f' - }, - number: 1 - }, - { - uri: '125000/es/2.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/es/2.m4f', - map: { - uri: '125000/es/init.m4f', - resolvedUri: 'https://www.example.com/125000/es/init.m4f' - }, - number: 2 - }, - { - uri: '125000/es/3.m4f', - timeline: 0, - duration: 0.04800000000000004, - resolvedUri: 'https://www.example.com/125000/es/3.m4f', - map: { - uri: '125000/es/init.m4f', - resolvedUri: 'https://www.example.com/125000/es/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - } - ], - uri: '' - } - } - }, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': { - subs: { - en: { - language: 'en', - default: false, - autoselect: false, - playlists: [ - { - attributes: { - 'NAME': 'en', - 'BANDWIDTH': 256, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: 'https://example.com/en.vtt', - targetDuration: 6, - segments: [ - { - uri: 'https://example.com/en.vtt', - timeline: 0, - resolvedUri: 'https://example.com/en.vtt', - duration: 6, - number: 0 - } - ], - mediaSequence: 0 - } - ], - uri: '' - }, - es: { - language: 'es', - default: false, - autoselect: false, - playlists: [ - { - attributes: { - 'NAME': 'es', - 'BANDWIDTH': 256, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: 'https://example.com/es.vtt', - targetDuration: 6, - segments: [ - { - uri: 'https://example.com/es.vtt', - timeline: 0, - resolvedUri: 'https://example.com/es.vtt', - duration: 6, - number: 0 - } - ], - mediaSequence: 0 - } - ], - uri: '' - } - } - } - }, - uri: '', - duration: 6, - playlists: [ - { - attributes: { - 'NAME': '482', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 482, - height: 270 - }, - 'CODECS': 'avc1.420015', - 'BANDWIDTH': 449000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.9185833333333333, - segments: [ - { - uri: '482/0.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/482/0.m4f', - map: { - uri: '482/init.m4f', - resolvedUri: 'https://www.example.com/482/init.m4f' - }, - number: 0 - }, - { - uri: '482/1.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/482/1.m4f', - map: { - uri: '482/init.m4f', - resolvedUri: 'https://www.example.com/482/init.m4f' - }, - number: 1 - }, - { - uri: '482/2.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/482/2.m4f', - map: { - uri: '482/init.m4f', - resolvedUri: 'https://www.example.com/482/init.m4f' - }, - number: 2 - }, - { - uri: '482/3.m4f', - timeline: 0, - duration: 0.24425000000000008, - resolvedUri: 'https://www.example.com/482/3.m4f', - map: { - uri: '482/init.m4f', - resolvedUri: 'https://www.example.com/482/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': '720', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 720, - height: 404 - }, - 'CODECS': 'avc1.64001e', - 'BANDWIDTH': 3971000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.9185833333333333, - segments: [ - { - uri: '720/0.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/720/0.m4f', - map: { - uri: '720/init.m4f', - resolvedUri: 'https://www.example.com/720/init.m4f' - }, - number: 0 - }, - { - uri: '720/1.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/720/1.m4f', - map: { - uri: '720/init.m4f', - resolvedUri: 'https://www.example.com/720/init.m4f' - }, - number: 1 - }, - { - uri: '720/2.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/720/2.m4f', - map: { - uri: '720/init.m4f', - resolvedUri: 'https://www.example.com/720/init.m4f' - }, - number: 2 - }, - { - uri: '720/3.m4f', - timeline: 0, - duration: 0.24425000000000008, - resolvedUri: 'https://www.example.com/720/3.m4f', - map: { - uri: '720/init.m4f', - resolvedUri: 'https://www.example.com/720/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - } - ] -}; diff --git a/node_modules/mpd-parser/test/manifests/maat_vtt_segmentTemplate.mpd b/node_modules/mpd-parser/test/manifests/maat_vtt_segmentTemplate.mpd deleted file mode 100644 index eb058f9..0000000 --- a/node_modules/mpd-parser/test/manifests/maat_vtt_segmentTemplate.mpd +++ /dev/null @@ -1,60 +0,0 @@ - - - https://www.example.com/base - - - - - - test - - - - - - - - - - - - - - test - - - - - - - - - - - - - - test - - - - - - - - - - - - - https://example.com/en.vtt - - - - - https://example.com/es.vtt - - - - - diff --git a/node_modules/mpd-parser/test/manifests/multiperiod-dynamic.js b/node_modules/mpd-parser/test/manifests/multiperiod-dynamic.js deleted file mode 100644 index 9057e7c..0000000 --- a/node_modules/mpd-parser/test/manifests/multiperiod-dynamic.js +++ /dev/null @@ -1,1299 +0,0 @@ -export const parsedManifest = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: { - 'AUDIO': { - audio: { - 'en (main)': { - language: 'en', - autoselect: true, - default: true, - playlists: [ - { - attributes: { - 'NAME': 'default_audio128_2', - 'BANDWIDTH': 123000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: false, - timeline: 0, - resolvedUri: '', - targetDuration: 2, - segments: [ - { - uri: 'https://example.com/default_audio128_2/segment0.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment0.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init0.m4f' - }, - number: 0 - }, - { - uri: 'https://example.com/default_audio128_2/segment1.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment1.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init0.m4f' - }, - number: 1 - }, - { - uri: 'https://example.com/default_audio128_2/segment2.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment2.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init0.m4f' - }, - number: 2 - }, - { - uri: 'https://example.com/default_audio128_2/segment3.m4f', - timeline: 1, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment3.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init1.m4f' - }, - number: 3, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio128_2/segment4.m4f', - timeline: 1, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment4.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init1.m4f' - }, - number: 4 - }, - { - uri: 'https://example.com/default_audio128_2/segment5.m4f', - timeline: 1, - duration: 0.8591383219954648, - resolvedUri: 'https://example.com/default_audio128_2/segment5.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init1.m4f' - }, - number: 5 - }, - { - uri: 'https://example.com/default_audio128_2/segment6.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment6.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 6, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio128_2/segment7.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment7.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 7 - }, - { - uri: 'https://example.com/default_audio128_2/segment8.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment8.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 8 - }, - { - uri: 'https://example.com/default_audio128_2/segment9.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment9.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 9 - }, - { - uri: 'https://example.com/default_audio128_2/segment10.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment10.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 10 - }, - { - uri: 'https://example.com/default_audio128_2/segment11.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment11.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 11 - }, - { - uri: 'https://example.com/default_audio128_2/segment12.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment12.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 12 - }, - { - uri: 'https://example.com/default_audio128_2/segment13.m4f', - timeline: 2, - duration: 0.023219954648526078, - resolvedUri: 'https://example.com/default_audio128_2/segment13.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 13 - }, - { - uri: 'https://example.com/default_audio128_2/segment14.m4f', - timeline: 3, - duration: 1.1609977324263039, - resolvedUri: 'https://example.com/default_audio128_2/segment14.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init3.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init3.m4f' - }, - number: 14, - presentationTimeOffset: 4.85297052154195, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio128_2/segment15.m4f', - timeline: 3, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment15.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init3.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init3.m4f' - }, - number: 15, - presentationTimeOffset: 4.85297052154195 - }, - { - uri: 'https://example.com/default_audio128_2/segment16.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment16.m4f', - map: { - uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' - }, - number: 16, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio128_2/segment17.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment17.m4f', - map: { - uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' - }, - number: 17 - }, - { - uri: 'https://example.com/default_audio128_2/segment18.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment18.m4f', - map: { - uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' - }, - number: 18 - }, - { - uri: 'https://example.com/default_audio128_2/segment19.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment19.m4f', - map: { - uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' - }, - number: 19 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': 'default_audio96_2', - 'BANDWIDTH': 93000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: false, - timeline: 0, - resolvedUri: '', - targetDuration: 2, - segments: [ - { - uri: 'https://example.com/default_audio96_2/segment0.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment0.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init0.m4f' - }, - number: 0 - }, - { - uri: 'https://example.com/default_audio96_2/segment1.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment1.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init0.m4f' - }, - number: 1 - }, - { - uri: 'https://example.com/default_audio96_2/segment2.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment2.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init0.m4f' - }, - number: 2 - }, - { - uri: 'https://example.com/default_audio96_2/segment3.m4f', - timeline: 1, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment3.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init1.m4f' - }, - number: 3, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio96_2/segment4.m4f', - timeline: 1, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment4.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init1.m4f' - }, - number: 4 - }, - { - uri: 'https://example.com/default_audio96_2/segment5.m4f', - timeline: 1, - duration: 0.8591383219954648, - resolvedUri: 'https://example.com/default_audio96_2/segment5.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init1.m4f' - }, - number: 5 - }, - { - uri: 'https://example.com/default_audio96_2/segment6.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment6.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 6, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio96_2/segment7.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment7.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 7 - }, - { - uri: 'https://example.com/default_audio96_2/segment8.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment8.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 8 - }, - { - uri: 'https://example.com/default_audio96_2/segment9.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment9.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 9 - }, - { - uri: 'https://example.com/default_audio96_2/segment10.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment10.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 10 - }, - { - uri: 'https://example.com/default_audio96_2/segment11.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment11.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 11 - }, - { - uri: 'https://example.com/default_audio96_2/segment12.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment12.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 12 - }, - { - uri: 'https://example.com/default_audio96_2/segment13.m4f', - timeline: 2, - duration: 0.023219954648526078, - resolvedUri: 'https://example.com/default_audio96_2/segment13.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 13 - }, - { - uri: 'https://example.com/default_audio96_2/segment14.m4f', - timeline: 3, - duration: 1.1609977324263039, - resolvedUri: 'https://example.com/default_audio96_2/segment14.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init3.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init3.m4f' - }, - number: 14, - presentationTimeOffset: 4.85297052154195, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio96_2/segment15.m4f', - timeline: 3, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment15.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init3.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init3.m4f' - }, - number: 15, - presentationTimeOffset: 4.85297052154195 - }, - { - uri: 'https://example.com/default_audio96_2/segment16.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment16.m4f', - map: { - uri: 'https://example.com/default_audio96_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio96_2/segment$Number$.m4f' - }, - number: 16, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio96_2/segment17.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment17.m4f', - map: { - uri: 'https://example.com/default_audio96_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio96_2/segment$Number$.m4f' - }, - number: 17 - }, - { - uri: 'https://example.com/default_audio96_2/segment18.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment18.m4f', - map: { - uri: 'https://example.com/default_audio96_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio96_2/segment$Number$.m4f' - }, - number: 18 - }, - { - uri: 'https://example.com/default_audio96_2/segment19.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment19.m4f', - map: { - uri: 'https://example.com/default_audio96_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio96_2/segment$Number$.m4f' - }, - number: 19 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - } - ], - uri: '' - } - } - }, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - uri: '', - duration: 36.269, - playlists: [ - { - attributes: { - 'NAME': 'default_video2000_0_1280x720', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 1280, - height: 720 - }, - 'CODECS': 'avc1.4d001f', - 'BANDWIDTH': 2008000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: false, - timeline: 0, - resolvedUri: '', - targetDuration: 3, - segments: [ - { - uri: 'https://example.com/default_video2000_0_1280x720/segment0.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment0.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init0.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init0.m4f' - }, - number: 0 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment1.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment1.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init0.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init0.m4f' - }, - number: 1 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment2.m4f', - timeline: 0, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment2.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init0.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init0.m4f' - }, - number: 2 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment3.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment3.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init1.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init1.m4f' - }, - number: 3, - discontinuity: true - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment4.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment4.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init1.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init1.m4f' - }, - number: 4 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment5.m4f', - timeline: 1, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment5.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init1.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init1.m4f' - }, - number: 5 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment6.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment6.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 6, - discontinuity: true - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment7.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment7.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 7 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment8.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment8.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 8 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment9.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment9.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 9 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment10.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment10.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 10 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment11.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment11.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 11 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment12.m4f', - timeline: 2, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment12.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 12 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment13.m4f', - timeline: 3, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment13.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init3.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init3.m4f' - }, - number: 13, - presentationTimeOffset: 4.838166666666667, - discontinuity: true - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment14.m4f', - timeline: 3, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment14.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init3.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init3.m4f' - }, - number: 14, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment15.m4f', - timeline: 3, - duration: 0.26693333333333336, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment15.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init3.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init3.m4f' - }, - number: 15, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment16.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment16.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' - }, - number: 16, - discontinuity: true - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment17.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment17.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' - }, - number: 17 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment18.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment18.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' - }, - number: 18 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment19.m4f', - timeline: 4, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment19.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' - }, - number: 19 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': 'default_video1200_1_960x540', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 960, - height: 540 - }, - 'CODECS': 'avc1.4d001f', - 'BANDWIDTH': 1195000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: false, - timeline: 0, - resolvedUri: '', - targetDuration: 3, - segments: [ - { - uri: 'https://example.com/default_video1200_1_960x540/segment0.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment0.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init0.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init0.m4f' - }, - number: 0 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment1.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment1.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init0.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init0.m4f' - }, - number: 1 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment2.m4f', - timeline: 0, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment2.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init0.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init0.m4f' - }, - number: 2 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment3.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment3.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init1.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init1.m4f' - }, - number: 3, - discontinuity: true - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment4.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment4.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init1.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init1.m4f' - }, - number: 4 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment5.m4f', - timeline: 1, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment5.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init1.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init1.m4f' - }, - number: 5 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment6.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment6.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 6, - discontinuity: true - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment7.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment7.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 7 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment8.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment8.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 8 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment9.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment9.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 9 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment10.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment10.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 10 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment11.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment11.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 11 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment12.m4f', - timeline: 2, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment12.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 12 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment13.m4f', - timeline: 3, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment13.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init3.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init3.m4f' - }, - number: 13, - presentationTimeOffset: 4.838166666666667, - discontinuity: true - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment14.m4f', - timeline: 3, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment14.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init3.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init3.m4f' - }, - number: 14, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment15.m4f', - timeline: 3, - duration: 0.26693333333333336, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment15.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init3.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init3.m4f' - }, - number: 15, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment16.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment16.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' - }, - number: 16, - discontinuity: true - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment17.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment17.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' - }, - number: 17 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment18.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment18.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' - }, - number: 18 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment19.m4f', - timeline: 4, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment19.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' - }, - number: 19 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': 'default_video900_1_640x360', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 640, - height: 360 - }, - 'CODECS': 'avc1.4d001e', - 'BANDWIDTH': 884000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: false, - timeline: 0, - resolvedUri: '', - targetDuration: 3, - segments: [ - { - uri: 'https://example.com/default_video900_1_640x360/segment0.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment0.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init0.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init0.m4f' - }, - number: 0 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment1.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment1.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init0.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init0.m4f' - }, - number: 1 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment2.m4f', - timeline: 0, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment2.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init0.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init0.m4f' - }, - number: 2 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment3.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment3.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init1.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init1.m4f' - }, - number: 3, - discontinuity: true - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment4.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment4.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init1.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init1.m4f' - }, - number: 4 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment5.m4f', - timeline: 1, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment5.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init1.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init1.m4f' - }, - number: 5 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment6.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment6.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 6, - discontinuity: true - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment7.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment7.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 7 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment8.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment8.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 8 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment9.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment9.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 9 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment10.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment10.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 10 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment11.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment11.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 11 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment12.m4f', - timeline: 2, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment12.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 12 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment13.m4f', - timeline: 3, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment13.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init3.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init3.m4f' - }, - number: 13, - presentationTimeOffset: 4.838166666666667, - discontinuity: true - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment14.m4f', - timeline: 3, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment14.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init3.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init3.m4f' - }, - number: 14, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment15.m4f', - timeline: 3, - duration: 0.26693333333333336, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment15.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init3.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init3.m4f' - }, - number: 15, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment16.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment16.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' - }, - number: 16, - discontinuity: true - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment17.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment17.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' - }, - number: 17 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment18.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment18.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' - }, - number: 18 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment19.m4f', - timeline: 4, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment19.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' - }, - number: 19 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - } - ], - suggestedPresentationDelay: 18 -}; diff --git a/node_modules/mpd-parser/test/manifests/multiperiod-dynamic.mpd b/node_modules/mpd-parser/test/manifests/multiperiod-dynamic.mpd deleted file mode 100644 index 7e934d0..0000000 --- a/node_modules/mpd-parser/test/manifests/multiperiod-dynamic.mpd +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - test - - - - - - - - - - - - - - - test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - test - - - - - - - - - - - - - - - test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/node_modules/mpd-parser/test/manifests/multiperiod.js b/node_modules/mpd-parser/test/manifests/multiperiod.js deleted file mode 100644 index a8fa86a..0000000 --- a/node_modules/mpd-parser/test/manifests/multiperiod.js +++ /dev/null @@ -1,1298 +0,0 @@ -export const parsedManifest = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: { - 'AUDIO': { - audio: { - 'en (main)': { - language: 'en', - autoselect: true, - default: true, - playlists: [ - { - attributes: { - 'NAME': 'default_audio128_2', - 'BANDWIDTH': 123000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 2, - segments: [ - { - uri: 'https://example.com/default_audio128_2/segment0.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment0.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init0.m4f' - }, - number: 0 - }, - { - uri: 'https://example.com/default_audio128_2/segment1.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment1.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init0.m4f' - }, - number: 1 - }, - { - uri: 'https://example.com/default_audio128_2/segment2.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment2.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init0.m4f' - }, - number: 2 - }, - { - uri: 'https://example.com/default_audio128_2/segment3.m4f', - timeline: 1, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment3.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init1.m4f' - }, - number: 3, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio128_2/segment4.m4f', - timeline: 1, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment4.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init1.m4f' - }, - number: 4 - }, - { - uri: 'https://example.com/default_audio128_2/segment5.m4f', - timeline: 1, - duration: 0.8591383219954648, - resolvedUri: 'https://example.com/default_audio128_2/segment5.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init1.m4f' - }, - number: 5 - }, - { - uri: 'https://example.com/default_audio128_2/segment6.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment6.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 6, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio128_2/segment7.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment7.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 7 - }, - { - uri: 'https://example.com/default_audio128_2/segment8.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment8.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 8 - }, - { - uri: 'https://example.com/default_audio128_2/segment9.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment9.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 9 - }, - { - uri: 'https://example.com/default_audio128_2/segment10.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment10.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 10 - }, - { - uri: 'https://example.com/default_audio128_2/segment11.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment11.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 11 - }, - { - uri: 'https://example.com/default_audio128_2/segment12.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment12.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 12 - }, - { - uri: 'https://example.com/default_audio128_2/segment13.m4f', - timeline: 2, - duration: 0.023219954648526078, - resolvedUri: 'https://example.com/default_audio128_2/segment13.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' - }, - number: 13 - }, - { - uri: 'https://example.com/default_audio128_2/segment14.m4f', - timeline: 3, - duration: 1.1609977324263039, - resolvedUri: 'https://example.com/default_audio128_2/segment14.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init3.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init3.m4f' - }, - number: 14, - presentationTimeOffset: 4.85297052154195, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio128_2/segment15.m4f', - timeline: 3, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment15.m4f', - map: { - uri: 'https://example.com/default_audio128_2/init3.m4f', - resolvedUri: 'https://example.com/default_audio128_2/init3.m4f' - }, - number: 15, - presentationTimeOffset: 4.85297052154195 - }, - { - uri: 'https://example.com/default_audio128_2/segment16.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment16.m4f', - map: { - uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' - }, - number: 16, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio128_2/segment17.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment17.m4f', - map: { - uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' - }, - number: 17 - }, - { - uri: 'https://example.com/default_audio128_2/segment18.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment18.m4f', - map: { - uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' - }, - number: 18 - }, - { - uri: 'https://example.com/default_audio128_2/segment19.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio128_2/segment19.m4f', - map: { - uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' - }, - number: 19 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': 'default_audio96_2', - 'BANDWIDTH': 93000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 2, - segments: [ - { - uri: 'https://example.com/default_audio96_2/segment0.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment0.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init0.m4f' - }, - number: 0 - }, - { - uri: 'https://example.com/default_audio96_2/segment1.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment1.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init0.m4f' - }, - number: 1 - }, - { - uri: 'https://example.com/default_audio96_2/segment2.m4f', - timeline: 0, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment2.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init0.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init0.m4f' - }, - number: 2 - }, - { - uri: 'https://example.com/default_audio96_2/segment3.m4f', - timeline: 1, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment3.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init1.m4f' - }, - number: 3, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio96_2/segment4.m4f', - timeline: 1, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment4.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init1.m4f' - }, - number: 4 - }, - { - uri: 'https://example.com/default_audio96_2/segment5.m4f', - timeline: 1, - duration: 0.8591383219954648, - resolvedUri: 'https://example.com/default_audio96_2/segment5.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init1.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init1.m4f' - }, - number: 5 - }, - { - uri: 'https://example.com/default_audio96_2/segment6.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment6.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 6, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio96_2/segment7.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment7.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 7 - }, - { - uri: 'https://example.com/default_audio96_2/segment8.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment8.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 8 - }, - { - uri: 'https://example.com/default_audio96_2/segment9.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment9.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 9 - }, - { - uri: 'https://example.com/default_audio96_2/segment10.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment10.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 10 - }, - { - uri: 'https://example.com/default_audio96_2/segment11.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment11.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 11 - }, - { - uri: 'https://example.com/default_audio96_2/segment12.m4f', - timeline: 2, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment12.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 12 - }, - { - uri: 'https://example.com/default_audio96_2/segment13.m4f', - timeline: 2, - duration: 0.023219954648526078, - resolvedUri: 'https://example.com/default_audio96_2/segment13.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init2.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init2.m4f' - }, - number: 13 - }, - { - uri: 'https://example.com/default_audio96_2/segment14.m4f', - timeline: 3, - duration: 1.1609977324263039, - resolvedUri: 'https://example.com/default_audio96_2/segment14.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init3.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init3.m4f' - }, - number: 14, - presentationTimeOffset: 4.85297052154195, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio96_2/segment15.m4f', - timeline: 3, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment15.m4f', - map: { - uri: 'https://example.com/default_audio96_2/init3.m4f', - resolvedUri: 'https://example.com/default_audio96_2/init3.m4f' - }, - number: 15, - presentationTimeOffset: 4.85297052154195 - }, - { - uri: 'https://example.com/default_audio96_2/segment16.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment16.m4f', - map: { - uri: 'https://example.com/default_audio96_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio96_2/segment$Number$.m4f' - }, - number: 16, - discontinuity: true - }, - { - uri: 'https://example.com/default_audio96_2/segment17.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment17.m4f', - map: { - uri: 'https://example.com/default_audio96_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio96_2/segment$Number$.m4f' - }, - number: 17 - }, - { - uri: 'https://example.com/default_audio96_2/segment18.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment18.m4f', - map: { - uri: 'https://example.com/default_audio96_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio96_2/segment$Number$.m4f' - }, - number: 18 - }, - { - uri: 'https://example.com/default_audio96_2/segment19.m4f', - timeline: 4, - duration: 1.9969160997732427, - resolvedUri: 'https://example.com/default_audio96_2/segment19.m4f', - map: { - uri: 'https://example.com/default_audio96_2/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_audio96_2/segment$Number$.m4f' - }, - number: 19 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - } - ], - uri: '' - } - } - }, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - uri: '', - duration: 36.269, - playlists: [ - { - attributes: { - 'NAME': 'default_video2000_0_1280x720', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 1280, - height: 720 - }, - 'CODECS': 'avc1.4d001f', - 'BANDWIDTH': 2008000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 3, - segments: [ - { - uri: 'https://example.com/default_video2000_0_1280x720/segment0.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment0.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init0.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init0.m4f' - }, - number: 0 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment1.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment1.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init0.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init0.m4f' - }, - number: 1 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment2.m4f', - timeline: 0, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment2.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init0.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init0.m4f' - }, - number: 2 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment3.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment3.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init1.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init1.m4f' - }, - number: 3, - discontinuity: true - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment4.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment4.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init1.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init1.m4f' - }, - number: 4 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment5.m4f', - timeline: 1, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment5.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init1.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init1.m4f' - }, - number: 5 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment6.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment6.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 6, - discontinuity: true - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment7.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment7.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 7 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment8.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment8.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 8 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment9.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment9.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 9 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment10.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment10.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 10 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment11.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment11.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 11 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment12.m4f', - timeline: 2, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment12.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' - }, - number: 12 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment13.m4f', - timeline: 3, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment13.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init3.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init3.m4f' - }, - number: 13, - presentationTimeOffset: 4.838166666666667, - discontinuity: true - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment14.m4f', - timeline: 3, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment14.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init3.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init3.m4f' - }, - number: 14, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment15.m4f', - timeline: 3, - duration: 0.26693333333333336, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment15.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/init3.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/init3.m4f' - }, - number: 15, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment16.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment16.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' - }, - number: 16, - discontinuity: true - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment17.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment17.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' - }, - number: 17 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment18.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment18.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' - }, - number: 18 - }, - { - uri: 'https://example.com/default_video2000_0_1280x720/segment19.m4f', - timeline: 4, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment19.m4f', - map: { - uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' - }, - number: 19 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': 'default_video1200_1_960x540', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 960, - height: 540 - }, - 'CODECS': 'avc1.4d001f', - 'BANDWIDTH': 1195000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 3, - segments: [ - { - uri: 'https://example.com/default_video1200_1_960x540/segment0.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment0.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init0.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init0.m4f' - }, - number: 0 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment1.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment1.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init0.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init0.m4f' - }, - number: 1 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment2.m4f', - timeline: 0, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment2.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init0.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init0.m4f' - }, - number: 2 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment3.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment3.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init1.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init1.m4f' - }, - number: 3, - discontinuity: true - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment4.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment4.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init1.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init1.m4f' - }, - number: 4 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment5.m4f', - timeline: 1, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment5.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init1.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init1.m4f' - }, - number: 5 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment6.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment6.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 6, - discontinuity: true - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment7.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment7.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 7 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment8.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment8.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 8 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment9.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment9.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 9 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment10.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment10.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 10 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment11.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment11.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 11 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment12.m4f', - timeline: 2, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment12.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' - }, - number: 12 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment13.m4f', - timeline: 3, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment13.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init3.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init3.m4f' - }, - number: 13, - presentationTimeOffset: 4.838166666666667, - discontinuity: true - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment14.m4f', - timeline: 3, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment14.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init3.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init3.m4f' - }, - number: 14, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment15.m4f', - timeline: 3, - duration: 0.26693333333333336, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment15.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/init3.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/init3.m4f' - }, - number: 15, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment16.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment16.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' - }, - number: 16, - discontinuity: true - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment17.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment17.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' - }, - number: 17 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment18.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment18.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' - }, - number: 18 - }, - { - uri: 'https://example.com/default_video1200_1_960x540/segment19.m4f', - timeline: 4, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment19.m4f', - map: { - uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' - }, - number: 19 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': 'default_video900_1_640x360', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 640, - height: 360 - }, - 'CODECS': 'avc1.4d001e', - 'BANDWIDTH': 884000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 3, - segments: [ - { - uri: 'https://example.com/default_video900_1_640x360/segment0.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment0.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init0.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init0.m4f' - }, - number: 0 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment1.m4f', - timeline: 0, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment1.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init0.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init0.m4f' - }, - number: 1 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment2.m4f', - timeline: 0, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment2.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init0.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init0.m4f' - }, - number: 2 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment3.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment3.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init1.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init1.m4f' - }, - number: 3, - discontinuity: true - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment4.m4f', - timeline: 1, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment4.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init1.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init1.m4f' - }, - number: 4 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment5.m4f', - timeline: 1, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment5.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init1.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init1.m4f' - }, - number: 5 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment6.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment6.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 6, - discontinuity: true - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment7.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment7.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 7 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment8.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment8.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 8 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment9.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment9.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 9 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment10.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment10.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 10 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment11.m4f', - timeline: 2, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment11.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 11 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment12.m4f', - timeline: 2, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment12.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init2.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' - }, - number: 12 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment13.m4f', - timeline: 3, - duration: 0.9676333333333333, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment13.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init3.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init3.m4f' - }, - number: 13, - presentationTimeOffset: 4.838166666666667, - discontinuity: true - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment14.m4f', - timeline: 3, - duration: 1.9352666666666667, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment14.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init3.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init3.m4f' - }, - number: 14, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment15.m4f', - timeline: 3, - duration: 0.26693333333333336, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment15.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/init3.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/init3.m4f' - }, - number: 15, - presentationTimeOffset: 4.838166666666667 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment16.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment16.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' - }, - number: 16, - discontinuity: true - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment17.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment17.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' - }, - number: 17 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment18.m4f', - timeline: 4, - duration: 2.002, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment18.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' - }, - number: 18 - }, - { - uri: 'https://example.com/default_video900_1_640x360/segment19.m4f', - timeline: 4, - duration: 1.9686333333333332, - resolvedUri: 'https://example.com/default_video900_1_640x360/segment19.m4f', - map: { - uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', - resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' - }, - number: 19 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - } - ] -}; diff --git a/node_modules/mpd-parser/test/manifests/multiperiod.mpd b/node_modules/mpd-parser/test/manifests/multiperiod.mpd deleted file mode 100644 index 396bb83..0000000 --- a/node_modules/mpd-parser/test/manifests/multiperiod.mpd +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - test - - - - - - - - - - - - - - - test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - test - - - - - - - - - - - - - - - test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/node_modules/mpd-parser/test/manifests/segmentBase.js b/node_modules/mpd-parser/test/manifests/segmentBase.js deleted file mode 100644 index 1fb5d5d..0000000 --- a/node_modules/mpd-parser/test/manifests/segmentBase.js +++ /dev/null @@ -1,49 +0,0 @@ -export const parsedManifest = { - allowCache: true, - discontinuityStarts: [], - duration: 6, - endList: true, - mediaGroups: { - 'AUDIO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {}, - 'VIDEO': {} - }, - playlists: [ - { - attributes: { - 'AUDIO': 'audio', - 'BANDWIDTH': 449000, - 'CODECS': 'avc1.420015', - 'NAME': '482', - 'PROGRAM-ID': 1, - 'RESOLUTION': { - height: 270, - width: 482 - }, - 'SUBTITLES': 'subs' - }, - endList: true, - resolvedUri: '', - targetDuration: 6, - mediaSequence: 0, - segments: [ - { - duration: 6, - timeline: 0, - number: 0, - map: { - uri: '', - resolvedUri: 'https://www.example.com/1080p.ts' - }, - resolvedUri: 'https://www.example.com/1080p.ts', - uri: 'https://www.example.com/1080p.ts' - } - ], - timeline: 0, - uri: '' - } - ], - segments: [], - uri: '' -}; diff --git a/node_modules/mpd-parser/test/manifests/segmentBase.mpd b/node_modules/mpd-parser/test/manifests/segmentBase.mpd deleted file mode 100644 index df4b292..0000000 --- a/node_modules/mpd-parser/test/manifests/segmentBase.mpd +++ /dev/null @@ -1,16 +0,0 @@ - - - https://www.example.com/base - - - - - - - 1080p.ts - - - - - - diff --git a/node_modules/mpd-parser/test/manifests/segmentList.js b/node_modules/mpd-parser/test/manifests/segmentList.js deleted file mode 100644 index 8ab1d2a..0000000 --- a/node_modules/mpd-parser/test/manifests/segmentList.js +++ /dev/null @@ -1,236 +0,0 @@ -export const parsedManifest = { - allowCache: true, - discontinuityStarts: [], - duration: 6, - endList: true, - mediaGroups: { - 'AUDIO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {}, - 'VIDEO': {} - }, - playlists: [ - { - attributes: { - 'AUDIO': 'audio', - 'BANDWIDTH': 449000, - 'CODECS': 'avc1.420015', - 'NAME': '482', - 'PROGRAM-ID': 1, - 'RESOLUTION': { - height: 270, - width: 482 - }, - 'SUBTITLES': 'subs' - }, - endList: true, - mediaSequence: 1, - targetDuration: 1, - resolvedUri: '', - segments: [ - { - duration: 1, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/low/segment-1.ts', - timeline: 0, - uri: 'low/segment-1.ts', - number: 1 - }, - { - duration: 1, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/low/segment-2.ts', - timeline: 0, - uri: 'low/segment-2.ts', - number: 2 - }, - { - duration: 1, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/low/segment-3.ts', - timeline: 0, - uri: 'low/segment-3.ts', - number: 3 - }, - { - duration: 1, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/low/segment-4.ts', - timeline: 0, - uri: 'low/segment-4.ts', - number: 4 - }, - { - duration: 1, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/low/segment-5.ts', - timeline: 0, - uri: 'low/segment-5.ts', - number: 5 - }, - { - duration: 1, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/low/segment-6.ts', - timeline: 0, - uri: 'low/segment-6.ts', - number: 6 - } - ], - timeline: 0, - uri: '' - }, - { - attributes: { - 'AUDIO': 'audio', - 'BANDWIDTH': 3971000, - 'CODECS': 'avc1.420015', - 'NAME': '720', - 'PROGRAM-ID': 1, - 'RESOLUTION': { - height: 404, - width: 720 - }, - 'SUBTITLES': 'subs' - }, - endList: true, - resolvedUri: '', - mediaSequence: 1, - targetDuration: 60, - segments: [ - { - duration: 60, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/high/segment-1.ts', - timeline: 0, - uri: 'high/segment-1.ts', - number: 1 - }, - { - duration: 60, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/high/segment-2.ts', - timeline: 0, - uri: 'high/segment-2.ts', - number: 2 - }, - { - duration: 60, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/high/segment-3.ts', - timeline: 0, - uri: 'high/segment-3.ts', - number: 3 - }, - { - duration: 60, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/high/segment-4.ts', - timeline: 0, - uri: 'high/segment-4.ts', - number: 4 - }, - { - duration: 60, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/high/segment-5.ts', - timeline: 0, - uri: 'high/segment-5.ts', - number: 5 - }, - { - duration: 60, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/high/segment-6.ts', - timeline: 0, - uri: 'high/segment-6.ts', - number: 6 - }, - { - duration: 60, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/high/segment-7.ts', - timeline: 0, - uri: 'high/segment-7.ts', - number: 7 - }, - { - duration: 60, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/high/segment-8.ts', - timeline: 0, - uri: 'high/segment-8.ts', - number: 8 - }, - { - duration: 60, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/high/segment-9.ts', - timeline: 0, - uri: 'high/segment-9.ts', - number: 9 - }, - { - duration: 60, - map: { - uri: '', - resolvedUri: 'https://www.example.com/base' - }, - resolvedUri: 'https://www.example.com/high/segment-10.ts', - timeline: 0, - uri: 'high/segment-10.ts', - number: 10 - } - ], - timeline: 0, - uri: '' - } - ], - segments: [], - uri: '' -}; diff --git a/node_modules/mpd-parser/test/manifests/segmentList.mpd b/node_modules/mpd-parser/test/manifests/segmentList.mpd deleted file mode 100644 index e8a28ea..0000000 --- a/node_modules/mpd-parser/test/manifests/segmentList.mpd +++ /dev/null @@ -1,47 +0,0 @@ - - - https://www.example.com/base - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/node_modules/mpd-parser/test/manifests/vtt_codecs.js b/node_modules/mpd-parser/test/manifests/vtt_codecs.js deleted file mode 100644 index 48cc89d..0000000 --- a/node_modules/mpd-parser/test/manifests/vtt_codecs.js +++ /dev/null @@ -1,519 +0,0 @@ -export const parsedManifest = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: { - 'AUDIO': { - audio: { - 'en (main)': { - language: 'en', - autoselect: true, - default: true, - playlists: [ - { - attributes: { - 'NAME': '63000', - 'BANDWIDTH': 63000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.984, - segments: [ - { - uri: '63000/0.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/0.m4f', - map: { - uri: '63000/init.m4f', - resolvedUri: 'https://www.example.com/63000/init.m4f' - }, - number: 0 - }, - { - uri: '63000/1.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/1.m4f', - map: { - uri: '63000/init.m4f', - resolvedUri: 'https://www.example.com/63000/init.m4f' - }, - number: 1 - }, - { - uri: '63000/2.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/2.m4f', - map: { - uri: '63000/init.m4f', - resolvedUri: 'https://www.example.com/63000/init.m4f' - }, - number: 2 - }, - { - uri: '63000/3.m4f', - timeline: 0, - duration: 0.04800000000000004, - resolvedUri: 'https://www.example.com/63000/3.m4f', - map: { - uri: '63000/init.m4f', - resolvedUri: 'https://www.example.com/63000/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': '125000', - 'BANDWIDTH': 125000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.984, - segments: [ - { - uri: '125000/0.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/0.m4f', - map: { - uri: '125000/init.m4f', - resolvedUri: 'https://www.example.com/125000/init.m4f' - }, - number: 0 - }, - { - uri: '125000/1.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/1.m4f', - map: { - uri: '125000/init.m4f', - resolvedUri: 'https://www.example.com/125000/init.m4f' - }, - number: 1 - }, - { - uri: '125000/2.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/2.m4f', - map: { - uri: '125000/init.m4f', - resolvedUri: 'https://www.example.com/125000/init.m4f' - }, - number: 2 - }, - { - uri: '125000/3.m4f', - timeline: 0, - duration: 0.04800000000000004, - resolvedUri: 'https://www.example.com/125000/3.m4f', - map: { - uri: '125000/init.m4f', - resolvedUri: 'https://www.example.com/125000/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - } - ], - uri: '' - }, - 'es': { - language: 'es', - autoselect: true, - default: false, - playlists: [ - { - attributes: { - 'NAME': '63000', - 'BANDWIDTH': 63000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.984, - segments: [ - { - uri: '63000/es/0.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/es/0.m4f', - map: { - uri: '63000/es/init.m4f', - resolvedUri: 'https://www.example.com/63000/es/init.m4f' - }, - number: 0 - }, - { - uri: '63000/es/1.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/es/1.m4f', - map: { - uri: '63000/es/init.m4f', - resolvedUri: 'https://www.example.com/63000/es/init.m4f' - }, - number: 1 - }, - { - uri: '63000/es/2.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/63000/es/2.m4f', - map: { - uri: '63000/es/init.m4f', - resolvedUri: 'https://www.example.com/63000/es/init.m4f' - }, - number: 2 - }, - { - uri: '63000/es/3.m4f', - timeline: 0, - duration: 0.04800000000000004, - resolvedUri: 'https://www.example.com/63000/es/3.m4f', - map: { - uri: '63000/es/init.m4f', - resolvedUri: 'https://www.example.com/63000/es/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': '125000', - 'BANDWIDTH': 125000, - 'CODECS': 'mp4a.40.2', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.984, - segments: [ - { - uri: '125000/es/0.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/es/0.m4f', - map: { - uri: '125000/es/init.m4f', - resolvedUri: 'https://www.example.com/125000/es/init.m4f' - }, - number: 0 - }, - { - uri: '125000/es/1.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/es/1.m4f', - map: { - uri: '125000/es/init.m4f', - resolvedUri: 'https://www.example.com/125000/es/init.m4f' - }, - number: 1 - }, - { - uri: '125000/es/2.m4f', - timeline: 0, - duration: 1.984, - resolvedUri: 'https://www.example.com/125000/es/2.m4f', - map: { - uri: '125000/es/init.m4f', - resolvedUri: 'https://www.example.com/125000/es/init.m4f' - }, - number: 2 - }, - { - uri: '125000/es/3.m4f', - timeline: 0, - duration: 0.04800000000000004, - resolvedUri: 'https://www.example.com/125000/es/3.m4f', - map: { - uri: '125000/es/init.m4f', - resolvedUri: 'https://www.example.com/125000/es/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - } - ], - uri: '' - } - } - }, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': { - subs: { - en: { - language: 'en', - default: false, - autoselect: false, - playlists: [ - { - attributes: { - 'NAME': 'en', - 'BANDWIDTH': 256, - 'PROGRAM-ID': 1, - 'CODECS': 'stpp.ttml.im1t' - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: 'https://example.com/en.dash', - targetDuration: 6, - segments: [ - { - uri: 'https://example.com/en.dash', - timeline: 0, - resolvedUri: 'https://example.com/en.dash', - duration: 6, - number: 0 - } - ], - mediaSequence: 0 - } - ], - uri: '' - }, - es: { - language: 'es', - default: false, - autoselect: false, - playlists: [ - { - attributes: { - 'NAME': 'es', - 'BANDWIDTH': 256, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: 'https://example.com/es.vtt', - targetDuration: 6, - segments: [ - { - uri: 'https://example.com/es.vtt', - timeline: 0, - resolvedUri: 'https://example.com/es.vtt', - duration: 6, - number: 0 - } - ], - mediaSequence: 0 - } - ], - uri: '' - } - } - } - }, - uri: '', - duration: 6, - playlists: [ - { - attributes: { - 'NAME': '482', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 482, - height: 270 - }, - 'CODECS': 'avc1.420015', - 'BANDWIDTH': 449000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.9185833333333333, - segments: [ - { - uri: '482/0.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/482/0.m4f', - map: { - uri: '482/init.m4f', - resolvedUri: 'https://www.example.com/482/init.m4f' - }, - number: 0 - }, - { - uri: '482/1.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/482/1.m4f', - map: { - uri: '482/init.m4f', - resolvedUri: 'https://www.example.com/482/init.m4f' - }, - number: 1 - }, - { - uri: '482/2.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/482/2.m4f', - map: { - uri: '482/init.m4f', - resolvedUri: 'https://www.example.com/482/init.m4f' - }, - number: 2 - }, - { - uri: '482/3.m4f', - timeline: 0, - duration: 0.24425000000000008, - resolvedUri: 'https://www.example.com/482/3.m4f', - map: { - uri: '482/init.m4f', - resolvedUri: 'https://www.example.com/482/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - }, - { - attributes: { - 'NAME': '720', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 720, - height: 404 - }, - 'CODECS': 'avc1.64001e', - 'BANDWIDTH': 3971000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 0, - resolvedUri: '', - targetDuration: 1.9185833333333333, - segments: [ - { - uri: '720/0.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/720/0.m4f', - map: { - uri: '720/init.m4f', - resolvedUri: 'https://www.example.com/720/init.m4f' - }, - number: 0 - }, - { - uri: '720/1.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/720/1.m4f', - map: { - uri: '720/init.m4f', - resolvedUri: 'https://www.example.com/720/init.m4f' - }, - number: 1 - }, - { - uri: '720/2.m4f', - timeline: 0, - duration: 1.9185833333333333, - resolvedUri: 'https://www.example.com/720/2.m4f', - map: { - uri: '720/init.m4f', - resolvedUri: 'https://www.example.com/720/init.m4f' - }, - number: 2 - }, - { - uri: '720/3.m4f', - timeline: 0, - duration: 0.24425000000000008, - resolvedUri: 'https://www.example.com/720/3.m4f', - map: { - uri: '720/init.m4f', - resolvedUri: 'https://www.example.com/720/init.m4f' - }, - number: 3 - } - ], - mediaSequence: 0, - contentProtection: { - 'com.widevine.alpha': { - attributes: { - schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' - }, - pssh: new Uint8Array([181, 235, 45]) - } - } - } - ] -}; diff --git a/node_modules/mpd-parser/test/manifests/vtt_codecs.mpd b/node_modules/mpd-parser/test/manifests/vtt_codecs.mpd deleted file mode 100644 index c3ab266..0000000 --- a/node_modules/mpd-parser/test/manifests/vtt_codecs.mpd +++ /dev/null @@ -1,60 +0,0 @@ - - - https://www.example.com/base - - - - - - test - - - - - - - - - - - - - - test - - - - - - - - - - - - - - test - - - - - - - - - - - - - https://example.com/en.dash - - - - - https://example.com/es.vtt - - - - - diff --git a/node_modules/mpd-parser/test/manifests/webmsegments.js b/node_modules/mpd-parser/test/manifests/webmsegments.js deleted file mode 100644 index 1b69d07..0000000 --- a/node_modules/mpd-parser/test/manifests/webmsegments.js +++ /dev/null @@ -1,153 +0,0 @@ -export const parsedManifest = { - allowCache: true, - discontinuityStarts: [], - segments: [], - endList: true, - mediaGroups: { - 'AUDIO': { - audio: { - en: { - language: 'en', - autoselect: true, - default: true, - playlists: [ - { - attributes: { - 'NAME': '2', - 'BANDWIDTH': 32000, - 'CODECS': 'opus', - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 1, - resolvedUri: '', - targetDuration: 4, - segments: [ - { - uri: 'audio/segment_0.chk', - timeline: 1, - duration: 4, - resolvedUri: 'https://www.example.com/audio/segment_0.chk', - map: { - uri: 'audio/init.hdr', - resolvedUri: 'https://www.example.com/audio/init.hdr' - }, - number: 0 - }, - { - uri: 'audio/segment_1.chk', - timeline: 1, - duration: 4, - resolvedUri: 'https://www.example.com/audio/segment_1.chk', - map: { - uri: 'audio/init.hdr', - resolvedUri: 'https://www.example.com/audio/init.hdr' - }, - number: 1 - }, - { - uri: 'audio/segment_2.chk', - timeline: 1, - duration: 4, - resolvedUri: 'https://www.example.com/audio/segment_2.chk', - map: { - uri: 'audio/init.hdr', - resolvedUri: 'https://www.example.com/audio/init.hdr' - }, - number: 2 - }, - { - uri: 'audio/segment_3.chk', - timeline: 1, - duration: 4, - resolvedUri: 'https://www.example.com/audio/segment_3.chk', - map: { - uri: 'audio/init.hdr', - resolvedUri: 'https://www.example.com/audio/init.hdr' - }, - number: 3 - } - ], - mediaSequence: 0 - } - ], - uri: '' - } - } - }, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - uri: '', - duration: 16, - playlists: [ - { - attributes: { - 'NAME': '1', - 'AUDIO': 'audio', - 'SUBTITLES': 'subs', - 'RESOLUTION': { - width: 480, - height: 200 - }, - 'CODECS': 'av1', - 'BANDWIDTH': 100000, - 'PROGRAM-ID': 1 - }, - uri: '', - endList: true, - timeline: 1, - resolvedUri: '', - targetDuration: 4, - segments: [ - { - uri: 'video/segment_0.chk', - timeline: 1, - duration: 4, - resolvedUri: 'https://www.example.com/video/segment_0.chk', - map: { - uri: 'video/init.hdr', - resolvedUri: 'https://www.example.com/video/init.hdr' - }, - number: 0 - }, - { - uri: 'video/segment_1.chk', - timeline: 1, - duration: 4, - resolvedUri: 'https://www.example.com/video/segment_1.chk', - map: { - uri: 'video/init.hdr', - resolvedUri: 'https://www.example.com/video/init.hdr' - }, - number: 1 - }, - { - uri: 'video/segment_2.chk', - timeline: 1, - duration: 4, - resolvedUri: 'https://www.example.com/video/segment_2.chk', - map: { - uri: 'video/init.hdr', - resolvedUri: 'https://www.example.com/video/init.hdr' - }, - number: 2 - }, - { - uri: 'video/segment_3.chk', - timeline: 1, - duration: 4, - resolvedUri: 'https://www.example.com/video/segment_3.chk', - map: { - uri: 'video/init.hdr', - resolvedUri: 'https://www.example.com/video/init.hdr' - }, - number: 3 - } - ], - mediaSequence: 0 - } - ] -}; diff --git a/node_modules/mpd-parser/test/manifests/webmsegments.mpd b/node_modules/mpd-parser/test/manifests/webmsegments.mpd deleted file mode 100644 index a2bae9c..0000000 --- a/node_modules/mpd-parser/test/manifests/webmsegments.mpd +++ /dev/null @@ -1,21 +0,0 @@ - - - - https://www.example.com/base - - - - - - - - - - - - - diff --git a/node_modules/mpd-parser/test/parseAttributes.test.js b/node_modules/mpd-parser/test/parseAttributes.test.js deleted file mode 100644 index f4e288d..0000000 --- a/node_modules/mpd-parser/test/parseAttributes.test.js +++ /dev/null @@ -1,21 +0,0 @@ -import {JSDOM} from 'jsdom'; -import QUnit from 'qunit'; -import { parseAttributes } from '../src/parseAttributes'; - -const document = new JSDOM().window.document; - -QUnit.module('parseAttributes'); - -QUnit.test('simple', function(assert) { - const el = document.createElement('el'); - - el.setAttribute('foo', 1); - - assert.deepEqual(parseAttributes(el), { foo: '1' }); -}); - -QUnit.test('empty', function(assert) { - const el = document.createElement('el'); - - assert.deepEqual(parseAttributes(el), {}); -}); diff --git a/node_modules/mpd-parser/test/segment/segmentBase.test.js b/node_modules/mpd-parser/test/segment/segmentBase.test.js deleted file mode 100644 index 3f94514..0000000 --- a/node_modules/mpd-parser/test/segment/segmentBase.test.js +++ /dev/null @@ -1,201 +0,0 @@ -import QUnit from 'qunit'; -import { - segmentsFromBase, - addSidxSegmentsToPlaylist -} from '../../src/segment/segmentBase'; -import errors from '../../src/errors'; - -QUnit.module('segmentBase - segmentsFromBase'); - -QUnit.test('sets segment to baseUrl', function(assert) { - const inputAttributes = { - baseUrl: 'http://www.example.com/i.fmp4', - initialization: { sourceURL: 'http://www.example.com/init.fmp4' } - }; - - assert.deepEqual(segmentsFromBase(inputAttributes), [{ - map: { - resolvedUri: 'http://www.example.com/init.fmp4', - uri: 'http://www.example.com/init.fmp4' - }, - resolvedUri: 'http://www.example.com/i.fmp4', - uri: 'http://www.example.com/i.fmp4', - number: 0 - }]); -}); - -QUnit.test('sets duration based on sourceDuration', function(assert) { - const inputAttributes = { - baseUrl: 'http://www.example.com/i.fmp4', - initialization: { sourceURL: 'http://www.example.com/init.fmp4' }, - sourceDuration: 10 - }; - - assert.deepEqual(segmentsFromBase(inputAttributes), [{ - duration: 10, - timeline: 0, - map: { - resolvedUri: 'http://www.example.com/init.fmp4', - uri: 'http://www.example.com/init.fmp4' - }, - resolvedUri: 'http://www.example.com/i.fmp4', - uri: 'http://www.example.com/i.fmp4', - number: 0 - }]); -}); - -// sourceDuration comes from mediaPresentationDuration. The DASH spec defines the type of -// mediaPresentationDuration as xs:duration, which follows ISO 8601. It does not need to -// be adjusted based on timescale. -// -// References: -// https://www.w3.org/TR/xmlschema-2/#duration -// https://en.wikipedia.org/wiki/ISO_8601 -QUnit.test('sets duration based on sourceDuration and not @timescale', function(assert) { - const inputAttributes = { - baseUrl: 'http://www.example.com/i.fmp4', - initialization: { sourceURL: 'http://www.example.com/init.fmp4' }, - sourceDuration: 10, - timescale: 2 - }; - - assert.deepEqual(segmentsFromBase(inputAttributes), [{ - duration: 10, - timeline: 0, - map: { - resolvedUri: 'http://www.example.com/init.fmp4', - uri: 'http://www.example.com/init.fmp4' - }, - resolvedUri: 'http://www.example.com/i.fmp4', - uri: 'http://www.example.com/i.fmp4', - number: 0 - }]); -}); - -QUnit.test('sets duration based on @duration', function(assert) { - const inputAttributes = { - duration: 10, - sourceDuration: 20, - baseUrl: 'http://www.example.com/i.fmp4', - initialization: { sourceURL: 'http://www.example.com/init.fmp4' }, - periodIndex: 0 - }; - - assert.deepEqual(segmentsFromBase(inputAttributes), [{ - duration: 10, - timeline: 0, - map: { - resolvedUri: 'http://www.example.com/init.fmp4', - uri: 'http://www.example.com/init.fmp4' - }, - resolvedUri: 'http://www.example.com/i.fmp4', - uri: 'http://www.example.com/i.fmp4', - number: 0 - }]); -}); - -QUnit.test('sets duration based on @duration and @timescale', function(assert) { - const inputAttributes = { - duration: 10, - sourceDuration: 20, - timescale: 5, - baseUrl: 'http://www.example.com/i.fmp4', - initialization: { sourceURL: 'http://www.example.com/init.fmp4' }, - periodIndex: 0 - }; - - assert.deepEqual(segmentsFromBase(inputAttributes), [{ - duration: 2, - timeline: 0, - map: { - resolvedUri: 'http://www.example.com/init.fmp4', - uri: 'http://www.example.com/init.fmp4' - }, - resolvedUri: 'http://www.example.com/i.fmp4', - uri: 'http://www.example.com/i.fmp4', - number: 0 - }]); -}); - -QUnit.test('translates ranges in node', function(assert) { - const inputAttributes = { - duration: 10, - sourceDuration: 20, - timescale: 5, - baseUrl: 'http://www.example.com/i.fmp4', - initialization: { - sourceURL: 'http://www.example.com/init.fmp4', - range: '121-125' - }, - periodIndex: 0 - }; - - assert.deepEqual(segmentsFromBase(inputAttributes), [{ - duration: 2, - timeline: 0, - map: { - resolvedUri: 'http://www.example.com/init.fmp4', - uri: 'http://www.example.com/init.fmp4', - byterange: { - length: 5, - offset: 121 - } - }, - resolvedUri: 'http://www.example.com/i.fmp4', - uri: 'http://www.example.com/i.fmp4', - number: 0 - }]); -}); - -QUnit.test('errors if no baseUrl exists', function(assert) { - assert.throws(() => segmentsFromBase({}), new Error(errors.NO_BASE_URL)); -}); - -QUnit.module('segmentBase - addSidxSegmentsToPlaylist'); - -QUnit.test('generates playlist from sidx references', function(assert) { - const baseUrl = 'http://www.example.com/i.fmp4'; - const playlist = { - sidx: { - map: { - byterange: { - offset: 0, - length: 10 - } - }, - duration: 10, - byterange: { - offset: 9, - length: 11 - } - }, - segments: [] - }; - const sidx = { - timescale: 1, - firstOffset: 0, - references: [{ - referenceType: 0, - referencedSize: 5, - subsegmentDuration: 2 - }] - }; - - assert.deepEqual(addSidxSegmentsToPlaylist(playlist, sidx, baseUrl).segments, [{ - map: { - byterange: { - offset: 0, - length: 10 - } - }, - uri: 'http://www.example.com/i.fmp4', - resolvedUri: 'http://www.example.com/i.fmp4', - byterange: { - offset: 20, - length: 5 - }, - duration: 2, - timeline: 0, - number: 0 - }]); -}); diff --git a/node_modules/mpd-parser/test/segment/segmentList.test.js b/node_modules/mpd-parser/test/segment/segmentList.test.js deleted file mode 100644 index 52bf9c4..0000000 --- a/node_modules/mpd-parser/test/segment/segmentList.test.js +++ /dev/null @@ -1,553 +0,0 @@ -import QUnit from 'qunit'; -import { - segmentsFromList -} from '../../src/segment/segmentList'; -import errors from '../../src/errors'; - -QUnit.module('segmentList - segmentsFromList'); - -QUnit.test('uses segmentTimeline to set segments', function(assert) { - const inputAttributes = { - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '2.fmp4' - }, { - media: '3.fmp4' - }, { - media: '4.fmp4' - }, { - media: '5.fmp4' - }], - initialization: { sourceURL: 'init.fmp4' }, - periodIndex: 0, - startNumber: 1, - baseUrl: 'http://example.com/' - }; - - const inputTimeline = [{ - t: 1000, - d: 1000, - r: 4 - }]; - - assert.deepEqual(segmentsFromList(inputAttributes, inputTimeline), [{ - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 1 - }, { - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/2.fmp4', - timeline: 0, - uri: '2.fmp4', - number: 2 - }, { - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/3.fmp4', - timeline: 0, - uri: '3.fmp4', - number: 3 - }, { - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/4.fmp4', - timeline: 0, - uri: '4.fmp4', - number: 4 - }, { - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/5.fmp4', - timeline: 0, - uri: '5.fmp4', - number: 5 - }]); -}); - -QUnit.test( - 'truncates if segmentTimeline does not apply for all segments', - function(assert) { - const inputAttributes = { - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '2.fmp4' - }, { - media: '3.fmp4' - }, { - media: '4.fmp4' - }, { - media: '5.fmp4' - }], - initialization: { sourceURL: 'init.fmp4' }, - periodIndex: 0, - startNumber: 1, - baseUrl: 'http://example.com/' - }; - - const inputTimeline = [{ - t: 1000, - d: 1000, - r: 1 - }]; - - assert.deepEqual(segmentsFromList(inputAttributes, inputTimeline), [{ - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 1 - }, { - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/2.fmp4', - timeline: 0, - uri: '2.fmp4', - number: 2 - }]); - } -); - -QUnit.test( - 'if segment timeline is too long does not add extra blank segments', - function(assert) { - const inputAttributes = { - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '2.fmp4' - }, { - media: '3.fmp4' - }, { - media: '4.fmp4' - }, { - media: '5.fmp4' - }], - initialization: { sourceURL: 'init.fmp4' }, - periodIndex: 0, - startNumber: 1, - baseUrl: 'http://example.com/' - }; - - const inputTimeline = [{ - t: 1000, - d: 1000, - r: 10 - }]; - - assert.deepEqual(segmentsFromList(inputAttributes, inputTimeline), [{ - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 1 - }, { - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/2.fmp4', - timeline: 0, - uri: '2.fmp4', - number: 2 - }, { - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/3.fmp4', - timeline: 0, - uri: '3.fmp4', - number: 3 - }, { - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/4.fmp4', - timeline: 0, - uri: '4.fmp4', - number: 4 - }, { - duration: 1000, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/5.fmp4', - timeline: 0, - uri: '5.fmp4', - number: 5 - }]); - } -); - -QUnit.test('uses duration to set segments', function(assert) { - const inputAttributes = { - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '2.fmp4' - }, { - media: '3.fmp4' - }, { - media: '4.fmp4' - }, { - media: '5.fmp4' - }], - initialization: { sourceURL: 'init.fmp4' }, - duration: 10, - periodIndex: 0, - startNumber: 1, - sourceDuration: 50, - baseUrl: 'http://example.com/' - }; - - assert.deepEqual(segmentsFromList(inputAttributes), [{ - duration: 10, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 1 - }, { - duration: 10, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/2.fmp4', - timeline: 0, - uri: '2.fmp4', - number: 2 - }, { - duration: 10, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/3.fmp4', - timeline: 0, - uri: '3.fmp4', - number: 3 - }, { - duration: 10, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/4.fmp4', - timeline: 0, - uri: '4.fmp4', - number: 4 - }, { - duration: 10, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/5.fmp4', - timeline: 0, - uri: '5.fmp4', - number: 5 - }]); -}); - -QUnit.test('uses timescale to set segment duration', function(assert) { - const inputAttributes = { - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '2.fmp4' - }, { - media: '3.fmp4' - }, { - media: '4.fmp4' - }, { - media: '5.fmp4' - }], - initialization: { sourceURL: 'init.fmp4' }, - duration: 10, - timescale: 2, - periodIndex: 0, - startNumber: 1, - sourceDuration: 25, - baseUrl: 'http://example.com/' - }; - - assert.deepEqual(segmentsFromList(inputAttributes), [{ - duration: 5, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 1 - }, { - duration: 5, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/2.fmp4', - timeline: 0, - uri: '2.fmp4', - number: 2 - }, { - duration: 5, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/3.fmp4', - timeline: 0, - uri: '3.fmp4', - number: 3 - }, { - duration: 5, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/4.fmp4', - timeline: 0, - uri: '4.fmp4', - number: 4 - }, { - duration: 5, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/5.fmp4', - timeline: 0, - uri: '5.fmp4', - number: 5 - }]); -}); - -QUnit.test('timescale sets duration of last segment correctly', function(assert) { - const inputAttributes = { - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '2.fmp4' - }], - initialization: { sourceURL: 'init.fmp4' }, - duration: 10, - timescale: 1, - periodIndex: 0, - startNumber: 1, - sourceDuration: 15, - baseUrl: 'http://example.com/' - }; - - assert.deepEqual(segmentsFromList(inputAttributes), [{ - duration: 10, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 1 - }, { - duration: 5, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/2.fmp4', - timeline: 0, - uri: '2.fmp4', - number: 2 - }]); -}); - -QUnit.test('segmentUrl translates ranges correctly', function(assert) { - const inputAttributes = { - segmentUrls: [{ - media: '1.fmp4', - mediaRange: '0-200' - }, { - media: '1.fmp4', - mediaRange: '201-400' - }], - initialization: { sourceURL: 'init.fmp4' }, - duration: 10, - timescale: 1, - periodIndex: 0, - startNumber: 1, - sourceDuration: 20, - baseUrl: 'http://example.com/' - }; - - assert.deepEqual(segmentsFromList(inputAttributes), [{ - duration: 10, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - byterange: { - length: 201, - offset: 0 - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 1 - }, { - duration: 10, - byterange: { - length: 200, - offset: 201 - }, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 2 - }]); -}); - -QUnit.test( - 'throws error if more than 1 segment and no duration or timeline', - function(assert) { - const inputAttributes = { - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '2.fmp4' - }], - duration: 10, - initialization: { sourceURL: 'init.fmp4' }, - timescale: 1, - periodIndex: 0, - startNumber: 1, - sourceDuration: 20, - baseUrl: 'http://example.com/' - }; - - const inputTimeline = [{ - t: 1000, - d: 1000, - r: 4 - }]; - - assert.throws( - () => segmentsFromList(inputAttributes, inputTimeline), - new Error(errors.SEGMENT_TIME_UNSPECIFIED) - ); - } -); - -QUnit.test('throws error if timeline and duration are both defined', function(assert) { - const inputAttributes = { - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '2.fmp4' - }], - initialization: { sourceURL: 'init.fmp4' }, - timescale: 1, - periodIndex: 0, - startNumber: 1, - sourceDuration: 20, - baseUrl: 'http://example.com/' - }; - - assert.throws( - () => segmentsFromList(inputAttributes), - new Error(errors.SEGMENT_TIME_UNSPECIFIED) - ); -}); - -QUnit.test('translates ranges in node', function(assert) { - const inputAttributes = { - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '1.fmp4' - }], - initialization: { sourceURL: 'init.fmp4', range: '121-125' }, - duration: 10, - timescale: 1, - periodIndex: 0, - startNumber: 1, - sourceDuration: 20, - baseUrl: 'http://example.com/' - }; - - assert.deepEqual(segmentsFromList(inputAttributes), [{ - duration: 10, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4', - byterange: { - length: 5, - offset: 121 - } - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 1 - }, { - duration: 10, - map: { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4', - byterange: { - length: 5, - offset: 121 - } - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 2 - }]); -}); diff --git a/node_modules/mpd-parser/test/segment/segmentTemplate.test.js b/node_modules/mpd-parser/test/segment/segmentTemplate.test.js deleted file mode 100644 index e4fa20a..0000000 --- a/node_modules/mpd-parser/test/segment/segmentTemplate.test.js +++ /dev/null @@ -1,1482 +0,0 @@ -import QUnit from 'qunit'; -import { - constructTemplateUrl, - parseTemplateInfo, - segmentsFromTemplate -} from '../../src/segment/segmentTemplate'; - -QUnit.module('segmentTemplate - constructTemplateUrl'); - -QUnit.test('does not change url with no identifiers', function(assert) { - const url = 'path/to/segment.mp4'; - - assert.equal(constructTemplateUrl(url, {}), url, 'no change'); -}); - -QUnit.test('replaces each identifier individually', function(assert) { - const values = { - RepresentationID: 'Rep1', - Bandwidth: 1000, - Number: 2, - Time: 2000 - }; - - const cases = [ - { - url: '/$RepresentationID$/segment.mp4', - expected: '/Rep1/segment.mp4' - }, - { - url: '/$Bandwidth$/segment.mp4', - expected: '/1000/segment.mp4' - }, - { - url: '/$Number$/segment.mp4', - expected: '/2/segment.mp4' - }, - { - url: '/$Time$/segment.mp4', - expected: '/2000/segment.mp4' - }, - { - url: '/$$/segment.mp4', - expected: '/$/segment.mp4' - } - ]; - - cases.forEach(test => { - assert.equal(constructTemplateUrl(test.url, values), test.expected, `constructs ${test.url}`); - }); -}); - -QUnit.test('replaces multiple identifiers in url', function(assert) { - assert.equal( - constructTemplateUrl( - '$$$Time$$$$$/$RepresentationID$/$Bandwidth$/$Number$-$Time$-segment-$Number$.mp4', - { - RepresentationID: 'Rep1', - Bandwidth: 1000, - Number: 2, - Time: 2000 - } - ), - '$2000$$/Rep1/1000/2-2000-segment-2.mp4', - 'correctly replaces multiple identifiers in single url' - ); -}); - -QUnit.test('does not replace unknown identifiers', function(assert) { - assert.equal( - constructTemplateUrl( - '/$UNKNOWN$/$RepresentationID$/$UNKOWN2$/$Number$.mp4', - { - RepresentationID: 'Rep1', - Number: 1 - } - ), - '/$UNKNOWN$/Rep1/$UNKOWN2$/1.mp4', - 'ignores unknown identifiers' - ); -}); - -QUnit.test('honors padding format tag', function(assert) { - assert.equal( - constructTemplateUrl( - '/$Number%03d$/segment.mp4', - { Number: 7 } - ), - '/007/segment.mp4', - 'correctly adds padding when format tag present' - ); -}); - -QUnit.test('does not add padding when value is longer than width', function(assert) { - assert.equal( - constructTemplateUrl( - '/$Bandwidth%06d$/segment.mp4', - { Bandwidth: 999999999 } - ), - '/999999999/segment.mp4', - 'no padding when value longer than format width' - ); -}); - -QUnit.test('does not use padding format tag for $RepresentationID$', function(assert) { - assert.equal( - constructTemplateUrl( - '/$RepresentationID%09d$/$Number%03d$/segment.mp4', - { RepresentationID: 'Rep1', Number: 7 } - ), - '/Rep1/007/segment.mp4', - 'ignores format tag for $RepresentationID$' - ); -}); - -QUnit.module('segmentTemplate - parseTemplateInfo'); - -QUnit.test( - 'one media segment when no @duration attribute or SegmentTimeline element', - function(assert) { - const attributes = { - startNumber: 3, - timescale: 1000, - sourceDuration: 42, - periodIndex: 1 - }; - - assert.deepEqual( - parseTemplateInfo(attributes, void 0), - [ { number: 3, duration: 42, time: 0, timeline: 1 }], - 'creates segment list of one media segment when no @duration attribute or timeline' - ); - } -); - -QUnit.test('uses @duration attribute when present', function(assert) { - const attributes = { - startNumber: 0, - timescale: 1000, - sourceDuration: 16, - duration: 6000, - periodIndex: 1 - }; - - assert.deepEqual( - parseTemplateInfo(attributes, []), - [ - { - number: 0, - duration: 6, - timeline: 1, - time: 0 - }, - { - number: 1, - duration: 6, - timeline: 1, - time: 6000 - }, - { - number: 2, - duration: 4, - timeline: 1, - time: 12000 - } - ], - 'correctly parses segment durations and start times with @duration attribute' - ); -}); - -QUnit.test('parseByDuration allows non zero startNumber', function(assert) { - const attributes = { - startNumber: 101, - timescale: 1000, - sourceDuration: 16, - duration: 6000, - periodIndex: 1 - }; - - assert.deepEqual( - parseTemplateInfo(attributes, []), - [ - { - number: 101, - duration: 6, - timeline: 1, - time: 0 - }, - { - number: 102, - duration: 6, - timeline: 1, - time: 6000 - }, - { - number: 103, - duration: 4, - timeline: 1, - time: 12000 - } - ], - 'allows non zero startNumber' - ); -}); - -QUnit.test('parseByDuration defaults 1 for startNumber and timescale', function(assert) { - const attributes = { - sourceDuration: 11, - duration: '4', - periodIndex: 1 - }; - - assert.deepEqual( - parseTemplateInfo(attributes, []), - [ - { - number: 1, - duration: 4, - timeline: 1, - time: 0 - }, - { - number: 2, - duration: 4, - timeline: 1, - time: 4 - }, - { - number: 3, - duration: 3, - timeline: 1, - time: 8 - } - ], - 'uses default startNumber and timescale value of 1' - ); -}); - -QUnit.test('parseByDuration uses endNumber and has correct duration', function(assert) { - const attributes = { - sourceDuration: 11, - duration: '4', - periodIndex: 1, - endNumber: '2' - }; - - assert.deepEqual( - parseTemplateInfo(attributes, []), - [ - { - number: 1, - duration: 4, - timeline: 1, - time: 0 - }, - { - number: 2, - duration: 7, - timeline: 1, - time: 4 - } - ], - 'uses default startNumber and timescale value of 1' - ); -}); - -QUnit.test('uses SegmentTimeline info when no @duration attribute', function(assert) { - const attributes = { - startNumber: 0, - sourceDuration: 16, - timescale: 1000, - periodIndex: 1 - }; - const segmentTimeline = [ - { - t: 0, - d: 6000 - }, - { - d: 2000 - }, - { - d: 3000 - }, - { - d: 5000 - } - ]; - - assert.deepEqual( - parseTemplateInfo(attributes, segmentTimeline), - [ - { - number: 0, - duration: 6, - time: 0, - timeline: 1 - }, - { - number: 1, - duration: 2, - time: 6000, - timeline: 1 - }, - { - number: 2, - duration: 3, - time: 8000, - timeline: 1 - }, - { - number: 3, - duration: 5, - time: 11000, - timeline: 1 - } - ], - 'correctly calculates segment durations and start times with SegmentTimeline' - ); -}); - -QUnit.test('parseByTimeline allows non zero startNumber', function(assert) { - const attributes = { - startNumber: 101, - sourceDuration: 16, - timescale: 1000, - periodIndex: 1 - }; - const segmentTimeline = [ - { - t: 0, - d: 6000 - }, - { - d: 2000 - }, - { - d: 3000 - }, - { - d: 5000 - } - ]; - - assert.deepEqual( - parseTemplateInfo(attributes, segmentTimeline), - [ - { - number: 101, - duration: 6, - time: 0, - timeline: 1 - }, - { - number: 102, - duration: 2, - time: 6000, - timeline: 1 - }, - { - number: 103, - duration: 3, - time: 8000, - timeline: 1 - }, - { - number: 104, - duration: 5, - time: 11000, - timeline: 1 - } - ], - 'allows non zero startNumber' - ); -}); - -QUnit.test('parseByTimeline defaults 1 for startNumber and timescale', function(assert) { - const attributes = { - sourceDuration: 11, - periodIndex: 1 - }; - const segmentTimeline = [ - { - t: 0, - d: 4 - }, - { - d: 2 - }, - { - d: 3 - }, - { - d: 2 - } - ]; - - assert.deepEqual( - parseTemplateInfo(attributes, segmentTimeline), - [ - { - number: 1, - duration: 4, - time: 0, - timeline: 1 - }, - { - number: 2, - duration: 2, - time: 4, - timeline: 1 - }, - { - number: 3, - duration: 3, - time: 6, - timeline: 1 - }, - { - number: 4, - duration: 2, - time: 9, - timeline: 1 - } - ], - 'defaults to 1 for startNumber and timescale' - ); -}); - -QUnit.test('defaults SegmentTimeline.S@t to 0 for first segment', function(assert) { - const attributes = { - startNumber: 0, - sourceDuration: 16, - timescale: 1000, - periodIndex: 1 - }; - const segmentTimeline = [ - { - d: 6000 - }, - { - d: 2000 - }, - { - d: 3000 - }, - { - d: 5000 - } - ]; - - assert.deepEqual( - parseTemplateInfo(attributes, segmentTimeline), - [ - { - number: 0, - duration: 6, - time: 0, - timeline: 1 - }, - { - number: 1, - duration: 2, - time: 6000, - timeline: 1 - }, - { - number: 2, - duration: 3, - time: 8000, - timeline: 1 - }, - { - number: 3, - duration: 5, - time: 11000, - timeline: 1 - } - ], - 'uses default value of 0' - ); -}); - -QUnit.test('allows non zero starting SegmentTimeline.S@t value', function(assert) { - const attributes = { - startNumber: 0, - sourceDuration: 16, - timescale: 1000, - periodIndex: 1 - }; - const segmentTimeline = [ - { - t: 42000, - d: 6000 - }, - { - d: 2000 - }, - { - d: 3000 - }, - { - d: 5000 - } - ]; - - assert.deepEqual( - parseTemplateInfo(attributes, segmentTimeline), - [ - { - number: 0, - duration: 6, - time: 42000, - timeline: 1 - }, - { - number: 1, - duration: 2, - time: 48000, - timeline: 1 - }, - { - number: 2, - duration: 3, - time: 50000, - timeline: 1 - }, - { - number: 3, - duration: 5, - time: 53000, - timeline: 1 - } - ], - 'allows non zero SegmentTimeline.S@t start value' - ); -}); - -QUnit.test('honors @r repeat attribute for SegmentTimeline.S', function(assert) { - const attributes = { - startNumber: 0, - sourceDuration: 16, - timescale: 1000, - periodIndex: 1 - }; - const segmentTimeline = [ - { - t: 0, - d: 6000 - }, - { - d: 1000, - r: 3 - }, - { - d: 5000 - }, - { - d: 1000 - } - ]; - - assert.deepEqual( - parseTemplateInfo(attributes, segmentTimeline), - [ - { - number: 0, - duration: 6, - time: 0, - timeline: 1 - }, - { - number: 1, - duration: 1, - time: 6000, - timeline: 1 - }, - { - number: 2, - duration: 1, - time: 7000, - timeline: 1 - }, - { - number: 3, - duration: 1, - time: 8000, - timeline: 1 - }, - { - number: 4, - duration: 1, - time: 9000, - timeline: 1 - }, - { - number: 5, - duration: 5, - time: 10000, - timeline: 1 - }, - { - number: 6, - duration: 1, - time: 15000, - timeline: 1 - } - ], - 'correctly uses @r repeat attribute' - ); -}); - -QUnit.test('correctly handles negative @r repeat value', function(assert) { - const attributes = { - startNumber: 0, - sourceDuration: 16, - timescale: 1000, - periodIndex: 1 - }; - const segmentTimeline = [ - { - t: 0, - d: 6000 - }, - { - d: 1000, - r: -1 - }, - { - t: 10000, - d: 5000 - }, - { - d: 1000 - } - ]; - - assert.deepEqual( - parseTemplateInfo(attributes, segmentTimeline), - [ - { - number: 0, - duration: 6, - time: 0, - timeline: 1 - }, - { - number: 1, - duration: 1, - time: 6000, - timeline: 1 - }, - { - number: 2, - duration: 1, - time: 7000, - timeline: 1 - }, - { - number: 3, - duration: 1, - time: 8000, - timeline: 1 - }, - { - number: 4, - duration: 1, - time: 9000, - timeline: 1 - }, - { - number: 5, - duration: 5, - time: 10000, - timeline: 1 - }, - { - number: 6, - duration: 1, - time: 15000, - timeline: 1 - } - ], - 'correctly uses negative @r repeat attribute' - ); -}); - -QUnit.test('correctly handles negative @r repeat value for last S', function(assert) { - const attributes = { - startNumber: 0, - sourceDuration: 15, - timescale: 1000, - periodIndex: 1 - }; - const segmentTimeline = [ - { - t: 0, - d: 6000 - }, - { - d: 3000, - r: -1 - } - ]; - - assert.deepEqual( - parseTemplateInfo(attributes, segmentTimeline), - [ - { - number: 0, - duration: 6, - time: 0, - timeline: 1 - }, - { - number: 1, - duration: 3, - time: 6000, - timeline: 1 - }, - { - number: 2, - duration: 3, - time: 9000, - timeline: 1 - }, - { - number: 3, - duration: 3, - time: 12000, - timeline: 1 - } - ], - 'correctly uses negative @r repeat attribute for last S' - ); -}); - -QUnit.skip( - 'detects discontinuity when @t time is greater than expected start time', - function(assert) { - - } -); - -QUnit.module('segmentTemplate - type ="dynamic"'); - -QUnit.test('correctly handles duration', function(assert) { - const basicAttributes = { - baseUrl: 'http://www.example.com/', - type: 'dynamic', - media: 'n-$Number$.m4s', - minimumUpdatePeriod: 0, - timescale: 1, - NOW: 10000, - clientOffset: 0, - availabilityStartTime: 0, - startNumber: 1, - duration: 2, - periodIndex: 1 - }; - - assert.deepEqual( - segmentsFromTemplate(basicAttributes, []), - [{ - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 1, - resolvedUri: 'http://www.example.com/n-1.m4s', - timeline: 1, - uri: 'n-1.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 2, - resolvedUri: 'http://www.example.com/n-2.m4s', - timeline: 1, - uri: 'n-2.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 3, - resolvedUri: 'http://www.example.com/n-3.m4s', - timeline: 1, - uri: 'n-3.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 4, - resolvedUri: 'http://www.example.com/n-4.m4s', - timeline: 1, - uri: 'n-4.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 5, - resolvedUri: 'http://www.example.com/n-5.m4s', - timeline: 1, - uri: 'n-5.m4s' - }], - 'segments correctly with basic settings' - ); - - assert.deepEqual( - segmentsFromTemplate(Object.assign({}, basicAttributes, { startNumber: 10 }), []), - [{ - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 10, - resolvedUri: 'http://www.example.com/n-10.m4s', - timeline: 1, - uri: 'n-10.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 11, - resolvedUri: 'http://www.example.com/n-11.m4s', - timeline: 1, - uri: 'n-11.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 12, - resolvedUri: 'http://www.example.com/n-12.m4s', - timeline: 1, - uri: 'n-12.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 13, - resolvedUri: 'http://www.example.com/n-13.m4s', - timeline: 1, - uri: 'n-13.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 14, - resolvedUri: 'http://www.example.com/n-14.m4s', - timeline: 1, - uri: 'n-14.m4s' - }], - 'segments adjusted correctly based on @startNumber' - ); - - assert.deepEqual( - segmentsFromTemplate(Object.assign( - {}, basicAttributes, - { availabilityStartTime: 4 } - ), []), - [{ - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 1, - resolvedUri: 'http://www.example.com/n-1.m4s', - timeline: 1, - uri: 'n-1.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 2, - resolvedUri: 'http://www.example.com/n-2.m4s', - timeline: 1, - uri: 'n-2.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 3, - resolvedUri: 'http://www.example.com/n-3.m4s', - timeline: 1, - uri: 'n-3.m4s' - }], - 'segments correct with @availabilityStartTime set' - ); - - assert.deepEqual( - segmentsFromTemplate(Object.assign( - {}, basicAttributes, - { availabilityStartTime: 2, start: 4 } - ), []), - [{ - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 1, - resolvedUri: 'http://www.example.com/n-1.m4s', - timeline: 1, - uri: 'n-1.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 2, - resolvedUri: 'http://www.example.com/n-2.m4s', - timeline: 1, - uri: 'n-2.m4s' - }], - 'segments correct with @availabilityStartTime and @start set' - ); - - assert.deepEqual( - segmentsFromTemplate(Object.assign( - {}, basicAttributes, - { timeShiftBufferDepth: 4 }, [] - )), - [{ - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 4, - resolvedUri: 'http://www.example.com/n-4.m4s', - timeline: 1, - uri: 'n-4.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 5, - resolvedUri: 'http://www.example.com/n-5.m4s', - timeline: 1, - uri: 'n-5.m4s' - }], - 'segments correct with @timeShiftBufferDepth set' - ); - - assert.deepEqual( - segmentsFromTemplate(Object.assign( - {}, basicAttributes, - { clientOffset: -2000 }, [] - )), - [{ - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 1, - resolvedUri: 'http://www.example.com/n-1.m4s', - timeline: 1, - uri: 'n-1.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 2, - resolvedUri: 'http://www.example.com/n-2.m4s', - timeline: 1, - uri: 'n-2.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 3, - resolvedUri: 'http://www.example.com/n-3.m4s', - timeline: 1, - uri: 'n-3.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 4, - resolvedUri: 'http://www.example.com/n-4.m4s', - timeline: 1, - uri: 'n-4.m4s' - }], - 'segments correct with given clientOffset' - ); - - assert.deepEqual( - segmentsFromTemplate(Object.assign( - {}, basicAttributes, - { endNumber: '4' }, [] - )), - [{ - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 1, - resolvedUri: 'http://www.example.com/n-1.m4s', - timeline: 1, - uri: 'n-1.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 2, - resolvedUri: 'http://www.example.com/n-2.m4s', - timeline: 1, - uri: 'n-2.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 3, - resolvedUri: 'http://www.example.com/n-3.m4s', - timeline: 1, - uri: 'n-3.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 4, - resolvedUri: 'http://www.example.com/n-4.m4s', - timeline: 1, - uri: 'n-4.m4s' - }], - 'segments correct with endNumber' - ); -}); - -QUnit.test('correctly handles duration with segmentTimeline', function(assert) { - const basicAttributes = { - baseUrl: 'http://www.example.com/', - type: 'dynamic', - media: 'n-$Number$.m4s', - minimumUpdatePeriod: 2, - timescale: 1, - NOW: 8000, - clientOffset: 0, - availabilityStartTime: 0, - startNumber: 1, - periodIndex: 1 - }; - - const segmentTimeline = [ - { - t: 0, - d: 2, - r: 1 - }, - { - d: 2, - r: -1 - } - ]; - - assert.deepEqual( - segmentsFromTemplate(basicAttributes, segmentTimeline), - [{ - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 1, - resolvedUri: 'http://www.example.com/n-1.m4s', - timeline: 1, - uri: 'n-1.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 2, - resolvedUri: 'http://www.example.com/n-2.m4s', - timeline: 1, - uri: 'n-2.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 3, - resolvedUri: 'http://www.example.com/n-3.m4s', - timeline: 1, - uri: 'n-3.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 4, - resolvedUri: 'http://www.example.com/n-4.m4s', - timeline: 1, - uri: 'n-4.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 5, - resolvedUri: 'http://www.example.com/n-5.m4s', - timeline: 1, - uri: 'n-5.m4s' - }], - 'segments should fill until current time when r = -1 and @minimumUpdatePeriod > 0' - ); - - assert.deepEqual( - segmentsFromTemplate(Object.assign({}, basicAttributes, {clientOffset: -2000}), segmentTimeline), - [{ - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 1, - resolvedUri: 'http://www.example.com/n-1.m4s', - timeline: 1, - uri: 'n-1.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 2, - resolvedUri: 'http://www.example.com/n-2.m4s', - timeline: 1, - uri: 'n-2.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 3, - resolvedUri: 'http://www.example.com/n-3.m4s', - timeline: 1, - uri: 'n-3.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 4, - resolvedUri: 'http://www.example.com/n-4.m4s', - timeline: 1, - uri: 'n-4.m4s' - }], - 'segments should fill correctly when taking client offset into account' - ); - - const segmentTimelineShifted = [ - { - t: 2, - d: 2, - r: 1 - }, - { - d: 2, - r: -1 - } - ]; - - assert.deepEqual( - segmentsFromTemplate(basicAttributes, segmentTimelineShifted), - [{ - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 1, - resolvedUri: 'http://www.example.com/n-1.m4s', - timeline: 1, - uri: 'n-1.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 2, - resolvedUri: 'http://www.example.com/n-2.m4s', - timeline: 1, - uri: 'n-2.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 3, - resolvedUri: 'http://www.example.com/n-3.m4s', - timeline: 1, - uri: 'n-3.m4s' - }, { - duration: 2, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 4, - resolvedUri: 'http://www.example.com/n-4.m4s', - timeline: 1, - uri: 'n-4.m4s' - }], - 'segments take into account different time value for first segment' - ); - - assert.deepEqual( - segmentsFromTemplate( - Object.assign({}, basicAttributes, {timescale: 2 }), - segmentTimelineShifted - ), - [{ - duration: 1, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 1, - resolvedUri: 'http://www.example.com/n-1.m4s', - timeline: 1, - uri: 'n-1.m4s' - }, { - duration: 1, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 2, - resolvedUri: 'http://www.example.com/n-2.m4s', - timeline: 1, - uri: 'n-2.m4s' - }, { - duration: 1, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 3, - resolvedUri: 'http://www.example.com/n-3.m4s', - timeline: 1, - uri: 'n-3.m4s' - }, { - duration: 1, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 4, - resolvedUri: 'http://www.example.com/n-4.m4s', - timeline: 1, - uri: 'n-4.m4s' - }, { - duration: 1, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 5, - resolvedUri: 'http://www.example.com/n-5.m4s', - timeline: 1, - uri: 'n-5.m4s' - }, { - duration: 1, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 6, - resolvedUri: 'http://www.example.com/n-6.m4s', - timeline: 1, - uri: 'n-6.m4s' - }, { - duration: 1, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 7, - resolvedUri: 'http://www.example.com/n-7.m4s', - timeline: 1, - uri: 'n-7.m4s' - }, { - duration: 1, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 8, - resolvedUri: 'http://www.example.com/n-8.m4s', - timeline: 1, - uri: 'n-8.m4s' - }, { - duration: 1, - map: { - resolvedUri: 'http://www.example.com/', - uri: '' - }, - number: 9, - resolvedUri: 'http://www.example.com/n-9.m4s', - timeline: 1, - uri: 'n-9.m4s' - }], - 'segments take into account different time value for first segment with timescale' - ); -}); - -QUnit.module('segmentTemplate - segmentsFromTemplate'); - -QUnit.test('constructs simple segment list and resolves uris', function(assert) { - const attributes = { - startNumber: 0, - duration: 6000, - sourceDuration: 16, - timescale: 1000, - bandwidth: 100, - id: 'Rep1', - initialization: { - sourceURL: '$RepresentationID$/$Bandwidth$/init.mp4' - }, - media: '$RepresentationID$/$Bandwidth$/$Number%03d$-$Time%05d$.mp4', - periodIndex: 1, - baseUrl: 'https://example.com/' - }; - const segments = [ - { - duration: 6, - map: { - resolvedUri: 'https://example.com/Rep1/100/init.mp4', - uri: 'Rep1/100/init.mp4' - }, - resolvedUri: 'https://example.com/Rep1/100/000-00000.mp4', - timeline: 1, - uri: 'Rep1/100/000-00000.mp4', - number: 0 - }, - { - duration: 6, - map: { - resolvedUri: 'https://example.com/Rep1/100/init.mp4', - uri: 'Rep1/100/init.mp4' - }, - resolvedUri: 'https://example.com/Rep1/100/001-06000.mp4', - timeline: 1, - uri: 'Rep1/100/001-06000.mp4', - number: 1 - }, - { - duration: 4, - map: { - resolvedUri: 'https://example.com/Rep1/100/init.mp4', - uri: 'Rep1/100/init.mp4' - }, - resolvedUri: 'https://example.com/Rep1/100/002-12000.mp4', - timeline: 1, - uri: 'Rep1/100/002-12000.mp4', - number: 2 - } - ]; - - assert.deepEqual( - segmentsFromTemplate(attributes, void 0), segments, - 'creates segments from template' - ); -}); - -QUnit.test('constructs simple segment list and with node', function(assert) { - const attributes = { - startNumber: 0, - duration: 6000, - sourceDuration: 16, - timescale: 1000, - bandwidth: 100, - id: 'Rep1', - initialization: { - sourceURL: 'init.mp4', - range: '121-125' - }, - media: '$RepresentationID$/$Bandwidth$/$Number%03d$-$Time%05d$.mp4', - periodIndex: 1, - baseUrl: 'https://example.com/' - }; - const segments = [ - { - duration: 6, - map: { - resolvedUri: 'https://example.com/init.mp4', - uri: 'init.mp4', - byterange: { - length: 5, - offset: 121 - } - }, - resolvedUri: 'https://example.com/Rep1/100/000-00000.mp4', - timeline: 1, - uri: 'Rep1/100/000-00000.mp4', - number: 0 - }, - { - duration: 6, - map: { - resolvedUri: 'https://example.com/init.mp4', - uri: 'init.mp4', - byterange: { - length: 5, - offset: 121 - } - }, - resolvedUri: 'https://example.com/Rep1/100/001-06000.mp4', - timeline: 1, - uri: 'Rep1/100/001-06000.mp4', - number: 1 - }, - { - duration: 4, - map: { - resolvedUri: 'https://example.com/init.mp4', - uri: 'init.mp4', - byterange: { - length: 5, - offset: 121 - } - }, - resolvedUri: 'https://example.com/Rep1/100/002-12000.mp4', - timeline: 1, - uri: 'Rep1/100/002-12000.mp4', - number: 2 - } - ]; - - assert.deepEqual( - segmentsFromTemplate(attributes, void 0), segments, - 'creates segments from template' - ); -}); diff --git a/node_modules/mpd-parser/test/segment/urlType.test.js b/node_modules/mpd-parser/test/segment/urlType.test.js deleted file mode 100644 index 8469562..0000000 --- a/node_modules/mpd-parser/test/segment/urlType.test.js +++ /dev/null @@ -1,94 +0,0 @@ -import QUnit from 'qunit'; -import { - urlTypeToSegment as urlTypeConverter, - byteRangeToString -} from '../../src/segment/urlType'; - -QUnit.module('urlType - urlTypeConverter'); - -QUnit.test('returns correct object if given baseUrl only', function(assert) { - assert.deepEqual(urlTypeConverter({ baseUrl: 'http://example.com/' }), { - resolvedUri: 'http://example.com/', - uri: '' - }); -}); - -QUnit.test('returns correct object if given baseUrl and source', function(assert) { - assert.deepEqual(urlTypeConverter({ - baseUrl: 'http://example.com', - source: 'init.fmp4' - }), { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4' - }); -}); - -QUnit.test('returns correct object if given baseUrl, source and range', function(assert) { - assert.deepEqual(urlTypeConverter({ - baseUrl: 'http://example.com', - source: 'init.fmp4', - range: '101-105' - }), { - resolvedUri: 'http://example.com/init.fmp4', - uri: 'init.fmp4', - byterange: { - offset: 101, - length: 5 - } - }); -}); - -QUnit.test('returns correct object if given baseUrl, source and indexRange', function(assert) { - assert.deepEqual(urlTypeConverter({ - baseUrl: 'http://example.com', - source: 'sidx.fmp4', - indexRange: '101-105' - }), { - resolvedUri: 'http://example.com/sidx.fmp4', - uri: 'sidx.fmp4', - byterange: { - offset: 101, - length: 5 - } - }); -}); - -QUnit.test('returns correct object if given baseUrl and range', function(assert) { - assert.deepEqual(urlTypeConverter({ - baseUrl: 'http://example.com/', - range: '101-105' - }), { - resolvedUri: 'http://example.com/', - uri: '', - byterange: { - offset: 101, - length: 5 - } - }); -}); - -QUnit.test('returns correct object if given baseUrl and indexRange', function(assert) { - assert.deepEqual(urlTypeConverter({ - baseUrl: 'http://example.com/', - indexRange: '101-105' - }), { - resolvedUri: 'http://example.com/', - uri: '', - byterange: { - offset: 101, - length: 5 - } - }); -}); - -QUnit.module('urlType - byteRangeToString'); - -QUnit.test('returns correct string representing byterange object', function(assert) { - assert.strictEqual( - byteRangeToString({ - offset: 0, - length: 100 - }), - '0-99' - ); -}); diff --git a/node_modules/mpd-parser/test/stringToMpdXml.test.js b/node_modules/mpd-parser/test/stringToMpdXml.test.js deleted file mode 100644 index 6b808f0..0000000 --- a/node_modules/mpd-parser/test/stringToMpdXml.test.js +++ /dev/null @@ -1,21 +0,0 @@ -import { stringToMpdXml } from '../src/stringToMpdXml'; -import errors from '../src/errors'; -import QUnit from 'qunit'; - -QUnit.module('stringToMpdXml'); - -QUnit.test('simple mpd', function(assert) { - assert.deepEqual(stringToMpdXml('').tagName, 'MPD'); -}); - -QUnit.test('invalid xml', function(assert) { - assert.throws(() => stringToMpdXml(' stringToMpdXml(''), new RegExp(errors.DASH_INVALID_XML)); -}); - -QUnit.test('empty manifest', function(assert) { - assert.throws(() => stringToMpdXml(''), new RegExp(errors.DASH_EMPTY_MANIFEST)); -}); diff --git a/node_modules/mpd-parser/test/toM3u8.test.js b/node_modules/mpd-parser/test/toM3u8.test.js deleted file mode 100644 index 6742c0a..0000000 --- a/node_modules/mpd-parser/test/toM3u8.test.js +++ /dev/null @@ -1,935 +0,0 @@ -import { toM3u8, generateSidxKey } from '../src/toM3u8'; -import QUnit from 'qunit'; - -QUnit.module('toM3u8'); - -QUnit.test('playlists', function(assert) { - const input = [{ - attributes: { - id: '1', - codecs: 'foo;bar', - sourceDuration: 100, - duration: 0, - bandwidth: 20000, - periodIndex: 1, - mimeType: 'audio/mp4' - }, - segments: [] - }, { - attributes: { - id: '2', - codecs: 'foo;bar', - sourceDuration: 100, - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'audio/mp4' - }, - segments: [] - }, { - attributes: { - sourceDuration: 100, - id: '1', - width: 800, - height: 600, - codecs: 'foo;bar', - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'video/mp4' - }, - segments: [] - }, { - attributes: { - sourceDuration: 100, - id: '1', - bandwidth: 20000, - periodIndex: 1, - mimeType: 'text/vtt', - baseUrl: 'https://www.example.com/vtt' - } - }, { - attributes: { - sourceDuration: 100, - id: '1', - bandwidth: 10000, - periodIndex: 1, - mimeType: 'text/vtt', - baseUrl: 'https://www.example.com/vtt' - } - }]; - - const expected = { - allowCache: true, - discontinuityStarts: [], - duration: 100, - endList: true, - mediaGroups: { - AUDIO: { - audio: { - main: { - autoselect: true, - default: true, - language: '', - playlists: [{ - attributes: { - BANDWIDTH: 20000, - CODECS: 'foo;bar', - NAME: '1', - ['PROGRAM-ID']: 1 - }, - mediaSequence: 1, - endList: true, - resolvedUri: '', - segments: [], - timeline: 1, - uri: '', - targetDuration: 0 - }, { - attributes: { - BANDWIDTH: 10000, - CODECS: 'foo;bar', - NAME: '2', - ['PROGRAM-ID']: 1 - }, - mediaSequence: 1, - endList: true, - resolvedUri: '', - segments: [], - timeline: 1, - uri: '', - targetDuration: 0 - - }], - uri: '' - } - } - }, - ['CLOSED-CAPTIONS']: {}, - SUBTITLES: { - subs: { - text: { - autoselect: false, - default: false, - language: 'text', - playlists: [{ - attributes: { - BANDWIDTH: 20000, - NAME: '1', - ['PROGRAM-ID']: 1 - }, - mediaSequence: 0, - targetDuration: 100, - endList: true, - resolvedUri: 'https://www.example.com/vtt', - segments: [{ - duration: 100, - resolvedUri: 'https://www.example.com/vtt', - timeline: 1, - uri: 'https://www.example.com/vtt', - number: 0 - }], - timeline: 1, - uri: '' - }, { - attributes: { - BANDWIDTH: 10000, - NAME: '1', - ['PROGRAM-ID']: 1 - }, - mediaSequence: 0, - targetDuration: 100, - endList: true, - resolvedUri: 'https://www.example.com/vtt', - segments: [{ - duration: 100, - resolvedUri: 'https://www.example.com/vtt', - timeline: 1, - uri: 'https://www.example.com/vtt', - number: 0 - }], - timeline: 1, - uri: '' - }], - uri: '' - } - } - }, - VIDEO: {} - }, - playlists: [{ - attributes: { - AUDIO: 'audio', - SUBTITLES: 'subs', - BANDWIDTH: 10000, - CODECS: 'foo;bar', - NAME: '1', - ['PROGRAM-ID']: 1, - RESOLUTION: { - height: 600, - width: 800 - } - }, - endList: true, - mediaSequence: 1, - targetDuration: 0, - resolvedUri: '', - segments: [], - timeline: 1, - uri: '' - }], - segments: [], - uri: '' - }; - - assert.deepEqual(toM3u8(input), expected); -}); - -QUnit.test('playlists with segments', function(assert) { - const input = [{ - attributes: { - id: '1', - codecs: 'foo;bar', - duration: 2, - sourceDuration: 100, - bandwidth: 20000, - periodIndex: 1, - mimeType: 'audio/mp4' - }, - segments: [{ - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 1 - }, { - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 2 - }] - }, { - attributes: { - id: '2', - codecs: 'foo;bar', - sourceDuration: 100, - duration: 2, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'audio/mp4' - }, - segments: [{ - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 1 - }, { - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 2 - }] - }, { - attributes: { - sourceDuration: 100, - id: '1', - width: 800, - duration: 2, - height: 600, - codecs: 'foo;bar', - bandwidth: 10000, - periodIndex: 1, - mimeType: 'video/mp4' - }, - segments: [{ - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 1 - }, { - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 2 - }] - }, { - attributes: { - sourceDuration: 100, - id: '1', - duration: 2, - bandwidth: 20000, - periodIndex: 1, - mimeType: 'text/vtt', - baseUrl: 'https://www.example.com/vtt' - }, - segments: [{ - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 1 - }, { - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 2 - }] - }, { - attributes: { - sourceDuration: 100, - duration: 2, - id: '2', - bandwidth: 10000, - periodIndex: 1, - mimeType: 'text/vtt', - baseUrl: 'https://www.example.com/vtt' - }, - segments: [{ - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 1 - }, { - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 2 - }] - }]; - - const expected = { - allowCache: true, - discontinuityStarts: [], - duration: 100, - endList: true, - mediaGroups: { - AUDIO: { - audio: { - main: { - autoselect: true, - default: true, - language: '', - playlists: [{ - attributes: { - BANDWIDTH: 20000, - CODECS: 'foo;bar', - NAME: '1', - ['PROGRAM-ID']: 1 - }, - targetDuration: 2, - mediaSequence: 1, - endList: true, - resolvedUri: '', - segments: [{ - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 1 - }, { - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 2 - }], - timeline: 1, - uri: '' - }, { - attributes: { - BANDWIDTH: 10000, - CODECS: 'foo;bar', - NAME: '2', - ['PROGRAM-ID']: 1 - }, - targetDuration: 2, - mediaSequence: 1, - endList: true, - resolvedUri: '', - segments: [{ - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 1 - }, { - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 2 - }], - timeline: 1, - uri: '' - }], - uri: '' - } - } - }, - ['CLOSED-CAPTIONS']: {}, - SUBTITLES: { - subs: { - text: { - autoselect: false, - default: false, - language: 'text', - playlists: [{ - attributes: { - BANDWIDTH: 20000, - NAME: '1', - ['PROGRAM-ID']: 1 - }, - endList: true, - targetDuration: 2, - mediaSequence: 1, - resolvedUri: 'https://www.example.com/vtt', - segments: [{ - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 1 - }, { - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 2 - }], - timeline: 1, - uri: '' - }, { - attributes: { - BANDWIDTH: 10000, - NAME: '2', - ['PROGRAM-ID']: 1 - }, - endList: true, - targetDuration: 2, - mediaSequence: 1, - resolvedUri: 'https://www.example.com/vtt', - segments: [{ - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 1 - }, { - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 2 - }], - timeline: 1, - uri: '' - }], - uri: '' - } - } - }, - VIDEO: {} - }, - playlists: [{ - attributes: { - AUDIO: 'audio', - SUBTITLES: 'subs', - BANDWIDTH: 10000, - CODECS: 'foo;bar', - NAME: '1', - ['PROGRAM-ID']: 1, - RESOLUTION: { - height: 600, - width: 800 - } - }, - endList: true, - resolvedUri: '', - mediaSequence: 1, - targetDuration: 2, - segments: [{ - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 1 - }, { - uri: '', - timeline: 1, - duration: 2, - resolvedUri: '', - map: { - uri: '', - resolvedUri: '' - }, - number: 2 - }], - timeline: 1, - uri: '' - }], - segments: [], - uri: '' - }; - - assert.deepEqual(toM3u8(input), expected); -}); - -QUnit.test('playlists with sidx and sidxMapping', function(assert) { - const input = [{ - attributes: { - sourceDuration: 100, - id: '1', - width: 800, - height: 600, - codecs: 'foo;bar', - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'video/mp4' - }, - segments: [], - sidx: { - byterange: { - offset: 10, - length: 10 - }, - uri: 'sidx.mp4', - resolvedUri: 'http://example.com/sidx.mp4', - duration: 10 - }, - uri: 'http://example.com/fmp4.mp4' - }]; - - const mapping = { - 'sidx.mp4-10-19': { - sidx: { - timescale: 1, - firstOffset: 0, - references: [{ - referenceType: 0, - referencedSize: 5, - subsegmentDuration: 2 - }] - } - } - }; - - const expected = [{ - attributes: { - AUDIO: 'audio', - SUBTITLES: 'subs', - BANDWIDTH: 10000, - CODECS: 'foo;bar', - NAME: '1', - ['PROGRAM-ID']: 1, - RESOLUTION: { - height: 600, - width: 800 - } - }, - sidx: { - byterange: { - offset: 10, - length: 10 - }, - uri: 'sidx.mp4', - resolvedUri: 'http://example.com/sidx.mp4', - duration: 10 - }, - targetDuration: 0, - timeline: 1, - uri: '', - segments: [{ - map: { - resolvedUri: 'http://example.com/sidx.mp4', - uri: '' - }, - byterange: { - offset: 20, - length: 5 - }, - uri: 'http://example.com/sidx.mp4', - resolvedUri: 'http://example.com/sidx.mp4', - duration: 2, - number: 0, - timeline: 1 - }], - endList: true, - mediaSequence: 1, - resolvedUri: '' - }]; - - assert.deepEqual(toM3u8(input, null, mapping).playlists, expected); -}); - -QUnit.test('playlists without minimumUpdatePeriod dont assign default value', function(assert) { - const input = [{ - attributes: { - sourceDuration: 100, - id: '1', - width: 800, - height: 600, - codecs: 'foo;bar', - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'video/mp4' - }, - segments: [], - sidx: { - byterange: { - offset: 10, - length: 10 - }, - uri: 'sidx.mp4', - resolvedUri: 'http://example.com/sidx.mp4', - duration: 10 - }, - uri: 'http://example.com/fmp4.mp4' - }]; - - assert.equal(toM3u8(input).minimumUpdatePeriod, undefined); -}); - -QUnit.test('playlists with minimumUpdatePeriod = 0', function(assert) { - const input = [{ - attributes: { - sourceDuration: 100, - id: '1', - width: 800, - height: 600, - codecs: 'foo;bar', - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'video/mp4', - minimumUpdatePeriod: 0 - }, - segments: [], - sidx: { - byterange: { - offset: 10, - length: 10 - }, - uri: 'sidx.mp4', - resolvedUri: 'http://example.com/sidx.mp4', - duration: 10 - }, - uri: 'http://example.com/fmp4.mp4' - }]; - - assert.equal(toM3u8(input).minimumUpdatePeriod, 0); -}); - -QUnit.test('playlists with integer value for minimumUpdatePeriod', function(assert) { - const input = [{ - attributes: { - sourceDuration: 100, - id: '1', - width: 800, - height: 600, - codecs: 'foo;bar', - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'video/mp4', - minimumUpdatePeriod: 2 - }, - segments: [], - sidx: { - byterange: { - offset: 10, - length: 10 - }, - uri: 'sidx.mp4', - resolvedUri: 'http://example.com/sidx.mp4', - duration: 10 - }, - uri: 'http://example.com/fmp4.mp4' - }]; - - assert.equal(toM3u8(input).minimumUpdatePeriod, 2000, 'converts update period to ms'); -}); - -QUnit.test('no playlists', function(assert) { - assert.deepEqual(toM3u8([]), {}); -}); - -QUnit.test('dynamic playlists with suggestedPresentationDelay', function(assert) { - const input = [{ - attributes: { - id: '1', - codecs: 'foo;bar', - sourceDuration: 100, - duration: 0, - bandwidth: 20000, - periodIndex: 1, - mimeType: 'audio/mp4', - type: 'dynamic', - suggestedPresentationDelay: 18 - }, - segments: [] - }, { - attributes: { - id: '2', - codecs: 'foo;bar', - sourceDuration: 100, - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'audio/mp4' - }, - segments: [] - }, { - attributes: { - sourceDuration: 100, - id: '1', - width: 800, - height: 600, - codecs: 'foo;bar', - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'video/mp4' - }, - segments: [] - }, { - attributes: { - sourceDuration: 100, - id: '1', - bandwidth: 20000, - periodIndex: 1, - mimeType: 'text/vtt', - baseUrl: 'https://www.example.com/vtt' - } - }, { - attributes: { - sourceDuration: 100, - id: '1', - bandwidth: 10000, - periodIndex: 1, - mimeType: 'text/vtt', - baseUrl: 'https://www.example.com/vtt' - } - }]; - - const output = toM3u8(input); - - assert.ok('suggestedPresentationDelay' in output); - assert.deepEqual(output.suggestedPresentationDelay, 18); -}); - -QUnit.test('playlists with label', function(assert) { - const label = 'English with commentary'; - const input = [{ - attributes: { - id: '1', - codecs: 'foo;bar', - sourceDuration: 100, - duration: 0, - bandwidth: 20000, - periodIndex: 1, - mimeType: 'audio/mp4', - type: 'dynamic', - label - }, - segments: [] - }, { - attributes: { - id: '2', - codecs: 'foo;bar', - sourceDuration: 100, - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'audio/mp4' - }, - segments: [] - }, { - attributes: { - sourceDuration: 100, - id: '1', - width: 800, - height: 600, - codecs: 'foo;bar', - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'video/mp4' - }, - segments: [] - }]; - const output = toM3u8(input); - - assert.ok(label in output.mediaGroups.AUDIO.audio, 'label exists'); -}); - -QUnit.test('608 captions', function(assert) { - const input = [{ - attributes: { - captionServices: [{ - channel: 'CC1', - language: 'CC1' - }, { - channel: 'CC2', - language: 'CC2' - }, { - channel: undefined, - language: 'English' - }, { - channel: 'CC4', - language: 'eng' - }], - id: '1', - codecs: 'foo;bar', - sourceDuration: 100, - duration: 0, - bandwidth: 20000, - periodIndex: 1, - mimeType: 'audio/mp4', - type: 'dynamic' - }, - segments: [] - }, { - attributes: { - id: '2', - codecs: 'foo;bar', - sourceDuration: 100, - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'audio/mp4' - }, - segments: [] - }, { - attributes: { - sourceDuration: 100, - id: '1', - width: 800, - height: 600, - codecs: 'foo;bar', - duration: 0, - bandwidth: 10000, - periodIndex: 1, - mimeType: 'video/mp4' - }, - segments: [] - }]; - const output = toM3u8(input); - - const cc = output.mediaGroups['CLOSED-CAPTIONS'].cc; - - Object.keys(cc).forEach((key) => { - assert.notOk(cc[key].autoselect, 'no autoselect'); - assert.notOk(cc[key].default, 'no default'); - }); - - assert.deepEqual(Object.keys(cc), ['CC1', 'CC2', 'English', 'eng'], 'we have 4 channels'); - assert.equal(cc.CC1.instreamId, 'CC1', 'CC1 has an instreamId of CC1'); - assert.equal(cc.CC2.instreamId, 'CC2', 'CC2 has an instreamId of CC1'); - assert.equal(cc.English.instreamId, undefined, 'English captions dont have an instreamId'); - assert.equal(cc.eng.instreamId, 'CC4', 'eng captions have an instreamId of CC4'); -}); - -QUnit.module('generateSidxKey'); - -QUnit.test('generates correct key', function(assert) { - const sidxInfo = { - byterange: { - offset: 1, - length: 5 - }, - uri: 'uri' - }; - - assert.strictEqual( - generateSidxKey(sidxInfo), - 'uri-1-5', - 'the key byterange should have a inclusive end' - ); -}); - diff --git a/node_modules/mpd-parser/test/toPlaylists.test.js b/node_modules/mpd-parser/test/toPlaylists.test.js deleted file mode 100644 index 344dc5a..0000000 --- a/node_modules/mpd-parser/test/toPlaylists.test.js +++ /dev/null @@ -1,211 +0,0 @@ -import { - toPlaylists -} from '../src/toPlaylists'; -import QUnit from 'qunit'; - -QUnit.module('toPlaylists'); - -QUnit.test('no representations', function(assert) { - assert.deepEqual(toPlaylists([]), []); -}); - -QUnit.test('pretty simple', function(assert) { - const representations = [{ - attributes: { baseUrl: 'http://example.com/', periodIndex: 0, sourceDuration: 2 }, - segmentInfo: { - template: { } - } - }]; - - const playlists = [{ - attributes: { - baseUrl: 'http://example.com/', - periodIndex: 0, - sourceDuration: 2, - duration: 2 - }, - segments: [{ - uri: '', - timeline: 0, - duration: 2, - resolvedUri: 'http://example.com/', - map: { - uri: '', - resolvedUri: 'http://example.com/' - }, - number: 1 - }] - }]; - - assert.deepEqual(toPlaylists(representations), playlists); -}); - -QUnit.test('segment base', function(assert) { - const representations = [{ - attributes: { baseUrl: 'http://example.com/', periodIndex: 0, sourceDuration: 2 }, - segmentInfo: { - base: true - } - }]; - - const playlists = [{ - attributes: { - baseUrl: 'http://example.com/', - periodIndex: 0, - sourceDuration: 2, - duration: 2 - }, - segments: [{ - map: { - resolvedUri: 'http://example.com/', - uri: '' - }, - resolvedUri: 'http://example.com/', - uri: 'http://example.com/', - timeline: 0, - duration: 2, - number: 0 - }] - }]; - - assert.deepEqual(toPlaylists(representations), playlists); -}); - -QUnit.test('segment base with sidx', function(assert) { - const representations = [{ - attributes: { - baseUrl: 'http://example.com/', - periodIndex: 0, - sourceDuration: 2, - indexRange: '10-19' - }, - segmentInfo: { - base: true - } - }]; - - const playlists = [{ - attributes: { - baseUrl: 'http://example.com/', - periodIndex: 0, - sourceDuration: 2, - duration: 2, - indexRange: '10-19' - }, - segments: [], - sidx: { - map: { - resolvedUri: 'http://example.com/', - uri: '' - }, - resolvedUri: 'http://example.com/', - uri: 'http://example.com/', - byterange: { - offset: 10, - length: 10 - }, - timeline: 0, - duration: 2, - number: 0 - } - }]; - - assert.deepEqual(toPlaylists(representations), playlists); -}); - -QUnit.test('segment list', function(assert) { - const representations = [{ - attributes: { - baseUrl: 'http://example.com/', - duration: 10, - sourceDuration: 11, - periodIndex: 0 - }, - segmentInfo: { - list: { - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '2.fmp4' - }] - } - } - }]; - - const playlists = [{ - attributes: { - baseUrl: 'http://example.com/', - duration: 10, - sourceDuration: 11, - segmentUrls: [{ - media: '1.fmp4' - }, { - media: '2.fmp4' - }], - periodIndex: 0 - }, - segments: [{ - duration: 10, - map: { - resolvedUri: 'http://example.com/', - uri: '' - }, - resolvedUri: 'http://example.com/1.fmp4', - timeline: 0, - uri: '1.fmp4', - number: 1 - }, { - duration: 1, - map: { - resolvedUri: 'http://example.com/', - uri: '' - }, - resolvedUri: 'http://example.com/2.fmp4', - timeline: 0, - uri: '2.fmp4', - number: 2 - }] - }]; - - assert.deepEqual(toPlaylists(representations), playlists); -}); - -QUnit.test('presentationTimeOffset', function(assert) { - const representations = [{ - attributes: { baseUrl: 'http://example.com/', periodIndex: 0, sourceDuration: 2 }, - segmentInfo: { - template: { - presentationTimeOffset: 100, - timescale: 4 - } - } - }]; - - // the presentationTimeOffset output should be the value in the template - // divided by the timescale in the template. - // It should be available on segments - const playlists = [{ - attributes: { - baseUrl: 'http://example.com/', - periodIndex: 0, - sourceDuration: 2, - duration: 2, - presentationTimeOffset: 25, - timescale: 4 - }, - segments: [{ - uri: '', - timeline: 0, - duration: 2, - presentationTimeOffset: 25, - resolvedUri: 'http://example.com/', - map: { - uri: '', - resolvedUri: 'http://example.com/' - }, - number: 1 - }] - }]; - - assert.deepEqual(toPlaylists(representations), playlists); -}); diff --git a/node_modules/mpd-parser/test/utils.test.js b/node_modules/mpd-parser/test/utils.test.js deleted file mode 100644 index 222d854..0000000 --- a/node_modules/mpd-parser/test/utils.test.js +++ /dev/null @@ -1,219 +0,0 @@ -import { merge, values } from '../src/utils/object'; -import { parseDuration } from '../src/utils/time'; -import { flatten, range, from, findIndexes } from '../src/utils/list'; -import { findChildren, getContent } from '../src/utils/xml'; -import {DOMParser} from 'xmldom'; -import {JSDOM} from 'jsdom'; -import QUnit from 'qunit'; - -const document = new JSDOM().window.document; - -QUnit.module('utils'); - -QUnit.module('merge'); -QUnit.test('empty', function(assert) { - assert.deepEqual(merge({}, { a: 1 }), { a: 1 }); - assert.deepEqual(merge({ a: 1 }, { a: 1 }), { a: 1 }); - assert.deepEqual(merge({ a: 1 }, {}), { a: 1 }); -}); - -QUnit.test('append', function(assert) { - assert.deepEqual(merge({ a: 1 }, { b: 3 }), { a: 1, b: 3 }); -}); - -QUnit.test('overwrite', function(assert) { - assert.deepEqual(merge({ a: 1 }, { a: 2 }), { a: 2 }); -}); - -QUnit.test('empty', function(assert) { - assert.deepEqual(merge({}, {}), {}); - assert.deepEqual(merge({}, 1), {}); - assert.deepEqual(merge(1, {}), {}); -}); - -QUnit.test('Test for checking the merge when multiple segment Information are present', function(assert) { - - const adaptationSetInfo = { - - base: { duration: '10'} - }; - - const representationInfo = { - - base: { duration: '25', indexRange: '230-252'} - }; - - const expected = { - - base: { duration: '25', indexRange: '230-252'} - }; - - assert.deepEqual( - merge(adaptationSetInfo, representationInfo), expected, - 'Merged SegmentBase info' - ); - -}); - -QUnit.test('Test for checking the merge when segment Information is present at a level and is undefined at another', function(assert) { - const periodInfo = { - base: { - initialization: { - range: '0-8888' - - } - } - }; - - const adaptationSetInfo = { - - base: { duration: '10', indexRange: '230-252'} - }; - - const representationInfo = {}; - - const expected = { - - base: { duration: '10', indexRange: '230-252', initialization: {range: '0-8888'}} - }; - - assert.deepEqual( - merge(periodInfo, adaptationSetInfo, representationInfo), expected, - 'Merged SegmentBase info' - ); - -}); - -QUnit.module('values'); - -QUnit.test('empty', function(assert) { - assert.deepEqual(values({}), []); -}); - -QUnit.test('mixed', function(assert) { - assert.deepEqual(values({ a: 1, b: true, c: 'foo'}), [1, true, 'foo']); -}); - -QUnit.module('flatten'); -QUnit.test('empty', function(assert) { - assert.deepEqual(flatten([]), []); -}); - -QUnit.test('one item', function(assert) { - assert.deepEqual(flatten([[1]]), [1]); -}); - -QUnit.test('multiple items', function(assert) { - assert.deepEqual(flatten([[1], [2], [3]]), [1, 2, 3]); -}); - -QUnit.test('multiple multiple items', function(assert) { - assert.deepEqual(flatten([[1], [2, 3], [4]]), [1, 2, 3, 4]); -}); - -QUnit.test('nested nests', function(assert) { - assert.deepEqual(flatten([[1], [[2]]]), [1, [2]]); -}); - -QUnit.test('not a list of lists', function(assert) { - assert.deepEqual(flatten([1, 2]), [1, 2]); - assert.deepEqual(flatten([[1], 2]), [1, 2]); -}); - -QUnit.module('parseDuration'); -QUnit.test('full date', function(assert) { - assert.deepEqual(parseDuration('P10Y10M10DT10H10M10.1S'), 342180610.1); -}); - -QUnit.test('time only', function(assert) { - assert.deepEqual(parseDuration('PT10H10M10.1S'), 36610.1); -}); - -QUnit.test('empty', function(assert) { - assert.deepEqual(parseDuration(''), 0); -}); - -QUnit.test('invalid', function(assert) { - assert.deepEqual(parseDuration('foo'), 0); -}); - -QUnit.module('range'); -QUnit.test('simple', function(assert) { - assert.deepEqual(range(1, 4), [1, 2, 3]); -}); - -QUnit.test('single number range', function(assert) { - assert.deepEqual(range(1, 1), []); -}); - -QUnit.test('negative', function(assert) { - assert.deepEqual(range(-1, 2), [-1, 0, 1]); -}); - -QUnit.module('from'); - -QUnit.test('simple array', function(assert) { - assert.deepEqual(from([1]), [1]); -}); - -QUnit.test('empty array', function(assert) { - assert.deepEqual(from([]), []); -}); - -QUnit.test('non-array', function(assert) { - assert.deepEqual(from(1), []); -}); - -QUnit.test('array-like', function(assert) { - const fixture = document.createElement('div'); - - fixture.innerHTML = '
    '; - - const result = from(fixture.getElementsByTagName('div')); - - assert.ok(result.map); - assert.deepEqual(result.length, 2); -}); - -QUnit.module('findIndexes'); - -QUnit.test('index not found', function(assert) { - assert.deepEqual(findIndexes([], 'a'), []); - assert.deepEqual(findIndexes([], ''), []); - assert.deepEqual(findIndexes([{ a: true}], 'b'), []); -}); - -QUnit.test('indexes found', function(assert) { - assert.deepEqual(findIndexes([{ a: true}], 'a'), [0]); - assert.deepEqual(findIndexes([ - { a: true }, - { b: true }, - { b: true, c: true } - ], 'b'), [1, 2]); -}); - -QUnit.module('xml', { - beforeEach() { - const parser = new DOMParser(); - const xmlString = ` - - foo -
    bar
    -
    baz
    -
    `; - - this.fixture = parser.parseFromString(xmlString, 'text/xml').documentElement; - } -}); - -QUnit.test('findChildren', function(assert) { - assert.deepEqual(findChildren(this.fixture, 'test').length, 1, 'single'); - assert.deepEqual(findChildren(this.fixture, 'div').length, 2, 'multiple'); - assert.deepEqual(findChildren(this.fixture, 'el').length, 0, 'none'); -}); - -QUnit.test('getContent', function(assert) { - const result = findChildren(this.fixture, 'test')[0]; - - assert.deepEqual(getContent(result), 'foo', 'gets text and trims'); -}); diff --git a/node_modules/mux.js/CHANGELOG.md b/node_modules/mux.js/CHANGELOG.md deleted file mode 100644 index 62be635..0000000 --- a/node_modules/mux.js/CHANGELOG.md +++ /dev/null @@ -1,61 +0,0 @@ - -## [5.11.1](https://github.com/videojs/mux.js/compare/v5.11.0...v5.11.1) (2021-06-22) - -### Bug Fixes - -* inspect all program map tables for stream types ([#386](https://github.com/videojs/mux.js/issues/386)) ([bac4da9](https://github.com/videojs/mux.js/commit/bac4da9)) - - -# [5.11.0](https://github.com/videojs/mux.js/compare/v5.10.0...v5.11.0) (2021-03-29) - -### Features - -* parse ctts atom in mp4 inspector ([#379](https://github.com/videojs/mux.js/issues/379)) ([b75a7a4](https://github.com/videojs/mux.js/commit/b75a7a4)) -* stss atom parsing ([#380](https://github.com/videojs/mux.js/issues/380)) ([305eb4f](https://github.com/videojs/mux.js/commit/305eb4f)) - - -# [5.10.0](https://github.com/videojs/mux.js/compare/v5.9.2...v5.10.0) (2021-03-05) - -### Features - -* parse edts boxes ([#375](https://github.com/videojs/mux.js/issues/375)) ([989bffd](https://github.com/videojs/mux.js/commit/989bffd)) - -### Bug Fixes - -* Check if baseTimestamp is NaN ([#370](https://github.com/videojs/mux.js/issues/370)) ([b4e61dd](https://github.com/videojs/mux.js/commit/b4e61dd)) -* only parse PES packets as PES packets ([#378](https://github.com/videojs/mux.js/issues/378)) ([bb984db](https://github.com/videojs/mux.js/commit/bb984db)) - - -## [5.9.2](https://github.com/videojs/mux.js/compare/v5.9.1...v5.9.2) (2021-02-24) - -### Features - -* add a nodejs binary for transmux via command line ([#366](https://github.com/videojs/mux.js/issues/366)) ([b87ed0f](https://github.com/videojs/mux.js/commit/b87ed0f)) - -### Bug Fixes - -* ts inspect ptsTime/dtsTime typo ([#377](https://github.com/videojs/mux.js/issues/377)) ([112e6e1](https://github.com/videojs/mux.js/commit/112e6e1)) - -### Chores - -* switch to rollup-plugin-data-files ([#369](https://github.com/videojs/mux.js/issues/369)) ([0bb1556](https://github.com/videojs/mux.js/commit/0bb1556)) -* update vjsverify to fix publish failure ([cb06bb5](https://github.com/videojs/mux.js/commit/cb06bb5)) - - -## [5.9.1](https://github.com/videojs/mux.js/compare/v5.9.0...v5.9.1) (2021-01-20) - -### Chores - -* **package:** fixup browser field ([#368](https://github.com/videojs/mux.js/issues/368)) ([8926506](https://github.com/videojs/mux.js/commit/8926506)) - - -# [5.9.0](https://github.com/videojs/mux.js/compare/v5.8.0...v5.9.0) (2021-01-20) - -### Features - -* **CaptionStream:** add flag to turn off 708 captions ([#365](https://github.com/videojs/mux.js/issues/365)) ([8a7cdb6](https://github.com/videojs/mux.js/commit/8a7cdb6)) - -### Chores - -* update this project to use the generator ([#352](https://github.com/videojs/mux.js/issues/352)) ([fa920a6](https://github.com/videojs/mux.js/commit/fa920a6)) - diff --git a/node_modules/mux.js/LICENSE b/node_modules/mux.js/LICENSE deleted file mode 100644 index cd4596f..0000000 --- a/node_modules/mux.js/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright Brightcove, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/mux.js/README.md b/node_modules/mux.js/README.md deleted file mode 100644 index 45a2a74..0000000 --- a/node_modules/mux.js/README.md +++ /dev/null @@ -1,363 +0,0 @@ -# mux.js -[![Build Status](https://travis-ci.org/videojs/mux.js.svg?branch=main)](https://travis-ci.org/videojs/mux.js)[![Greenkeeper badge](https://badges.greenkeeper.io/videojs/mux.js.svg)](https://greenkeeper.io/) -[![Slack Status](http://slack.videojs.com/badge.svg)](http://slack.videojs.com) - - -Lightweight utilities for inspecting and manipulating video container formats. - -Maintenance Status: Stable - -## Table of Contents - -- [Installation](#installation) - - [NPM](#npm) - - [Manual Build](#manual-build) -- [Building](#building) -- [Collaborator](#collaborator) -- [Contributing](#contributing) -- [Options](#options) -- [Background](#background) - - [fmp4](#fmp4) -- [MPEG2-TS to fMP4 Transmuxer](#mpeg2-ts-to-fmp4-transmuxer) - - [Diagram](#diagram) -- [Usage Examples](#usage-examples) - - [Basic Usage](#basic-usage) - - [Metadata](#metadata) - - [MP4 Inspector](#mp4-inspector) -- [Documentation](#documentation) -- [Talk to Us](#talk-to-us) - -## Installation -### NPM - -To install `mux.js` with npm run - -```bash -npm install --save mux.js -``` - -### Manual Build -Download a copy of this git repository and then follow the steps in [Building](#building) - -## Building -If you're using this project in a node-like environment, just `require()` whatever you need. If you'd like to package up a distribution to include separately, run `npm run build`. See the `package.json` for other handy scripts if you're thinking about contributing. - -## Collaborator -If you are a collaborator, we have a guide on how to [release](./COLLABORATOR_GUIDE.md#releasing) the project. - -## Contributing -If you are interested in contributing to `mux.js`, take a look at our docs on [streams](/docs/streams.md) to get started. - -## Options - -The exported `muxjs` object contains the following modules: - -- [codecs](#codecs): a module for handling various codecs -- [mp4](#mp4): a module for handling ISOBMFF MP4 boxes -- [flv](#flv): a module for handling Flash content -- [mp2t](#mp2t): a module for handling MPEG 2 Transport Stream content - -### Codecs - -#### Adts - -`muxjs.codecs.Adts` - -The Adts(Audio Data Transport Stream) module handles audio data, specifically AAC. Includes an `AdtsStream` that takes ADTS audio and parses out AAC frames to pass on to the next Stream component in a pipeline. - -#### h264 - -`muxjs.codecs.h264` - -The h264 module Handles H264 bitstreams, including a `NalByteStream` and `H264Stream` to parse out NAL Units and pass them on to the next Stream component in a pipeline. - -### mp4 - -#### MP4 Generator - -`muxjs.mp4.generator` - -The MP4 Generator module contains multiple functions that can be used to generate fragmented MP4s (fmp4s) that can be used in MSE. - -#### MP4 Probe - -`muxjs.mp4.probe` - -The MP4 Probe contains basic utilites that can be used to parse metadata about an MP4 segment. Some examples include: `timescale` and getting the base media decode time of a fragment in seconds. - -#### MP4 Transmuxer - -`muxjs.mp4.Transmuxer` - -Takes MPEG2-TS segments and transmuxes them into fmp4 segments. - -Options: - -##### baseMediaDecodeTime - -Type: `number` - -Default: `0` - -The Base Media Decode Time of the first segment to be passed into the transmuxer. - -##### keepOriginalTimestamps - -Type: `boolean` - -Default: `false` - -The default behavior of the MP4 Transmuxer is to rewrite the timestamps of media segments to ensure that they begin at `0` on the media timeline in MSE. To avoid this behavior, you may set this option to `true`. - -**Note**: This will affect behavior of captions and metadata, and these may not align with audio and video without additional manipulation of timing metadata. - -##### remux - -Type: `boolean` - -Default: `true` - -Set to `true` to remux audio and video into a single MP4 segment. - -#### CaptionParser - -`muxjs.mp4.CaptionParser` - -This module reads CEA-608 captions out of FMP4 segments. - -#### Tools - -`muxjs.mp4.tools` - -This module includes utilities to parse MP4s into an equivalent javascript object, primarily for debugging purposes. - -### flv - -#### Transmuxer - -`muxjs.flv.Transmuxer` - -Takes MPEG2-TS segments and transmuxes them into FLV segments. This module is in maintenance mode and will not have further major development. - -#### Tools - -`muxjs.flv.tools` - -This module includes utilities to parse FLV tags into an equivalent javascript object, primarily for debugging purposes. - -### mp2t - -`muxjs.mp2t` - -Contains Streams specifically to handle MPEG2-TS data, for example `ElementaryStream` and `TransportPacketStream`. This is used in the MP4 module. - -#### CaptionStream - -`muxjs.mp2t.CaptionStream` - -Handles the bulk of parsing CEA-608 captions out of MPEG2-TS segments. - -#### Tools - -`muxjs.mp2t.tools` - -This module contains utilities to parse basic timing information out of MPEG2-TS segments. - -## Background - -### fMP4 -Before making use of the Transmuxer it is best to understand the structure of a fragmented MP4 (fMP4). - -fMP4's are structured in *boxes* as described in the ISOBMFF spec. - -For a basic fMP4 to be valid it needs to have the following boxes: - -1) ftyp (File Type Box) -2) moov (Movie Header Box) -3) moof (Movie Fragment Box) -4) mdat (Movie Data Box) - -Every fMP4 stream needs to start with an `ftyp` and `moov` box which is then followed by many `moof` and `mdat` pairs. - -It is important to understand that when you append your first segment to [Media Source Extensions](https://www.w3.org/TR/media-source/) that this segment will need to start with an `ftyp` and `moov` followed by a `moof` and `mdat`. A segment containing a `ftyp` and `moov` box is often referred to as an Initialization Segment(`init`) segment, and segments containing `moof` and `mdat` boxes, referring to media itself as Media Segments. - -If you would like to see a clearer representation of your fMP4 you can use the `muxjs.mp4.tools.inspect()` method. - -## MPEG2-TS to fMP4 Transmuxer -### Diagram -![mux.js diagram](/docs/diagram.png) - -## Usage Examples - -### Basic Usage - -To make use of the Transmuxer method you will need to push data to the transmuxer you have created. - -Feed in `Uint8Array`s of an MPEG-2 transport stream, get out a fragmented MP4. - -Lets look at a very basic representation of what needs to happen the first time you want to append a fMP4 to an MSE buffer. - -```js -// Create your transmuxer: -// initOptions is optional and can be omitted at this time. -var transmuxer = new muxjs.mp4.Transmuxer(initOptions); - -// Create an event listener which will be triggered after the transmuxer processes data: -// 'data' events signal a new fMP4 segment is ready -transmuxer.on('data', function (segment) { - // This code will be executed when the event listener is triggered by a Transmuxer.push() method execution. - // Create an empty Uint8Array with the summed value of both the initSegment and data byteLength properties. - let data = new Uint8Array(segment.initSegment.byteLength + segment.data.byteLength); - - // Add the segment.initSegment (ftyp/moov) starting at position 0 - data.set(segment.initSegment, 0); - - // Add the segment.data (moof/mdat) starting after the initSegment - data.set(segment.data, segment.initSegment.byteLength); - - // Uncomment this line below to see the structure of your new fMP4 - // console.log(muxjs.mp4.tools.inspect(data)); - - // Add your brand new fMP4 segment to your MSE Source Buffer - sourceBuffer.appendBuffer(data); -}); - -// When you push your starting MPEG-TS segment it will cause the 'data' event listener above to run. -// It is important to push after your event listener has been defined. -transmuxer.push(transportStreamSegment); -transmuxer.flush(); -``` - -Above we are adding in the `initSegment` (ftyp/moov) to our data array before appending to the MSE Source Buffer. - -This is required for the first part of data we append to the MSE Source Buffer, but we will omit the `initSegment` for our remaining chunks (moof/mdat)'s of video we are going to append to our Source Buffer. - -In the case of appending additional segments after your first segment we will just need to use the following event listener anonymous function: - -```js -transmuxer.on('data', function(segment){ - sourceBuffer.appendBuffer(new Uint8Array(segment.data)); -}); -``` - -Here we put all of this together in a very basic example player. - -```html - - - Basic Transmuxer Test - - - - - - - -``` -*NOTE: This player is only for example and should not be used in production.* - -### Metadata - -The transmuxer can also parse out supplementary video data like timed ID3 metadata and CEA-608 captions. -You can find both attached to the data event object: - -```js -transmuxer.on('data', function (segment) { - // create a metadata text track cue for each ID3 frame: - segment.metadata.frames.forEach(function(frame) { - metadataTextTrack.addCue(new VTTCue(time, time, frame.value)); - }); - // create a VTTCue for all the parsed CEA-608 captions:> - segment.captions.forEach(function(cue) { - captionTextTrack.addCue(new VTTCue(cue.startTime, cue.endTime, cue.text)); - }); -}); -``` - -### MP4 Inspector - -Parse MP4s into javascript objects or a text representation for display or debugging: - -```js -// drop in a Uint8Array of an MP4: -var parsed = muxjs.mp4.tools.inspect(bytes); -// dig into the boxes: -console.log('The major brand of the first box:', parsed[0].majorBrand); -// print out the structure of the MP4: -document.body.appendChild(document.createTextNode(muxjs.textifyMp4(parsed))); -``` -The MP4 inspector is used extensively as a debugging tool for the transmuxer. You can see it in action by cloning the project and opening [the debug page](https://github.com/videojs/mux.js/blob/master/debug/index.html) in your browser. - -## Documentation - -Check out our [troubleshooting guide](/docs/troubleshooting.md). -We have some tips on [creating test content](/docs/test-content.md). -Also, check out our guide on [working with captions in Mux.js](/docs/captions.md). - -## Talk to us -Drop by our slack channel (#playback) on the [Video.js slack](http://slack.videojs.com). diff --git a/node_modules/mux.js/bin/transmux.js b/node_modules/mux.js/bin/transmux.js deleted file mode 100644 index 2659be8..0000000 --- a/node_modules/mux.js/bin/transmux.js +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env node -/* eslint-disable no-console */ - -const fs = require('fs'); -const path = require('path'); -const {Transmuxer} = require('../lib/mp4'); -const {version} = require('../package.json'); -const {concatTypedArrays} = require('@videojs/vhs-utils/cjs/byte-helpers'); -const {ONE_SECOND_IN_TS} = require('../lib/utils/clock.js'); - -const showHelp = function() { - console.log(` - transmux media-file > foo.mp4 - transmux media-file -o foo.mp4 - curl -s 'some-media-ulr' | transmux.js -o foo.mp4 - wget -O - -o /dev/null 'some-media-url' | transmux.js -o foo.mp4 - - transmux a supported segment (ts or adts) info an fmp4 - - -h, --help print help - -v, --version print the version - -o, --output write to a file instead of stdout - -d, --debugger add a break point just before data goes to transmuxer -`); -}; - -const parseArgs = function(args) { - const options = {}; - - for (let i = 0; i < args.length; i++) { - const arg = args[i]; - - if ((/^--version|-v$/).test(arg)) { - console.log(`transmux.js v${version}`); - process.exit(0); - } else if ((/^--help|-h$/).test(arg)) { - showHelp(); - process.exit(0); - } else if ((/^--debugger|-d$/).test(arg)) { - options.debugger = true; - } else if ((/^--output|-o$/).test(arg)) { - i++; - options.output = args[i]; - } else { - options.file = arg; - } - } - - return options; -}; - -const cli = function(stdin) { - const options = parseArgs(process.argv.slice(2)); - let inputStream; - let outputStream; - - // if stdin was provided - if (stdin && options.file) { - console.error(`You cannot pass in a file ${options.file} and pipe from stdin!`); - process.exit(1); - } - - if (stdin) { - inputStream = process.stdin; - } else if (options.file) { - inputStream = fs.createReadStream(path.resolve(options.file)); - } - - if (!inputStream) { - console.error('A file or stdin must be passed in as an argument or via pipeing to this script!'); - process.exit(1); - } - - if (options.output) { - outputStream = fs.createWriteStream(path.resolve(options.output), { - encoding: null - }); - } else { - outputStream = process.stdout; - } - - return new Promise(function(resolve, reject) { - let allData; - - inputStream.on('data', (chunk) => { - allData = concatTypedArrays(allData, chunk); - }); - inputStream.on('error', reject); - - inputStream.on('close', () => { - if (!allData || !allData.length) { - return reject('file is empty'); - } - resolve(allData); - }); - }).then(function(inputData) { - const transmuxer = new Transmuxer(); - - // Setting the BMDT to ensure that captions and id3 tags are not - // time-shifted by this value when they are output and instead are - // zero-based - transmuxer.setBaseMediaDecodeTime(ONE_SECOND_IN_TS); - - transmuxer.on('data', function(data) { - if (data.initSegment) { - outputStream.write(concatTypedArrays(data.initSegment, data.data)); - } else { - outputStream.write(data.data); - } - }); - - if (options.debugger) { - // eslint-disable-next-line - debugger; - } - transmuxer.push(inputData); - transmuxer.flush(); - process.exit(0); - }).catch(function(e) { - console.error(e); - process.exit(1); - }); -}; - -// no stdin if isTTY is set -cli(!process.stdin.isTTY ? process.stdin : null); diff --git a/node_modules/mux.js/cjs/aac/index.js b/node_modules/mux.js/cjs/aac/index.js deleted file mode 100644 index df0662f..0000000 --- a/node_modules/mux.js/cjs/aac/index.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based aac to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var aacUtils = require('./utils'); // Constants - - -var _AacStream; -/** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - -_AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = aacUtils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = aacUtils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; -}; - -_AacStream.prototype = new Stream(); -module.exports = _AacStream; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/aac/utils.js b/node_modules/mux.js/cjs/aac/utils.js deleted file mode 100644 index 2f72b36..0000000 --- a/node_modules/mux.js/cjs/aac/utils.js +++ /dev/null @@ -1,160 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ -'use strict'; - -var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - -var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; -}; - -var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); -}; // TODO: use vhs-utils - - -var isLikelyAacData = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; -}; - -var parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; -}; // return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding - - -var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; -}; // return the string representation of the specified byte range, -// interpreted as ISO-8859-1. - - -var parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}; - -var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; -}; - -var parseType = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; -}; - -var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; -}; - -var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; -}; - -module.exports = { - isLikelyAacData: isLikelyAacData, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/codecs/adts.js b/node_modules/mux.js/cjs/codecs/adts.js deleted file mode 100644 index a683e1e..0000000 --- a/node_modules/mux.js/cjs/codecs/adts.js +++ /dev/null @@ -1,128 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var _AdtsStream; - -var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; -/* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - -_AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - while (i + 5 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS / ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; - frameEnd = i + frameLength; // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - - if (buffer.byteLength < frameEnd) { - return; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - frameNum++; // If the buffer is empty, clear it and return - - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } // Remove the finished frame from the buffer and start the process again - - - buffer = buffer.subarray(frameEnd); - } - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; -}; - -_AdtsStream.prototype = new Stream(); -module.exports = _AdtsStream; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/codecs/h264.js b/node_modules/mux.js/cjs/codecs/h264.js deleted file mode 100644 index 7ca98ea..0000000 --- a/node_modules/mux.js/cjs/codecs/h264.js +++ /dev/null @@ -1,567 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var ExpGolomb = require('../utils/exp-golomb.js'); - -var _H264Stream, _NalByteStream; - -var PROFILES_WITH_OPTIONAL_SPS_DATA; -/** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - -_NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; -}; - -_NalByteStream.prototype = new Stream(); // values of profile_idc that indicate additional fields are included in the SPS -// see Recommendation ITU-T H.264 (4/2013), -// 7.3.2.1.1 Sequence parameter set data syntax - -PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true -}; -/** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - -_H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - - default: - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - expGolombDecoder = new ExpGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - sarRatio: sarRatio - }; - }; -}; - -_H264Stream.prototype = new Stream(); -module.exports = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/codecs/index.js b/node_modules/mux.js/cjs/codecs/index.js deleted file mode 100644 index e2e32b8..0000000 --- a/node_modules/mux.js/cjs/codecs/index.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - Adts: require('./adts'), - h264: require('./h264') -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/constants/audio-properties.js b/node_modules/mux.js/cjs/constants/audio-properties.js deleted file mode 100644 index 5384d3f..0000000 --- a/node_modules/mux.js/cjs/constants/audio-properties.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -// constants -var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; -module.exports = AUDIO_PROPERTIES; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/constants/video-properties.js b/node_modules/mux.js/cjs/constants/video-properties.js deleted file mode 100644 index 2da6b07..0000000 --- a/node_modules/mux.js/cjs/constants/video-properties.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; - -var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; -module.exports = VIDEO_PROPERTIES; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/data/silence.js b/node_modules/mux.js/cjs/data/silence.js deleted file mode 100644 index 1560b3d..0000000 --- a/node_modules/mux.js/cjs/data/silence.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var highPrefix = [33, 16, 5, 32, 164, 27]; -var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - -var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; -}; - -var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); -}; - -var silence; - -module.exports = function () { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]], - 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/flv/coalesce-stream.js b/node_modules/mux.js/cjs/flv/coalesce-stream.js deleted file mode 100644 index 4bf5ca9..0000000 --- a/node_modules/mux.js/cjs/flv/coalesce-stream.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -/** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ - - -var CoalesceStream = function CoalesceStream(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - CoalesceStream.prototype.init.call(this); // Take output from multiple - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; -}; - -CoalesceStream.prototype = new Stream(); - -CoalesceStream.prototype.flush = function (flushSource) { - var id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - captionStreams: {}, - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; // Translate caption PTS times into second offsets into the - // video timeline for the segment, and add track info - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; // Emit the final segment - - this.trigger('data', event); - this.trigger('done'); -}; - -module.exports = CoalesceStream; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/flv/flv-header.js b/node_modules/mux.js/cjs/flv/flv-header.js deleted file mode 100644 index aa8c189..0000000 --- a/node_modules/mux.js/cjs/flv/flv-header.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var FlvTag = require('./flv-tag.js'); // For information on the FLV format, see -// http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. -// Technically, this function returns the header and a metadata FLV tag -// if duration is greater than zero -// duration in seconds -// @return {object} the bytes of the FLV header as a Uint8Array - - -var getFlvHeader = function getFlvHeader(duration, audio, video) { - // :ByteArray { - var headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; // default arguments - - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; // signature - - head.setUint8(0, 0x46); // 'F' - - head.setUint8(1, 0x4c); // 'L' - - head.setUint8(2, 0x56); // 'V' - // version - - head.setUint8(3, 0x01); // flags - - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); // data offset, should be 9 for FLV v1 - - head.setUint32(5, headBytes.byteLength); // init the first FLV tag - - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } // write out the duration metadata tag - - - metadata = new FlvTag(FlvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - return result; -}; - -module.exports = getFlvHeader; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/flv/flv-tag.js b/node_modules/mux.js/cjs/flv/flv-tag.js deleted file mode 100644 index bb73b25..0000000 --- a/node_modules/mux.js/cjs/flv/flv-tag.js +++ /dev/null @@ -1,372 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ -'use strict'; - -var _FlvTag; // (type:uint, extraData:Boolean = false) extends ByteArray - - -_FlvTag = function FlvTag(type, extraData) { - var // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, - // :uint - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function prepareWrite(flv, count) { - var bytes, - minLength = flv.position + count; - - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } // allocate a new buffer and copy over the data that will not be modified - - - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - // commonly used metadata properties - widthBytes = _FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = _FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = _FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!_FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - _FlvTag.widthBytes = widthBytes; - _FlvTag.heightBytes = heightBytes; - _FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case _FlvTag.VIDEO_TAG: - this.length = 16; // Start the buffer at 256k - - bufferStartSize *= 6; - break; - - case _FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - - case _FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - // presentation timestamp - - this.pts = 0; // decoder timestamp - - this.dts = 0; // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - - this.writeBytes = function (bytes, offset, length) { - var start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - this.position += length; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeByte(value:int):void - - - this.writeByte = function (byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeShort(value:int):void - - - this.writeShort = function (short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; // Negative index into array - // (pos:uint):int - - - this.negIndex = function (pos) { - return this.bytes[this.length - pos]; - }; // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - - - this.nalUnitSize = function () { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function () { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } // reserve 4 bytes for nal unit size - - - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; // (nal:ByteArray = null):void - - - this.endNalUnit = function (nalContainer) { - var nalStart, // :uint - nalLength; // :uint - // Rewind to the marker and write the size - - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - - - this.writeMetaDataDouble = function (key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); // write size of property name - - this.view.setUint16(this.position, key.length); - this.position += 2; // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - // write property name - - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } // skip null byte - - - this.position++; // write property value - - this.view.setFloat64(this.position, val); - this.position += 8; // update flv tag length - - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // (key:String, val:Boolean):void - - - this.writeMetaDataBoolean = function (key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // ():ByteArray - - - this.finalize = function () { - var dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case _FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = (this.keyFrame || extraData ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case _FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case _FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - - this.position += 2; // set "onMetaData" - - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - - this.length = this.position; - break; - } - - len = this.length - 11; // write the DataSize field - - this.bytes[1] = (len & 0x00FF0000) >>> 16; - this.bytes[2] = (len & 0x0000FF00) >>> 8; - this.bytes[3] = (len & 0x000000FF) >>> 0; // write the Timestamp - - this.bytes[4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[7] = (this.dts & 0xFF000000) >>> 24; // write the StreamID - - this.bytes[8] = 0; - this.bytes[9] = 0; - this.bytes[10] = 0; // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; // trim down the byte buffer to what is actually being used - - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = _FlvTag.frameTime(this.bytes); // if bytes.bytelength isn't equal to this.length, handle error - - return this; - }; -}; - -_FlvTag.AUDIO_TAG = 0x08; // == 8, :uint - -_FlvTag.VIDEO_TAG = 0x09; // == 9, :uint - -_FlvTag.METADATA_TAG = 0x12; // == 18, :uint -// (tag:ByteArray):Boolean { - -_FlvTag.isAudioFrame = function (tag) { - return _FlvTag.AUDIO_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isVideoFrame = function (tag) { - return _FlvTag.VIDEO_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isMetaData = function (tag) { - return _FlvTag.METADATA_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isKeyFrame = function (tag) { - if (_FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (_FlvTag.isAudioFrame(tag)) { - return true; - } - - if (_FlvTag.isMetaData(tag)) { - return true; - } - - return false; -}; // (tag:ByteArray):uint { - - -_FlvTag.frameTime = function (tag) { - var pts = tag[4] << 16; // :uint - - pts |= tag[5] << 8; - pts |= tag[6] << 0; - pts |= tag[7] << 24; - return pts; -}; - -module.exports = _FlvTag; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/flv/index.js b/node_modules/mux.js/cjs/flv/index.js deleted file mode 100644 index 193e884..0000000 --- a/node_modules/mux.js/cjs/flv/index.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - tag: require('./flv-tag'), - Transmuxer: require('./transmuxer'), - getFlvHeader: require('./flv-header') -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/flv/tag-list.js b/node_modules/mux.js/cjs/flv/tag-list.js deleted file mode 100644 index 2b0785c..0000000 --- a/node_modules/mux.js/cjs/flv/tag-list.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var TagList = function TagList() { - var self = this; - this.list = []; - - this.push = function (tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function get() { - return self.list.length; - } - }); -}; - -module.exports = TagList; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/flv/transmuxer.js b/node_modules/mux.js/cjs/flv/transmuxer.js deleted file mode 100644 index f1268fa..0000000 --- a/node_modules/mux.js/cjs/flv/transmuxer.js +++ /dev/null @@ -1,425 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var FlvTag = require('./flv-tag.js'); - -var m2ts = require('../m2ts/m2ts.js'); - -var AdtsStream = require('../codecs/adts.js'); - -var H264Stream = require('../codecs/h264').H264Stream; - -var CoalesceStream = require('./coalesce-stream.js'); - -var TagList = require('./tag-list.js'); - -var _Transmuxer, _VideoSegmentStream, _AudioSegmentStream, collectTimelineInfo, metaDataTag, extraDataTag; -/** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - -collectTimelineInfo = function collectTimelineInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = Math.min(track.timelineStartInfo.dts, data.dts); - } - } -}; - -metaDataTag = function metaDataTag(track, pts) { - var tag = new FlvTag(FlvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - return tag; -}; - -extraDataTag = function extraDataTag(track, pts) { - var i, - tag = new FlvTag(FlvTag.VIDEO_TAG, true); - tag.dts = pts; - tag.pts = pts; - tag.writeByte(0x01); // version - - tag.writeByte(track.profileIdc); // profile - - tag.writeByte(track.profileCompatibility); // compatibility - - tag.writeByte(track.levelIdc); // level - - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - - tag.writeShort(track.sps[0].length); // data of SPS - - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; -}; -/** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ - - -_AudioSegmentStream = function AudioSegmentStream(track) { - var adtsFrames = [], - videoKeyFrames = [], - oldExtraData; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - collectTimelineInfo(track, data); - - if (track) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = track.audioobjecttype << 11 | track.samplingfrequencyindex << 7 | track.channelcount << 3; - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer audio data until end() is called - - adtsFrames.push(data); - }; - - this.flush = function () { - var currentFrame, - adtsFrame, - lastMetaPts, - tags = new TagList(); // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); // write out a metadata frame at every video key frame - - if (videoKeyFrames.length && currentFrame.pts >= videoKeyFrames[0]) { - lastMetaPts = videoKeyFrames.shift(); - this.writeMetaDataTags(tags, lastMetaPts); - } // also write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration. - - - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - this.writeMetaDataTags(tags, currentFrame.pts); - oldExtraData = track.extraData; - lastMetaPts = currentFrame.pts; - } - - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - adtsFrame.writeBytes(currentFrame.data); - tags.push(adtsFrame.finalize()); - } - - videoKeyFrames.length = 0; - oldExtraData = null; - this.trigger('data', { - track: track, - tags: tags.list - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.writeMetaDataTags = function (tags, pts) { - var adtsFrame; - adtsFrame = new FlvTag(FlvTag.METADATA_TAG); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; // AAC is always 10 - - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); // Is AAC always 16 bit? - - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - tags.push(adtsFrame.finalize()); - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG, true); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - tags.push(adtsFrame.finalize()); - }; - - this.onVideoKeyFrame = function (pts) { - videoKeyFrames.push(pts); - }; -}; - -_AudioSegmentStream.prototype = new Stream(); -/** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ - -_VideoSegmentStream = function VideoSegmentStream(track) { - var nalUnits = [], - config, - h264Frame; - - _VideoSegmentStream.prototype.init.call(this); - - this.finishFrame = function (tags, frame) { - if (!frame) { - return; - } // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - - - if (config && track && track.newMetadata && (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - metaTag.metaDataTag = extraTag.metaDataTag = true; - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - this.trigger('keyframe', frame.dts); - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function (data) { - collectTimelineInfo(track, data); - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer video until flush() is called - - nalUnits.push(data); - }; - - this.flush = function () { - var currentNal, - tags = new TagList(); // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); // record the track config - - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - h264Frame = new FlvTag(FlvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - - h264Frame.endNalUnit(); - } - - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', { - track: track, - tags: tags.list - }); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; -}; - -_VideoSegmentStream.prototype = new Stream(); -/** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ - -_Transmuxer = function Transmuxer(options) { - var self = this, - packetStream, - parseStream, - elementaryStream, - videoTimestampRolloverStream, - audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, - h264Stream, - videoSegmentStream, - audioSegmentStream, - captionStream, - coalesceStream; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; // expose the metadata stream - - this.metadataStream = new m2ts.MetadataStream(); - options.metadataStream = this.metadataStream; // set up the parsing pipeline - - packetStream = new m2ts.TransportPacketStream(); - parseStream = new m2ts.TransportParseStream(); - elementaryStream = new m2ts.ElementaryStream(); - videoTimestampRolloverStream = new m2ts.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - adtsStream = new AdtsStream(); - h264Stream = new H264Stream(); - coalesceStream = new CoalesceStream(options); // disassemble MPEG2-TS packets into elementary streams - - packetStream.pipe(parseStream).pipe(elementaryStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - elementaryStream.pipe(videoTimestampRolloverStream).pipe(h264Stream); - elementaryStream.pipe(audioTimestampRolloverStream).pipe(adtsStream); - elementaryStream.pipe(timedMetadataTimestampRolloverStream).pipe(this.metadataStream).pipe(coalesceStream); // if CEA-708 parsing is available, hook up a caption stream - - captionStream = new m2ts.CaptionStream(options); - h264Stream.pipe(captionStream).pipe(coalesceStream); // hook up the segment streams once track metadata is delivered - - elementaryStream.on('data', function (data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !videoSegmentStream) { - coalesceStream.numberOfTracks++; - videoSegmentStream = new _VideoSegmentStream(videoTrack); // Set up the final part of the video pipeline - - h264Stream.pipe(videoSegmentStream).pipe(coalesceStream); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream.numberOfTracks++; - audioSegmentStream = new _AudioSegmentStream(audioTrack); // Set up the final part of the audio pipeline - - adtsStream.pipe(audioSegmentStream).pipe(coalesceStream); - - if (videoSegmentStream) { - videoSegmentStream.on('keyframe', audioSegmentStream.onVideoKeyFrame); - } - } - } - }); // feed incoming data to the front of the parsing pipeline - - this.push = function (data) { - packetStream.push(data); - }; // flush any buffered data - - - this.flush = function () { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - captionStream.reset(); - }; // Re-emit any data coming from the coalesce stream to the outside world - - - coalesceStream.on('data', function (event) { - self.trigger('data', event); - }); // Let the consumer know we have finished flushing the entire pipeline - - coalesceStream.on('done', function () { - self.trigger('done'); - }); -}; - -_Transmuxer.prototype = new Stream(); // forward compatibility - -module.exports = _Transmuxer; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/index.js b/node_modules/mux.js/cjs/index.js deleted file mode 100644 index 97dc1ba..0000000 --- a/node_modules/mux.js/cjs/index.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var muxjs = { - codecs: require('./codecs'), - mp4: require('./mp4'), - flv: require('./flv'), - mp2t: require('./m2ts'), - partial: require('./partial') -}; // include all the tools when the full library is required - -muxjs.mp4.tools = require('./tools/mp4-inspector'); -muxjs.flv.tools = require('./tools/flv-inspector'); -muxjs.mp2t.tools = require('./tools/ts-inspector'); -module.exports = muxjs; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/m2ts/caption-stream.js b/node_modules/mux.js/cjs/m2ts/caption-stream.js deleted file mode 100644 index d2525ec..0000000 --- a/node_modules/mux.js/cjs/m2ts/caption-stream.js +++ /dev/null @@ -1,1791 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ -'use strict'; // ----------------- -// Link To Transport -// ----------------- - -var Stream = require('../utils/stream'); - -var cea708Parser = require('../tools/caption-packet-parser'); - -var CaptionStream = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream(); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } -}; - -CaptionStream.prototype = new Stream(); - -CaptionStream.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = cea708Parser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== cea708Parser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = cea708Parser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = cea708Parser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; -}; - -CaptionStream.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); -}; - -CaptionStream.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); -}; - -CaptionStream.prototype.flush = function () { - return this.flushStream('flush'); -}; // Only called if handling partial data - - -CaptionStream.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); -}; - -CaptionStream.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); -}; // From the CEA-608 spec: - -/* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. -*/ -// With that in mind, we ignore any data between an XDS control code and a -// subsequent closed-captioning control code. - - -CaptionStream.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); -}; - -CaptionStream.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; -}; - -CaptionStream.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; -}; - -CaptionStream.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; -}; - -CaptionStream.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } -}; // ---------------------- -// Session to Application -// ---------------------- -// This hash maps special and extended character codes to their -// proper Unicode equivalent. The first one-byte key is just a -// non-standard character code. The two-byte keys that follow are -// the extended CEA708 character codes, along with the preceding -// 0x10 extended character byte to distinguish these codes from -// non-extended character codes. Every CEA708 character code that -// is not in this object maps directly to a standard unicode -// character code. -// The transparent space and non-breaking transparent space are -// technically not fully supported since there is no code to -// make them transparent, so they have normal non-transparent -// stand-ins. -// The special closed caption (CC) character isn't a standard -// unicode character, so a fairly similar unicode character was -// chosen in it's place. - - -var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - -}; - -var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); -}; - -var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; -}; - -var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); -}; - -Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; -}; - -Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); -}; - -Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; -}; - -Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } -}; - -Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; -}; - -Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; -}; - -Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } -}; - -var Cea708Service = function Cea708Service(serviceNum) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; -}; -/** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - -Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } -}; -/** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - -Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; -}; - -var Cea708Stream = function Cea708Stream() { - Cea708Stream.prototype.init.call(this); - var self = this; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; -}; - -Cea708Stream.prototype = new Stream(); -/** - * Push current 708 packet, create new 708 packet. - */ - -Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; -}; -/** - * Add pts and both bytes from packet into current 708 packet. - */ - - -Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); -}; -/** - * Parse completed 708 packet into service blocks and push each service block. - */ - - -Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } -}; -/** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - -Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else if (b === 0x8e) {// DLC: Delay cancel, nothing to do - } else if (b === 0x03) {// ETX: End Text, don't need to do anything - } else if (b === 0x00) {// Padding - } else {// Unknown command - } - } -}; -/** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, true); - } else {// Unknown command - } - - return i; -}; -/** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - -Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; -}; -/** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - -Cea708Stream.prototype.initService = function (serviceNum, i) { - var self = this; - this.services[serviceNum] = new Cea708Service(serviceNum); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; -}; -/** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.handleText = function (i, service, isExtended) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var extended = isExtended ? 0x1000 : 0x0000; - var char = get708CharFromCode(extended | b); - var win = service.currentWindow; - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; -}; -/** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; -}; -/** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; -}; -/** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; -}; -/** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - -Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; -}; -/** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - -Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } -}; -/** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; -}; -/** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; -}; -/** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; -}; -/** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; -}; -/** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; -}; -/** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; -}; -/** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; -}; -/** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; -}; -/** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - -Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); -}; // This hash maps non-ASCII, special, and extended character codes to their -// proper Unicode equivalent. The first keys that are only a single byte -// are the non-standard ASCII characters, which simply map the CEA608 byte -// to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 -// character codes, but have their MSB bitmasked with 0x03 so that a lookup -// can be performed regardless of the field and data channel on which the -// character code was received. - - -var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - -}; - -var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); -}; // the index of the last row in a CEA-608 display buffer - - -var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of -// getting it through bit logic. - -var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character -// cells. The "bottom" row is the last element in the outer array. - -var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push(''); - } - - return result; -}; - -var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; -}; - -Cea608Stream.prototype = new Stream(); // Trigger a cue point that captures the current state of the -// display buffer - -Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - // eslint-disable-next-line no-console - console.error('Skipping malformed caption.'); - return ''; - } - }) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content, - stream: this.name_ - }); - } -}; -/** - * Zero out the data, used for startup and on seek - */ - - -Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; -}; -/** - * Sets up control code and related constants for this instance - */ - - -Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; -}; -/** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - -Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; -}; -/** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - -Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; -}; -/** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - -Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; -}; -/** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - -Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; -}; -/** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - -Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; -}; -/** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - -Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; -}; -/** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - -Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; -}; -/** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - -Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; -}; // Adds the opening HTML tag for the passed character to the caption text, -// and keeps track of it for later closing - - -Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); -}; // Adds HTML closing tags for current formatting to caption text and -// clears remembered formatting - - -Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); -}; // Mode Implementations - - -Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; -}; - -Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; -}; - -Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = ''; -}; - -Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; -}; // exports - - -module.exports = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/m2ts/index.js b/node_modules/mux.js/cjs/m2ts/index.js deleted file mode 100644 index 218f0fd..0000000 --- a/node_modules/mux.js/cjs/m2ts/index.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = require('./m2ts'); \ No newline at end of file diff --git a/node_modules/mux.js/cjs/m2ts/m2ts.js b/node_modules/mux.js/cjs/m2ts/m2ts.js deleted file mode 100644 index 2e900a3..0000000 --- a/node_modules/mux.js/cjs/m2ts/m2ts.js +++ /dev/null @@ -1,535 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'), - CaptionStream = require('./caption-stream'), - StreamTypes = require('./stream-types'), - TimestampRolloverStream = require('./timestamp-rollover-stream').TimestampRolloverStream; // object types - - -var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - -var MP2T_PACKET_LENGTH = 188, - // bytes -SYNC_BYTE = 0x47; -/** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - -_TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; -}; - -_TransportPacketStream.prototype = new Stream(); -/** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - -_TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === StreamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === StreamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === StreamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = StreamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = StreamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; -}; - -_TransportParseStream.prototype = new Stream(); -_TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f -}; -/** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - -_ElementaryStream = function ElementaryStream() { - var self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case StreamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case StreamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case StreamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - this.flushStreams_(); - this.trigger('done'); - }; -}; - -_ElementaryStream.prototype = new Stream(); -var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: CaptionStream.CaptionStream, - Cea608Stream: CaptionStream.Cea608Stream, - Cea708Stream: CaptionStream.Cea708Stream, - MetadataStream: require('./metadata-stream') -}; - -for (var type in StreamTypes) { - if (StreamTypes.hasOwnProperty(type)) { - m2ts[type] = StreamTypes[type]; - } -} - -module.exports = m2ts; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/m2ts/metadata-stream.js b/node_modules/mux.js/cjs/m2ts/metadata-stream.js deleted file mode 100644 index 8fca990..0000000 --- a/node_modules/mux.js/cjs/m2ts/metadata-stream.js +++ /dev/null @@ -1,247 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and parses out - * ID3 metadata from them, if present. - * @see http://id3.org/id3v2.3.0 - */ -'use strict'; - -var Stream = require('../utils/stream'), - StreamTypes = require('./stream-types'), - // return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding -percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; -}, - // return the string representation of the specified byte range, -// interpreted as UTf-8. -parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); -}, - // return the string representation of the specified byte range, -// interpreted as ISO-8859-1. -parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}, - parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; -}, - tagParsers = { - TXXX: function TXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); // do not include the null terminator in the tag value - - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - - tag.data = tag.value; - }, - WXXX: function WXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function PRIV(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591(tag.data, 0, i); - break; - } - } - - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } -}, - _MetadataStream; - -_MetadataStream = function MetadataStream(options) { - var settings = { - debug: !!(options && options.debug), - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = StreamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseSyncSafeInteger(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; -}; - -_MetadataStream.prototype = new Stream(); -module.exports = _MetadataStream; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/m2ts/probe.js b/node_modules/mux.js/cjs/m2ts/probe.js deleted file mode 100644 index 739a0a7..0000000 --- a/node_modules/mux.js/cjs/m2ts/probe.js +++ /dev/null @@ -1,299 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about TS Segments. - */ -'use strict'; - -var StreamTypes = require('./stream-types.js'); - -var parsePid = function parsePid(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; -}; - -var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) { - return !!(packet[1] & 0x40); -}; - -var parseAdaptionField = function parseAdaptionField(packet) { - var offset = 0; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[4] + 1; - } - - return offset; -}; - -var parseType = function parseType(packet, pmtPid) { - var pid = parsePid(packet); - - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - - return null; -}; - -var parsePat = function parsePat(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; -}; - -var parsePmt = function parsePmt(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section - - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table - - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type - - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry - // skip past the elementary stream descriptors, if present - - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - - return programMapTable; -}; - -var parsePesType = function parsePesType(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - return 'video'; - - case StreamTypes.ADTS_STREAM_TYPE: - return 'audio'; - - case StreamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - - default: - return null; - } -}; - -var parsePesTime = function parsePesTime(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - pes = {}; // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - - pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - - return pes; -}; - -var parseNalUnitType = function parseNalUnitType(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - - case 0x06: - return 'sei_rbsp'; - - case 0x07: - return 'seq_parameter_set_rbsp'; - - case 0x08: - return 'pic_parameter_set_rbsp'; - - case 0x09: - return 'access_unit_delimiter_rbsp'; - - default: - return null; - } -}; - -var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; // advance the sync point to a NAL start, if necessary - - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } // drop trailing zeroes - - - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; // parse the final nal - - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; -}; - -module.exports = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/m2ts/stream-types.js b/node_modules/mux.js/cjs/m2ts/stream-types.js deleted file mode 100644 index 9ecf7ad..0000000 --- a/node_modules/mux.js/cjs/m2ts/stream-types.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -module.exports = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/m2ts/timestamp-rollover-stream.js b/node_modules/mux.js/cjs/m2ts/timestamp-rollover-stream.js deleted file mode 100644 index 852f6a7..0000000 --- a/node_modules/mux.js/cjs/m2ts/timestamp-rollover-stream.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and corrects - * decode and presentation time stamps to account for a rollover - * of the 33 bit value. - */ -'use strict'; - -var Stream = require('../utils/stream'); - -var MAX_TS = 8589934592; -var RO_THRESH = 4294967296; -var TYPE_SHARED = 'shared'; - -var handleRollover = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; -}; - -var TimestampRolloverStream = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; -}; - -TimestampRolloverStream.prototype = new Stream(); -module.exports = { - TimestampRolloverStream: TimestampRolloverStream, - handleRollover: handleRollover -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/mp4/audio-frame-utils.js b/node_modules/mux.js/cjs/mp4/audio-frame-utils.js deleted file mode 100644 index 133cbd9..0000000 --- a/node_modules/mux.js/cjs/mp4/audio-frame-utils.js +++ /dev/null @@ -1,148 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var coneOfSilence = require('../data/silence'); - -var clock = require('../utils/clock'); -/** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - -var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; -}; // Possibly pad (prefix) the audio track with silence if appending this track -// would lead to the introduction of a gap in the audio buffer - - -var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = coneOfSilence()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; -}; // If the audio segment extends before the earliest allowed dts -// value, remove AAC frames until starts at or after the earliest -// allowed DTS so that we don't end up with a negative baseMedia- -// DecodeTime for the audio track - - -var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); -}; // generate the track's raw mdat data from an array of frames - - -var generateSampleTable = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; -}; // generate the track's sample table from an array of frames - - -var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; -}; - -module.exports = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/mp4/caption-parser.js b/node_modules/mux.js/cjs/mp4/caption-parser.js deleted file mode 100644 index 91359d2..0000000 --- a/node_modules/mux.js/cjs/mp4/caption-parser.js +++ /dev/null @@ -1,452 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band CEA-708 captions out of FMP4 segments. - * @see https://en.wikipedia.org/wiki/CEA-708 - */ -'use strict'; - -var discardEmulationPreventionBytes = require('../tools/caption-packet-parser').discardEmulationPreventionBytes; - -var CaptionStream = require('../m2ts/caption-stream').CaptionStream; - -var findBox = require('../mp4/find-box.js'); - -var parseTfdt = require('../tools/parse-tfdt.js'); - -var parseTrun = require('../tools/parse-trun.js'); - -var parseTfhd = require('../tools/parse-tfhd.js'); -/** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - -var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; -}; -/** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - -var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - // eslint-disable-next-line no-console - console.log("We've encountered a nal unit without data. See mux.js#233."); - break; - } - - result.push(seiNal); - break; - - default: - break; - } - } - - return result; -}; -/** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - -var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; -}; -/** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - -var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox(traf, ['trun']); - var samples; - var seiNals; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - seiNals = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = []; - } - - captionNals[trackId] = captionNals[trackId].concat(seiNals); - } - }); - return captionNals; -}; -/** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption - **/ - - -var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var seiNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - seiNals = parseCaptionNals(segment, trackId); - return { - seiNals: seiNals[trackId], - timescale: timescale - }; -}; -/** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - -var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData === null || !parsedData.seiNals) { - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {} - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); -}; - -module.exports = CaptionParser; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/mp4/find-box.js b/node_modules/mux.js/cjs/mp4/find-box.js deleted file mode 100644 index d9b88b0..0000000 --- a/node_modules/mux.js/cjs/mp4/find-box.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -var toUnsigned = require('../utils/bin').toUnsigned; - -var parseType = require('./parse-type.js'); - -var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; -}; - -module.exports = findBox; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/mp4/frame-utils.js b/node_modules/mux.js/cjs/mp4/frame-utils.js deleted file mode 100644 index 34c39c0..0000000 --- a/node_modules/mux.js/cjs/mp4/frame-utils.js +++ /dev/null @@ -1,304 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -// Convert an array of nal units into an array of frames with each frame being -// composed of the nal units that make up that frame -// Also keep track of cummulative data about the frame from the nal units such -// as the frame duration, starting pts, etc. -var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; -}; // Convert an array of frames into an array of Gop with each Gop being composed -// of the frames that make up that Gop -// Also keep track of cummulative data about the Gop from the frames such as the -// Gop duration, starting pts, etc. - - -var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; -}; -/* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - -var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; -}; -/** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - -var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; -}; -/* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - -var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; -}; // generate the track's sample table from an array of gops - - -var generateSampleTable = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; -}; // generate the track's raw mdat data from an array of gops - - -var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; -}; // generate the track's sample table from a frame - - -var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; -}; // generate the track's raw mdat data from a frame - - -var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; -}; - -module.exports = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/mp4/index.js b/node_modules/mux.js/cjs/mp4/index.js deleted file mode 100644 index d8d359d..0000000 --- a/node_modules/mux.js/cjs/mp4/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - generator: require('./mp4-generator'), - probe: require('./probe'), - Transmuxer: require('./transmuxer').Transmuxer, - AudioSegmentStream: require('./transmuxer').AudioSegmentStream, - VideoSegmentStream: require('./transmuxer').VideoSegmentStream, - CaptionParser: require('./caption-parser') -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/mp4/mp4-generator.js b/node_modules/mux.js/cjs/mp4/mp4-generator.js deleted file mode 100644 index 5fb19c3..0000000 --- a/node_modules/mux.js/cjs/mp4/mp4-generator.js +++ /dev/null @@ -1,610 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ -'use strict'; - -var UINT32_MAX = Math.pow(2, 32) - 1; -var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - -(function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); -})(); - -box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; -}; - -dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); -}; - -esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); -}; - -ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); -}; - -hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); -}; - -mdat = function mdat(data) { - return box(types.mdat, data); -}; - -mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); -}; - -mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); -}; - -mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); -}; - -minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); -}; - -moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); -}; -/** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - -moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); -}; - -mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); -}; - -mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); -}; - -sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); -}; - -stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); -}; - -(function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; -})(); - -tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); -}; -/** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - -traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (UINT32_MAX + 1)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (UINT32_MAX + 1)); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); -}; -/** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - -trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); -}; - -trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); -}; - -(function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; -})(); - -module.exports = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/mp4/parse-type.js b/node_modules/mux.js/cjs/mp4/parse-type.js deleted file mode 100644 index 4ba9e7e..0000000 --- a/node_modules/mux.js/cjs/mp4/parse-type.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -var parseType = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; -}; - -module.exports = parseType; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/mp4/probe.js b/node_modules/mux.js/cjs/mp4/probe.js deleted file mode 100644 index b78e597..0000000 --- a/node_modules/mux.js/cjs/mp4/probe.js +++ /dev/null @@ -1,335 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about MP4s. - */ -'use strict'; - -var toUnsigned = require('../utils/bin').toUnsigned; - -var toHexString = require('../utils/bin').toHexString; - -var findBox = require('../mp4/find-box.js'); - -var parseType = require('../mp4/parse-type.js'); - -var parseTfhd = require('../tools/parse-tfhd.js'); - -var parseTrun = require('../tools/parse-trun.js'); - -var parseTfdt = require('../tools/parse-tfdt.js'); - -var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader; -/** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - -timescale = function timescale(init) { - var result = {}, - traks = findBox(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); -}; -/** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - -startTime = function startTime(timescale, fragment) { - var trafs, baseTimes, result; // we need info from two childrend of each track fragment box - - trafs = findBox(fragment, ['moof', 'traf']); // determine the start times for each track - - baseTimes = [].concat.apply([], trafs.map(function (traf) { - return findBox(traf, ['tfhd']).map(function (tfhd) { - var id, scale, baseTime; // get the track id from the tfhd - - id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - baseTime = findBox(traf, ['tfdt']).map(function (tfdt) { - var version, result; - version = tfdt[0]; - result = toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]); - - if (version === 1) { - result *= Math.pow(2, 32); - result += toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11]); - } - - return result; - })[0]; - baseTime = typeof baseTime === 'number' && !isNaN(baseTime) ? baseTime : Infinity; // convert base time to seconds - - return baseTime / scale; - }); - })); // return the minimum - - result = Math.min.apply(null, baseTimes); - return isFinite(result) ? result : 0; -}; -/** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - -compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - return (baseMediaDecodeTime + compositionTimeOffset) / timescale; -}; -/** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - -getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox(trak, ['mdia', 'hdlr']); - var tkhds = findBox(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; -}; - -getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); -}; -/** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - -getTracks = function getTracks(init) { - var traks = findBox(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[a-z]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString(codecConfig[10]); // level idc - - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; -}; - -module.exports = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox, - parseType: parseType, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/mp4/track-decode-info.js b/node_modules/mux.js/cjs/mp4/track-decode-info.js deleted file mode 100644 index 51748ed..0000000 --- a/node_modules/mux.js/cjs/mp4/track-decode-info.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; -/** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - -var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } -}; -/** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - -var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; -}; -/** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - -var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; -}; - -module.exports = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/mp4/transmuxer.js b/node_modules/mux.js/cjs/mp4/transmuxer.js deleted file mode 100644 index 87ee826..0000000 --- a/node_modules/mux.js/cjs/mp4/transmuxer.js +++ /dev/null @@ -1,1077 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('./mp4-generator.js'); - -var frameUtils = require('./frame-utils'); - -var audioFrameUtils = require('./audio-frame-utils'); - -var trackDecodeInfo = require('./track-decode-info'); - -var m2ts = require('../m2ts/m2ts.js'); - -var clock = require('../utils/clock'); - -var AdtsStream = require('../codecs/adts.js'); - -var H264Stream = require('../codecs/h264').H264Stream; - -var AacStream = require('../aac'); - -var isLikelyAacData = require('../aac/utils').isLikelyAacData; - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); - -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); // object types - - -var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; -/** - * Compare two arrays (even typed) for same-ness - */ - - -var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; -}; - -var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; -}; -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - -_AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -_AudioSegmentStream.prototype = new Stream(); -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - -_VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - VIDEO_PROPERTIES.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; -}; - -_VideoSegmentStream.prototype = new Stream(); -/** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - -_CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; -}; - -_CoalesceStream.prototype = new Stream(); - -_CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - VIDEO_PROPERTIES.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - AUDIO_PROPERTIES.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } -}; - -_CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; -}; -/** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - -_Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new AacStream(); - pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new AdtsStream(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts.TransportPacketStream(); - pipeline.parseStream = new m2ts.TransportParseStream(); - pipeline.elementaryStream = new m2ts.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream(); - pipeline.adtsStream = new AdtsStream(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; -}; - -_Transmuxer.prototype = new Stream(); -module.exports = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: AUDIO_PROPERTIES, - VIDEO_PROPERTIES: VIDEO_PROPERTIES, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/partial/audio-segment-stream.js b/node_modules/mux.js/cjs/partial/audio-segment-stream.js deleted file mode 100644 index 93bf9c5..0000000 --- a/node_modules/mux.js/cjs/partial/audio-segment-stream.js +++ /dev/null @@ -1,141 +0,0 @@ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('../mp4/mp4-generator.js'); - -var audioFrameUtils = require('../mp4/audio-frame-utils'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - */ - - -var AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity, - segmentStartPts = null, - segmentEndPts = null; - options = options || {}; - AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.processFrames_ = function () { - var frames, moof, mdat, boxes, timingInfo; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - - if (frames.length === 0) { - // return early if the frames are all after the earliest allowed DTS - // TODO should we clear the adtsFrames? - return; - } - - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4.moof(sequenceNumber, [track]); // bump the sequence number for next time - - sequenceNumber++; - track.initSegment = mp4.initSegment([track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackInfo.clearDtsInfo(track); - - if (segmentStartPts === null) { - segmentEndPts = segmentStartPts = frames[0].pts; - } - - segmentEndPts += frames.length * (ONE_SECOND_IN_TS * 1024 / track.samplerate); - timingInfo = { - start: segmentStartPts - }; - this.trigger('timingInfo', timingInfo); - this.trigger('data', { - track: track, - boxes: boxes - }); - }; - - this.flush = function () { - this.processFrames_(); // trigger final timing info - - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - this.resetTiming_(); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.partialFlush = function () { - this.processFrames_(); - this.trigger('partialdone', 'AudioSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'AudioSegmentStream'); - }; - - this.resetTiming_ = function () { - trackInfo.clearDtsInfo(track); - segmentStartPts = null; - segmentEndPts = null; - }; - - this.reset = function () { - this.resetTiming_(); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -AudioSegmentStream.prototype = new Stream(); -module.exports = AudioSegmentStream; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/partial/index.js b/node_modules/mux.js/cjs/partial/index.js deleted file mode 100644 index 287fa59..0000000 --- a/node_modules/mux.js/cjs/partial/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -module.exports = { - Transmuxer: require('./transmuxer') -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/partial/transmuxer.js b/node_modules/mux.js/cjs/partial/transmuxer.js deleted file mode 100644 index 3627f00..0000000 --- a/node_modules/mux.js/cjs/partial/transmuxer.js +++ /dev/null @@ -1,324 +0,0 @@ -"use strict"; - -var Stream = require('../utils/stream.js'); - -var m2ts = require('../m2ts/m2ts.js'); - -var codecs = require('../codecs/index.js'); - -var AudioSegmentStream = require('./audio-segment-stream.js'); - -var VideoSegmentStream = require('./video-segment-stream.js'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var isLikelyAacData = require('../aac/utils').isLikelyAacData; - -var AdtsStream = require('../codecs/adts'); - -var AacStream = require('../aac/index'); - -var clock = require('../utils/clock'); - -var createPipeline = function createPipeline(object) { - object.prototype = new Stream(); - object.prototype.init.call(object); - return object; -}; - -var tsPipeline = function tsPipeline(options) { - var pipeline = { - type: 'ts', - tracks: { - audio: null, - video: null - }, - packet: new m2ts.TransportPacketStream(), - parse: new m2ts.TransportParseStream(), - elementary: new m2ts.ElementaryStream(), - timestampRollover: new m2ts.TimestampRolloverStream(), - adts: new codecs.Adts(), - h264: new codecs.h264.H264Stream(), - captionStream: new m2ts.CaptionStream(options), - metadataStream: new m2ts.MetadataStream() - }; - pipeline.headOfPipeline = pipeline.packet; // Transport Stream - - pipeline.packet.pipe(pipeline.parse).pipe(pipeline.elementary).pipe(pipeline.timestampRollover); // H264 - - pipeline.timestampRollover.pipe(pipeline.h264); // Hook up CEA-608/708 caption stream - - pipeline.h264.pipe(pipeline.captionStream); - pipeline.timestampRollover.pipe(pipeline.metadataStream); // ADTS - - pipeline.timestampRollover.pipe(pipeline.adts); - pipeline.elementary.on('data', function (data) { - if (data.type !== 'metadata') { - return; - } - - for (var i = 0; i < data.tracks.length; i++) { - if (!pipeline.tracks[data.tracks[i].type]) { - pipeline.tracks[data.tracks[i].type] = data.tracks[i]; - pipeline.tracks[data.tracks[i].type].timelineStartInfo.baseMediaDecodeTime = options.baseMediaDecodeTime; - } - } - - if (pipeline.tracks.video && !pipeline.videoSegmentStream) { - pipeline.videoSegmentStream = new VideoSegmentStream(pipeline.tracks.video, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - if (pipeline.tracks.audio && !options.keepOriginalTimestamps) { - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - options.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'videoTimingInfo')); - pipeline.videoSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'video', - data: data - }); - }); - pipeline.videoSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.videoSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.videoSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.h264.pipe(pipeline.videoSegmentStream); - } - - if (pipeline.tracks.audio && !pipeline.audioSegmentStream) { - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); - pipeline.adts.pipe(pipeline.audioSegmentStream); - } // emit pmt info - - - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); - pipeline.captionStream.on('data', function (caption) { - var timelineStartPts; - - if (pipeline.tracks.video) { - timelineStartPts = pipeline.tracks.video.timelineStartInfo.pts || 0; - } else { - // This will only happen if we encounter caption packets before - // video data in a segment. This is an unusual/unlikely scenario, - // so we assume the timeline starts at zero for now. - timelineStartPts = 0; - } // Translate caption PTS times into second offsets into the - // video timeline for the segment - - - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, options.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, options.keepOriginalTimestamps); - pipeline.trigger('caption', caption); - }); - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; -}; - -var aacPipeline = function aacPipeline(options) { - var pipeline = { - type: 'aac', - tracks: { - audio: null - }, - metadataStream: new m2ts.MetadataStream(), - aacStream: new AacStream(), - audioRollover: new m2ts.TimestampRolloverStream('audio'), - timedMetadataRollover: new m2ts.TimestampRolloverStream('timed-metadata'), - adtsStream: new AdtsStream(true) - }; // set up the parsing pipeline - - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioRollover).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataRollover).pipe(pipeline.metadataStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - pipeline.tracks.audio = pipeline.tracks.audio || { - timelineStartInfo: { - baseMediaDecodeTime: options.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream); - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); // set the pipeline up as a stream before binding to get access to the trigger function - - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; -}; - -var setupPipelineListeners = function setupPipelineListeners(pipeline, transmuxer) { - pipeline.on('data', transmuxer.trigger.bind(transmuxer, 'data')); - pipeline.on('done', transmuxer.trigger.bind(transmuxer, 'done')); - pipeline.on('partialdone', transmuxer.trigger.bind(transmuxer, 'partialdone')); - pipeline.on('endedtimeline', transmuxer.trigger.bind(transmuxer, 'endedtimeline')); - pipeline.on('audioTimingInfo', transmuxer.trigger.bind(transmuxer, 'audioTimingInfo')); - pipeline.on('videoTimingInfo', transmuxer.trigger.bind(transmuxer, 'videoTimingInfo')); - pipeline.on('trackinfo', transmuxer.trigger.bind(transmuxer, 'trackinfo')); - pipeline.on('id3Frame', function (event) { - // add this to every single emitted segment even though it's only needed for the first - event.dispatchType = pipeline.metadataStream.dispatchType; // keep original time, can be adjusted if needed at a higher level - - event.cueTime = clock.videoTsToSeconds(event.pts); - transmuxer.trigger('id3Frame', event); - }); - pipeline.on('caption', function (event) { - transmuxer.trigger('caption', event); - }); -}; - -var Transmuxer = function Transmuxer(options) { - var pipeline = null, - hasFlushed = true; - options = options || {}; - Transmuxer.prototype.init.call(this); - options.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - - this.push = function (bytes) { - if (hasFlushed) { - var isAac = isLikelyAacData(bytes); - - if (isAac && (!pipeline || pipeline.type !== 'aac')) { - pipeline = aacPipeline(options); - setupPipelineListeners(pipeline, this); - } else if (!isAac && (!pipeline || pipeline.type !== 'ts')) { - pipeline = tsPipeline(options); - setupPipelineListeners(pipeline, this); - } - - hasFlushed = false; - } - - pipeline.headOfPipeline.push(bytes); - }; - - this.flush = function () { - if (!pipeline) { - return; - } - - hasFlushed = true; - pipeline.headOfPipeline.flush(); - }; - - this.partialFlush = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.partialFlush(); - }; - - this.endTimeline = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.reset(); - }; - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - if (!options.keepOriginalTimestamps) { - options.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (!pipeline) { - return; - } - - if (pipeline.tracks.audio) { - pipeline.tracks.audio.timelineStartInfo.dts = undefined; - pipeline.tracks.audio.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.audio); - - if (pipeline.audioRollover) { - pipeline.audioRollover.discontinuity(); - } - } - - if (pipeline.tracks.video) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - pipeline.tracks.video.timelineStartInfo.dts = undefined; - pipeline.tracks.video.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.video); // pipeline.captionStream.reset(); - } - - if (pipeline.timestampRollover) { - pipeline.timestampRollover.discontinuity(); - } - }; - - this.setRemux = function (val) { - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.setAudioAppendStart = function (audioAppendStart) { - if (!pipeline || !pipeline.tracks.audio || !pipeline.audioSegmentStream) { - return; - } - - pipeline.audioSegmentStream.setAudioAppendStart(audioAppendStart); - }; // TODO GOP alignment support - // Support may be a bit trickier than with full segment appends, as GOPs may be split - // and processed in a more granular fashion - - - this.alignGopsWith = function (gopsToAlignWith) { - return; - }; -}; - -Transmuxer.prototype = new Stream(); -module.exports = Transmuxer; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/partial/video-segment-stream.js b/node_modules/mux.js/cjs/partial/video-segment-stream.js deleted file mode 100644 index 826bab6..0000000 --- a/node_modules/mux.js/cjs/partial/video-segment-stream.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('../mp4/mp4-generator.js'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var frameUtils = require('../mp4/frame-utils'); - -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); - -var VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - frameCache = [], - // gopsToAlignWith = [], - config, - pps, - segmentStartPts = null, - segmentEndPts = null, - gops, - ensureNextFrameIsKeyFrame = true; - options = options || {}; - VideoSegmentStream.prototype.init.call(this); - - this.push = function (nalUnit) { - trackInfo.collectDtsInfo(track, nalUnit); - - if (typeof track.timelineStartInfo.dts === 'undefined') { - track.timelineStartInfo.dts = nalUnit.dts; - } // record the track config - - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - VIDEO_PROPERTIES.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - - this.processNals_ = function (cacheLastFrame) { - var i; - nalUnits = frameCache.concat(nalUnits); // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - return; - } - - var frames = frameUtils.groupNalsIntoFrames(nalUnits); - - if (!frames.length) { - return; - } // note that the frame cache may also protect us from cases where we haven't - // pushed data for the entire first or last frame yet - - - frameCache = frames[frames.length - 1]; - - if (cacheLastFrame) { - frames.pop(); - frames.duration -= frameCache.duration; - frames.nalCount -= frameCache.length; - frames.byteLength -= frameCache.byteLength; - } - - if (!frames.length) { - nalUnits = []; - return; - } - - this.trigger('timelineStartInfo', track.timelineStartInfo); - - if (ensureNextFrameIsKeyFrame) { - gops = frameUtils.groupFramesIntoGops(frames); - - if (!gops[0][0].keyFrame) { - gops = frameUtils.extendFirstKeyFrame(gops); - - if (!gops[0][0].keyFrame) { - // we haven't yet gotten a key frame, so reset nal units to wait for more nal - // units - nalUnits = [].concat.apply([], frames).concat(frameCache); - frameCache = []; - return; - } - - frames = [].concat.apply([], gops); - frames.duration = gops.duration; - } - - ensureNextFrameIsKeyFrame = false; - } - - if (segmentStartPts === null) { - segmentStartPts = frames[0].pts; - segmentEndPts = segmentStartPts; - } - - segmentEndPts += frames.duration; - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - - for (i = 0; i < frames.length; i++) { - var frame = frames[i]; - track.samples = frameUtils.generateSampleTableForFrame(frame); - var mdat = mp4.mdat(frameUtils.concatenateNalDataForFrame(frame)); - trackInfo.clearDtsInfo(track); - trackInfo.collectDtsInfo(track, frame); - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - var moof = mp4.moof(sequenceNumber, [track]); - sequenceNumber++; - track.initSegment = mp4.initSegment([track]); - var boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes, - sequence: sequenceNumber, - videoFrameDts: frame.dts, - videoFramePts: frame.pts - }); - } - - nalUnits = []; - }; - - this.resetTimingAndConfig_ = function () { - config = undefined; - pps = undefined; - segmentStartPts = null; - segmentEndPts = null; - }; - - this.partialFlush = function () { - this.processNals_(true); - this.trigger('partialdone', 'VideoSegmentStream'); - }; - - this.flush = function () { - this.processNals_(false); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - this.resetTimingAndConfig_(); - this.trigger('done', 'VideoSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetTimingAndConfig_(); - frameCache = []; - nalUnits = []; - ensureNextFrameIsKeyFrame = true; - this.trigger('reset'); - }; -}; - -VideoSegmentStream.prototype = new Stream(); -module.exports = VideoSegmentStream; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/tools/caption-packet-parser.js b/node_modules/mux.js/cjs/tools/caption-packet-parser.js deleted file mode 100644 index 129adc6..0000000 --- a/node_modules/mux.js/cjs/tools/caption-packet-parser.js +++ /dev/null @@ -1,189 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ -'use strict'; // Supplemental enhancement information (SEI) NAL units have a -// payload type field to indicate how they are to be -// interpreted. CEAS-708 caption content is always transmitted with -// payload type 0x04. - -var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; -/** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - -var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; -}; // see ANSI/SCTE 128-1 (2013), section 8.1 - - -var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); -}; // see CEA-708-D, section 4.4 - - -var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; -}; - -var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; -}; // exports - - -module.exports = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/tools/flv-inspector.js b/node_modules/mux.js/cjs/tools/flv-inspector.js deleted file mode 100644 index 6502fd1..0000000 --- a/node_modules/mux.js/cjs/tools/flv-inspector.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var tagTypes = { - 0x08: 'audio', - 0x09: 'video', - 0x12: 'metadata' -}, - hex = function hex(val) { - return '0x' + ('00' + val.toString(16)).slice(-2).toUpperCase(); -}, - hexStringList = function hexStringList(data) { - var arr = [], - i; - - while (data.byteLength > 0) { - i = 0; - arr.push(hex(data[i++])); - data = data.subarray(i); - } - - return arr.join(' '); -}, - parseAVCTag = function parseAVCTag(tag, obj) { - var avcPacketTypes = ['AVC Sequence Header', 'AVC NALU', 'AVC End-of-Sequence'], - compositionTime = tag[1] & parseInt('01111111', 2) << 16 | tag[2] << 8 | tag[3]; - obj = obj || {}; - obj.avcPacketType = avcPacketTypes[tag[0]]; - obj.CompositionTime = tag[1] & parseInt('10000000', 2) ? -compositionTime : compositionTime; - - if (tag[0] === 1) { - obj.nalUnitTypeRaw = hexStringList(tag.subarray(4, 100)); - } else { - obj.data = hexStringList(tag.subarray(4)); - } - - return obj; -}, - parseVideoTag = function parseVideoTag(tag, obj) { - var frameTypes = ['Unknown', 'Keyframe (for AVC, a seekable frame)', 'Inter frame (for AVC, a nonseekable frame)', 'Disposable inter frame (H.263 only)', 'Generated keyframe (reserved for server use only)', 'Video info/command frame'], - codecID = tag[0] & parseInt('00001111', 2); - obj = obj || {}; - obj.frameType = frameTypes[(tag[0] & parseInt('11110000', 2)) >>> 4]; - obj.codecID = codecID; - - if (codecID === 7) { - return parseAVCTag(tag.subarray(1), obj); - } - - return obj; -}, - parseAACTag = function parseAACTag(tag, obj) { - var packetTypes = ['AAC Sequence Header', 'AAC Raw']; - obj = obj || {}; - obj.aacPacketType = packetTypes[tag[0]]; - obj.data = hexStringList(tag.subarray(1)); - return obj; -}, - parseAudioTag = function parseAudioTag(tag, obj) { - var formatTable = ['Linear PCM, platform endian', 'ADPCM', 'MP3', 'Linear PCM, little endian', 'Nellymoser 16-kHz mono', 'Nellymoser 8-kHz mono', 'Nellymoser', 'G.711 A-law logarithmic PCM', 'G.711 mu-law logarithmic PCM', 'reserved', 'AAC', 'Speex', 'MP3 8-Khz', 'Device-specific sound'], - samplingRateTable = ['5.5-kHz', '11-kHz', '22-kHz', '44-kHz'], - soundFormat = (tag[0] & parseInt('11110000', 2)) >>> 4; - obj = obj || {}; - obj.soundFormat = formatTable[soundFormat]; - obj.soundRate = samplingRateTable[(tag[0] & parseInt('00001100', 2)) >>> 2]; - obj.soundSize = (tag[0] & parseInt('00000010', 2)) >>> 1 ? '16-bit' : '8-bit'; - obj.soundType = tag[0] & parseInt('00000001', 2) ? 'Stereo' : 'Mono'; - - if (soundFormat === 10) { - return parseAACTag(tag.subarray(1), obj); - } - - return obj; -}, - parseGenericTag = function parseGenericTag(tag) { - return { - tagType: tagTypes[tag[0]], - dataSize: tag[1] << 16 | tag[2] << 8 | tag[3], - timestamp: tag[7] << 24 | tag[4] << 16 | tag[5] << 8 | tag[6], - streamID: tag[8] << 16 | tag[9] << 8 | tag[10] - }; -}, - inspectFlvTag = function inspectFlvTag(tag) { - var header = parseGenericTag(tag); - - switch (tag[0]) { - case 0x08: - parseAudioTag(tag.subarray(11), header); - break; - - case 0x09: - parseVideoTag(tag.subarray(11), header); - break; - - case 0x12: - } - - return header; -}, - inspectFlv = function inspectFlv(bytes) { - var i = 9, - // header - dataSize, - parsedResults = [], - tag; // traverse the tags - - i += 4; // skip previous tag size - - while (i < bytes.byteLength) { - dataSize = bytes[i + 1] << 16; - dataSize |= bytes[i + 2] << 8; - dataSize |= bytes[i + 3]; - dataSize += 11; - tag = bytes.subarray(i, i + dataSize); - parsedResults.push(inspectFlvTag(tag)); - i += dataSize + 4; - } - - return parsedResults; -}, - textifyFlv = function textifyFlv(flvTagArray) { - return JSON.stringify(flvTagArray, null, 2); -}; - -module.exports = { - inspectTag: inspectFlvTag, - inspect: inspectFlv, - textify: textifyFlv -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/tools/mp4-inspector.js b/node_modules/mux.js/cjs/tools/mp4-inspector.js deleted file mode 100644 index 935600f..0000000 --- a/node_modules/mux.js/cjs/tools/mp4-inspector.js +++ /dev/null @@ -1,753 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse the internal MP4 structure into an equivalent javascript - * object. - */ -'use strict'; - -var MAX_UINT32 = Math.pow(2, 32); - -var inspectMp4, - _textifyMp, - parseMp4Date = function parseMp4Date(seconds) { - return new Date(seconds * 1000 - 2082844800000); -}, - parseType = require('../mp4/parse-type'), - findBox = require('../mp4/find-box'), - nalParse = function nalParse(avcStream) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - i, - length; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - result.push('MALFORMED DATA'); - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x01: - result.push('slice_layer_without_partitioning_rbsp'); - break; - - case 0x05: - result.push('slice_layer_without_partitioning_rbsp_idr'); - break; - - case 0x06: - result.push('sei_rbsp'); - break; - - case 0x07: - result.push('seq_parameter_set_rbsp'); - break; - - case 0x08: - result.push('pic_parameter_set_rbsp'); - break; - - case 0x09: - result.push('access_unit_delimiter_rbsp'); - break; - - default: - result.push('UNKNOWN NAL - ' + avcStream[i] & 0x1F); - break; - } - } - - return result; -}, - // registry of handlers for individual mp4 box types -parse = { - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - avc1: function avc1(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - dataReferenceIndex: view.getUint16(6), - width: view.getUint16(24), - height: view.getUint16(26), - horizresolution: view.getUint16(28) + view.getUint16(30) / 16, - vertresolution: view.getUint16(32) + view.getUint16(34) / 16, - frameCount: view.getUint16(40), - depth: view.getUint16(74), - config: inspectMp4(data.subarray(78, data.byteLength)) - }; - }, - avcC: function avcC(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - configurationVersion: data[0], - avcProfileIndication: data[1], - profileCompatibility: data[2], - avcLevelIndication: data[3], - lengthSizeMinusOne: data[4] & 0x03, - sps: [], - pps: [] - }, - numOfSequenceParameterSets = data[5] & 0x1f, - numOfPictureParameterSets, - nalSize, - offset, - i; // iterate past any SPSs - - offset = 6; - - for (i = 0; i < numOfSequenceParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.sps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } // iterate past any PPSs - - - numOfPictureParameterSets = data[offset]; - offset++; - - for (i = 0; i < numOfPictureParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.pps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } - - return result; - }, - btrt: function btrt(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - bufferSizeDB: view.getUint32(0), - maxBitrate: view.getUint32(4), - avgBitrate: view.getUint32(8) - }; - }, - edts: function edts(data) { - return { - boxes: inspectMp4(data) - }; - }, - elst: function elst(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - edits: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; entryCount--) { - if (result.version === 0) { - result.edits.push({ - segmentDuration: view.getUint32(i), - mediaTime: view.getInt32(i + 4), - mediaRate: view.getUint16(i + 8) + view.getUint16(i + 10) / (256 * 256) - }); - i += 12; - } else { - result.edits.push({ - segmentDuration: view.getUint32(i) * MAX_UINT32 + view.getUint32(i + 4), - mediaTime: view.getUint32(i + 8) * MAX_UINT32 + view.getUint32(i + 12), - mediaRate: view.getUint16(i + 16) + view.getUint16(i + 18) / (256 * 256) - }); - i += 20; - } - } - - return result; - }, - esds: function esds(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - esId: data[6] << 8 | data[7], - streamPriority: data[8] & 0x1f, - decoderConfig: { - objectProfileIndication: data[11], - streamType: data[12] >>> 2 & 0x3f, - bufferSize: data[13] << 16 | data[14] << 8 | data[15], - maxBitrate: data[16] << 24 | data[17] << 16 | data[18] << 8 | data[19], - avgBitrate: data[20] << 24 | data[21] << 16 | data[22] << 8 | data[23], - decoderConfigDescriptor: { - tag: data[24], - length: data[25], - audioObjectType: data[26] >>> 3 & 0x1f, - samplingFrequencyIndex: (data[26] & 0x07) << 1 | data[27] >>> 7 & 0x01, - channelConfiguration: data[27] >>> 3 & 0x0f - } - } - }; - }, - ftyp: function ftyp(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - majorBrand: parseType(data.subarray(0, 4)), - minorVersion: view.getUint32(4), - compatibleBrands: [] - }, - i = 8; - - while (i < data.byteLength) { - result.compatibleBrands.push(parseType(data.subarray(i, i + 4))); - i += 4; - } - - return result; - }, - dinf: function dinf(data) { - return { - boxes: inspectMp4(data) - }; - }, - dref: function dref(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - dataReferences: inspectMp4(data.subarray(8)) - }; - }, - hdlr: function hdlr(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - handlerType: parseType(data.subarray(8, 12)), - name: '' - }, - i = 8; // parse out the name field - - for (i = 24; i < data.byteLength; i++) { - if (data[i] === 0x00) { - // the name field is null-terminated - i++; - break; - } - - result.name += String.fromCharCode(data[i]); - } // decode UTF-8 to javascript's internal representation - // see http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html - - - result.name = decodeURIComponent(escape(result.name)); - return result; - }, - mdat: function mdat(data) { - return { - byteLength: data.byteLength, - nals: nalParse(data) - }; - }, - mdhd: function mdhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - language, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - language: '' - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // language is stored as an ISO-639-2/T code in an array of three 5-bit fields - // each field is the packed difference between its ASCII value and 0x60 - - language = view.getUint16(i); - result.language += String.fromCharCode((language >> 10) + 0x60); - result.language += String.fromCharCode(((language & 0x03e0) >> 5) + 0x60); - result.language += String.fromCharCode((language & 0x1f) + 0x60); - return result; - }, - mdia: function mdia(data) { - return { - boxes: inspectMp4(data) - }; - }, - mfhd: function mfhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sequenceNumber: data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7] - }; - }, - minf: function minf(data) { - return { - boxes: inspectMp4(data) - }; - }, - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - mp4a: function mp4a(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - // 6 bytes reserved - dataReferenceIndex: view.getUint16(6), - // 4 + 4 bytes reserved - channelcount: view.getUint16(16), - samplesize: view.getUint16(18), - // 2 bytes pre_defined - // 2 bytes reserved - samplerate: view.getUint16(24) + view.getUint16(26) / 65536 - }; // if there are more bytes to process, assume this is an ISO/IEC - // 14496-14 MP4AudioSampleEntry and parse the ESDBox - - if (data.byteLength > 28) { - result.streamDescriptor = inspectMp4(data.subarray(28))[0]; - } - - return result; - }, - moof: function moof(data) { - return { - boxes: inspectMp4(data) - }; - }, - moov: function moov(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvex: function mvex(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvhd: function mvhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // convert fixed-point, base 16 back to a number - - result.rate = view.getUint16(i) + view.getUint16(i + 2) / 16; - i += 4; - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - i += 2 * 4; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - i += 6 * 4; - result.nextTrackId = view.getUint32(i); - return result; - }, - pdin: function pdin(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - rate: view.getUint32(4), - initialDelay: view.getUint32(8) - }; - }, - sdtp: function sdtp(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - i; - - for (i = 4; i < data.byteLength; i++) { - result.samples.push({ - dependsOn: (data[i] & 0x30) >> 4, - isDependedOn: (data[i] & 0x0c) >> 2, - hasRedundancy: data[i] & 0x03 - }); - } - - return result; - }, - sidx: require('./parse-sidx.js'), - smhd: function smhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - balance: data[4] + data[5] / 256 - }; - }, - stbl: function stbl(data) { - return { - boxes: inspectMp4(data) - }; - }, - ctts: function ctts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - compositionOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.compositionOffsets.push({ - sampleCount: view.getUint32(i), - sampleOffset: view[result.version === 0 ? 'getUint32' : 'getInt32'](i + 4) - }); - } - - return result; - }, - stss: function stss(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - syncSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.syncSamples.push(view.getUint32(i)); - } - - return result; - }, - stco: function stco(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - chunkOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.chunkOffsets.push(view.getUint32(i)); - } - - return result; - }, - stsc: function stsc(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - entryCount = view.getUint32(4), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleToChunks: [] - }, - i; - - for (i = 8; entryCount; i += 12, entryCount--) { - result.sampleToChunks.push({ - firstChunk: view.getUint32(i), - samplesPerChunk: view.getUint32(i + 4), - sampleDescriptionIndex: view.getUint32(i + 8) - }); - } - - return result; - }, - stsd: function stsd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleDescriptions: inspectMp4(data.subarray(8)) - }; - }, - stsz: function stsz(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleSize: view.getUint32(4), - entries: [] - }, - i; - - for (i = 12; i < data.byteLength; i += 4) { - result.entries.push(view.getUint32(i)); - } - - return result; - }, - stts: function stts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - timeToSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.timeToSamples.push({ - sampleCount: view.getUint32(i), - sampleDelta: view.getUint32(i + 4) - }); - } - - return result; - }, - styp: function styp(data) { - return parse.ftyp(data); - }, - tfdt: require('./parse-tfdt.js'), - tfhd: require('./parse-tfhd.js'), - tkhd: function tkhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; - i += 2 * 4; - result.layer = view.getUint16(i); - i += 2; - result.alternateGroup = view.getUint16(i); - i += 2; // convert fixed-point, base 16 back to a number - - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - result.width = view.getUint16(i) + view.getUint16(i + 2) / 65536; - i += 4; - result.height = view.getUint16(i) + view.getUint16(i + 2) / 65536; - return result; - }, - traf: function traf(data) { - return { - boxes: inspectMp4(data) - }; - }, - trak: function trak(data) { - return { - boxes: inspectMp4(data) - }; - }, - trex: function trex(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4), - defaultSampleDescriptionIndex: view.getUint32(8), - defaultSampleDuration: view.getUint32(12), - defaultSampleSize: view.getUint32(16), - sampleDependsOn: data[20] & 0x03, - sampleIsDependedOn: (data[21] & 0xc0) >> 6, - sampleHasRedundancy: (data[21] & 0x30) >> 4, - samplePaddingValue: (data[21] & 0x0e) >> 1, - sampleIsDifferenceSample: !!(data[21] & 0x01), - sampleDegradationPriority: view.getUint16(22) - }; - }, - trun: require('./parse-trun.js'), - 'url ': function url(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - }, - vmhd: function vmhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - graphicsmode: view.getUint16(4), - opcolor: new Uint16Array([view.getUint16(6), view.getUint16(8), view.getUint16(10)]) - }; - } -}; -/** - * Return a javascript array of box objects parsed from an ISO base - * media file. - * @param data {Uint8Array} the binary data of the media to be inspected - * @return {array} a javascript array of potentially nested box objects - */ - - -inspectMp4 = function inspectMp4(data) { - var i = 0, - result = [], - view, - size, - type, - end, - box; // Convert data from Uint8Array to ArrayBuffer, to follow Dataview API - - var ab = new ArrayBuffer(data.length); - var v = new Uint8Array(ab); - - for (var z = 0; z < data.length; ++z) { - v[z] = data[z]; - } - - view = new DataView(ab); - - while (i < data.byteLength) { - // parse box data - size = view.getUint32(i); - type = parseType(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; // parse type-specific data - - box = (parse[type] || function (data) { - return { - data: data - }; - })(data.subarray(i + 8, end)); - - box.size = size; - box.type = type; // store this box and move to the next - - result.push(box); - i = end; - } - - return result; -}; -/** - * Returns a textual representation of the javascript represtentation - * of an MP4 file. You can use it as an alternative to - * JSON.stringify() to compare inspected MP4s. - * @param inspectedMp4 {array} the parsed array of boxes in an MP4 - * file - * @param depth {number} (optional) the number of ancestor boxes of - * the elements of inspectedMp4. Assumed to be zero if unspecified. - * @return {string} a text representation of the parsed MP4 - */ - - -_textifyMp = function textifyMp4(inspectedMp4, depth) { - var indent; - depth = depth || 0; - indent = new Array(depth * 2 + 1).join(' '); // iterate over all the boxes - - return inspectedMp4.map(function (box, index) { - // list the box type first at the current indentation level - return indent + box.type + '\n' + // the type is already included and handle child boxes separately - Object.keys(box).filter(function (key) { - return key !== 'type' && key !== 'boxes'; // output all the box properties - }).map(function (key) { - var prefix = indent + ' ' + key + ': ', - value = box[key]; // print out raw bytes as hexademical - - if (value instanceof Uint8Array || value instanceof Uint32Array) { - var bytes = Array.prototype.slice.call(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)).map(function (byte) { - return ' ' + ('00' + byte.toString(16)).slice(-2); - }).join('').match(/.{1,24}/g); - - if (!bytes) { - return prefix + '<>'; - } - - if (bytes.length === 1) { - return prefix + '<' + bytes.join('').slice(1) + '>'; - } - - return prefix + '<\n' + bytes.map(function (line) { - return indent + ' ' + line; - }).join('\n') + '\n' + indent + ' >'; - } // stringify generic objects - - - return prefix + JSON.stringify(value, null, 2).split('\n').map(function (line, index) { - if (index === 0) { - return line; - } - - return indent + ' ' + line; - }).join('\n'); - }).join('\n') + ( // recursively textify the child boxes - box.boxes ? '\n' + _textifyMp(box.boxes, depth + 1) : ''); - }).join('\n'); -}; - -module.exports = { - inspect: inspectMp4, - textify: _textifyMp, - parseType: parseType, - findBox: findBox, - parseTraf: parse.traf, - parseTfdt: parse.tfdt, - parseHdlr: parse.hdlr, - parseTfhd: parse.tfhd, - parseTrun: parse.trun, - parseSidx: parse.sidx -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/tools/parse-sample-flags.js b/node_modules/mux.js/cjs/tools/parse-sample-flags.js deleted file mode 100644 index 2595561..0000000 --- a/node_modules/mux.js/cjs/tools/parse-sample-flags.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; -}; - -module.exports = parseSampleFlags; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/tools/parse-sidx.js b/node_modules/mux.js/cjs/tools/parse-sidx.js deleted file mode 100644 index 8258720..0000000 --- a/node_modules/mux.js/cjs/tools/parse-sidx.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; - -var MAX_UINT32 = Math.pow(2, 32); - -var parseSidx = function parseSidx(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - references: [], - referenceId: view.getUint32(4), - timescale: view.getUint32(8) - }, - i = 12; - - if (result.version === 0) { - result.earliestPresentationTime = view.getUint32(i); - result.firstOffset = view.getUint32(i + 4); - i += 8; - } else { - // read 64 bits - result.earliestPresentationTime = view.getUint32(i) * MAX_UINT32 + view.getUint32(i + 4); - result.firstOffset = view.getUint32(i + 8) * MAX_UINT32 + view.getUint32(i + 12); - i += 16; - } - - i += 2; // reserved - - var referenceCount = view.getUint16(i); - i += 2; // start of references - - for (; referenceCount > 0; i += 12, referenceCount--) { - result.references.push({ - referenceType: (data[i] & 0x80) >>> 7, - referencedSize: view.getUint32(i) & 0x7FFFFFFF, - subsegmentDuration: view.getUint32(i + 4), - startsWithSap: !!(data[i + 8] & 0x80), - sapType: (data[i + 8] & 0x70) >>> 4, - sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF - }); - } - - return result; -}; - -module.exports = parseSidx; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/tools/parse-tfdt.js b/node_modules/mux.js/cjs/tools/parse-tfdt.js deleted file mode 100644 index 3b5487d..0000000 --- a/node_modules/mux.js/cjs/tools/parse-tfdt.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -var toUnsigned = require('../utils/bin').toUnsigned; - -var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - baseMediaDecodeTime: toUnsigned(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime *= Math.pow(2, 32); - result.baseMediaDecodeTime += toUnsigned(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11]); - } - - return result; -}; - -module.exports = tfdt; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/tools/parse-tfhd.js b/node_modules/mux.js/cjs/tools/parse-tfhd.js deleted file mode 100644 index 6a99afd..0000000 --- a/node_modules/mux.js/cjs/tools/parse-tfhd.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; - -var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; -}; - -module.exports = tfhd; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/tools/parse-trun.js b/node_modules/mux.js/cjs/tools/parse-trun.js deleted file mode 100644 index 0e464da..0000000 --- a/node_modules/mux.js/cjs/tools/parse-trun.js +++ /dev/null @@ -1,101 +0,0 @@ -"use strict"; - -var parseSampleFlags = require('./parse-sample-flags.js'); - -var trun = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; -}; - -module.exports = trun; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/tools/ts-inspector.js b/node_modules/mux.js/cjs/tools/ts-inspector.js deleted file mode 100644 index ba27ede..0000000 --- a/node_modules/mux.js/cjs/tools/ts-inspector.js +++ /dev/null @@ -1,555 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse mpeg2 transport stream packets to extract basic timing information - */ -'use strict'; - -var StreamTypes = require('../m2ts/stream-types.js'); - -var handleRollover = require('../m2ts/timestamp-rollover-stream.js').handleRollover; - -var probe = {}; -probe.ts = require('../m2ts/probe.js'); -probe.aac = require('../aac/utils.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var MP2T_PACKET_LENGTH = 188, - // bytes -SYNC_BYTE = 0x47; -/** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ - -var parsePsi_ = function parsePsi_(bytes, pmt) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - - case 'pmt': - var table = probe.ts.parsePmt(packet); - pmt.table = pmt.table || {}; - Object.keys(table).forEach(function (key) { - pmt.table[key] = table[key]; - }); - break; - - default: - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } -}; -/** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ - - -var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed; - var endLoop = false; // Start walking from start of segment to get first audio packet - - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last audio packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } -}; -/** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ - - -var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed, - frame, - i, - pes; - var endLoop = false; - var currentFrame = { - data: [], - size: 0 - }; // Start walking from start of segment to get first video packet - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn('Failed to extract PTS/DTS from PES at first keyframe. ' + 'This could be an unusual TS segment, or else mux.js did not ' + 'parse your TS segment correctly. If you know your TS ' + 'segments do contain PTS/DTS on keyframes please file a bug ' + 'report! You can try ffprobe to double check for yourself.'); - } - } - - currentFrame.size = 0; - } - } - - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - - break; - - default: - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last video packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } -}; -/** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ - - -var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - - segmentInfo.audio.forEach(function (info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - - segmentInfo.video.forEach(function (info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds - - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } -}; -/** - * inspects the aac data stream for start and end time information - */ - - -var inspectAac_ = function inspectAac_(bytes) { - var endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - - byteIndex += frameSize; - break; - - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - - audioCount++; - byteIndex += frameSize; - break; - - default: - byteIndex++; - break; - } - - if (endLoop) { - return null; - } - } - - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - var result = { - audio: [{ - type: 'audio', - dts: timestamp, - pts: timestamp - }, { - type: 'audio', - dts: timestamp + audioCount * 1024 * audioTimescale, - pts: timestamp + audioCount * 1024 * audioTimescale - }] - }; - return result; -}; -/** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ - - -var inspectTs_ = function inspectTs_(bytes) { - var pmt = { - pid: null, - table: null - }; - var result = {}; - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - - if (result.video.length === 0) { - delete result.video; - } - - break; - - case StreamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - - if (result.audio.length === 0) { - delete result.audio; - } - - break; - - default: - break; - } - } - } - - return result; -}; -/** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ - - -var inspect = function inspect(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || !result.audio && !result.video) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - return result; -}; - -module.exports = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/utils/bin.js b/node_modules/mux.js/cjs/utils/bin.js deleted file mode 100644 index c8e8933..0000000 --- a/node_modules/mux.js/cjs/utils/bin.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var toUnsigned = function toUnsigned(value) { - return value >>> 0; -}; - -var toHexString = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); -}; - -module.exports = { - toUnsigned: toUnsigned, - toHexString: toHexString -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/utils/clock.js b/node_modules/mux.js/cjs/utils/clock.js deleted file mode 100644 index 91b0b43..0000000 --- a/node_modules/mux.js/cjs/utils/clock.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var ONE_SECOND_IN_TS = 90000, - // 90kHz clock -secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - -secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS; -}; - -secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; -}; - -videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS; -}; - -audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; -}; - -audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); -}; - -videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); -}; -/** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - -metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); -}; - -module.exports = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds -}; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/utils/exp-golomb.js b/node_modules/mux.js/cjs/utils/exp-golomb.js deleted file mode 100644 index 5fd249e..0000000 --- a/node_modules/mux.js/cjs/utils/exp-golomb.js +++ /dev/null @@ -1,154 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var ExpGolomb; -/** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - -ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); -}; - -module.exports = ExpGolomb; \ No newline at end of file diff --git a/node_modules/mux.js/cjs/utils/stream.js b/node_modules/mux.js/cjs/utils/stream.js deleted file mode 100644 index 7d28c99..0000000 --- a/node_modules/mux.js/cjs/utils/stream.js +++ /dev/null @@ -1,153 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ -'use strict'; - -var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; -}; -/** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - -Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; -}; // Default stream functions that are expected to be overridden to perform -// actual work. These are provided by the prototype as a sort of no-op -// implementation so that we don't have to check for their existence in the -// `pipe` function above. - - -Stream.prototype.push = function (data) { - this.trigger('data', data); -}; - -Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); -}; - -Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); -}; - -Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); -}; - -Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); -}; - -module.exports = Stream; \ No newline at end of file diff --git a/node_modules/mux.js/dist/mux-flv.js b/node_modules/mux.js/dist/mux-flv.js deleted file mode 100644 index c764842..0000000 --- a/node_modules/mux.js/dist/mux-flv.js +++ /dev/null @@ -1,4867 +0,0 @@ -/*! @name mux.js @version 5.11.1 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.muxjs = factory()); -}(this, (function () { 'use strict'; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ - - var _FlvTag; // (type:uint, extraData:Boolean = false) extends ByteArray - - - _FlvTag = function FlvTag(type, extraData) { - var // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, - // :uint - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function prepareWrite(flv, count) { - var bytes, - minLength = flv.position + count; - - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } // allocate a new buffer and copy over the data that will not be modified - - - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - // commonly used metadata properties - widthBytes = _FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = _FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = _FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!_FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - _FlvTag.widthBytes = widthBytes; - _FlvTag.heightBytes = heightBytes; - _FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case _FlvTag.VIDEO_TAG: - this.length = 16; // Start the buffer at 256k - - bufferStartSize *= 6; - break; - - case _FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - - case _FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - // presentation timestamp - - this.pts = 0; // decoder timestamp - - this.dts = 0; // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - - this.writeBytes = function (bytes, offset, length) { - var start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - this.position += length; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeByte(value:int):void - - - this.writeByte = function (byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeShort(value:int):void - - - this.writeShort = function (short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; // Negative index into array - // (pos:uint):int - - - this.negIndex = function (pos) { - return this.bytes[this.length - pos]; - }; // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - - - this.nalUnitSize = function () { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function () { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } // reserve 4 bytes for nal unit size - - - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; // (nal:ByteArray = null):void - - - this.endNalUnit = function (nalContainer) { - var nalStart, // :uint - nalLength; // :uint - // Rewind to the marker and write the size - - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - - - this.writeMetaDataDouble = function (key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); // write size of property name - - this.view.setUint16(this.position, key.length); - this.position += 2; // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - // write property name - - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } // skip null byte - - - this.position++; // write property value - - this.view.setFloat64(this.position, val); - this.position += 8; // update flv tag length - - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // (key:String, val:Boolean):void - - - this.writeMetaDataBoolean = function (key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // ():ByteArray - - - this.finalize = function () { - var dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case _FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = (this.keyFrame || extraData ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case _FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case _FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - - this.position += 2; // set "onMetaData" - - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - - this.length = this.position; - break; - } - - len = this.length - 11; // write the DataSize field - - this.bytes[1] = (len & 0x00FF0000) >>> 16; - this.bytes[2] = (len & 0x0000FF00) >>> 8; - this.bytes[3] = (len & 0x000000FF) >>> 0; // write the Timestamp - - this.bytes[4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[7] = (this.dts & 0xFF000000) >>> 24; // write the StreamID - - this.bytes[8] = 0; - this.bytes[9] = 0; - this.bytes[10] = 0; // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; // trim down the byte buffer to what is actually being used - - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = _FlvTag.frameTime(this.bytes); // if bytes.bytelength isn't equal to this.length, handle error - - return this; - }; - }; - - _FlvTag.AUDIO_TAG = 0x08; // == 8, :uint - - _FlvTag.VIDEO_TAG = 0x09; // == 9, :uint - - _FlvTag.METADATA_TAG = 0x12; // == 18, :uint - // (tag:ByteArray):Boolean { - - _FlvTag.isAudioFrame = function (tag) { - return _FlvTag.AUDIO_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isVideoFrame = function (tag) { - return _FlvTag.VIDEO_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isMetaData = function (tag) { - return _FlvTag.METADATA_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isKeyFrame = function (tag) { - if (_FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (_FlvTag.isAudioFrame(tag)) { - return true; - } - - if (_FlvTag.isMetaData(tag)) { - return true; - } - - return false; - }; // (tag:ByteArray):uint { - - - _FlvTag.frameTime = function (tag) { - var pts = tag[4] << 16; // :uint - - pts |= tag[5] << 8; - pts |= tag[6] << 0; - pts |= tag[7] << 24; - return pts; - }; - - var flvTag = _FlvTag; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ - - var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; - }; - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - - Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; - }; // Default stream functions that are expected to be overridden to perform - // actual work. These are provided by the prototype as a sort of no-op - // implementation so that we don't have to check for their existence in the - // `pipe` function above. - - - Stream.prototype.push = function (data) { - this.trigger('data', data); - }; - - Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); - }; - - Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); - }; - - Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); - }; - - Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); - }; - - var stream = Stream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - // payload type field to indicate how they are to be - // interpreted. CEAS-708 caption content is always transmitted with - // payload type 0x04. - - var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - /** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - - var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; - }; // see ANSI/SCTE 128-1 (2013), section 8.1 - - - var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); - }; // see CEA-708-D, section 4.4 - - - var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; - }; - - var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; // exports - - - var captionPacketParser = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 - }; - - // Link To Transport - // ----------------- - - - var CaptionStream = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream(); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - }; - - CaptionStream.prototype = new stream(); - - CaptionStream.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; - }; - - CaptionStream.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); - }; - - CaptionStream.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); - }; - - CaptionStream.prototype.flush = function () { - return this.flushStream('flush'); - }; // Only called if handling partial data - - - CaptionStream.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); - }; - - CaptionStream.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); - }; // From the CEA-608 spec: - - /* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. - */ - // With that in mind, we ignore any data between an XDS control code and a - // subsequent closed-captioning control code. - - - CaptionStream.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); - }; - - CaptionStream.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; - }; - - CaptionStream.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; - }; - - CaptionStream.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; - }; - - CaptionStream.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } - }; // ---------------------- - // Session to Application - // ---------------------- - // This hash maps special and extended character codes to their - // proper Unicode equivalent. The first one-byte key is just a - // non-standard character code. The two-byte keys that follow are - // the extended CEA708 character codes, along with the preceding - // 0x10 extended character byte to distinguish these codes from - // non-extended character codes. Every CEA708 character code that - // is not in this object maps directly to a standard unicode - // character code. - // The transparent space and non-breaking transparent space are - // technically not fully supported since there is no code to - // make them transparent, so they have normal non-transparent - // stand-ins. - // The special closed caption (CC) character isn't a standard - // unicode character, so a fairly similar unicode character was - // chosen in it's place. - - - var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - - }; - - var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); - }; - - var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; - }; - - var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); - }; - - Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; - }; - - Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); - }; - - Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; - }; - - Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } - }; - - Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; - }; - - Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; - }; - - Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } - }; - - var Cea708Service = function Cea708Service(serviceNum) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - }; - /** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - - Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } - }; - /** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - - Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; - }; - - var Cea708Stream = function Cea708Stream() { - Cea708Stream.prototype.init.call(this); - var self = this; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; - }; - - Cea708Stream.prototype = new stream(); - /** - * Push current 708 packet, create new 708 packet. - */ - - Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; - }; - /** - * Add pts and both bytes from packet into current 708 packet. - */ - - - Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); - }; - /** - * Parse completed 708 packet into service blocks and push each service block. - */ - - - Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } - }; - /** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - - Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else ; - } - }; - /** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, true); - } - - return i; - }; - /** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - - Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; - }; - /** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - - Cea708Stream.prototype.initService = function (serviceNum, i) { - var self = this; - this.services[serviceNum] = new Cea708Service(serviceNum); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; - }; - /** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.handleText = function (i, service, isExtended) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var extended = isExtended ? 0x1000 : 0x0000; - var char = get708CharFromCode(extended | b); - var win = service.currentWindow; - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; - }; - /** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; - }; - /** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; - }; - /** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; - }; - /** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; - }; - /** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } - }; - /** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; - }; - /** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; - }; - /** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; - }; - /** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; - }; - /** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; - }; - /** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; - }; - /** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; - }; - /** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; - }; - /** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - - Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); - }; // This hash maps non-ASCII, special, and extended character codes to their - // proper Unicode equivalent. The first keys that are only a single byte - // are the non-standard ASCII characters, which simply map the CEA608 byte - // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 - // character codes, but have their MSB bitmasked with 0x03 so that a lookup - // can be performed regardless of the field and data channel on which the - // character code was received. - - - var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - - }; - - var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); - }; // the index of the last row in a CEA-608 display buffer - - - var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of - // getting it through bit logic. - - var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character - // cells. The "bottom" row is the last element in the outer array. - - var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push(''); - } - - return result; - }; - - var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; - }; - - Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the - // display buffer - - Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - // eslint-disable-next-line no-console - console.error('Skipping malformed caption.'); - return ''; - } - }) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content, - stream: this.name_ - }); - } - }; - /** - * Zero out the data, used for startup and on seek - */ - - - Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; - }; - /** - * Sets up control code and related constants for this instance - */ - - - Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; - }; - /** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - - Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - - Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - - Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; - }; - /** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - - Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; - }; - /** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - - Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; - }; - /** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - - Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; - }; - /** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - - Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; - }; - /** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - - Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; - }; // Adds the opening HTML tag for the passed character to the caption text, - // and keeps track of it for later closing - - - Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); - }; // Adds HTML closing tags for current formatting to caption text and - // clears remembered formatting - - - Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); - }; // Mode Implementations - - - Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = ''; - }; - - Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; // exports - - - var captionStream = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var streamTypes = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 - }; - - var MAX_TS = 8589934592; - var RO_THRESH = 4294967296; - var TYPE_SHARED = 'shared'; - - var handleRollover = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; - }; - - var TimestampRolloverStream = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; - }; - - TimestampRolloverStream.prototype = new stream(); - var timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream, - handleRollover: handleRollover - }; - - var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }, - tagParsers = { - TXXX: function TXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); // do not include the null terminator in the tag value - - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - - tag.data = tag.value; - }, - WXXX: function WXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function PRIV(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591(tag.data, 0, i); - break; - } - } - - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } - }, - _MetadataStream; - - _MetadataStream = function MetadataStream(options) { - var settings = { - debug: !!(options && options.debug), - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseSyncSafeInteger(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; - }; - - _MetadataStream.prototype = new stream(); - var metadataStream = _MetadataStream; - - var TimestampRolloverStream$1 = timestampRolloverStream.TimestampRolloverStream; // object types - - var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - - var MP2T_PACKET_LENGTH = 188, - // bytes - SYNC_BYTE = 0x47; - /** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - - _TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; - }; - - _TransportPacketStream.prototype = new stream(); - /** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - - _TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === streamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = streamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = streamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; - }; - - _TransportParseStream.prototype = new stream(); - _TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f - }; - /** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - - _ElementaryStream = function ElementaryStream() { - var self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case streamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case streamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case streamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - this.flushStreams_(); - this.trigger('done'); - }; - }; - - _ElementaryStream.prototype = new stream(); - var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream$1, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, - MetadataStream: metadataStream - }; - - for (var type in streamTypes) { - if (streamTypes.hasOwnProperty(type)) { - m2ts[type] = streamTypes[type]; - } - } - - var m2ts_1 = m2ts; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var ONE_SECOND_IN_TS = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - - var ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS; - - var _AdtsStream; - - var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - /* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - - _AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - while (i + 5 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$1 / ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; - frameEnd = i + frameLength; // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - - if (buffer.byteLength < frameEnd) { - return; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - frameNum++; // If the buffer is empty, clear it and return - - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } // Remove the finished frame from the buffer and start the process again - - - buffer = buffer.subarray(frameEnd); - } - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; - }; - - _AdtsStream.prototype = new stream(); - var adts = _AdtsStream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ExpGolomb; - /** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - - ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); - }; - - var expGolomb = ExpGolomb; - - var _H264Stream, _NalByteStream; - - var PROFILES_WITH_OPTIONAL_SPS_DATA; - /** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - - _NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - }; - - _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS - // see Recommendation ITU-T H.264 (4/2013), - // 7.3.2.1.1 Sequence parameter set data syntax - - PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true - }; - /** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - - _H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - expGolombDecoder = new expGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - sarRatio: sarRatio - }; - }; - }; - - _H264Stream.prototype = new stream(); - var h264 = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream - }; - - /** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ - - - var CoalesceStream = function CoalesceStream(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - CoalesceStream.prototype.init.call(this); // Take output from multiple - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; - }; - - CoalesceStream.prototype = new stream(); - - CoalesceStream.prototype.flush = function (flushSource) { - var id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - captionStreams: {}, - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; // Translate caption PTS times into second offsets into the - // video timeline for the segment, and add track info - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; // Emit the final segment - - this.trigger('data', event); - this.trigger('done'); - }; - - var coalesceStream = CoalesceStream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var TagList = function TagList() { - var self = this; - this.list = []; - - this.push = function (tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function get() { - return self.list.length; - } - }); - }; - - var tagList = TagList; - - var H264Stream = h264.H264Stream; - - var _Transmuxer, _VideoSegmentStream, _AudioSegmentStream, collectTimelineInfo, metaDataTag, extraDataTag; - /** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - - collectTimelineInfo = function collectTimelineInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = Math.min(track.timelineStartInfo.dts, data.dts); - } - } - }; - - metaDataTag = function metaDataTag(track, pts) { - var tag = new flvTag(flvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - return tag; - }; - - extraDataTag = function extraDataTag(track, pts) { - var i, - tag = new flvTag(flvTag.VIDEO_TAG, true); - tag.dts = pts; - tag.pts = pts; - tag.writeByte(0x01); // version - - tag.writeByte(track.profileIdc); // profile - - tag.writeByte(track.profileCompatibility); // compatibility - - tag.writeByte(track.levelIdc); // level - - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - - tag.writeShort(track.sps[0].length); // data of SPS - - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; - }; - /** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ - - - _AudioSegmentStream = function AudioSegmentStream(track) { - var adtsFrames = [], - videoKeyFrames = [], - oldExtraData; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - collectTimelineInfo(track, data); - - if (track) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = track.audioobjecttype << 11 | track.samplingfrequencyindex << 7 | track.channelcount << 3; - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer audio data until end() is called - - adtsFrames.push(data); - }; - - this.flush = function () { - var currentFrame, - adtsFrame, - lastMetaPts, - tags = new tagList(); // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); // write out a metadata frame at every video key frame - - if (videoKeyFrames.length && currentFrame.pts >= videoKeyFrames[0]) { - lastMetaPts = videoKeyFrames.shift(); - this.writeMetaDataTags(tags, lastMetaPts); - } // also write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration. - - - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - this.writeMetaDataTags(tags, currentFrame.pts); - oldExtraData = track.extraData; - lastMetaPts = currentFrame.pts; - } - - adtsFrame = new flvTag(flvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - adtsFrame.writeBytes(currentFrame.data); - tags.push(adtsFrame.finalize()); - } - - videoKeyFrames.length = 0; - oldExtraData = null; - this.trigger('data', { - track: track, - tags: tags.list - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.writeMetaDataTags = function (tags, pts) { - var adtsFrame; - adtsFrame = new flvTag(flvTag.METADATA_TAG); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; // AAC is always 10 - - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); // Is AAC always 16 bit? - - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - tags.push(adtsFrame.finalize()); - adtsFrame = new flvTag(flvTag.AUDIO_TAG, true); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - tags.push(adtsFrame.finalize()); - }; - - this.onVideoKeyFrame = function (pts) { - videoKeyFrames.push(pts); - }; - }; - - _AudioSegmentStream.prototype = new stream(); - /** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ - - _VideoSegmentStream = function VideoSegmentStream(track) { - var nalUnits = [], - config, - h264Frame; - - _VideoSegmentStream.prototype.init.call(this); - - this.finishFrame = function (tags, frame) { - if (!frame) { - return; - } // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - - - if (config && track && track.newMetadata && (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - metaTag.metaDataTag = extraTag.metaDataTag = true; - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - this.trigger('keyframe', frame.dts); - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function (data) { - collectTimelineInfo(track, data); - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer video until flush() is called - - nalUnits.push(data); - }; - - this.flush = function () { - var currentNal, - tags = new tagList(); // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); // record the track config - - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - h264Frame = new flvTag(flvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - - h264Frame.endNalUnit(); - } - - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', { - track: track, - tags: tags.list - }); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - }; - - _VideoSegmentStream.prototype = new stream(); - /** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ - - _Transmuxer = function Transmuxer(options) { - var self = this, - packetStream, - parseStream, - elementaryStream, - videoTimestampRolloverStream, - audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, - h264Stream, - videoSegmentStream, - audioSegmentStream, - captionStream, - coalesceStream$1; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; // expose the metadata stream - - this.metadataStream = new m2ts_1.MetadataStream(); - options.metadataStream = this.metadataStream; // set up the parsing pipeline - - packetStream = new m2ts_1.TransportPacketStream(); - parseStream = new m2ts_1.TransportParseStream(); - elementaryStream = new m2ts_1.ElementaryStream(); - videoTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - adtsStream = new adts(); - h264Stream = new H264Stream(); - coalesceStream$1 = new coalesceStream(options); // disassemble MPEG2-TS packets into elementary streams - - packetStream.pipe(parseStream).pipe(elementaryStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - elementaryStream.pipe(videoTimestampRolloverStream).pipe(h264Stream); - elementaryStream.pipe(audioTimestampRolloverStream).pipe(adtsStream); - elementaryStream.pipe(timedMetadataTimestampRolloverStream).pipe(this.metadataStream).pipe(coalesceStream$1); // if CEA-708 parsing is available, hook up a caption stream - - captionStream = new m2ts_1.CaptionStream(options); - h264Stream.pipe(captionStream).pipe(coalesceStream$1); // hook up the segment streams once track metadata is delivered - - elementaryStream.on('data', function (data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !videoSegmentStream) { - coalesceStream$1.numberOfTracks++; - videoSegmentStream = new _VideoSegmentStream(videoTrack); // Set up the final part of the video pipeline - - h264Stream.pipe(videoSegmentStream).pipe(coalesceStream$1); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream$1.numberOfTracks++; - audioSegmentStream = new _AudioSegmentStream(audioTrack); // Set up the final part of the audio pipeline - - adtsStream.pipe(audioSegmentStream).pipe(coalesceStream$1); - - if (videoSegmentStream) { - videoSegmentStream.on('keyframe', audioSegmentStream.onVideoKeyFrame); - } - } - } - }); // feed incoming data to the front of the parsing pipeline - - this.push = function (data) { - packetStream.push(data); - }; // flush any buffered data - - - this.flush = function () { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - captionStream.reset(); - }; // Re-emit any data coming from the coalesce stream to the outside world - - - coalesceStream$1.on('data', function (event) { - self.trigger('data', event); - }); // Let the consumer know we have finished flushing the entire pipeline - - coalesceStream$1.on('done', function () { - self.trigger('done'); - }); - }; - - _Transmuxer.prototype = new stream(); // forward compatibility - - var transmuxer = _Transmuxer; - - // http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. - // Technically, this function returns the header and a metadata FLV tag - // if duration is greater than zero - // duration in seconds - // @return {object} the bytes of the FLV header as a Uint8Array - - - var getFlvHeader = function getFlvHeader(duration, audio, video) { - // :ByteArray { - var headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; // default arguments - - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; // signature - - head.setUint8(0, 0x46); // 'F' - - head.setUint8(1, 0x4c); // 'L' - - head.setUint8(2, 0x56); // 'V' - // version - - head.setUint8(3, 0x01); // flags - - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); // data offset, should be 9 for FLV v1 - - head.setUint32(5, headBytes.byteLength); // init the first FLV tag - - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } // write out the duration metadata tag - - - metadata = new flvTag(flvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - return result; - }; - - var flvHeader = getFlvHeader; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var flv = { - tag: flvTag, - Transmuxer: transmuxer, - getFlvHeader: flvHeader - }; - - return flv; - -}))); diff --git a/node_modules/mux.js/dist/mux-flv.min.js b/node_modules/mux.js/dist/mux-flv.min.js deleted file mode 100644 index b95aeda..0000000 --- a/node_modules/mux.js/dist/mux-flv.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name mux.js @version 5.11.1 @license Apache-2.0 */ -!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=i()}(this,(function(){"use strict";var t;(t=function(i,e){var s,n=0,a=16384,r=function(t,i){var e,s=t.position+i;s0)throw new Error("Attempted to create new NAL wihout closing the old one");n=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(t){var i,e;this.length===n+4?this.length-=4:n>0&&(i=n+4,e=this.length-i,this.position=n,this.view.setUint32(this.position,e),this.position=this.length,t&&t.push(this.bytes.subarray(i,i+e))),n=0},this.writeMetaDataDouble=function(t,i){var e;if(r(this,2+t.length+9),this.view.setUint16(this.position,t.length),this.position+=2,"width"===t)this.bytes.set(o,this.position),this.position+=5;else if("height"===t)this.bytes.set(h,this.position),this.position+=6;else if("videocodecid"===t)this.bytes.set(p,this.position),this.position+=12;else for(e=0;e>>16,this.bytes[14]=(65280&i)>>>8,this.bytes[15]=(255&i)>>>0;break;case t.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=e?0:1;break;case t.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,n),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return s=this.length-11,this.bytes[1]=(16711680&s)>>>16,this.bytes[2]=(65280&s)>>>8,this.bytes[3]=(255&s)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,r(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=t.frameTime(this.bytes),this}}).AUDIO_TAG=8,t.VIDEO_TAG=9,t.METADATA_TAG=18,t.isAudioFrame=function(i){return t.AUDIO_TAG===i[0]},t.isVideoFrame=function(i){return t.VIDEO_TAG===i[0]},t.isMetaData=function(i){return t.METADATA_TAG===i[0]},t.isKeyFrame=function(i){return t.isVideoFrame(i)?23===i[11]:!!t.isAudioFrame(i)||!!t.isMetaData(i)},t.frameTime=function(t){var i=t[4]<<16;return i|=t[5]<<8,i|=t[6]<<0,i|=t[7]<<24};var i=t,e=function(){this.init=function(){var t={};this.on=function(i,e){t[i]||(t[i]=[]),t[i]=t[i].concat(e)},this.off=function(i,e){var s;return!!t[i]&&(s=t[i].indexOf(e),t[i]=t[i].slice(),t[i].splice(s,1),s>-1)},this.trigger=function(i){var e,s,n,a;if(e=t[i])if(2===arguments.length)for(n=e.length,s=0;s=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},l.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},l.prototype.addText=function(t){this.rows[this.rowIdx]+=t},l.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var c=function(t){this.serviceNum=t,this.text="",this.currentWindow=new l(-1),this.windows=[]};c.prototype.init=function(t,i){this.startPts=t;for(var e=0;e<8;e++)this.windows[e]=new l(e),"function"==typeof i&&(this.windows[e].beforeRowOverflow=i)},c.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]};var u=function t(){t.prototype.init.call(this);var i=this;this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(i.new708Packet(),i.add708Bytes(t)):(null===i.current708Packet&&i.new708Packet(),i.add708Bytes(t))}};u.prototype=new s,u.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},u.prototype.add708Bytes=function(t){var i=t.ccData,e=i>>>8,s=255&i;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(e),this.current708Packet.data.push(s)},u.prototype.push708Packet=function(){var t=this.current708Packet,i=t.data,e=null,s=null,n=0,a=i[n++];for(t.seq=a>>6,t.sizeCode=63&a;n>5)&&s>0&&(e=a=i[n++]),this.pushServiceBlock(e,n,s),s>0&&(n+=s-1)},u.prototype.pushServiceBlock=function(t,i,e){var s,n=i,a=this.current708Packet.data,r=this.services[t];for(r||(r=this.initService(t,n));n>5,a.rowLock=(16&s)>>4,a.columnLock=(8&s)>>3,a.priority=7&s,s=e[++t],a.relativePositioning=(128&s)>>7,a.anchorVertical=127&s,s=e[++t],a.anchorHorizontal=s,s=e[++t],a.anchorPoint=(240&s)>>4,a.rowCount=15&s,s=e[++t],a.columnCount=63&s,s=e[++t],a.windowStyle=(56&s)>>3,a.penStyle=7&s,a.virtualRowCount=a.rowCount+1,t},u.prototype.setWindowAttributes=function(t,i){var e=this.current708Packet.data,s=e[t],n=i.currentWindow.winAttr;return s=e[++t],n.fillOpacity=(192&s)>>6,n.fillRed=(48&s)>>4,n.fillGreen=(12&s)>>2,n.fillBlue=3&s,s=e[++t],n.borderType=(192&s)>>6,n.borderRed=(48&s)>>4,n.borderGreen=(12&s)>>2,n.borderBlue=3&s,s=e[++t],n.borderType+=(128&s)>>5,n.wordWrap=(64&s)>>6,n.printDirection=(48&s)>>4,n.scrollDirection=(12&s)>>2,n.justify=3&s,s=e[++t],n.effectSpeed=(240&s)>>4,n.effectDirection=(12&s)>>2,n.displayEffect=3&s,t},u.prototype.flushDisplayed=function(t,i){for(var e=[],s=0;s<8;s++)i.windows[s].visible&&!i.windows[s].isEmpty()&&e.push(i.windows[s].getText());i.endPts=t,i.text=e.join("\n\n"),this.pushCaption(i),i.startPts=t},u.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},u.prototype.displayWindows=function(t,i){var e=this.current708Packet.data[++t],s=this.getPts(t);this.flushDisplayed(s,i);for(var n=0;n<8;n++)e&1<>4,n.offset=(12&s)>>2,n.penSize=3&s,s=e[++t],n.italics=(128&s)>>7,n.underline=(64&s)>>6,n.edgeType=(56&s)>>3,n.fontStyle=7&s,t},u.prototype.setPenColor=function(t,i){var e=this.current708Packet.data,s=e[t],n=i.currentWindow.penColor;return s=e[++t],n.fgOpacity=(192&s)>>6,n.fgRed=(48&s)>>4,n.fgGreen=(12&s)>>2,n.fgBlue=3&s,s=e[++t],n.bgOpacity=(192&s)>>6,n.bgRed=(48&s)>>4,n.bgGreen=(12&s)>>2,n.bgBlue=3&s,s=e[++t],n.edgeRed=(48&s)>>4,n.edgeGreen=(12&s)>>2,n.edgeBlue=3&s,t},u.prototype.setPenLocation=function(t,i){var e=this.current708Packet.data,s=e[t],n=i.currentWindow.penLoc;return i.currentWindow.pendingNewLine=!0,s=e[++t],n.row=15&s,s=e[++t],n.column=63&s,t},u.prototype.reset=function(t,i){var e=this.getPts(t);return this.flushDisplayed(e,i),this.initService(i.serviceNum,t)};var f={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},g=function(t){return null===t?"":(t=f[t]||t,String.fromCharCode(t))},y=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],m=function(){for(var t=[],i=15;i--;)t.push("");return t},_=function t(i,e){t.prototype.init.call(this),this.field_=i||0,this.dataChannel_=e||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var i,e,s,n,a;if((i=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&i)?this.lastControlCode_=i:i!==this.PADDING_&&(this.lastControlCode_=null),s=i>>>8,n=255&i,i!==this.PADDING_)if(i===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(i===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),e=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=e,this.startPts_=t.pts;else if(i===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(i===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(i===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(i===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(i===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(i===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=m();else if(i===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=m();else if(i===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=m()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(s,n))a=g((s=(3&s)<<8)|n),this[this.mode_](t.pts,a),this.column_++;else if(this.isExtCharacter(s,n))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=g((s=(3&s)<<8)|n),this[this.mode_](t.pts,a),this.column_++;else if(this.isMidRowCode(s,n))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&n)&&this.addFormatting(t.pts,["i"]),1==(1&n)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(s,n))this.column_+=3&n;else if(this.isPAC(s,n)){var r=y.indexOf(7968&i);"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(t.pts,r)),r!==this.row_&&(this.clearFormatting(t.pts),this.row_=r),1&n&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&i)&&(this.column_=4*((14&i)>>1)),this.isColorPAC(n)&&14==(14&n)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(s)&&(0===n&&(n=null),a=g(s),a+=g(n),this[this.mode_](t.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};_.prototype=new s,_.prototype.flushDisplayed=function(t){var i=this.displayed_.map((function(t){try{return t.trim()}catch(t){return console.error("Skipping malformed caption."),""}})).join("\n").replace(/^\n+|\n+$/g,"");i.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:i,stream:this.name_})},_.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=m(),this.nonDisplayed_=m(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},_.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},_.prototype.isSpecialCharacter=function(t,i){return t===this.EXT_&&i>=48&&i<=63},_.prototype.isExtCharacter=function(t,i){return(t===this.EXT_+1||t===this.EXT_+2)&&i>=32&&i<=63},_.prototype.isMidRowCode=function(t,i){return t===this.EXT_&&i>=32&&i<=47},_.prototype.isOffsetControlCode=function(t,i){return t===this.OFFSET_&&i>=33&&i<=35},_.prototype.isPAC=function(t,i){return t>=this.BASE_&&t=64&&i<=127},_.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},_.prototype.isNormalChar=function(t){return t>=32&&t<=127},_.prototype.setRollUp=function(t,i){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=m(),this.displayed_=m()),void 0!==i&&i!==this.row_)for(var e=0;e"}),"");this[this.mode_](t,e)},_.prototype.clearFormatting=function(t){if(this.formatting_.length){var i=this.formatting_.reverse().reduce((function(t,i){return t+""}),"");this.formatting_=[],this[this.mode_](t,i)}},_.prototype.popOn=function(t,i){var e=this.nonDisplayed_[this.row_];e+=i,this.nonDisplayed_[this.row_]=e},_.prototype.rollUp=function(t,i){var e=this.displayed_[this.row_];e+=i,this.displayed_[this.row_]=e},_.prototype.shiftRowsUp_=function(){var t;for(t=0;ti&&(e=-1);Math.abs(i-t)>4294967296;)t+=8589934592*e;return t},k=function t(i){var e,s;t.prototype.init.call(this),this.type_=i||v,this.push=function(t){this.type_!==v&&t.type!==this.type_||(void 0===s&&(s=t.dts),t.dts=T(t.dts,s),t.pts=T(t.pts,s),e=t.dts,this.trigger("data",t))},this.flush=function(){s=e,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){s=void 0,e=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};k.prototype=new s;var S,A=k,C=function(t,i,e){var s,n="";for(s=i;s>>2;l*=4,l+=3&d[7],h.timeStamp=l,void 0===i.pts&&void 0===i.dts&&(i.pts=h.timeStamp,i.dts=h.timeStamp),this.trigger("timestamp",h)}i.frames.push(h),r+=10,r+=o}while(r>>4>1&&(s+=i[s]+1),0===e.pid)e.type="pat",t(i.subarray(s),e),this.trigger("data",e);else if(e.pid===this.pmtPid)for(e.type="pmt",t(i.subarray(s),e),this.trigger("data",e);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([i,s,e]):this.processPes_(i,s,e)},this.processPes_=function(t,i,e){e.pid===this.programMapTable.video?e.streamType=b.H264_STREAM_TYPE:e.pid===this.programMapTable.audio?e.streamType=b.ADTS_STREAM_TYPE:e.streamType=this.programMapTable["timed-metadata"][e.pid],e.type="pes",e.data=t.subarray(i),this.trigger("data",e)}}).prototype=new s,R.STREAM_TYPES={h264:27,adts:15},(M=function(){var t,i=this,e={data:[],size:0},s={data:[],size:0},n={data:[],size:0},a=function(t,e,s){var n,a,r=new Uint8Array(t.size),o={type:e},h=0,p=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,h=0;h>>3,l.pts*=4,l.pts+=(6&d[13])>>>1,l.dts=l.pts,64&c&&(l.dts=(14&d[14])<<27|(255&d[15])<<20|(254&d[16])<<12|(255&d[17])<<5|(254&d[18])>>>3,l.dts*=4,l.dts+=(6&d[18])>>>1)),l.data=d.subarray(9+d[8])),n="video"===e||o.packetLength<=t.size,(s||n)&&(t.size=0,t.data.length=0),n&&i.trigger("data",o)}};M.prototype.init.call(this),this.push=function(r){({pat:function(){},pes:function(){var t,i;switch(r.streamType){case b.H264_STREAM_TYPE:t=e,i="video";break;case b.ADTS_STREAM_TYPE:t=s,i="audio";break;case b.METADATA_STREAM_TYPE:t=n,i="timed-metadata";break;default:return}r.payloadUnitStartIndicator&&a(t,i,!0),t.data.push(r),t.size+=r.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=r.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i.trigger("data",e)}})[r.type]()},this.reset=function(){e.size=0,e.data.length=0,s.size=0,s.data.length=0,this.trigger("reset")},this.flushStreams_=function(){a(e,"video"),a(s,"audio"),a(n,"timed-metadata")},this.flush=function(){this.flushStreams_(),this.trigger("done")}}).prototype=new s;var I={PAT_PID:0,MP2T_PACKET_LENGTH:L,TransportPacketStream:U,TransportParseStream:R,ElementaryStream:M,TimestampRolloverStream:x,CaptionStream:w.CaptionStream,Cea608Stream:w.Cea608Stream,Cea708Stream:w.Cea708Stream,MetadataStream:O};for(var B in b)b.hasOwnProperty(B)&&(I[B]=b[B]);var G,N,F,W,z=I,V=9e4;G=function(t){return t*V},N=function(t,i){return t*i},F=function(t){return t/V},W=function(t,i){return t/i};var Y,X=V,j=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(Y=function(t){var i,e=0;Y.prototype.init.call(this),this.push=function(s){var n,a,r,o,h,p,d=0;if(t||(e=0),"audio"===s.type)for(i?(o=i,(i=new Uint8Array(o.byteLength+s.data.byteLength)).set(o),i.set(s.data,o.byteLength)):i=s.data;d+5>5,p=(h=1024*(1+(3&i[d+6])))*X/j[(60&i[d+2])>>>2],r=d+n,i.byteLength>>6&3),channelcount:(1&i[d+2])<<2|(192&i[d+3])>>>6,samplerate:j[(60&i[d+2])>>>2],samplingfrequencyindex:(60&i[d+2])>>>2,samplesize:16,data:i.subarray(d+7+a,r)}),e++,i.byteLength===r)return void(i=void 0);i=i.subarray(r)}else d++},this.flush=function(){e=0,this.trigger("done")},this.reset=function(){i=void 0,this.trigger("reset")},this.endTimeline=function(){i=void 0,this.trigger("endedtimeline")}}).prototype=new s;var q,H,K,Z=Y,$=function(t){var i=t.byteLength,e=0,s=0;this.length=function(){return 8*i},this.bitsAvailable=function(){return 8*i+s},this.loadWord=function(){var n=t.byteLength-i,a=new Uint8Array(4),r=Math.min(4,i);if(0===r)throw new Error("no bytes available");a.set(t.subarray(n,n+r)),e=new DataView(a.buffer).getUint32(0),s=8*r,i-=r},this.skipBits=function(t){var n;s>t?(e<<=t,s-=t):(t-=s,t-=8*(n=Math.floor(t/8)),i-=n,this.loadWord(),e<<=t,s-=t)},this.readBits=function(t){var n=Math.min(s,t),a=e>>>32-n;return(s-=n)>0?e<<=n:i>0&&this.loadWord(),(n=t-n)>0?a<>>t))return e<<=t,s-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(H=function(){var t,i,e=0;H.prototype.init.call(this),this.push=function(s){var n;i?((n=new Uint8Array(i.byteLength+s.data.byteLength)).set(i),n.set(s.data,i.byteLength),i=n):i=s.data;for(var a=i.byteLength;e3&&this.trigger("data",i.subarray(e+3)),i=null,e=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new s,K={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(q=function(){var t,i,e,s,n,a,r,o=new H;q.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(i=t.trackId,e=t.pts,s=t.dts,o.push(t))},o.on("data",(function(r){var o={trackId:i,pts:e,dts:s,data:r};switch(31&r[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=n(r.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=n(r.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},r=function(t,i){var e,s=8,n=8;for(e=0;e=n[0]&&(o=n.shift(),this.writeMetaDataTags(h,o)),(t.extraData!==e||a.pts-o>=1e3)&&(this.writeMetaDataTags(h,a.pts),e=t.extraData,o=a.pts),(r=new i(i.AUDIO_TAG)).pts=a.pts,r.dts=a.dts,r.writeBytes(a.data),h.push(r.finalize());n.length=0,e=null,this.trigger("data",{track:t,tags:h.list}),this.trigger("done","AudioSegmentStream")}else this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(e,s){var n;(n=new i(i.METADATA_TAG)).pts=s,n.dts=s,n.writeMetaDataDouble("audiocodecid",10),n.writeMetaDataBoolean("stereo",2===t.channelcount),n.writeMetaDataDouble("audiosamplerate",t.samplerate),n.writeMetaDataDouble("audiosamplesize",16),e.push(n.finalize()),(n=new i(i.AUDIO_TAG,!0)).pts=s,n.dts=s,n.view.setUint16(n.position,t.extraData),n.position+=2,n.length=Math.max(n.length,n.position),e.push(n.finalize())},this.onVideoKeyFrame=function(t){n.push(t)}}).prototype=new s,(it=function(t){var e,s,n=[];it.prototype.init.call(this),this.finishFrame=function(i,n){if(n){if(e&&t&&t.newMetadata&&(n.keyFrame||0===i.length)){var a=nt(e,n.dts).finalize(),r=at(t,n.dts).finalize();a.metaDataTag=r.metaDataTag=!0,i.push(a),i.push(r),t.newMetadata=!1,this.trigger("keyframe",n.dts)}n.endNalUnit(),i.push(n.finalize()),s=null}},this.push=function(i){st(t,i),i.pts=Math.round(i.pts/90),i.dts=Math.round(i.dts/90),n.push(i)},this.flush=function(){for(var a,r=new ot;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0!==n.length){for(;n.length;)"seq_parameter_set_rbsp"===(a=n.shift()).nalUnitType?(t.newMetadata=!0,e=a.config,t.width=e.width,t.height=e.height,t.sps=[a.data],t.profileIdc=e.profileIdc,t.levelIdc=e.levelIdc,t.profileCompatibility=e.profileCompatibility,s.endNalUnit()):"pic_parameter_set_rbsp"===a.nalUnitType?(t.newMetadata=!0,t.pps=[a.data],s.endNalUnit()):"access_unit_delimiter_rbsp"===a.nalUnitType?(s&&this.finishFrame(r,s),(s=new i(i.VIDEO_TAG)).pts=a.pts,s.dts=a.dts):("slice_layer_without_partitioning_rbsp_idr"===a.nalUnitType&&(s.keyFrame=!0),s.endNalUnit()),s.startNalUnit(),s.writeBytes(a.data);s&&this.finishFrame(r,s),this.trigger("data",{track:t,tags:r.list}),this.trigger("done","VideoSegmentStream")}else this.trigger("done","VideoSegmentStream")}}).prototype=new s,(tt=function(t){var i,e,s,n,a,r,o,h,p,d,l,c,u=this;tt.prototype.init.call(this),t=t||{},this.metadataStream=new z.MetadataStream,t.metadataStream=this.metadataStream,i=new z.TransportPacketStream,e=new z.TransportParseStream,s=new z.ElementaryStream,n=new z.TimestampRolloverStream("video"),a=new z.TimestampRolloverStream("audio"),r=new z.TimestampRolloverStream("timed-metadata"),o=new Z,h=new ht,c=new rt(t),i.pipe(e).pipe(s),s.pipe(n).pipe(h),s.pipe(a).pipe(o),s.pipe(r).pipe(this.metadataStream).pipe(c),l=new z.CaptionStream(t),h.pipe(l).pipe(c),s.on("data",(function(t){var i,e,s;if("metadata"===t.type){for(i=t.tracks.length;i--;)"video"===t.tracks[i].type?e=t.tracks[i]:"audio"===t.tracks[i].type&&(s=t.tracks[i]);e&&!p&&(c.numberOfTracks++,p=new it(e),h.pipe(p).pipe(c)),s&&!d&&(c.numberOfTracks++,d=new et(s),o.pipe(d).pipe(c),p&&p.on("keyframe",d.onVideoKeyFrame))}})),this.push=function(t){i.push(t)},this.flush=function(){i.flush()},this.resetCaptions=function(){l.reset()},c.on("data",(function(t){u.trigger("data",t)})),c.on("done",(function(){u.trigger("done")}))}).prototype=new s;var pt=function(t,e,s){var n,a,r,o=new Uint8Array(9),h=new DataView(o.buffer);return t=t||0,e=void 0===e||e,s=void 0===s||s,h.setUint8(0,70),h.setUint8(1,76),h.setUint8(2,86),h.setUint8(3,1),h.setUint8(4,(e?4:0)|(s?1:0)),h.setUint32(5,o.byteLength),t<=0?((a=new Uint8Array(o.byteLength+4)).set(o),a.set([0,0,0,0],o.byteLength),a):((n=new i(i.METADATA_TAG)).pts=n.dts=0,n.writeMetaDataDouble("duration",t),r=n.finalize().length,(a=new Uint8Array(o.byteLength+r)).set(o),a.set(h.byteLength,r),a)};return{tag:i,Transmuxer:tt,getFlvHeader:pt}})); diff --git a/node_modules/mux.js/dist/mux-mp4.js b/node_modules/mux.js/dist/mux-mp4.js deleted file mode 100644 index 437232d..0000000 --- a/node_modules/mux.js/dist/mux-mp4.js +++ /dev/null @@ -1,7407 +0,0 @@ -/*! @name mux.js @version 5.11.1 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.muxjs = factory()); -}(this, (function () { 'use strict'; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ - - var UINT32_MAX = Math.pow(2, 32) - 1; - var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - - (function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); - })(); - - box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; - }; - - dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); - }; - - esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); - }; - - ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); - }; - - hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); - }; - - mdat = function mdat(data) { - return box(types.mdat, data); - }; - - mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); - }; - - mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); - }; - - mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); - }; - - minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); - }; - - moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); - }; - /** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - - moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); - }; - - mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); - }; - - mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); - }; - - sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); - }; - - stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); - }; - - (function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; - })(); - - tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); - }; - /** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - - traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (UINT32_MAX + 1)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (UINT32_MAX + 1)); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); - }; - /** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - - trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); - }; - - trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); - }; - - (function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; - })(); - - var mp4Generator = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var toUnsigned = function toUnsigned(value) { - return value >>> 0; - }; - - var toHexString = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); - }; - - var bin = { - toUnsigned: toUnsigned, - toHexString: toHexString - }; - - var parseType = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; - }; - - var parseType_1 = parseType; - - var toUnsigned$1 = bin.toUnsigned; - - var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned$1(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType_1(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; - }; - - var findBox_1 = findBox; - - var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; - }; - - var parseTfhd = tfhd; - - var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; - }; - - var parseSampleFlags_1 = parseSampleFlags; - - var trun$1 = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags_1(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; - }; - - var parseTrun = trun$1; - - var toUnsigned$2 = bin.toUnsigned; - - var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - baseMediaDecodeTime: toUnsigned$2(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime *= Math.pow(2, 32); - result.baseMediaDecodeTime += toUnsigned$2(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11]); - } - - return result; - }; - - var parseTfdt = tfdt; - - var toUnsigned$3 = bin.toUnsigned; - var toHexString$1 = bin.toHexString; - var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader; - /** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - - timescale = function timescale(init) { - var result = {}, - traks = findBox_1(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox_1(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned$3(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned$3(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); - }; - /** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - - startTime = function startTime(timescale, fragment) { - var trafs, baseTimes, result; // we need info from two childrend of each track fragment box - - trafs = findBox_1(fragment, ['moof', 'traf']); // determine the start times for each track - - baseTimes = [].concat.apply([], trafs.map(function (traf) { - return findBox_1(traf, ['tfhd']).map(function (tfhd) { - var id, scale, baseTime; // get the track id from the tfhd - - id = toUnsigned$3(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - baseTime = findBox_1(traf, ['tfdt']).map(function (tfdt) { - var version, result; - version = tfdt[0]; - result = toUnsigned$3(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]); - - if (version === 1) { - result *= Math.pow(2, 32); - result += toUnsigned$3(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11]); - } - - return result; - })[0]; - baseTime = typeof baseTime === 'number' && !isNaN(baseTime) ? baseTime : Infinity; // convert base time to seconds - - return baseTime / scale; - }); - })); // return the minimum - - result = Math.min.apply(null, baseTimes); - return isFinite(result) ? result : 0; - }; - /** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - - compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox_1(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox_1(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox_1(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox_1(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - return (baseMediaDecodeTime + compositionTimeOffset) / timescale; - }; - /** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - - getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox_1(trak, ['mdia', 'hdlr']); - var tkhds = findBox_1(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType_1(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; - }; - - getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned$3(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - }; - /** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - - getTracks = function getTracks(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox_1(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox_1(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType_1(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox_1(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType_1(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox_1(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[a-z]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString$1(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString$1(codecConfig[10]); // level idc - - track.codec += toHexString$1(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString$1(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString$1(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; - }; - - var probe = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox_1, - parseType: parseType_1, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ - - var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; - }; - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - - Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; - }; // Default stream functions that are expected to be overridden to perform - // actual work. These are provided by the prototype as a sort of no-op - // implementation so that we don't have to check for their existence in the - // `pipe` function above. - - - Stream.prototype.push = function (data) { - this.trigger('data', data); - }; - - Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); - }; - - Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); - }; - - Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); - }; - - Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); - }; - - var stream = Stream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - // Convert an array of nal units into an array of frames with each frame being - // composed of the nal units that make up that frame - // Also keep track of cummulative data about the frame from the nal units such - // as the frame duration, starting pts, etc. - var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; - }; // Convert an array of frames into an array of Gop with each Gop being composed - // of the frames that make up that Gop - // Also keep track of cummulative data about the Gop from the frames such as the - // Gop duration, starting pts, etc. - - - var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; - }; - /* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - - var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; - }; - /** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - - var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; - }; - /* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - - var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; - }; // generate the track's sample table from an array of gops - - - var generateSampleTable = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; - }; // generate the track's raw mdat data from an array of gops - - - var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; - }; // generate the track's sample table from a frame - - - var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; - }; // generate the track's raw mdat data from a frame - - - var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; - }; - - var frameUtils = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var highPrefix = [33, 16, 5, 32, 164, 27]; - var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - - var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; - }; - - var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); - }; - - var silence; - - var silence_1 = function silence_1() { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]], - 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var ONE_SECOND_IN_TS = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - /** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; - }; // Possibly pad (prefix) the audio track with silence if appending this track - // would lead to the introduction of a gap in the audio buffer - - - var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = silence_1()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; - }; // If the audio segment extends before the earliest allowed dts - // value, remove AAC frames until starts at or after the earliest - // allowed DTS so that we don't end up with a negative baseMedia- - // DecodeTime for the audio track - - - var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); - }; // generate the track's raw mdat data from an array of frames - - - var generateSampleTable$1 = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; - }; // generate the track's sample table from an array of frames - - - var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; - }; - - var audioFrameUtils = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable$1, - concatenateFrameData: concatenateFrameData - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS; - /** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } - }; - /** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - - var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; - }; - /** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS$1; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; - }; - - var trackDecodeInfo = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - // payload type field to indicate how they are to be - // interpreted. CEAS-708 caption content is always transmitted with - // payload type 0x04. - - var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - /** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - - var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; - }; // see ANSI/SCTE 128-1 (2013), section 8.1 - - - var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); - }; // see CEA-708-D, section 4.4 - - - var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; - }; - - var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; // exports - - - var captionPacketParser = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 - }; - - // Link To Transport - // ----------------- - - - var CaptionStream = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream(); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - }; - - CaptionStream.prototype = new stream(); - - CaptionStream.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; - }; - - CaptionStream.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); - }; - - CaptionStream.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); - }; - - CaptionStream.prototype.flush = function () { - return this.flushStream('flush'); - }; // Only called if handling partial data - - - CaptionStream.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); - }; - - CaptionStream.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); - }; // From the CEA-608 spec: - - /* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. - */ - // With that in mind, we ignore any data between an XDS control code and a - // subsequent closed-captioning control code. - - - CaptionStream.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); - }; - - CaptionStream.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; - }; - - CaptionStream.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; - }; - - CaptionStream.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; - }; - - CaptionStream.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } - }; // ---------------------- - // Session to Application - // ---------------------- - // This hash maps special and extended character codes to their - // proper Unicode equivalent. The first one-byte key is just a - // non-standard character code. The two-byte keys that follow are - // the extended CEA708 character codes, along with the preceding - // 0x10 extended character byte to distinguish these codes from - // non-extended character codes. Every CEA708 character code that - // is not in this object maps directly to a standard unicode - // character code. - // The transparent space and non-breaking transparent space are - // technically not fully supported since there is no code to - // make them transparent, so they have normal non-transparent - // stand-ins. - // The special closed caption (CC) character isn't a standard - // unicode character, so a fairly similar unicode character was - // chosen in it's place. - - - var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - - }; - - var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); - }; - - var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; - }; - - var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); - }; - - Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; - }; - - Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); - }; - - Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; - }; - - Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } - }; - - Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; - }; - - Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; - }; - - Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } - }; - - var Cea708Service = function Cea708Service(serviceNum) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - }; - /** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - - Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } - }; - /** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - - Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; - }; - - var Cea708Stream = function Cea708Stream() { - Cea708Stream.prototype.init.call(this); - var self = this; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; - }; - - Cea708Stream.prototype = new stream(); - /** - * Push current 708 packet, create new 708 packet. - */ - - Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; - }; - /** - * Add pts and both bytes from packet into current 708 packet. - */ - - - Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); - }; - /** - * Parse completed 708 packet into service blocks and push each service block. - */ - - - Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } - }; - /** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - - Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else ; - } - }; - /** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, true); - } - - return i; - }; - /** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - - Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; - }; - /** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - - Cea708Stream.prototype.initService = function (serviceNum, i) { - var self = this; - this.services[serviceNum] = new Cea708Service(serviceNum); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; - }; - /** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.handleText = function (i, service, isExtended) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var extended = isExtended ? 0x1000 : 0x0000; - var char = get708CharFromCode(extended | b); - var win = service.currentWindow; - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; - }; - /** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; - }; - /** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; - }; - /** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; - }; - /** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; - }; - /** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } - }; - /** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; - }; - /** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; - }; - /** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; - }; - /** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; - }; - /** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; - }; - /** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; - }; - /** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; - }; - /** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; - }; - /** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - - Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); - }; // This hash maps non-ASCII, special, and extended character codes to their - // proper Unicode equivalent. The first keys that are only a single byte - // are the non-standard ASCII characters, which simply map the CEA608 byte - // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 - // character codes, but have their MSB bitmasked with 0x03 so that a lookup - // can be performed regardless of the field and data channel on which the - // character code was received. - - - var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - - }; - - var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); - }; // the index of the last row in a CEA-608 display buffer - - - var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of - // getting it through bit logic. - - var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character - // cells. The "bottom" row is the last element in the outer array. - - var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push(''); - } - - return result; - }; - - var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; - }; - - Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the - // display buffer - - Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - // eslint-disable-next-line no-console - console.error('Skipping malformed caption.'); - return ''; - } - }) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content, - stream: this.name_ - }); - } - }; - /** - * Zero out the data, used for startup and on seek - */ - - - Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; - }; - /** - * Sets up control code and related constants for this instance - */ - - - Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; - }; - /** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - - Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - - Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - - Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; - }; - /** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - - Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; - }; - /** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - - Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; - }; - /** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - - Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; - }; - /** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - - Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; - }; - /** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - - Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; - }; // Adds the opening HTML tag for the passed character to the caption text, - // and keeps track of it for later closing - - - Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); - }; // Adds HTML closing tags for current formatting to caption text and - // clears remembered formatting - - - Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); - }; // Mode Implementations - - - Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = ''; - }; - - Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; // exports - - - var captionStream = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var streamTypes = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 - }; - - var MAX_TS = 8589934592; - var RO_THRESH = 4294967296; - var TYPE_SHARED = 'shared'; - - var handleRollover = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; - }; - - var TimestampRolloverStream = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; - }; - - TimestampRolloverStream.prototype = new stream(); - var timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream, - handleRollover: handleRollover - }; - - var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }, - tagParsers = { - TXXX: function TXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); // do not include the null terminator in the tag value - - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - - tag.data = tag.value; - }, - WXXX: function WXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function PRIV(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591(tag.data, 0, i); - break; - } - } - - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } - }, - _MetadataStream; - - _MetadataStream = function MetadataStream(options) { - var settings = { - debug: !!(options && options.debug), - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseSyncSafeInteger(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; - }; - - _MetadataStream.prototype = new stream(); - var metadataStream = _MetadataStream; - - var TimestampRolloverStream$1 = timestampRolloverStream.TimestampRolloverStream; // object types - - var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - - var MP2T_PACKET_LENGTH = 188, - // bytes - SYNC_BYTE = 0x47; - /** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - - _TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; - }; - - _TransportPacketStream.prototype = new stream(); - /** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - - _TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === streamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = streamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = streamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; - }; - - _TransportParseStream.prototype = new stream(); - _TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f - }; - /** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - - _ElementaryStream = function ElementaryStream() { - var self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case streamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case streamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case streamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - this.flushStreams_(); - this.trigger('done'); - }; - }; - - _ElementaryStream.prototype = new stream(); - var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream$1, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, - MetadataStream: metadataStream - }; - - for (var type in streamTypes) { - if (streamTypes.hasOwnProperty(type)) { - m2ts[type] = streamTypes[type]; - } - } - - var m2ts_1 = m2ts; - - var ONE_SECOND_IN_TS$2 = clock.ONE_SECOND_IN_TS; - - var _AdtsStream; - - var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - /* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - - _AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - while (i + 5 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; - frameEnd = i + frameLength; // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - - if (buffer.byteLength < frameEnd) { - return; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - frameNum++; // If the buffer is empty, clear it and return - - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } // Remove the finished frame from the buffer and start the process again - - - buffer = buffer.subarray(frameEnd); - } - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; - }; - - _AdtsStream.prototype = new stream(); - var adts = _AdtsStream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ExpGolomb; - /** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - - ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); - }; - - var expGolomb = ExpGolomb; - - var _H264Stream, _NalByteStream; - - var PROFILES_WITH_OPTIONAL_SPS_DATA; - /** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - - _NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - }; - - _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS - // see Recommendation ITU-T H.264 (4/2013), - // 7.3.2.1.1 Sequence parameter set data syntax - - PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true - }; - /** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - - _H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - expGolombDecoder = new expGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - sarRatio: sarRatio - }; - }; - }; - - _H264Stream.prototype = new stream(); - var h264 = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ - - var ADTS_SAMPLING_FREQUENCIES$1 = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - - var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - - var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); - }; // TODO: use vhs-utils - - - var isLikelyAacData = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; - }; - - var parseSyncSafeInteger$1 = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }; // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - - - var percentEncode$1 = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }; // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - - - var parseIso88591$1 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode$1(bytes, start, end)); // jshint ignore:line - }; - - var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; - }; - - var parseType$1 = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; - }; - - var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES$1[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; - }; - - var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger$1(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger$1(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591$1(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; - }; - - var utils = { - isLikelyAacData: isLikelyAacData, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType$1, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp - }; - - var _AacStream; - /** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - - _AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = utils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = utils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; - }; - - _AacStream.prototype = new stream(); - var aac = _AacStream; - - // constants - var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; - var audioProperties = AUDIO_PROPERTIES; - - var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; - var videoProperties = VIDEO_PROPERTIES; - - var H264Stream = h264.H264Stream; - var isLikelyAacData$1 = utils.isLikelyAacData; - var ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS; // object types - - var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; - /** - * Compare two arrays (even typed) for same-ness - */ - - - var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; - }; - - var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; - }; - /** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - _AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - audioProperties.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4Generator.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS$3 * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; - }; - - _AudioSegmentStream.prototype = new stream(); - /** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - _VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - videoProperties.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4Generator.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4Generator.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; - }; - - _VideoSegmentStream.prototype = new stream(); - /** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - - _CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; - }; - - _CoalesceStream.prototype = new stream(); - - _CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - videoProperties.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - audioProperties.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4Generator.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - }; - - _CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; - }; - /** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - - _Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new aac(); - pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new adts(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts_1.TransportPacketStream(); - pipeline.parseStream = new m2ts_1.TransportParseStream(); - pipeline.elementaryStream = new m2ts_1.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream(); - pipeline.adtsStream = new adts(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts_1.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData$1(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; - }; - - _Transmuxer.prototype = new stream(); - var transmuxer = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: audioProperties, - VIDEO_PROPERTIES: videoProperties, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo - }; - - var discardEmulationPreventionBytes$1 = captionPacketParser.discardEmulationPreventionBytes; - var CaptionStream$1 = captionStream.CaptionStream; - /** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; - }; - /** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - - var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes$1(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - // eslint-disable-next-line no-console - console.log("We've encountered a nal unit without data. See mux.js#233."); - break; - } - - result.push(seiNal); - break; - } - } - - return result; - }; - /** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - - var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; - }; - /** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - - var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox_1(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox_1(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox_1(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox_1(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox_1(traf, ['trun']); - var samples; - var seiNals; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - seiNals = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = []; - } - - captionNals[trackId] = captionNals[trackId].concat(seiNals); - } - }); - return captionNals; - }; - /** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption - **/ - - - var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var seiNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - seiNals = parseCaptionNals(segment, trackId); - return { - seiNals: seiNals[trackId], - timescale: timescale - }; - }; - /** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - - var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream$1(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData === null || !parsedData.seiNals) { - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {} - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); - }; - - var captionParser = CaptionParser; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var mp4 = { - generator: mp4Generator, - probe: probe, - Transmuxer: transmuxer.Transmuxer, - AudioSegmentStream: transmuxer.AudioSegmentStream, - VideoSegmentStream: transmuxer.VideoSegmentStream, - CaptionParser: captionParser - }; - - return mp4; - -}))); diff --git a/node_modules/mux.js/dist/mux-mp4.min.js b/node_modules/mux.js/dist/mux-mp4.min.js deleted file mode 100644 index b07d463..0000000 --- a/node_modules/mux.js/dist/mux-mp4.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name mux.js @version 5.11.1 @license Apache-2.0 */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e()}(this,(function(){"use strict";var t,e,i,n,a,r,s,o,h,d,p,u,l,c,f,m,g,y,S,v,_,b,w,T,k,C,P,A,D,U,L,E,O,x,R,M,I,B,N,G,W=Math.pow(2,32)-1;!function(){var t;if(b={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(t in b)b.hasOwnProperty(t)&&(b[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);w=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),k=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),T=new Uint8Array([0,0,0,1]),C=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),P=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),A={video:C,audio:P},L=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),U=new Uint8Array([0,0,0,0,0,0,0,0]),E=new Uint8Array([0,0,0,0,0,0,0,0]),O=E,x=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R=E,D=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),t=function(t){var e,i,n=[],a=0;for(e=1;e>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},f=function(e){return t(b.hdlr,A[e])},c=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(b.mdhd,i)},l=function(e){return t(b.mdia,c(e),f(e.type),r(e))},a=function(e){return t(b.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},r=function(i){return t(b.minf,"video"===i.type?t(b.vmhd,D):t(b.smhd,U),e(),g(i))},s=function(e,i){for(var n=[],r=i.length;r--;)n[r]=S(i[r]);return t.apply(null,[b.moof,a(e)].concat(n))},o=function(e){for(var i=e.length,n=[];i--;)n[i]=p(e[i]);return t.apply(null,[b.moov,d(4294967295)].concat(n).concat(h(e)))},h=function(e){for(var i=e.length,n=[];i--;)n[i]=v(e[i]);return t.apply(null,[b.mvex].concat(n))},d=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t(b.mvhd,i)},m=function(e){var i,n,a=e.samples||[],r=new Uint8Array(4+a.length);for(n=0;n>>8),s.push(255&a[i].byteLength),s=s.concat(Array.prototype.slice.call(a[i]));for(i=0;i>>8),o.push(255&r[i].byteLength),o=o.concat(Array.prototype.slice.call(r[i]));if(n=[b.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(b.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([a.length],s,[r.length],o))),t(b.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var h=e.sarRatio[0],d=e.sarRatio[1];n.push(t(b.pasp,new Uint8Array([(4278190080&h)>>24,(16711680&h)>>16,(65280&h)>>8,255&h,(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d])))}return t.apply(null,n)},I=function(e){return t(b.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),i(e))},u=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(b.tkhd,i)},S=function(e){var i,n,a,r,s,o;return i=t(b.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/(W+1)),o=Math.floor(e.baseMediaDecodeTime%(W+1)),n=t(b.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),92,"audio"===e.type?(a=_(e,92),t(b.traf,i,n,a)):(r=m(e),a=_(e,r.length+92),t(b.traf,i,n,a,r))},p=function(e){return e.duration=e.duration||4294967295,t(b.trak,u(e),l(e))},v=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(b.trex,i)},G=function(t,e){var i=0,n=0,a=0,r=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(a=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,i|n|a|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},N=function(e,i){var n,a,r,s,o,h;for(i+=20+16*(s=e.samples||[]).length,r=G(s,i),(a=new Uint8Array(r.length+16*s.length)).set(r),n=r.length,h=0;h>>24,a[n++]=(16711680&o.duration)>>>16,a[n++]=(65280&o.duration)>>>8,a[n++]=255&o.duration,a[n++]=(4278190080&o.size)>>>24,a[n++]=(16711680&o.size)>>>16,a[n++]=(65280&o.size)>>>8,a[n++]=255&o.size,a[n++]=o.flags.isLeading<<2|o.flags.dependsOn,a[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,a[n++]=61440&o.flags.degradationPriority,a[n++]=15&o.flags.degradationPriority,a[n++]=(4278190080&o.compositionTimeOffset)>>>24,a[n++]=(16711680&o.compositionTimeOffset)>>>16,a[n++]=(65280&o.compositionTimeOffset)>>>8,a[n++]=255&o.compositionTimeOffset;return t(b.trun,a)},B=function(e,i){var n,a,r,s,o,h;for(i+=20+8*(s=e.samples||[]).length,r=G(s,i),(n=new Uint8Array(r.length+8*s.length)).set(r),a=r.length,h=0;h>>24,n[a++]=(16711680&o.duration)>>>16,n[a++]=(65280&o.duration)>>>8,n[a++]=255&o.duration,n[a++]=(4278190080&o.size)>>>24,n[a++]=(16711680&o.size)>>>16,n[a++]=(65280&o.size)>>>8,n[a++]=255&o.size;return t(b.trun,n)},_=function(t,e){return"audio"===t.type?B(t,e):N(t,e)};var z,F,V,Y,X,j,q={ftyp:n=function(){return t(b.ftyp,w,T,w,k)},mdat:function(e){return t(b.mdat,e)},moof:s,moov:o,initSegment:function(t){var e,i=n(),a=o(t);return(e=new Uint8Array(i.byteLength+a.byteLength)).set(i),e.set(a,i.byteLength),e}},H=function(t){return t>>>0},Z=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},$=H,K=function t(e,i){var n,a,r,s,o,h=[];if(!i.length)return null;for(n=0;n1?n+a:e.byteLength,r===i[0]&&(1===i.length?h.push(e.subarray(n+8,s)):(o=t(e.subarray(n+8,s),i.slice(1))).length&&(h=h.concat(o))),n=s;return h},J=function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},a=1&n.flags[2],r=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],h=32&n.flags[2],d=65536&n.flags[0],p=131072&n.flags[0];return e=8,a&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),r&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),h&&(n.defaultSampleFlags=i.getUint32(e)),d&&(n.durationIsEmpty=!0),!a&&p&&(n.baseDataOffsetIsMoof=!0),n},Q=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},tt=function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=1&i.flags[2],r=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],h=4&i.flags[1],d=8&i.flags[1],p=n.getUint32(4),u=8;for(a&&(i.dataOffset=n.getInt32(u),u+=4),r&&p&&(e={flags:Q(t.subarray(u,u+4))},u+=4,s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),d&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e),p--);p--;)e={},s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),h&&(e.flags=Q(t.subarray(u,u+4)),u+=4),d&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e);return i},et=H,it=function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4)),baseMediaDecodeTime:et(t[4]<<24|t[5]<<16|t[6]<<8|t[7])};return 1===e.version&&(e.baseMediaDecodeTime*=Math.pow(2,32),e.baseMediaDecodeTime+=et(t[8]<<24|t[9]<<16|t[10]<<8|t[11])),e},nt=H,at=function(t){return("00"+t.toString(16)).slice(-2)};z=function(t){return K(t,["moov","trak"]).reduce((function(t,e){var i,n,a,r,s;return(i=K(e,["tkhd"])[0])?(n=i[0],r=nt(i[a=0===n?12:20]<<24|i[a+1]<<16|i[a+2]<<8|i[a+3]),(s=K(e,["mdia","mdhd"])[0])?(a=0===(n=s[0])?12:20,t[r]=nt(s[a]<<24|s[a+1]<<16|s[a+2]<<8|s[a+3]),t):null):null}),{})},F=function(t,e){var i,n,a;return i=K(e,["moof","traf"]),n=[].concat.apply([],i.map((function(e){return K(e,["tfhd"]).map((function(i){var n,a,r;return n=nt(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),a=t[n]||9e4,(r="number"!=typeof(r=K(e,["tfdt"]).map((function(t){var e,i;return e=t[0],i=nt(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),1===e&&(i*=Math.pow(2,32),i+=nt(t[8]<<24|t[9]<<16|t[10]<<8|t[11])),i}))[0])||isNaN(r)?1/0:r)/a}))}))),a=Math.min.apply(null,n),isFinite(a)?a:0},V=function(t,e){var i,n=K(e,["moof","traf"]),a=0,r=0;if(n&&n.length){var s=K(n[0],["tfhd"])[0],o=K(n[0],["trun"])[0],h=K(n[0],["tfdt"])[0];if(s)i=J(s).trackId;if(h)a=it(h).baseMediaDecodeTime;if(o){var d=tt(o);d.samples&&d.samples.length&&(r=d.samples[0].compositionTimeOffset||0)}}return(a+r)/(t[i]||9e4)},Y=function(t){var e=K(t,["moov","trak"]),i=[];return e.forEach((function(t){var e=K(t,["mdia","hdlr"]),n=K(t,["tkhd"]);e.forEach((function(t,e){var a,r,s=Z(t.subarray(8,12)),o=n[e];"vide"===s&&(r=0===(a=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?a.getUint32(12):a.getUint32(20),i.push(r))}))})),i},X=function(t){var e=K(t,["moov","trak"]),i=[];return e.forEach((function(t){var e,n,a={},r=K(t,["tkhd"])[0];r&&(n=(e=new DataView(r.buffer,r.byteOffset,r.byteLength)).getUint8(0),a.id=0===n?e.getUint32(12):e.getUint32(20));var s=K(t,["mdia","hdlr"])[0];if(s){var o=Z(s.subarray(8,12));a.type="vide"===o?"video":"soun"===o?"audio":o}var h=K(t,["mdia","minf","stbl","stsd"])[0];if(h){var d=h.subarray(8);a.codec=Z(d.subarray(4,8));var p,u=K(d,[a.codec])[0];u&&(/^[a-z]vc[1-9]$/i.test(a.codec)?(p=u.subarray(78),"avcC"===Z(p.subarray(4,8))&&p.length>11?(a.codec+=".",a.codec+=at(p[9]),a.codec+=at(p[10]),a.codec+=at(p[11])):a.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(a.codec)?(p=u.subarray(28),"esds"===Z(p.subarray(4,8))&&p.length>20&&0!==p[19]?(a.codec+="."+at(p[19]),a.codec+="."+at(p[20]>>>2&63).replace(/^0/,"")):a.codec="mp4a.40.2"):a.codec=a.codec.toLowerCase())}var l=K(t,["mdia","mdhd"])[0];l&&(a.timescale=j(l)),i.push(a)})),i};var rt={findBox:K,parseType:Z,timescale:z,startTime:F,compositionStartTime:V,videoTrackIds:Y,tracks:X,getTimescaleFromMediaHeader:j=function(t){var e=0===t[0]?12:20;return nt(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])}},st=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var n;return!!t[e]&&(n=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(n,1),n>-1)},this.trigger=function(e){var i,n,a,r;if(i=t[e])if(2===arguments.length)for(a=i.length,n=0;n1&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},_t=function(t,e){var i,n,a,r,s,o=e||0,h=[];for(i=0;iAt/2))){for((s=Ct()[t.samplerate])||(s=e[0].data),o=0;o=i?t:(e.minSegmentDts=1/0,t.filter((function(t){return t.dts>=i&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)})))},xt=function(t){var e,i,n=[];for(e=0;e=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},qt.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},qt.prototype.addText=function(t){this.rows[this.rowIdx]+=t},qt.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var Ht=function(t){this.serviceNum=t,this.text="",this.currentWindow=new qt(-1),this.windows=[]};Ht.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new qt(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},Ht.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]};var Zt=function t(){t.prototype.init.call(this);var e=this;this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(e.new708Packet(),e.add708Bytes(t)):(null===e.current708Packet&&e.new708Packet(),e.add708Bytes(t))}};Zt.prototype=new mt,Zt.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Zt.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,n=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Zt.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,n=null,a=0,r=e[a++];for(t.seq=r>>6,t.sizeCode=63&r;a>5)&&n>0&&(i=r=e[a++]),this.pushServiceBlock(i,a,n),n>0&&(a+=n-1)},Zt.prototype.pushServiceBlock=function(t,e,i){var n,a=e,r=this.current708Packet.data,s=this.services[t];for(s||(s=this.initService(t,a));a>5,r.rowLock=(16&n)>>4,r.columnLock=(8&n)>>3,r.priority=7&n,n=i[++t],r.relativePositioning=(128&n)>>7,r.anchorVertical=127&n,n=i[++t],r.anchorHorizontal=n,n=i[++t],r.anchorPoint=(240&n)>>4,r.rowCount=15&n,n=i[++t],r.columnCount=63&n,n=i[++t],r.windowStyle=(56&n)>>3,r.penStyle=7&n,r.virtualRowCount=r.rowCount+1,t},Zt.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.winAttr;return n=i[++t],a.fillOpacity=(192&n)>>6,a.fillRed=(48&n)>>4,a.fillGreen=(12&n)>>2,a.fillBlue=3&n,n=i[++t],a.borderType=(192&n)>>6,a.borderRed=(48&n)>>4,a.borderGreen=(12&n)>>2,a.borderBlue=3&n,n=i[++t],a.borderType+=(128&n)>>5,a.wordWrap=(64&n)>>6,a.printDirection=(48&n)>>4,a.scrollDirection=(12&n)>>2,a.justify=3&n,n=i[++t],a.effectSpeed=(240&n)>>4,a.effectDirection=(12&n)>>2,a.displayEffect=3&n,t},Zt.prototype.flushDisplayed=function(t,e){for(var i=[],n=0;n<8;n++)e.windows[n].visible&&!e.windows[n].isEmpty()&&i.push(e.windows[n].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},Zt.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},Zt.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],n=this.getPts(t);this.flushDisplayed(n,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&n)>>2,a.penSize=3&n,n=i[++t],a.italics=(128&n)>>7,a.underline=(64&n)>>6,a.edgeType=(56&n)>>3,a.fontStyle=7&n,t},Zt.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penColor;return n=i[++t],a.fgOpacity=(192&n)>>6,a.fgRed=(48&n)>>4,a.fgGreen=(12&n)>>2,a.fgBlue=3&n,n=i[++t],a.bgOpacity=(192&n)>>6,a.bgRed=(48&n)>>4,a.bgGreen=(12&n)>>2,a.bgBlue=3&n,n=i[++t],a.edgeRed=(48&n)>>4,a.edgeGreen=(12&n)>>2,a.edgeBlue=3&n,t},Zt.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,n=i[++t],a.row=15&n,n=i[++t],a.column=63&n,t},Zt.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var $t={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Kt=function(t){return null===t?"":(t=$t[t]||t,String.fromCharCode(t))},Jt=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Qt=function(){for(var t=[],e=15;e--;)t.push("");return t},te=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,a,r;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=Qt();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Qt();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=Qt()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(n,a))r=Kt((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(n,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),r=Kt((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(n,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,a))this.column_+=3&a;else if(this.isPAC(n,a)){var s=Jt.indexOf(7968&e);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(t.pts,s)),s!==this.row_&&(this.clearFormatting(t.pts),this.row_=s),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)&&(this.column_=4*((14&e)>>1)),this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===a&&(a=null),r=Kt(n),r+=Kt(a),this[this.mode_](t.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};te.prototype=new mt,te.prototype.flushDisplayed=function(t){var e=this.displayed_.map((function(t){try{return t.trim()}catch(t){return console.error("Skipping malformed caption."),""}})).join("\n").replace(/^\n+|\n+$/g,"");e.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:e,stream:this.name_})},te.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Qt(),this.nonDisplayed_=Qt(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},te.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},te.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},te.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},te.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},te.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},te.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},te.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},te.prototype.isNormalChar=function(t){return t>=32&&t<=127},te.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=Qt(),this.displayed_=Qt()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},te.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},te.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_];i+=e,this.nonDisplayed_[this.row_]=i},te.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_];i+=e,this.displayed_[this.row_]=i},te.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},re=function t(e){var i,n;t.prototype.init.call(this),this.type_=e||ne,this.push=function(t){this.type_!==ne&&t.type!==this.type_||(void 0===n&&(n=t.dts),t.dts=ae(t.dts,n),t.pts=ae(t.pts,n),i=t.dts,this.trigger("data",t))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};re.prototype=new mt;var se,oe=re,he=function(t,e,i){var n,a="";for(n=e;n>>2;u*=4,u+=3&p[7],h.timeStamp=u,void 0===e.pts&&void 0===e.dts&&(e.pts=h.timeStamp,e.dts=h.timeStamp),this.trigger("timestamp",h)}e.frames.push(h),s+=10,s+=o}while(s>>4>1&&(n+=e[n]+1),0===i.pid)i.type="pat",t(e.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,n,i]):this.processPes_(e,n,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=ie.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=ie.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new mt,ce.STREAM_TYPES={h264:27,adts:15},(fe=function(){var t,e=this,i={data:[],size:0},n={data:[],size:0},a={data:[],size:0},r=function(t,i,n){var a,r,s=new Uint8Array(t.size),o={type:i},h=0,d=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,h=0;h>>3,u.pts*=4,u.pts+=(6&p[13])>>>1,u.dts=u.pts,64&l&&(u.dts=(14&p[14])<<27|(255&p[15])<<20|(254&p[16])<<12|(255&p[17])<<5|(254&p[18])>>>3,u.dts*=4,u.dts+=(6&p[18])>>>1)),u.data=p.subarray(9+p[8])),a="video"===i||o.packetLength<=t.size,(n||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};fe.prototype.init.call(this),this.push=function(s){({pat:function(){},pes:function(){var t,e;switch(s.streamType){case ie.H264_STREAM_TYPE:t=i,e="video";break;case ie.ADTS_STREAM_TYPE:t=n,e="audio";break;case ie.METADATA_STREAM_TYPE:t=a,e="timed-metadata";break;default:return}s.payloadUnitStartIndicator&&r(t,e,!0),t.data.push(s),t.size+=s.data.byteLength},pmt:function(){var i={type:"metadata",tracks:[]};null!==(t=s.programMapTable).video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",i)}})[s.type]()},this.reset=function(){i.size=0,i.data.length=0,n.size=0,n.data.length=0,this.trigger("reset")},this.flushStreams_=function(){r(i,"video"),r(n,"audio"),r(a,"timed-metadata")},this.flush=function(){this.flushStreams_(),this.trigger("done")}}).prototype=new mt;var Se={PAT_PID:0,MP2T_PACKET_LENGTH:ye,TransportPacketStream:le,TransportParseStream:ce,ElementaryStream:fe,TimestampRolloverStream:ge,CaptionStream:ee.CaptionStream,Cea608Stream:ee.Cea608Stream,Cea708Stream:ee.Cea708Stream,MetadataStream:me};for(var ve in ie)ie.hasOwnProperty(ve)&&(Se[ve]=ie[ve]);var _e,be=Se,we=At,Te=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(_e=function(t){var e,i=0;_e.prototype.init.call(this),this.push=function(n){var a,r,s,o,h,d,p=0;if(t||(i=0),"audio"===n.type)for(e?(o=e,(e=new Uint8Array(o.byteLength+n.data.byteLength)).set(o),e.set(n.data,o.byteLength)):e=n.data;p+5>5,d=(h=1024*(1+(3&e[p+6])))*we/Te[(60&e[p+2])>>>2],s=p+a,e.byteLength>>6&3),channelcount:(1&e[p+2])<<2|(192&e[p+3])>>>6,samplerate:Te[(60&e[p+2])>>>2],samplingfrequencyindex:(60&e[p+2])>>>2,samplesize:16,data:e.subarray(p+7+r,s)}),i++,e.byteLength===s)return void(e=void 0);e=e.subarray(s)}else p++},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new mt;var ke,Ce,Pe,Ae=_e,De=function(t){var e=t.byteLength,i=0,n=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+n},this.loadWord=function(){var a=t.byteLength-e,r=new Uint8Array(4),s=Math.min(4,e);if(0===s)throw new Error("no bytes available");r.set(t.subarray(a,a+s)),i=new DataView(r.buffer).getUint32(0),n=8*s,e-=s},this.skipBits=function(t){var a;n>t?(i<<=t,n-=t):(t-=n,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,n-=t)},this.readBits=function(t){var a=Math.min(n,t),r=i>>>32-a;return(n-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?r<>>t))return i<<=t,n-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Ce=function(){var t,e,i=0;Ce.prototype.init.call(this),this.push=function(n){var a;e?((a=new Uint8Array(e.byteLength+n.data.byteLength)).set(e),a.set(n.data,e.byteLength),e=a):e=n.data;for(var r=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new mt,Pe={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(ke=function(){var t,e,i,n,a,r,s,o=new Ce;ke.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,n=t.dts,o.push(t))},o.on("data",(function(s){var o={trackId:e,pts:i,dts:n,data:s};switch(31&s[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(s.subarray(1)),o.config=r(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(t,e){var i,n=8,a=8;for(i=0;i=0?i:0,(16&t[e+5])>>4?i+20:i+10},Oe=function t(e,i){return e.length-i<10||e[i]!=="I".charCodeAt(0)||e[i+1]!=="D".charCodeAt(0)||e[i+2]!=="3".charCodeAt(0)?i:t(e,i+=Ee(e,i))},xe=function(t){var e=Oe(t,0);return t.length>=e+2&&255==(255&t[e])&&240==(240&t[e+1])&&16==(22&t[e+1])},Re=Ee,Me=function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i};(Ue=function(){var t=new Uint8Array,e=0;Ue.prototype.init.call(this),this.setTimestamp=function(t){e=t},this.push=function(i){var n,a,r,s,o=0,h=0;for(t.length?(s=t.length,(t=new Uint8Array(i.byteLength+s)).set(t.subarray(0,s)),t.set(i,s)):t=i;t.length-h>=3;)if(t[h]!=="I".charCodeAt(0)||t[h+1]!=="D".charCodeAt(0)||t[h+2]!=="3".charCodeAt(0))if(255!=(255&t[h])||240!=(240&t[h+1]))h++;else{if(t.length-h<7)break;if(h+(o=Me(t,h))>t.length)break;r={type:"audio",data:t.subarray(h,h+o),pts:e,dts:e},this.trigger("data",r),h+=o}else{if(t.length-h<10)break;if(h+(o=Re(t,h))>t.length)break;a={type:"timed-metadata",data:t.subarray(h,h+o)},this.trigger("data",a),h+=o}n=t.length-h,t=n>0?t.subarray(h):new Uint8Array},this.reset=function(){t=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){t=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new mt;var Ie,Be,Ne,Ge,We=Ue,ze=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Fe=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Ve=Le.H264Stream,Ye=xe,Xe=At,je=function(t,e){var i;if(t.length!==e.length)return!1;for(i=0;i=-1e4&&i<=45e3&&(!n||o>i)&&(n=r,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(t){var e,i,n,a,r,o,h,d;for(r=t.byteLength,o=t.nalCount,h=t.duration,e=i=0;en.pts?e++:(i++,r-=a.byteLength,o-=a.nalCount,h-=a.duration);return 0===i?t:i===t.length?null:((d=t.slice(i)).byteLength=r,d.duration=h,d.nalCount=o,d.pts=d[0].pts,d.dts=d[0].dts,d)},this.alignGopsAtEnd_=function(t){var e,i,n,a,r,o,h;for(e=s.length-1,i=t.length-1,r=null,o=!1;e>=0&&i>=0;){if(n=s[e],a=t[i],n.pts===a.pts){o=!0;break}n.pts>a.pts?e--:(e===s.length-1&&(r=i),i--)}if(!o&&null===r)return null;if(0===(h=o?i:r))return t;var d=t.slice(h),p=d.reduce((function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t}),{byteLength:0,duration:0,nalCount:0});return d.byteLength=p.byteLength,d.duration=p.duration,d.nalCount=p.nalCount,d.pts=d[0].pts,d.dts=d[0].dts,d},this.alignGopsWith=function(t){s=t}}).prototype=new mt,(Ge=function(t,e){this.numberOfTracks=0,this.metadataStream=e,void 0!==(t=t||{}).remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,"boolean"==typeof t.keepOriginalTimestamps?this.keepOriginalTimestamps=t.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ge.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track,this.pendingBoxes.push(t.boxes)),void("audio"===t.track.type&&(this.audioTrack=t.track,this.pendingBoxes.unshift(t.boxes))))}}).prototype=new mt,Ge.prototype.flush=function(t){var e,i,n,a,r=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,Fe.forEach((function(t){s.info[t]=this.videoTrack[t]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,ze.forEach((function(t){s.info[t]=this.audioTrack[t]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=q.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ge.prototype.setRemux=function(t){this.remuxTracks=t},(Ne=function(t){var e,i,n=this,a=!0;Ne.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="aac",a.metadataStream=new be.MetadataStream,a.aacStream=new We,a.audioTimestampRolloverStream=new be.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new be.TimestampRolloverStream("timed-metadata"),a.adtsStream=new Ae,a.coalesceStream=new Ge(t,a.metadataStream),a.headOfPipeline=a.aacStream,a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.metadataStream.on("timestamp",(function(t){a.aacStream.setTimestamp(t.timeStamp)})),a.aacStream.on("data",(function(r){"timed-metadata"!==r.type&&"audio"!==r.type||a.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new Be(i,t),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e}))})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new be.MetadataStream,a.packetStream=new be.TransportPacketStream,a.parseStream=new be.TransportParseStream,a.elementaryStream=new be.ElementaryStream,a.timestampRolloverStream=new be.TimestampRolloverStream,a.adtsStream=new Ae,a.h264Stream=new Ve,a.captionStream=new be.CaptionStream(t),a.coalesceStream=new Ge(t,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream),a.timestampRolloverStream.pipe(a.h264Stream),a.timestampRolloverStream.pipe(a.adtsStream),a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",(function(r){var s;if("metadata"===r.type){for(s=r.tracks.length;s--;)e||"video"!==r.tracks[s].type?i||"audio"!==r.tracks[s].type||((i=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(e=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;e&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new Ie(e,t),a.videoSegmentStream.on("timelineStartInfo",(function(e){i&&!t.keepOriginalTimestamps&&(i.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts-n.baseMediaDecodeTime))})),a.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),a.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",(function(t){i&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(t)})),a.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),i&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new Be(i,t),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e})}})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("id3Frame",(function(t){t.dispatchType=a.metadataStream.dispatchType,n.trigger("id3Frame",t)})),a.coalesceStream.on("caption",this.trigger.bind(this,"caption")),a.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(n){var a=this.transmuxPipeline_;t.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,It(i),a.audioTimestampRolloverStream&&a.audioTimestampRolloverStream.discontinuity()),e&&(a.videoSegmentStream&&(a.videoSegmentStream.gopCache_=[]),e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,It(e),a.captionStream.reset()),a.timestampRolloverStream&&a.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.setRemux=function(e){var i=this.transmuxPipeline_;t.remux=e,i&&i.coalesceStream&&i.coalesceStream.setRemux(e)},this.alignGopsWith=function(t){e&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.push=function(t){if(a){var e=Ye(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),a=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){a=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new mt;var He={Transmuxer:Ne,VideoSegmentStream:Ie,AudioSegmentStream:Be,AUDIO_PROPERTIES:ze,VIDEO_PROPERTIES:Fe,generateSegmentTimingInfo:qe},Ze=Ft,$e=ee.CaptionStream,Ke=function(t,e){for(var i=t,n=0;n0?it(d[0]).baseMediaDecodeTime:0,u=K(r,["trun"]);e===h&&u.length>0&&(i=function(t,e,i){var n,a,r,s,o=new DataView(t.buffer,t.byteOffset,t.byteLength),h=[];for(a=0;a+40;){var h=e.shift();this.parse(h,r,s)}return null!==(o=function(t,e,i){return null===e?null:{seiNals:Je(t,e)[e],timescale:i}}(t,i,n))&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),a):null},this.pushNals=function(e){if(!this.isInitialized()||!e||0===e.length)return null;e.forEach((function(e){t.push(e)}))},this.flushStream=function(){if(!this.isInitialized())return null;r?t.partialFlush():t.flush()},this.clearParsedCaptions=function(){a.captions=[],a.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){e=[],i=null,n=null,a?this.clearParsedCaptions():a={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}}})); diff --git a/node_modules/mux.js/dist/mux.js b/node_modules/mux.js/dist/mux.js deleted file mode 100644 index 5a23fbc..0000000 --- a/node_modules/mux.js/dist/mux.js +++ /dev/null @@ -1,10797 +0,0 @@ -/*! @name mux.js @version 5.11.1 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.muxjs = factory()); -}(this, (function () { 'use strict'; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ - - var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; - }; - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - - Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; - }; // Default stream functions that are expected to be overridden to perform - // actual work. These are provided by the prototype as a sort of no-op - // implementation so that we don't have to check for their existence in the - // `pipe` function above. - - - Stream.prototype.push = function (data) { - this.trigger('data', data); - }; - - Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); - }; - - Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); - }; - - Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); - }; - - Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); - }; - - var stream = Stream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var ONE_SECOND_IN_TS = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - - var ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS; - - var _AdtsStream; - - var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - /* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - - _AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - while (i + 5 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$1 / ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; - frameEnd = i + frameLength; // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - - if (buffer.byteLength < frameEnd) { - return; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - frameNum++; // If the buffer is empty, clear it and return - - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } // Remove the finished frame from the buffer and start the process again - - - buffer = buffer.subarray(frameEnd); - } - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; - }; - - _AdtsStream.prototype = new stream(); - var adts = _AdtsStream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ExpGolomb; - /** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - - ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); - }; - - var expGolomb = ExpGolomb; - - var _H264Stream, _NalByteStream; - - var PROFILES_WITH_OPTIONAL_SPS_DATA; - /** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - - _NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - }; - - _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS - // see Recommendation ITU-T H.264 (4/2013), - // 7.3.2.1.1 Sequence parameter set data syntax - - PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true - }; - /** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - - _H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - expGolombDecoder = new expGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - sarRatio: sarRatio - }; - }; - }; - - _H264Stream.prototype = new stream(); - var h264 = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var codecs = { - Adts: adts, - h264: h264 - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ - - var UINT32_MAX = Math.pow(2, 32) - 1; - var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - - (function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); - })(); - - box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; - }; - - dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); - }; - - esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); - }; - - ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); - }; - - hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); - }; - - mdat = function mdat(data) { - return box(types.mdat, data); - }; - - mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); - }; - - mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); - }; - - mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); - }; - - minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); - }; - - moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); - }; - /** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - - moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); - }; - - mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); - }; - - mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); - }; - - sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); - }; - - stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); - }; - - (function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; - })(); - - tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); - }; - /** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - - traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (UINT32_MAX + 1)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (UINT32_MAX + 1)); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); - }; - /** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - - trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); - }; - - trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); - }; - - (function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; - })(); - - var mp4Generator = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var toUnsigned = function toUnsigned(value) { - return value >>> 0; - }; - - var toHexString = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); - }; - - var bin = { - toUnsigned: toUnsigned, - toHexString: toHexString - }; - - var parseType = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; - }; - - var parseType_1 = parseType; - - var toUnsigned$1 = bin.toUnsigned; - - var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned$1(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType_1(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; - }; - - var findBox_1 = findBox; - - var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; - }; - - var parseTfhd = tfhd; - - var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; - }; - - var parseSampleFlags_1 = parseSampleFlags; - - var trun$1 = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags_1(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; - }; - - var parseTrun = trun$1; - - var toUnsigned$2 = bin.toUnsigned; - - var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - baseMediaDecodeTime: toUnsigned$2(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime *= Math.pow(2, 32); - result.baseMediaDecodeTime += toUnsigned$2(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11]); - } - - return result; - }; - - var parseTfdt = tfdt; - - var toUnsigned$3 = bin.toUnsigned; - var toHexString$1 = bin.toHexString; - var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader; - /** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - - timescale = function timescale(init) { - var result = {}, - traks = findBox_1(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox_1(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned$3(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned$3(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); - }; - /** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - - startTime = function startTime(timescale, fragment) { - var trafs, baseTimes, result; // we need info from two childrend of each track fragment box - - trafs = findBox_1(fragment, ['moof', 'traf']); // determine the start times for each track - - baseTimes = [].concat.apply([], trafs.map(function (traf) { - return findBox_1(traf, ['tfhd']).map(function (tfhd) { - var id, scale, baseTime; // get the track id from the tfhd - - id = toUnsigned$3(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - baseTime = findBox_1(traf, ['tfdt']).map(function (tfdt) { - var version, result; - version = tfdt[0]; - result = toUnsigned$3(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]); - - if (version === 1) { - result *= Math.pow(2, 32); - result += toUnsigned$3(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11]); - } - - return result; - })[0]; - baseTime = typeof baseTime === 'number' && !isNaN(baseTime) ? baseTime : Infinity; // convert base time to seconds - - return baseTime / scale; - }); - })); // return the minimum - - result = Math.min.apply(null, baseTimes); - return isFinite(result) ? result : 0; - }; - /** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - - compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox_1(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox_1(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox_1(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox_1(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - return (baseMediaDecodeTime + compositionTimeOffset) / timescale; - }; - /** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - - getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox_1(trak, ['mdia', 'hdlr']); - var tkhds = findBox_1(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType_1(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; - }; - - getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned$3(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - }; - /** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - - getTracks = function getTracks(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox_1(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox_1(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType_1(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox_1(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType_1(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox_1(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[a-z]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString$1(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString$1(codecConfig[10]); // level idc - - track.codec += toHexString$1(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString$1(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString$1(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; - }; - - var probe = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox_1, - parseType: parseType_1, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - // Convert an array of nal units into an array of frames with each frame being - // composed of the nal units that make up that frame - // Also keep track of cummulative data about the frame from the nal units such - // as the frame duration, starting pts, etc. - var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; - }; // Convert an array of frames into an array of Gop with each Gop being composed - // of the frames that make up that Gop - // Also keep track of cummulative data about the Gop from the frames such as the - // Gop duration, starting pts, etc. - - - var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; - }; - /* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - - var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; - }; - /** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - - var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; - }; - /* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - - var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; - }; // generate the track's sample table from an array of gops - - - var generateSampleTable = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; - }; // generate the track's raw mdat data from an array of gops - - - var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; - }; // generate the track's sample table from a frame - - - var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; - }; // generate the track's raw mdat data from a frame - - - var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; - }; - - var frameUtils = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var highPrefix = [33, 16, 5, 32, 164, 27]; - var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - - var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; - }; - - var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); - }; - - var silence; - - var silence_1 = function silence_1() { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]], - 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - /** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; - }; // Possibly pad (prefix) the audio track with silence if appending this track - // would lead to the introduction of a gap in the audio buffer - - - var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = silence_1()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; - }; // If the audio segment extends before the earliest allowed dts - // value, remove AAC frames until starts at or after the earliest - // allowed DTS so that we don't end up with a negative baseMedia- - // DecodeTime for the audio track - - - var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); - }; // generate the track's raw mdat data from an array of frames - - - var generateSampleTable$1 = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; - }; // generate the track's sample table from an array of frames - - - var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; - }; - - var audioFrameUtils = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable$1, - concatenateFrameData: concatenateFrameData - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ONE_SECOND_IN_TS$2 = clock.ONE_SECOND_IN_TS; - /** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } - }; - /** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - - var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; - }; - /** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS$2; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; - }; - - var trackDecodeInfo = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - // payload type field to indicate how they are to be - // interpreted. CEAS-708 caption content is always transmitted with - // payload type 0x04. - - var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - /** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - - var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; - }; // see ANSI/SCTE 128-1 (2013), section 8.1 - - - var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); - }; // see CEA-708-D, section 4.4 - - - var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; - }; - - var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; // exports - - - var captionPacketParser = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 - }; - - // Link To Transport - // ----------------- - - - var CaptionStream = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream(); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - }; - - CaptionStream.prototype = new stream(); - - CaptionStream.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; - }; - - CaptionStream.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); - }; - - CaptionStream.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); - }; - - CaptionStream.prototype.flush = function () { - return this.flushStream('flush'); - }; // Only called if handling partial data - - - CaptionStream.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); - }; - - CaptionStream.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); - }; // From the CEA-608 spec: - - /* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. - */ - // With that in mind, we ignore any data between an XDS control code and a - // subsequent closed-captioning control code. - - - CaptionStream.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); - }; - - CaptionStream.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; - }; - - CaptionStream.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; - }; - - CaptionStream.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; - }; - - CaptionStream.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } - }; // ---------------------- - // Session to Application - // ---------------------- - // This hash maps special and extended character codes to their - // proper Unicode equivalent. The first one-byte key is just a - // non-standard character code. The two-byte keys that follow are - // the extended CEA708 character codes, along with the preceding - // 0x10 extended character byte to distinguish these codes from - // non-extended character codes. Every CEA708 character code that - // is not in this object maps directly to a standard unicode - // character code. - // The transparent space and non-breaking transparent space are - // technically not fully supported since there is no code to - // make them transparent, so they have normal non-transparent - // stand-ins. - // The special closed caption (CC) character isn't a standard - // unicode character, so a fairly similar unicode character was - // chosen in it's place. - - - var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - - }; - - var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); - }; - - var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; - }; - - var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); - }; - - Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; - }; - - Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); - }; - - Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; - }; - - Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } - }; - - Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; - }; - - Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; - }; - - Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } - }; - - var Cea708Service = function Cea708Service(serviceNum) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - }; - /** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - - Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } - }; - /** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - - Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; - }; - - var Cea708Stream = function Cea708Stream() { - Cea708Stream.prototype.init.call(this); - var self = this; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; - }; - - Cea708Stream.prototype = new stream(); - /** - * Push current 708 packet, create new 708 packet. - */ - - Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; - }; - /** - * Add pts and both bytes from packet into current 708 packet. - */ - - - Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); - }; - /** - * Parse completed 708 packet into service blocks and push each service block. - */ - - - Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } - }; - /** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - - Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else ; - } - }; - /** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, true); - } - - return i; - }; - /** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - - Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; - }; - /** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - - Cea708Stream.prototype.initService = function (serviceNum, i) { - var self = this; - this.services[serviceNum] = new Cea708Service(serviceNum); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; - }; - /** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.handleText = function (i, service, isExtended) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var extended = isExtended ? 0x1000 : 0x0000; - var char = get708CharFromCode(extended | b); - var win = service.currentWindow; - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; - }; - /** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; - }; - /** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; - }; - /** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; - }; - /** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; - }; - /** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } - }; - /** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; - }; - /** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; - }; - /** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; - }; - /** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; - }; - /** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; - }; - /** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; - }; - /** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; - }; - /** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; - }; - /** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - - Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); - }; // This hash maps non-ASCII, special, and extended character codes to their - // proper Unicode equivalent. The first keys that are only a single byte - // are the non-standard ASCII characters, which simply map the CEA608 byte - // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 - // character codes, but have their MSB bitmasked with 0x03 so that a lookup - // can be performed regardless of the field and data channel on which the - // character code was received. - - - var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - - }; - - var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); - }; // the index of the last row in a CEA-608 display buffer - - - var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of - // getting it through bit logic. - - var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character - // cells. The "bottom" row is the last element in the outer array. - - var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push(''); - } - - return result; - }; - - var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; - }; - - Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the - // display buffer - - Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - // eslint-disable-next-line no-console - console.error('Skipping malformed caption.'); - return ''; - } - }) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content, - stream: this.name_ - }); - } - }; - /** - * Zero out the data, used for startup and on seek - */ - - - Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; - }; - /** - * Sets up control code and related constants for this instance - */ - - - Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; - }; - /** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - - Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - - Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - - Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; - }; - /** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - - Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; - }; - /** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - - Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; - }; - /** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - - Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; - }; - /** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - - Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; - }; - /** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - - Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; - }; // Adds the opening HTML tag for the passed character to the caption text, - // and keeps track of it for later closing - - - Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); - }; // Adds HTML closing tags for current formatting to caption text and - // clears remembered formatting - - - Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); - }; // Mode Implementations - - - Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; - - Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = ''; - }; - - Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; - }; // exports - - - var captionStream = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var streamTypes = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 - }; - - var MAX_TS = 8589934592; - var RO_THRESH = 4294967296; - var TYPE_SHARED = 'shared'; - - var handleRollover = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; - }; - - var TimestampRolloverStream = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; - }; - - TimestampRolloverStream.prototype = new stream(); - var timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream, - handleRollover: handleRollover - }; - - var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }, - tagParsers = { - TXXX: function TXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); // do not include the null terminator in the tag value - - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - - tag.data = tag.value; - }, - WXXX: function WXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function PRIV(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591(tag.data, 0, i); - break; - } - } - - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } - }, - _MetadataStream; - - _MetadataStream = function MetadataStream(options) { - var settings = { - debug: !!(options && options.debug), - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseSyncSafeInteger(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; - }; - - _MetadataStream.prototype = new stream(); - var metadataStream = _MetadataStream; - - var TimestampRolloverStream$1 = timestampRolloverStream.TimestampRolloverStream; // object types - - var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - - var MP2T_PACKET_LENGTH = 188, - // bytes - SYNC_BYTE = 0x47; - /** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - - _TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; - }; - - _TransportPacketStream.prototype = new stream(); - /** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - - _TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === streamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = streamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = streamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; - }; - - _TransportParseStream.prototype = new stream(); - _TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f - }; - /** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - - _ElementaryStream = function ElementaryStream() { - var self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case streamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case streamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case streamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - this.flushStreams_(); - this.trigger('done'); - }; - }; - - _ElementaryStream.prototype = new stream(); - var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream$1, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, - MetadataStream: metadataStream - }; - - for (var type in streamTypes) { - if (streamTypes.hasOwnProperty(type)) { - m2ts[type] = streamTypes[type]; - } - } - - var m2ts_1 = m2ts; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ - - var ADTS_SAMPLING_FREQUENCIES$1 = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - - var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - - var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); - }; // TODO: use vhs-utils - - - var isLikelyAacData = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; - }; - - var parseSyncSafeInteger$1 = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }; // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - - - var percentEncode$1 = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }; // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - - - var parseIso88591$1 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode$1(bytes, start, end)); // jshint ignore:line - }; - - var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; - }; - - var parseType$1 = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; - }; - - var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES$1[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; - }; - - var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger$1(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger$1(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591$1(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; - }; - - var utils = { - isLikelyAacData: isLikelyAacData, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType$1, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp - }; - - var _AacStream; - /** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - - _AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = utils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = utils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; - }; - - _AacStream.prototype = new stream(); - var aac = _AacStream; - - // constants - var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; - var audioProperties = AUDIO_PROPERTIES; - - var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; - var videoProperties = VIDEO_PROPERTIES; - - var H264Stream = h264.H264Stream; - var isLikelyAacData$1 = utils.isLikelyAacData; - var ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS; // object types - - var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; - /** - * Compare two arrays (even typed) for same-ness - */ - - - var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; - }; - - var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; - }; - /** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - _AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - audioProperties.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4Generator.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS$3 * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; - }; - - _AudioSegmentStream.prototype = new stream(); - /** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - _VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - videoProperties.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4Generator.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4Generator.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; - }; - - _VideoSegmentStream.prototype = new stream(); - /** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - - _CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; - }; - - _CoalesceStream.prototype = new stream(); - - _CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - videoProperties.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - audioProperties.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4Generator.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - }; - - _CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; - }; - /** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - - _Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new aac(); - pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new adts(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts_1.TransportPacketStream(); - pipeline.parseStream = new m2ts_1.TransportParseStream(); - pipeline.elementaryStream = new m2ts_1.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream(); - pipeline.adtsStream = new adts(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts_1.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData$1(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; - }; - - _Transmuxer.prototype = new stream(); - var transmuxer = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: audioProperties, - VIDEO_PROPERTIES: videoProperties, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo - }; - - var discardEmulationPreventionBytes$1 = captionPacketParser.discardEmulationPreventionBytes; - var CaptionStream$1 = captionStream.CaptionStream; - /** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; - }; - /** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - - var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes$1(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - // eslint-disable-next-line no-console - console.log("We've encountered a nal unit without data. See mux.js#233."); - break; - } - - result.push(seiNal); - break; - } - } - - return result; - }; - /** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - - var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; - }; - /** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - - var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox_1(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox_1(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox_1(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox_1(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox_1(traf, ['trun']); - var samples; - var seiNals; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - seiNals = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = []; - } - - captionNals[trackId] = captionNals[trackId].concat(seiNals); - } - }); - return captionNals; - }; - /** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption - **/ - - - var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var seiNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - seiNals = parseCaptionNals(segment, trackId); - return { - seiNals: seiNals[trackId], - timescale: timescale - }; - }; - /** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - - var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream$1(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData === null || !parsedData.seiNals) { - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {} - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); - }; - - var captionParser = CaptionParser; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var mp4 = { - generator: mp4Generator, - probe: probe, - Transmuxer: transmuxer.Transmuxer, - AudioSegmentStream: transmuxer.AudioSegmentStream, - VideoSegmentStream: transmuxer.VideoSegmentStream, - CaptionParser: captionParser - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ - - var _FlvTag; // (type:uint, extraData:Boolean = false) extends ByteArray - - - _FlvTag = function FlvTag(type, extraData) { - var // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, - // :uint - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function prepareWrite(flv, count) { - var bytes, - minLength = flv.position + count; - - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } // allocate a new buffer and copy over the data that will not be modified - - - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - // commonly used metadata properties - widthBytes = _FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = _FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = _FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!_FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - _FlvTag.widthBytes = widthBytes; - _FlvTag.heightBytes = heightBytes; - _FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case _FlvTag.VIDEO_TAG: - this.length = 16; // Start the buffer at 256k - - bufferStartSize *= 6; - break; - - case _FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - - case _FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - // presentation timestamp - - this.pts = 0; // decoder timestamp - - this.dts = 0; // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - - this.writeBytes = function (bytes, offset, length) { - var start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - this.position += length; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeByte(value:int):void - - - this.writeByte = function (byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeShort(value:int):void - - - this.writeShort = function (short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; // Negative index into array - // (pos:uint):int - - - this.negIndex = function (pos) { - return this.bytes[this.length - pos]; - }; // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - - - this.nalUnitSize = function () { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function () { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } // reserve 4 bytes for nal unit size - - - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; // (nal:ByteArray = null):void - - - this.endNalUnit = function (nalContainer) { - var nalStart, // :uint - nalLength; // :uint - // Rewind to the marker and write the size - - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - - - this.writeMetaDataDouble = function (key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); // write size of property name - - this.view.setUint16(this.position, key.length); - this.position += 2; // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - // write property name - - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } // skip null byte - - - this.position++; // write property value - - this.view.setFloat64(this.position, val); - this.position += 8; // update flv tag length - - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // (key:String, val:Boolean):void - - - this.writeMetaDataBoolean = function (key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // ():ByteArray - - - this.finalize = function () { - var dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case _FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = (this.keyFrame || extraData ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case _FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case _FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - - this.position += 2; // set "onMetaData" - - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - - this.length = this.position; - break; - } - - len = this.length - 11; // write the DataSize field - - this.bytes[1] = (len & 0x00FF0000) >>> 16; - this.bytes[2] = (len & 0x0000FF00) >>> 8; - this.bytes[3] = (len & 0x000000FF) >>> 0; // write the Timestamp - - this.bytes[4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[7] = (this.dts & 0xFF000000) >>> 24; // write the StreamID - - this.bytes[8] = 0; - this.bytes[9] = 0; - this.bytes[10] = 0; // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; // trim down the byte buffer to what is actually being used - - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = _FlvTag.frameTime(this.bytes); // if bytes.bytelength isn't equal to this.length, handle error - - return this; - }; - }; - - _FlvTag.AUDIO_TAG = 0x08; // == 8, :uint - - _FlvTag.VIDEO_TAG = 0x09; // == 9, :uint - - _FlvTag.METADATA_TAG = 0x12; // == 18, :uint - // (tag:ByteArray):Boolean { - - _FlvTag.isAudioFrame = function (tag) { - return _FlvTag.AUDIO_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isVideoFrame = function (tag) { - return _FlvTag.VIDEO_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isMetaData = function (tag) { - return _FlvTag.METADATA_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isKeyFrame = function (tag) { - if (_FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (_FlvTag.isAudioFrame(tag)) { - return true; - } - - if (_FlvTag.isMetaData(tag)) { - return true; - } - - return false; - }; // (tag:ByteArray):uint { - - - _FlvTag.frameTime = function (tag) { - var pts = tag[4] << 16; // :uint - - pts |= tag[5] << 8; - pts |= tag[6] << 0; - pts |= tag[7] << 24; - return pts; - }; - - var flvTag = _FlvTag; - - /** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ - - - var CoalesceStream = function CoalesceStream(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - CoalesceStream.prototype.init.call(this); // Take output from multiple - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; - }; - - CoalesceStream.prototype = new stream(); - - CoalesceStream.prototype.flush = function (flushSource) { - var id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - captionStreams: {}, - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; // Translate caption PTS times into second offsets into the - // video timeline for the segment, and add track info - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; // Emit the final segment - - this.trigger('data', event); - this.trigger('done'); - }; - - var coalesceStream = CoalesceStream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var TagList = function TagList() { - var self = this; - this.list = []; - - this.push = function (tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function get() { - return self.list.length; - } - }); - }; - - var tagList = TagList; - - var H264Stream$1 = h264.H264Stream; - - var _Transmuxer$1, _VideoSegmentStream$1, _AudioSegmentStream$1, collectTimelineInfo, metaDataTag, extraDataTag; - /** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - - collectTimelineInfo = function collectTimelineInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = Math.min(track.timelineStartInfo.dts, data.dts); - } - } - }; - - metaDataTag = function metaDataTag(track, pts) { - var tag = new flvTag(flvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - return tag; - }; - - extraDataTag = function extraDataTag(track, pts) { - var i, - tag = new flvTag(flvTag.VIDEO_TAG, true); - tag.dts = pts; - tag.pts = pts; - tag.writeByte(0x01); // version - - tag.writeByte(track.profileIdc); // profile - - tag.writeByte(track.profileCompatibility); // compatibility - - tag.writeByte(track.levelIdc); // level - - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - - tag.writeShort(track.sps[0].length); // data of SPS - - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; - }; - /** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ - - - _AudioSegmentStream$1 = function AudioSegmentStream(track) { - var adtsFrames = [], - videoKeyFrames = [], - oldExtraData; - - _AudioSegmentStream$1.prototype.init.call(this); - - this.push = function (data) { - collectTimelineInfo(track, data); - - if (track) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = track.audioobjecttype << 11 | track.samplingfrequencyindex << 7 | track.channelcount << 3; - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer audio data until end() is called - - adtsFrames.push(data); - }; - - this.flush = function () { - var currentFrame, - adtsFrame, - lastMetaPts, - tags = new tagList(); // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); // write out a metadata frame at every video key frame - - if (videoKeyFrames.length && currentFrame.pts >= videoKeyFrames[0]) { - lastMetaPts = videoKeyFrames.shift(); - this.writeMetaDataTags(tags, lastMetaPts); - } // also write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration. - - - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - this.writeMetaDataTags(tags, currentFrame.pts); - oldExtraData = track.extraData; - lastMetaPts = currentFrame.pts; - } - - adtsFrame = new flvTag(flvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - adtsFrame.writeBytes(currentFrame.data); - tags.push(adtsFrame.finalize()); - } - - videoKeyFrames.length = 0; - oldExtraData = null; - this.trigger('data', { - track: track, - tags: tags.list - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.writeMetaDataTags = function (tags, pts) { - var adtsFrame; - adtsFrame = new flvTag(flvTag.METADATA_TAG); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; // AAC is always 10 - - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); // Is AAC always 16 bit? - - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - tags.push(adtsFrame.finalize()); - adtsFrame = new flvTag(flvTag.AUDIO_TAG, true); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - tags.push(adtsFrame.finalize()); - }; - - this.onVideoKeyFrame = function (pts) { - videoKeyFrames.push(pts); - }; - }; - - _AudioSegmentStream$1.prototype = new stream(); - /** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ - - _VideoSegmentStream$1 = function VideoSegmentStream(track) { - var nalUnits = [], - config, - h264Frame; - - _VideoSegmentStream$1.prototype.init.call(this); - - this.finishFrame = function (tags, frame) { - if (!frame) { - return; - } // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - - - if (config && track && track.newMetadata && (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - metaTag.metaDataTag = extraTag.metaDataTag = true; - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - this.trigger('keyframe', frame.dts); - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function (data) { - collectTimelineInfo(track, data); - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer video until flush() is called - - nalUnits.push(data); - }; - - this.flush = function () { - var currentNal, - tags = new tagList(); // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); // record the track config - - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - h264Frame = new flvTag(flvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - - h264Frame.endNalUnit(); - } - - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', { - track: track, - tags: tags.list - }); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - }; - - _VideoSegmentStream$1.prototype = new stream(); - /** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ - - _Transmuxer$1 = function Transmuxer(options) { - var self = this, - packetStream, - parseStream, - elementaryStream, - videoTimestampRolloverStream, - audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, - h264Stream, - videoSegmentStream, - audioSegmentStream, - captionStream, - coalesceStream$1; - - _Transmuxer$1.prototype.init.call(this); - - options = options || {}; // expose the metadata stream - - this.metadataStream = new m2ts_1.MetadataStream(); - options.metadataStream = this.metadataStream; // set up the parsing pipeline - - packetStream = new m2ts_1.TransportPacketStream(); - parseStream = new m2ts_1.TransportParseStream(); - elementaryStream = new m2ts_1.ElementaryStream(); - videoTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - adtsStream = new adts(); - h264Stream = new H264Stream$1(); - coalesceStream$1 = new coalesceStream(options); // disassemble MPEG2-TS packets into elementary streams - - packetStream.pipe(parseStream).pipe(elementaryStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - elementaryStream.pipe(videoTimestampRolloverStream).pipe(h264Stream); - elementaryStream.pipe(audioTimestampRolloverStream).pipe(adtsStream); - elementaryStream.pipe(timedMetadataTimestampRolloverStream).pipe(this.metadataStream).pipe(coalesceStream$1); // if CEA-708 parsing is available, hook up a caption stream - - captionStream = new m2ts_1.CaptionStream(options); - h264Stream.pipe(captionStream).pipe(coalesceStream$1); // hook up the segment streams once track metadata is delivered - - elementaryStream.on('data', function (data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !videoSegmentStream) { - coalesceStream$1.numberOfTracks++; - videoSegmentStream = new _VideoSegmentStream$1(videoTrack); // Set up the final part of the video pipeline - - h264Stream.pipe(videoSegmentStream).pipe(coalesceStream$1); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream$1.numberOfTracks++; - audioSegmentStream = new _AudioSegmentStream$1(audioTrack); // Set up the final part of the audio pipeline - - adtsStream.pipe(audioSegmentStream).pipe(coalesceStream$1); - - if (videoSegmentStream) { - videoSegmentStream.on('keyframe', audioSegmentStream.onVideoKeyFrame); - } - } - } - }); // feed incoming data to the front of the parsing pipeline - - this.push = function (data) { - packetStream.push(data); - }; // flush any buffered data - - - this.flush = function () { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - captionStream.reset(); - }; // Re-emit any data coming from the coalesce stream to the outside world - - - coalesceStream$1.on('data', function (event) { - self.trigger('data', event); - }); // Let the consumer know we have finished flushing the entire pipeline - - coalesceStream$1.on('done', function () { - self.trigger('done'); - }); - }; - - _Transmuxer$1.prototype = new stream(); // forward compatibility - - var transmuxer$1 = _Transmuxer$1; - - // http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. - // Technically, this function returns the header and a metadata FLV tag - // if duration is greater than zero - // duration in seconds - // @return {object} the bytes of the FLV header as a Uint8Array - - - var getFlvHeader = function getFlvHeader(duration, audio, video) { - // :ByteArray { - var headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; // default arguments - - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; // signature - - head.setUint8(0, 0x46); // 'F' - - head.setUint8(1, 0x4c); // 'L' - - head.setUint8(2, 0x56); // 'V' - // version - - head.setUint8(3, 0x01); // flags - - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); // data offset, should be 9 for FLV v1 - - head.setUint32(5, headBytes.byteLength); // init the first FLV tag - - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } // write out the duration metadata tag - - - metadata = new flvTag(flvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - return result; - }; - - var flvHeader = getFlvHeader; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var flv = { - tag: flvTag, - Transmuxer: transmuxer$1, - getFlvHeader: flvHeader - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var m2ts$1 = m2ts_1; - - var ONE_SECOND_IN_TS$4 = clock.ONE_SECOND_IN_TS; - /** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - */ - - var AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity, - segmentStartPts = null, - segmentEndPts = null; - options = options || {}; - AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - audioProperties.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.processFrames_ = function () { - var frames, moof, mdat, boxes, timingInfo; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - - if (frames.length === 0) { - // return early if the frames are all after the earliest allowed DTS - // TODO should we clear the adtsFrames? - return; - } - - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4Generator.moof(sequenceNumber, [track]); // bump the sequence number for next time - - sequenceNumber++; - track.initSegment = mp4Generator.initSegment([track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - - if (segmentStartPts === null) { - segmentEndPts = segmentStartPts = frames[0].pts; - } - - segmentEndPts += frames.length * (ONE_SECOND_IN_TS$4 * 1024 / track.samplerate); - timingInfo = { - start: segmentStartPts - }; - this.trigger('timingInfo', timingInfo); - this.trigger('data', { - track: track, - boxes: boxes - }); - }; - - this.flush = function () { - this.processFrames_(); // trigger final timing info - - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - this.resetTiming_(); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.partialFlush = function () { - this.processFrames_(); - this.trigger('partialdone', 'AudioSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'AudioSegmentStream'); - }; - - this.resetTiming_ = function () { - trackDecodeInfo.clearDtsInfo(track); - segmentStartPts = null; - segmentEndPts = null; - }; - - this.reset = function () { - this.resetTiming_(); - adtsFrames = []; - this.trigger('reset'); - }; - }; - - AudioSegmentStream.prototype = new stream(); - var audioSegmentStream = AudioSegmentStream; - - var VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - frameCache = [], - // gopsToAlignWith = [], - config, - pps, - segmentStartPts = null, - segmentEndPts = null, - gops, - ensureNextFrameIsKeyFrame = true; - options = options || {}; - VideoSegmentStream.prototype.init.call(this); - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); - - if (typeof track.timelineStartInfo.dts === 'undefined') { - track.timelineStartInfo.dts = nalUnit.dts; - } // record the track config - - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - videoProperties.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - - this.processNals_ = function (cacheLastFrame) { - var i; - nalUnits = frameCache.concat(nalUnits); // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - return; - } - - var frames = frameUtils.groupNalsIntoFrames(nalUnits); - - if (!frames.length) { - return; - } // note that the frame cache may also protect us from cases where we haven't - // pushed data for the entire first or last frame yet - - - frameCache = frames[frames.length - 1]; - - if (cacheLastFrame) { - frames.pop(); - frames.duration -= frameCache.duration; - frames.nalCount -= frameCache.length; - frames.byteLength -= frameCache.byteLength; - } - - if (!frames.length) { - nalUnits = []; - return; - } - - this.trigger('timelineStartInfo', track.timelineStartInfo); - - if (ensureNextFrameIsKeyFrame) { - gops = frameUtils.groupFramesIntoGops(frames); - - if (!gops[0][0].keyFrame) { - gops = frameUtils.extendFirstKeyFrame(gops); - - if (!gops[0][0].keyFrame) { - // we haven't yet gotten a key frame, so reset nal units to wait for more nal - // units - nalUnits = [].concat.apply([], frames).concat(frameCache); - frameCache = []; - return; - } - - frames = [].concat.apply([], gops); - frames.duration = gops.duration; - } - - ensureNextFrameIsKeyFrame = false; - } - - if (segmentStartPts === null) { - segmentStartPts = frames[0].pts; - segmentEndPts = segmentStartPts; - } - - segmentEndPts += frames.duration; - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - - for (i = 0; i < frames.length; i++) { - var frame = frames[i]; - track.samples = frameUtils.generateSampleTableForFrame(frame); - var mdat = mp4Generator.mdat(frameUtils.concatenateNalDataForFrame(frame)); - trackDecodeInfo.clearDtsInfo(track); - trackDecodeInfo.collectDtsInfo(track, frame); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - var moof = mp4Generator.moof(sequenceNumber, [track]); - sequenceNumber++; - track.initSegment = mp4Generator.initSegment([track]); - var boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes, - sequence: sequenceNumber, - videoFrameDts: frame.dts, - videoFramePts: frame.pts - }); - } - - nalUnits = []; - }; - - this.resetTimingAndConfig_ = function () { - config = undefined; - pps = undefined; - segmentStartPts = null; - segmentEndPts = null; - }; - - this.partialFlush = function () { - this.processNals_(true); - this.trigger('partialdone', 'VideoSegmentStream'); - }; - - this.flush = function () { - this.processNals_(false); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - this.resetTimingAndConfig_(); - this.trigger('done', 'VideoSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetTimingAndConfig_(); - frameCache = []; - nalUnits = []; - ensureNextFrameIsKeyFrame = true; - this.trigger('reset'); - }; - }; - - VideoSegmentStream.prototype = new stream(); - var videoSegmentStream = VideoSegmentStream; - - var isLikelyAacData$2 = utils.isLikelyAacData; - - var createPipeline = function createPipeline(object) { - object.prototype = new stream(); - object.prototype.init.call(object); - return object; - }; - - var tsPipeline = function tsPipeline(options) { - var pipeline = { - type: 'ts', - tracks: { - audio: null, - video: null - }, - packet: new m2ts_1.TransportPacketStream(), - parse: new m2ts_1.TransportParseStream(), - elementary: new m2ts_1.ElementaryStream(), - timestampRollover: new m2ts_1.TimestampRolloverStream(), - adts: new codecs.Adts(), - h264: new codecs.h264.H264Stream(), - captionStream: new m2ts_1.CaptionStream(options), - metadataStream: new m2ts_1.MetadataStream() - }; - pipeline.headOfPipeline = pipeline.packet; // Transport Stream - - pipeline.packet.pipe(pipeline.parse).pipe(pipeline.elementary).pipe(pipeline.timestampRollover); // H264 - - pipeline.timestampRollover.pipe(pipeline.h264); // Hook up CEA-608/708 caption stream - - pipeline.h264.pipe(pipeline.captionStream); - pipeline.timestampRollover.pipe(pipeline.metadataStream); // ADTS - - pipeline.timestampRollover.pipe(pipeline.adts); - pipeline.elementary.on('data', function (data) { - if (data.type !== 'metadata') { - return; - } - - for (var i = 0; i < data.tracks.length; i++) { - if (!pipeline.tracks[data.tracks[i].type]) { - pipeline.tracks[data.tracks[i].type] = data.tracks[i]; - pipeline.tracks[data.tracks[i].type].timelineStartInfo.baseMediaDecodeTime = options.baseMediaDecodeTime; - } - } - - if (pipeline.tracks.video && !pipeline.videoSegmentStream) { - pipeline.videoSegmentStream = new videoSegmentStream(pipeline.tracks.video, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - if (pipeline.tracks.audio && !options.keepOriginalTimestamps) { - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - options.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'videoTimingInfo')); - pipeline.videoSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'video', - data: data - }); - }); - pipeline.videoSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.videoSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.videoSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.h264.pipe(pipeline.videoSegmentStream); - } - - if (pipeline.tracks.audio && !pipeline.audioSegmentStream) { - pipeline.audioSegmentStream = new audioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); - pipeline.adts.pipe(pipeline.audioSegmentStream); - } // emit pmt info - - - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); - pipeline.captionStream.on('data', function (caption) { - var timelineStartPts; - - if (pipeline.tracks.video) { - timelineStartPts = pipeline.tracks.video.timelineStartInfo.pts || 0; - } else { - // This will only happen if we encounter caption packets before - // video data in a segment. This is an unusual/unlikely scenario, - // so we assume the timeline starts at zero for now. - timelineStartPts = 0; - } // Translate caption PTS times into second offsets into the - // video timeline for the segment - - - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, options.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, options.keepOriginalTimestamps); - pipeline.trigger('caption', caption); - }); - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; - }; - - var aacPipeline = function aacPipeline(options) { - var pipeline = { - type: 'aac', - tracks: { - audio: null - }, - metadataStream: new m2ts_1.MetadataStream(), - aacStream: new aac(), - audioRollover: new m2ts_1.TimestampRolloverStream('audio'), - timedMetadataRollover: new m2ts_1.TimestampRolloverStream('timed-metadata'), - adtsStream: new adts(true) - }; // set up the parsing pipeline - - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioRollover).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataRollover).pipe(pipeline.metadataStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - pipeline.tracks.audio = pipeline.tracks.audio || { - timelineStartInfo: { - baseMediaDecodeTime: options.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.audioSegmentStream = new audioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream); - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); // set the pipeline up as a stream before binding to get access to the trigger function - - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; - }; - - var setupPipelineListeners = function setupPipelineListeners(pipeline, transmuxer) { - pipeline.on('data', transmuxer.trigger.bind(transmuxer, 'data')); - pipeline.on('done', transmuxer.trigger.bind(transmuxer, 'done')); - pipeline.on('partialdone', transmuxer.trigger.bind(transmuxer, 'partialdone')); - pipeline.on('endedtimeline', transmuxer.trigger.bind(transmuxer, 'endedtimeline')); - pipeline.on('audioTimingInfo', transmuxer.trigger.bind(transmuxer, 'audioTimingInfo')); - pipeline.on('videoTimingInfo', transmuxer.trigger.bind(transmuxer, 'videoTimingInfo')); - pipeline.on('trackinfo', transmuxer.trigger.bind(transmuxer, 'trackinfo')); - pipeline.on('id3Frame', function (event) { - // add this to every single emitted segment even though it's only needed for the first - event.dispatchType = pipeline.metadataStream.dispatchType; // keep original time, can be adjusted if needed at a higher level - - event.cueTime = clock.videoTsToSeconds(event.pts); - transmuxer.trigger('id3Frame', event); - }); - pipeline.on('caption', function (event) { - transmuxer.trigger('caption', event); - }); - }; - - var Transmuxer = function Transmuxer(options) { - var pipeline = null, - hasFlushed = true; - options = options || {}; - Transmuxer.prototype.init.call(this); - options.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - - this.push = function (bytes) { - if (hasFlushed) { - var isAac = isLikelyAacData$2(bytes); - - if (isAac && (!pipeline || pipeline.type !== 'aac')) { - pipeline = aacPipeline(options); - setupPipelineListeners(pipeline, this); - } else if (!isAac && (!pipeline || pipeline.type !== 'ts')) { - pipeline = tsPipeline(options); - setupPipelineListeners(pipeline, this); - } - - hasFlushed = false; - } - - pipeline.headOfPipeline.push(bytes); - }; - - this.flush = function () { - if (!pipeline) { - return; - } - - hasFlushed = true; - pipeline.headOfPipeline.flush(); - }; - - this.partialFlush = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.partialFlush(); - }; - - this.endTimeline = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.reset(); - }; - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - if (!options.keepOriginalTimestamps) { - options.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (!pipeline) { - return; - } - - if (pipeline.tracks.audio) { - pipeline.tracks.audio.timelineStartInfo.dts = undefined; - pipeline.tracks.audio.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(pipeline.tracks.audio); - - if (pipeline.audioRollover) { - pipeline.audioRollover.discontinuity(); - } - } - - if (pipeline.tracks.video) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - pipeline.tracks.video.timelineStartInfo.dts = undefined; - pipeline.tracks.video.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(pipeline.tracks.video); // pipeline.captionStream.reset(); - } - - if (pipeline.timestampRollover) { - pipeline.timestampRollover.discontinuity(); - } - }; - - this.setRemux = function (val) { - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.setAudioAppendStart = function (audioAppendStart) { - if (!pipeline || !pipeline.tracks.audio || !pipeline.audioSegmentStream) { - return; - } - - pipeline.audioSegmentStream.setAudioAppendStart(audioAppendStart); - }; // TODO GOP alignment support - // Support may be a bit trickier than with full segment appends, as GOPs may be split - // and processed in a more granular fashion - - - this.alignGopsWith = function (gopsToAlignWith) { - return; - }; - }; - - Transmuxer.prototype = new stream(); - var transmuxer$2 = Transmuxer; - - var partial = { - Transmuxer: transmuxer$2 - }; - - var MAX_UINT32 = Math.pow(2, 32); - - var parseSidx = function parseSidx(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - references: [], - referenceId: view.getUint32(4), - timescale: view.getUint32(8) - }, - i = 12; - - if (result.version === 0) { - result.earliestPresentationTime = view.getUint32(i); - result.firstOffset = view.getUint32(i + 4); - i += 8; - } else { - // read 64 bits - result.earliestPresentationTime = view.getUint32(i) * MAX_UINT32 + view.getUint32(i + 4); - result.firstOffset = view.getUint32(i + 8) * MAX_UINT32 + view.getUint32(i + 12); - i += 16; - } - - i += 2; // reserved - - var referenceCount = view.getUint16(i); - i += 2; // start of references - - for (; referenceCount > 0; i += 12, referenceCount--) { - result.references.push({ - referenceType: (data[i] & 0x80) >>> 7, - referencedSize: view.getUint32(i) & 0x7FFFFFFF, - subsegmentDuration: view.getUint32(i + 4), - startsWithSap: !!(data[i + 8] & 0x80), - sapType: (data[i + 8] & 0x70) >>> 4, - sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF - }); - } - - return result; - }; - - var parseSidx_1 = parseSidx; - - var MAX_UINT32$1 = Math.pow(2, 32); - - var inspectMp4, - _textifyMp, - parseMp4Date = function parseMp4Date(seconds) { - return new Date(seconds * 1000 - 2082844800000); - }, - nalParse = function nalParse(avcStream) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - i, - length; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - result.push('MALFORMED DATA'); - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x01: - result.push('slice_layer_without_partitioning_rbsp'); - break; - - case 0x05: - result.push('slice_layer_without_partitioning_rbsp_idr'); - break; - - case 0x06: - result.push('sei_rbsp'); - break; - - case 0x07: - result.push('seq_parameter_set_rbsp'); - break; - - case 0x08: - result.push('pic_parameter_set_rbsp'); - break; - - case 0x09: - result.push('access_unit_delimiter_rbsp'); - break; - - default: - result.push('UNKNOWN NAL - ' + avcStream[i] & 0x1F); - break; - } - } - - return result; - }, - // registry of handlers for individual mp4 box types - parse = { - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - avc1: function avc1(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - dataReferenceIndex: view.getUint16(6), - width: view.getUint16(24), - height: view.getUint16(26), - horizresolution: view.getUint16(28) + view.getUint16(30) / 16, - vertresolution: view.getUint16(32) + view.getUint16(34) / 16, - frameCount: view.getUint16(40), - depth: view.getUint16(74), - config: inspectMp4(data.subarray(78, data.byteLength)) - }; - }, - avcC: function avcC(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - configurationVersion: data[0], - avcProfileIndication: data[1], - profileCompatibility: data[2], - avcLevelIndication: data[3], - lengthSizeMinusOne: data[4] & 0x03, - sps: [], - pps: [] - }, - numOfSequenceParameterSets = data[5] & 0x1f, - numOfPictureParameterSets, - nalSize, - offset, - i; // iterate past any SPSs - - offset = 6; - - for (i = 0; i < numOfSequenceParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.sps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } // iterate past any PPSs - - - numOfPictureParameterSets = data[offset]; - offset++; - - for (i = 0; i < numOfPictureParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.pps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } - - return result; - }, - btrt: function btrt(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - bufferSizeDB: view.getUint32(0), - maxBitrate: view.getUint32(4), - avgBitrate: view.getUint32(8) - }; - }, - edts: function edts(data) { - return { - boxes: inspectMp4(data) - }; - }, - elst: function elst(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - edits: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; entryCount--) { - if (result.version === 0) { - result.edits.push({ - segmentDuration: view.getUint32(i), - mediaTime: view.getInt32(i + 4), - mediaRate: view.getUint16(i + 8) + view.getUint16(i + 10) / (256 * 256) - }); - i += 12; - } else { - result.edits.push({ - segmentDuration: view.getUint32(i) * MAX_UINT32$1 + view.getUint32(i + 4), - mediaTime: view.getUint32(i + 8) * MAX_UINT32$1 + view.getUint32(i + 12), - mediaRate: view.getUint16(i + 16) + view.getUint16(i + 18) / (256 * 256) - }); - i += 20; - } - } - - return result; - }, - esds: function esds(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - esId: data[6] << 8 | data[7], - streamPriority: data[8] & 0x1f, - decoderConfig: { - objectProfileIndication: data[11], - streamType: data[12] >>> 2 & 0x3f, - bufferSize: data[13] << 16 | data[14] << 8 | data[15], - maxBitrate: data[16] << 24 | data[17] << 16 | data[18] << 8 | data[19], - avgBitrate: data[20] << 24 | data[21] << 16 | data[22] << 8 | data[23], - decoderConfigDescriptor: { - tag: data[24], - length: data[25], - audioObjectType: data[26] >>> 3 & 0x1f, - samplingFrequencyIndex: (data[26] & 0x07) << 1 | data[27] >>> 7 & 0x01, - channelConfiguration: data[27] >>> 3 & 0x0f - } - } - }; - }, - ftyp: function ftyp(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - majorBrand: parseType_1(data.subarray(0, 4)), - minorVersion: view.getUint32(4), - compatibleBrands: [] - }, - i = 8; - - while (i < data.byteLength) { - result.compatibleBrands.push(parseType_1(data.subarray(i, i + 4))); - i += 4; - } - - return result; - }, - dinf: function dinf(data) { - return { - boxes: inspectMp4(data) - }; - }, - dref: function dref(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - dataReferences: inspectMp4(data.subarray(8)) - }; - }, - hdlr: function hdlr(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - handlerType: parseType_1(data.subarray(8, 12)), - name: '' - }, - i = 8; // parse out the name field - - for (i = 24; i < data.byteLength; i++) { - if (data[i] === 0x00) { - // the name field is null-terminated - i++; - break; - } - - result.name += String.fromCharCode(data[i]); - } // decode UTF-8 to javascript's internal representation - // see http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html - - - result.name = decodeURIComponent(escape(result.name)); - return result; - }, - mdat: function mdat(data) { - return { - byteLength: data.byteLength, - nals: nalParse(data) - }; - }, - mdhd: function mdhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - language, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - language: '' - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // language is stored as an ISO-639-2/T code in an array of three 5-bit fields - // each field is the packed difference between its ASCII value and 0x60 - - language = view.getUint16(i); - result.language += String.fromCharCode((language >> 10) + 0x60); - result.language += String.fromCharCode(((language & 0x03e0) >> 5) + 0x60); - result.language += String.fromCharCode((language & 0x1f) + 0x60); - return result; - }, - mdia: function mdia(data) { - return { - boxes: inspectMp4(data) - }; - }, - mfhd: function mfhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sequenceNumber: data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7] - }; - }, - minf: function minf(data) { - return { - boxes: inspectMp4(data) - }; - }, - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - mp4a: function mp4a(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - // 6 bytes reserved - dataReferenceIndex: view.getUint16(6), - // 4 + 4 bytes reserved - channelcount: view.getUint16(16), - samplesize: view.getUint16(18), - // 2 bytes pre_defined - // 2 bytes reserved - samplerate: view.getUint16(24) + view.getUint16(26) / 65536 - }; // if there are more bytes to process, assume this is an ISO/IEC - // 14496-14 MP4AudioSampleEntry and parse the ESDBox - - if (data.byteLength > 28) { - result.streamDescriptor = inspectMp4(data.subarray(28))[0]; - } - - return result; - }, - moof: function moof(data) { - return { - boxes: inspectMp4(data) - }; - }, - moov: function moov(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvex: function mvex(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvhd: function mvhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // convert fixed-point, base 16 back to a number - - result.rate = view.getUint16(i) + view.getUint16(i + 2) / 16; - i += 4; - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - i += 2 * 4; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - i += 6 * 4; - result.nextTrackId = view.getUint32(i); - return result; - }, - pdin: function pdin(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - rate: view.getUint32(4), - initialDelay: view.getUint32(8) - }; - }, - sdtp: function sdtp(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - i; - - for (i = 4; i < data.byteLength; i++) { - result.samples.push({ - dependsOn: (data[i] & 0x30) >> 4, - isDependedOn: (data[i] & 0x0c) >> 2, - hasRedundancy: data[i] & 0x03 - }); - } - - return result; - }, - sidx: parseSidx_1, - smhd: function smhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - balance: data[4] + data[5] / 256 - }; - }, - stbl: function stbl(data) { - return { - boxes: inspectMp4(data) - }; - }, - ctts: function ctts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - compositionOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.compositionOffsets.push({ - sampleCount: view.getUint32(i), - sampleOffset: view[result.version === 0 ? 'getUint32' : 'getInt32'](i + 4) - }); - } - - return result; - }, - stss: function stss(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - syncSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.syncSamples.push(view.getUint32(i)); - } - - return result; - }, - stco: function stco(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - chunkOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.chunkOffsets.push(view.getUint32(i)); - } - - return result; - }, - stsc: function stsc(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - entryCount = view.getUint32(4), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleToChunks: [] - }, - i; - - for (i = 8; entryCount; i += 12, entryCount--) { - result.sampleToChunks.push({ - firstChunk: view.getUint32(i), - samplesPerChunk: view.getUint32(i + 4), - sampleDescriptionIndex: view.getUint32(i + 8) - }); - } - - return result; - }, - stsd: function stsd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleDescriptions: inspectMp4(data.subarray(8)) - }; - }, - stsz: function stsz(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleSize: view.getUint32(4), - entries: [] - }, - i; - - for (i = 12; i < data.byteLength; i += 4) { - result.entries.push(view.getUint32(i)); - } - - return result; - }, - stts: function stts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - timeToSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.timeToSamples.push({ - sampleCount: view.getUint32(i), - sampleDelta: view.getUint32(i + 4) - }); - } - - return result; - }, - styp: function styp(data) { - return parse.ftyp(data); - }, - tfdt: parseTfdt, - tfhd: parseTfhd, - tkhd: function tkhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; - i += 2 * 4; - result.layer = view.getUint16(i); - i += 2; - result.alternateGroup = view.getUint16(i); - i += 2; // convert fixed-point, base 16 back to a number - - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - result.width = view.getUint16(i) + view.getUint16(i + 2) / 65536; - i += 4; - result.height = view.getUint16(i) + view.getUint16(i + 2) / 65536; - return result; - }, - traf: function traf(data) { - return { - boxes: inspectMp4(data) - }; - }, - trak: function trak(data) { - return { - boxes: inspectMp4(data) - }; - }, - trex: function trex(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4), - defaultSampleDescriptionIndex: view.getUint32(8), - defaultSampleDuration: view.getUint32(12), - defaultSampleSize: view.getUint32(16), - sampleDependsOn: data[20] & 0x03, - sampleIsDependedOn: (data[21] & 0xc0) >> 6, - sampleHasRedundancy: (data[21] & 0x30) >> 4, - samplePaddingValue: (data[21] & 0x0e) >> 1, - sampleIsDifferenceSample: !!(data[21] & 0x01), - sampleDegradationPriority: view.getUint16(22) - }; - }, - trun: parseTrun, - 'url ': function url(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - }, - vmhd: function vmhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - graphicsmode: view.getUint16(4), - opcolor: new Uint16Array([view.getUint16(6), view.getUint16(8), view.getUint16(10)]) - }; - } - }; - /** - * Return a javascript array of box objects parsed from an ISO base - * media file. - * @param data {Uint8Array} the binary data of the media to be inspected - * @return {array} a javascript array of potentially nested box objects - */ - - - inspectMp4 = function inspectMp4(data) { - var i = 0, - result = [], - view, - size, - type, - end, - box; // Convert data from Uint8Array to ArrayBuffer, to follow Dataview API - - var ab = new ArrayBuffer(data.length); - var v = new Uint8Array(ab); - - for (var z = 0; z < data.length; ++z) { - v[z] = data[z]; - } - - view = new DataView(ab); - - while (i < data.byteLength) { - // parse box data - size = view.getUint32(i); - type = parseType_1(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; // parse type-specific data - - box = (parse[type] || function (data) { - return { - data: data - }; - })(data.subarray(i + 8, end)); - - box.size = size; - box.type = type; // store this box and move to the next - - result.push(box); - i = end; - } - - return result; - }; - /** - * Returns a textual representation of the javascript represtentation - * of an MP4 file. You can use it as an alternative to - * JSON.stringify() to compare inspected MP4s. - * @param inspectedMp4 {array} the parsed array of boxes in an MP4 - * file - * @param depth {number} (optional) the number of ancestor boxes of - * the elements of inspectedMp4. Assumed to be zero if unspecified. - * @return {string} a text representation of the parsed MP4 - */ - - - _textifyMp = function textifyMp4(inspectedMp4, depth) { - var indent; - depth = depth || 0; - indent = new Array(depth * 2 + 1).join(' '); // iterate over all the boxes - - return inspectedMp4.map(function (box, index) { - // list the box type first at the current indentation level - return indent + box.type + '\n' + // the type is already included and handle child boxes separately - Object.keys(box).filter(function (key) { - return key !== 'type' && key !== 'boxes'; // output all the box properties - }).map(function (key) { - var prefix = indent + ' ' + key + ': ', - value = box[key]; // print out raw bytes as hexademical - - if (value instanceof Uint8Array || value instanceof Uint32Array) { - var bytes = Array.prototype.slice.call(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)).map(function (byte) { - return ' ' + ('00' + byte.toString(16)).slice(-2); - }).join('').match(/.{1,24}/g); - - if (!bytes) { - return prefix + '<>'; - } - - if (bytes.length === 1) { - return prefix + '<' + bytes.join('').slice(1) + '>'; - } - - return prefix + '<\n' + bytes.map(function (line) { - return indent + ' ' + line; - }).join('\n') + '\n' + indent + ' >'; - } // stringify generic objects - - - return prefix + JSON.stringify(value, null, 2).split('\n').map(function (line, index) { - if (index === 0) { - return line; - } - - return indent + ' ' + line; - }).join('\n'); - }).join('\n') + ( // recursively textify the child boxes - box.boxes ? '\n' + _textifyMp(box.boxes, depth + 1) : ''); - }).join('\n'); - }; - - var mp4Inspector = { - inspect: inspectMp4, - textify: _textifyMp, - parseType: parseType_1, - findBox: findBox_1, - parseTraf: parse.traf, - parseTfdt: parse.tfdt, - parseHdlr: parse.hdlr, - parseTfhd: parse.tfhd, - parseTrun: parse.trun, - parseSidx: parse.sidx - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var tagTypes = { - 0x08: 'audio', - 0x09: 'video', - 0x12: 'metadata' - }, - hex = function hex(val) { - return '0x' + ('00' + val.toString(16)).slice(-2).toUpperCase(); - }, - hexStringList = function hexStringList(data) { - var arr = [], - i; - - while (data.byteLength > 0) { - i = 0; - arr.push(hex(data[i++])); - data = data.subarray(i); - } - - return arr.join(' '); - }, - parseAVCTag = function parseAVCTag(tag, obj) { - var avcPacketTypes = ['AVC Sequence Header', 'AVC NALU', 'AVC End-of-Sequence'], - compositionTime = tag[1] & parseInt('01111111', 2) << 16 | tag[2] << 8 | tag[3]; - obj = obj || {}; - obj.avcPacketType = avcPacketTypes[tag[0]]; - obj.CompositionTime = tag[1] & parseInt('10000000', 2) ? -compositionTime : compositionTime; - - if (tag[0] === 1) { - obj.nalUnitTypeRaw = hexStringList(tag.subarray(4, 100)); - } else { - obj.data = hexStringList(tag.subarray(4)); - } - - return obj; - }, - parseVideoTag = function parseVideoTag(tag, obj) { - var frameTypes = ['Unknown', 'Keyframe (for AVC, a seekable frame)', 'Inter frame (for AVC, a nonseekable frame)', 'Disposable inter frame (H.263 only)', 'Generated keyframe (reserved for server use only)', 'Video info/command frame'], - codecID = tag[0] & parseInt('00001111', 2); - obj = obj || {}; - obj.frameType = frameTypes[(tag[0] & parseInt('11110000', 2)) >>> 4]; - obj.codecID = codecID; - - if (codecID === 7) { - return parseAVCTag(tag.subarray(1), obj); - } - - return obj; - }, - parseAACTag = function parseAACTag(tag, obj) { - var packetTypes = ['AAC Sequence Header', 'AAC Raw']; - obj = obj || {}; - obj.aacPacketType = packetTypes[tag[0]]; - obj.data = hexStringList(tag.subarray(1)); - return obj; - }, - parseAudioTag = function parseAudioTag(tag, obj) { - var formatTable = ['Linear PCM, platform endian', 'ADPCM', 'MP3', 'Linear PCM, little endian', 'Nellymoser 16-kHz mono', 'Nellymoser 8-kHz mono', 'Nellymoser', 'G.711 A-law logarithmic PCM', 'G.711 mu-law logarithmic PCM', 'reserved', 'AAC', 'Speex', 'MP3 8-Khz', 'Device-specific sound'], - samplingRateTable = ['5.5-kHz', '11-kHz', '22-kHz', '44-kHz'], - soundFormat = (tag[0] & parseInt('11110000', 2)) >>> 4; - obj = obj || {}; - obj.soundFormat = formatTable[soundFormat]; - obj.soundRate = samplingRateTable[(tag[0] & parseInt('00001100', 2)) >>> 2]; - obj.soundSize = (tag[0] & parseInt('00000010', 2)) >>> 1 ? '16-bit' : '8-bit'; - obj.soundType = tag[0] & parseInt('00000001', 2) ? 'Stereo' : 'Mono'; - - if (soundFormat === 10) { - return parseAACTag(tag.subarray(1), obj); - } - - return obj; - }, - parseGenericTag = function parseGenericTag(tag) { - return { - tagType: tagTypes[tag[0]], - dataSize: tag[1] << 16 | tag[2] << 8 | tag[3], - timestamp: tag[7] << 24 | tag[4] << 16 | tag[5] << 8 | tag[6], - streamID: tag[8] << 16 | tag[9] << 8 | tag[10] - }; - }, - inspectFlvTag = function inspectFlvTag(tag) { - var header = parseGenericTag(tag); - - switch (tag[0]) { - case 0x08: - parseAudioTag(tag.subarray(11), header); - break; - - case 0x09: - parseVideoTag(tag.subarray(11), header); - break; - } - - return header; - }, - inspectFlv = function inspectFlv(bytes) { - var i = 9, - // header - dataSize, - parsedResults = [], - tag; // traverse the tags - - i += 4; // skip previous tag size - - while (i < bytes.byteLength) { - dataSize = bytes[i + 1] << 16; - dataSize |= bytes[i + 2] << 8; - dataSize |= bytes[i + 3]; - dataSize += 11; - tag = bytes.subarray(i, i + dataSize); - parsedResults.push(inspectFlvTag(tag)); - i += dataSize + 4; - } - - return parsedResults; - }, - textifyFlv = function textifyFlv(flvTagArray) { - return JSON.stringify(flvTagArray, null, 2); - }; - - var flvInspector = { - inspectTag: inspectFlvTag, - inspect: inspectFlv, - textify: textifyFlv - }; - - var parsePid = function parsePid(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; - }; - - var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) { - return !!(packet[1] & 0x40); - }; - - var parseAdaptionField = function parseAdaptionField(packet) { - var offset = 0; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[4] + 1; - } - - return offset; - }; - - var parseType$2 = function parseType(packet, pmtPid) { - var pid = parsePid(packet); - - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - - return null; - }; - - var parsePat = function parsePat(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; - }; - - var parsePmt = function parsePmt(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section - - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table - - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type - - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry - // skip past the elementary stream descriptors, if present - - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - - return programMapTable; - }; - - var parsePesType = function parsePesType(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - return 'video'; - - case streamTypes.ADTS_STREAM_TYPE: - return 'audio'; - - case streamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - - default: - return null; - } - }; - - var parsePesTime = function parsePesTime(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - pes = {}; // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - - pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - - return pes; - }; - - var parseNalUnitType = function parseNalUnitType(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - - case 0x06: - return 'sei_rbsp'; - - case 0x07: - return 'seq_parameter_set_rbsp'; - - case 0x08: - return 'pic_parameter_set_rbsp'; - - case 0x09: - return 'access_unit_delimiter_rbsp'; - - default: - return null; - } - }; - - var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; // advance the sync point to a NAL start, if necessary - - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } // drop trailing zeroes - - - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; // parse the final nal - - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; - }; - - var probe$1 = { - parseType: parseType$2, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame - }; - - var handleRollover$1 = timestampRolloverStream.handleRollover; - var probe$2 = {}; - probe$2.ts = probe$1; - probe$2.aac = utils; - var ONE_SECOND_IN_TS$5 = clock.ONE_SECOND_IN_TS; - var MP2T_PACKET_LENGTH$1 = 188, - // bytes - SYNC_BYTE$1 = 0x47; - /** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ - - var parsePsi_ = function parsePsi_(bytes, pmt) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH$1, - packet, - type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE$1 && bytes[endIndex] === SYNC_BYTE$1) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe$2.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe$2.ts.parsePat(packet); - break; - - case 'pmt': - var table = probe$2.ts.parsePmt(packet); - pmt.table = pmt.table || {}; - Object.keys(table).forEach(function (key) { - pmt.table[key] = table[key]; - }); - break; - } - - startIndex += MP2T_PACKET_LENGTH$1; - endIndex += MP2T_PACKET_LENGTH$1; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ - - - var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH$1, - packet, - type, - pesType, - pusi, - parsed; - var endLoop = false; // Start walking from start of segment to get first audio packet - - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE$1 && (bytes[endIndex] === SYNC_BYTE$1 || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe$2.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe$2.ts.parsePesType(packet, pmt.table); - pusi = probe$2.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe$2.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH$1; - endIndex += MP2T_PACKET_LENGTH$1; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last audio packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH$1; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE$1 && (bytes[endIndex] === SYNC_BYTE$1 || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe$2.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe$2.ts.parsePesType(packet, pmt.table); - pusi = probe$2.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe$2.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH$1; - endIndex -= MP2T_PACKET_LENGTH$1; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ - - - var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH$1, - packet, - type, - pesType, - pusi, - parsed, - frame, - i, - pes; - var endLoop = false; - var currentFrame = { - data: [], - size: 0 - }; // Start walking from start of segment to get first video packet - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE$1 && bytes[endIndex] === SYNC_BYTE$1) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe$2.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe$2.ts.parsePesType(packet, pmt.table); - pusi = probe$2.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe$2.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - - if (probe$2.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe$2.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn('Failed to extract PTS/DTS from PES at first keyframe. ' + 'This could be an unusual TS segment, or else mux.js did not ' + 'parse your TS segment correctly. If you know your TS ' + 'segments do contain PTS/DTS on keyframes please file a bug ' + 'report! You can try ffprobe to double check for yourself.'); - } - } - - currentFrame.size = 0; - } - } - - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH$1; - endIndex += MP2T_PACKET_LENGTH$1; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last video packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH$1; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE$1 && bytes[endIndex] === SYNC_BYTE$1) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe$2.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe$2.ts.parsePesType(packet, pmt.table); - pusi = probe$2.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video' && pusi) { - parsed = probe$2.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH$1; - endIndex -= MP2T_PACKET_LENGTH$1; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ - - - var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - - segmentInfo.audio.forEach(function (info) { - info.dts = handleRollover$1(info.dts, audioBaseTimestamp); - info.pts = handleRollover$1(info.pts, audioBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS$5; - info.ptsTime = info.pts / ONE_SECOND_IN_TS$5; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - - segmentInfo.video.forEach(function (info) { - info.dts = handleRollover$1(info.dts, videoBaseTimestamp); - info.pts = handleRollover$1(info.pts, videoBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS$5; - info.ptsTime = info.pts / ONE_SECOND_IN_TS$5; - }); - - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover$1(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover$1(frame.pts, videoBaseTimestamp); // time in seconds - - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS$5; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS$5; - } - } - }; - /** - * inspects the aac data stream for start and end time information - */ - - - var inspectAac_ = function inspectAac_(bytes) { - var endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe$2.aac.parseType(bytes, byteIndex); - - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe$2.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe$2.aac.parseAacTimestamp(packet); - } - - byteIndex += frameSize; - break; - - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe$2.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe$2.aac.parseSampleRate(packet); - } - - audioCount++; - byteIndex += frameSize; - break; - - default: - byteIndex++; - break; - } - - if (endLoop) { - return null; - } - } - - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS$5 / sampleRate; - var result = { - audio: [{ - type: 'audio', - dts: timestamp, - pts: timestamp - }, { - type: 'audio', - dts: timestamp + audioCount * 1024 * audioTimescale, - pts: timestamp + audioCount * 1024 * audioTimescale - }] - }; - return result; - }; - /** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ - - - var inspectTs_ = function inspectTs_(bytes) { - var pmt = { - pid: null, - table: null - }; - var result = {}; - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - - if (result.video.length === 0) { - delete result.video; - } - - break; - - case streamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - - if (result.audio.length === 0) { - delete result.audio; - } - - break; - } - } - } - - return result; - }; - /** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ - - - var inspect = function inspect(bytes, baseTimestamp) { - var isAacData = probe$2.aac.isLikelyAacData(bytes); - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || !result.audio && !result.video) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - return result; - }; - - var tsInspector = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ - }; - - var muxjs = { - codecs: codecs, - mp4: mp4, - flv: flv, - mp2t: m2ts$1, - partial: partial - }; // include all the tools when the full library is required - - muxjs.mp4.tools = mp4Inspector; - muxjs.flv.tools = flvInspector; - muxjs.mp2t.tools = tsInspector; - var lib = muxjs; - - return lib; - -}))); diff --git a/node_modules/mux.js/dist/mux.min.js b/node_modules/mux.js/dist/mux.min.js deleted file mode 100644 index 3d05b2d..0000000 --- a/node_modules/mux.js/dist/mux.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name mux.js @version 5.11.1 @license Apache-2.0 */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e()}(this,(function(){"use strict";var t=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var n;return!!t[e]&&(n=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(n,1),n>-1)},this.trigger=function(e){var i,n,a,r;if(i=t[e])if(2===arguments.length)for(a=i.length,n=0;n>5,h=(d=1024*(1+(3&e[p+6])))*g/y[(60&e[p+2])>>>2],s=p+a,e.byteLength>>6&3),channelcount:(1&e[p+2])<<2|(192&e[p+3])>>>6,samplerate:y[(60&e[p+2])>>>2],samplingfrequencyindex:(60&e[p+2])>>>2,samplesize:16,data:e.subarray(p+7+r,s)}),i++,e.byteLength===s)return void(e=void 0);e=e.subarray(s)}else p++},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new d;var b,v,S,w=p,T=function(t){var e=t.byteLength,i=0,n=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+n},this.loadWord=function(){var a=t.byteLength-e,r=new Uint8Array(4),s=Math.min(4,e);if(0===s)throw new Error("no bytes available");r.set(t.subarray(a,a+s)),i=new DataView(r.buffer).getUint32(0),n=8*s,e-=s},this.skipBits=function(t){var a;n>t?(i<<=t,n-=t):(t-=n,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,n-=t)},this.readBits=function(t){var a=Math.min(n,t),r=i>>>32-a;return(n-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?r<>>t))return i<<=t,n-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(v=function(){var t,e,i=0;v.prototype.init.call(this),this.push=function(n){var a;e?((a=new Uint8Array(e.byteLength+n.data.byteLength)).set(e),a.set(n.data,e.byteLength),e=a):e=n.data;for(var r=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new d,S={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(b=function(){var t,e,i,n,a,r,s,o=new v;b.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,n=t.dts,o.push(t))},o.on("data",(function(s){var o={trackId:e,pts:i,dts:n,data:s};switch(31&s[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(s.subarray(1)),o.config=r(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(t,e){var i,n=8,a=8;for(i=0;i>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},B=function(t){return _(j.hdlr,Z[t])},R=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(e[12]=t.samplerate>>>24&255,e[13]=t.samplerate>>>16&255,e[14]=t.samplerate>>>8&255,e[15]=255&t.samplerate),_(j.mdhd,e)},E=function(t){return _(j.mdia,R(t),B(t.type),D(t))},C=function(t){return _(j.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},D=function(t){return _(j.minf,"video"===t.type?_(j.vmhd,$):_(j.smhd,J),k(),F(t))},P=function(t,e){for(var i=[],n=e.length;n--;)i[n]=V(e[n]);return _.apply(null,[j.moof,C(t)].concat(i))},L=function(t){for(var e=t.length,i=[];e--;)i[e]=M(t[e]);return _.apply(null,[j.moov,I(4294967295)].concat(i).concat(O(t)))},O=function(t){for(var e=t.length,i=[];e--;)i[e]=G(t[e]);return _.apply(null,[j.mvex].concat(i))},I=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return _(j.mvhd,e)},z=function(t){var e,i,n=t.samples||[],a=new Uint8Array(4+n.length);for(i=0;i>>8),r.push(255&n[e].byteLength),r=r.concat(Array.prototype.slice.call(n[e]));for(e=0;e>>8),s.push(255&a[e].byteLength),s=s.concat(Array.prototype.slice.call(a[e]));if(i=[j.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),_(j.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([n.length],r,[a.length],s))),_(j.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],t.sarRatio){var o=t.sarRatio[0],d=t.sarRatio[1];i.push(_(j.pasp,new Uint8Array([(4278190080&o)>>24,(16711680&o)>>16,(65280&o)>>8,255&o,(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d])))}return _.apply(null,i)},rt=function(t){return _(j.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),U(t))},x=function(t){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return _(j.tkhd,e)},V=function(t){var e,i,n,a,r,s;return e=_(j.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(t.baseMediaDecodeTime/(ut+1)),s=Math.floor(t.baseMediaDecodeTime%(ut+1)),i=_(j.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,s>>>24&255,s>>>16&255,s>>>8&255,255&s])),92,"audio"===t.type?(n=W(t,92),_(j.traf,e,i,n)):(a=z(t),n=W(t,a.length+92),_(j.traf,e,i,n,a))},M=function(t){return t.duration=t.duration||4294967295,_(j.trak,x(t),E(t))},G=function(t){var e=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(e[e.length-1]=0),_(j.trex,e)},dt=function(t,e){var i=0,n=0,a=0,r=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(a=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,i|n|a|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},ot=function(t,e){var i,n,a,r,s,o;for(e+=20+16*(r=t.samples||[]).length,a=dt(r,e),(n=new Uint8Array(a.length+16*r.length)).set(a),i=a.length,o=0;o>>24,n[i++]=(16711680&s.duration)>>>16,n[i++]=(65280&s.duration)>>>8,n[i++]=255&s.duration,n[i++]=(4278190080&s.size)>>>24,n[i++]=(16711680&s.size)>>>16,n[i++]=(65280&s.size)>>>8,n[i++]=255&s.size,n[i++]=s.flags.isLeading<<2|s.flags.dependsOn,n[i++]=s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,n[i++]=61440&s.flags.degradationPriority,n[i++]=15&s.flags.degradationPriority,n[i++]=(4278190080&s.compositionTimeOffset)>>>24,n[i++]=(16711680&s.compositionTimeOffset)>>>16,n[i++]=(65280&s.compositionTimeOffset)>>>8,n[i++]=255&s.compositionTimeOffset;return _(j.trun,n)},st=function(t,e){var i,n,a,r,s,o;for(e+=20+8*(r=t.samples||[]).length,a=dt(r,e),(i=new Uint8Array(a.length+8*r.length)).set(a),n=a.length,o=0;o>>24,i[n++]=(16711680&s.duration)>>>16,i[n++]=(65280&s.duration)>>>8,i[n++]=255&s.duration,i[n++]=(4278190080&s.size)>>>24,i[n++]=(16711680&s.size)>>>16,i[n++]=(65280&s.size)>>>8,i[n++]=255&s.size;return _(j.trun,i)},W=function(t,e){return"audio"===t.type?st(t,e):ot(t,e)};var lt,ct,ft,mt,gt,yt,bt={ftyp:A=function(){return _(j.ftyp,Y,H,Y,q)},mdat:function(t){return _(j.mdat,t)},moof:P,moov:L,initSegment:function(t){var e,i=A(),n=L(t);return(e=new Uint8Array(i.byteLength+n.byteLength)).set(i),e.set(n,i.byteLength),e}},vt=function(t){return t>>>0},St=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},wt=vt,Tt=function t(e,i){var n,a,r,s,o,d=[];if(!i.length)return null;for(n=0;n1?n+a:e.byteLength,r===i[0]&&(1===i.length?d.push(e.subarray(n+8,s)):(o=t(e.subarray(n+8,s),i.slice(1))).length&&(d=d.concat(o))),n=s;return d},_t=function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},a=1&n.flags[2],r=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],d=32&n.flags[2],h=65536&n.flags[0],p=131072&n.flags[0];return e=8,a&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),r&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),d&&(n.defaultSampleFlags=i.getUint32(e)),h&&(n.durationIsEmpty=!0),!a&&p&&(n.baseDataOffsetIsMoof=!0),n},kt=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},Ut=function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=1&i.flags[2],r=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],d=4&i.flags[1],h=8&i.flags[1],p=n.getUint32(4),u=8;for(a&&(i.dataOffset=n.getInt32(u),u+=4),r&&p&&(e={flags:kt(t.subarray(u,u+4))},u+=4,s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e),p--);p--;)e={},s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),d&&(e.flags=kt(t.subarray(u,u+4)),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e);return i},At=vt,Ct=function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4)),baseMediaDecodeTime:At(t[4]<<24|t[5]<<16|t[6]<<8|t[7])};return 1===e.version&&(e.baseMediaDecodeTime*=Math.pow(2,32),e.baseMediaDecodeTime+=At(t[8]<<24|t[9]<<16|t[10]<<8|t[11])),e},Dt=vt,Pt=function(t){return("00"+t.toString(16)).slice(-2)};lt=function(t){return Tt(t,["moov","trak"]).reduce((function(t,e){var i,n,a,r,s;return(i=Tt(e,["tkhd"])[0])?(n=i[0],r=Dt(i[a=0===n?12:20]<<24|i[a+1]<<16|i[a+2]<<8|i[a+3]),(s=Tt(e,["mdia","mdhd"])[0])?(a=0===(n=s[0])?12:20,t[r]=Dt(s[a]<<24|s[a+1]<<16|s[a+2]<<8|s[a+3]),t):null):null}),{})},ct=function(t,e){var i,n,a;return i=Tt(e,["moof","traf"]),n=[].concat.apply([],i.map((function(e){return Tt(e,["tfhd"]).map((function(i){var n,a,r;return n=Dt(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),a=t[n]||9e4,(r="number"!=typeof(r=Tt(e,["tfdt"]).map((function(t){var e,i;return e=t[0],i=Dt(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),1===e&&(i*=Math.pow(2,32),i+=Dt(t[8]<<24|t[9]<<16|t[10]<<8|t[11])),i}))[0])||isNaN(r)?1/0:r)/a}))}))),a=Math.min.apply(null,n),isFinite(a)?a:0},ft=function(t,e){var i,n=Tt(e,["moof","traf"]),a=0,r=0;if(n&&n.length){var s=Tt(n[0],["tfhd"])[0],o=Tt(n[0],["trun"])[0],d=Tt(n[0],["tfdt"])[0];if(s)i=_t(s).trackId;if(d)a=Ct(d).baseMediaDecodeTime;if(o){var h=Ut(o);h.samples&&h.samples.length&&(r=h.samples[0].compositionTimeOffset||0)}}return(a+r)/(t[i]||9e4)},mt=function(t){var e=Tt(t,["moov","trak"]),i=[];return e.forEach((function(t){var e=Tt(t,["mdia","hdlr"]),n=Tt(t,["tkhd"]);e.forEach((function(t,e){var a,r,s=St(t.subarray(8,12)),o=n[e];"vide"===s&&(r=0===(a=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?a.getUint32(12):a.getUint32(20),i.push(r))}))})),i},gt=function(t){var e=Tt(t,["moov","trak"]),i=[];return e.forEach((function(t){var e,n,a={},r=Tt(t,["tkhd"])[0];r&&(n=(e=new DataView(r.buffer,r.byteOffset,r.byteLength)).getUint8(0),a.id=0===n?e.getUint32(12):e.getUint32(20));var s=Tt(t,["mdia","hdlr"])[0];if(s){var o=St(s.subarray(8,12));a.type="vide"===o?"video":"soun"===o?"audio":o}var d=Tt(t,["mdia","minf","stbl","stsd"])[0];if(d){var h=d.subarray(8);a.codec=St(h.subarray(4,8));var p,u=Tt(h,[a.codec])[0];u&&(/^[a-z]vc[1-9]$/i.test(a.codec)?(p=u.subarray(78),"avcC"===St(p.subarray(4,8))&&p.length>11?(a.codec+=".",a.codec+=Pt(p[9]),a.codec+=Pt(p[10]),a.codec+=Pt(p[11])):a.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(a.codec)?(p=u.subarray(28),"esds"===St(p.subarray(4,8))&&p.length>20&&0!==p[19]?(a.codec+="."+Pt(p[19]),a.codec+="."+Pt(p[20]>>>2&63).replace(/^0/,"")):a.codec="mp4a.40.2"):a.codec=a.codec.toLowerCase())}var l=Tt(t,["mdia","mdhd"])[0];l&&(a.timescale=yt(l)),i.push(a)})),i};var Lt,Ot={findBox:Tt,parseType:St,timescale:lt,startTime:ct,compositionStartTime:ft,videoTrackIds:mt,tracks:gt,getTimescaleFromMediaHeader:yt=function(t){var e=0===t[0]?12:20;return Dt(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])}},It=function(t,e){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=e,i.compositionTimeOffset=t.pts-t.dts,i.duration=t.duration,i.size=4*t.length,i.size+=t.byteLength,t.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},Mt=function(t){var e,i,n=[],a=[];for(a.byteLength=0,a.nalCount=0,a.duration=0,n.byteLength=0,e=0;e1&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},Rt=function(t,e){var i,n,a,r,s,o=e||0,d=[];for(i=0;iu/2))){for((s=Wt()[t.samplerate])||(s=e[0].data),o=0;o=i?t:(e.minSegmentDts=1/0,t.filter((function(t){return t.dts>=i&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)})))},Ht=function(t){var e,i,n=[];for(e=0;e=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},se.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},se.prototype.addText=function(t){this.rows[this.rowIdx]+=t},se.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var oe=function(t){this.serviceNum=t,this.text="",this.currentWindow=new se(-1),this.windows=[]};oe.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new se(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},oe.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]};var de=function t(){t.prototype.init.call(this);var e=this;this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(e.new708Packet(),e.add708Bytes(t)):(null===e.current708Packet&&e.new708Packet(),e.add708Bytes(t))}};de.prototype=new d,de.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},de.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,n=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},de.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,n=null,a=0,r=e[a++];for(t.seq=r>>6,t.sizeCode=63&r;a>5)&&n>0&&(i=r=e[a++]),this.pushServiceBlock(i,a,n),n>0&&(a+=n-1)},de.prototype.pushServiceBlock=function(t,e,i){var n,a=e,r=this.current708Packet.data,s=this.services[t];for(s||(s=this.initService(t,a));a>5,r.rowLock=(16&n)>>4,r.columnLock=(8&n)>>3,r.priority=7&n,n=i[++t],r.relativePositioning=(128&n)>>7,r.anchorVertical=127&n,n=i[++t],r.anchorHorizontal=n,n=i[++t],r.anchorPoint=(240&n)>>4,r.rowCount=15&n,n=i[++t],r.columnCount=63&n,n=i[++t],r.windowStyle=(56&n)>>3,r.penStyle=7&n,r.virtualRowCount=r.rowCount+1,t},de.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.winAttr;return n=i[++t],a.fillOpacity=(192&n)>>6,a.fillRed=(48&n)>>4,a.fillGreen=(12&n)>>2,a.fillBlue=3&n,n=i[++t],a.borderType=(192&n)>>6,a.borderRed=(48&n)>>4,a.borderGreen=(12&n)>>2,a.borderBlue=3&n,n=i[++t],a.borderType+=(128&n)>>5,a.wordWrap=(64&n)>>6,a.printDirection=(48&n)>>4,a.scrollDirection=(12&n)>>2,a.justify=3&n,n=i[++t],a.effectSpeed=(240&n)>>4,a.effectDirection=(12&n)>>2,a.displayEffect=3&n,t},de.prototype.flushDisplayed=function(t,e){for(var i=[],n=0;n<8;n++)e.windows[n].visible&&!e.windows[n].isEmpty()&&i.push(e.windows[n].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},de.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},de.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],n=this.getPts(t);this.flushDisplayed(n,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&n)>>2,a.penSize=3&n,n=i[++t],a.italics=(128&n)>>7,a.underline=(64&n)>>6,a.edgeType=(56&n)>>3,a.fontStyle=7&n,t},de.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penColor;return n=i[++t],a.fgOpacity=(192&n)>>6,a.fgRed=(48&n)>>4,a.fgGreen=(12&n)>>2,a.fgBlue=3&n,n=i[++t],a.bgOpacity=(192&n)>>6,a.bgRed=(48&n)>>4,a.bgGreen=(12&n)>>2,a.bgBlue=3&n,n=i[++t],a.edgeRed=(48&n)>>4,a.edgeGreen=(12&n)>>2,a.edgeBlue=3&n,t},de.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,n=i[++t],a.row=15&n,n=i[++t],a.column=63&n,t},de.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var he={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},pe=function(t){return null===t?"":(t=he[t]||t,String.fromCharCode(t))},ue=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],le=function(){for(var t=[],e=15;e--;)t.push("");return t},ce=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,a,r;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=le();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=le();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=le()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(n,a))r=pe((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(n,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),r=pe((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(n,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,a))this.column_+=3&a;else if(this.isPAC(n,a)){var s=ue.indexOf(7968&e);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(t.pts,s)),s!==this.row_&&(this.clearFormatting(t.pts),this.row_=s),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)&&(this.column_=4*((14&e)>>1)),this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===a&&(a=null),r=pe(n),r+=pe(a),this[this.mode_](t.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};ce.prototype=new d,ce.prototype.flushDisplayed=function(t){var e=this.displayed_.map((function(t){try{return t.trim()}catch(t){return console.error("Skipping malformed caption."),""}})).join("\n").replace(/^\n+|\n+$/g,"");e.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:e,stream:this.name_})},ce.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=le(),this.nonDisplayed_=le(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},ce.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},ce.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},ce.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},ce.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},ce.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},ce.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},ce.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},ce.prototype.isNormalChar=function(t){return t>=32&&t<=127},ce.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=le(),this.displayed_=le()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},ce.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},ce.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_];i+=e,this.nonDisplayed_[this.row_]=i},ce.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_];i+=e,this.displayed_[this.row_]=i},ce.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},be=function t(e){var i,n;t.prototype.init.call(this),this.type_=e||ge,this.push=function(t){this.type_!==ge&&t.type!==this.type_||(void 0===n&&(n=t.dts),t.dts=ye(t.dts,n),t.pts=ye(t.pts,n),i=t.dts,this.trigger("data",t))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};be.prototype=new d;var ve,Se=be,we=ye,Te=function(t,e,i){var n,a="";for(n=e;n>>2;u*=4,u+=3&p[7],d.timeStamp=u,void 0===e.pts&&void 0===e.dts&&(e.pts=d.timeStamp,e.dts=d.timeStamp),this.trigger("timestamp",d)}e.frames.push(d),s+=10,s+=o}while(s>>4>1&&(n+=e[n]+1),0===i.pid)i.type="pat",t(e.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,n,i]):this.processPes_(e,n,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=me.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=me.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new d,Ce.STREAM_TYPES={h264:27,adts:15},(De=function(){var t,e=this,i={data:[],size:0},n={data:[],size:0},a={data:[],size:0},r=function(t,i,n){var a,r,s=new Uint8Array(t.size),o={type:i},d=0,h=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,d=0;d>>3,u.pts*=4,u.pts+=(6&p[13])>>>1,u.dts=u.pts,64&l&&(u.dts=(14&p[14])<<27|(255&p[15])<<20|(254&p[16])<<12|(255&p[17])<<5|(254&p[18])>>>3,u.dts*=4,u.dts+=(6&p[18])>>>1)),u.data=p.subarray(9+p[8])),a="video"===i||o.packetLength<=t.size,(n||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};De.prototype.init.call(this),this.push=function(s){({pat:function(){},pes:function(){var t,e;switch(s.streamType){case me.H264_STREAM_TYPE:t=i,e="video";break;case me.ADTS_STREAM_TYPE:t=n,e="audio";break;case me.METADATA_STREAM_TYPE:t=a,e="timed-metadata";break;default:return}s.payloadUnitStartIndicator&&r(t,e,!0),t.data.push(s),t.size+=s.data.byteLength},pmt:function(){var i={type:"metadata",tracks:[]};null!==(t=s.programMapTable).video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",i)}})[s.type]()},this.reset=function(){i.size=0,i.data.length=0,n.size=0,n.data.length=0,this.trigger("reset")},this.flushStreams_=function(){r(i,"video"),r(n,"audio"),r(a,"timed-metadata")},this.flush=function(){this.flushStreams_(),this.trigger("done")}}).prototype=new d;var Ie={PAT_PID:0,MP2T_PACKET_LENGTH:Oe,TransportPacketStream:Ae,TransportParseStream:Ce,ElementaryStream:De,TimestampRolloverStream:Le,CaptionStream:fe.CaptionStream,Cea608Stream:fe.Cea608Stream,Cea708Stream:fe.Cea708Stream,MetadataStream:Pe};for(var Me in me)me.hasOwnProperty(Me)&&(Ie[Me]=me[Me]);var xe,Ee=Ie,Re=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Be=function(t,e){var i=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return i=i>=0?i:0,(16&t[e+5])>>4?i+20:i+10},ze=function t(e,i){return e.length-i<10||e[i]!=="I".charCodeAt(0)||e[i+1]!=="D".charCodeAt(0)||e[i+2]!=="3".charCodeAt(0)?i:t(e,i+=Be(e,i))},Fe=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},Ne={isLikelyAacData:function(t){var e=ze(t,0);return t.length>=e+2&&255==(255&t[e])&&240==(240&t[e+1])&&16==(22&t[e+1])},parseId3TagSize:Be,parseAdtsSize:function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i},parseType:function(t,e){return t[e]==="I".charCodeAt(0)&&t[e+1]==="D".charCodeAt(0)&&t[e+2]==="3".charCodeAt(0)?"timed-metadata":!0&t[e]&&240==(240&t[e+1])?"audio":null},parseSampleRate:function(t){for(var e=0;e+5>>2];e++}return null},parseAacTimestamp:function(t){var e,i,n;e=10,64&t[5]&&(e+=4,e+=Fe(t.subarray(10,14)));do{if((i=Fe(t.subarray(e+4,e+8)))<1)return null;if("PRIV"===String.fromCharCode(t[e],t[e+1],t[e+2],t[e+3])){n=t.subarray(e+10,e+i+10);for(var a=0;a>>2;return s*=4,s+=3&r[7]}break}}e+=10,e+=i}while(e=3;)if(t[d]!=="I".charCodeAt(0)||t[d+1]!=="D".charCodeAt(0)||t[d+2]!=="3".charCodeAt(0))if(255!=(255&t[d])||240!=(240&t[d+1]))d++;else{if(t.length-d<7)break;if(d+(o=Ne.parseAdtsSize(t,d))>t.length)break;r={type:"audio",data:t.subarray(d,d+o),pts:e,dts:e},this.trigger("data",r),d+=o}else{if(t.length-d<10)break;if(d+(o=Ne.parseId3TagSize(t,d))>t.length)break;a={type:"timed-metadata",data:t.subarray(d,d+o)},this.trigger("data",a),d+=o}n=t.length-d,t=n>0?t.subarray(d):new Uint8Array},this.reset=function(){t=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){t=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new d;var Ve,Ge,We,je,Ye=xe,He=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],qe=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Ke=ht.H264Stream,Xe=Ne.isLikelyAacData,Ze=u,$e=function(t,e){var i;if(t.length!==e.length)return!1;for(i=0;i=-1e4&&i<=45e3&&(!n||o>i)&&(n=r,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(t){var e,i,n,a,r,o,d,h;for(r=t.byteLength,o=t.nalCount,d=t.duration,e=i=0;en.pts?e++:(i++,r-=a.byteLength,o-=a.nalCount,d-=a.duration);return 0===i?t:i===t.length?null:((h=t.slice(i)).byteLength=r,h.duration=d,h.nalCount=o,h.pts=h[0].pts,h.dts=h[0].dts,h)},this.alignGopsAtEnd_=function(t){var e,i,n,a,r,o,d;for(e=s.length-1,i=t.length-1,r=null,o=!1;e>=0&&i>=0;){if(n=s[e],a=t[i],n.pts===a.pts){o=!0;break}n.pts>a.pts?e--:(e===s.length-1&&(r=i),i--)}if(!o&&null===r)return null;if(0===(d=o?i:r))return t;var h=t.slice(d),p=h.reduce((function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t}),{byteLength:0,duration:0,nalCount:0});return h.byteLength=p.byteLength,h.duration=p.duration,h.nalCount=p.nalCount,h.pts=h[0].pts,h.dts=h[0].dts,h},this.alignGopsWith=function(t){s=t}}).prototype=new d,(je=function(t,e){this.numberOfTracks=0,this.metadataStream=e,void 0!==(t=t||{}).remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,"boolean"==typeof t.keepOriginalTimestamps?this.keepOriginalTimestamps=t.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,je.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track,this.pendingBoxes.push(t.boxes)),void("audio"===t.track.type&&(this.audioTrack=t.track,this.pendingBoxes.unshift(t.boxes))))}}).prototype=new d,je.prototype.flush=function(t){var e,i,n,a,r=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,qe.forEach((function(t){s.info[t]=this.videoTrack[t]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,He.forEach((function(t){s.info[t]=this.audioTrack[t]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=bt.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},je.prototype.setRemux=function(t){this.remuxTracks=t},(We=function(t){var e,i,n=this,a=!0;We.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="aac",a.metadataStream=new Ee.MetadataStream,a.aacStream=new Ye,a.audioTimestampRolloverStream=new Ee.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new Ee.TimestampRolloverStream("timed-metadata"),a.adtsStream=new w,a.coalesceStream=new je(t,a.metadataStream),a.headOfPipeline=a.aacStream,a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.metadataStream.on("timestamp",(function(t){a.aacStream.setTimestamp(t.timeStamp)})),a.aacStream.on("data",(function(r){"timed-metadata"!==r.type&&"audio"!==r.type||a.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new Ge(i,t),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e}))})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new Ee.MetadataStream,a.packetStream=new Ee.TransportPacketStream,a.parseStream=new Ee.TransportParseStream,a.elementaryStream=new Ee.ElementaryStream,a.timestampRolloverStream=new Ee.TimestampRolloverStream,a.adtsStream=new w,a.h264Stream=new Ke,a.captionStream=new Ee.CaptionStream(t),a.coalesceStream=new je(t,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream),a.timestampRolloverStream.pipe(a.h264Stream),a.timestampRolloverStream.pipe(a.adtsStream),a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",(function(r){var s;if("metadata"===r.type){for(s=r.tracks.length;s--;)e||"video"!==r.tracks[s].type?i||"audio"!==r.tracks[s].type||((i=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(e=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;e&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new Ve(e,t),a.videoSegmentStream.on("timelineStartInfo",(function(e){i&&!t.keepOriginalTimestamps&&(i.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts-n.baseMediaDecodeTime))})),a.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),a.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",(function(t){i&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(t)})),a.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),i&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new Ge(i,t),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e})}})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("id3Frame",(function(t){t.dispatchType=a.metadataStream.dispatchType,n.trigger("id3Frame",t)})),a.coalesceStream.on("caption",this.trigger.bind(this,"caption")),a.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(n){var a=this.transmuxPipeline_;t.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,Xt(i),a.audioTimestampRolloverStream&&a.audioTimestampRolloverStream.discontinuity()),e&&(a.videoSegmentStream&&(a.videoSegmentStream.gopCache_=[]),e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,Xt(e),a.captionStream.reset()),a.timestampRolloverStream&&a.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.setRemux=function(e){var i=this.transmuxPipeline_;t.remux=e,i&&i.coalesceStream&&i.coalesceStream.setRemux(e)},this.alignGopsWith=function(t){e&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.push=function(t){if(a){var e=Xe(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),a=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){a=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new d;var Qe,ti={Transmuxer:We,VideoSegmentStream:Ve,AudioSegmentStream:Ge,AUDIO_PROPERTIES:He,VIDEO_PROPERTIES:qe,generateSegmentTimingInfo:Je},ei=ee,ii=fe.CaptionStream,ni=function(t,e){for(var i=t,n=0;n0?Ct(h[0]).baseMediaDecodeTime:0,u=Tt(r,["trun"]);e===d&&u.length>0&&(i=function(t,e,i){var n,a,r,s,o=new DataView(t.buffer,t.byteOffset,t.byteLength),d=[];for(a=0;a+40;){var d=e.shift();this.parse(d,r,s)}return null!==(o=function(t,e,i){return null===e?null:{seiNals:ai(t,e)[e],timescale:i}}(t,i,n))&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),a):null},this.pushNals=function(e){if(!this.isInitialized()||!e||0===e.length)return null;e.forEach((function(e){t.push(e)}))},this.flushStream=function(){if(!this.isInitialized())return null;r?t.partialFlush():t.flush()},this.clearParsedCaptions=function(){a.captions=[],a.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){e=[],i=null,n=null,a?this.clearParsedCaptions():a={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}};(Qe=function(t,e){var i,n=0,a=16384,r=function(t,e){var i,n=t.position+e;n0)throw new Error("Attempted to create new NAL wihout closing the old one");n=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(t){var e,i;this.length===n+4?this.length-=4:n>0&&(e=n+4,i=this.length-e,this.position=n,this.view.setUint32(this.position,i),this.position=this.length,t&&t.push(this.bytes.subarray(e,e+i))),n=0},this.writeMetaDataDouble=function(t,e){var i;if(r(this,2+t.length+9),this.view.setUint16(this.position,t.length),this.position+=2,"width"===t)this.bytes.set(s,this.position),this.position+=5;else if("height"===t)this.bytes.set(o,this.position),this.position+=6;else if("videocodecid"===t)this.bytes.set(d,this.position),this.position+=12;else for(i=0;i>>16,this.bytes[14]=(65280&t)>>>8,this.bytes[15]=(255&t)>>>0;break;case Qe.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=e?0:1;break;case Qe.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,n),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return i=this.length-11,this.bytes[1]=(16711680&i)>>>16,this.bytes[2]=(65280&i)>>>8,this.bytes[3]=(255&i)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,r(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=Qe.frameTime(this.bytes),this}}).AUDIO_TAG=8,Qe.VIDEO_TAG=9,Qe.METADATA_TAG=18,Qe.isAudioFrame=function(t){return Qe.AUDIO_TAG===t[0]},Qe.isVideoFrame=function(t){return Qe.VIDEO_TAG===t[0]},Qe.isMetaData=function(t){return Qe.METADATA_TAG===t[0]},Qe.isKeyFrame=function(t){return Qe.isVideoFrame(t)?23===t[11]:!!Qe.isAudioFrame(t)||!!Qe.isMetaData(t)},Qe.frameTime=function(t){var e=t[4]<<16;return e|=t[5]<<8,e|=t[6]<<0,e|=t[7]<<24};var si=Qe,oi=function t(e){this.numberOfTracks=0,this.metadataStream=e.metadataStream,this.videoTags=[],this.audioTags=[],this.videoTrack=null,this.audioTrack=null,this.pendingCaptions=[],this.pendingMetadata=[],this.pendingTracks=0,this.processedTracks=0,t.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):("video"===t.track.type&&(this.videoTrack=t.track,this.videoTags=t.tags,this.pendingTracks++),void("audio"===t.track.type&&(this.audioTrack=t.track,this.audioTags=t.tags,this.pendingTracks++)))}};(oi.prototype=new d).flush=function(t){var e,i,n,a,r={tags:{},captions:[],captionStreams:{},metadata:[]};if(this.pendingTracks=n[0]&&(s=n.shift(),this.writeMetaDataTags(o,s)),(t.extraData!==e||a.pts-s>=1e3)&&(this.writeMetaDataTags(o,a.pts),e=t.extraData,s=a.pts),(r=new si(si.AUDIO_TAG)).pts=a.pts,r.dts=a.dts,r.writeBytes(a.data),o.push(r.finalize());n.length=0,e=null,this.trigger("data",{track:t,tags:o.list}),this.trigger("done","AudioSegmentStream")}else this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(e,i){var n;(n=new si(si.METADATA_TAG)).pts=i,n.dts=i,n.writeMetaDataDouble("audiocodecid",10),n.writeMetaDataBoolean("stereo",2===t.channelcount),n.writeMetaDataDouble("audiosamplerate",t.samplerate),n.writeMetaDataDouble("audiosamplesize",16),e.push(n.finalize()),(n=new si(si.AUDIO_TAG,!0)).pts=i,n.dts=i,n.view.setUint16(n.position,t.extraData),n.position+=2,n.length=Math.max(n.length,n.position),e.push(n.finalize())},this.onVideoKeyFrame=function(t){n.push(t)}}).prototype=new d,(hi=function(t){var e,i,n=[];hi.prototype.init.call(this),this.finishFrame=function(n,a){if(a){if(e&&t&&t.newMetadata&&(a.keyFrame||0===n.length)){var r=li(e,a.dts).finalize(),s=ci(t,a.dts).finalize();r.metaDataTag=s.metaDataTag=!0,n.push(r),n.push(s),t.newMetadata=!1,this.trigger("keyframe",a.dts)}a.endNalUnit(),n.push(a.finalize()),i=null}},this.push=function(e){ui(t,e),e.pts=Math.round(e.pts/90),e.dts=Math.round(e.dts/90),n.push(e)},this.flush=function(){for(var a,r=new mi;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0!==n.length){for(;n.length;)"seq_parameter_set_rbsp"===(a=n.shift()).nalUnitType?(t.newMetadata=!0,e=a.config,t.width=e.width,t.height=e.height,t.sps=[a.data],t.profileIdc=e.profileIdc,t.levelIdc=e.levelIdc,t.profileCompatibility=e.profileCompatibility,i.endNalUnit()):"pic_parameter_set_rbsp"===a.nalUnitType?(t.newMetadata=!0,t.pps=[a.data],i.endNalUnit()):"access_unit_delimiter_rbsp"===a.nalUnitType?(i&&this.finishFrame(r,i),(i=new si(si.VIDEO_TAG)).pts=a.pts,i.dts=a.dts):("slice_layer_without_partitioning_rbsp_idr"===a.nalUnitType&&(i.keyFrame=!0),i.endNalUnit()),i.startNalUnit(),i.writeBytes(a.data);i&&this.finishFrame(r,i),this.trigger("data",{track:t,tags:r.list}),this.trigger("done","VideoSegmentStream")}else this.trigger("done","VideoSegmentStream")}}).prototype=new d,(di=function(t){var e,i,n,a,r,s,o,d,h,p,u,l,c=this;di.prototype.init.call(this),t=t||{},this.metadataStream=new Ee.MetadataStream,t.metadataStream=this.metadataStream,e=new Ee.TransportPacketStream,i=new Ee.TransportParseStream,n=new Ee.ElementaryStream,a=new Ee.TimestampRolloverStream("video"),r=new Ee.TimestampRolloverStream("audio"),s=new Ee.TimestampRolloverStream("timed-metadata"),o=new w,d=new gi,l=new fi(t),e.pipe(i).pipe(n),n.pipe(a).pipe(d),n.pipe(r).pipe(o),n.pipe(s).pipe(this.metadataStream).pipe(l),u=new Ee.CaptionStream(t),d.pipe(u).pipe(l),n.on("data",(function(t){var e,i,n;if("metadata"===t.type){for(e=t.tracks.length;e--;)"video"===t.tracks[e].type?i=t.tracks[e]:"audio"===t.tracks[e].type&&(n=t.tracks[e]);i&&!h&&(l.numberOfTracks++,h=new hi(i),d.pipe(h).pipe(l)),n&&!p&&(l.numberOfTracks++,p=new pi(n),o.pipe(p).pipe(l),h&&h.on("keyframe",p.onVideoKeyFrame))}})),this.push=function(t){e.push(t)},this.flush=function(){e.flush()},this.resetCaptions=function(){u.reset()},l.on("data",(function(t){c.trigger("data",t)})),l.on("done",(function(){c.trigger("done")}))}).prototype=new d;var yi=function(t,e,i){var n,a,r,s=new Uint8Array(9),o=new DataView(s.buffer);return t=t||0,e=void 0===e||e,i=void 0===i||i,o.setUint8(0,70),o.setUint8(1,76),o.setUint8(2,86),o.setUint8(3,1),o.setUint8(4,(e?4:0)|(i?1:0)),o.setUint32(5,s.byteLength),t<=0?((a=new Uint8Array(s.byteLength+4)).set(s),a.set([0,0,0,0],s.byteLength),a):((n=new si(si.METADATA_TAG)).pts=n.dts=0,n.writeMetaDataDouble("duration",t),r=n.finalize().length,(a=new Uint8Array(s.byteLength+r)).set(s),a.set(o.byteLength,r),a)},bi={tag:si,Transmuxer:di,getFlvHeader:yi},vi=Ee,Si=u,wi=function t(e,i){var n=[],a=0,r=0,s=0,o=1/0,d=null,h=null;i=i||{},t.prototype.init.call(this),this.push=function(t){$t(e,t),e&&He.forEach((function(i){e[i]=t[i]})),n.push(t)},this.setEarliestDts=function(t){r=t},this.setVideoBaseMediaDecodeTime=function(t){o=t},this.setAudioAppendStart=function(t){s=t},this.processFrames_=function(){var t,p,u,l,c;0!==n.length&&0!==(t=Yt(n,e,r)).length&&(e.baseMediaDecodeTime=Zt(e,i.keepOriginalTimestamps),jt(e,t,s,o),e.samples=Ht(t),u=bt.mdat(qt(t)),n=[],p=bt.moof(a,[e]),a++,e.initSegment=bt.initSegment([e]),(l=new Uint8Array(p.byteLength+u.byteLength)).set(p),l.set(u,p.byteLength),Xt(e),null===d&&(h=d=t[0].pts),h+=t.length*(1024*Si/e.samplerate),c={start:d},this.trigger("timingInfo",c),this.trigger("data",{track:e,boxes:l}))},this.flush=function(){this.processFrames_(),this.trigger("timingInfo",{start:d,end:h}),this.resetTiming_(),this.trigger("done","AudioSegmentStream")},this.partialFlush=function(){this.processFrames_(),this.trigger("partialdone","AudioSegmentStream")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline","AudioSegmentStream")},this.resetTiming_=function(){Xt(e),d=null,h=null},this.reset=function(){this.resetTiming_(),n=[],this.trigger("reset")}};wi.prototype=new d;var Ti=wi,_i=function t(e,i){var n,a,r,s=0,o=[],d=[],h=null,p=null,u=!0;i=i||{},t.prototype.init.call(this),this.push=function(t){$t(e,t),void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),"seq_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.config,e.sps=[t.data],qe.forEach((function(t){e[t]=n[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||a||(a=t.data,e.pps=[t.data]),o.push(t)},this.processNals_=function(t){var n;for(o=d.concat(o);o.length&&"access_unit_delimiter_rbsp"!==o[0].nalUnitType;)o.shift();if(0!==o.length){var a=Mt(o);if(a.length)if(d=a[a.length-1],t&&(a.pop(),a.duration-=d.duration,a.nalCount-=d.length,a.byteLength-=d.byteLength),a.length){if(this.trigger("timelineStartInfo",e.timelineStartInfo),u){if(!(r=xt(a))[0][0].keyFrame){if(!(r=Et(r))[0][0].keyFrame)return o=[].concat.apply([],a).concat(d),void(d=[]);(a=[].concat.apply([],r)).duration=r.duration}u=!1}for(null===h&&(h=a[0].pts,p=h),p+=a.duration,this.trigger("timingInfo",{start:h,end:p}),n=0;n0;n+=12,a--)i.references.push({referenceType:(128&t[n])>>>7,referencedSize:2147483647&e.getUint32(n),subsegmentDuration:e.getUint32(n+4),startsWithSap:!!(128&t[n+8]),sapType:(112&t[n+8])>>>4,sapDeltaTime:268435455&e.getUint32(n+8)});return i},xi=Math.pow(2,32),Ei=function(t){return new Date(1e3*t-20828448e5)},Ri=function(t){var e,i,n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=[];for(e=0;e+4MALFORMED DATA");else switch(31&t[e]){case 1:a.push("slice_layer_without_partitioning_rbsp");break;case 5:a.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:a.push("sei_rbsp");break;case 7:a.push("seq_parameter_set_rbsp");break;case 8:a.push("pic_parameter_set_rbsp");break;case 9:a.push("access_unit_delimiter_rbsp");break;default:a.push("UNKNOWN NAL - "+t[e]&31)}return a},Bi={avc1:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{dataReferenceIndex:e.getUint16(6),width:e.getUint16(24),height:e.getUint16(26),horizresolution:e.getUint16(28)+e.getUint16(30)/16,vertresolution:e.getUint16(32)+e.getUint16(34)/16,frameCount:e.getUint16(40),depth:e.getUint16(74),config:Pi(t.subarray(78,t.byteLength))}},avcC:function(t){var e,i,n,a,r=new DataView(t.buffer,t.byteOffset,t.byteLength),s={configurationVersion:t[0],avcProfileIndication:t[1],profileCompatibility:t[2],avcLevelIndication:t[3],lengthSizeMinusOne:3&t[4],sps:[],pps:[]},o=31&t[5];for(n=6,a=0;a>>2&63,bufferSize:t[13]<<16|t[14]<<8|t[15],maxBitrate:t[16]<<24|t[17]<<16|t[18]<<8|t[19],avgBitrate:t[20]<<24|t[21]<<16|t[22]<<8|t[23],decoderConfigDescriptor:{tag:t[24],length:t[25],audioObjectType:t[26]>>>3&31,samplingFrequencyIndex:(7&t[26])<<1|t[27]>>>7&1,channelConfiguration:t[27]>>>3&15}}}},ftyp:function(t){for(var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={majorBrand:St(t.subarray(0,4)),minorVersion:e.getUint32(4),compatibleBrands:[]},n=8;n>10)),a.language+=String.fromCharCode(96+((992&e)>>5)),a.language+=String.fromCharCode(96+(31&e)),a},mdia:function(t){return{boxes:Pi(t)}},mfhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sequenceNumber:t[4]<<24|t[5]<<16|t[6]<<8|t[7]}},minf:function(t){return{boxes:Pi(t)}},mp4a:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={dataReferenceIndex:e.getUint16(6),channelcount:e.getUint16(16),samplesize:e.getUint16(18),samplerate:e.getUint16(24)+e.getUint16(26)/65536};return t.byteLength>28&&(i.streamDescriptor=Pi(t.subarray(28))[0]),i},moof:function(t){return{boxes:Pi(t)}},moov:function(t){return{boxes:Pi(t)}},mvex:function(t){return{boxes:Pi(t)}},mvhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=Ei(e.getUint32(i)),i+=8,n.modificationTime=Ei(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=8,n.duration=e.getUint32(i)):(n.creationTime=Ei(e.getUint32(i)),i+=4,n.modificationTime=Ei(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=4,n.duration=e.getUint32(i)),i+=4,n.rate=e.getUint16(i)+e.getUint16(i+2)/16,i+=4,n.volume=e.getUint8(i)+e.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(t.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=e.getUint32(i),n},pdin:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),rate:e.getUint32(4),initialDelay:e.getUint32(8)}},sdtp:function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]};for(e=4;e>4,isDependedOn:(12&t[e])>>2,hasRedundancy:3&t[e]});return i},sidx:Mi,smhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),balance:t[4]+t[5]/256}},stbl:function(t){return{boxes:Pi(t)}},ctts:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),compositionOffsets:[]},a=i.getUint32(4);for(e=8;a;e+=8,a--)n.compositionOffsets.push({sampleCount:i.getUint32(e),sampleOffset:i[0===n.version?"getUint32":"getInt32"](e+4)});return n},stss:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),syncSamples:[]},a=i.getUint32(4);for(e=8;a;e+=4,a--)n.syncSamples.push(i.getUint32(e));return n},stco:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),chunkOffsets:[]},a=i.getUint32(4);for(e=8;a;e+=4,a--)n.chunkOffsets.push(i.getUint32(e));return n},stsc:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=i.getUint32(4),a={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleToChunks:[]};for(e=8;n;e+=12,n--)a.sampleToChunks.push({firstChunk:i.getUint32(e),samplesPerChunk:i.getUint32(e+4),sampleDescriptionIndex:i.getUint32(e+8)});return a},stsd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleDescriptions:Pi(t.subarray(8))}},stsz:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(e=12;e>6,sampleHasRedundancy:(48&t[21])>>4,samplePaddingValue:(14&t[21])>>1,sampleIsDifferenceSample:!!(1&t[21]),sampleDegradationPriority:e.getUint16(22)}},trun:Ut,"url ":function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4))}},vmhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),graphicsmode:e.getUint16(4),opcolor:new Uint16Array([e.getUint16(6),e.getUint16(8),e.getUint16(10)])}}},zi={inspect:Pi=function(t){for(var e,i,n,a,r,s=0,o=[],d=new ArrayBuffer(t.length),h=new Uint8Array(d),p=0;p1?s+i:t.byteLength,(r=(Bi[n]||function(t){return{data:t}})(t.subarray(s+8,a))).size=i,r.type=n,o.push(r),s=a;return o},textify:Li=function(t,e){var i;return e=e||0,i=new Array(2*e+1).join(" "),t.map((function(t,n){return i+t.type+"\n"+Object.keys(t).filter((function(t){return"type"!==t&&"boxes"!==t})).map((function(e){var n=i+" "+e+": ",a=t[e];if(a instanceof Uint8Array||a instanceof Uint32Array){var r=Array.prototype.slice.call(new Uint8Array(a.buffer,a.byteOffset,a.byteLength)).map((function(t){return" "+("00"+t.toString(16)).slice(-2)})).join("").match(/.{1,24}/g);return r?1===r.length?n+"<"+r.join("").slice(1)+">":n+"<\n"+r.map((function(t){return i+" "+t})).join("\n")+"\n"+i+" >":n+"<>"}return n+JSON.stringify(a,null,2).split("\n").map((function(t,e){return 0===e?t:i+" "+t})).join("\n")})).join("\n")+(t.boxes?"\n"+Li(t.boxes,e+1):"")})).join("\n")},parseType:St,findBox:Tt,parseTraf:Bi.traf,parseTfdt:Bi.tfdt,parseHdlr:Bi.hdlr,parseTfhd:Bi.tfhd,parseTrun:Bi.trun,parseSidx:Bi.sidx},Fi={8:"audio",9:"video",18:"metadata"},Ni=function(t){for(var e,i=[];t.byteLength>0;)e=0,i.push("0x"+("00"+t[e++].toString(16)).slice(-2).toUpperCase()),t=t.subarray(1);return i.join(" ")},Vi=function(t,e){var i=t[0]&parseInt("00001111",2);return(e=e||{}).frameType=["Unknown","Keyframe (for AVC, a seekable frame)","Inter frame (for AVC, a nonseekable frame)","Disposable inter frame (H.263 only)","Generated keyframe (reserved for server use only)","Video info/command frame"][(t[0]&parseInt("11110000",2))>>>4],e.codecID=i,7===i?function(t,e){var i=t[1]&parseInt("01111111",2)<<16|t[2]<<8|t[3];return(e=e||{}).avcPacketType=["AVC Sequence Header","AVC NALU","AVC End-of-Sequence"][t[0]],e.CompositionTime=t[1]&parseInt("10000000",2)?-i:i,1===t[0]?e.nalUnitTypeRaw=Ni(t.subarray(4,100)):e.data=Ni(t.subarray(4)),e}(t.subarray(1),e):e},Gi=function(t,e){var i=(t[0]&parseInt("11110000",2))>>>4;return(e=e||{}).soundFormat=["Linear PCM, platform endian","ADPCM","MP3","Linear PCM, little endian","Nellymoser 16-kHz mono","Nellymoser 8-kHz mono","Nellymoser","G.711 A-law logarithmic PCM","G.711 mu-law logarithmic PCM","reserved","AAC","Speex","MP3 8-Khz","Device-specific sound"][i],e.soundRate=["5.5-kHz","11-kHz","22-kHz","44-kHz"][(t[0]&parseInt("00001100",2))>>>2],e.soundSize=(t[0]&parseInt("00000010",2))>>>1?"16-bit":"8-bit",e.soundType=t[0]&parseInt("00000001",2)?"Stereo":"Mono",10===i?function(t,e){return(e=e||{}).aacPacketType=["AAC Sequence Header","AAC Raw"][t[0]],e.data=Ni(t.subarray(1)),e}(t.subarray(1),e):e},Wi=function(t){var e=function(t){return{tagType:Fi[t[0]],dataSize:t[1]<<16|t[2]<<8|t[3],timestamp:t[7]<<24|t[4]<<16|t[5]<<8|t[6],streamID:t[8]<<16|t[9]<<8|t[10]}}(t);switch(t[0]){case 8:Gi(t.subarray(11),e);break;case 9:Vi(t.subarray(11),e)}return e},ji={inspectTag:Wi,inspect:function(t){var e,i,n=9,a=[];for(n+=4;n>>4>1&&(e+=t[4]+1),e},Ki=function(t){switch(t){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Xi={parseType:function(t,e){var i=Yi(t);return 0===i?"pat":i===e?"pmt":e?"pes":null},parsePat:function(t){var e=Hi(t),i=4+qi(t);return e&&(i+=t[i]+1),(31&t[i+10])<<8|t[i+11]},parsePmt:function(t){var e={},i=Hi(t),n=4+qi(t);if(i&&(n+=t[n]+1),1&t[n+5]){var a;a=3+((15&t[n+1])<<8|t[n+2])-4;for(var r=12+((15&t[n+10])<<8|t[n+11]);r=t.byteLength)return null;var i,n=null;return 192&(i=t[e+7])&&((n={}).pts=(14&t[e+9])<<27|(255&t[e+10])<<20|(254&t[e+11])<<12|(255&t[e+12])<<5|(254&t[e+13])>>>3,n.pts*=4,n.pts+=(6&t[e+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&t[e+14])<<27|(255&t[e+15])<<20|(254&t[e+16])<<12|(255&t[e+17])<<5|(254&t[e+18])>>>3,n.dts*=4,n.dts+=(6&t[e+18])>>>1)),n},videoPacketContainsKeyFrame:function(t){for(var e=4+qi(t),i=t.subarray(e),n=0,a=0,r=!1;a3&&"slice_layer_without_partitioning_rbsp_idr"===Ki(31&i[a+3])&&(r=!0),r}},Zi=we,$i={};$i.ts=Xi,$i.aac=Ne;var Ji=u,Qi=188,tn=71,en=function(t,e,i){for(var n,a,r,s,o=0,d=Qi,h=!1;d<=t.byteLength;)if(t[o]!==tn||t[d]!==tn&&d!==t.byteLength)o++,d++;else{switch(n=t.subarray(o,d),$i.ts.parseType(n,e.pid)){case"pes":a=$i.ts.parsePesType(n,e.table),r=$i.ts.parsePayloadUnitStartIndicator(n),"audio"===a&&r&&(s=$i.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),h=!0)}if(h)break;o+=Qi,d+=Qi}for(o=(d=t.byteLength)-Qi,h=!1;o>=0;)if(t[o]!==tn||t[d]!==tn&&d!==t.byteLength)o--,d--;else{switch(n=t.subarray(o,d),$i.ts.parseType(n,e.pid)){case"pes":a=$i.ts.parsePesType(n,e.table),r=$i.ts.parsePayloadUnitStartIndicator(n),"audio"===a&&r&&(s=$i.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),h=!0)}if(h)break;o-=Qi,d-=Qi}},nn=function(t,e,i){for(var n,a,r,s,o,d,h,p=0,u=Qi,l=!1,c={data:[],size:0};u=0;)if(t[p]!==tn||t[u]!==tn)p--,u--;else{switch(n=t.subarray(p,u),$i.ts.parseType(n,e.pid)){case"pes":a=$i.ts.parsePesType(n,e.table),r=$i.ts.parsePayloadUnitStartIndicator(n),"video"===a&&r&&(s=$i.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),l=!0)}if(l)break;p-=Qi,u-=Qi}},an=function(t){var e={pid:null,table:null},i={};for(var n in function(t,e){for(var i,n=0,a=Qi;a=3;){switch($i.aac.parseType(t,o)){case"timed-metadata":if(t.length-o<10){i=!0;break}if((s=$i.aac.parseId3TagSize(t,o))>t.length){i=!0;break}null===r&&(e=t.subarray(o,o+s),r=$i.aac.parseAacTimestamp(e)),o+=s;break;case"audio":if(t.length-o<7){i=!0;break}if((s=$i.aac.parseAdtsSize(t,o))>t.length){i=!0;break}null===a&&(e=t.subarray(o,o+s),a=$i.aac.parseSampleRate(e)),n++,o+=s;break;default:o++}if(i)return null}if(null===a||null===r)return null;var d=Ji/a;return{audio:[{type:"audio",dts:r,pts:r},{type:"audio",dts:r+1024*n*d,pts:r+1024*n*d}]}}(t):an(t))&&(i.audio||i.video)?(function(t,e){if(t.audio&&t.audio.length){var i=e;(void 0===i||isNaN(i))&&(i=t.audio[0].dts),t.audio.forEach((function(t){t.dts=Zi(t.dts,i),t.pts=Zi(t.pts,i),t.dtsTime=t.dts/Ji,t.ptsTime=t.pts/Ji}))}if(t.video&&t.video.length){var n=e;if((void 0===n||isNaN(n))&&(n=t.video[0].dts),t.video.forEach((function(t){t.dts=Zi(t.dts,n),t.pts=Zi(t.pts,n),t.dtsTime=t.dts/Ji,t.ptsTime=t.pts/Ji})),t.firstKeyFrame){var a=t.firstKeyFrame;a.dts=Zi(a.dts,n),a.pts=Zi(a.pts,n),a.dtsTime=a.dts/Ji,a.ptsTime=a.pts/Ji}}}(i,e),i):null},parseAudioPes_:en},sn={codecs:pt,mp4:ri,flv:bi,mp2t:vi,partial:Oi};return sn.mp4.tools=zi,sn.flv.tools=ji,sn.mp2t.tools=rn,sn})); diff --git a/node_modules/mux.js/docs/captions.md b/node_modules/mux.js/docs/captions.md deleted file mode 100644 index e3545b3..0000000 --- a/node_modules/mux.js/docs/captions.md +++ /dev/null @@ -1,37 +0,0 @@ -# In-Band Captions -Captions come in two varieties, based on their relationship to the -video. Typically on the web, captions are delivered as a separate file -and associated with a video through the `` element. This type -of captions are sometimes referred to as *out-of-band*. - -The alternative method involves embedding the caption data directly into -the video content and is sometimes called *in-band captions*. In-band -captions exist in many videos today that were originally encoded for -broadcast and they are also a standard method used to provide captions -for live events. In-band HLS captions follow the CEA-708 standard. - -In this project, in-band captions are parsed using a [CaptionStream][caption-stream]. For MPEG2-TS sources, the CaptionStream is used as part of the [Transmuxer TS Pipeline][transmuxer]. For ISOBMFF sources, the CaptionStream is used as part of the [MP4 CaptionParser][mp4-caption-parser]. - -## Is my stream CEA-608/CEA-708 compatible? - -If you are having difficulties getting caption data as you expect out of Mux.js, take a look at our [Troubleshooting Guide](/docs/troubleshooting.md#608/708-caption-parsing) to ensure your content is compatible. - -# Useful Tools - -- [CCExtractor][cc-extractor] -- [Thumbcoil][thumbcoil] - -# References -- [Rec. ITU-T H.264][h264-spec]: H.264 video data specification. CEA-708 captions are encapsulated in supplemental enhancement information (SEI) network abstraction layer (NAL) units within the video stream. -- [ANSI/SCTE 128-1][ansi-scte-spec]: the binary encapsulation of caption data within an SEI user_data_registered_itu_t_t35 payload. -- CEA-708-E: describes the framing and interpretation of caption data reassembled out of the picture user data blobs. -- CEA-608-E: specifies the hex to character mapping for extended language characters. -- [Closed Captioning Intro by Technology Connections](https://www.youtube.com/watch?v=6SL6zs2bDks) - -[h264-spec]: https://www.itu.int/rec/T-REC-H.264 -[ansi-scte-spec]: https://www.scte.org/documents/pdf/Standards/ANSI_SCTE%20128-1%202013.pdf -[caption-stream]: /lib/m2ts/caption-stream.js -[transmuxer]: /lib/mp4/transmuxer.js -[mp4-caption-parser]: /lib/mp4/caption-parser.js -[thumbcoil]: http://thumb.co.il/ -[cc-extractor]: https://github.com/CCExtractor/ccextractor diff --git a/node_modules/mux.js/docs/diagram.png b/node_modules/mux.js/docs/diagram.png deleted file mode 100644 index c78f22d..0000000 Binary files a/node_modules/mux.js/docs/diagram.png and /dev/null differ diff --git a/node_modules/mux.js/docs/streams.md b/node_modules/mux.js/docs/streams.md deleted file mode 100644 index 0e4e89e..0000000 --- a/node_modules/mux.js/docs/streams.md +++ /dev/null @@ -1,26 +0,0 @@ -# Streams - -mux.js uses a concept of `streams` to allow a flexible architecture to read and manipulate video bitstreams. The `streams` are loosely based on [Node Streams][node-streams] and are meant to be composible into a series of streams: a `pipeline`. - -## Stream API - -Take a look at the base [Stream][stream] to get an idea of the methods and events available. In general, data is `push`ed into a stream and is `flush`ed out of a stream. Streams can be connected by calling `pipe` on the source `Stream` and passing in the destination `Stream`. `data` events correspond to `push`es and `done` events correspond to `flush`es. - -## MP4 Transmuxer - -An example of a `pipeline` is contained in the [MP4 Transmuxer][mp4-transmuxer]. This is a diagram showing the whole pipeline, including the flow of data from beginning to end: - -![mux.js diagram](./diagram.png) - -You can gain a better understanding of what is going on by using our [debug page][debug-demo] and following the bytes through the pipeline: - -```bash -npm start -``` - -and go to `http://localhost:9999/debug/` - -[node-streams]: https://nodejs.org/api/stream.html -[mp4-transmuxer]: ../lib/mp4/transmuxer.js -[stream]: ../lib/utils/stream.js -[debug-demo]: ../debug/index.html diff --git a/node_modules/mux.js/docs/test-content.md b/node_modules/mux.js/docs/test-content.md deleted file mode 100644 index d301650..0000000 --- a/node_modules/mux.js/docs/test-content.md +++ /dev/null @@ -1,61 +0,0 @@ -# Creating Test Content - -## Table of Contents - -- [CEA-608 Content](#creating-cea-608-content) - -## Creating CEA-608 Content - -- Use ffmpeg to create an MP4 file to start with: - - `ffmpeg -f lavfi -i testsrc=duration=300:size=1280x720:rate=30 -profile:v baseline -pix_fmt yuv420p output.mp4` (no audio) - - `ffmpeg -f lavfi -i testsrc=duration=300:size=1280x720:rate=30 -profile:v baseline -pix_fmt yuv420p -filter_complex "anoisesrc=d=300" output.mp4` (audio + video) - - This uses ffmpeg's built-in `testsrc` source which generates a test video pattern with a color and timestamp. For this example, we are using a duration of `300` seconds, a size of `1280x720` and a framerate of `30fps`. We also specify extra settings `profile` and `pix_fmt` to force the output to be encoded using `avc1.42C01F`. - -- Create an [srt file][srt] with the captions you would like to see with their timestamps. - -- Use ffmpeg to convert `ouput.mp4` to a flv file: - - `ffmpeg -i output.mp4 -acodec copy -vcodec copy output.flv` - -- Use [libcaption][] to embed the captions into the flv: - - `flv+srt output.flv captions.srt with-captions.flv` - -- Use ffmpeg to convert `with-captions.flv` to mp4 - - `ffmpeg -i with-captions.flv -acodec copy -vcodec copy with-captions.mp4` - -- Use [Bento4][bento4] to convert the file into a FMP4 file: - - `bento4 mp4fragment with-captions.mp4 \ - --verbosity 3 \ - --fragment-duration 4000 \ - --timescale 90000 \ - with-captions-fragment.mf4` - -Then do *either* of the following: - -- Use [Bento4][bento4] to split the file into an init segment and a fmp4 media segments: - - `bento4 mp4split --verbose \ - --init-segment with-captions-init.mp4 \ - --media-segment segs/with-captions-segment-%llu.m4s \ - with-captions-fragment.mf4` - -- Use [Bento4][bento4] to create a DASH manifest: - - `bento4 mp4dash -v \ - --mpd-name=with-captions.mpd \ - --init-segment=with-captions-init.mp4 \ - --subtitles - with-captions-fragment.mf4` - - This will create a DASH MPD and media segments in a new directory called `output`. - - -[srt]: https://en.wikipedia.org/wiki/SubRip#SubRip_text_file_format -[libcaption]: https://github.com/szatmary/libcaption -[bento4]: https://www.bento4.com/documentation/ diff --git a/node_modules/mux.js/docs/troubleshooting.md b/node_modules/mux.js/docs/troubleshooting.md deleted file mode 100644 index 3b4a179..0000000 --- a/node_modules/mux.js/docs/troubleshooting.md +++ /dev/null @@ -1,20 +0,0 @@ -# Troubleshooting Guide - -## Table of Contents -- [608/708 Caption Parsing](caption-parsing) - -## 608/708 Caption Parsing - -**I have a stream with caption data in more than one field, but only captions from one field are being returned** - -You may want to confirm the SEI NAL units are constructed according to the CEA-608 or CEA-708 specification. Specifically: - -- that control codes/commands are doubled -- control codes starting from 0x14, 0x20 and ending with 0x14, 0x2f in field 1 are replaced with 0x15, 0x20 to 0x15, 0x2f when used in field 2 -- control codes starting from 0x1c, 0x20 and ending with 0x1c, 0x2f in field 1 are replaced with 0x1d, 0x20 to 0x1d, 0x2f when used in field 2 - -**I am getting the wrong times for only some captions, other captions are correct** - -If your content includes B-frames, there is an existing [issue](https://github.com/videojs/mux.js/issues/214) to fix this problem. We recommend that you ensure that all the segments in your source start with keyframes, to allow proper caption timing. - -[caption-parsing]: /docs/troubleshooting.md#608/708-caption-parsing diff --git a/node_modules/mux.js/es/aac/index.js b/node_modules/mux.js/es/aac/index.js deleted file mode 100644 index df0662f..0000000 --- a/node_modules/mux.js/es/aac/index.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based aac to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var aacUtils = require('./utils'); // Constants - - -var _AacStream; -/** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - -_AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = aacUtils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = aacUtils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; -}; - -_AacStream.prototype = new Stream(); -module.exports = _AacStream; \ No newline at end of file diff --git a/node_modules/mux.js/es/aac/utils.js b/node_modules/mux.js/es/aac/utils.js deleted file mode 100644 index 2f72b36..0000000 --- a/node_modules/mux.js/es/aac/utils.js +++ /dev/null @@ -1,160 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ -'use strict'; - -var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - -var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; -}; - -var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); -}; // TODO: use vhs-utils - - -var isLikelyAacData = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; -}; - -var parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; -}; // return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding - - -var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; -}; // return the string representation of the specified byte range, -// interpreted as ISO-8859-1. - - -var parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}; - -var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; -}; - -var parseType = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; -}; - -var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; -}; - -var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; -}; - -module.exports = { - isLikelyAacData: isLikelyAacData, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/codecs/adts.js b/node_modules/mux.js/es/codecs/adts.js deleted file mode 100644 index a683e1e..0000000 --- a/node_modules/mux.js/es/codecs/adts.js +++ /dev/null @@ -1,128 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var _AdtsStream; - -var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; -/* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - -_AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - while (i + 5 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS / ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; - frameEnd = i + frameLength; // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - - if (buffer.byteLength < frameEnd) { - return; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - frameNum++; // If the buffer is empty, clear it and return - - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } // Remove the finished frame from the buffer and start the process again - - - buffer = buffer.subarray(frameEnd); - } - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; -}; - -_AdtsStream.prototype = new Stream(); -module.exports = _AdtsStream; \ No newline at end of file diff --git a/node_modules/mux.js/es/codecs/h264.js b/node_modules/mux.js/es/codecs/h264.js deleted file mode 100644 index 7ca98ea..0000000 --- a/node_modules/mux.js/es/codecs/h264.js +++ /dev/null @@ -1,567 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var ExpGolomb = require('../utils/exp-golomb.js'); - -var _H264Stream, _NalByteStream; - -var PROFILES_WITH_OPTIONAL_SPS_DATA; -/** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - -_NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; -}; - -_NalByteStream.prototype = new Stream(); // values of profile_idc that indicate additional fields are included in the SPS -// see Recommendation ITU-T H.264 (4/2013), -// 7.3.2.1.1 Sequence parameter set data syntax - -PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true -}; -/** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - -_H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - - default: - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - expGolombDecoder = new ExpGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - sarRatio: sarRatio - }; - }; -}; - -_H264Stream.prototype = new Stream(); -module.exports = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/codecs/index.js b/node_modules/mux.js/es/codecs/index.js deleted file mode 100644 index 6b93772..0000000 --- a/node_modules/mux.js/es/codecs/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - Adts: require('./adts'), - h264: require('./h264') -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/constants/audio-properties.js b/node_modules/mux.js/es/constants/audio-properties.js deleted file mode 100644 index d77d0bd..0000000 --- a/node_modules/mux.js/es/constants/audio-properties.js +++ /dev/null @@ -1,3 +0,0 @@ -// constants -var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; -module.exports = AUDIO_PROPERTIES; \ No newline at end of file diff --git a/node_modules/mux.js/es/constants/video-properties.js b/node_modules/mux.js/es/constants/video-properties.js deleted file mode 100644 index 9aed7fe..0000000 --- a/node_modules/mux.js/es/constants/video-properties.js +++ /dev/null @@ -1,2 +0,0 @@ -var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; -module.exports = VIDEO_PROPERTIES; \ No newline at end of file diff --git a/node_modules/mux.js/es/data/silence.js b/node_modules/mux.js/es/data/silence.js deleted file mode 100644 index e74ed24..0000000 --- a/node_modules/mux.js/es/data/silence.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var highPrefix = [33, 16, 5, 32, 164, 27]; -var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - -var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; -}; - -var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); -}; - -var silence; - -module.exports = function () { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]], - 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/flv/coalesce-stream.js b/node_modules/mux.js/es/flv/coalesce-stream.js deleted file mode 100644 index 4bf5ca9..0000000 --- a/node_modules/mux.js/es/flv/coalesce-stream.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -/** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ - - -var CoalesceStream = function CoalesceStream(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - CoalesceStream.prototype.init.call(this); // Take output from multiple - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; -}; - -CoalesceStream.prototype = new Stream(); - -CoalesceStream.prototype.flush = function (flushSource) { - var id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - captionStreams: {}, - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; // Translate caption PTS times into second offsets into the - // video timeline for the segment, and add track info - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; // Emit the final segment - - this.trigger('data', event); - this.trigger('done'); -}; - -module.exports = CoalesceStream; \ No newline at end of file diff --git a/node_modules/mux.js/es/flv/flv-header.js b/node_modules/mux.js/es/flv/flv-header.js deleted file mode 100644 index aa8c189..0000000 --- a/node_modules/mux.js/es/flv/flv-header.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var FlvTag = require('./flv-tag.js'); // For information on the FLV format, see -// http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. -// Technically, this function returns the header and a metadata FLV tag -// if duration is greater than zero -// duration in seconds -// @return {object} the bytes of the FLV header as a Uint8Array - - -var getFlvHeader = function getFlvHeader(duration, audio, video) { - // :ByteArray { - var headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; // default arguments - - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; // signature - - head.setUint8(0, 0x46); // 'F' - - head.setUint8(1, 0x4c); // 'L' - - head.setUint8(2, 0x56); // 'V' - // version - - head.setUint8(3, 0x01); // flags - - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); // data offset, should be 9 for FLV v1 - - head.setUint32(5, headBytes.byteLength); // init the first FLV tag - - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } // write out the duration metadata tag - - - metadata = new FlvTag(FlvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - return result; -}; - -module.exports = getFlvHeader; \ No newline at end of file diff --git a/node_modules/mux.js/es/flv/flv-tag.js b/node_modules/mux.js/es/flv/flv-tag.js deleted file mode 100644 index bb73b25..0000000 --- a/node_modules/mux.js/es/flv/flv-tag.js +++ /dev/null @@ -1,372 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ -'use strict'; - -var _FlvTag; // (type:uint, extraData:Boolean = false) extends ByteArray - - -_FlvTag = function FlvTag(type, extraData) { - var // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, - // :uint - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function prepareWrite(flv, count) { - var bytes, - minLength = flv.position + count; - - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } // allocate a new buffer and copy over the data that will not be modified - - - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - // commonly used metadata properties - widthBytes = _FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = _FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = _FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!_FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - _FlvTag.widthBytes = widthBytes; - _FlvTag.heightBytes = heightBytes; - _FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case _FlvTag.VIDEO_TAG: - this.length = 16; // Start the buffer at 256k - - bufferStartSize *= 6; - break; - - case _FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - - case _FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - // presentation timestamp - - this.pts = 0; // decoder timestamp - - this.dts = 0; // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - - this.writeBytes = function (bytes, offset, length) { - var start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - this.position += length; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeByte(value:int):void - - - this.writeByte = function (byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeShort(value:int):void - - - this.writeShort = function (short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; // Negative index into array - // (pos:uint):int - - - this.negIndex = function (pos) { - return this.bytes[this.length - pos]; - }; // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - - - this.nalUnitSize = function () { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function () { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } // reserve 4 bytes for nal unit size - - - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; // (nal:ByteArray = null):void - - - this.endNalUnit = function (nalContainer) { - var nalStart, // :uint - nalLength; // :uint - // Rewind to the marker and write the size - - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - - - this.writeMetaDataDouble = function (key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); // write size of property name - - this.view.setUint16(this.position, key.length); - this.position += 2; // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - // write property name - - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } // skip null byte - - - this.position++; // write property value - - this.view.setFloat64(this.position, val); - this.position += 8; // update flv tag length - - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // (key:String, val:Boolean):void - - - this.writeMetaDataBoolean = function (key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // ():ByteArray - - - this.finalize = function () { - var dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case _FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = (this.keyFrame || extraData ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case _FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case _FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - - this.position += 2; // set "onMetaData" - - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - - this.length = this.position; - break; - } - - len = this.length - 11; // write the DataSize field - - this.bytes[1] = (len & 0x00FF0000) >>> 16; - this.bytes[2] = (len & 0x0000FF00) >>> 8; - this.bytes[3] = (len & 0x000000FF) >>> 0; // write the Timestamp - - this.bytes[4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[7] = (this.dts & 0xFF000000) >>> 24; // write the StreamID - - this.bytes[8] = 0; - this.bytes[9] = 0; - this.bytes[10] = 0; // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; // trim down the byte buffer to what is actually being used - - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = _FlvTag.frameTime(this.bytes); // if bytes.bytelength isn't equal to this.length, handle error - - return this; - }; -}; - -_FlvTag.AUDIO_TAG = 0x08; // == 8, :uint - -_FlvTag.VIDEO_TAG = 0x09; // == 9, :uint - -_FlvTag.METADATA_TAG = 0x12; // == 18, :uint -// (tag:ByteArray):Boolean { - -_FlvTag.isAudioFrame = function (tag) { - return _FlvTag.AUDIO_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isVideoFrame = function (tag) { - return _FlvTag.VIDEO_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isMetaData = function (tag) { - return _FlvTag.METADATA_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isKeyFrame = function (tag) { - if (_FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (_FlvTag.isAudioFrame(tag)) { - return true; - } - - if (_FlvTag.isMetaData(tag)) { - return true; - } - - return false; -}; // (tag:ByteArray):uint { - - -_FlvTag.frameTime = function (tag) { - var pts = tag[4] << 16; // :uint - - pts |= tag[5] << 8; - pts |= tag[6] << 0; - pts |= tag[7] << 24; - return pts; -}; - -module.exports = _FlvTag; \ No newline at end of file diff --git a/node_modules/mux.js/es/flv/index.js b/node_modules/mux.js/es/flv/index.js deleted file mode 100644 index b0fff3e..0000000 --- a/node_modules/mux.js/es/flv/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - tag: require('./flv-tag'), - Transmuxer: require('./transmuxer'), - getFlvHeader: require('./flv-header') -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/flv/tag-list.js b/node_modules/mux.js/es/flv/tag-list.js deleted file mode 100644 index 2b0785c..0000000 --- a/node_modules/mux.js/es/flv/tag-list.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var TagList = function TagList() { - var self = this; - this.list = []; - - this.push = function (tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function get() { - return self.list.length; - } - }); -}; - -module.exports = TagList; \ No newline at end of file diff --git a/node_modules/mux.js/es/flv/transmuxer.js b/node_modules/mux.js/es/flv/transmuxer.js deleted file mode 100644 index f1268fa..0000000 --- a/node_modules/mux.js/es/flv/transmuxer.js +++ /dev/null @@ -1,425 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var FlvTag = require('./flv-tag.js'); - -var m2ts = require('../m2ts/m2ts.js'); - -var AdtsStream = require('../codecs/adts.js'); - -var H264Stream = require('../codecs/h264').H264Stream; - -var CoalesceStream = require('./coalesce-stream.js'); - -var TagList = require('./tag-list.js'); - -var _Transmuxer, _VideoSegmentStream, _AudioSegmentStream, collectTimelineInfo, metaDataTag, extraDataTag; -/** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - -collectTimelineInfo = function collectTimelineInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = Math.min(track.timelineStartInfo.dts, data.dts); - } - } -}; - -metaDataTag = function metaDataTag(track, pts) { - var tag = new FlvTag(FlvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - return tag; -}; - -extraDataTag = function extraDataTag(track, pts) { - var i, - tag = new FlvTag(FlvTag.VIDEO_TAG, true); - tag.dts = pts; - tag.pts = pts; - tag.writeByte(0x01); // version - - tag.writeByte(track.profileIdc); // profile - - tag.writeByte(track.profileCompatibility); // compatibility - - tag.writeByte(track.levelIdc); // level - - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - - tag.writeShort(track.sps[0].length); // data of SPS - - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; -}; -/** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ - - -_AudioSegmentStream = function AudioSegmentStream(track) { - var adtsFrames = [], - videoKeyFrames = [], - oldExtraData; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - collectTimelineInfo(track, data); - - if (track) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = track.audioobjecttype << 11 | track.samplingfrequencyindex << 7 | track.channelcount << 3; - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer audio data until end() is called - - adtsFrames.push(data); - }; - - this.flush = function () { - var currentFrame, - adtsFrame, - lastMetaPts, - tags = new TagList(); // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); // write out a metadata frame at every video key frame - - if (videoKeyFrames.length && currentFrame.pts >= videoKeyFrames[0]) { - lastMetaPts = videoKeyFrames.shift(); - this.writeMetaDataTags(tags, lastMetaPts); - } // also write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration. - - - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - this.writeMetaDataTags(tags, currentFrame.pts); - oldExtraData = track.extraData; - lastMetaPts = currentFrame.pts; - } - - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - adtsFrame.writeBytes(currentFrame.data); - tags.push(adtsFrame.finalize()); - } - - videoKeyFrames.length = 0; - oldExtraData = null; - this.trigger('data', { - track: track, - tags: tags.list - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.writeMetaDataTags = function (tags, pts) { - var adtsFrame; - adtsFrame = new FlvTag(FlvTag.METADATA_TAG); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; // AAC is always 10 - - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); // Is AAC always 16 bit? - - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - tags.push(adtsFrame.finalize()); - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG, true); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - tags.push(adtsFrame.finalize()); - }; - - this.onVideoKeyFrame = function (pts) { - videoKeyFrames.push(pts); - }; -}; - -_AudioSegmentStream.prototype = new Stream(); -/** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ - -_VideoSegmentStream = function VideoSegmentStream(track) { - var nalUnits = [], - config, - h264Frame; - - _VideoSegmentStream.prototype.init.call(this); - - this.finishFrame = function (tags, frame) { - if (!frame) { - return; - } // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - - - if (config && track && track.newMetadata && (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - metaTag.metaDataTag = extraTag.metaDataTag = true; - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - this.trigger('keyframe', frame.dts); - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function (data) { - collectTimelineInfo(track, data); - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer video until flush() is called - - nalUnits.push(data); - }; - - this.flush = function () { - var currentNal, - tags = new TagList(); // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); // record the track config - - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - h264Frame = new FlvTag(FlvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - - h264Frame.endNalUnit(); - } - - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', { - track: track, - tags: tags.list - }); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; -}; - -_VideoSegmentStream.prototype = new Stream(); -/** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ - -_Transmuxer = function Transmuxer(options) { - var self = this, - packetStream, - parseStream, - elementaryStream, - videoTimestampRolloverStream, - audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, - h264Stream, - videoSegmentStream, - audioSegmentStream, - captionStream, - coalesceStream; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; // expose the metadata stream - - this.metadataStream = new m2ts.MetadataStream(); - options.metadataStream = this.metadataStream; // set up the parsing pipeline - - packetStream = new m2ts.TransportPacketStream(); - parseStream = new m2ts.TransportParseStream(); - elementaryStream = new m2ts.ElementaryStream(); - videoTimestampRolloverStream = new m2ts.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - adtsStream = new AdtsStream(); - h264Stream = new H264Stream(); - coalesceStream = new CoalesceStream(options); // disassemble MPEG2-TS packets into elementary streams - - packetStream.pipe(parseStream).pipe(elementaryStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - elementaryStream.pipe(videoTimestampRolloverStream).pipe(h264Stream); - elementaryStream.pipe(audioTimestampRolloverStream).pipe(adtsStream); - elementaryStream.pipe(timedMetadataTimestampRolloverStream).pipe(this.metadataStream).pipe(coalesceStream); // if CEA-708 parsing is available, hook up a caption stream - - captionStream = new m2ts.CaptionStream(options); - h264Stream.pipe(captionStream).pipe(coalesceStream); // hook up the segment streams once track metadata is delivered - - elementaryStream.on('data', function (data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !videoSegmentStream) { - coalesceStream.numberOfTracks++; - videoSegmentStream = new _VideoSegmentStream(videoTrack); // Set up the final part of the video pipeline - - h264Stream.pipe(videoSegmentStream).pipe(coalesceStream); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream.numberOfTracks++; - audioSegmentStream = new _AudioSegmentStream(audioTrack); // Set up the final part of the audio pipeline - - adtsStream.pipe(audioSegmentStream).pipe(coalesceStream); - - if (videoSegmentStream) { - videoSegmentStream.on('keyframe', audioSegmentStream.onVideoKeyFrame); - } - } - } - }); // feed incoming data to the front of the parsing pipeline - - this.push = function (data) { - packetStream.push(data); - }; // flush any buffered data - - - this.flush = function () { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - captionStream.reset(); - }; // Re-emit any data coming from the coalesce stream to the outside world - - - coalesceStream.on('data', function (event) { - self.trigger('data', event); - }); // Let the consumer know we have finished flushing the entire pipeline - - coalesceStream.on('done', function () { - self.trigger('done'); - }); -}; - -_Transmuxer.prototype = new Stream(); // forward compatibility - -module.exports = _Transmuxer; \ No newline at end of file diff --git a/node_modules/mux.js/es/index.js b/node_modules/mux.js/es/index.js deleted file mode 100644 index 97dc1ba..0000000 --- a/node_modules/mux.js/es/index.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var muxjs = { - codecs: require('./codecs'), - mp4: require('./mp4'), - flv: require('./flv'), - mp2t: require('./m2ts'), - partial: require('./partial') -}; // include all the tools when the full library is required - -muxjs.mp4.tools = require('./tools/mp4-inspector'); -muxjs.flv.tools = require('./tools/flv-inspector'); -muxjs.mp2t.tools = require('./tools/ts-inspector'); -module.exports = muxjs; \ No newline at end of file diff --git a/node_modules/mux.js/es/m2ts/caption-stream.js b/node_modules/mux.js/es/m2ts/caption-stream.js deleted file mode 100644 index d2525ec..0000000 --- a/node_modules/mux.js/es/m2ts/caption-stream.js +++ /dev/null @@ -1,1791 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ -'use strict'; // ----------------- -// Link To Transport -// ----------------- - -var Stream = require('../utils/stream'); - -var cea708Parser = require('../tools/caption-packet-parser'); - -var CaptionStream = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream(); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } -}; - -CaptionStream.prototype = new Stream(); - -CaptionStream.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = cea708Parser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== cea708Parser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = cea708Parser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = cea708Parser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; -}; - -CaptionStream.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); -}; - -CaptionStream.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); -}; - -CaptionStream.prototype.flush = function () { - return this.flushStream('flush'); -}; // Only called if handling partial data - - -CaptionStream.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); -}; - -CaptionStream.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); -}; // From the CEA-608 spec: - -/* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. -*/ -// With that in mind, we ignore any data between an XDS control code and a -// subsequent closed-captioning control code. - - -CaptionStream.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); -}; - -CaptionStream.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; -}; - -CaptionStream.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; -}; - -CaptionStream.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; -}; - -CaptionStream.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } -}; // ---------------------- -// Session to Application -// ---------------------- -// This hash maps special and extended character codes to their -// proper Unicode equivalent. The first one-byte key is just a -// non-standard character code. The two-byte keys that follow are -// the extended CEA708 character codes, along with the preceding -// 0x10 extended character byte to distinguish these codes from -// non-extended character codes. Every CEA708 character code that -// is not in this object maps directly to a standard unicode -// character code. -// The transparent space and non-breaking transparent space are -// technically not fully supported since there is no code to -// make them transparent, so they have normal non-transparent -// stand-ins. -// The special closed caption (CC) character isn't a standard -// unicode character, so a fairly similar unicode character was -// chosen in it's place. - - -var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - -}; - -var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); -}; - -var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; -}; - -var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); -}; - -Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; -}; - -Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); -}; - -Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; -}; - -Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } -}; - -Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; -}; - -Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; -}; - -Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } -}; - -var Cea708Service = function Cea708Service(serviceNum) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; -}; -/** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - -Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } -}; -/** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - -Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; -}; - -var Cea708Stream = function Cea708Stream() { - Cea708Stream.prototype.init.call(this); - var self = this; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; -}; - -Cea708Stream.prototype = new Stream(); -/** - * Push current 708 packet, create new 708 packet. - */ - -Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; -}; -/** - * Add pts and both bytes from packet into current 708 packet. - */ - - -Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); -}; -/** - * Parse completed 708 packet into service blocks and push each service block. - */ - - -Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } -}; -/** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - -Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else if (b === 0x8e) {// DLC: Delay cancel, nothing to do - } else if (b === 0x03) {// ETX: End Text, don't need to do anything - } else if (b === 0x00) {// Padding - } else {// Unknown command - } - } -}; -/** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, true); - } else {// Unknown command - } - - return i; -}; -/** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - -Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; -}; -/** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - -Cea708Stream.prototype.initService = function (serviceNum, i) { - var self = this; - this.services[serviceNum] = new Cea708Service(serviceNum); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; -}; -/** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.handleText = function (i, service, isExtended) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var extended = isExtended ? 0x1000 : 0x0000; - var char = get708CharFromCode(extended | b); - var win = service.currentWindow; - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; -}; -/** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; -}; -/** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; -}; -/** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; -}; -/** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - -Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; -}; -/** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - -Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } -}; -/** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; -}; -/** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; -}; -/** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; -}; -/** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; -}; -/** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; -}; -/** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; -}; -/** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; -}; -/** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; -}; -/** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - -Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); -}; // This hash maps non-ASCII, special, and extended character codes to their -// proper Unicode equivalent. The first keys that are only a single byte -// are the non-standard ASCII characters, which simply map the CEA608 byte -// to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 -// character codes, but have their MSB bitmasked with 0x03 so that a lookup -// can be performed regardless of the field and data channel on which the -// character code was received. - - -var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - -}; - -var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); -}; // the index of the last row in a CEA-608 display buffer - - -var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of -// getting it through bit logic. - -var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character -// cells. The "bottom" row is the last element in the outer array. - -var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push(''); - } - - return result; -}; - -var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; -}; - -Cea608Stream.prototype = new Stream(); // Trigger a cue point that captures the current state of the -// display buffer - -Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - // eslint-disable-next-line no-console - console.error('Skipping malformed caption.'); - return ''; - } - }) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content, - stream: this.name_ - }); - } -}; -/** - * Zero out the data, used for startup and on seek - */ - - -Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; -}; -/** - * Sets up control code and related constants for this instance - */ - - -Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; -}; -/** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - -Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; -}; -/** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - -Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; -}; -/** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - -Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; -}; -/** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - -Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; -}; -/** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - -Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; -}; -/** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - -Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; -}; -/** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - -Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; -}; -/** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - -Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; -}; // Adds the opening HTML tag for the passed character to the caption text, -// and keeps track of it for later closing - - -Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); -}; // Adds HTML closing tags for current formatting to caption text and -// clears remembered formatting - - -Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); -}; // Mode Implementations - - -Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; -}; - -Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; -}; - -Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = ''; -}; - -Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; - baseRow += text; - this.displayed_[this.row_] = baseRow; -}; // exports - - -module.exports = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/m2ts/index.js b/node_modules/mux.js/es/m2ts/index.js deleted file mode 100644 index bff191a..0000000 --- a/node_modules/mux.js/es/m2ts/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = require('./m2ts'); \ No newline at end of file diff --git a/node_modules/mux.js/es/m2ts/m2ts.js b/node_modules/mux.js/es/m2ts/m2ts.js deleted file mode 100644 index 2e900a3..0000000 --- a/node_modules/mux.js/es/m2ts/m2ts.js +++ /dev/null @@ -1,535 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'), - CaptionStream = require('./caption-stream'), - StreamTypes = require('./stream-types'), - TimestampRolloverStream = require('./timestamp-rollover-stream').TimestampRolloverStream; // object types - - -var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - -var MP2T_PACKET_LENGTH = 188, - // bytes -SYNC_BYTE = 0x47; -/** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - -_TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; -}; - -_TransportPacketStream.prototype = new Stream(); -/** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - -_TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === StreamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === StreamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === StreamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = StreamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = StreamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; -}; - -_TransportParseStream.prototype = new Stream(); -_TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f -}; -/** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - -_ElementaryStream = function ElementaryStream() { - var self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case StreamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case StreamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case StreamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - this.flushStreams_(); - this.trigger('done'); - }; -}; - -_ElementaryStream.prototype = new Stream(); -var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: CaptionStream.CaptionStream, - Cea608Stream: CaptionStream.Cea608Stream, - Cea708Stream: CaptionStream.Cea708Stream, - MetadataStream: require('./metadata-stream') -}; - -for (var type in StreamTypes) { - if (StreamTypes.hasOwnProperty(type)) { - m2ts[type] = StreamTypes[type]; - } -} - -module.exports = m2ts; \ No newline at end of file diff --git a/node_modules/mux.js/es/m2ts/metadata-stream.js b/node_modules/mux.js/es/m2ts/metadata-stream.js deleted file mode 100644 index 8fca990..0000000 --- a/node_modules/mux.js/es/m2ts/metadata-stream.js +++ /dev/null @@ -1,247 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and parses out - * ID3 metadata from them, if present. - * @see http://id3.org/id3v2.3.0 - */ -'use strict'; - -var Stream = require('../utils/stream'), - StreamTypes = require('./stream-types'), - // return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding -percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; -}, - // return the string representation of the specified byte range, -// interpreted as UTf-8. -parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); -}, - // return the string representation of the specified byte range, -// interpreted as ISO-8859-1. -parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}, - parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; -}, - tagParsers = { - TXXX: function TXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); // do not include the null terminator in the tag value - - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - - tag.data = tag.value; - }, - WXXX: function WXXX(tag) { - var i; - - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function PRIV(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591(tag.data, 0, i); - break; - } - } - - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } -}, - _MetadataStream; - -_MetadataStream = function MetadataStream(options) { - var settings = { - debug: !!(options && options.debug), - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = StreamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseSyncSafeInteger(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; -}; - -_MetadataStream.prototype = new Stream(); -module.exports = _MetadataStream; \ No newline at end of file diff --git a/node_modules/mux.js/es/m2ts/probe.js b/node_modules/mux.js/es/m2ts/probe.js deleted file mode 100644 index 739a0a7..0000000 --- a/node_modules/mux.js/es/m2ts/probe.js +++ /dev/null @@ -1,299 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about TS Segments. - */ -'use strict'; - -var StreamTypes = require('./stream-types.js'); - -var parsePid = function parsePid(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; -}; - -var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) { - return !!(packet[1] & 0x40); -}; - -var parseAdaptionField = function parseAdaptionField(packet) { - var offset = 0; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[4] + 1; - } - - return offset; -}; - -var parseType = function parseType(packet, pmtPid) { - var pid = parsePid(packet); - - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - - return null; -}; - -var parsePat = function parsePat(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; -}; - -var parsePmt = function parsePmt(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section - - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table - - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type - - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry - // skip past the elementary stream descriptors, if present - - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - - return programMapTable; -}; - -var parsePesType = function parsePesType(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - return 'video'; - - case StreamTypes.ADTS_STREAM_TYPE: - return 'audio'; - - case StreamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - - default: - return null; - } -}; - -var parsePesTime = function parsePesTime(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - pes = {}; // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - - pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - - return pes; -}; - -var parseNalUnitType = function parseNalUnitType(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - - case 0x06: - return 'sei_rbsp'; - - case 0x07: - return 'seq_parameter_set_rbsp'; - - case 0x08: - return 'pic_parameter_set_rbsp'; - - case 0x09: - return 'access_unit_delimiter_rbsp'; - - default: - return null; - } -}; - -var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; // advance the sync point to a NAL start, if necessary - - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } // drop trailing zeroes - - - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; // parse the final nal - - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; -}; - -module.exports = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/m2ts/stream-types.js b/node_modules/mux.js/es/m2ts/stream-types.js deleted file mode 100644 index 9ecf7ad..0000000 --- a/node_modules/mux.js/es/m2ts/stream-types.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -module.exports = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/m2ts/timestamp-rollover-stream.js b/node_modules/mux.js/es/m2ts/timestamp-rollover-stream.js deleted file mode 100644 index 852f6a7..0000000 --- a/node_modules/mux.js/es/m2ts/timestamp-rollover-stream.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and corrects - * decode and presentation time stamps to account for a rollover - * of the 33 bit value. - */ -'use strict'; - -var Stream = require('../utils/stream'); - -var MAX_TS = 8589934592; -var RO_THRESH = 4294967296; -var TYPE_SHARED = 'shared'; - -var handleRollover = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; -}; - -var TimestampRolloverStream = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; -}; - -TimestampRolloverStream.prototype = new Stream(); -module.exports = { - TimestampRolloverStream: TimestampRolloverStream, - handleRollover: handleRollover -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/mp4/audio-frame-utils.js b/node_modules/mux.js/es/mp4/audio-frame-utils.js deleted file mode 100644 index 8dd7e12..0000000 --- a/node_modules/mux.js/es/mp4/audio-frame-utils.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var coneOfSilence = require('../data/silence'); - -var clock = require('../utils/clock'); -/** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - -var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; -}; // Possibly pad (prefix) the audio track with silence if appending this track -// would lead to the introduction of a gap in the audio buffer - - -var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = coneOfSilence()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; -}; // If the audio segment extends before the earliest allowed dts -// value, remove AAC frames until starts at or after the earliest -// allowed DTS so that we don't end up with a negative baseMedia- -// DecodeTime for the audio track - - -var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); -}; // generate the track's raw mdat data from an array of frames - - -var generateSampleTable = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; -}; // generate the track's sample table from an array of frames - - -var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; -}; - -module.exports = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/mp4/caption-parser.js b/node_modules/mux.js/es/mp4/caption-parser.js deleted file mode 100644 index 91359d2..0000000 --- a/node_modules/mux.js/es/mp4/caption-parser.js +++ /dev/null @@ -1,452 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band CEA-708 captions out of FMP4 segments. - * @see https://en.wikipedia.org/wiki/CEA-708 - */ -'use strict'; - -var discardEmulationPreventionBytes = require('../tools/caption-packet-parser').discardEmulationPreventionBytes; - -var CaptionStream = require('../m2ts/caption-stream').CaptionStream; - -var findBox = require('../mp4/find-box.js'); - -var parseTfdt = require('../tools/parse-tfdt.js'); - -var parseTrun = require('../tools/parse-trun.js'); - -var parseTfhd = require('../tools/parse-tfhd.js'); -/** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - -var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; -}; -/** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - -var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - // eslint-disable-next-line no-console - console.log("We've encountered a nal unit without data. See mux.js#233."); - break; - } - - result.push(seiNal); - break; - - default: - break; - } - } - - return result; -}; -/** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - -var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; -}; -/** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - -var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox(traf, ['trun']); - var samples; - var seiNals; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - seiNals = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = []; - } - - captionNals[trackId] = captionNals[trackId].concat(seiNals); - } - }); - return captionNals; -}; -/** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption - **/ - - -var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var seiNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - seiNals = parseCaptionNals(segment, trackId); - return { - seiNals: seiNals[trackId], - timescale: timescale - }; -}; -/** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - -var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData === null || !parsedData.seiNals) { - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {} - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); -}; - -module.exports = CaptionParser; \ No newline at end of file diff --git a/node_modules/mux.js/es/mp4/find-box.js b/node_modules/mux.js/es/mp4/find-box.js deleted file mode 100644 index 4d9b251..0000000 --- a/node_modules/mux.js/es/mp4/find-box.js +++ /dev/null @@ -1,45 +0,0 @@ -var toUnsigned = require('../utils/bin').toUnsigned; - -var parseType = require('./parse-type.js'); - -var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; -}; - -module.exports = findBox; \ No newline at end of file diff --git a/node_modules/mux.js/es/mp4/frame-utils.js b/node_modules/mux.js/es/mp4/frame-utils.js deleted file mode 100644 index 3384c14..0000000 --- a/node_modules/mux.js/es/mp4/frame-utils.js +++ /dev/null @@ -1,302 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -// Convert an array of nal units into an array of frames with each frame being -// composed of the nal units that make up that frame -// Also keep track of cummulative data about the frame from the nal units such -// as the frame duration, starting pts, etc. -var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; -}; // Convert an array of frames into an array of Gop with each Gop being composed -// of the frames that make up that Gop -// Also keep track of cummulative data about the Gop from the frames such as the -// Gop duration, starting pts, etc. - - -var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; -}; -/* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - -var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; -}; -/** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - -var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; -}; -/* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - -var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; -}; // generate the track's sample table from an array of gops - - -var generateSampleTable = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; -}; // generate the track's raw mdat data from an array of gops - - -var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; -}; // generate the track's sample table from a frame - - -var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; -}; // generate the track's raw mdat data from a frame - - -var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; -}; - -module.exports = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/mp4/index.js b/node_modules/mux.js/es/mp4/index.js deleted file mode 100644 index 0f771f0..0000000 --- a/node_modules/mux.js/es/mp4/index.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - generator: require('./mp4-generator'), - probe: require('./probe'), - Transmuxer: require('./transmuxer').Transmuxer, - AudioSegmentStream: require('./transmuxer').AudioSegmentStream, - VideoSegmentStream: require('./transmuxer').VideoSegmentStream, - CaptionParser: require('./caption-parser') -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/mp4/mp4-generator.js b/node_modules/mux.js/es/mp4/mp4-generator.js deleted file mode 100644 index 5fb19c3..0000000 --- a/node_modules/mux.js/es/mp4/mp4-generator.js +++ /dev/null @@ -1,610 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ -'use strict'; - -var UINT32_MAX = Math.pow(2, 32) - 1; -var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - -(function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); -})(); - -box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; -}; - -dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); -}; - -esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); -}; - -ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); -}; - -hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); -}; - -mdat = function mdat(data) { - return box(types.mdat, data); -}; - -mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); -}; - -mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); -}; - -mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); -}; - -minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); -}; - -moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); -}; -/** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - -moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); -}; - -mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); -}; - -mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); -}; - -sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); -}; - -stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); -}; - -(function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; -})(); - -tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); -}; -/** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - -traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (UINT32_MAX + 1)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (UINT32_MAX + 1)); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); -}; -/** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - -trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); -}; - -trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); -}; - -(function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; -})(); - -module.exports = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/mp4/parse-type.js b/node_modules/mux.js/es/mp4/parse-type.js deleted file mode 100644 index 05a7fe8..0000000 --- a/node_modules/mux.js/es/mp4/parse-type.js +++ /dev/null @@ -1,10 +0,0 @@ -var parseType = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; -}; - -module.exports = parseType; \ No newline at end of file diff --git a/node_modules/mux.js/es/mp4/probe.js b/node_modules/mux.js/es/mp4/probe.js deleted file mode 100644 index b78e597..0000000 --- a/node_modules/mux.js/es/mp4/probe.js +++ /dev/null @@ -1,335 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about MP4s. - */ -'use strict'; - -var toUnsigned = require('../utils/bin').toUnsigned; - -var toHexString = require('../utils/bin').toHexString; - -var findBox = require('../mp4/find-box.js'); - -var parseType = require('../mp4/parse-type.js'); - -var parseTfhd = require('../tools/parse-tfhd.js'); - -var parseTrun = require('../tools/parse-trun.js'); - -var parseTfdt = require('../tools/parse-tfdt.js'); - -var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader; -/** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - -timescale = function timescale(init) { - var result = {}, - traks = findBox(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); -}; -/** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - -startTime = function startTime(timescale, fragment) { - var trafs, baseTimes, result; // we need info from two childrend of each track fragment box - - trafs = findBox(fragment, ['moof', 'traf']); // determine the start times for each track - - baseTimes = [].concat.apply([], trafs.map(function (traf) { - return findBox(traf, ['tfhd']).map(function (tfhd) { - var id, scale, baseTime; // get the track id from the tfhd - - id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - baseTime = findBox(traf, ['tfdt']).map(function (tfdt) { - var version, result; - version = tfdt[0]; - result = toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]); - - if (version === 1) { - result *= Math.pow(2, 32); - result += toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11]); - } - - return result; - })[0]; - baseTime = typeof baseTime === 'number' && !isNaN(baseTime) ? baseTime : Infinity; // convert base time to seconds - - return baseTime / scale; - }); - })); // return the minimum - - result = Math.min.apply(null, baseTimes); - return isFinite(result) ? result : 0; -}; -/** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - -compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - return (baseMediaDecodeTime + compositionTimeOffset) / timescale; -}; -/** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - -getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox(trak, ['mdia', 'hdlr']); - var tkhds = findBox(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; -}; - -getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); -}; -/** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - -getTracks = function getTracks(init) { - var traks = findBox(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[a-z]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString(codecConfig[10]); // level idc - - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; -}; - -module.exports = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox, - parseType: parseType, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/mp4/track-decode-info.js b/node_modules/mux.js/es/mp4/track-decode-info.js deleted file mode 100644 index e4b53d2..0000000 --- a/node_modules/mux.js/es/mp4/track-decode-info.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; -/** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - -var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } -}; -/** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - -var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; -}; -/** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - -var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; -}; - -module.exports = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/mp4/transmuxer.js b/node_modules/mux.js/es/mp4/transmuxer.js deleted file mode 100644 index 87ee826..0000000 --- a/node_modules/mux.js/es/mp4/transmuxer.js +++ /dev/null @@ -1,1077 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('./mp4-generator.js'); - -var frameUtils = require('./frame-utils'); - -var audioFrameUtils = require('./audio-frame-utils'); - -var trackDecodeInfo = require('./track-decode-info'); - -var m2ts = require('../m2ts/m2ts.js'); - -var clock = require('../utils/clock'); - -var AdtsStream = require('../codecs/adts.js'); - -var H264Stream = require('../codecs/h264').H264Stream; - -var AacStream = require('../aac'); - -var isLikelyAacData = require('../aac/utils').isLikelyAacData; - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); - -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); // object types - - -var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; -/** - * Compare two arrays (even typed) for same-ness - */ - - -var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; -}; - -var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; -}; -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - -_AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -_AudioSegmentStream.prototype = new Stream(); -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - -_VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - VIDEO_PROPERTIES.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; -}; - -_VideoSegmentStream.prototype = new Stream(); -/** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - -_CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; -}; - -_CoalesceStream.prototype = new Stream(); - -_CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - VIDEO_PROPERTIES.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - AUDIO_PROPERTIES.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } -}; - -_CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; -}; -/** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - -_Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new AacStream(); - pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new AdtsStream(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts.TransportPacketStream(); - pipeline.parseStream = new m2ts.TransportParseStream(); - pipeline.elementaryStream = new m2ts.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream(); - pipeline.adtsStream = new AdtsStream(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; -}; - -_Transmuxer.prototype = new Stream(); -module.exports = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: AUDIO_PROPERTIES, - VIDEO_PROPERTIES: VIDEO_PROPERTIES, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/partial/audio-segment-stream.js b/node_modules/mux.js/es/partial/audio-segment-stream.js deleted file mode 100644 index 93bf9c5..0000000 --- a/node_modules/mux.js/es/partial/audio-segment-stream.js +++ /dev/null @@ -1,141 +0,0 @@ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('../mp4/mp4-generator.js'); - -var audioFrameUtils = require('../mp4/audio-frame-utils'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - */ - - -var AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity, - segmentStartPts = null, - segmentEndPts = null; - options = options || {}; - AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.processFrames_ = function () { - var frames, moof, mdat, boxes, timingInfo; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - - if (frames.length === 0) { - // return early if the frames are all after the earliest allowed DTS - // TODO should we clear the adtsFrames? - return; - } - - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4.moof(sequenceNumber, [track]); // bump the sequence number for next time - - sequenceNumber++; - track.initSegment = mp4.initSegment([track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackInfo.clearDtsInfo(track); - - if (segmentStartPts === null) { - segmentEndPts = segmentStartPts = frames[0].pts; - } - - segmentEndPts += frames.length * (ONE_SECOND_IN_TS * 1024 / track.samplerate); - timingInfo = { - start: segmentStartPts - }; - this.trigger('timingInfo', timingInfo); - this.trigger('data', { - track: track, - boxes: boxes - }); - }; - - this.flush = function () { - this.processFrames_(); // trigger final timing info - - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - this.resetTiming_(); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.partialFlush = function () { - this.processFrames_(); - this.trigger('partialdone', 'AudioSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'AudioSegmentStream'); - }; - - this.resetTiming_ = function () { - trackInfo.clearDtsInfo(track); - segmentStartPts = null; - segmentEndPts = null; - }; - - this.reset = function () { - this.resetTiming_(); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -AudioSegmentStream.prototype = new Stream(); -module.exports = AudioSegmentStream; \ No newline at end of file diff --git a/node_modules/mux.js/es/partial/index.js b/node_modules/mux.js/es/partial/index.js deleted file mode 100644 index 380fc72..0000000 --- a/node_modules/mux.js/es/partial/index.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - Transmuxer: require('./transmuxer') -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/partial/transmuxer.js b/node_modules/mux.js/es/partial/transmuxer.js deleted file mode 100644 index 9ed0034..0000000 --- a/node_modules/mux.js/es/partial/transmuxer.js +++ /dev/null @@ -1,322 +0,0 @@ -var Stream = require('../utils/stream.js'); - -var m2ts = require('../m2ts/m2ts.js'); - -var codecs = require('../codecs/index.js'); - -var AudioSegmentStream = require('./audio-segment-stream.js'); - -var VideoSegmentStream = require('./video-segment-stream.js'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var isLikelyAacData = require('../aac/utils').isLikelyAacData; - -var AdtsStream = require('../codecs/adts'); - -var AacStream = require('../aac/index'); - -var clock = require('../utils/clock'); - -var createPipeline = function createPipeline(object) { - object.prototype = new Stream(); - object.prototype.init.call(object); - return object; -}; - -var tsPipeline = function tsPipeline(options) { - var pipeline = { - type: 'ts', - tracks: { - audio: null, - video: null - }, - packet: new m2ts.TransportPacketStream(), - parse: new m2ts.TransportParseStream(), - elementary: new m2ts.ElementaryStream(), - timestampRollover: new m2ts.TimestampRolloverStream(), - adts: new codecs.Adts(), - h264: new codecs.h264.H264Stream(), - captionStream: new m2ts.CaptionStream(options), - metadataStream: new m2ts.MetadataStream() - }; - pipeline.headOfPipeline = pipeline.packet; // Transport Stream - - pipeline.packet.pipe(pipeline.parse).pipe(pipeline.elementary).pipe(pipeline.timestampRollover); // H264 - - pipeline.timestampRollover.pipe(pipeline.h264); // Hook up CEA-608/708 caption stream - - pipeline.h264.pipe(pipeline.captionStream); - pipeline.timestampRollover.pipe(pipeline.metadataStream); // ADTS - - pipeline.timestampRollover.pipe(pipeline.adts); - pipeline.elementary.on('data', function (data) { - if (data.type !== 'metadata') { - return; - } - - for (var i = 0; i < data.tracks.length; i++) { - if (!pipeline.tracks[data.tracks[i].type]) { - pipeline.tracks[data.tracks[i].type] = data.tracks[i]; - pipeline.tracks[data.tracks[i].type].timelineStartInfo.baseMediaDecodeTime = options.baseMediaDecodeTime; - } - } - - if (pipeline.tracks.video && !pipeline.videoSegmentStream) { - pipeline.videoSegmentStream = new VideoSegmentStream(pipeline.tracks.video, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - if (pipeline.tracks.audio && !options.keepOriginalTimestamps) { - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - options.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'videoTimingInfo')); - pipeline.videoSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'video', - data: data - }); - }); - pipeline.videoSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.videoSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.videoSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.h264.pipe(pipeline.videoSegmentStream); - } - - if (pipeline.tracks.audio && !pipeline.audioSegmentStream) { - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); - pipeline.adts.pipe(pipeline.audioSegmentStream); - } // emit pmt info - - - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); - pipeline.captionStream.on('data', function (caption) { - var timelineStartPts; - - if (pipeline.tracks.video) { - timelineStartPts = pipeline.tracks.video.timelineStartInfo.pts || 0; - } else { - // This will only happen if we encounter caption packets before - // video data in a segment. This is an unusual/unlikely scenario, - // so we assume the timeline starts at zero for now. - timelineStartPts = 0; - } // Translate caption PTS times into second offsets into the - // video timeline for the segment - - - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, options.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, options.keepOriginalTimestamps); - pipeline.trigger('caption', caption); - }); - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; -}; - -var aacPipeline = function aacPipeline(options) { - var pipeline = { - type: 'aac', - tracks: { - audio: null - }, - metadataStream: new m2ts.MetadataStream(), - aacStream: new AacStream(), - audioRollover: new m2ts.TimestampRolloverStream('audio'), - timedMetadataRollover: new m2ts.TimestampRolloverStream('timed-metadata'), - adtsStream: new AdtsStream(true) - }; // set up the parsing pipeline - - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioRollover).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataRollover).pipe(pipeline.metadataStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - pipeline.tracks.audio = pipeline.tracks.audio || { - timelineStartInfo: { - baseMediaDecodeTime: options.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream); - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); // set the pipeline up as a stream before binding to get access to the trigger function - - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; -}; - -var setupPipelineListeners = function setupPipelineListeners(pipeline, transmuxer) { - pipeline.on('data', transmuxer.trigger.bind(transmuxer, 'data')); - pipeline.on('done', transmuxer.trigger.bind(transmuxer, 'done')); - pipeline.on('partialdone', transmuxer.trigger.bind(transmuxer, 'partialdone')); - pipeline.on('endedtimeline', transmuxer.trigger.bind(transmuxer, 'endedtimeline')); - pipeline.on('audioTimingInfo', transmuxer.trigger.bind(transmuxer, 'audioTimingInfo')); - pipeline.on('videoTimingInfo', transmuxer.trigger.bind(transmuxer, 'videoTimingInfo')); - pipeline.on('trackinfo', transmuxer.trigger.bind(transmuxer, 'trackinfo')); - pipeline.on('id3Frame', function (event) { - // add this to every single emitted segment even though it's only needed for the first - event.dispatchType = pipeline.metadataStream.dispatchType; // keep original time, can be adjusted if needed at a higher level - - event.cueTime = clock.videoTsToSeconds(event.pts); - transmuxer.trigger('id3Frame', event); - }); - pipeline.on('caption', function (event) { - transmuxer.trigger('caption', event); - }); -}; - -var Transmuxer = function Transmuxer(options) { - var pipeline = null, - hasFlushed = true; - options = options || {}; - Transmuxer.prototype.init.call(this); - options.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - - this.push = function (bytes) { - if (hasFlushed) { - var isAac = isLikelyAacData(bytes); - - if (isAac && (!pipeline || pipeline.type !== 'aac')) { - pipeline = aacPipeline(options); - setupPipelineListeners(pipeline, this); - } else if (!isAac && (!pipeline || pipeline.type !== 'ts')) { - pipeline = tsPipeline(options); - setupPipelineListeners(pipeline, this); - } - - hasFlushed = false; - } - - pipeline.headOfPipeline.push(bytes); - }; - - this.flush = function () { - if (!pipeline) { - return; - } - - hasFlushed = true; - pipeline.headOfPipeline.flush(); - }; - - this.partialFlush = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.partialFlush(); - }; - - this.endTimeline = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.reset(); - }; - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - if (!options.keepOriginalTimestamps) { - options.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (!pipeline) { - return; - } - - if (pipeline.tracks.audio) { - pipeline.tracks.audio.timelineStartInfo.dts = undefined; - pipeline.tracks.audio.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.audio); - - if (pipeline.audioRollover) { - pipeline.audioRollover.discontinuity(); - } - } - - if (pipeline.tracks.video) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - pipeline.tracks.video.timelineStartInfo.dts = undefined; - pipeline.tracks.video.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.video); // pipeline.captionStream.reset(); - } - - if (pipeline.timestampRollover) { - pipeline.timestampRollover.discontinuity(); - } - }; - - this.setRemux = function (val) { - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.setAudioAppendStart = function (audioAppendStart) { - if (!pipeline || !pipeline.tracks.audio || !pipeline.audioSegmentStream) { - return; - } - - pipeline.audioSegmentStream.setAudioAppendStart(audioAppendStart); - }; // TODO GOP alignment support - // Support may be a bit trickier than with full segment appends, as GOPs may be split - // and processed in a more granular fashion - - - this.alignGopsWith = function (gopsToAlignWith) { - return; - }; -}; - -Transmuxer.prototype = new Stream(); -module.exports = Transmuxer; \ No newline at end of file diff --git a/node_modules/mux.js/es/partial/video-segment-stream.js b/node_modules/mux.js/es/partial/video-segment-stream.js deleted file mode 100644 index 826bab6..0000000 --- a/node_modules/mux.js/es/partial/video-segment-stream.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('../mp4/mp4-generator.js'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var frameUtils = require('../mp4/frame-utils'); - -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); - -var VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - frameCache = [], - // gopsToAlignWith = [], - config, - pps, - segmentStartPts = null, - segmentEndPts = null, - gops, - ensureNextFrameIsKeyFrame = true; - options = options || {}; - VideoSegmentStream.prototype.init.call(this); - - this.push = function (nalUnit) { - trackInfo.collectDtsInfo(track, nalUnit); - - if (typeof track.timelineStartInfo.dts === 'undefined') { - track.timelineStartInfo.dts = nalUnit.dts; - } // record the track config - - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - VIDEO_PROPERTIES.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - - this.processNals_ = function (cacheLastFrame) { - var i; - nalUnits = frameCache.concat(nalUnits); // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - return; - } - - var frames = frameUtils.groupNalsIntoFrames(nalUnits); - - if (!frames.length) { - return; - } // note that the frame cache may also protect us from cases where we haven't - // pushed data for the entire first or last frame yet - - - frameCache = frames[frames.length - 1]; - - if (cacheLastFrame) { - frames.pop(); - frames.duration -= frameCache.duration; - frames.nalCount -= frameCache.length; - frames.byteLength -= frameCache.byteLength; - } - - if (!frames.length) { - nalUnits = []; - return; - } - - this.trigger('timelineStartInfo', track.timelineStartInfo); - - if (ensureNextFrameIsKeyFrame) { - gops = frameUtils.groupFramesIntoGops(frames); - - if (!gops[0][0].keyFrame) { - gops = frameUtils.extendFirstKeyFrame(gops); - - if (!gops[0][0].keyFrame) { - // we haven't yet gotten a key frame, so reset nal units to wait for more nal - // units - nalUnits = [].concat.apply([], frames).concat(frameCache); - frameCache = []; - return; - } - - frames = [].concat.apply([], gops); - frames.duration = gops.duration; - } - - ensureNextFrameIsKeyFrame = false; - } - - if (segmentStartPts === null) { - segmentStartPts = frames[0].pts; - segmentEndPts = segmentStartPts; - } - - segmentEndPts += frames.duration; - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - - for (i = 0; i < frames.length; i++) { - var frame = frames[i]; - track.samples = frameUtils.generateSampleTableForFrame(frame); - var mdat = mp4.mdat(frameUtils.concatenateNalDataForFrame(frame)); - trackInfo.clearDtsInfo(track); - trackInfo.collectDtsInfo(track, frame); - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - var moof = mp4.moof(sequenceNumber, [track]); - sequenceNumber++; - track.initSegment = mp4.initSegment([track]); - var boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes, - sequence: sequenceNumber, - videoFrameDts: frame.dts, - videoFramePts: frame.pts - }); - } - - nalUnits = []; - }; - - this.resetTimingAndConfig_ = function () { - config = undefined; - pps = undefined; - segmentStartPts = null; - segmentEndPts = null; - }; - - this.partialFlush = function () { - this.processNals_(true); - this.trigger('partialdone', 'VideoSegmentStream'); - }; - - this.flush = function () { - this.processNals_(false); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - this.resetTimingAndConfig_(); - this.trigger('done', 'VideoSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetTimingAndConfig_(); - frameCache = []; - nalUnits = []; - ensureNextFrameIsKeyFrame = true; - this.trigger('reset'); - }; -}; - -VideoSegmentStream.prototype = new Stream(); -module.exports = VideoSegmentStream; \ No newline at end of file diff --git a/node_modules/mux.js/es/tools/caption-packet-parser.js b/node_modules/mux.js/es/tools/caption-packet-parser.js deleted file mode 100644 index 129adc6..0000000 --- a/node_modules/mux.js/es/tools/caption-packet-parser.js +++ /dev/null @@ -1,189 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ -'use strict'; // Supplemental enhancement information (SEI) NAL units have a -// payload type field to indicate how they are to be -// interpreted. CEAS-708 caption content is always transmitted with -// payload type 0x04. - -var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; -/** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - -var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; -}; // see ANSI/SCTE 128-1 (2013), section 8.1 - - -var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); -}; // see CEA-708-D, section 4.4 - - -var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; -}; - -var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; -}; // exports - - -module.exports = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/tools/flv-inspector.js b/node_modules/mux.js/es/tools/flv-inspector.js deleted file mode 100644 index 6502fd1..0000000 --- a/node_modules/mux.js/es/tools/flv-inspector.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var tagTypes = { - 0x08: 'audio', - 0x09: 'video', - 0x12: 'metadata' -}, - hex = function hex(val) { - return '0x' + ('00' + val.toString(16)).slice(-2).toUpperCase(); -}, - hexStringList = function hexStringList(data) { - var arr = [], - i; - - while (data.byteLength > 0) { - i = 0; - arr.push(hex(data[i++])); - data = data.subarray(i); - } - - return arr.join(' '); -}, - parseAVCTag = function parseAVCTag(tag, obj) { - var avcPacketTypes = ['AVC Sequence Header', 'AVC NALU', 'AVC End-of-Sequence'], - compositionTime = tag[1] & parseInt('01111111', 2) << 16 | tag[2] << 8 | tag[3]; - obj = obj || {}; - obj.avcPacketType = avcPacketTypes[tag[0]]; - obj.CompositionTime = tag[1] & parseInt('10000000', 2) ? -compositionTime : compositionTime; - - if (tag[0] === 1) { - obj.nalUnitTypeRaw = hexStringList(tag.subarray(4, 100)); - } else { - obj.data = hexStringList(tag.subarray(4)); - } - - return obj; -}, - parseVideoTag = function parseVideoTag(tag, obj) { - var frameTypes = ['Unknown', 'Keyframe (for AVC, a seekable frame)', 'Inter frame (for AVC, a nonseekable frame)', 'Disposable inter frame (H.263 only)', 'Generated keyframe (reserved for server use only)', 'Video info/command frame'], - codecID = tag[0] & parseInt('00001111', 2); - obj = obj || {}; - obj.frameType = frameTypes[(tag[0] & parseInt('11110000', 2)) >>> 4]; - obj.codecID = codecID; - - if (codecID === 7) { - return parseAVCTag(tag.subarray(1), obj); - } - - return obj; -}, - parseAACTag = function parseAACTag(tag, obj) { - var packetTypes = ['AAC Sequence Header', 'AAC Raw']; - obj = obj || {}; - obj.aacPacketType = packetTypes[tag[0]]; - obj.data = hexStringList(tag.subarray(1)); - return obj; -}, - parseAudioTag = function parseAudioTag(tag, obj) { - var formatTable = ['Linear PCM, platform endian', 'ADPCM', 'MP3', 'Linear PCM, little endian', 'Nellymoser 16-kHz mono', 'Nellymoser 8-kHz mono', 'Nellymoser', 'G.711 A-law logarithmic PCM', 'G.711 mu-law logarithmic PCM', 'reserved', 'AAC', 'Speex', 'MP3 8-Khz', 'Device-specific sound'], - samplingRateTable = ['5.5-kHz', '11-kHz', '22-kHz', '44-kHz'], - soundFormat = (tag[0] & parseInt('11110000', 2)) >>> 4; - obj = obj || {}; - obj.soundFormat = formatTable[soundFormat]; - obj.soundRate = samplingRateTable[(tag[0] & parseInt('00001100', 2)) >>> 2]; - obj.soundSize = (tag[0] & parseInt('00000010', 2)) >>> 1 ? '16-bit' : '8-bit'; - obj.soundType = tag[0] & parseInt('00000001', 2) ? 'Stereo' : 'Mono'; - - if (soundFormat === 10) { - return parseAACTag(tag.subarray(1), obj); - } - - return obj; -}, - parseGenericTag = function parseGenericTag(tag) { - return { - tagType: tagTypes[tag[0]], - dataSize: tag[1] << 16 | tag[2] << 8 | tag[3], - timestamp: tag[7] << 24 | tag[4] << 16 | tag[5] << 8 | tag[6], - streamID: tag[8] << 16 | tag[9] << 8 | tag[10] - }; -}, - inspectFlvTag = function inspectFlvTag(tag) { - var header = parseGenericTag(tag); - - switch (tag[0]) { - case 0x08: - parseAudioTag(tag.subarray(11), header); - break; - - case 0x09: - parseVideoTag(tag.subarray(11), header); - break; - - case 0x12: - } - - return header; -}, - inspectFlv = function inspectFlv(bytes) { - var i = 9, - // header - dataSize, - parsedResults = [], - tag; // traverse the tags - - i += 4; // skip previous tag size - - while (i < bytes.byteLength) { - dataSize = bytes[i + 1] << 16; - dataSize |= bytes[i + 2] << 8; - dataSize |= bytes[i + 3]; - dataSize += 11; - tag = bytes.subarray(i, i + dataSize); - parsedResults.push(inspectFlvTag(tag)); - i += dataSize + 4; - } - - return parsedResults; -}, - textifyFlv = function textifyFlv(flvTagArray) { - return JSON.stringify(flvTagArray, null, 2); -}; - -module.exports = { - inspectTag: inspectFlvTag, - inspect: inspectFlv, - textify: textifyFlv -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/tools/mp4-inspector.js b/node_modules/mux.js/es/tools/mp4-inspector.js deleted file mode 100644 index 935600f..0000000 --- a/node_modules/mux.js/es/tools/mp4-inspector.js +++ /dev/null @@ -1,753 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse the internal MP4 structure into an equivalent javascript - * object. - */ -'use strict'; - -var MAX_UINT32 = Math.pow(2, 32); - -var inspectMp4, - _textifyMp, - parseMp4Date = function parseMp4Date(seconds) { - return new Date(seconds * 1000 - 2082844800000); -}, - parseType = require('../mp4/parse-type'), - findBox = require('../mp4/find-box'), - nalParse = function nalParse(avcStream) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - i, - length; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - result.push('MALFORMED DATA'); - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x01: - result.push('slice_layer_without_partitioning_rbsp'); - break; - - case 0x05: - result.push('slice_layer_without_partitioning_rbsp_idr'); - break; - - case 0x06: - result.push('sei_rbsp'); - break; - - case 0x07: - result.push('seq_parameter_set_rbsp'); - break; - - case 0x08: - result.push('pic_parameter_set_rbsp'); - break; - - case 0x09: - result.push('access_unit_delimiter_rbsp'); - break; - - default: - result.push('UNKNOWN NAL - ' + avcStream[i] & 0x1F); - break; - } - } - - return result; -}, - // registry of handlers for individual mp4 box types -parse = { - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - avc1: function avc1(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - dataReferenceIndex: view.getUint16(6), - width: view.getUint16(24), - height: view.getUint16(26), - horizresolution: view.getUint16(28) + view.getUint16(30) / 16, - vertresolution: view.getUint16(32) + view.getUint16(34) / 16, - frameCount: view.getUint16(40), - depth: view.getUint16(74), - config: inspectMp4(data.subarray(78, data.byteLength)) - }; - }, - avcC: function avcC(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - configurationVersion: data[0], - avcProfileIndication: data[1], - profileCompatibility: data[2], - avcLevelIndication: data[3], - lengthSizeMinusOne: data[4] & 0x03, - sps: [], - pps: [] - }, - numOfSequenceParameterSets = data[5] & 0x1f, - numOfPictureParameterSets, - nalSize, - offset, - i; // iterate past any SPSs - - offset = 6; - - for (i = 0; i < numOfSequenceParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.sps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } // iterate past any PPSs - - - numOfPictureParameterSets = data[offset]; - offset++; - - for (i = 0; i < numOfPictureParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.pps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } - - return result; - }, - btrt: function btrt(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - bufferSizeDB: view.getUint32(0), - maxBitrate: view.getUint32(4), - avgBitrate: view.getUint32(8) - }; - }, - edts: function edts(data) { - return { - boxes: inspectMp4(data) - }; - }, - elst: function elst(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - edits: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; entryCount--) { - if (result.version === 0) { - result.edits.push({ - segmentDuration: view.getUint32(i), - mediaTime: view.getInt32(i + 4), - mediaRate: view.getUint16(i + 8) + view.getUint16(i + 10) / (256 * 256) - }); - i += 12; - } else { - result.edits.push({ - segmentDuration: view.getUint32(i) * MAX_UINT32 + view.getUint32(i + 4), - mediaTime: view.getUint32(i + 8) * MAX_UINT32 + view.getUint32(i + 12), - mediaRate: view.getUint16(i + 16) + view.getUint16(i + 18) / (256 * 256) - }); - i += 20; - } - } - - return result; - }, - esds: function esds(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - esId: data[6] << 8 | data[7], - streamPriority: data[8] & 0x1f, - decoderConfig: { - objectProfileIndication: data[11], - streamType: data[12] >>> 2 & 0x3f, - bufferSize: data[13] << 16 | data[14] << 8 | data[15], - maxBitrate: data[16] << 24 | data[17] << 16 | data[18] << 8 | data[19], - avgBitrate: data[20] << 24 | data[21] << 16 | data[22] << 8 | data[23], - decoderConfigDescriptor: { - tag: data[24], - length: data[25], - audioObjectType: data[26] >>> 3 & 0x1f, - samplingFrequencyIndex: (data[26] & 0x07) << 1 | data[27] >>> 7 & 0x01, - channelConfiguration: data[27] >>> 3 & 0x0f - } - } - }; - }, - ftyp: function ftyp(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - majorBrand: parseType(data.subarray(0, 4)), - minorVersion: view.getUint32(4), - compatibleBrands: [] - }, - i = 8; - - while (i < data.byteLength) { - result.compatibleBrands.push(parseType(data.subarray(i, i + 4))); - i += 4; - } - - return result; - }, - dinf: function dinf(data) { - return { - boxes: inspectMp4(data) - }; - }, - dref: function dref(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - dataReferences: inspectMp4(data.subarray(8)) - }; - }, - hdlr: function hdlr(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - handlerType: parseType(data.subarray(8, 12)), - name: '' - }, - i = 8; // parse out the name field - - for (i = 24; i < data.byteLength; i++) { - if (data[i] === 0x00) { - // the name field is null-terminated - i++; - break; - } - - result.name += String.fromCharCode(data[i]); - } // decode UTF-8 to javascript's internal representation - // see http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html - - - result.name = decodeURIComponent(escape(result.name)); - return result; - }, - mdat: function mdat(data) { - return { - byteLength: data.byteLength, - nals: nalParse(data) - }; - }, - mdhd: function mdhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - language, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - language: '' - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // language is stored as an ISO-639-2/T code in an array of three 5-bit fields - // each field is the packed difference between its ASCII value and 0x60 - - language = view.getUint16(i); - result.language += String.fromCharCode((language >> 10) + 0x60); - result.language += String.fromCharCode(((language & 0x03e0) >> 5) + 0x60); - result.language += String.fromCharCode((language & 0x1f) + 0x60); - return result; - }, - mdia: function mdia(data) { - return { - boxes: inspectMp4(data) - }; - }, - mfhd: function mfhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sequenceNumber: data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7] - }; - }, - minf: function minf(data) { - return { - boxes: inspectMp4(data) - }; - }, - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - mp4a: function mp4a(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - // 6 bytes reserved - dataReferenceIndex: view.getUint16(6), - // 4 + 4 bytes reserved - channelcount: view.getUint16(16), - samplesize: view.getUint16(18), - // 2 bytes pre_defined - // 2 bytes reserved - samplerate: view.getUint16(24) + view.getUint16(26) / 65536 - }; // if there are more bytes to process, assume this is an ISO/IEC - // 14496-14 MP4AudioSampleEntry and parse the ESDBox - - if (data.byteLength > 28) { - result.streamDescriptor = inspectMp4(data.subarray(28))[0]; - } - - return result; - }, - moof: function moof(data) { - return { - boxes: inspectMp4(data) - }; - }, - moov: function moov(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvex: function mvex(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvhd: function mvhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // convert fixed-point, base 16 back to a number - - result.rate = view.getUint16(i) + view.getUint16(i + 2) / 16; - i += 4; - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - i += 2 * 4; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - i += 6 * 4; - result.nextTrackId = view.getUint32(i); - return result; - }, - pdin: function pdin(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - rate: view.getUint32(4), - initialDelay: view.getUint32(8) - }; - }, - sdtp: function sdtp(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - i; - - for (i = 4; i < data.byteLength; i++) { - result.samples.push({ - dependsOn: (data[i] & 0x30) >> 4, - isDependedOn: (data[i] & 0x0c) >> 2, - hasRedundancy: data[i] & 0x03 - }); - } - - return result; - }, - sidx: require('./parse-sidx.js'), - smhd: function smhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - balance: data[4] + data[5] / 256 - }; - }, - stbl: function stbl(data) { - return { - boxes: inspectMp4(data) - }; - }, - ctts: function ctts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - compositionOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.compositionOffsets.push({ - sampleCount: view.getUint32(i), - sampleOffset: view[result.version === 0 ? 'getUint32' : 'getInt32'](i + 4) - }); - } - - return result; - }, - stss: function stss(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - syncSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.syncSamples.push(view.getUint32(i)); - } - - return result; - }, - stco: function stco(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - chunkOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.chunkOffsets.push(view.getUint32(i)); - } - - return result; - }, - stsc: function stsc(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - entryCount = view.getUint32(4), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleToChunks: [] - }, - i; - - for (i = 8; entryCount; i += 12, entryCount--) { - result.sampleToChunks.push({ - firstChunk: view.getUint32(i), - samplesPerChunk: view.getUint32(i + 4), - sampleDescriptionIndex: view.getUint32(i + 8) - }); - } - - return result; - }, - stsd: function stsd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleDescriptions: inspectMp4(data.subarray(8)) - }; - }, - stsz: function stsz(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleSize: view.getUint32(4), - entries: [] - }, - i; - - for (i = 12; i < data.byteLength; i += 4) { - result.entries.push(view.getUint32(i)); - } - - return result; - }, - stts: function stts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - timeToSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.timeToSamples.push({ - sampleCount: view.getUint32(i), - sampleDelta: view.getUint32(i + 4) - }); - } - - return result; - }, - styp: function styp(data) { - return parse.ftyp(data); - }, - tfdt: require('./parse-tfdt.js'), - tfhd: require('./parse-tfhd.js'), - tkhd: function tkhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; - i += 2 * 4; - result.layer = view.getUint16(i); - i += 2; - result.alternateGroup = view.getUint16(i); - i += 2; // convert fixed-point, base 16 back to a number - - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - result.width = view.getUint16(i) + view.getUint16(i + 2) / 65536; - i += 4; - result.height = view.getUint16(i) + view.getUint16(i + 2) / 65536; - return result; - }, - traf: function traf(data) { - return { - boxes: inspectMp4(data) - }; - }, - trak: function trak(data) { - return { - boxes: inspectMp4(data) - }; - }, - trex: function trex(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4), - defaultSampleDescriptionIndex: view.getUint32(8), - defaultSampleDuration: view.getUint32(12), - defaultSampleSize: view.getUint32(16), - sampleDependsOn: data[20] & 0x03, - sampleIsDependedOn: (data[21] & 0xc0) >> 6, - sampleHasRedundancy: (data[21] & 0x30) >> 4, - samplePaddingValue: (data[21] & 0x0e) >> 1, - sampleIsDifferenceSample: !!(data[21] & 0x01), - sampleDegradationPriority: view.getUint16(22) - }; - }, - trun: require('./parse-trun.js'), - 'url ': function url(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - }, - vmhd: function vmhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - graphicsmode: view.getUint16(4), - opcolor: new Uint16Array([view.getUint16(6), view.getUint16(8), view.getUint16(10)]) - }; - } -}; -/** - * Return a javascript array of box objects parsed from an ISO base - * media file. - * @param data {Uint8Array} the binary data of the media to be inspected - * @return {array} a javascript array of potentially nested box objects - */ - - -inspectMp4 = function inspectMp4(data) { - var i = 0, - result = [], - view, - size, - type, - end, - box; // Convert data from Uint8Array to ArrayBuffer, to follow Dataview API - - var ab = new ArrayBuffer(data.length); - var v = new Uint8Array(ab); - - for (var z = 0; z < data.length; ++z) { - v[z] = data[z]; - } - - view = new DataView(ab); - - while (i < data.byteLength) { - // parse box data - size = view.getUint32(i); - type = parseType(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; // parse type-specific data - - box = (parse[type] || function (data) { - return { - data: data - }; - })(data.subarray(i + 8, end)); - - box.size = size; - box.type = type; // store this box and move to the next - - result.push(box); - i = end; - } - - return result; -}; -/** - * Returns a textual representation of the javascript represtentation - * of an MP4 file. You can use it as an alternative to - * JSON.stringify() to compare inspected MP4s. - * @param inspectedMp4 {array} the parsed array of boxes in an MP4 - * file - * @param depth {number} (optional) the number of ancestor boxes of - * the elements of inspectedMp4. Assumed to be zero if unspecified. - * @return {string} a text representation of the parsed MP4 - */ - - -_textifyMp = function textifyMp4(inspectedMp4, depth) { - var indent; - depth = depth || 0; - indent = new Array(depth * 2 + 1).join(' '); // iterate over all the boxes - - return inspectedMp4.map(function (box, index) { - // list the box type first at the current indentation level - return indent + box.type + '\n' + // the type is already included and handle child boxes separately - Object.keys(box).filter(function (key) { - return key !== 'type' && key !== 'boxes'; // output all the box properties - }).map(function (key) { - var prefix = indent + ' ' + key + ': ', - value = box[key]; // print out raw bytes as hexademical - - if (value instanceof Uint8Array || value instanceof Uint32Array) { - var bytes = Array.prototype.slice.call(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)).map(function (byte) { - return ' ' + ('00' + byte.toString(16)).slice(-2); - }).join('').match(/.{1,24}/g); - - if (!bytes) { - return prefix + '<>'; - } - - if (bytes.length === 1) { - return prefix + '<' + bytes.join('').slice(1) + '>'; - } - - return prefix + '<\n' + bytes.map(function (line) { - return indent + ' ' + line; - }).join('\n') + '\n' + indent + ' >'; - } // stringify generic objects - - - return prefix + JSON.stringify(value, null, 2).split('\n').map(function (line, index) { - if (index === 0) { - return line; - } - - return indent + ' ' + line; - }).join('\n'); - }).join('\n') + ( // recursively textify the child boxes - box.boxes ? '\n' + _textifyMp(box.boxes, depth + 1) : ''); - }).join('\n'); -}; - -module.exports = { - inspect: inspectMp4, - textify: _textifyMp, - parseType: parseType, - findBox: findBox, - parseTraf: parse.traf, - parseTfdt: parse.tfdt, - parseHdlr: parse.hdlr, - parseTfhd: parse.tfhd, - parseTrun: parse.trun, - parseSidx: parse.sidx -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/tools/parse-sample-flags.js b/node_modules/mux.js/es/tools/parse-sample-flags.js deleted file mode 100644 index 993a61e..0000000 --- a/node_modules/mux.js/es/tools/parse-sample-flags.js +++ /dev/null @@ -1,13 +0,0 @@ -var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; -}; - -module.exports = parseSampleFlags; \ No newline at end of file diff --git a/node_modules/mux.js/es/tools/parse-sidx.js b/node_modules/mux.js/es/tools/parse-sidx.js deleted file mode 100644 index 210ef74..0000000 --- a/node_modules/mux.js/es/tools/parse-sidx.js +++ /dev/null @@ -1,44 +0,0 @@ -var MAX_UINT32 = Math.pow(2, 32); - -var parseSidx = function parseSidx(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - references: [], - referenceId: view.getUint32(4), - timescale: view.getUint32(8) - }, - i = 12; - - if (result.version === 0) { - result.earliestPresentationTime = view.getUint32(i); - result.firstOffset = view.getUint32(i + 4); - i += 8; - } else { - // read 64 bits - result.earliestPresentationTime = view.getUint32(i) * MAX_UINT32 + view.getUint32(i + 4); - result.firstOffset = view.getUint32(i + 8) * MAX_UINT32 + view.getUint32(i + 12); - i += 16; - } - - i += 2; // reserved - - var referenceCount = view.getUint16(i); - i += 2; // start of references - - for (; referenceCount > 0; i += 12, referenceCount--) { - result.references.push({ - referenceType: (data[i] & 0x80) >>> 7, - referencedSize: view.getUint32(i) & 0x7FFFFFFF, - subsegmentDuration: view.getUint32(i + 4), - startsWithSap: !!(data[i + 8] & 0x80), - sapType: (data[i + 8] & 0x70) >>> 4, - sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF - }); - } - - return result; -}; - -module.exports = parseSidx; \ No newline at end of file diff --git a/node_modules/mux.js/es/tools/parse-tfdt.js b/node_modules/mux.js/es/tools/parse-tfdt.js deleted file mode 100644 index 39c594a..0000000 --- a/node_modules/mux.js/es/tools/parse-tfdt.js +++ /dev/null @@ -1,18 +0,0 @@ -var toUnsigned = require('../utils/bin').toUnsigned; - -var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - baseMediaDecodeTime: toUnsigned(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime *= Math.pow(2, 32); - result.baseMediaDecodeTime += toUnsigned(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11]); - } - - return result; -}; - -module.exports = tfdt; \ No newline at end of file diff --git a/node_modules/mux.js/es/tools/parse-tfhd.js b/node_modules/mux.js/es/tools/parse-tfhd.js deleted file mode 100644 index 41b90ef..0000000 --- a/node_modules/mux.js/es/tools/parse-tfhd.js +++ /dev/null @@ -1,56 +0,0 @@ -var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; -}; - -module.exports = tfhd; \ No newline at end of file diff --git a/node_modules/mux.js/es/tools/parse-trun.js b/node_modules/mux.js/es/tools/parse-trun.js deleted file mode 100644 index 4b7932d..0000000 --- a/node_modules/mux.js/es/tools/parse-trun.js +++ /dev/null @@ -1,99 +0,0 @@ -var parseSampleFlags = require('./parse-sample-flags.js'); - -var trun = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; -}; - -module.exports = trun; \ No newline at end of file diff --git a/node_modules/mux.js/es/tools/ts-inspector.js b/node_modules/mux.js/es/tools/ts-inspector.js deleted file mode 100644 index ba27ede..0000000 --- a/node_modules/mux.js/es/tools/ts-inspector.js +++ /dev/null @@ -1,555 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse mpeg2 transport stream packets to extract basic timing information - */ -'use strict'; - -var StreamTypes = require('../m2ts/stream-types.js'); - -var handleRollover = require('../m2ts/timestamp-rollover-stream.js').handleRollover; - -var probe = {}; -probe.ts = require('../m2ts/probe.js'); -probe.aac = require('../aac/utils.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var MP2T_PACKET_LENGTH = 188, - // bytes -SYNC_BYTE = 0x47; -/** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ - -var parsePsi_ = function parsePsi_(bytes, pmt) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - - case 'pmt': - var table = probe.ts.parsePmt(packet); - pmt.table = pmt.table || {}; - Object.keys(table).forEach(function (key) { - pmt.table[key] = table[key]; - }); - break; - - default: - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } -}; -/** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ - - -var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed; - var endLoop = false; // Start walking from start of segment to get first audio packet - - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last audio packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } -}; -/** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ - - -var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed, - frame, - i, - pes; - var endLoop = false; - var currentFrame = { - data: [], - size: 0 - }; // Start walking from start of segment to get first video packet - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn('Failed to extract PTS/DTS from PES at first keyframe. ' + 'This could be an unusual TS segment, or else mux.js did not ' + 'parse your TS segment correctly. If you know your TS ' + 'segments do contain PTS/DTS on keyframes please file a bug ' + 'report! You can try ffprobe to double check for yourself.'); - } - } - - currentFrame.size = 0; - } - } - - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - - break; - - default: - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last video packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } -}; -/** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ - - -var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - - segmentInfo.audio.forEach(function (info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - - segmentInfo.video.forEach(function (info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds - - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } -}; -/** - * inspects the aac data stream for start and end time information - */ - - -var inspectAac_ = function inspectAac_(bytes) { - var endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - - byteIndex += frameSize; - break; - - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - - audioCount++; - byteIndex += frameSize; - break; - - default: - byteIndex++; - break; - } - - if (endLoop) { - return null; - } - } - - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - var result = { - audio: [{ - type: 'audio', - dts: timestamp, - pts: timestamp - }, { - type: 'audio', - dts: timestamp + audioCount * 1024 * audioTimescale, - pts: timestamp + audioCount * 1024 * audioTimescale - }] - }; - return result; -}; -/** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ - - -var inspectTs_ = function inspectTs_(bytes) { - var pmt = { - pid: null, - table: null - }; - var result = {}; - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - - if (result.video.length === 0) { - delete result.video; - } - - break; - - case StreamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - - if (result.audio.length === 0) { - delete result.audio; - } - - break; - - default: - break; - } - } - } - - return result; -}; -/** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ - - -var inspect = function inspect(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || !result.audio && !result.video) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - return result; -}; - -module.exports = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/utils/bin.js b/node_modules/mux.js/es/utils/bin.js deleted file mode 100644 index 963bd5f..0000000 --- a/node_modules/mux.js/es/utils/bin.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var toUnsigned = function toUnsigned(value) { - return value >>> 0; -}; - -var toHexString = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); -}; - -module.exports = { - toUnsigned: toUnsigned, - toHexString: toHexString -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/utils/clock.js b/node_modules/mux.js/es/utils/clock.js deleted file mode 100644 index d68b177..0000000 --- a/node_modules/mux.js/es/utils/clock.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var ONE_SECOND_IN_TS = 90000, - // 90kHz clock -secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - -secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS; -}; - -secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; -}; - -videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS; -}; - -audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; -}; - -audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); -}; - -videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); -}; -/** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - -metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); -}; - -module.exports = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds -}; \ No newline at end of file diff --git a/node_modules/mux.js/es/utils/exp-golomb.js b/node_modules/mux.js/es/utils/exp-golomb.js deleted file mode 100644 index 5fd249e..0000000 --- a/node_modules/mux.js/es/utils/exp-golomb.js +++ /dev/null @@ -1,154 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var ExpGolomb; -/** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - -ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); -}; - -module.exports = ExpGolomb; \ No newline at end of file diff --git a/node_modules/mux.js/es/utils/stream.js b/node_modules/mux.js/es/utils/stream.js deleted file mode 100644 index 7d28c99..0000000 --- a/node_modules/mux.js/es/utils/stream.js +++ /dev/null @@ -1,153 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ -'use strict'; - -var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; -}; -/** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - -Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; -}; // Default stream functions that are expected to be overridden to perform -// actual work. These are provided by the prototype as a sort of no-op -// implementation so that we don't have to check for their existence in the -// `pipe` function above. - - -Stream.prototype.push = function (data) { - this.trigger('data', data); -}; - -Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); -}; - -Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); -}; - -Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); -}; - -Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); -}; - -module.exports = Stream; \ No newline at end of file diff --git a/node_modules/mux.js/index.html b/node_modules/mux.js/index.html deleted file mode 100644 index 5adb9c0..0000000 --- a/node_modules/mux.js/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Mux.js Demo - - - -

    use window.muxjs in the console!

    - - - - - diff --git a/node_modules/mux.js/lib/aac/index.js b/node_modules/mux.js/lib/aac/index.js deleted file mode 100644 index 5a8e40f..0000000 --- a/node_modules/mux.js/lib/aac/index.js +++ /dev/null @@ -1,131 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based aac to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; -var Stream = require('../utils/stream.js'); -var aacUtils = require('./utils'); - -// Constants -var AacStream; - -/** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - -AacStream = function() { - var - everything = new Uint8Array(), - timeStamp = 0; - - AacStream.prototype.init.call(this); - - this.setTimestamp = function(timestamp) { - timeStamp = timestamp; - }; - - this.push = function(bytes) { - var - frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; - - // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if ((everything[byteIndex] === 'I'.charCodeAt(0)) && - (everything[byteIndex + 1] === 'D'.charCodeAt(0)) && - (everything[byteIndex + 2] === '3'.charCodeAt(0))) { - - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } - - // check framesize - frameSize = aacUtils.parseId3TagSize(everything, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - if (byteIndex + frameSize > everything.length) { - break; - } - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if (((everything[byteIndex] & 0xff) === 0xff) && - ((everything[byteIndex + 1] & 0xf0) === 0xf0)) { - - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = aacUtils.parseAdtsSize(everything, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - byteIndex++; - } - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function() { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function() { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; -}; - -AacStream.prototype = new Stream(); - -module.exports = AacStream; diff --git a/node_modules/mux.js/lib/aac/utils.js b/node_modules/mux.js/lib/aac/utils.js deleted file mode 100644 index f95758f..0000000 --- a/node_modules/mux.js/lib/aac/utils.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ -'use strict'; - -var ADTS_SAMPLING_FREQUENCIES = [ - 96000, - 88200, - 64000, - 48000, - 44100, - 32000, - 24000, - 22050, - 16000, - 12000, - 11025, - 8000, - 7350 -]; - -var parseId3TagSize = function(header, byteIndex) { - var - returnSize = (header[byteIndex + 6] << 21) | - (header[byteIndex + 7] << 14) | - (header[byteIndex + 8] << 7) | - (header[byteIndex + 9]), - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; - - // if we get a negative returnSize clamp it to 0 - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - return returnSize + 10; -}; - -var getId3Offset = function(data, offset) { - if (data.length - offset < 10 || - data[offset] !== 'I'.charCodeAt(0) || - data[offset + 1] !== 'D'.charCodeAt(0) || - data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - - return getId3Offset(data, offset); -}; - - -// TODO: use vhs-utils -var isLikelyAacData = function(data) { - var offset = getId3Offset(data, 0); - - return data.length >= offset + 2 && - (data[offset] & 0xFF) === 0xFF && - (data[offset + 1] & 0xF0) === 0xF0 && - // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; -}; - -var parseSyncSafeInteger = function(data) { - return (data[0] << 21) | - (data[1] << 14) | - (data[2] << 7) | - (data[3]); -}; - -// return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding -var percentEncode = function(bytes, start, end) { - var i, result = ''; - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - return result; -}; - -// return the string representation of the specified byte range, -// interpreted as ISO-8859-1. -var parseIso88591 = function(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}; - -var parseAdtsSize = function(header, byteIndex) { - var - lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - - return (highTwo | middle) | lowThree; -}; - -var parseType = function(header, byteIndex) { - if ((header[byteIndex] === 'I'.charCodeAt(0)) && - (header[byteIndex + 1] === 'D'.charCodeAt(0)) && - (header[byteIndex + 2] === '3'.charCodeAt(0))) { - return 'timed-metadata'; - } else if ((header[byteIndex] & 0xff === 0xff) && - ((header[byteIndex + 1] & 0xf0) === 0xf0)) { - return 'audio'; - } - return null; -}; - -var parseSampleRate = function(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; -}; - -var parseAacTimestamp = function(packet) { - var frameStart, frameSize, frame, frameHeader; - - // find the start of the first frame and the end of the tag - frameStart = 10; - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } - - // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - if (frameSize < 1) { - return null; - } - frameHeader = String.fromCharCode(packet[frameStart], - packet[frameStart + 1], - packet[frameStart + 2], - packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = ((d[3] & 0x01) << 30) | - (d[4] << 22) | - (d[5] << 14) | - (d[6] << 6) | - (d[7] >>> 2); - size *= 4; - size += d[7] & 0x03; - - return size; - } - break; - } - } - } - - frameStart += 10; // advance past the frame header - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - return null; -}; - -module.exports = { - isLikelyAacData: isLikelyAacData, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp -}; diff --git a/node_modules/mux.js/lib/codecs/adts.js b/node_modules/mux.js/lib/codecs/adts.js deleted file mode 100644 index 89062d4..0000000 --- a/node_modules/mux.js/lib/codecs/adts.js +++ /dev/null @@ -1,156 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var AdtsStream; - -var - ADTS_SAMPLING_FREQUENCIES = [ - 96000, - 88200, - 64000, - 48000, - 44100, - 32000, - 24000, - 22050, - 16000, - 12000, - 11025, - 8000, - 7350 - ]; - -/* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ -AdtsStream = function(handlePartialSegments) { - var - buffer, - frameNum = 0; - - AdtsStream.prototype.init.call(this); - - this.push = function(packet) { - var - i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } - - // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } - - // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - while (i + 5 < buffer.length) { - - // Look for the start of an ADTS header.. - if ((buffer[i] !== 0xFF) || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; - - // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - frameLength = ((buffer[i + 3] & 0x03) << 11) | - (buffer[i + 4] << 3) | - ((buffer[i + 5] & 0xe0) >> 5); - - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = (sampleCount * ONE_SECOND_IN_TS) / - ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; - - frameEnd = i + frameLength; - - // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - if (buffer.byteLength < frameEnd) { - return; - } - - // Otherwise, deliver the complete AAC frame - this.trigger('data', { - pts: packet.pts + (frameNum * adtsFrameDuration), - dts: packet.dts + (frameNum * adtsFrameDuration), - sampleCount: sampleCount, - audioobjecttype: ((buffer[i + 2] >>> 6) & 0x03) + 1, - channelcount: ((buffer[i + 2] & 1) << 2) | - ((buffer[i + 3] & 0xc0) >>> 6), - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - - frameNum++; - - // If the buffer is empty, clear it and return - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } - - // Remove the finished frame from the buffer and start the process again - buffer = buffer.subarray(frameEnd); - } - }; - - this.flush = function() { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function() { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function() { - buffer = void 0; - this.trigger('endedtimeline'); - }; -}; - -AdtsStream.prototype = new Stream(); - -module.exports = AdtsStream; diff --git a/node_modules/mux.js/lib/codecs/h264.js b/node_modules/mux.js/lib/codecs/h264.js deleted file mode 100644 index a1c131c..0000000 --- a/node_modules/mux.js/lib/codecs/h264.js +++ /dev/null @@ -1,485 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var ExpGolomb = require('../utils/exp-golomb.js'); - -var H264Stream, NalByteStream; -var PROFILES_WITH_OPTIONAL_SPS_DATA; - -/** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ -NalByteStream = function() { - var - syncPoint = 0, - i, - buffer; - NalByteStream.prototype.init.call(this); - - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - this.push = function(data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - var len = buffer.byteLength; - - // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - - // advance the sync point to a NAL start, if necessary - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } - - // deliver the NAL unit if it isn't empty - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } - - // drop trailing zeroes - do { - i++; - } while (buffer[i] !== 1 && i < len); - syncPoint = i - 2; - i += 3; - break; - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || - buffer[i - 2] !== 0) { - i += 3; - break; - } - - // deliver the NAL unit - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } - // filter out the NAL units that were delivered - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function() { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function() { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } - // reset the stream state - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function() { - this.flush(); - this.trigger('endedtimeline'); - }; -}; -NalByteStream.prototype = new Stream(); - -// values of profile_idc that indicate additional fields are included in the SPS -// see Recommendation ITU-T H.264 (4/2013), -// 7.3.2.1.1 Sequence parameter set data syntax -PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true -}; - -/** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ -H264Stream = function() { - var - nalByteStream = new NalByteStream(), - self, - trackId, - currentPts, - currentDts, - - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - H264Stream.prototype.init.call(this); - self = this; - - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - this.push = function(packet) { - if (packet.type !== 'video') { - return; - } - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - - nalByteStream.push(packet); - }; - - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - nalByteStream.on('data', function(data) { - var - event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - - default: - break; - } - // This triggers data on the H264Stream - self.trigger('data', event); - }); - nalByteStream.on('done', function() { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function() { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function() { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function() { - self.trigger('endedtimeline'); - }); - - this.flush = function() { - nalByteStream.flush(); - }; - - this.partialFlush = function() { - nalByteStream.partialFlush(); - }; - - this.reset = function() { - nalByteStream.reset(); - }; - - this.endTimeline = function() { - nalByteStream.endTimeline(); - }; - - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - skipScalingList = function(count, expGolombDecoder) { - var - lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = (nextScale === 0) ? lastScale : nextScale; - } - }; - - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - discardEmulationPreventionBytes = function(data) { - var - length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, newData; - - // Find all `Emulation Prevention Bytes` - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } - - // If no Emulation Prevention Bytes were found just return the original - // array - if (emulationPreventionBytesPositions.length === 0) { - return data; - } - - // Create a new array to hold the NAL unit data - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; - // Remove this position index - emulationPreventionBytesPositions.shift(); - } - newData[i] = data[sourceIndex]; - } - - return newData; - }; - - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - readSequenceParameterSet = function(data) { - var - frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, profileIdc, levelIdc, profileCompatibility, - chromaFormatIdc, picOrderCntType, - numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - - expGolombDecoder = new ExpGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - - // some profiles have more optional data we don't need - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - if (expGolombDecoder.readBoolean()) { // seq_scaling_matrix_present_flag - scalingListCount = (chromaFormatIdc !== 3) ? 8 : 12; - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - if (expGolombDecoder.readBoolean()) { // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - switch (aspectRatioIdc) { - case 1: sarRatio = [1, 1]; break; - case 2: sarRatio = [12, 11]; break; - case 3: sarRatio = [10, 11]; break; - case 4: sarRatio = [16, 11]; break; - case 5: sarRatio = [40, 33]; break; - case 6: sarRatio = [24, 11]; break; - case 7: sarRatio = [20, 11]; break; - case 8: sarRatio = [32, 11]; break; - case 9: sarRatio = [80, 33]; break; - case 10: sarRatio = [18, 11]; break; - case 11: sarRatio = [15, 11]; break; - case 12: sarRatio = [64, 33]; break; - case 13: sarRatio = [160, 99]; break; - case 14: sarRatio = [4, 3]; break; - case 15: sarRatio = [3, 2]; break; - case 16: sarRatio = [2, 1]; break; - case 255: { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | - expGolombDecoder.readUnsignedByte(), - expGolombDecoder.readUnsignedByte() << 8 | - expGolombDecoder.readUnsignedByte() ]; - break; - } - } - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil((((picWidthInMbsMinus1 + 1) * 16) - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: ((2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16) - (frameCropTopOffset * 2) - (frameCropBottomOffset * 2), - sarRatio: sarRatio - }; - }; - -}; -H264Stream.prototype = new Stream(); - -module.exports = { - H264Stream: H264Stream, - NalByteStream: NalByteStream -}; diff --git a/node_modules/mux.js/lib/codecs/index.js b/node_modules/mux.js/lib/codecs/index.js deleted file mode 100644 index 4e1da21..0000000 --- a/node_modules/mux.js/lib/codecs/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - Adts: require('./adts'), - h264: require('./h264') -}; diff --git a/node_modules/mux.js/lib/constants/audio-properties.js b/node_modules/mux.js/lib/constants/audio-properties.js deleted file mode 100644 index a87d9b7..0000000 --- a/node_modules/mux.js/lib/constants/audio-properties.js +++ /dev/null @@ -1,10 +0,0 @@ -// constants -var AUDIO_PROPERTIES = [ - 'audioobjecttype', - 'channelcount', - 'samplerate', - 'samplingfrequencyindex', - 'samplesize' -]; - -module.exports = AUDIO_PROPERTIES; diff --git a/node_modules/mux.js/lib/constants/video-properties.js b/node_modules/mux.js/lib/constants/video-properties.js deleted file mode 100644 index f09b20e..0000000 --- a/node_modules/mux.js/lib/constants/video-properties.js +++ /dev/null @@ -1,11 +0,0 @@ -var VIDEO_PROPERTIES = [ - 'width', - 'height', - 'profileIdc', - 'levelIdc', - 'profileCompatibility', - 'sarRatio' -]; - - -module.exports = VIDEO_PROPERTIES; diff --git a/node_modules/mux.js/lib/data/silence.js b/node_modules/mux.js/lib/data/silence.js deleted file mode 100644 index 74be1b4..0000000 --- a/node_modules/mux.js/lib/data/silence.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var highPrefix = [33, 16, 5, 32, 164, 27]; -var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; -var zeroFill = function(count) { - var a = []; - while (count--) { - a.push(0); - } - return a; -}; - -var makeTable = function(metaTable) { - return Object.keys(metaTable).reduce(function(obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function(arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); -}; - - -var silence; - -module.exports = function() { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]], - 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - return silence; -}; diff --git a/node_modules/mux.js/lib/flv/coalesce-stream.js b/node_modules/mux.js/lib/flv/coalesce-stream.js deleted file mode 100644 index 927aa2f..0000000 --- a/node_modules/mux.js/lib/flv/coalesce-stream.js +++ /dev/null @@ -1,151 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -/** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ -var CoalesceStream = function(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - - CoalesceStream.prototype.init.call(this); - - // Take output from multiple - this.push = function(output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } - // buffer incoming id3 tags until the final flush - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; -}; - -CoalesceStream.prototype = new Stream(); -CoalesceStream.prototype.flush = function(flushSource) { - var - id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - captionStreams: {}, - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && - flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; - - // Translate caption PTS times into second offsets into the - // video timeline for the segment, and add track info - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } - - // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } - // We add this to every single emitted segment even though we only need - // it for the first - event.metadata.dispatchType = this.metadataStream.dispatchType; - - // Reset stream state - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; - - // Emit the final segment - this.trigger('data', event); - - this.trigger('done'); -}; - -module.exports = CoalesceStream; diff --git a/node_modules/mux.js/lib/flv/flv-header.js b/node_modules/mux.js/lib/flv/flv-header.js deleted file mode 100644 index 81eebb3..0000000 --- a/node_modules/mux.js/lib/flv/flv-header.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var FlvTag = require('./flv-tag.js'); - -// For information on the FLV format, see -// http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. -// Technically, this function returns the header and a metadata FLV tag -// if duration is greater than zero -// duration in seconds -// @return {object} the bytes of the FLV header as a Uint8Array -var getFlvHeader = function(duration, audio, video) { // :ByteArray { - var - headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; - - // default arguments - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; - - // signature - head.setUint8(0, 0x46); // 'F' - head.setUint8(1, 0x4c); // 'L' - head.setUint8(2, 0x56); // 'V' - - // version - head.setUint8(3, 0x01); - - // flags - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); - - // data offset, should be 9 for FLV v1 - head.setUint32(5, headBytes.byteLength); - - // init the first FLV tag - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } - - // write out the duration metadata tag - metadata = new FlvTag(FlvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - - return result; -}; - -module.exports = getFlvHeader; diff --git a/node_modules/mux.js/lib/flv/flv-tag.js b/node_modules/mux.js/lib/flv/flv-tag.js deleted file mode 100644 index d5b0d64..0000000 --- a/node_modules/mux.js/lib/flv/flv-tag.js +++ /dev/null @@ -1,377 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ -'use strict'; - -var FlvTag; - -// (type:uint, extraData:Boolean = false) extends ByteArray -FlvTag = function(type, extraData) { - var - // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, // :uint - - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function(flv, count) { - var - bytes, - minLength = flv.position + count; - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } - - // allocate a new buffer and copy over the data that will not be modified - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - - // commonly used metadata properties - widthBytes = FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - FlvTag.widthBytes = widthBytes; - FlvTag.heightBytes = heightBytes; - FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case FlvTag.VIDEO_TAG: - this.length = 16; - // Start the buffer at 256k - bufferStartSize *= 6; - break; - case FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - case FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - - // presentation timestamp - this.pts = 0; - // decoder timestamp - this.dts = 0; - - // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - this.writeBytes = function(bytes, offset, length) { - var - start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - - this.position += length; - this.length = Math.max(this.length, this.position); - }; - - // ByteArray#writeByte(value:int):void - this.writeByte = function(byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; - - // ByteArray#writeShort(value:int):void - this.writeShort = function(short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; - - // Negative index into array - // (pos:uint):int - this.negIndex = function(pos) { - return this.bytes[this.length - pos]; - }; - - // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - this.nalUnitSize = function() { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function() { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } - - // reserve 4 bytes for nal unit size - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; - - // (nal:ByteArray = null):void - this.endNalUnit = function(nalContainer) { - var - nalStart, // :uint - nalLength; // :uint - - // Rewind to the marker and write the size - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - this.writeMetaDataDouble = function(key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); - - // write size of property name - this.view.setUint16(this.position, key.length); - this.position += 2; - - // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - - // write property name - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } - - // skip null byte - this.position++; - - // write property value - this.view.setFloat64(this.position, val); - this.position += 8; - - // update flv tag length - this.length = Math.max(this.length, this.position); - ++adHoc; - }; - - // (key:String, val:Boolean):void - this.writeMetaDataBoolean = function(key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; - - // ():ByteArray - this.finalize = function() { - var - dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = ((this.keyFrame || extraData) ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - this.position += 2; - // set "onMetaData" - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, - 0x74, 0x61, 0x44, 0x61, - 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - this.length = this.position; - break; - } - - len = this.length - 11; - - // write the DataSize field - this.bytes[ 1] = (len & 0x00FF0000) >>> 16; - this.bytes[ 2] = (len & 0x0000FF00) >>> 8; - this.bytes[ 3] = (len & 0x000000FF) >>> 0; - // write the Timestamp - this.bytes[ 4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[ 5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[ 6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[ 7] = (this.dts & 0xFF000000) >>> 24; - // write the StreamID - this.bytes[ 8] = 0; - this.bytes[ 9] = 0; - this.bytes[10] = 0; - - // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; - - // trim down the byte buffer to what is actually being used - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = FlvTag.frameTime(this.bytes); - // if bytes.bytelength isn't equal to this.length, handle error - return this; - }; -}; - -FlvTag.AUDIO_TAG = 0x08; // == 8, :uint -FlvTag.VIDEO_TAG = 0x09; // == 9, :uint -FlvTag.METADATA_TAG = 0x12; // == 18, :uint - -// (tag:ByteArray):Boolean { -FlvTag.isAudioFrame = function(tag) { - return FlvTag.AUDIO_TAG === tag[0]; -}; - -// (tag:ByteArray):Boolean { -FlvTag.isVideoFrame = function(tag) { - return FlvTag.VIDEO_TAG === tag[0]; -}; - -// (tag:ByteArray):Boolean { -FlvTag.isMetaData = function(tag) { - return FlvTag.METADATA_TAG === tag[0]; -}; - -// (tag:ByteArray):Boolean { -FlvTag.isKeyFrame = function(tag) { - if (FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (FlvTag.isAudioFrame(tag)) { - return true; - } - - if (FlvTag.isMetaData(tag)) { - return true; - } - - return false; -}; - -// (tag:ByteArray):uint { -FlvTag.frameTime = function(tag) { - var pts = tag[ 4] << 16; // :uint - pts |= tag[ 5] << 8; - pts |= tag[ 6] << 0; - pts |= tag[ 7] << 24; - return pts; -}; - -module.exports = FlvTag; diff --git a/node_modules/mux.js/lib/flv/index.js b/node_modules/mux.js/lib/flv/index.js deleted file mode 100644 index 9cfbaf5..0000000 --- a/node_modules/mux.js/lib/flv/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - tag: require('./flv-tag'), - Transmuxer: require('./transmuxer'), - getFlvHeader: require('./flv-header') -}; diff --git a/node_modules/mux.js/lib/flv/tag-list.js b/node_modules/mux.js/lib/flv/tag-list.js deleted file mode 100644 index 5b83cde..0000000 --- a/node_modules/mux.js/lib/flv/tag-list.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var TagList = function() { - var self = this; - - this.list = []; - - this.push = function(tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function() { - return self.list.length; - } - }); -}; - -module.exports = TagList; diff --git a/node_modules/mux.js/lib/flv/transmuxer.js b/node_modules/mux.js/lib/flv/transmuxer.js deleted file mode 100644 index 4a8a85d..0000000 --- a/node_modules/mux.js/lib/flv/transmuxer.js +++ /dev/null @@ -1,453 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var FlvTag = require('./flv-tag.js'); -var m2ts = require('../m2ts/m2ts.js'); -var AdtsStream = require('../codecs/adts.js'); -var H264Stream = require('../codecs/h264').H264Stream; -var CoalesceStream = require('./coalesce-stream.js'); -var TagList = require('./tag-list.js'); - -var - Transmuxer, - VideoSegmentStream, - AudioSegmentStream, - collectTimelineInfo, - metaDataTag, - extraDataTag; - -/** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ -collectTimelineInfo = function(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = - Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = - Math.min(track.timelineStartInfo.dts, data.dts); - } - } -}; - -metaDataTag = function(track, pts) { - var - tag = new FlvTag(FlvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - - return tag; -}; - -extraDataTag = function(track, pts) { - var - i, - tag = new FlvTag(FlvTag.VIDEO_TAG, true); - - tag.dts = pts; - tag.pts = pts; - - tag.writeByte(0x01);// version - tag.writeByte(track.profileIdc);// profile - tag.writeByte(track.profileCompatibility);// compatibility - tag.writeByte(track.levelIdc);// level - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - tag.writeShort(track.sps[0].length); // data of SPS - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; -}; - -/** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ -AudioSegmentStream = function(track) { - var - adtsFrames = [], - videoKeyFrames = [], - oldExtraData; - - AudioSegmentStream.prototype.init.call(this); - - this.push = function(data) { - collectTimelineInfo(track, data); - - if (track) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = (track.audioobjecttype << 11) | - (track.samplingfrequencyindex << 7) | - (track.channelcount << 3); - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); - - // buffer audio data until end() is called - adtsFrames.push(data); - }; - - this.flush = function() { - var currentFrame, adtsFrame, lastMetaPts, tags = new TagList(); - // return early if no audio data has been observed - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); - - // write out a metadata frame at every video key frame - if (videoKeyFrames.length && currentFrame.pts >= videoKeyFrames[0]) { - lastMetaPts = videoKeyFrames.shift(); - this.writeMetaDataTags(tags, lastMetaPts); - } - - // also write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration. - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - this.writeMetaDataTags(tags, currentFrame.pts); - oldExtraData = track.extraData; - lastMetaPts = currentFrame.pts; - } - - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - - adtsFrame.writeBytes(currentFrame.data); - - tags.push(adtsFrame.finalize()); - } - - videoKeyFrames.length = 0; - oldExtraData = null; - this.trigger('data', {track: track, tags: tags.list}); - - this.trigger('done', 'AudioSegmentStream'); - }; - - this.writeMetaDataTags = function(tags, pts) { - var adtsFrame; - - adtsFrame = new FlvTag(FlvTag.METADATA_TAG); - // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - adtsFrame.pts = pts; - adtsFrame.dts = pts; - - // AAC is always 10 - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); - // Is AAC always 16 bit? - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - - tags.push(adtsFrame.finalize()); - - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG, true); - // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - adtsFrame.pts = pts; - adtsFrame.dts = pts; - - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - - tags.push(adtsFrame.finalize()); - }; - - this.onVideoKeyFrame = function(pts) { - videoKeyFrames.push(pts); - }; -}; -AudioSegmentStream.prototype = new Stream(); - -/** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ -VideoSegmentStream = function(track) { - var - nalUnits = [], - config, - h264Frame; - VideoSegmentStream.prototype.init.call(this); - - this.finishFrame = function(tags, frame) { - if (!frame) { - return; - } - // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - if (config && track && track.newMetadata && - (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - - metaTag.metaDataTag = extraTag.metaDataTag = true; - - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - - this.trigger('keyframe', frame.dts); - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function(data) { - collectTimelineInfo(track, data); - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); - - // buffer video until flush() is called - nalUnits.push(data); - }; - - this.flush = function() { - var - currentNal, - tags = new TagList(); - - // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - nalUnits.shift(); - } - - // return early if no video data has been observed - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); - - // record the track config - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - h264Frame = new FlvTag(FlvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - h264Frame.endNalUnit(); - } - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', {track: track, tags: tags.list}); - - // Continue with the flush process now - this.trigger('done', 'VideoSegmentStream'); - }; -}; - -VideoSegmentStream.prototype = new Stream(); - -/** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ -Transmuxer = function(options) { - var - self = this, - - packetStream, parseStream, elementaryStream, - videoTimestampRolloverStream, audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, h264Stream, - videoSegmentStream, audioSegmentStream, captionStream, - coalesceStream; - - Transmuxer.prototype.init.call(this); - - options = options || {}; - - // expose the metadata stream - this.metadataStream = new m2ts.MetadataStream(); - - options.metadataStream = this.metadataStream; - - // set up the parsing pipeline - packetStream = new m2ts.TransportPacketStream(); - parseStream = new m2ts.TransportParseStream(); - elementaryStream = new m2ts.ElementaryStream(); - videoTimestampRolloverStream = new m2ts.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - - adtsStream = new AdtsStream(); - h264Stream = new H264Stream(); - coalesceStream = new CoalesceStream(options); - - // disassemble MPEG2-TS packets into elementary streams - packetStream - .pipe(parseStream) - .pipe(elementaryStream); - - // !!THIS ORDER IS IMPORTANT!! - // demux the streams - elementaryStream - .pipe(videoTimestampRolloverStream) - .pipe(h264Stream); - elementaryStream - .pipe(audioTimestampRolloverStream) - .pipe(adtsStream); - - elementaryStream - .pipe(timedMetadataTimestampRolloverStream) - .pipe(this.metadataStream) - .pipe(coalesceStream); - // if CEA-708 parsing is available, hook up a caption stream - captionStream = new m2ts.CaptionStream(options); - h264Stream.pipe(captionStream) - .pipe(coalesceStream); - - // hook up the segment streams once track metadata is delivered - elementaryStream.on('data', function(data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; - - // scan the tracks listed in the metadata - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } - - // hook up the video segment stream to the first track with h264 data - if (videoTrack && !videoSegmentStream) { - coalesceStream.numberOfTracks++; - videoSegmentStream = new VideoSegmentStream(videoTrack); - - // Set up the final part of the video pipeline - h264Stream - .pipe(videoSegmentStream) - .pipe(coalesceStream); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream.numberOfTracks++; - audioSegmentStream = new AudioSegmentStream(audioTrack); - - // Set up the final part of the audio pipeline - adtsStream - .pipe(audioSegmentStream) - .pipe(coalesceStream); - - if (videoSegmentStream) { - videoSegmentStream.on('keyframe', audioSegmentStream.onVideoKeyFrame); - } - } - } - }); - - // feed incoming data to the front of the parsing pipeline - this.push = function(data) { - packetStream.push(data); - }; - - // flush any buffered data - this.flush = function() { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; - - // Caption data has to be reset when seeking outside buffered range - this.resetCaptions = function() { - captionStream.reset(); - }; - - // Re-emit any data coming from the coalesce stream to the outside world - coalesceStream.on('data', function(event) { - self.trigger('data', event); - }); - - // Let the consumer know we have finished flushing the entire pipeline - coalesceStream.on('done', function() { - self.trigger('done'); - }); -}; -Transmuxer.prototype = new Stream(); - -// forward compatibility -module.exports = Transmuxer; diff --git a/node_modules/mux.js/lib/index.js b/node_modules/mux.js/lib/index.js deleted file mode 100644 index 4f3fe20..0000000 --- a/node_modules/mux.js/lib/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var muxjs = { - codecs: require('./codecs'), - mp4: require('./mp4'), - flv: require('./flv'), - mp2t: require('./m2ts'), - partial: require('./partial') -}; - -// include all the tools when the full library is required -muxjs.mp4.tools = require('./tools/mp4-inspector'); -muxjs.flv.tools = require('./tools/flv-inspector'); -muxjs.mp2t.tools = require('./tools/ts-inspector'); - - -module.exports = muxjs; diff --git a/node_modules/mux.js/lib/m2ts/caption-stream.js b/node_modules/mux.js/lib/m2ts/caption-stream.js deleted file mode 100644 index ded037d..0000000 --- a/node_modules/mux.js/lib/m2ts/caption-stream.js +++ /dev/null @@ -1,1676 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - -'use strict'; - -// ----------------- -// Link To Transport -// ----------------- - -var Stream = require('../utils/stream'); -var cea708Parser = require('../tools/caption-packet-parser'); - -var CaptionStream = function(options) { - options = options || {}; - - CaptionStream.prototype.init.call(this); - - // parse708captions flag, default to true - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? - options.parse708captions : - true; - - this.captionPackets_ = []; - - this.ccStreams_ = [ - new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream(); // eslint-disable-line no-use-before-define - } - - this.reset(); - - // forward data and done events from CCs to this CaptionStream - this.ccStreams_.forEach(function(cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - -}; - -CaptionStream.prototype = new Stream(); -CaptionStream.prototype.push = function(event) { - var sei, userData, newCaptionPackets; - - // only examine SEI NALs - if (event.nalUnitType !== 'sei_rbsp') { - return; - } - - // parse the sei - sei = cea708Parser.parseSei(event.escapedRBSP); - - // no payload data, skip - if (!sei.payload) { - return; - } - - // ignore everything but user_data_registered_itu_t_t35 - if (sei.payloadType !== cea708Parser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } - - // parse out the user data payload - userData = cea708Parser.parseUserData(sei); - - // ignore unrecognized userData - if (!userData) { - return; - } - - // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if ((event.dts === this.latestDts_) && (this.ignoreNextEqualDts_)) { - this.numSameDts_--; - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - return; - } - - // parse out CC data packets and save them for later - newCaptionPackets = cea708Parser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - this.numSameDts_++; - this.latestDts_ = event.dts; -}; - -CaptionStream.prototype.flushCCStreams = function(flushType) { - this.ccStreams_.forEach(function(cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); -}; - -CaptionStream.prototype.flushStream = function(flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } - - // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - this.captionPackets_.forEach(function(elem, idx) { - elem.presortIndex = idx; - }); - - // sort caption byte-pairs based on their PTS values - this.captionPackets_.sort(function(a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - return a.pts - b.pts; - }); - - this.captionPackets_.forEach(function(packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); -}; - -CaptionStream.prototype.flush = function() { - return this.flushStream('flush'); -}; - -// Only called if handling partial data -CaptionStream.prototype.partialFlush = function() { - return this.flushStream('partialFlush'); -}; - -CaptionStream.prototype.reset = function() { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function(ccStream) { - ccStream.reset(); - }); -}; - -// From the CEA-608 spec: -/* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. -*/ -// With that in mind, we ignore any data between an XDS control code and a -// subsequent closed-captioning control code. -CaptionStream.prototype.dispatchCea608Packet = function(packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); -}; - -CaptionStream.prototype.setsChannel1Active = function(packet) { - return ((packet.ccData & 0x7800) === 0x1000); -}; -CaptionStream.prototype.setsChannel2Active = function(packet) { - return ((packet.ccData & 0x7800) === 0x1800); -}; -CaptionStream.prototype.setsTextOrXDSActive = function(packet) { - return ((packet.ccData & 0x7100) === 0x0100) || - ((packet.ccData & 0x78fe) === 0x102a) || - ((packet.ccData & 0x78fe) === 0x182a); -}; - -CaptionStream.prototype.dispatchCea708Packet = function(packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } -}; - - -// ---------------------- -// Session to Application -// ---------------------- - -// This hash maps special and extended character codes to their -// proper Unicode equivalent. The first one-byte key is just a -// non-standard character code. The two-byte keys that follow are -// the extended CEA708 character codes, along with the preceding -// 0x10 extended character byte to distinguish these codes from -// non-extended character codes. Every CEA708 character code that -// is not in this object maps directly to a standard unicode -// character code. -// The transparent space and non-breaking transparent space are -// technically not fully supported since there is no code to -// make them transparent, so they have normal non-transparent -// stand-ins. -// The special closed caption (CC) character isn't a standard -// unicode character, so a fairly similar unicode character was -// chosen in it's place. -var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, // ♪ - 0x1020: 0x20, // Transparent Space - 0x1021: 0xa0, // Nob-breaking Transparent Space - 0x1025: 0x2026, // … - 0x102a: 0x0160, // Š - 0x102c: 0x0152, // Œ - 0x1030: 0x2588, // █ - 0x1031: 0x2018, // ‘ - 0x1032: 0x2019, // ’ - 0x1033: 0x201c, // “ - 0x1034: 0x201d, // ” - 0x1035: 0x2022, // • - 0x1039: 0x2122, // ™ - 0x103a: 0x0161, // š - 0x103c: 0x0153, // œ - 0x103d: 0x2120, // ℠ - 0x103f: 0x0178, // Ÿ - 0x1076: 0x215b, // ⅛ - 0x1077: 0x215c, // ⅜ - 0x1078: 0x215d, // ⅝ - 0x1079: 0x215e, // ⅞ - 0x107a: 0x23d0, // ⏐ - 0x107b: 0x23a4, // ⎤ - 0x107c: 0x23a3, // ⎣ - 0x107d: 0x23af, // ⎯ - 0x107e: 0x23a6, // ⎦ - 0x107f: 0x23a1, // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) -}; - -var get708CharFromCode = function(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if ((code & 0x1000) && code === newCode) { - // Invalid extended code - return ''; - } - return String.fromCharCode(newCode); -}; - -var within708TextBlock = function(b) { - return (0x20 <= b && b <= 0x7f) || (0xa0 <= b && b <= 0xff); -}; - -var Cea708Window = function(windowNum) { - this.windowNum = windowNum; - this.reset(); -}; - -Cea708Window.prototype.reset = function() { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; - - // These default values are arbitrary, - // defineWindow will usually override them - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; -}; - -Cea708Window.prototype.getText = function() { - return this.rows.join('\n'); -}; - -Cea708Window.prototype.clearText = function() { - this.rows = ['']; - this.rowIdx = 0; -}; - -Cea708Window.prototype.newLine = function(pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } - - // Show all virtual rows since there's no visible scrolling - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } -}; - -Cea708Window.prototype.isEmpty = function() { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; -}; - -Cea708Window.prototype.addText = function(text) { - this.rows[this.rowIdx] += text; -}; - -Cea708Window.prototype.backspace = function() { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } -}; - -var Cea708Service = function(serviceNum) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; -}; - -/** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ -Cea708Service.prototype.init = function(pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } -}; - -/** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ -Cea708Service.prototype.setCurrentWindow = function(windowNum) { - this.currentWindow = this.windows[windowNum]; -}; - -var Cea708Stream = function() { - Cea708Stream.prototype.init.call(this); - - var self = this; - this.current708Packet = null; - this.services = {}; - - this.push = function(packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; -}; -Cea708Stream.prototype = new Stream(); - -/** - * Push current 708 packet, create new 708 packet. - */ -Cea708Stream.prototype.new708Packet = function() { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; -}; - -/** - * Add pts and both bytes from packet into current 708 packet. - */ -Cea708Stream.prototype.add708Bytes = function(packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; - - // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); -}; - -/** - * Parse completed 708 packet into service blocks and push each service block. - */ -Cea708Stream.prototype.push708Packet = function() { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } -}; - -/** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ -Cea708Stream.prototype.pushServiceBlock = function(serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else if (b === 0x8e) { - // DLC: Delay cancel, nothing to do - } else if (b === 0x03) { - // ETX: End Text, don't need to do anything - } else if (b === 0x00) { - // Padding - } else { - // Unknown command - } - } -}; - -/** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.extendedCommands = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - if (within708TextBlock(b)) { - i = this.handleText(i, service, true); - } else { - // Unknown command - } - - return i; -}; - -/** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ -Cea708Stream.prototype.getPts = function(byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; -}; - -/** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ -Cea708Stream.prototype.initService = function(serviceNum, i) { - var self = this; - - this.services[serviceNum] = new Cea708Service(serviceNum); - this.services[serviceNum].init(this.getPts(i), function(pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - - return this.services[serviceNum]; -}; - -/** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.handleText = function(i, service, isExtended) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var extended = isExtended ? 0x1000 : 0x0000; - var char = get708CharFromCode(extended | b); - var win = service.currentWindow; - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - win.pendingNewLine = false; - win.addText(char); - - return i; -}; - -/** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.setCurrentWindow = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - - service.setCurrentWindow(windowNum); - - return i; -}; - -/** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.defineWindow = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - win.rowLock = (b & 0x10) >> 4; // rl - win.columnLock = (b & 0x08) >> 3; // cl - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - win.penStyle = b & 0x07; // ps - - // The spec says there are (rowCount+1) "virtual rows" - win.virtualRowCount = win.rowCount + 1; - - return i; -}; - -/** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.setWindowAttributes = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - winAttr.fillRed = (b & 0x30) >> 4; // fr - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - winAttr.borderRed = (b & 0x30) >> 4; // br - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - winAttr.wordWrap = (b & 0x40) >> 6; // ww - winAttr.printDirection = (b & 0x30) >> 4; // pd - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - winAttr.displayEffect = b & 0x03; // de - - return i; -}; - -/** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ -Cea708Stream.prototype.flushDisplayed = function(pts, service) { - var displayedText = []; - - // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - - service.startPts = pts; -}; - -/** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ -Cea708Stream.prototype.pushCaption = function(service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - - service.text = ''; - service.startPts = service.endPts; - } -}; - -/** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.displayWindows = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & (0x01 << winId)) { - service.windows[winId].visible = 1; - } - } - - return i; -}; - -/** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.hideWindows = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & (0x01 << winId)) { - service.windows[winId].visible = 0; - } - } - - return i; -}; - -/** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.toggleWindows = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & (0x01 << winId)) { - service.windows[winId].visible ^= 1; - } - } - - return i; -}; - -/** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.clearWindows = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & (0x01 << winId)) { - service.windows[winId].clearText(); - } - } - - return i; -}; - -/** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.deleteWindows = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & (0x01 << winId)) { - service.windows[winId].reset(); - } - } - - return i; -}; - -/** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.setPenAttributes = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - penAttr.offset = (b & 0x0c) >> 2; // o - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - penAttr.underline = (b & 0x40) >> 6; // u - penAttr.edgeType = (b & 0x38) >> 3; // et - penAttr.fontStyle = b & 0x07; // fs - - return i; -}; - -/** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.setPenColor = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - penColor.fgRed = (b & 0x30) >> 4; // fr - penColor.fgGreen = (b & 0x0c) >> 2; // fg - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - penColor.bgRed = (b & 0x30) >> 4; // br - penColor.bgGreen = (b & 0x0c) >> 2; // bg - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - penColor.edgeBlue = b & 0x03; // eb - - return i; -}; - -/** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.setPenLocation = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; - - // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - service.currentWindow.pendingNewLine = true; - - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; -}; - -/** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ -Cea708Stream.prototype.reset = function(i, service) { - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - return this.initService(service.serviceNum, i); -}; - - -// This hash maps non-ASCII, special, and extended character codes to their -// proper Unicode equivalent. The first keys that are only a single byte -// are the non-standard ASCII characters, which simply map the CEA608 byte -// to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 -// character codes, but have their MSB bitmasked with 0x03 so that a lookup -// can be performed regardless of the field and data channel on which the -// character code was received. -var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, // á - 0x5c: 0xe9, // é - 0x5e: 0xed, // í - 0x5f: 0xf3, // ó - 0x60: 0xfa, // ú - 0x7b: 0xe7, // ç - 0x7c: 0xf7, // ÷ - 0x7d: 0xd1, // Ñ - 0x7e: 0xf1, // ñ - 0x7f: 0x2588, // █ - 0x0130: 0xae, // ® - 0x0131: 0xb0, // ° - 0x0132: 0xbd, // ½ - 0x0133: 0xbf, // ¿ - 0x0134: 0x2122, // ™ - 0x0135: 0xa2, // ¢ - 0x0136: 0xa3, // £ - 0x0137: 0x266a, // ♪ - 0x0138: 0xe0, // à - 0x0139: 0xa0, // - 0x013a: 0xe8, // è - 0x013b: 0xe2, // â - 0x013c: 0xea, // ê - 0x013d: 0xee, // î - 0x013e: 0xf4, // ô - 0x013f: 0xfb, // û - 0x0220: 0xc1, // Á - 0x0221: 0xc9, // É - 0x0222: 0xd3, // Ó - 0x0223: 0xda, // Ú - 0x0224: 0xdc, // Ü - 0x0225: 0xfc, // ü - 0x0226: 0x2018, // ‘ - 0x0227: 0xa1, // ¡ - 0x0228: 0x2a, // * - 0x0229: 0x27, // ' - 0x022a: 0x2014, // — - 0x022b: 0xa9, // © - 0x022c: 0x2120, // ℠ - 0x022d: 0x2022, // • - 0x022e: 0x201c, // “ - 0x022f: 0x201d, // ” - 0x0230: 0xc0, // À - 0x0231: 0xc2, //  - 0x0232: 0xc7, // Ç - 0x0233: 0xc8, // È - 0x0234: 0xca, // Ê - 0x0235: 0xcb, // Ë - 0x0236: 0xeb, // ë - 0x0237: 0xce, // Î - 0x0238: 0xcf, // Ï - 0x0239: 0xef, // ï - 0x023a: 0xd4, // Ô - 0x023b: 0xd9, // Ù - 0x023c: 0xf9, // ù - 0x023d: 0xdb, // Û - 0x023e: 0xab, // « - 0x023f: 0xbb, // » - 0x0320: 0xc3, // à - 0x0321: 0xe3, // ã - 0x0322: 0xcd, // Í - 0x0323: 0xcc, // Ì - 0x0324: 0xec, // ì - 0x0325: 0xd2, // Ò - 0x0326: 0xf2, // ò - 0x0327: 0xd5, // Õ - 0x0328: 0xf5, // õ - 0x0329: 0x7b, // { - 0x032a: 0x7d, // } - 0x032b: 0x5c, // \ - 0x032c: 0x5e, // ^ - 0x032d: 0x5f, // _ - 0x032e: 0x7c, // | - 0x032f: 0x7e, // ~ - 0x0330: 0xc4, // Ä - 0x0331: 0xe4, // ä - 0x0332: 0xd6, // Ö - 0x0333: 0xf6, // ö - 0x0334: 0xdf, // ß - 0x0335: 0xa5, // ¥ - 0x0336: 0xa4, // ¤ - 0x0337: 0x2502, // │ - 0x0338: 0xc5, // Å - 0x0339: 0xe5, // å - 0x033a: 0xd8, // Ø - 0x033b: 0xf8, // ø - 0x033c: 0x250c, // ┌ - 0x033d: 0x2510, // ┐ - 0x033e: 0x2514, // └ - 0x033f: 0x2518 // ┘ -}; - -var getCharFromCode = function(code) { - if (code === null) { - return ''; - } - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); -}; - -// the index of the last row in a CEA-608 display buffer -var BOTTOM_ROW = 14; - -// This array is used for mapping PACs -> row #, since there's no way of -// getting it through bit logic. -var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, - 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; - -// CEA-608 captions are rendered onto a 34x15 matrix of character -// cells. The "bottom" row is the last element in the outer array. -var createDisplayBuffer = function() { - var result = [], i = BOTTOM_ROW + 1; - while (i--) { - result.push(''); - } - return result; -}; - -var Cea608Stream = function(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - - this.name_ = 'CC' + (((this.field_ << 1) | this.dataChannel_) + 1); - - this.setConstants(); - this.reset(); - - this.push = function(packet) { - var data, swap, char0, char1, text; - // remove the parity bits - data = packet.ccData & 0x7f7f; - - // ignore duplicate control codes; the spec demands they're sent twice - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } - - // Store control codes - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); - // if a caption was being displayed, it's gone now - this.flushDisplayed(packet.pts); - - // flip memory - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; - - // start measuring the time to display the caption - this.startPts_ = packet.pts; - - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; - - // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; - - // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); - } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - } - - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; - - // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); - - // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } - - // Detect offset control codes and adjust cursor - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - this.column_ += (char1 & 0x03); - - // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); - - // Configure the caption window if we're in roll-up mode - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } - // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - if ((char1 & 0x1) && (this.formatting_.indexOf('u') === -1)) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } - - // We have a normal character in char0, and possibly one in char1 - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - - } // finish data processing - - }; -}; -Cea608Stream.prototype = new Stream(); -// Trigger a cue point that captures the current state of the -// display buffer -Cea608Stream.prototype.flushDisplayed = function(pts) { - var content = this.displayed_ - // remove spaces from the start and end of the string - .map(function(row) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - // eslint-disable-next-line no-console - console.error('Skipping malformed caption.'); - return ''; - } - }) - // combine all text rows to display in one cue - .join('\n') - // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content, - stream: this.name_ - }); - } -}; - -/** - * Zero out the data, used for startup and on seek - */ -Cea608Stream.prototype.reset = function() { - this.mode_ = 'popOn'; - // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; - - // Track row and column for proper line-breaking and spacing - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; - - // This variable holds currently-applied formatting - this.formatting_ = []; -}; - -/** - * Sets up control code and related constants for this instance - */ -Cea608Stream.prototype.setConstants = function() { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } - - // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - this.PADDING_ = 0x0000; - // Pop-on Mode - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; - // Roll-up Mode - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; - // paint-on mode - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; - // Erasure - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; -}; - -/** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ -Cea608Stream.prototype.isSpecialCharacter = function(char0, char1) { - return (char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f); -}; - -/** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ -Cea608Stream.prototype.isExtCharacter = function(char0, char1) { - return ((char0 === (this.EXT_ + 1) || char0 === (this.EXT_ + 2)) && - (char1 >= 0x20 && char1 <= 0x3f)); -}; - -/** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ -Cea608Stream.prototype.isMidRowCode = function(char0, char1) { - return (char0 === this.EXT_ && (char1 >= 0x20 && char1 <= 0x2f)); -}; - -/** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ -Cea608Stream.prototype.isOffsetControlCode = function(char0, char1) { - return (char0 === this.OFFSET_ && (char1 >= 0x21 && char1 <= 0x23)); -}; - -/** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ -Cea608Stream.prototype.isPAC = function(char0, char1) { - return (char0 >= this.BASE_ && char0 < (this.BASE_ + 8) && - (char1 >= 0x40 && char1 <= 0x7f)); -}; - -/** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ -Cea608Stream.prototype.isColorPAC = function(char1) { - return ((char1 >= 0x40 && char1 <= 0x4f) || (char1 >= 0x60 && char1 <= 0x7f)); -}; - -/** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ -Cea608Stream.prototype.isNormalChar = function(char) { - return (char >= 0x20 && char <= 0x7f); -}; - -/** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ -Cea608Stream.prototype.setRollUp = function(pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; - // Spec says to wipe memories when switching to roll-up - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; -}; - -// Adds the opening HTML tag for the passed character to the caption text, -// and keeps track of it for later closing -Cea608Stream.prototype.addFormatting = function(pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function(text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); -}; - -// Adds HTML closing tags for current formatting to caption text and -// clears remembered formatting -Cea608Stream.prototype.clearFormatting = function(pts) { - if (!this.formatting_.length) { - return; - } - var text = this.formatting_.reverse().reduce(function(text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); -}; - -// Mode Implementations -Cea608Stream.prototype.popOn = function(pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; - - // buffer characters - baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; -}; - -Cea608Stream.prototype.rollUp = function(pts, text) { - var baseRow = this.displayed_[this.row_]; - - baseRow += text; - this.displayed_[this.row_] = baseRow; - -}; - -Cea608Stream.prototype.shiftRowsUp_ = function() { - var i; - // clear out inactive rows - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; - } - // shift displayed rows up - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } - // clear out the bottom row - this.displayed_[this.row_] = ''; -}; - -Cea608Stream.prototype.paintOn = function(pts, text) { - var baseRow = this.displayed_[this.row_]; - - baseRow += text; - this.displayed_[this.row_] = baseRow; -}; - -// exports -module.exports = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream -}; diff --git a/node_modules/mux.js/lib/m2ts/index.js b/node_modules/mux.js/lib/m2ts/index.js deleted file mode 100644 index f73b1e4..0000000 --- a/node_modules/mux.js/lib/m2ts/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = require('./m2ts'); diff --git a/node_modules/mux.js/lib/m2ts/m2ts.js b/node_modules/mux.js/lib/m2ts/m2ts.js deleted file mode 100644 index e45d4c0..0000000 --- a/node_modules/mux.js/lib/m2ts/m2ts.js +++ /dev/null @@ -1,547 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; -var Stream = require('../utils/stream.js'), - CaptionStream = require('./caption-stream'), - StreamTypes = require('./stream-types'), - TimestampRolloverStream = require('./timestamp-rollover-stream').TimestampRolloverStream; - -// object types -var TransportPacketStream, TransportParseStream, ElementaryStream; - -// constants -var - MP2T_PACKET_LENGTH = 188, // bytes - SYNC_BYTE = 0x47; - -/** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ -TransportPacketStream = function() { - var - buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - TransportPacketStream.prototype.init.call(this); - - // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - this.push = function(bytes) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; - - // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } - - // While we have enough data for a packet - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } - - // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - this.flush = function() { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - this.trigger('done'); - }; - - this.endTimeline = function() { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function() { - bytesInBuffer = 0; - this.trigger('reset'); - }; -}; -TransportPacketStream.prototype = new Stream(); - -/** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ -TransportParseStream = function() { - var parsePsi, parsePat, parsePmt, self; - TransportParseStream.prototype.init.call(this); - self = this; - - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function(payload, psi) { - var offset = 0; - - // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - - // skip the PSI header and parse the first PMT entry - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - parsePmt = function(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; - - // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - if (!(payload[5] & 0x01)) { - return; - } - - // overwrite any existing program map table - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; - - // the mapping table ends at the end of the current section - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; - - // to determine where the table is, we have to figure out how - // long the program info descriptors are - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; - - // advance the offset to the first entry in the mapping table - offset = 12 + programInfoLength; - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; - - // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - if (streamType === StreamTypes.H264_STREAM_TYPE && - self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === StreamTypes.ADTS_STREAM_TYPE && - self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === StreamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } - - // move to the next table entry - // skip past the elementary stream descriptors, if present - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } - - // record the map on the packet as well - pmt.programMapTable = self.programMapTable; - }; - - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - this.push = function(packet) { - var - result = {}, - offset = 4; - - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); - - // pid is a 13-bit field starting at the last bit of packet[1] - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; - - // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - if (((packet[3] & 0x30) >>> 4) > 0x01) { - offset += packet[offset] + 1; - } - - // parse the rest of the packet based on the type - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - - // if there are any packets waiting for a PMT to be found, process them now - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function(packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = StreamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = StreamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; -}; -TransportParseStream.prototype = new Stream(); -TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f -}; - -/** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ -ElementaryStream = function() { - var - self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function(payload, pes) { - var ptsDtsFlags; - const startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2] - // default to an empty array - pes.data = new Uint8Array() - // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - if (startPrefix !== 1) { - return; - } - // get the packet length, this will be 0 for video - pes.packetLength = 6 + ((payload[4] << 8) | payload[5]); - - // find out if this packets starts a new keyframe - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; - // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - ptsDtsFlags = payload[7]; - - // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | - (payload[10] & 0xFF) << 20 | - (payload[11] & 0xFE) << 12 | - (payload[12] & 0xFF) << 5 | - (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - pes.dts = pes.pts; - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | - (payload[15] & 0xFF) << 20 | - (payload[16] & 0xFE) << 12 | - (payload[17] & 0xFF) << 5 | - (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } - // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - pes.data = payload.subarray(9 + payload[8]); - }, - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function(stream, type, forceFlush) { - var - packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; - - // do nothing if there is not enough buffered data for a complete - // PES header - if (!stream.data.length || stream.size < 9) { - return; - } - event.trackId = stream.data[0].pid; - - // reassemble the packet - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } - - // parse assembled packet's PES header - parsePes(packetData, event); - - // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - packetFlushable = type === 'video' || event.packetLength <= stream.size; - - // flush pending packets if the conditions are right - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } - - // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - if (packetFlushable) { - self.trigger('data', event); - } - }; - - ElementaryStream.prototype.init.call(this); - - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - this.push = function(data) { - ({ - pat: function() { - // we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function() { - var stream, streamType; - - switch (data.streamType) { - case StreamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - case StreamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - case StreamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - default: - // ignore unknown stream types - return; - } - - // if a new packet is starting, we can flush the completed - // packet - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } - - // buffer this fragment until we are sure we've received the - // complete payload - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function() { - var - event = { - type: 'metadata', - tracks: [] - }; - - programMapTable = data.programMapTable; - - // translate audio and video streams to tracks - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function() { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - this.flushStreams_ = function() { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function() { - this.flushStreams_(); - this.trigger('done'); - }; -}; -ElementaryStream.prototype = new Stream(); - -var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: TransportPacketStream, - TransportParseStream: TransportParseStream, - ElementaryStream: ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: CaptionStream.CaptionStream, - Cea608Stream: CaptionStream.Cea608Stream, - Cea708Stream: CaptionStream.Cea708Stream, - MetadataStream: require('./metadata-stream') -}; - -for (var type in StreamTypes) { - if (StreamTypes.hasOwnProperty(type)) { - m2ts[type] = StreamTypes[type]; - } -} - -module.exports = m2ts; diff --git a/node_modules/mux.js/lib/m2ts/metadata-stream.js b/node_modules/mux.js/lib/m2ts/metadata-stream.js deleted file mode 100644 index 5f239bc..0000000 --- a/node_modules/mux.js/lib/m2ts/metadata-stream.js +++ /dev/null @@ -1,253 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and parses out - * ID3 metadata from them, if present. - * @see http://id3.org/id3v2.3.0 - */ -'use strict'; -var - Stream = require('../utils/stream'), - StreamTypes = require('./stream-types'), - // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - percentEncode = function(bytes, start, end) { - var i, result = ''; - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591 = function(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger = function(data) { - return (data[0] << 21) | - (data[1] << 14) | - (data[2] << 7) | - (data[3]); - }, - tagParsers = { - TXXX: function(tag) { - var i; - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); - // do not include the null terminator in the tag value - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - tag.data = tag.value; - }, - WXXX: function(tag) { - var i; - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591(tag.data, 0, i); - break; - } - } - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } - }, - MetadataStream; - -MetadataStream = function(options) { - var - settings = { - debug: !!(options && options.debug), - - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - MetadataStream.prototype.init.call(this); - - // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - this.dispatchType = StreamTypes.METADATA_STREAM_TYPE.toString(16); - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function(chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - if (chunk.type !== 'timed-metadata') { - return; - } - - // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } - - // ignore events that don't look like ID3 data - if (buffer.length === 0 && - (chunk.data.length < 10 || - chunk.data[0] !== 'I'.charCodeAt(0) || - chunk.data[1] !== 'D'.charCodeAt(0) || - chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - return; - } - - // add this chunk to the data we've collected so far - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; - - // grab the size of the entire frame from the ID3 header - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger(chunk.data.subarray(6, 10)); - - // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - tagSize += 10; - } - - // if the entire frame has not arrived, wait for more data - if (bufferSize < tagSize) { - return; - } - - // collect the entire frame so it can be parsed - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } - - // find the start of the first frame and the end of the tag - frameStart = 10; - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - frameStart += parseSyncSafeInteger(tag.data.subarray(10, 14)); - - // clip any padding off the end - tagSize -= parseSyncSafeInteger(tag.data.subarray(16, 20)); - } - - // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - frameHeader = String.fromCharCode(tag.data[frameStart], - tag.data[frameStart + 1], - tag.data[frameStart + 2], - tag.data[frameStart + 3]); - - - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); - - // handle the special PRIV frame used to indicate the start - // time for raw AAC data - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var - d = frame.data, - size = ((d[3] & 0x01) << 30) | - (d[4] << 22) | - (d[5] << 14) | - (d[6] << 6) | - (d[7] >>> 2); - - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; - // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - this.trigger('timestamp', frame); - } - } - tag.frames.push(frame); - - frameStart += 10; // advance past the frame header - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - this.trigger('data', tag); - }; -}; -MetadataStream.prototype = new Stream(); - -module.exports = MetadataStream; diff --git a/node_modules/mux.js/lib/m2ts/probe.js b/node_modules/mux.js/lib/m2ts/probe.js deleted file mode 100644 index 12a055c..0000000 --- a/node_modules/mux.js/lib/m2ts/probe.js +++ /dev/null @@ -1,287 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about TS Segments. - */ -'use strict'; - -var StreamTypes = require('./stream-types.js'); - -var parsePid = function(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; -}; - -var parsePayloadUnitStartIndicator = function(packet) { - return !!(packet[1] & 0x40); -}; - -var parseAdaptionField = function(packet) { - var offset = 0; - // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - if (((packet[3] & 0x30) >>> 4) > 0x01) { - offset += packet[4] + 1; - } - return offset; -}; - -var parseType = function(packet, pmtPid) { - var pid = parsePid(packet); - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - return null; -}; - -var parsePat = function(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; -}; - -var parsePmt = function(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } - - // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; - // the mapping table ends at the end of the current section - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; - - // to determine where the table is, we have to figure out how - // long the program info descriptors are - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; - - // advance the offset to the first entry in the mapping table - var offset = 12 + programInfoLength; - while (offset < tableEnd) { - var i = payloadOffset + offset; - // add an entry that maps the elementary_pid to the stream_type - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; - - // move to the next table entry - // skip past the elementary stream descriptors, if present - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - return programMapTable; -}; - -var parsePesType = function(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - return 'video'; - case StreamTypes.ADTS_STREAM_TYPE: - return 'audio'; - case StreamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - default: - return null; - } -}; - -var parsePesTime = function(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; - - // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - ptsDtsFlags = packet[offset + 7]; - - // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - if (ptsDtsFlags & 0xC0) { - pes = {}; - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (packet[offset + 9] & 0x0E) << 27 | - (packet[offset + 10] & 0xFF) << 20 | - (packet[offset + 11] & 0xFE) << 12 | - (packet[offset + 12] & 0xFF) << 5 | - (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - pes.dts = pes.pts; - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | - (packet[offset + 15] & 0xFF) << 20 | - (packet[offset + 16] & 0xFE) << 12 | - (packet[offset + 17] & 0xFF) << 5 | - (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - return pes; -}; - -var parseNalUnitType = function(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - case 0x06: - return 'sei_rbsp'; - case 0x07: - return 'seq_parameter_set_rbsp'; - case 0x08: - return 'pic_parameter_set_rbsp'; - case 0x09: - return 'access_unit_delimiter_rbsp'; - default: - return null; - } -}; - -var videoPacketContainsKeyFrame = function(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; - - // advance the sync point to a NAL start, if necessary - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - // drop trailing zeroes - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - frameSyncPoint = frameI - 2; - frameI += 3; - break; - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || - frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - frameSyncPoint = frameI - 2; - frameI += 3; - break; - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; - // parse the final nal - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; -}; - - -module.exports = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame -}; diff --git a/node_modules/mux.js/lib/m2ts/stream-types.js b/node_modules/mux.js/lib/m2ts/stream-types.js deleted file mode 100644 index 62a2f5a..0000000 --- a/node_modules/mux.js/lib/m2ts/stream-types.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -module.exports = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 -}; diff --git a/node_modules/mux.js/lib/m2ts/timestamp-rollover-stream.js b/node_modules/mux.js/lib/m2ts/timestamp-rollover-stream.js deleted file mode 100644 index ffd1408..0000000 --- a/node_modules/mux.js/lib/m2ts/timestamp-rollover-stream.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and corrects - * decode and presentation time stamps to account for a rollover - * of the 33 bit value. - */ - -'use strict'; - -var Stream = require('../utils/stream'); - -var MAX_TS = 8589934592; - -var RO_THRESH = 4294967296; - -var TYPE_SHARED = 'shared'; - -var handleRollover = function(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } - - // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - while (Math.abs(reference - value) > RO_THRESH) { - value += (direction * MAX_TS); - } - - return value; -}; - -var TimestampRolloverStream = function(type) { - var lastDTS, referenceDTS; - - TimestampRolloverStream.prototype.init.call(this); - - // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - this.type_ = type || TYPE_SHARED; - - this.push = function(data) { - - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - - lastDTS = data.dts; - - this.trigger('data', data); - }; - - this.flush = function() { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function() { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function() { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function() { - this.discontinuity(); - this.trigger('reset'); - }; -}; - -TimestampRolloverStream.prototype = new Stream(); - -module.exports = { - TimestampRolloverStream: TimestampRolloverStream, - handleRollover: handleRollover -}; diff --git a/node_modules/mux.js/lib/mp4/audio-frame-utils.js b/node_modules/mux.js/lib/mp4/audio-frame-utils.js deleted file mode 100644 index 58e93b2..0000000 --- a/node_modules/mux.js/lib/mp4/audio-frame-utils.js +++ /dev/null @@ -1,157 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var coneOfSilence = require('../data/silence'); -var clock = require('../utils/clock'); - -/** - * Sum the `byteLength` properties of the data in each AAC frame - */ -var sumFrameByteLengths = function(array) { - var - i, - currentObj, - sum = 0; - - // sum the byteLength's all each nal unit in the frame - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; -}; - -// Possibly pad (prefix) the audio track with silence if appending this track -// would lead to the introduction of a gap in the audio buffer -var prefixWithSilence = function( - track, - frames, - audioAppendStartTs, - videoBaseMediaDecodeTime -) { - var - baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); - // determine frame clock duration based on sample rate, round up to avoid overfills - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = - baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); - // number of full frames in the audio gap - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } - - // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = coneOfSilence()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= - Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - - return audioFillDuration; -}; - -// If the audio segment extends before the earliest allowed dts -// value, remove AAC frames until starts at or after the earliest -// allowed DTS so that we don't end up with a negative baseMedia- -// DecodeTime for the audio track -var trimAdtsFramesByEarliestDts = function(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } - - // We will need to recalculate the earliest segment Dts - track.minSegmentDts = Infinity; - - return adtsFrames.filter(function(currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } - // Otherwise, discard it - return false; - }); -}; - -// generate the track's raw mdat data from an array of frames -var generateSampleTable = function(frames) { - var - i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - }); - } - return samples; -}; - -// generate the track's sample table from an array of frames -var concatenateFrameData = function(frames) { - var - i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - return data; -}; - -module.exports = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData -}; diff --git a/node_modules/mux.js/lib/mp4/caption-parser.js b/node_modules/mux.js/lib/mp4/caption-parser.js deleted file mode 100644 index 1d452d0..0000000 --- a/node_modules/mux.js/lib/mp4/caption-parser.js +++ /dev/null @@ -1,455 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band CEA-708 captions out of FMP4 segments. - * @see https://en.wikipedia.org/wiki/CEA-708 - */ -'use strict'; - -var discardEmulationPreventionBytes = require('../tools/caption-packet-parser').discardEmulationPreventionBytes; -var CaptionStream = require('../m2ts/caption-stream').CaptionStream; -var findBox = require('../mp4/find-box.js'); -var parseTfdt = require('../tools/parse-tfdt.js'); -var parseTrun = require('../tools/parse-trun.js'); -var parseTfhd = require('../tools/parse-tfhd.js'); - -/** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ -var mapToSample = function(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; -}; - -/** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ -var findSeiNals = function(avcStream, samples, trackId) { - var - avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; - - // Bail if this doesn't appear to be an H264 stream - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - // eslint-disable-next-line no-console - console.log("We've encountered a nal unit without data. See mux.js#233."); - break; - } - - result.push(seiNal); - break; - default: - break; - } - } - - return result; -}; - -/** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ -var parseSamples = function(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - - truns.forEach(function(trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - - samples.forEach(function(sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - sample.trackId = trackId; - sample.dts = currentDts; - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - sample.pts = currentDts + sample.compositionTimeOffset; - - currentDts += sample.duration; - }); - - allSamples = allSamples.concat(samples); - }); - - return allSamples; -}; - -/** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ -var parseCaptionNals = function(segment, videoTrackId) { - // To get the samples - var trafs = findBox(segment, ['moof', 'traf']); - // To get SEI NAL units - var mdats = findBox(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; - - // Pair up each traf with a mdat as moofs and mdats are in pairs - mdats.forEach(function(mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - - mdatTrafPairs.forEach(function(pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox(traf, ['tfhd']); - // Exactly 1 tfhd per traf - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox(traf, ['tfdt']); - // Either 0 or 1 tfdt per traf - var baseMediaDecodeTime = (tfdt.length > 0) ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox(traf, ['trun']); - var samples; - var seiNals; - - // Only parse video data for the chosen video track - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - - seiNals = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = []; - } - - captionNals[trackId] = captionNals[trackId].concat(seiNals); - } - }); - - return captionNals; -}; - -/** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption - **/ -var parseEmbeddedCaptions = function(segment, trackId, timescale) { - var seiNals; - - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - if (trackId === null) { - return null; - } - - seiNals = parseCaptionNals(segment, trackId); - - return { - seiNals: seiNals[trackId], - timescale: timescale - }; -}; - -/** - * Converts SEI NALUs into captions that can be used by video.js - **/ -var CaptionParser = function() { - var isInitialized = false; - var captionStream; - - // Stores segments seen before trackId and timescale are set - var segmentCache; - // Stores video track ID of the track being parsed - var trackId; - // Stores the timescale of the track being parsed - var timescale; - // Stores captions parsed so far - var parsedCaptions; - // Stores whether we are receiving partial data or not - var parsingPartial; - - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - this.isInitialized = function() { - return isInitialized; - }; - - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - this.init = function(options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; - - // Collect dispatched captions - captionStream.on('data', function(event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - }; - - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - this.isNewInit = function(videoTrackIds, timescales) { - if ((videoTrackIds && videoTrackIds.length === 0) || - (timescales && typeof timescales === 'object' && - Object.keys(timescales).length === 0)) { - return false; - } - - return trackId !== videoTrackIds[0] || - timescale !== timescales[trackId]; - }; - - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - this.parse = function(segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; - - // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; - - // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } - - // Now that a timescale and trackId is set, parse cached segments - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData === null || !parsedData.seiNals) { - return null; - } - - this.pushNals(parsedData.seiNals); - // Force the parsed captions to be dispatched - this.flushStream(); - - return parsedCaptions; - }; - - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - this.pushNals = function(nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function(nal) { - captionStream.push(nal); - }); - }; - - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - this.flushStream = function() { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - - /** - * Reset caption buckets for new data - **/ - this.clearParsedCaptions = function() { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - }; - - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - this.resetCaptionStream = function() { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - this.clearAllCaptions = function() { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - - /** - * Reset caption parser - **/ - this.reset = function() { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {} - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); -}; - -module.exports = CaptionParser; diff --git a/node_modules/mux.js/lib/mp4/find-box.js b/node_modules/mux.js/lib/mp4/find-box.js deleted file mode 100644 index eced28d..0000000 --- a/node_modules/mux.js/lib/mp4/find-box.js +++ /dev/null @@ -1,44 +0,0 @@ -var toUnsigned = require('../utils/bin').toUnsigned; -var parseType = require('./parse-type.js'); - -var findBox = function(data, path) { - var results = [], - i, size, type, end, subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned(data[i] << 24 | - data[i + 1] << 16 | - data[i + 2] << 8 | - data[i + 3]); - - type = parseType(data.subarray(i + 4, i + 8)); - - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - if (subresults.length) { - results = results.concat(subresults); - } - } - } - i = end; - } - - // we've finished searching all of data - return results; -}; - -module.exports = findBox; - diff --git a/node_modules/mux.js/lib/mp4/frame-utils.js b/node_modules/mux.js/lib/mp4/frame-utils.js deleted file mode 100644 index c7d98ec..0000000 --- a/node_modules/mux.js/lib/mp4/frame-utils.js +++ /dev/null @@ -1,319 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -// Convert an array of nal units into an array of frames with each frame being -// composed of the nal units that make up that frame -// Also keep track of cummulative data about the frame from the nal units such -// as the frame duration, starting pts, etc. -var groupNalsIntoFrames = function(nalUnits) { - var - i, - currentNal, - currentFrame = [], - frames = []; - - // TODO added for LHLS, make sure this is OK - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; - - // Split on 'aud'-type nal units - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; - // TODO added for LHLS, make sure this is OK - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } - - // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - if (frames.length && - (!currentFrame.duration || - currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } - - // Push the final frame - // TODO added for LHLS, make sure this is OK - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - - frames.push(currentFrame); - return frames; -}; - -// Convert an array of frames into an array of Gop with each Gop being composed -// of the frames that make up that Gop -// Also keep track of cummulative data about the Gop from the frames such as the -// Gop duration, starting pts, etc. -var groupFramesIntoGops = function(frames) { - var - i, - currentFrame, - currentGop = [], - gops = []; - - // We must pre-set some of the values on the Gop since we - // keep running totals of these values - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; - - // store some metadata about all the Gops - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - - // push the final Gop - gops.push(currentGop); - return gops; -}; - -/* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ -var extendFirstKeyFrame = function(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; - - // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; -}; - -/** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ -var createDefaultSample = function() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; -}; - -/* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ -var sampleForFrame = function(frame, dataOffset) { - var sample = createDefaultSample(); - - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; -}; - -// generate the track's sample table from an array of gops -var generateSampleTable = function(gops, baseDataOffset) { - var - h, i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - - sample = sampleForFrame(currentFrame, dataOffset); - - dataOffset += sample.size; - - samples.push(sample); - } - } - return samples; -}; - -// generate the track's raw mdat data from an array of gops -var concatenateNalData = function(gops) { - var - h, i, j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); - - // For each Gop.. - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - // For each Frame.. - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - - // For each NAL.. - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - return data; -}; - -// generate the track's sample table from a frame -var generateSampleTableForFrame = function(frame, baseDataOffset) { - var - sample, - dataOffset = baseDataOffset || 0, - samples = []; - - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - - return samples; -}; - -// generate the track's raw mdat data from a frame -var concatenateNalDataForFrame = function(frame) { - var - i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); - - // For each NAL.. - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; -}; - -module.exports = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame -}; diff --git a/node_modules/mux.js/lib/mp4/index.js b/node_modules/mux.js/lib/mp4/index.js deleted file mode 100644 index 15b9123..0000000 --- a/node_modules/mux.js/lib/mp4/index.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - generator: require('./mp4-generator'), - probe: require('./probe'), - Transmuxer: require('./transmuxer').Transmuxer, - AudioSegmentStream: require('./transmuxer').AudioSegmentStream, - VideoSegmentStream: require('./transmuxer').VideoSegmentStream, - CaptionParser: require('./caption-parser') -}; diff --git a/node_modules/mux.js/lib/mp4/mp4-generator.js b/node_modules/mux.js/lib/mp4/mp4-generator.js deleted file mode 100644 index 649896f..0000000 --- a/node_modules/mux.js/lib/mp4/mp4-generator.js +++ /dev/null @@ -1,799 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ -'use strict'; - -var UINT32_MAX = Math.pow(2, 32) - 1; - -var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, - trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, - trun, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, - AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; - -// pre-calculate constants -(function() { - var i; - types = { - avc1: [], // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; - - // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [ - i.charCodeAt(0), - i.charCodeAt(1), - i.charCodeAt(2), - i.charCodeAt(3) - ]; - } - } - - MAJOR_BRAND = new Uint8Array([ - 'i'.charCodeAt(0), - 's'.charCodeAt(0), - 'o'.charCodeAt(0), - 'm'.charCodeAt(0) - ]); - AVC1_BRAND = new Uint8Array([ - 'a'.charCodeAt(0), - 'v'.charCodeAt(0), - 'c'.charCodeAt(0), - '1'.charCodeAt(0) - ]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, - 0x6f, 0x48, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, - 0x64, 0x48, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00 // opcolor - ]); -}()); - -box = function(type) { - var - payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; - - // calculate the total size we need to allocate - while (i--) { - size += payload[i].byteLength; - } - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); - - // copy the payload into the result - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - return result; -}; - -dinf = function() { - return box(types.dinf, box(types.dref, DREF)); -}; - -esds = function(track) { - return box(types.esds, new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - (track.audioobjecttype << 3) | (track.samplingfrequencyindex >>> 1), - (track.samplingfrequencyindex << 7) | (track.channelcount << 3), - 0x06, 0x01, 0x02 // GASpecificConfig - ])); -}; - -ftyp = function() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); -}; - -hdlr = function(type) { - return box(types.hdlr, HDLR_TYPES[type]); -}; -mdat = function(data) { - return box(types.mdat, data); -}; -mdhd = function(track) { - var result = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - - (track.duration >>> 24) & 0xFF, - (track.duration >>> 16) & 0xFF, - (track.duration >>> 8) & 0xFF, - track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00 - ]); - - // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - if (track.samplerate) { - result[12] = (track.samplerate >>> 24) & 0xFF; - result[13] = (track.samplerate >>> 16) & 0xFF; - result[14] = (track.samplerate >>> 8) & 0xFF; - result[15] = (track.samplerate) & 0xFF; - } - - return box(types.mdhd, result); -}; -mdia = function(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); -}; -mfhd = function(sequenceNumber) { - return box(types.mfhd, new Uint8Array([ - 0x00, - 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, - (sequenceNumber & 0xFF0000) >> 16, - (sequenceNumber & 0xFF00) >> 8, - sequenceNumber & 0xFF // sequence_number - ])); -}; -minf = function(track) { - return box(types.minf, - track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), - dinf(), - stbl(track)); -}; -moof = function(sequenceNumber, tracks) { - var - trackFragments = [], - i = tracks.length; - // build traf boxes for each track fragment - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - return box.apply(null, [ - types.moof, - mfhd(sequenceNumber) - ].concat(trackFragments)); -}; -/** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ -moov = function(tracks) { - var - i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); -}; -mvex = function(tracks) { - var - i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - return box.apply(null, [types.mvex].concat(boxes)); -}; -mvhd = function(duration) { - var - bytes = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, - (duration & 0xFF0000) >> 16, - (duration & 0xFF00) >> 8, - duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); -}; - -sdtp = function(track) { - var - samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; - - // leave the full box header (4 bytes) all zero - - // write the sample table - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - - bytes[i + 4] = (flags.dependsOn << 4) | - (flags.isDependedOn << 2) | - (flags.hasRedundancy); - } - - return box(types.sdtp, - bytes); -}; - -stbl = function(track) { - return box(types.stbl, - stsd(track), - box(types.stts, STTS), - box(types.stsc, STSC), - box(types.stsz, STSZ), - box(types.stco, STCO)); -}; - -(function() { - var videoSample, audioSample; - - stsd = function(track) { - - return box(types.stsd, new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01 - ]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function(track) { - var - sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; - - // assemble the SPSs - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push((sps[i].byteLength & 0xFF)); // sequenceParameterSetLength - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } - - // assemble the PPSs - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push((pps[i].byteLength & 0xFF)); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [ - types.avc1, new Uint8Array([ - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, - track.width & 0xff, // width - (track.height & 0xff00) >> 8, - track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, - 0x76, 0x69, 0x64, 0x65, - 0x6f, 0x6a, 0x73, 0x2d, - 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x69, 0x62, 0x2d, - 0x68, 0x6c, 0x73, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), - box(types.avcC, new Uint8Array([ - 0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat( - [sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), - box(types.btrt, new Uint8Array([ - 0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ])) - ]; - - if (track.sarRatio) { - var - hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - - avc1Box.push( - box(types.pasp, new Uint8Array([ - (hSpacing & 0xFF000000) >> 24, - (hSpacing & 0xFF0000) >> 16, - (hSpacing & 0xFF00) >> 8, - hSpacing & 0xFF, - (vSpacing & 0xFF000000) >> 24, - (vSpacing & 0xFF0000) >> 16, - (vSpacing & 0xFF00) >> 8, - vSpacing & 0xFF - ])) - ); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function(track) { - return box(types.mp4a, new Uint8Array([ - - // SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, - (track.channelcount & 0xff), // channelcount - - (track.samplesize & 0xff00) >> 8, - (track.samplesize & 0xff), // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - - (track.samplerate & 0xff00) >> 8, - (track.samplerate & 0xff), - 0x00, 0x00 // samplerate, 16.16 - - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; -}()); - -tkhd = function(track) { - var result = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, - (track.id & 0xFF0000) >> 16, - (track.id & 0xFF00) >> 8, - track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, - (track.duration & 0xFF0000) >> 16, - (track.duration & 0xFF00) >> 8, - track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, - track.width & 0xFF, - 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, - track.height & 0xFF, - 0x00, 0x00 // height - ]); - - return box(types.tkhd, result); -}; - -/** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ -traf = function(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, - sampleDependencyTable, dataOffset, - upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - - trackFragmentHeader = box(types.tfhd, new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, - (track.id & 0xFF0000) >> 16, - (track.id & 0xFF00) >> 8, - (track.id & 0xFF), // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (UINT32_MAX + 1)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (UINT32_MAX + 1)); - - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([ - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - (upperWordBaseMediaDecodeTime >>> 24) & 0xFF, - (upperWordBaseMediaDecodeTime >>> 16) & 0xFF, - (upperWordBaseMediaDecodeTime >>> 8) & 0xFF, - upperWordBaseMediaDecodeTime & 0xFF, - (lowerWordBaseMediaDecodeTime >>> 24) & 0xFF, - (lowerWordBaseMediaDecodeTime >>> 16) & 0xFF, - (lowerWordBaseMediaDecodeTime >>> 8) & 0xFF, - lowerWordBaseMediaDecodeTime & 0xFF - ])); - - // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - dataOffset = (32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8); // mdat header - - // audio tracks require less metadata - if (track.type === 'audio') { - trackFragmentRun = trun(track, dataOffset); - return box(types.traf, - trackFragmentHeader, - trackFragmentDecodeTime, - trackFragmentRun); - } - - // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun(track, - sampleDependencyTable.length + dataOffset); - return box(types.traf, - trackFragmentHeader, - trackFragmentDecodeTime, - trackFragmentRun, - sampleDependencyTable); -}; - -/** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ -trak = function(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, - tkhd(track), - mdia(track)); -}; - -trex = function(track) { - var result = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, - (track.id & 0xFF0000) >> 16, - (track.id & 0xFF00) >> 8, - (track.id & 0xFF), // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); - // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); -}; - -(function() { - var audioTrun, videoTrun, trunHeader; - - // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - trunHeader = function(samples, offset) { - var durationPresent = 0, sizePresent = 0, - flagsPresent = 0, compositionTimeOffset = 0; - - // trun flag constants - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [ - 0x00, // version 0 - 0x00, - durationPresent | sizePresent | flagsPresent | compositionTimeOffset, - 0x01, // flags - (samples.length & 0xFF000000) >>> 24, - (samples.length & 0xFF0000) >>> 16, - (samples.length & 0xFF00) >>> 8, - samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, - (offset & 0xFF0000) >>> 16, - (offset & 0xFF00) >>> 8, - offset & 0xFF // data_offset - ]; - }; - - videoTrun = function(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - - samples = track.samples || []; - offset += 8 + 12 + (16 * samples.length); - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - bytes[bytesOffest++] = (sample.flags.isLeading << 2) | sample.flags.dependsOn; - bytes[bytesOffest++] = (sample.flags.isDependedOn << 6) | - (sample.flags.hasRedundancy << 4) | - (sample.flags.paddingValue << 1) | - sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - return box(types.trun, bytes); - }; - - audioTrun = function(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - - samples = track.samples || []; - offset += 8 + 12 + (8 * samples.length); - - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun = function(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; -}()); - -module.exports = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function(tracks) { - var - fileType = ftyp(), - movie = moov(tracks), - result; - - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } -}; diff --git a/node_modules/mux.js/lib/mp4/parse-type.js b/node_modules/mux.js/lib/mp4/parse-type.js deleted file mode 100644 index c39d67d..0000000 --- a/node_modules/mux.js/lib/mp4/parse-type.js +++ /dev/null @@ -1,11 +0,0 @@ -var parseType = function(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; -}; - - -module.exports = parseType; diff --git a/node_modules/mux.js/lib/mp4/probe.js b/node_modules/mux.js/lib/mp4/probe.js deleted file mode 100644 index 339739c..0000000 --- a/node_modules/mux.js/lib/mp4/probe.js +++ /dev/null @@ -1,366 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about MP4s. - */ -'use strict'; - -var toUnsigned = require('../utils/bin').toUnsigned; -var toHexString = require('../utils/bin').toHexString; -var findBox = require('../mp4/find-box.js'); -var parseType = require('../mp4/parse-type.js'); -var parseTfhd = require('../tools/parse-tfhd.js'); -var parseTrun = require('../tools/parse-trun.js'); -var parseTfdt = require('../tools/parse-tfdt.js'); -var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, - getTimescaleFromMediaHeader; - -/** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ -timescale = function(init) { - var - result = {}, - traks = findBox(init, ['moov', 'trak']); - - // mdhd timescale - return traks.reduce(function(result, trak) { - var tkhd, version, index, id, mdhd; - - tkhd = findBox(trak, ['tkhd'])[0]; - if (!tkhd) { - return null; - } - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | - tkhd[index + 1] << 16 | - tkhd[index + 2] << 8 | - tkhd[index + 3]); - - mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - if (!mdhd) { - return null; - } - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | - mdhd[index + 1] << 16 | - mdhd[index + 2] << 8 | - mdhd[index + 3]); - return result; - }, result); -}; - -/** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ -startTime = function(timescale, fragment) { - var trafs, baseTimes, result; - - // we need info from two childrend of each track fragment box - trafs = findBox(fragment, ['moof', 'traf']); - - // determine the start times for each track - baseTimes = [].concat.apply([], trafs.map(function(traf) { - return findBox(traf, ['tfhd']).map(function(tfhd) { - var id, scale, baseTime; - - // get the track id from the tfhd - id = toUnsigned(tfhd[4] << 24 | - tfhd[5] << 16 | - tfhd[6] << 8 | - tfhd[7]); - // assume a 90kHz clock if no timescale was specified - scale = timescale[id] || 90e3; - - // get the base media decode time from the tfdt - baseTime = findBox(traf, ['tfdt']).map(function(tfdt) { - var version, result; - - version = tfdt[0]; - result = toUnsigned(tfdt[4] << 24 | - tfdt[5] << 16 | - tfdt[6] << 8 | - tfdt[7]); - if (version === 1) { - result *= Math.pow(2, 32); - result += toUnsigned(tfdt[8] << 24 | - tfdt[9] << 16 | - tfdt[10] << 8 | - tfdt[11]); - } - return result; - })[0]; - baseTime = typeof baseTime === 'number' && !isNaN(baseTime) ? baseTime : Infinity; - - // convert base time to seconds - return baseTime / scale; - }); - })); - - // return the minimum - result = Math.min.apply(null, baseTimes); - return isFinite(result) ? result : 0; -}; - -/** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ -compositionStartTime = function(timescales, fragment) { - var trafBoxes = findBox(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } - - // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - var timescale = timescales[trackId] || 90e3; - - // return the composition start time, in seconds - return (baseMediaDecodeTime + compositionTimeOffset) / timescale; -}; - -/** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ -getVideoTrackIds = function(init) { - var traks = findBox(init, ['moov', 'trak']); - var videoTrackIds = []; - - traks.forEach(function(trak) { - var hdlrs = findBox(trak, ['mdia', 'hdlr']); - var tkhds = findBox(trak, ['tkhd']); - - hdlrs.forEach(function(hdlr, index) { - var handlerType = parseType(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = (version === 0) ? view.getUint32(12) : view.getUint32(20); - - videoTrackIds.push(trackId); - } - }); - }); - - return videoTrackIds; -}; - -getTimescaleFromMediaHeader = function(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - - return toUnsigned( - mdhd[index] << 24 | - mdhd[index + 1] << 16 | - mdhd[index + 2] << 8 | - mdhd[index + 3] - ); -}; - -/** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ -getTracks = function(init) { - var traks = findBox(init, ['moov', 'trak']); - var tracks = []; - - traks.forEach(function(trak) { - var track = {}; - var tkhd = findBox(trak, ['tkhd'])[0]; - var view, tkhdVersion; - - // id - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - - track.id = (tkhdVersion === 0) ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox(trak, ['mdia', 'hdlr'])[0]; - - // type - if (hdlr) { - var type = parseType(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } - - - // codec - var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); - // gives the codec type string - track.codec = parseType(sampleDescriptions.subarray(4, 8)); - - var codecBox = findBox(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if ((/^[a-z]vc[1-9]$/i).test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; - - // left padded with zeroes for single digit hex - // profile idc - track.codec += toHexString(codecConfig[9]); - // the byte containing the constraint_set flags - track.codec += toHexString(codecConfig[10]); - // level idc - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if ((/^mp4[a,v]$/i).test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); - // this value is only a single digit - track.codec += '.' + toHexString((codecConfig[20] >>> 2) & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - - return tracks; -}; - -module.exports = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox, - parseType: parseType, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader -}; diff --git a/node_modules/mux.js/lib/mp4/track-decode-info.js b/node_modules/mux.js/lib/mp4/track-decode-info.js deleted file mode 100644 index 49c4af2..0000000 --- a/node_modules/mux.js/lib/mp4/track-decode-info.js +++ /dev/null @@ -1,107 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -/** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ -var collectDtsInfo = function(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } -}; - -/** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ -var clearDtsInfo = function(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; -}; - -/** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ -var calculateTrackBaseMediaDecodeTime = function(track, keepOriginalTimestamps) { - var - baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; - - // Optionally adjust the time so the first segment starts at zero. - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } - - // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; - - // Add to that the distance this segment is from the very first - baseMediaDecodeTime += minSegmentDts; - - // baseMediaDecodeTime must not become negative - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; -}; - -module.exports = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo -}; diff --git a/node_modules/mux.js/lib/mp4/transmuxer.js b/node_modules/mux.js/lib/mp4/transmuxer.js deleted file mode 100644 index 865dd34..0000000 --- a/node_modules/mux.js/lib/mp4/transmuxer.js +++ /dev/null @@ -1,1207 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var mp4 = require('./mp4-generator.js'); -var frameUtils = require('./frame-utils'); -var audioFrameUtils = require('./audio-frame-utils'); -var trackDecodeInfo = require('./track-decode-info'); -var m2ts = require('../m2ts/m2ts.js'); -var clock = require('../utils/clock'); -var AdtsStream = require('../codecs/adts.js'); -var H264Stream = require('../codecs/h264').H264Stream; -var AacStream = require('../aac'); -var isLikelyAacData = require('../aac/utils').isLikelyAacData; -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); - -// object types -var VideoSegmentStream, AudioSegmentStream, Transmuxer, CoalesceStream; - -/** - * Compare two arrays (even typed) for same-ness - */ -var arrayEquals = function(a, b) { - var - i; - - if (a.length !== b.length) { - return false; - } - - // compare the value of each element in the array - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; -}; - -var generateSegmentTimingInfo = function( - baseMediaDecodeTime, - startDts, - startPts, - endDts, - endPts, - prependedContentDuration -) { - var - ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; - - // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; -}; - -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ -AudioSegmentStream = function(track, options) { - var - adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - - options = options || {}; - - AudioSegmentStream.prototype.init.call(this); - - this.push = function(data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function(prop) { - track[prop] = data[prop]; - }); - } - - // buffer audio data until end() is called - adtsFrames.push(data); - }; - - this.setEarliestDts = function(earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function(timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function() { - var - frames, - moof, - mdat, - boxes, - frameDuration, - segmentDuration, - videoClockCyclesOfSilencePrefixed; - - // return early if no audio data has been observed - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts( - adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime( - track, options.keepOriginalTimestamps); - - // amount of audio filled but the value is in video clock rather than audio clock - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence( - track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); - - // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - track.samples = audioFrameUtils.generateSampleTable(frames); - - // concatenate the audio data to constuct the mdat - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - - adtsFrames = []; - - moof = mp4.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - - // bump the sequence number for next time - sequenceNumber++; - - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - - trackDecodeInfo.clearDtsInfo(track); - - frameDuration = Math.ceil(ONE_SECOND_IN_TS * 1024 / track.samplerate); - - // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - if (frames.length) { - segmentDuration = frames.length * frameDuration; - - this.trigger( - 'segmentTimingInfo', - generateSegmentTimingInfo( - // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), - // frame times are already in video clock, as is segment duration - frames[0].dts, - frames[0].pts, - frames[0].dts + segmentDuration, - frames[0].pts + segmentDuration, - videoClockCyclesOfSilencePrefixed || 0 - ) - ); - - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - this.trigger('data', {track: track, boxes: boxes}); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function() { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -AudioSegmentStream.prototype = new Stream(); - -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ -VideoSegmentStream = function(track, options) { - var - sequenceNumber = 0, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - - options = options || {}; - - VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - - this.gopCache_ = []; - - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - this.push = function(nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); - - // record the track config - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - - VIDEO_PROPERTIES.forEach(function(prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && - !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } - - // buffer video until flush() is called - nalUnits.push(nalUnit); - }; - - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - this.flush = function() { - var - frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; - - // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - nalUnits.shift(); - } - - // Return early if no video data has been observed - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } - - // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); - - // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - - gops.unshift(gopForFusion); - // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } - - // Trim gops to align with gopsToAlignWith - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); - - // Keep a maximum of 6 GOPs in the cache - this.gopCache_.length = Math.min(6, this.gopCache_.length); - - // Clear nalUnits - nalUnits = []; - - // return early no gops can be aligned with desired gopsToAlignWith - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } - - // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - trackDecodeInfo.clearDtsInfo(track); - - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); - - // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - track.samples = frameUtils.generateSampleTable(gops); - - // Concatenate the video data and construct the mdat - mdat = mp4.mdat(frameUtils.concatenateNalData(gops)); - - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime( - track, options.keepOriginalTimestamps); - - this.trigger('processedGopsInfo', gops.map(function(gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - - this.trigger( - 'segmentTimingInfo', - generateSegmentTimingInfo( - track.baseMediaDecodeTime, - firstGop.dts, - firstGop.pts, - lastGop.dts + lastGop.duration, - lastGop.pts + lastGop.duration, - prependedContentDuration)); - - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); - - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); - - // Keep a maximum of 6 GOPs in the cache - this.gopCache_.length = Math.min(6, this.gopCache_.length); - - // Clear nalUnits - nalUnits = []; - - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - - moof = mp4.moof(sequenceNumber, [track]); - - // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - - // Bump the sequence number for next time - sequenceNumber++; - - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - - this.trigger('data', {track: track, boxes: boxes}); - - this.resetStream_(); - - // Continue with the flush process now - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function() { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function() { - trackDecodeInfo.clearDtsInfo(track); - - // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - config = undefined; - pps = undefined; - }; - - // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - this.getGopForFusion_ = function(nalUnit) { - var - halfSecond = 45000, // Half-a-second in a 90khz clock - allowableOverlap = 10000, // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; - - // Search for the GOP nearest to the beginning of this nal unit - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; - - // Reject Gops with different SPS or PPS - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || - !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } - - // Reject Gops that would require a negative baseMediaDecodeTime - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } - - // The distance between the end of the gop and the start of the nalUnit - dtsDistance = (nalUnit.dts - currentGop.dts) - currentGop.duration; - - // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - if (dtsDistance >= -allowableOverlap && - dtsDistance <= halfSecond) { - - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || - nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - return null; - }; - - // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - this.alignGopsAtStart_ = function(gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } - - // current gop starts before the current gop we want to align on. so increment gop - // index - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - - return alignedGops; - }; - - // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - this.alignGopsAtEnd_ = function(gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function(total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { byteLength: 0, duration: 0, nalCount: 0 }); - - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - - return alignedGops; - }; - - this.alignGopsWith = function(newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; -}; - -VideoSegmentStream.prototype = new Stream(); - -/** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ -CoalesceStream = function(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - CoalesceStream.prototype.init.call(this); - - // Take output from multiple - this.push = function(output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } - // buffer incoming id3 tags until the final flush - if (output.frames) { - return this.pendingMetadata.push(output); - } - - // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; - - // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; -}; - -CoalesceStream.prototype = new Stream(); -CoalesceStream.prototype.flush = function(flushSource) { - var - offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && - flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - VIDEO_PROPERTIES.forEach(function(prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - AUDIO_PROPERTIES.forEach(function(prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - - initSegment = mp4.initSegment(this.pendingTracks); - - // Create a new typed array to hold the init segment - event.initSegment = new Uint8Array(initSegment.byteLength); - - // Create an init segment containing a moov - // and track definitions - event.initSegment.set(initSegment); - - // Create a new typed array to hold the moof+mdats - event.data = new Uint8Array(this.pendingBytes); - - // Append each moof+mdat (one per track) together - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } - - // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds( - caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds( - caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } - - // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds( - id3.pts, timelineStartPts, this.keepOriginalTimestamps); - - event.metadata.push(id3); - } - - // We add this to every single emitted segment even though we only need - // it for the first - event.metadata.dispatchType = this.metadataStream.dispatchType; - - // Reset stream state - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; - - // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - this.trigger('data', event); - // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - - this.trigger('caption', caption); - } - // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - - this.trigger('id3Frame', id3); - } - } - - // Only emit `done` if all tracks have been flushed and emitted - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } -}; - -CoalesceStream.prototype.setRemux = function(val) { - this.remuxTracks = val; -}; -/** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ -Transmuxer = function(options) { - var - self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function() { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts.MetadataStream(); - - // set up the parsing pipeline - pipeline.aacStream = new AacStream(); - pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new AdtsStream(); - pipeline.coalesceStream = new CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - - pipeline.aacStream - .pipe(pipeline.audioTimestampRolloverStream) - .pipe(pipeline.adtsStream); - pipeline.aacStream - .pipe(pipeline.timedMetadataTimestampRolloverStream) - .pipe(pipeline.metadataStream) - .pipe(pipeline.coalesceStream); - - pipeline.metadataStream.on('timestamp', function(frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - - pipeline.aacStream.on('data', function(data) { - if ((data.type !== 'timed-metadata' && data.type !== 'audio') || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options); - - pipeline.audioSegmentStream.on('timingInfo', - self.trigger.bind(self, 'audioTimingInfo')); - - // Set up the final part of the audio pipeline - pipeline.adtsStream - .pipe(pipeline.audioSegmentStream) - .pipe(pipeline.coalesceStream); - - // emit pmt info - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); - - // Re-emit any data coming from the coalesce stream to the outside world - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - // Let the consumer know we have finished flushing the entire pipeline - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - this.setupTsPipeline = function() { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts.MetadataStream(); - - // set up the parsing pipeline - pipeline.packetStream = new m2ts.TransportPacketStream(); - pipeline.parseStream = new m2ts.TransportParseStream(); - pipeline.elementaryStream = new m2ts.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream(); - pipeline.adtsStream = new AdtsStream(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts.CaptionStream(options); - pipeline.coalesceStream = new CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; - - // disassemble MPEG2-TS packets into elementary streams - pipeline.packetStream - .pipe(pipeline.parseStream) - .pipe(pipeline.elementaryStream) - .pipe(pipeline.timestampRolloverStream); - - // !!THIS ORDER IS IMPORTANT!! - // demux the streams - pipeline.timestampRolloverStream - .pipe(pipeline.h264Stream); - - pipeline.timestampRolloverStream - .pipe(pipeline.adtsStream); - - pipeline.timestampRolloverStream - .pipe(pipeline.metadataStream) - .pipe(pipeline.coalesceStream); - - // Hook up CEA-608/708 caption stream - pipeline.h264Stream.pipe(pipeline.captionStream) - .pipe(pipeline.coalesceStream); - - pipeline.elementaryStream.on('data', function(data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; - - // scan the tracks listed in the metadata - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } - - // hook up the video segment stream to the first track with h264 data - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new VideoSegmentStream(videoTrack, options); - - pipeline.videoSegmentStream.on('timelineStartInfo', function(timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; - // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - - pipeline.videoSegmentStream.on('processedGopsInfo', - self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', - self.trigger.bind(self, 'videoSegmentTimingInfo')); - - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function(baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - - pipeline.videoSegmentStream.on('timingInfo', - self.trigger.bind(self, 'videoTimingInfo')); - - // Set up the final part of the video pipeline - pipeline.h264Stream - .pipe(pipeline.videoSegmentStream) - .pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options); - - pipeline.audioSegmentStream.on('timingInfo', - self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', - self.trigger.bind(self, 'audioSegmentTimingInfo')); - - // Set up the final part of the audio pipeline - pipeline.adtsStream - .pipe(pipeline.audioSegmentStream) - .pipe(pipeline.coalesceStream); - } - - // emit pmt info - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); - - // Re-emit any data coming from the coalesce stream to the outside world - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function(id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); - // Let the consumer know we have finished flushing the entire pipeline - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - // hook up the segment streams once track metadata is delivered - this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function(timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function(val) { - var pipeline = this.transmuxPipeline_; - - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function(gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; - - // feed incoming data to the front of the parsing pipeline - this.push = function(data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - hasFlushed = false; - } - this.transmuxPipeline_.headOfPipeline.push(data); - }; - - // flush any buffered data - this.flush = function() { - hasFlushed = true; - // Start at the top of the pipeline and flush all pending work - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function() { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function() { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; - - // Caption data has to be reset when seeking outside buffered range - this.resetCaptions = function() { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; - -}; -Transmuxer.prototype = new Stream(); - -module.exports = { - Transmuxer: Transmuxer, - VideoSegmentStream: VideoSegmentStream, - AudioSegmentStream: AudioSegmentStream, - AUDIO_PROPERTIES: AUDIO_PROPERTIES, - VIDEO_PROPERTIES: VIDEO_PROPERTIES, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo -}; diff --git a/node_modules/mux.js/lib/partial/audio-segment-stream.js b/node_modules/mux.js/lib/partial/audio-segment-stream.js deleted file mode 100644 index c4c1787..0000000 --- a/node_modules/mux.js/lib/partial/audio-segment-stream.js +++ /dev/null @@ -1,154 +0,0 @@ -'use strict'; - -var Stream = require('../utils/stream.js'); -var mp4 = require('../mp4/mp4-generator.js'); -var audioFrameUtils = require('../mp4/audio-frame-utils'); -var trackInfo = require('../mp4/track-decode-info.js'); -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); - -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - */ -var AudioSegmentStream = function(track, options) { - var - adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity, - segmentStartPts = null, - segmentEndPts = null; - - options = options || {}; - - AudioSegmentStream.prototype.init.call(this); - - this.push = function(data) { - trackInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function(prop) { - track[prop] = data[prop]; - }); - } - - // buffer audio data until end() is called - adtsFrames.push(data); - }; - - this.setEarliestDts = function(earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function(timestamp) { - audioAppendStartTs = timestamp; - }; - - this.processFrames_ = function() { - var - frames, - moof, - mdat, - boxes, - timingInfo; - - // return early if no audio data has been observed - if (adtsFrames.length === 0) { - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts( - adtsFrames, track, earliestAllowedDts); - if (frames.length === 0) { - // return early if the frames are all after the earliest allowed DTS - // TODO should we clear the adtsFrames? - return; - } - - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime( - track, options.keepOriginalTimestamps); - - audioFrameUtils.prefixWithSilence( - track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); - - // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - track.samples = audioFrameUtils.generateSampleTable(frames); - - // concatenate the audio data to constuct the mdat - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - - adtsFrames = []; - - moof = mp4.moof(sequenceNumber, [track]); - - // bump the sequence number for next time - sequenceNumber++; - - track.initSegment = mp4.initSegment([track]); - - // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - - trackInfo.clearDtsInfo(track); - - if (segmentStartPts === null) { - segmentEndPts = segmentStartPts = frames[0].pts; - } - - segmentEndPts += frames.length * (ONE_SECOND_IN_TS * 1024 / track.samplerate); - - timingInfo = { start: segmentStartPts }; - - this.trigger('timingInfo', timingInfo); - this.trigger('data', {track: track, boxes: boxes}); - }; - - this.flush = function() { - this.processFrames_(); - // trigger final timing info - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - this.resetTiming_(); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.partialFlush = function() { - this.processFrames_(); - this.trigger('partialdone', 'AudioSegmentStream'); - }; - - this.endTimeline = function() { - this.flush(); - this.trigger('endedtimeline', 'AudioSegmentStream'); - }; - - this.resetTiming_ = function() { - trackInfo.clearDtsInfo(track); - segmentStartPts = null; - segmentEndPts = null; - }; - - this.reset = function() { - this.resetTiming_(); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -AudioSegmentStream.prototype = new Stream(); - -module.exports = AudioSegmentStream; diff --git a/node_modules/mux.js/lib/partial/index.js b/node_modules/mux.js/lib/partial/index.js deleted file mode 100644 index bfc3438..0000000 --- a/node_modules/mux.js/lib/partial/index.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - Transmuxer: require('./transmuxer') -}; diff --git a/node_modules/mux.js/lib/partial/transmuxer.js b/node_modules/mux.js/lib/partial/transmuxer.js deleted file mode 100644 index feb6671..0000000 --- a/node_modules/mux.js/lib/partial/transmuxer.js +++ /dev/null @@ -1,378 +0,0 @@ -var Stream = require('../utils/stream.js'); -var m2ts = require('../m2ts/m2ts.js'); -var codecs = require('../codecs/index.js'); -var AudioSegmentStream = require('./audio-segment-stream.js'); -var VideoSegmentStream = require('./video-segment-stream.js'); -var trackInfo = require('../mp4/track-decode-info.js'); -var isLikelyAacData = require('../aac/utils').isLikelyAacData; -var AdtsStream = require('../codecs/adts'); -var AacStream = require('../aac/index'); -var clock = require('../utils/clock'); - -var createPipeline = function(object) { - object.prototype = new Stream(); - object.prototype.init.call(object); - - return object; -}; - -var tsPipeline = function(options) { - var - pipeline = { - type: 'ts', - tracks: { - audio: null, - video: null - }, - packet: new m2ts.TransportPacketStream(), - parse: new m2ts.TransportParseStream(), - elementary: new m2ts.ElementaryStream(), - timestampRollover: new m2ts.TimestampRolloverStream(), - adts: new codecs.Adts(), - h264: new codecs.h264.H264Stream(), - captionStream: new m2ts.CaptionStream(options), - metadataStream: new m2ts.MetadataStream() - }; - - pipeline.headOfPipeline = pipeline.packet; - - // Transport Stream - pipeline.packet - .pipe(pipeline.parse) - .pipe(pipeline.elementary) - .pipe(pipeline.timestampRollover); - - // H264 - pipeline.timestampRollover - .pipe(pipeline.h264); - - // Hook up CEA-608/708 caption stream - pipeline.h264 - .pipe(pipeline.captionStream); - - pipeline.timestampRollover - .pipe(pipeline.metadataStream); - - // ADTS - pipeline.timestampRollover - .pipe(pipeline.adts); - - pipeline.elementary.on('data', function(data) { - if (data.type !== 'metadata') { - return; - } - - for (var i = 0; i < data.tracks.length; i++) { - if (!pipeline.tracks[data.tracks[i].type]) { - pipeline.tracks[data.tracks[i].type] = data.tracks[i]; - pipeline.tracks[data.tracks[i].type].timelineStartInfo.baseMediaDecodeTime = options.baseMediaDecodeTime; - } - } - - if (pipeline.tracks.video && !pipeline.videoSegmentStream) { - pipeline.videoSegmentStream = new VideoSegmentStream(pipeline.tracks.video, options); - - pipeline.videoSegmentStream.on('timelineStartInfo', function(timelineStartInfo) { - if (pipeline.tracks.audio && !options.keepOriginalTimestamps) { - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - options.baseMediaDecodeTime); - } - }); - - pipeline.videoSegmentStream.on('timingInfo', - pipeline.trigger.bind(pipeline, 'videoTimingInfo')); - - pipeline.videoSegmentStream.on('data', function(data) { - pipeline.trigger('data', { - type: 'video', - data: data - }); - }); - - pipeline.videoSegmentStream.on('done', - pipeline.trigger.bind(pipeline, 'done')); - pipeline.videoSegmentStream.on('partialdone', - pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.videoSegmentStream.on('endedtimeline', - pipeline.trigger.bind(pipeline, 'endedtimeline')); - - pipeline.h264 - .pipe(pipeline.videoSegmentStream); - } - - if (pipeline.tracks.audio && !pipeline.audioSegmentStream) { - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - - pipeline.audioSegmentStream.on('data', function(data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - - pipeline.audioSegmentStream.on('done', - pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('partialdone', - pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('endedtimeline', - pipeline.trigger.bind(pipeline, 'endedtimeline')); - - pipeline.audioSegmentStream.on('timingInfo', - pipeline.trigger.bind(pipeline, 'audioTimingInfo')); - - pipeline.adts - .pipe(pipeline.audioSegmentStream); - } - - // emit pmt info - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); - - pipeline.captionStream.on('data', function(caption) { - var timelineStartPts; - - if (pipeline.tracks.video) { - timelineStartPts = pipeline.tracks.video.timelineStartInfo.pts || 0; - } else { - // This will only happen if we encounter caption packets before - // video data in a segment. This is an unusual/unlikely scenario, - // so we assume the timeline starts at zero for now. - timelineStartPts = 0; - } - - // Translate caption PTS times into second offsets into the - // video timeline for the segment - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, options.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, options.keepOriginalTimestamps); - - pipeline.trigger('caption', caption); - }); - - pipeline = createPipeline(pipeline); - - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - - return pipeline; -}; - -var aacPipeline = function(options) { - var - pipeline = { - type: 'aac', - tracks: { - audio: null - }, - metadataStream: new m2ts.MetadataStream(), - aacStream: new AacStream(), - audioRollover: new m2ts.TimestampRolloverStream('audio'), - timedMetadataRollover: new m2ts.TimestampRolloverStream('timed-metadata'), - adtsStream: new AdtsStream(true) - }; - - // set up the parsing pipeline - pipeline.headOfPipeline = pipeline.aacStream; - - pipeline.aacStream - .pipe(pipeline.audioRollover) - .pipe(pipeline.adtsStream); - pipeline.aacStream - .pipe(pipeline.timedMetadataRollover) - .pipe(pipeline.metadataStream); - - pipeline.metadataStream.on('timestamp', function(frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - - pipeline.aacStream.on('data', function(data) { - if ((data.type !== 'timed-metadata' && data.type !== 'audio') || pipeline.audioSegmentStream) { - return; - } - - pipeline.tracks.audio = pipeline.tracks.audio || { - timelineStartInfo: { - baseMediaDecodeTime: options.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; - - // hook up the audio segment stream to the first track with aac data - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - - pipeline.audioSegmentStream.on('data', function(data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - - pipeline.audioSegmentStream.on('partialdone', - pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('endedtimeline', - pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', - pipeline.trigger.bind(pipeline, 'audioTimingInfo')); - - // Set up the final part of the audio pipeline - pipeline.adtsStream - .pipe(pipeline.audioSegmentStream); - - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); - - // set the pipeline up as a stream before binding to get access to the trigger function - pipeline = createPipeline(pipeline); - - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - - return pipeline; -}; - -var setupPipelineListeners = function(pipeline, transmuxer) { - pipeline.on('data', transmuxer.trigger.bind(transmuxer, 'data')); - pipeline.on('done', transmuxer.trigger.bind(transmuxer, 'done')); - pipeline.on('partialdone', transmuxer.trigger.bind(transmuxer, 'partialdone')); - pipeline.on('endedtimeline', transmuxer.trigger.bind(transmuxer, 'endedtimeline')); - pipeline.on('audioTimingInfo', transmuxer.trigger.bind(transmuxer, 'audioTimingInfo')); - pipeline.on('videoTimingInfo', transmuxer.trigger.bind(transmuxer, 'videoTimingInfo')); - pipeline.on('trackinfo', transmuxer.trigger.bind(transmuxer, 'trackinfo')); - pipeline.on('id3Frame', function(event) { - // add this to every single emitted segment even though it's only needed for the first - event.dispatchType = pipeline.metadataStream.dispatchType; - // keep original time, can be adjusted if needed at a higher level - event.cueTime = clock.videoTsToSeconds(event.pts); - - transmuxer.trigger('id3Frame', event); - }); - pipeline.on('caption', function(event) { - transmuxer.trigger('caption', event); - }); -}; - -var Transmuxer = function(options) { - var - pipeline = null, - hasFlushed = true; - - options = options || {}; - - Transmuxer.prototype.init.call(this); - options.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - - this.push = function(bytes) { - if (hasFlushed) { - var isAac = isLikelyAacData(bytes); - - if (isAac && (!pipeline || pipeline.type !== 'aac')) { - pipeline = aacPipeline(options); - setupPipelineListeners(pipeline, this); - } else if (!isAac && (!pipeline || pipeline.type !== 'ts')) { - pipeline = tsPipeline(options); - setupPipelineListeners(pipeline, this); - } - hasFlushed = false; - } - - pipeline.headOfPipeline.push(bytes); - }; - - this.flush = function() { - if (!pipeline) { - return; - } - - hasFlushed = true; - pipeline.headOfPipeline.flush(); - }; - - this.partialFlush = function() { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.partialFlush(); - }; - - this.endTimeline = function() { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.endTimeline(); - }; - - this.reset = function() { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.reset(); - }; - - this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) { - if (!options.keepOriginalTimestamps) { - options.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (!pipeline) { - return; - } - - if (pipeline.tracks.audio) { - pipeline.tracks.audio.timelineStartInfo.dts = undefined; - pipeline.tracks.audio.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.audio); - if (pipeline.audioRollover) { - pipeline.audioRollover.discontinuity(); - } - } - if (pipeline.tracks.video) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - pipeline.tracks.video.timelineStartInfo.dts = undefined; - pipeline.tracks.video.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.video); - // pipeline.captionStream.reset(); - } - - if (pipeline.timestampRollover) { - pipeline.timestampRollover.discontinuity(); - - } - }; - - this.setRemux = function(val) { - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - - this.setAudioAppendStart = function(audioAppendStart) { - if (!pipeline || !pipeline.tracks.audio || !pipeline.audioSegmentStream) { - return; - } - - pipeline.audioSegmentStream.setAudioAppendStart(audioAppendStart); - }; - - // TODO GOP alignment support - // Support may be a bit trickier than with full segment appends, as GOPs may be split - // and processed in a more granular fashion - this.alignGopsWith = function(gopsToAlignWith) { - return; - }; -}; - -Transmuxer.prototype = new Stream(); - -module.exports = Transmuxer; diff --git a/node_modules/mux.js/lib/partial/video-segment-stream.js b/node_modules/mux.js/lib/partial/video-segment-stream.js deleted file mode 100644 index 53241c4..0000000 --- a/node_modules/mux.js/lib/partial/video-segment-stream.js +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var mp4 = require('../mp4/mp4-generator.js'); -var trackInfo = require('../mp4/track-decode-info.js'); -var frameUtils = require('../mp4/frame-utils'); -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); - -var VideoSegmentStream = function(track, options) { - var - sequenceNumber = 0, - nalUnits = [], - frameCache = [], - // gopsToAlignWith = [], - config, - pps, - segmentStartPts = null, - segmentEndPts = null, - gops, - ensureNextFrameIsKeyFrame = true; - - options = options || {}; - - VideoSegmentStream.prototype.init.call(this); - - this.push = function(nalUnit) { - trackInfo.collectDtsInfo(track, nalUnit); - if (typeof track.timelineStartInfo.dts === 'undefined') { - track.timelineStartInfo.dts = nalUnit.dts; - } - - // record the track config - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - - VIDEO_PROPERTIES.forEach(function(prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && - !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } - - // buffer video until flush() is called - nalUnits.push(nalUnit); - }; - - this.processNals_ = function(cacheLastFrame) { - var i; - - nalUnits = frameCache.concat(nalUnits); - - // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - nalUnits.shift(); - } - - // Return early if no video data has been observed - if (nalUnits.length === 0) { - return; - } - - var frames = frameUtils.groupNalsIntoFrames(nalUnits); - - if (!frames.length) { - return; - } - - // note that the frame cache may also protect us from cases where we haven't - // pushed data for the entire first or last frame yet - frameCache = frames[frames.length - 1]; - - if (cacheLastFrame) { - frames.pop(); - frames.duration -= frameCache.duration; - frames.nalCount -= frameCache.length; - frames.byteLength -= frameCache.byteLength; - } - - if (!frames.length) { - nalUnits = []; - return; - } - - this.trigger('timelineStartInfo', track.timelineStartInfo); - - if (ensureNextFrameIsKeyFrame) { - gops = frameUtils.groupFramesIntoGops(frames); - - if (!gops[0][0].keyFrame) { - gops = frameUtils.extendFirstKeyFrame(gops); - - if (!gops[0][0].keyFrame) { - // we haven't yet gotten a key frame, so reset nal units to wait for more nal - // units - nalUnits = ([].concat.apply([], frames)).concat(frameCache); - frameCache = []; - return; - } - - frames = [].concat.apply([], gops); - frames.duration = gops.duration; - } - ensureNextFrameIsKeyFrame = false; - } - - if (segmentStartPts === null) { - segmentStartPts = frames[0].pts; - segmentEndPts = segmentStartPts; - } - - segmentEndPts += frames.duration; - - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - - for (i = 0; i < frames.length; i++) { - var frame = frames[i]; - - track.samples = frameUtils.generateSampleTableForFrame(frame); - - var mdat = mp4.mdat(frameUtils.concatenateNalDataForFrame(frame)); - - trackInfo.clearDtsInfo(track); - trackInfo.collectDtsInfo(track, frame); - - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime( - track, options.keepOriginalTimestamps); - - var moof = mp4.moof(sequenceNumber, [track]); - - sequenceNumber++; - - track.initSegment = mp4.initSegment([track]); - - var boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - - this.trigger('data', { - track: track, - boxes: boxes, - sequence: sequenceNumber, - videoFrameDts: frame.dts, - videoFramePts: frame.pts - }); - } - - nalUnits = []; - }; - - this.resetTimingAndConfig_ = function() { - config = undefined; - pps = undefined; - segmentStartPts = null; - segmentEndPts = null; - }; - - this.partialFlush = function() { - this.processNals_(true); - this.trigger('partialdone', 'VideoSegmentStream'); - }; - - this.flush = function() { - this.processNals_(false); - // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - this.resetTimingAndConfig_(); - this.trigger('done', 'VideoSegmentStream'); - }; - - this.endTimeline = function() { - this.flush(); - this.trigger('endedtimeline', 'VideoSegmentStream'); - }; - - this.reset = function() { - this.resetTimingAndConfig_(); - frameCache = []; - nalUnits = []; - ensureNextFrameIsKeyFrame = true; - this.trigger('reset'); - }; -}; - -VideoSegmentStream.prototype = new Stream(); - -module.exports = VideoSegmentStream; diff --git a/node_modules/mux.js/lib/tools/caption-packet-parser.js b/node_modules/mux.js/lib/tools/caption-packet-parser.js deleted file mode 100644 index b188c47..0000000 --- a/node_modules/mux.js/lib/tools/caption-packet-parser.js +++ /dev/null @@ -1,196 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - -'use strict'; - -// Supplemental enhancement information (SEI) NAL units have a -// payload type field to indicate how they are to be -// interpreted. CEAS-708 caption content is always transmitted with -// payload type 0x04. -var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - -/** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ -var parseSei = function(bytes) { - var - i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; - - // go through the sei_rbsp parsing each each individual sei_message - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } - - // Parse payload type - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - payloadType += bytes[i++]; - - // Parse payload size - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - payloadSize += bytes[i++]; - - // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode( - bytes[i + 3], - bytes[i + 4], - bytes[i + 5], - bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } - - // skip the payload and parse the next message - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; -}; - -// see ANSI/SCTE 128-1 (2013), section 8.1 -var parseUserData = function(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } - - // itu_t_t35_provider_code should be 49 (ATSC) for captions - if (((sei.payload[1] << 8) | sei.payload[2]) !== 49) { - return null; - } - - // the user_identifier should be "GA94" to indicate ATSC1 data - if (String.fromCharCode(sei.payload[3], - sei.payload[4], - sei.payload[5], - sei.payload[6]) !== 'GA94') { - return null; - } - - // finally, user_data_type_code should be 0x03 for caption data - if (sei.payload[7] !== 0x03) { - return null; - } - - // return the user_data_type_structure and strip the trailing - // marker bits - return sei.payload.subarray(8, sei.payload.length - 1); -}; - -// see CEA-708-D, section 4.4 -var parseCaptionPackets = function(pts, userData) { - var results = [], i, count, offset, data; - - // if this is just filler, return immediately - if (!(userData[0] & 0x40)) { - return results; - } - - // parse out the cc_data_1 and cc_data_2 fields - count = userData[0] & 0x1f; - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; - - // capture cc data when cc_valid is 1 - if (userData[offset + 2] & 0x04) { - data.ccData = (userData[offset + 3] << 8) | userData[offset + 4]; - results.push(data); - } - } - return results; -}; - -var discardEmulationPreventionBytes = function(data) { - var - length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, newData; - - // Find all `Emulation Prevention Bytes` - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } - - // If no Emulation Prevention Bytes were found just return the original - // array - if (emulationPreventionBytesPositions.length === 0) { - return data; - } - - // Create a new array to hold the NAL unit data - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; - // Remove this position index - emulationPreventionBytesPositions.shift(); - } - newData[i] = data[sourceIndex]; - } - - return newData; -}; - -// exports -module.exports = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 -}; diff --git a/node_modules/mux.js/lib/tools/flv-inspector.js b/node_modules/mux.js/lib/tools/flv-inspector.js deleted file mode 100644 index 97b8e42..0000000 --- a/node_modules/mux.js/lib/tools/flv-inspector.js +++ /dev/null @@ -1,172 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var - tagTypes = { - 0x08: 'audio', - 0x09: 'video', - 0x12: 'metadata' - }, - hex = function(val) { - return '0x' + ('00' + val.toString(16)).slice(-2).toUpperCase(); - }, - hexStringList = function(data) { - var arr = [], i; - - while (data.byteLength > 0) { - i = 0; - arr.push(hex(data[i++])); - data = data.subarray(i); - } - return arr.join(' '); - }, - parseAVCTag = function(tag, obj) { - var - avcPacketTypes = [ - 'AVC Sequence Header', - 'AVC NALU', - 'AVC End-of-Sequence' - ], - compositionTime = (tag[1] & parseInt('01111111', 2) << 16) | (tag[2] << 8) | tag[3]; - - obj = obj || {}; - - obj.avcPacketType = avcPacketTypes[tag[0]]; - obj.CompositionTime = (tag[1] & parseInt('10000000', 2)) ? -compositionTime : compositionTime; - - if (tag[0] === 1) { - obj.nalUnitTypeRaw = hexStringList(tag.subarray(4, 100)); - } else { - obj.data = hexStringList(tag.subarray(4)); - } - - return obj; - }, - parseVideoTag = function(tag, obj) { - var - frameTypes = [ - 'Unknown', - 'Keyframe (for AVC, a seekable frame)', - 'Inter frame (for AVC, a nonseekable frame)', - 'Disposable inter frame (H.263 only)', - 'Generated keyframe (reserved for server use only)', - 'Video info/command frame' - ], - codecID = tag[0] & parseInt('00001111', 2); - - obj = obj || {}; - - obj.frameType = frameTypes[(tag[0] & parseInt('11110000', 2)) >>> 4]; - obj.codecID = codecID; - - if (codecID === 7) { - return parseAVCTag(tag.subarray(1), obj); - } - return obj; - }, - parseAACTag = function(tag, obj) { - var packetTypes = [ - 'AAC Sequence Header', - 'AAC Raw' - ]; - - obj = obj || {}; - - obj.aacPacketType = packetTypes[tag[0]]; - obj.data = hexStringList(tag.subarray(1)); - - return obj; - }, - parseAudioTag = function(tag, obj) { - var - formatTable = [ - 'Linear PCM, platform endian', - 'ADPCM', - 'MP3', - 'Linear PCM, little endian', - 'Nellymoser 16-kHz mono', - 'Nellymoser 8-kHz mono', - 'Nellymoser', - 'G.711 A-law logarithmic PCM', - 'G.711 mu-law logarithmic PCM', - 'reserved', - 'AAC', - 'Speex', - 'MP3 8-Khz', - 'Device-specific sound' - ], - samplingRateTable = [ - '5.5-kHz', - '11-kHz', - '22-kHz', - '44-kHz' - ], - soundFormat = (tag[0] & parseInt('11110000', 2)) >>> 4; - - obj = obj || {}; - - obj.soundFormat = formatTable[soundFormat]; - obj.soundRate = samplingRateTable[(tag[0] & parseInt('00001100', 2)) >>> 2]; - obj.soundSize = ((tag[0] & parseInt('00000010', 2)) >>> 1) ? '16-bit' : '8-bit'; - obj.soundType = (tag[0] & parseInt('00000001', 2)) ? 'Stereo' : 'Mono'; - - if (soundFormat === 10) { - return parseAACTag(tag.subarray(1), obj); - } - return obj; - }, - parseGenericTag = function(tag) { - return { - tagType: tagTypes[tag[0]], - dataSize: (tag[1] << 16) | (tag[2] << 8) | tag[3], - timestamp: (tag[7] << 24) | (tag[4] << 16) | (tag[5] << 8) | tag[6], - streamID: (tag[8] << 16) | (tag[9] << 8) | tag[10] - }; - }, - inspectFlvTag = function(tag) { - var header = parseGenericTag(tag); - switch (tag[0]) { - case 0x08: - parseAudioTag(tag.subarray(11), header); - break; - case 0x09: - parseVideoTag(tag.subarray(11), header); - break; - case 0x12: - } - return header; - }, - inspectFlv = function(bytes) { - var i = 9, // header - dataSize, - parsedResults = [], - tag; - - // traverse the tags - i += 4; // skip previous tag size - while (i < bytes.byteLength) { - dataSize = bytes[i + 1] << 16; - dataSize |= bytes[i + 2] << 8; - dataSize |= bytes[i + 3]; - dataSize += 11; - - tag = bytes.subarray(i, i + dataSize); - parsedResults.push(inspectFlvTag(tag)); - i += dataSize + 4; - } - return parsedResults; - }, - textifyFlv = function(flvTagArray) { - return JSON.stringify(flvTagArray, null, 2); - }; - -module.exports = { - inspectTag: inspectFlvTag, - inspect: inspectFlv, - textify: textifyFlv -}; diff --git a/node_modules/mux.js/lib/tools/mp4-inspector.js b/node_modules/mux.js/lib/tools/mp4-inspector.js deleted file mode 100644 index fa416a2..0000000 --- a/node_modules/mux.js/lib/tools/mp4-inspector.js +++ /dev/null @@ -1,754 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse the internal MP4 structure into an equivalent javascript - * object. - */ -'use strict'; - -var MAX_UINT32 = Math.pow(2, 32); - -var - inspectMp4, - textifyMp4, - parseMp4Date = function(seconds) { - return new Date(seconds * 1000 - 2082844800000); - }, - parseType = require('../mp4/parse-type'), - findBox = require('../mp4/find-box'), - nalParse = function(avcStream) { - var - avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - i, - length; - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; - - // bail if this doesn't appear to be an H264 stream - if (length <= 0) { - result.push('MALFORMED DATA'); - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x01: - result.push('slice_layer_without_partitioning_rbsp'); - break; - case 0x05: - result.push('slice_layer_without_partitioning_rbsp_idr'); - break; - case 0x06: - result.push('sei_rbsp'); - break; - case 0x07: - result.push('seq_parameter_set_rbsp'); - break; - case 0x08: - result.push('pic_parameter_set_rbsp'); - break; - case 0x09: - result.push('access_unit_delimiter_rbsp'); - break; - default: - result.push('UNKNOWN NAL - ' + avcStream[i] & 0x1F); - break; - } - } - return result; - }, - - // registry of handlers for individual mp4 box types - parse = { - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - avc1: function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - dataReferenceIndex: view.getUint16(6), - width: view.getUint16(24), - height: view.getUint16(26), - horizresolution: view.getUint16(28) + (view.getUint16(30) / 16), - vertresolution: view.getUint16(32) + (view.getUint16(34) / 16), - frameCount: view.getUint16(40), - depth: view.getUint16(74), - config: inspectMp4(data.subarray(78, data.byteLength)) - }; - }, - avcC: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - configurationVersion: data[0], - avcProfileIndication: data[1], - profileCompatibility: data[2], - avcLevelIndication: data[3], - lengthSizeMinusOne: data[4] & 0x03, - sps: [], - pps: [] - }, - numOfSequenceParameterSets = data[5] & 0x1f, - numOfPictureParameterSets, - nalSize, - offset, - i; - - // iterate past any SPSs - offset = 6; - for (i = 0; i < numOfSequenceParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.sps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } - // iterate past any PPSs - numOfPictureParameterSets = data[offset]; - offset++; - for (i = 0; i < numOfPictureParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.pps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } - return result; - }, - btrt: function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - bufferSizeDB: view.getUint32(0), - maxBitrate: view.getUint32(4), - avgBitrate: view.getUint32(8) - }; - }, - edts: function edts(data) { - return { - boxes: inspectMp4(data) - }; - }, - elst: function elst(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - edits: [] - }, - entryCount = view.getUint32(4), - i; - for (i = 8; entryCount; entryCount--) { - if (result.version === 0) { - result.edits.push({ - segmentDuration: view.getUint32(i), - mediaTime: view.getInt32(i + 4), - mediaRate: view.getUint16(i + 8) + view.getUint16(i + 10) / (256 * 256) - }); - i += 12; - } else { - result.edits.push({ - segmentDuration: (view.getUint32(i) * MAX_UINT32) + view.getUint32(i + 4), - mediaTime: (view.getUint32(i + 8) * MAX_UINT32) + view.getUint32(i + 12), - mediaRate: view.getUint16(i + 16) + view.getUint16(i + 18) / (256 * 256) - }); - i += 20; - } - } - return result; - }, - esds: function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - esId: (data[6] << 8) | data[7], - streamPriority: data[8] & 0x1f, - decoderConfig: { - objectProfileIndication: data[11], - streamType: (data[12] >>> 2) & 0x3f, - bufferSize: (data[13] << 16) | (data[14] << 8) | data[15], - maxBitrate: (data[16] << 24) | - (data[17] << 16) | - (data[18] << 8) | - data[19], - avgBitrate: (data[20] << 24) | - (data[21] << 16) | - (data[22] << 8) | - data[23], - decoderConfigDescriptor: { - tag: data[24], - length: data[25], - audioObjectType: (data[26] >>> 3) & 0x1f, - samplingFrequencyIndex: ((data[26] & 0x07) << 1) | - ((data[27] >>> 7) & 0x01), - channelConfiguration: (data[27] >>> 3) & 0x0f - } - } - }; - }, - ftyp: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - majorBrand: parseType(data.subarray(0, 4)), - minorVersion: view.getUint32(4), - compatibleBrands: [] - }, - i = 8; - while (i < data.byteLength) { - result.compatibleBrands.push(parseType(data.subarray(i, i + 4))); - i += 4; - } - return result; - }, - dinf: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - dref: function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - dataReferences: inspectMp4(data.subarray(8)) - }; - }, - hdlr: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - handlerType: parseType(data.subarray(8, 12)), - name: '' - }, - i = 8; - - // parse out the name field - for (i = 24; i < data.byteLength; i++) { - if (data[i] === 0x00) { - // the name field is null-terminated - i++; - break; - } - result.name += String.fromCharCode(data[i]); - } - // decode UTF-8 to javascript's internal representation - // see http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html - result.name = decodeURIComponent(escape(result.name)); - - return result; - }, - mdat: function(data) { - return { - byteLength: data.byteLength, - nals: nalParse(data) - }; - }, - mdhd: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - language, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - language: '' - }; - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - i += 4; - // language is stored as an ISO-639-2/T code in an array of three 5-bit fields - // each field is the packed difference between its ASCII value and 0x60 - language = view.getUint16(i); - result.language += String.fromCharCode((language >> 10) + 0x60); - result.language += String.fromCharCode(((language & 0x03e0) >> 5) + 0x60); - result.language += String.fromCharCode((language & 0x1f) + 0x60); - - return result; - }, - mdia: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - mfhd: function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sequenceNumber: (data[4] << 24) | - (data[5] << 16) | - (data[6] << 8) | - (data[7]) - }; - }, - minf: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - mp4a: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - // 6 bytes reserved - dataReferenceIndex: view.getUint16(6), - // 4 + 4 bytes reserved - channelcount: view.getUint16(16), - samplesize: view.getUint16(18), - // 2 bytes pre_defined - // 2 bytes reserved - samplerate: view.getUint16(24) + (view.getUint16(26) / 65536) - }; - - // if there are more bytes to process, assume this is an ISO/IEC - // 14496-14 MP4AudioSampleEntry and parse the ESDBox - if (data.byteLength > 28) { - result.streamDescriptor = inspectMp4(data.subarray(28))[0]; - } - return result; - }, - moof: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - moov: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvex: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvhd: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - i += 4; - - // convert fixed-point, base 16 back to a number - result.rate = view.getUint16(i) + (view.getUint16(i + 2) / 16); - i += 4; - result.volume = view.getUint8(i) + (view.getUint8(i + 1) / 8); - i += 2; - i += 2; - i += 2 * 4; - result.matrix = new Uint32Array(data.subarray(i, i + (9 * 4))); - i += 9 * 4; - i += 6 * 4; - result.nextTrackId = view.getUint32(i); - return result; - }, - pdin: function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - rate: view.getUint32(4), - initialDelay: view.getUint32(8) - }; - }, - sdtp: function(data) { - var - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, i; - - for (i = 4; i < data.byteLength; i++) { - result.samples.push({ - dependsOn: (data[i] & 0x30) >> 4, - isDependedOn: (data[i] & 0x0c) >> 2, - hasRedundancy: data[i] & 0x03 - }); - } - return result; - }, - sidx: require('./parse-sidx.js'), - smhd: function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - balance: data[4] + (data[5] / 256) - }; - }, - stbl: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - ctts: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - compositionOffsets: [] - }, - entryCount = view.getUint32(4), - i; - for (i = 8; entryCount; i += 8, entryCount--) { - result.compositionOffsets.push({ - sampleCount: view.getUint32(i), - sampleOffset: view[(result.version === 0 ? 'getUint32' :'getInt32')](i + 4) - }); - } - return result; - }, - stss: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - syncSamples: [] - }, - entryCount = view.getUint32(4), - i; - for (i = 8; entryCount; i += 4, entryCount--) { - result.syncSamples.push(view.getUint32(i)); - } - return result; - }, - stco: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - chunkOffsets: [] - }, - entryCount = view.getUint32(4), - i; - for (i = 8; entryCount; i += 4, entryCount--) { - result.chunkOffsets.push(view.getUint32(i)); - } - return result; - }, - stsc: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - entryCount = view.getUint32(4), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleToChunks: [] - }, - i; - for (i = 8; entryCount; i += 12, entryCount--) { - result.sampleToChunks.push({ - firstChunk: view.getUint32(i), - samplesPerChunk: view.getUint32(i + 4), - sampleDescriptionIndex: view.getUint32(i + 8) - }); - } - return result; - }, - stsd: function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleDescriptions: inspectMp4(data.subarray(8)) - }; - }, - stsz: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleSize: view.getUint32(4), - entries: [] - }, - i; - for (i = 12; i < data.byteLength; i += 4) { - result.entries.push(view.getUint32(i)); - } - return result; - }, - stts: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - timeToSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.timeToSamples.push({ - sampleCount: view.getUint32(i), - sampleDelta: view.getUint32(i + 4) - }); - } - return result; - }, - styp: function(data) { - return parse.ftyp(data); - }, - tfdt: require('./parse-tfdt.js'), - tfhd: require('./parse-tfhd.js'), - tkhd: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 4; - result.duration = view.getUint32(i); - } - i += 4; - i += 2 * 4; - result.layer = view.getUint16(i); - i += 2; - result.alternateGroup = view.getUint16(i); - i += 2; - // convert fixed-point, base 16 back to a number - result.volume = view.getUint8(i) + (view.getUint8(i + 1) / 8); - i += 2; - i += 2; - result.matrix = new Uint32Array(data.subarray(i, i + (9 * 4))); - i += 9 * 4; - result.width = view.getUint16(i) + (view.getUint16(i + 2) / 65536); - i += 4; - result.height = view.getUint16(i) + (view.getUint16(i + 2) / 65536); - return result; - }, - traf: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - trak: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - trex: function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4), - defaultSampleDescriptionIndex: view.getUint32(8), - defaultSampleDuration: view.getUint32(12), - defaultSampleSize: view.getUint32(16), - sampleDependsOn: data[20] & 0x03, - sampleIsDependedOn: (data[21] & 0xc0) >> 6, - sampleHasRedundancy: (data[21] & 0x30) >> 4, - samplePaddingValue: (data[21] & 0x0e) >> 1, - sampleIsDifferenceSample: !!(data[21] & 0x01), - sampleDegradationPriority: view.getUint16(22) - }; - }, - trun: require('./parse-trun.js'), - 'url ': function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - }, - vmhd: function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - graphicsmode: view.getUint16(4), - opcolor: new Uint16Array([view.getUint16(6), - view.getUint16(8), - view.getUint16(10)]) - }; - } - }; - - -/** - * Return a javascript array of box objects parsed from an ISO base - * media file. - * @param data {Uint8Array} the binary data of the media to be inspected - * @return {array} a javascript array of potentially nested box objects - */ -inspectMp4 = function(data) { - var - i = 0, - result = [], - view, - size, - type, - end, - box; - - // Convert data from Uint8Array to ArrayBuffer, to follow Dataview API - var ab = new ArrayBuffer(data.length); - var v = new Uint8Array(ab); - for (var z = 0; z < data.length; ++z) { - v[z] = data[z]; - } - view = new DataView(ab); - - while (i < data.byteLength) { - // parse box data - size = view.getUint32(i); - type = parseType(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - // parse type-specific data - box = (parse[type] || function(data) { - return { - data: data - }; - })(data.subarray(i + 8, end)); - box.size = size; - box.type = type; - - // store this box and move to the next - result.push(box); - i = end; - } - return result; -}; - -/** - * Returns a textual representation of the javascript represtentation - * of an MP4 file. You can use it as an alternative to - * JSON.stringify() to compare inspected MP4s. - * @param inspectedMp4 {array} the parsed array of boxes in an MP4 - * file - * @param depth {number} (optional) the number of ancestor boxes of - * the elements of inspectedMp4. Assumed to be zero if unspecified. - * @return {string} a text representation of the parsed MP4 - */ -textifyMp4 = function(inspectedMp4, depth) { - var indent; - depth = depth || 0; - indent = new Array(depth * 2 + 1).join(' '); - - // iterate over all the boxes - return inspectedMp4.map(function(box, index) { - - // list the box type first at the current indentation level - return indent + box.type + '\n' + - - // the type is already included and handle child boxes separately - Object.keys(box).filter(function(key) { - return key !== 'type' && key !== 'boxes'; - - // output all the box properties - }).map(function(key) { - var prefix = indent + ' ' + key + ': ', - value = box[key]; - - // print out raw bytes as hexademical - if (value instanceof Uint8Array || value instanceof Uint32Array) { - var bytes = Array.prototype.slice.call(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)) - .map(function(byte) { - return ' ' + ('00' + byte.toString(16)).slice(-2); - }).join('').match(/.{1,24}/g); - if (!bytes) { - return prefix + '<>'; - } - if (bytes.length === 1) { - return prefix + '<' + bytes.join('').slice(1) + '>'; - } - return prefix + '<\n' + bytes.map(function(line) { - return indent + ' ' + line; - }).join('\n') + '\n' + indent + ' >'; - } - - // stringify generic objects - return prefix + - JSON.stringify(value, null, 2) - .split('\n').map(function(line, index) { - if (index === 0) { - return line; - } - return indent + ' ' + line; - }).join('\n'); - }).join('\n') + - - // recursively textify the child boxes - (box.boxes ? '\n' + textifyMp4(box.boxes, depth + 1) : ''); - }).join('\n'); -}; - -module.exports = { - inspect: inspectMp4, - textify: textifyMp4, - parseType: parseType, - findBox: findBox, - parseTraf: parse.traf, - parseTfdt: parse.tfdt, - parseHdlr: parse.hdlr, - parseTfhd: parse.tfhd, - parseTrun: parse.trun, - parseSidx: parse.sidx -}; diff --git a/node_modules/mux.js/lib/tools/parse-sample-flags.js b/node_modules/mux.js/lib/tools/parse-sample-flags.js deleted file mode 100644 index 6899dde..0000000 --- a/node_modules/mux.js/lib/tools/parse-sample-flags.js +++ /dev/null @@ -1,13 +0,0 @@ -var parseSampleFlags = function(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: (flags[2] << 8) | flags[3] - }; -}; - -module.exports = parseSampleFlags; diff --git a/node_modules/mux.js/lib/tools/parse-sidx.js b/node_modules/mux.js/lib/tools/parse-sidx.js deleted file mode 100644 index aa001a9..0000000 --- a/node_modules/mux.js/lib/tools/parse-sidx.js +++ /dev/null @@ -1,46 +0,0 @@ -var MAX_UINT32 = Math.pow(2, 32); - -var parseSidx = function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - references: [], - referenceId: view.getUint32(4), - timescale: view.getUint32(8) - }, - i = 12; - - if (result.version === 0) { - result.earliestPresentationTime = view.getUint32(i); - result.firstOffset = view.getUint32(i + 4); - i += 8; - } else { - // read 64 bits - result.earliestPresentationTime = (view.getUint32(i) * MAX_UINT32) + view.getUint32(i + 4); - result.firstOffset = (view.getUint32(i + 8) * MAX_UINT32) + view.getUint32(i + 12); - i += 16; - } - - i += 2; // reserved - - var referenceCount = view.getUint16(i); - - i += 2; // start of references - - for (; referenceCount > 0; i += 12, referenceCount--) { - result.references.push({ - referenceType: (data[i] & 0x80) >>> 7, - referencedSize: view.getUint32(i) & 0x7FFFFFFF, - subsegmentDuration: view.getUint32(i + 4), - startsWithSap: !!(data[i + 8] & 0x80), - sapType: (data[i + 8] & 0x70) >>> 4, - sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF - }); - } - - return result; -}; - - -module.exports = parseSidx; diff --git a/node_modules/mux.js/lib/tools/parse-tfdt.js b/node_modules/mux.js/lib/tools/parse-tfdt.js deleted file mode 100644 index 5e082d6..0000000 --- a/node_modules/mux.js/lib/tools/parse-tfdt.js +++ /dev/null @@ -1,17 +0,0 @@ -var toUnsigned = require('../utils/bin').toUnsigned; - -var tfdt = function(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - baseMediaDecodeTime: toUnsigned(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) - }; - if (result.version === 1) { - result.baseMediaDecodeTime *= Math.pow(2, 32); - result.baseMediaDecodeTime += toUnsigned(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11]); - } - return result; -}; - -module.exports = tfdt; - diff --git a/node_modules/mux.js/lib/tools/parse-tfhd.js b/node_modules/mux.js/lib/tools/parse-tfhd.js deleted file mode 100644 index e9350c3..0000000 --- a/node_modules/mux.js/lib/tools/parse-tfhd.js +++ /dev/null @@ -1,49 +0,0 @@ -var tfhd = function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - - i = 8; - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - result.baseDataOffset = view.getUint32(12); - i += 4; - } - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - return result; -}; - -module.exports = tfhd; diff --git a/node_modules/mux.js/lib/tools/parse-trun.js b/node_modules/mux.js/lib/tools/parse-trun.js deleted file mode 100644 index 8baee5c..0000000 --- a/node_modules/mux.js/lib/tools/parse-trun.js +++ /dev/null @@ -1,82 +0,0 @@ -var parseSampleFlags = require('./parse-sample-flags.js'); - -var trun = function(data) { - var - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } - - // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags(data.subarray(offset, offset + 4)) - }; - offset += 4; - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - offset += 4; - } - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags(data.subarray(offset, offset + 4)); - offset += 4; - } - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - offset += 4; - } - result.samples.push(sample); - } - return result; -}; - -module.exports = trun; diff --git a/node_modules/mux.js/lib/tools/ts-inspector.js b/node_modules/mux.js/lib/tools/ts-inspector.js deleted file mode 100644 index d3b500a..0000000 --- a/node_modules/mux.js/lib/tools/ts-inspector.js +++ /dev/null @@ -1,519 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse mpeg2 transport stream packets to extract basic timing information - */ -'use strict'; - -var StreamTypes = require('../m2ts/stream-types.js'); -var handleRollover = require('../m2ts/timestamp-rollover-stream.js').handleRollover; -var probe = {}; -probe.ts = require('../m2ts/probe.js'); -probe.aac = require('../aac/utils.js'); -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var - MP2T_PACKET_LENGTH = 188, // bytes - SYNC_BYTE = 0x47; - -/** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ -var parsePsi_ = function(bytes, pmt) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - case 'pmt': - var table = probe.ts.parsePmt(packet); - - pmt.table = pmt.table || {}; - - Object.keys(table).forEach(function(key) { - pmt.table[key] = table[key]; - }); - - break; - default: - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } -}; - -/** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ -var parseAudioPes_ = function(bytes, pmt, result) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, type, pesType, pusi, parsed; - - var endLoop = false; - - // Start walking from start of segment to get first audio packet - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && - (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - break; - default: - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } - - // Start walking from end of segment to get last audio packet - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && - (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - break; - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex--; - endIndex--; - } -}; - -/** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ -var parseVideoPes_ = function(bytes, pmt, result) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, type, pesType, pusi, parsed, frame, i, pes; - - var endLoop = false; - - var currentFrame = { - data: [], - size: 0 - }; - - // Start walking from start of segment to get first video packet - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); - - // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn( - 'Failed to extract PTS/DTS from PES at first keyframe. ' + - 'This could be an unusual TS segment, or else mux.js did not ' + - 'parse your TS segment correctly. If you know your TS ' + - 'segments do contain PTS/DTS on keyframes please file a bug ' + - 'report! You can try ffprobe to double check for yourself.' - ); - } - } - currentFrame.size = 0; - } - } - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - break; - default: - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } - - // Start walking from end of segment to get last video packet - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - break; - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex--; - endIndex--; - } -}; - -/** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ -var adjustTimestamp_ = function(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - segmentInfo.audio.forEach(function(info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); - // time in seconds - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - segmentInfo.video.forEach(function(info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); - // time in seconds - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); - // time in seconds - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } -}; - -/** - * inspects the aac data stream for start and end time information - */ -var inspectAac_ = function(bytes) { - var - endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - if (frameSize > bytes.length) { - endLoop = true; - break; - } - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - byteIndex += frameSize; - break; - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - if (frameSize > bytes.length) { - endLoop = true; - break; - } - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - audioCount++; - byteIndex += frameSize; - break; - default: - byteIndex++; - break; - } - if (endLoop) { - return null; - } - } - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - - var result = { - audio: [ - { - type: 'audio', - dts: timestamp, - pts: timestamp - }, - { - type: 'audio', - dts: timestamp + (audioCount * 1024 * audioTimescale), - pts: timestamp + (audioCount * 1024 * audioTimescale) - } - ] - }; - - return result; -}; - -/** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ -var inspectTs_ = function(bytes) { - var pmt = { - pid: null, - table: null - }; - - var result = {}; - - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - if (result.video.length === 0) { - delete result.video; - } - break; - case StreamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - if (result.audio.length === 0) { - delete result.audio; - } - break; - default: - break; - } - } - } - return result; -}; - -/** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ -var inspect = function(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || (!result.audio && !result.video)) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - - return result; -}; - -module.exports = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ -}; diff --git a/node_modules/mux.js/lib/utils/bin.js b/node_modules/mux.js/lib/utils/bin.js deleted file mode 100644 index 2b878c8..0000000 --- a/node_modules/mux.js/lib/utils/bin.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var toUnsigned = function(value) { - return value >>> 0; -}; - -var toHexString = function(value) { - return ('00' + value.toString(16)).slice(-2); -}; - -module.exports = { - toUnsigned: toUnsigned, - toHexString: toHexString -}; diff --git a/node_modules/mux.js/lib/utils/clock.js b/node_modules/mux.js/lib/utils/clock.js deleted file mode 100644 index 58e35bb..0000000 --- a/node_modules/mux.js/lib/utils/clock.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var - ONE_SECOND_IN_TS = 90000, // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - -secondsToVideoTs = function(seconds) { - return seconds * ONE_SECOND_IN_TS; -}; - -secondsToAudioTs = function(seconds, sampleRate) { - return seconds * sampleRate; -}; - -videoTsToSeconds = function(timestamp) { - return timestamp / ONE_SECOND_IN_TS; -}; - -audioTsToSeconds = function(timestamp, sampleRate) { - return timestamp / sampleRate; -}; - -audioTsToVideoTs = function(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); -}; - -videoTsToAudioTs = function(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); -}; - -/** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ -metadataTsToSeconds = function(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); -}; - -module.exports = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds -}; diff --git a/node_modules/mux.js/lib/utils/exp-golomb.js b/node_modules/mux.js/lib/utils/exp-golomb.js deleted file mode 100644 index 358cba2..0000000 --- a/node_modules/mux.js/lib/utils/exp-golomb.js +++ /dev/null @@ -1,153 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var ExpGolomb; - -/** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ -ExpGolomb = function(workingData) { - var - // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - - // the current word being examined - workingWord = 0, // :uint - - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - - // ():uint - this.length = function() { - return (8 * workingBytesAvailable); - }; - - // ():uint - this.bitsAvailable = function() { - return (8 * workingBytesAvailable) + workingBitsAvailable; - }; - - // ():void - this.loadWord = function() { - var - position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, - position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); - - // track the amount of workingData that has been processed - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; - - // (count:int):void - this.skipBits = function(count) { - var skipBytes; // :int - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - - count -= (skipBytes * 8); - workingBytesAvailable -= skipBytes; - - this.loadWord(); - - workingWord <<= count; - workingBitsAvailable -= count; - } - }; - - // (size:int):uint - this.readBits = function(size) { - var - bits = Math.min(workingBitsAvailable, size), // :uint - valu = workingWord >>> (32 - bits); // :uint - // if size > 31, handle error - workingBitsAvailable -= bits; - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - return valu; - }; - - // ():uint - this.skipLeadingZeros = function() { - var leadingZeroCount; // :uint - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & (0x80000000 >>> leadingZeroCount)) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } - - // we exhausted workingWord and still have not found a 1 - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; - - // ():void - this.skipUnsignedExpGolomb = function() { - this.skipBits(1 + this.skipLeadingZeros()); - }; - - // ():void - this.skipExpGolomb = function() { - this.skipBits(1 + this.skipLeadingZeros()); - }; - - // ():uint - this.readUnsignedExpGolomb = function() { - var clz = this.skipLeadingZeros(); // :uint - return this.readBits(clz + 1) - 1; - }; - - // ():int - this.readExpGolomb = function() { - var valu = this.readUnsignedExpGolomb(); // :int - if (0x01 & valu) { - // the number is odd if the low order bit is set - return (1 + valu) >>> 1; // add 1 to make it even, and divide by 2 - } - return -1 * (valu >>> 1); // divide by two then make it negative - }; - - // Some convenience functions - // :Boolean - this.readBoolean = function() { - return this.readBits(1) === 1; - }; - - // ():int - this.readUnsignedByte = function() { - return this.readBits(8); - }; - - this.loadWord(); -}; - -module.exports = ExpGolomb; diff --git a/node_modules/mux.js/lib/utils/stream.js b/node_modules/mux.js/lib/utils/stream.js deleted file mode 100644 index f40cc83..0000000 --- a/node_modules/mux.js/lib/utils/stream.js +++ /dev/null @@ -1,141 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ -'use strict'; - -var Stream = function() { - this.init = function() { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - this.on = function(type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - this.off = function(type, listener) { - var index; - if (!listeners[type]) { - return false; - } - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - this.trigger = function(type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - if (!callbacks) { - return; - } - // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - if (arguments.length === 2) { - length = callbacks.length; - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - length = callbacks.length; - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - this.dispose = function() { - listeners = {}; - }; - }; -}; - -/** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ -Stream.prototype.pipe = function(destination) { - this.on('data', function(data) { - destination.push(data); - }); - - this.on('done', function(flushSource) { - destination.flush(flushSource); - }); - - this.on('partialdone', function(flushSource) { - destination.partialFlush(flushSource); - }); - - this.on('endedtimeline', function(flushSource) { - destination.endTimeline(flushSource); - }); - - this.on('reset', function(flushSource) { - destination.reset(flushSource); - }); - - return destination; -}; - -// Default stream functions that are expected to be overridden to perform -// actual work. These are provided by the prototype as a sort of no-op -// implementation so that we don't have to check for their existence in the -// `pipe` function above. -Stream.prototype.push = function(data) { - this.trigger('data', data); -}; - -Stream.prototype.flush = function(flushSource) { - this.trigger('done', flushSource); -}; - -Stream.prototype.partialFlush = function(flushSource) { - this.trigger('partialdone', flushSource); -}; - -Stream.prototype.endTimeline = function(flushSource) { - this.trigger('endedtimeline', flushSource); -}; - -Stream.prototype.reset = function(flushSource) { - this.trigger('reset', flushSource); -}; - -module.exports = Stream; diff --git a/node_modules/mux.js/package.json b/node_modules/mux.js/package.json deleted file mode 100644 index 9f00532..0000000 --- a/node_modules/mux.js/package.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "_from": "mux.js@5.11.1", - "_id": "mux.js@5.11.1", - "_inBundle": false, - "_integrity": "sha512-U/JKEU4GZfk2BpEQpPfmH81nF79UKK2a1QOb6PF9viPspJpexGt11YzR/nTKNWdfjWG0DGjcSU+zb2F52Z/q8w==", - "_location": "/mux.js", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "mux.js@5.11.1", - "name": "mux.js", - "escapedName": "mux.js", - "rawSpec": "5.11.1", - "saveSpec": null, - "fetchSpec": "5.11.1" - }, - "_requiredBy": [ - "/@videojs/http-streaming", - "/video.js" - ], - "_resolved": "https://registry.npmjs.org/mux.js/-/mux.js-5.11.1.tgz", - "_shasum": "531192c2c5ee5e9abb6243ba58e2c1ef916b35eb", - "_spec": "mux.js@5.11.1", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js", - "author": { - "name": "Brightcove" - }, - "bin": { - "muxjs-transmux": "bin/transmux.js" - }, - "browser": "dist/mux.js", - "browserslist": [ - "defaults", - "ie 11" - ], - "bugs": { - "url": "https://github.com/videojs/mux.js/issues" - }, - "bundleDependencies": false, - "dependencies": { - "@babel/runtime": "^7.11.2" - }, - "deprecated": false, - "description": "A collection of lightweight utilities for inspecting and manipulating video container formats.", - "devDependencies": { - "@babel/cli": "^7.11.6", - "@videojs/babel-config": "^0.2.0", - "@videojs/generator-helpers": "~2.0.1", - "@videojs/vhs-utils": "^3.0.0", - "global": "^4.4.0", - "karma": "^5.0.0", - "rollup": "^2.37.1", - "rollup-plugin-data-files": "^0.1.0", - "rollup-plugin-worker-factory": "^0.3.0", - "sinon": "^8.1.1", - "videojs-generate-karma-config": "~7.1.0", - "videojs-generate-rollup-config": "~6.2.0", - "videojs-generator-verify": "~3.0.2", - "videojs-standard": "^8.0.4" - }, - "engines": { - "node": ">=8", - "npm": ">=5" - }, - "files": [ - "bin/", - "CONTRIBUTING.md", - "cjs/", - "dist/", - "docs/", - "es/", - "lib/", - "index.html", - "scripts/", - "src/", - "test/" - ], - "generator-videojs-plugin": { - "version": "7.7.3" - }, - "homepage": "https://github.com/videojs/mux.js#readme", - "husky": { - "hooks": { - "pre-commit": ": lint-staged" - } - }, - "keywords": [ - "video", - "container", - "transmux", - "mux", - "player", - "hls", - "mp4", - "flv", - "aac", - "h264" - ], - "license": "Apache-2.0", - "lint-staged": { - "*.js": "vjsstandard --fix", - "README.md": "doctoc --notitle" - }, - "main": "./cjs/index.js", - "module": "es/index.js", - "name": "mux.js", - "repository": { - "type": "git", - "url": "git+https://github.com/videojs/mux.js.git" - }, - "scripts": { - "build": "npm-run-all -s clean -p build:*", - "build-prod": "cross-env-shell NO_TEST_BUNDLE=1 'npm run build'", - "build-test": "cross-env-shell TEST_BUNDLE_ONLY=1 'npm run build'", - "build:cjs": "babel-config-cjs -d ./cjs ./lib", - "build:es": "babel-config-es -d ./es ./lib", - "build:js": "rollup -c scripts/rollup.config.js", - "clean": "shx rm -rf ./dist ./test/dist ./cjs ./es && shx mkdir -p ./dist ./test/dist ./cjs ./es", - "docs": "npm-run-all docs:*", - "docs:toc": "doctoc --notitle README.md", - "lint": ": vjsstandard", - "netlify": "node scripts/netlify.js", - "prepublishOnly": "npm ci && npm-run-all build-prod && vjsverify --verbose", - "preversion": "npm test", - "server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch", - "start": "npm-run-all -p server watch", - "test": "npm-run-all lint build-test test:*", - "test:browser": "karma start scripts/karma.conf.js", - "test:node": "node --experimental-worker \"$(which qunit)\" test/dist/bundle.js", - "update-changelog": "conventional-changelog -p videojs -i CHANGELOG.md -s", - "version": "is-prerelease || npm run update-changelog && git add CHANGELOG.md", - "watch": "npm-run-all -p watch:*", - "watch:cjs": "npm run build:cjs -- -w", - "watch:es": "npm run build:es -- -w", - "watch:js": "npm run build:js -- -w" - }, - "version": "5.11.1", - "vjsstandard": { - "ignore": [ - "es", - "cjs", - "dist", - "docs", - "test/dist" - ] - } -} diff --git a/node_modules/mux.js/scripts/karma.conf.js b/node_modules/mux.js/scripts/karma.conf.js deleted file mode 100644 index ce98aab..0000000 --- a/node_modules/mux.js/scripts/karma.conf.js +++ /dev/null @@ -1,25 +0,0 @@ -const generate = require('videojs-generate-karma-config'); - -module.exports = function(config) { - - // see https://github.com/videojs/videojs-generate-karma-config - // for options - const options = { - coverage: false, - browsers(aboutToRun) { - return aboutToRun.filter(function(launcherName) { - return !(/^Safari/).test(launcherName); - }); - }, - browserstackLaunchers(defaults) { - delete defaults.bsSafariMojave; - delete defaults.bsSafariElCapitan; - - return defaults; - } - }; - - config = generate(config, options); - - // any other custom stuff not supported by options here! -}; diff --git a/node_modules/mux.js/scripts/netlify.js b/node_modules/mux.js/scripts/netlify.js deleted file mode 100644 index a22bbbf..0000000 --- a/node_modules/mux.js/scripts/netlify.js +++ /dev/null @@ -1,20 +0,0 @@ -const shell = require('shelljs'); - -// clone vhs -shell.exec('git clone https://github.com/videojs/http-streaming'); -shell.cd('http-streaming'); - -// install vhs and link in the local version of mux.js -shell.exec('npm ci'); -shell.exec('npm link ../'); - -// run the vhs netlify script so that we can use -// the vhs netlify page with this local mux.js -shell.exec('npm run netlify'); - -// move the vhs deploy directory to the project root -shell.cp('-R', 'deploy', '../'); - -// cleanup by removing the cloned vhs directory -shell.cd('..'); -shell.rm('-rf', 'http-streaming'); diff --git a/node_modules/mux.js/scripts/rollup.config.js b/node_modules/mux.js/scripts/rollup.config.js deleted file mode 100644 index 5653988..0000000 --- a/node_modules/mux.js/scripts/rollup.config.js +++ /dev/null @@ -1,54 +0,0 @@ -const generate = require('videojs-generate-rollup-config'); -const dataFiles = require('rollup-plugin-data-files'); -const worker = require('rollup-plugin-worker-factory'); - -// see https://github.com/videojs/videojs-generate-rollup-config -// for options - -const shared = { - primedPlugins(defaults) { - defaults = Object.assign(defaults, { - dataFiles: dataFiles({ - segments: {include: 'test/segments/**'} - }) - }); - - defaults.worker = worker({plugins: [ - defaults.resolve, - defaults.json, - defaults.commonjs, - defaults.babel - ]}); - - return defaults; - }, - plugins(defaults) { - defaults.module.splice(2, 0, 'worker'); - defaults.browser.splice(2, 0, 'worker'); - defaults.test.splice(3, 0, 'worker'); - defaults.test.splice(0, 0, 'dataFiles'); - - // istanbul is only in the list for regular builds and not watch - if (defaults.test.indexOf('istanbul') !== -1) { - defaults.test.splice(defaults.test.indexOf('istanbul'), 1); - } - - return defaults; - } -}; -const mainBuilds = generate(Object.assign({input: 'lib/index.js', distName: 'mux', exportName: 'muxjs'}, shared)).builds; -const mp4Builds = generate({input: 'lib/mp4/index.js', distName: 'mux-mp4', exportName: 'muxjs'}).builds; -const flvBuilds = generate({input: 'lib/flv/index.js', distName: 'mux-flv', exportName: 'muxjs'}).builds; - -const allBuilds = []; - -if (mainBuilds.test) { - allBuilds.push(mainBuilds.test); -} - -if (mainBuilds.browser) { - allBuilds.push(mainBuilds.browser, mp4Builds.browser, flvBuilds.browser); -} - -// export the builds to rollup -export default allBuilds; diff --git a/node_modules/mux.js/test/.eslintrc.json b/node_modules/mux.js/test/.eslintrc.json deleted file mode 100644 index 99022c7..0000000 --- a/node_modules/mux.js/test/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "env": { - "qunit": true - } -} diff --git a/node_modules/mux.js/test/aac-stream.test.js b/node_modules/mux.js/test/aac-stream.test.js deleted file mode 100644 index c238c9b..0000000 --- a/node_modules/mux.js/test/aac-stream.test.js +++ /dev/null @@ -1,289 +0,0 @@ -'use strict'; - -var - aacStream, - AacStream = require('../lib/aac'), - QUnit = require('qunit'), - utils = require('./utils'), - createId3Header, - createId3FrameHeader, - createAdtsHeader; - -createId3Header = function(tagSize) { - var header = []; - - header[0] = 'I'.charCodeAt(0); - header[1] = 'D'.charCodeAt(0); - header[2] = '3'.charCodeAt(0); - // 2 version bytes, ID3v2.4.0 (major 4, revision 0) - header[3] = 4; - header[4] = 0; - // unsynchronization, extended header, experimental indicator, footer present flags - header[5] = 0; - // "The ID3v2 tag size is the sum of the byte length of the extended - // header, the padding and the frames after unsynchronisation. If a - // footer is present this equals to ('total size' - 20) bytes, otherwise - // ('total size' - 10) bytes." - // http://id3.org/id3v2.4.0-structure - header[6] = 0; - header[7] = 0; - header[8] = 0; - header[9] = tagSize; - - return header; -}; - -createId3FrameHeader = function() { - var header = []; - - // four byte frame ID, XYZ are experimental - header[0] = 'X'.charCodeAt(0); - header[1] = 'Y'.charCodeAt(0); - header[2] = 'Z'.charCodeAt(0); - header[3] = '0'.charCodeAt(0); - // four byte sync safe integer size (excluding frame header) - header[4] = 0; - header[5] = 0; - header[6] = 0; - header[7] = 10; - // two bytes for flags - header[8] = 0; - header[9] = 0; - - return header; -}; - -createAdtsHeader = function(frameLength) { - // Header consists of 7 or 9 bytes (without or with CRC). - // see: https://wiki.multimedia.cx/index.php/ADTS - return utils.binaryStringToArrayOfBytes(''.concat( - // 12 bits for syncword (0xFFF) - '111111111111', - // 1 bit MPEG version - '0', - // 2 bit layer (always 0) - '00', - // 1 bit protection absent (1 for no CRC) - '1', - // 2 bit profile - '10', - // 4 bit sampling frequency index - '0110', - // 1 bit private bit - '0', - // 3 bit channel config - '100', - // 2 bit (ignore) - '00', - // 2 bit (copright bits) - '00', - // 13 bit frame length (includes header length) - utils.leftPad(frameLength.toString(2), 13), - // 11 bit buffer fullness - '11111111111', - // 2 bit number of AAC frames minus 1 - '00' - // 16 bit CRC (if present) - )); -}; - -QUnit.module('AAC Stream', { - beforeEach: function() { - aacStream = new AacStream(); - } -}); - -QUnit.test('parses ID3 tag', function(assert) { - var - id3Count = 0, - adtsCount = 0, - frameHeader = createId3FrameHeader(), - id3Tag = createId3Header(frameHeader.length).concat(frameHeader); - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - - aacStream.push(new Uint8Array(id3Tag)); - - assert.equal(adtsCount, 0, 'no adts frames'); - assert.equal(id3Count, 1, 'one id3 chunk'); -}); - -QUnit.test('parses two ID3 tags in sequence', function(assert) { - var - id3Count = 0, - adtsCount = 0, - frameHeader = createId3FrameHeader(), - id3Tag = createId3Header(frameHeader.length).concat(frameHeader); - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - - aacStream.push(new Uint8Array(id3Tag.concat(id3Tag))); - - assert.equal(adtsCount, 0, 'no adts frames'); - assert.equal(id3Count, 2, 'two id3 chunks'); -}); - -QUnit.test('does not parse second ID3 tag if it\'s incomplete', function(assert) { - var - id3Count = 0, - adtsCount = 0, - frameHeader = createId3FrameHeader(), - id3Tag = createId3Header(frameHeader.length).concat(frameHeader); - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - - aacStream.push(new Uint8Array(id3Tag.concat(id3Tag.slice(0, id3Tag.length - 1)))); - - assert.equal(adtsCount, 0, 'no adts frames'); - assert.equal(id3Count, 1, 'one id3 chunk'); -}); - -QUnit.test('handles misaligned adts header', function(assert) { - var - id3Count = 0, - adtsCount = 0, - // fake adts frame - adtsFrame = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - packetStream = createAdtsHeader(adtsFrame.length).concat(adtsFrame); - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - - // misalign by two bytes specific to a bug related to detecting sync bytes - // (where we were only properly checking the second byte) - aacStream.push(new Uint8Array([0x01, 0xf0].concat(packetStream))); - - assert.equal(adtsCount, 1, 'one adts frames'); - assert.equal(id3Count, 0, 'no id3 chunk'); -}); - -QUnit.test('handles incomplete adts frame after id3 frame', function(assert) { - var - id3Count = 0, - adtsCount = 0, - id3FrameHeader = createId3FrameHeader(), - id3Tag = createId3Header(id3FrameHeader.length).concat(id3FrameHeader), - // in this case: - // id3 tag = 20 bytes - // adts header = 7 bytes - // total = 27 bytes - // report the ADTS frame size as 20 bytes - adtsHeader = createAdtsHeader(20), - // no adts frame, stream was cut off - packetStream = id3Tag.concat(adtsHeader); - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - - aacStream.push(new Uint8Array(packetStream)); - - assert.equal(adtsCount, 0, 'no adts frame'); - assert.equal(id3Count, 1, 'one id3 chunk'); -}); - -QUnit.test('emits data after receiving push', function(assert) { - var - array = new Uint8Array(109), - count = 0; - - array[0] = 255; - array[1] = 241; - array[2] = 92; - array[3] = 128; - array[4] = 13; - array[5] = 191; - array[6] = 252; - array[7] = 33; - array[8] = 32; - array[9] = 3; - array[10] = 64; - array[11] = 104; - array[12] = 27; - array[13] = 212; - aacStream.setTimestamp(90); - aacStream.on('data', function(frame) { - if (frame.pts === 90 && frame.dts === 90) { - count += 1; - } - }); - aacStream.push(array); - assert.equal(count, 1); -}); - -QUnit.test('continues parsing after corrupted stream', function(assert) { - var - array = new Uint8Array(10000), - adtsCount = 0, - id3Count = 0; - - // an ID3 frame - array[0] = 73; - array[1] = 68; - array[2] = 51; - array[3] = 4; - array[4] = 0; - array[5] = 0; - array[6] = 0; - array[7] = 0; - array[8] = 0; - array[9] = 63; - array[10] = 80; - array[11] = 82; - array[12] = 73; - array[13] = 86; - - // an atds frame - array[1020] = 255; - array[1021] = 241; - array[1022] = 92; - array[1023] = 128; - array[1024] = 13; - array[1025] = 191; - array[1026] = 252; - array[1027] = 33; - array[1028] = 32; - array[1029] = 3; - array[1030] = 64; - array[1031] = 104; - array[1032] = 27; - array[1033] = 212; - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - aacStream.push(array); - assert.equal(adtsCount, 1); - assert.equal(id3Count, 1); -}); diff --git a/node_modules/mux.js/test/aac-utils.test.js b/node_modules/mux.js/test/aac-utils.test.js deleted file mode 100644 index 88d4ac6..0000000 --- a/node_modules/mux.js/test/aac-utils.test.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; - -var segments = require('data-files!segments'); - -var - QUnit = require('qunit'), - utils = require('../lib/aac/utils.js'), - testSegment = segments['test-aac-segment.aac'](); - -var id3TagOffset = 0; -var audioFrameOffset = 73; - - -QUnit.module('AAC Utils'); - -QUnit.test('correctly determines aac data', function(assert) { - assert.ok(utils.isLikelyAacData(testSegment), 'test segment is aac'); - - - var id3Offset = utils.parseId3TagSize(testSegment, 0); - var id3 = Array.prototype.slice.call(testSegment, 0, id3Offset); - var segmentOnly = testSegment.subarray(id3Offset); - var multipleId3 = new Uint8Array([] - .concat(id3) - .concat(id3) - .concat(id3) - .concat(id3) - .concat(Array.prototype.slice.call(segmentOnly)) - ); - - assert.ok(utils.isLikelyAacData(segmentOnly), 'test segment is aac without id3'); - assert.notOk(utils.isLikelyAacData(testSegment.subarray(id3Offset + 25)), 'non aac data not recognized'); - assert.notOk(utils.isLikelyAacData(testSegment.subarray(0, 5)), 'not enough aac data is not recognized'); - assert.ok(utils.isLikelyAacData(multipleId3), 'test segment with multilpe id3'); -}); - - -QUnit.test('correctly parses aac packet type', function(assert) { - assert.equal(utils.parseType(testSegment, id3TagOffset), 'timed-metadata', - 'parsed timed-metadata type'); - assert.equal(utils.parseType(testSegment, 1), null, - 'parsed unknown type'); - assert.equal(utils.parseType(testSegment, audioFrameOffset), 'audio', - 'parsed audio type'); -}); - -QUnit.test('correctly parses ID3 tag size', function(assert) { - assert.equal(utils.parseId3TagSize(testSegment, id3TagOffset), 73, - 'correct id3 tag size'); -}); - -QUnit.test('correctly parses timestamp from ID3 metadata', function(assert) { - var frameSize = utils.parseId3TagSize(testSegment, id3TagOffset); - var frame = testSegment.subarray(id3TagOffset, id3TagOffset + frameSize); - - assert.equal(utils.parseAacTimestamp(frame), 895690, 'correct aac timestamp'); -}); - -QUnit.test('correctly parses adts frame size', function(assert) { - assert.equal(utils.parseAdtsSize(testSegment, audioFrameOffset), 13, - 'correct adts frame size'); -}); - -QUnit.test('correctly parses packet sample rate', function(assert) { - var frameSize = utils.parseAdtsSize(testSegment, audioFrameOffset); - var frame = testSegment.subarray(audioFrameOffset, audioFrameOffset + frameSize); - - assert.equal(utils.parseSampleRate(frame), 44100, 'correct sample rate'); -}); - -QUnit.test('parses correct ID3 tag size', function(assert) { - var packetStream = new Uint8Array(10); - - packetStream[9] = 63; - - assert.equal(utils.parseId3TagSize(packetStream, 0), - 73, - 'correctly parsed a header without a footer'); -}); - -QUnit.test('parses correct ADTS Frame size', function(assert) { - var packetStream = new Uint8Array(6); - - packetStream[3] = 128; - packetStream[4] = 29; - packetStream[5] = 255; - - assert.equal(utils.parseAdtsSize(packetStream, 0), 239, 'correctly parsed framesize'); -}); diff --git a/node_modules/mux.js/test/base64-to-uint8-array.js b/node_modules/mux.js/test/base64-to-uint8-array.js deleted file mode 100644 index 13f166e..0000000 --- a/node_modules/mux.js/test/base64-to-uint8-array.js +++ /dev/null @@ -1,17 +0,0 @@ -var window = require('global/window'); -// TODO: use vhs-utils here - -var atob = (s) => window.atob ? window.atob(s) : Buffer.from(s, 'base64').toString('binary'); - -var base64ToUint8Array = function(base64) { - var decoded = atob(base64); - var uint8Array = new Uint8Array(new ArrayBuffer(decoded.length)); - - for (var i = 0; i < decoded.length; i++) { - uint8Array[i] = decoded.charCodeAt(i); - } - - return uint8Array; -}; - -module.exports = base64ToUint8Array; diff --git a/node_modules/mux.js/test/caption-parser.test.js b/node_modules/mux.js/test/caption-parser.test.js deleted file mode 100644 index 78ee394..0000000 --- a/node_modules/mux.js/test/caption-parser.test.js +++ /dev/null @@ -1,253 +0,0 @@ -'use strict'; - -var segments = require('data-files!segments'); - -var probe = require('../lib/mp4/probe'); -var CaptionParser = require('../lib/mp4').CaptionParser; -var captionParser; - -var dashInit = segments['dash-608-captions-init.mp4'](); -// This file includes 2 segments data to force a flush -// of the first caption. The second caption is at 200s -var dashSegment = segments['dash-608-captions-seg.m4s'](); - -var mp4Helpers = require('./utils/mp4-helpers'); -var box = mp4Helpers.box; -var seiNalUnitGenerator = require('./utils/sei-nal-unit-generator'); -var makeMdatFromCaptionPackets = seiNalUnitGenerator.makeMdatFromCaptionPackets; -var characters = seiNalUnitGenerator.characters; - -var packets0; -var version0Moof; -var version0Segment; - -var packets1; -var version1Moof; -var version1Segment; - -QUnit.module('MP4 Caption Parser', { - beforeEach: function() { - captionParser = new CaptionParser(); - captionParser.init(); - }, - - afterEach: function() { - captionParser.reset(); - } -}); - -QUnit.test('parse captions from real segment', function(assert) { - var trackIds; - var timescales; - var cc; - - trackIds = probe.videoTrackIds(dashInit); - timescales = probe.timescale(dashInit); - - cc = captionParser.parse(dashSegment, trackIds, timescales); - - assert.equal(cc.captions.length, 1); - assert.equal(cc.captions[0].text, '00:00:00', - 'real segment caption has correct text'); - assert.equal(cc.captions[0].stream, 'CC1', - 'real segment caption has correct stream'); - assert.equal(cc.captions[0].startTime, 0, - 'real segment caption has correct startTime'); - assert.equal(cc.captions[0].endTime, 119, - 'real segment caption has correct endTime'); - assert.equal(cc.captionStreams.CC1, true, - 'real segment caption streams have correct settings'); -}); - -QUnit.test('parse captions when init segment received late', function(assert) { - var trackIds; - var timescales; - var cc; - - trackIds = probe.videoTrackIds(dashInit); - timescales = probe.timescale(dashInit); - - cc = captionParser.parse(dashSegment, [], {}); - assert.ok(!cc, 'there should not be any parsed captions yet'); - - cc = captionParser.parse(dashSegment, trackIds, timescales); - assert.equal(cc.captions.length, 1); -}); - -QUnit.test('parseTrackId for version 0 and version 1 boxes', function(assert) { - var v0Captions; - var v1Captions; - - v0Captions = captionParser.parse( - new Uint8Array(version0Segment), // segment - [1], // trackIds - { 1: 90000 }); // timescales); - - assert.equal(v0Captions.captions.length, 1, 'got 1 version0 caption'); - assert.equal(v0Captions.captions[0].text, 'test string #1', - 'got the expected version0 caption text'); - assert.equal(v0Captions.captions[0].stream, 'CC1', - 'returned the correct caption stream CC1'); - assert.equal(v0Captions.captions[0].startTime, 10 / 90000, - 'the start time for version0 caption is correct'); - assert.equal(v0Captions.captions[0].endTime, 10 / 90000, - 'the end time for version0 caption is correct'); - assert.equal(v0Captions.captionStreams.CC1, true, - 'stream is CC1'); - assert.ok(!v0Captions.captionStreams.CC4, - 'stream is not CC4'); - - // Clear parsed captions - captionParser.clearParsedCaptions(); - - v1Captions = captionParser.parse( - new Uint8Array(version1Segment), - [2], // trackIds - { 2: 90000 }); // timescales - - assert.equal(v1Captions.captions.length, 1, 'got version1 caption'); - assert.equal(v1Captions.captions[0].text, 'test string #2', - 'got the expected version1 caption text'); - assert.equal(v1Captions.captions[0].stream, 'CC4', - 'returned the correct caption stream CC4'); - assert.equal(v1Captions.captions[0].startTime, 30 / 90000, - 'the start time for version1 caption is correct'); - assert.equal(v1Captions.captions[0].endTime, 30 / 90000, - 'the end time for version1 caption is correct'); - assert.equal(v1Captions.captionStreams.CC4, true, - 'stream is CC4'); - assert.ok(!v1Captions.captionStreams.CC1, - 'stream is not CC1'); -}); - -// --------- -// Test Data -// --------- - -// "test string #1", channel 1, field 1 -packets0 = [ - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // 'test string #1' - { ccData: characters('te'), type: 0 }, - { ccData: characters('st'), type: 0 }, - { ccData: characters(' s'), type: 0 }, - // 'test string #1' continued - { ccData: characters('tr'), type: 0 }, - { ccData: characters('in'), type: 0 }, - { ccData: characters('g '), type: 0 }, - { ccData: characters('#1'), type: 0 }, - // EOC, End of Caption. End display - { ccData: 0x142f, type: 0 }, - // EOC, End of Caption. Finished transmitting, begin display - { ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption. End display - { ccData: 0x142f, type: 0 } -]; - -// "test string #2", channel 2, field 2 -packets1 = [ - // Send another command so that the second EOC isn't ignored - { ccData: 0x1d20, type: 1 }, - // RCL, resume caption loading - { ccData: 0x1d20, type: 1 }, - // 'test string #2' - { ccData: characters('te'), type: 1 }, - { ccData: characters('st'), type: 1 }, - { ccData: characters(' s'), type: 1 }, - // 'test string #2' continued - { ccData: characters('tr'), type: 1 }, - { ccData: characters('in'), type: 1 }, - { ccData: characters('g '), type: 1 }, - { ccData: characters('#2'), type: 1 }, - // EOC, End of Caption. End display - { ccData: 0x1d2f, type: 1 }, - // EOC, End of Caption. Finished transmitting, begin display - { ccData: 0x1d2f, type: 1 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1d20, type: 1 }, - // EOC, End of Caption. End display - { ccData: 0x1d2f, type: 1 } -]; - -/** - * version 0: - * Uses version 0 boxes, no first sample flags - * sample size, flags, duration, composition time offset included. -**/ -version0Moof = - box('moof', - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // base_data_offset - 0x00, 0x00, 0x00, 0x00, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00), // default_sample_flags - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00), // baseMediaDecodeTime, - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, no first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0a, // signed sample_composition_time_offset = 10 - // sample 2 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x14))); // signed sample_composition_time_offset = 20 - -version0Segment = version0Moof.concat(makeMdatFromCaptionPackets(packets0)); - -/** - * version 1: - * Uses version 1 boxes, has first sample flags, - * other samples include flags and composition time offset only. -**/ -version1Moof = - box('moof', - box('traf', - box('tfhd', - 0x01, // version - 0x00, 0x00, 0x18, // flags - 0x00, 0x00, 0x00, 0x02, // track_ID - // no base_data_offset, sample_description_index - 0x00, 0x00, 0x00, 0x0a, // default_sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a), // default_sample_size = 10 - box('tfdt', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x14), // baseMediaDecodeTime = 20, - box('trun', - 0x01, // version - 0x00, 0x0c, 0x05, // flags: dataOffsetPresent, sampleFlagsPresent, - // firstSampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, has first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0a, // signed sample_composition_time_offset = 10 - // sample 2 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x14))); // signed sample_composition_time_offset = 20 - -version1Segment = version1Moof.concat(makeMdatFromCaptionPackets(packets1)); diff --git a/node_modules/mux.js/test/caption-stream.test.js b/node_modules/mux.js/test/caption-stream.test.js deleted file mode 100644 index 798c83d..0000000 --- a/node_modules/mux.js/test/caption-stream.test.js +++ /dev/null @@ -1,3008 +0,0 @@ -'use strict'; - -var segments = require('data-files!segments'); - -var - captionStream, - m2ts = require('../lib/m2ts'), - mp4 = require('../lib/mp4'), - QUnit = require('qunit'), - seiNalUnitGenerator = require('./utils/sei-nal-unit-generator'), - makeSeiFromCaptionPacket = seiNalUnitGenerator.makeSeiFromCaptionPacket, - makeSeiFromMultipleCaptionPackets = seiNalUnitGenerator.makeSeiFromMultipleCaptionPackets, - characters = seiNalUnitGenerator.characters, - packetHeader708 = seiNalUnitGenerator.packetHeader708, - displayWindows708 = seiNalUnitGenerator.displayWindows708, - cc708PinkUnderscore = require('./utils/cc708-pink-underscore'), - sintelCaptions = segments['sintel-captions.ts'](), - mixed608708Captions = require('./utils/mixed-608-708-captions.js'), - multiChannel608Captions = segments['multi-channel-608-captions.ts'](); - -QUnit.module('Caption Stream', { - beforeEach: function() { - captionStream = new m2ts.CaptionStream(); - } -}); - -QUnit.test('parses SEIs messages larger than 255 bytes', function(assert) { - var packets = [], data; - captionStream.ccStreams_[0].push = function(packet) { - packets.push(packet); - }; - // set data channel 1 active for field 1 - captionStream.activeCea608Channel_[0] = 0; - data = new Uint8Array(268); - data[0] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[1] = 0xff; // payload_size - data[2] = 0x0d; // payload_size - data[3] = 181; // itu_t_t35_country_code - data[4] = 0x00; - data[5] = 0x31; // itu_t_t35_provider_code - data[6] = 0x47; - data[7] = 0x41; - data[8] = 0x39; - data[9] = 0x34; // user_identifier, "GA94" - data[10] = 0x03; // user_data_type_code, 0x03 is cc_data - data[11] = 0xc1; // process_cc_data, cc_count - data[12] = 0xff; // reserved - data[13] = 0xfc; // cc_valid, cc_type (608, field 1) - data[14] = 0xff; // cc_data_1 with parity bit set - data[15] = 0x0e; // cc_data_2 without parity bit set - data[16] = 0xff; // marker_bits - - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: data - }); - captionStream.flush(); - assert.equal(packets.length, 1, 'parsed a caption'); -}); - -QUnit.test('parses SEIs containing multiple messages', function(assert) { - var packets = [], data; - - captionStream.ccStreams_[0].push = function(packet) { - packets.push(packet); - }; - // set data channel 1 active for field 1 - captionStream.activeCea608Channel_[0] = 0; - - data = new Uint8Array(22); - data[0] = 0x01; // payload_type !== user_data_registered_itu_t_t35 - data[1] = 0x04; // payload_size - data[6] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[7] = 0x0d; // payload_size - data[8] = 181; // itu_t_t35_country_code - data[9] = 0x00; - data[10] = 0x31; // itu_t_t35_provider_code - data[11] = 0x47; - data[12] = 0x41; - data[13] = 0x39; - data[14] = 0x34; // user_identifier, "GA94" - data[15] = 0x03; // user_data_type_code, 0x03 is cc_data - data[16] = 0xc1; // process_cc_data, cc_count - data[17] = 0xff; // reserved - data[18] = 0xfc; // cc_valid, cc_type (608, field 1) - data[19] = 0xff; // cc_data_1 with parity bit set - data[20] = 0x0e; // cc_data_2 without parity bit set - data[21] = 0xff; // marker_bits - - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: data - }); - captionStream.flush(); - assert.equal(packets.length, 1, 'parsed a caption'); -}); - -QUnit.test('parses SEIs containing multiple messages of type user_data_registered_itu_t_t35', function(assert) { - var packets = [], data; - - captionStream.ccStreams_[0].push = function(packet) { - packets.push(packet); - }; - // set data channel 1 active for field 1 - captionStream.activeCea608Channel_[0] = 0; - - data = new Uint8Array(33); - data[0] = 0x01; // payload_type !== user_data_registered_itu_t_t35 - data[1] = 0x04; // payload_size - - // https://www.etsi.org/deliver/etsi_ts/101100_101199/101154/01.11.01_60/ts_101154v011101p.pdf#page=117 - data[6] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[7] = 0x09; // payload_size - data[8] = 181; // itu_t_t35_country_code - data[9] = 0x00; - data[10] = 0x31; // itu_t_t35_provider_code - data[11] = 0x44; - data[12] = 0x54; - data[13] = 0x47; - data[14] = 0x31; // user_identifier, "DTG1" - data[15] = 0x11; // zero_bit (b7), active_format_flag (b6), reserved (b5-b0) - data[16] = 0xF0; // reserved (b7-b4), active_format (b3-b0) - - data[17] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[18] = 0x0d; // payload_size - data[19] = 181; // itu_t_t35_country_code - data[20] = 0x00; - data[21] = 0x31; // itu_t_t35_provider_code - data[22] = 0x47; - data[23] = 0x41; - data[24] = 0x39; - data[25] = 0x34; // user_identifier, "GA94" - data[26] = 0x03; // user_data_type_code, 0x03 is cc_data - data[27] = 0xc1; // process_cc_data, cc_count - data[28] = 0xff; // reserved - data[29] = 0xfc; // cc_valid, cc_type (608, field 1) - data[30] = 0xff; // cc_data_1 with parity bit set - data[31] = 0x0e; // cc_data_2 without parity bit set - data[32] = 0xff; // marker_bits - - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: data - }); - captionStream.flush(); - assert.equal(packets.length, 1, 'ignored DTG1 payload, parsed a GA94 caption'); -}); - -QUnit.test('does not throw error if only invalid payloads', function(assert) { - var packets = [], data; - - captionStream.ccStreams_[0].push = function(packet) { - packets.push(packet); - }; - // set data channel 1 active for field 1 - captionStream.activeCea608Channel_[0] = 0; - - data = new Uint8Array(33); - data[0] = 0x01; // payload_type !== user_data_registered_itu_t_t35 - data[1] = 0x04; // payload_size - - // https://www.etsi.org/deliver/etsi_ts/101100_101199/101154/01.11.01_60/ts_101154v011101p.pdf#page=117 - data[6] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[7] = 0x09; // payload_size - data[8] = 181; // itu_t_t35_country_code - data[9] = 0x00; - data[10] = 0x31; // itu_t_t35_provider_code - data[11] = 0x44; - data[12] = 0x54; - data[13] = 0x47; - data[14] = 0x31; // user_identifier, "DTG1" - data[15] = 0x11; // zero_bit (b7), active_format_flag (b6), reserved (b5-b0) - data[16] = 0xF0; // reserved (b7-b4), active_format (b3-b0) - - data[17] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[18] = 0x0d; // payload_size - data[19] = 181; // itu_t_t35_country_code - data[20] = 0x00; - data[21] = 0x31; // itu_t_t35_provider_code - data[22] = 0x47; - data[23] = 0x41; - data[24] = 0x39; - - - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: data - }); - captionStream.flush(); - assert.equal(packets.length, 0, 'ignored DTG1 payload'); -}); - - -QUnit.test('ignores SEIs that do not have type user_data_registered_itu_t_t35', function(assert) { - var captions = []; - captionStream.on('data', function(caption) { - captions.push(caption); - }); - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: new Uint8Array([ - 0x05 // payload_type !== user_data_registered_itu_t_t35 - ]) - }); - - assert.equal(captions.length, 0, 'ignored the unknown payload type'); -}); - -QUnit.test('parses a minimal example of caption data', function(assert) { - var packets = []; - captionStream.ccStreams_[0].push = function(packet) { - packets.push(packet); - }; - // set data channel 1 active for field 1 - captionStream.activeCea608Channel_[0] = 0; - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: new Uint8Array([ - 0x04, // payload_type === user_data_registered_itu_t_t35 - - 0x0d, // payload_size - - 181, // itu_t_t35_country_code - 0x00, 0x31, // itu_t_t35_provider_code - 0x47, 0x41, 0x39, 0x34, // user_identifier, "GA94" - 0x03, // user_data_type_code, 0x03 is cc_data - - // 110 00001 - 0xc1, // process_cc_data, cc_count - 0xff, // reserved - // 1111 1100 - 0xfc, // cc_valid, cc_type (608, field 1) - 0xff, // cc_data_1 with parity bit set - 0x0e, // cc_data_2 without parity bit set - - 0xff // marker_bits - ]) - }); - captionStream.flush(); - assert.equal(packets.length, 1, 'parsed a caption packet'); -}); - -QUnit.test('can be parsed from a segment', function(assert) { - var transmuxer = new mp4.Transmuxer(), - captions = []; - - // Setting the BMDT to ensure that captions and id3 tags are not - // time-shifted by this value when they are output and instead are - // zero-based - transmuxer.setBaseMediaDecodeTime(100000); - - transmuxer.on('data', function(data) { - if (data.captions) { - captions = captions.concat(data.captions); - } - }); - - transmuxer.push(sintelCaptions); - transmuxer.flush(); - - assert.equal(captions.length, 2, 'parsed two captions'); - assert.equal(captions[0].text.indexOf('ASUKA'), 0, 'parsed the start of the first caption'); - assert.ok(captions[0].text.indexOf('Japanese') > 0, 'parsed the end of the first caption'); - assert.equal(captions[0].startTime, 1, 'parsed the start time'); - assert.equal(captions[0].endTime, 4, 'parsed the end time'); -}); - -QUnit.test('dispatches caption track information', function(assert) { - var transmuxer = new mp4.Transmuxer(), - captions = [], - captionStreams = {}; - - // Setting the BMDT to ensure that captions and id3 tags are not - // time-shifted by this value when they are output and instead are - // zero-based - transmuxer.setBaseMediaDecodeTime(100000); - - transmuxer.on('data', function(data) { - if (data.captions) { - captions = captions.concat(data.captions); - for (var trackId in data.captionStreams) { - captionStreams[trackId] = true; - } - } - }); - - transmuxer.push(multiChannel608Captions); - transmuxer.flush(); - - assert.deepEqual(captionStreams, {CC1: true, CC3: true}, 'found captions in CC1 and CC3'); - assert.equal(captions.length, 4, 'parsed eight captions'); - assert.equal(captions[0].text, 'être une période de questions', 'parsed the text of the first caption in CC3'); - assert.equal(captions[1].text, 'PERIOD, FOLKS.', 'parsed the text of the first caption in CC1'); -}); - -QUnit.test('sorting is fun', function(assert) { - var packets, captions, seiNals; - packets = [ - // Send another command so that the second EOC isn't ignored - { pts: 10 * 1000, ccData: 0x1420, type: 0 }, - // RCL, resume caption loading - { pts: 1000, ccData: 0x1420, type: 0 }, - // 'test string #1' - { pts: 1000, ccData: characters('te'), type: 0 }, - { pts: 1000, ccData: characters('st'), type: 0 }, - { pts: 1000, ccData: characters(' s'), type: 0 }, - // 'test string #2' - { pts: 10 * 1000, ccData: characters('te'), type: 0 }, - { pts: 10 * 1000, ccData: characters('st'), type: 0 }, - { pts: 10 * 1000, ccData: characters(' s'), type: 0 }, - // 'test string #1' continued - { pts: 1000, ccData: characters('tr'), type: 0 }, - { pts: 1000, ccData: characters('in'), type: 0 }, - { pts: 1000, ccData: characters('g '), type: 0 }, - { pts: 1000, ccData: characters('#1'), type: 0 }, - // 'test string #2' continued - { pts: 10 * 1000, ccData: characters('tr'), type: 0 }, - { pts: 10 * 1000, ccData: characters('in'), type: 0 }, - { pts: 10 * 1000, ccData: characters('g '), type: 0 }, - { pts: 10 * 1000, ccData: characters('#2'), type: 0 }, - // EOC, End of Caption. End display - { pts: 10 * 1000, ccData: 0x142f, type: 0 }, - // EOC, End of Caption. Finished transmitting, begin display - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { pts: 20 * 1000, ccData: 0x1420, type: 0 }, - // EOC, End of Caption. End display - { pts: 20 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - - seiNals = packets.map(makeSeiFromCaptionPacket); - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 2, 'detected two captions'); - assert.equal(captions[0].text, 'test string #1', 'parsed caption 1'); - assert.equal(captions[1].text, 'test string #2', 'parsed caption 2'); -}); - -QUnit.test('drops duplicate segments', function(assert) { - var packets, captions, seiNals; - packets = [ - { - pts: 1000, dts: 1000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL (resume caption loading) - {ccData: 0x1420, type: 0 }, // RCL, duplicate as per spec - {ccData: characters('te'), type: 0 }, - {ccData: characters('st'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters(' s'), type: 0 }, - {ccData: characters('tr'), type: 0 }, - {ccData: characters('in'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('g '), type: 0 }, - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters(' s'), type: 0 }, - {ccData: characters('tr'), type: 0 }, - {ccData: characters('in'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('g '), type: 0 }, - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - }, - { - pts: 4000, dts: 4000, captions: [ - {ccData: 0x142f, type: 0 }, // EOC (end of caption), mark display start - {ccData: 0x142f, type: 0 }, // EOC, duplicate as per spec - {ccData: 0x142f, type: 0 }, // EOC, mark display end and flush - {ccData: 0x142f, type: 0 } // EOC, duplicate as per spec - ] - } - ]; - captions = []; - - seiNals = packets.map(makeSeiFromMultipleCaptionPackets); - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 1, 'detected one caption'); - assert.equal(captions[0].text, 'test string data', 'parsed caption properly'); -}); - -QUnit.test('drops duplicate segments with multi-segment DTS values', function(assert) { - var packets, captions, seiNals; - packets = [ - { - pts: 1000, dts: 1000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL (resume caption loading) - {ccData: 0x1420, type: 0 }, // RCL, duplicate as per spec - {ccData: characters('te'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters('st'), type: 0 }, - {ccData: characters(' s'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters('tr'), type: 0 }, - {ccData: characters('in'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('g '), type: 0 }, - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters(' s'), type: 0 }, - {ccData: characters('tr'), type: 0 }, - {ccData: characters('in'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('g '), type: 0 }, - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters(' s'), type: 0 }, - {ccData: characters('tu'), type: 0 }, - {ccData: characters('ff'), type: 0 } - ] - }, - { - pts: 4000, dts: 4000, captions: [ - {ccData: 0x142f, type: 0 }, // EOC (end of caption) - // EOC not duplicated for robustness testing - {ccData: 0x1420, type: 0 } // RCL (resume caption loading) - ] - }, - { - pts: 5000, dts: 5000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL, duplicated as per spec - {ccData: characters(' a'), type: 0 }, - {ccData: characters('nd'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters(' e'), type: 0 }, - {ccData: characters('ve'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('n '), type: 0 }, - {ccData: characters('mo'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('re'), type: 0 }, - {ccData: characters(' t'), type: 0 } - ] - }, - { - pts: 5000, dts: 5000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL, duplicated as per spec - {ccData: characters(' a'), type: 0 }, - {ccData: characters('nd'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters(' e'), type: 0 }, - {ccData: characters('ve'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('n '), type: 0 }, - {ccData: characters('mo'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('re'), type: 0 }, - {ccData: characters(' t'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('ex'), type: 0 }, - {ccData: characters('t '), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - }, - { - pts: 7000, dts: 7000, captions: [ - {ccData: characters(' h'), type: 0 }, - {ccData: characters('er'), type: 0 } - ] - }, - { - pts: 8000, dts: 8000, captions: [ - {ccData: characters('e!'), type: 0 }, - {ccData: 0x142f, type: 0 }, // EOC (end of caption), mark display start - {ccData: 0x142f, type: 0 }, // EOC, duplicated as per spec - {ccData: 0x142f, type: 0 } // EOC, mark display end and flush - // EOC not duplicated for robustness testing - ] - } - ]; - captions = []; - - seiNals = packets.map(makeSeiFromMultipleCaptionPackets); - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 2, 'detected two captions'); - assert.equal(captions[0].text, 'test string data stuff', 'parsed caption properly'); - assert.equal(captions[1].text, 'and even more text data here!', 'parsed caption properly'); -}); - -QUnit.test('doesn\'t ignore older segments if reset', function(assert) { - var firstPackets, secondPackets, captions, seiNals1, seiNals2; - firstPackets = [ - { - pts: 11000, dts: 11000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL (resume caption loading) - {ccData: 0x1420, type: 0 }, // RCL, duplicated as per spec - {ccData: characters('te'), type: 0 } - ] - }, - { - pts: 12000, dts: 12000, captions: [ - {ccData: characters('st'), type: 0 }, - {ccData: characters(' s'), type: 0 } - ] - }, - { - pts: 12000, dts: 12000, captions: [ - {ccData: characters('tr'), type: 0 }, - {ccData: characters('in'), type: 0 } - ] - }, - { - pts: 13000, dts: 13000, captions: [ - {ccData: characters('g '), type: 0 }, - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - } - ]; - secondPackets = [ - { - pts: 1000, dts: 1000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL (resume caption loading) - {ccData: 0x1420, type: 0 }, // RCL, duplicated as per spec - {ccData: characters('af'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters('te'), type: 0 }, - {ccData: characters('r '), type: 0 }, - {ccData: characters('re'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('se'), type: 0 }, - {ccData: characters('t '), type: 0 }, - {ccData: characters('da'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('ta'), type: 0 }, - {ccData: characters('!!'), type: 0 } - ] - }, - { - pts: 4000, dts: 4000, captions: [ - {ccData: 0x142f, type: 0 }, // EOC (end of caption), mark display start - {ccData: 0x142f, type: 0 }, // EOC, duplicated as per spec - {ccData: 0x142f, type: 0 } // EOC, mark display end and flush - // EOC not duplicated for robustness testing - ] - } - ]; - captions = []; - - seiNals1 = firstPackets.map(makeSeiFromMultipleCaptionPackets); - seiNals2 = secondPackets.map(makeSeiFromMultipleCaptionPackets); - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals1.forEach(captionStream.push, captionStream); - captionStream.flush(); - assert.equal(captionStream.latestDts_, 13000, 'DTS is tracked correctly'); - - captionStream.reset(); - assert.equal(captionStream.latestDts_, null, 'DTS tracking was reset'); - - seiNals2.forEach(captionStream.push, captionStream); - captionStream.flush(); - assert.equal(captionStream.latestDts_, 4000, 'DTS is tracked correctly'); - - assert.equal(captions.length, 1, 'detected one caption'); - assert.equal(captions[0].text, 'after reset data!!', 'parsed caption properly'); -}); - -QUnit.test('extracts all theoretical caption channels', function(assert) { - var captions = []; - captionStream.ccStreams_.forEach(function(cc) { - cc.on('data', function(caption) { - captions.push(caption); - }); - }); - - // RU2 = roll-up, 2 rows - // CR = carriage return - var packets = [ - { pts: 1000, type: 0, ccData: 0x1425 }, // RU2 (sets CC1) - { pts: 2000, type: 0, ccData: characters('1a') }, // CC1 - { pts: 3000, type: 0, ccData: 0x1c25 }, // RU2 (sets CC2) - { pts: 4000, type: 1, ccData: 0x1525 }, // RU2 (sets CC3) - { pts: 5000, type: 1, ccData: characters('3a') }, // CC3 - // this next one tests if active channel is tracked per-field - // instead of globally - { pts: 6000, type: 0, ccData: characters('2a') }, // CC2 - { pts: 7000, type: 1, ccData: 0x1d25 }, // RU2 (sets CC4) - { pts: 8000, type: 1, ccData: characters('4a') }, // CC4 - { pts: 9000, type: 1, ccData: characters('4b') }, // CC4 - { pts: 10000, type: 0, ccData: 0x142d }, // CR (sets + flushes CC1) - { pts: 11000, type: 0, ccData: 0x1c2d }, // CR (sets + flushes CC2) - { pts: 12000, type: 0, ccData: 0x1425 }, // RU2 (sets CC1) - { pts: 13000, type: 0, ccData: characters('1b') }, // CC1 - { pts: 14000, type: 0, ccData: characters('1c') }, // CC1 - { pts: 15000, type: 0, ccData: 0x142d }, // CR (sets + flushes CC1) - { pts: 16000, type: 1, ccData: 0x152d }, // CR (sets + flushes CC3) - { pts: 17000, type: 1, ccData: 0x1d2d }, // CR (sets + flushes CC4) - { pts: 18000, type: 0, ccData: 0x1c25 }, // RU2 (sets CC2) - { pts: 19000, type: 0, ccData: characters('2b') }, // CC2 - { pts: 20000, type: 0, ccData: 0x1c2d } // CR (sets + flushes CC2) - ]; - - var seiNals = packets.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 6, 'got all captions'); - assert.equal(captions[0].text, '1a', 'cc1 first row'); - assert.equal(captions[1].text, '2a', 'cc2 first row'); - assert.equal(captions[2].text, '1a\n1b1c', 'cc1 first and second row'); - assert.equal(captions[3].text, '3a', 'cc3 first row'); - assert.equal(captions[4].text, '4a4b', 'cc4 first row'); - assert.equal(captions[5].text, '2a\n2b', 'cc2 first and second row'); - -}); - -QUnit.test('drops data until first command that sets activeChannel for a field', function(assert) { - var captions = []; - captionStream.ccStreams_.forEach(function(cc) { - cc.on('data', function(caption) { - captions.push(caption); - }); - }); - - var packets = [ - // test that packets in same field and same data channel are dropped - // before a control code that sets the data channel - { pts: 0 * 1000, ccData: characters('no'), type: 0 }, - { pts: 0 * 1000, ccData: characters('t '), type: 0 }, - { pts: 0 * 1000, ccData: characters('th'), type: 0 }, - { pts: 0 * 1000, ccData: characters('is'), type: 0 }, - // EOC (end of caption), sets CC1 - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL (resume caption loading) - { pts: 1 * 1000, ccData: 0x1420, type: 0 }, - // EOC, if data wasn't dropped this would dispatch a caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 }, - // RCL - { pts: 3 * 1000, ccData: 0x1420, type: 0 }, - { pts: 4 * 1000, ccData: characters('fi'), type: 0 }, - { pts: 4 * 1000, ccData: characters('el'), type: 0 }, - { pts: 4 * 1000, ccData: characters('d0'), type: 0 }, - // EOC, mark display start - { pts: 5 * 1000, ccData: 0x142f, type: 0 }, - // EOC, duplicated as per spec - { pts: 5 * 1000, ccData: 0x142f, type: 0 }, - // EOC, mark display end and flush - { pts: 6 * 1000, ccData: 0x142f, type: 0 }, - // EOC not duplicated cuz not necessary - // now switch to field 1 and test that packets in the same field - // but DIFFERENT data channel are dropped - { pts: 7 * 1000, ccData: characters('or'), type: 1 }, - { pts: 7 * 1000, ccData: characters(' t'), type: 1 }, - { pts: 7 * 1000, ccData: characters('hi'), type: 1 }, - { pts: 7 * 1000, ccData: characters('s.'), type: 1 }, - // EOC (end of caption, sets CC4) - { pts: 8 * 1000, ccData: 0x1d2f, type: 1 }, - // RCL (resume caption loading) - { pts: 8 * 1000, ccData: 0x1d20, type: 1 }, - // EOC, if data wasn't dropped this would dispatch a caption - { pts: 9 * 1000, ccData: 0x1d2f, type: 1 }, - // RCL - { pts: 10 * 1000, ccData: 0x1d20, type: 1 }, - { pts: 11 * 1000, ccData: characters('fi'), type: 1 }, - { pts: 11 * 1000, ccData: characters('el'), type: 1 }, - { pts: 11 * 1000, ccData: characters('d1'), type: 1 }, - // EOC, mark display start - { pts: 12 * 1000, ccData: 0x1d2f, type: 1 }, - // EOC, duplicated as per spec - { pts: 12 * 1000, ccData: 0x1d2f, type: 1 }, - // EOC, mark display end and flush - { pts: 13 * 1000, ccData: 0x1d2f, type: 1 } - // EOC not duplicated cuz not necessary - ]; - - var seiNals = packets.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 2, 'received 2 captions'); - assert.equal(captions[0].text, 'field0', 'received only confirmed field0 data'); - assert.equal(captions[0].stream, 'CC1', 'caption went to right channel'); - assert.equal(captions[1].text, 'field1', 'received only confirmed field1 data'); - assert.equal(captions[1].stream, 'CC4', 'caption went to right channel'); -}); - -QUnit.test('clears buffer and drops data until first command that sets activeChannel after reset', function(assert) { - var firstPackets, secondPackets, captions, seiNals1, seiNals2; - captions = []; - - firstPackets = [ - // RCL (resume caption loading), CC1 - { pts: 1 * 1000, ccData: 0x1420, type: 0 }, - { pts: 2 * 1000, ccData: characters('fi'), type: 0 }, - { pts: 2 * 1000, ccData: characters('el'), type: 0 }, - { pts: 2 * 1000, ccData: characters('d0'), type: 0 }, - // EOC (end of caption), swap text to displayed memory - { pts: 3 * 1000, ccData: 0x142f, type: 0 }, - { pts: 4 * 1000, ccData: characters('fi'), type: 0 }, - { pts: 4 * 1000, ccData: characters('el'), type: 0 }, - { pts: 4 * 1000, ccData: characters('d0'), type: 0 }, - // RCL (resume caption loading), CC4 - { pts: 5 * 1000, ccData: 0x1d20, type: 1 }, - { pts: 6 * 1000, ccData: characters('fi'), type: 1 }, - { pts: 6 * 1000, ccData: characters('el'), type: 1 }, - { pts: 6 * 1000, ccData: characters('d1'), type: 1 }, - // EOC (end of caption), swap text to displayed memory - { pts: 7 * 1000, ccData: 0x1d2f, type: 1 }, - { pts: 8 * 1000, ccData: characters('fi'), type: 1 }, - { pts: 8 * 1000, ccData: characters('el'), type: 1 }, - { pts: 8 * 1000, ccData: characters('d1'), type: 1 } - ]; - secondPackets = [ - // following packets are dropped - { pts: 9 * 1000, ccData: characters('no'), type: 0 }, - { pts: 9 * 1000, ccData: characters('t '), type: 0 }, - { pts: 9 * 1000, ccData: characters('th'), type: 0 }, - { pts: 9 * 1000, ccData: characters('is'), type: 0 }, - { pts: 10 * 1000, ccData: characters('or'), type: 1 }, - { pts: 10 * 1000, ccData: characters(' t'), type: 1 }, - { pts: 10 * 1000, ccData: characters('hi'), type: 1 }, - { pts: 10 * 1000, ccData: characters('s.'), type: 1 }, - // EOC (end of caption), sets CC1 - { pts: 11 * 1000, ccData: 0x142f, type: 0 }, - // RCL (resume caption loading), CC1 - { pts: 11 * 1000, ccData: 0x1420, type: 0 }, - // EOC, sets CC4 - { pts: 12 * 1000, ccData: 0x1d2f, type: 1 }, - // RCL, CC4 - { pts: 12 * 1000, ccData: 0x1d20, type: 1 }, - // EOC, CC1, would dispatch caption if packets weren't ignored - { pts: 13 * 1000, ccData: 0x142f, type: 0 }, - // RCL, CC1 - { pts: 13 * 1000, ccData: 0x1420, type: 0 }, - // EOC, CC4, would dispatch caption if packets weren't ignored - { pts: 14 * 1000, ccData: 0x1d2f, type: 1 }, - // RCL, CC4 - { pts: 14 * 1000, ccData: 0x1d20, type: 1 }, - { pts: 18 * 1000, ccData: characters('bu'), type: 0 }, - { pts: 18 * 1000, ccData: characters('t '), type: 0 }, - { pts: 18 * 1000, ccData: characters('th'), type: 0 }, - { pts: 18 * 1000, ccData: characters('is'), type: 0 }, - { pts: 19 * 1000, ccData: characters('an'), type: 1 }, - { pts: 19 * 1000, ccData: characters('d '), type: 1 }, - { pts: 19 * 1000, ccData: characters('th'), type: 1 }, - { pts: 19 * 1000, ccData: characters('is'), type: 1 }, - // EOC (end of caption), CC1, mark caption 1 start - { pts: 20 * 1000, ccData: 0x142f, type: 0 }, - // EOC, CC1, duplicated as per spec - { pts: 20 * 1000, ccData: 0x142f, type: 0 }, - // EOC, CC1, mark caption 1 end and dispatch - { pts: 21 * 1000, ccData: 0x142f, type: 0 }, - // No duplicate EOC cuz not necessary - // EOC, CC4, mark caption 2 start - { pts: 22 * 1000, ccData: 0x1d2f, type: 1 }, - // EOC, CC4, duplicated as per spec - { pts: 22 * 1000, ccData: 0x1d2f, type: 1 }, - // EOC, CC4, mark caption 2 end and dispatch - { pts: 23 * 1000, ccData: 0x1d2f, type: 1 } - // No duplicate EOC cuz not necessary - ]; - - seiNals1 = firstPackets.map(makeSeiFromCaptionPacket); - seiNals2 = secondPackets.map(makeSeiFromCaptionPacket); - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals1.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captionStream.ccStreams_[0].nonDisplayed_[14], 'field0', - 'there is data in non-displayed memory for field 0 before reset'); - assert.equal(captionStream.ccStreams_[3].nonDisplayed_[14], 'field1', - 'there is data in non-displayed memory for field 1 before reset'); - assert.equal(captionStream.ccStreams_[0].displayed_[14], 'field0', - 'there is data in displayed memory for field 0 before reset'); - assert.equal(captionStream.ccStreams_[3].displayed_[14], 'field1', - 'there is data in displayed memory for field 1 before reset'); - - captionStream.reset(); - - assert.equal(captionStream.ccStreams_[0].nonDisplayed_[14], '', - 'there is no data in non-displayed memory for field 0 after reset'); - assert.equal(captionStream.ccStreams_[3].nonDisplayed_[14], '', - 'there is no data in non-displayed memory for field 1 after reset'); - assert.equal(captionStream.ccStreams_[0].displayed_[14], '', - 'there is no data in displayed memory for field 0 after reset'); - assert.equal(captionStream.ccStreams_[3].displayed_[14], '', - 'there is no data in displayed memory for field 1 after reset'); - - seiNals2.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 2, 'detected two captions'); - assert.equal(captions[0].text, 'but this', 'parsed caption properly'); - assert.equal(captions[0].stream, 'CC1', 'caption went to right channel'); - assert.equal(captions[1].text, 'and this', 'parsed caption properly'); - assert.equal(captions[1].stream, 'CC4', 'caption went to right channel'); -}); - -QUnit.test("don't mess up 608 captions when 708 are present", function(assert) { - var captions = []; - captionStream.ccStreams_.forEach(function(cc) { - cc.on('data', function(caption) { - captions.push(caption); - }); - }); - - var seiNals = mixed608708Captions.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 3, 'parsed three captions'); - assert.equal(captions[0].text, 'BUT IT\'S NOT SUFFERING\nRIGHW.', 'parsed first caption correctly'); - // there is also bad data in the captions, but the null ascii character is removed - assert.equal(captions[1].text, 'IT\'S NOT A THREAT TO ANYBODY.', 'parsed second caption correctly'); - assert.equal(captions[2].text, 'WE TRY NOT TO PUT AN ANIMAL DOWN\nIF WE DON\'T HAVE TO.', 'parsed third caption correctly'); -}); - -QUnit.test("both 608 and 708 captions are available by default", function(assert) { - var cc608 = []; - var cc708 = []; - captionStream.on('data', function(caption) { - if (caption.stream === 'CC1') { - cc608.push(caption); - } else { - cc708.push(caption); - } - }); - - var seiNals = mixed608708Captions.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(cc608.length, 3, 'parsed three 608 cues'); - assert.equal(cc708.length, 3, 'parsed three 708 cues'); -}); - -QUnit.test("708 parsing can be turned off", function(assert) { - captionStream.reset(); - captionStream = new m2ts.CaptionStream({ - parse708captions: false - }); - var cc608 = []; - var cc708 = []; - captionStream.on('data', function(caption) { - if (caption.stream === 'CC1') { - cc608.push(caption); - } else { - cc708.push(caption); - } - }); - - var seiNals = mixed608708Captions.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(cc608.length, 3, 'parsed three 608 cues'); - assert.equal(cc708.length, 0, 'did not parse any 708 cues'); -}); - -QUnit.test('ignores XDS and Text packets', function(assert) { - var captions = []; - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RCL, resume caption loading, CC3 - { pts: 1000, ccData: 0x1520, type: 1 }, - { pts: 2000, ccData: characters('hi'), type: 1 }, - // EOC, End of Caption - { pts: 3000, ccData: 0x152f, type: 1 }, - // Send another command so that the second EOC isn't ignored - { pts: 3000, ccData: 0x152f, type: 1 }, - // EOC, End of Caption - { pts: 4000, ccData: 0x152f, type: 1 }, - // ENM, Erase Non-Displayed Memory - { pts: 4000, ccData: 0x152e, type: 1 }, - // RCL, resume caption loading, CC1 - { pts: 5000, ccData: 0x1420, type: 0 } - ].map(makeSeiFromCaptionPacket).forEach(captionStream.push, captionStream); - captionStream.flush(); - assert.equal(captionStream.activeCea608Channel_[0], 0, 'field 1: CC1 is active'); - assert.equal(captionStream.activeCea608Channel_[1], 0, 'field 2: CC3 is active'); - - [ - // TR, text restart, CC1 - { pts: 5000, ccData: 0x142a, type: 0 }, - { pts: 6000, ccData: characters('tx'), type: 0 } - ].map(makeSeiFromCaptionPacket).forEach(captionStream.push, captionStream); - captionStream.flush(); - assert.equal(captionStream.activeCea608Channel_[0], null, 'field 1: disabled'); - assert.equal(captionStream.activeCea608Channel_[1], 0, 'field 2: CC3 is active'); - - [ - // EOC, End of Caption - { pts: 7000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { pts: 7000, ccData: 0x142f, type: 0 }, - // EOC, End of Caption - { pts: 8000, ccData: 0x142f, type: 0 }, - // RCL, resume caption loading, CC3 - { pts: 9000, ccData: 0x1520, type: 1 }, - // XDS start, "current" class, program identification number type - { pts: 10000, ccData: 0x0101, type: 1 }, - { pts: 11000, ccData: characters('oh'), type: 1 }, - // XDS end - { pts: 12000, ccData: 0x0f00, type: 1 } - ].map(makeSeiFromCaptionPacket).forEach(captionStream.push, captionStream); - captionStream.flush(); - assert.equal(captionStream.activeCea608Channel_[0], 0, 'field 1: CC1 is active'); - assert.equal(captionStream.activeCea608Channel_[1], null, 'field 2: disabled'); - - [ - // EOC, End of Caption - { pts: 13000, ccData: 0x152f, type: 1 }, - // Send another command so that the second EOC isn't ignored - { pts: 13000, ccData: 0x152f, type: 1 } - ].map(makeSeiFromCaptionPacket).forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 1, 'only parsed real caption'); - assert.equal(captions[0].text, 'hi', 'caption is correct'); - -}); - -// Full character translation tests are below for Cea608Stream, they just only -// test support for CC1. See those tests and the source code for more about the -// mechanics of special and extended characters. -QUnit.test('special and extended character codes work regardless of field and data channel', function(assert) { - var packets, seiNals, captions = []; - packets = [ - // RU2 (roll-up, 2 rows), CC2 - { ccData: 0x1c25, type: 0 }, - // ® - { ccData: 0x1930, type: 0 }, - // CR (carriage return), CC2, flush caption - { ccData: 0x1c2d, type: 0 }, - // RU2, CC3 - { ccData: 0x1525, type: 1 }, - // " - { ccData: 0x2200, type: 1 }, - // « - { ccData: 0x123e, type: 1 }, - // CR, CC3, flush caption - { ccData: 0x152d, type: 1 }, - // RU2, CC4 - { ccData: 0x1d25, type: 1 }, - // " - { ccData: 0x2200, type: 1 }, - // » - { ccData: 0x1a3f, type: 1 }, - // CR, CC4, flush caption - { ccData: 0x1d2d, type: 1 } - ]; - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals = packets.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.deepEqual(captions[0].text, String.fromCharCode(0xae), 'CC2 special character correct'); - assert.deepEqual(captions[1].text, String.fromCharCode(0xab), 'CC3 extended character correct'); - assert.deepEqual(captions[2].text, String.fromCharCode(0xbb), 'CC4 extended character correct'); -}); - -QUnit.test('number of roll up rows takes precedence over base row command', function(assert) { - var captions = []; - var packets = [ - - // RU2 (roll-up, 2 rows), CC1 - { type: 0, ccData: 0x1425 }, - // RU2, CC1 - { type: 0, ccData: 0x1425 }, - // PAC: row 1 (sets base row to row 1) - { type: 0, ccData: 0x1170 }, - // PAC: row 1 - { type: 0, ccData: 0x1170 }, - // - - { type: 0, ccData: 0x2d00 }, - // CR - { type: 0, ccData: 0x14ad }, - // CR - { type: 0, ccData: 0x14ad }, - // RU3 (roll-up, 3 rows), CC1 - { type: 0, ccData: 0x1426 }, - // RU3, CC1 - { type: 0, ccData: 0x1426 }, - // PAC, row 11 - { type: 0, ccData: 0x13d0 }, - // PAC, row 11 - { type: 0, ccData: 0x13d0 }, - // so - { type: 0, ccData: 0x736f }, - // CR - { type: 0, ccData: 0x14ad }, - // CR - { type: 0, ccData: 0x14ad } - ]; - var seis; - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seis = packets.map(makeSeiFromCaptionPacket); - - seis.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.deepEqual(captions[0].text, '-', 'RU2 caption is correct'); - assert.deepEqual(captions[1].text, '-\nso', 'RU3 caption is correct'); - - packets = [ - // switching from row 11 to 0 - // PAC: row 0 (sets base row to row 0) - { type: 0, ccData: 0x1140 }, - // PAC: row 0 - { type: 0, ccData: 0x1140 }, - // CR - { type: 0, ccData: 0x14ad }, - // CR - { type: 0, ccData: 0x14ad } - ]; - - seis = packets.map(makeSeiFromCaptionPacket); - seis.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.deepEqual(captions[2].text, '-\nso', 'RU3 caption is correct'); -}); - -var cea608Stream; - -QUnit.module('CEA 608 Stream', { - beforeEach: function() { - cea608Stream = new m2ts.Cea608Stream(); - } -}); - -QUnit.skip('filters null data', function(assert) { - assert.ok(false, 'not implemented'); -}); - -QUnit.skip('removes parity bits', function(assert) { - assert.ok(false, 'not implemented'); -}); - -QUnit.test('converts non-ASCII character codes to ASCII', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // ASCII exceptions - { ccData: 0x2a5c, type: 0 }, - { ccData: 0x5e5f, type: 0 }, - { ccData: 0x607b, type: 0 }, - { ccData: 0x7c7d, type: 0 }, - { ccData: 0x7e7f, type: 0 }, - // EOC, End of Caption - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption, clear the display - { pts: 10 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, - String.fromCharCode(0xe1, 0xe9, 0xed, 0xf3, 0xfa, 0xe7, 0xf7, 0xd1, 0xf1, 0x2588), - 'translated non-standard characters'); -}); - -QUnit.test('properly handles special character codes', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // Special characters as defined by CEA-608 - // see the CHARACTER_TRANSLATION hash in lib/m2ts/caption-stream for the - // mapping table - { ccData: 0x1130, type: 0 }, - { ccData: 0x1131, type: 0 }, - { ccData: 0x1132, type: 0 }, - { ccData: 0x1133, type: 0 }, - { ccData: 0x1134, type: 0 }, - { ccData: 0x1135, type: 0 }, - { ccData: 0x1136, type: 0 }, - { ccData: 0x1137, type: 0 }, - { ccData: 0x1138, type: 0 }, - { ccData: 0x1139, type: 0 }, - { ccData: 0x113a, type: 0 }, - { ccData: 0x113b, type: 0 }, - { ccData: 0x113c, type: 0 }, - { ccData: 0x113d, type: 0 }, - { ccData: 0x113e, type: 0 }, - { ccData: 0x113f, type: 0 }, - // EOC, End of Caption - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption, CC1, clear the display - { pts: 10 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions[0].text, - String.fromCharCode(0xae, 0xb0, 0xbd, 0xbf, 0x2122, 0xa2, 0xa3, 0x266a, - 0xe0, 0xa0, 0xe8, 0xe2, 0xea, 0xee, 0xf4, 0xfb), - 'translated special characters'); -}); - -QUnit.test('properly handles extended character codes', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // Extended characters are defined in CEA-608 as a standard character, - // which is followed by an extended character, and the standard character - // gets deleted. - // see the CHARACTER_TRANSLATION hash in lib/m2ts/caption-stream for the - // mapping table - { ccData: 0x2200, type: 0 }, - { ccData: 0x123e, type: 0 }, - { ccData: 0x4c41, type: 0 }, - { ccData: 0x1230, type: 0 }, - { ccData: 0x2d4c, type: 0 }, - { ccData: 0x4100, type: 0 }, - { ccData: 0x1338, type: 0 }, - { ccData: 0x204c, type: 0 }, - { ccData: 0x417d, type: 0 }, - { ccData: 0x4400, type: 0 }, - { ccData: 0x1137, type: 0 }, - { ccData: 0x2200, type: 0 }, - { ccData: 0x123f, type: 0 }, - // EOC, End of Caption - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption, clear the display - { pts: 10 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions[0].text, '«LÀ-LÅ LAÑD♪»', - 'translated special characters'); -}); - -QUnit.test('pop-on mode', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // 'hi' - { ccData: characters('hi'), type: 0 }, - // EOC, End of Caption. Finished transmitting, begin display - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption. End display - { pts: 10 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.deepEqual(captions[0], { - startPts: 1000, - endPts: 10 * 1000, - text: 'hi', - stream: 'CC1' - }, 'parsed the caption'); -}); - -QUnit.test('ignores null characters', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // 'mu' - { ccData: characters('mu'), type: 0 }, - // null characters - { ccData: 0x0000, type: 0 }, - // ' x' - { ccData: characters(' x'), type: 0 }, - // EOC, End of Caption. Finished transmitting, begin display - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption. End display - { pts: 10 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.deepEqual(captions[0], { - startPts: 1000, - endPts: 10 * 1000, - text: 'mu x', - stream: 'CC1' - }, 'ignored null characters'); -}); - -QUnit.test('recognizes the Erase Displayed Memory command', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // '01' - { ccData: characters('01'), type: 0 }, - // EOC, End of Caption. Finished transmitting, display '01' - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // EDM, Erase Displayed Memory - { pts: 1.5 * 1000, ccData: 0x142c, type: 0 }, - // '23' - { ccData: characters('23'), type: 0 }, - // EOC, End of Caption. Display '23' - { pts: 2 * 1000, ccData: 0x142f, type: 0 }, - // '34' - { ccData: characters('34'), type: 0 }, - // EOC, End of Caption. Display '34' - { pts: 3 * 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0}, - // EOC, End of Caption - { pts: 4 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 3, 'detected three captions'); - assert.deepEqual(captions[0], { - startPts: 1 * 1000, - endPts: 1.5 * 1000, - text: '01', - stream: 'CC1' - }, 'parsed the first caption'); - assert.deepEqual(captions[1], { - startPts: 2 * 1000, - endPts: 3 * 1000, - text: '23', - stream: 'CC1' - }, 'parsed the second caption'); - assert.deepEqual(captions[2], { - startPts: 3 * 1000, - endPts: 4 * 1000, - text: '34', - stream: 'CC1' - }, 'parsed the third caption'); -}); - -QUnit.test('backspaces are applied to non-displayed memory for pop-on mode', function(assert) { - var captions = [], packets; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // '01' - { ccData: characters('01'), type: 0 }, - // backspace - { ccData: 0x1421, type: 0 }, - { ccData: characters('23'), type: 0 }, - // PAC: row 13, no indent - { pts: 1 * 1000, ccData: 0x1370, type: 0 }, - { pts: 1 * 1000, ccData: characters('32'), type: 0 }, - // backspace - { pts: 2 * 1000, ccData: 0x1421, type: 0 }, - { pts: 3 * 1000, ccData: characters('10'), type: 0 }, - // EOC, End of Caption - { pts: 4 * 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption, flush caption - { pts: 5 * 1000, ccData: 0x142f, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.equal(captions[0].text, '310\n\n023', 'applied the backspaces'); -}); - -QUnit.test('backspaces on cleared memory are no-ops', function(assert) { - var captions = [], packets; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - packets = [ - // RCL, resume caption loading - { ccData: 0x1420 }, - // backspace - { ccData: 0x1421 }, - // EOC, End of Caption. Finished transmitting, display '01' - { pts: 1 * 1000, ccData: 0x142f } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 0, 'no captions detected'); -}); - -QUnit.test('recognizes the Erase Non-Displayed Memory command', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // '01' - { ccData: characters('01'), type: 0 }, - // ENM, Erase Non-Displayed Memory - { ccData: 0x142e, type: 0 }, - { ccData: characters('23'), type: 0 }, - // EOC, End of Caption. Finished transmitting, display '23' - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - - packets.forEach(cea608Stream.push, cea608Stream); - - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected one caption'); - assert.deepEqual(captions[0], { - startPts: 1 * 1000, - endPts: 2 * 1000, - text: '23', - stream: 'CC1' - }, 'cleared the non-displayed memory'); -}); - -QUnit.test('ignores unrecognized commands', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // a row-9 magenta command, which is not supported - { ccData: 0x1f4c, type: 0 }, - // '01' - { ccData: characters('01'), type: 0 }, - // EOC, End of Caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions[0].text, '01', 'skipped the unrecognized commands'); -}); - -QUnit.skip('applies preamble address codes', function(assert) { - assert.ok(false, 'not implemented'); -}); - -QUnit.skip('applies mid-row colors', function(assert) { - assert.ok(false, 'not implemented'); -}); - -QUnit.test('applies mid-row underline', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - { ccData: characters('no'), type: 0 }, - // mid-row, white underline - { ccData: 0x1121, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'no yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('applies mid-row italics', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - { ccData: characters('no'), type: 0 }, - // mid-row, italics - { ccData: 0x112e, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'no yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('applies mid-row italics underline', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - { ccData: characters('no'), type: 0 }, - // mid-row, italics underline - { ccData: 0x112f, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'no yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -// NOTE: With the exception of white italics PACs (the following two test -// cases), PACs only have their underline attribute extracted and used -QUnit.test('applies PAC underline', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - // PAC: row 15, white underline - { ccData: 0x1461, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('applies PAC white italics', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - // PAC: row 15, white italics - { ccData: 0x146e, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('applies PAC white italics underline', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - // PAC: row 15, white italics underline - { ccData: 0x146f, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('closes formatting at PAC row change', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // PAC: row 14, white italics underlime - { ccData: 0x144f, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // PAC: row 15, indent 0 - { ccData: 0x1470, type: 0 }, - { ccData: characters('no'), type: 0 }, - // EOC, End of Caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'yes.\nno', 'properly closed by PAC row change'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('closes formatting at EOC', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // PAC: row 15, white italics underline - { ccData: 0x146f, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // EOC, End of Caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'yes.', 'properly closed by EOC'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('closes formatting at negating mid-row code', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - { ccData: characters('no'), type: 0 }, - // mid-row: italics underline - { ccData: 0x112f, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // mid-row: white - { ccData: 0x1120, type: 0 }, - { ccData: characters('no'), type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - cea608Stream.flushDisplayed(); - assert.equal(captions[0].text, 'no yes. no', 'properly closed by negating mid-row code'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('roll-up display mode', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0}, - // '01' - { - pts: 1 * 1000, - ccData: characters('01'), - type: 0 - }, - // CR, carriage return - { pts: 3 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected one caption'); - assert.deepEqual(captions[0], { - startPts: 0 * 1000, - endPts: 3 * 1000, - text: '01', - stream: 'CC1' - }, 'parsed the caption'); - captions = []; - - [ // RU4, roll-up captions 4 rows - { ccdata: 0x1427, type: 0 }, - // '23' - { - pts: 4 * 1000, - ccData: characters('23'), - type: 0, - stream: 'CC1' - }, - // CR - { pts: 5 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected another caption'); - assert.deepEqual(captions[0], { - startPts: 3 * 1000, - endPts: 5 * 1000, - text: '01\n23', - stream: 'CC1' - }, 'parsed the new caption and kept the caption up after the new caption'); -}); - -QUnit.test('roll-up displays multiple rows simultaneously', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0, - stream: 'CC1' - }, - // CR, carriage return - { pts: 1 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.deepEqual(captions[0], { - startPts: 0 * 1000, - endPts: 1 * 1000, - text: '01', - stream: 'CC1' - }, 'created a caption for the first period'); - captions = []; - - [ // '23' - { - pts: 2 * 1000, - ccData: characters('23'), - type: 0, - stream: 'CC1' - }, - // CR, carriage return - { pts: 3 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected another caption'); - assert.deepEqual(captions[0], { - startPts: 1 * 1000, - endPts: 3 * 1000, - text: '01\n23', - stream: 'CC1' - }, 'created the top and bottom rows after the shift up'); - captions = []; - - [ // '45' - { - pts: 4 * 1000, - ccData: characters('45'), - type: 0, - stream: 'CC1' - }, - // CR, carriage return - { pts: 5 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected third caption'); - assert.deepEqual(captions[0], { - startPts: 3 * 1000, - endPts: 5 * 1000, - text: '23\n45', - stream: 'CC1' - }, 'created the top and bottom rows after the shift up'); -}); - -QUnit.test('the roll-up count can be changed on-the-fly', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0, - stream: 'CC1' - }, - // CR, carriage return - { pts: 1 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - captions = []; - - [ // RU3, roll-up captions 3 rows - { ccData: 0x1426, type: 0 }, - // CR, carriage return - { pts: 2 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'still displaying a caption'); - captions = []; - - [ // RU4, roll-up captions 4 rows - { ccData: 0x1427, type: 0 }, - // CR, carriage return - { pts: 3 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'still displaying a caption'); - captions = []; - - // RU3, roll-up captions 3 rows - cea608Stream.push({ ccdata: 0x1426, type: 0 }); - assert.equal(captions.length, 0, 'cleared the caption'); -}); - -QUnit.test('switching to roll-up from pop-on wipes memories and flushes captions', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RCL (resume caption loading) - { pts: 0 * 1000, ccData: 0x1420, type: 0 }, - { pts: 0 * 1000, ccData: characters('hi'), type: 0 }, - // EOC (end of caption), mark 1st caption start - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL, resume caption loading - { pts: 1 * 1000, ccData: 0x1420, type: 0 }, - { pts: 2 * 1000, ccData: characters('oh'), type: 0 }, - // EOC, mark 2nd caption start and flush 1st caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 }, - // RU2 (roll-up, 2 rows), flush 2nd caption - { pts: 3 * 1000, ccData: 0x1425, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - var displayed = cea608Stream.displayed_.reduce(function(acc, val) { - acc += val; - return acc; - }); - var nonDisplayed = cea608Stream.nonDisplayed_.reduce(function(acc, val) { - acc += val; - return acc; - }); - - assert.equal(captions.length, 2, 'both captions flushed'); - assert.equal(displayed, '', 'displayed memory is wiped'); - assert.equal(nonDisplayed, '', 'non-displayed memory is wiped'); - assert.deepEqual(captions[0], { - startPts: 1000, - endPts: 2000, - text: 'hi', - stream: 'CC1' - }, 'first caption correct'); - assert.deepEqual(captions[1], { - startPts: 2000, - endPts: 3000, - text: 'oh', - stream: 'CC1' - }, 'second caption correct'); -}); - -QUnit.test('switching to roll-up from paint-on wipes memories and flushes captions', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RDC (resume direct captioning) - { pts: 0 * 1000, ccData: 0x1429, type: 0 }, - { pts: 0 * 1000, ccData: characters('hi'), type: 0 }, - // RU2 (roll-up, 2 rows), flush displayed caption - { pts: 1 * 1000, ccData: 0x1425, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - var displayed = cea608Stream.displayed_.reduce(function(acc, val) { - acc += val; - return acc; - }); - var nonDisplayed = cea608Stream.nonDisplayed_.reduce(function(acc, val) { - acc += val; - return acc; - }); - - assert.equal(captions.length, 1, 'flushed caption'); - assert.equal(displayed, '', 'displayed memory is wiped'); - assert.equal(nonDisplayed, '', 'non-displayed memory is wiped'); - assert.deepEqual(captions[0], { - startPts: 0, - endPts: 1000, - text: 'hi', - stream: 'CC1' - }, 'caption correct'); -}); - -// NOTE: This should change to not wiping the display when caption -// positioning is properly implemented -QUnit.test('switching to paint-on from pop-on flushes display', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RCL (resume caption loading) - { pts: 0 * 1000, ccData: 0x1420, type: 0 }, - // PAC: row 14, indent 0 - { pts: 0 * 1000, ccData: 0x1450, type: 0 }, - { pts: 0 * 1000, ccData: characters('hi'), type: 0 }, - // EOC (end of caption), mark caption start - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL - { pts: 1 * 1000, ccData: 0x1420, type: 0 }, - // RDC (resume direct captioning), flush caption - { pts: 2 * 1000, ccData: 0x1429, type: 0 }, - // PAC: row 14, indent 0 - { pts: 2 * 1000, ccData: 0x1450, type: 0 }, - // TO1 (tab offset 1 column) - { pts: 2 * 1000, ccData: 0x1721, type: 0 }, - { pts: 3 * 1000, ccData: characters('io'), type: 0 }, - // EDM (erase displayed memory), flush paint-on caption - { pts: 4 * 1000, ccData: 0x142c, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 2, 'detected 2 captions'); - assert.equal(captions[0].text, 'hi', 'pop-on caption received'); - assert.equal(captions[0].startPts, 1000, 'proper start pts'); - assert.equal(captions[0].endPts, 2000, 'proper end pts'); - assert.equal(captions[1].text, 'io', 'paint-on caption received'); - assert.equal(captions[1].startPts, 2000, 'proper start pts'); - assert.equal(captions[1].endPts, 4000, 'proper end pts'); -}); - -QUnit.test('backspaces are reflected in the generated captions', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // backspace - { ccData: 0x1421, type: 0 }, - { - pts: 1 * 1000, - ccData: characters('23'), - type: 0 - }, - // CR, carriage return - { pts: 1 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.equal(captions[0].text, '023', 'applied the backspace'); -}); - -QUnit.test('backspaces can remove a caption entirely', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // backspace - { ccData: 0x1421, type: 0 }, - // Send another command so that the backspace isn't - // ignored as a duplicate command - { ccData: 0x1425, type: 0 }, - // backspace - { ccData: 0x1421, type: 0 }, - // CR, carriage return - { pts: 1 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 0, 'no caption emitted'); -}); - -QUnit.test('a second identical control code immediately following the first is ignored', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // '02' - { - pts: 1 * 1000, - ccData: characters('02'), - type: 0 - }, - // backspace - { ccData: 0x1421, type: 0 }, - // backspace - { ccData: 0x1421, type: 0 }, // duplicate is ignored - // backspace - { ccData: 0x1421, type: 0 }, - // CR, carriage return - { pts: 2 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].text, '01', 'only two backspaces processed'); -}); - -QUnit.test('a second identical control code separated by only padding from the first is ignored', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // '02' - { - pts: 1 * 1000, - ccData: characters('02'), - type: 0 - }, - // backspace - { ccData: 0x1421, type: 0 }, - // padding - { ccData: 0x0000, type: 0 }, - { ccData: 0x0000, type: 0 }, - { ccData: 0x0000, type: 0 }, - // backspace - { pts: 2 * 1000, ccData: 0x1421, type: 0 }, // duplicate is ignored - // CR, carriage return - { pts: 3 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].text, '010', 'only one backspace processed'); -}); - -QUnit.test('preamble address codes on same row are NOT converted into spaces', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // PAC: row 15, indent 0 - { ccData: 0x1470, type: 0 }, - // '02' - { - pts: 1 * 1000, - ccData: characters('02'), - type: 0 - }, - // CR, carriage return - { pts: 2 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].text, '0102', 'PACs were NOT converted to space'); -}); - -QUnit.test('preserves newlines from PACs in pop-on mode', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // ENM, erase non-displayed memory - { ccData: 0x142e, type: 0 }, - // PAC: row 12, indent 0 - { ccData: 0x1350, type: 0 }, - // text: TEST - { ccData: 0x5445, type: 0 }, - { ccData: 0x5354, type: 0 }, - // PAC: row 14, indent 0 - { ccData: 0x1450, type: 0 }, - // text: STRING - { ccData: 0x5354, type: 0 }, - { ccData: 0x5249, type: 0 }, - { ccData: 0x4e47, type: 0 }, - // PAC: row 15, indent 0 - { ccData: 0x1470, type: 0 }, - // text: DATA - { ccData: 0x4441, type: 0 }, - { ccData: 0x5441, type: 0 }, - // EOC, end of caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // EOC, duplicated as per spec - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // EOC, dispatch caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].text, 'TEST\n\nSTRING\nDATA', 'Position PACs were converted to newlines'); -}); - -QUnit.test('extracts real-world cc1 and cc3 channels', function(assert) { - var cea608Stream1 = cea608Stream; - var cea608Stream3 = new m2ts.Cea608Stream(1, 0); - var captions = []; - cea608Stream1.on('data', function(caption) { - captions.push(caption); - }); - cea608Stream3.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - { pts: 425316, type: 0, ccData: 5158 }, // RU3 - { pts: 431322, type: 0, ccData: 5165 }, // CR - { pts: 440331, type: 0, ccData: 4944 }, // position 11,0 - { pts: 443334, type: 0, ccData: 20549 }, // PE - { pts: 449340, type: 0, ccData: 21065 }, // RI - { pts: 449340, type: 0, ccData: 0 }, // padding - { pts: 452343, type: 0, ccData: 20292 }, // OD - { pts: 458349, type: 0, ccData: 11264 }, // , - { pts: 458349, type: 0, ccData: 0 }, // padding - { pts: 461352, type: 0, ccData: 0 }, // padding - { pts: 467358, type: 0, ccData: 8192 }, // (space) - { pts: 467358, type: 0, ccData: 17920 }, // F - { pts: 470361, type: 0, ccData: 0 }, // padding - { pts: 476367, type: 0, ccData: 0 }, // padding - { pts: 476367, type: 0, ccData: 20300 }, // OL - { pts: 479370, type: 0, ccData: 19283 }, // KS - { pts: 485376, type: 0, ccData: 0 }, // padding - { pts: 485376, type: 0, ccData: 11776 }, // . - { pts: 674565, type: 0, ccData: 5158 }, // RU3 - { pts: 677568, type: 0, ccData: 5165 }, // CR - { pts: 371262, type: 1, ccData: 5414 }, // RU3 - { pts: 377268, type: 1, ccData: 0 }, // padding - { pts: 377268, type: 1, ccData: 4944 }, // position 11,0 - { pts: 380271, type: 1, ccData: 0 }, // padding - { pts: 386277, type: 1, ccData: 4412 }, // ê - { pts: 386277, type: 1, ccData: 0 }, // padding - { pts: 389280, type: 1, ccData: 29810 }, // tr - { pts: 395286, type: 1, ccData: 25888 }, // e(space) - { pts: 395286, type: 1, ccData: 30062 }, // un - { pts: 398289, type: 1, ccData: 25888 }, // e(space) - { pts: 404295, type: 1, ccData: 28764 }, // pé - { pts: 404295, type: 1, ccData: 29289 }, // ri - { pts: 407298, type: 1, ccData: 28516 }, // od - { pts: 413304, type: 1, ccData: 25856 }, // e - { pts: 413304, type: 1, ccData: 0 }, // padding - { pts: 443334, type: 1, ccData: 8292 }, // (space)d - { pts: 449340, type: 1, ccData: 25888 }, // e(space) - { pts: 449340, type: 1, ccData: 29045 }, // qu - { pts: 452343, type: 1, ccData: 25971 }, // es - { pts: 458349, type: 1, ccData: 29801 }, // ti - { pts: 458349, type: 1, ccData: 28526 }, // on - { pts: 461352, type: 1, ccData: 29440 }, // s - { pts: 467358, type: 1, ccData: 5421 }, // CR - { pts: 467358, type: 1, ccData: 0 }, // padding - { pts: 470361, type: 1, ccData: 5414 }, // RU3 - { pts: 476367, type: 1, ccData: 0 } // padding - ]; - - packets.forEach(function(packet) { - cea608Stream1.push(packet); - cea608Stream3.push(packet); - }); - - var cc1 = {stream: 'CC1', text: 'PERIOD, FOLKS.'}; - var cc3 = {stream: 'CC3', text: 'être une période de questions'}; - - assert.equal(captions.length, 2, 'caption emitted'); - assert.equal(captions[0].stream, cc1.stream, 'cc1 stream detected'); - assert.equal(captions[0].text, cc1.text, 'cc1 stream extracted successfully'); - assert.equal(captions[1].stream, cc3.stream, 'cc3 stream detected'); - assert.equal(captions[1].text, cc3.text, 'cc3 stream extracted successfully'); -}); - -QUnit.test('backspaces stop at the beginning of the line', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // backspace - { ccData: 0x1421, type: 0 }, - // Send another command so that the backspace isn't - // ignored as a duplicate command - { ccData: 0x1425, type: 0 }, - // backspace - { ccData: 0x1421, type: 0 }, - // Send another command so that the backspace isn't - // ignored as a duplicate command - { ccData: 0x1425, type: 0 }, - // backspace - { ccData: 0x1421, type: 0 }, - // CR, carriage return - { pts: 1 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 0, 'no caption emitted'); -}); - -QUnit.test('reset works', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - [ // RU2, roll-up captions 2 rows - { pts: 0, ccData: 0x1425, type: 0 }, - // mid-row: white underline - { pts: 0, ccData: 0x1121, type: 0 }, - { pts: 0, ccData: characters('01'), type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - var buffer = cea608Stream.displayed_.map(function(row) { - return row.trim(); - }).join('\n') - .replace(/^\n+|\n+$/g, ''); - - assert.equal(buffer, '01', 'buffer is as expected'); - - cea608Stream.reset(); - buffer = cea608Stream.displayed_ - .map(function(row) { - return row.trim(); - }) - .join('\n') - .replace(/^\n+|\n+$/g, ''); - assert.equal(buffer, '', 'displayed buffer reset successfully'); - assert.equal(cea608Stream.lastControlCode_, null, 'last control code reset successfully'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting was reset'); - -}); - - -QUnit.test('paint-on mode', function(assert) { - var packets, captions; - packets = [ - // RDC, resume direct captioning, begin display - { pts: 1000, ccData: 0x1429, type: 0 }, - { pts: 2000, ccData: characters('hi'), type: 0 }, - // EDM, erase displayed memory. Finish display, flush caption - { pts: 3000, ccData: 0x142c, type: 0 } - ]; - captions = []; - - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.deepEqual(captions[0], { - startPts: 1000, - endPts: 3000, - text: 'hi', - stream: 'CC1' - }, 'parsed the caption'); -}); - -QUnit.test('preserves newlines from PACs in paint-on mode', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RDC, resume direct captioning - { pts: 1000, ccData: 0x1429, type: 0 }, - // PAC: row 12, indent 0 - { pts: 1000, ccData: 0x1350, type: 0 }, - // text: TEST - { pts: 2000, ccData: 0x5445, type: 0 }, - { pts: 2000, ccData: 0x5354, type: 0 }, - // PAC: row 14, indent 0 - { pts: 3000, ccData: 0x1450, type: 0 }, - // text: STRING - { pts: 3000, ccData: 0x5354, type: 0 }, - { pts: 4000, ccData: 0x5249, type: 0 }, - { pts: 4000, ccData: 0x4e47, type: 0 }, - // PAC: row 15, indent 0 - { pts: 5000, ccData: 0x1470, type: 0 }, - // text: DATA - { pts: 5000, ccData: 0x4441, type: 0 }, - { pts: 6000, ccData: 0x5441, type: 0 }, - // EDM, erase displayed memory. Finish display, flush caption - { pts: 6000, ccData: 0x142c, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].text, 'TEST\n\nSTRING\nDATA', 'Position PACs were converted to newlines'); -}); - -QUnit.test('backspaces are reflected in the generated captions (paint-on)', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RDC, resume direct captioning - { ccData: 0x1429, type: 0 }, - // '01', default row 15 - { pts: 0 * 1000, ccData: characters('01'), type: 0 }, - // backspace - { pts: 0 * 1000, ccData: 0x1421, type: 0 }, - { pts: 1 * 1000, ccData: characters('23'), type: 0 }, - // PAC: row 13, indent 0 - { pts: 2 * 1000, ccData: 0x1370, type: 0 }, - { pts: 2 * 1000, ccData: characters('32'), type: 0 }, - // backspace - { pts: 3 * 1000, ccData: 0x1421, type: 0 }, - { pts: 4 * 1000, ccData: characters('10'), type: 0 }, - // EDM, erase displayed memory, flush caption - { pts: 5 * 1000, ccData: 0x142c, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.equal(captions[0].text, '310\n\n023', 'applied the backspaces'); -}); - -QUnit.test('mix of all modes (extract from CNN)', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RU2 (roll-up, 2 rows) - { pts: 6675, ccData: 0x1425, type: 0 }, - // CR (carriange return), flush nothing - { pts: 6675, ccData: 0x142d, type: 0 }, - // PAC: row 2, indent 0 - { pts: 6675, ccData: 0x1170, type: 0 }, - // text: YEAR. - { pts: 6676, ccData: 0x5945, type: 0 }, - { pts: 6676, ccData: 0x4152, type: 0 }, - { pts: 6676, ccData: 0x2e00, type: 0 }, - // RU2 (roll-up, 2 rows) - { pts: 6677, ccData: 0x1425, type: 0 }, - // CR (carriange return), flush 1 row - { pts: 6677, ccData: 0x142d, type: 0 }, - // PAC: row 2, indent 0 - { pts: 6677, ccData: 0x1170, type: 0 }, - // text: GO TO CNNHEROS.COM. - { pts: 6677, ccData: 0x474f, type: 0 }, - { pts: 6678, ccData: 0x2054, type: 0 }, - { pts: 6678, ccData: 0x4f00, type: 0 }, - { pts: 6678, ccData: 0x2043, type: 0 }, - { pts: 6679, ccData: 0x4e4e, type: 0 }, - { pts: 6679, ccData: 0x4845, type: 0 }, - { pts: 6679, ccData: 0x524f, type: 0 }, - { pts: 6680, ccData: 0x532e, type: 0 }, - { pts: 6680, ccData: 0x434f, type: 0 }, - { pts: 6680, ccData: 0x4d2e, type: 0 }, - // EDM (erase displayed memory), flush 2 displayed roll-up rows - { pts: 6697, ccData: 0x142c, type: 0 }, - // RDC (resume direct captioning), wipes memories, flushes nothing - { pts: 6749, ccData: 0x1429, type: 0 }, - // PAC: row 1, indent 0 - { pts: 6750, ccData: 0x1150, type: 0 }, - // text: Did your Senator or Congressman - { pts: 6750, ccData: 0x4469, type: 0 }, - { pts: 6750, ccData: 0x6420, type: 0 }, - { pts: 6750, ccData: 0x796f, type: 0 }, - { pts: 6751, ccData: 0x7572, type: 0 }, - { pts: 6751, ccData: 0x2053, type: 0 }, - { pts: 6751, ccData: 0x656e, type: 0 }, - { pts: 6752, ccData: 0x6174, type: 0 }, - { pts: 6752, ccData: 0x6f72, type: 0 }, - { pts: 6752, ccData: 0x206f, type: 0 }, - { pts: 6753, ccData: 0x7220, type: 0 }, - { pts: 6753, ccData: 0x436f, type: 0 }, - { pts: 6753, ccData: 0x6e67, type: 0 }, - { pts: 6753, ccData: 0x7265, type: 0 }, - { pts: 6754, ccData: 0x7373, type: 0 }, - { pts: 6754, ccData: 0x6d61, type: 0 }, - { pts: 6754, ccData: 0x6e00, type: 0 }, - // PAC: row 2, indent 0 - { pts: 6755, ccData: 0x1170, type: 0 }, - // TO2 (tab offset 2 columns) - { pts: 6755, ccData: 0x1722, type: 0 }, - // text: get elected by talking tough - { pts: 6755, ccData: 0x6765, type: 0 }, - { pts: 6756, ccData: 0x7420, type: 0 }, - { pts: 6756, ccData: 0x656c, type: 0 }, - { pts: 6756, ccData: 0x6563, type: 0 }, - { pts: 6756, ccData: 0x7465, type: 0 }, - { pts: 6757, ccData: 0x6420, type: 0 }, - { pts: 6757, ccData: 0x6279, type: 0 }, - { pts: 6757, ccData: 0x2074, type: 0 }, - { pts: 6758, ccData: 0x616c, type: 0 }, - { pts: 6758, ccData: 0x6b69, type: 0 }, - { pts: 6758, ccData: 0x6e67, type: 0 }, - { pts: 6759, ccData: 0x2074, type: 0 }, - { pts: 6759, ccData: 0x6f75, type: 0 }, - { pts: 6759, ccData: 0x6768, type: 0 }, - // RCL (resume caption loading) - { pts: 6759, ccData: 0x1420, type: 0 }, - // PAC: row 1, indent 4 - { pts: 6760, ccData: 0x1152, type: 0 }, - // TO1 (tab offset 1 column) - { pts: 6760, ccData: 0x1721, type: 0 }, - // text: on the national debt? - { pts: 6760, ccData: 0x6f6e, type: 0 }, - { pts: 6761, ccData: 0x2074, type: 0 }, - { pts: 6761, ccData: 0x6865, type: 0 }, - { pts: 6761, ccData: 0x206e, type: 0 }, - { pts: 6762, ccData: 0x6174, type: 0 }, - { pts: 6762, ccData: 0x696f, type: 0 }, - { pts: 6762, ccData: 0x6e61, type: 0 }, - { pts: 6762, ccData: 0x6c20, type: 0 }, - { pts: 6763, ccData: 0x6465, type: 0 }, - { pts: 6763, ccData: 0x6274, type: 0 }, - { pts: 6763, ccData: 0x3f00, type: 0 }, - // RCL (resume caption loading) - { pts: 6781, ccData: 0x1420, type: 0 }, - // EDM (erase displayed memory), flush paint-on caption - { pts: 6781, ccData: 0x142c, type: 0 }, - // EOC (end of caption), mark pop-on caption 1 start - { pts: 6782, ccData: 0x142f, type: 0 }, - // RCL (resume caption loading) - { pts: 6782, ccData: 0x1420, type: 0 }, - // PAC: row 1, indent 4 - { pts: 6782, ccData: 0x1152, type: 0 }, - // TO2 (tab offset 2 columns) - { pts: 6783, ccData: 0x1722, type: 0 }, - // text: Will they stay true - { pts: 6783, ccData: 0x5769, type: 0 }, - { pts: 6783, ccData: 0x6c6c, type: 0 }, - { pts: 6783, ccData: 0x2074, type: 0 }, - { pts: 6784, ccData: 0x6865, type: 0 }, - { pts: 6784, ccData: 0x7920, type: 0 }, - { pts: 6784, ccData: 0x7374, type: 0 }, - { pts: 6785, ccData: 0x6179, type: 0 }, - { pts: 6785, ccData: 0x2074, type: 0 }, - { pts: 6785, ccData: 0x7275, type: 0 }, - { pts: 6786, ccData: 0x6500, type: 0 }, - // PAC: row 2, indent 8 - { pts: 6786, ccData: 0x1174, type: 0 }, - // text: to their words? - { pts: 6786, ccData: 0x746f, type: 0 }, - { pts: 6786, ccData: 0x2074, type: 0 }, - { pts: 6787, ccData: 0x6865, type: 0 }, - { pts: 6787, ccData: 0x6972, type: 0 }, - { pts: 6787, ccData: 0x2077, type: 0 }, - { pts: 6788, ccData: 0x6f72, type: 0 }, - { pts: 6788, ccData: 0x6473, type: 0 }, - { pts: 6788, ccData: 0x3f00, type: 0 }, - // RCL (resume caption loading) - { pts: 6797, ccData: 0x1420, type: 0 }, - // EDM (erase displayed memory), mark pop-on caption 1 end and flush - { pts: 6797, ccData: 0x142c, type: 0 }, - // EOC (end of caption), mark pop-on caption 2 start, flush nothing - { pts: 6798, ccData: 0x142f, type: 0 }, - // RCL - { pts: 6799, ccData: 0x1420, type: 0 }, - // EOC, mark pop-on caption 2 end and flush - { pts: 6838, ccData: 0x142f, type: 0 }, - // RU2 (roll-up, 2 rows), wipes memories - { pts: 6841, ccData: 0x1425, type: 0 }, - // CR (carriage return), flush nothing - { pts: 6841, ccData: 0x142d, type: 0 }, - // PAC: row 2, indent 0 - { pts: 6841, ccData: 0x1170, type: 0 }, - // text: NO MORE SPECULATION, NO MORE - { pts: 6841, ccData: 0x3e3e, type: 0 }, - { pts: 6841, ccData: 0x3e00, type: 0 }, - { pts: 6842, ccData: 0x204e, type: 0 }, - { pts: 6842, ccData: 0x4f00, type: 0 }, - { pts: 6842, ccData: 0x204d, type: 0 }, - { pts: 6842, ccData: 0x4f52, type: 0 }, - { pts: 6842, ccData: 0x4500, type: 0 }, - { pts: 6842, ccData: 0x2000, type: 0 }, - { pts: 6842, ccData: 0x5350, type: 0 }, - { pts: 6843, ccData: 0x4543, type: 0 }, - { pts: 6843, ccData: 0x554c, type: 0 }, - { pts: 6843, ccData: 0x4154, type: 0 }, - { pts: 6843, ccData: 0x494f, type: 0 }, - { pts: 6843, ccData: 0x4e2c, type: 0 }, - { pts: 6843, ccData: 0x204e, type: 0 }, - { pts: 6843, ccData: 0x4f00, type: 0 }, - { pts: 6843, ccData: 0x204d, type: 0 }, - { pts: 6844, ccData: 0x4f52, type: 0 }, - { pts: 6844, ccData: 0x4500, type: 0 }, - // RU2 (roll-up, two rows) - { pts: 6844, ccData: 0x1425, type: 0 }, - // CR (carriage return), flush 1 roll-up row - { pts: 6844, ccData: 0x142d, type: 0 }, - // PAC: row 2, indent 0 - { pts: 6844, ccData: 0x1170, type: 0 }, - // text: RUMORS OR GUESSING GAMES. - { pts: 6844, ccData: 0x5255, type: 0 }, - { pts: 6844, ccData: 0x4d4f, type: 0 }, - { pts: 6844, ccData: 0x5253, type: 0 }, - { pts: 6844, ccData: 0x204f, type: 0 }, - { pts: 6845, ccData: 0x5200, type: 0 }, - { pts: 6845, ccData: 0x2047, type: 0 }, - { pts: 6845, ccData: 0x5545, type: 0 }, - { pts: 6845, ccData: 0x5353, type: 0 }, - { pts: 6845, ccData: 0x494e, type: 0 }, - { pts: 6845, ccData: 0x4700, type: 0 }, - { pts: 6845, ccData: 0x2047, type: 0 }, - { pts: 6845, ccData: 0x414d, type: 0 }, - { pts: 6845, ccData: 0x4553, type: 0 }, - { pts: 6845, ccData: 0x2e00, type: 0 }, - // RU2 (roll-up, 2 rows) - { pts: 6846, ccData: 0x1425, type: 0 }, - // CR (carriage return), flush 2 roll-up rows - { pts: 6846, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 7, 'detected 7 captions of varying types'); - assert.deepEqual(captions[0], { - startPts: 6675, - endPts: 6677, - text: 'YEAR.', - stream: 'CC1' - }, 'parsed the 1st roll-up caption'); - assert.deepEqual(captions[1], { - startPts: 6677, - endPts: 6697, - text: 'YEAR.\nGO TO CNNHEROS.COM.', - stream: 'CC1' - }, 'parsed the 2nd roll-up caption'); - assert.deepEqual(captions[2], { - startPts: 6749, - endPts: 6781, - text: 'Did your Senator or Congressman\nget elected by talking tough', - stream: 'CC1' - }, 'parsed the paint-on caption'); - assert.deepEqual(captions[3], { - startPts: 6782, - endPts: 6797, - text: 'on the national debt?', - stream: 'CC1' - }, 'parsed the 1st pop-on caption'); - assert.deepEqual(captions[4], { - startPts: 6798, - endPts: 6838, - text: 'Will they stay true\nto their words?', - stream: 'CC1' - }, 'parsed the 2nd pop-on caption'); - assert.deepEqual(captions[5], { - startPts: 6841, - endPts: 6844, - text: '>>> NO MORE SPECULATION, NO MORE', - stream: 'CC1' - }, 'parsed the 3rd roll-up caption'); - assert.deepEqual(captions[6], { - startPts: 6844, - endPts: 6846, - text: '>>> NO MORE SPECULATION, NO MORE\nRUMORS OR GUESSING GAMES.', - stream: 'CC1' - }, 'parsed the 4th roll-up caption'); - -}); - -QUnit.test('Cea608Stream will log errors, not throw an exception', function(assert) { - var result; - var originalConsole = console.error; - var logs = []; - - console.error = function(msg) { - logs.push(msg); - }; - - // this will force an exception to happen in flushDisplayed - cea608Stream.displayed_[0] = undefined; - - try { - cea608Stream.flushDisplayed(); - result = true; - } catch (e) { - result = false; - } - - assert.ok( - result, - 'the function does not throw an exception' - ); - assert.deepEqual( - logs, - [ - 'Skipping malformed caption.' - ], - 'warnings were logged to the console' - ); - - console.error = originalConsole; -}); - -var cea708Stream; - -QUnit.module('CEA 708 Stream', { - beforeEach: function() { - cea708Stream = new m2ts.Cea708Stream(); - } -}); - -QUnit.test('parses 708 captions', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - cc708PinkUnderscore.forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 235, 'parsed 235 captions'); - assert.deepEqual(captions[0], { - startPts: 6723335478, - endPts: 6723626769, - text: '\"Pinkalicious_and_Peterrific\"\nis_made_possible_in_part_by:', - stream: 'cc708_1' - }, 'parsed first caption correctly'); - assert.deepEqual(captions[1], { - startPts: 6723740883, - endPts: 6723945087, - text: 'GIRL:\nRead_me_the_tale\nof_a_faraway_land.', - stream: 'cc708_1' - }, 'parsed second caption correctly'); - assert.deepEqual(captions[2], { - startPts: 6723948090, - endPts: 6724200342, - text: 'Tell_me_of_planets\nwith_oceans_of_sand.', - stream: 'cc708_1' - }, 'parsed third caption correctly'); - assert.deepEqual(captions[33], { - startPts: 6732617751, - endPts: 6732876009, - text: '♪_It\'s_a_Pinkalicious_feeling_♪', - stream: 'cc708_1' - }, 'parsed caption 33 correctly with music note'); - assert.deepEqual(captions[38], { - startPts: 6734218350, - endPts: 6734425557, - text: 'PINKALICIOUS:\n\"Dream_Salon.\"', - stream: 'cc708_1' - }, 'parsed caption 38 correctly'); - assert.deepEqual(captions[234], { - startPts: 6778809897, - endPts: 6779104191, - text: 'I_guess_I\'ll_just_have\nto_duck_a_little_bit.', - stream: 'cc708_1' - }, 'parsed caption 234 correctly'); -}); - -QUnit.test('reset command', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - { type: 3, pts: 153315036, ccData: 0x8322 }, - { type: 2, pts: 153315036, ccData: 0x4820 }, - { type: 2, pts: 153315036, ccData: 0x0000 }, - { type: 3, pts: 153318039, ccData: 0xc322 }, - { type: 2, pts: 153318039, ccData: 0x4953 }, - { type: 2, pts: 153318039, ccData: 0x0000 }, - { type: 3, pts: 153387108, ccData: 0x0628 }, - { type: 2, pts: 153387108, ccData: 0x0d90 }, - { type: 2, pts: 153387108, ccData: 0x0503 }, - { type: 2, pts: 153387108, ccData: 0x912a }, - { type: 2, pts: 153387108, ccData: 0x002a }, - { type: 2, pts: 153387108, ccData: 0x0000 }, - { type: 3, pts: 153405126, ccData: 0x4da2 }, - { type: 2, pts: 153405126, ccData: 0x8c0f }, - { type: 2, pts: 153405126, ccData: 0x628c }, - { type: 2, pts: 153405126, ccData: 0x0f31 }, - { type: 2, pts: 153405126, ccData: 0x983b }, - { type: 2, pts: 153405126, ccData: 0x912a }, - { type: 2, pts: 153405126, ccData: 0x8f00 }, - { type: 2, pts: 153405126, ccData: 0x611f }, - { type: 2, pts: 153405126, ccData: 0x002a }, - { type: 2, pts: 153405126, ccData: 0x1090 }, - { type: 2, pts: 153405126, ccData: 0x0503 }, - { type: 3, pts: 153408129, ccData: 0x8a31 }, - { type: 2, pts: 153408129, ccData: 0x9201 }, - { type: 2, pts: 153408129, ccData: 0x983b }, - // RST (Reset command) - { type: 2, pts: 153408129, ccData: 0x8f00 }, - { type: 2, pts: 153408129, ccData: 0x0000 }, - { type: 2, pts: 153408129, ccData: 0x611f }, - { type: 2, pts: 153408129, ccData: 0x1090 }, - { type: 2, pts: 153408129, ccData: 0x0000 }, - { type: 2, pts: 153408129, ccData: 0x0503 }, - { type: 2, pts: 153408129, ccData: 0x912a }, - { type: 2, pts: 153408129, ccData: 0x0000 }, - { type: 2, pts: 153408129, ccData: 0x9201 }, - { type: 3, pts: 153414135, ccData: 0xc322 }, - { type: 2, pts: 153414135, ccData: 0x434f }, - { type: 2, pts: 153414135, ccData: 0x0000 } - ].forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 1, 'parsed 1 caption'); - assert.deepEqual(captions[0], { - startPts: 153315036, - endPts: 153408129, - text: '*\n;', - stream: 'cc708_1' - }, 'parsed the caption correctly'); -}); - -QUnit.test('windowing', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - { type: 3, pts: 1000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8000 }, // CW0 - { type: 2, pts: 1000, ccData: characters('w0') }, - - { type: 3, pts: 1000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8100 }, // CW1 - { type: 2, pts: 1000, ccData: characters('w1') }, - - { type: 3, pts: 1000, ccData: packetHeader708(2, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8200 }, // CW2 - { type: 2, pts: 1000, ccData: characters('w2') }, - - { type: 3, pts: 1000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8300 }, // CW3 - { type: 2, pts: 1000, ccData: characters('w3') }, - - { type: 3, pts: 1000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8400 }, // CW4 - { type: 2, pts: 1000, ccData: characters('w4') }, - - { type: 3, pts: 1000, ccData: packetHeader708(2, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8500 }, // CW5 - { type: 2, pts: 1000, ccData: characters('w5') }, - - { type: 3, pts: 1000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8600 }, // CW6 - { type: 2, pts: 1000, ccData: characters('w6') }, - - { type: 3, pts: 1000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8700 }, // CW7 - { type: 2, pts: 1000, ccData: characters('w7') }, - - { type: 3, pts: 2000, ccData: packetHeader708(2, 3, 1, 4) }, - { type: 2, pts: 2000, ccData: 0x8aff }, // HDW (Hide all) - { type: 2, pts: 2000, ccData: displayWindows708([0]) }, - - { type: 3, pts: 3000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 3000, ccData: 0x8aff }, // HDW (Hide all) - { type: 2, pts: 3000, ccData: displayWindows708([1]) }, - - { type: 3, pts: 4000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 4000, ccData: 0x8aff }, // HDW (Hide all) - { type: 2, pts: 4000, ccData: displayWindows708([2, 3]) }, - - { type: 3, pts: 5000, ccData: packetHeader708(2, 3, 1, 4) }, - { type: 2, pts: 5000, ccData: 0x8aff }, // HDW (Hide all) - { type: 2, pts: 5000, ccData: displayWindows708([3, 4]) }, - - { type: 3, pts: 6000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 6000, ccData: 0x8aff }, // HDW (Hide all) - { type: 2, pts: 6000, ccData: displayWindows708([5, 6, 7]) }, - - { type: 3, pts: 7000, ccData: packetHeader708(1, 2, 1, 2) }, - { type: 2, pts: 7000, ccData: 0x8aff }, // HDW (Hide all) - - // Indicate end of last packet - { type: 3, pts: 8000, ccData: packetHeader708(2, 1, 1, 0) } - ].forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 5, 'parsed 5 captions'); - assert.deepEqual(captions[0], { - startPts: 2000, - endPts: 3000, - text: 'w0', - stream: 'cc708_1' - }, 'parsed caption 0 correctly'); - assert.deepEqual(captions[1], { - startPts: 3000, - endPts: 4000, - text: 'w1', - stream: 'cc708_1' - }, 'parsed caption 1 correctly'); - assert.deepEqual(captions[2], { - startPts: 4000, - endPts: 5000, - text: 'w2\n\nw3', - stream: 'cc708_1' - }, 'parsed caption 2 correctly'); - assert.deepEqual(captions[3], { - startPts: 5000, - endPts: 6000, - text: 'w3\n\nw4', - stream: 'cc708_1' - }, 'parsed caption 3 correctly'); - assert.deepEqual(captions[4], { - startPts: 6000, - endPts: 7000, - text: 'w5\n\nw6\n\nw7', - stream: 'cc708_1' - }, 'parsed caption 4 correctly'); -}); - -QUnit.test('backspace', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - { type: 3, pts: 1000, ccData: packetHeader708(0, 7, 1, 12) }, - { type: 2, pts: 1000, ccData: 0x8000 }, // CW0 - { type: 2, pts: 1000, ccData: characters('ty') }, - { type: 2, pts: 1000, ccData: characters('op') }, - { type: 2, pts: 1000, ccData: 0x0808 }, // BS BS: Backspace twice - { type: 2, pts: 1000, ccData: characters('po') }, - { type: 2, pts: 1000, ccData: displayWindows708([0]) }, - - { type: 3, pts: 2000, ccData: packetHeader708(1, 2, 1, 2) }, - { type: 2, pts: 2000, ccData: 0x8aff }, - - // Indicate end of last packet - { type: 3, pts: 3000, ccData: packetHeader708(2, 1, 1, 0) } - ].forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 1, 'parsed 1 caption'); - assert.equal(captions[0].text, 'typo', 'parsed caption with backspaces correctly'); -}); - -QUnit.test('extended character set', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - { type: 3, pts: 1000, ccData: packetHeader708(0, 7, 1, 12) }, - { type: 2, pts: 1000, ccData: displayWindows708([0]) }, - { type: 2, pts: 1000, ccData: 0x8000 }, // CW0 - { type: 2, pts: 1000, ccData: 0x103f }, // Ÿ - { type: 2, pts: 1000, ccData: 0x1035 }, // • - { type: 2, pts: 1000, ccData: 0x103f }, // Ÿ - { type: 2, pts: 1000, ccData: 0x0020 }, - - { type: 3, pts: 1000, ccData: packetHeader708(1, 7, 1, 12) }, - { type: 2, pts: 1000, ccData: 0x103c }, // œ - { type: 2, pts: 1000, ccData: 0x102a }, // Š - { type: 2, pts: 1000, ccData: 0x1025 }, // … - { type: 2, pts: 1000, ccData: 0x102a }, // Š - { type: 2, pts: 1000, ccData: 0x103c }, // œ - { type: 2, pts: 1000, ccData: 0x0020 }, - - { type: 3, pts: 1000, ccData: packetHeader708(2, 5, 1, 8) }, - { type: 2, pts: 1000, ccData: 0x1033 }, // “ - { type: 2, pts: 1000, ccData: 0x103d }, // ℠ - { type: 2, pts: 1000, ccData: 0x1034 }, // ” - { type: 2, pts: 1000, ccData: 0x1039 }, // ™ - - { type: 3, pts: 2000, ccData: packetHeader708(0, 2, 1, 2) }, - { type: 2, pts: 2000, ccData: 0x8aff }, - - // Indicate end of last packet - { type: 3, pts: 3000, ccData: packetHeader708(1, 1, 1, 0) } - ].forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 1, 'parsed 1 caption'); - assert.equal(captions[0].text, 'Ÿ•Ÿ œŠ…Šœ “℠”™', 'parsed extended characters correctly'); -}); - -QUnit.test('roll up', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // Define window with two virtual rows (rowCount = 1) - { type: 3, pts: 1000, ccData: packetHeader708(0, 4, 1, 6) }, - { type: 2, pts: 1000, ccData: 0x983b }, - { type: 2, pts: 1000, ccData: 0x8f00 }, - { type: 2, pts: 1000, ccData: 0x611f }, - - { type: 3, pts: 1000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: characters('L1') }, - { type: 2, pts: 1000, ccData: 0x0d00 }, // CR - - { type: 3, pts: 2000, ccData: packetHeader708(2, 3, 1, 4) }, - { type: 2, pts: 2000, ccData: characters('L2') }, - { type: 2, pts: 2000, ccData: 0x0d00 }, // CR - - { type: 3, pts: 3000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 3000, ccData: characters('L3') }, - { type: 2, pts: 3000, ccData: 0x0d00 }, // CR - - { type: 3, pts: 4000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 4000, ccData: characters('L4') }, - { type: 2, pts: 4000, ccData: 0x0d00 }, // CR - - { type: 3, pts: 5000, ccData: packetHeader708(2, 2, 1, 2) }, - { type: 2, pts: 5000, ccData: 0x8aff }, - - // Indicate end of last packet - { type: 3, pts: 6000, ccData: packetHeader708(0, 1, 1, 0) } - ].forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 3, 'parsed 3 captions'); - assert.equal(captions[0].text, 'L1\nL2', 'parsed caption 1 correctly'); - assert.equal(captions[1].text, 'L2\nL3', 'parsed caption 2 correctly'); - assert.equal(captions[2].text, 'L3\nL4', 'parsed caption 3 correctly'); -}); diff --git a/node_modules/mux.js/test/captions.dfxp b/node_modules/mux.js/test/captions.dfxp deleted file mode 100644 index 6e38e97..0000000 --- a/node_modules/mux.js/test/captions.dfxp +++ /dev/null @@ -1,1114 +0,0 @@ - - - - - - - -
    - -

    - ASUKA 明日香, 飛鳥 f Japanese -

    - -

    - Он подчеркнул, что "вчера дал поручение коллегам из министерств". -

    - -

    - 🍒 🐑 💀 -

    -

    - 0:10.50 - 0:15.10 -

    -

    - 0:20.00 - 0:23.00 -

    -

    - 30 - 34 -

    -

    - 35 - 39 -

    -

    - 40 - 44 -

    -

    - 45 - 49 -

    -

    - 50 - 54 -

    -

    - 55 - 59 -

    -

    - 60 - 64 -

    -

    - 65 - 69 -

    -

    - 70 - 74 -

    -

    - 75 - 79 -

    -

    - 80 - 84 -

    -

    - 85 - 89 -

    -

    - 90 - 94 -

    -

    - 95 - 99 -

    -

    - 100 - 104 -

    -

    - 105 - 109 -

    -

    - 110 - 114 -

    -

    - 115 - 119 -

    -

    - 120 - 124 -

    -

    - 125 - 129 -

    -

    - 130 - 134 -

    -

    - 135 - 139 -

    -

    - 140 - 144 -

    -

    - 145 - 149 -

    -

    - 150 - 154 -

    -

    - 155 - 159 -

    -

    - 160 - 164 -

    -

    - 165 - 169 -

    -

    - 170 - 174 -

    -

    - 175 - 179 -

    -

    - 180 - 184 -

    -

    - 185 - 189 -

    -

    - 190 - 194 -

    -

    - 195 - 199 -

    -

    - 200 - 204 -

    -

    - 205 - 209 -

    -

    - 210 - 214 -

    -

    - 215 - 219 -

    -

    - 220 - 224 -

    -

    - 225 - 229 -

    -

    - 230 - 234 -

    -

    - 235 - 239 -

    -

    - 240 - 244 -

    -

    - 245 - 249 -

    -

    - 250 - 254 -

    -

    - 255 - 259 -

    -

    - 260 - 264 -

    -

    - 265 - 269 -

    -

    - 270 - 274 -

    -

    - 275 - 279 -

    -

    - 280 - 284 -

    -

    - 285 - 289 -

    -

    - 290 - 294 -

    -

    - 295 - 299 -

    -

    - 300 - 304 -

    -

    - 305 - 309 -

    -

    - 310 - 314 -

    -

    - 315 - 319 -

    -

    - 320 - 324 -

    -

    - 325 - 329 -

    -

    - 330 - 334 -

    -

    - 335 - 339 -

    -

    - 340 - 344 -

    -

    - 345 - 349 -

    -

    - 350 - 354 -

    -

    - 355 - 359 -

    -

    - 360 - 364 -

    -

    - 365 - 369 -

    -

    - 370 - 374 -

    -

    - 375 - 379 -

    -

    - 380 - 384 -

    -

    - 385 - 389 -

    -

    - 390 - 394 -

    -

    - 395 - 399 -

    -

    - 400 - 404 -

    -

    - 405 - 409 -

    -

    - 410 - 414 -

    -

    - 415 - 419 -

    -

    - 420 - 424 -

    -

    - 425 - 429 -

    -

    - 430 - 434 -

    -

    - 435 - 439 -

    -

    - 440 - 444 -

    -

    - 445 - 449 -

    -

    - 450 - 454 -

    -

    - 455 - 459 -

    -

    - 460 - 464 -

    -

    - 465 - 469 -

    -

    - 470 - 474 -

    -

    - 475 - 479 -

    -

    - 480 - 484 -

    -

    - 485 - 489 -

    -

    - 490 - 494 -

    -

    - 495 - 499 -

    -

    - 500 - 504 -

    -

    - 505 - 509 -

    -

    - 510 - 514 -

    -

    - 515 - 519 -

    -

    - 520 - 524 -

    -

    - 525 - 529 -

    -

    - 530 - 534 -

    -

    - 535 - 539 -

    -

    - 540 - 544 -

    -

    - 545 - 549 -

    -

    - 550 - 554 -

    -

    - 555 - 559 -

    -

    - 560 - 564 -

    -

    - 565 - 569 -

    -

    - 570 - 574 -

    -

    - 575 - 579 -

    -

    - 580 - 584 -

    -

    - 585 - 589 -

    -

    - 590 - 594 -

    -

    - 595 - 599 -

    -

    - 600 - 604 -

    -

    - 605 - 609 -

    -

    - 610 - 614 -

    -

    - 615 - 619 -

    -

    - 620 - 624 -

    -

    - 625 - 629 -

    -

    - 630 - 634 -

    -

    - 635 - 639 -

    -

    - 640 - 644 -

    -

    - 645 - 649 -

    -

    - 650 - 654 -

    -

    - 655 - 659 -

    -

    - 660 - 664 -

    -

    - 665 - 669 -

    -

    - 670 - 674 -

    -

    - 675 - 679 -

    -

    - 680 - 684 -

    -

    - 685 - 689 -

    -

    - 690 - 694 -

    -

    - 695 - 699 -

    -

    - 700 - 704 -

    -

    - 705 - 709 -

    -

    - 710 - 714 -

    -

    - 715 - 719 -

    -

    - 720 - 724 -

    -

    - 725 - 729 -

    -

    - 730 - 734 -

    -

    - 735 - 739 -

    -

    - 740 - 744 -

    -

    - 745 - 749 -

    -

    - 750 - 754 -

    -

    - 755 - 759 -

    -

    - 760 - 764 -

    -

    - 765 - 769 -

    -

    - 770 - 774 -

    -

    - 775 - 779 -

    -

    - 780 - 784 -

    -

    - 785 - 789 -

    -

    - 790 - 794 -

    -

    - 795 - 799 -

    -

    - 800 - 804 -

    -

    - 805 - 809 -

    -

    - 810 - 814 -

    -

    - 815 - 819 -

    -

    - 820 - 824 -

    -

    - 825 - 829 -

    -

    - 830 - 834 -

    -

    - 835 - 839 -

    -

    - 840 - 844 -

    -

    - 845 - 849 -

    -

    - 850 - 854 -

    -

    - 855 - 859 -

    -

    - 860 - 864 -

    -

    - 865 - 869 -

    -

    - 870 - 874 -

    -

    - 875 - 879 -

    -

    - 880 - 884 -

    -

    - 885 - 889 -

    -

    - 890 - 894 -

    -

    - 895 - 899 -

    -

    - 900 - 904 -

    -

    - 905 - 909 -

    -

    - 910 - 914 -

    -

    - 915 - 919 -

    -

    - 920 - 924 -

    -

    - 925 - 929 -

    -

    - 930 - 934 -

    -

    - 935 - 939 -

    -

    - 940 - 944 -

    -

    - 945 - 949 -

    -

    - 950 - 954 -

    -

    - 955 - 959 -

    -

    - 960 - 964 -

    -

    - 965 - 969 -

    -

    - 970 - 974 -

    -

    - 975 - 979 -

    -

    - 980 - 984 -

    -

    - 985 - 989 -

    -

    - 990 - 994 -

    -

    - 995 - 999 -

    -

    - 1000 - 1004 -

    -

    - 1005 - 1009 -

    -

    - 1010 - 1014 -

    -

    - 1015 - 1019 -

    -

    - 1020 - 1024 -

    -

    - 1025 - 1029 -

    -

    - 1030 - 1034 -

    -

    - 1035 - 1039 -

    -

    - 1040 - 1044 -

    -

    - 1045 - 1049 -

    -

    - 1050 - 1054 -

    -

    - 1055 - 1059 -

    -

    - 1060 - 1064 -

    -

    - 1065 - 1069 -

    -

    - 1070 - 1074 -

    -

    - 1075 - 1079 -

    -

    - 1080 - 1084 -

    -

    - 1085 - 1089 -

    -

    - 1090 - 1094 -

    -

    - 1095 - 1099 -

    -

    - 1100 - 1104 -

    -

    - 1105 - 1109 -

    -

    - 1110 - 1114 -

    -

    - 1115 - 1119 -

    -

    - 1120 - 1124 -

    -

    - 1125 - 1129 -

    -

    - 1130 - 1134 -

    -

    - 1135 - 1139 -

    -

    - 1140 - 1144 -

    -

    - 1145 - 1149 -

    -

    - 1150 - 1154 -

    -

    - 1155 - 1159 -

    -

    - 1160 - 1164 -

    -

    - 1165 - 1169 -

    -

    - 1170 - 1174 -

    -

    - 1175 - 1179 -

    -

    - 1180 - 1184 -

    -

    - 1185 - 1189 -

    -

    - 1190 - 1194 -

    -

    - 1195 - 1199 -

    -

    - 1200 - 1204 -

    -

    - 1205 - 1209 -

    -

    - 1210 - 1214 -

    -

    - 1215 - 1219 -

    -

    - 1220 - 1224 -

    -

    - 1225 - 1229 -

    -

    - 1230 - 1234 -

    -

    - 1235 - 1239 -

    -

    - 1240 - 1244 -

    -

    - 1245 - 1249 -

    -

    - 1250 - 1254 -

    -

    - 1255 - 1259 -

    -

    - 1260 - 1264 -

    -

    - 1265 - 1269 -

    -

    - 1270 - 1274 -

    -

    - 1275 - 1279 -

    -

    - 1280 - 1284 -

    -

    - 1285 - 1289 -

    -

    - 1290 - 1294 -

    -

    - 1295 - 1299 -

    -

    - 1300 - 1304 -

    -

    - 1305 - 1309 -

    -

    - 1310 - 1314 -

    -

    - 1315 - 1319 -

    -

    - 1320 - 1324 -

    -

    - 1325 - 1329 -

    -

    - 1330 - 1334 -

    -

    - 1335 - 1339 -

    -

    - 1340 - 1344 -

    -

    - 1345 - 1349 -

    -

    - 1350 - 1354 -

    -

    - 1355 - 1359 -

    -

    - 1360 - 1364 -

    -

    - 1365 - 1369 -

    -

    - 1370 - 1374 -

    -

    - 1375 - 1379 -

    -

    - 1380 - 1384 -

    -

    - 1385 - 1389 -

    -

    - 1390 - 1394 -

    -

    - 1395 - 1399 -

    -

    - 1400 - 1404 -

    -

    - 1405 - 1409 -

    -

    - 1410 - 1414 -

    -

    - 1415 - 1419 -

    -

    - 1420 - 1424 -

    -

    - 1425 - 1429 -

    -

    - 1430 - 1434 -

    -

    - 1435 - 1439 -

    -

    - 1440 - 1444 -

    -

    - 1445 - 1449 -

    -

    - 1450 - 1454 -

    -

    - 1455 - 1459 -

    -

    - 1460 - 1464 -

    -

    - 1465 - 1469 -

    -

    - 1470 - 1474 -

    -

    - 1475 - 1479 -

    -

    - 1480 - 1484 -

    -

    - 1485 - 1489 -

    -

    - 1490 - 1494 -

    -

    - 1495 - 1499 -

    -

    - 1500 - 1504 -

    -

    - 1505 - 1509 -

    -

    - 1510 - 1514 -

    -

    - 1515 - 1519 -

    -

    - 1520 - 1524 -

    -

    - 1525 - 1529 -

    -

    - 1530 - 1534 -

    -

    - 1535 - 1539 -

    -

    - 1540 - 1544 -

    -

    - 1545 - 1549 -

    -

    - 1550 - 1554 -

    -

    - 1555 - 1559 -

    -

    - 1560 - 1564 -

    -

    - 1565 - 1569 -

    -

    - 1570 - 1574 -

    -

    - 1575 - 1579 -

    -

    - 1580 - 1584 -

    -

    - 1585 - 1589 -

    -

    - 1590 - 1594 -

    -

    - 1595 - 1599 -

    -

    - 1600 - 1604 -

    -

    - 1605 - 1609 -

    -

    - 1610 - 1614 -

    -

    - 1615 - 1619 -

    -

    - 1620 - 1624 -

    -

    - 1625 - 1629 -

    -

    - 1630 - 1634 -

    -

    - 1635 - 1639 -

    -

    - 1640 - 1644 -

    -

    - 1645 - 1649 -

    -

    - 1650 - 1654 -

    -

    - 1655 - 1659 -

    -

    - 1660 - 1664 -

    -

    - 1665 - 1669 -

    -

    - 1670 - 1674 -

    -

    - 1675 - 1679 -

    -

    - 1680 - 1684 -

    -

    - 1685 - 1689 -

    -

    - 1690 - 1694 -

    -

    - 1695 - 1699 -

    -

    - 1700 - 1704 -

    -

    - 1705 - 1709 -

    -

    - 1710 - 1714 -

    -

    - 1715 - 1719 -

    -

    - 1720 - 1724 -

    -

    - 1725 - 1729 -

    -

    - 1730 - 1734 -

    -

    - 1735 - 1739 -

    -

    - 1740 - 1744 -

    -

    - 1745 - 1749 -

    -

    - 1750 - 1754 -

    -

    - 1755 - 1759 -

    -

    - 1760 - 1764 -

    -

    - 1765 - 1769 -

    -

    - 1770 - 1774 -

    -

    - 1775 - 1779 -

    -

    - 1780 - 1784 -

    -

    - 1785 - 1789 -

    -

    - 1790 - 1794 -

    -

    - 1795 - 1799 -

    -

    - 1800 - 1804 -

    -

    - 1805 - 1809 -

    -

    - 1810 - 1814 -

    -

    - 1815 - 1819 -

    -

    - 1820 - 1824 -

    -

    - 1825 - 1829 -

    - - -

    - This is the final caption. -

    -
    - -
    diff --git a/node_modules/mux.js/test/exp-golomb.test.js b/node_modules/mux.js/test/exp-golomb.test.js deleted file mode 100644 index 83e602c..0000000 --- a/node_modules/mux.js/test/exp-golomb.test.js +++ /dev/null @@ -1,113 +0,0 @@ - /* - ======== A Handy Little QUnit Reference ======== - http://api.qunitjs.com/ - - Test methods: - module(name, {[setup][ ,teardown]}) - test(name, callback) - expect(numberOfAssertions) - stop(increment) - start(decrement) - Test assertions: - assert.ok(value, [message]) - assert.equal(actual, expected, [message]) - assert.notEqual(actual, expected, [message]) - assert.deepEqual(actual, expected, [message]) - assert.notDeepEqual(actual, expected, [message]) - assert.strictEqual(actual, expected, [message]) - assert.notStrictEqual(actual, expected, [message]) - assert.throws(block, [expected], [message]) - */ -var - buffer, - ExpGolomb = require('../lib/utils/exp-golomb'), - expGolomb; - -QUnit.module('Exponential Golomb coding'); - -QUnit.test('small numbers are coded correctly', function(assert) { - var - expected = [ - [0xF8, 0], - [0x5F, 1], - [0x7F, 2], - [0x27, 3], - [0x2F, 4], - [0x37, 5], - [0x3F, 6], - [0x11, 7], - [0x13, 8], - [0x15, 9] - ], - i = expected.length, - result; - - while (i--) { - buffer = new Uint8Array([expected[i][0]]); - expGolomb = new ExpGolomb(buffer); - result = expGolomb.readUnsignedExpGolomb(); - assert.equal(expected[i][1], result, expected[i][0] + ' is decoded to ' + expected[i][1]); - } -}); - -QUnit.test('drops working data as it is parsed', function(assert) { - var expGolomb = new ExpGolomb(new Uint8Array([0x00, 0xFF])); - expGolomb.skipBits(8); - assert.equal(8, expGolomb.bitsAvailable(), '8 bits remain'); - assert.equal(0xFF, expGolomb.readBits(8), 'the second byte is read'); -}); - -QUnit.test('drops working data when skipping leading zeros', function(assert) { - var expGolomb = new ExpGolomb(new Uint8Array([0x00, 0x00, 0x00, 0x00, 0xFF])); - assert.equal(32, expGolomb.skipLeadingZeros(), '32 leading zeros are dropped'); - assert.equal(8, expGolomb.bitsAvailable(), '8 bits remain'); - assert.equal(0xFF, expGolomb.readBits(8), 'the second byte is read'); -}); - -QUnit.test('drops working data when skipping leading zeros', function(assert) { - var expGolomb = new ExpGolomb(new Uint8Array([0x15, 0xab, 0x40, 0xc8, 0xFF])); - assert.equal(3, expGolomb.skipLeadingZeros(), '3 leading zeros are dropped'); - assert.equal((8 * 4) + 5, expGolomb.bitsAvailable(), '37 bits remain'); - expGolomb.skipBits(1); - assert.equal(0x5a, expGolomb.readBits(8), 'the next bits are read'); -}); - -QUnit.test('skipBits correctly across word-boundaries', function(assert) { - var expGolomb = new ExpGolomb(new Uint8Array([0x15, 0x00, 0x00, 0x28, 0x00, 0x0a, 0x00, 0x00])); - assert.equal(expGolomb.readUnsignedExpGolomb(), 9, 'the first number is read'); - expGolomb.skipBits(17); - assert.equal(expGolomb.readUnsignedExpGolomb(), 4, 'the second number is read'); - expGolomb.skipBits(13); // Crosses word boundary - assert.equal(expGolomb.readUnsignedExpGolomb(), 4, 'the third number is read'); -}); - -QUnit.test('parses a sequence parameter set', function(assert) { - var - sps = new Uint8Array([ - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x35, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ]), - expGolomb = new ExpGolomb(sps); - - assert.strictEqual(expGolomb.readBits(8), 0x27, 'the NAL type specifies an SPS'); - assert.strictEqual(expGolomb.readBits(8), 66, 'profile_idc is 66'); - assert.strictEqual(expGolomb.readBits(4), 0x0E, 'constraints 0-3 are correct'); - - expGolomb.skipBits(4); - assert.strictEqual(expGolomb.readBits(8), 11, 'level_idc is 11'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 0, 'seq_parameter_set_id is 0'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 1, 'log2_max_frame_num_minus4 is 1'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 0, 'pic_order_cnt_type is 0'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 3, 'log2_max_pic_order_cnt_lsb_minus4 is 3'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 2, 'max_num_ref_frames is 2'); - assert.strictEqual(expGolomb.readBits(1), 0, 'gaps_in_frame_num_value_allowed_flag is false'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 11, 'pic_width_in_mbs_minus1 is 11'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 8, 'pic_height_in_map_units_minus1 is 8'); - assert.strictEqual(expGolomb.readBits(1), 1, 'frame_mbs_only_flag is true'); - assert.strictEqual(expGolomb.readBits(1), 1, 'direct_8x8_inference_flag is true'); - assert.strictEqual(expGolomb.readBits(1), 0, 'frame_cropping_flag is false'); -}); - diff --git a/node_modules/mux.js/test/m2ts-probe.test.js b/node_modules/mux.js/test/m2ts-probe.test.js deleted file mode 100644 index aedbb3d..0000000 --- a/node_modules/mux.js/test/m2ts-probe.test.js +++ /dev/null @@ -1,75 +0,0 @@ -'use strict'; - -var segments = require('data-files!segments'); - -var - QUnit = require('qunit'), - probe = require('../lib/m2ts/probe.js'), - testSegment = segments['test-segment.ts'](), - stuffedPesPacket = segments['test-stuffed-pes.ts'](); - -/** - * All subarray indices verified with the use of thumbcoil. - */ -var patPacket = testSegment.subarray(188, 376); -var pmtPid = 4095; -var programMapTable = { - 256: 0x1B, - 257: 0x0F -}; -var pmtPacket = testSegment.subarray(376, 564); -var pesPacket = testSegment.subarray(564, 752); -var videoPacket = testSegment.subarray(564, 1692); -var videoNoKeyFramePacket = testSegment.subarray(1880, 2820); -var audioPacket = testSegment.subarray(6956, 7144); -var notPusiPacket = testSegment.subarray(1316, 1504); - -QUnit.module('M2TS Probe'); - -QUnit.test('correctly parses packet type', function(assert) { - assert.equal(probe.parseType(patPacket), 'pat', 'parses pat type'); - assert.equal(probe.parseType(pmtPacket), null, - 'cannot determine type of pmt packet when pmt pid has not been parsed yet'); - assert.equal(probe.parseType(pmtPacket, pmtPid), 'pmt', 'parses pmt type'); - assert.equal(probe.parseType(pesPacket), null, - 'cannot determine type of pes packet when pmt pid has not been parsed yet'); - assert.equal(probe.parseType(pesPacket, pmtPid), 'pes', 'parses pes type'); -}); - -QUnit.test('correctly parses pmt pid from pat packet', function(assert) { - assert.equal(probe.parsePat(patPacket), pmtPid, 'parses pmt pid from pat'); -}); - -QUnit.test('correctly parses program map table from pmt packet', function(assert) { - assert.deepEqual(probe.parsePmt(pmtPacket), programMapTable, 'generates correct pmt'); -}); - -QUnit.test('correctly parses payload unit start indicator', function(assert) { - assert.ok(probe.parsePayloadUnitStartIndicator(pesPacket), - 'detects payload unit start indicator'); - assert.ok(!probe.parsePayloadUnitStartIndicator(notPusiPacket), - 'detects no payload unit start indicator'); -}); - -QUnit.test('correctly parses type of pes packet', function(assert) { - assert.equal(probe.parsePesType(videoPacket, programMapTable), 'video', - 'parses video pes type'); - assert.equal(probe.parsePesType(audioPacket, programMapTable), 'audio', - 'parses audio pes type'); -}); - -QUnit.test('correctly parses dts and pts values of pes packet', function(assert) { - var videoPes = probe.parsePesTime(videoPacket); - assert.equal(videoPes.dts, 126000, 'correct dts value'); - assert.equal(videoPes.pts, 126000, 'correct pts value'); - - videoPes = probe.parsePesTime(stuffedPesPacket); - assert.equal(videoPes, null, - 'correctly returned null when there is no packet data, only stuffing'); -}); - -QUnit.test('correctly determines if video pes packet contains a key frame', function(assert) { - assert.ok(probe.videoPacketContainsKeyFrame(videoPacket), 'detects key frame in packet'); - assert.ok(!probe.videoPacketContainsKeyFrame(videoNoKeyFramePacket), - 'detects no key frame in packet'); -}); diff --git a/node_modules/mux.js/test/metadata-stream-test-worker.js b/node_modules/mux.js/test/metadata-stream-test-worker.js deleted file mode 100644 index 29e77f0..0000000 --- a/node_modules/mux.js/test/metadata-stream-test-worker.js +++ /dev/null @@ -1,11 +0,0 @@ -var mp2t, metadataStream; - -mp2t = require('../lib/m2ts'); -metadataStream = new mp2t.MetadataStream(); - -self.addEventListener('message', function(e) { - metadataStream.on('data', function(data) { - self.postMessage(data); - }); - metadataStream.push(e.data); -}); diff --git a/node_modules/mux.js/test/metadata-stream.test.js b/node_modules/mux.js/test/metadata-stream.test.js deleted file mode 100644 index 276a4e8..0000000 --- a/node_modules/mux.js/test/metadata-stream.test.js +++ /dev/null @@ -1,586 +0,0 @@ -'use strict'; -/* - ======== A Handy Little QUnit Reference ======== - http://api.qunitjs.com/ - - Test methods: - module(name, {[setup][ ,teardown]}) - test(name, callback) - expect(numberOfAssertions) - stop(increment) - start(decrement) - Test assertions: - ok(value, [message]) - equal(actual, expected, [message]) - notEqual(actual, expected, [message]) - deepEqual(actual, expected, [message]) - notDeepEqual(actual, expected, [message]) - strictEqual(actual, expected, [message]) - notStrictEqual(actual, expected, [message]) - throws(block, [expected], [message]) -*/ - -var metadataStream, stringToInts, stringToCString, id3Tag, id3Frame, id3Generator, mp2t, QUnit, - webworkify, MetadataStreamTestWorker; - -mp2t = require('../lib/m2ts'); -QUnit = require('qunit'); -id3Generator = require('./utils/id3-generator'); -MetadataStreamTestWorker = require('worker!./metadata-stream-test-worker.js'); -stringToInts = id3Generator.stringToInts; -stringToCString = id3Generator.stringToCString; -id3Tag = id3Generator.id3Tag; -id3Frame = id3Generator.id3Frame; - -QUnit.module('MetadataStream', { - beforeEach: function() { - metadataStream = new mp2t.MetadataStream(); - } -}); - -QUnit.test('can construct a MetadataStream', function(assert) { - assert.ok(metadataStream, 'does not return null'); -}); - - -QUnit.test('parses simple ID3 metadata out of PES packets', function(assert) { - var - events = [], - wxxxPayload = [ - 0x00 // text encoding. ISO-8859-1 - ].concat(stringToCString('ad tag URL'), // description - stringToInts('http://example.com/ad?v=1234&q=7')), // value - id3Bytes, - size; - - metadataStream.on('data', function(event) { - events.push(event); - }); - - id3Bytes = new Uint8Array(stringToInts('ID3').concat([ - 0x03, 0x00, // version 3.0 of ID3v2 (aka ID3v.2.3.0) - 0x40, // flags. include an extended header - 0x00, 0x00, 0x00, 0x00, // size. set later - - // extended header - 0x00, 0x00, 0x00, 0x06, // extended header size. no CRC - 0x00, 0x00, // extended flags - 0x00, 0x00, 0x00, 0x02 // size of padding - - // frame 0 - // http://id3.org/id3v2.3.0#User_defined_text_information_frame - ], id3Frame('WXXX', - wxxxPayload), // value - // frame 1 - // custom tag - id3Frame('XINF', - [ - 0x04, 0x03, 0x02, 0x01 // arbitrary data - ]), [ - 0x00, 0x00 // padding - ])); - - // set header size field - size = id3Bytes.byteLength - 10; - id3Bytes[6] = (size >>> 21) & 0x7f; - id3Bytes[7] = (size >>> 14) & 0x7f; - id3Bytes[8] = (size >>> 7) & 0x7f; - id3Bytes[9] = (size) & 0x7f; - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 1000, - - // header - data: id3Bytes - }); - - assert.equal(events.length, 1, 'parsed one tag'); - assert.equal(events[0].frames.length, 2, 'parsed two frames'); - assert.equal(events[0].frames[0].key, 'WXXX', 'parsed a WXXX frame'); - assert.deepEqual(new Uint8Array(events[0].frames[0].data), - new Uint8Array(wxxxPayload), - 'attached the frame payload'); - assert.equal(events[0].frames[1].key, 'XINF', 'parsed a user-defined frame'); - assert.deepEqual(new Uint8Array(events[0].frames[1].data), - new Uint8Array([0x04, 0x03, 0x02, 0x01]), - 'attached the frame payload'); - assert.equal(events[0].pts, 1000, 'did not modify the PTS'); - assert.equal(events[0].dts, 1000, 'did not modify the PTS'); -}); - -QUnit.test('skips non-ID3 metadata events', function(assert) { - var events = []; - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 1000, - - // header - data: new Uint8Array([0]) - }); - - assert.equal(events.length, 0, 'did not emit an event'); -}); - -// missing cases: -// unsynchronization -// CRC -// no extended header -// compressed frames -// encrypted frames -// frame groups -// too large/small tag size values -// too large/small frame size values -QUnit.test('parses TXXX frames without null terminators', function(assert) { - var events = []; - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - - // header - data: new Uint8Array(id3Tag(id3Frame('TXXX', - 0x03, // utf-8 - stringToCString('get done'), - stringToInts('{ "key": "value" }')), - [0x00, 0x00])) - }); - - assert.equal(events.length, 1, 'parsed one tag'); - assert.equal(events[0].frames.length, 1, 'parsed one frame'); - assert.equal(events[0].frames[0].key, 'TXXX', 'parsed the frame key'); - assert.equal(events[0].frames[0].description, 'get done', 'parsed the description'); - assert.deepEqual(JSON.parse(events[0].frames[0].data), { key: 'value' }, 'parsed the data'); -}); - -QUnit.test('parses TXXX frames with null terminators', function(assert) { - var events = []; - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - - // header - data: new Uint8Array(id3Tag(id3Frame('TXXX', - 0x03, // utf-8 - stringToCString('get done'), - stringToCString('{ "key": "value" }')), - [0x00, 0x00])) - }); - - assert.equal(events.length, 1, 'parsed one tag'); - assert.equal(events[0].frames.length, 1, 'parsed one frame'); - assert.equal(events[0].frames[0].key, 'TXXX', 'parsed the frame key'); - assert.equal(events[0].frames[0].description, 'get done', 'parsed the description'); - assert.deepEqual(JSON.parse(events[0].frames[0].data), { key: 'value' }, 'parsed the data'); -}); - -QUnit.test('parses WXXX frames', function(assert) { - var events = [], url = 'http://example.com/path/file?abc=7&d=4#ty'; - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - - // header - data: new Uint8Array(id3Tag(id3Frame('WXXX', - 0x03, // utf-8 - stringToCString(''), - stringToInts(url)), - [0x00, 0x00])) - }); - - assert.equal(events.length, 1, 'parsed one tag'); - assert.equal(events[0].frames.length, 1, 'parsed one frame'); - assert.equal(events[0].frames[0].key, 'WXXX', 'parsed the frame key'); - assert.equal(events[0].frames[0].description, '', 'parsed the description'); - assert.equal(events[0].frames[0].url, url, 'parsed the value'); -}); - -QUnit.test('parses TXXX frames with characters that have a single-digit hexadecimal representation', function(assert) { - var events = [], value = String.fromCharCode(7); - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - - // header - data: new Uint8Array(id3Tag(id3Frame('TXXX', - 0x03, // utf-8 - stringToCString(''), - stringToCString(value)), - [0x00, 0x00])) - }); - - assert.equal(events[0].frames[0].data, - value, - 'parsed the single-digit character'); -}); - -QUnit.test('parses PRIV frames', function(assert) { - var - events = [], - payload = stringToInts('arbitrary data may be included in the payload ' + - 'of a PRIV frame'); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - - // header - data: new Uint8Array(id3Tag(id3Frame('PRIV', - stringToCString('priv-owner@example.com'), - payload))) - }); - - assert.equal(events.length, 1, 'parsed a tag'); - assert.equal(events[0].frames.length, 1, 'parsed a frame'); - assert.equal(events[0].frames[0].key, 'PRIV', 'frame key is PRIV'); - assert.equal(events[0].frames[0].owner, 'priv-owner@example.com', 'parsed the owner'); - assert.deepEqual(new Uint8Array(events[0].frames[0].data), - new Uint8Array(payload), - 'parsed the frame private data'); - -}); - -QUnit.test('parses tags split across pushes', function(assert) { - var - events = [], - owner = stringToCString('owner@example.com'), - payload = stringToInts('A TS packet is 188 bytes in length so that it can' + - ' be easily transmitted over ATM networks, an ' + - 'important medium at one time. We want to be sure' + - ' that ID3 frames larger than a TS packet are ' + - 'properly re-assembled.'), - tag = new Uint8Array(id3Tag(id3Frame('PRIV', owner, payload))), - front = tag.subarray(0, 100), - back = tag.subarray(100); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: front, - dataAlignmentIndicator: true - }); - - assert.equal(events.length, 0, 'parsed zero tags'); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: back, - dataAlignmentIndicator: false - }); - - assert.equal(events.length, 1, 'parsed a tag'); - assert.equal(events[0].frames.length, 1, 'parsed a frame'); - assert.equal(events[0].frames[0].data.byteLength, - payload.length, - 'collected data across pushes'); - - // parses subsequent fragmented tags - tag = new Uint8Array(id3Tag(id3Frame('PRIV', - owner, payload, payload))); - front = tag.subarray(0, 188); - back = tag.subarray(188); - events = []; - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 2000, - dts: 2000, - data: front, - dataAlignmentIndicator: true - }); - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 2000, - dts: 2000, - data: back, - dataAlignmentIndicator: false - }); - - assert.equal(events.length, 1, 'parsed a tag'); - assert.equal(events[0].frames.length, 1, 'parsed a frame'); - assert.equal(events[0].frames[0].data.byteLength, - 2 * payload.length, - 'collected data across pushes'); -}); - -QUnit.test('id3 frame is malformed first time but gets corrected in the next frame', function(assert) { - var - events = [], - owner = stringToCString('owner@example.com'), - payload = stringToInts('A TS packet is 188 bytes in length so that it can' + - ' be easily transmitted over ATM networks, an ' + - 'important medium at one time. We want to be sure' + - ' that ID3 frames larger than a TS packet are ' + - 'properly re-assembled.'), - tag = new Uint8Array(id3Tag(id3Frame('PRIV', owner, payload))), - front = tag.subarray(0, 100); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - // receives incomplete id3 - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: front, - dataAlignmentIndicator: true - }); - - assert.equal(events.length, 0, 'parsed zero tags'); - - // receives complete id3 - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: tag, - dataAlignmentIndicator: true - }); - - assert.equal(events.length, 1, 'parsed a tag'); - assert.equal(events[0].frames.length, 1, 'parsed a frame'); - assert.equal(events[0].frames[0].data.byteLength, - payload.length, - 'collected data across pushes'); -}); - -QUnit.test('id3 frame reports more data than its tagsize ', function(assert) { - var - events = [], - owner = stringToCString('owner@example.com'), - payload = stringToInts('A TS packet is 188 bytes in length so that it can' + - ' be easily transmitted over ATM networks, an ' + - 'important medium at one time. We want to be sure' + - ' that ID3 frames larger than a TS packet are ' + - 'properly re-assembled.'), - tag = new Uint8Array(id3Tag(id3Frame('PRIV', owner, payload))), - d = new Uint8Array([0x04, 0x05, 0x06]), - data = new Uint8Array(tag.byteLength + d.byteLength); - - data.set(tag); - data.set(d, tag.length); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: data, - dataAlignmentIndicator: true - }); - - assert.equal(events.length, 1, 'parsed a tag'); - assert.equal(events[0].frames.length, 1, 'parsed a frame'); - assert.equal(events[0].frames[0].data.byteLength, - payload.length, - 'collected data across pushes'); -}); - -QUnit.test('ignores tags when the header is fragmented', function(assert) { - - var - events = [], - tag = new Uint8Array(id3Tag(id3Frame('PRIV', - stringToCString('owner@example.com'), - stringToInts('payload')))), - // split the 10-byte ID3 tag header in half - front = tag.subarray(0, 5), - back = tag.subarray(5); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: front - }); - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: back - }); - - assert.equal(events.length, 0, 'parsed zero tags'); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1500, - dts: 1500, - data: new Uint8Array(id3Tag(id3Frame('PRIV', - stringToCString('owner2'), - stringToInts('payload2')))) - }); - assert.equal(events.length, 1, 'parsed one tag'); - assert.equal(events[0].frames[0].owner, 'owner2', 'dropped the first tag'); -}); - -// https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track -QUnit.test('constructs the dispatch type', function(assert) { - metadataStream = new mp2t.MetadataStream({ - descriptor: new Uint8Array([0x03, 0x02, 0x01, 0x00]) - }); - - assert.equal(metadataStream.dispatchType, '1503020100', 'built the dispatch type'); -}); - - -QUnit.test('can parse PRIV frames in web worker', function(assert) { - var payload = stringToInts('arbitrary'), - worker = new MetadataStreamTestWorker(), - done = assert.async(); - - worker.addEventListener('message', function(e) { - assert.equal(e.data.frames[0].key, 'PRIV', 'frame key is PRIV'); - assert.deepEqual(new Uint8Array(e.data.frames[0].data), new Uint8Array(payload), - 'parsed the frame private data'); - worker.terminate(); - done(); - }); - - worker.postMessage({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - // header - data: new Uint8Array(id3Tag(id3Frame('PRIV', - stringToCString('priv-owner@example.com'), - payload))) - }); -}); - -QUnit.test('can parse TXXX frames in web worker', function(assert) { - var worker = new MetadataStreamTestWorker(), - done = assert.async(); - - worker.addEventListener('message', function(e) { - assert.equal(e.data.frames[0].key, 'TXXX', 'frame key is TXXX'); - assert.equal(e.data.frames[0].description, 'get done', 'parsed the description'); - assert.deepEqual(JSON.parse(e.data.frames[0].data), { key: 'value' }, 'parsed the data'); - worker.terminate(); - done(); - }); - - worker.postMessage({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - // header - data: new Uint8Array(id3Tag(id3Frame('TXXX', - 0x03, // utf-8 - stringToCString('get done'), - stringToCString('{ "key": "value" }')), - [0x00, 0x00])) - }); -}); - -QUnit.test('triggers special event after parsing a timestamp ID3 tag', function(assert) { - var - array = new Uint8Array(73), - streamTimestamp = 'com.apple.streaming.transportStreamTimestamp', - priv = 'PRIV', - count = 0, - frame, - tag, - metadataStream, - chunk, - i; - - metadataStream = new mp2t.MetadataStream(); - metadataStream.on('timestamp', function(f) { - frame = f; - count += 1; - }); - metadataStream.on('data', function(t) { - tag = t; - }); - - array[0] = 73; - array[1] = 68; - array[2] = 51; - array[3] = 4; - array[9] = 63; - array[17] = 53; - array[70] = 13; - array[71] = 187; - array[72] = 160; - for (i = 0; i < priv.length; i++) { - array[i + 10] = priv.charCodeAt(i); - } - for (i = 0; i < streamTimestamp.length; i++) { - array[i + 20] = streamTimestamp.charCodeAt(i); - } - chunk = { - type: 'timed-metadata', - data: array - }; - - metadataStream.push(chunk); - assert.equal(count, 1, 'timestamp event triggered once'); - assert.equal(frame.timeStamp, 900000, 'Initial timestamp fired and calculated correctly'); - assert.equal(tag.pts, 10 * 90e3, 'set tag PTS'); - assert.equal(tag.dts, 10 * 90e3, 'set tag DTS'); -}); diff --git a/node_modules/mux.js/test/mp4-generator.test.js b/node_modules/mux.js/test/mp4-generator.test.js deleted file mode 100644 index 8116826..0000000 --- a/node_modules/mux.js/test/mp4-generator.test.js +++ /dev/null @@ -1,581 +0,0 @@ -'use strict'; -/* - ======== A Handy Little QUnit Reference ======== - http://api.qunitjs.com/ - - Test methods: - module(name, {[setup][ ,teardown]}) - QUnit.test(name, callback) - expect(numberOfAssertions) - stop(increment) - start(decrement) - Test assertions: - assert.ok(value, [message]) - assert.equal(actual, expected, [message]) - notEqual(actual, expected, [message]) - assert.deepEqual(actual, expected, [message]) - notDeepEqual(actual, expected, [message]) - assert.strictEqual(actual, expected, [message]) - notStrictEqual(actual, expected, [message]) - throws(block, [expected], [message]) -*/ -var - mp4 = require('../lib/mp4'), - QUnit = require('qunit'), - validateMvhd, validateTrak, validateTkhd, validateMdia, - validateMdhd, validateHdlr, validateMinf, validateDinf, - validateStbl, validateStsd, validateMvex, - validateVideoSample, validateAudioSample; - -QUnit.module('MP4 Generator'); - -QUnit.test('generates a BSMFF ftyp', function(assert) { - var data = mp4.generator.ftyp(), boxes; - - assert.ok(data, 'box is not null'); - - boxes = mp4.tools.inspect(data); - assert.equal(1, boxes.length, 'generated a single box'); - assert.equal(boxes[0].type, 'ftyp', 'generated ftyp type'); - assert.equal(boxes[0].size, data.byteLength, 'generated size'); - assert.equal(boxes[0].majorBrand, 'isom', 'major version is "isom"'); - assert.equal(boxes[0].minorVersion, 1, 'minor version is one'); -}); - -validateMvhd = function(mvhd) { - QUnit.assert.equal(mvhd.type, 'mvhd', 'generated a mvhd'); - QUnit.assert.equal(mvhd.duration, 0xffffffff, 'wrote the maximum movie header duration'); - QUnit.assert.equal(mvhd.nextTrackId, 0xffffffff, 'wrote the max next track id'); -}; - -validateTrak = function(trak, expected) { - expected = expected || {}; - QUnit.assert.equal(trak.type, 'trak', 'generated a trak'); - QUnit.assert.equal(trak.boxes.length, 2, 'generated two track sub boxes'); - - validateTkhd(trak.boxes[0], expected); - validateMdia(trak.boxes[1], expected); -}; - -validateTkhd = function(tkhd, expected) { - QUnit.assert.equal(tkhd.type, 'tkhd', 'generated a tkhd'); - QUnit.assert.equal(tkhd.trackId, 7, 'wrote the track id'); - QUnit.assert.deepEqual(tkhd.flags, new Uint8Array([0, 0, 7]), 'flags should QUnit.equal 7'); - QUnit.assert.equal(tkhd.duration, - expected.duration || Math.pow(2, 32) - 1, - 'wrote duration into the track header'); - QUnit.assert.equal(tkhd.width, expected.width || 0, 'wrote width into the track header'); - QUnit.assert.equal(tkhd.height, expected.height || 0, 'wrote height into the track header'); - QUnit.assert.equal(tkhd.volume, 1, 'set volume to 1'); -}; - -validateMdia = function(mdia, expected) { - QUnit.assert.equal(mdia.type, 'mdia', 'generated an mdia type'); - QUnit.assert.equal(mdia.boxes.length, 3, 'generated three track media sub boxes'); - - validateMdhd(mdia.boxes[0], expected); - validateHdlr(mdia.boxes[1], expected); - validateMinf(mdia.boxes[2], expected); -}; - -validateMdhd = function(mdhd, expected) { - QUnit.assert.equal(mdhd.type, 'mdhd', 'generate an mdhd type'); - QUnit.assert.equal(mdhd.language, 'und', 'wrote undetermined language'); - QUnit.assert.equal(mdhd.timescale, expected.timescale || 90000, 'wrote the timescale'); - QUnit.assert.equal(mdhd.duration, - expected.duration || Math.pow(2, 32) - 1, - 'wrote duration into the media header'); -}; - -validateHdlr = function(hdlr, expected) { - QUnit.assert.equal(hdlr.type, 'hdlr', 'generate an hdlr type'); - if (expected.type !== 'audio') { - QUnit.assert.equal(hdlr.handlerType, 'vide', 'wrote a video handler'); - QUnit.assert.equal(hdlr.name, 'VideoHandler', 'wrote the handler name'); - } else { - QUnit.assert.equal(hdlr.handlerType, 'soun', 'wrote a sound handler'); - QUnit.assert.equal(hdlr.name, 'SoundHandler', 'wrote the sound handler name'); - } -}; - -validateMinf = function(minf, expected) { - QUnit.assert.equal(minf.type, 'minf', 'generate an minf type'); - QUnit.assert.equal(minf.boxes.length, 3, 'generates three minf sub boxes'); - - if (expected.type !== 'audio') { - QUnit.assert.deepEqual({ - type: 'vmhd', - size: 20, - version: 0, - flags: new Uint8Array([0, 0, 1]), - graphicsmode: 0, - opcolor: new Uint16Array([0, 0, 0]) - }, minf.boxes[0], 'generates a vhmd'); - } else { - QUnit.assert.deepEqual({ - type: 'smhd', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - balance: 0 - }, minf.boxes[0], 'generates an smhd'); - } - - validateDinf(minf.boxes[1]); - validateStbl(minf.boxes[2], expected); -}; - -validateDinf = function(dinf) { - QUnit.assert.deepEqual({ - type: 'dinf', - size: 36, - boxes: [{ - type: 'dref', - size: 28, - version: 0, - flags: new Uint8Array([0, 0, 0]), - dataReferences: [{ - type: 'url ', - size: 12, - version: 0, - flags: new Uint8Array([0, 0, 1]) - }] - }] - }, dinf, 'generates a dinf'); -}; - -validateStbl = function(stbl, expected) { - QUnit.assert.equal(stbl.type, 'stbl', 'generates an stbl type'); - QUnit.assert.equal(stbl.boxes.length, 5, 'generated five stbl child boxes'); - - validateStsd(stbl.boxes[0], expected); - QUnit.assert.deepEqual({ - type: 'stts', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - timeToSamples: [] - }, stbl.boxes[1], 'generated an stts'); - QUnit.assert.deepEqual({ - type: 'stsc', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - sampleToChunks: [] - }, stbl.boxes[2], 'generated an stsc'); - QUnit.assert.deepEqual({ - type: 'stsz', - version: 0, - size: 20, - flags: new Uint8Array([0, 0, 0]), - sampleSize: 0, - entries: [] - }, stbl.boxes[3], 'generated an stsz'); - QUnit.assert.deepEqual({ - type: 'stco', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - chunkOffsets: [] - }, stbl.boxes[4], 'generated and stco'); -}; - -validateStsd = function(stsd, expected) { - QUnit.assert.equal(stsd.type, 'stsd', 'generated an stsd'); - QUnit.assert.equal(stsd.sampleDescriptions.length, 1, 'generated one sample'); - if (expected.type !== 'audio') { - validateVideoSample(stsd.sampleDescriptions[0]); - } else { - validateAudioSample(stsd.sampleDescriptions[0]); - } -}; - -validateVideoSample = function(sample) { - QUnit.assert.deepEqual(sample, { - type: 'avc1', - size: 152, - dataReferenceIndex: 1, - width: 600, - height: 300, - horizresolution: 72, - vertresolution: 72, - frameCount: 1, - depth: 24, - config: [{ - type: 'avcC', - size: 30, - configurationVersion: 1, - avcProfileIndication: 3, - avcLevelIndication: 5, - profileCompatibility: 7, - lengthSizeMinusOne: 3, - sps: [new Uint8Array([ - 0, 1, 2 - ]), new Uint8Array([ - 3, 4, 5 - ])], - pps: [new Uint8Array([ - 6, 7, 8 - ])] - }, { - type: 'btrt', - size: 20, - bufferSizeDB: 1875072, - maxBitrate: 3000000, - avgBitrate: 3000000 - }, { - type: 'pasp', - size: 16, - data: new Uint8Array([0, 0, 0, 1, 0, 0, 0, 1]) - }] - }, 'generated a video sample'); -}; - -validateAudioSample = function(sample) { - QUnit.assert.deepEqual(sample, { - type: 'mp4a', - size: 75, - dataReferenceIndex: 1, - channelcount: 2, - samplesize: 16, - samplerate: 48000, - streamDescriptor: { - type: 'esds', - version: 0, - flags: new Uint8Array([0, 0, 0]), - size: 39, - esId: 0, - streamPriority: 0, - // these values were hard-coded based on a working audio init segment - decoderConfig: { - avgBitrate: 56000, - maxBitrate: 56000, - bufferSize: 1536, - objectProfileIndication: 64, - streamType: 5, - decoderConfigDescriptor: { - audioObjectType: 2, - channelConfiguration: 2, - length: 2, - samplingFrequencyIndex: 3, - tag: 5 - } - } - } - }, 'generated an audio sample'); -}; - -validateMvex = function(mvex, options) { - options = options || { - sampleDegradationPriority: 1 - }; - QUnit.assert.deepEqual({ - type: 'mvex', - size: 40, - boxes: [{ - type: 'trex', - size: 32, - version: 0, - flags: new Uint8Array([0, 0, 0]), - trackId: 7, - defaultSampleDescriptionIndex: 1, - defaultSampleDuration: 0, - defaultSampleSize: 0, - sampleDependsOn: 0, - sampleIsDependedOn: 0, - sampleHasRedundancy: 0, - samplePaddingValue: 0, - sampleIsDifferenceSample: true, - sampleDegradationPriority: options.sampleDegradationPriority - }] - }, mvex, 'writes a movie extends box'); -}; - -QUnit.test('generates a video moov', function(assert) { - var - boxes, - data = mp4.generator.moov([{ - id: 7, - duration: 100, - width: 600, - height: 300, - type: 'video', - profileIdc: 3, - levelIdc: 5, - profileCompatibility: 7, - sarRatio: [1, 1], - sps: [new Uint8Array([0, 1, 2]), new Uint8Array([3, 4, 5])], - pps: [new Uint8Array([6, 7, 8])] - }]); - - assert.ok(data, 'box is not null'); - boxes = mp4.tools.inspect(data); - assert.equal(boxes.length, 1, 'generated a single box'); - assert.equal(boxes[0].type, 'moov', 'generated a moov type'); - assert.equal(boxes[0].size, data.byteLength, 'generated size'); - assert.equal(boxes[0].boxes.length, 3, 'generated three sub boxes'); - - validateMvhd(boxes[0].boxes[0]); - validateTrak(boxes[0].boxes[1], { - duration: 100, - width: 600, - height: 300 - }); - validateMvex(boxes[0].boxes[2]); -}); - -QUnit.test('generates an audio moov', function(assert) { - var - data = mp4.generator.moov([{ - id: 7, - type: 'audio', - audioobjecttype: 2, - channelcount: 2, - samplerate: 48000, - samplingfrequencyindex: 3, - samplesize: 16 - }]), - boxes; - - assert.ok(data, 'box is not null'); - boxes = mp4.tools.inspect(data); - assert.equal(boxes.length, 1, 'generated a single box'); - assert.equal(boxes[0].type, 'moov', 'generated a moov type'); - assert.equal(boxes[0].size, data.byteLength, 'generated size'); - assert.equal(boxes[0].boxes.length, 3, 'generated three sub boxes'); - - validateMvhd(boxes[0].boxes[0]); - validateTrak(boxes[0].boxes[1], { - type: 'audio', - timescale: 48000 - }); - validateMvex(boxes[0].boxes[2], { - sampleDegradationPriority: 0 - }); -}); - -QUnit.test('generates a sound hdlr', function(assert) { - var boxes, hdlr, - data = mp4.generator.moov([{ - duration: 100, - type: 'audio' - }]); - - assert.ok(data, 'box is not null'); - - boxes = mp4.tools.inspect(data); - - hdlr = boxes[0].boxes[1].boxes[1].boxes[1]; - assert.equal(hdlr.type, 'hdlr', 'generate an hdlr type'); - assert.equal(hdlr.handlerType, 'soun', 'wrote a sound handler'); - assert.equal(hdlr.name, 'SoundHandler', 'wrote the handler name'); -}); - -QUnit.test('generates a video hdlr', function(assert) { - var boxes, hdlr, - data = mp4.generator.moov([{ - duration: 100, - width: 600, - height: 300, - type: 'video', - sps: [], - pps: [] - }]); - - assert.ok(data, 'box is not null'); - - boxes = mp4.tools.inspect(data); - - hdlr = boxes[0].boxes[1].boxes[1].boxes[1]; - assert.equal(hdlr.type, 'hdlr', 'generate an hdlr type'); - assert.equal(hdlr.handlerType, 'vide', 'wrote a video handler'); - assert.equal(hdlr.name, 'VideoHandler', 'wrote the handler name'); -}); - -QUnit.test('generates an initialization segment', function(assert) { - var - data = mp4.generator.initSegment([{ - id: 1, - width: 600, - height: 300, - type: 'video', - sps: [new Uint8Array([0])], - pps: [new Uint8Array([1])] - }, { - id: 2, - type: 'audio' - }]), - init, mvhd, trak1, trak2, mvex; - - init = mp4.tools.inspect(data); - assert.equal(init.length, 2, 'generated two boxes'); - assert.equal(init[0].type, 'ftyp', 'generated a ftyp box'); - assert.equal(init[1].type, 'moov', 'generated a moov box'); - assert.equal(init[1].boxes[0].duration, 0xffffffff, 'wrote a maximum duration'); - - mvhd = init[1].boxes[0]; - assert.equal(mvhd.type, 'mvhd', 'wrote an mvhd'); - - trak1 = init[1].boxes[1]; - assert.equal(trak1.type, 'trak', 'wrote a trak'); - assert.equal(trak1.boxes[0].trackId, 1, 'wrote the first track id'); - assert.equal(trak1.boxes[0].width, 600, 'wrote the first track width'); - assert.equal(trak1.boxes[0].height, 300, 'wrote the first track height'); - assert.equal(trak1.boxes[1].boxes[1].handlerType, 'vide', 'wrote the first track type'); - - trak2 = init[1].boxes[2]; - assert.equal(trak2.type, 'trak', 'wrote a trak'); - assert.equal(trak2.boxes[0].trackId, 2, 'wrote the second track id'); - assert.equal(trak2.boxes[1].boxes[1].handlerType, 'soun', 'wrote the second track type'); - - mvex = init[1].boxes[3]; - assert.equal(mvex.type, 'mvex', 'wrote an mvex'); -}); - -QUnit.test('generates a minimal moof', function(assert) { - var - data = mp4.generator.moof(7, [{ - id: 17, - samples: [{ - duration: 9000, - size: 10, - flags: { - isLeading: 0, - dependsOn: 2, - isDependedOn: 1, - hasRedundancy: 0, - paddingValue: 0, - isNonSyncSample: 0, - degradationPriority: 14 - }, - compositionTimeOffset: 500 - }, { - duration: 10000, - size: 11, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - paddingValue: 0, - isNonSyncSample: 0, - degradationPriority: 9 - }, - compositionTimeOffset: 1000 - }] - }]), - moof = mp4.tools.inspect(data), - trun, - sdtp; - - assert.equal(moof.length, 1, 'generated one box'); - assert.equal(moof[0].type, 'moof', 'generated a moof box'); - assert.equal(moof[0].boxes.length, 2, 'generated two child boxes'); - assert.equal(moof[0].boxes[0].type, 'mfhd', 'generated an mfhd box'); - assert.equal(moof[0].boxes[0].sequenceNumber, 7, 'included the sequence_number'); - assert.equal(moof[0].boxes[1].type, 'traf', 'generated a traf box'); - assert.equal(moof[0].boxes[1].boxes.length, 4, 'generated track fragment info'); - assert.equal(moof[0].boxes[1].boxes[0].type, 'tfhd', 'generated a tfhd box'); - assert.equal(moof[0].boxes[1].boxes[0].trackId, 17, 'wrote the first track id'); - assert.equal(moof[0].boxes[1].boxes[0].baseDataOffset, undefined, 'did not set a base data offset'); - - assert.equal(moof[0].boxes[1].boxes[1].type, 'tfdt', 'generated a tfdt box'); - assert.ok(moof[0].boxes[1].boxes[1].baseMediaDecodeTime >= 0, - 'media decode time is non-negative'); - - trun = moof[0].boxes[1].boxes[2]; - assert.equal(trun.type, 'trun', 'generated a trun box'); - assert.equal(typeof trun.dataOffset, 'number', 'has a data offset'); - assert.ok(trun.dataOffset >= 0, 'has a non-negative data offset'); - assert.equal(trun.dataOffset, moof[0].size + 8, 'sets the data offset past the mdat header'); - assert.equal(trun.samples.length, 2, 'wrote two samples'); - - assert.equal(trun.samples[0].duration, 9000, 'wrote a sample duration'); - assert.equal(trun.samples[0].size, 10, 'wrote a sample size'); - assert.deepEqual(trun.samples[0].flags, { - isLeading: 0, - dependsOn: 2, - isDependedOn: 1, - hasRedundancy: 0, - paddingValue: 0, - isNonSyncSample: 0, - degradationPriority: 14 - }, 'wrote the sample flags'); - assert.equal(trun.samples[0].compositionTimeOffset, 500, 'wrote the composition time offset'); - - assert.equal(trun.samples[1].duration, 10000, 'wrote a sample duration'); - assert.equal(trun.samples[1].size, 11, 'wrote a sample size'); - assert.deepEqual(trun.samples[1].flags, { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - paddingValue: 0, - isNonSyncSample: 0, - degradationPriority: 9 - }, 'wrote the sample flags'); - assert.equal(trun.samples[1].compositionTimeOffset, 1000, 'wrote the composition time offset'); - - sdtp = moof[0].boxes[1].boxes[3]; - assert.equal(sdtp.type, 'sdtp', 'generated an sdtp box'); - assert.equal(sdtp.samples.length, 2, 'wrote two samples'); - assert.deepEqual(sdtp.samples[0], { - dependsOn: 2, - isDependedOn: 1, - hasRedundancy: 0 - }, 'wrote the sample data table'); - assert.deepEqual(sdtp.samples[1], { - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0 - }, 'wrote the sample data table'); -}); - -QUnit.test('generates a moof for audio', function(assert) { - var - data = mp4.generator.moof(7, [{ - id: 17, - type: 'audio', - samples: [{ - duration: 9000, - size: 10 - }, { - duration: 10000, - size: 11 - }] - }]), - moof = mp4.tools.inspect(data), - trun; - - assert.deepEqual(moof[0].boxes[1].boxes.length, 3, 'generated three traf children'); - trun = moof[0].boxes[1].boxes[2]; - assert.ok(trun, 'generated a trun'); - assert.equal(trun.dataOffset, data.byteLength + 8, 'calculated the data offset'); - assert.deepEqual(trun.samples, [{ - duration: 9000, - size: 10 - }, { - duration: 10000, - size: 11 - }], 'wrote simple audio samples'); -}); - -QUnit.test('can generate a traf without samples', function(assert) { - var - data = mp4.generator.moof(8, [{ - trackId: 13 - }]), - moof = mp4.tools.inspect(data); - - assert.equal(moof[0].boxes[1].boxes[2].samples.length, 0, 'generated no samples'); -}); - -QUnit.test('generates an mdat', function(assert) { - var - data = mp4.generator.mdat(new Uint8Array([1, 2, 3, 4])), - mdat = mp4.tools.inspect(data); - - assert.equal(mdat.length, 1, 'generated one box'); - assert.equal(mdat[0].type, 'mdat', 'generated an mdat box'); - assert.deepEqual(mdat[0].byteLength, 4, 'encapsulated the data'); -}); diff --git a/node_modules/mux.js/test/mp4-inspector.test.js b/node_modules/mux.js/test/mp4-inspector.test.js deleted file mode 100644 index 8372cb1..0000000 --- a/node_modules/mux.js/test/mp4-inspector.test.js +++ /dev/null @@ -1,1121 +0,0 @@ -'use strict'; -/* - ======== A Handy Little QUnit Reference ======== - http://api.qunitjs.com/ - - Test methods: - module(name, {[setup][ ,teardown]}) - QUnit.test(name, callback) - expect(numberOfAssertions) - stop(increment) - start(decrement) - Test assertions: - assert.ok(value, [message]) - assert.equal(actual, expected, [message]) - notEqual(actual, expected, [message]) - assert.deepEqual(actual, expected, [message]) - notDeepEqual(actual, expected, [message]) - assert.strictEqual(actual, expected, [message]) - notStrictEqual(actual, expected, [message]) - throws(block, [expected], [message]) -*/ -var - mp4 = require('../lib/mp4'), - mp4Helpers = require('./utils/mp4-helpers'), - QUnit = require('qunit'), - typeBytes = mp4Helpers.typeBytes, - box = mp4Helpers.box, - unityMatrix = mp4Helpers.unityMatrix, - - mvhd0 = box('mvhd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x00, 0x00, 0x3c, // timescale - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - unityMatrix, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x00, 0x00, 0x00, 0x02), - - tkhd0 = box('tkhd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x00, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - unityMatrix, - 0x01, 0x2c, 0x80, 0x00, // 300.5 in 16.16 fixed point - 0x00, 0x96, 0x80, 0x00), // 150.5 in 16.16 fixed point - mdhd0 = box('mdhd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x00, 0x3c, // timescale - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7, // 'eng' language - 0x00, 0x00); - -QUnit.module('MP4 Inspector'); - -QUnit.test('produces an empty array for empty input', function(assert) { - assert.strictEqual(mp4.tools.inspect(new Uint8Array([])).length, 0, 'returned an empty array'); -}); - -QUnit.test('can parse a Box', function(assert) { - var box = new Uint8Array([ - 0x00, 0x00, 0x00, 0x00, // size 0 - 0x00, 0x00, 0x00, 0x00 // boxtype 0 - ]); - assert.deepEqual(mp4.tools.inspect(box), [{ - type: '\u0000\u0000\u0000\u0000', - size: 0, - data: box.subarray(box.byteLength) - }], 'parsed a Box'); -}); - -QUnit.test('can parse an ftyp', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(box('ftyp', - 0x61, 0x76, 0x63, 0x31, // major brand - 0x00, 0x00, 0x00, 0x02, // minor version - 98, 111, 111, 112, // compatible brands - 98, 101, 101, 112 // compatible brands - ))), [{ - type: 'ftyp', - size: 4 * 6, - majorBrand: 'avc1', - minorVersion: 2, - compatibleBrands: ['boop', 'beep'] - }], 'parsed an ftyp'); -}); - -QUnit.test('can parse a pdin', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(box('pdin', - 0x01, // version 1 - 0x01, 0x02, 0x03, // flags - 0x00, 0x00, 0x04, 0x00, // 1024 = 0x400 bytes/second rate - 0x00, 0x00, 0x00, 0x01 // initial delay - ))), [{ - size: 20, - type: 'pdin', - version: 1, - flags: new Uint8Array([1, 2, 3]), - rate: 1024, - initialDelay: 1 - }], 'parsed a pdin'); -}); - -QUnit.test('can parse an mdat', function(assert) { - var mdat = new Uint8Array(box('mdat', - 0, 0, 0, 4, // length - 0x01, 0x02, 0x03, 0x04 // data - )); - assert.deepEqual(mp4.tools.inspect(mdat), [{ - size: 16, - type: 'mdat', - nals: [ - 'slice_layer_without_partitioning_rbsp' - ], - byteLength: 8 - }], 'parsed an mdat'); -}); - -QUnit.test('can parse a free or skip', function(assert) { - var - free = new Uint8Array(box('free', - 0x01, 0x02, 0x03, 0x04)), // data - skip = new Uint8Array(box('skip', - 0x01, 0x02, 0x03, 0x04)); // data - - assert.deepEqual(mp4.tools.inspect(free), [{ - size: 12, - type: 'free', - data: free.subarray(free.byteLength - 4) - }], 'parsed a free'); - assert.deepEqual(mp4.tools.inspect(skip), [{ - size: 12, - type: 'skip', - data: skip.subarray(skip.byteLength - 4) - }], 'parsed a skip'); -}); - -QUnit.test('can parse a version 0 mvhd', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(mvhd0)), [{ - type: 'mvhd', - version: 0, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(1000 - 2082844800000), - modificationTime: new Date(2000 - 2082844800000), - timescale: 60, - duration: 600, - rate: 1, - volume: 1, - matrix: new Uint32Array(unityMatrix), - size: 108, - nextTrackId: 2 - }]); -}); - -QUnit.test('can parse a version 0 tkhd', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(tkhd0)), [{ - type: 'tkhd', - version: 0, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - size: 92, - trackId: 1, - duration: 600, - layer: 0, - alternateGroup: 0, - volume: 0, - matrix: new Uint32Array(unityMatrix), - width: 300.5, - height: 150.5 - }]); -}); - -QUnit.test('can parse a version 0 mdhd', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(mdhd0)), [{ - type: 'mdhd', - version: 0, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - size: 32, - timescale: 60, - duration: 600, - language: 'eng' - }]); -}); - -QUnit.test('can parse a moov', function(assert) { - var data = mp4Helpers.sampleMoov; - - QUnit.dump.maxDepth = 100; - var result = QUnit.dump.parse(mp4.tools.inspect(new Uint8Array(data))); - var expected = QUnit.dump.parse([{ - type: 'moov', - size: 1129, - boxes: [{ - type: 'mvhd', - version: 1, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(1000 - 2082844800000), - modificationTime: new Date(2000 - 2082844800000), - timescale: 1000, - duration: 600, - rate: 1, - size: 120, - volume: 1, - matrix: new Uint32Array(unityMatrix), - nextTrackId: 2 - }, { - type: 'trak', - size: 519, - boxes: [{ - type: 'tkhd', - flags: new Uint8Array([0, 0, 0]), - version: 1, - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - size: 104, - trackId: 1, - duration: 600, - layer: 0, - alternateGroup: 0, - volume: 0, - matrix: new Uint32Array(unityMatrix), - width: 300, - height: 150 - }, { - type: 'edts', - size: 36, - boxes: [{ - type: 'elst', - size: 28, - version: 0, - flags: new Uint8Array([0, 0, 0]), - edits: [{ - segmentDuration: 0, - mediaTime: 1024, - mediaRate: 1.5 - }] - }] - }, { - type: 'mdia', - size: 371, - boxes: [{ - type: 'mdhd', - version: 1, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - timescale: 90e3, - duration: 600, - language: 'eng', - size: 44 - }, { - type: 'hdlr', - version: 1, - flags: new Uint8Array([0, 0, 0]), - handlerType: 'vide', - name: 'one', - size: 37 - }, { - type: 'minf', - size: 282, - boxes: [{ - type: 'dinf', - size: 36, - boxes: [{ - type: 'dref', - size: 28, - version: 1, - flags: new Uint8Array([0, 0, 0]), - dataReferences: [{ - type: 'url ', - size: 12, - version: 0, - flags: new Uint8Array([0, 0, 1]) - }] - }] - }, { - type: 'stbl', - size: 238, - boxes: [{ - type: 'stsd', - size: 114, - version: 1, - flags: new Uint8Array([0, 0, 0]), - sampleDescriptions: [{ - config: [ - { - avcLevelIndication: 13, - avcProfileIndication: 77, - configurationVersion: 0, - lengthSizeMinusOne: 0, - pps: [], - profileCompatibility: 64, - size: 0, - sps: [], - type: 'avcC' - } - ], - dataReferenceIndex: 0, - depth: 0, - frameCount: 0, - height: 0, - horizresolution: 0, - size: 98, - type: 'avc1', - vertresolution: 0, - width: 0 - } - ] - }, { - type: 'stts', - size: 24, - version: 1, - flags: new Uint8Array([0, 0, 0]), - timeToSamples: [{ - sampleCount: 1, - sampleDelta: 1 - }] - }, { - type: 'stsc', - version: 1, - flags: new Uint8Array([0, 0, 0]), - sampleToChunks: [{ - firstChunk: 2, - samplesPerChunk: 3, - sampleDescriptionIndex: 1 - }], - size: 28 - }, { - type: 'stco', - size: 20, - version: 1, - flags: new Uint8Array([0, 0, 0]), - chunkOffsets: [1] - }, { - type: 'stss', - size: 20, - version: 0, - flags: new Uint8Array([0, 0, 0]), - syncSamples: [1] - }, { - type: 'ctts', - size: 24, - version: 0, - flags: new Uint8Array([0, 0, 0]), - compositionOffsets: [ - { sampleCount: 1, sampleOffset: 1 } - ] - }] - }] - }] - }] - }, { - type: 'trak', - size: 482, - boxes: [{ - type: 'tkhd', - flags: new Uint8Array([0, 0, 0]), - version: 1, - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - size: 104, - trackId: 2, - duration: 600, - layer: 0, - alternateGroup: 0, - volume: 0, - matrix: new Uint32Array(unityMatrix), - width: 300, - height: 150 - }, { - type: 'edts', - size: 44, - boxes: [{ - type: 'elst', - size: 36, - version: 1, - flags: new Uint8Array([0, 0, 0]), - edits: [{ - segmentDuration: 0, - mediaTime: 1152921504606847000, - mediaRate: 1.5 - }] - }] - }, { - type: 'mdia', - size: 326, - boxes: [{ - type: 'mdhd', - version: 1, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - timescale: 90e3, - duration: 600, - language: 'eng', - size: 44 - }, { - type: 'hdlr', - version: 1, - flags: new Uint8Array([0, 0, 0]), - handlerType: 'soun', - name: 'one', - size: 37 - }, { - type: 'minf', - size: 237, - boxes: [{ - type: 'dinf', - size: 36, - boxes: [{ - type: 'dref', - size: 28, - version: 1, - flags: new Uint8Array([0, 0, 0]), - dataReferences: [{ - type: 'url ', - size: 12, - version: 0, - flags: new Uint8Array([0, 0, 1]) - }] - }] - }, { - type: 'stbl', - size: 193, - boxes: [{ - type: 'stsd', - size: 89, - version: 1, - flags: new Uint8Array([0, 0, 0]), - sampleDescriptions: [{ - channelcount: 0, - dataReferenceIndex: 0, - samplerate: 0, - samplesize: 0, - size: 73, - streamDescriptor: { - decoderConfig: { - avgBitrate: 0, - bufferSize: 0, - decoderConfigDescriptor: { - audioObjectType: 0, - channelConfiguration: 0, - length: 0, - samplingFrequencyIndex: 0, - tag: 0 - }, - maxBitrate: 0, - objectProfileIndication: 64, - streamType: 2 - }, - esId: 0, - flags: { - 0: 0, - 1: 0, - 2: 0 - }, - size: 0, - streamPriority: 0, - type: 'esds', - version: 0 - }, - type: 'mp4a' - }] - }, { - type: 'stts', - size: 24, - version: 1, - flags: new Uint8Array([0, 0, 0]), - timeToSamples: [{ - sampleCount: 1, - sampleDelta: 1 - }] - }, { - type: 'stsc', - version: 1, - flags: new Uint8Array([0, 0, 0]), - sampleToChunks: [{ - firstChunk: 2, - samplesPerChunk: 3, - sampleDescriptionIndex: 1 - }], - size: 28 - }, { - type: 'ctts', - size: 24, - version: 1, - flags: new Uint8Array([0, 0, 0]), - compositionOffsets: [ - { sampleCount: 1, sampleOffset: -1 } - ] - }, { - type: 'stco', - size: 20, - version: 1, - flags: new Uint8Array([0, 0, 0]), - chunkOffsets: [1] - }] - }] - }] - }] - }] - }]); - assert.equal(result, expected, 'can parse moov'); -}); - -QUnit.test('can parse an mvex', function(assert) { - var mvex = - box('mvex', - box('trex', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x02, // default_sample_duration - 0x00, 0x00, 0x00, 0x03, // default_sample_size - 0x00, 0x61, 0x00, 0x01)); // default_sample_flags - assert.deepEqual(mp4.tools.inspect(new Uint8Array(mvex)), [{ - type: 'mvex', - size: 40, - boxes: [{ - type: 'trex', - size: 32, - version: 0, - flags: new Uint8Array([0, 0, 0]), - trackId: 1, - defaultSampleDescriptionIndex: 1, - defaultSampleDuration: 2, - defaultSampleSize: 3, - sampleDependsOn: 0, - sampleIsDependedOn: 1, - sampleHasRedundancy: 2, - samplePaddingValue: 0, - sampleIsDifferenceSample: true, - sampleDegradationPriority: 1 - }] - }], 'parsed an mvex'); -}); - -QUnit.test('can parse a video stsd', function(assert) { - var data = box('stsd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, - box('avc1', - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x01, 0x2c, // width = 300 - 0x00, 0x96, // height = 150 - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x04, - typeBytes('avc1'), - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11, // pre_defined - box('avcC', - 0x01, // configurationVersion - 0x00, // AVCProfileIndication?? - 0x00, // profile_compatibility - 0x00, // AVCLevelIndication - 0x1c, // lengthSizeMinusOne - 0xe1, // numOfSequenceParameterSets - 0x00, 0x01, // sequenceParameterSetLength - 0x00, // "SPS" - 0x02, // numOfPictureParameterSets - 0x00, 0x02, // pictureParameterSetLength - 0x01, 0x02, // "PPS" - 0x00, 0x01, // pictureParameterSetLength - 0xff), // "PPS" - box('btrt', - 0x00, 0x00, 0x00, 0x00, // bufferSizeDB - 0x00, 0x00, 0x00, 0x01, // maxBitrate - 0x00, 0x00, 0x00, 0x01), // avgBitrate - box('pasp', - 0x00, 0x00, 0x00, 0x01, // hSpacing - 0x00, 0x00, 0x00, 0x01))); // vSpacing - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), [{ - type: 'stsd', - size: 163, - version: 0, - flags: new Uint8Array([0, 0, 0]), - sampleDescriptions: [{ - type: 'avc1', - size: 147, - dataReferenceIndex: 1, - width: 300, - height: 150, - horizresolution: 72, - vertresolution: 72, - frameCount: 1, - depth: 24, - config: [{ - type: 'avcC', - size: 25, - configurationVersion: 1, - avcProfileIndication: 0, - profileCompatibility: 0, - avcLevelIndication: 0, - lengthSizeMinusOne: 0, - sps: [new Uint8Array(1)], - pps: [new Uint8Array([1, 2]), - new Uint8Array([0xff])] - }, { - type: 'btrt', - size: 20, - bufferSizeDB: 0, - maxBitrate: 1, - avgBitrate: 1 - }, { - type: 'pasp', - size: 16, - data: new Uint8Array([0, 0, 0, 1, 0, 0, 0, 1]) - }] - }] - }]); -}); - -QUnit.test('can parse an audio stsd', function(assert) { - var data = box('stsd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - box('mp4a', - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x02, // channelcount - 0x00, 0x10, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0xbb, 0x80, 0x00, 0x00, // samplerate, fixed-point 16.16 - box('esds', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x03, // tag, ES_DescrTag - 0x00, // length - 0x00, 0x01, // ES_ID - 0x00, // streamDependenceFlag, URL_Flag, reserved, streamPriority - - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x0d, // length - 0x40, // objectProfileIndication, AAC Main - 0x15, // streamType, AudioStream. upstream, reserved - 0x00, 0x00, 0xff, // bufferSizeDB - 0x00, 0x00, 0x00, 0xff, // maxBitrate - 0x00, 0x00, 0x00, 0xaa, // avgBitrate - - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // audioObjectType, samplingFrequencyIndex, channelConfiguration - 0x11, 0x90, - // GASpecificConfig - 0x06, 0x01, 0x02))); - - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), [{ - version: 0, - flags: new Uint8Array([0, 0, 0]), - type: 'stsd', - size: 91, - sampleDescriptions: [{ - type: 'mp4a', - dataReferenceIndex: 1, - channelcount: 2, - samplesize: 16, - samplerate: 48000, - size: 75, - streamDescriptor: { - type: 'esds', - version: 0, - size: 39, - flags: new Uint8Array([0, 0, 0]), - esId: 1, - streamPriority: 0, - decoderConfig: { - objectProfileIndication: 0x40, - streamType: 0x05, - bufferSize: 0xff, - maxBitrate: 0xff, - avgBitrate: 0xaa, - decoderConfigDescriptor: { - tag: 5, - length: 2, - audioObjectType: 2, - samplingFrequencyIndex: 3, - channelConfiguration: 2 - } - } - } - }] - }], 'parsed an audio stsd'); -}); - -QUnit.test('can parse an styp', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(box('styp', - 0x61, 0x76, 0x63, 0x31, // major brand - 0x00, 0x00, 0x00, 0x02, // minor version - 98, 111, 111, 112 // compatible brands - ))), [{ - type: 'styp', - size: 4 * 5, - majorBrand: 'avc1', - minorVersion: 2, - compatibleBrands: ['boop'] - }], 'parsed an styp'); -}); - -QUnit.test('can parse a vmhd', function(assert) { - var data = box('vmhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00); // opcolor - - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'vmhd', - size: 20, - version: 0, - flags: new Uint8Array([0, 0, 0]), - graphicsmode: 0, - opcolor: new Uint16Array([0, 0, 0]) - }]); -}); - -QUnit.test('can parse an stsz', function(assert) { - var data = box('stsz', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x03, // sample_count - 0x00, 0x00, 0x00, 0x01, // entry_size - 0x00, 0x00, 0x00, 0x02, // entry_size - 0x00, 0x00, 0x00, 0x03); // entry_size - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'stsz', - size: 32, - version: 0, - flags: new Uint8Array([0, 0, 0]), - sampleSize: 0, - entries: [1, 2, 3] - }]); -}); - -QUnit.test('can parse a moof', function(assert) { - var data = box('moof', - box('mfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05))); // default_sample_flags - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'moof', - size: 72, - boxes: [{ - type: 'mfhd', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - sequenceNumber: 4 - }, - { - type: 'traf', - size: 48, - boxes: [{ - type: 'tfhd', - version: 0, - size: 40, - flags: new Uint8Array([0x00, 0, 0x3b]), - trackId: 1, - baseDataOffset: 1, - sampleDescriptionIndex: 2, - defaultSampleDuration: 3, - defaultSampleSize: 4, - defaultSampleFlags: 5 - }] - }] - }]); -}); - -QUnit.test('can parse a trun', function(assert) { - var data = box('trun', - 0x00, // version - 0x00, 0x0b, 0x05, // flags - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x01, // data_offset - // first_sample_flags - // r:0000 il:10 sdo:01 sido:10 shr:01 spv:111 snss:1 - // dp:1111 1110 1101 1100 - 0x09, 0x9f, 0xfe, 0xdc, - - 0x00, 0x00, 0x00, 0x09, // sample_duration - 0x00, 0x00, 0x00, 0xff, // sample_size - 0x00, 0x00, 0x00, 0x00, // sample_composition_time_offset - - 0x00, 0x00, 0x00, 0x08, // sample_duration - 0x00, 0x00, 0x00, 0xfe, // sample_size - 0x00, 0x00, 0x00, 0x00); // sample_composition_time_offset - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'trun', - version: 0, - size: 48, - flags: new Uint8Array([0, 0x0b, 0x05]), - dataOffset: 1, - samples: [{ - duration: 9, - size: 0xff, - flags: { - isLeading: 2, - dependsOn: 1, - isDependedOn: 2, - hasRedundancy: 1, - paddingValue: 7, - isNonSyncSample: 1, - degradationPriority: 0xfedc - }, - compositionTimeOffset: 0 - }, { - duration: 8, - size: 0xfe, - compositionTimeOffset: 0 - }] - }]); -}); - -QUnit.test('can parse a trun with per-sample flags', function(assert) { - var data = box('trun', - 0x00, // version - 0x00, 0x0f, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // sample_count - - 0x00, 0x00, 0x00, 0x09, // sample_duration - 0x00, 0x00, 0x00, 0xff, // sample_size - // sample_flags - // r:0000 il:00 sdo:01, sido:11 shr:00 spv:010 snss:0 - // dp: 0001 0010 0011 0100 - 0x01, 0xc4, 0x12, 0x34, - 0x00, 0x00, 0x00, 0x00); // sample_composition_time_offset - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'trun', - version: 0, - size: 32, - flags: new Uint8Array([0, 0x0f, 0x00]), - samples: [{ - duration: 9, - size: 0xff, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 3, - hasRedundancy: 0, - paddingValue: 2, - isNonSyncSample: 0, - degradationPriority: 0x1234 - }, - compositionTimeOffset: 0 - }] - }]); - -}); - -QUnit.test('can parse an sdtp', function(assert) { - var data = box('sdtp', - 0x00, // version - 0x00, 0x00, 0x00, // flags - // reserved + sample_depends_on + - // sample_is_dependend_on + sample_has_redundancy - 0x15, - // reserved + sample_depends_on + - // sample_is_dependend_on + sample_has_redundancy - 0x27); - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), [{ - type: 'sdtp', - version: 0, - flags: new Uint8Array([0, 0, 0]), - size: 14, - samples: [{ - dependsOn: 1, - isDependedOn: 1, - hasRedundancy: 1 - }, { - dependsOn: 2, - isDependedOn: 1, - hasRedundancy: 3 - }] - }]); -}); - -QUnit.test('can parse a sidx', function(assert) { - var data = box('sidx', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // reference_ID - 0x00, 0x00, 0x00, 0x01, // timescale - 0x01, 0x02, 0x03, 0x04, // earliest_presentation_time - 0x00, 0x00, 0x00, 0x00, // first_offset - 0x00, 0x00, // reserved - 0x00, 0x02, // reference_count - // first reference - 0x80, 0x00, 0x00, 0x07, // reference_type(1) + referenced_size(31) - 0x00, 0x00, 0x00, 0x08, // subsegment_duration - 0x80, 0x00, 0x00, 0x09, // starts_with_SAP(1) + SAP_type(3) + SAP_delta_time(28) - // second reference - 0x00, 0x00, 0x00, 0x03, // reference_type(1) + referenced_size(31) - 0x00, 0x00, 0x00, 0x04, // subsegment_duration - 0x10, 0x00, 0x00, 0x05 // starts_with_SAP(1) + SAP_type(3) + SAP_delta_time(28) - ); - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'sidx', - version: 0, - flags: new Uint8Array([0, 0x00, 0x00]), - timescale: 1, - earliestPresentationTime: 0x01020304, - firstOffset: 0, - referenceId: 2, - size: 56, - references: [{ - referenceType: 1, - referencedSize: 7, - subsegmentDuration: 8, - startsWithSap: true, - sapType: 0, - sapDeltaTime: 9 - }, { - referenceType: 0, - referencedSize: 3, - subsegmentDuration: 4, - startsWithSap: false, - sapType: 1, - sapDeltaTime: 5 - }] - - }]); -}); - -QUnit.test('can parse a version 1 sidx', function(assert) { - var data = box('sidx', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // reference_ID - 0x00, 0x00, 0x00, 0x01, // timescale - 0x00, 0x00, 0x00, 0x00, // earliest_presentation_time - 0x01, 0x02, 0x03, 0x04, - 0x00, 0x00, 0x00, 0x00, // first_offset - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, // reserved - 0x00, 0x02, // reference_count - // first reference - 0x80, 0x00, 0x00, 0x07, // reference_type(1) + referenced_size(31) - 0x00, 0x00, 0x00, 0x08, // subsegment_duration - 0x80, 0x00, 0x00, 0x09, // starts_with_SAP(1) + SAP_type(3) + SAP_delta_time(28) - // second reference - 0x00, 0x00, 0x00, 0x03, // reference_type(1) + referenced_size(31) - 0x00, 0x00, 0x00, 0x04, // subsegment_duration - 0x10, 0x00, 0x00, 0x05 // starts_with_SAP(1) + SAP_type(3) + SAP_delta_time(28) - ); - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'sidx', - version: 1, - flags: new Uint8Array([0, 0x00, 0x00]), - timescale: 1, - earliestPresentationTime: 0x01020304, - firstOffset: 0, - referenceId: 2, - size: 64, - references: [{ - referenceType: 1, - referencedSize: 7, - subsegmentDuration: 8, - startsWithSap: true, - sapType: 0, - sapDeltaTime: 9 - }, { - referenceType: 0, - referencedSize: 3, - subsegmentDuration: 4, - startsWithSap: false, - sapType: 1, - sapDeltaTime: 5 - }] - - }]); -}); - -QUnit.test('can parse an smhd', function(assert) { - var data = box('smhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0xff, // balance, fixed-point 8.8 - 0x00, 0x00); // reserved - - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'smhd', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - balance: 0xff / Math.pow(2, 8) - }], - 'parsed an smhd'); -}); - -QUnit.test('can parse a version 0 tfdt', function(assert) { - var data = box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x03, 0x04); // baseMediaDecodeTime - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'tfdt', - version: 0, - size: 16, - flags: new Uint8Array([0, 0, 0]), - baseMediaDecodeTime: 0x01020304 - }]); -}); - -QUnit.test('can parse a version 1 tfdt and return an unsigned integer value', function(assert) { - var data = box('tfdt', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x81, 0x02, 0x03, 0x04, - 0x05, 0x06, 0x07, 0x08); // baseMediaDecodeTime - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'tfdt', - version: 1, - size: 20, - flags: new Uint8Array([0, 0, 0]), - baseMediaDecodeTime: 0x8102030405060708 - }]); -}); - -QUnit.test('can parse a series of boxes', function(assert) { - var ftyp = [ - 0x00, 0x00, 0x00, 0x18 // size 4 * 6 = 24 - ].concat(typeBytes('ftyp')).concat([ - 0x69, 0x73, 0x6f, 0x6d, // major brand - 0x00, 0x00, 0x00, 0x02, // minor version - 98, 101, 101, 112, // compatible brands - 98, 111, 111, 112 // compatible brands - ]); - - assert.deepEqual(mp4.tools.inspect(new Uint8Array(ftyp.concat(ftyp))), - [{ - type: 'ftyp', - size: 4 * 6, - majorBrand: 'isom', - minorVersion: 2, - compatibleBrands: ['beep', 'boop'] - }, { - type: 'ftyp', - size: 4 * 6, - majorBrand: 'isom', - minorVersion: 2, - compatibleBrands: ['beep', 'boop'] - }], - 'parsed two boxes in series'); - -}); diff --git a/node_modules/mux.js/test/mp4-probe.test.js b/node_modules/mux.js/test/mp4-probe.test.js deleted file mode 100644 index b67780e..0000000 --- a/node_modules/mux.js/test/mp4-probe.test.js +++ /dev/null @@ -1,407 +0,0 @@ -'use strict'; - -var - QUnit = require('qunit'), - probe = require('../lib/mp4/probe'), - mp4Helpers = require('./utils/mp4-helpers'), - box = mp4Helpers.box, - - // defined below - moovWithoutMdhd, - moovWithoutTkhd, - moofWithTfdt, - multiMoof, - multiTraf, - noTrunSamples, - v1boxes; - -QUnit.module('MP4 Probe'); - -QUnit.test('reads the timescale from an mdhd', function(assert) { - // sampleMoov has a base timescale of 1000 with an override to 90kHz - // in the mdhd - assert.deepEqual(probe.timescale(new Uint8Array(mp4Helpers.sampleMoov)), { - 1: 90e3, - 2: 90e3 - }, 'found the timescale'); -}); - -QUnit.test('reads tracks', function(assert) { - var tracks = probe.tracks(new Uint8Array(mp4Helpers.sampleMoov)); - - assert.equal(tracks.length, 2, 'two tracks'); - assert.equal(tracks[0].codec, 'avc1.4d400d', 'codec is correct'); - assert.equal(tracks[0].id, 1, 'id is correct'); - assert.equal(tracks[0].type, 'video', 'type is correct'); - assert.equal(tracks[0].timescale, 90e3, 'timescale is correct'); - - assert.equal(tracks[1].codec, 'mp4a.40.2', 'codec is correct'); - assert.equal(tracks[1].id, 2, 'id is correct'); - assert.equal(tracks[1].type, 'audio', 'type is correct'); - assert.equal(tracks[1].timescale, 90e3, 'timescale is correct'); -}); - -QUnit.test('returns null if the tkhd is missing', function(assert) { - assert.equal(probe.timescale(new Uint8Array(moovWithoutTkhd)), null, 'indicated missing info'); -}); - -QUnit.test('returns null if the mdhd is missing', function(assert) { - assert.equal(probe.timescale(new Uint8Array(moovWithoutMdhd)), null, 'indicated missing info'); -}); - -QUnit.test('startTime reads the base decode time from a tfdt', function(assert) { - assert.equal(probe.startTime({ - 4: 2 - }, new Uint8Array(moofWithTfdt)), - 0x01020304 / 2, - 'calculated base decode time'); -}); - -QUnit.test('startTime returns the earliest base decode time', function(assert) { - assert.equal(probe.startTime({ - 4: 2, - 6: 1 - }, new Uint8Array(multiMoof)), - 0x01020304 / 2, - 'returned the earlier time'); -}); - -QUnit.test('startTime parses 64-bit base decode times', function(assert) { - assert.equal(probe.startTime({ - 4: 3 - }, new Uint8Array(v1boxes)), - 0x0101020304 / 3, - 'parsed a long value'); -}); - -QUnit.test('compositionStartTime calculates composition time using composition time' + - 'offset from first trun sample', function(assert) { - assert.equal(probe.compositionStartTime({ - 1: 6, - 4: 3 - }, new Uint8Array(moofWithTfdt)), - (0x01020304 + 10) / 3, - 'calculated correct composition start time'); -}); - -QUnit.test('compositionStartTime looks at only the first traf', function(assert) { - assert.equal(probe.compositionStartTime({ - 2: 6, - 4: 3 - }, new Uint8Array(multiTraf)), - (0x01020304 + 10) / 3, - 'calculated composition start time from first traf'); -}); - -QUnit.test('compositionStartTime uses default composition time offset of 0' + - 'if no trun samples present', function(assert) { - assert.equal(probe.compositionStartTime({ - 2: 6, - 4: 3 - }, new Uint8Array(noTrunSamples)), - (0x01020304 + 0) / 3, - 'calculated correct composition start time using default offset'); -}); - -QUnit.test('getTimescaleFromMediaHeader gets timescale for version 0 mdhd', function(assert) { - var mdhd = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - // version 0 has 32 bit creation_time, modification_time, and duration - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x03, 0xe8, // timescale = 1000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7 // 'eng' language - ]); - - assert.equal( - probe.getTimescaleFromMediaHeader(mdhd), - 1000, - 'got timescale from version 0 mdhd' - ); -}); - -QUnit.test('getTimescaleFromMediaHeader gets timescale for version 0 mdhd', function(assert) { - var mdhd = new Uint8Array([ - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // version 1 has 64 bit creation_time, modification_time, and duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x03, 0xe8, // timescale = 1000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7 // 'eng' language - ]); - - assert.equal( - probe.getTimescaleFromMediaHeader(mdhd), - 1000, - 'got timescale from version 1 mdhd' - ); -}); - -// --------- -// Test Data -// --------- - -moovWithoutTkhd = - box('moov', - box('trak', - box('mdia', - box('mdhd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x03, 0xe8, // timescale = 1000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7, // 'eng' language - 0x00, 0x00), - box('hdlr', - 0x00, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - mp4Helpers.typeBytes('vide'), // handler_type - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - mp4Helpers.typeBytes('one'), 0x00)))); // name - -moovWithoutMdhd = - box('moov', - box('trak', - box('tkhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x00, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - mp4Helpers.unityMatrix, - 0x01, 0x2c, 0x00, 0x00, // 300 in 16.16 fixed-point - 0x00, 0x96, 0x00, 0x00), // 150 in 16.16 fixed-point - box('mdia', - box('hdlr', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - mp4Helpers.typeBytes('vide'), // handler_type - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - mp4Helpers.typeBytes('one'), 0x00)))); // name - -moofWithTfdt = - box('moof', - box('mfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x04, // track_ID = 4 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x03, 0x04), // baseMediaDecodeTime - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, no first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0a, // signed sample_composition_time_offset = 10 - // sample 2 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x14))); // signed sample_composition_time_offset = 20 - -noTrunSamples = - box('moof', - box('mfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x04, // track_ID = 4 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x03, 0x04), // baseMediaDecodeTime - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x00, // sample_count - 0x00, 0x00, 0x00, 0x00))); // data_offset, no first_sample_flags - - -multiTraf = - box('moof', - box('mfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x04, // track_ID = 4 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x03, 0x04), // baseMediaDecodeTime - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, no first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0a, // signed sample_composition_time_offset = 10 - // sample 2 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x14)), // signed sample_composition_time_offset = 20 - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x02, // track_ID = 2 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x01, 0x02), // baseMediaDecodeTime - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, no first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0b, // signed sample_composition_time_offset = 11 - // sample 2 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x05))); // signed sample_composition_time_offset = 5 - -multiMoof = moofWithTfdt - .concat(box('moof', - box('mfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x06, // track_ID = 6 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x03, 0x04), // baseMediaDecodeTime - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, no first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x14, // signed sample_composition_time_offset = 20 - // sample 2 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0a)))); // signed sample_composition_time_offset = 10 -v1boxes = - box('moof', - box('mfhd', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x01, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x04, // track_ID = 4 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x03, 0x04))); // baseMediaDecodeTime diff --git a/node_modules/mux.js/test/partial.test.js b/node_modules/mux.js/test/partial.test.js deleted file mode 100644 index e7c5a28..0000000 --- a/node_modules/mux.js/test/partial.test.js +++ /dev/null @@ -1,142 +0,0 @@ -var Transmuxer = require('../lib/partial/transmuxer.js'); -var utils = require('./utils'); -var generatePMT = utils.generatePMT; -var videoPes = utils.videoPes; -var audioPes = utils.audioPes; -var packetize = utils.packetize; -var PAT = utils.PAT; - -QUnit.module('Partial Transmuxer - Options'); -[ - {options: {keepOriginalTimestamps: false}}, - {options: {keepOriginalTimestamps: true}}, - {options: {keepOriginalTimestamps: false, baseMediaDecodeTime: 15000}}, - {options: {keepOriginalTimestamps: true, baseMediaDecodeTime: 15000}}, - {options: {keepOriginalTimestamps: false}, baseMediaSetter: 15000}, - {options: {keepOriginalTimestamps: true}, baseMediaSetter: 15000} -].forEach(function(test) { - var createTransmuxer = function() { - var transmuxer = new Transmuxer(test.options); - - if (test.baseMediaSetter) { - transmuxer.setBaseMediaDecodeTime(test.baseMediaSetter); - } - - return transmuxer; - }; - - var name = ''; - - Object.keys(test.options).forEach(function(optionName) { - name += '' + optionName + ' ' + test.options[optionName] + ' '; - }); - - if (test.baseMediaSetter) { - name += 'baseMediaDecodeTime setter ' + test.baseMediaSetter; - } - - QUnit.test('Audio frames after video not trimmed, ' + name, function(assert) { - var - segments = [], - earliestDts = 15000, - transmuxer = createTransmuxer(); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - - // the following transmuxer pushes add tiny video and - // audio data to the transmuxer. When we add the data - // we also set the pts/dts time so that audio should - // not be trimmed. - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, earliestDts + 1))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, earliestDts))); - transmuxer.flush(); - - // the partial transmuxer only generates a video segment - // when all audio frames are trimmed. So we should have an audio and video - // segment - assert.equal(segments.length, 2, 'generated a video and an audio segment'); - assert.equal(segments[0].type, 'video', 'video segment exists'); - assert.equal(segments[1].type, 'audio', 'audio segment exists'); - }); - - QUnit.test('Audio frames trimmed before video, ' + name, function(assert) { - var - segments = [], - earliestDts = 15000, - baseTime = test.options.baseMediaDecodeTime || test.baseMediaSetter || 0, - transmuxer = createTransmuxer(); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - - // the following transmuxer pushes add tiny video and - // audio data to the transmuxer. When we add the data - // we also set the pts/dts time so that audio should - // be trimmed. - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, earliestDts - baseTime - 1))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, earliestDts))); - transmuxer.flush(); - - // the partial transmuxer only generates a video segment - // when all audio frames are trimmed. - if (test.options.keepOriginalTimestamps && !baseTime) { - assert.equal(segments.length, 2, 'generated both a video/audio segment'); - assert.equal(segments[0].type, 'video', 'segment is video'); - assert.equal(segments[1].type, 'audio', 'segment is audio'); - } else { - assert.equal(segments.length, 1, 'generated only a video segment'); - assert.equal(segments[0].type, 'video', 'segment is video'); - } - }); -}); diff --git a/node_modules/mux.js/test/segments/dash-608-captions-init.mp4 b/node_modules/mux.js/test/segments/dash-608-captions-init.mp4 deleted file mode 100644 index f22cffd..0000000 Binary files a/node_modules/mux.js/test/segments/dash-608-captions-init.mp4 and /dev/null differ diff --git a/node_modules/mux.js/test/segments/dash-608-captions-seg.m4s b/node_modules/mux.js/test/segments/dash-608-captions-seg.m4s deleted file mode 100644 index be26d74..0000000 Binary files a/node_modules/mux.js/test/segments/dash-608-captions-seg.m4s and /dev/null differ diff --git a/node_modules/mux.js/test/segments/multi-channel-608-captions.ts b/node_modules/mux.js/test/segments/multi-channel-608-captions.ts deleted file mode 100644 index 31dca2a..0000000 Binary files a/node_modules/mux.js/test/segments/multi-channel-608-captions.ts and /dev/null differ diff --git a/node_modules/mux.js/test/segments/sintel-captions.ts b/node_modules/mux.js/test/segments/sintel-captions.ts deleted file mode 100644 index cbcfb20..0000000 Binary files a/node_modules/mux.js/test/segments/sintel-captions.ts and /dev/null differ diff --git a/node_modules/mux.js/test/segments/test-aac-segment.aac b/node_modules/mux.js/test/segments/test-aac-segment.aac deleted file mode 100644 index bf6148b..0000000 Binary files a/node_modules/mux.js/test/segments/test-aac-segment.aac and /dev/null differ diff --git a/node_modules/mux.js/test/segments/test-middle-pat-pmt.ts b/node_modules/mux.js/test/segments/test-middle-pat-pmt.ts deleted file mode 100644 index edcb952..0000000 Binary files a/node_modules/mux.js/test/segments/test-middle-pat-pmt.ts and /dev/null differ diff --git a/node_modules/mux.js/test/segments/test-no-audio-segment.ts b/node_modules/mux.js/test/segments/test-no-audio-segment.ts deleted file mode 100644 index 76df1f1..0000000 Binary files a/node_modules/mux.js/test/segments/test-no-audio-segment.ts and /dev/null differ diff --git a/node_modules/mux.js/test/segments/test-segment.ts b/node_modules/mux.js/test/segments/test-segment.ts deleted file mode 100644 index 383fbb4..0000000 Binary files a/node_modules/mux.js/test/segments/test-segment.ts and /dev/null differ diff --git a/node_modules/mux.js/test/segments/test-stuffed-pes.ts b/node_modules/mux.js/test/segments/test-stuffed-pes.ts deleted file mode 100644 index 929974e..0000000 Binary files a/node_modules/mux.js/test/segments/test-stuffed-pes.ts and /dev/null differ diff --git a/node_modules/mux.js/test/stream.test.js b/node_modules/mux.js/test/stream.test.js deleted file mode 100644 index 5e07833..0000000 --- a/node_modules/mux.js/test/stream.test.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -var - stream, - Stream = require('../lib/utils/stream'), - QUnit = require('qunit'); - -QUnit.module('Stream', { - beforeEach: function() { - stream = new Stream(); - stream.init(); - } -}); - -QUnit.test('trigger calls listeners', function(assert) { - var args = []; - - stream.on('test', function(data) { - args.push(data); - }); - - stream.trigger('test', 1); - stream.trigger('test', 2); - - assert.deepEqual(args, [1, 2]); -}); - -QUnit.test('callbacks can remove themselves', function(assert) { - var args1 = [], args2 = [], args3 = []; - - stream.on('test', function(event) { - args1.push(event); - }); - stream.on('test', function t(event) { - args2.push(event); - stream.off('test', t); - }); - stream.on('test', function(event) { - args3.push(event); - }); - - stream.trigger('test', 1); - stream.trigger('test', 2); - - assert.deepEqual(args1, [1, 2], 'first callback ran all times'); - assert.deepEqual(args2, [1], 'second callback removed after first run'); - assert.deepEqual(args3, [1, 2], 'third callback ran all times'); -}); diff --git a/node_modules/mux.js/test/transmuxer.test.js b/node_modules/mux.js/test/transmuxer.test.js deleted file mode 100644 index b86118c..0000000 --- a/node_modules/mux.js/test/transmuxer.test.js +++ /dev/null @@ -1,4498 +0,0 @@ -'use strict'; - -var segments = require('data-files!segments'); - -var mp2t = require('../lib/m2ts'), - codecs = require('../lib/codecs'), - flv = require('../lib/flv'), - id3Generator = require('./utils/id3-generator'), - mp4 = require('../lib/mp4'), - QUnit = require('qunit'), - testSegment = segments['test-segment.ts'](), - testMiddlePatPMT = segments['test-middle-pat-pmt.ts'](), - mp4Transmuxer = require('../lib/mp4/transmuxer'), - mp4AudioProperties = mp4Transmuxer.AUDIO_PROPERTIES, - mp4VideoProperties = mp4Transmuxer.VIDEO_PROPERTIES, - generateSegmentTimingInfo = mp4Transmuxer.generateSegmentTimingInfo, - clock = require('../lib/utils/clock'), - utils = require('./utils'), - TransportPacketStream = mp2t.TransportPacketStream, - transportPacketStream, - TransportParseStream = mp2t.TransportParseStream, - transportParseStream, - ElementaryStream = mp2t.ElementaryStream, - elementaryStream, - TimestampRolloverStream = mp2t.TimestampRolloverStream, - timestampRolloverStream, - H264Stream = codecs.h264.H264Stream, - h264Stream, - - VideoSegmentStream = mp4.VideoSegmentStream, - videoSegmentStream, - AudioSegmentStream = mp4.AudioSegmentStream, - audioSegmentStream, - - AdtsStream = codecs.Adts, - adtsStream, - Transmuxer = mp4.Transmuxer, - FlvTransmuxer = flv.Transmuxer, - transmuxer, - NalByteStream = codecs.h264.NalByteStream, - nalByteStream, - - H264_STREAM_TYPE = mp2t.H264_STREAM_TYPE, - ADTS_STREAM_TYPE = mp2t.ADTS_STREAM_TYPE, - METADATA_STREAM_TYPE = mp2t.METADATA_STREAM_TYPE, - - validateTrack, - validateTrackFragment, - - PMT = utils.PMT, - PAT = utils.PAT, - generatePMT = utils.generatePMT, - pesHeader = utils.pesHeader, - packetize = utils.packetize, - videoPes = utils.videoPes, - adtsFrame = utils.adtsFrame, - audioPes = utils.audioPes, - timedMetadataPes = utils.timedMetadataPes; - -mp4.tools = require('../lib/tools/mp4-inspector'); - -QUnit.module('MP2T Packet Stream', { - beforeEach: function() { - transportPacketStream = new TransportPacketStream(); - } -}); -QUnit.test('tester', function(assert) { - assert.ok(true, 'did not throw'); -}); -QUnit.test('empty input does not error', function(assert) { - transportPacketStream.push(new Uint8Array([])); - assert.ok(true, 'did not throw'); -}); -QUnit.test('parses a generic packet', function(assert) { - var - datas = [], - packet = new Uint8Array(188); - - packet[0] = 0x47; // Sync-byte - - transportPacketStream.on('data', function(event) { - datas.push(event); - }); - transportPacketStream.push(packet); - transportPacketStream.flush(); - - assert.equal(1, datas.length, 'fired one event'); - assert.equal(datas[0].byteLength, 188, 'delivered the packet'); -}); - -QUnit.test('buffers partial packets', function(assert) { - var - datas = [], - partialPacket1 = new Uint8Array(187), - partialPacket2 = new Uint8Array(189); - - partialPacket1[0] = 0x47; // Sync-byte - partialPacket2[1] = 0x47; // Sync-byte - - transportPacketStream.on('data', function(event) { - datas.push(event); - }); - transportPacketStream.push(partialPacket1); - - assert.equal(0, datas.length, 'did not fire an event'); - - transportPacketStream.push(partialPacket2); - transportPacketStream.flush(); - - assert.equal(2, datas.length, 'fired events'); - assert.equal(188, datas[0].byteLength, 'parsed the first packet'); - assert.equal(188, datas[1].byteLength, 'parsed the second packet'); -}); - -QUnit.test('parses multiple packets delivered at once', function(assert) { - var datas = [], packetStream = new Uint8Array(188 * 3); - - packetStream[0] = 0x47; // Sync-byte - packetStream[188] = 0x47; // Sync-byte - packetStream[376] = 0x47; // Sync-byte - - transportPacketStream.on('data', function(event) { - datas.push(event); - }); - - transportPacketStream.push(packetStream); - transportPacketStream.flush(); - - assert.equal(3, datas.length, 'fired three events'); - assert.equal(188, datas[0].byteLength, 'parsed the first packet'); - assert.equal(188, datas[1].byteLength, 'parsed the second packet'); - assert.equal(188, datas[2].byteLength, 'parsed the third packet'); -}); - -QUnit.test('resyncs packets', function(assert) { - var datas = [], packetStream = new Uint8Array(188 * 3 - 2); - - packetStream[0] = 0x47; // Sync-byte - packetStream[186] = 0x47; // Sync-byte - packetStream[374] = 0x47; // Sync-byte - - transportPacketStream.on('data', function(event) { - datas.push(event); - }); - - transportPacketStream.push(packetStream); - transportPacketStream.flush(); - - assert.equal(datas.length, 2, 'fired three events'); - assert.equal(datas[0].byteLength, 188, 'parsed the first packet'); - assert.equal(datas[1].byteLength, 188, 'parsed the second packet'); -}); - -QUnit.test('buffers extra after multiple packets', function(assert) { - var datas = [], packetStream = new Uint8Array(188 * 2 + 10); - - packetStream[0] = 0x47; // Sync-byte - packetStream[188] = 0x47; // Sync-byte - packetStream[376] = 0x47; // Sync-byte - - transportPacketStream.on('data', function(event) { - datas.push(event); - }); - - transportPacketStream.push(packetStream); - assert.equal(2, datas.length, 'fired three events'); - assert.equal(188, datas[0].byteLength, 'parsed the first packet'); - assert.equal(188, datas[1].byteLength, 'parsed the second packet'); - - transportPacketStream.push(new Uint8Array(178)); - transportPacketStream.flush(); - - assert.equal(3, datas.length, 'fired a final event'); - assert.equal(188, datas[2].length, 'parsed the finel packet'); -}); - -QUnit.module('MP2T TransportParseStream', { - beforeEach: function() { - transportPacketStream = new TransportPacketStream(); - transportParseStream = new TransportParseStream(); - - transportPacketStream.pipe(transportParseStream); - } -}); - -QUnit.test('parses generic packet properties', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - transportParseStream.push(packetize(PAT)); - transportParseStream.push(packetize(generatePMT({}))); - transportParseStream.push(new Uint8Array([ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0001 tsc:01 afc:10 cc:11 padding: 00 - 0x40, 0x01, 0x6c - ])); - - assert.ok(packet.payloadUnitStartIndicator, 'parsed payload_unit_start_indicator'); - assert.ok(packet.pid, 'parsed PID'); -}); - -QUnit.test('parses piped data events', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - transportParseStream.push(packetize(PAT)); - transportParseStream.push(packetize(generatePMT({}))); - transportParseStream.push(new Uint8Array([ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0001 tsc:01 afc:10 cc:11 padding: 00 - 0x40, 0x01, 0x6c - ])); - - assert.ok(packet, 'parsed a packet'); -}); - -QUnit.test('parses a data packet with adaptation fields', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - transportParseStream.push(new Uint8Array([ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0000 tsc:01 afc:10 cc:11 afl:00 0000 00 stuffing:00 0000 00 pscp:00 0001 padding:0000 - 0x40, 0x00, 0x6c, 0x00, 0x00, 0x10 - ])); - assert.strictEqual(packet.type, 'pat', 'parsed the packet type'); -}); - -QUnit.test('parses a PES packet', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - // setup a program map table - transportParseStream.programMapTable = { - video: 0x0010, - 'timed-metadata': {} - }; - - transportParseStream.push(new Uint8Array([ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0010 tsc:01 afc:01 cc:11 padding:00 - 0x40, 0x02, 0x5c - ])); - assert.strictEqual(packet.type, 'pes', 'parsed a PES packet'); -}); - -QUnit.test('parses packets with variable length adaptation fields and a payload', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - // setup a program map table - transportParseStream.programMapTable = { - video: 0x0010, - 'timed-metadata': {} - }; - - transportParseStream.push(new Uint8Array([ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0010 tsc:01 afc:11 cc:11 afl:00 0000 11 stuffing:00 0000 0000 00 pscp:00 0001 - 0x40, 0x02, 0x7c, 0x0c, 0x00, 0x01 - ])); - assert.strictEqual(packet.type, 'pes', 'parsed a PES packet'); -}); - -QUnit.test('parses the program map table pid from the program association table (PAT)', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - transportParseStream.push(new Uint8Array(PAT)); - assert.ok(packet, 'parsed a packet'); - assert.strictEqual(0x0010, transportParseStream.pmtPid, 'parsed PMT pid'); -}); - -QUnit.test('does not parse PES packets until after the PES has been parsed', function(assert) { - var pesCount = 0; - - transportParseStream.on('data', function(data) { - if (data.type === 'pmt') { - assert.equal(pesCount, 0, 'have not yet parsed any PES packets'); - } else if (data.type === 'pes') { - pesCount++; - } - }); - - transportPacketStream.push(testMiddlePatPMT); -}); - -QUnit.test('parse the elementary streams from a program map table', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - transportParseStream.pmtPid = 0x0010; - - transportParseStream.push(new Uint8Array(PMT.concat(0, 0, 0, 0, 0))); - - assert.ok(packet, 'parsed a packet'); - assert.ok(transportParseStream.programMapTable, 'parsed a program map'); - assert.strictEqual(transportParseStream.programMapTable.video, 0x11, 'associated h264 with pid 0x11'); - assert.strictEqual(transportParseStream.programMapTable.audio, 0x12, 'associated adts with pid 0x12'); - assert.deepEqual(transportParseStream.programMapTable, packet.programMapTable, 'recorded the PMT'); -}); - -QUnit.module('MP2T ElementaryStream', { - beforeEach: function() { - elementaryStream = new ElementaryStream(); - } -}); - -QUnit.test('parses metadata events from PSI packets', function(assert) { - var - metadatas = [], - datas = 0, - sortById = function(left, right) { - return left.id - right.id; - }; - elementaryStream.on('data', function(data) { - if (data.type === 'metadata') { - metadatas.push(data); - } - datas++; - }); - elementaryStream.push({ - type: 'pat' - }); - elementaryStream.push({ - type: 'pmt', - programMapTable: { - video: 1, - audio: 2, - 'timed-metadata': {} - } - }); - - assert.equal(1, datas, 'data fired'); - assert.equal(1, metadatas.length, 'metadata generated'); - metadatas[0].tracks.sort(sortById); - assert.deepEqual(metadatas[0].tracks, [{ - id: 1, - codec: 'avc', - type: 'video', - timelineStartInfo: { - baseMediaDecodeTime: 0 - } - }, { - id: 2, - codec: 'adts', - type: 'audio', - timelineStartInfo: { - baseMediaDecodeTime: 0 - } - }], 'identified two tracks'); -}); - -QUnit.test('parses standalone program stream packets', function(assert) { - var - packets = [], - packetData = [0x01, 0x02], - pesHead = pesHeader(false, 7, 2); - - elementaryStream.on('data', function(packet) { - packets.push(packet); - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHead.concat(packetData)) - }); - elementaryStream.flush(); - - assert.equal(packets.length, 1, 'built one packet'); - assert.equal(packets[0].type, 'audio', 'identified audio data'); - assert.equal(packets[0].data.byteLength, packetData.length, 'parsed the correct payload size'); - assert.equal(packets[0].pts, 7, 'correctly parsed the pts value'); -}); - -QUnit.test('aggregates program stream packets from the transport stream', function(assert) { - var - events = [], - packetData = [0x01, 0x02], - pesHead = pesHeader(false, 7); - - elementaryStream.on('data', function(event) { - events.push(event); - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHead.slice(0, 4)) // Spread PES Header across packets - }); - - assert.equal(events.length, 0, 'buffers partial packets'); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - data: new Uint8Array(pesHead.slice(4).concat(packetData)) - }); - elementaryStream.flush(); - - assert.equal(events.length, 1, 'built one packet'); - assert.equal(events[0].type, 'video', 'identified video data'); - assert.equal(events[0].pts, 7, 'correctly parsed the pts'); - assert.equal(events[0].data.byteLength, packetData.length, 'concatenated transport packets'); -}); - -QUnit.test('aggregates program stream packets from the transport stream with no header data', function(assert) { - var events = [] - - elementaryStream.on('data', function(event) { - events.push(event); - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - data: new Uint8Array([0x1, 0x2, 0x3]) - }); - - assert.equal(events.length, 0, 'buffers partial packets'); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array([0x4, 0x5, 0x6]) - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - data: new Uint8Array([0x7, 0x8, 0x9]) - }); - elementaryStream.flush(); - - assert.equal(events.length, 1, 'built one packet'); - assert.equal(events[0].type, 'video', 'identified video data'); - assert.equal(events[0].data.byteLength, 0, 'empty packet'); -}); - -QUnit.test('parses an elementary stream packet with just a pts', function(assert) { - var packet; - elementaryStream.on('data', function(data) { - packet = data; - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array([ - // pscp:0000 0000 0000 0000 0000 0001 - 0x00, 0x00, 0x01, - // sid:0000 0000 ppl:0000 0000 0000 1001 - 0x00, 0x00, 0x09, - // 10 psc:00 pp:0 dai:1 c:0 ooc:0 - 0x84, - // pdf:10 ef:1 erf:0 dtmf:0 acif:0 pcf:0 pef:0 - 0xc0, - // phdl:0000 0101 '0010' pts:111 mb:1 pts:1111 1111 - 0x05, 0xFF, 0xFF, - // pts:1111 111 mb:1 pts:1111 1111 pts:1111 111 mb:1 - 0xFF, 0xFF, 0xFF, - // "data":0101 - 0x11 - ]) - }); - elementaryStream.flush(); - - assert.ok(packet, 'parsed a packet'); - assert.equal(packet.data.byteLength, 1, 'parsed a single data byte'); - assert.equal(packet.data[0], 0x11, 'parsed the data'); - // 2^33-1 is the maximum value of a 33-bit unsigned value - assert.equal(packet.pts, Math.pow(2, 33) - 1, 'parsed the pts'); -}); - -QUnit.test('parses an elementary stream packet with a pts and dts', function(assert) { - var packet; - elementaryStream.on('data', function(data) { - packet = data; - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array([ - // pscp:0000 0000 0000 0000 0000 0001 - 0x00, 0x00, 0x01, - // sid:0000 0000 ppl:0000 0000 0000 1110 - 0x00, 0x00, 0x0e, - // 10 psc:00 pp:0 dai:1 c:0 ooc:0 - 0x84, - // pdf:11 ef:1 erf:0 dtmf:0 acif:0 pcf:0 pef:0 - 0xe0, - // phdl:0000 1010 '0011' pts:000 mb:1 pts:0000 0000 - 0x0a, 0x21, 0x00, - // pts:0000 000 mb:1 pts:0000 0000 pts:0000 100 mb:1 - 0x01, 0x00, 0x09, - // '0001' dts:000 mb:1 dts:0000 0000 dts:0000 000 mb:1 - 0x11, 0x00, 0x01, - // dts:0000 0000 dts:0000 010 mb:1 - 0x00, 0x05, - // "data":0101 - 0x11 - ]) - }); - elementaryStream.flush(); - - assert.ok(packet, 'parsed a packet'); - assert.equal(packet.data.byteLength, 1, 'parsed a single data byte'); - assert.equal(packet.data[0], 0x11, 'parsed the data'); - assert.equal(packet.pts, 4, 'parsed the pts'); - assert.equal(packet.dts, 2, 'parsed the dts'); -}); - -QUnit.test('parses an elementary stream packet without a pts or dts', function(assert) { - var packet; - elementaryStream.on('data', function(data) { - packet = data; - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHeader().concat([0xaf, 0x01])) - }); - elementaryStream.flush(); - - assert.ok(packet, 'parsed a packet'); - assert.equal(packet.data.byteLength, 2, 'parsed two data bytes'); - assert.equal(packet.data[0], 0xaf, 'parsed the first data byte'); - assert.equal(packet.data[1], 0x01, 'parsed the second data byte'); - assert.ok(!packet.pts, 'did not parse a pts'); - assert.ok(!packet.dts, 'did not parse a dts'); -}); - -QUnit.test('won\'t emit non-video packets if the PES_packet_length is larger than the contents', function(assert) { - var events = []; - var pesHead = pesHeader(false, 1, 5); - - elementaryStream.on('data', function(event) { - events.push(event); - }); - - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: H264_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: ADTS_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: METADATA_STREAM_TYPE, - // data larger than 5 byte dataLength, should still emit event - data: new Uint8Array(pesHead.concat([1, 1, 1, 1, 1, 1, 1, 1, 1])) - }); - - assert.equal(0, events.length, 'buffers partial packets'); - - elementaryStream.flush(); - assert.equal(events.length, 2, 'emitted 2 packets'); - assert.equal(events[0].type, 'video', 'identified video data'); - assert.equal(events[1].type, 'timed-metadata', 'identified timed-metadata'); -}); - -QUnit.test('buffers audio and video program streams individually', function(assert) { - var events = []; - var pesHead = pesHeader(false, 1, 2); - - elementaryStream.on('data', function(event) { - events.push(event); - }); - - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: H264_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: ADTS_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - assert.equal(0, events.length, 'buffers partial packets'); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - data: new Uint8Array(1) - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - data: new Uint8Array(1) - }); - elementaryStream.flush(); - assert.equal(2, events.length, 'parsed a complete packet'); - assert.equal('video', events[0].type, 'identified video data'); - assert.equal('audio', events[1].type, 'identified audio data'); -}); - -QUnit.test('flushes the buffered packets when a new one of that type is started', function(assert) { - var packets = []; - var pesHead = pesHeader(false, 1, 2); - - elementaryStream.on('data', function(packet) { - packets.push(packet); - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: H264_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: ADTS_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1, 2])) - }); - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - data: new Uint8Array(1) - }); - assert.equal(packets.length, 0, 'buffers packets by type'); - - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: H264_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - assert.equal(packets.length, 1, 'built one packet'); - assert.equal(packets[0].type, 'video', 'identified video data'); - assert.equal(packets[0].data.byteLength, 2, 'concatenated packets'); - - elementaryStream.flush(); - assert.equal(packets.length, 3, 'built two more packets'); - assert.equal(packets[1].type, 'video', 'identified video data'); - assert.equal(packets[1].data.byteLength, 1, 'parsed the video payload'); - assert.equal(packets[2].type, 'audio', 'identified audio data'); - assert.equal(packets[2].data.byteLength, 2, 'parsed the audio payload'); -}); - -QUnit.test('buffers and emits timed-metadata', function(assert) { - var packets = []; - var pesHead = pesHeader(false, 1, 4); - - elementaryStream.on('data', function(packet) { - packets.push(packet); - }); - - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: METADATA_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([0, 1])) - }); - elementaryStream.push({ - type: 'pes', - streamType: METADATA_STREAM_TYPE, - data: new Uint8Array([2, 3]) - }); - assert.equal(packets.length, 0, 'buffers metadata until the next start indicator'); - - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: METADATA_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([4, 5])) - }); - elementaryStream.push({ - type: 'pes', - streamType: METADATA_STREAM_TYPE, - data: new Uint8Array([6, 7]) - }); - assert.equal(packets.length, 1, 'built a packet'); - assert.equal(packets[0].type, 'timed-metadata', 'identified timed-metadata'); - assert.deepEqual(packets[0].data, new Uint8Array([0, 1, 2, 3]), 'concatenated the data'); - - elementaryStream.flush(); - assert.equal(packets.length, 2, 'flushed a packet'); - assert.equal(packets[1].type, 'timed-metadata', 'identified timed-metadata'); - assert.deepEqual(packets[1].data, new Uint8Array([4, 5, 6, 7]), 'included the data'); -}); - -QUnit.test('drops packets with unknown stream types', function(assert) { - var packets = []; - elementaryStream.on('data', function(packet) { - packets.push(packet); - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - data: new Uint8Array(1) - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - data: new Uint8Array(1) - }); - - assert.equal(packets.length, 0, 'ignored unknown packets'); -}); - -QUnit.module('MP2T TimestampRolloverStream', { - beforeEach: function() { - timestampRolloverStream = new TimestampRolloverStream('audio'); - elementaryStream = new ElementaryStream(); - elementaryStream.pipe(timestampRolloverStream); - } -}); - -QUnit.test('Correctly parses rollover PTS', function(assert) { - var - maxTS = 8589934592, - packets = [], - packetData = [0x01, 0x02], - pesHeadOne = pesHeader(false, maxTS - 400, 2), - pesHeadTwo = pesHeader(false, maxTS - 100, 2), - pesHeadThree = pesHeader(false, maxTS, 2), - pesHeadFour = pesHeader(false, 50, 2); - - timestampRolloverStream.on('data', function(packet) { - packets.push(packet); - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHeadOne.concat(packetData)) - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHeadTwo.concat(packetData)) - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHeadThree.concat(packetData)) - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHeadFour.concat(packetData)) - }); - elementaryStream.flush(); - - assert.equal(packets.length, 4, 'built four packets'); - assert.equal(packets[0].type, 'audio', 'identified audio data'); - assert.equal(packets[0].data.byteLength, packetData.length, 'parsed the correct payload size'); - assert.equal(packets[0].pts, maxTS - 400, 'correctly parsed the pts value'); - assert.equal(packets[1].pts, maxTS - 100, 'Does not rollover on minor change'); - assert.equal(packets[2].pts, maxTS, 'correctly parses the max pts value'); - assert.equal(packets[3].pts, maxTS + 50, 'correctly parsed the rollover pts value'); -}); - -QUnit.test('Correctly parses multiple PTS rollovers', function(assert) { - var - maxTS = 8589934592, - packets = [], - packetData = [0x01, 0x02], - pesArray = [pesHeader(false, 1, 2), - pesHeader(false, Math.floor(maxTS * (1 / 3)), 2), - pesHeader(false, Math.floor(maxTS * (2 / 3)), 2), - pesHeader(false, 1, 2), - pesHeader(false, Math.floor(maxTS * (1 / 3)), 2), - pesHeader(false, Math.floor(maxTS * (2 / 3)), 2), - pesHeader(false, 1, 2), - pesHeader(false, Math.floor(maxTS * (1 / 3)), 2), - pesHeader(false, Math.floor(maxTS * (2 / 3)), 2), - pesHeader(false, 1, 2)]; - - timestampRolloverStream.on('data', function(packet) { - packets.push(packet); - }); - - while (pesArray.length > 0) { - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesArray.shift().concat(packetData)) - }); - elementaryStream.flush(); - } - - - assert.equal(packets.length, 10, 'built ten packets'); - assert.equal(packets[0].pts, 1, 'correctly parsed the pts value'); - assert.equal(packets[1].pts, Math.floor(maxTS * (1 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[2].pts, Math.floor(maxTS * (2 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[3].pts, maxTS + 1, 'correctly parsed the pts value'); - assert.equal(packets[4].pts, maxTS + Math.floor(maxTS * (1 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[5].pts, maxTS + Math.floor(maxTS * (2 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[6].pts, (2 * maxTS) + 1, 'correctly parsed the pts value'); - assert.equal(packets[7].pts, (2 * maxTS) + Math.floor(maxTS * (1 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[8].pts, (2 * maxTS) + Math.floor(maxTS * (2 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[9].pts, (3 * maxTS) + 1, 'correctly parsed the pts value'); -}); - -QUnit.module('H264 Stream', { - beforeEach: function() { - h264Stream = new H264Stream(); - } -}); - -QUnit.test('properly parses seq_parameter_set_rbsp nal units', function(assert) { - var - data, - expectedRBSP = new Uint8Array([ - 0x42, 0xc0, 0x1e, 0xd9, - 0x00, 0xb4, 0x35, 0xf9, - 0xe1, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, - 0x3c, 0x0f, 0x16, 0x2e, - 0x48 - ]), - expectedConfig = { - profileIdc: 66, - levelIdc: 30, - profileCompatibility: 192, - width: 720, - height: 404, - sarRatio: undefined - }; - - h264Stream.on('data', function(event) { - data = event; - }); - - // QUnit.test SPS: - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x67, 0x42, 0xc0, 0x1e, - 0xd9, 0x00, 0xb4, 0x35, - 0xf9, 0xe1, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x00, - 0x00, 0x03, 0x00, 0x3c, - 0x0f, 0x16, 0x2e, 0x48, - 0x00, 0x00, 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - assert.deepEqual(data.escapedRBSP, expectedRBSP, 'properly removed Emulation Prevention Bytes from the RBSP'); - - assert.deepEqual(data.config, expectedConfig, 'parsed the sps'); -}); - -QUnit.test('Properly parses seq_parameter_set VUI nal unit', function(assert) { - var - data, - expectedConfig = { - profileIdc: 66, - levelIdc: 30, - profileCompatibility: 192, - width: 64, - height: 16, - sarRatio: [65528, 16384] - }; - - h264Stream.on('data', function(event) { - data = event; - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x67, 0x42, 0xc0, 0x1e, - 0xd9, 0xff, 0xff, 0xff, - 0xff, 0xe1, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x00, - 0x00, 0x03, 0x00, 0x3c, - 0x0f, 0x16, 0x2e, 0x48, - 0xff, 0x00, 0x00, 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - assert.deepEqual(data.config, expectedConfig, 'parsed the sps'); -}); - -QUnit.test('Properly parses seq_parameter_set nal unit with defined sarRatio', function(assert) { - var - data, - expectedConfig = { - profileIdc: 77, - levelIdc: 21, - profileCompatibility: 64, - width: 640, - height: 480, - sarRatio: [20, 11] - }; - - h264Stream.on('data', function(event) { - data = event; - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x67, 0x4d, 0x40, 0x15, - 0xec, 0xa0, 0xb0, 0x7b, - 0x60, 0xe2, 0x00, 0x00, - 0x07, 0xd2, 0x00, 0x01, - 0xd4, 0xc0, 0x1e, 0x2c, - 0x5b, 0x2c, 0x00, 0x00, - 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - assert.deepEqual(data.config, expectedConfig, 'parsed the sps'); -}); - -QUnit.test('Properly parses seq_parameter_set nal unit with extended sarRatio', function(assert) { - var - data, - expectedConfig = { - profileIdc: 77, - levelIdc: 21, - profileCompatibility: 64, - width: 403, - height: 480, - sarRatio: [8, 7] - }; - - h264Stream.on('data', function(event) { - data = event; - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x67, 0x4d, 0x40, 0x15, - 0xec, 0xa0, 0xb0, 0x7b, - 0x7F, 0xe0, 0x01, 0x00, - 0x00, 0xf0, 0x00, 0x00, - 0x00, 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - assert.deepEqual(data.config, expectedConfig, 'parsed the sps'); -}); - -QUnit.test('Properly parses seq_parameter_set nal unit without VUI', function(assert) { - var - data, - expectedConfig = { - profileIdc: 77, - levelIdc: 21, - profileCompatibility: 64, - width: 352, - height: 480, - sarRatio: undefined - }; - - h264Stream.on('data', function(event) { - data = event; - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x67, 0x4d, 0x40, 0x15, - 0xec, 0xa0, 0xb0, 0x7b, - 0x02, 0x00, 0x00, 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - assert.deepEqual(data.config, expectedConfig, 'parsed the sps'); -}); - -QUnit.test('unpacks nal units from simple byte stream framing', function(assert) { - var data; - h264Stream.on('data', function(event) { - data = event; - }); - - // the simplest byte stream framing: - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09, 0x07, - 0x00, 0x00, 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'access_unit_delimiter_rbsp', 'identified an access unit delimiter'); - assert.equal(data.data.length, 2, 'calculated nal unit length'); - assert.equal(data.data[1], 7, 'read a payload byte'); -}); - -QUnit.test('unpacks nal units from byte streams split across pushes', function(assert) { - var data; - h264Stream.on('data', function(event) { - data = event; - }); - - // handles byte streams split across pushes - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09, 0x07, 0x06, 0x05, - 0x04 - ]) - }); - assert.ok(!data, 'buffers NAL units across events'); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x03, 0x02, 0x01, - 0x00, 0x00, 0x01 - ]) - }); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'access_unit_delimiter_rbsp', 'identified an access unit delimiter'); - assert.equal(data.data.length, 8, 'calculated nal unit length'); - assert.equal(data.data[1], 7, 'read a payload byte'); -}); - -QUnit.test('buffers nal unit trailing zeros across pushes', function(assert) { - var data = []; - h264Stream.on('data', function(event) { - data.push(event); - }); - - // lots of zeros after the nal, stretching into the next push - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00 - ]) - }); - assert.equal(data.length, 1, 'delivered the first nal'); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, - 0x00, 0x00, 0x01, - 0x09, 0x06, - 0x00, 0x00, 0x01 - ]) - }); - assert.equal(data.length, 2, 'generated data events'); - assert.equal(data[0].data.length, 2, 'ignored trailing zeros'); - assert.equal(data[0].data[0], 0x09, 'found the first nal start'); - assert.equal(data[1].data.length, 2, 'found the following nal start'); - assert.equal(data[1].data[0], 0x09, 'found the second nal start'); -}); - -QUnit.test('unpacks nal units from byte streams with split sync points', function(assert) { - var data; - h264Stream.on('data', function(event) { - data = event; - }); - - // handles sync points split across pushes - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09, 0x07, - 0x00]) - }); - assert.ok(!data, 'buffers NAL units across events'); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x01 - ]) - }); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'access_unit_delimiter_rbsp', 'identified an access unit delimiter'); - assert.equal(data.data.length, 2, 'calculated nal unit length'); - assert.equal(data.data[1], 7, 'read a payload byte'); -}); - -QUnit.test('parses nal unit types', function(assert) { - var data; - h264Stream.on('data', function(event) { - data = event; - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09 - ]) - }); - h264Stream.flush(); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'access_unit_delimiter_rbsp', 'identified an access unit delimiter'); - - data = null; - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x07, - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x35, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ]) - }); - h264Stream.flush(); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - - data = null; - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x08, 0x01 - ]) - }); - h264Stream.flush(); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'pic_parameter_set_rbsp', 'identified a picture parameter set'); - - data = null; - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x05, 0x01 - ]) - }); - h264Stream.flush(); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'slice_layer_without_partitioning_rbsp_idr', 'identified a key frame'); - - data = null; - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x01 - ]) - }); - h264Stream.flush(); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'sei_rbsp', 'identified a supplemental enhancement information unit'); -}); - -// MP4 expects H264 (aka AVC) data to be in storage format. Storage -// format is optimized for reliable, random-access media in contrast -// to the byte stream format that retransmits metadata regularly to -// allow decoders to quickly begin operation from wherever in the -// broadcast they begin receiving. -// Details on the byte stream format can be found in Annex B of -// Recommendation ITU-T H.264. -// The storage format is described in ISO/IEC 14496-15 -QUnit.test('strips byte stream framing during parsing', function(assert) { - var data = []; - h264Stream.on('data', function(event) { - data.push(event); - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - // -- NAL unit start - // zero_byte - 0x00, - // start_code_prefix_one_3bytes - 0x00, 0x00, 0x01, - // nal_unit_type (picture parameter set) - 0x08, - // fake data - 0x01, 0x02, 0x03, 0x04, - 0x05, 0x06, 0x07, - // trailing_zero_8bits * 5 - 0x00, 0x00, 0x00, 0x00, - 0x00, - - // -- NAL unit start - // zero_byte - 0x00, - // start_code_prefix_one_3bytes - 0x00, 0x00, 0x01, - // nal_unit_type (access_unit_delimiter_rbsp) - 0x09, - // fake data - 0x06, 0x05, 0x04, 0x03, - 0x02, 0x01, 0x00 - ]) - }); - h264Stream.flush(); - - assert.equal(data.length, 2, 'parsed two NAL units'); - assert.deepEqual(new Uint8Array([ - 0x08, - 0x01, 0x02, 0x03, 0x04, - 0x05, 0x06, 0x07 - ]), new Uint8Array(data[0].data), 'parsed the first NAL unit'); - assert.deepEqual(new Uint8Array([ - 0x09, - 0x06, 0x05, 0x04, 0x03, - 0x02, 0x01, 0x00 - ]), new Uint8Array(data[1].data), 'parsed the second NAL unit'); -}); - -QUnit.test('can be reset', function(assert) { - var input = { - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09, 0x07, - 0x00, 0x00, 0x01 - ]) - }, data = []; - // only the laQUnit.test event is relevant for this QUnit.test - h264Stream.on('data', function(event) { - data.push(event); - }); - - h264Stream.push(input); - h264Stream.flush(); - h264Stream.push(input); - h264Stream.flush(); - - assert.equal(data.length, 2, 'generated two data events'); - assert.equal(data[1].nalUnitType, 'access_unit_delimiter_rbsp', 'identified an access unit delimiter'); - assert.equal(data[1].data.length, 2, 'calculated nal unit length'); - assert.equal(data[1].data[1], 7, 'read a payload byte'); -}); - -QUnit.module('VideoSegmentStream', { - beforeEach: function() { - var track = {}; - var options = {}; - videoSegmentStream = new VideoSegmentStream(track, options); - videoSegmentStream.track = track; - videoSegmentStream.options = options; - videoSegmentStream.track.timelineStartInfo = { - dts: 10, - pts: 10, - baseMediaDecodeTime: 0 - }; - } -}); - -// see ISO/IEC 14496-15, Section 5 "AVC elementary streams and sample definitions" -QUnit.test('concatenates NAL units into AVC elementary streams', function(assert) { - var segment, boxes; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - videoSegmentStream.push({ - nalUnitType: 'access_unit_delimiter_rbsp', - data: new Uint8Array([0x09, 0x01]) - }); - videoSegmentStream.push({ - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - data: new Uint8Array([0x05, 0x01]) - }); - videoSegmentStream.push({ - data: new Uint8Array([ - 0x08, - 0x01, 0x02, 0x03 - ]) - }); - videoSegmentStream.push({ - data: new Uint8Array([ - 0x08, - 0x04, 0x03, 0x02, 0x01, 0x00 - ]) - }); - videoSegmentStream.flush(); - - assert.ok(segment, 'generated a data event'); - boxes = mp4.tools.inspect(segment); - assert.equal(boxes[1].byteLength, - (2 + 4) + (2 + 4) + (4 + 4) + (4 + 6), - 'wrote the correct number of bytes'); - assert.deepEqual(new Uint8Array(segment.subarray(boxes[0].size + 8)), new Uint8Array([ - 0, 0, 0, 2, - 0x09, 0x01, - 0, 0, 0, 2, - 0x05, 0x01, - 0, 0, 0, 4, - 0x08, 0x01, 0x02, 0x03, - 0, 0, 0, 6, - 0x08, 0x04, 0x03, 0x02, 0x01, 0x00 - ]), 'wrote an AVC stream into the mdat'); -}); - -QUnit.test('infers sample durations from DTS values', function(assert) { - var segment, boxes, samples; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 4 - }); - videoSegmentStream.flush(); - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 3, 'generated three samples'); - assert.equal(samples[0].duration, 1, 'set the first sample duration'); - assert.equal(samples[1].duration, 2, 'set the second sample duration'); - assert.equal(samples[2].duration, 2, 'inferred the final sample duration'); -}); - -QUnit.test('filters pre-IDR samples and calculate duration correctly', function(assert) { - var segment, boxes, samples; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 4 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 2, 'generated two samples, filters out pre-IDR'); - assert.equal(samples[0].duration, 3, 'set the first sample duration'); - assert.equal(samples[1].duration, 3, 'set the second sample duration'); -}); - -QUnit.test('holds onto the last GOP and prepends the subsequent push operation with that GOP', function(assert) { - var segment, boxes, samples; - - videoSegmentStream.track.timelineStartInfo.dts = 0; - - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'seq_parameter_set_rbsp', - config: {}, - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x66, 0x66]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 2, - pts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x03]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x99, 0x99]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x04]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 4, - pts: 4 - }); - videoSegmentStream.flush(); - - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 5, - pts: 5 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 6, - pts: 6 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'seq_parameter_set_rbsp', - config: {}, - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x11, 0x11]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 6, - pts: 6 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 4, 'generated four samples, two from previous segment'); - assert.equal(samples[0].size, 12, 'first sample is an AUD + IDR pair'); - assert.equal(samples[1].size, 6, 'second sample is an AUD'); - assert.equal(samples[2].size, 6, 'third sample is an AUD'); - assert.equal(samples[3].size, 24, 'fourth sample is an AUD + PPS + SPS + IDR'); -}); - -QUnit.test('doesn\'t prepend the last GOP if the next segment has earlier PTS', function(assert) { - var segment, boxes, samples; - - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 10, - pts: 10 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x66, 0x66]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 10, - pts: 10 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 11, - pts: 11 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x03]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 12, - pts: 12 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x99, 0x99]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 12, - pts: 12 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x04]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 13, - pts: 13 - }); - videoSegmentStream.flush(); - - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 5, - pts: 5 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 6, - pts: 6 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x11, 0x11]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 6, - pts: 6 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 1, 'generated one sample'); - assert.equal(samples[0].size, 12, 'first sample is an AUD + IDR pair'); -}); - -QUnit.test('doesn\'t prepend the last GOP if the next segment has different PPS or SPS', function(assert) { - var segment, boxes, samples; - - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'seq_parameter_set_rbsp', - config: {}, - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x66, 0x66]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 2, - pts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x03]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x99, 0x99]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x04]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 4, - pts: 4 - }); - videoSegmentStream.flush(); - - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 5, - pts: 5 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 6, - pts: 6 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x01]), - nalUnitType: 'seq_parameter_set_rbsp', - config: {}, - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x01]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x11, 0x11]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 6, - pts: 6 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 1, 'generated one sample'); - assert.equal(samples[0].size, 24, 'first sample is an AUD + PPS + SPS + IDR'); -}); - -QUnit.test('doesn\'t prepend the last GOP if the next segment is more than 1 seconds in the future', function(assert) { - var segment, boxes, samples; - - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x66, 0x66]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 2, - pts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x03]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x99, 0x99]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x04]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 4, - pts: 4 - }); - videoSegmentStream.flush(); - - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1000000, - pts: 1000000 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1000001, - pts: 1000001 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x11, 0x11]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1000001, - pts: 1000001 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 1, 'generated one sample'); - assert.equal(samples[0].size, 12, 'first sample is an AUD + IDR pair'); -}); - -QUnit.test('track values from seq_parameter_set_rbsp should be cleared by a flush', function(assert) { - var track; - videoSegmentStream.on('data', function(data) { - track = data.track; - }); - videoSegmentStream.push({ - data: new Uint8Array([0xFF]), - nalUnitType: 'access_unit_delimiter_rbsp' - }); - videoSegmentStream.push({ - data: new Uint8Array([0xFF]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr' - }); - videoSegmentStream.push({ - data: new Uint8Array([0xFF]), - nalUnitType: 'seq_parameter_set_rbsp', - config: { - width: 123, - height: 321, - profileIdc: 1, - levelIdc: 2, - profileCompatibility: 3 - }, - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x88]), - nalUnitType: 'seq_parameter_set_rbsp', - config: { - width: 1234, - height: 4321, - profileIdc: 4, - levelIdc: 5, - profileCompatibility: 6 - }, - dts: 1 - }); - videoSegmentStream.flush(); - - assert.equal(track.width, 123, 'width is set by first SPS'); - assert.equal(track.height, 321, 'height is set by first SPS'); - assert.equal(track.sps[0][0], 0xFF, 'first sps is 0xFF'); - assert.equal(track.profileIdc, 1, 'profileIdc is set by first SPS'); - assert.equal(track.levelIdc, 2, 'levelIdc is set by first SPS'); - assert.equal(track.profileCompatibility, 3, 'profileCompatibility is set by first SPS'); - - videoSegmentStream.push({ - data: new Uint8Array([0x99]), - nalUnitType: 'seq_parameter_set_rbsp', - config: { - width: 300, - height: 200, - profileIdc: 11, - levelIdc: 12, - profileCompatibility: 13 - }, - dts: 1 - }); - videoSegmentStream.flush(); - - assert.equal(track.width, 300, 'width is set by first SPS after flush'); - assert.equal(track.height, 200, 'height is set by first SPS after flush'); - assert.equal(track.sps.length, 1, 'there is one sps'); - assert.equal(track.sps[0][0], 0x99, 'first sps is 0x99'); - assert.equal(track.profileIdc, 11, 'profileIdc is set by first SPS after flush'); - assert.equal(track.levelIdc, 12, 'levelIdc is set by first SPS after flush'); - assert.equal(track.profileCompatibility, 13, 'profileCompatibility is set by first SPS after flush'); -}); - -QUnit.test('track pps from pic_parameter_set_rbsp should be cleared by a flush', function(assert) { - var track; - videoSegmentStream.on('data', function(data) { - track = data.track; - }); - videoSegmentStream.push({ - data: new Uint8Array([0xFF]), - nalUnitType: 'access_unit_delimiter_rbsp' - }); - videoSegmentStream.push({ - data: new Uint8Array([0xFF]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr' - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x02]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1 - }); - videoSegmentStream.flush(); - - assert.equal(track.pps[0][0], 0x01, 'first pps is 0x01'); - - videoSegmentStream.push({ - data: new Uint8Array([0x03]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1 - }); - videoSegmentStream.flush(); - - assert.equal(track.pps[0][0], 0x03, 'first pps is 0x03 after a flush'); -}); - -QUnit.test('calculates compositionTimeOffset values from the PTS/DTS', function(assert) { - var segment, boxes, samples; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 4 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 3, 'generated three samples'); - assert.equal(samples[0].compositionTimeOffset, 0, 'calculated compositionTimeOffset'); - assert.equal(samples[1].compositionTimeOffset, 1, 'calculated compositionTimeOffset'); - assert.equal(samples[2].compositionTimeOffset, 3, 'calculated compositionTimeOffset'); -}); - -QUnit.test('calculates baseMediaDecodeTime values from the first DTS ever seen and subsequent segments\' lowest DTS', function(assert) { - var segment, boxes, tfdt; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 200, - pts: 200 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 300, - pts: 300 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - tfdt = boxes[0].boxes[1].boxes[1]; - assert.equal(tfdt.baseMediaDecodeTime, 90, 'calculated baseMediaDecodeTime'); -}); - -QUnit.test('doesn\'t adjust baseMediaDecodeTime when configured to keep original timestamps', function(assert) { - videoSegmentStream.options.keepOriginalTimestamps = true; - - var segment, boxes, tfdt; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 200, - pts: 200 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 300, - pts: 300 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - tfdt = boxes[0].boxes[1].boxes[1]; - assert.equal(tfdt.baseMediaDecodeTime, 100, 'calculated baseMediaDecodeTime'); -}); - -QUnit.test('calculates baseMediaDecodeTime values relative to a customizable baseMediaDecodeTime', function(assert) { - var segment, boxes, tfdt, baseMediaDecodeTimeValue; - - // Set the baseMediaDecodeTime to something over 2^32 to ensure - // that the version 1 TFDT box is being created correctly - baseMediaDecodeTimeValue = Math.pow(2, 32) + 100; - - videoSegmentStream.track.timelineStartInfo = { - dts: 10, - pts: 10, - baseMediaDecodeTime: baseMediaDecodeTimeValue - }; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 200, - pts: 200 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 300, - pts: 300 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - tfdt = boxes[0].boxes[1].boxes[1]; - - // The timeline begins at 10 and the first sample has a dts of - // 100, so the baseMediaDecodeTime should be equal to (100 - 10) - assert.equal(tfdt.baseMediaDecodeTime, baseMediaDecodeTimeValue + 90, 'calculated baseMediaDecodeTime'); -}); - -QUnit.test('do not subtract the first frame\'s compositionTimeOffset from baseMediaDecodeTime', function(assert) { - var segment, boxes, tfdt; - videoSegmentStream.track.timelineStartInfo = { - dts: 10, - pts: 10, - baseMediaDecodeTime: 100 - }; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 50, - pts: 60 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 50, - pts: 60 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 100, - pts: 110 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 150, - pts: 160 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - tfdt = boxes[0].boxes[1].boxes[1]; - - // The timelineStartInfo's bMDT is 100 and that corresponds to a dts/pts of 10 - // The first frame has a dts 50 so the bMDT is calculated as: (50 - 10) + 100 = 140 - assert.equal(tfdt.baseMediaDecodeTime, 140, 'calculated baseMediaDecodeTime'); -}); - -QUnit.test('video segment stream triggers segmentTimingInfo with timing info', -function(assert) { - var - segmentTimingInfoArr = [], - baseMediaDecodeTime = 40, - startingDts = 50, - startingPts = 60, - lastFrameStartDts = 150, - lastFrameStartPts = 160; - - videoSegmentStream.on('segmentTimingInfo', function(segmentTimingInfo) { - segmentTimingInfoArr.push(segmentTimingInfo); - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: startingDts, - pts: startingPts - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: startingDts, - pts: startingPts - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 100, - pts: 110 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: lastFrameStartDts, - pts: lastFrameStartPts - }); - videoSegmentStream.flush(); - - assert.equal(segmentTimingInfoArr.length, 1, 'triggered segmentTimingInfo once'); - assert.equal( - baseMediaDecodeTime, - segmentTimingInfoArr[0].baseMediaDecodeTime, - 'set baseMediaDecodeTime' - ); - assert.deepEqual(segmentTimingInfoArr[0], { - start: { - // baseMediaDecodeTime - dts: 40, - // baseMediaDecodeTime + startingPts - startingDts - pts: 40 + 60 - 50 - }, - end: { - // because no duration is provided in this test, the duration will instead be based - // on the previous frame, which will be the start of this frame minus the end of the - // last frame, or 150 - 100 = 50, which gets added to lastFrameStartDts - startDts = - // 150 - 50 = 100 - // + baseMediaDecodeTime - dts: 40 + 100 + 50, - pts: 40 + 100 + 50 - }, - prependedContentDuration: 0, - baseMediaDecodeTime: baseMediaDecodeTime - }, 'triggered correct segment timing info'); -}); - -QUnit.test('aignGopsAtStart_ filters gops appropriately', function(assert) { - var gopsToAlignWith, gops, actual, expected; - - // atog === arrayToGops - var atog = function(list) { - var mapped = list.map(function(item) { - return { - pts: item, - dts: item, - nalCount: 1, - duration: 1, - byteLength: 1 - }; - }); - - mapped.byteLength = mapped.length; - mapped.nalCount = mapped.length; - mapped.duration = mapped.length; - mapped.dts = mapped[0].dts; - mapped.pts = mapped[0].pts; - - return mapped; - }; - - // no gops to trim, all gops start after any alignment candidates - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([10, 12, 13, 14, 16]); - expected = atog([10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, all gops start after any alignment candidates'); - - // no gops to trim, first gop has a match with first alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([0, 2, 4, 6, 8]); - expected = atog([0, 2, 4, 6, 8]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with first alignment candidate'); - - // no gops to trim, first gop has a match with last alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([8, 10, 12, 13, 14, 16]); - expected = atog([8, 10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with last alignment candidate'); - - // no gops to trim, first gop has a match with an alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([6, 9, 10, 12, 13, 14, 16]); - expected = atog([6, 9, 10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with an alignment candidate'); - - // all gops trimmed, all gops come before first alignment candidate - gopsToAlignWith = atog([10, 12, 13, 14, 16]); - gops = atog([0, 2, 4, 6, 8]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops come before first alignment candidate'); - - // all gops trimmed, all gops come before last alignment candidate, no match found - gopsToAlignWith = atog([10, 12, 13, 14, 16]); - gops = atog([0, 2, 4, 6, 8, 11, 15]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops come before last alignment candidate, no match found'); - - // all gops trimmed, all gops contained between alignment candidates, no match found - gopsToAlignWith = atog([6, 10, 12, 13, 14, 16]); - gops = atog([7, 8, 9, 11, 15]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops contained between alignment candidates, no match found'); - - // some gops trimmed, some gops before first alignment candidate - // match on first alignment candidate - gopsToAlignWith = atog([9, 10, 13, 16]); - gops = atog([7, 8, 9, 10, 12]); - expected = atog([9, 10, 12]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on first alignment candidate'); - - // some gops trimmed, some gops before first alignment candidate - // match on an alignment candidate - gopsToAlignWith = atog([9, 10, 13, 16]); - gops = atog([7, 8, 11, 13, 14]); - expected = atog([13, 14]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on an alignment candidate'); - - // some gops trimmed, some gops before first alignment candidate - // match on last alignment candidate - gopsToAlignWith = atog([9, 10, 13, 16]); - gops = atog([7, 8, 11, 12, 15, 16]); - expected = atog([16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on last alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // match on an alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 9, 11, 13]); - expected = atog([9, 11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'match on an alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // match on last alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 7, 10, 13]); - expected = atog([10, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'match on last alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // no match found - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 7, 13, 15]); - expected = atog([13, 15]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'no match found'); - - // some gops trimmed, gops contained between alignment candidates - // match with an alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([2, 4, 6, 8]); - expected = atog([6, 8]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, gops contained between alignment candidates,' + - 'match with an alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // no match - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 8, 11, 13]); - expected = atog([11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'no match'); - - // some gops trimmed, alignment candidates contained between gops - // match with first alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 3, 4, 5, 9, 10, 11]); - expected = atog([3, 4, 5, 9, 10, 11]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with first alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // match with last alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 8, 10, 13, 15]); - expected = atog([10, 13, 15]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with last alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // match with an alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 6, 9, 11, 13]); - expected = atog([6, 9, 11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with an alignment candidate'); -}); - -QUnit.test('alignGopsAtEnd_ filters gops appropriately', function(assert) { - var gopsToAlignWith, gops, actual, expected; - - // atog === arrayToGops - var atog = function(list) { - var mapped = list.map(function(item) { - return { - pts: item, - dts: item, - nalCount: 1, - duration: 1, - byteLength: 1 - }; - }); - - mapped.byteLength = mapped.length; - mapped.nalCount = mapped.length; - mapped.duration = mapped.length; - mapped.dts = mapped[0].dts; - mapped.pts = mapped[0].pts; - - return mapped; - }; - - // no gops to trim, all gops start after any alignment candidates - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([10, 12, 13, 14, 16]); - expected = atog([10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, all gops start after any alignment candidates'); - - // no gops to trim, first gop has a match with first alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([0, 1, 3, 5, 7]); - expected = atog([0, 1, 3, 5, 7]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with first alignment candidate'); - - // no gops to trim, first gop has a match with last alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([8, 10, 12, 13, 14, 16]); - expected = atog([8, 10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with last alignment candidate'); - - // no gops to trim, first gop has a match with an alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([6, 9, 10, 12, 13, 14, 16]); - expected = atog([6, 9, 10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with an alignment candidate'); - - // all gops trimmed, all gops come before first alignment candidate - gopsToAlignWith = atog([10, 12, 13, 14, 16]); - gops = atog([0, 2, 4, 6, 8]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops come before first alignment candidate'); - - // all gops trimmed, all gops come before last alignment candidate, no match found - gopsToAlignWith = atog([10, 12, 13, 14, 16]); - gops = atog([0, 2, 4, 6, 8, 11, 15]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops come before last alignment candidate, no match found'); - - gopsToAlignWith = atog([10, 12, 13, 14, 16]); - gops = atog([8, 11, 15]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops come before last alignment candidate, no match found'); - - // all gops trimmed, all gops contained between alignment candidates, no match found - gopsToAlignWith = atog([6, 10, 12, 13, 14, 16]); - gops = atog([7, 8, 9, 11, 15]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops contained between alignment candidates, no match found'); - - // some gops trimmed, some gops before first alignment candidate - // match on first alignment candidate - gopsToAlignWith = atog([9, 11, 13, 16]); - gops = atog([7, 8, 9, 10, 12]); - expected = atog([9, 10, 12]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on first alignment candidate'); - - // some gops trimmed, some gops before first alignment candidate - // match on an alignment candidate - gopsToAlignWith = atog([9, 10, 11, 13, 16]); - gops = atog([7, 8, 11, 13, 14, 15]); - expected = atog([13, 14, 15]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on an alignment candidate'); - - // some gops trimmed, some gops before first alignment candidate - // match on last alignment candidate - gopsToAlignWith = atog([9, 10, 13, 16]); - gops = atog([7, 8, 11, 12, 15, 16]); - expected = atog([16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on last alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // match on an alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 6, 9, 11, 13]); - expected = atog([9, 11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'match on an alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // match on last alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 7, 9, 10, 13]); - expected = atog([10, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'match on last alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // no match found - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 7, 13, 15]); - expected = atog([13, 15]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'no match found'); - - // some gops trimmed, gops contained between alignment candidates - // match with an alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([2, 4, 6, 8]); - expected = atog([6, 8]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, gops contained between alignment candidates,' + - 'match with an alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // no match - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 8, 11, 13]); - expected = atog([11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'no match'); - - // some gops trimmed, alignment candidates contained between gops - // match with first alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 3, 4, 5, 11]); - expected = atog([3, 4, 5, 11]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with first alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // match with last alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 8, 10, 13, 15]); - expected = atog([10, 13, 15]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with last alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // match with an alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 6, 9, 11, 13]); - expected = atog([9, 11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with an alignment candidate'); -}); - -QUnit.test('generateSegmentTimingInfo generates correct timing info object', function(assert) { - var - firstFrame = { - dts: 12, - pts: 14, - duration: 3 - }, - lastFrame = { - dts: 120, - pts: 140, - duration: 4 - }, - baseMediaDecodeTime = 20, - prependedContentDuration = 0; - - assert.deepEqual( - generateSegmentTimingInfo( - baseMediaDecodeTime, - firstFrame.dts, - firstFrame.pts, - lastFrame.dts + lastFrame.duration, - lastFrame.pts + lastFrame.duration, - prependedContentDuration - ), { - start: { - // baseMediaDecodeTime, - dts: 20, - // baseMediaDecodeTime + firstFrame.pts - firstFrame.dts - pts: 20 + 14 - 12 - }, - end: { - // baseMediaDecodeTime + lastFrame.dts + lastFrame.duration - firstFrame.dts, - dts: 20 + 120 + 4 - 12, - // baseMediaDecodeTime + lastFrame.pts + lastFrame.duration - firstFrame.pts - pts: 20 + 140 + 4 - 14 - }, - prependedContentDuration: 0, - baseMediaDecodeTime: baseMediaDecodeTime - }, 'generated correct timing info object'); -}); - -QUnit.test('generateSegmentTimingInfo accounts for prepended GOPs', function(assert) { - var - firstFrame = { - dts: 12, - pts: 14, - duration: 3 - }, - lastFrame = { - dts: 120, - pts: 140, - duration: 4 - }, - baseMediaDecodeTime = 20, - prependedContentDuration = 7; - - assert.deepEqual( - generateSegmentTimingInfo( - baseMediaDecodeTime, - firstFrame.dts, - firstFrame.pts, - lastFrame.dts + lastFrame.duration, - lastFrame.pts + lastFrame.duration, - prependedContentDuration - ), { - start: { - // baseMediaDecodeTime, - dts: 20, - // baseMediaDecodeTime + firstFrame.pts - firstFrame.dts - pts: 20 + 14 - 12 - }, - end: { - // baseMediaDecodeTime + lastFrame.dts + lastFrame.duration - firstFrame.dts, - dts: 20 + 120 + 4 - 12, - // baseMediaDecodeTime + lastFrame.pts + lastFrame.duration - firstFrame.pts - pts: 20 + 140 + 4 - 14 - }, - prependedContentDuration: 7, - baseMediaDecodeTime: 20 - }, - 'included prepended content duration in timing info'); -}); - -QUnit.test('generateSegmentTimingInfo handles GOPS where pts is < dts', function(assert) { - var - firstFrame = { - dts: 14, - pts: 12, - duration: 3 - }, - lastFrame = { - dts: 140, - pts: 120, - duration: 4 - }, - baseMediaDecodeTime = 20, - prependedContentDuration = 7; - - assert.deepEqual( - generateSegmentTimingInfo( - baseMediaDecodeTime, - firstFrame.dts, - firstFrame.pts, - lastFrame.dts + lastFrame.duration, - lastFrame.pts + lastFrame.duration, - prependedContentDuration - ), { - start: { - // baseMediaDecodeTime, - dts: 20, - // baseMediaDecodeTime + firstFrame.pts - firstFrame.dts - pts: 20 + 12 - 14 - }, - end: { - // baseMediaDecodeTime + lastFrame.dts + lastFrame.duration - firstFrame.dts, - dts: 20 + 140 + 4 - 14, - // baseMediaDecodeTime + lastFrame.pts + lastFrame.duration - firstFrame.pts - pts: 20 + 120 + 4 - 12 - }, - prependedContentDuration: 7, - baseMediaDecodeTime: 20 - }, - 'included prepended content duration in timing info'); -}); - -QUnit.module('ADTS Stream', { - beforeEach: function() { - adtsStream = new AdtsStream(); - } -}); - -QUnit.test('generates AAC frame events from ADTS bytes', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x12, 0x34, // AAC payload - 0x56, 0x78 // extra junk that should be ignored - ]) - }); - - assert.equal(frames.length, 1, 'generated one frame'); - assert.deepEqual(new Uint8Array(frames[0].data), - new Uint8Array([0x12, 0x34]), - 'extracted AAC frame'); - assert.equal(frames[0].channelcount, 2, 'parsed channelcount'); - assert.equal(frames[0].samplerate, 44100, 'parsed samplerate'); - - // Chrome only supports 8, 16, and 32 bit sample sizes. Assuming the - // default value of 16 in ISO/IEC 14496-12 AudioSampleEntry is - // acceptable. - assert.equal(frames[0].samplesize, 16, 'parsed samplesize'); -}); - -QUnit.test('parses across packets', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x12, 0x34 // AAC payload 1 - ]) - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x9a, 0xbc, // AAC payload 2 - 0xde, 0xf0 // extra junk that should be ignored - ]) - }); - - assert.equal(frames.length, 2, 'parsed two frames'); - assert.deepEqual(new Uint8Array(frames[1].data), - new Uint8Array([0x9a, 0xbc]), - 'extracted the second AAC frame'); -}); - -QUnit.test('parses frames segmented across packet', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x12 // incomplete AAC payload 1 - ]) - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0x34, // remainder of the previous frame's payload - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x9a, 0xbc, // AAC payload 2 - 0xde, 0xf0 // extra junk that should be ignored - ]) - }); - - assert.equal(frames.length, 2, 'parsed two frames'); - assert.deepEqual(new Uint8Array(frames[0].data), - new Uint8Array([0x12, 0x34]), - 'extracted the first AAC frame'); - assert.deepEqual(new Uint8Array(frames[1].data), - new Uint8Array([0x9a, 0xbc]), - 'extracted the second AAC frame'); -}); - -QUnit.test('resyncs data in aac frames that contain garbage', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0x67, // garbage - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x9a, 0xbc, // AAC payload 1 - 0xde, 0xf0 // extra junk that should be ignored - ]) - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0x67, // garbage - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x12, 0x34 // AAC payload 2 - ]) - }); - - assert.equal(frames.length, 2, 'parsed two frames'); - assert.deepEqual(new Uint8Array(frames[0].data), - new Uint8Array([0x9a, 0xbc]), - 'extracted the first AAC frame'); - assert.deepEqual(new Uint8Array(frames[1].data), - new Uint8Array([0x12, 0x34]), - 'extracted the second AAC frame'); -}); - -QUnit.test('ignores audio "MPEG version" bit in adts header', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf8, // MPEG-2 audio, CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x60, // 2 channels, frame length 11 bytes - 0x00, // one AAC per ADTS frame - 0xfe, 0xdc, // "CRC" - 0x12, 0x34 // AAC payload 2 - ]) - }); - - assert.equal(frames.length, 1, 'parsed a frame'); - assert.deepEqual(new Uint8Array(frames[0].data), - new Uint8Array([0x12, 0x34]), - 'skipped the CRC'); -}); - -QUnit.test('skips CRC bytes', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf0, // with CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x60, // 2 channels, frame length 11 bytes - 0x00, // one AAC per ADTS frame - 0xfe, 0xdc, // "CRC" - 0x12, 0x34 // AAC payload 2 - ]) - }); - - assert.equal(frames.length, 1, 'parsed a frame'); - assert.deepEqual(new Uint8Array(frames[0].data), - new Uint8Array([0x12, 0x34]), - 'skipped the CRC'); -}); - -QUnit.module('AudioSegmentStream', { - beforeEach: function() { - var track = { - type: 'audio', - samplerate: 90e3 // no scaling - }; - audioSegmentStream = new AudioSegmentStream(track); - audioSegmentStream.track = track; - audioSegmentStream.track.timelineStartInfo = { - dts: 111, - pts: 111, - baseMediaDecodeTime: 0 - }; - } -}); - -QUnit.test('fills audio gaps taking into account audio sample rate', function(assert) { - var - events = [], - boxes, - numSilentFrames, - videoGap = 0.29, - audioGap = 0.49, - expectedFillSeconds = audioGap - videoGap, - sampleRate = 44100, - frameDuration = Math.ceil(90e3 / (sampleRate / 1024)), - frameSeconds = clock.videoTsToSeconds(frameDuration), - audioBMDT, - offsetSeconds = clock.videoTsToSeconds(111), - startingAudioBMDT = clock.secondsToAudioTs(10 + audioGap - offsetSeconds, sampleRate); - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setAudioAppendStart(clock.secondsToVideoTs(10)); - audioSegmentStream.setVideoBaseMediaDecodeTime(clock.secondsToVideoTs(10 + videoGap)); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: sampleRate, - pts: clock.secondsToVideoTs(10 + audioGap), - dts: clock.secondsToVideoTs(10 + audioGap), - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - numSilentFrames = Math.floor(expectedFillSeconds / frameSeconds); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1 + numSilentFrames, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 364, 'silent sample'); - assert.equal(events[0].track.samples[7].size, 364, 'silent sample'); - assert.equal(events[0].track.samples[8].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - - audioBMDT = boxes[0].boxes[1].boxes[1].baseMediaDecodeTime; - - assert.equal( - audioBMDT, - // should always be rounded up so as not to overfill - Math.ceil(startingAudioBMDT - - clock.secondsToAudioTs(numSilentFrames * frameSeconds, sampleRate)), - 'filled the gap to the nearest frame'); - assert.equal( - Math.floor(clock.audioTsToVideoTs(audioBMDT, sampleRate) - - clock.secondsToVideoTs(10 + videoGap)), - Math.floor(clock.secondsToVideoTs(expectedFillSeconds) % frameDuration - - clock.secondsToVideoTs(offsetSeconds)), - 'filled all but frame remainder between video start and audio start'); -}); - -QUnit.test('fills audio gaps with existing frame if odd sample rate', function(assert) { - var - events = [], - boxes, - numSilentFrames, - videoGap = 0.29, - audioGap = 0.49, - expectedFillSeconds = audioGap - videoGap, - sampleRate = 90e3, // we don't have matching silent frames - frameDuration = Math.ceil(90e3 / (sampleRate / 1024)), - frameSeconds = clock.videoTsToSeconds(frameDuration), - audioBMDT, - offsetSeconds = clock.videoTsToSeconds(111), - startingAudioBMDT = clock.secondsToAudioTs(10 + audioGap - offsetSeconds, sampleRate); - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setAudioAppendStart(clock.secondsToVideoTs(10)); - audioSegmentStream.setVideoBaseMediaDecodeTime(clock.secondsToVideoTs(10 + videoGap)); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: sampleRate, - pts: clock.secondsToVideoTs(10 + audioGap), - dts: clock.secondsToVideoTs(10 + audioGap), - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - numSilentFrames = Math.floor(expectedFillSeconds / frameSeconds); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1 + numSilentFrames, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 1, 'copied sample'); - assert.equal(events[0].track.samples[7].size, 1, 'copied sample'); - assert.equal(events[0].track.samples[8].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - - audioBMDT = boxes[0].boxes[1].boxes[1].baseMediaDecodeTime; - - assert.equal( - audioBMDT, - // should always be rounded up so as not to overfill - Math.ceil(startingAudioBMDT - - clock.secondsToAudioTs(numSilentFrames * frameSeconds, sampleRate)), - 'filled the gap to the nearest frame'); - assert.equal( - Math.floor(clock.audioTsToVideoTs(audioBMDT, sampleRate) - - clock.secondsToVideoTs(10 + videoGap)), - Math.floor(clock.secondsToVideoTs(expectedFillSeconds) % frameDuration - - clock.secondsToVideoTs(offsetSeconds)), - 'filled all but frame remainder between video start and audio start'); -}); - -QUnit.test('fills audio gaps with smaller of audio gap and audio-video gap', function(assert) { - var - events = [], - boxes, - offsetSeconds = clock.videoTsToSeconds(111), - videoGap = 0.29, - sampleRate = 44100, - frameDuration = Math.ceil(90e3 / (sampleRate / 1024)), - frameSeconds = clock.videoTsToSeconds(frameDuration), - // audio gap smaller, should be used as fill - numSilentFrames = 1, - // buffer for imprecise numbers - audioGap = frameSeconds + offsetSeconds + 0.001, - oldAudioEnd = 10.5, - audioBMDT; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setAudioAppendStart(clock.secondsToVideoTs(oldAudioEnd)); - audioSegmentStream.setVideoBaseMediaDecodeTime(clock.secondsToVideoTs(10 + videoGap)); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: sampleRate, - pts: clock.secondsToVideoTs(oldAudioEnd + audioGap), - dts: clock.secondsToVideoTs(oldAudioEnd + audioGap), - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1 + numSilentFrames, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 364, 'silent sample'); - assert.equal(events[0].track.samples[1].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - - audioBMDT = boxes[0].boxes[1].boxes[1].baseMediaDecodeTime; - - assert.equal( - Math.floor(clock.secondsToVideoTs(oldAudioEnd + audioGap) - - clock.audioTsToVideoTs(audioBMDT, sampleRate) - - clock.secondsToVideoTs(offsetSeconds)), - Math.floor(frameDuration + 0.001), - 'filled length of audio gap only'); -}); - -QUnit.test('does not fill audio gaps if no audio append start time', function(assert) { - var - events = [], - boxes, - videoGap = 0.29, - audioGap = 0.49; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setVideoBaseMediaDecodeTime((10 + videoGap) * 90e3); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: (10 + audioGap) * 90e3, - dts: (10 + audioGap) * 90e3, - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - (10 + audioGap) * 90e3 - 111, - 'did not fill gap'); -}); - -QUnit.test('does not fill audio gap if no video base media decode time', function(assert) { - var - events = [], - boxes, - audioGap = 0.49; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setAudioAppendStart(10 * 90e3); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: (10 + audioGap) * 90e3, - dts: (10 + audioGap) * 90e3, - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - (10 + audioGap) * 90e3 - 111, - 'did not fill the gap'); -}); - -QUnit.test('does not fill audio gaps greater than a half second', function(assert) { - var - events = [], - boxes, - videoGap = 0.01, - audioGap = videoGap + 0.51; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setAudioAppendStart(10 * 90e3); - audioSegmentStream.setVideoBaseMediaDecodeTime((10 + videoGap) * 90e3); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: (10 + audioGap) * 90e3, - dts: (10 + audioGap) * 90e3, - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - (10 + audioGap) * 90e3 - 111, - 'did not fill gap'); -}); - -QUnit.test('does not fill audio gaps smaller than a frame duration', function(assert) { - var - events = [], - boxes, - offsetSeconds = clock.videoTsToSeconds(111), - // audio gap small enough that it shouldn't be filled - audioGap = 0.001, - newVideoStart = 10, - oldAudioEnd = 10.3, - newAudioStart = oldAudioEnd + audioGap + offsetSeconds; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - // the real audio gap is tiny, but the gap between the new video and audio segments - // would be large enough to fill - audioSegmentStream.setAudioAppendStart(clock.secondsToVideoTs(oldAudioEnd)); - audioSegmentStream.setVideoBaseMediaDecodeTime(clock.secondsToVideoTs(newVideoStart)); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: clock.secondsToVideoTs(newAudioStart), - dts: clock.secondsToVideoTs(newAudioStart), - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - clock.secondsToVideoTs(newAudioStart - offsetSeconds), - 'did not fill gap'); -}); - -QUnit.test('ensures baseMediaDecodeTime for audio is not negative', function(assert) { - var events = [], boxes; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - audioSegmentStream.track.timelineStartInfo.baseMediaDecodeTime = 10; - audioSegmentStream.setEarliestDts(101); - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: 111 - 10 - 1, // before the earliest DTS - dts: 111 - 10 - 1, // before the earliest DTS - data: new Uint8Array([0]) - }); - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: 111 - 10 + 2, // after the earliest DTS - dts: 111 - 10 + 2, // after the earliest DTS - data: new Uint8Array([1]) - }); - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1, 'generated only one sample'); - boxes = mp4.tools.inspect(events[0].boxes); - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, 2, 'kept the later sample'); -}); - -QUnit.test('audio track metadata takes on the value of the last metadata seen', function(assert) { - var events = []; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: 100, - dts: 100, - data: new Uint8Array([0]) - }); - audioSegmentStream.push({ - channelcount: 4, - samplerate: 10000, - pts: 111, - dts: 111, - data: new Uint8Array([1]) - }); - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 2, 'generated two samples'); - assert.equal(events[0].track.samplerate, 10000, 'kept the later samplerate'); - assert.equal(events[0].track.channelcount, 4, 'kept the later channelcount'); -}); - -QUnit.test('audio segment stream triggers segmentTimingInfo with timing info', -function(assert) { - var - events = [], - samplerate = 48000, - baseMediaDecodeTimeInVideoClock = 30, - audioFrameDurationInVideoClock = 90000 * 1024 / samplerate, - firstFrame = { - channelcount: 2, - samplerate: samplerate, - pts: 112, - dts: 111, - data: new Uint8Array([0]) - }, - secondFrame = { - channelcount: 2, - samplerate: samplerate, - pts: firstFrame.pts + audioFrameDurationInVideoClock, - dts: firstFrame.dts + audioFrameDurationInVideoClock, - data: new Uint8Array([1]) - }; - - audioSegmentStream.on('segmentTimingInfo', function(event) { - events.push(event); - }); - audioSegmentStream.track.timelineStartInfo.baseMediaDecodeTime = - baseMediaDecodeTimeInVideoClock; - - audioSegmentStream.push(firstFrame); - audioSegmentStream.push(secondFrame); - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a segmentTimingInfo event was fired'); - assert.deepEqual( - events[0], - { - start: { - dts: baseMediaDecodeTimeInVideoClock, - pts: baseMediaDecodeTimeInVideoClock + (firstFrame.pts - firstFrame.dts) - }, - end: { - dts: baseMediaDecodeTimeInVideoClock + (secondFrame.dts - firstFrame.dts) + - audioFrameDurationInVideoClock, - pts: baseMediaDecodeTimeInVideoClock + (secondFrame.pts - firstFrame.pts) + - audioFrameDurationInVideoClock - }, - prependedContentDuration: 0, - baseMediaDecodeTime: baseMediaDecodeTimeInVideoClock - }, - 'has correct segmentTimingInfo' - ); -}); - - -QUnit.module('Transmuxer - options'); - -QUnit.test('no options creates combined output', function(assert) { - var - segments = [], - boxes, - initSegment, - transmuxer = new Transmuxer(); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined video and audio segment'); - assert.equal(segments[0].type, 'combined', 'combined is the segment type'); - - boxes = mp4.tools.inspect(segments[0].data); - initSegment = mp4.tools.inspect(segments[0].initSegment); - assert.equal(initSegment.length, 2, 'generated 2 init segment boxes'); - assert.equal('ftyp', initSegment[0].type, 'generated an ftyp box'); - assert.equal('moov', initSegment[1].type, 'generated a single moov box'); - assert.equal(boxes.length, 4, 'generated 4 top-level boxes'); - assert.equal('moof', boxes[0].type, 'generated a first moof box'); - assert.equal('mdat', boxes[1].type, 'generated a first mdat box'); - assert.equal('moof', boxes[2].type, 'generated a second moof box'); - assert.equal('mdat', boxes[3].type, 'generated a second mdat box'); -}); - -QUnit.test('can specify that we want to generate separate audio and video segments', function(assert) { - var - segments = [], - segmentLengthOnDone, - boxes, - initSegment, - transmuxer = new Transmuxer({remux: false}); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.on('done', function(segment) { - if (!segmentLengthOnDone) { - segmentLengthOnDone = segments.length; - } - }); - - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true))); - transmuxer.flush(); - - assert.equal(segmentLengthOnDone, 2, 'emitted both segments before triggering done'); - assert.equal(segments.length, 2, 'generated a video and an audio segment'); - assert.ok(segments[0].type === 'video' || segments[1].type === 'video', 'one segment is video'); - assert.ok(segments[0].type === 'audio' || segments[1].type === 'audio', 'one segment is audio'); - - boxes = mp4.tools.inspect(segments[0].data); - initSegment = mp4.tools.inspect(segments[0].initSegment); - assert.equal(initSegment.length, 2, 'generated 2 top-level initSegment boxes'); - assert.equal(boxes.length, 2, 'generated 2 top-level boxes'); - assert.equal('ftyp', initSegment[0].type, 'generated an ftyp box'); - assert.equal('moov', initSegment[1].type, 'generated a moov box'); - assert.equal('moof', boxes[0].type, 'generated a moof box'); - assert.equal('mdat', boxes[1].type, 'generated a mdat box'); - - boxes = mp4.tools.inspect(segments[1].data); - initSegment = mp4.tools.inspect(segments[1].initSegment); - assert.equal(initSegment.length, 2, 'generated 2 top-level initSegment boxes'); - assert.equal(boxes.length, 2, 'generated 2 top-level boxes'); - assert.equal('ftyp', initSegment[0].type, 'generated an ftyp box'); - assert.equal('moov', initSegment[1].type, 'generated a moov box'); - assert.equal('moof', boxes[0].type, 'generated a moof box'); - assert.equal('mdat', boxes[1].type, 'generated a mdat box'); -}); - -QUnit.test('adjusts caption and ID3 times when configured to adjust timestamps', function(assert) { - var transmuxer = new Transmuxer({ keepOriginalTimestamps: false }); - - var - segments = [], - captions = []; - - transmuxer.on('data', function(segment) { - captions = captions.concat(segment.captions); - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, 90000))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, 90000))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, 90002))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, 90002))); - transmuxer.push(packetize(videoPes([ - 0x06, // sei_rbsp - 0x04, 0x29, 0xb5, 0x00, - 0x31, 0x47, 0x41, 0x39, - 0x34, 0x03, 0x52, 0xff, - 0xfc, 0x94, 0xae, 0xfc, - 0x94, 0x20, 0xfc, 0x91, - 0x40, 0xfc, 0xb0, 0xb0, - 0xfc, 0xba, 0xb0, 0xfc, - 0xb0, 0xba, 0xfc, 0xb0, - 0xb0, 0xfc, 0x94, 0x2f, - 0xfc, 0x94, 0x2f, 0xfc, - 0x94, 0x2f, 0xff, 0x80, - 0x00 // has an extra End Of Caption, so start and end times will be the same - ], true, 90002))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, 90004))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined video and audio segment'); - assert.equal(segments[0].type, 'combined', 'combined is the segment type'); - assert.equal(captions.length, 1, 'got one caption'); - assert.equal(captions[0].startPts, 90004, 'original pts value intact'); - assert.equal(captions[0].startTime, (90004 - 90002) / 90e3, 'caption start time are based on original timeline'); - assert.equal(captions[0].endTime, (90004 - 90002) / 90e3, 'caption end time are based on original timeline'); -}); - -[ - {options: {keepOriginalTimestamps: false}}, - {options: {keepOriginalTimestamps: true}}, - {options: {keepOriginalTimestamps: false, baseMediaDecodeTime: 15000}}, - {options: {keepOriginalTimestamps: true, baseMediaDecodeTime: 15000}}, - {options: {keepOriginalTimestamps: false}, baseMediaSetter: 15000}, - {options: {keepOriginalTimestamps: true}, baseMediaSetter: 15000} -].forEach(function(test) { - var createTransmuxer = function() { - var transmuxer = new Transmuxer(test.options); - - if (test.baseMediaSetter) { - transmuxer.setBaseMediaDecodeTime(test.baseMediaSetter); - } - - return transmuxer; - }; - - var name = ''; - - Object.keys(test.options).forEach(function(optionName) { - name += '' + optionName + ' ' + test.options[optionName] + ' '; - }); - - if (test.baseMediaSetter) { - name += 'baseMediaDecodeTime setter ' + test.baseMediaSetter; - } - - QUnit.test('Audio frames after video not trimmed, ' + name, function(assert) { - var - segments = [], - earliestDts = 15000, - transmuxer = createTransmuxer(); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - - // the following transmuxer pushes add tiny video and - // audio data to the transmuxer. When we add the data - // we also set the pts/dts time so that audio should - // not be trimmed. - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, earliestDts + 1))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, earliestDts))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined segment'); - // The audio frame is 10 bytes. The full data is 305 bytes without anything - // trimmed. If the audio frame was trimmed this will be 295 bytes. - assert.equal(segments[0].data.length, 305, 'trimmed audio frame'); - }); - - QUnit.test('Audio frames trimmed before video, ' + name, function(assert) { - var - segments = [], - earliestDts = 15000, - baseTime = test.options.baseMediaDecodeTime || test.baseMediaSetter || 0, - transmuxer = createTransmuxer(); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - - // the following transmuxer pushes add tiny video and - // audio data to the transmuxer. When we add the data - // we also set the pts/dts time so that audio should - // be trimmed. - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, earliestDts - baseTime - 1))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, earliestDts))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined segment'); - // The audio frame is 10 bytes. The full data is 305 bytes without anything - // trimmed. If the audio frame was trimmed this will be 295 bytes. - if (test.options.keepOriginalTimestamps && !baseTime) { - assert.equal(segments[0].data.length, 305, 'did not trim audio frame'); - } else { - assert.equal(segments[0].data.length, 295, 'trimmed audio frame'); - } - }); -}); - -QUnit.test("doesn't adjust caption and ID3 times when configured to keep original timestamps", function(assert) { - var transmuxer = new Transmuxer({ keepOriginalTimestamps: true }); - - var - segments = [], - captions = []; - - transmuxer.on('data', function(segment) { - captions = captions.concat(segment.captions); - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, 90000))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, 90000))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, 90002))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, 90002))); - transmuxer.push(packetize(videoPes([ - 0x06, // sei_rbsp - 0x04, 0x29, 0xb5, 0x00, - 0x31, 0x47, 0x41, 0x39, - 0x34, 0x03, 0x52, 0xff, - 0xfc, 0x94, 0xae, 0xfc, - 0x94, 0x20, 0xfc, 0x91, - 0x40, 0xfc, 0xb0, 0xb0, - 0xfc, 0xba, 0xb0, 0xfc, - 0xb0, 0xba, 0xfc, 0xb0, - 0xb0, 0xfc, 0x94, 0x2f, - 0xfc, 0x94, 0x2f, 0xfc, - 0x94, 0x2f, 0xff, 0x80, - 0x00 // has an extra End Of Caption, so start and end times will be the same - ], true, 90002))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, 90004))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined video and audio segment'); - assert.equal(segments[0].type, 'combined', 'combined is the segment type'); - assert.equal(captions.length, 1, 'got one caption'); - assert.equal(captions[0].startPts, 90004, 'original pts value intact'); - assert.equal(captions[0].startTime, 90004 / 90e3, 'caption start time are based on original timeline'); - assert.equal(captions[0].endTime, 90004 / 90e3, 'caption end time are based on original timeline'); -}); - -QUnit.module('MP4 - Transmuxer', { - beforeEach: function() { - transmuxer = new Transmuxer(); - } -}); - -QUnit.test('generates a video init segment', function(assert) { - var segments = [], boxes; - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x87, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a segment'); - assert.ok(segments[0].data, 'wrote data in the init segment'); - assert.equal(segments[0].type, 'video', 'video is the segment type'); - assert.ok(segments[0].info, 'video info is alongside video segments/bytes'); - - mp4VideoProperties.forEach(function(prop) { - assert.ok(segments[0].info[prop], 'video info has ' + prop); - }); - - boxes = mp4.tools.inspect(segments[0].initSegment); - assert.equal('ftyp', boxes[0].type, 'generated an ftyp box'); - assert.equal('moov', boxes[1].type, 'generated a moov box'); -}); - -QUnit.test('transmuxer triggers video timing info event on flush', function(assert) { - var videoSegmentTimingInfoArr = []; - - transmuxer.on('videoSegmentTimingInfo', function(videoSegmentTimingInfo) { - videoSegmentTimingInfoArr.push(videoSegmentTimingInfo); - }); - - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true))); - - assert.equal( - videoSegmentTimingInfoArr.length, - 0, - 'has not triggered videoSegmentTimingInfo' - ); - - transmuxer.flush(); - - assert.equal(videoSegmentTimingInfoArr.length, 1, 'triggered videoSegmentTimingInfo'); -}); - -QUnit.test('generates an audio init segment', function(assert) { - var segments = [], boxes; - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasAudio: true - }))); - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a segment'); - assert.ok(segments[0].data, 'wrote data in the init segment'); - assert.equal(segments[0].type, 'audio', 'audio is the segment type'); - assert.ok(segments[0].info, 'audio info is alongside audio segments/bytes'); - mp4AudioProperties.forEach(function(prop) { - assert.ok(segments[0].info[prop], 'audio info has ' + prop); - }); - - boxes = mp4.tools.inspect(segments[0].initSegment); - assert.equal('ftyp', boxes[0].type, 'generated an ftyp box'); - assert.equal('moov', boxes[1].type, 'generated a moov box'); -}); - -QUnit.test('buffers video samples until flushed', function(assert) { - var samples = [], offset, boxes, initSegment; - transmuxer.on('data', function(data) { - samples.push(data); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - // buffer a NAL - transmuxer.push(packetize(videoPes([0x09, 0x01], true))); - transmuxer.push(packetize(videoPes([0x05, 0x02]))); - - // add an access_unit_delimiter_rbsp - transmuxer.push(packetize(videoPes([0x09, 0x03]))); - transmuxer.push(packetize(videoPes([0x00, 0x04]))); - transmuxer.push(packetize(videoPes([0x00, 0x05]))); - - // flush everything - transmuxer.flush(); - assert.equal(samples.length, 1, 'emitted one event'); - boxes = mp4.tools.inspect(samples[0].data); - initSegment = mp4.tools.inspect(samples[0].initSegment); - assert.equal(boxes.length, 2, 'generated two boxes'); - assert.equal(initSegment.length, 2, 'generated two init segment boxes'); - assert.equal(boxes[0].type, 'moof', 'the first box is a moof'); - assert.equal(boxes[1].type, 'mdat', 'the second box is a mdat'); - - offset = boxes[0].size + 8; - assert.deepEqual(new Uint8Array(samples[0].data.subarray(offset)), - new Uint8Array([ - 0, 0, 0, 2, - 0x09, 0x01, - 0, 0, 0, 2, - 0x05, 0x02, - 0, 0, 0, 2, - 0x09, 0x03, - 0, 0, 0, 2, - 0x00, 0x04, - 0, 0, 0, 2, - 0x00, 0x05]), - 'concatenated NALs into an mdat'); -}); - -QUnit.test('creates a metadata stream', function(assert) { - transmuxer.push(packetize(PAT)); - assert.ok(transmuxer.transmuxPipeline_.metadataStream, 'created a metadata stream'); -}); - -QUnit.test('pipes timed metadata to the metadata stream', function(assert) { - var metadatas = []; - transmuxer.push(packetize(PAT)); - transmuxer.transmuxPipeline_.metadataStream.on('data', function(data) { - metadatas.push(data); - }); - transmuxer.push(packetize(PMT)); - transmuxer.push(packetize(timedMetadataPes([0x03]))); - - transmuxer.flush(); - assert.equal(metadatas.length, 1, 'emitted timed metadata'); -}); - -QUnit.test('pipeline dynamically configures itself based on input', function(assert) { - var id3 = id3Generator; - - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasAudio: true - }))); - transmuxer.push(packetize(timedMetadataPes([0x03]))); - transmuxer.flush(); - assert.equal(transmuxer.transmuxPipeline_.type, 'ts', 'detected TS file data'); - - transmuxer.push(new Uint8Array(id3.id3Tag(id3.id3Frame('PRIV', 0x00, 0x01)).concat([0xFF, 0xF1]))); - transmuxer.flush(); - assert.equal(transmuxer.transmuxPipeline_.type, 'aac', 'detected AAC file data'); -}); - -QUnit.test('reuses audio track object when the pipeline reconfigures itself', function(assert) { - var boxes, segments = [], - id3Tag = new Uint8Array(75), - streamTimestamp = 'com.apple.streaming.transportStreamTimestamp', - priv = 'PRIV', - i, - adtsPayload; - - id3Tag[0] = 73; - id3Tag[1] = 68; - id3Tag[2] = 51; - id3Tag[3] = 4; - id3Tag[9] = 63; - id3Tag[17] = 53; - id3Tag[70] = 13; - id3Tag[71] = 187; - id3Tag[72] = 160; - id3Tag[73] = 0xFF; - id3Tag[74] = 0xF1; - - for (i = 0; i < priv.length; i++) { - id3Tag[i + 10] = priv.charCodeAt(i); - } - for (i = 0; i < streamTimestamp.length; i++) { - id3Tag[i + 20] = streamTimestamp.charCodeAt(i); - } - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(packetize(generatePMT({ - hasAudio: true - })))); - transmuxer.push(packetize(audioPes([0x19, 0x47], true, 10000))); - transmuxer.flush(); - - boxes = mp4.tools.inspect(segments[0].data); - - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - 0, - 'first segment starts at 0 pts'); - - adtsPayload = new Uint8Array(adtsFrame(2).concat([0x19, 0x47])); - - transmuxer.push(id3Tag); - transmuxer.push(adtsPayload); - transmuxer.flush(); - - boxes = mp4.tools.inspect(segments[1].data); - - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - // The first segment had a PTS of 10,000 and the second segment 900,000 - // Audio PTS is specified in a clock equal to samplerate (44.1khz) - // So you have to take the different between the PTSs (890,000) - // and transform it from 90khz to 44.1khz clock - Math.floor((900000 - 10000) / (90000 / 44100)), - 'second segment starts at the right time'); -}); - -validateTrack = function(track, metadata) { - var mdia; - QUnit.assert.equal(track.type, 'trak', 'wrote the track type'); - QUnit.assert.equal(track.boxes.length, 2, 'wrote track children'); - QUnit.assert.equal(track.boxes[0].type, 'tkhd', 'wrote the track header'); - if (metadata) { - if (metadata.trackId) { - QUnit.assert.equal(track.boxes[0].trackId, metadata.trackId, 'wrote the track id'); - } - if (metadata.width) { - QUnit.assert.equal(track.boxes[0].width, metadata.width, 'wrote the width'); - } - if (metadata.height) { - QUnit.assert.equal(track.boxes[0].height, metadata.height, 'wrote the height'); - } - } - - mdia = track.boxes[1]; - QUnit.assert.equal(mdia.type, 'mdia', 'wrote the media'); - QUnit.assert.equal(mdia.boxes.length, 3, 'wrote the mdia children'); - - QUnit.assert.equal(mdia.boxes[0].type, 'mdhd', 'wrote the media header'); - QUnit.assert.equal(mdia.boxes[0].language, 'und', 'the language is undefined'); - QUnit.assert.equal(mdia.boxes[0].duration, 0xffffffff, 'the duration is at maximum'); - - QUnit.assert.equal(mdia.boxes[1].type, 'hdlr', 'wrote the media handler'); - - QUnit.assert.equal(mdia.boxes[2].type, 'minf', 'wrote the media info'); -}; - -validateTrackFragment = function(track, segment, metadata, type) { - var tfhd, trun, sdtp, i, j, sample, nalUnitType; - QUnit.assert.equal(track.type, 'traf', 'wrote a track fragment'); - - if (type === 'video') { - QUnit.assert.equal(track.boxes.length, 4, 'wrote four track fragment children'); - } else if (type === 'audio') { - QUnit.assert.equal(track.boxes.length, 3, 'wrote three track fragment children'); - } - - tfhd = track.boxes[0]; - QUnit.assert.equal(tfhd.type, 'tfhd', 'wrote a track fragment header'); - QUnit.assert.equal(tfhd.trackId, metadata.trackId, 'wrote the track id'); - - QUnit.assert.equal(track.boxes[1].type, - 'tfdt', - 'wrote a track fragment decode time box'); - QUnit.assert.ok(track.boxes[1].baseMediaDecodeTime >= 0, 'base decode time is non-negative'); - - trun = track.boxes[2]; - QUnit.assert.ok(trun.dataOffset >= 0, 'set data offset'); - - QUnit.assert.equal(trun.dataOffset, - metadata.mdatOffset + 8, - 'trun data offset is the size of the moof'); - - QUnit.assert.ok(trun.samples.length > 0, 'generated media samples'); - for (i = 0, j = metadata.baseOffset + trun.dataOffset; - i < trun.samples.length; - i++) { - sample = trun.samples[i]; - QUnit.assert.ok(sample.size > 0, 'wrote a positive size for sample ' + i); - if (type === 'video') { - QUnit.assert.ok(sample.duration > 0, 'wrote a positive duration for sample ' + i); - QUnit.assert.ok(sample.compositionTimeOffset >= 0, - 'wrote a positive composition time offset for sample ' + i); - QUnit.assert.ok(sample.flags, 'wrote sample flags'); - QUnit.assert.equal(sample.flags.isLeading, 0, 'the leading nature is unknown'); - - QUnit.assert.notEqual(sample.flags.dependsOn, 0, 'sample dependency is not unknown'); - QUnit.assert.notEqual(sample.flags.dependsOn, 4, 'sample dependency is valid'); - nalUnitType = segment[j + 4] & 0x1F; - QUnit.assert.equal(nalUnitType, 9, 'samples begin with an access_unit_delimiter_rbsp'); - - QUnit.assert.equal(sample.flags.isDependedOn, 0, 'dependency of other samples is unknown'); - QUnit.assert.equal(sample.flags.hasRedundancy, 0, 'sample redundancy is unknown'); - QUnit.assert.equal(sample.flags.degradationPriority, 0, 'sample degradation priority is zero'); - // If current sample is Key frame - if (sample.flags.dependsOn === 2) { - QUnit.assert.equal(sample.flags.isNonSyncSample, 0, 'samples_is_non_sync_sample flag is zero'); - } else { - QUnit.assert.equal(sample.flags.isNonSyncSample, 1, 'samples_is_non_sync_sample flag is one'); - } - } else { - QUnit.assert.equal(sample.duration, 1024, - 'aac sample duration is always 1024'); - } - j += sample.size; // advance to the next sample in the mdat - } - - if (type === 'video') { - sdtp = track.boxes[3]; - QUnit.assert.equal(trun.samples.length, - sdtp.samples.length, - 'wrote an QUnit.equal number of trun and sdtp samples'); - for (i = 0; i < sdtp.samples.length; i++) { - sample = sdtp.samples[i]; - QUnit.assert.notEqual(sample.dependsOn, 0, 'sample dependency is not unknown'); - QUnit.assert.equal(trun.samples[i].flags.dependsOn, - sample.dependsOn, - 'wrote a consistent dependsOn'); - QUnit.assert.equal(trun.samples[i].flags.isDependedOn, - sample.isDependedOn, - 'wrote a consistent isDependedOn'); - QUnit.assert.equal(trun.samples[i].flags.hasRedundancy, - sample.hasRedundancy, - 'wrote a consistent hasRedundancy'); - } - } -}; - -QUnit.test('parses an example mp2t file and generates combined media segments', function(assert) { - var - segments = [], - i, j, boxes, mfhd, trackType = 'audio', trackId = 257, baseOffset = 0, initSegment; - - transmuxer.on('data', function(segment) { - if (segment.type === 'combined') { - segments.push(segment); - } - }); - transmuxer.push(testSegment); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated one combined segment'); - - boxes = mp4.tools.inspect(segments[0].data); - initSegment = mp4.tools.inspect(segments[0].initSegment); - assert.equal(boxes.length, 4, 'combined segments are composed of 4 boxes'); - assert.equal(initSegment.length, 2, 'init segment is composed of 2 boxes'); - assert.equal(initSegment[0].type, 'ftyp', 'the first box is an ftyp'); - assert.equal(initSegment[1].type, 'moov', 'the second box is a moov'); - assert.equal(initSegment[1].boxes[0].type, 'mvhd', 'generated an mvhd'); - validateTrack(initSegment[1].boxes[1], { - trackId: 256 - }); - validateTrack(initSegment[1].boxes[2], { - trackId: 257 - }); - - for (i = 0; i < boxes.length; i += 2) { - assert.equal(boxes[i].type, 'moof', 'first box is a moof'); - assert.equal(boxes[i].boxes.length, 2, 'the moof has two children'); - - mfhd = boxes[i].boxes[0]; - assert.equal(mfhd.type, 'mfhd', 'mfhd is a child of the moof'); - - assert.equal(boxes[i + 1].type, 'mdat', 'second box is an mdat'); - - // Only do even numbered boxes because the odd-offsets will be mdat - if (i % 2 === 0) { - for (j = 0; j < i; j++) { - baseOffset += boxes[j].size; - } - - validateTrackFragment(boxes[i].boxes[1], segments[0].data, { - trackId: trackId, - width: 388, - height: 300, - baseOffset: baseOffset, - mdatOffset: boxes[i].size - }, trackType); - - trackId--; - baseOffset = 0; - trackType = 'video'; - } - } -}); - -QUnit.test('can be reused for multiple TS segments', function(assert) { - var - boxes = [], - initSegments = []; - - transmuxer.on('data', function(segment) { - if (segment.type === 'combined') { - boxes.push(mp4.tools.inspect(segment.data)); - initSegments.push(mp4.tools.inspect(segment.initSegment)); - } - }); - transmuxer.push(testSegment); - transmuxer.flush(); - transmuxer.push(testSegment); - transmuxer.flush(); - - assert.equal(boxes.length, 2, 'generated two combined segments'); - assert.equal(initSegments.length, 2, 'generated two combined init segments'); - - assert.deepEqual(initSegments[0][0], initSegments[1][0], 'generated identical ftyps'); - assert.deepEqual(initSegments[0][1], initSegments[1][1], 'generated identical moovs'); - - assert.deepEqual(boxes[0][0].boxes[1], - boxes[1][0].boxes[1], - 'generated identical video trafs'); - assert.equal(boxes[0][0].boxes[0].sequenceNumber, - 0, - 'set the correct video sequence number'); - assert.equal(boxes[1][0].boxes[0].sequenceNumber, - 1, - 'set the correct video sequence number'); - assert.deepEqual(boxes[0][1], - boxes[1][1], - 'generated identical video mdats'); - - assert.deepEqual(boxes[0][2].boxes[3], - boxes[1][2].boxes[3], - 'generated identical audio trafs'); - assert.equal(boxes[0][2].boxes[0].sequenceNumber, - 0, - 'set the correct audio sequence number'); - assert.equal(boxes[1][2].boxes[0].sequenceNumber, - 1, - 'set the correct audio sequence number'); - assert.deepEqual(boxes[0][3], - boxes[1][3], - 'generated identical audio mdats'); -}); - -QUnit.module('NalByteStream', { - beforeEach: function() { - nalByteStream = new NalByteStream(); - } -}); - -QUnit.test('parses nal units with 4-byte start code', function(assert) { - var nalUnits = []; - nalByteStream.on('data', function(data) { - nalUnits.push(data); - }); - - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, // start code - 0x09, 0xFF, // Payload - 0x00, 0x00, 0x00 // end code - ]) - }); - - assert.equal(nalUnits.length, 1, 'found one nal'); - assert.deepEqual(nalUnits[0], new Uint8Array([0x09, 0xFF]), 'has the proper payload'); -}); - -QUnit.test('parses nal units with 3-byte start code', function(assert) { - var nalUnits = []; - nalByteStream.on('data', function(data) { - nalUnits.push(data); - }); - - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x01, // start code - 0x09, 0xFF, // Payload - 0x00, 0x00, 0x00 // end code - ]) - }); - - assert.equal(nalUnits.length, 1, 'found one nal'); - assert.deepEqual(nalUnits[0], new Uint8Array([0x09, 0xFF]), 'has the proper payload'); -}); - -QUnit.test('does not emit empty nal units', function(assert) { - var dataTriggerCount = 0; - nalByteStream.on('data', function(data) { - dataTriggerCount++; - }); - - // An empty nal unit is just two start codes: - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, // start code - 0x00, 0x00, 0x00, 0x01 // start code - ]) - }); - assert.equal(dataTriggerCount, 0, 'emmited no nal units'); -}); - -QUnit.test('parses multiple nal units', function(assert) { - var nalUnits = []; - nalByteStream.on('data', function(data) { - nalUnits.push(data); - }); - - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x01, // start code - 0x09, 0xFF, // Payload - 0x00, 0x00, 0x00, // end code - 0x00, 0x00, 0x01, // start code - 0x12, 0xDD, // Payload - 0x00, 0x00, 0x00 // end code - ]) - }); - - assert.equal(nalUnits.length, 2, 'found two nals'); - assert.deepEqual(nalUnits[0], new Uint8Array([0x09, 0xFF]), 'has the proper payload'); - assert.deepEqual(nalUnits[1], new Uint8Array([0x12, 0xDD]), 'has the proper payload'); -}); - -QUnit.test('parses nal units surrounded by an unreasonable amount of zero-bytes', function(assert) { - var nalUnits = []; - nalByteStream.on('data', function(data) { - nalUnits.push(data); - }); - - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, // start code - 0x09, 0xFF, // Payload - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // end code - 0x00, 0x00, 0x01, // start code - 0x12, 0xDD, // Payload - 0x00, 0x00, 0x00, // end code - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 - ]) - }); - - assert.equal(nalUnits.length, 2, 'found two nals'); - assert.deepEqual(nalUnits[0], new Uint8Array([0x09, 0xFF]), 'has the proper payload'); - assert.deepEqual(nalUnits[1], new Uint8Array([0x12, 0xDD]), 'has the proper payload'); -}); - -QUnit.test('parses nal units split across multiple packets', function(assert) { - var nalUnits = []; - nalByteStream.on('data', function(data) { - nalUnits.push(data); - }); - - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x01, // start code - 0x09, 0xFF // Partial payload - ]) - }); - nalByteStream.push({ - data: new Uint8Array([ - 0x12, 0xDD, // Partial Payload - 0x00, 0x00, 0x00 // end code - ]) - }); - - assert.equal(nalUnits.length, 1, 'found one nal'); - assert.deepEqual(nalUnits[0], new Uint8Array([0x09, 0xFF, 0x12, 0xDD]), 'has the proper payload'); -}); - -QUnit.module('FLV - Transmuxer', { - beforeEach: function() { - transmuxer = new FlvTransmuxer(); - } -}); - -QUnit.test('generates video tags', function(assert) { - var segments = []; - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 2, 'generated a two video tags'); -}); - -QUnit.test('drops nalUnits at the start of a segment not preceeded by an access_unit_delimiter_rbsp', function(assert) { - var segments = []; - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 1, 'generated a single video tag'); -}); - -QUnit.test('generates audio tags', function(assert) { - var segments = []; - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasAudio: true - }))); - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true))); - - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 3, 'generated three audio tags'); - assert.equal(segments[0].tags.videoTags.length, 0, 'generated no video tags'); -}); - -QUnit.test('buffers video samples until flushed', function(assert) { - var segments = []; - transmuxer.on('data', function(data) { - segments.push(data); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - // buffer a NAL - transmuxer.push(packetize(videoPes([0x09, 0x01], true))); - transmuxer.push(packetize(videoPes([0x00, 0x02]))); - - // add an access_unit_delimiter_rbsp - transmuxer.push(packetize(videoPes([0x09, 0x03]))); - transmuxer.push(packetize(videoPes([0x00, 0x04]))); - transmuxer.push(packetize(videoPes([0x00, 0x05]))); - - // flush everything - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 2, 'generated two video tags'); -}); - -QUnit.test('does not buffer a duplicate video sample on subsequent flushes', function(assert) { - var segments = []; - transmuxer.on('data', function(data) { - segments.push(data); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - // buffer a NAL - transmuxer.push(packetize(videoPes([0x09, 0x01], true))); - transmuxer.push(packetize(videoPes([0x00, 0x02]))); - - // add an access_unit_delimiter_rbsp - transmuxer.push(packetize(videoPes([0x09, 0x03]))); - transmuxer.push(packetize(videoPes([0x00, 0x04]))); - transmuxer.push(packetize(videoPes([0x00, 0x05]))); - - // flush everything - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 2, 'generated two video tags'); - - segments = []; - - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - // buffer a NAL - transmuxer.push(packetize(videoPes([0x09, 0x01], true))); - transmuxer.push(packetize(videoPes([0x00, 0x02]))); - - // add an access_unit_delimiter_rbsp - transmuxer.push(packetize(videoPes([0x09, 0x03]))); - transmuxer.push(packetize(videoPes([0x00, 0x04]))); - transmuxer.push(packetize(videoPes([0x00, 0x05]))); - - // flush everything - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 2, 'generated two video tags'); -}); - -QUnit.test('emits done event when no audio data is present', function(assert) { - var segments = []; - var done = false; - - transmuxer.on('data', function(data) { - segments.push(data); - }); - transmuxer.on('done', function() { - done = true; - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - // buffer a NAL - transmuxer.push(packetize(videoPes([0x09, 0x01], true))); - transmuxer.push(packetize(videoPes([0x00, 0x02]))); - - // add an access_unit_delimiter_rbsp - transmuxer.push(packetize(videoPes([0x09, 0x03]))); - transmuxer.push(packetize(videoPes([0x00, 0x04]))); - transmuxer.push(packetize(videoPes([0x00, 0x05]))); - - // flush everything - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 2, 'generated two video tags'); - assert.ok(done, 'emitted done event even though no audio data was given'); -}); diff --git a/node_modules/mux.js/test/ts-inspector.test.js b/node_modules/mux.js/test/ts-inspector.test.js deleted file mode 100644 index 9800745..0000000 --- a/node_modules/mux.js/test/ts-inspector.test.js +++ /dev/null @@ -1,205 +0,0 @@ -'use strict'; -var segments = require('data-files!segments'); - -var - QUnit = require('qunit'), - tsInspector = require('../lib/tools/ts-inspector.js'), - StreamTypes = require('../lib/m2ts/stream-types.js'), - tsSegment = segments['test-segment.ts'](), - tsNoAudioSegment = segments['test-no-audio-segment.ts'](), - aacSegment = segments['test-aac-segment.aac'](), - utils = require('./utils'), - inspect = tsInspector.inspect, - parseAudioPes_ = tsInspector.parseAudioPes_, - packetize = utils.packetize, - audioPes = utils.audioPes, - PES_TIMESCALE = 90000; - -QUnit.module('TS Inspector'); - -QUnit.test('returns null for empty segment input', function(assert) { - assert.equal(inspect(new Uint8Array([])), null, 'returned null'); -}); - -QUnit.test('can parse a ts segment', function(assert) { - var expected = { - video: [ - { - type: 'video', - pts: 126000, - dts: 126000, - ptsTime: 126000 / PES_TIMESCALE, - dtsTime: 126000 / PES_TIMESCALE - }, - { - type: 'video', - pts: 924000, - dts: 924000, - ptsTime: 924000 / PES_TIMESCALE, - dtsTime: 924000 / PES_TIMESCALE - } - ], - firstKeyFrame: { - type: 'video', - pts: 126000, - dts: 126000, - ptsTime: 126000 / PES_TIMESCALE, - dtsTime: 126000 / PES_TIMESCALE - }, - audio: [ - { - type: 'audio', - pts: 126000, - dts: 126000, - ptsTime: 126000 / PES_TIMESCALE, - dtsTime: 126000 / PES_TIMESCALE - }, - { - type: 'audio', - pts: 859518, - dts: 859518, - ptsTime: 859518 / PES_TIMESCALE, - dtsTime: 859518 / PES_TIMESCALE - } - ] - }; - - assert.deepEqual(inspect(tsSegment), expected, 'parses ts segment timing data'); -}); - -QUnit.test('adjusts timestamp values based on provided reference', function(assert) { - var rollover = Math.pow(2, 33); - - var expected = { - video: [ - { - type: 'video', - pts: (126000 + rollover), - dts: (126000 + rollover), - ptsTime: (126000 + rollover) / PES_TIMESCALE, - dtsTime: (126000 + rollover) / PES_TIMESCALE - }, - { - type: 'video', - pts: (924000 + rollover), - dts: (924000 + rollover), - ptsTime: (924000 + rollover) / PES_TIMESCALE, - dtsTime: (924000 + rollover) / PES_TIMESCALE - } - ], - firstKeyFrame: { - type: 'video', - pts: (126000 + rollover), - dts: (126000 + rollover), - ptsTime: (126000 + rollover) / PES_TIMESCALE, - dtsTime: (126000 + rollover) / PES_TIMESCALE - }, - audio: [ - { - type: 'audio', - pts: (126000 + rollover), - dts: (126000 + rollover), - ptsTime: (126000 + rollover) / PES_TIMESCALE, - dtsTime: (126000 + rollover) / PES_TIMESCALE - }, - { - type: 'audio', - pts: (859518 + rollover), - dts: (859518 + rollover), - ptsTime: (859518 + rollover) / PES_TIMESCALE, - dtsTime: (859518 + rollover) / PES_TIMESCALE - } - ] - }; - - assert.deepEqual(inspect(tsSegment, rollover - 1), expected, - 'adjusts inspected time data to account for pts rollover'); -}); - -QUnit.test('can parse an aac segment', function(assert) { - var expected = { - audio: [ - { - type: 'audio', - pts: 895690, - dts: 895690, - ptsTime: 895690 / PES_TIMESCALE, - dtsTime: 895690 / PES_TIMESCALE - }, - { - type: 'audio', - pts: (895690 + (430 * 1024 * PES_TIMESCALE / 44100)), - dts: (895690 + (430 * 1024 * PES_TIMESCALE / 44100)), - ptsTime: (895690 + (430 * 1024 * PES_TIMESCALE / 44100)) / PES_TIMESCALE, - dtsTime: (895690 + (430 * 1024 * PES_TIMESCALE / 44100)) / PES_TIMESCALE - } - ] - }; - - assert.deepEqual(inspect(aacSegment), expected, 'parses aac segment timing data'); -}); - -QUnit.test('can parse ts segment with no audio muxed in', function(assert) { - var expected = { - video: [ - { - type: 'video', - pts: 126000, - dts: 126000, - ptsTime: 126000 / PES_TIMESCALE, - dtsTime: 126000 / PES_TIMESCALE - }, - { - type: 'video', - pts: 924000, - dts: 924000, - ptsTime: 924000 / PES_TIMESCALE, - dtsTime: 924000 / PES_TIMESCALE - } - ], - firstKeyFrame: { - type: 'video', - pts: 126000, - dts: 126000, - ptsTime: 126000 / PES_TIMESCALE, - dtsTime: 126000 / PES_TIMESCALE - } - }; - - var actual = inspect(tsNoAudioSegment); - - assert.equal(typeof actual.audio, 'undefined', 'results do not contain audio info'); - assert.deepEqual(actual, expected, - 'parses ts segment without audio timing data'); -}); - -QUnit.test('can parse audio PES when it\'s the only packet in a stream', function(assert) { - var - pts = 90000, - pmt = { - // fake pmt pid that doesn't clash with the audio pid - pid: 0x10, - table: { - // pid copied over from default of audioPes function - 0x12: StreamTypes.ADTS_STREAM_TYPE - } - }, - result = { audio: [] }; - - parseAudioPes_(packetize(audioPes([0x00], true, pts)), pmt, result); - - // note that both the first and last packet timings are the same, as there's only one - // packet to parse - assert.deepEqual( - result.audio, - [{ - dts: pts, - pts: pts, - type: 'audio' - }, { - dts: pts, - pts: pts, - type: 'audio' - }], - 'parses audio pes for timing info'); -}); diff --git a/node_modules/mux.js/test/utils.bin.test.js b/node_modules/mux.js/test/utils.bin.test.js deleted file mode 100644 index c0bcf78..0000000 --- a/node_modules/mux.js/test/utils.bin.test.js +++ /dev/null @@ -1,32 +0,0 @@ -var - QUnit = require('qunit'), - toUnsigned = require('../lib/utils/bin').toUnsigned; - -QUnit.module('Binary Utils'); - -QUnit.test('converts values to unsigned integers after bitwise operations', function(assert) { - var bytes; - - bytes = [0, 0, 124, 129]; - - assert.equal(toUnsigned(bytes[0] << 24 | - bytes[1] << 16 | - bytes[2] << 8 | - bytes[3]), - 31873, 'positive signed result stays positive'); - - bytes = [150, 234, 221, 192]; - - // sanity check - assert.equal(bytes[0] << 24 | - bytes[1] << 16 | - bytes[2] << 8 | - bytes[3], - -1762992704, 'bitwise operation produces negative signed result'); - - assert.equal(toUnsigned(bytes[0] << 24 | - bytes[1] << 16 | - bytes[2] << 8 | - bytes[3]), - 2531974592, 'negative signed result becomes unsigned positive'); -}); diff --git a/node_modules/mux.js/test/utils.clock.test.js b/node_modules/mux.js/test/utils.clock.test.js deleted file mode 100644 index a33cc16..0000000 --- a/node_modules/mux.js/test/utils.clock.test.js +++ /dev/null @@ -1,181 +0,0 @@ -'use strict'; - -var - QUnit = require('qunit'), - clock = require('../lib/utils/clock'); - -QUnit.module('Clock Utils'); - -QUnit.test('converts from seconds to video timestamps', function(assert) { - assert.equal(clock.secondsToVideoTs(0), 0, 'converts seconds to video timestamp'); - assert.equal(clock.secondsToVideoTs(1), 90000, 'converts seconds to video timestamp'); - assert.equal(clock.secondsToVideoTs(10), 900000, 'converts seconds to video timestamp'); - assert.equal(clock.secondsToVideoTs(-1), -90000, 'converts seconds to video timestamp'); - assert.equal(clock.secondsToVideoTs(3), 270000, 'converts seconds to video timestamp'); - assert.equal(clock.secondsToVideoTs(0.1), 9000, 'converts seconds to video timestamp'); -}); - -QUnit.test('converts from seconds to audio timestamps', function(assert) { - assert.equal(clock.secondsToAudioTs(0, 90000), - 0, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(1, 90000), - 90000, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(-1, 90000), - -90000, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(3, 90000), - 270000, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(0, 44100), - 0, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(1, 44100), - 44100, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(3, 44100), - 132300, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(-1, 44100), - -44100, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(0.1, 44100), - 4410, - 'converts seconds to audio timestamp'); -}); - -QUnit.test('converts from video timestamp to seconds', function(assert) { - assert.equal(clock.videoTsToSeconds(0), 0, 'converts video timestamp to seconds'); - assert.equal(clock.videoTsToSeconds(90000), 1, 'converts video timestamp to seconds'); - assert.equal(clock.videoTsToSeconds(900000), 10, 'converts video timestamp to seconds'); - assert.equal(clock.videoTsToSeconds(-90000), -1, 'converts video timestamp to seconds'); - assert.equal(clock.videoTsToSeconds(270000), 3, 'converts video timestamp to seconds'); - assert.equal(clock.videoTsToSeconds(9000), 0.1, 'converts video timestamp to seconds'); -}); - -QUnit.test('converts from audio timestamp to seconds', function(assert) { - assert.equal(clock.audioTsToSeconds(0, 90000), - 0, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(90000, 90000), - 1, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(-90000, 90000), - -1, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(270000, 90000), - 3, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(0, 44100), - 0, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(44100, 44100), - 1, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(132300, 44100), - 3, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(-44100, 44100), - -1, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(4410, 44100), - 0.1, - 'converts seconds to audio timestamp'); -}); - -QUnit.test('converts from audio timestamp to video timestamp', function(assert) { - assert.equal(clock.audioTsToVideoTs(0, 90000), - 0, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(90000, 90000), - 90000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(900000, 90000), - 900000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(-90000, 90000), - -90000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(270000, 90000), - 270000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(9000, 90000), - 9000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(0, 44100), - 0, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(44100, 44100), - 90000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(441000, 44100), - 900000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(-44100, 44100), - -90000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(132300, 44100), - 270000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(4410, 44100), - 9000, - 'converts audio timestamp to video timestamp'); -}); - -QUnit.test('converts from video timestamp to audio timestamp', function(assert) { - assert.equal(clock.videoTsToAudioTs(0, 90000), - 0, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(90000, 90000), - 90000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(900000, 90000), - 900000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(-90000, 90000), - -90000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(270000, 90000), - 270000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(9000, 90000), - 9000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(0, 44100), - 0, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(90000, 44100), - 44100, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(900000, 44100), - 441000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(-90000, 44100), - -44100, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(270000, 44100), - 132300, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(9000, 44100), - 4410, - 'converts video timestamp to audio timestamp'); -}); - -QUnit.test('converts from metadata timestamp to seconds', function(assert) { - assert.equal(clock.metadataTsToSeconds(90000, 90000, false), - 0, - 'converts metadata timestamp to seconds and adjusts by timelineStartPts'); - - assert.equal(clock.metadataTsToSeconds(270000, 90000, false), - 2, - 'converts metadata timestamp to seconds and adjusts by timelineStartPts'); - - assert.equal(clock.metadataTsToSeconds(90000, 90000, true), - 1, - 'converts metadata timestamp to seconds while keeping original timestamps'); - - assert.equal(clock.metadataTsToSeconds(180000, 0, true), - 2, - 'converts metadata timestamp to seconds while keeping original timestamps'); -}); diff --git a/node_modules/mux.js/test/utils.js b/node_modules/mux.js/test/utils.js deleted file mode 100644 index aeee72a..0000000 --- a/node_modules/mux.js/test/utils.js +++ /dev/null @@ -1,327 +0,0 @@ -var - mp2t = require('../lib/m2ts'), - id3Generator = require('./utils/id3-generator'), - MP2T_PACKET_LENGTH = mp2t.MP2T_PACKET_LENGTH, - PMT, - PAT, - generatePMT, - pesHeader, - packetize, - transportPacket, - videoPes, - adtsFrame, - audioPes, - timedMetadataPes, - binaryStringToArrayOfBytes, - leftPad; - - -PMT = [ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0010 0000 - 0x40, 0x10, - // tsc:01 afc:01 cc:0000 pointer_field:0000 0000 - 0x50, 0x00, - // tid:0000 0010 ssi:0 0:0 r:00 sl:0000 0001 1100 - 0x02, 0x00, 0x1c, - // pn:0000 0000 0000 0001 - 0x00, 0x01, - // r:00 vn:00 000 cni:1 sn:0000 0000 lsn:0000 0000 - 0x01, 0x00, 0x00, - // r:000 ppid:0 0011 1111 1111 - 0x03, 0xff, - // r:0000 pil:0000 0000 0000 - 0x00, 0x00, - // h264 - // st:0001 1010 r:000 epid:0 0000 0001 0001 - 0x1b, 0x00, 0x11, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00, - // adts - // st:0000 1111 r:000 epid:0 0000 0001 0010 - 0x0f, 0x00, 0x12, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00, - - // timed metadata - // st:0001 0111 r:000 epid:0 0000 0001 0011 - 0x15, 0x00, 0x13, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00, - - // crc - 0x00, 0x00, 0x00, 0x00 -]; - -/* - Packet Header: - | sb | tei pusi tp pid:5 | pid | tsc afc cc | - with af: - | afl | ... | | - without af: - | | - -PAT: - | pf? | ... | - | tid | ssi '0' r sl:4 | sl | tsi:8 | - | tsi | r vn cni | sn | lsn | - -with program_number == '0': - | pn | pn | r np:5 | np | -otherwise: - | pn | pn | r pmp:5 | pmp | -*/ - -PAT = [ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0000 - 0x40, 0x00, - // tsc:01 afc:01 cc:0000 pointer_field:0000 0000 - 0x50, 0x00, - // tid:0000 0000 ssi:0 0:0 r:00 sl:0000 0000 0000 - 0x00, 0x00, 0x00, - // tsi:0000 0000 0000 0000 - 0x00, 0x00, - // r:00 vn:00 000 cni:1 sn:0000 0000 lsn:0000 0000 - 0x01, 0x00, 0x00, - // pn:0000 0000 0000 0001 - 0x00, 0x01, - // r:000 pmp:0 0000 0010 0000 - 0x00, 0x10, - // crc32:0000 0000 0000 0000 0000 0000 0000 0000 - 0x00, 0x00, 0x00, 0x00 -]; - -generatePMT = function(options) { - var PMT = [ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0010 0000 - 0x40, 0x10, - // tsc:01 afc:01 cc:0000 pointer_field:0000 0000 - 0x50, 0x00, - // tid:0000 0010 ssi:0 0:0 r:00 sl:0000 0001 1100 - 0x02, 0x00, 0x1c, - // pn:0000 0000 0000 0001 - 0x00, 0x01, - // r:00 vn:00 000 cni:1 sn:0000 0000 lsn:0000 0000 - 0x01, 0x00, 0x00, - // r:000 ppid:0 0011 1111 1111 - 0x03, 0xff, - // r:0000 pil:0000 0000 0000 - 0x00, 0x00]; - - if (options.hasVideo) { - // h264 - PMT = PMT.concat([ - // st:0001 1010 r:000 epid:0 0000 0001 0001 - 0x1b, 0x00, 0x11, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00 - ]); - } - - if (options.hasAudio) { - // adts - PMT = PMT.concat([ - // st:0000 1111 r:000 epid:0 0000 0001 0010 - 0x0f, 0x00, 0x12, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00 - ]); - } - - if (options.hasMetadata) { - // timed metadata - PMT = PMT.concat([ - // st:0001 0111 r:000 epid:0 0000 0001 0011 - 0x15, 0x00, 0x13, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00 - ]); - } - - // crc - return PMT.concat([0x00, 0x00, 0x00, 0x00]); -}; - -pesHeader = function(first, pts, dataLength) { - if (!dataLength) { - dataLength = 0; - } else { - // Add the pes header length (only the portion after the - // pes_packet_length field) - dataLength += 3; - } - - // PES_packet(), Rec. ITU-T H.222.0, Table 2-21 - var result = [ - // pscp:0000 0000 0000 0000 0000 0001 - 0x00, 0x00, 0x01, - // sid:0000 0000 ppl:0000 0000 0000 0000 - 0x00, 0x00, 0x00, - // 10 psc:00 pp:0 dai:1 c:0 ooc:0 - 0x84, - // pdf:?0 ef:1 erf:0 dtmf:0 acif:0 pcf:0 pef:0 - 0x20 | (pts ? 0x80 : 0x00), - // phdl:0000 0000 - (first ? 0x01 : 0x00) + (pts ? 0x05 : 0x00) - ]; - - // Only store 15 bits of the PTS for QUnit.testing purposes - if (pts) { - var - pts32 = Math.floor(pts / 2), // right shift by 1 - leftMostBit = ((pts32 & 0x80000000) >>> 31) & 0x01, - firstThree; - - pts = pts & 0xffffffff; // remove left most bit - firstThree = (leftMostBit << 3) | (((pts & 0xc0000000) >>> 29) & 0x06) | 0x01; - result.push((0x2 << 4) | firstThree); - result.push((pts >>> 22) & 0xff); - result.push(((pts >>> 14) | 0x01) & 0xff); - result.push((pts >>> 7) & 0xff); - result.push(((pts << 1) | 0x01) & 0xff); - - // Add the bytes spent on the pts info - dataLength += 5; - } - if (first) { - result.push(0x00); - dataLength += 1; - } - - // Finally set the pes_packet_length field - result[4] = (dataLength & 0x0000FF00) >> 8; - result[5] = dataLength & 0x000000FF; - - return result; -}; - -packetize = function(data) { - var packet = new Uint8Array(MP2T_PACKET_LENGTH); - packet.set(data); - return packet; -}; - -/** - * Helper function to create transport stream PES packets - * @param pid {uint8} - the program identifier (PID) - * @param data {arraylike} - the payload bytes - * @payload first {boolean} - true if this PES should be a payload - * unit start - */ -transportPacket = function(pid, data, first, pts, isVideoData) { - var - adaptationFieldLength = 188 - data.length - 14 - (first ? 1 : 0) - (pts ? 5 : 0), - // transport_packet(), Rec. ITU-T H.222.0, Table 2-2 - result = [ - // sync byte - 0x47, - // tei:0 pusi:1 tp:0 pid:0 0000 0001 0001 - 0x40, pid, - // tsc:01 afc:11 cc:0000 - 0x70 - ].concat([ - // afl - adaptationFieldLength & 0xff, - // di:0 rai:0 espi:0 pf:0 of:0 spf:0 tpdf:0 afef:0 - 0x00 - ]), - i; - - i = adaptationFieldLength - 1; - while (i--) { - // stuffing_bytes - result.push(0xff); - } - - // PES_packet(), Rec. ITU-T H.222.0, Table 2-21 - result = result.concat(pesHeader(first, pts, isVideoData ? 0 : data.length)); - - return result.concat(data); -}; - -/** - * Helper function to create video PES packets - * @param data {arraylike} - the payload bytes - * @payload first {boolean} - true if this PES should be a payload - * unit start - */ -videoPes = function(data, first, pts) { - return transportPacket(0x11, [ - // NAL unit start code - 0x00, 0x00, 0x01 - ].concat(data), first, pts, true); -}; - -/** - * Helper function to create audio ADTS frame header - * @param dataLength {number} - the payload byte count - */ -adtsFrame = function(dataLength) { - var frameLength = dataLength + 7; - return [ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xb0 | ((frameLength & 0x1800) >> 11), // 2 channels - (frameLength & 0x7f8) >> 3, - ((frameLength & 0x07) << 5) + 7, // frame length in bytes - 0x00 // one AAC per ADTS frame - ]; -}; - -/** - * Helper function to create audio PES packets - * @param data {arraylike} - the payload bytes - * @payload first {boolean} - true if this PES should be a payload - * unit start - */ -audioPes = function(data, first, pts) { - return transportPacket(0x12, - adtsFrame(data.length).concat(data), - first, pts); -}; - -timedMetadataPes = function(data) { - var id3 = id3Generator; - return transportPacket(0x13, id3.id3Tag(id3.id3Frame('PRIV', 0x00, 0x01))); -}; - -binaryStringToArrayOfBytes = function(string) { - var - array = [], - arrayIndex = 0, - stringIndex = 0; - - while (stringIndex < string.length) { - array[arrayIndex] = parseInt(string.slice(stringIndex, stringIndex + 8), 2); - - arrayIndex++; - // next byte - stringIndex += 8; - } - - return array; -}; - -leftPad = function(string, targetLength) { - if (string.length >= targetLength) { - return string; - } - return new Array(targetLength - string.length + 1).join('0') + string; -}; - -module.exports = { - PMT: PMT, - PAT: PAT, - generatePMT: generatePMT, - pesHeader: pesHeader, - packetize: packetize, - transportPacket: transportPacket, - videoPes: videoPes, - adtsFrame: adtsFrame, - audioPes: audioPes, - timedMetadataPes: timedMetadataPes, - binaryStringToArrayOfBytes: binaryStringToArrayOfBytes, - leftPad: leftPad -}; diff --git a/node_modules/mux.js/test/utils/cc708-pink-underscore.js b/node_modules/mux.js/test/utils/cc708-pink-underscore.js deleted file mode 100644 index cf328ef..0000000 --- a/node_modules/mux.js/test/utils/cc708-pink-underscore.js +++ /dev/null @@ -1,10816 +0,0 @@ -module.exports = [ - { type: 3, pts: 6723191334, ccData: 546 }, - { type: 2, pts: 6723191334, ccData: 35842 }, - { type: 3, pts: 6723197340, ccData: 16930 }, - { type: 2, pts: 6723197340, ccData: 35072 }, - { type: 3, pts: 6723215358, ccData: 35377 }, - { type: 2, pts: 6723215358, ccData: 38939 }, - { type: 2, pts: 6723215358, ccData: 16640 }, - { type: 2, pts: 6723215358, ccData: 31 }, - { type: 2, pts: 6723215358, ccData: 5264 }, - { type: 2, pts: 6723215358, ccData: 1283 }, - { type: 2, pts: 6723215358, ccData: 37162 }, - { type: 2, pts: 6723215358, ccData: 42 }, - { type: 2, pts: 6723215358, ccData: 37376 }, - { type: 2, pts: 6723215358, ccData: 0 }, - { type: 3, pts: 6723221364, ccData: 49955 }, - { type: 2, pts: 6723221364, ccData: 37376 }, - { type: 2, pts: 6723221364, ccData: 256 }, - { type: 3, pts: 6723227370, ccData: 546 }, - { type: 2, pts: 6723227370, ccData: 8784 }, - { type: 3, pts: 6723230373, ccData: 16930 }, - { type: 2, pts: 6723230373, ccData: 26990 }, - { type: 3, pts: 6723233376, ccData: 33314 }, - { type: 2, pts: 6723233376, ccData: 27489 }, - { type: 3, pts: 6723236379, ccData: 49698 }, - { type: 2, pts: 6723236379, ccData: 27753 }, - { type: 3, pts: 6723239382, ccData: 546 }, - { type: 2, pts: 6723239382, ccData: 25449 }, - { type: 3, pts: 6723242385, ccData: 16930 }, - { type: 2, pts: 6723242385, ccData: 28533 }, - { type: 3, pts: 6723245388, ccData: 33314 }, - { type: 2, pts: 6723245388, ccData: 29535 }, - { type: 3, pts: 6723248391, ccData: 49698 }, - { type: 2, pts: 6723248391, ccData: 24942 }, - { type: 3, pts: 6723251394, ccData: 546 }, - { type: 2, pts: 6723251394, ccData: 25695 }, - { type: 3, pts: 6723254397, ccData: 16930 }, - { type: 2, pts: 6723254397, ccData: 20581 }, - { type: 3, pts: 6723257400, ccData: 33314 }, - { type: 2, pts: 6723257400, ccData: 29797 }, - { type: 3, pts: 6723260403, ccData: 49698 }, - { type: 2, pts: 6723260403, ccData: 29298 }, - { type: 3, pts: 6723263406, ccData: 546 }, - { type: 2, pts: 6723263406, ccData: 26982 }, - { type: 3, pts: 6723266409, ccData: 16930 }, - { type: 2, pts: 6723266409, ccData: 26979 }, - { type: 3, pts: 6723269412, ccData: 33314 }, - { type: 2, pts: 6723269412, ccData: 8704 }, - { type: 3, pts: 6723272415, ccData: 51761 }, - { type: 2, pts: 6723272415, ccData: 38939 }, - { type: 2, pts: 6723272415, ccData: 16640 }, - { type: 2, pts: 6723272415, ccData: 287 }, - { type: 2, pts: 6723272415, ccData: 4240 }, - { type: 2, pts: 6723272415, ccData: 1283 }, - { type: 2, pts: 6723272415, ccData: 37162 }, - { type: 2, pts: 6723272415, ccData: 0 }, - { type: 2, pts: 6723272415, ccData: 37377 }, - { type: 2, pts: 6723272415, ccData: 0 }, - { type: 3, pts: 6723275418, ccData: 51761 }, - { type: 2, pts: 6723275418, ccData: 38939 }, - { type: 2, pts: 6723275418, ccData: 16640 }, - { type: 2, pts: 6723275418, ccData: 287 }, - { type: 2, pts: 6723275418, ccData: 4240 }, - { type: 2, pts: 6723275418, ccData: 1283 }, - { type: 2, pts: 6723275418, ccData: 37162 }, - { type: 2, pts: 6723275418, ccData: 0 }, - { type: 2, pts: 6723275418, ccData: 37377 }, - { type: 2, pts: 6723275418, ccData: 0 }, - { type: 3, pts: 6723281424, ccData: 803 }, - { type: 2, pts: 6723281424, ccData: 37377 }, - { type: 2, pts: 6723281424, ccData: 512 }, - { type: 3, pts: 6723287430, ccData: 16930 }, - { type: 2, pts: 6723287430, ccData: 26995 }, - { type: 3, pts: 6723290433, ccData: 33314 }, - { type: 2, pts: 6723290433, ccData: 24429 }, - { type: 3, pts: 6723293436, ccData: 49698 }, - { type: 2, pts: 6723293436, ccData: 24932 }, - { type: 3, pts: 6723296439, ccData: 546 }, - { type: 2, pts: 6723296439, ccData: 25951 }, - { type: 3, pts: 6723299442, ccData: 16930 }, - { type: 2, pts: 6723299442, ccData: 28783 }, - { type: 3, pts: 6723302445, ccData: 33314 }, - { type: 2, pts: 6723302445, ccData: 29555 }, - { type: 3, pts: 6723305448, ccData: 49698 }, - { type: 2, pts: 6723305448, ccData: 26978 }, - { type: 3, pts: 6723308451, ccData: 546 }, - { type: 2, pts: 6723308451, ccData: 27749 }, - { type: 3, pts: 6723311454, ccData: 16930 }, - { type: 2, pts: 6723311454, ccData: 24425 }, - { type: 3, pts: 6723314457, ccData: 33314 }, - { type: 2, pts: 6723314457, ccData: 28255 }, - { type: 3, pts: 6723317460, ccData: 49698 }, - { type: 2, pts: 6723317460, ccData: 28769 }, - { type: 3, pts: 6723320463, ccData: 546 }, - { type: 2, pts: 6723320463, ccData: 29300 }, - { type: 3, pts: 6723323466, ccData: 16930 }, - { type: 2, pts: 6723323466, ccData: 24418 }, - { type: 3, pts: 6723326469, ccData: 33314 }, - { type: 2, pts: 6723326469, ccData: 31034 }, - { type: 3, pts: 6723335478, ccData: 49698 }, - { type: 2, pts: 6723335478, ccData: 35073 }, - { type: 3, pts: 6723626769, ccData: 546 }, - { type: 2, pts: 6723626769, ccData: 35841 }, - { type: 3, pts: 6723644787, ccData: 16930 }, - { type: 2, pts: 6723644787, ccData: 35072 }, - { type: 3, pts: 6723650793, ccData: 35377 }, - { type: 2, pts: 6723650793, ccData: 38939 }, - { type: 2, pts: 6723650793, ccData: 15360 }, - { type: 2, pts: 6723650793, ccData: 31 }, - { type: 2, pts: 6723650793, ccData: 5264 }, - { type: 2, pts: 6723650793, ccData: 1283 }, - { type: 2, pts: 6723650793, ccData: 37162 }, - { type: 2, pts: 6723650793, ccData: 0 }, - { type: 2, pts: 6723650793, ccData: 37376 }, - { type: 2, pts: 6723650793, ccData: 3072 }, - { type: 3, pts: 6723653796, ccData: 49955 }, - { type: 2, pts: 6723653796, ccData: 37376 }, - { type: 2, pts: 6723653796, ccData: 3328 }, - { type: 3, pts: 6723656799, ccData: 546 }, - { type: 2, pts: 6723656799, ccData: 18249 }, - { type: 3, pts: 6723659802, ccData: 16930 }, - { type: 2, pts: 6723659802, ccData: 21068 }, - { type: 3, pts: 6723662805, ccData: 33314 }, - { type: 2, pts: 6723662805, ccData: 14848 }, - { type: 3, pts: 6723665808, ccData: 51761 }, - { type: 2, pts: 6723665808, ccData: 38939 }, - { type: 2, pts: 6723665808, ccData: 15360 }, - { type: 2, pts: 6723665808, ccData: 287 }, - { type: 2, pts: 6723665808, ccData: 4240 }, - { type: 2, pts: 6723665808, ccData: 1283 }, - { type: 2, pts: 6723665808, ccData: 37162 }, - { type: 2, pts: 6723665808, ccData: 0 }, - { type: 2, pts: 6723665808, ccData: 37377 }, - { type: 2, pts: 6723665808, ccData: 2048 }, - { type: 3, pts: 6723668811, ccData: 546 }, - { type: 2, pts: 6723668811, ccData: 21093 }, - { type: 3, pts: 6723671814, ccData: 16930 }, - { type: 2, pts: 6723671814, ccData: 24932 }, - { type: 3, pts: 6723674817, ccData: 33314 }, - { type: 2, pts: 6723674817, ccData: 24429 }, - { type: 3, pts: 6723677820, ccData: 49698 }, - { type: 2, pts: 6723677820, ccData: 25951 }, - { type: 3, pts: 6723680823, ccData: 546 }, - { type: 2, pts: 6723680823, ccData: 29800 }, - { type: 3, pts: 6723683826, ccData: 16930 }, - { type: 2, pts: 6723683826, ccData: 25951 }, - { type: 3, pts: 6723686829, ccData: 33314 }, - { type: 2, pts: 6723686829, ccData: 29793 }, - { type: 3, pts: 6723689832, ccData: 49698 }, - { type: 2, pts: 6723689832, ccData: 27749 }, - { type: 3, pts: 6723692835, ccData: 2609 }, - { type: 2, pts: 6723692835, ccData: 38939 }, - { type: 2, pts: 6723692835, ccData: 15360 }, - { type: 2, pts: 6723692835, ccData: 543 }, - { type: 2, pts: 6723692835, ccData: 4240 }, - { type: 2, pts: 6723692835, ccData: 1283 }, - { type: 2, pts: 6723692835, ccData: 37162 }, - { type: 2, pts: 6723692835, ccData: 0 }, - { type: 2, pts: 6723692835, ccData: 37378 }, - { type: 2, pts: 6723692835, ccData: 1024 }, - { type: 3, pts: 6723695838, ccData: 17187 }, - { type: 2, pts: 6723695838, ccData: 37378 }, - { type: 2, pts: 6723695838, ccData: 1792 }, - { type: 3, pts: 6723698841, ccData: 33314 }, - { type: 2, pts: 6723698841, ccData: 28518 }, - { type: 3, pts: 6723701844, ccData: 49698 }, - { type: 2, pts: 6723701844, ccData: 24417 }, - { type: 3, pts: 6723704847, ccData: 546 }, - { type: 2, pts: 6723704847, ccData: 24422 }, - { type: 3, pts: 6723707850, ccData: 16930 }, - { type: 2, pts: 6723707850, ccData: 24946 }, - { type: 3, pts: 6723710853, ccData: 33314 }, - { type: 2, pts: 6723710853, ccData: 24951 }, - { type: 3, pts: 6723713856, ccData: 49698 }, - { type: 2, pts: 6723713856, ccData: 24953 }, - { type: 3, pts: 6723716859, ccData: 546 }, - { type: 2, pts: 6723716859, ccData: 24428 }, - { type: 3, pts: 6723719862, ccData: 16930 }, - { type: 2, pts: 6723719862, ccData: 24942 }, - { type: 3, pts: 6723722865, ccData: 33314 }, - { type: 2, pts: 6723722865, ccData: 25646 }, - { type: 3, pts: 6723740883, ccData: 49698 }, - { type: 2, pts: 6723740883, ccData: 35073 }, - { type: 3, pts: 6723746889, ccData: 2609 }, - { type: 2, pts: 6723746889, ccData: 39195 }, - { type: 2, pts: 6723746889, ccData: 16640 }, - { type: 2, pts: 6723746889, ccData: 31 }, - { type: 2, pts: 6723746889, ccData: 5264 }, - { type: 2, pts: 6723746889, ccData: 1283 }, - { type: 2, pts: 6723746889, ccData: 37162 }, - { type: 2, pts: 6723746889, ccData: 42 }, - { type: 2, pts: 6723746889, ccData: 37376 }, - { type: 2, pts: 6723746889, ccData: 1024 }, - { type: 3, pts: 6723749892, ccData: 17187 }, - { type: 2, pts: 6723749892, ccData: 37376 }, - { type: 2, pts: 6723749892, ccData: 1792 }, - { type: 3, pts: 6723752895, ccData: 33314 }, - { type: 2, pts: 6723752895, ccData: 21605 }, - { type: 3, pts: 6723755898, ccData: 49698 }, - { type: 2, pts: 6723755898, ccData: 27756 }, - { type: 3, pts: 6723758901, ccData: 546 }, - { type: 2, pts: 6723758901, ccData: 24429 }, - { type: 3, pts: 6723761904, ccData: 16930 }, - { type: 2, pts: 6723761904, ccData: 25951 }, - { type: 3, pts: 6723764907, ccData: 33314 }, - { type: 2, pts: 6723764907, ccData: 28518 }, - { type: 3, pts: 6723767910, ccData: 49698 }, - { type: 2, pts: 6723767910, ccData: 24432 }, - { type: 3, pts: 6723770913, ccData: 546 }, - { type: 2, pts: 6723770913, ccData: 27745 }, - { type: 3, pts: 6723773916, ccData: 16930 }, - { type: 2, pts: 6723773916, ccData: 28261 }, - { type: 3, pts: 6723776919, ccData: 33314 }, - { type: 2, pts: 6723776919, ccData: 29811 }, - { type: 3, pts: 6723779922, ccData: 51761 }, - { type: 2, pts: 6723779922, ccData: 39195 }, - { type: 2, pts: 6723779922, ccData: 16640 }, - { type: 2, pts: 6723779922, ccData: 287 }, - { type: 2, pts: 6723779922, ccData: 4240 }, - { type: 2, pts: 6723779922, ccData: 1283 }, - { type: 2, pts: 6723779922, ccData: 37162 }, - { type: 2, pts: 6723779922, ccData: 0 }, - { type: 2, pts: 6723779922, ccData: 37377 }, - { type: 2, pts: 6723779922, ccData: 1024 }, - { type: 3, pts: 6723782925, ccData: 803 }, - { type: 2, pts: 6723782925, ccData: 37377 }, - { type: 2, pts: 6723782925, ccData: 1536 }, - { type: 3, pts: 6723785928, ccData: 16930 }, - { type: 2, pts: 6723785928, ccData: 30569 }, - { type: 3, pts: 6723788931, ccData: 33314 }, - { type: 2, pts: 6723788931, ccData: 29800 }, - { type: 3, pts: 6723791934, ccData: 49698 }, - { type: 2, pts: 6723791934, ccData: 24431 }, - { type: 3, pts: 6723794937, ccData: 546 }, - { type: 2, pts: 6723794937, ccData: 25445 }, - { type: 3, pts: 6723797940, ccData: 16930 }, - { type: 2, pts: 6723797940, ccData: 24942 }, - { type: 3, pts: 6723800943, ccData: 33314 }, - { type: 2, pts: 6723800943, ccData: 29535 }, - { type: 3, pts: 6723803946, ccData: 49698 }, - { type: 2, pts: 6723803946, ccData: 28518 }, - { type: 3, pts: 6723806949, ccData: 546 }, - { type: 2, pts: 6723806949, ccData: 24435 }, - { type: 3, pts: 6723809952, ccData: 16930 }, - { type: 2, pts: 6723809952, ccData: 24942 }, - { type: 3, pts: 6723812955, ccData: 33314 }, - { type: 2, pts: 6723812955, ccData: 25646 }, - { type: 3, pts: 6723945087, ccData: 49698 }, - { type: 2, pts: 6723945087, ccData: 35841 }, - { type: 3, pts: 6723948090, ccData: 546 }, - { type: 2, pts: 6723948090, ccData: 35074 }, - { type: 3, pts: 6723954096, ccData: 18993 }, - { type: 2, pts: 6723954096, ccData: 38939 }, - { type: 2, pts: 6723954096, ccData: 16640 }, - { type: 2, pts: 6723954096, ccData: 31 }, - { type: 2, pts: 6723954096, ccData: 5264 }, - { type: 2, pts: 6723954096, ccData: 1283 }, - { type: 2, pts: 6723954096, ccData: 37162 }, - { type: 2, pts: 6723954096, ccData: 42 }, - { type: 2, pts: 6723954096, ccData: 37376 }, - { type: 2, pts: 6723954096, ccData: 1024 }, - { type: 3, pts: 6723957099, ccData: 33571 }, - { type: 2, pts: 6723957099, ccData: 37376 }, - { type: 2, pts: 6723957099, ccData: 1792 }, - { type: 3, pts: 6723960102, ccData: 49698 }, - { type: 2, pts: 6723960102, ccData: 21601 }, - { type: 3, pts: 6723963105, ccData: 546 }, - { type: 2, pts: 6723963105, ccData: 27493 }, - { type: 3, pts: 6723966108, ccData: 16930 }, - { type: 2, pts: 6723966108, ccData: 24429 }, - { type: 3, pts: 6723969111, ccData: 33314 }, - { type: 2, pts: 6723969111, ccData: 25951 }, - { type: 3, pts: 6723972114, ccData: 49698 }, - { type: 2, pts: 6723972114, ccData: 29807 }, - { type: 3, pts: 6723975117, ccData: 546 }, - { type: 2, pts: 6723975117, ccData: 24432 }, - { type: 3, pts: 6723978120, ccData: 16930 }, - { type: 2, pts: 6723978120, ccData: 27745 }, - { type: 3, pts: 6723981123, ccData: 33314 }, - { type: 2, pts: 6723981123, ccData: 25445 }, - { type: 3, pts: 6723984126, ccData: 49698 }, - { type: 2, pts: 6723984126, ccData: 29440 }, - { type: 3, pts: 6723987129, ccData: 2609 }, - { type: 2, pts: 6723987129, ccData: 38939 }, - { type: 2, pts: 6723987129, ccData: 16640 }, - { type: 2, pts: 6723987129, ccData: 287 }, - { type: 2, pts: 6723987129, ccData: 4240 }, - { type: 2, pts: 6723987129, ccData: 1283 }, - { type: 2, pts: 6723987129, ccData: 37162 }, - { type: 2, pts: 6723987129, ccData: 0 }, - { type: 2, pts: 6723987129, ccData: 37377 }, - { type: 2, pts: 6723987129, ccData: 1024 }, - { type: 3, pts: 6723990132, ccData: 17187 }, - { type: 2, pts: 6723990132, ccData: 37377 }, - { type: 2, pts: 6723990132, ccData: 1536 }, - { type: 3, pts: 6723993135, ccData: 33314 }, - { type: 2, pts: 6723993135, ccData: 28025 }, - { type: 3, pts: 6723996138, ccData: 49698 }, - { type: 2, pts: 6723996138, ccData: 24432 }, - { type: 3, pts: 6723999141, ccData: 546 }, - { type: 2, pts: 6723999141, ccData: 24947 }, - { type: 3, pts: 6724002144, ccData: 16930 }, - { type: 2, pts: 6724002144, ccData: 29545 }, - { type: 3, pts: 6724005147, ccData: 33314 }, - { type: 2, pts: 6724005147, ccData: 28526 }, - { type: 3, pts: 6724008150, ccData: 49698 }, - { type: 2, pts: 6724008150, ccData: 29535 }, - { type: 3, pts: 6724011153, ccData: 546 }, - { type: 2, pts: 6724011153, ccData: 28789 }, - { type: 3, pts: 6724014156, ccData: 16930 }, - { type: 2, pts: 6724014156, ccData: 29299 }, - { type: 3, pts: 6724017159, ccData: 33314 }, - { type: 2, pts: 6724017159, ccData: 30053 }, - { type: 3, pts: 6724020162, ccData: 49698 }, - { type: 2, pts: 6724020162, ccData: 11776 }, - { type: 3, pts: 6724200342, ccData: 546 }, - { type: 2, pts: 6724200342, ccData: 35842 }, - { type: 3, pts: 6724203345, ccData: 16930 }, - { type: 2, pts: 6724203345, ccData: 35073 }, - { type: 3, pts: 6724209351, ccData: 35377 }, - { type: 2, pts: 6724209351, ccData: 39195 }, - { type: 2, pts: 6724209351, ccData: 16640 }, - { type: 2, pts: 6724209351, ccData: 31 }, - { type: 2, pts: 6724209351, ccData: 5264 }, - { type: 2, pts: 6724209351, ccData: 1283 }, - { type: 2, pts: 6724209351, ccData: 37162 }, - { type: 2, pts: 6724209351, ccData: 42 }, - { type: 2, pts: 6724209351, ccData: 37376 }, - { type: 2, pts: 6724209351, ccData: 1024 }, - { type: 3, pts: 6724212354, ccData: 49955 }, - { type: 2, pts: 6724212354, ccData: 37376 }, - { type: 2, pts: 6724212354, ccData: 1792 }, - { type: 3, pts: 6724215357, ccData: 546 }, - { type: 2, pts: 6724215357, ccData: 21605 }, - { type: 3, pts: 6724218360, ccData: 16930 }, - { type: 2, pts: 6724218360, ccData: 24931 }, - { type: 3, pts: 6724221363, ccData: 33314 }, - { type: 2, pts: 6724221363, ccData: 26719 }, - { type: 3, pts: 6724224366, ccData: 49698 }, - { type: 2, pts: 6724224366, ccData: 28005 }, - { type: 3, pts: 6724227369, ccData: 546 }, - { type: 2, pts: 6724227369, ccData: 24436 }, - { type: 3, pts: 6724230372, ccData: 16930 }, - { type: 2, pts: 6724230372, ccData: 28511 }, - { type: 3, pts: 6724233375, ccData: 33314 }, - { type: 2, pts: 6724233375, ccData: 29285 }, - { type: 3, pts: 6724236378, ccData: 49698 }, - { type: 2, pts: 6724236378, ccData: 24932 }, - { type: 3, pts: 6724239381, ccData: 546 }, - { type: 2, pts: 6724239381, ccData: 11264 }, - { type: 3, pts: 6724242384, ccData: 18993 }, - { type: 2, pts: 6724242384, ccData: 39195 }, - { type: 2, pts: 6724242384, ccData: 16640 }, - { type: 2, pts: 6724242384, ccData: 287 }, - { type: 2, pts: 6724242384, ccData: 4240 }, - { type: 2, pts: 6724242384, ccData: 1283 }, - { type: 2, pts: 6724242384, ccData: 37162 }, - { type: 2, pts: 6724242384, ccData: 0 }, - { type: 2, pts: 6724242384, ccData: 37377 }, - { type: 2, pts: 6724242384, ccData: 0 }, - { type: 3, pts: 6724245387, ccData: 33571 }, - { type: 2, pts: 6724245387, ccData: 37377 }, - { type: 2, pts: 6724245387, ccData: 512 }, - { type: 3, pts: 6724248390, ccData: 49698 }, - { type: 2, pts: 6724248390, ccData: 24942 }, - { type: 3, pts: 6724251393, ccData: 546 }, - { type: 2, pts: 6724251393, ccData: 25695 }, - { type: 3, pts: 6724254396, ccData: 16930 }, - { type: 2, pts: 6724254396, ccData: 18727 }, - { type: 3, pts: 6724257399, ccData: 33314 }, - { type: 2, pts: 6724257399, ccData: 27756 }, - { type: 3, pts: 6724260402, ccData: 49698 }, - { type: 2, pts: 6724260402, ccData: 24436 }, - { type: 3, pts: 6724263405, ccData: 546 }, - { type: 2, pts: 6724263405, ccData: 25953 }, - { type: 3, pts: 6724266408, ccData: 16930 }, - { type: 2, pts: 6724266408, ccData: 25448 }, - { type: 3, pts: 6724269411, ccData: 33314 }, - { type: 2, pts: 6724269411, ccData: 24435 }, - { type: 3, pts: 6724272414, ccData: 49698 }, - { type: 2, pts: 6724272414, ccData: 28525 }, - { type: 3, pts: 6724275417, ccData: 546 }, - { type: 2, pts: 6724275417, ccData: 25967 }, - { type: 3, pts: 6724278420, ccData: 16930 }, - { type: 2, pts: 6724278420, ccData: 28261 }, - { type: 3, pts: 6724281423, ccData: 33314 }, - { type: 2, pts: 6724281423, ccData: 11359 }, - { type: 3, pts: 6724284426, ccData: 49698 }, - { type: 2, pts: 6724284426, ccData: 29807 }, - { type: 3, pts: 6724287429, ccData: 546 }, - { type: 2, pts: 6724287429, ccData: 28462 }, - { type: 3, pts: 6724482624, ccData: 16930 }, - { type: 2, pts: 6724482624, ccData: 35841 }, - { type: 3, pts: 6724485627, ccData: 33314 }, - { type: 2, pts: 6724485627, ccData: 35074 }, - { type: 3, pts: 6724491633, ccData: 51761 }, - { type: 2, pts: 6724491633, ccData: 38939 }, - { type: 2, pts: 6724491633, ccData: 0 }, - { type: 2, pts: 6724491633, ccData: 31 }, - { type: 2, pts: 6724491633, ccData: 5264 }, - { type: 2, pts: 6724491633, ccData: 1283 }, - { type: 2, pts: 6724491633, ccData: 37162 }, - { type: 2, pts: 6724491633, ccData: 42 }, - { type: 2, pts: 6724491633, ccData: 37376 }, - { type: 2, pts: 6724491633, ccData: 1024 }, - { type: 3, pts: 6724494636, ccData: 546 }, - { type: 2, pts: 6724494636, ccData: 18543 }, - { type: 3, pts: 6724497639, ccData: 16930 }, - { type: 2, pts: 6724497639, ccData: 28005 }, - { type: 3, pts: 6724500642, ccData: 33314 }, - { type: 2, pts: 6724500642, ccData: 29279 }, - { type: 3, pts: 6724503645, ccData: 49698 }, - { type: 2, pts: 6724503645, ccData: 26995 }, - { type: 3, pts: 6724506648, ccData: 546 }, - { type: 2, pts: 6724506648, ccData: 24417 }, - { type: 3, pts: 6724509651, ccData: 16930 }, - { type: 2, pts: 6724509651, ccData: 24432 }, - { type: 3, pts: 6724512654, ccData: 33314 }, - { type: 2, pts: 6724512654, ccData: 29295 }, - { type: 3, pts: 6724515657, ccData: 49698 }, - { type: 2, pts: 6724515657, ccData: 30052 }, - { type: 3, pts: 6724518660, ccData: 546 }, - { type: 2, pts: 6724518660, ccData: 24435 }, - { type: 3, pts: 6724521663, ccData: 16930 }, - { type: 2, pts: 6724521663, ccData: 28783 }, - { type: 3, pts: 6724524666, ccData: 33314 }, - { type: 2, pts: 6724524666, ccData: 28275 }, - { type: 3, pts: 6724527669, ccData: 49698 }, - { type: 2, pts: 6724527669, ccData: 28530 }, - { type: 3, pts: 6724530672, ccData: 2609 }, - { type: 2, pts: 6724530672, ccData: 38939 }, - { type: 2, pts: 6724530672, ccData: 0 }, - { type: 2, pts: 6724530672, ccData: 287 }, - { type: 2, pts: 6724530672, ccData: 4240 }, - { type: 2, pts: 6724530672, ccData: 1283 }, - { type: 2, pts: 6724530672, ccData: 37162 }, - { type: 2, pts: 6724530672, ccData: 0 }, - { type: 2, pts: 6724530672, ccData: 37377 }, - { type: 2, pts: 6724530672, ccData: 2048 }, - { type: 3, pts: 6724533675, ccData: 17187 }, - { type: 2, pts: 6724533675, ccData: 37377 }, - { type: 2, pts: 6724533675, ccData: 2560 }, - { type: 3, pts: 6724536678, ccData: 33314 }, - { type: 2, pts: 6724536678, ccData: 28518 }, - { type: 3, pts: 6724539681, ccData: 49698 }, - { type: 2, pts: 6724539681, ccData: 24400 }, - { type: 3, pts: 6724542684, ccData: 546 }, - { type: 2, pts: 6724542684, ccData: 16979 }, - { type: 3, pts: 6724545687, ccData: 16930 }, - { type: 2, pts: 6724545687, ccData: 24395 }, - { type: 3, pts: 6724548690, ccData: 33314 }, - { type: 2, pts: 6724548690, ccData: 26980 }, - { type: 3, pts: 6724551693, ccData: 49698 }, - { type: 2, pts: 6724551693, ccData: 29486 }, - { type: 3, pts: 6724713855, ccData: 546 }, - { type: 2, pts: 6724713855, ccData: 35842 }, - { type: 3, pts: 6724716858, ccData: 16930 }, - { type: 2, pts: 6724716858, ccData: 35073 }, - { type: 3, pts: 6724975116, ccData: 33314 }, - { type: 2, pts: 6724975116, ccData: 35841 }, - { type: 3, pts: 6724996137, ccData: 49698 }, - { type: 2, pts: 6724996137, ccData: 35072 }, - { type: 3, pts: 6725002143, ccData: 2609 }, - { type: 2, pts: 6725002143, ccData: 38939 }, - { type: 2, pts: 6725002143, ccData: 17920 }, - { type: 2, pts: 6725002143, ccData: 31 }, - { type: 2, pts: 6725002143, ccData: 5264 }, - { type: 2, pts: 6725002143, ccData: 1283 }, - { type: 2, pts: 6725002143, ccData: 37162 }, - { type: 2, pts: 6725002143, ccData: 0 }, - { type: 2, pts: 6725002143, ccData: 37376 }, - { type: 2, pts: 6725002143, ccData: 3072 }, - { type: 3, pts: 6725005146, ccData: 17187 }, - { type: 2, pts: 6725005146, ccData: 37376 }, - { type: 2, pts: 6725005146, ccData: 3584 }, - { type: 3, pts: 6725008149, ccData: 33313 }, - { type: 2, pts: 6725008149, ccData: 32512 }, - { type: 3, pts: 6725011152, ccData: 49698 }, - { type: 2, pts: 6725011152, ccData: 24320 }, - { type: 3, pts: 6725014155, ccData: 545 }, - { type: 2, pts: 6725014155, ccData: 32512 }, - { type: 3, pts: 6725065206, ccData: 16930 }, - { type: 2, pts: 6725065206, ccData: 35073 }, - { type: 3, pts: 6725071212, ccData: 35377 }, - { type: 2, pts: 6725071212, ccData: 39195 }, - { type: 2, pts: 6725071212, ccData: 15360 }, - { type: 2, pts: 6725071212, ccData: 31 }, - { type: 2, pts: 6725071212, ccData: 5264 }, - { type: 2, pts: 6725071212, ccData: 1283 }, - { type: 2, pts: 6725071212, ccData: 37162 }, - { type: 2, pts: 6725071212, ccData: 42 }, - { type: 2, pts: 6725071212, ccData: 37376 }, - { type: 2, pts: 6725071212, ccData: 3072 }, - { type: 3, pts: 6725074215, ccData: 49955 }, - { type: 2, pts: 6725074215, ccData: 37376 }, - { type: 2, pts: 6725074215, ccData: 3584 }, - { type: 3, pts: 6725077218, ccData: 546 }, - { type: 2, pts: 6725077218, ccData: 19273 }, - { type: 3, pts: 6725080221, ccData: 16930 }, - { type: 2, pts: 6725080221, ccData: 17466 }, - { type: 3, pts: 6725083224, ccData: 35377 }, - { type: 2, pts: 6725083224, ccData: 39195 }, - { type: 2, pts: 6725083224, ccData: 15360 }, - { type: 2, pts: 6725083224, ccData: 287 }, - { type: 2, pts: 6725083224, ccData: 4240 }, - { type: 2, pts: 6725083224, ccData: 1283 }, - { type: 2, pts: 6725083224, ccData: 37162 }, - { type: 2, pts: 6725083224, ccData: 0 }, - { type: 2, pts: 6725083224, ccData: 37377 }, - { type: 2, pts: 6725083224, ccData: 2048 }, - { type: 3, pts: 6725086227, ccData: 49698 }, - { type: 2, pts: 6725086227, ccData: 21601 }, - { type: 3, pts: 6725089230, ccData: 546 }, - { type: 2, pts: 6725089230, ccData: 29287 }, - { type: 3, pts: 6725092233, ccData: 16930 }, - { type: 2, pts: 6725092233, ccData: 25972 }, - { type: 3, pts: 6725095236, ccData: 33314 }, - { type: 2, pts: 6725095236, ccData: 24418 }, - { type: 3, pts: 6725098239, ccData: 49698 }, - { type: 2, pts: 6725098239, ccData: 25964 }, - { type: 3, pts: 6725101242, ccData: 546 }, - { type: 2, pts: 6725101242, ccData: 26981 }, - { type: 3, pts: 6725104245, ccData: 16930 }, - { type: 2, pts: 6725104245, ccData: 30309 }, - { type: 3, pts: 6725107248, ccData: 33314 }, - { type: 2, pts: 6725107248, ccData: 29440 }, - { type: 3, pts: 6725110251, ccData: 51761 }, - { type: 2, pts: 6725110251, ccData: 39195 }, - { type: 2, pts: 6725110251, ccData: 15360 }, - { type: 2, pts: 6725110251, ccData: 543 }, - { type: 2, pts: 6725110251, ccData: 4240 }, - { type: 2, pts: 6725110251, ccData: 1283 }, - { type: 2, pts: 6725110251, ccData: 37162 }, - { type: 2, pts: 6725110251, ccData: 0 }, - { type: 2, pts: 6725110251, ccData: 37378 }, - { type: 2, pts: 6725110251, ccData: 1024 }, - { type: 3, pts: 6725113254, ccData: 803 }, - { type: 2, pts: 6725113254, ccData: 37378 }, - { type: 2, pts: 6725113254, ccData: 1280 }, - { type: 3, pts: 6725116257, ccData: 16930 }, - { type: 2, pts: 6725116257, ccData: 29800 }, - { type: 3, pts: 6725119260, ccData: 33314 }, - { type: 2, pts: 6725119260, ccData: 24948 }, - { type: 3, pts: 6725122263, ccData: 49698 }, - { type: 2, pts: 6725122263, ccData: 24436 }, - { type: 3, pts: 6725125266, ccData: 546 }, - { type: 2, pts: 6725125266, ccData: 26725 }, - { type: 3, pts: 6725128269, ccData: 16930 }, - { type: 2, pts: 6725128269, ccData: 24432 }, - { type: 3, pts: 6725131272, ccData: 33314 }, - { type: 2, pts: 6725131272, ccData: 28535 }, - { type: 3, pts: 6725134275, ccData: 49698 }, - { type: 2, pts: 6725134275, ccData: 25970 }, - { type: 3, pts: 6725137278, ccData: 546 }, - { type: 2, pts: 6725137278, ccData: 24431 }, - { type: 3, pts: 6725140281, ccData: 16930 }, - { type: 2, pts: 6725140281, ccData: 26207 }, - { type: 3, pts: 6725143284, ccData: 33314 }, - { type: 2, pts: 6725143284, ccData: 28780 }, - { type: 3, pts: 6725146287, ccData: 49698 }, - { type: 2, pts: 6725146287, ccData: 24953 }, - { type: 3, pts: 6725173314, ccData: 546 }, - { type: 2, pts: 6725173314, ccData: 35841 }, - { type: 3, pts: 6725176317, ccData: 16930 }, - { type: 2, pts: 6725176317, ccData: 35074 }, - { type: 3, pts: 6725182323, ccData: 35377 }, - { type: 2, pts: 6725182323, ccData: 38939 }, - { type: 2, pts: 6725182323, ccData: 17920 }, - { type: 2, pts: 6725182323, ccData: 31 }, - { type: 2, pts: 6725182323, ccData: 5264 }, - { type: 2, pts: 6725182323, ccData: 1283 }, - { type: 2, pts: 6725182323, ccData: 37162 }, - { type: 2, pts: 6725182323, ccData: 42 }, - { type: 2, pts: 6725182323, ccData: 37376 }, - { type: 2, pts: 6725182323, ccData: 0 }, - { type: 3, pts: 6725185326, ccData: 49955 }, - { type: 2, pts: 6725185326, ccData: 37376 }, - { type: 2, pts: 6725185326, ccData: 512 }, - { type: 3, pts: 6725188329, ccData: 546 }, - { type: 2, pts: 6725188329, ccData: 24942 }, - { type: 3, pts: 6725191332, ccData: 16930 }, - { type: 2, pts: 6725191332, ccData: 25695 }, - { type: 3, pts: 6725194335, ccData: 33314 }, - { type: 2, pts: 6725194335, ccData: 29800 }, - { type: 3, pts: 6725197338, ccData: 49698 }, - { type: 2, pts: 6725197338, ccData: 25951 }, - { type: 3, pts: 6725200341, ccData: 546 }, - { type: 2, pts: 6725200341, ccData: 27247 }, - { type: 3, pts: 6725203344, ccData: 16930 }, - { type: 2, pts: 6725203344, ccData: 31071 }, - { type: 3, pts: 6725206347, ccData: 33314 }, - { type: 2, pts: 6725206347, ccData: 28518 }, - { type: 3, pts: 6725209350, ccData: 49698 }, - { type: 2, pts: 6725209350, ccData: 24421 }, - { type: 3, pts: 6725212353, ccData: 546 }, - { type: 2, pts: 6725212353, ccData: 30309 }, - { type: 3, pts: 6725215356, ccData: 16930 }, - { type: 2, pts: 6725215356, ccData: 29305 }, - { type: 3, pts: 6725218359, ccData: 33314 }, - { type: 2, pts: 6725218359, ccData: 25697 }, - { type: 3, pts: 6725221362, ccData: 49698 }, - { type: 2, pts: 6725221362, ccData: 31071 }, - { type: 3, pts: 6725224365, ccData: 546 }, - { type: 2, pts: 6725224365, ccData: 27753 }, - { type: 3, pts: 6725227368, ccData: 16930 }, - { type: 2, pts: 6725227368, ccData: 26213 }, - { type: 3, pts: 6725374515, ccData: 33314 }, - { type: 2, pts: 6725374515, ccData: 35842 }, - { type: 3, pts: 6725377518, ccData: 49698 }, - { type: 2, pts: 6725377518, ccData: 35073 }, - { type: 3, pts: 6725383524, ccData: 2609 }, - { type: 2, pts: 6725383524, ccData: 39195 }, - { type: 2, pts: 6725383524, ccData: 17920 }, - { type: 2, pts: 6725383524, ccData: 31 }, - { type: 2, pts: 6725383524, ccData: 5264 }, - { type: 2, pts: 6725383524, ccData: 1283 }, - { type: 2, pts: 6725383524, ccData: 37162 }, - { type: 2, pts: 6725383524, ccData: 42 }, - { type: 2, pts: 6725383524, ccData: 37376 }, - { type: 2, pts: 6725383524, ccData: 2048 }, - { type: 3, pts: 6725386527, ccData: 16930 }, - { type: 2, pts: 6725386527, ccData: 24946 }, - { type: 3, pts: 6725389530, ccData: 33314 }, - { type: 2, pts: 6725389530, ccData: 25951 }, - { type: 3, pts: 6725392533, ccData: 49698 }, - { type: 2, pts: 6725392533, ccData: 24940 }, - { type: 3, pts: 6725395536, ccData: 546 }, - { type: 2, pts: 6725395536, ccData: 27743 }, - { type: 3, pts: 6725398539, ccData: 16930 }, - { type: 2, pts: 6725398539, ccData: 24946 }, - { type: 3, pts: 6725401542, ccData: 33314 }, - { type: 2, pts: 6725401542, ccData: 28533 }, - { type: 3, pts: 6725404545, ccData: 49698 }, - { type: 2, pts: 6725404545, ccData: 28260 }, - { type: 3, pts: 6725407548, ccData: 546 }, - { type: 2, pts: 6725407548, ccData: 11776 }, - { type: 3, pts: 6725578719, ccData: 16930 }, - { type: 2, pts: 6725578719, ccData: 35841 }, - { type: 3, pts: 6725581722, ccData: 33314 }, - { type: 2, pts: 6725581722, ccData: 35074 }, - { type: 3, pts: 6725587728, ccData: 51761 }, - { type: 2, pts: 6725587728, ccData: 38939 }, - { type: 2, pts: 6725587728, ccData: 17920 }, - { type: 2, pts: 6725587728, ccData: 31 }, - { type: 2, pts: 6725587728, ccData: 5264 }, - { type: 2, pts: 6725587728, ccData: 1283 }, - { type: 2, pts: 6725587728, ccData: 37162 }, - { type: 2, pts: 6725587728, ccData: 42 }, - { type: 2, pts: 6725587728, ccData: 37376 }, - { type: 2, pts: 6725587728, ccData: 3072 }, - { type: 3, pts: 6725590731, ccData: 803 }, - { type: 2, pts: 6725590731, ccData: 37376 }, - { type: 2, pts: 6725590731, ccData: 3584 }, - { type: 3, pts: 6725593734, ccData: 16929 }, - { type: 2, pts: 6725593734, ccData: 32512 }, - { type: 3, pts: 6725596737, ccData: 33314 }, - { type: 2, pts: 6725596737, ccData: 24320 }, - { type: 3, pts: 6725599740, ccData: 49697 }, - { type: 2, pts: 6725599740, ccData: 32512 }, - { type: 3, pts: 6725698839, ccData: 546 }, - { type: 2, pts: 6725698839, ccData: 35842 }, - { type: 3, pts: 6725701842, ccData: 16930 }, - { type: 2, pts: 6725701842, ccData: 35073 }, - { type: 3, pts: 6725707848, ccData: 35377 }, - { type: 2, pts: 6725707848, ccData: 39195 }, - { type: 2, pts: 6725707848, ccData: 16640 }, - { type: 2, pts: 6725707848, ccData: 31 }, - { type: 2, pts: 6725707848, ccData: 5264 }, - { type: 2, pts: 6725707848, ccData: 1283 }, - { type: 2, pts: 6725707848, ccData: 37162 }, - { type: 2, pts: 6725707848, ccData: 42 }, - { type: 2, pts: 6725707848, ccData: 37376 }, - { type: 2, pts: 6725707848, ccData: 0 }, - { type: 3, pts: 6725710851, ccData: 49955 }, - { type: 2, pts: 6725710851, ccData: 37376 }, - { type: 2, pts: 6725710851, ccData: 768 }, - { type: 3, pts: 6725713854, ccData: 546 }, - { type: 2, pts: 6725713854, ccData: 21601 }, - { type: 3, pts: 6725716857, ccData: 16930 }, - { type: 2, pts: 6725716857, ccData: 29287 }, - { type: 3, pts: 6725719860, ccData: 33314 }, - { type: 2, pts: 6725719860, ccData: 25972 }, - { type: 3, pts: 6725722863, ccData: 49698 }, - { type: 2, pts: 6725722863, ccData: 24425 }, - { type: 3, pts: 6725725866, ccData: 546 }, - { type: 2, pts: 6725725866, ccData: 29535 }, - { type: 3, pts: 6725728869, ccData: 16930 }, - { type: 2, pts: 6725728869, ccData: 24927 }, - { type: 3, pts: 6725731872, ccData: 33314 }, - { type: 2, pts: 6725731872, ccData: 28786 }, - { type: 3, pts: 6725734875, ccData: 49698 }, - { type: 2, pts: 6725734875, ccData: 28533 }, - { type: 3, pts: 6725737878, ccData: 546 }, - { type: 2, pts: 6725737878, ccData: 25695 }, - { type: 3, pts: 6725740881, ccData: 16930 }, - { type: 2, pts: 6725740881, ccData: 29552 }, - { type: 3, pts: 6725743884, ccData: 33314 }, - { type: 2, pts: 6725743884, ccData: 28526 }, - { type: 3, pts: 6725746887, ccData: 49698 }, - { type: 2, pts: 6725746887, ccData: 29551 }, - { type: 3, pts: 6725749890, ccData: 546 }, - { type: 2, pts: 6725749890, ccData: 29184 }, - { type: 3, pts: 6725752893, ccData: 18993 }, - { type: 2, pts: 6725752893, ccData: 39195 }, - { type: 2, pts: 6725752893, ccData: 16640 }, - { type: 2, pts: 6725752893, ccData: 287 }, - { type: 2, pts: 6725752893, ccData: 4240 }, - { type: 2, pts: 6725752893, ccData: 1283 }, - { type: 2, pts: 6725752893, ccData: 37162 }, - { type: 2, pts: 6725752893, ccData: 0 }, - { type: 2, pts: 6725752893, ccData: 37377 }, - { type: 2, pts: 6725752893, ccData: 2048 }, - { type: 3, pts: 6725755896, ccData: 33571 }, - { type: 2, pts: 6725755896, ccData: 37377 }, - { type: 2, pts: 6725755896, ccData: 2560 }, - { type: 3, pts: 6725758899, ccData: 49698 }, - { type: 2, pts: 6725758899, ccData: 28518 }, - { type: 3, pts: 6725761902, ccData: 546 }, - { type: 2, pts: 6725761902, ccData: 24400 }, - { type: 3, pts: 6725764905, ccData: 16930 }, - { type: 2, pts: 6725764905, ccData: 16979 }, - { type: 3, pts: 6725767908, ccData: 33314 }, - { type: 2, pts: 6725767908, ccData: 24395 }, - { type: 3, pts: 6725770911, ccData: 49698 }, - { type: 2, pts: 6725770911, ccData: 26980 }, - { type: 3, pts: 6725773914, ccData: 546 }, - { type: 2, pts: 6725773914, ccData: 29486 }, - { type: 3, pts: 6725812953, ccData: 16930 }, - { type: 2, pts: 6725812953, ccData: 35841 }, - { type: 3, pts: 6725815956, ccData: 33314 }, - { type: 2, pts: 6725815956, ccData: 35074 }, - { type: 3, pts: 6726188328, ccData: 49698 }, - { type: 2, pts: 6726188328, ccData: 35842 }, - { type: 3, pts: 6726347487, ccData: 546 }, - { type: 2, pts: 6726347487, ccData: 35072 }, - { type: 3, pts: 6726353493, ccData: 18993 }, - { type: 2, pts: 6726353493, ccData: 38939 }, - { type: 2, pts: 6726353493, ccData: 17920 }, - { type: 2, pts: 6726353493, ccData: 31 }, - { type: 2, pts: 6726353493, ccData: 5264 }, - { type: 2, pts: 6726353493, ccData: 1283 }, - { type: 2, pts: 6726353493, ccData: 37162 }, - { type: 2, pts: 6726353493, ccData: 42 }, - { type: 2, pts: 6726353493, ccData: 37376 }, - { type: 2, pts: 6726353493, ccData: 3072 }, - { type: 3, pts: 6726356496, ccData: 33571 }, - { type: 2, pts: 6726356496, ccData: 37376 }, - { type: 2, pts: 6726356496, ccData: 3584 }, - { type: 3, pts: 6726359499, ccData: 49697 }, - { type: 2, pts: 6726359499, ccData: 32512 }, - { type: 3, pts: 6726362502, ccData: 546 }, - { type: 2, pts: 6726362502, ccData: 24320 }, - { type: 3, pts: 6726365505, ccData: 16929 }, - { type: 2, pts: 6726365505, ccData: 32512 }, - { type: 3, pts: 6726392532, ccData: 33314 }, - { type: 2, pts: 6726392532, ccData: 35073 }, - { type: 3, pts: 6726512652, ccData: 51761 }, - { type: 2, pts: 6726512652, ccData: 39195 }, - { type: 2, pts: 6726512652, ccData: 0 }, - { type: 2, pts: 6726512652, ccData: 31 }, - { type: 2, pts: 6726512652, ccData: 5264 }, - { type: 2, pts: 6726512652, ccData: 1283 }, - { type: 2, pts: 6726512652, ccData: 37162 }, - { type: 2, pts: 6726512652, ccData: 42 }, - { type: 2, pts: 6726512652, ccData: 37376 }, - { type: 2, pts: 6726512652, ccData: 2048 }, - { type: 3, pts: 6726515655, ccData: 803 }, - { type: 2, pts: 6726515655, ccData: 37376 }, - { type: 2, pts: 6726515655, ccData: 2816 }, - { type: 3, pts: 6726518658, ccData: 16930 }, - { type: 2, pts: 6726518658, ccData: 16718 }, - { type: 3, pts: 6726521661, ccData: 33314 }, - { type: 2, pts: 6726521661, ccData: 20047 }, - { type: 3, pts: 6726524664, ccData: 49698 }, - { type: 2, pts: 6726524664, ccData: 21838 }, - { type: 3, pts: 6726527667, ccData: 546 }, - { type: 2, pts: 6726527667, ccData: 17221 }, - { type: 3, pts: 6726530670, ccData: 16930 }, - { type: 2, pts: 6726530670, ccData: 21050 }, - { type: 3, pts: 6726533673, ccData: 35377 }, - { type: 2, pts: 6726533673, ccData: 39195 }, - { type: 2, pts: 6726533673, ccData: 0 }, - { type: 2, pts: 6726533673, ccData: 287 }, - { type: 2, pts: 6726533673, ccData: 4240 }, - { type: 2, pts: 6726533673, ccData: 1283 }, - { type: 2, pts: 6726533673, ccData: 37162 }, - { type: 2, pts: 6726533673, ccData: 0 }, - { type: 2, pts: 6726533673, ccData: 37377 }, - { type: 2, pts: 6726533673, ccData: 1024 }, - { type: 3, pts: 6726536676, ccData: 49698 }, - { type: 2, pts: 6726536676, ccData: 19301 }, - { type: 3, pts: 6726539679, ccData: 546 }, - { type: 2, pts: 6726539679, ccData: 25968 }, - { type: 3, pts: 6726542682, ccData: 16930 }, - { type: 2, pts: 6726542682, ccData: 24419 }, - { type: 3, pts: 6726545685, ccData: 33314 }, - { type: 2, pts: 6726545685, ccData: 30066 }, - { type: 3, pts: 6726548688, ccData: 49698 }, - { type: 2, pts: 6726548688, ccData: 26991 }, - { type: 3, pts: 6726551691, ccData: 546 }, - { type: 2, pts: 6726551691, ccData: 29545 }, - { type: 3, pts: 6726554694, ccData: 16930 }, - { type: 2, pts: 6726554694, ccData: 29817 }, - { type: 3, pts: 6726557697, ccData: 33314 }, - { type: 2, pts: 6726557697, ccData: 24434 }, - { type: 3, pts: 6726560700, ccData: 49698 }, - { type: 2, pts: 6726560700, ccData: 30062 }, - { type: 3, pts: 6726563703, ccData: 546 }, - { type: 2, pts: 6726563703, ccData: 28265 }, - { type: 3, pts: 6726566706, ccData: 16930 }, - { type: 2, pts: 6726566706, ccData: 28263 }, - { type: 3, pts: 6726569709, ccData: 33314 }, - { type: 2, pts: 6726569709, ccData: 11776 }, - { type: 3, pts: 6726845985, ccData: 49698 }, - { type: 2, pts: 6726845985, ccData: 35841 }, - { type: 3, pts: 6726848988, ccData: 546 }, - { type: 2, pts: 6726848988, ccData: 35074 }, - { type: 3, pts: 6726854994, ccData: 18993 }, - { type: 2, pts: 6726854994, ccData: 38939 }, - { type: 2, pts: 6726854994, ccData: 0 }, - { type: 2, pts: 6726854994, ccData: 31 }, - { type: 2, pts: 6726854994, ccData: 5264 }, - { type: 2, pts: 6726854994, ccData: 1283 }, - { type: 2, pts: 6726854994, ccData: 37162 }, - { type: 2, pts: 6726854994, ccData: 42 }, - { type: 2, pts: 6726854994, ccData: 37376 }, - { type: 2, pts: 6726854994, ccData: 3072 }, - { type: 3, pts: 6726857997, ccData: 33571 }, - { type: 2, pts: 6726857997, ccData: 37376 }, - { type: 2, pts: 6726857997, ccData: 3584 }, - { type: 3, pts: 6726861000, ccData: 49697 }, - { type: 2, pts: 6726861000, ccData: 32512 }, - { type: 3, pts: 6726864003, ccData: 546 }, - { type: 2, pts: 6726864003, ccData: 24320 }, - { type: 3, pts: 6726867006, ccData: 16929 }, - { type: 2, pts: 6726867006, ccData: 32512 }, - { type: 3, pts: 6727098237, ccData: 33314 }, - { type: 2, pts: 6727098237, ccData: 35842 }, - { type: 3, pts: 6727101240, ccData: 49698 }, - { type: 2, pts: 6727101240, ccData: 35073 }, - { type: 3, pts: 6727107246, ccData: 2609 }, - { type: 2, pts: 6727107246, ccData: 39195 }, - { type: 2, pts: 6727107246, ccData: 0 }, - { type: 2, pts: 6727107246, ccData: 31 }, - { type: 2, pts: 6727107246, ccData: 5264 }, - { type: 2, pts: 6727107246, ccData: 1283 }, - { type: 2, pts: 6727107246, ccData: 37162 }, - { type: 2, pts: 6727107246, ccData: 42 }, - { type: 2, pts: 6727107246, ccData: 37376 }, - { type: 2, pts: 6727107246, ccData: 2048 }, - { type: 3, pts: 6727110249, ccData: 17187 }, - { type: 2, pts: 6727110249, ccData: 37376 }, - { type: 2, pts: 6727110249, ccData: 2304 }, - { type: 3, pts: 6727113252, ccData: 33314 }, - { type: 2, pts: 6727113252, ccData: 19305 }, - { type: 3, pts: 6727116255, ccData: 49698 }, - { type: 2, pts: 6727116255, ccData: 25700 }, - { type: 3, pts: 6727119258, ccData: 546 }, - { type: 2, pts: 6727119258, ccData: 26981 }, - { type: 3, pts: 6727122261, ccData: 16930 }, - { type: 2, pts: 6727122261, ccData: 24385 }, - { type: 3, pts: 6727125264, ccData: 33314 }, - { type: 2, pts: 6727125264, ccData: 25441 }, - { type: 3, pts: 6727128267, ccData: 49698 }, - { type: 2, pts: 6727128267, ccData: 25701 }, - { type: 3, pts: 6727131270, ccData: 546 }, - { type: 2, pts: 6727131270, ccData: 28025 }, - { type: 3, pts: 6727134273, ccData: 18993 }, - { type: 2, pts: 6727134273, ccData: 39195 }, - { type: 2, pts: 6727134273, ccData: 0 }, - { type: 2, pts: 6727134273, ccData: 287 }, - { type: 2, pts: 6727134273, ccData: 4240 }, - { type: 2, pts: 6727134273, ccData: 1283 }, - { type: 2, pts: 6727134273, ccData: 37162 }, - { type: 2, pts: 6727134273, ccData: 0 }, - { type: 2, pts: 6727134273, ccData: 37377 }, - { type: 2, pts: 6727134273, ccData: 1024 }, - { type: 3, pts: 6727137276, ccData: 33314 }, - { type: 2, pts: 6727137276, ccData: 17764 }, - { type: 3, pts: 6727140279, ccData: 49698 }, - { type: 2, pts: 6727140279, ccData: 30051 }, - { type: 3, pts: 6727143282, ccData: 546 }, - { type: 2, pts: 6727143282, ccData: 24948 }, - { type: 3, pts: 6727146285, ccData: 16930 }, - { type: 2, pts: 6727146285, ccData: 26991 }, - { type: 3, pts: 6727149288, ccData: 33314 }, - { type: 2, pts: 6727149288, ccData: 28257 }, - { type: 3, pts: 6727152291, ccData: 49698 }, - { type: 2, pts: 6727152291, ccData: 27743 }, - { type: 3, pts: 6727155294, ccData: 546 }, - { type: 2, pts: 6727155294, ccData: 17256 }, - { type: 3, pts: 6727158297, ccData: 16930 }, - { type: 2, pts: 6727158297, ccData: 26988 }, - { type: 3, pts: 6727161300, ccData: 33314 }, - { type: 2, pts: 6727161300, ccData: 25695 }, - { type: 3, pts: 6727164303, ccData: 49698 }, - { type: 2, pts: 6727164303, ccData: 17249 }, - { type: 3, pts: 6727167306, ccData: 546 }, - { type: 2, pts: 6727167306, ccData: 29285 }, - { type: 3, pts: 6727170309, ccData: 16930 }, - { type: 2, pts: 6727170309, ccData: 11776 }, - { type: 3, pts: 6727353492, ccData: 33314 }, - { type: 2, pts: 6727353492, ccData: 35841 }, - { type: 3, pts: 6727356495, ccData: 49698 }, - { type: 2, pts: 6727356495, ccData: 35074 }, - { type: 3, pts: 6727602741, ccData: 546 }, - { type: 2, pts: 6727602741, ccData: 35842 }, - { type: 3, pts: 6727891029, ccData: 18993 }, - { type: 2, pts: 6727891029, ccData: 38939 }, - { type: 2, pts: 6727891029, ccData: 16640 }, - { type: 2, pts: 6727891029, ccData: 31 }, - { type: 2, pts: 6727891029, ccData: 5264 }, - { type: 2, pts: 6727891029, ccData: 1283 }, - { type: 2, pts: 6727891029, ccData: 37162 }, - { type: 2, pts: 6727891029, ccData: 42 }, - { type: 2, pts: 6727891029, ccData: 37376 }, - { type: 2, pts: 6727891029, ccData: 1024 }, - { type: 3, pts: 6727897035, ccData: 33571 }, - { type: 2, pts: 6727897035, ccData: 37376 }, - { type: 2, pts: 6727897035, ccData: 1536 }, - { type: 3, pts: 6727903041, ccData: 49698 }, - { type: 2, pts: 6727903041, ccData: 16750 }, - { type: 3, pts: 6727906044, ccData: 546 }, - { type: 2, pts: 6727906044, ccData: 25695 }, - { type: 3, pts: 6727909047, ccData: 16930 }, - { type: 2, pts: 6727909047, ccData: 25209 }, - { type: 3, pts: 6727912050, ccData: 33314 }, - { type: 2, pts: 6727912050, ccData: 24419 }, - { type: 3, pts: 6727915053, ccData: 49698 }, - { type: 2, pts: 6727915053, ccData: 28526 }, - { type: 3, pts: 6727918056, ccData: 546 }, - { type: 2, pts: 6727918056, ccData: 29810 }, - { type: 3, pts: 6727921059, ccData: 16930 }, - { type: 2, pts: 6727921059, ccData: 26978 }, - { type: 3, pts: 6727924062, ccData: 33314 }, - { type: 2, pts: 6727924062, ccData: 30068 }, - { type: 3, pts: 6727927065, ccData: 49698 }, - { type: 2, pts: 6727927065, ccData: 26991 }, - { type: 3, pts: 6727930068, ccData: 546 }, - { type: 2, pts: 6727930068, ccData: 28275 }, - { type: 3, pts: 6727933071, ccData: 18993 }, - { type: 2, pts: 6727933071, ccData: 38939 }, - { type: 2, pts: 6727933071, ccData: 16640 }, - { type: 2, pts: 6727933071, ccData: 287 }, - { type: 2, pts: 6727933071, ccData: 4240 }, - { type: 2, pts: 6727933071, ccData: 1283 }, - { type: 2, pts: 6727933071, ccData: 37162 }, - { type: 2, pts: 6727933071, ccData: 0 }, - { type: 2, pts: 6727933071, ccData: 37377 }, - { type: 2, pts: 6727933071, ccData: 1024 }, - { type: 3, pts: 6727939077, ccData: 33571 }, - { type: 2, pts: 6727939077, ccData: 37377 }, - { type: 2, pts: 6727939077, ccData: 1536 }, - { type: 3, pts: 6727945083, ccData: 49698 }, - { type: 2, pts: 6727945083, ccData: 29807 }, - { type: 3, pts: 6727948086, ccData: 546 }, - { type: 2, pts: 6727948086, ccData: 24441 }, - { type: 3, pts: 6727951089, ccData: 16930 }, - { type: 2, pts: 6727951089, ccData: 28533 }, - { type: 3, pts: 6727954092, ccData: 33314 }, - { type: 2, pts: 6727954092, ccData: 29279 }, - { type: 3, pts: 6727957095, ccData: 49698 }, - { type: 2, pts: 6727957095, ccData: 20546 }, - { type: 3, pts: 6727960098, ccData: 546 }, - { type: 2, pts: 6727960098, ccData: 21343 }, - { type: 3, pts: 6727963101, ccData: 16930 }, - { type: 2, pts: 6727963101, ccData: 29556 }, - { type: 3, pts: 6727966104, ccData: 33314 }, - { type: 2, pts: 6727966104, ccData: 24948 }, - { type: 3, pts: 6727969107, ccData: 49698 }, - { type: 2, pts: 6727969107, ccData: 26991 }, - { type: 3, pts: 6727972110, ccData: 546 }, - { type: 2, pts: 6727972110, ccData: 28160 }, - { type: 3, pts: 6727981119, ccData: 16930 }, - { type: 2, pts: 6727981119, ccData: 35073 }, - { type: 3, pts: 6728182320, ccData: 35377 }, - { type: 2, pts: 6728182320, ccData: 39195 }, - { type: 2, pts: 6728182320, ccData: 17920 }, - { type: 2, pts: 6728182320, ccData: 31 }, - { type: 2, pts: 6728182320, ccData: 5264 }, - { type: 2, pts: 6728182320, ccData: 1283 }, - { type: 2, pts: 6728182320, ccData: 37162 }, - { type: 2, pts: 6728182320, ccData: 42 }, - { type: 2, pts: 6728182320, ccData: 37376 }, - { type: 2, pts: 6728182320, ccData: 1024 }, - { type: 3, pts: 6728188326, ccData: 49955 }, - { type: 2, pts: 6728188326, ccData: 37376 }, - { type: 2, pts: 6728188326, ccData: 1280 }, - { type: 3, pts: 6728194332, ccData: 546 }, - { type: 2, pts: 6728194332, ccData: 26226 }, - { type: 3, pts: 6728197335, ccData: 16930 }, - { type: 2, pts: 6728197335, ccData: 28525 }, - { type: 3, pts: 6728200338, ccData: 33314 }, - { type: 2, pts: 6728200338, ccData: 24438 }, - { type: 3, pts: 6728203341, ccData: 49698 }, - { type: 2, pts: 6728203341, ccData: 26981 }, - { type: 3, pts: 6728206344, ccData: 546 }, - { type: 2, pts: 6728206344, ccData: 30565 }, - { type: 3, pts: 6728209347, ccData: 16930 }, - { type: 2, pts: 6728209347, ccData: 29299 }, - { type: 3, pts: 6728212350, ccData: 33314 }, - { type: 2, pts: 6728212350, ccData: 24428 }, - { type: 3, pts: 6728215353, ccData: 49698 }, - { type: 2, pts: 6728215353, ccData: 26987 }, - { type: 3, pts: 6728218356, ccData: 546 }, - { type: 2, pts: 6728218356, ccData: 25951 }, - { type: 3, pts: 6728221359, ccData: 16930 }, - { type: 2, pts: 6728221359, ccData: 31087 }, - { type: 3, pts: 6728224362, ccData: 33314 }, - { type: 2, pts: 6728224362, ccData: 29998 }, - { type: 3, pts: 6728227365, ccData: 49698 }, - { type: 2, pts: 6728227365, ccData: 35841 }, - { type: 3, pts: 6728233371, ccData: 546 }, - { type: 2, pts: 6728233371, ccData: 35074 }, - { type: 3, pts: 6728377515, ccData: 18993 }, - { type: 2, pts: 6728377515, ccData: 38939 }, - { type: 2, pts: 6728377515, ccData: 17920 }, - { type: 2, pts: 6728377515, ccData: 31 }, - { type: 2, pts: 6728377515, ccData: 5264 }, - { type: 2, pts: 6728377515, ccData: 1283 }, - { type: 2, pts: 6728377515, ccData: 37162 }, - { type: 2, pts: 6728377515, ccData: 42 }, - { type: 2, pts: 6728377515, ccData: 37376 }, - { type: 2, pts: 6728377515, ccData: 2048 }, - { type: 3, pts: 6728383521, ccData: 33571 }, - { type: 2, pts: 6728383521, ccData: 37376 }, - { type: 2, pts: 6728383521, ccData: 2816 }, - { type: 3, pts: 6728389527, ccData: 49698 }, - { type: 2, pts: 6728389527, ccData: 21608 }, - { type: 3, pts: 6728392530, ccData: 546 }, - { type: 2, pts: 6728392530, ccData: 24942 }, - { type: 3, pts: 6728395533, ccData: 16930 }, - { type: 2, pts: 6728395533, ccData: 27487 }, - { type: 3, pts: 6728398536, ccData: 33314 }, - { type: 2, pts: 6728398536, ccData: 31087 }, - { type: 3, pts: 6728401539, ccData: 49698 }, - { type: 2, pts: 6728401539, ccData: 29985 }, - { type: 3, pts: 6728404542, ccData: 546 }, - { type: 2, pts: 6728404542, ccData: 35842 }, - { type: 3, pts: 6728410548, ccData: 16930 }, - { type: 2, pts: 6728410548, ccData: 35073 }, - { type: 3, pts: 6728572710, ccData: 33314 }, - { type: 2, pts: 6728572710, ccData: 35841 }, - { type: 3, pts: 6728605743, ccData: 49698 }, - { type: 2, pts: 6728605743, ccData: 35072 }, - { type: 3, pts: 6728623761, ccData: 2609 }, - { type: 2, pts: 6728623761, ccData: 38939 }, - { type: 2, pts: 6728623761, ccData: 16640 }, - { type: 2, pts: 6728623761, ccData: 31 }, - { type: 2, pts: 6728623761, ccData: 5264 }, - { type: 2, pts: 6728623761, ccData: 1283 }, - { type: 2, pts: 6728623761, ccData: 37162 }, - { type: 2, pts: 6728623761, ccData: 0 }, - { type: 2, pts: 6728623761, ccData: 37376 }, - { type: 2, pts: 6728623761, ccData: 1024 }, - { type: 3, pts: 6728629767, ccData: 17187 }, - { type: 2, pts: 6728629767, ccData: 37376 }, - { type: 2, pts: 6728629767, ccData: 1792 }, - { type: 3, pts: 6728635773, ccData: 33313 }, - { type: 2, pts: 6728635773, ccData: 32512 }, - { type: 3, pts: 6728638776, ccData: 49698 }, - { type: 2, pts: 6728638776, ccData: 24400 }, - { type: 3, pts: 6728641779, ccData: 546 }, - { type: 2, pts: 6728641779, ccData: 26990 }, - { type: 3, pts: 6728644782, ccData: 16930 }, - { type: 2, pts: 6728644782, ccData: 27487 }, - { type: 3, pts: 6728647785, ccData: 33314 }, - { type: 2, pts: 6728647785, ccData: 26995 }, - { type: 3, pts: 6728650788, ccData: 49698 }, - { type: 2, pts: 6728650788, ccData: 24436 }, - { type: 3, pts: 6728653791, ccData: 546 }, - { type: 2, pts: 6728653791, ccData: 26725 }, - { type: 3, pts: 6728656794, ccData: 16930 }, - { type: 2, pts: 6728656794, ccData: 24422 }, - { type: 3, pts: 6728659797, ccData: 33314 }, - { type: 2, pts: 6728659797, ccData: 30062 }, - { type: 3, pts: 6728662800, ccData: 51761 }, - { type: 2, pts: 6728662800, ccData: 38939 }, - { type: 2, pts: 6728662800, ccData: 16640 }, - { type: 2, pts: 6728662800, ccData: 287 }, - { type: 2, pts: 6728662800, ccData: 4240 }, - { type: 2, pts: 6728662800, ccData: 1283 }, - { type: 2, pts: 6728662800, ccData: 37162 }, - { type: 2, pts: 6728662800, ccData: 0 }, - { type: 2, pts: 6728662800, ccData: 37377 }, - { type: 2, pts: 6728662800, ccData: 1024 }, - { type: 3, pts: 6728668806, ccData: 803 }, - { type: 2, pts: 6728668806, ccData: 37377 }, - { type: 2, pts: 6728668806, ccData: 1536 }, - { type: 3, pts: 6728674812, ccData: 16930 }, - { type: 2, pts: 6728674812, ccData: 28518 }, - { type: 3, pts: 6728677815, ccData: 33314 }, - { type: 2, pts: 6728677815, ccData: 24436 }, - { type: 3, pts: 6728680818, ccData: 49698 }, - { type: 2, pts: 6728680818, ccData: 30569 }, - { type: 3, pts: 6728683821, ccData: 546 }, - { type: 2, pts: 6728683821, ccData: 29292 }, - { type: 3, pts: 6728686824, ccData: 16930 }, - { type: 2, pts: 6728686824, ccData: 26990 }, - { type: 3, pts: 6728689827, ccData: 33314 }, - { type: 2, pts: 6728689827, ccData: 26463 }, - { type: 3, pts: 6728692830, ccData: 49698 }, - { type: 2, pts: 6728692830, ccData: 24946 }, - { type: 3, pts: 6728695833, ccData: 546 }, - { type: 2, pts: 6728695833, ccData: 28533 }, - { type: 3, pts: 6728698836, ccData: 16930 }, - { type: 2, pts: 6728698836, ccData: 28260 }, - { type: 3, pts: 6728701839, ccData: 33314 }, - { type: 2, pts: 6728701839, ccData: 24320 }, - { type: 3, pts: 6728704842, ccData: 49697 }, - { type: 2, pts: 6728704842, ccData: 32512 }, - { type: 3, pts: 6728713851, ccData: 546 }, - { type: 2, pts: 6728713851, ccData: 35073 }, - { type: 3, pts: 6728888025, ccData: 18993 }, - { type: 2, pts: 6728888025, ccData: 39195 }, - { type: 2, pts: 6728888025, ccData: 16640 }, - { type: 2, pts: 6728888025, ccData: 31 }, - { type: 2, pts: 6728888025, ccData: 5264 }, - { type: 2, pts: 6728888025, ccData: 1283 }, - { type: 2, pts: 6728888025, ccData: 37162 }, - { type: 2, pts: 6728888025, ccData: 42 }, - { type: 2, pts: 6728888025, ccData: 37376 }, - { type: 2, pts: 6728888025, ccData: 1024 }, - { type: 3, pts: 6728894031, ccData: 33571 }, - { type: 2, pts: 6728894031, ccData: 37376 }, - { type: 2, pts: 6728894031, ccData: 1792 }, - { type: 3, pts: 6728900037, ccData: 49697 }, - { type: 2, pts: 6728900037, ccData: 32512 }, - { type: 3, pts: 6728903040, ccData: 546 }, - { type: 2, pts: 6728903040, ccData: 24385 }, - { type: 3, pts: 6728906043, ccData: 16930 }, - { type: 2, pts: 6728906043, ccData: 28260 }, - { type: 3, pts: 6728909046, ccData: 33314 }, - { type: 2, pts: 6728909046, ccData: 24435 }, - { type: 3, pts: 6728912049, ccData: 49698 }, - { type: 2, pts: 6728912049, ccData: 25455 }, - { type: 3, pts: 6728915052, ccData: 546 }, - { type: 2, pts: 6728915052, ccData: 28532 }, - { type: 3, pts: 6728918055, ccData: 16930 }, - { type: 2, pts: 6728918055, ccData: 26990 }, - { type: 3, pts: 6728921058, ccData: 33314 }, - { type: 2, pts: 6728921058, ccData: 26463 }, - { type: 3, pts: 6728924061, ccData: 49698 }, - { type: 2, pts: 6728924061, ccData: 24942 }, - { type: 3, pts: 6728927064, ccData: 546 }, - { type: 2, pts: 6728927064, ccData: 25600 }, - { type: 3, pts: 6728930067, ccData: 18993 }, - { type: 2, pts: 6728930067, ccData: 39195 }, - { type: 2, pts: 6728930067, ccData: 16640 }, - { type: 2, pts: 6728930067, ccData: 287 }, - { type: 2, pts: 6728930067, ccData: 4240 }, - { type: 2, pts: 6728930067, ccData: 1283 }, - { type: 2, pts: 6728930067, ccData: 37162 }, - { type: 2, pts: 6728930067, ccData: 0 }, - { type: 2, pts: 6728930067, ccData: 37377 }, - { type: 2, pts: 6728930067, ccData: 0 }, - { type: 3, pts: 6728936073, ccData: 33571 }, - { type: 2, pts: 6728936073, ccData: 37377 }, - { type: 2, pts: 6728936073, ccData: 512 }, - { type: 3, pts: 6728942079, ccData: 49698 }, - { type: 2, pts: 6728942079, ccData: 26735 }, - { type: 3, pts: 6728945082, ccData: 546 }, - { type: 2, pts: 6728945082, ccData: 28267 }, - { type: 3, pts: 6728948085, ccData: 16930 }, - { type: 2, pts: 6728948085, ccData: 26990 }, - { type: 3, pts: 6728951088, ccData: 33314 }, - { type: 2, pts: 6728951088, ccData: 26463 }, - { type: 3, pts: 6728954091, ccData: 49698 }, - { type: 2, pts: 6728954091, ccData: 29800 }, - { type: 3, pts: 6728957094, ccData: 546 }, - { type: 2, pts: 6728957094, ccData: 25951 }, - { type: 3, pts: 6728960097, ccData: 16930 }, - { type: 2, pts: 6728960097, ccData: 26721 }, - { type: 3, pts: 6728963100, ccData: 33314 }, - { type: 2, pts: 6728963100, ccData: 28784 }, - { type: 3, pts: 6728966103, ccData: 49698 }, - { type: 2, pts: 6728966103, ccData: 26981 }, - { type: 3, pts: 6728969106, ccData: 546 }, - { type: 2, pts: 6728969106, ccData: 29556 }, - { type: 3, pts: 6728972109, ccData: 16930 }, - { type: 2, pts: 6728972109, ccData: 24435 }, - { type: 3, pts: 6728975112, ccData: 33314 }, - { type: 2, pts: 6728975112, ccData: 28533 }, - { type: 3, pts: 6728978115, ccData: 49698 }, - { type: 2, pts: 6728978115, ccData: 28260 }, - { type: 3, pts: 6728981118, ccData: 546 }, - { type: 2, pts: 6728981118, ccData: 24320 }, - { type: 3, pts: 6728984121, ccData: 16929 }, - { type: 2, pts: 6728984121, ccData: 32512 }, - { type: 3, pts: 6728987124, ccData: 33314 }, - { type: 2, pts: 6728987124, ccData: 35841 }, - { type: 3, pts: 6728993130, ccData: 49698 }, - { type: 2, pts: 6728993130, ccData: 35074 }, - { type: 3, pts: 6729122259, ccData: 2609 }, - { type: 2, pts: 6729122259, ccData: 38939 }, - { type: 2, pts: 6729122259, ccData: 16640 }, - { type: 2, pts: 6729122259, ccData: 31 }, - { type: 2, pts: 6729122259, ccData: 5264 }, - { type: 2, pts: 6729122259, ccData: 1283 }, - { type: 2, pts: 6729122259, ccData: 37162 }, - { type: 2, pts: 6729122259, ccData: 42 }, - { type: 2, pts: 6729122259, ccData: 37376 }, - { type: 2, pts: 6729122259, ccData: 1024 }, - { type: 3, pts: 6729128265, ccData: 16929 }, - { type: 2, pts: 6729128265, ccData: 32512 }, - { type: 3, pts: 6729131268, ccData: 33314 }, - { type: 2, pts: 6729131268, ccData: 24399 }, - { type: 3, pts: 6729134271, ccData: 49698 }, - { type: 2, pts: 6729134271, ccData: 29279 }, - { type: 3, pts: 6729137274, ccData: 546 }, - { type: 2, pts: 6729137274, ccData: 25452 }, - { type: 3, pts: 6729140277, ccData: 16930 }, - { type: 2, pts: 6729140277, ccData: 26989 }, - { type: 3, pts: 6729143280, ccData: 33314 }, - { type: 2, pts: 6729143280, ccData: 25193 }, - { type: 3, pts: 6729146283, ccData: 49698 }, - { type: 2, pts: 6729146283, ccData: 28263 }, - { type: 3, pts: 6729149286, ccData: 546 }, - { type: 2, pts: 6729149286, ccData: 24431 }, - { type: 3, pts: 6729152289, ccData: 16930 }, - { type: 2, pts: 6729152289, ccData: 28255 }, - { type: 3, pts: 6729155292, ccData: 33314 }, - { type: 2, pts: 6729155292, ccData: 25196 }, - { type: 3, pts: 6729158295, ccData: 49698 }, - { type: 2, pts: 6729158295, ccData: 28515 }, - { type: 3, pts: 6729161298, ccData: 546 }, - { type: 2, pts: 6729161298, ccData: 27507 }, - { type: 3, pts: 6729164301, ccData: 18993 }, - { type: 2, pts: 6729164301, ccData: 38939 }, - { type: 2, pts: 6729164301, ccData: 16640 }, - { type: 2, pts: 6729164301, ccData: 287 }, - { type: 2, pts: 6729164301, ccData: 4240 }, - { type: 2, pts: 6729164301, ccData: 1283 }, - { type: 2, pts: 6729164301, ccData: 37162 }, - { type: 2, pts: 6729164301, ccData: 0 }, - { type: 2, pts: 6729164301, ccData: 37377 }, - { type: 2, pts: 6729164301, ccData: 1024 }, - { type: 3, pts: 6729170307, ccData: 33571 }, - { type: 2, pts: 6729170307, ccData: 37377 }, - { type: 2, pts: 6729170307, ccData: 1280 }, - { type: 3, pts: 6729176313, ccData: 49698 }, - { type: 2, pts: 6729176313, ccData: 29807 }, - { type: 3, pts: 6729179316, ccData: 546 }, - { type: 2, pts: 6729179316, ccData: 24436 }, - { type: 3, pts: 6729182319, ccData: 16930 }, - { type: 2, pts: 6729182319, ccData: 26725 }, - { type: 3, pts: 6729185322, ccData: 33314 }, - { type: 2, pts: 6729185322, ccData: 24429 }, - { type: 3, pts: 6729188325, ccData: 49698 }, - { type: 2, pts: 6729188325, ccData: 28527 }, - { type: 3, pts: 6729191328, ccData: 546 }, - { type: 2, pts: 6729191328, ccData: 28255 }, - { type: 3, pts: 6729194331, ccData: 16930 }, - { type: 2, pts: 6729194331, ccData: 30064 }, - { type: 3, pts: 6729197334, ccData: 33314 }, - { type: 2, pts: 6729197334, ccData: 24417 }, - { type: 3, pts: 6729200337, ccData: 49698 }, - { type: 2, pts: 6729200337, ccData: 25199 }, - { type: 3, pts: 6729203340, ccData: 546 }, - { type: 2, pts: 6729203340, ccData: 30309 }, - { type: 3, pts: 6729206343, ccData: 16930 }, - { type: 2, pts: 6729206343, ccData: 24320 }, - { type: 3, pts: 6729209346, ccData: 33313 }, - { type: 2, pts: 6729209346, ccData: 32512 }, - { type: 3, pts: 6729212349, ccData: 49698 }, - { type: 2, pts: 6729212349, ccData: 35842 }, - { type: 3, pts: 6729218355, ccData: 546 }, - { type: 2, pts: 6729218355, ccData: 35073 }, - { type: 3, pts: 6729419556, ccData: 18993 }, - { type: 2, pts: 6729419556, ccData: 39195 }, - { type: 2, pts: 6729419556, ccData: 16640 }, - { type: 2, pts: 6729419556, ccData: 31 }, - { type: 2, pts: 6729419556, ccData: 5264 }, - { type: 2, pts: 6729419556, ccData: 1283 }, - { type: 2, pts: 6729419556, ccData: 37162 }, - { type: 2, pts: 6729419556, ccData: 42 }, - { type: 2, pts: 6729419556, ccData: 37376 }, - { type: 2, pts: 6729419556, ccData: 1024 }, - { type: 3, pts: 6729425562, ccData: 33571 }, - { type: 2, pts: 6729425562, ccData: 37376 }, - { type: 2, pts: 6729425562, ccData: 1536 }, - { type: 3, pts: 6729431568, ccData: 49697 }, - { type: 2, pts: 6729431568, ccData: 32512 }, - { type: 3, pts: 6729434571, ccData: 546 }, - { type: 2, pts: 6729434571, ccData: 24400 }, - { type: 3, pts: 6729437574, ccData: 16930 }, - { type: 2, pts: 6729437574, ccData: 26990 }, - { type: 3, pts: 6729440577, ccData: 33314 }, - { type: 2, pts: 6729440577, ccData: 27487 }, - { type: 3, pts: 6729443580, ccData: 49698 }, - { type: 2, pts: 6729443580, ccData: 26995 }, - { type: 3, pts: 6729446583, ccData: 546 }, - { type: 2, pts: 6729446583, ccData: 24417 }, - { type: 3, pts: 6729449586, ccData: 16930 }, - { type: 2, pts: 6729449586, ccData: 24422 }, - { type: 3, pts: 6729452589, ccData: 33314 }, - { type: 2, pts: 6729452589, ccData: 25957 }, - { type: 3, pts: 6729455592, ccData: 49698 }, - { type: 2, pts: 6729455592, ccData: 27753 }, - { type: 3, pts: 6729458595, ccData: 546 }, - { type: 2, pts: 6729458595, ccData: 28263 }, - { type: 3, pts: 6729461598, ccData: 18993 }, - { type: 2, pts: 6729461598, ccData: 39195 }, - { type: 2, pts: 6729461598, ccData: 16640 }, - { type: 2, pts: 6729461598, ccData: 287 }, - { type: 2, pts: 6729461598, ccData: 4240 }, - { type: 2, pts: 6729461598, ccData: 1283 }, - { type: 2, pts: 6729461598, ccData: 37162 }, - { type: 2, pts: 6729461598, ccData: 0 }, - { type: 2, pts: 6729461598, ccData: 37377 }, - { type: 2, pts: 6729461598, ccData: 1024 }, - { type: 3, pts: 6729467604, ccData: 33571 }, - { type: 2, pts: 6729467604, ccData: 37377 }, - { type: 2, pts: 6729467604, ccData: 1792 }, - { type: 3, pts: 6729473610, ccData: 49698 }, - { type: 2, pts: 6729473610, ccData: 28518 }, - { type: 3, pts: 6729476613, ccData: 546 }, - { type: 2, pts: 6729476613, ccData: 24426 }, - { type: 3, pts: 6729479616, ccData: 16930 }, - { type: 2, pts: 6729479616, ccData: 28537 }, - { type: 3, pts: 6729482619, ccData: 33314 }, - { type: 2, pts: 6729482619, ccData: 24417 }, - { type: 3, pts: 6729485622, ccData: 49698 }, - { type: 2, pts: 6729485622, ccData: 28260 }, - { type: 3, pts: 6729488625, ccData: 546 }, - { type: 2, pts: 6729488625, ccData: 24428 }, - { type: 3, pts: 6729491628, ccData: 16930 }, - { type: 2, pts: 6729491628, ccData: 28534 }, - { type: 3, pts: 6729494631, ccData: 33314 }, - { type: 2, pts: 6729494631, ccData: 25951 }, - { type: 3, pts: 6729497634, ccData: 49697 }, - { type: 2, pts: 6729497634, ccData: 32512 }, - { type: 3, pts: 6729500637, ccData: 546 }, - { type: 2, pts: 6729500637, ccData: 35841 }, - { type: 3, pts: 6729506643, ccData: 16930 }, - { type: 2, pts: 6729506643, ccData: 35074 }, - { type: 3, pts: 6729806943, ccData: 35377 }, - { type: 2, pts: 6729806943, ccData: 38939 }, - { type: 2, pts: 6729806943, ccData: 16640 }, - { type: 2, pts: 6729806943, ccData: 31 }, - { type: 2, pts: 6729806943, ccData: 5264 }, - { type: 2, pts: 6729806943, ccData: 1283 }, - { type: 2, pts: 6729806943, ccData: 37162 }, - { type: 2, pts: 6729806943, ccData: 42 }, - { type: 2, pts: 6729806943, ccData: 37376 }, - { type: 2, pts: 6729806943, ccData: 1024 }, - { type: 3, pts: 6729812949, ccData: 49955 }, - { type: 2, pts: 6729812949, ccData: 37376 }, - { type: 2, pts: 6729812949, ccData: 1536 }, - { type: 3, pts: 6729818955, ccData: 545 }, - { type: 2, pts: 6729818955, ccData: 32512 }, - { type: 3, pts: 6729821958, ccData: 16930 }, - { type: 2, pts: 6729821958, ccData: 24400 }, - { type: 3, pts: 6729824961, ccData: 33314 }, - { type: 2, pts: 6729824961, ccData: 26990 }, - { type: 3, pts: 6729827964, ccData: 49698 }, - { type: 2, pts: 6729827964, ccData: 27487 }, - { type: 3, pts: 6729830967, ccData: 546 }, - { type: 2, pts: 6729830967, ccData: 26995 }, - { type: 3, pts: 6729833970, ccData: 16930 }, - { type: 2, pts: 6729833970, ccData: 24425 }, - { type: 3, pts: 6729836973, ccData: 33314 }, - { type: 2, pts: 6729836973, ccData: 28001 }, - { type: 3, pts: 6729839976, ccData: 49698 }, - { type: 2, pts: 6729839976, ccData: 26473 }, - { type: 3, pts: 6729842979, ccData: 546 }, - { type: 2, pts: 6729842979, ccData: 28265 }, - { type: 3, pts: 6729845982, ccData: 16930 }, - { type: 2, pts: 6729845982, ccData: 28263 }, - { type: 3, pts: 6729848985, ccData: 35377 }, - { type: 2, pts: 6729848985, ccData: 38939 }, - { type: 2, pts: 6729848985, ccData: 16640 }, - { type: 2, pts: 6729848985, ccData: 287 }, - { type: 2, pts: 6729848985, ccData: 4240 }, - { type: 2, pts: 6729848985, ccData: 1283 }, - { type: 2, pts: 6729848985, ccData: 37162 }, - { type: 2, pts: 6729848985, ccData: 0 }, - { type: 2, pts: 6729848985, ccData: 37377 }, - { type: 2, pts: 6729848985, ccData: 2048 }, - { type: 3, pts: 6729854991, ccData: 49698 }, - { type: 2, pts: 6729854991, ccData: 30568 }, - { type: 3, pts: 6729857994, ccData: 546 }, - { type: 2, pts: 6729857994, ccData: 24948 }, - { type: 3, pts: 6729860997, ccData: 16930 }, - { type: 2, pts: 6729860997, ccData: 24439 }, - { type: 3, pts: 6729864000, ccData: 33314 }, - { type: 2, pts: 6729864000, ccData: 25951 }, - { type: 3, pts: 6729867003, ccData: 49698 }, - { type: 2, pts: 6729867003, ccData: 25441 }, - { type: 3, pts: 6729870006, ccData: 546 }, - { type: 2, pts: 6729870006, ccData: 28255 }, - { type: 3, pts: 6729873009, ccData: 16930 }, - { type: 2, pts: 6729873009, ccData: 25189 }, - { type: 3, pts: 6729876012, ccData: 33314 }, - { type: 2, pts: 6729876012, ccData: 24320 }, - { type: 3, pts: 6729879015, ccData: 49697 }, - { type: 2, pts: 6729879015, ccData: 32512 }, - { type: 3, pts: 6729882018, ccData: 546 }, - { type: 2, pts: 6729882018, ccData: 35842 }, - { type: 3, pts: 6729888024, ccData: 16930 }, - { type: 2, pts: 6729888024, ccData: 35073 }, - { type: 3, pts: 6730044180, ccData: 35377 }, - { type: 2, pts: 6730044180, ccData: 39195 }, - { type: 2, pts: 6730044180, ccData: 15360 }, - { type: 2, pts: 6730044180, ccData: 31 }, - { type: 2, pts: 6730044180, ccData: 5264 }, - { type: 2, pts: 6730044180, ccData: 1283 }, - { type: 2, pts: 6730044180, ccData: 37162 }, - { type: 2, pts: 6730044180, ccData: 42 }, - { type: 2, pts: 6730044180, ccData: 37376 }, - { type: 2, pts: 6730044180, ccData: 0 }, - { type: 3, pts: 6730050186, ccData: 49697 }, - { type: 2, pts: 6730050186, ccData: 32512 }, - { type: 3, pts: 6730053189, ccData: 546 }, - { type: 2, pts: 6730053189, ccData: 24385 }, - { type: 3, pts: 6730056192, ccData: 16930 }, - { type: 2, pts: 6730056192, ccData: 24420 }, - { type: 3, pts: 6730059195, ccData: 33314 }, - { type: 2, pts: 6730059195, ccData: 24942 }, - { type: 3, pts: 6730062198, ccData: 49698 }, - { type: 2, pts: 6730062198, ccData: 25445 }, - { type: 3, pts: 6730065201, ccData: 546 }, - { type: 2, pts: 6730065201, ccData: 29279 }, - { type: 3, pts: 6730068204, ccData: 16929 }, - { type: 2, pts: 6730068204, ccData: 32512 }, - { type: 3, pts: 6730071207, ccData: 35377 }, - { type: 2, pts: 6730071207, ccData: 39195 }, - { type: 2, pts: 6730071207, ccData: 15360 }, - { type: 2, pts: 6730071207, ccData: 543 }, - { type: 2, pts: 6730071207, ccData: 4240 }, - { type: 2, pts: 6730071207, ccData: 1283 }, - { type: 2, pts: 6730071207, ccData: 37162 }, - { type: 2, pts: 6730071207, ccData: 0 }, - { type: 2, pts: 6730071207, ccData: 37378 }, - { type: 2, pts: 6730071207, ccData: 5120 }, - { type: 3, pts: 6730077213, ccData: 49955 }, - { type: 2, pts: 6730077213, ccData: 37378 }, - { type: 2, pts: 6730077213, ccData: 5376 }, - { type: 3, pts: 6730083219, ccData: 545 }, - { type: 2, pts: 6730083219, ccData: 32512 }, - { type: 3, pts: 6730086222, ccData: 16930 }, - { type: 2, pts: 6730086222, ccData: 24385 }, - { type: 3, pts: 6730089225, ccData: 33314 }, - { type: 2, pts: 6730089225, ccData: 24434 }, - { type: 3, pts: 6730092228, ccData: 49698 }, - { type: 2, pts: 6730092228, ccData: 28514 }, - { type: 3, pts: 6730095231, ccData: 546 }, - { type: 2, pts: 6730095231, ccData: 28532 }, - { type: 3, pts: 6730098234, ccData: 16930 }, - { type: 2, pts: 6730098234, ccData: 24320 }, - { type: 3, pts: 6730101237, ccData: 33313 }, - { type: 2, pts: 6730101237, ccData: 32512 }, - { type: 3, pts: 6730104240, ccData: 49698 }, - { type: 2, pts: 6730104240, ccData: 35841 }, - { type: 3, pts: 6730110246, ccData: 546 }, - { type: 2, pts: 6730110246, ccData: 35074 }, - { type: 3, pts: 6730227363, ccData: 18993 }, - { type: 2, pts: 6730227363, ccData: 38939 }, - { type: 2, pts: 6730227363, ccData: 17920 }, - { type: 2, pts: 6730227363, ccData: 31 }, - { type: 2, pts: 6730227363, ccData: 5264 }, - { type: 2, pts: 6730227363, ccData: 1283 }, - { type: 2, pts: 6730227363, ccData: 37162 }, - { type: 2, pts: 6730227363, ccData: 42 }, - { type: 2, pts: 6730227363, ccData: 37376 }, - { type: 2, pts: 6730227363, ccData: 1024 }, - { type: 3, pts: 6730233369, ccData: 33571 }, - { type: 2, pts: 6730233369, ccData: 37376 }, - { type: 2, pts: 6730233369, ccData: 1536 }, - { type: 3, pts: 6730239375, ccData: 49697 }, - { type: 2, pts: 6730239375, ccData: 32512 }, - { type: 3, pts: 6730242378, ccData: 546 }, - { type: 2, pts: 6730242378, ccData: 24385 }, - { type: 3, pts: 6730245381, ccData: 16930 }, - { type: 2, pts: 6730245381, ccData: 24432 }, - { type: 3, pts: 6730248384, ccData: 33314 }, - { type: 2, pts: 6730248384, ccData: 26994 }, - { type: 3, pts: 6730251387, ccData: 49698 }, - { type: 2, pts: 6730251387, ccData: 24948 }, - { type: 3, pts: 6730254390, ccData: 546 }, - { type: 2, pts: 6730254390, ccData: 25951 }, - { type: 3, pts: 6730257393, ccData: 16930 }, - { type: 2, pts: 6730257393, ccData: 24948 }, - { type: 3, pts: 6730260396, ccData: 33314 }, - { type: 2, pts: 6730260396, ccData: 24435 }, - { type: 3, pts: 6730263399, ccData: 49698 }, - { type: 2, pts: 6730263399, ccData: 25953 }, - { type: 3, pts: 6730266402, ccData: 546 }, - { type: 2, pts: 6730266402, ccData: 24320 }, - { type: 3, pts: 6730269405, ccData: 16929 }, - { type: 2, pts: 6730269405, ccData: 32512 }, - { type: 3, pts: 6730272408, ccData: 33314 }, - { type: 2, pts: 6730272408, ccData: 35842 }, - { type: 3, pts: 6730278414, ccData: 49698 }, - { type: 2, pts: 6730278414, ccData: 35073 }, - { type: 3, pts: 6730347483, ccData: 2609 }, - { type: 2, pts: 6730347483, ccData: 39195 }, - { type: 2, pts: 6730347483, ccData: 16640 }, - { type: 2, pts: 6730347483, ccData: 31 }, - { type: 2, pts: 6730347483, ccData: 5264 }, - { type: 2, pts: 6730347483, ccData: 1283 }, - { type: 2, pts: 6730347483, ccData: 37162 }, - { type: 2, pts: 6730347483, ccData: 42 }, - { type: 2, pts: 6730347483, ccData: 37376 }, - { type: 2, pts: 6730347483, ccData: 1024 }, - { type: 3, pts: 6730353489, ccData: 17187 }, - { type: 2, pts: 6730353489, ccData: 37376 }, - { type: 2, pts: 6730353489, ccData: 1792 }, - { type: 3, pts: 6730359495, ccData: 33313 }, - { type: 2, pts: 6730359495, ccData: 32512 }, - { type: 3, pts: 6730362498, ccData: 49698 }, - { type: 2, pts: 6730362498, ccData: 24400 }, - { type: 3, pts: 6730365501, ccData: 546 }, - { type: 2, pts: 6730365501, ccData: 26990 }, - { type: 3, pts: 6730368504, ccData: 16930 }, - { type: 2, pts: 6730368504, ccData: 27487 }, - { type: 3, pts: 6730371507, ccData: 33314 }, - { type: 2, pts: 6730371507, ccData: 26995 }, - { type: 3, pts: 6730374510, ccData: 49698 }, - { type: 2, pts: 6730374510, ccData: 24417 }, - { type: 3, pts: 6730377513, ccData: 546 }, - { type: 2, pts: 6730377513, ccData: 24423 }, - { type: 3, pts: 6730380516, ccData: 16930 }, - { type: 2, pts: 6730380516, ccData: 26983 }, - { type: 3, pts: 6730383519, ccData: 33314 }, - { type: 2, pts: 6730383519, ccData: 26476 }, - { type: 3, pts: 6730386522, ccData: 49698 }, - { type: 2, pts: 6730386522, ccData: 25856 }, - { type: 3, pts: 6730389525, ccData: 2609 }, - { type: 2, pts: 6730389525, ccData: 39195 }, - { type: 2, pts: 6730389525, ccData: 16640 }, - { type: 2, pts: 6730389525, ccData: 287 }, - { type: 2, pts: 6730389525, ccData: 4240 }, - { type: 2, pts: 6730389525, ccData: 1283 }, - { type: 2, pts: 6730389525, ccData: 37162 }, - { type: 2, pts: 6730389525, ccData: 0 }, - { type: 2, pts: 6730389525, ccData: 37377 }, - { type: 2, pts: 6730389525, ccData: 1024 }, - { type: 3, pts: 6730395531, ccData: 16930 }, - { type: 2, pts: 6730395531, ccData: 29800 }, - { type: 3, pts: 6730398534, ccData: 33314 }, - { type: 2, pts: 6730398534, ccData: 24948 }, - { type: 3, pts: 6730401537, ccData: 49698 }, - { type: 2, pts: 6730401537, ccData: 24439 }, - { type: 3, pts: 6730404540, ccData: 546 }, - { type: 2, pts: 6730404540, ccData: 26983 }, - { type: 3, pts: 6730407543, ccData: 16930 }, - { type: 2, pts: 6730407543, ccData: 26476 }, - { type: 3, pts: 6730410546, ccData: 33314 }, - { type: 2, pts: 6730410546, ccData: 25971 }, - { type: 3, pts: 6730413549, ccData: 49698 }, - { type: 2, pts: 6730413549, ccData: 24441 }, - { type: 3, pts: 6730416552, ccData: 546 }, - { type: 2, pts: 6730416552, ccData: 28533 }, - { type: 3, pts: 6730419555, ccData: 16930 }, - { type: 2, pts: 6730419555, ccData: 29279 }, - { type: 3, pts: 6730422558, ccData: 33314 }, - { type: 2, pts: 6730422558, ccData: 29807 }, - { type: 3, pts: 6730425561, ccData: 49698 }, - { type: 2, pts: 6730425561, ccData: 25971 }, - { type: 3, pts: 6730428564, ccData: 546 }, - { type: 2, pts: 6730428564, ccData: 24320 }, - { type: 3, pts: 6730431567, ccData: 16929 }, - { type: 2, pts: 6730431567, ccData: 32512 }, - { type: 3, pts: 6730434570, ccData: 33314 }, - { type: 2, pts: 6730434570, ccData: 35841 }, - { type: 3, pts: 6730440576, ccData: 49698 }, - { type: 2, pts: 6730440576, ccData: 35074 }, - { type: 3, pts: 6730575711, ccData: 2609 }, - { type: 2, pts: 6730575711, ccData: 38939 }, - { type: 2, pts: 6730575711, ccData: 16640 }, - { type: 2, pts: 6730575711, ccData: 31 }, - { type: 2, pts: 6730575711, ccData: 5264 }, - { type: 2, pts: 6730575711, ccData: 1283 }, - { type: 2, pts: 6730575711, ccData: 37162 }, - { type: 2, pts: 6730575711, ccData: 42 }, - { type: 2, pts: 6730575711, ccData: 37376 }, - { type: 2, pts: 6730575711, ccData: 1024 }, - { type: 3, pts: 6730581717, ccData: 17187 }, - { type: 2, pts: 6730581717, ccData: 37376 }, - { type: 2, pts: 6730581717, ccData: 1536 }, - { type: 3, pts: 6730587723, ccData: 33313 }, - { type: 2, pts: 6730587723, ccData: 32512 }, - { type: 3, pts: 6730590726, ccData: 49698 }, - { type: 2, pts: 6730590726, ccData: 24400 }, - { type: 3, pts: 6730593729, ccData: 546 }, - { type: 2, pts: 6730593729, ccData: 26990 }, - { type: 3, pts: 6730596732, ccData: 16930 }, - { type: 2, pts: 6730596732, ccData: 27487 }, - { type: 3, pts: 6730599735, ccData: 33314 }, - { type: 2, pts: 6730599735, ccData: 26995 }, - { type: 3, pts: 6730602738, ccData: 49698 }, - { type: 2, pts: 6730602738, ccData: 24417 }, - { type: 3, pts: 6730605741, ccData: 546 }, - { type: 2, pts: 6730605741, ccData: 24435 }, - { type: 3, pts: 6730608744, ccData: 16930 }, - { type: 2, pts: 6730608744, ccData: 28769 }, - { type: 3, pts: 6730611747, ccData: 33314 }, - { type: 2, pts: 6730611747, ccData: 29291 }, - { type: 3, pts: 6730614750, ccData: 49698 }, - { type: 2, pts: 6730614750, ccData: 27749 }, - { type: 3, pts: 6730617753, ccData: 2609 }, - { type: 2, pts: 6730617753, ccData: 38939 }, - { type: 2, pts: 6730617753, ccData: 16640 }, - { type: 2, pts: 6730617753, ccData: 287 }, - { type: 2, pts: 6730617753, ccData: 4240 }, - { type: 2, pts: 6730617753, ccData: 1283 }, - { type: 2, pts: 6730617753, ccData: 37162 }, - { type: 2, pts: 6730617753, ccData: 0 }, - { type: 2, pts: 6730617753, ccData: 37377 }, - { type: 2, pts: 6730617753, ccData: 1024 }, - { type: 3, pts: 6730623759, ccData: 17187 }, - { type: 2, pts: 6730623759, ccData: 37377 }, - { type: 2, pts: 6730623759, ccData: 1280 }, - { type: 3, pts: 6730629765, ccData: 33314 }, - { type: 2, pts: 6730629765, ccData: 29800 }, - { type: 3, pts: 6730632768, ccData: 49698 }, - { type: 2, pts: 6730632768, ccData: 24948 }, - { type: 3, pts: 6730635771, ccData: 546 }, - { type: 2, pts: 6730635771, ccData: 24423 }, - { type: 3, pts: 6730638774, ccData: 16930 }, - { type: 2, pts: 6730638774, ccData: 27759 }, - { type: 3, pts: 6730641777, ccData: 33314 }, - { type: 2, pts: 6730641777, ccData: 30579 }, - { type: 3, pts: 6730644780, ccData: 49698 }, - { type: 2, pts: 6730644780, ccData: 24417 }, - { type: 3, pts: 6730647783, ccData: 546 }, - { type: 2, pts: 6730647783, ccData: 28260 }, - { type: 3, pts: 6730650786, ccData: 16930 }, - { type: 2, pts: 6730650786, ccData: 24423 }, - { type: 3, pts: 6730653789, ccData: 33314 }, - { type: 2, pts: 6730653789, ccData: 27759 }, - { type: 3, pts: 6730656792, ccData: 49698 }, - { type: 2, pts: 6730656792, ccData: 30579 }, - { type: 3, pts: 6730659795, ccData: 546 }, - { type: 2, pts: 6730659795, ccData: 24320 }, - { type: 3, pts: 6730662798, ccData: 16929 }, - { type: 2, pts: 6730662798, ccData: 32512 }, - { type: 3, pts: 6730665801, ccData: 33314 }, - { type: 2, pts: 6730665801, ccData: 35842 }, - { type: 3, pts: 6730671807, ccData: 49698 }, - { type: 2, pts: 6730671807, ccData: 35073 }, - { type: 3, pts: 6731011146, ccData: 2609 }, - { type: 2, pts: 6731011146, ccData: 39195 }, - { type: 2, pts: 6731011146, ccData: 17920 }, - { type: 2, pts: 6731011146, ccData: 31 }, - { type: 2, pts: 6731011146, ccData: 5264 }, - { type: 2, pts: 6731011146, ccData: 1283 }, - { type: 2, pts: 6731011146, ccData: 37162 }, - { type: 2, pts: 6731011146, ccData: 42 }, - { type: 2, pts: 6731011146, ccData: 37376 }, - { type: 2, pts: 6731011146, ccData: 0 }, - { type: 3, pts: 6731017152, ccData: 17187 }, - { type: 2, pts: 6731017152, ccData: 37376 }, - { type: 2, pts: 6731017152, ccData: 256 }, - { type: 3, pts: 6731023158, ccData: 33313 }, - { type: 2, pts: 6731023158, ccData: 32512 }, - { type: 3, pts: 6731026161, ccData: 49698 }, - { type: 2, pts: 6731026161, ccData: 24393 }, - { type: 3, pts: 6731029164, ccData: 546 }, - { type: 2, pts: 6731029164, ccData: 29735 }, - { type: 3, pts: 6731032167, ccData: 16930 }, - { type: 2, pts: 6731032167, ccData: 29535 }, - { type: 3, pts: 6731035170, ccData: 33314 }, - { type: 2, pts: 6731035170, ccData: 24927 }, - { type: 3, pts: 6731038173, ccData: 49698 }, - { type: 2, pts: 6731038173, ccData: 28777 }, - { type: 3, pts: 6731041176, ccData: 546 }, - { type: 2, pts: 6731041176, ccData: 28267 }, - { type: 3, pts: 6731044179, ccData: 16930 }, - { type: 2, pts: 6731044179, ccData: 24948 }, - { type: 3, pts: 6731047182, ccData: 33314 }, - { type: 2, pts: 6731047182, ccData: 24947 }, - { type: 3, pts: 6731050185, ccData: 49698 }, - { type: 2, pts: 6731050185, ccData: 29801 }, - { type: 3, pts: 6731053188, ccData: 546 }, - { type: 2, pts: 6731053188, ccData: 25439 }, - { type: 3, pts: 6731056191, ccData: 16930 }, - { type: 2, pts: 6731056191, ccData: 26213 }, - { type: 3, pts: 6731059194, ccData: 33314 }, - { type: 2, pts: 6731059194, ccData: 25964 }, - { type: 3, pts: 6731062197, ccData: 49698 }, - { type: 2, pts: 6731062197, ccData: 26990 }, - { type: 3, pts: 6731065200, ccData: 546 }, - { type: 2, pts: 6731065200, ccData: 26463 }, - { type: 3, pts: 6731068203, ccData: 16929 }, - { type: 2, pts: 6731068203, ccData: 32512 }, - { type: 3, pts: 6731071206, ccData: 33314 }, - { type: 2, pts: 6731071206, ccData: 35841 }, - { type: 3, pts: 6731077212, ccData: 49698 }, - { type: 2, pts: 6731077212, ccData: 35074 }, - { type: 3, pts: 6731257392, ccData: 2609 }, - { type: 2, pts: 6731257392, ccData: 38939 }, - { type: 2, pts: 6731257392, ccData: 17920 }, - { type: 2, pts: 6731257392, ccData: 31 }, - { type: 2, pts: 6731257392, ccData: 5264 }, - { type: 2, pts: 6731257392, ccData: 1283 }, - { type: 2, pts: 6731257392, ccData: 37162 }, - { type: 2, pts: 6731257392, ccData: 42 }, - { type: 2, pts: 6731257392, ccData: 37376 }, - { type: 2, pts: 6731257392, ccData: 1024 }, - { type: 3, pts: 6731263398, ccData: 16929 }, - { type: 2, pts: 6731263398, ccData: 32512 }, - { type: 3, pts: 6731266401, ccData: 33314 }, - { type: 2, pts: 6731266401, ccData: 24393 }, - { type: 3, pts: 6731269404, ccData: 49698 }, - { type: 2, pts: 6731269404, ccData: 28255 }, - { type: 3, pts: 6731272407, ccData: 546 }, - { type: 2, pts: 6731272407, ccData: 24927 }, - { type: 3, pts: 6731275410, ccData: 16930 }, - { type: 2, pts: 6731275410, ccData: 28777 }, - { type: 3, pts: 6731278413, ccData: 33314 }, - { type: 2, pts: 6731278413, ccData: 28267 }, - { type: 3, pts: 6731281416, ccData: 49698 }, - { type: 2, pts: 6731281416, ccData: 24941 }, - { type: 3, pts: 6731284419, ccData: 546 }, - { type: 2, pts: 6731284419, ccData: 24954 }, - { type: 3, pts: 6731287422, ccData: 16930 }, - { type: 2, pts: 6731287422, ccData: 26990 }, - { type: 3, pts: 6731290425, ccData: 33314 }, - { type: 2, pts: 6731290425, ccData: 26463 }, - { type: 3, pts: 6731293428, ccData: 49698 }, - { type: 2, pts: 6731293428, ccData: 30561 }, - { type: 3, pts: 6731296431, ccData: 546 }, - { type: 2, pts: 6731296431, ccData: 31071 }, - { type: 3, pts: 6731299434, ccData: 16929 }, - { type: 2, pts: 6731299434, ccData: 32512 }, - { type: 3, pts: 6731302437, ccData: 33314 }, - { type: 2, pts: 6731302437, ccData: 35842 }, - { type: 3, pts: 6731308443, ccData: 49698 }, - { type: 2, pts: 6731308443, ccData: 35073 }, - { type: 3, pts: 6731500635, ccData: 2609 }, - { type: 2, pts: 6731500635, ccData: 39195 }, - { type: 2, pts: 6731500635, ccData: 17920 }, - { type: 2, pts: 6731500635, ccData: 31 }, - { type: 2, pts: 6731500635, ccData: 5264 }, - { type: 2, pts: 6731500635, ccData: 1283 }, - { type: 2, pts: 6731500635, ccData: 37162 }, - { type: 2, pts: 6731500635, ccData: 42 }, - { type: 2, pts: 6731500635, ccData: 37376 }, - { type: 2, pts: 6731500635, ccData: 0 }, - { type: 3, pts: 6731506641, ccData: 17187 }, - { type: 2, pts: 6731506641, ccData: 37376 }, - { type: 2, pts: 6731506641, ccData: 256 }, - { type: 3, pts: 6731512647, ccData: 33313 }, - { type: 2, pts: 6731512647, ccData: 32512 }, - { type: 3, pts: 6731515650, ccData: 49698 }, - { type: 2, pts: 6731515650, ccData: 24393 }, - { type: 3, pts: 6731518653, ccData: 546 }, - { type: 2, pts: 6731518653, ccData: 29735 }, - { type: 3, pts: 6731521656, ccData: 16930 }, - { type: 2, pts: 6731521656, ccData: 29535 }, - { type: 3, pts: 6731524659, ccData: 33314 }, - { type: 2, pts: 6731524659, ccData: 24927 }, - { type: 3, pts: 6731527662, ccData: 49698 }, - { type: 2, pts: 6731527662, ccData: 28777 }, - { type: 3, pts: 6731530665, ccData: 546 }, - { type: 2, pts: 6731530665, ccData: 28267 }, - { type: 3, pts: 6731533668, ccData: 16930 }, - { type: 2, pts: 6731533668, ccData: 24948 }, - { type: 3, pts: 6731536671, ccData: 33314 }, - { type: 2, pts: 6731536671, ccData: 24947 }, - { type: 3, pts: 6731539674, ccData: 49698 }, - { type: 2, pts: 6731539674, ccData: 29801 }, - { type: 3, pts: 6731542677, ccData: 546 }, - { type: 2, pts: 6731542677, ccData: 25439 }, - { type: 3, pts: 6731545680, ccData: 16930 }, - { type: 2, pts: 6731545680, ccData: 26213 }, - { type: 3, pts: 6731548683, ccData: 33314 }, - { type: 2, pts: 6731548683, ccData: 25964 }, - { type: 3, pts: 6731551686, ccData: 49698 }, - { type: 2, pts: 6731551686, ccData: 26990 }, - { type: 3, pts: 6731554689, ccData: 546 }, - { type: 2, pts: 6731554689, ccData: 26463 }, - { type: 3, pts: 6731557692, ccData: 16929 }, - { type: 2, pts: 6731557692, ccData: 32512 }, - { type: 3, pts: 6731560695, ccData: 33314 }, - { type: 2, pts: 6731560695, ccData: 35841 }, - { type: 3, pts: 6731566701, ccData: 49698 }, - { type: 2, pts: 6731566701, ccData: 35074 }, - { type: 3, pts: 6731728863, ccData: 2609 }, - { type: 2, pts: 6731728863, ccData: 38939 }, - { type: 2, pts: 6731728863, ccData: 17920 }, - { type: 2, pts: 6731728863, ccData: 31 }, - { type: 2, pts: 6731728863, ccData: 5264 }, - { type: 2, pts: 6731728863, ccData: 1283 }, - { type: 2, pts: 6731728863, ccData: 37162 }, - { type: 2, pts: 6731728863, ccData: 42 }, - { type: 2, pts: 6731728863, ccData: 37376 }, - { type: 2, pts: 6731728863, ccData: 0 }, - { type: 3, pts: 6731734869, ccData: 17187 }, - { type: 2, pts: 6731734869, ccData: 37376 }, - { type: 2, pts: 6731734869, ccData: 768 }, - { type: 3, pts: 6731740875, ccData: 33313 }, - { type: 2, pts: 6731740875, ccData: 32512 }, - { type: 3, pts: 6731743878, ccData: 49698 }, - { type: 2, pts: 6731743878, ccData: 24399 }, - { type: 3, pts: 6731746881, ccData: 546 }, - { type: 2, pts: 6731746881, ccData: 28255 }, - { type: 3, pts: 6731749884, ccData: 16930 }, - { type: 2, pts: 6731749884, ccData: 24927 }, - { type: 3, pts: 6731752887, ccData: 33314 }, - { type: 2, pts: 6731752887, ccData: 28777 }, - { type: 3, pts: 6731755890, ccData: 49698 }, - { type: 2, pts: 6731755890, ccData: 28267 }, - { type: 3, pts: 6731758893, ccData: 546 }, - { type: 2, pts: 6731758893, ccData: 24944 }, - { type: 3, pts: 6731761896, ccData: 16930 }, - { type: 2, pts: 6731761896, ccData: 25970 }, - { type: 3, pts: 6731764899, ccData: 33314 }, - { type: 2, pts: 6731764899, ccData: 26213 }, - { type: 3, pts: 6731767902, ccData: 49698 }, - { type: 2, pts: 6731767902, ccData: 25460 }, - { type: 3, pts: 6731770905, ccData: 546 }, - { type: 2, pts: 6731770905, ccData: 24420 }, - { type: 3, pts: 6731773908, ccData: 16930 }, - { type: 2, pts: 6731773908, ccData: 24953 }, - { type: 3, pts: 6731776911, ccData: 33314 }, - { type: 2, pts: 6731776911, ccData: 24320 }, - { type: 3, pts: 6731779914, ccData: 49697 }, - { type: 2, pts: 6731779914, ccData: 32512 }, - { type: 3, pts: 6731782917, ccData: 546 }, - { type: 2, pts: 6731782917, ccData: 35842 }, - { type: 3, pts: 6731788923, ccData: 16930 }, - { type: 2, pts: 6731788923, ccData: 35073 }, - { type: 3, pts: 6731957091, ccData: 35377 }, - { type: 2, pts: 6731957091, ccData: 39195 }, - { type: 2, pts: 6731957091, ccData: 16640 }, - { type: 2, pts: 6731957091, ccData: 31 }, - { type: 2, pts: 6731957091, ccData: 5264 }, - { type: 2, pts: 6731957091, ccData: 1283 }, - { type: 2, pts: 6731957091, ccData: 37162 }, - { type: 2, pts: 6731957091, ccData: 42 }, - { type: 2, pts: 6731957091, ccData: 37376 }, - { type: 2, pts: 6731957091, ccData: 1024 }, - { type: 3, pts: 6731963097, ccData: 49955 }, - { type: 2, pts: 6731963097, ccData: 37376 }, - { type: 2, pts: 6731963097, ccData: 1280 }, - { type: 3, pts: 6731969103, ccData: 545 }, - { type: 2, pts: 6731969103, ccData: 32512 }, - { type: 3, pts: 6731972106, ccData: 16930 }, - { type: 2, pts: 6731972106, ccData: 24385 }, - { type: 3, pts: 6731975109, ccData: 33314 }, - { type: 2, pts: 6731975109, ccData: 28281 }, - { type: 3, pts: 6731978112, ccData: 49698 }, - { type: 2, pts: 6731978112, ccData: 29800 }, - { type: 3, pts: 6731981115, ccData: 546 }, - { type: 2, pts: 6731981115, ccData: 26990 }, - { type: 3, pts: 6731984118, ccData: 16930 }, - { type: 2, pts: 6731984118, ccData: 26463 }, - { type: 3, pts: 6731987121, ccData: 33314 }, - { type: 2, pts: 6731987121, ccData: 25441 }, - { type: 3, pts: 6731990124, ccData: 49698 }, - { type: 2, pts: 6731990124, ccData: 28255 }, - { type: 3, pts: 6731993127, ccData: 546 }, - { type: 2, pts: 6731993127, ccData: 26721 }, - { type: 3, pts: 6731996130, ccData: 16930 }, - { type: 2, pts: 6731996130, ccData: 28784 }, - { type: 3, pts: 6731999133, ccData: 33314 }, - { type: 2, pts: 6731999133, ccData: 25966 }, - { type: 3, pts: 6732002136, ccData: 51761 }, - { type: 2, pts: 6732002136, ccData: 39195 }, - { type: 2, pts: 6732002136, ccData: 16640 }, - { type: 2, pts: 6732002136, ccData: 287 }, - { type: 2, pts: 6732002136, ccData: 4240 }, - { type: 2, pts: 6732002136, ccData: 1283 }, - { type: 2, pts: 6732002136, ccData: 37162 }, - { type: 2, pts: 6732002136, ccData: 0 }, - { type: 2, pts: 6732002136, ccData: 37377 }, - { type: 2, pts: 6732002136, ccData: 0 }, - { type: 3, pts: 6732008142, ccData: 803 }, - { type: 2, pts: 6732008142, ccData: 37377 }, - { type: 2, pts: 6732008142, ccData: 768 }, - { type: 3, pts: 6732014148, ccData: 16930 }, - { type: 2, pts: 6732014148, ccData: 24947 }, - { type: 3, pts: 6732017151, ccData: 33314 }, - { type: 2, pts: 6732017151, ccData: 24439 }, - { type: 3, pts: 6732020154, ccData: 49698 }, - { type: 2, pts: 6732020154, ccData: 25951 }, - { type: 3, pts: 6732023157, ccData: 546 }, - { type: 2, pts: 6732023157, ccData: 28780 }, - { type: 3, pts: 6732026160, ccData: 16930 }, - { type: 2, pts: 6732026160, ccData: 24953 }, - { type: 3, pts: 6732029163, ccData: 33314 }, - { type: 2, pts: 6732029163, ccData: 24436 }, - { type: 3, pts: 6732032166, ccData: 49698 }, - { type: 2, pts: 6732032166, ccData: 26725 }, - { type: 3, pts: 6732035169, ccData: 546 }, - { type: 2, pts: 6732035169, ccData: 24420 }, - { type: 3, pts: 6732038172, ccData: 16930 }, - { type: 2, pts: 6732038172, ccData: 24953 }, - { type: 3, pts: 6732041175, ccData: 33314 }, - { type: 2, pts: 6732041175, ccData: 24417 }, - { type: 3, pts: 6732044178, ccData: 49698 }, - { type: 2, pts: 6732044178, ccData: 30561 }, - { type: 3, pts: 6732047181, ccData: 546 }, - { type: 2, pts: 6732047181, ccData: 31071 }, - { type: 3, pts: 6732050184, ccData: 16929 }, - { type: 2, pts: 6732050184, ccData: 32512 }, - { type: 3, pts: 6732053187, ccData: 33314 }, - { type: 2, pts: 6732053187, ccData: 35841 }, - { type: 3, pts: 6732059193, ccData: 49698 }, - { type: 2, pts: 6732059193, ccData: 35074 }, - { type: 3, pts: 6732554688, ccData: 2609 }, - { type: 2, pts: 6732554688, ccData: 38939 }, - { type: 2, pts: 6732554688, ccData: 17920 }, - { type: 2, pts: 6732554688, ccData: 31 }, - { type: 2, pts: 6732554688, ccData: 5264 }, - { type: 2, pts: 6732554688, ccData: 1283 }, - { type: 2, pts: 6732554688, ccData: 37162 }, - { type: 2, pts: 6732554688, ccData: 42 }, - { type: 2, pts: 6732554688, ccData: 37376 }, - { type: 2, pts: 6732554688, ccData: 0 }, - { type: 3, pts: 6732560694, ccData: 16929 }, - { type: 2, pts: 6732560694, ccData: 32512 }, - { type: 3, pts: 6732563697, ccData: 33314 }, - { type: 2, pts: 6732563697, ccData: 24393 }, - { type: 3, pts: 6732566700, ccData: 49698 }, - { type: 2, pts: 6732566700, ccData: 29735 }, - { type: 3, pts: 6732569703, ccData: 546 }, - { type: 2, pts: 6732569703, ccData: 29535 }, - { type: 3, pts: 6732572706, ccData: 16930 }, - { type: 2, pts: 6732572706, ccData: 24927 }, - { type: 3, pts: 6732575709, ccData: 33314 }, - { type: 2, pts: 6732575709, ccData: 20585 }, - { type: 3, pts: 6732578712, ccData: 49698 }, - { type: 2, pts: 6732578712, ccData: 28267 }, - { type: 3, pts: 6732581715, ccData: 546 }, - { type: 2, pts: 6732581715, ccData: 24940 }, - { type: 3, pts: 6732584718, ccData: 16930 }, - { type: 2, pts: 6732584718, ccData: 26979 }, - { type: 3, pts: 6732587721, ccData: 33314 }, - { type: 2, pts: 6732587721, ccData: 26991 }, - { type: 3, pts: 6732590724, ccData: 49698 }, - { type: 2, pts: 6732590724, ccData: 30067 }, - { type: 3, pts: 6732593727, ccData: 546 }, - { type: 2, pts: 6732593727, ccData: 24422 }, - { type: 3, pts: 6732596730, ccData: 16930 }, - { type: 2, pts: 6732596730, ccData: 25957 }, - { type: 3, pts: 6732599733, ccData: 33314 }, - { type: 2, pts: 6732599733, ccData: 27753 }, - { type: 3, pts: 6732602736, ccData: 49698 }, - { type: 2, pts: 6732602736, ccData: 28263 }, - { type: 3, pts: 6732605739, ccData: 546 }, - { type: 2, pts: 6732605739, ccData: 24320 }, - { type: 3, pts: 6732608742, ccData: 16929 }, - { type: 2, pts: 6732608742, ccData: 32512 }, - { type: 3, pts: 6732611745, ccData: 33314 }, - { type: 2, pts: 6732611745, ccData: 35842 }, - { type: 3, pts: 6732617751, ccData: 49698 }, - { type: 2, pts: 6732617751, ccData: 35073 }, - { type: 3, pts: 6732818952, ccData: 2609 }, - { type: 2, pts: 6732818952, ccData: 39195 }, - { type: 2, pts: 6732818952, ccData: 17920 }, - { type: 2, pts: 6732818952, ccData: 31 }, - { type: 2, pts: 6732818952, ccData: 5264 }, - { type: 2, pts: 6732818952, ccData: 1283 }, - { type: 2, pts: 6732818952, ccData: 37162 }, - { type: 2, pts: 6732818952, ccData: 42 }, - { type: 2, pts: 6732818952, ccData: 37376 }, - { type: 2, pts: 6732818952, ccData: 0 }, - { type: 3, pts: 6732824958, ccData: 17187 }, - { type: 2, pts: 6732824958, ccData: 37376 }, - { type: 2, pts: 6732824958, ccData: 512 }, - { type: 3, pts: 6732830964, ccData: 33313 }, - { type: 2, pts: 6732830964, ccData: 32512 }, - { type: 3, pts: 6732833967, ccData: 49698 }, - { type: 2, pts: 6732833967, ccData: 24400 }, - { type: 3, pts: 6732836970, ccData: 546 }, - { type: 2, pts: 6732836970, ccData: 25972 }, - { type: 3, pts: 6732839973, ccData: 16930 }, - { type: 2, pts: 6732839973, ccData: 25970 }, - { type: 3, pts: 6732842976, ccData: 33314 }, - { type: 2, pts: 6732842976, ccData: 29289 }, - { type: 3, pts: 6732845979, ccData: 49698 }, - { type: 2, pts: 6732845979, ccData: 26217 }, - { type: 3, pts: 6732848982, ccData: 546 }, - { type: 2, pts: 6732848982, ccData: 25439 }, - { type: 3, pts: 6732851985, ccData: 16930 }, - { type: 2, pts: 6732851985, ccData: 31087 }, - { type: 3, pts: 6732854988, ccData: 33314 }, - { type: 2, pts: 6732854988, ccData: 30047 }, - { type: 3, pts: 6732857991, ccData: 49698 }, - { type: 2, pts: 6732857991, ccData: 28009 }, - { type: 3, pts: 6732860994, ccData: 546 }, - { type: 2, pts: 6732860994, ccData: 26472 }, - { type: 3, pts: 6732863997, ccData: 16930 }, - { type: 2, pts: 6732863997, ccData: 29791 }, - { type: 3, pts: 6732867000, ccData: 33314 }, - { type: 2, pts: 6732867000, ccData: 29537 }, - { type: 3, pts: 6732870003, ccData: 49698 }, - { type: 2, pts: 6732870003, ccData: 31071 }, - { type: 3, pts: 6732873006, ccData: 545 }, - { type: 2, pts: 6732873006, ccData: 32512 }, - { type: 3, pts: 6732876009, ccData: 16930 }, - { type: 2, pts: 6732876009, ccData: 35841 }, - { type: 3, pts: 6732882015, ccData: 33314 }, - { type: 2, pts: 6732882015, ccData: 35074 }, - { type: 3, pts: 6733065198, ccData: 51761 }, - { type: 2, pts: 6733065198, ccData: 38939 }, - { type: 2, pts: 6733065198, ccData: 17920 }, - { type: 2, pts: 6733065198, ccData: 31 }, - { type: 2, pts: 6733065198, ccData: 5264 }, - { type: 2, pts: 6733065198, ccData: 1283 }, - { type: 2, pts: 6733065198, ccData: 37162 }, - { type: 2, pts: 6733065198, ccData: 42 }, - { type: 2, pts: 6733065198, ccData: 37376 }, - { type: 2, pts: 6733065198, ccData: 0 }, - { type: 3, pts: 6733071204, ccData: 545 }, - { type: 2, pts: 6733071204, ccData: 32512 }, - { type: 3, pts: 6733074207, ccData: 16930 }, - { type: 2, pts: 6733074207, ccData: 24400 }, - { type: 3, pts: 6733077210, ccData: 33314 }, - { type: 2, pts: 6733077210, ccData: 26990 }, - { type: 3, pts: 6733080213, ccData: 49698 }, - { type: 2, pts: 6733080213, ccData: 27489 }, - { type: 3, pts: 6733083216, ccData: 546 }, - { type: 2, pts: 6733083216, ccData: 27753 }, - { type: 3, pts: 6733086219, ccData: 16930 }, - { type: 2, pts: 6733086219, ccData: 25449 }, - { type: 3, pts: 6733089222, ccData: 33314 }, - { type: 2, pts: 6733089222, ccData: 28533 }, - { type: 3, pts: 6733092225, ccData: 49698 }, - { type: 2, pts: 6733092225, ccData: 29535 }, - { type: 3, pts: 6733095228, ccData: 546 }, - { type: 2, pts: 6733095228, ccData: 24942 }, - { type: 3, pts: 6733098231, ccData: 16930 }, - { type: 2, pts: 6733098231, ccData: 25695 }, - { type: 3, pts: 6733101234, ccData: 33314 }, - { type: 2, pts: 6733101234, ccData: 20581 }, - { type: 3, pts: 6733104237, ccData: 49698 }, - { type: 2, pts: 6733104237, ccData: 29797 }, - { type: 3, pts: 6733107240, ccData: 546 }, - { type: 2, pts: 6733107240, ccData: 29298 }, - { type: 3, pts: 6733110243, ccData: 16930 }, - { type: 2, pts: 6733110243, ccData: 26982 }, - { type: 3, pts: 6733113246, ccData: 33314 }, - { type: 2, pts: 6733113246, ccData: 26979 }, - { type: 3, pts: 6733116249, ccData: 49698 }, - { type: 2, pts: 6733116249, ccData: 24320 }, - { type: 3, pts: 6733119252, ccData: 545 }, - { type: 2, pts: 6733119252, ccData: 32512 }, - { type: 3, pts: 6733122255, ccData: 16930 }, - { type: 2, pts: 6733122255, ccData: 35842 }, - { type: 3, pts: 6733128261, ccData: 33314 }, - { type: 2, pts: 6733128261, ccData: 35073 }, - { type: 3, pts: 6733335468, ccData: 51761 }, - { type: 2, pts: 6733335468, ccData: 39195 }, - { type: 2, pts: 6733335468, ccData: 16640 }, - { type: 2, pts: 6733335468, ccData: 31 }, - { type: 2, pts: 6733335468, ccData: 5264 }, - { type: 2, pts: 6733335468, ccData: 1283 }, - { type: 2, pts: 6733335468, ccData: 37162 }, - { type: 2, pts: 6733335468, ccData: 42 }, - { type: 2, pts: 6733335468, ccData: 37376 }, - { type: 2, pts: 6733335468, ccData: 2048 }, - { type: 3, pts: 6733341474, ccData: 803 }, - { type: 2, pts: 6733341474, ccData: 37376 }, - { type: 2, pts: 6733341474, ccData: 2304 }, - { type: 3, pts: 6733347480, ccData: 16929 }, - { type: 2, pts: 6733347480, ccData: 32512 }, - { type: 3, pts: 6733350483, ccData: 33314 }, - { type: 2, pts: 6733350483, ccData: 24400 }, - { type: 3, pts: 6733353486, ccData: 49698 }, - { type: 2, pts: 6733353486, ccData: 26990 }, - { type: 3, pts: 6733356489, ccData: 546 }, - { type: 2, pts: 6733356489, ccData: 27489 }, - { type: 3, pts: 6733359492, ccData: 16930 }, - { type: 2, pts: 6733359492, ccData: 27753 }, - { type: 3, pts: 6733362495, ccData: 33314 }, - { type: 2, pts: 6733362495, ccData: 25449 }, - { type: 3, pts: 6733365498, ccData: 49698 }, - { type: 2, pts: 6733365498, ccData: 28533 }, - { type: 3, pts: 6733368501, ccData: 546 }, - { type: 2, pts: 6733368501, ccData: 29440 }, - { type: 3, pts: 6733371504, ccData: 18993 }, - { type: 2, pts: 6733371504, ccData: 39195 }, - { type: 2, pts: 6733371504, ccData: 16640 }, - { type: 2, pts: 6733371504, ccData: 287 }, - { type: 2, pts: 6733371504, ccData: 4240 }, - { type: 2, pts: 6733371504, ccData: 1283 }, - { type: 2, pts: 6733371504, ccData: 37162 }, - { type: 2, pts: 6733371504, ccData: 0 }, - { type: 2, pts: 6733371504, ccData: 37377 }, - { type: 2, pts: 6733371504, ccData: 1024 }, - { type: 3, pts: 6733377510, ccData: 33571 }, - { type: 2, pts: 6733377510, ccData: 37377 }, - { type: 2, pts: 6733377510, ccData: 1536 }, - { type: 3, pts: 6733383516, ccData: 49698 }, - { type: 2, pts: 6733383516, ccData: 28777 }, - { type: 3, pts: 6733386519, ccData: 546 }, - { type: 2, pts: 6733386519, ccData: 28267 }, - { type: 3, pts: 6733389522, ccData: 16930 }, - { type: 2, pts: 6733389522, ccData: 11359 }, - { type: 3, pts: 6733392525, ccData: 33314 }, - { type: 2, pts: 6733392525, ccData: 28777 }, - { type: 3, pts: 6733395528, ccData: 49698 }, - { type: 2, pts: 6733395528, ccData: 28267 }, - { type: 3, pts: 6733398531, ccData: 546 }, - { type: 2, pts: 6733398531, ccData: 24424 }, - { type: 3, pts: 6733401534, ccData: 16930 }, - { type: 2, pts: 6733401534, ccData: 28527 }, - { type: 3, pts: 6733404537, ccData: 33314 }, - { type: 2, pts: 6733404537, ccData: 29281 }, - { type: 3, pts: 6733407540, ccData: 49698 }, - { type: 2, pts: 6733407540, ccData: 31009 }, - { type: 3, pts: 6733410543, ccData: 546 }, - { type: 2, pts: 6733410543, ccData: 24320 }, - { type: 3, pts: 6733413546, ccData: 16929 }, - { type: 2, pts: 6733413546, ccData: 32512 }, - { type: 3, pts: 6733416549, ccData: 33314 }, - { type: 2, pts: 6733416549, ccData: 35841 }, - { type: 3, pts: 6733422555, ccData: 49698 }, - { type: 2, pts: 6733422555, ccData: 35074 }, - { type: 3, pts: 6733668801, ccData: 2609 }, - { type: 2, pts: 6733668801, ccData: 38939 }, - { type: 2, pts: 6733668801, ccData: 17920 }, - { type: 2, pts: 6733668801, ccData: 31 }, - { type: 2, pts: 6733668801, ccData: 5264 }, - { type: 2, pts: 6733668801, ccData: 1283 }, - { type: 2, pts: 6733668801, ccData: 37162 }, - { type: 2, pts: 6733668801, ccData: 42 }, - { type: 2, pts: 6733668801, ccData: 37376 }, - { type: 2, pts: 6733668801, ccData: 1024 }, - { type: 3, pts: 6733674807, ccData: 17187 }, - { type: 2, pts: 6733674807, ccData: 37376 }, - { type: 2, pts: 6733674807, ccData: 1792 }, - { type: 3, pts: 6733680813, ccData: 33314 }, - { type: 2, pts: 6733680813, ccData: 20585 }, - { type: 3, pts: 6733683816, ccData: 49698 }, - { type: 2, pts: 6733683816, ccData: 28267 }, - { type: 3, pts: 6733686819, ccData: 546 }, - { type: 2, pts: 6733686819, ccData: 11359 }, - { type: 3, pts: 6733689822, ccData: 16930 }, - { type: 2, pts: 6733689822, ccData: 28777 }, - { type: 3, pts: 6733692825, ccData: 33314 }, - { type: 2, pts: 6733692825, ccData: 28267 }, - { type: 3, pts: 6733695828, ccData: 49698 }, - { type: 2, pts: 6733695828, ccData: 24424 }, - { type: 3, pts: 6733698831, ccData: 546 }, - { type: 2, pts: 6733698831, ccData: 28527 }, - { type: 3, pts: 6733701834, ccData: 16930 }, - { type: 2, pts: 6733701834, ccData: 29281 }, - { type: 3, pts: 6733704837, ccData: 33314 }, - { type: 2, pts: 6733704837, ccData: 31009 }, - { type: 3, pts: 6733707840, ccData: 49698 }, - { type: 2, pts: 6733707840, ccData: 35842 }, - { type: 3, pts: 6733713846, ccData: 546 }, - { type: 2, pts: 6733713846, ccData: 35073 }, - { type: 3, pts: 6733942074, ccData: 16930 }, - { type: 2, pts: 6733942074, ccData: 35841 }, - { type: 3, pts: 6734146278, ccData: 35377 }, - { type: 2, pts: 6734146278, ccData: 38939 }, - { type: 2, pts: 6734146278, ccData: 16640 }, - { type: 2, pts: 6734146278, ccData: 31 }, - { type: 2, pts: 6734146278, ccData: 5264 }, - { type: 2, pts: 6734146278, ccData: 1283 }, - { type: 2, pts: 6734146278, ccData: 37162 }, - { type: 2, pts: 6734146278, ccData: 0 }, - { type: 2, pts: 6734146278, ccData: 37376 }, - { type: 2, pts: 6734146278, ccData: 2048 }, - { type: 3, pts: 6734152284, ccData: 49955 }, - { type: 2, pts: 6734152284, ccData: 37376 }, - { type: 2, pts: 6734152284, ccData: 2304 }, - { type: 3, pts: 6734158290, ccData: 546 }, - { type: 2, pts: 6734158290, ccData: 20553 }, - { type: 3, pts: 6734161293, ccData: 16930 }, - { type: 2, pts: 6734161293, ccData: 20043 }, - { type: 3, pts: 6734164296, ccData: 33314 }, - { type: 2, pts: 6734164296, ccData: 16716 }, - { type: 3, pts: 6734167299, ccData: 49698 }, - { type: 2, pts: 6734167299, ccData: 18755 }, - { type: 3, pts: 6734170302, ccData: 546 }, - { type: 2, pts: 6734170302, ccData: 18767 }, - { type: 3, pts: 6734173305, ccData: 16930 }, - { type: 2, pts: 6734173305, ccData: 21843 }, - { type: 3, pts: 6734176308, ccData: 33314 }, - { type: 2, pts: 6734176308, ccData: 14848 }, - { type: 3, pts: 6734179311, ccData: 51761 }, - { type: 2, pts: 6734179311, ccData: 38939 }, - { type: 2, pts: 6734179311, ccData: 16640 }, - { type: 2, pts: 6734179311, ccData: 287 }, - { type: 2, pts: 6734179311, ccData: 4240 }, - { type: 2, pts: 6734179311, ccData: 1283 }, - { type: 2, pts: 6734179311, ccData: 37162 }, - { type: 2, pts: 6734179311, ccData: 0 }, - { type: 2, pts: 6734179311, ccData: 37377 }, - { type: 2, pts: 6734179311, ccData: 2048 }, - { type: 3, pts: 6734185317, ccData: 803 }, - { type: 2, pts: 6734185317, ccData: 37377 }, - { type: 2, pts: 6734185317, ccData: 2304 }, - { type: 3, pts: 6734191323, ccData: 16930 }, - { type: 2, pts: 6734191323, ccData: 8772 }, - { type: 3, pts: 6734194326, ccData: 33314 }, - { type: 2, pts: 6734194326, ccData: 29285 }, - { type: 3, pts: 6734197329, ccData: 49698 }, - { type: 2, pts: 6734197329, ccData: 24941 }, - { type: 3, pts: 6734200332, ccData: 546 }, - { type: 2, pts: 6734200332, ccData: 24403 }, - { type: 3, pts: 6734203335, ccData: 16930 }, - { type: 2, pts: 6734203335, ccData: 24940 }, - { type: 3, pts: 6734206338, ccData: 33314 }, - { type: 2, pts: 6734206338, ccData: 28526 }, - { type: 3, pts: 6734209341, ccData: 49698 }, - { type: 2, pts: 6734209341, ccData: 11810 }, - { type: 3, pts: 6734218350, ccData: 546 }, - { type: 2, pts: 6734218350, ccData: 35073 }, - { type: 3, pts: 6734425557, ccData: 16930 }, - { type: 2, pts: 6734425557, ccData: 35841 }, - { type: 3, pts: 6734488620, ccData: 35377 }, - { type: 2, pts: 6734488620, ccData: 38939 }, - { type: 2, pts: 6734488620, ccData: 15360 }, - { type: 2, pts: 6734488620, ccData: 31 }, - { type: 2, pts: 6734488620, ccData: 5264 }, - { type: 2, pts: 6734488620, ccData: 1283 }, - { type: 2, pts: 6734488620, ccData: 37162 }, - { type: 2, pts: 6734488620, ccData: 0 }, - { type: 2, pts: 6734488620, ccData: 37376 }, - { type: 2, pts: 6734488620, ccData: 2048 }, - { type: 3, pts: 6734494626, ccData: 49955 }, - { type: 2, pts: 6734494626, ccData: 37376 }, - { type: 2, pts: 6734494626, ccData: 2560 }, - { type: 3, pts: 6734500632, ccData: 546 }, - { type: 2, pts: 6734500632, ccData: 10358 }, - { type: 3, pts: 6734503635, ccData: 16930 }, - { type: 2, pts: 6734503635, ccData: 28521 }, - { type: 3, pts: 6734506638, ccData: 33314 }, - { type: 2, pts: 6734506638, ccData: 25445 }, - { type: 3, pts: 6734509641, ccData: 49698 }, - { type: 2, pts: 6734509641, ccData: 28534 }, - { type: 3, pts: 6734512644, ccData: 546 }, - { type: 2, pts: 6734512644, ccData: 25970 }, - { type: 3, pts: 6734515647, ccData: 16930 }, - { type: 2, pts: 6734515647, ccData: 10554 }, - { type: 3, pts: 6734518650, ccData: 35377 }, - { type: 2, pts: 6734518650, ccData: 38939 }, - { type: 2, pts: 6734518650, ccData: 15360 }, - { type: 2, pts: 6734518650, ccData: 287 }, - { type: 2, pts: 6734518650, ccData: 4240 }, - { type: 2, pts: 6734518650, ccData: 1283 }, - { type: 2, pts: 6734518650, ccData: 37162 }, - { type: 2, pts: 6734518650, ccData: 0 }, - { type: 2, pts: 6734518650, ccData: 37377 }, - { type: 2, pts: 6734518650, ccData: 1024 }, - { type: 3, pts: 6734524656, ccData: 49698 }, - { type: 2, pts: 6734524656, ccData: 21615 }, - { type: 3, pts: 6734527659, ccData: 546 }, - { type: 2, pts: 6734527659, ccData: 25697 }, - { type: 3, pts: 6734530662, ccData: 16930 }, - { type: 2, pts: 6734530662, ccData: 31071 }, - { type: 3, pts: 6734533665, ccData: 33314 }, - { type: 2, pts: 6734533665, ccData: 19823 }, - { type: 3, pts: 6734536668, ccData: 49698 }, - { type: 2, pts: 6734536668, ccData: 28013 }, - { type: 3, pts: 6734539671, ccData: 546 }, - { type: 2, pts: 6734539671, ccData: 31015 }, - { type: 3, pts: 6734542674, ccData: 16930 }, - { type: 2, pts: 6734542674, ccData: 29535 }, - { type: 3, pts: 6734545677, ccData: 33314 }, - { type: 2, pts: 6734545677, ccData: 29793 }, - { type: 3, pts: 6734548680, ccData: 49698 }, - { type: 2, pts: 6734548680, ccData: 27497 }, - { type: 3, pts: 6734551683, ccData: 546 }, - { type: 2, pts: 6734551683, ccData: 28263 }, - { type: 3, pts: 6734554686, ccData: 16930 }, - { type: 2, pts: 6734554686, ccData: 24429 }, - { type: 3, pts: 6734557689, ccData: 33314 }, - { type: 2, pts: 6734557689, ccData: 25856 }, - { type: 3, pts: 6734560692, ccData: 51761 }, - { type: 2, pts: 6734560692, ccData: 38939 }, - { type: 2, pts: 6734560692, ccData: 15360 }, - { type: 2, pts: 6734560692, ccData: 543 }, - { type: 2, pts: 6734560692, ccData: 4240 }, - { type: 2, pts: 6734560692, ccData: 1283 }, - { type: 2, pts: 6734560692, ccData: 37162 }, - { type: 2, pts: 6734560692, ccData: 0 }, - { type: 2, pts: 6734560692, ccData: 37378 }, - { type: 2, pts: 6734560692, ccData: 2048 }, - { type: 3, pts: 6734566698, ccData: 546 }, - { type: 2, pts: 6734566698, ccData: 29807 }, - { type: 3, pts: 6734569701, ccData: 16930 }, - { type: 2, pts: 6734569701, ccData: 24423 }, - { type: 3, pts: 6734572704, ccData: 33314 }, - { type: 2, pts: 6734572704, ccData: 25972 }, - { type: 3, pts: 6734575707, ccData: 49698 }, - { type: 2, pts: 6734575707, ccData: 24417 }, - { type: 3, pts: 6734578710, ccData: 546 }, - { type: 2, pts: 6734578710, ccData: 24424 }, - { type: 3, pts: 6734581713, ccData: 16930 }, - { type: 2, pts: 6734581713, ccData: 24937 }, - { type: 3, pts: 6734584716, ccData: 33314 }, - { type: 2, pts: 6734584716, ccData: 29283 }, - { type: 3, pts: 6734587719, ccData: 49698 }, - { type: 2, pts: 6734587719, ccData: 30068 }, - { type: 3, pts: 6734596728, ccData: 546 }, - { type: 2, pts: 6734596728, ccData: 35073 }, - { type: 3, pts: 6734692824, ccData: 18993 }, - { type: 2, pts: 6734692824, ccData: 39195 }, - { type: 2, pts: 6734692824, ccData: 16640 }, - { type: 2, pts: 6734692824, ccData: 31 }, - { type: 2, pts: 6734692824, ccData: 5264 }, - { type: 2, pts: 6734692824, ccData: 1283 }, - { type: 2, pts: 6734692824, ccData: 37162 }, - { type: 2, pts: 6734692824, ccData: 42 }, - { type: 2, pts: 6734692824, ccData: 37376 }, - { type: 2, pts: 6734692824, ccData: 1024 }, - { type: 3, pts: 6734698830, ccData: 33314 }, - { type: 2, pts: 6734698830, ccData: 24948 }, - { type: 3, pts: 6734701833, ccData: 49698 }, - { type: 2, pts: 6734701833, ccData: 24400 }, - { type: 3, pts: 6734704836, ccData: 546 }, - { type: 2, pts: 6734704836, ccData: 26990 }, - { type: 3, pts: 6734707839, ccData: 16930 }, - { type: 2, pts: 6734707839, ccData: 27510 }, - { type: 3, pts: 6734710842, ccData: 33314 }, - { type: 2, pts: 6734710842, ccData: 26988 }, - { type: 3, pts: 6734713845, ccData: 49698 }, - { type: 2, pts: 6734713845, ccData: 27749 }, - { type: 3, pts: 6734716848, ccData: 546 }, - { type: 2, pts: 6734716848, ccData: 10099 }, - { type: 3, pts: 6734719851, ccData: 16930 }, - { type: 2, pts: 6734719851, ccData: 24418 }, - { type: 3, pts: 6734722854, ccData: 33314 }, - { type: 2, pts: 6734722854, ccData: 29281 }, - { type: 3, pts: 6734725857, ccData: 49698 }, - { type: 2, pts: 6734725857, ccData: 28260 }, - { type: 3, pts: 6734728860, ccData: 546 }, - { type: 2, pts: 6734728860, ccData: 11630 }, - { type: 3, pts: 6734731863, ccData: 16930 }, - { type: 2, pts: 6734731863, ccData: 25975 }, - { type: 3, pts: 6734734866, ccData: 35377 }, - { type: 2, pts: 6734734866, ccData: 39195 }, - { type: 2, pts: 6734734866, ccData: 16640 }, - { type: 2, pts: 6734734866, ccData: 287 }, - { type: 2, pts: 6734734866, ccData: 4240 }, - { type: 2, pts: 6734734866, ccData: 1283 }, - { type: 2, pts: 6734734866, ccData: 37162 }, - { type: 2, pts: 6734734866, ccData: 0 }, - { type: 2, pts: 6734734866, ccData: 37377 }, - { type: 2, pts: 6734734866, ccData: 2048 }, - { type: 3, pts: 6734740872, ccData: 49955 }, - { type: 2, pts: 6734740872, ccData: 37377 }, - { type: 2, pts: 6734740872, ccData: 2560 }, - { type: 3, pts: 6734746878, ccData: 546 }, - { type: 2, pts: 6734746878, ccData: 26721 }, - { type: 3, pts: 6734749881, ccData: 16930 }, - { type: 2, pts: 6734749881, ccData: 26994 }, - { type: 3, pts: 6734752884, ccData: 33314 }, - { type: 2, pts: 6734752884, ccData: 24435 }, - { type: 3, pts: 6734755887, ccData: 49698 }, - { type: 2, pts: 6734755887, ccData: 24940 }, - { type: 3, pts: 6734758890, ccData: 546 }, - { type: 2, pts: 6734758890, ccData: 28526 }, - { type: 3, pts: 6734761893, ccData: 16930 }, - { type: 2, pts: 6734761893, ccData: 11776 }, - { type: 3, pts: 6734764896, ccData: 33314 }, - { type: 2, pts: 6734764896, ccData: 35841 }, - { type: 3, pts: 6734770902, ccData: 49698 }, - { type: 2, pts: 6734770902, ccData: 35074 }, - { type: 3, pts: 6734924055, ccData: 2609 }, - { type: 2, pts: 6734924055, ccData: 38939 }, - { type: 2, pts: 6734924055, ccData: 17920 }, - { type: 2, pts: 6734924055, ccData: 31 }, - { type: 2, pts: 6734924055, ccData: 5264 }, - { type: 2, pts: 6734924055, ccData: 1283 }, - { type: 2, pts: 6734924055, ccData: 37162 }, - { type: 2, pts: 6734924055, ccData: 42 }, - { type: 2, pts: 6734924055, ccData: 37376 }, - { type: 2, pts: 6734924055, ccData: 0 }, - { type: 3, pts: 6734930061, ccData: 17187 }, - { type: 2, pts: 6734930061, ccData: 37376 }, - { type: 2, pts: 6734930061, ccData: 512 }, - { type: 3, pts: 6734936067, ccData: 33314 }, - { type: 2, pts: 6734936067, ccData: 18804 }, - { type: 3, pts: 6734939070, ccData: 49698 }, - { type: 2, pts: 6734939070, ccData: 10099 }, - { type: 3, pts: 6734942073, ccData: 546 }, - { type: 2, pts: 6734942073, ccData: 24419 }, - { type: 3, pts: 6734945076, ccData: 16930 }, - { type: 2, pts: 6734945076, ccData: 24940 }, - { type: 3, pts: 6734948079, ccData: 33314 }, - { type: 2, pts: 6734948079, ccData: 27749 }, - { type: 3, pts: 6734951082, ccData: 49698 }, - { type: 2, pts: 6734951082, ccData: 25695 }, - { type: 3, pts: 6734954085, ccData: 546 }, - { type: 2, pts: 6734954085, ccData: 29800 }, - { type: 3, pts: 6734957088, ccData: 16930 }, - { type: 2, pts: 6734957088, ccData: 25951 }, - { type: 3, pts: 6734960091, ccData: 33314 }, - { type: 2, pts: 6734960091, ccData: 17522 }, - { type: 3, pts: 6734963094, ccData: 49698 }, - { type: 2, pts: 6734963094, ccData: 25953 }, - { type: 3, pts: 6734966097, ccData: 546 }, - { type: 2, pts: 6734966097, ccData: 27999 }, - { type: 3, pts: 6734969100, ccData: 16930 }, - { type: 2, pts: 6734969100, ccData: 21345 }, - { type: 3, pts: 6734972103, ccData: 33314 }, - { type: 2, pts: 6734972103, ccData: 27759 }, - { type: 3, pts: 6734975106, ccData: 49698 }, - { type: 2, pts: 6734975106, ccData: 28206 }, - { type: 3, pts: 6734978109, ccData: 546 }, - { type: 2, pts: 6734978109, ccData: 35842 }, - { type: 3, pts: 6734984115, ccData: 16930 }, - { type: 2, pts: 6734984115, ccData: 35073 }, - { type: 3, pts: 6735245376, ccData: 35377 }, - { type: 2, pts: 6735245376, ccData: 39195 }, - { type: 2, pts: 6735245376, ccData: 17920 }, - { type: 2, pts: 6735245376, ccData: 31 }, - { type: 2, pts: 6735245376, ccData: 5264 }, - { type: 2, pts: 6735245376, ccData: 1283 }, - { type: 2, pts: 6735245376, ccData: 37162 }, - { type: 2, pts: 6735245376, ccData: 42 }, - { type: 2, pts: 6735245376, ccData: 37376 }, - { type: 2, pts: 6735245376, ccData: 3072 }, - { type: 3, pts: 6735251382, ccData: 49955 }, - { type: 2, pts: 6735251382, ccData: 37376 }, - { type: 2, pts: 6735251382, ccData: 3584 }, - { type: 3, pts: 6735257388, ccData: 545 }, - { type: 2, pts: 6735257388, ccData: 32512 }, - { type: 3, pts: 6735260391, ccData: 16930 }, - { type: 2, pts: 6735260391, ccData: 24320 }, - { type: 3, pts: 6735263394, ccData: 33313 }, - { type: 2, pts: 6735263394, ccData: 32512 }, - { type: 3, pts: 6735266397, ccData: 49698 }, - { type: 2, pts: 6735266397, ccData: 35841 }, - { type: 3, pts: 6735272403, ccData: 546 }, - { type: 2, pts: 6735272403, ccData: 35074 }, - { type: 3, pts: 6735452583, ccData: 18993 }, - { type: 2, pts: 6735452583, ccData: 38939 }, - { type: 2, pts: 6735452583, ccData: 17920 }, - { type: 2, pts: 6735452583, ccData: 31 }, - { type: 2, pts: 6735452583, ccData: 5264 }, - { type: 2, pts: 6735452583, ccData: 1283 }, - { type: 2, pts: 6735452583, ccData: 37162 }, - { type: 2, pts: 6735452583, ccData: 42 }, - { type: 2, pts: 6735452583, ccData: 37376 }, - { type: 2, pts: 6735452583, ccData: 0 }, - { type: 3, pts: 6735458589, ccData: 33571 }, - { type: 2, pts: 6735458589, ccData: 37376 }, - { type: 2, pts: 6735458589, ccData: 512 }, - { type: 3, pts: 6735464595, ccData: 49698 }, - { type: 2, pts: 6735464595, ccData: 21089 }, - { type: 3, pts: 6735467598, ccData: 546 }, - { type: 2, pts: 6735467598, ccData: 26209 }, - { type: 3, pts: 6735470601, ccData: 16930 }, - { type: 2, pts: 6735470601, ccData: 25964 }, - { type: 3, pts: 6735473604, ccData: 33314 }, - { type: 2, pts: 6735473604, ccData: 16128 }, - { type: 3, pts: 6735476607, ccData: 49698 }, - { type: 2, pts: 6735476607, ccData: 35842 }, - { type: 3, pts: 6735482613, ccData: 546 }, - { type: 2, pts: 6735482613, ccData: 35073 }, - { type: 3, pts: 6735542673, ccData: 18993 }, - { type: 2, pts: 6735542673, ccData: 39195 }, - { type: 2, pts: 6735542673, ccData: 17920 }, - { type: 2, pts: 6735542673, ccData: 31 }, - { type: 2, pts: 6735542673, ccData: 5264 }, - { type: 2, pts: 6735542673, ccData: 1283 }, - { type: 2, pts: 6735542673, ccData: 37162 }, - { type: 2, pts: 6735542673, ccData: 42 }, - { type: 2, pts: 6735542673, ccData: 37376 }, - { type: 2, pts: 6735542673, ccData: 0 }, - { type: 3, pts: 6735548679, ccData: 33571 }, - { type: 2, pts: 6735548679, ccData: 37376 }, - { type: 2, pts: 6735548679, ccData: 768 }, - { type: 3, pts: 6735554685, ccData: 49698 }, - { type: 2, pts: 6735554685, ccData: 19809 }, - { type: 3, pts: 6735557688, ccData: 546 }, - { type: 2, pts: 6735557688, ccData: 31087 }, - { type: 3, pts: 6735560691, ccData: 16930 }, - { type: 2, pts: 6735560691, ccData: 29279 }, - { type: 3, pts: 6735563694, ccData: 33314 }, - { type: 2, pts: 6735563694, ccData: 19809 }, - { type: 3, pts: 6735566697, ccData: 49698 }, - { type: 2, pts: 6735566697, ccData: 29300 }, - { type: 3, pts: 6735569700, ccData: 546 }, - { type: 2, pts: 6735569700, ccData: 26990 }, - { type: 3, pts: 6735572703, ccData: 16930 }, - { type: 2, pts: 6735572703, ccData: 25978 }, - { type: 3, pts: 6735575706, ccData: 33314 }, - { type: 2, pts: 6735575706, ccData: 16128 }, - { type: 3, pts: 6735578709, ccData: 49698 }, - { type: 2, pts: 6735578709, ccData: 35841 }, - { type: 3, pts: 6735584715, ccData: 546 }, - { type: 2, pts: 6735584715, ccData: 35074 }, - { type: 3, pts: 6735707838, ccData: 18993 }, - { type: 2, pts: 6735707838, ccData: 38939 }, - { type: 2, pts: 6735707838, ccData: 17920 }, - { type: 2, pts: 6735707838, ccData: 31 }, - { type: 2, pts: 6735707838, ccData: 5264 }, - { type: 2, pts: 6735707838, ccData: 1283 }, - { type: 2, pts: 6735707838, ccData: 37162 }, - { type: 2, pts: 6735707838, ccData: 42 }, - { type: 2, pts: 6735707838, ccData: 37376 }, - { type: 2, pts: 6735707838, ccData: 0 }, - { type: 3, pts: 6735713844, ccData: 33571 }, - { type: 2, pts: 6735713844, ccData: 37376 }, - { type: 2, pts: 6735713844, ccData: 768 }, - { type: 3, pts: 6735719850, ccData: 49698 }, - { type: 2, pts: 6735719850, ccData: 18803 }, - { type: 3, pts: 6735722853, ccData: 546 }, - { type: 2, pts: 6735722853, ccData: 24436 }, - { type: 3, pts: 6735725856, ccData: 16930 }, - { type: 2, pts: 6735725856, ccData: 26721 }, - { type: 3, pts: 6735728859, ccData: 33314 }, - { type: 2, pts: 6735728859, ccData: 29791 }, - { type: 3, pts: 6735731862, ccData: 49698 }, - { type: 2, pts: 6735731862, ccData: 31087 }, - { type: 3, pts: 6735734865, ccData: 546 }, - { type: 2, pts: 6735734865, ccData: 30015 }, - { type: 3, pts: 6735737868, ccData: 16930 }, - { type: 2, pts: 6735737868, ccData: 35842 }, - { type: 3, pts: 6735743874, ccData: 33314 }, - { type: 2, pts: 6735743874, ccData: 35073 }, - { type: 3, pts: 6735827958, ccData: 51761 }, - { type: 2, pts: 6735827958, ccData: 39195 }, - { type: 2, pts: 6735827958, ccData: 17920 }, - { type: 2, pts: 6735827958, ccData: 31 }, - { type: 2, pts: 6735827958, ccData: 5264 }, - { type: 2, pts: 6735827958, ccData: 1283 }, - { type: 2, pts: 6735827958, ccData: 37162 }, - { type: 2, pts: 6735827958, ccData: 42 }, - { type: 2, pts: 6735827958, ccData: 37376 }, - { type: 2, pts: 6735827958, ccData: 3072 }, - { type: 3, pts: 6735833964, ccData: 803 }, - { type: 2, pts: 6735833964, ccData: 37376 }, - { type: 2, pts: 6735833964, ccData: 3584 }, - { type: 3, pts: 6735839970, ccData: 16930 }, - { type: 2, pts: 6735839970, ccData: 22885 }, - { type: 3, pts: 6735842973, ccData: 33314 }, - { type: 2, pts: 6735842973, ccData: 29473 }, - { type: 3, pts: 6735845976, ccData: 49698 }, - { type: 2, pts: 6735845976, ccData: 35841 }, - { type: 3, pts: 6735851982, ccData: 546 }, - { type: 2, pts: 6735851982, ccData: 35074 }, - { type: 3, pts: 6735891021, ccData: 18993 }, - { type: 2, pts: 6735891021, ccData: 38939 }, - { type: 2, pts: 6735891021, ccData: 17920 }, - { type: 2, pts: 6735891021, ccData: 31 }, - { type: 2, pts: 6735891021, ccData: 5264 }, - { type: 2, pts: 6735891021, ccData: 1283 }, - { type: 2, pts: 6735891021, ccData: 37162 }, - { type: 2, pts: 6735891021, ccData: 42 }, - { type: 2, pts: 6735891021, ccData: 37376 }, - { type: 2, pts: 6735891021, ccData: 0 }, - { type: 3, pts: 6735897027, ccData: 33571 }, - { type: 2, pts: 6735897027, ccData: 37376 }, - { type: 2, pts: 6735897027, ccData: 512 }, - { type: 3, pts: 6735903033, ccData: 49698 }, - { type: 2, pts: 6735903033, ccData: 21608 }, - { type: 3, pts: 6735906036, ccData: 546 }, - { type: 2, pts: 6735906036, ccData: 26995 }, - { type: 3, pts: 6735909039, ccData: 16930 }, - { type: 2, pts: 6735909039, ccData: 24424 }, - { type: 3, pts: 6735912042, ccData: 33314 }, - { type: 2, pts: 6735912042, ccData: 24937 }, - { type: 3, pts: 6735915045, ccData: 49698 }, - { type: 2, pts: 6735915045, ccData: 29279 }, - { type: 3, pts: 6735918048, ccData: 546 }, - { type: 2, pts: 6735918048, ccData: 29537 }, - { type: 3, pts: 6735921051, ccData: 16930 }, - { type: 2, pts: 6735921051, ccData: 27759 }, - { type: 3, pts: 6735924054, ccData: 33314 }, - { type: 2, pts: 6735924054, ccData: 28255 }, - { type: 3, pts: 6735927057, ccData: 49698 }, - { type: 2, pts: 6735927057, ccData: 26995 }, - { type: 3, pts: 6735930060, ccData: 546 }, - { type: 2, pts: 6735930060, ccData: 24435 }, - { type: 3, pts: 6735933063, ccData: 16930 }, - { type: 2, pts: 6735933063, ccData: 28511 }, - { type: 3, pts: 6735936066, ccData: 33314 }, - { type: 2, pts: 6735936066, ccData: 25455 }, - { type: 3, pts: 6735939069, ccData: 49698 }, - { type: 2, pts: 6735939069, ccData: 28524 }, - { type: 3, pts: 6735942072, ccData: 546 }, - { type: 2, pts: 6735942072, ccData: 11776 }, - { type: 3, pts: 6735945075, ccData: 16930 }, - { type: 2, pts: 6735945075, ccData: 35842 }, - { type: 3, pts: 6735951081, ccData: 33314 }, - { type: 2, pts: 6735951081, ccData: 35073 }, - { type: 3, pts: 6736128258, ccData: 51761 }, - { type: 2, pts: 6736128258, ccData: 39195 }, - { type: 2, pts: 6736128258, ccData: 16640 }, - { type: 2, pts: 6736128258, ccData: 31 }, - { type: 2, pts: 6736128258, ccData: 5264 }, - { type: 2, pts: 6736128258, ccData: 1283 }, - { type: 2, pts: 6736128258, ccData: 37162 }, - { type: 2, pts: 6736128258, ccData: 42 }, - { type: 2, pts: 6736128258, ccData: 37376 }, - { type: 2, pts: 6736128258, ccData: 0 }, - { type: 3, pts: 6736134264, ccData: 803 }, - { type: 2, pts: 6736134264, ccData: 37376 }, - { type: 2, pts: 6736134264, ccData: 768 }, - { type: 3, pts: 6736140270, ccData: 16930 }, - { type: 2, pts: 6736140270, ccData: 22895 }, - { type: 3, pts: 6736143273, ccData: 33314 }, - { type: 2, pts: 6736143273, ccData: 30047 }, - { type: 3, pts: 6736146276, ccData: 49698 }, - { type: 2, pts: 6736146276, ccData: 25441 }, - { type: 3, pts: 6736149279, ccData: 546 }, - { type: 2, pts: 6736149279, ccData: 28255 }, - { type: 3, pts: 6736152282, ccData: 16930 }, - { type: 2, pts: 6736152282, ccData: 26721 }, - { type: 3, pts: 6736155285, ccData: 33314 }, - { type: 2, pts: 6736155285, ccData: 30309 }, - { type: 3, pts: 6736158288, ccData: 49698 }, - { type: 2, pts: 6736158288, ccData: 24417 }, - { type: 3, pts: 6736161291, ccData: 546 }, - { type: 2, pts: 6736161291, ccData: 28281 }, - { type: 3, pts: 6736164294, ccData: 16930 }, - { type: 2, pts: 6736164294, ccData: 24424 }, - { type: 3, pts: 6736167297, ccData: 33314 }, - { type: 2, pts: 6736167297, ccData: 24937 }, - { type: 3, pts: 6736170300, ccData: 49698 }, - { type: 2, pts: 6736170300, ccData: 29299 }, - { type: 3, pts: 6736173303, ccData: 546 }, - { type: 2, pts: 6736173303, ccData: 29817 }, - { type: 3, pts: 6736176306, ccData: 16930 }, - { type: 2, pts: 6736176306, ccData: 27749 }, - { type: 3, pts: 6736179309, ccData: 35377 }, - { type: 2, pts: 6736179309, ccData: 39195 }, - { type: 2, pts: 6736179309, ccData: 16640 }, - { type: 2, pts: 6736179309, ccData: 287 }, - { type: 2, pts: 6736179309, ccData: 4240 }, - { type: 2, pts: 6736179309, ccData: 1283 }, - { type: 2, pts: 6736179309, ccData: 37162 }, - { type: 2, pts: 6736179309, ccData: 0 }, - { type: 2, pts: 6736179309, ccData: 37377 }, - { type: 2, pts: 6736179309, ccData: 2048 }, - { type: 3, pts: 6736185315, ccData: 49955 }, - { type: 2, pts: 6736185315, ccData: 37377 }, - { type: 2, pts: 6736185315, ccData: 2304 }, - { type: 3, pts: 6736191321, ccData: 546 }, - { type: 2, pts: 6736191321, ccData: 31087 }, - { type: 3, pts: 6736194324, ccData: 16930 }, - { type: 2, pts: 6736194324, ccData: 30047 }, - { type: 3, pts: 6736197327, ccData: 33314 }, - { type: 2, pts: 6736197327, ccData: 25714 }, - { type: 3, pts: 6736200330, ccData: 49698 }, - { type: 2, pts: 6736200330, ccData: 25953 }, - { type: 3, pts: 6736203333, ccData: 546 }, - { type: 2, pts: 6736203333, ccData: 27999 }, - { type: 3, pts: 6736206336, ccData: 16930 }, - { type: 2, pts: 6736206336, ccData: 28518 }, - { type: 3, pts: 6736209339, ccData: 33314 }, - { type: 2, pts: 6736209339, ccData: 11776 }, - { type: 3, pts: 6736212342, ccData: 49698 }, - { type: 2, pts: 6736212342, ccData: 35841 }, - { type: 3, pts: 6736218348, ccData: 546 }, - { type: 2, pts: 6736218348, ccData: 35074 }, - { type: 3, pts: 6736365495, ccData: 18993 }, - { type: 2, pts: 6736365495, ccData: 38939 }, - { type: 2, pts: 6736365495, ccData: 16640 }, - { type: 2, pts: 6736365495, ccData: 31 }, - { type: 2, pts: 6736365495, ccData: 5264 }, - { type: 2, pts: 6736365495, ccData: 1283 }, - { type: 2, pts: 6736365495, ccData: 37162 }, - { type: 2, pts: 6736365495, ccData: 42 }, - { type: 2, pts: 6736365495, ccData: 37376 }, - { type: 2, pts: 6736365495, ccData: 0 }, - { type: 3, pts: 6736371501, ccData: 33571 }, - { type: 2, pts: 6736371501, ccData: 37376 }, - { type: 2, pts: 6736371501, ccData: 512 }, - { type: 3, pts: 6736377507, ccData: 49698 }, - { type: 2, pts: 6736377507, ccData: 21359 }, - { type: 3, pts: 6736380510, ccData: 546 }, - { type: 2, pts: 6736380510, ccData: 24436 }, - { type: 3, pts: 6736383513, ccData: 16930 }, - { type: 2, pts: 6736383513, ccData: 26721 }, - { type: 3, pts: 6736386516, ccData: 33314 }, - { type: 2, pts: 6736386516, ccData: 29735 }, - { type: 3, pts: 6736389519, ccData: 49698 }, - { type: 2, pts: 6736389519, ccData: 29535 }, - { type: 3, pts: 6736392522, ccData: 546 }, - { type: 2, pts: 6736392522, ccData: 30568 }, - { type: 3, pts: 6736395525, ccData: 16930 }, - { type: 2, pts: 6736395525, ccData: 30976 }, - { type: 3, pts: 6736398528, ccData: 35377 }, - { type: 2, pts: 6736398528, ccData: 38939 }, - { type: 2, pts: 6736398528, ccData: 16640 }, - { type: 2, pts: 6736398528, ccData: 287 }, - { type: 2, pts: 6736398528, ccData: 4240 }, - { type: 2, pts: 6736398528, ccData: 1283 }, - { type: 2, pts: 6736398528, ccData: 37162 }, - { type: 2, pts: 6736398528, ccData: 0 }, - { type: 2, pts: 6736398528, ccData: 37377 }, - { type: 2, pts: 6736398528, ccData: 0 }, - { type: 3, pts: 6736404534, ccData: 49955 }, - { type: 2, pts: 6736404534, ccData: 37377 }, - { type: 2, pts: 6736404534, ccData: 512 }, - { type: 3, pts: 6736410540, ccData: 546 }, - { type: 2, pts: 6736410540, ccData: 26996 }, - { type: 3, pts: 6736413543, ccData: 16930 }, - { type: 2, pts: 6736413543, ccData: 10099 }, - { type: 3, pts: 6736416546, ccData: 33314 }, - { type: 2, pts: 6736416546, ccData: 24419 }, - { type: 3, pts: 6736419549, ccData: 49698 }, - { type: 2, pts: 6736419549, ccData: 24940 }, - { type: 3, pts: 6736422552, ccData: 546 }, - { type: 2, pts: 6736422552, ccData: 27749 }, - { type: 3, pts: 6736425555, ccData: 16930 }, - { type: 2, pts: 6736425555, ccData: 25695 }, - { type: 3, pts: 6736428558, ccData: 33314 }, - { type: 2, pts: 6736428558, ccData: 29800 }, - { type: 3, pts: 6736431561, ccData: 49698 }, - { type: 2, pts: 6736431561, ccData: 25951 }, - { type: 3, pts: 6736434564, ccData: 546 }, - { type: 2, pts: 6736434564, ccData: 17522 }, - { type: 3, pts: 6736437567, ccData: 16930 }, - { type: 2, pts: 6736437567, ccData: 25953 }, - { type: 3, pts: 6736440570, ccData: 33314 }, - { type: 2, pts: 6736440570, ccData: 27999 }, - { type: 3, pts: 6736443573, ccData: 49698 }, - { type: 2, pts: 6736443573, ccData: 21345 }, - { type: 3, pts: 6736446576, ccData: 546 }, - { type: 2, pts: 6736446576, ccData: 27759 }, - { type: 3, pts: 6736449579, ccData: 16930 }, - { type: 2, pts: 6736449579, ccData: 28206 }, - { type: 3, pts: 6736452582, ccData: 33314 }, - { type: 2, pts: 6736452582, ccData: 35842 }, - { type: 3, pts: 6736458588, ccData: 49698 }, - { type: 2, pts: 6736458588, ccData: 35073 }, - { type: 3, pts: 6736695825, ccData: 2609 }, - { type: 2, pts: 6736695825, ccData: 39195 }, - { type: 2, pts: 6736695825, ccData: 16640 }, - { type: 2, pts: 6736695825, ccData: 31 }, - { type: 2, pts: 6736695825, ccData: 5264 }, - { type: 2, pts: 6736695825, ccData: 1283 }, - { type: 2, pts: 6736695825, ccData: 37162 }, - { type: 2, pts: 6736695825, ccData: 42 }, - { type: 2, pts: 6736695825, ccData: 37376 }, - { type: 2, pts: 6736695825, ccData: 1024 }, - { type: 3, pts: 6736701831, ccData: 17187 }, - { type: 2, pts: 6736701831, ccData: 37376 }, - { type: 2, pts: 6736701831, ccData: 1280 }, - { type: 3, pts: 6736707837, ccData: 33314 }, - { type: 2, pts: 6736707837, ccData: 22895 }, - { type: 3, pts: 6736710840, ccData: 49698 }, - { type: 2, pts: 6736710840, ccData: 30047 }, - { type: 3, pts: 6736713843, ccData: 546 }, - { type: 2, pts: 6736713843, ccData: 25199 }, - { type: 3, pts: 6736716846, ccData: 16930 }, - { type: 2, pts: 6736716846, ccData: 29800 }, - { type: 3, pts: 6736719849, ccData: 33314 }, - { type: 2, pts: 6736719849, ccData: 24428 }, - { type: 3, pts: 6736722852, ccData: 49698 }, - { type: 2, pts: 6736722852, ccData: 28527 }, - { type: 3, pts: 6736725855, ccData: 546 }, - { type: 2, pts: 6736725855, ccData: 27392 }, - { type: 3, pts: 6736728858, ccData: 18993 }, - { type: 2, pts: 6736728858, ccData: 39195 }, - { type: 2, pts: 6736728858, ccData: 16640 }, - { type: 2, pts: 6736728858, ccData: 287 }, - { type: 2, pts: 6736728858, ccData: 4240 }, - { type: 2, pts: 6736728858, ccData: 1283 }, - { type: 2, pts: 6736728858, ccData: 37162 }, - { type: 2, pts: 6736728858, ccData: 0 }, - { type: 2, pts: 6736728858, ccData: 37377 }, - { type: 2, pts: 6736728858, ccData: 1024 }, - { type: 3, pts: 6736734864, ccData: 33571 }, - { type: 2, pts: 6736734864, ccData: 37377 }, - { type: 2, pts: 6736734864, ccData: 1280 }, - { type: 3, pts: 6736740870, ccData: 49698 }, - { type: 2, pts: 6736740870, ccData: 24941 }, - { type: 3, pts: 6736743873, ccData: 546 }, - { type: 2, pts: 6736743873, ccData: 24954 }, - { type: 3, pts: 6736746876, ccData: 16930 }, - { type: 2, pts: 6736746876, ccData: 26990 }, - { type: 3, pts: 6736749879, ccData: 33314 }, - { type: 2, pts: 6736749879, ccData: 26414 }, - { type: 3, pts: 6736752882, ccData: 49698 }, - { type: 2, pts: 6736752882, ccData: 35841 }, - { type: 3, pts: 6736758888, ccData: 546 }, - { type: 2, pts: 6736758888, ccData: 35074 }, - { type: 3, pts: 6736824954, ccData: 18993 }, - { type: 2, pts: 6736824954, ccData: 38939 }, - { type: 2, pts: 6736824954, ccData: 15360 }, - { type: 2, pts: 6736824954, ccData: 31 }, - { type: 2, pts: 6736824954, ccData: 5264 }, - { type: 2, pts: 6736824954, ccData: 1283 }, - { type: 2, pts: 6736824954, ccData: 37162 }, - { type: 2, pts: 6736824954, ccData: 42 }, - { type: 2, pts: 6736824954, ccData: 37376 }, - { type: 2, pts: 6736824954, ccData: 1024 }, - { type: 3, pts: 6736830960, ccData: 33571 }, - { type: 2, pts: 6736830960, ccData: 37376 }, - { type: 2, pts: 6736830960, ccData: 1536 }, - { type: 3, pts: 6736836966, ccData: 49698 }, - { type: 2, pts: 6736836966, ccData: 21608 }, - { type: 3, pts: 6736839969, ccData: 546 }, - { type: 2, pts: 6736839969, ccData: 24942 }, - { type: 3, pts: 6736842972, ccData: 16930 }, - { type: 2, pts: 6736842972, ccData: 27487 }, - { type: 3, pts: 6736845975, ccData: 33314 }, - { type: 2, pts: 6736845975, ccData: 31087 }, - { type: 3, pts: 6736848978, ccData: 49698 }, - { type: 2, pts: 6736848978, ccData: 29998 }, - { type: 3, pts: 6736851981, ccData: 2609 }, - { type: 2, pts: 6736851981, ccData: 38939 }, - { type: 2, pts: 6736851981, ccData: 15360 }, - { type: 2, pts: 6736851981, ccData: 543 }, - { type: 2, pts: 6736851981, ccData: 4240 }, - { type: 2, pts: 6736851981, ccData: 1283 }, - { type: 2, pts: 6736851981, ccData: 37162 }, - { type: 2, pts: 6736851981, ccData: 0 }, - { type: 2, pts: 6736851981, ccData: 37378 }, - { type: 2, pts: 6736851981, ccData: 5120 }, - { type: 3, pts: 6736857987, ccData: 17187 }, - { type: 2, pts: 6736857987, ccData: 37378 }, - { type: 2, pts: 6736857987, ccData: 5376 }, - { type: 3, pts: 6736863993, ccData: 33314 }, - { type: 2, pts: 6736863993, ccData: 21608 }, - { type: 3, pts: 6736866996, ccData: 49698 }, - { type: 2, pts: 6736866996, ccData: 24942 }, - { type: 3, pts: 6736869999, ccData: 546 }, - { type: 2, pts: 6736869999, ccData: 27507 }, - { type: 3, pts: 6736873002, ccData: 16930 }, - { type: 2, pts: 6736873002, ccData: 11776 }, - { type: 3, pts: 6736876005, ccData: 33314 }, - { type: 2, pts: 6736876005, ccData: 35842 }, - { type: 3, pts: 6736882011, ccData: 49698 }, - { type: 2, pts: 6736882011, ccData: 35073 }, - { type: 3, pts: 6736951080, ccData: 2609 }, - { type: 2, pts: 6736951080, ccData: 39195 }, - { type: 2, pts: 6736951080, ccData: 16640 }, - { type: 2, pts: 6736951080, ccData: 31 }, - { type: 2, pts: 6736951080, ccData: 5264 }, - { type: 2, pts: 6736951080, ccData: 1283 }, - { type: 2, pts: 6736951080, ccData: 37162 }, - { type: 2, pts: 6736951080, ccData: 42 }, - { type: 2, pts: 6736951080, ccData: 37376 }, - { type: 2, pts: 6736951080, ccData: 2048 }, - { type: 3, pts: 6736957086, ccData: 17187 }, - { type: 2, pts: 6736957086, ccData: 37376 }, - { type: 2, pts: 6736957086, ccData: 2304 }, - { type: 3, pts: 6736963092, ccData: 33314 }, - { type: 2, pts: 6736963092, ccData: 19823 }, - { type: 3, pts: 6736966095, ccData: 49698 }, - { type: 2, pts: 6736966095, ccData: 28013 }, - { type: 3, pts: 6736969098, ccData: 546 }, - { type: 2, pts: 6736969098, ccData: 31020 }, - { type: 3, pts: 6736972101, ccData: 16930 }, - { type: 2, pts: 6736972101, ccData: 24429 }, - { type: 3, pts: 6736975104, ccData: 33314 }, - { type: 2, pts: 6736975104, ccData: 24953 }, - { type: 3, pts: 6736978107, ccData: 49698 }, - { type: 2, pts: 6736978107, ccData: 24393 }, - { type: 3, pts: 6736981110, ccData: 546 }, - { type: 2, pts: 6736981110, ccData: 24432 }, - { type: 3, pts: 6736984113, ccData: 16930 }, - { type: 2, pts: 6736984113, ccData: 27749 }, - { type: 3, pts: 6736987116, ccData: 33314 }, - { type: 2, pts: 6736987116, ccData: 24947 }, - { type: 3, pts: 6736990119, ccData: 49698 }, - { type: 2, pts: 6736990119, ccData: 25951 }, - { type: 3, pts: 6736993122, ccData: 546 }, - { type: 2, pts: 6736993122, ccData: 29810 }, - { type: 3, pts: 6736996125, ccData: 16930 }, - { type: 2, pts: 6736996125, ccData: 30976 }, - { type: 3, pts: 6736999128, ccData: 35377 }, - { type: 2, pts: 6736999128, ccData: 39195 }, - { type: 2, pts: 6736999128, ccData: 16640 }, - { type: 2, pts: 6736999128, ccData: 287 }, - { type: 2, pts: 6736999128, ccData: 4240 }, - { type: 2, pts: 6736999128, ccData: 1283 }, - { type: 2, pts: 6736999128, ccData: 37162 }, - { type: 2, pts: 6736999128, ccData: 0 }, - { type: 2, pts: 6736999128, ccData: 37377 }, - { type: 2, pts: 6736999128, ccData: 3072 }, - { type: 3, pts: 6737005134, ccData: 49698 }, - { type: 2, pts: 6737005134, ccData: 24927 }, - { type: 3, pts: 6737008137, ccData: 546 }, - { type: 2, pts: 6737008137, ccData: 28261 }, - { type: 3, pts: 6737011140, ccData: 16930 }, - { type: 2, pts: 6737011140, ccData: 30559 }, - { type: 3, pts: 6737014143, ccData: 33314 }, - { type: 2, pts: 6737014143, ccData: 26721 }, - { type: 3, pts: 6737017146, ccData: 49698 }, - { type: 2, pts: 6737017146, ccData: 26994 }, - { type: 3, pts: 6737020149, ccData: 546 }, - { type: 2, pts: 6737020149, ccData: 29556 }, - { type: 3, pts: 6737023152, ccData: 16930 }, - { type: 2, pts: 6737023152, ccData: 31084 }, - { type: 3, pts: 6737026155, ccData: 33314 }, - { type: 2, pts: 6737026155, ccData: 25951 }, - { type: 3, pts: 6737029158, ccData: 49698 }, - { type: 2, pts: 6737029158, ccData: 29807 }, - { type: 3, pts: 6737032161, ccData: 546 }, - { type: 2, pts: 6737032161, ccData: 28479 }, - { type: 3, pts: 6737035164, ccData: 16930 }, - { type: 2, pts: 6737035164, ccData: 35841 }, - { type: 3, pts: 6737041170, ccData: 33314 }, - { type: 2, pts: 6737041170, ccData: 35074 }, - { type: 3, pts: 6737299428, ccData: 51761 }, - { type: 2, pts: 6737299428, ccData: 38939 }, - { type: 2, pts: 6737299428, ccData: 16640 }, - { type: 2, pts: 6737299428, ccData: 31 }, - { type: 2, pts: 6737299428, ccData: 5264 }, - { type: 2, pts: 6737299428, ccData: 1283 }, - { type: 2, pts: 6737299428, ccData: 37162 }, - { type: 2, pts: 6737299428, ccData: 42 }, - { type: 2, pts: 6737299428, ccData: 37376 }, - { type: 2, pts: 6737299428, ccData: 0 }, - { type: 3, pts: 6737305434, ccData: 546 }, - { type: 2, pts: 6737305434, ccData: 10343 }, - { type: 3, pts: 6737308437, ccData: 16930 }, - { type: 2, pts: 6737308437, ccData: 24947 }, - { type: 3, pts: 6737311440, ccData: 33314 }, - { type: 2, pts: 6737311440, ccData: 28787 }, - { type: 3, pts: 6737314443, ccData: 49698 }, - { type: 2, pts: 6737314443, ccData: 10554 }, - { type: 3, pts: 6737317446, ccData: 2609 }, - { type: 2, pts: 6737317446, ccData: 38939 }, - { type: 2, pts: 6737317446, ccData: 16640 }, - { type: 2, pts: 6737317446, ccData: 287 }, - { type: 2, pts: 6737317446, ccData: 4240 }, - { type: 2, pts: 6737317446, ccData: 1283 }, - { type: 2, pts: 6737317446, ccData: 37162 }, - { type: 2, pts: 6737317446, ccData: 0 }, - { type: 2, pts: 6737317446, ccData: 37377 }, - { type: 2, pts: 6737317446, ccData: 0 }, - { type: 3, pts: 6737323452, ccData: 16930 }, - { type: 2, pts: 6737323452, ccData: 20326 }, - { type: 3, pts: 6737326455, ccData: 33314 }, - { type: 2, pts: 6737326455, ccData: 24419 }, - { type: 3, pts: 6737329458, ccData: 49698 }, - { type: 2, pts: 6737329458, ccData: 28533 }, - { type: 3, pts: 6737332461, ccData: 546 }, - { type: 2, pts: 6737332461, ccData: 29299 }, - { type: 3, pts: 6737335464, ccData: 16930 }, - { type: 2, pts: 6737335464, ccData: 25902 }, - { type: 3, pts: 6737338467, ccData: 33314 }, - { type: 2, pts: 6737338467, ccData: 35842 }, - { type: 3, pts: 6737344473, ccData: 49698 }, - { type: 2, pts: 6737344473, ccData: 35073 }, - { type: 3, pts: 6737431560, ccData: 2609 }, - { type: 2, pts: 6737431560, ccData: 39195 }, - { type: 2, pts: 6737431560, ccData: 17920 }, - { type: 2, pts: 6737431560, ccData: 31 }, - { type: 2, pts: 6737431560, ccData: 5264 }, - { type: 2, pts: 6737431560, ccData: 1283 }, - { type: 2, pts: 6737431560, ccData: 37162 }, - { type: 2, pts: 6737431560, ccData: 42 }, - { type: 2, pts: 6737431560, ccData: 37376 }, - { type: 2, pts: 6737431560, ccData: 0 }, - { type: 3, pts: 6737437566, ccData: 16930 }, - { type: 2, pts: 6737437566, ccData: 21359 }, - { type: 3, pts: 6737440569, ccData: 33314 }, - { type: 2, pts: 6737440569, ccData: 30062 }, - { type: 3, pts: 6737443572, ccData: 49698 }, - { type: 2, pts: 6737443572, ccData: 25715 }, - { type: 3, pts: 6737446575, ccData: 546 }, - { type: 2, pts: 6737446575, ccData: 24428 }, - { type: 3, pts: 6737449578, ccData: 16930 }, - { type: 2, pts: 6737449578, ccData: 26987 }, - { type: 3, pts: 6737452581, ccData: 33314 }, - { type: 2, pts: 6737452581, ccData: 25951 }, - { type: 3, pts: 6737455584, ccData: 49698 }, - { type: 2, pts: 6737455584, ccData: 26229 }, - { type: 3, pts: 6737458587, ccData: 546 }, - { type: 2, pts: 6737458587, ccData: 28206 }, - { type: 3, pts: 6737461590, ccData: 16930 }, - { type: 2, pts: 6737461590, ccData: 35841 }, - { type: 3, pts: 6737467596, ccData: 33314 }, - { type: 2, pts: 6737467596, ccData: 35074 }, - { type: 3, pts: 6737512641, ccData: 51761 }, - { type: 2, pts: 6737512641, ccData: 38939 }, - { type: 2, pts: 6737512641, ccData: 17920 }, - { type: 2, pts: 6737512641, ccData: 31 }, - { type: 2, pts: 6737512641, ccData: 5264 }, - { type: 2, pts: 6737512641, ccData: 1283 }, - { type: 2, pts: 6737512641, ccData: 37162 }, - { type: 2, pts: 6737512641, ccData: 42 }, - { type: 2, pts: 6737512641, ccData: 37376 }, - { type: 2, pts: 6737512641, ccData: 2048 }, - { type: 3, pts: 6737518647, ccData: 803 }, - { type: 2, pts: 6737518647, ccData: 37376 }, - { type: 2, pts: 6737518647, ccData: 2816 }, - { type: 3, pts: 6737524653, ccData: 16930 }, - { type: 2, pts: 6737524653, ccData: 21349 }, - { type: 3, pts: 6737527656, ccData: 33314 }, - { type: 2, pts: 6737527656, ccData: 25951 }, - { type: 3, pts: 6737530659, ccData: 49698 }, - { type: 2, pts: 6737530659, ccData: 31087 }, - { type: 3, pts: 6737533662, ccData: 546 }, - { type: 2, pts: 6737533662, ccData: 30047 }, - { type: 3, pts: 6737536665, ccData: 16930 }, - { type: 2, pts: 6737536665, ccData: 24948 }, - { type: 3, pts: 6737539668, ccData: 33314 }, - { type: 2, pts: 6737539668, ccData: 24435 }, - { type: 3, pts: 6737542671, ccData: 49698 }, - { type: 2, pts: 6737542671, ccData: 28515 }, - { type: 3, pts: 6737545674, ccData: 546 }, - { type: 2, pts: 6737545674, ccData: 25445 }, - { type: 3, pts: 6737548677, ccData: 16930 }, - { type: 2, pts: 6737548677, ccData: 29217 }, - { type: 3, pts: 6737551680, ccData: 33314 }, - { type: 2, pts: 6737551680, ccData: 35842 }, - { type: 3, pts: 6737557686, ccData: 49698 }, - { type: 2, pts: 6737557686, ccData: 35073 }, - { type: 3, pts: 6737743872, ccData: 2609 }, - { type: 2, pts: 6737743872, ccData: 39195 }, - { type: 2, pts: 6737743872, ccData: 17920 }, - { type: 2, pts: 6737743872, ccData: 31 }, - { type: 2, pts: 6737743872, ccData: 5264 }, - { type: 2, pts: 6737743872, ccData: 1283 }, - { type: 2, pts: 6737743872, ccData: 37162 }, - { type: 2, pts: 6737743872, ccData: 42 }, - { type: 2, pts: 6737743872, ccData: 37376 }, - { type: 2, pts: 6737743872, ccData: 3072 }, - { type: 3, pts: 6737749878, ccData: 17187 }, - { type: 2, pts: 6737749878, ccData: 37376 }, - { type: 2, pts: 6737749878, ccData: 3584 }, - { type: 3, pts: 6737755884, ccData: 33313 }, - { type: 2, pts: 6737755884, ccData: 32512 }, - { type: 3, pts: 6737758887, ccData: 49698 }, - { type: 2, pts: 6737758887, ccData: 24320 }, - { type: 3, pts: 6737761890, ccData: 545 }, - { type: 2, pts: 6737761890, ccData: 32512 }, - { type: 3, pts: 6737764893, ccData: 16930 }, - { type: 2, pts: 6737764893, ccData: 35841 }, - { type: 3, pts: 6737770899, ccData: 33314 }, - { type: 2, pts: 6737770899, ccData: 35074 }, - { type: 3, pts: 6737969097, ccData: 49698 }, - { type: 2, pts: 6737969097, ccData: 35842 }, - { type: 3, pts: 6738164292, ccData: 2609 }, - { type: 2, pts: 6738164292, ccData: 38939 }, - { type: 2, pts: 6738164292, ccData: 17920 }, - { type: 2, pts: 6738164292, ccData: 31 }, - { type: 2, pts: 6738164292, ccData: 5264 }, - { type: 2, pts: 6738164292, ccData: 1283 }, - { type: 2, pts: 6738164292, ccData: 37162 }, - { type: 2, pts: 6738164292, ccData: 42 }, - { type: 2, pts: 6738164292, ccData: 37376 }, - { type: 2, pts: 6738164292, ccData: 1024 }, - { type: 3, pts: 6738170298, ccData: 16930 }, - { type: 2, pts: 6738170298, ccData: 18533 }, - { type: 3, pts: 6738173301, ccData: 33314 }, - { type: 2, pts: 6738173301, ccData: 31071 }, - { type: 3, pts: 6738176304, ccData: 49698 }, - { type: 2, pts: 6738176304, ccData: 29800 }, - { type: 3, pts: 6738179307, ccData: 546 }, - { type: 2, pts: 6738179307, ccData: 25970 }, - { type: 3, pts: 6738182310, ccData: 16930 }, - { type: 2, pts: 6738182310, ccData: 25889 }, - { type: 3, pts: 6738191319, ccData: 33314 }, - { type: 2, pts: 6738191319, ccData: 35073 }, - { type: 3, pts: 6738242370, ccData: 51761 }, - { type: 2, pts: 6738242370, ccData: 39195 }, - { type: 2, pts: 6738242370, ccData: 17920 }, - { type: 2, pts: 6738242370, ccData: 31 }, - { type: 2, pts: 6738242370, ccData: 5264 }, - { type: 2, pts: 6738242370, ccData: 1283 }, - { type: 2, pts: 6738242370, ccData: 37162 }, - { type: 2, pts: 6738242370, ccData: 42 }, - { type: 2, pts: 6738242370, ccData: 37376 }, - { type: 2, pts: 6738242370, ccData: 0 }, - { type: 3, pts: 6738248376, ccData: 803 }, - { type: 2, pts: 6738248376, ccData: 37376 }, - { type: 2, pts: 6738248376, ccData: 256 }, - { type: 3, pts: 6738254382, ccData: 16930 }, - { type: 2, pts: 6738254382, ccData: 22373 }, - { type: 3, pts: 6738257385, ccData: 33314 }, - { type: 2, pts: 6738257385, ccData: 27747 }, - { type: 3, pts: 6738260388, ccData: 49698 }, - { type: 2, pts: 6738260388, ccData: 28525 }, - { type: 3, pts: 6738263391, ccData: 546 }, - { type: 2, pts: 6738263391, ccData: 25951 }, - { type: 3, pts: 6738266394, ccData: 16930 }, - { type: 2, pts: 6738266394, ccData: 29807 }, - { type: 3, pts: 6738269397, ccData: 33314 }, - { type: 2, pts: 6738269397, ccData: 24436 }, - { type: 3, pts: 6738272400, ccData: 49698 }, - { type: 2, pts: 6738272400, ccData: 26725 }, - { type: 3, pts: 6738275403, ccData: 546 }, - { type: 2, pts: 6738275403, ccData: 24388 }, - { type: 3, pts: 6738278406, ccData: 16930 }, - { type: 2, pts: 6738278406, ccData: 29285 }, - { type: 3, pts: 6738281409, ccData: 33314 }, - { type: 2, pts: 6738281409, ccData: 24941 }, - { type: 3, pts: 6738284412, ccData: 49698 }, - { type: 2, pts: 6738284412, ccData: 24403 }, - { type: 3, pts: 6738287415, ccData: 546 }, - { type: 2, pts: 6738287415, ccData: 24940 }, - { type: 3, pts: 6738290418, ccData: 16930 }, - { type: 2, pts: 6738290418, ccData: 28526 }, - { type: 3, pts: 6738293421, ccData: 33314 }, - { type: 2, pts: 6738293421, ccData: 11776 }, - { type: 3, pts: 6738296424, ccData: 49698 }, - { type: 2, pts: 6738296424, ccData: 35841 }, - { type: 3, pts: 6738302430, ccData: 546 }, - { type: 2, pts: 6738302430, ccData: 35074 }, - { type: 3, pts: 6738404532, ccData: 18993 }, - { type: 2, pts: 6738404532, ccData: 38939 }, - { type: 2, pts: 6738404532, ccData: 15360 }, - { type: 2, pts: 6738404532, ccData: 31 }, - { type: 2, pts: 6738404532, ccData: 5264 }, - { type: 2, pts: 6738404532, ccData: 1283 }, - { type: 2, pts: 6738404532, ccData: 37162 }, - { type: 2, pts: 6738404532, ccData: 42 }, - { type: 2, pts: 6738404532, ccData: 37376 }, - { type: 2, pts: 6738404532, ccData: 4096 }, - { type: 3, pts: 6738410538, ccData: 33571 }, - { type: 2, pts: 6738410538, ccData: 37376 }, - { type: 2, pts: 6738410538, ccData: 4608 }, - { type: 3, pts: 6738416544, ccData: 49698 }, - { type: 2, pts: 6738416544, ccData: 18537 }, - { type: 3, pts: 6738419547, ccData: 546 }, - { type: 2, pts: 6738419547, ccData: 8448 }, - { type: 3, pts: 6738422550, ccData: 18993 }, - { type: 2, pts: 6738422550, ccData: 38939 }, - { type: 2, pts: 6738422550, ccData: 15360 }, - { type: 2, pts: 6738422550, ccData: 543 }, - { type: 2, pts: 6738422550, ccData: 4240 }, - { type: 2, pts: 6738422550, ccData: 1283 }, - { type: 2, pts: 6738422550, ccData: 37162 }, - { type: 2, pts: 6738422550, ccData: 0 }, - { type: 2, pts: 6738422550, ccData: 37378 }, - { type: 2, pts: 6738422550, ccData: 6144 }, - { type: 3, pts: 6738428556, ccData: 33314 }, - { type: 2, pts: 6738428556, ccData: 18533 }, - { type: 3, pts: 6738431559, ccData: 49698 }, - { type: 2, pts: 6738431559, ccData: 27756 }, - { type: 3, pts: 6738434562, ccData: 546 }, - { type: 2, pts: 6738434562, ccData: 28449 }, - { type: 3, pts: 6738437565, ccData: 16930 }, - { type: 2, pts: 6738437565, ccData: 35842 }, - { type: 3, pts: 6738443571, ccData: 33314 }, - { type: 2, pts: 6738443571, ccData: 35073 }, - { type: 3, pts: 6738482610, ccData: 51761 }, - { type: 2, pts: 6738482610, ccData: 39195 }, - { type: 2, pts: 6738482610, ccData: 16640 }, - { type: 2, pts: 6738482610, ccData: 31 }, - { type: 2, pts: 6738482610, ccData: 5264 }, - { type: 2, pts: 6738482610, ccData: 1283 }, - { type: 2, pts: 6738482610, ccData: 37162 }, - { type: 2, pts: 6738482610, ccData: 42 }, - { type: 2, pts: 6738482610, ccData: 37376 }, - { type: 2, pts: 6738482610, ccData: 2048 }, - { type: 3, pts: 6738488616, ccData: 803 }, - { type: 2, pts: 6738488616, ccData: 37376 }, - { type: 2, pts: 6738488616, ccData: 2560 }, - { type: 3, pts: 6738494622, ccData: 16930 }, - { type: 2, pts: 6738494622, ccData: 18727 }, - { type: 3, pts: 6738497625, ccData: 33314 }, - { type: 2, pts: 6738497625, ccData: 27999 }, - { type: 3, pts: 6738500628, ccData: 49698 }, - { type: 2, pts: 6738500628, ccData: 16750 }, - { type: 3, pts: 6738503631, ccData: 546 }, - { type: 2, pts: 6738503631, ccData: 25714 }, - { type: 3, pts: 6738506634, ccData: 16930 }, - { type: 2, pts: 6738506634, ccData: 25953 }, - { type: 3, pts: 6738509637, ccData: 33314 }, - { type: 2, pts: 6738509637, ccData: 11264 }, - { type: 3, pts: 6738512640, ccData: 51761 }, - { type: 2, pts: 6738512640, ccData: 39195 }, - { type: 2, pts: 6738512640, ccData: 16640 }, - { type: 2, pts: 6738512640, ccData: 287 }, - { type: 2, pts: 6738512640, ccData: 4240 }, - { type: 2, pts: 6738512640, ccData: 1283 }, - { type: 2, pts: 6738512640, ccData: 37162 }, - { type: 2, pts: 6738512640, ccData: 0 }, - { type: 2, pts: 6738512640, ccData: 37377 }, - { type: 2, pts: 6738512640, ccData: 0 }, - { type: 3, pts: 6738518646, ccData: 803 }, - { type: 2, pts: 6738518646, ccData: 37377 }, - { type: 2, pts: 6738518646, ccData: 256 }, - { type: 3, pts: 6738524652, ccData: 16930 }, - { type: 2, pts: 6738524652, ccData: 24942 }, - { type: 3, pts: 6738527655, ccData: 33314 }, - { type: 2, pts: 6738527655, ccData: 25695 }, - { type: 3, pts: 6738530658, ccData: 49698 }, - { type: 2, pts: 6738530658, ccData: 18727 }, - { type: 3, pts: 6738533661, ccData: 546 }, - { type: 2, pts: 6738533661, ccData: 27756 }, - { type: 3, pts: 6738536664, ccData: 16930 }, - { type: 2, pts: 6738536664, ccData: 24418 }, - { type: 3, pts: 6738539667, ccData: 33314 }, - { type: 2, pts: 6738539667, ccData: 25951 }, - { type: 3, pts: 6738542670, ccData: 49698 }, - { type: 2, pts: 6738542670, ccData: 31087 }, - { type: 3, pts: 6738545673, ccData: 546 }, - { type: 2, pts: 6738545673, ccData: 30066 }, - { type: 3, pts: 6738548676, ccData: 16930 }, - { type: 2, pts: 6738548676, ccData: 24424 }, - { type: 3, pts: 6738551679, ccData: 33314 }, - { type: 2, pts: 6738551679, ccData: 24937 }, - { type: 3, pts: 6738554682, ccData: 49698 }, - { type: 2, pts: 6738554682, ccData: 29279 }, - { type: 3, pts: 6738557685, ccData: 546 }, - { type: 2, pts: 6738557685, ccData: 29556 }, - { type: 3, pts: 6738560688, ccData: 16930 }, - { type: 2, pts: 6738560688, ccData: 31084 }, - { type: 3, pts: 6738563691, ccData: 33314 }, - { type: 2, pts: 6738563691, ccData: 26995 }, - { type: 3, pts: 6738566694, ccData: 49698 }, - { type: 2, pts: 6738566694, ccData: 29742 }, - { type: 3, pts: 6738569697, ccData: 546 }, - { type: 2, pts: 6738569697, ccData: 35841 }, - { type: 3, pts: 6738575703, ccData: 16930 }, - { type: 2, pts: 6738575703, ccData: 35074 }, - { type: 3, pts: 6738743871, ccData: 35377 }, - { type: 2, pts: 6738743871, ccData: 38939 }, - { type: 2, pts: 6738743871, ccData: 17920 }, - { type: 2, pts: 6738743871, ccData: 31 }, - { type: 2, pts: 6738743871, ccData: 5264 }, - { type: 2, pts: 6738743871, ccData: 1283 }, - { type: 2, pts: 6738743871, ccData: 37162 }, - { type: 2, pts: 6738743871, ccData: 42 }, - { type: 2, pts: 6738743871, ccData: 37376 }, - { type: 2, pts: 6738743871, ccData: 1024 }, - { type: 3, pts: 6738749877, ccData: 49955 }, - { type: 2, pts: 6738749877, ccData: 37376 }, - { type: 2, pts: 6738749877, ccData: 1792 }, - { type: 3, pts: 6738755883, ccData: 546 }, - { type: 2, pts: 6738755883, ccData: 18727 }, - { type: 3, pts: 6738758886, ccData: 16930 }, - { type: 2, pts: 6738758886, ccData: 27999 }, - { type: 3, pts: 6738761889, ccData: 33314 }, - { type: 2, pts: 6738761889, ccData: 20585 }, - { type: 3, pts: 6738764892, ccData: 49698 }, - { type: 2, pts: 6738764892, ccData: 28267 }, - { type: 3, pts: 6738767895, ccData: 546 }, - { type: 2, pts: 6738767895, ccData: 24940 }, - { type: 3, pts: 6738770898, ccData: 16930 }, - { type: 2, pts: 6738770898, ccData: 26979 }, - { type: 3, pts: 6738773901, ccData: 33314 }, - { type: 2, pts: 6738773901, ccData: 26991 }, - { type: 3, pts: 6738776904, ccData: 49698 }, - { type: 2, pts: 6738776904, ccData: 30067 }, - { type: 3, pts: 6738779907, ccData: 546 }, - { type: 2, pts: 6738779907, ccData: 11776 }, - { type: 3, pts: 6738782910, ccData: 16930 }, - { type: 2, pts: 6738782910, ccData: 35842 }, - { type: 3, pts: 6738788916, ccData: 33314 }, - { type: 2, pts: 6738788916, ccData: 35073 }, - { type: 3, pts: 6738885012, ccData: 51761 }, - { type: 2, pts: 6738885012, ccData: 39195 }, - { type: 2, pts: 6738885012, ccData: 17920 }, - { type: 2, pts: 6738885012, ccData: 31 }, - { type: 2, pts: 6738885012, ccData: 5264 }, - { type: 2, pts: 6738885012, ccData: 1283 }, - { type: 2, pts: 6738885012, ccData: 37162 }, - { type: 2, pts: 6738885012, ccData: 42 }, - { type: 2, pts: 6738885012, ccData: 37376 }, - { type: 2, pts: 6738885012, ccData: 1024 }, - { type: 3, pts: 6738891018, ccData: 803 }, - { type: 2, pts: 6738891018, ccData: 37376 }, - { type: 2, pts: 6738891018, ccData: 1792 }, - { type: 3, pts: 6738897024, ccData: 16930 }, - { type: 2, pts: 6738897024, ccData: 16750 }, - { type: 3, pts: 6738900027, ccData: 33314 }, - { type: 2, pts: 6738900027, ccData: 25695 }, - { type: 3, pts: 6738903030, ccData: 49698 }, - { type: 2, pts: 6738903030, ccData: 29800 }, - { type: 3, pts: 6738906033, ccData: 546 }, - { type: 2, pts: 6738906033, ccData: 26995 }, - { type: 3, pts: 6738909036, ccData: 16930 }, - { type: 2, pts: 6738909036, ccData: 24425 }, - { type: 3, pts: 6738912039, ccData: 33314 }, - { type: 2, pts: 6738912039, ccData: 29535 }, - { type: 3, pts: 6738915042, ccData: 49698 }, - { type: 2, pts: 6738915042, ccData: 19823 }, - { type: 3, pts: 6738918045, ccData: 546 }, - { type: 2, pts: 6738918045, ccData: 28013 }, - { type: 3, pts: 6738921048, ccData: 16930 }, - { type: 2, pts: 6738921048, ccData: 31022 }, - { type: 3, pts: 6738924051, ccData: 33314 }, - { type: 2, pts: 6738924051, ccData: 35841 }, - { type: 3, pts: 6738930057, ccData: 49698 }, - { type: 2, pts: 6738930057, ccData: 35074 }, - { type: 3, pts: 6739026153, ccData: 2609 }, - { type: 2, pts: 6739026153, ccData: 38939 }, - { type: 2, pts: 6739026153, ccData: 16640 }, - { type: 2, pts: 6739026153, ccData: 31 }, - { type: 2, pts: 6739026153, ccData: 5264 }, - { type: 2, pts: 6739026153, ccData: 1283 }, - { type: 2, pts: 6739026153, ccData: 37162 }, - { type: 2, pts: 6739026153, ccData: 42 }, - { type: 2, pts: 6739026153, ccData: 37376 }, - { type: 2, pts: 6739026153, ccData: 3072 }, - { type: 3, pts: 6739032159, ccData: 17187 }, - { type: 2, pts: 6739032159, ccData: 37376 }, - { type: 2, pts: 6739032159, ccData: 3840 }, - { type: 3, pts: 6739038165, ccData: 33314 }, - { type: 2, pts: 6739038165, ccData: 20073 }, - { type: 3, pts: 6739041168, ccData: 49698 }, - { type: 2, pts: 6739041168, ccData: 25445 }, - { type: 3, pts: 6739044171, ccData: 546 }, - { type: 2, pts: 6739044171, ccData: 24436 }, - { type: 3, pts: 6739047174, ccData: 16930 }, - { type: 2, pts: 6739047174, ccData: 28511 }, - { type: 3, pts: 6739050177, ccData: 33314 }, - { type: 2, pts: 6739050177, ccData: 28005 }, - { type: 3, pts: 6739053180, ccData: 49698 }, - { type: 2, pts: 6739053180, ccData: 25972 }, - { type: 3, pts: 6739056183, ccData: 546 }, - { type: 2, pts: 6739056183, ccData: 24441 }, - { type: 3, pts: 6739059186, ccData: 16930 }, - { type: 2, pts: 6739059186, ccData: 28533 }, - { type: 3, pts: 6739062189, ccData: 33314 }, - { type: 2, pts: 6739062189, ccData: 11264 }, - { type: 3, pts: 6739065192, ccData: 51761 }, - { type: 2, pts: 6739065192, ccData: 38939 }, - { type: 2, pts: 6739065192, ccData: 16640 }, - { type: 2, pts: 6739065192, ccData: 287 }, - { type: 2, pts: 6739065192, ccData: 4240 }, - { type: 2, pts: 6739065192, ccData: 1283 }, - { type: 2, pts: 6739065192, ccData: 37162 }, - { type: 2, pts: 6739065192, ccData: 0 }, - { type: 2, pts: 6739065192, ccData: 37377 }, - { type: 2, pts: 6739065192, ccData: 6144 }, - { type: 3, pts: 6739071198, ccData: 803 }, - { type: 2, pts: 6739071198, ccData: 37377 }, - { type: 2, pts: 6739071198, ccData: 6400 }, - { type: 3, pts: 6739077204, ccData: 16930 }, - { type: 2, pts: 6739077204, ccData: 16750 }, - { type: 3, pts: 6739080207, ccData: 33314 }, - { type: 2, pts: 6739080207, ccData: 25714 }, - { type: 3, pts: 6739083210, ccData: 49698 }, - { type: 2, pts: 6739083210, ccData: 25953 }, - { type: 3, pts: 6739086213, ccData: 546 }, - { type: 2, pts: 6739086213, ccData: 11776 }, - { type: 3, pts: 6739089216, ccData: 16930 }, - { type: 2, pts: 6739089216, ccData: 35842 }, - { type: 3, pts: 6739095222, ccData: 33314 }, - { type: 2, pts: 6739095222, ccData: 35073 }, - { type: 3, pts: 6739164291, ccData: 51761 }, - { type: 2, pts: 6739164291, ccData: 39195 }, - { type: 2, pts: 6739164291, ccData: 16640 }, - { type: 2, pts: 6739164291, ccData: 31 }, - { type: 2, pts: 6739164291, ccData: 5264 }, - { type: 2, pts: 6739164291, ccData: 1283 }, - { type: 2, pts: 6739164291, ccData: 37162 }, - { type: 2, pts: 6739164291, ccData: 42 }, - { type: 2, pts: 6739164291, ccData: 37376 }, - { type: 2, pts: 6739164291, ccData: 1024 }, - { type: 3, pts: 6739170297, ccData: 803 }, - { type: 2, pts: 6739170297, ccData: 37376 }, - { type: 2, pts: 6739170297, ccData: 1536 }, - { type: 3, pts: 6739176303, ccData: 16930 }, - { type: 2, pts: 6739176303, ccData: 18783 }, - { type: 3, pts: 6739179306, ccData: 33314 }, - { type: 2, pts: 6739179306, ccData: 25441 }, - { type: 3, pts: 6739182309, ccData: 49698 }, - { type: 2, pts: 6739182309, ccData: 28199 }, - { type: 3, pts: 6739185312, ccData: 546 }, - { type: 2, pts: 6739185312, ccData: 29791 }, - { type: 3, pts: 6739188315, ccData: 16930 }, - { type: 2, pts: 6739188315, ccData: 30561 }, - { type: 3, pts: 6739191318, ccData: 33314 }, - { type: 2, pts: 6739191318, ccData: 26996 }, - { type: 3, pts: 6739194321, ccData: 49698 }, - { type: 2, pts: 6739194321, ccData: 24436 }, - { type: 3, pts: 6739197324, ccData: 546 }, - { type: 2, pts: 6739197324, ccData: 28511 }, - { type: 3, pts: 6739200327, ccData: 16930 }, - { type: 2, pts: 6739200327, ccData: 29810 }, - { type: 3, pts: 6739203330, ccData: 33314 }, - { type: 2, pts: 6739203330, ccData: 30976 }, - { type: 3, pts: 6739206333, ccData: 51761 }, - { type: 2, pts: 6739206333, ccData: 39195 }, - { type: 2, pts: 6739206333, ccData: 16640 }, - { type: 2, pts: 6739206333, ccData: 287 }, - { type: 2, pts: 6739206333, ccData: 4240 }, - { type: 2, pts: 6739206333, ccData: 1283 }, - { type: 2, pts: 6739206333, ccData: 37162 }, - { type: 2, pts: 6739206333, ccData: 0 }, - { type: 2, pts: 6739206333, ccData: 37377 }, - { type: 2, pts: 6739206333, ccData: 2048 }, - { type: 3, pts: 6739212339, ccData: 546 }, - { type: 2, pts: 6739212339, ccData: 24927 }, - { type: 3, pts: 6739215342, ccData: 16930 }, - { type: 2, pts: 6739215342, ccData: 28261 }, - { type: 3, pts: 6739218345, ccData: 33314 }, - { type: 2, pts: 6739218345, ccData: 30559 }, - { type: 3, pts: 6739221348, ccData: 49698 }, - { type: 2, pts: 6739221348, ccData: 26721 }, - { type: 3, pts: 6739224351, ccData: 546 }, - { type: 2, pts: 6739224351, ccData: 26994 }, - { type: 3, pts: 6739227354, ccData: 16930 }, - { type: 2, pts: 6739227354, ccData: 29556 }, - { type: 3, pts: 6739230357, ccData: 33314 }, - { type: 2, pts: 6739230357, ccData: 31084 }, - { type: 3, pts: 6739233360, ccData: 49698 }, - { type: 2, pts: 6739233360, ccData: 25902 }, - { type: 3, pts: 6739236363, ccData: 546 }, - { type: 2, pts: 6739236363, ccData: 35841 }, - { type: 3, pts: 6739242369, ccData: 16930 }, - { type: 2, pts: 6739242369, ccData: 35074 }, - { type: 3, pts: 6739479606, ccData: 35377 }, - { type: 2, pts: 6739479606, ccData: 38939 }, - { type: 2, pts: 6739479606, ccData: 17920 }, - { type: 2, pts: 6739479606, ccData: 31 }, - { type: 2, pts: 6739479606, ccData: 5264 }, - { type: 2, pts: 6739479606, ccData: 1283 }, - { type: 2, pts: 6739479606, ccData: 37162 }, - { type: 2, pts: 6739479606, ccData: 42 }, - { type: 2, pts: 6739479606, ccData: 37376 }, - { type: 2, pts: 6739479606, ccData: 3072 }, - { type: 3, pts: 6739485612, ccData: 49698 }, - { type: 2, pts: 6739485612, ccData: 20581 }, - { type: 3, pts: 6739488615, ccData: 546 }, - { type: 2, pts: 6739488615, ccData: 29286 }, - { type: 3, pts: 6739491618, ccData: 16930 }, - { type: 2, pts: 6739491618, ccData: 25955 }, - { type: 3, pts: 6739494621, ccData: 33314 }, - { type: 2, pts: 6739494621, ccData: 29729 }, - { type: 3, pts: 6739497624, ccData: 49698 }, - { type: 2, pts: 6739497624, ccData: 35842 }, - { type: 3, pts: 6739503630, ccData: 546 }, - { type: 2, pts: 6739503630, ccData: 35073 }, - { type: 3, pts: 6739518645, ccData: 18993 }, - { type: 2, pts: 6739518645, ccData: 39195 }, - { type: 2, pts: 6739518645, ccData: 16640 }, - { type: 2, pts: 6739518645, ccData: 31 }, - { type: 2, pts: 6739518645, ccData: 5264 }, - { type: 2, pts: 6739518645, ccData: 1283 }, - { type: 2, pts: 6739518645, ccData: 37162 }, - { type: 2, pts: 6739518645, ccData: 42 }, - { type: 2, pts: 6739518645, ccData: 37376 }, - { type: 2, pts: 6739518645, ccData: 1024 }, - { type: 3, pts: 6739524651, ccData: 33571 }, - { type: 2, pts: 6739524651, ccData: 37376 }, - { type: 2, pts: 6739524651, ccData: 1280 }, - { type: 3, pts: 6739530657, ccData: 49698 }, - { type: 2, pts: 6739530657, ccData: 22376 }, - { type: 3, pts: 6739533660, ccData: 546 }, - { type: 2, pts: 6739533660, ccData: 24948 }, - { type: 3, pts: 6739536663, ccData: 16930 }, - { type: 2, pts: 6739536663, ccData: 24427 }, - { type: 3, pts: 6739539666, ccData: 33314 }, - { type: 2, pts: 6739539666, ccData: 26990 }, - { type: 3, pts: 6739542669, ccData: 49698 }, - { type: 2, pts: 6739542669, ccData: 25695 }, - { type: 3, pts: 6739545672, ccData: 546 }, - { type: 2, pts: 6739545672, ccData: 28518 }, - { type: 3, pts: 6739548675, ccData: 16930 }, - { type: 2, pts: 6739548675, ccData: 24424 }, - { type: 3, pts: 6739551678, ccData: 33314 }, - { type: 2, pts: 6739551678, ccData: 24937 }, - { type: 3, pts: 6739554681, ccData: 49698 }, - { type: 2, pts: 6739554681, ccData: 29299 }, - { type: 3, pts: 6739557684, ccData: 546 }, - { type: 2, pts: 6739557684, ccData: 29817 }, - { type: 3, pts: 6739560687, ccData: 16930 }, - { type: 2, pts: 6739560687, ccData: 27749 }, - { type: 3, pts: 6739563690, ccData: 35377 }, - { type: 2, pts: 6739563690, ccData: 39195 }, - { type: 2, pts: 6739563690, ccData: 16640 }, - { type: 2, pts: 6739563690, ccData: 287 }, - { type: 2, pts: 6739563690, ccData: 4240 }, - { type: 2, pts: 6739563690, ccData: 1283 }, - { type: 2, pts: 6739563690, ccData: 37162 }, - { type: 2, pts: 6739563690, ccData: 0 }, - { type: 2, pts: 6739563690, ccData: 37377 }, - { type: 2, pts: 6739563690, ccData: 2048 }, - { type: 3, pts: 6739569696, ccData: 49955 }, - { type: 2, pts: 6739569696, ccData: 37377 }, - { type: 2, pts: 6739569696, ccData: 2560 }, - { type: 3, pts: 6739575702, ccData: 546 }, - { type: 2, pts: 6739575702, ccData: 25711 }, - { type: 3, pts: 6739578705, ccData: 16930 }, - { type: 2, pts: 6739578705, ccData: 24441 }, - { type: 3, pts: 6739581708, ccData: 33314 }, - { type: 2, pts: 6739581708, ccData: 28533 }, - { type: 3, pts: 6739584711, ccData: 49698 }, - { type: 2, pts: 6739584711, ccData: 24439 }, - { type: 3, pts: 6739587714, ccData: 546 }, - { type: 2, pts: 6739587714, ccData: 24942 }, - { type: 3, pts: 6739590717, ccData: 16930 }, - { type: 2, pts: 6739590717, ccData: 29759 }, - { type: 3, pts: 6739593720, ccData: 33314 }, - { type: 2, pts: 6739593720, ccData: 35841 }, - { type: 3, pts: 6739599726, ccData: 49698 }, - { type: 2, pts: 6739599726, ccData: 35074 }, - { type: 3, pts: 6739695822, ccData: 2609 }, - { type: 2, pts: 6739695822, ccData: 38939 }, - { type: 2, pts: 6739695822, ccData: 16640 }, - { type: 2, pts: 6739695822, ccData: 31 }, - { type: 2, pts: 6739695822, ccData: 5264 }, - { type: 2, pts: 6739695822, ccData: 1283 }, - { type: 2, pts: 6739695822, ccData: 37162 }, - { type: 2, pts: 6739695822, ccData: 42 }, - { type: 2, pts: 6739695822, ccData: 37376 }, - { type: 2, pts: 6739695822, ccData: 1024 }, - { type: 3, pts: 6739701828, ccData: 16930 }, - { type: 2, pts: 6739701828, ccData: 18727 }, - { type: 3, pts: 6739704831, ccData: 33314 }, - { type: 2, pts: 6739704831, ccData: 27950 }, - { type: 3, pts: 6739707834, ccData: 49698 }, - { type: 2, pts: 6739707834, ccData: 11822 }, - { type: 3, pts: 6739710837, ccData: 546 }, - { type: 2, pts: 6739710837, ccData: 24393 }, - { type: 3, pts: 6739713840, ccData: 16930 }, - { type: 2, pts: 6739713840, ccData: 10093 }, - { type: 3, pts: 6739716843, ccData: 33314 }, - { type: 2, pts: 6739716843, ccData: 24430 }, - { type: 3, pts: 6739719846, ccData: 49698 }, - { type: 2, pts: 6739719846, ccData: 28532 }, - { type: 3, pts: 6739722849, ccData: 546 }, - { type: 2, pts: 6739722849, ccData: 24435 }, - { type: 3, pts: 6739725852, ccData: 16930 }, - { type: 2, pts: 6739725852, ccData: 30066 }, - { type: 3, pts: 6739728855, ccData: 33314 }, - { type: 2, pts: 6739728855, ccData: 25951 }, - { type: 3, pts: 6739731858, ccData: 49698 }, - { type: 2, pts: 6739731858, ccData: 31077 }, - { type: 3, pts: 6739734861, ccData: 546 }, - { type: 2, pts: 6739734861, ccData: 29740 }, - { type: 3, pts: 6739737864, ccData: 18993 }, - { type: 2, pts: 6739737864, ccData: 38939 }, - { type: 2, pts: 6739737864, ccData: 16640 }, - { type: 2, pts: 6739737864, ccData: 287 }, - { type: 2, pts: 6739737864, ccData: 4240 }, - { type: 2, pts: 6739737864, ccData: 1283 }, - { type: 2, pts: 6739737864, ccData: 37162 }, - { type: 2, pts: 6739737864, ccData: 0 }, - { type: 2, pts: 6739737864, ccData: 37377 }, - { type: 2, pts: 6739737864, ccData: 3072 }, - { type: 3, pts: 6739743870, ccData: 33314 }, - { type: 2, pts: 6739743870, ccData: 16750 }, - { type: 3, pts: 6739746873, ccData: 49698 }, - { type: 2, pts: 6739746873, ccData: 25714 }, - { type: 3, pts: 6739749876, ccData: 546 }, - { type: 2, pts: 6739749876, ccData: 25953 }, - { type: 3, pts: 6739752879, ccData: 16930 }, - { type: 2, pts: 6739752879, ccData: 11776 }, - { type: 3, pts: 6739755882, ccData: 33314 }, - { type: 2, pts: 6739755882, ccData: 35842 }, - { type: 3, pts: 6739761888, ccData: 49698 }, - { type: 2, pts: 6739761888, ccData: 35073 }, - { type: 3, pts: 6739999125, ccData: 2609 }, - { type: 2, pts: 6739999125, ccData: 39195 }, - { type: 2, pts: 6739999125, ccData: 16640 }, - { type: 2, pts: 6739999125, ccData: 31 }, - { type: 2, pts: 6739999125, ccData: 5264 }, - { type: 2, pts: 6739999125, ccData: 1283 }, - { type: 2, pts: 6739999125, ccData: 37162 }, - { type: 2, pts: 6739999125, ccData: 42 }, - { type: 2, pts: 6739999125, ccData: 37376 }, - { type: 2, pts: 6739999125, ccData: 0 }, - { type: 3, pts: 6740005131, ccData: 16930 }, - { type: 2, pts: 6740005131, ccData: 22373 }, - { type: 3, pts: 6740008134, ccData: 33314 }, - { type: 2, pts: 6740008134, ccData: 27756 }, - { type: 3, pts: 6740011137, ccData: 49698 }, - { type: 2, pts: 6740011137, ccData: 11264 }, - { type: 3, pts: 6740014140, ccData: 2609 }, - { type: 2, pts: 6740014140, ccData: 39195 }, - { type: 2, pts: 6740014140, ccData: 16640 }, - { type: 2, pts: 6740014140, ccData: 287 }, - { type: 2, pts: 6740014140, ccData: 4240 }, - { type: 2, pts: 6740014140, ccData: 1283 }, - { type: 2, pts: 6740014140, ccData: 37162 }, - { type: 2, pts: 6740014140, ccData: 0 }, - { type: 2, pts: 6740014140, ccData: 37377 }, - { type: 2, pts: 6740014140, ccData: 0 }, - { type: 3, pts: 6740020146, ccData: 16930 }, - { type: 2, pts: 6740020146, ccData: 29800 }, - { type: 3, pts: 6740023149, ccData: 33314 }, - { type: 2, pts: 6740023149, ccData: 26995 }, - { type: 3, pts: 6740026152, ccData: 49698 }, - { type: 2, pts: 6740026152, ccData: 24429 }, - { type: 3, pts: 6740029155, ccData: 546 }, - { type: 2, pts: 6740029155, ccData: 26983 }, - { type: 3, pts: 6740032158, ccData: 16930 }, - { type: 2, pts: 6740032158, ccData: 26740 }, - { type: 3, pts: 6740035161, ccData: 33314 }, - { type: 2, pts: 6740035161, ccData: 24424 }, - { type: 3, pts: 6740038164, ccData: 49698 }, - { type: 2, pts: 6740038164, ccData: 25964 }, - { type: 3, pts: 6740041167, ccData: 546 }, - { type: 2, pts: 6740041167, ccData: 28718 }, - { type: 3, pts: 6740044170, ccData: 16930 }, - { type: 2, pts: 6740044170, ccData: 35841 }, - { type: 3, pts: 6740050176, ccData: 33314 }, - { type: 2, pts: 6740050176, ccData: 35074 }, - { type: 3, pts: 6740122248, ccData: 51761 }, - { type: 2, pts: 6740122248, ccData: 38939 }, - { type: 2, pts: 6740122248, ccData: 16640 }, - { type: 2, pts: 6740122248, ccData: 31 }, - { type: 2, pts: 6740122248, ccData: 5264 }, - { type: 2, pts: 6740122248, ccData: 1283 }, - { type: 2, pts: 6740122248, ccData: 37162 }, - { type: 2, pts: 6740122248, ccData: 42 }, - { type: 2, pts: 6740122248, ccData: 37376 }, - { type: 2, pts: 6740122248, ccData: 0 }, - { type: 3, pts: 6740128254, ccData: 546 }, - { type: 2, pts: 6740128254, ccData: 18804 }, - { type: 3, pts: 6740131257, ccData: 16930 }, - { type: 2, pts: 6740131257, ccData: 10099 }, - { type: 3, pts: 6740134260, ccData: 33314 }, - { type: 2, pts: 6740134260, ccData: 24431 }, - { type: 3, pts: 6740137263, ccData: 49698 }, - { type: 2, pts: 6740137263, ccData: 30066 }, - { type: 3, pts: 6740140266, ccData: 546 }, - { type: 2, pts: 6740140266, ccData: 24418 }, - { type: 3, pts: 6740143269, ccData: 16930 }, - { type: 2, pts: 6740143269, ccData: 28527 }, - { type: 3, pts: 6740146272, ccData: 33314 }, - { type: 2, pts: 6740146272, ccData: 27392 }, - { type: 3, pts: 6740149275, ccData: 51761 }, - { type: 2, pts: 6740149275, ccData: 38939 }, - { type: 2, pts: 6740149275, ccData: 16640 }, - { type: 2, pts: 6740149275, ccData: 287 }, - { type: 2, pts: 6740149275, ccData: 4240 }, - { type: 2, pts: 6740149275, ccData: 1283 }, - { type: 2, pts: 6740149275, ccData: 37162 }, - { type: 2, pts: 6740149275, ccData: 0 }, - { type: 2, pts: 6740149275, ccData: 37377 }, - { type: 2, pts: 6740149275, ccData: 0 }, - { type: 3, pts: 6740155281, ccData: 546 }, - { type: 2, pts: 6740155281, ccData: 28518 }, - { type: 3, pts: 6740158284, ccData: 16930 }, - { type: 2, pts: 6740158284, ccData: 24424 }, - { type: 3, pts: 6740161287, ccData: 33314 }, - { type: 2, pts: 6740161287, ccData: 24937 }, - { type: 3, pts: 6740164290, ccData: 49698 }, - { type: 2, pts: 6740164290, ccData: 29299 }, - { type: 3, pts: 6740167293, ccData: 546 }, - { type: 2, pts: 6740167293, ccData: 29817 }, - { type: 3, pts: 6740170296, ccData: 16930 }, - { type: 2, pts: 6740170296, ccData: 27749 }, - { type: 3, pts: 6740173299, ccData: 33314 }, - { type: 2, pts: 6740173299, ccData: 29486 }, - { type: 3, pts: 6740176302, ccData: 49698 }, - { type: 2, pts: 6740176302, ccData: 35842 }, - { type: 3, pts: 6740182308, ccData: 546 }, - { type: 2, pts: 6740182308, ccData: 35073 }, - { type: 3, pts: 6740326452, ccData: 18993 }, - { type: 2, pts: 6740326452, ccData: 39195 }, - { type: 2, pts: 6740326452, ccData: 17920 }, - { type: 2, pts: 6740326452, ccData: 31 }, - { type: 2, pts: 6740326452, ccData: 5264 }, - { type: 2, pts: 6740326452, ccData: 1283 }, - { type: 2, pts: 6740326452, ccData: 37162 }, - { type: 2, pts: 6740326452, ccData: 42 }, - { type: 2, pts: 6740326452, ccData: 37376 }, - { type: 2, pts: 6740326452, ccData: 0 }, - { type: 3, pts: 6740332458, ccData: 33314 }, - { type: 2, pts: 6740332458, ccData: 21601 }, - { type: 3, pts: 6740335461, ccData: 49698 }, - { type: 2, pts: 6740335461, ccData: 27493 }, - { type: 3, pts: 6740338464, ccData: 546 }, - { type: 2, pts: 6740338464, ccData: 24417 }, - { type: 3, pts: 6740341467, ccData: 16930 }, - { type: 2, pts: 6740341467, ccData: 24428 }, - { type: 3, pts: 6740344470, ccData: 33314 }, - { type: 2, pts: 6740344470, ccData: 28527 }, - { type: 3, pts: 6740347473, ccData: 49698 }, - { type: 2, pts: 6740347473, ccData: 27438 }, - { type: 3, pts: 6740350476, ccData: 546 }, - { type: 2, pts: 6740350476, ccData: 35841 }, - { type: 3, pts: 6740356482, ccData: 16930 }, - { type: 2, pts: 6740356482, ccData: 35074 }, - { type: 3, pts: 6740410536, ccData: 35377 }, - { type: 2, pts: 6740410536, ccData: 38939 }, - { type: 2, pts: 6740410536, ccData: 16640 }, - { type: 2, pts: 6740410536, ccData: 31 }, - { type: 2, pts: 6740410536, ccData: 5264 }, - { type: 2, pts: 6740410536, ccData: 1283 }, - { type: 2, pts: 6740410536, ccData: 37162 }, - { type: 2, pts: 6740410536, ccData: 42 }, - { type: 2, pts: 6740410536, ccData: 37376 }, - { type: 2, pts: 6740410536, ccData: 0 }, - { type: 3, pts: 6740416542, ccData: 49698 }, - { type: 2, pts: 6740416542, ccData: 21608 }, - { type: 3, pts: 6740419545, ccData: 546 }, - { type: 2, pts: 6740419545, ccData: 25970 }, - { type: 3, pts: 6740422548, ccData: 16930 }, - { type: 2, pts: 6740422548, ccData: 25951 }, - { type: 3, pts: 6740425551, ccData: 33314 }, - { type: 2, pts: 6740425551, ccData: 28009 }, - { type: 3, pts: 6740428554, ccData: 49698 }, - { type: 2, pts: 6740428554, ccData: 26472 }, - { type: 3, pts: 6740431557, ccData: 546 }, - { type: 2, pts: 6740431557, ccData: 29791 }, - { type: 3, pts: 6740434560, ccData: 16930 }, - { type: 2, pts: 6740434560, ccData: 25189 }, - { type: 3, pts: 6740437563, ccData: 33314 }, - { type: 2, pts: 6740437563, ccData: 24431 }, - { type: 3, pts: 6740440566, ccData: 49698 }, - { type: 2, pts: 6740440566, ccData: 28261 }, - { type: 3, pts: 6740443569, ccData: 2609 }, - { type: 2, pts: 6740443569, ccData: 38939 }, - { type: 2, pts: 6740443569, ccData: 16640 }, - { type: 2, pts: 6740443569, ccData: 287 }, - { type: 2, pts: 6740443569, ccData: 4240 }, - { type: 2, pts: 6740443569, ccData: 1283 }, - { type: 2, pts: 6740443569, ccData: 37162 }, - { type: 2, pts: 6740443569, ccData: 0 }, - { type: 2, pts: 6740443569, ccData: 37377 }, - { type: 2, pts: 6740443569, ccData: 0 }, - { type: 3, pts: 6740449575, ccData: 16930 }, - { type: 2, pts: 6740449575, ccData: 31087 }, - { type: 3, pts: 6740452578, ccData: 33314 }, - { type: 2, pts: 6740452578, ccData: 30047 }, - { type: 3, pts: 6740455581, ccData: 49698 }, - { type: 2, pts: 6740455581, ccData: 27753 }, - { type: 3, pts: 6740458584, ccData: 546 }, - { type: 2, pts: 6740458584, ccData: 27493 }, - { type: 3, pts: 6740461587, ccData: 16930 }, - { type: 2, pts: 6740461587, ccData: 11776 }, - { type: 3, pts: 6740464590, ccData: 33314 }, - { type: 2, pts: 6740464590, ccData: 35842 }, - { type: 3, pts: 6740470596, ccData: 49698 }, - { type: 2, pts: 6740470596, ccData: 35073 }, - { type: 3, pts: 6740509635, ccData: 2609 }, - { type: 2, pts: 6740509635, ccData: 39195 }, - { type: 2, pts: 6740509635, ccData: 16640 }, - { type: 2, pts: 6740509635, ccData: 31 }, - { type: 2, pts: 6740509635, ccData: 5264 }, - { type: 2, pts: 6740509635, ccData: 1283 }, - { type: 2, pts: 6740509635, ccData: 37162 }, - { type: 2, pts: 6740509635, ccData: 42 }, - { type: 2, pts: 6740509635, ccData: 37376 }, - { type: 2, pts: 6740509635, ccData: 2048 }, - { type: 3, pts: 6740515641, ccData: 17187 }, - { type: 2, pts: 6740515641, ccData: 37376 }, - { type: 2, pts: 6740515641, ccData: 2304 }, - { type: 3, pts: 6740521647, ccData: 33314 }, - { type: 2, pts: 6740521647, ccData: 18541 }, - { type: 3, pts: 6740524650, ccData: 49698 }, - { type: 2, pts: 6740524650, ccData: 27948 }, - { type: 3, pts: 6740527653, ccData: 546 }, - { type: 2, pts: 6740527653, ccData: 24439 }, - { type: 3, pts: 6740530656, ccData: 16930 }, - { type: 2, pts: 6740530656, ccData: 26721 }, - { type: 3, pts: 6740533659, ccData: 33314 }, - { type: 2, pts: 6740533659, ccData: 29791 }, - { type: 3, pts: 6740536662, ccData: 49698 }, - { type: 2, pts: 6740536662, ccData: 25711 }, - { type: 3, pts: 6740539665, ccData: 546 }, - { type: 2, pts: 6740539665, ccData: 24441 }, - { type: 3, pts: 6740542668, ccData: 16930 }, - { type: 2, pts: 6740542668, ccData: 28533 }, - { type: 3, pts: 6740545671, ccData: 33314 }, - { type: 2, pts: 6740545671, ccData: 24436 }, - { type: 3, pts: 6740548674, ccData: 49698 }, - { type: 2, pts: 6740548674, ccData: 26729 }, - { type: 3, pts: 6740551677, ccData: 546 }, - { type: 2, pts: 6740551677, ccData: 28267 }, - { type: 3, pts: 6740554680, ccData: 16930 }, - { type: 2, pts: 6740554680, ccData: 11264 }, - { type: 3, pts: 6740557683, ccData: 35377 }, - { type: 2, pts: 6740557683, ccData: 39195 }, - { type: 2, pts: 6740557683, ccData: 16640 }, - { type: 2, pts: 6740557683, ccData: 287 }, - { type: 2, pts: 6740557683, ccData: 4240 }, - { type: 2, pts: 6740557683, ccData: 1283 }, - { type: 2, pts: 6740557683, ccData: 37162 }, - { type: 2, pts: 6740557683, ccData: 0 }, - { type: 2, pts: 6740557683, ccData: 37377 }, - { type: 2, pts: 6740557683, ccData: 4096 }, - { type: 3, pts: 6740563689, ccData: 49955 }, - { type: 2, pts: 6740563689, ccData: 37377 }, - { type: 2, pts: 6740563689, ccData: 4864 }, - { type: 3, pts: 6740569695, ccData: 546 }, - { type: 2, pts: 6740569695, ccData: 20585 }, - { type: 3, pts: 6740572698, ccData: 16930 }, - { type: 2, pts: 6740572698, ccData: 28267 }, - { type: 3, pts: 6740575701, ccData: 33314 }, - { type: 2, pts: 6740575701, ccData: 24940 }, - { type: 3, pts: 6740578704, ccData: 49698 }, - { type: 2, pts: 6740578704, ccData: 26979 }, - { type: 3, pts: 6740581707, ccData: 546 }, - { type: 2, pts: 6740581707, ccData: 26991 }, - { type: 3, pts: 6740584710, ccData: 16930 }, - { type: 2, pts: 6740584710, ccData: 30067 }, - { type: 3, pts: 6740587713, ccData: 33314 }, - { type: 2, pts: 6740587713, ccData: 16128 }, - { type: 3, pts: 6740590716, ccData: 49698 }, - { type: 2, pts: 6740590716, ccData: 35841 }, - { type: 3, pts: 6740596722, ccData: 546 }, - { type: 2, pts: 6740596722, ccData: 35074 }, - { type: 3, pts: 6740689815, ccData: 18993 }, - { type: 2, pts: 6740689815, ccData: 38939 }, - { type: 2, pts: 6740689815, ccData: 16640 }, - { type: 2, pts: 6740689815, ccData: 31 }, - { type: 2, pts: 6740689815, ccData: 5264 }, - { type: 2, pts: 6740689815, ccData: 1283 }, - { type: 2, pts: 6740689815, ccData: 37162 }, - { type: 2, pts: 6740689815, ccData: 42 }, - { type: 2, pts: 6740689815, ccData: 37376 }, - { type: 2, pts: 6740689815, ccData: 2048 }, - { type: 3, pts: 6740695821, ccData: 33571 }, - { type: 2, pts: 6740695821, ccData: 37376 }, - { type: 2, pts: 6740695821, ccData: 2304 }, - { type: 3, pts: 6740701827, ccData: 49698 }, - { type: 2, pts: 6740701827, ccData: 20553 }, - { type: 3, pts: 6740704830, ccData: 546 }, - { type: 2, pts: 6740704830, ccData: 20043 }, - { type: 3, pts: 6740707833, ccData: 16930 }, - { type: 2, pts: 6740707833, ccData: 16716 }, - { type: 3, pts: 6740710836, ccData: 33314 }, - { type: 2, pts: 6740710836, ccData: 18755 }, - { type: 3, pts: 6740713839, ccData: 49698 }, - { type: 2, pts: 6740713839, ccData: 18767 }, - { type: 3, pts: 6740716842, ccData: 546 }, - { type: 2, pts: 6740716842, ccData: 21843 }, - { type: 3, pts: 6740719845, ccData: 16930 }, - { type: 2, pts: 6740719845, ccData: 14848 }, - { type: 3, pts: 6740722848, ccData: 35377 }, - { type: 2, pts: 6740722848, ccData: 38939 }, - { type: 2, pts: 6740722848, ccData: 16640 }, - { type: 2, pts: 6740722848, ccData: 287 }, - { type: 2, pts: 6740722848, ccData: 4240 }, - { type: 2, pts: 6740722848, ccData: 1283 }, - { type: 2, pts: 6740722848, ccData: 37162 }, - { type: 2, pts: 6740722848, ccData: 0 }, - { type: 2, pts: 6740722848, ccData: 37377 }, - { type: 2, pts: 6740722848, ccData: 1024 }, - { type: 3, pts: 6740728854, ccData: 49955 }, - { type: 2, pts: 6740728854, ccData: 37377 }, - { type: 2, pts: 6740728854, ccData: 1280 }, - { type: 3, pts: 6740734860, ccData: 546 }, - { type: 2, pts: 6740734860, ccData: 18541 }, - { type: 3, pts: 6740737863, ccData: 16930 }, - { type: 2, pts: 6740737863, ccData: 28013 }, - { type: 3, pts: 6740740866, ccData: 33314 }, - { type: 2, pts: 6740740866, ccData: 11822 }, - { type: 3, pts: 6740743869, ccData: 49698 }, - { type: 2, pts: 6740743869, ccData: 11871 }, - { type: 3, pts: 6740746872, ccData: 546 }, - { type: 2, pts: 6740746872, ccData: 18783 }, - { type: 3, pts: 6740749875, ccData: 16930 }, - { type: 2, pts: 6740749875, ccData: 27753 }, - { type: 3, pts: 6740752878, ccData: 33314 }, - { type: 2, pts: 6740752878, ccData: 27493 }, - { type: 3, pts: 6740755881, ccData: 49698 }, - { type: 2, pts: 6740755881, ccData: 24419 }, - { type: 3, pts: 6740758884, ccData: 546 }, - { type: 2, pts: 6740758884, ccData: 30066 }, - { type: 3, pts: 6740761887, ccData: 16930 }, - { type: 2, pts: 6740761887, ccData: 27763 }, - { type: 3, pts: 6740764890, ccData: 33314 }, - { type: 2, pts: 6740764890, ccData: 11776 }, - { type: 3, pts: 6740767893, ccData: 49698 }, - { type: 2, pts: 6740767893, ccData: 35842 }, - { type: 3, pts: 6740773899, ccData: 546 }, - { type: 2, pts: 6740773899, ccData: 35073 }, - { type: 3, pts: 6741071196, ccData: 18993 }, - { type: 2, pts: 6741071196, ccData: 39195 }, - { type: 2, pts: 6741071196, ccData: 17920 }, - { type: 2, pts: 6741071196, ccData: 31 }, - { type: 2, pts: 6741071196, ccData: 5264 }, - { type: 2, pts: 6741071196, ccData: 1283 }, - { type: 2, pts: 6741071196, ccData: 37162 }, - { type: 2, pts: 6741071196, ccData: 42 }, - { type: 2, pts: 6741071196, ccData: 37376 }, - { type: 2, pts: 6741071196, ccData: 0 }, - { type: 3, pts: 6741077202, ccData: 33571 }, - { type: 2, pts: 6741077202, ccData: 37376 }, - { type: 2, pts: 6741077202, ccData: 512 }, - { type: 3, pts: 6741083208, ccData: 49698 }, - { type: 2, pts: 6741083208, ccData: 21608 }, - { type: 3, pts: 6741086211, ccData: 546 }, - { type: 2, pts: 6741086211, ccData: 25951 }, - { type: 3, pts: 6741089214, ccData: 16930 }, - { type: 2, pts: 6741089214, ccData: 26213 }, - { type: 3, pts: 6741092217, ccData: 33314 }, - { type: 2, pts: 6741092217, ccData: 24948 }, - { type: 3, pts: 6741095220, ccData: 49698 }, - { type: 2, pts: 6741095220, ccData: 26725 }, - { type: 3, pts: 6741098223, ccData: 546 }, - { type: 2, pts: 6741098223, ccData: 29279 }, - { type: 3, pts: 6741101226, ccData: 16930 }, - { type: 2, pts: 6741101226, ccData: 26725 }, - { type: 3, pts: 6741104229, ccData: 33314 }, - { type: 2, pts: 6741104229, ccData: 24932 }, - { type: 3, pts: 6741107232, ccData: 49698 }, - { type: 2, pts: 6741107232, ccData: 25185 }, - { type: 3, pts: 6741110235, ccData: 546 }, - { type: 2, pts: 6741110235, ccData: 28260 }, - { type: 3, pts: 6741113238, ccData: 16930 }, - { type: 2, pts: 6741113238, ccData: 24425 }, - { type: 3, pts: 6741116241, ccData: 33314 }, - { type: 2, pts: 6741116241, ccData: 29535 }, - { type: 3, pts: 6741119244, ccData: 49698 }, - { type: 2, pts: 6741119244, ccData: 26229 }, - { type: 3, pts: 6741122247, ccData: 546 }, - { type: 2, pts: 6741122247, ccData: 28206 }, - { type: 3, pts: 6741125250, ccData: 16930 }, - { type: 2, pts: 6741125250, ccData: 35841 }, - { type: 3, pts: 6741131256, ccData: 33314 }, - { type: 2, pts: 6741131256, ccData: 35074 }, - { type: 3, pts: 6741374499, ccData: 51761 }, - { type: 2, pts: 6741374499, ccData: 38939 }, - { type: 2, pts: 6741374499, ccData: 17920 }, - { type: 2, pts: 6741374499, ccData: 31 }, - { type: 2, pts: 6741374499, ccData: 5264 }, - { type: 2, pts: 6741374499, ccData: 1283 }, - { type: 2, pts: 6741374499, ccData: 37162 }, - { type: 2, pts: 6741374499, ccData: 42 }, - { type: 2, pts: 6741374499, ccData: 37376 }, - { type: 2, pts: 6741374499, ccData: 0 }, - { type: 3, pts: 6741380505, ccData: 803 }, - { type: 2, pts: 6741380505, ccData: 37376 }, - { type: 2, pts: 6741380505, ccData: 256 }, - { type: 3, pts: 6741386511, ccData: 16930 }, - { type: 2, pts: 6741386511, ccData: 18727 }, - { type: 3, pts: 6741389514, ccData: 33314 }, - { type: 2, pts: 6741389514, ccData: 30309 }, - { type: 3, pts: 6741392517, ccData: 49698 }, - { type: 2, pts: 6741392517, ccData: 24430 }, - { type: 3, pts: 6741395520, ccData: 546 }, - { type: 2, pts: 6741395520, ccData: 25974 }, - { type: 3, pts: 6741398523, ccData: 16930 }, - { type: 2, pts: 6741398523, ccData: 25970 }, - { type: 3, pts: 6741401526, ccData: 33314 }, - { type: 2, pts: 6741401526, ccData: 24424 }, - { type: 3, pts: 6741404529, ccData: 49698 }, - { type: 2, pts: 6741404529, ccData: 24932 }, - { type: 3, pts: 6741407532, ccData: 546 }, - { type: 2, pts: 6741407532, ccData: 24418 }, - { type: 3, pts: 6741410535, ccData: 16930 }, - { type: 2, pts: 6741410535, ccData: 29281 }, - { type: 3, pts: 6741413538, ccData: 33314 }, - { type: 2, pts: 6741413538, ccData: 26980 }, - { type: 3, pts: 6741416541, ccData: 49698 }, - { type: 2, pts: 6741416541, ccData: 29535 }, - { type: 3, pts: 6741419544, ccData: 546 }, - { type: 2, pts: 6741419544, ccData: 25189 }, - { type: 3, pts: 6741422547, ccData: 16930 }, - { type: 2, pts: 6741422547, ccData: 26223 }, - { type: 3, pts: 6741425550, ccData: 33314 }, - { type: 2, pts: 6741425550, ccData: 29285 }, - { type: 3, pts: 6741428553, ccData: 49698 }, - { type: 2, pts: 6741428553, ccData: 11776 }, - { type: 3, pts: 6741431556, ccData: 546 }, - { type: 2, pts: 6741431556, ccData: 35842 }, - { type: 3, pts: 6741437562, ccData: 16930 }, - { type: 2, pts: 6741437562, ccData: 35073 }, - { type: 3, pts: 6741629754, ccData: 35377 }, - { type: 2, pts: 6741629754, ccData: 39195 }, - { type: 2, pts: 6741629754, ccData: 16640 }, - { type: 2, pts: 6741629754, ccData: 31 }, - { type: 2, pts: 6741629754, ccData: 5264 }, - { type: 2, pts: 6741629754, ccData: 1283 }, - { type: 2, pts: 6741629754, ccData: 37162 }, - { type: 2, pts: 6741629754, ccData: 42 }, - { type: 2, pts: 6741629754, ccData: 37376 }, - { type: 2, pts: 6741629754, ccData: 0 }, - { type: 3, pts: 6741635760, ccData: 49698 }, - { type: 2, pts: 6741635760, ccData: 17513 }, - { type: 3, pts: 6741638763, ccData: 546 }, - { type: 2, pts: 6741638763, ccData: 25695 }, - { type: 3, pts: 6741641766, ccData: 16930 }, - { type: 2, pts: 6741641766, ccData: 31087 }, - { type: 3, pts: 6741644769, ccData: 33314 }, - { type: 2, pts: 6741644769, ccData: 30047 }, - { type: 3, pts: 6741647772, ccData: 49698 }, - { type: 2, pts: 6741647772, ccData: 29541 }, - { type: 3, pts: 6741650775, ccData: 546 }, - { type: 2, pts: 6741650775, ccData: 25951 }, - { type: 3, pts: 6741653778, ccData: 16930 }, - { type: 2, pts: 6741653778, ccData: 24942 }, - { type: 3, pts: 6741656781, ccData: 33314 }, - { type: 2, pts: 6741656781, ccData: 31092 }, - { type: 3, pts: 6741659784, ccData: 49698 }, - { type: 2, pts: 6741659784, ccData: 26729 }, - { type: 3, pts: 6741662787, ccData: 546 }, - { type: 2, pts: 6741662787, ccData: 28263 }, - { type: 3, pts: 6741665790, ccData: 18993 }, - { type: 2, pts: 6741665790, ccData: 39195 }, - { type: 2, pts: 6741665790, ccData: 16640 }, - { type: 2, pts: 6741665790, ccData: 287 }, - { type: 2, pts: 6741665790, ccData: 4240 }, - { type: 2, pts: 6741665790, ccData: 1283 }, - { type: 2, pts: 6741665790, ccData: 37162 }, - { type: 2, pts: 6741665790, ccData: 0 }, - { type: 2, pts: 6741665790, ccData: 37377 }, - { type: 2, pts: 6741665790, ccData: 0 }, - { type: 3, pts: 6741671796, ccData: 33314 }, - { type: 2, pts: 6741671796, ccData: 31087 }, - { type: 3, pts: 6741674799, ccData: 49698 }, - { type: 2, pts: 6741674799, ccData: 30047 }, - { type: 3, pts: 6741677802, ccData: 546 }, - { type: 2, pts: 6741677802, ccData: 27753 }, - { type: 3, pts: 6741680805, ccData: 16930 }, - { type: 2, pts: 6741680805, ccData: 27493 }, - { type: 3, pts: 6741683808, ccData: 33314 }, - { type: 2, pts: 6741683808, ccData: 16128 }, - { type: 3, pts: 6741686811, ccData: 49698 }, - { type: 2, pts: 6741686811, ccData: 35841 }, - { type: 3, pts: 6741692817, ccData: 546 }, - { type: 2, pts: 6741692817, ccData: 35074 }, - { type: 3, pts: 6741830955, ccData: 18993 }, - { type: 2, pts: 6741830955, ccData: 38939 }, - { type: 2, pts: 6741830955, ccData: 17920 }, - { type: 2, pts: 6741830955, ccData: 31 }, - { type: 2, pts: 6741830955, ccData: 5264 }, - { type: 2, pts: 6741830955, ccData: 1283 }, - { type: 2, pts: 6741830955, ccData: 37162 }, - { type: 2, pts: 6741830955, ccData: 42 }, - { type: 2, pts: 6741830955, ccData: 37376 }, - { type: 2, pts: 6741830955, ccData: 0 }, - { type: 3, pts: 6741836961, ccData: 33571 }, - { type: 2, pts: 6741836961, ccData: 37376 }, - { type: 2, pts: 6741836961, ccData: 768 }, - { type: 3, pts: 6741842967, ccData: 49698 }, - { type: 2, pts: 6741842967, ccData: 18783 }, - { type: 3, pts: 6741845970, ccData: 546 }, - { type: 2, pts: 6741845970, ccData: 27753 }, - { type: 3, pts: 6741848973, ccData: 16930 }, - { type: 2, pts: 6741848973, ccData: 27493 }, - { type: 3, pts: 6741851976, ccData: 33314 }, - { type: 2, pts: 6741851976, ccData: 24417 }, - { type: 3, pts: 6741854979, ccData: 49698 }, - { type: 2, pts: 6741854979, ccData: 27756 }, - { type: 3, pts: 6741857982, ccData: 546 }, - { type: 2, pts: 6741857982, ccData: 24436 }, - { type: 3, pts: 6741860985, ccData: 16930 }, - { type: 2, pts: 6741860985, ccData: 26725 }, - { type: 3, pts: 6741863988, ccData: 33314 }, - { type: 2, pts: 6741863988, ccData: 24424 }, - { type: 3, pts: 6741866991, ccData: 49698 }, - { type: 2, pts: 6741866991, ccData: 24937 }, - { type: 3, pts: 6741869994, ccData: 546 }, - { type: 2, pts: 6741869994, ccData: 29299 }, - { type: 3, pts: 6741872997, ccData: 16930 }, - { type: 2, pts: 6741872997, ccData: 29817 }, - { type: 3, pts: 6741876000, ccData: 33314 }, - { type: 2, pts: 6741876000, ccData: 27749 }, - { type: 3, pts: 6741879003, ccData: 49698 }, - { type: 2, pts: 6741879003, ccData: 29486 }, - { type: 3, pts: 6741882006, ccData: 546 }, - { type: 2, pts: 6741882006, ccData: 35842 }, - { type: 3, pts: 6741888012, ccData: 16930 }, - { type: 2, pts: 6741888012, ccData: 35073 }, - { type: 3, pts: 6741978102, ccData: 35377 }, - { type: 2, pts: 6741978102, ccData: 39195 }, - { type: 2, pts: 6741978102, ccData: 16640 }, - { type: 2, pts: 6741978102, ccData: 31 }, - { type: 2, pts: 6741978102, ccData: 5264 }, - { type: 2, pts: 6741978102, ccData: 1283 }, - { type: 2, pts: 6741978102, ccData: 37162 }, - { type: 2, pts: 6741978102, ccData: 42 }, - { type: 2, pts: 6741978102, ccData: 37376 }, - { type: 2, pts: 6741978102, ccData: 2048 }, - { type: 3, pts: 6741984108, ccData: 49698 }, - { type: 2, pts: 6741984108, ccData: 17013 }, - { type: 3, pts: 6741987111, ccData: 546 }, - { type: 2, pts: 6741987111, ccData: 29791 }, - { type: 3, pts: 6741990114, ccData: 16930 }, - { type: 2, pts: 6741990114, ccData: 18727 }, - { type: 3, pts: 6741993117, ccData: 33314 }, - { type: 2, pts: 6741993117, ccData: 27999 }, - { type: 3, pts: 6741996120, ccData: 49698 }, - { type: 2, pts: 6741996120, ccData: 28271 }, - { type: 3, pts: 6741999123, ccData: 546 }, - { type: 2, pts: 6741999123, ccData: 29791 }, - { type: 3, pts: 6742002126, ccData: 16930 }, - { type: 2, pts: 6742002126, ccData: 29557 }, - { type: 3, pts: 6742005129, ccData: 33314 }, - { type: 2, pts: 6742005129, ccData: 29285 }, - { type: 3, pts: 6742008132, ccData: 51761 }, - { type: 2, pts: 6742008132, ccData: 39195 }, - { type: 2, pts: 6742008132, ccData: 16640 }, - { type: 2, pts: 6742008132, ccData: 287 }, - { type: 2, pts: 6742008132, ccData: 4240 }, - { type: 2, pts: 6742008132, ccData: 1283 }, - { type: 2, pts: 6742008132, ccData: 37162 }, - { type: 2, pts: 6742008132, ccData: 0 }, - { type: 2, pts: 6742008132, ccData: 37377 }, - { type: 2, pts: 6742008132, ccData: 1024 }, - { type: 3, pts: 6742014138, ccData: 803 }, - { type: 2, pts: 6742014138, ccData: 37377 }, - { type: 2, pts: 6742014138, ccData: 1280 }, - { type: 3, pts: 6742020144, ccData: 16930 }, - { type: 2, pts: 6742020144, ccData: 29800 }, - { type: 3, pts: 6742023147, ccData: 33314 }, - { type: 2, pts: 6742023147, ccData: 25977 }, - { type: 3, pts: 6742026150, ccData: 49698 }, - { type: 2, pts: 6742026150, ccData: 10098 }, - { type: 3, pts: 6742029153, ccData: 546 }, - { type: 2, pts: 6742029153, ccData: 25951 }, - { type: 3, pts: 6742032156, ccData: 16930 }, - { type: 2, pts: 6742032156, ccData: 29289 }, - { type: 3, pts: 6742035159, ccData: 33314 }, - { type: 2, pts: 6742035159, ccData: 26472 }, - { type: 3, pts: 6742038162, ccData: 49698 }, - { type: 2, pts: 6742038162, ccData: 29791 }, - { type: 3, pts: 6742041165, ccData: 546 }, - { type: 2, pts: 6742041165, ccData: 26223 }, - { type: 3, pts: 6742044168, ccData: 16930 }, - { type: 2, pts: 6742044168, ccData: 29279 }, - { type: 3, pts: 6742047171, ccData: 33314 }, - { type: 2, pts: 6742047171, ccData: 28005 }, - { type: 3, pts: 6742050174, ccData: 49698 }, - { type: 2, pts: 6742050174, ccData: 11776 }, - { type: 3, pts: 6742053177, ccData: 546 }, - { type: 2, pts: 6742053177, ccData: 35841 }, - { type: 3, pts: 6742059183, ccData: 16930 }, - { type: 2, pts: 6742059183, ccData: 35074 }, - { type: 3, pts: 6742272396, ccData: 35377 }, - { type: 2, pts: 6742272396, ccData: 38939 }, - { type: 2, pts: 6742272396, ccData: 17920 }, - { type: 2, pts: 6742272396, ccData: 31 }, - { type: 2, pts: 6742272396, ccData: 5264 }, - { type: 2, pts: 6742272396, ccData: 1283 }, - { type: 2, pts: 6742272396, ccData: 37162 }, - { type: 2, pts: 6742272396, ccData: 42 }, - { type: 2, pts: 6742272396, ccData: 37376 }, - { type: 2, pts: 6742272396, ccData: 2048 }, - { type: 3, pts: 6742278402, ccData: 49955 }, - { type: 2, pts: 6742278402, ccData: 37376 }, - { type: 2, pts: 6742278402, ccData: 2560 }, - { type: 3, pts: 6742284408, ccData: 546 }, - { type: 2, pts: 6742284408, ccData: 21608 }, - { type: 3, pts: 6742287411, ccData: 16930 }, - { type: 2, pts: 6742287411, ccData: 24948 }, - { type: 3, pts: 6742290414, ccData: 33314 }, - { type: 2, pts: 6742290414, ccData: 10099 }, - { type: 3, pts: 6742293417, ccData: 49698 }, - { type: 2, pts: 6742293417, ccData: 24431 }, - { type: 3, pts: 6742296420, ccData: 546 }, - { type: 2, pts: 6742296420, ccData: 27489 }, - { type: 3, pts: 6742299423, ccData: 16930 }, - { type: 2, pts: 6742299423, ccData: 31022 }, - { type: 3, pts: 6742302426, ccData: 33314 }, - { type: 2, pts: 6742302426, ccData: 35842 }, - { type: 3, pts: 6742308432, ccData: 49698 }, - { type: 2, pts: 6742308432, ccData: 35073 }, - { type: 3, pts: 6742332456, ccData: 2609 }, - { type: 2, pts: 6742332456, ccData: 39195 }, - { type: 2, pts: 6742332456, ccData: 16640 }, - { type: 2, pts: 6742332456, ccData: 31 }, - { type: 2, pts: 6742332456, ccData: 5264 }, - { type: 2, pts: 6742332456, ccData: 1283 }, - { type: 2, pts: 6742332456, ccData: 37162 }, - { type: 2, pts: 6742332456, ccData: 42 }, - { type: 2, pts: 6742332456, ccData: 37376 }, - { type: 2, pts: 6742332456, ccData: 2048 }, - { type: 3, pts: 6742338462, ccData: 16930 }, - { type: 2, pts: 6742338462, ccData: 22895 }, - { type: 3, pts: 6742341465, ccData: 33314 }, - { type: 2, pts: 6742341465, ccData: 30047 }, - { type: 3, pts: 6742344468, ccData: 49698 }, - { type: 2, pts: 6742344468, ccData: 25441 }, - { type: 3, pts: 6742347471, ccData: 546 }, - { type: 2, pts: 6742347471, ccData: 28255 }, - { type: 3, pts: 6742350474, ccData: 16930 }, - { type: 2, pts: 6742350474, ccData: 28001 }, - { type: 3, pts: 6742353477, ccData: 33314 }, - { type: 2, pts: 6742353477, ccData: 27493 }, - { type: 3, pts: 6742356480, ccData: 49698 }, - { type: 2, pts: 6742356480, ccData: 24437 }, - { type: 3, pts: 6742359483, ccData: 546 }, - { type: 2, pts: 6742359483, ccData: 28672 }, - { type: 3, pts: 6742362486, ccData: 18993 }, - { type: 2, pts: 6742362486, ccData: 39195 }, - { type: 2, pts: 6742362486, ccData: 16640 }, - { type: 2, pts: 6742362486, ccData: 287 }, - { type: 2, pts: 6742362486, ccData: 4240 }, - { type: 2, pts: 6742362486, ccData: 1283 }, - { type: 2, pts: 6742362486, ccData: 37162 }, - { type: 2, pts: 6742362486, ccData: 0 }, - { type: 2, pts: 6742362486, ccData: 37377 }, - { type: 2, pts: 6742362486, ccData: 1024 }, - { type: 3, pts: 6742368492, ccData: 33571 }, - { type: 2, pts: 6742368492, ccData: 37377 }, - { type: 2, pts: 6742368492, ccData: 1536 }, - { type: 3, pts: 6742374498, ccData: 49698 }, - { type: 2, pts: 6742374498, ccData: 31087 }, - { type: 3, pts: 6742377501, ccData: 546 }, - { type: 2, pts: 6742377501, ccData: 30066 }, - { type: 3, pts: 6742380504, ccData: 16930 }, - { type: 2, pts: 6742380504, ccData: 24431 }, - { type: 3, pts: 6742383507, ccData: 33314 }, - { type: 2, pts: 6742383507, ccData: 30574 }, - { type: 3, pts: 6742386510, ccData: 49698 }, - { type: 2, pts: 6742386510, ccData: 24424 }, - { type: 3, pts: 6742389513, ccData: 546 }, - { type: 2, pts: 6742389513, ccData: 24937 }, - { type: 3, pts: 6742392516, ccData: 16930 }, - { type: 2, pts: 6742392516, ccData: 29299 }, - { type: 3, pts: 6742395519, ccData: 33314 }, - { type: 2, pts: 6742395519, ccData: 29817 }, - { type: 3, pts: 6742398522, ccData: 49698 }, - { type: 2, pts: 6742398522, ccData: 27749 }, - { type: 3, pts: 6742401525, ccData: 546 }, - { type: 2, pts: 6742401525, ccData: 11776 }, - { type: 3, pts: 6742404528, ccData: 16930 }, - { type: 2, pts: 6742404528, ccData: 35841 }, - { type: 3, pts: 6742410534, ccData: 33314 }, - { type: 2, pts: 6742410534, ccData: 35074 }, - { type: 3, pts: 6742554678, ccData: 51761 }, - { type: 2, pts: 6742554678, ccData: 38939 }, - { type: 2, pts: 6742554678, ccData: 17920 }, - { type: 2, pts: 6742554678, ccData: 31 }, - { type: 2, pts: 6742554678, ccData: 5264 }, - { type: 2, pts: 6742554678, ccData: 1283 }, - { type: 2, pts: 6742554678, ccData: 37162 }, - { type: 2, pts: 6742554678, ccData: 42 }, - { type: 2, pts: 6742554678, ccData: 37376 }, - { type: 2, pts: 6742554678, ccData: 3072 }, - { type: 3, pts: 6742560684, ccData: 803 }, - { type: 2, pts: 6742560684, ccData: 37376 }, - { type: 2, pts: 6742560684, ccData: 3328 }, - { type: 3, pts: 6742566690, ccData: 16930 }, - { type: 2, pts: 6742566690, ccData: 18783 }, - { type: 3, pts: 6742569693, ccData: 33314 }, - { type: 2, pts: 6742569693, ccData: 25441 }, - { type: 3, pts: 6742572696, ccData: 49698 }, - { type: 2, pts: 6742572696, ccData: 28223 }, - { type: 3, pts: 6742575699, ccData: 546 }, - { type: 2, pts: 6742575699, ccData: 35842 }, - { type: 3, pts: 6742581705, ccData: 16930 }, - { type: 2, pts: 6742581705, ccData: 35073 }, - { type: 3, pts: 6742740864, ccData: 35377 }, - { type: 2, pts: 6742740864, ccData: 39195 }, - { type: 2, pts: 6742740864, ccData: 17920 }, - { type: 2, pts: 6742740864, ccData: 31 }, - { type: 2, pts: 6742740864, ccData: 5264 }, - { type: 2, pts: 6742740864, ccData: 1283 }, - { type: 2, pts: 6742740864, ccData: 37162 }, - { type: 2, pts: 6742740864, ccData: 42 }, - { type: 2, pts: 6742740864, ccData: 37376 }, - { type: 2, pts: 6742740864, ccData: 1024 }, - { type: 3, pts: 6742746870, ccData: 49698 }, - { type: 2, pts: 6742746870, ccData: 21365 }, - { type: 3, pts: 6742749873, ccData: 546 }, - { type: 2, pts: 6742749873, ccData: 29285 }, - { type: 3, pts: 6742752876, ccData: 16930 }, - { type: 2, pts: 6742752876, ccData: 11776 }, - { type: 3, pts: 6742755879, ccData: 33314 }, - { type: 2, pts: 6742755879, ccData: 35841 }, - { type: 3, pts: 6742761885, ccData: 49698 }, - { type: 2, pts: 6742761885, ccData: 35074 }, - { type: 3, pts: 6742815939, ccData: 2609 }, - { type: 2, pts: 6742815939, ccData: 38939 }, - { type: 2, pts: 6742815939, ccData: 17920 }, - { type: 2, pts: 6742815939, ccData: 31 }, - { type: 2, pts: 6742815939, ccData: 5264 }, - { type: 2, pts: 6742815939, ccData: 1283 }, - { type: 2, pts: 6742815939, ccData: 37162 }, - { type: 2, pts: 6742815939, ccData: 42 }, - { type: 2, pts: 6742815939, ccData: 37376 }, - { type: 2, pts: 6742815939, ccData: 0 }, - { type: 3, pts: 6742821945, ccData: 16930 }, - { type: 2, pts: 6742821945, ccData: 17263 }, - { type: 3, pts: 6742824948, ccData: 33314 }, - { type: 2, pts: 6742824948, ccData: 28005 }, - { type: 3, pts: 6742827951, ccData: 49698 }, - { type: 2, pts: 6742827951, ccData: 24439 }, - { type: 3, pts: 6742830954, ccData: 546 }, - { type: 2, pts: 6742830954, ccData: 26996 }, - { type: 3, pts: 6742833957, ccData: 16930 }, - { type: 2, pts: 6742833957, ccData: 26719 }, - { type: 3, pts: 6742836960, ccData: 33314 }, - { type: 2, pts: 6742836960, ccData: 28005 }, - { type: 3, pts: 6742839963, ccData: 49698 }, - { type: 2, pts: 6742839963, ccData: 11776 }, - { type: 3, pts: 6742842966, ccData: 546 }, - { type: 2, pts: 6742842966, ccData: 35842 }, - { type: 3, pts: 6742848972, ccData: 16930 }, - { type: 2, pts: 6742848972, ccData: 35073 }, - { type: 3, pts: 6742921044, ccData: 35377 }, - { type: 2, pts: 6742921044, ccData: 39195 }, - { type: 2, pts: 6742921044, ccData: 16640 }, - { type: 2, pts: 6742921044, ccData: 31 }, - { type: 2, pts: 6742921044, ccData: 5264 }, - { type: 2, pts: 6742921044, ccData: 1283 }, - { type: 2, pts: 6742921044, ccData: 37162 }, - { type: 2, pts: 6742921044, ccData: 42 }, - { type: 2, pts: 6742921044, ccData: 37376 }, - { type: 2, pts: 6742921044, ccData: 0 }, - { type: 3, pts: 6742927050, ccData: 49955 }, - { type: 2, pts: 6742927050, ccData: 37376 }, - { type: 2, pts: 6742927050, ccData: 512 }, - { type: 3, pts: 6742933056, ccData: 546 }, - { type: 2, pts: 6742933056, ccData: 21608 }, - { type: 3, pts: 6742936059, ccData: 16930 }, - { type: 2, pts: 6742936059, ccData: 26995 }, - { type: 3, pts: 6742939062, ccData: 33314 }, - { type: 2, pts: 6742939062, ccData: 24425 }, - { type: 3, pts: 6742942065, ccData: 49698 }, - { type: 2, pts: 6742942065, ccData: 29535 }, - { type: 3, pts: 6742945068, ccData: 546 }, - { type: 2, pts: 6742945068, ccData: 28533 }, - { type: 3, pts: 6742948071, ccData: 16930 }, - { type: 2, pts: 6742948071, ccData: 29184 }, - { type: 3, pts: 6742951074, ccData: 35377 }, - { type: 2, pts: 6742951074, ccData: 39195 }, - { type: 2, pts: 6742951074, ccData: 16640 }, - { type: 2, pts: 6742951074, ccData: 287 }, - { type: 2, pts: 6742951074, ccData: 4240 }, - { type: 2, pts: 6742951074, ccData: 1283 }, - { type: 2, pts: 6742951074, ccData: 37162 }, - { type: 2, pts: 6742951074, ccData: 0 }, - { type: 2, pts: 6742951074, ccData: 37377 }, - { type: 2, pts: 6742951074, ccData: 0 }, - { type: 3, pts: 6742957080, ccData: 49955 }, - { type: 2, pts: 6742957080, ccData: 37377 }, - { type: 2, pts: 6742957080, ccData: 512 }, - { type: 3, pts: 6742963086, ccData: 546 }, - { type: 2, pts: 6742963086, ccData: 17522 }, - { type: 3, pts: 6742966089, ccData: 16930 }, - { type: 2, pts: 6742966089, ccData: 25953 }, - { type: 3, pts: 6742969092, ccData: 33314 }, - { type: 2, pts: 6742969092, ccData: 27999 }, - { type: 3, pts: 6742972095, ccData: 49698 }, - { type: 2, pts: 6742972095, ccData: 17522 }, - { type: 3, pts: 6742975098, ccData: 546 }, - { type: 2, pts: 6742975098, ccData: 24951 }, - { type: 3, pts: 6742978101, ccData: 16930 }, - { type: 2, pts: 6742978101, ccData: 26990 }, - { type: 3, pts: 6742981104, ccData: 33314 }, - { type: 2, pts: 6742981104, ccData: 26463 }, - { type: 3, pts: 6742984107, ccData: 49698 }, - { type: 2, pts: 6742984107, ccData: 17007 }, - { type: 3, pts: 6742987110, ccData: 546 }, - { type: 2, pts: 6742987110, ccData: 24946 }, - { type: 3, pts: 6742990113, ccData: 16930 }, - { type: 2, pts: 6742990113, ccData: 25646 }, - { type: 3, pts: 6742993116, ccData: 33314 }, - { type: 2, pts: 6742993116, ccData: 35841 }, - { type: 3, pts: 6742999122, ccData: 49698 }, - { type: 2, pts: 6742999122, ccData: 35074 }, - { type: 3, pts: 6743110233, ccData: 2609 }, - { type: 2, pts: 6743110233, ccData: 38939 }, - { type: 2, pts: 6743110233, ccData: 16640 }, - { type: 2, pts: 6743110233, ccData: 31 }, - { type: 2, pts: 6743110233, ccData: 5264 }, - { type: 2, pts: 6743110233, ccData: 1283 }, - { type: 2, pts: 6743110233, ccData: 37162 }, - { type: 2, pts: 6743110233, ccData: 42 }, - { type: 2, pts: 6743110233, ccData: 37376 }, - { type: 2, pts: 6743110233, ccData: 0 }, - { type: 3, pts: 6743116239, ccData: 17187 }, - { type: 2, pts: 6743116239, ccData: 37376 }, - { type: 2, pts: 6743116239, ccData: 512 }, - { type: 3, pts: 6743122245, ccData: 33314 }, - { type: 2, pts: 6743122245, ccData: 22895 }, - { type: 3, pts: 6743125248, ccData: 49698 }, - { type: 2, pts: 6743125248, ccData: 30047 }, - { type: 3, pts: 6743128251, ccData: 546 }, - { type: 2, pts: 6743128251, ccData: 25441 }, - { type: 3, pts: 6743131254, ccData: 16930 }, - { type: 2, pts: 6743131254, ccData: 28255 }, - { type: 3, pts: 6743134257, ccData: 33314 }, - { type: 2, pts: 6743134257, ccData: 25714 }, - { type: 3, pts: 6743137260, ccData: 49698 }, - { type: 2, pts: 6743137260, ccData: 24951 }, - { type: 3, pts: 6743140263, ccData: 546 }, - { type: 2, pts: 6743140263, ccData: 24417 }, - { type: 3, pts: 6743143266, ccData: 16930 }, - { type: 2, pts: 6743143266, ccData: 28281 }, - { type: 3, pts: 6743146269, ccData: 33314 }, - { type: 2, pts: 6743146269, ccData: 24424 }, - { type: 3, pts: 6743149272, ccData: 49698 }, - { type: 2, pts: 6743149272, ccData: 24937 }, - { type: 3, pts: 6743152275, ccData: 546 }, - { type: 2, pts: 6743152275, ccData: 29299 }, - { type: 3, pts: 6743155278, ccData: 16930 }, - { type: 2, pts: 6743155278, ccData: 29817 }, - { type: 3, pts: 6743158281, ccData: 33314 }, - { type: 2, pts: 6743158281, ccData: 27749 }, - { type: 3, pts: 6743161284, ccData: 51761 }, - { type: 2, pts: 6743161284, ccData: 38939 }, - { type: 2, pts: 6743161284, ccData: 16640 }, - { type: 2, pts: 6743161284, ccData: 287 }, - { type: 2, pts: 6743161284, ccData: 4240 }, - { type: 2, pts: 6743161284, ccData: 1283 }, - { type: 2, pts: 6743161284, ccData: 37162 }, - { type: 2, pts: 6743161284, ccData: 0 }, - { type: 2, pts: 6743161284, ccData: 37377 }, - { type: 2, pts: 6743161284, ccData: 0 }, - { type: 3, pts: 6743167290, ccData: 803 }, - { type: 2, pts: 6743167290, ccData: 37377 }, - { type: 2, pts: 6743167290, ccData: 512 }, - { type: 3, pts: 6743173296, ccData: 16930 }, - { type: 2, pts: 6743173296, ccData: 31087 }, - { type: 3, pts: 6743176299, ccData: 33314 }, - { type: 2, pts: 6743176299, ccData: 30047 }, - { type: 3, pts: 6743179302, ccData: 49698 }, - { type: 2, pts: 6743179302, ccData: 25714 }, - { type: 3, pts: 6743182305, ccData: 546 }, - { type: 2, pts: 6743182305, ccData: 25953 }, - { type: 3, pts: 6743185308, ccData: 16930 }, - { type: 2, pts: 6743185308, ccData: 27999 }, - { type: 3, pts: 6743188311, ccData: 33314 }, - { type: 2, pts: 6743188311, ccData: 30064 }, - { type: 3, pts: 6743191314, ccData: 49698 }, - { type: 2, pts: 6743191314, ccData: 11776 }, - { type: 3, pts: 6743194317, ccData: 546 }, - { type: 2, pts: 6743194317, ccData: 35842 }, - { type: 3, pts: 6743200323, ccData: 16930 }, - { type: 2, pts: 6743200323, ccData: 35073 }, - { type: 3, pts: 6743341464, ccData: 35377 }, - { type: 2, pts: 6743341464, ccData: 39195 }, - { type: 2, pts: 6743341464, ccData: 16640 }, - { type: 2, pts: 6743341464, ccData: 31 }, - { type: 2, pts: 6743341464, ccData: 5264 }, - { type: 2, pts: 6743341464, ccData: 1283 }, - { type: 2, pts: 6743341464, ccData: 37162 }, - { type: 2, pts: 6743341464, ccData: 42 }, - { type: 2, pts: 6743341464, ccData: 37376 }, - { type: 2, pts: 6743341464, ccData: 0 }, - { type: 3, pts: 6743347470, ccData: 49955 }, - { type: 2, pts: 6743347470, ccData: 37376 }, - { type: 2, pts: 6743347470, ccData: 512 }, - { type: 3, pts: 6743353476, ccData: 546 }, - { type: 2, pts: 6743353476, ccData: 16750 }, - { type: 3, pts: 6743356479, ccData: 16930 }, - { type: 2, pts: 6743356479, ccData: 25695 }, - { type: 3, pts: 6743359482, ccData: 33314 }, - { type: 2, pts: 6743359482, ccData: 29800 }, - { type: 3, pts: 6743362485, ccData: 49698 }, - { type: 2, pts: 6743362485, ccData: 25966 }, - { type: 3, pts: 6743365488, ccData: 2609 }, - { type: 2, pts: 6743365488, ccData: 39195 }, - { type: 2, pts: 6743365488, ccData: 16640 }, - { type: 2, pts: 6743365488, ccData: 287 }, - { type: 2, pts: 6743365488, ccData: 4240 }, - { type: 2, pts: 6743365488, ccData: 1283 }, - { type: 2, pts: 6743365488, ccData: 37162 }, - { type: 2, pts: 6743365488, ccData: 0 }, - { type: 2, pts: 6743365488, ccData: 37377 }, - { type: 2, pts: 6743365488, ccData: 0 }, - { type: 3, pts: 6743371494, ccData: 17187 }, - { type: 2, pts: 6743371494, ccData: 37377 }, - { type: 2, pts: 6743371494, ccData: 512 }, - { type: 3, pts: 6743377500, ccData: 33314 }, - { type: 2, pts: 6743377500, ccData: 18727 }, - { type: 3, pts: 6743380503, ccData: 49698 }, - { type: 2, pts: 6743380503, ccData: 27756 }, - { type: 3, pts: 6743383506, ccData: 546 }, - { type: 2, pts: 6743383506, ccData: 24429 }, - { type: 3, pts: 6743386509, ccData: 16930 }, - { type: 2, pts: 6743386509, ccData: 24939 }, - { type: 3, pts: 6743389512, ccData: 33314 }, - { type: 2, pts: 6743389512, ccData: 25951 }, - { type: 3, pts: 6743392515, ccData: 49698 }, - { type: 2, pts: 6743392515, ccData: 31087 }, - { type: 3, pts: 6743395518, ccData: 546 }, - { type: 2, pts: 6743395518, ccData: 30066 }, - { type: 3, pts: 6743398521, ccData: 16930 }, - { type: 2, pts: 6743398521, ccData: 24424 }, - { type: 3, pts: 6743401524, ccData: 33314 }, - { type: 2, pts: 6743401524, ccData: 24937 }, - { type: 3, pts: 6743404527, ccData: 49698 }, - { type: 2, pts: 6743404527, ccData: 29184 }, - { type: 3, pts: 6743407530, ccData: 546 }, - { type: 2, pts: 6743407530, ccData: 35841 }, - { type: 3, pts: 6743413536, ccData: 16930 }, - { type: 2, pts: 6743413536, ccData: 35074 }, - { type: 3, pts: 6743491614, ccData: 35377 }, - { type: 2, pts: 6743491614, ccData: 38939 }, - { type: 2, pts: 6743491614, ccData: 16640 }, - { type: 2, pts: 6743491614, ccData: 31 }, - { type: 2, pts: 6743491614, ccData: 5264 }, - { type: 2, pts: 6743491614, ccData: 1283 }, - { type: 2, pts: 6743491614, ccData: 37162 }, - { type: 2, pts: 6743491614, ccData: 42 }, - { type: 2, pts: 6743491614, ccData: 37376 }, - { type: 2, pts: 6743491614, ccData: 0 }, - { type: 3, pts: 6743497620, ccData: 49955 }, - { type: 2, pts: 6743497620, ccData: 37376 }, - { type: 2, pts: 6743497620, ccData: 768 }, - { type: 3, pts: 6743503626, ccData: 546 }, - { type: 2, pts: 6743503626, ccData: 27759 }, - { type: 3, pts: 6743506629, ccData: 16930 }, - { type: 2, pts: 6743506629, ccData: 28523 }, - { type: 3, pts: 6743509632, ccData: 33314 }, - { type: 2, pts: 6743509632, ccData: 24426 }, - { type: 3, pts: 6743512635, ccData: 49698 }, - { type: 2, pts: 6743512635, ccData: 30067 }, - { type: 3, pts: 6743515638, ccData: 546 }, - { type: 2, pts: 6743515638, ccData: 29696 }, - { type: 3, pts: 6743518641, ccData: 18993 }, - { type: 2, pts: 6743518641, ccData: 38939 }, - { type: 2, pts: 6743518641, ccData: 16640 }, - { type: 2, pts: 6743518641, ccData: 287 }, - { type: 2, pts: 6743518641, ccData: 4240 }, - { type: 2, pts: 6743518641, ccData: 1283 }, - { type: 2, pts: 6743518641, ccData: 37162 }, - { type: 2, pts: 6743518641, ccData: 0 }, - { type: 2, pts: 6743518641, ccData: 37377 }, - { type: 2, pts: 6743518641, ccData: 0 }, - { type: 3, pts: 6743524647, ccData: 33571 }, - { type: 2, pts: 6743524647, ccData: 37377 }, - { type: 2, pts: 6743524647, ccData: 768 }, - { type: 3, pts: 6743530653, ccData: 49698 }, - { type: 2, pts: 6743530653, ccData: 27753 }, - { type: 3, pts: 6743533656, ccData: 546 }, - { type: 2, pts: 6743533656, ccData: 27493 }, - { type: 3, pts: 6743536659, ccData: 16930 }, - { type: 2, pts: 6743536659, ccData: 24441 }, - { type: 3, pts: 6743539662, ccData: 33314 }, - { type: 2, pts: 6743539662, ccData: 28533 }, - { type: 3, pts: 6743542665, ccData: 49698 }, - { type: 2, pts: 6743542665, ccData: 29279 }, - { type: 3, pts: 6743545668, ccData: 546 }, - { type: 2, pts: 6743545668, ccData: 28777 }, - { type: 3, pts: 6743548671, ccData: 16930 }, - { type: 2, pts: 6743548671, ccData: 25460 }, - { type: 3, pts: 6743551674, ccData: 33314 }, - { type: 2, pts: 6743551674, ccData: 30066 }, - { type: 3, pts: 6743554677, ccData: 49698 }, - { type: 2, pts: 6743554677, ccData: 25902 }, - { type: 3, pts: 6743557680, ccData: 546 }, - { type: 2, pts: 6743557680, ccData: 35842 }, - { type: 3, pts: 6743563686, ccData: 16930 }, - { type: 2, pts: 6743563686, ccData: 35073 }, - { type: 3, pts: 6743644767, ccData: 35377 }, - { type: 2, pts: 6743644767, ccData: 39195 }, - { type: 2, pts: 6743644767, ccData: 17920 }, - { type: 2, pts: 6743644767, ccData: 31 }, - { type: 2, pts: 6743644767, ccData: 5264 }, - { type: 2, pts: 6743644767, ccData: 1283 }, - { type: 2, pts: 6743644767, ccData: 37162 }, - { type: 2, pts: 6743644767, ccData: 42 }, - { type: 2, pts: 6743644767, ccData: 37376 }, - { type: 2, pts: 6743644767, ccData: 1024 }, - { type: 3, pts: 6743650773, ccData: 49955 }, - { type: 2, pts: 6743650773, ccData: 37376 }, - { type: 2, pts: 6743650773, ccData: 1536 }, - { type: 3, pts: 6743656779, ccData: 546 }, - { type: 2, pts: 6743656779, ccData: 21608 }, - { type: 3, pts: 6743659782, ccData: 16930 }, - { type: 2, pts: 6743659782, ccData: 24948 }, - { type: 3, pts: 6743662785, ccData: 33314 }, - { type: 2, pts: 6743662785, ccData: 10099 }, - { type: 3, pts: 6743665788, ccData: 49698 }, - { type: 2, pts: 6743665788, ccData: 24432 }, - { type: 3, pts: 6743668791, ccData: 546 }, - { type: 2, pts: 6743668791, ccData: 26990 }, - { type: 3, pts: 6743671794, ccData: 16930 }, - { type: 2, pts: 6743671794, ccData: 27489 }, - { type: 3, pts: 6743674797, ccData: 33314 }, - { type: 2, pts: 6743674797, ccData: 28001 }, - { type: 3, pts: 6743677800, ccData: 49698 }, - { type: 2, pts: 6743677800, ccData: 31337 }, - { type: 3, pts: 6743680803, ccData: 546 }, - { type: 2, pts: 6743680803, ccData: 28263 }, - { type: 3, pts: 6743683806, ccData: 16930 }, - { type: 2, pts: 6743683806, ccData: 8448 }, - { type: 3, pts: 6743686809, ccData: 33314 }, - { type: 2, pts: 6743686809, ccData: 35841 }, - { type: 3, pts: 6743692815, ccData: 49698 }, - { type: 2, pts: 6743692815, ccData: 35074 }, - { type: 3, pts: 6743900022, ccData: 2609 }, - { type: 2, pts: 6743900022, ccData: 38939 }, - { type: 2, pts: 6743900022, ccData: 17920 }, - { type: 2, pts: 6743900022, ccData: 31 }, - { type: 2, pts: 6743900022, ccData: 5264 }, - { type: 2, pts: 6743900022, ccData: 1283 }, - { type: 2, pts: 6743900022, ccData: 37162 }, - { type: 2, pts: 6743900022, ccData: 42 }, - { type: 2, pts: 6743900022, ccData: 37376 }, - { type: 2, pts: 6743900022, ccData: 3072 }, - { type: 3, pts: 6743906028, ccData: 16930 }, - { type: 2, pts: 6743906028, ccData: 18541 }, - { type: 3, pts: 6743909031, ccData: 33314 }, - { type: 2, pts: 6743909031, ccData: 28013 }, - { type: 3, pts: 6743912034, ccData: 49698 }, - { type: 2, pts: 6743912034, ccData: 11822 }, - { type: 3, pts: 6743915037, ccData: 546 }, - { type: 2, pts: 6743915037, ccData: 11776 }, - { type: 3, pts: 6743918040, ccData: 16930 }, - { type: 2, pts: 6743918040, ccData: 35842 }, - { type: 3, pts: 6743924046, ccData: 33314 }, - { type: 2, pts: 6743924046, ccData: 35073 }, - { type: 3, pts: 6743960082, ccData: 51761 }, - { type: 2, pts: 6743960082, ccData: 39195 }, - { type: 2, pts: 6743960082, ccData: 16640 }, - { type: 2, pts: 6743960082, ccData: 31 }, - { type: 2, pts: 6743960082, ccData: 5264 }, - { type: 2, pts: 6743960082, ccData: 1283 }, - { type: 2, pts: 6743960082, ccData: 37162 }, - { type: 2, pts: 6743960082, ccData: 42 }, - { type: 2, pts: 6743960082, ccData: 37376 }, - { type: 2, pts: 6743960082, ccData: 1024 }, - { type: 3, pts: 6743966088, ccData: 803 }, - { type: 2, pts: 6743966088, ccData: 37376 }, - { type: 2, pts: 6743966088, ccData: 1280 }, - { type: 3, pts: 6743972094, ccData: 16930 }, - { type: 2, pts: 6743972094, ccData: 22376 }, - { type: 3, pts: 6743975097, ccData: 33314 }, - { type: 2, pts: 6743975097, ccData: 24948 }, - { type: 3, pts: 6743978100, ccData: 49698 }, - { type: 2, pts: 6743978100, ccData: 24427 }, - { type: 3, pts: 6743981103, ccData: 546 }, - { type: 2, pts: 6743981103, ccData: 26990 }, - { type: 3, pts: 6743984106, ccData: 16930 }, - { type: 2, pts: 6743984106, ccData: 25695 }, - { type: 3, pts: 6743987109, ccData: 33314 }, - { type: 2, pts: 6743987109, ccData: 28518 }, - { type: 3, pts: 6743990112, ccData: 49698 }, - { type: 2, pts: 6743990112, ccData: 24424 }, - { type: 3, pts: 6743993115, ccData: 546 }, - { type: 2, pts: 6743993115, ccData: 24937 }, - { type: 3, pts: 6743996118, ccData: 16930 }, - { type: 2, pts: 6743996118, ccData: 29299 }, - { type: 3, pts: 6743999121, ccData: 33314 }, - { type: 2, pts: 6743999121, ccData: 29817 }, - { type: 3, pts: 6744002124, ccData: 49698 }, - { type: 2, pts: 6744002124, ccData: 27749 }, - { type: 3, pts: 6744005127, ccData: 2609 }, - { type: 2, pts: 6744005127, ccData: 39195 }, - { type: 2, pts: 6744005127, ccData: 16640 }, - { type: 2, pts: 6744005127, ccData: 287 }, - { type: 2, pts: 6744005127, ccData: 4240 }, - { type: 2, pts: 6744005127, ccData: 1283 }, - { type: 2, pts: 6744005127, ccData: 37162 }, - { type: 2, pts: 6744005127, ccData: 0 }, - { type: 2, pts: 6744005127, ccData: 37377 }, - { type: 2, pts: 6744005127, ccData: 2048 }, - { type: 3, pts: 6744011133, ccData: 17187 }, - { type: 2, pts: 6744011133, ccData: 37377 }, - { type: 2, pts: 6744011133, ccData: 2304 }, - { type: 3, pts: 6744017139, ccData: 33314 }, - { type: 2, pts: 6744017139, ccData: 29544 }, - { type: 3, pts: 6744020142, ccData: 49698 }, - { type: 2, pts: 6744020142, ccData: 28533 }, - { type: 3, pts: 6744023145, ccData: 546 }, - { type: 2, pts: 6744023145, ccData: 27748 }, - { type: 3, pts: 6744026148, ccData: 16930 }, - { type: 2, pts: 6744026148, ccData: 24393 }, - { type: 3, pts: 6744029151, ccData: 33314 }, - { type: 2, pts: 6744029151, ccData: 24423 }, - { type: 3, pts: 6744032154, ccData: 49698 }, - { type: 2, pts: 6744032154, ccData: 25972 }, - { type: 3, pts: 6744035157, ccData: 546 }, - { type: 2, pts: 6744035157, ccData: 16128 }, - { type: 3, pts: 6744038160, ccData: 16930 }, - { type: 2, pts: 6744038160, ccData: 35841 }, - { type: 3, pts: 6744044166, ccData: 33314 }, - { type: 2, pts: 6744044166, ccData: 35074 }, - { type: 3, pts: 6744275397, ccData: 51761 }, - { type: 2, pts: 6744275397, ccData: 38939 }, - { type: 2, pts: 6744275397, ccData: 17920 }, - { type: 2, pts: 6744275397, ccData: 31 }, - { type: 2, pts: 6744275397, ccData: 5264 }, - { type: 2, pts: 6744275397, ccData: 1283 }, - { type: 2, pts: 6744275397, ccData: 37162 }, - { type: 2, pts: 6744275397, ccData: 42 }, - { type: 2, pts: 6744275397, ccData: 37376 }, - { type: 2, pts: 6744275397, ccData: 3072 }, - { type: 3, pts: 6744281403, ccData: 803 }, - { type: 2, pts: 6744281403, ccData: 37376 }, - { type: 2, pts: 6744281403, ccData: 3584 }, - { type: 3, pts: 6744287409, ccData: 16929 }, - { type: 2, pts: 6744287409, ccData: 32512 }, - { type: 3, pts: 6744290412, ccData: 33314 }, - { type: 2, pts: 6744290412, ccData: 24320 }, - { type: 3, pts: 6744293415, ccData: 49697 }, - { type: 2, pts: 6744293415, ccData: 32512 }, - { type: 3, pts: 6744296418, ccData: 546 }, - { type: 2, pts: 6744296418, ccData: 35842 }, - { type: 3, pts: 6744302424, ccData: 16930 }, - { type: 2, pts: 6744302424, ccData: 35073 }, - { type: 3, pts: 6744839961, ccData: 35377 }, - { type: 2, pts: 6744839961, ccData: 39195 }, - { type: 2, pts: 6744839961, ccData: 17920 }, - { type: 2, pts: 6744839961, ccData: 31 }, - { type: 2, pts: 6744839961, ccData: 5264 }, - { type: 2, pts: 6744839961, ccData: 1283 }, - { type: 2, pts: 6744839961, ccData: 37162 }, - { type: 2, pts: 6744839961, ccData: 42 }, - { type: 2, pts: 6744839961, ccData: 37376 }, - { type: 2, pts: 6744839961, ccData: 1024 }, - { type: 3, pts: 6744845967, ccData: 49955 }, - { type: 2, pts: 6744845967, ccData: 37376 }, - { type: 2, pts: 6744845967, ccData: 1536 }, - { type: 3, pts: 6744851973, ccData: 546 }, - { type: 2, pts: 6744851973, ccData: 20079 }, - { type: 3, pts: 6744854976, ccData: 16930 }, - { type: 2, pts: 6744854976, ccData: 11359 }, - { type: 3, pts: 6744857979, ccData: 33314 }, - { type: 2, pts: 6744857979, ccData: 29800 }, - { type: 3, pts: 6744860982, ccData: 49698 }, - { type: 2, pts: 6744860982, ccData: 26995 }, - { type: 3, pts: 6744863985, ccData: 546 }, - { type: 2, pts: 6744863985, ccData: 24425 }, - { type: 3, pts: 6744866988, ccData: 16930 }, - { type: 2, pts: 6744866988, ccData: 29535 }, - { type: 3, pts: 6744869991, ccData: 33314 }, - { type: 2, pts: 6744869991, ccData: 28271 }, - { type: 3, pts: 6744872994, ccData: 49698 }, - { type: 2, pts: 6744872994, ccData: 29791 }, - { type: 3, pts: 6744875997, ccData: 546 }, - { type: 2, pts: 6744875997, ccData: 28005 }, - { type: 3, pts: 6744879000, ccData: 16930 }, - { type: 2, pts: 6744879000, ccData: 8448 }, - { type: 3, pts: 6744882003, ccData: 33314 }, - { type: 2, pts: 6744882003, ccData: 35841 }, - { type: 3, pts: 6744888009, ccData: 49698 }, - { type: 2, pts: 6744888009, ccData: 35074 }, - { type: 3, pts: 6745128249, ccData: 2609 }, - { type: 2, pts: 6745128249, ccData: 38939 }, - { type: 2, pts: 6745128249, ccData: 17920 }, - { type: 2, pts: 6745128249, ccData: 31 }, - { type: 2, pts: 6745128249, ccData: 5264 }, - { type: 2, pts: 6745128249, ccData: 1283 }, - { type: 2, pts: 6745128249, ccData: 37162 }, - { type: 2, pts: 6745128249, ccData: 42 }, - { type: 2, pts: 6745128249, ccData: 37376 }, - { type: 2, pts: 6745128249, ccData: 3072 }, - { type: 3, pts: 6745134255, ccData: 17187 }, - { type: 2, pts: 6745134255, ccData: 37376 }, - { type: 2, pts: 6745134255, ccData: 3584 }, - { type: 3, pts: 6745140261, ccData: 33313 }, - { type: 2, pts: 6745140261, ccData: 32512 }, - { type: 3, pts: 6745143264, ccData: 49698 }, - { type: 2, pts: 6745143264, ccData: 24320 }, - { type: 3, pts: 6745146267, ccData: 545 }, - { type: 2, pts: 6745146267, ccData: 32512 }, - { type: 3, pts: 6745149270, ccData: 16930 }, - { type: 2, pts: 6745149270, ccData: 35842 }, - { type: 3, pts: 6745155276, ccData: 33314 }, - { type: 2, pts: 6745155276, ccData: 35073 }, - { type: 3, pts: 6745524645, ccData: 51761 }, - { type: 2, pts: 6745524645, ccData: 39195 }, - { type: 2, pts: 6745524645, ccData: 17920 }, - { type: 2, pts: 6745524645, ccData: 31 }, - { type: 2, pts: 6745524645, ccData: 5264 }, - { type: 2, pts: 6745524645, ccData: 1283 }, - { type: 2, pts: 6745524645, ccData: 37162 }, - { type: 2, pts: 6745524645, ccData: 42 }, - { type: 2, pts: 6745524645, ccData: 37376 }, - { type: 2, pts: 6745524645, ccData: 1024 }, - { type: 3, pts: 6745530651, ccData: 803 }, - { type: 2, pts: 6745530651, ccData: 37376 }, - { type: 2, pts: 6745530651, ccData: 1792 }, - { type: 3, pts: 6745536657, ccData: 16930 }, - { type: 2, pts: 6745536657, ccData: 18783 }, - { type: 3, pts: 6745539660, ccData: 33314 }, - { type: 2, pts: 6745539660, ccData: 25711 }, - { type: 3, pts: 6745542663, ccData: 49698 }, - { type: 2, pts: 6745542663, ccData: 28199 }, - { type: 3, pts: 6745545666, ccData: 546 }, - { type: 2, pts: 6745545666, ccData: 29791 }, - { type: 3, pts: 6745548669, ccData: 16930 }, - { type: 2, pts: 6745548669, ccData: 29800 }, - { type: 3, pts: 6745551672, ccData: 33314 }, - { type: 2, pts: 6745551672, ccData: 26990 }, - { type: 3, pts: 6745554675, ccData: 49698 }, - { type: 2, pts: 6745554675, ccData: 27487 }, - { type: 3, pts: 6745557678, ccData: 546 }, - { type: 2, pts: 6745557678, ccData: 29551 }, - { type: 3, pts: 6745560681, ccData: 16930 }, - { type: 2, pts: 6745560681, ccData: 11776 }, - { type: 3, pts: 6745563684, ccData: 33314 }, - { type: 2, pts: 6745563684, ccData: 35841 }, - { type: 3, pts: 6745569690, ccData: 49698 }, - { type: 2, pts: 6745569690, ccData: 35074 }, - { type: 3, pts: 6745800921, ccData: 2609 }, - { type: 2, pts: 6745800921, ccData: 38939 }, - { type: 2, pts: 6745800921, ccData: 17920 }, - { type: 2, pts: 6745800921, ccData: 31 }, - { type: 2, pts: 6745800921, ccData: 5264 }, - { type: 2, pts: 6745800921, ccData: 1283 }, - { type: 2, pts: 6745800921, ccData: 37162 }, - { type: 2, pts: 6745800921, ccData: 42 }, - { type: 2, pts: 6745800921, ccData: 37376 }, - { type: 2, pts: 6745800921, ccData: 3072 }, - { type: 3, pts: 6745806927, ccData: 17187 }, - { type: 2, pts: 6745806927, ccData: 37376 }, - { type: 2, pts: 6745806927, ccData: 3584 }, - { type: 3, pts: 6745812933, ccData: 33313 }, - { type: 2, pts: 6745812933, ccData: 32512 }, - { type: 3, pts: 6745815936, ccData: 49698 }, - { type: 2, pts: 6745815936, ccData: 24320 }, - { type: 3, pts: 6745818939, ccData: 545 }, - { type: 2, pts: 6745818939, ccData: 32512 }, - { type: 3, pts: 6745821942, ccData: 16930 }, - { type: 2, pts: 6745821942, ccData: 35842 }, - { type: 3, pts: 6745827948, ccData: 33314 }, - { type: 2, pts: 6745827948, ccData: 35073 }, - { type: 3, pts: 6746473593, ccData: 51761 }, - { type: 2, pts: 6746473593, ccData: 39195 }, - { type: 2, pts: 6746473593, ccData: 17920 }, - { type: 2, pts: 6746473593, ccData: 31 }, - { type: 2, pts: 6746473593, ccData: 5264 }, - { type: 2, pts: 6746473593, ccData: 1283 }, - { type: 2, pts: 6746473593, ccData: 37162 }, - { type: 2, pts: 6746473593, ccData: 42 }, - { type: 2, pts: 6746473593, ccData: 37376 }, - { type: 2, pts: 6746473593, ccData: 2048 }, - { type: 3, pts: 6746479599, ccData: 803 }, - { type: 2, pts: 6746479599, ccData: 37376 }, - { type: 2, pts: 6746479599, ccData: 2816 }, - { type: 3, pts: 6746485605, ccData: 16930 }, - { type: 2, pts: 6746485605, ccData: 21608 }, - { type: 3, pts: 6746488608, ccData: 33314 }, - { type: 2, pts: 6746488608, ccData: 24948 }, - { type: 3, pts: 6746491611, ccData: 49698 }, - { type: 2, pts: 6746491611, ccData: 10099 }, - { type: 3, pts: 6746494614, ccData: 546 }, - { type: 2, pts: 6746494614, ccData: 24425 }, - { type: 3, pts: 6746497617, ccData: 16930 }, - { type: 2, pts: 6746497617, ccData: 29729 }, - { type: 3, pts: 6746500620, ccData: 33314 }, - { type: 2, pts: 6746500620, ccData: 35841 }, - { type: 3, pts: 6746506626, ccData: 49698 }, - { type: 2, pts: 6746506626, ccData: 35074 }, - { type: 3, pts: 6746590710, ccData: 2609 }, - { type: 2, pts: 6746590710, ccData: 38939 }, - { type: 2, pts: 6746590710, ccData: 17920 }, - { type: 2, pts: 6746590710, ccData: 31 }, - { type: 2, pts: 6746590710, ccData: 5264 }, - { type: 2, pts: 6746590710, ccData: 1283 }, - { type: 2, pts: 6746590710, ccData: 37162 }, - { type: 2, pts: 6746590710, ccData: 42 }, - { type: 2, pts: 6746590710, ccData: 37376 }, - { type: 2, pts: 6746590710, ccData: 1024 }, - { type: 3, pts: 6746596716, ccData: 17187 }, - { type: 2, pts: 6746596716, ccData: 37376 }, - { type: 2, pts: 6746596716, ccData: 1792 }, - { type: 3, pts: 6746602722, ccData: 33314 }, - { type: 2, pts: 6746602722, ccData: 18783 }, - { type: 3, pts: 6746605725, ccData: 49698 }, - { type: 2, pts: 6746605725, ccData: 27253 }, - { type: 3, pts: 6746608728, ccData: 546 }, - { type: 2, pts: 6746608728, ccData: 29556 }, - { type: 3, pts: 6746611731, ccData: 16930 }, - { type: 2, pts: 6746611731, ccData: 24420 }, - { type: 3, pts: 6746614734, ccData: 33314 }, - { type: 2, pts: 6746614734, ccData: 29285 }, - { type: 3, pts: 6746617737, ccData: 49698 }, - { type: 2, pts: 6746617737, ccData: 24941 }, - { type: 3, pts: 6746620740, ccData: 546 }, - { type: 2, pts: 6746620740, ccData: 25956 }, - { type: 3, pts: 6746623743, ccData: 16930 }, - { type: 2, pts: 6746623743, ccData: 24437 }, - { type: 3, pts: 6746626746, ccData: 33314 }, - { type: 2, pts: 6746626746, ccData: 28672 }, - { type: 3, pts: 6746629749, ccData: 49698 }, - { type: 2, pts: 6746629749, ccData: 35842 }, - { type: 3, pts: 6746635755, ccData: 546 }, - { type: 2, pts: 6746635755, ccData: 35073 }, - { type: 3, pts: 6746671791, ccData: 18993 }, - { type: 2, pts: 6746671791, ccData: 39195 }, - { type: 2, pts: 6746671791, ccData: 16640 }, - { type: 2, pts: 6746671791, ccData: 31 }, - { type: 2, pts: 6746671791, ccData: 5264 }, - { type: 2, pts: 6746671791, ccData: 1283 }, - { type: 2, pts: 6746671791, ccData: 37162 }, - { type: 2, pts: 6746671791, ccData: 42 }, - { type: 2, pts: 6746671791, ccData: 37376 }, - { type: 2, pts: 6746671791, ccData: 1024 }, - { type: 3, pts: 6746677797, ccData: 33314 }, - { type: 2, pts: 6746677797, ccData: 29800 }, - { type: 3, pts: 6746680800, ccData: 49698 }, - { type: 2, pts: 6746680800, ccData: 25951 }, - { type: 3, pts: 6746683803, ccData: 546 }, - { type: 2, pts: 6746683803, ccData: 29552 }, - { type: 3, pts: 6746686806, ccData: 16930 }, - { type: 2, pts: 6746686806, ccData: 24946 }, - { type: 3, pts: 6746689809, ccData: 33314 }, - { type: 2, pts: 6746689809, ccData: 27500 }, - { type: 3, pts: 6746692812, ccData: 49698 }, - { type: 2, pts: 6746692812, ccData: 26981 }, - { type: 3, pts: 6746695815, ccData: 546 }, - { type: 2, pts: 6746695815, ccData: 29556 }, - { type: 3, pts: 6746698818, ccData: 16930 }, - { type: 2, pts: 6746698818, ccData: 24424 }, - { type: 3, pts: 6746701821, ccData: 33314 }, - { type: 2, pts: 6746701821, ccData: 24937 }, - { type: 3, pts: 6746704824, ccData: 49698 }, - { type: 2, pts: 6746704824, ccData: 29299 }, - { type: 3, pts: 6746707827, ccData: 546 }, - { type: 2, pts: 6746707827, ccData: 29817 }, - { type: 3, pts: 6746710830, ccData: 16930 }, - { type: 2, pts: 6746710830, ccData: 27749 }, - { type: 3, pts: 6746713833, ccData: 35377 }, - { type: 2, pts: 6746713833, ccData: 39195 }, - { type: 2, pts: 6746713833, ccData: 16640 }, - { type: 2, pts: 6746713833, ccData: 287 }, - { type: 2, pts: 6746713833, ccData: 4240 }, - { type: 2, pts: 6746713833, ccData: 1283 }, - { type: 2, pts: 6746713833, ccData: 37162 }, - { type: 2, pts: 6746713833, ccData: 0 }, - { type: 2, pts: 6746713833, ccData: 37377 }, - { type: 2, pts: 6746713833, ccData: 2048 }, - { type: 3, pts: 6746719839, ccData: 49955 }, - { type: 2, pts: 6746719839, ccData: 37377 }, - { type: 2, pts: 6746719839, ccData: 2304 }, - { type: 3, pts: 6746725845, ccData: 546 }, - { type: 2, pts: 6746725845, ccData: 26990 }, - { type: 3, pts: 6746728848, ccData: 16930 }, - { type: 2, pts: 6746728848, ccData: 24436 }, - { type: 3, pts: 6746731851, ccData: 33314 }, - { type: 2, pts: 6746731851, ccData: 26725 }, - { type: 3, pts: 6746734854, ccData: 49698 }, - { type: 2, pts: 6746734854, ccData: 24439 }, - { type: 3, pts: 6746737857, ccData: 546 }, - { type: 2, pts: 6746737857, ccData: 28530 }, - { type: 3, pts: 6746740860, ccData: 16930 }, - { type: 2, pts: 6746740860, ccData: 27748 }, - { type: 3, pts: 6746743863, ccData: 33314 }, - { type: 2, pts: 6746743863, ccData: 8448 }, - { type: 3, pts: 6746746866, ccData: 49698 }, - { type: 2, pts: 6746746866, ccData: 35841 }, - { type: 3, pts: 6746752872, ccData: 546 }, - { type: 2, pts: 6746752872, ccData: 35074 }, - { type: 3, pts: 6746930049, ccData: 18993 }, - { type: 2, pts: 6746930049, ccData: 38939 }, - { type: 2, pts: 6746930049, ccData: 17920 }, - { type: 2, pts: 6746930049, ccData: 31 }, - { type: 2, pts: 6746930049, ccData: 5264 }, - { type: 2, pts: 6746930049, ccData: 1283 }, - { type: 2, pts: 6746930049, ccData: 37162 }, - { type: 2, pts: 6746930049, ccData: 42 }, - { type: 2, pts: 6746930049, ccData: 37376 }, - { type: 2, pts: 6746930049, ccData: 1024 }, - { type: 3, pts: 6746936055, ccData: 33571 }, - { type: 2, pts: 6746936055, ccData: 37376 }, - { type: 2, pts: 6746936055, ccData: 1280 }, - { type: 3, pts: 6746942061, ccData: 49698 }, - { type: 2, pts: 6746942061, ccData: 18727 }, - { type: 3, pts: 6746945064, ccData: 546 }, - { type: 2, pts: 6746945064, ccData: 27756 }, - { type: 3, pts: 6746948067, ccData: 16930 }, - { type: 2, pts: 6746948067, ccData: 24420 }, - { type: 3, pts: 6746951070, ccData: 33314 }, - { type: 2, pts: 6746951070, ccData: 29281 }, - { type: 3, pts: 6746954073, ccData: 49698 }, - { type: 2, pts: 6746954073, ccData: 30559 }, - { type: 3, pts: 6746957076, ccData: 546 }, - { type: 2, pts: 6746957076, ccData: 26996 }, - { type: 3, pts: 6746960079, ccData: 16930 }, - { type: 2, pts: 6746960079, ccData: 24422 }, - { type: 3, pts: 6746963082, ccData: 33314 }, - { type: 2, pts: 6746963082, ccData: 28530 }, - { type: 3, pts: 6746966085, ccData: 49698 }, - { type: 2, pts: 6746966085, ccData: 24441 }, - { type: 3, pts: 6746969088, ccData: 546 }, - { type: 2, pts: 6746969088, ccData: 28533 }, - { type: 3, pts: 6746972091, ccData: 16930 }, - { type: 2, pts: 6746972091, ccData: 11776 }, - { type: 3, pts: 6746975094, ccData: 33314 }, - { type: 2, pts: 6746975094, ccData: 35842 }, - { type: 3, pts: 6746981100, ccData: 49698 }, - { type: 2, pts: 6746981100, ccData: 35073 }, - { type: 3, pts: 6747122241, ccData: 2609 }, - { type: 2, pts: 6747122241, ccData: 39195 }, - { type: 2, pts: 6747122241, ccData: 16640 }, - { type: 2, pts: 6747122241, ccData: 31 }, - { type: 2, pts: 6747122241, ccData: 5264 }, - { type: 2, pts: 6747122241, ccData: 1283 }, - { type: 2, pts: 6747122241, ccData: 37162 }, - { type: 2, pts: 6747122241, ccData: 42 }, - { type: 2, pts: 6747122241, ccData: 37376 }, - { type: 2, pts: 6747122241, ccData: 1024 }, - { type: 3, pts: 6747128247, ccData: 17187 }, - { type: 2, pts: 6747128247, ccData: 37376 }, - { type: 2, pts: 6747128247, ccData: 1536 }, - { type: 3, pts: 6747134253, ccData: 33314 }, - { type: 2, pts: 6747134253, ccData: 18727 }, - { type: 3, pts: 6747137256, ccData: 49698 }, - { type: 2, pts: 6747137256, ccData: 27756 }, - { type: 3, pts: 6747140259, ccData: 546 }, - { type: 2, pts: 6747140259, ccData: 24424 }, - { type: 3, pts: 6747143262, ccData: 16930 }, - { type: 2, pts: 6747143262, ccData: 24950 }, - { type: 3, pts: 6747146265, ccData: 33314 }, - { type: 2, pts: 6747146265, ccData: 25951 }, - { type: 3, pts: 6747149268, ccData: 49698 }, - { type: 2, pts: 6747149268, ccData: 27759 }, - { type: 3, pts: 6747152271, ccData: 546 }, - { type: 2, pts: 6747152271, ccData: 28263 }, - { type: 3, pts: 6747155274, ccData: 16930 }, - { type: 2, pts: 6747155274, ccData: 24424 }, - { type: 3, pts: 6747158277, ccData: 33314 }, - { type: 2, pts: 6747158277, ccData: 24937 }, - { type: 3, pts: 6747161280, ccData: 49698 }, - { type: 2, pts: 6747161280, ccData: 29184 }, - { type: 3, pts: 6747164283, ccData: 2609 }, - { type: 2, pts: 6747164283, ccData: 39195 }, - { type: 2, pts: 6747164283, ccData: 16640 }, - { type: 2, pts: 6747164283, ccData: 287 }, - { type: 2, pts: 6747164283, ccData: 4240 }, - { type: 2, pts: 6747164283, ccData: 1283 }, - { type: 2, pts: 6747164283, ccData: 37162 }, - { type: 2, pts: 6747164283, ccData: 0 }, - { type: 2, pts: 6747164283, ccData: 37377 }, - { type: 2, pts: 6747164283, ccData: 1024 }, - { type: 3, pts: 6747170289, ccData: 17187 }, - { type: 2, pts: 6747170289, ccData: 37377 }, - { type: 2, pts: 6747170289, ccData: 1792 }, - { type: 3, pts: 6747176295, ccData: 33314 }, - { type: 2, pts: 6747176295, ccData: 25711 }, - { type: 3, pts: 6747179298, ccData: 49698 }, - { type: 2, pts: 6747179298, ccData: 30574 }, - { type: 3, pts: 6747182301, ccData: 546 }, - { type: 2, pts: 6747182301, ccData: 24436 }, - { type: 3, pts: 6747185304, ccData: 16930 }, - { type: 2, pts: 6747185304, ccData: 28511 }, - { type: 3, pts: 6747188307, ccData: 33314 }, - { type: 2, pts: 6747188307, ccData: 29800 }, - { type: 3, pts: 6747191310, ccData: 49698 }, - { type: 2, pts: 6747191310, ccData: 25951 }, - { type: 3, pts: 6747194313, ccData: 546 }, - { type: 2, pts: 6747194313, ccData: 26220 }, - { type: 3, pts: 6747197316, ccData: 16930 }, - { type: 2, pts: 6747197316, ccData: 28527 }, - { type: 3, pts: 6747200319, ccData: 33314 }, - { type: 2, pts: 6747200319, ccData: 29230 }, - { type: 3, pts: 6747203322, ccData: 49698 }, - { type: 2, pts: 6747203322, ccData: 35841 }, - { type: 3, pts: 6747209328, ccData: 546 }, - { type: 2, pts: 6747209328, ccData: 35074 }, - { type: 3, pts: 6747569688, ccData: 18993 }, - { type: 2, pts: 6747569688, ccData: 38939 }, - { type: 2, pts: 6747569688, ccData: 16640 }, - { type: 2, pts: 6747569688, ccData: 31 }, - { type: 2, pts: 6747569688, ccData: 5264 }, - { type: 2, pts: 6747569688, ccData: 1283 }, - { type: 2, pts: 6747569688, ccData: 37162 }, - { type: 2, pts: 6747569688, ccData: 42 }, - { type: 2, pts: 6747569688, ccData: 37376 }, - { type: 2, pts: 6747569688, ccData: 0 }, - { type: 3, pts: 6747575694, ccData: 33571 }, - { type: 2, pts: 6747575694, ccData: 37376 }, - { type: 2, pts: 6747575694, ccData: 512 }, - { type: 3, pts: 6747581700, ccData: 49698 }, - { type: 2, pts: 6747581700, ccData: 21359 }, - { type: 3, pts: 6747584703, ccData: 546 }, - { type: 2, pts: 6747584703, ccData: 24436 }, - { type: 3, pts: 6747587706, ccData: 16930 }, - { type: 2, pts: 6747587706, ccData: 26725 }, - { type: 3, pts: 6747590709, ccData: 33314 }, - { type: 2, pts: 6747590709, ccData: 29285 }, - { type: 3, pts: 6747593712, ccData: 49698 }, - { type: 2, pts: 6747593712, ccData: 10092 }, - { type: 3, pts: 6747596715, ccData: 546 }, - { type: 2, pts: 6747596715, ccData: 27743 }, - { type: 3, pts: 6747599718, ccData: 16930 }, - { type: 2, pts: 6747599718, ccData: 25189 }, - { type: 3, pts: 6747602721, ccData: 33314 }, - { type: 2, pts: 6747602721, ccData: 24428 }, - { type: 3, pts: 6747605724, ccData: 49698 }, - { type: 2, pts: 6747605724, ccData: 28532 }, - { type: 3, pts: 6747608727, ccData: 546 }, - { type: 2, pts: 6747608727, ccData: 29535 }, - { type: 3, pts: 6747611730, ccData: 16930 }, - { type: 2, pts: 6747611730, ccData: 28518 }, - { type: 3, pts: 6747614733, ccData: 33314 }, - { type: 2, pts: 6747614733, ccData: 24434 }, - { type: 3, pts: 6747617736, ccData: 49698 }, - { type: 2, pts: 6747617736, ccData: 28527 }, - { type: 3, pts: 6747620739, ccData: 546 }, - { type: 2, pts: 6747620739, ccData: 27904 }, - { type: 3, pts: 6747623742, ccData: 18993 }, - { type: 2, pts: 6747623742, ccData: 38939 }, - { type: 2, pts: 6747623742, ccData: 16640 }, - { type: 2, pts: 6747623742, ccData: 287 }, - { type: 2, pts: 6747623742, ccData: 4240 }, - { type: 2, pts: 6747623742, ccData: 1283 }, - { type: 2, pts: 6747623742, ccData: 37162 }, - { type: 2, pts: 6747623742, ccData: 0 }, - { type: 2, pts: 6747623742, ccData: 37377 }, - { type: 2, pts: 6747623742, ccData: 2048 }, - { type: 3, pts: 6747629748, ccData: 33571 }, - { type: 2, pts: 6747629748, ccData: 37377 }, - { type: 2, pts: 6747629748, ccData: 2304 }, - { type: 3, pts: 6747635754, ccData: 49698 }, - { type: 2, pts: 6747635754, ccData: 26223 }, - { type: 3, pts: 6747638757, ccData: 546 }, - { type: 2, pts: 6747638757, ccData: 29279 }, - { type: 3, pts: 6747641760, ccData: 16930 }, - { type: 2, pts: 6747641760, ccData: 29552 }, - { type: 3, pts: 6747644763, ccData: 33314 }, - { type: 2, pts: 6747644763, ccData: 24946 }, - { type: 3, pts: 6747647766, ccData: 49698 }, - { type: 2, pts: 6747647766, ccData: 27500 }, - { type: 3, pts: 6747650769, ccData: 546 }, - { type: 2, pts: 6747650769, ccData: 25971 }, - { type: 3, pts: 6747653772, ccData: 16930 }, - { type: 2, pts: 6747653772, ccData: 11776 }, - { type: 3, pts: 6747656775, ccData: 33314 }, - { type: 2, pts: 6747656775, ccData: 35842 }, - { type: 3, pts: 6747662781, ccData: 49698 }, - { type: 2, pts: 6747662781, ccData: 35073 }, - { type: 3, pts: 6747957075, ccData: 546 }, - { type: 2, pts: 6747957075, ccData: 35841 }, - { type: 3, pts: 6748035153, ccData: 18993 }, - { type: 2, pts: 6748035153, ccData: 38939 }, - { type: 2, pts: 6748035153, ccData: 17920 }, - { type: 2, pts: 6748035153, ccData: 31 }, - { type: 2, pts: 6748035153, ccData: 5264 }, - { type: 2, pts: 6748035153, ccData: 1283 }, - { type: 2, pts: 6748035153, ccData: 37162 }, - { type: 2, pts: 6748035153, ccData: 0 }, - { type: 2, pts: 6748035153, ccData: 37376 }, - { type: 2, pts: 6748035153, ccData: 0 }, - { type: 3, pts: 6748041159, ccData: 33314 }, - { type: 2, pts: 6748041159, ccData: 21864 }, - { type: 3, pts: 6748044162, ccData: 49698 }, - { type: 2, pts: 6748044162, ccData: 11359 }, - { type: 3, pts: 6748047165, ccData: 546 }, - { type: 2, pts: 6748047165, ccData: 20585 }, - { type: 3, pts: 6748050168, ccData: 16930 }, - { type: 2, pts: 6748050168, ccData: 28267 }, - { type: 3, pts: 6748053171, ccData: 33314 }, - { type: 2, pts: 6748053171, ccData: 24940 }, - { type: 3, pts: 6748056174, ccData: 49698 }, - { type: 2, pts: 6748056174, ccData: 26979 }, - { type: 3, pts: 6748059177, ccData: 546 }, - { type: 2, pts: 6748059177, ccData: 26991 }, - { type: 3, pts: 6748062180, ccData: 16930 }, - { type: 2, pts: 6748062180, ccData: 30067 }, - { type: 3, pts: 6748065183, ccData: 33314 }, - { type: 2, pts: 6748065183, ccData: 11264 }, - { type: 3, pts: 6748074192, ccData: 49698 }, - { type: 2, pts: 6748074192, ccData: 35073 }, - { type: 3, pts: 6748131249, ccData: 2609 }, - { type: 2, pts: 6748131249, ccData: 39195 }, - { type: 2, pts: 6748131249, ccData: 16640 }, - { type: 2, pts: 6748131249, ccData: 31 }, - { type: 2, pts: 6748131249, ccData: 5264 }, - { type: 2, pts: 6748131249, ccData: 1283 }, - { type: 2, pts: 6748131249, ccData: 37162 }, - { type: 2, pts: 6748131249, ccData: 42 }, - { type: 2, pts: 6748131249, ccData: 37376 }, - { type: 2, pts: 6748131249, ccData: 0 }, - { type: 3, pts: 6748137255, ccData: 16930 }, - { type: 2, pts: 6748137255, ccData: 18783 }, - { type: 3, pts: 6748140258, ccData: 33314 }, - { type: 2, pts: 6748140258, ccData: 25711 }, - { type: 3, pts: 6748143261, ccData: 49698 }, - { type: 2, pts: 6748143261, ccData: 28199 }, - { type: 3, pts: 6748146264, ccData: 546 }, - { type: 2, pts: 6748146264, ccData: 29791 }, - { type: 3, pts: 6748149267, ccData: 16930 }, - { type: 2, pts: 6748149267, ccData: 29800 }, - { type: 3, pts: 6748152270, ccData: 33314 }, - { type: 2, pts: 6748152270, ccData: 26990 }, - { type: 3, pts: 6748155273, ccData: 49698 }, - { type: 2, pts: 6748155273, ccData: 27392 }, - { type: 3, pts: 6748158276, ccData: 2609 }, - { type: 2, pts: 6748158276, ccData: 39195 }, - { type: 2, pts: 6748158276, ccData: 16640 }, - { type: 2, pts: 6748158276, ccData: 287 }, - { type: 2, pts: 6748158276, ccData: 4240 }, - { type: 2, pts: 6748158276, ccData: 1283 }, - { type: 2, pts: 6748158276, ccData: 37162 }, - { type: 2, pts: 6748158276, ccData: 0 }, - { type: 2, pts: 6748158276, ccData: 37377 }, - { type: 2, pts: 6748158276, ccData: 0 }, - { type: 3, pts: 6748164282, ccData: 16930 }, - { type: 2, pts: 6748164282, ccData: 29800 }, - { type: 3, pts: 6748167285, ccData: 33314 }, - { type: 2, pts: 6748167285, ccData: 25977 }, - { type: 3, pts: 6748170288, ccData: 49698 }, - { type: 2, pts: 6748170288, ccData: 24419 }, - { type: 3, pts: 6748173291, ccData: 546 }, - { type: 2, pts: 6748173291, ccData: 24942 }, - { type: 3, pts: 6748176294, ccData: 16930 }, - { type: 2, pts: 6748176294, ccData: 24417 }, - { type: 3, pts: 6748179297, ccData: 33314 }, - { type: 2, pts: 6748179297, ccData: 25460 }, - { type: 3, pts: 6748182300, ccData: 49698 }, - { type: 2, pts: 6748182300, ccData: 30049 }, - { type: 3, pts: 6748185303, ccData: 546 }, - { type: 2, pts: 6748185303, ccData: 27756 }, - { type: 3, pts: 6748188306, ccData: 16930 }, - { type: 2, pts: 6748188306, ccData: 30976 }, - { type: 3, pts: 6748191309, ccData: 33314 }, - { type: 2, pts: 6748191309, ccData: 35841 }, - { type: 3, pts: 6748197315, ccData: 49698 }, - { type: 2, pts: 6748197315, ccData: 35074 }, - { type: 3, pts: 6748275393, ccData: 2609 }, - { type: 2, pts: 6748275393, ccData: 38939 }, - { type: 2, pts: 6748275393, ccData: 16640 }, - { type: 2, pts: 6748275393, ccData: 31 }, - { type: 2, pts: 6748275393, ccData: 5264 }, - { type: 2, pts: 6748275393, ccData: 1283 }, - { type: 2, pts: 6748275393, ccData: 37162 }, - { type: 2, pts: 6748275393, ccData: 42 }, - { type: 2, pts: 6748275393, ccData: 37376 }, - { type: 2, pts: 6748275393, ccData: 0 }, - { type: 3, pts: 6748281399, ccData: 16930 }, - { type: 2, pts: 6748281399, ccData: 28001 }, - { type: 3, pts: 6748284402, ccData: 33314 }, - { type: 2, pts: 6748284402, ccData: 27493 }, - { type: 3, pts: 6748287405, ccData: 49698 }, - { type: 2, pts: 6748287405, ccData: 24441 }, - { type: 3, pts: 6748290408, ccData: 546 }, - { type: 2, pts: 6748290408, ccData: 28533 }, - { type: 3, pts: 6748293411, ccData: 16930 }, - { type: 2, pts: 6748293411, ccData: 29279 }, - { type: 3, pts: 6748296414, ccData: 33314 }, - { type: 2, pts: 6748296414, ccData: 26721 }, - { type: 3, pts: 6748299417, ccData: 49698 }, - { type: 2, pts: 6748299417, ccData: 26994 }, - { type: 3, pts: 6748302420, ccData: 546 }, - { type: 2, pts: 6748302420, ccData: 24423 }, - { type: 3, pts: 6748305423, ccData: 16930 }, - { type: 2, pts: 6748305423, ccData: 29295 }, - { type: 3, pts: 6748308426, ccData: 33314 }, - { type: 2, pts: 6748308426, ccData: 30464 }, - { type: 3, pts: 6748311429, ccData: 51761 }, - { type: 2, pts: 6748311429, ccData: 38939 }, - { type: 2, pts: 6748311429, ccData: 16640 }, - { type: 2, pts: 6748311429, ccData: 287 }, - { type: 2, pts: 6748311429, ccData: 4240 }, - { type: 2, pts: 6748311429, ccData: 1283 }, - { type: 2, pts: 6748311429, ccData: 37162 }, - { type: 2, pts: 6748311429, ccData: 0 }, - { type: 2, pts: 6748311429, ccData: 37377 }, - { type: 2, pts: 6748311429, ccData: 0 }, - { type: 3, pts: 6748317435, ccData: 546 }, - { type: 2, pts: 6748317435, ccData: 27759 }, - { type: 3, pts: 6748320438, ccData: 16930 }, - { type: 2, pts: 6748320438, ccData: 28263 }, - { type: 3, pts: 6748323441, ccData: 33314 }, - { type: 2, pts: 6748323441, ccData: 25970 }, - { type: 3, pts: 6748326444, ccData: 49698 }, - { type: 2, pts: 6748326444, ccData: 11776 }, - { type: 3, pts: 6748329447, ccData: 546 }, - { type: 2, pts: 6748329447, ccData: 35842 }, - { type: 3, pts: 6748335453, ccData: 16930 }, - { type: 2, pts: 6748335453, ccData: 35073 }, - { type: 3, pts: 6748446564, ccData: 35377 }, - { type: 2, pts: 6748446564, ccData: 39195 }, - { type: 2, pts: 6748446564, ccData: 16640 }, - { type: 2, pts: 6748446564, ccData: 31 }, - { type: 2, pts: 6748446564, ccData: 5264 }, - { type: 2, pts: 6748446564, ccData: 1283 }, - { type: 2, pts: 6748446564, ccData: 37162 }, - { type: 2, pts: 6748446564, ccData: 42 }, - { type: 2, pts: 6748446564, ccData: 37376 }, - { type: 2, pts: 6748446564, ccData: 5120 }, - { type: 3, pts: 6748452570, ccData: 49955 }, - { type: 2, pts: 6748452570, ccData: 37376 }, - { type: 2, pts: 6748452570, ccData: 5376 }, - { type: 3, pts: 6748458576, ccData: 546 }, - { type: 2, pts: 6748458576, ccData: 10339 }, - { type: 3, pts: 6748461579, ccData: 16930 }, - { type: 2, pts: 6748461579, ccData: 26741 }, - { type: 3, pts: 6748464582, ccData: 33314 }, - { type: 2, pts: 6748464582, ccData: 25451 }, - { type: 3, pts: 6748467585, ccData: 49698 }, - { type: 2, pts: 6748467585, ccData: 27749 }, - { type: 3, pts: 6748470588, ccData: 546 }, - { type: 2, pts: 6748470588, ccData: 29481 }, - { type: 3, pts: 6748473591, ccData: 16930 }, - { type: 2, pts: 6748473591, ccData: 14848 }, - { type: 3, pts: 6748476594, ccData: 35377 }, - { type: 2, pts: 6748476594, ccData: 39195 }, - { type: 2, pts: 6748476594, ccData: 16640 }, - { type: 2, pts: 6748476594, ccData: 287 }, - { type: 2, pts: 6748476594, ccData: 4240 }, - { type: 2, pts: 6748476594, ccData: 1283 }, - { type: 2, pts: 6748476594, ccData: 37162 }, - { type: 2, pts: 6748476594, ccData: 0 }, - { type: 2, pts: 6748476594, ccData: 37377 }, - { type: 2, pts: 6748476594, ccData: 5120 }, - { type: 3, pts: 6748482600, ccData: 49698 }, - { type: 2, pts: 6748482600, ccData: 21365 }, - { type: 3, pts: 6748485603, ccData: 546 }, - { type: 2, pts: 6748485603, ccData: 29285 }, - { type: 3, pts: 6748488606, ccData: 16930 }, - { type: 2, pts: 6748488606, ccData: 24439 }, - { type: 3, pts: 6748491609, ccData: 33314 }, - { type: 2, pts: 6748491609, ccData: 25951 }, - { type: 3, pts: 6748494612, ccData: 49698 }, - { type: 2, pts: 6748494612, ccData: 25441 }, - { type: 3, pts: 6748497615, ccData: 546 }, - { type: 2, pts: 6748497615, ccData: 28193 }, - { type: 3, pts: 6748500618, ccData: 16930 }, - { type: 2, pts: 6748500618, ccData: 35841 }, - { type: 3, pts: 6748506624, ccData: 33314 }, - { type: 2, pts: 6748506624, ccData: 35074 }, - { type: 3, pts: 6748695813, ccData: 49698 }, - { type: 2, pts: 6748695813, ccData: 35842 }, - { type: 3, pts: 6748803921, ccData: 2609 }, - { type: 2, pts: 6748803921, ccData: 38939 }, - { type: 2, pts: 6748803921, ccData: 17920 }, - { type: 2, pts: 6748803921, ccData: 31 }, - { type: 2, pts: 6748803921, ccData: 5264 }, - { type: 2, pts: 6748803921, ccData: 1283 }, - { type: 2, pts: 6748803921, ccData: 37162 }, - { type: 2, pts: 6748803921, ccData: 42 }, - { type: 2, pts: 6748803921, ccData: 37376 }, - { type: 2, pts: 6748803921, ccData: 0 }, - { type: 3, pts: 6748809927, ccData: 17187 }, - { type: 2, pts: 6748809927, ccData: 37376 }, - { type: 2, pts: 6748809927, ccData: 512 }, - { type: 3, pts: 6748815933, ccData: 33314 }, - { type: 2, pts: 6748815933, ccData: 22377 }, - { type: 3, pts: 6748818936, ccData: 49698 }, - { type: 2, pts: 6748818936, ccData: 29800 }, - { type: 3, pts: 6748821939, ccData: 546 }, - { type: 2, pts: 6748821939, ccData: 24431 }, - { type: 3, pts: 6748824942, ccData: 16930 }, - { type: 2, pts: 6748824942, ccData: 30066 }, - { type: 3, pts: 6748827945, ccData: 33314 }, - { type: 2, pts: 6748827945, ccData: 24392 }, - { type: 3, pts: 6748830948, ccData: 49698 }, - { type: 2, pts: 6748830948, ccData: 24937 }, - { type: 3, pts: 6748833951, ccData: 546 }, - { type: 2, pts: 6748833951, ccData: 29279 }, - { type: 3, pts: 6748836954, ccData: 16930 }, - { type: 2, pts: 6748836954, ccData: 18290 }, - { type: 3, pts: 6748839957, ccData: 33314 }, - { type: 2, pts: 6748839957, ccData: 28535 }, - { type: 3, pts: 6748842960, ccData: 49698 }, - { type: 2, pts: 6748842960, ccData: 24396 }, - { type: 3, pts: 6748845963, ccData: 546 }, - { type: 2, pts: 6748845963, ccData: 28526 }, - { type: 3, pts: 6748848966, ccData: 16930 }, - { type: 2, pts: 6748848966, ccData: 26463 }, - { type: 3, pts: 6748851969, ccData: 33314 }, - { type: 2, pts: 6748851969, ccData: 18277 }, - { type: 3, pts: 6748854972, ccData: 49698 }, - { type: 2, pts: 6748854972, ccData: 27694 }, - { type: 3, pts: 6748863981, ccData: 546 }, - { type: 2, pts: 6748863981, ccData: 35073 }, - { type: 3, pts: 6749068185, ccData: 16930 }, - { type: 2, pts: 6749068185, ccData: 35841 }, - { type: 3, pts: 6749347464, ccData: 35377 }, - { type: 2, pts: 6749347464, ccData: 38939 }, - { type: 2, pts: 6749347464, ccData: 17920 }, - { type: 2, pts: 6749347464, ccData: 31 }, - { type: 2, pts: 6749347464, ccData: 5264 }, - { type: 2, pts: 6749347464, ccData: 1283 }, - { type: 2, pts: 6749347464, ccData: 37162 }, - { type: 2, pts: 6749347464, ccData: 0 }, - { type: 2, pts: 6749347464, ccData: 37376 }, - { type: 2, pts: 6749347464, ccData: 3072 }, - { type: 3, pts: 6749353470, ccData: 49698 }, - { type: 2, pts: 6749353470, ccData: 10343 }, - { type: 3, pts: 6749356473, ccData: 546 }, - { type: 2, pts: 6749356473, ccData: 24947 }, - { type: 3, pts: 6749359476, ccData: 16930 }, - { type: 2, pts: 6749359476, ccData: 28787 }, - { type: 3, pts: 6749362479, ccData: 33314 }, - { type: 2, pts: 6749362479, ccData: 10496 }, - { type: 3, pts: 6749371488, ccData: 49698 }, - { type: 2, pts: 6749371488, ccData: 35073 }, - { type: 3, pts: 6749452569, ccData: 2609 }, - { type: 2, pts: 6749452569, ccData: 39195 }, - { type: 2, pts: 6749452569, ccData: 16640 }, - { type: 2, pts: 6749452569, ccData: 31 }, - { type: 2, pts: 6749452569, ccData: 5264 }, - { type: 2, pts: 6749452569, ccData: 1283 }, - { type: 2, pts: 6749452569, ccData: 37162 }, - { type: 2, pts: 6749452569, ccData: 42 }, - { type: 2, pts: 6749452569, ccData: 37376 }, - { type: 2, pts: 6749452569, ccData: 3072 }, - { type: 3, pts: 6749458575, ccData: 16930 }, - { type: 2, pts: 6749458575, ccData: 10343 }, - { type: 3, pts: 6749461578, ccData: 33314 }, - { type: 2, pts: 6749461578, ccData: 24947 }, - { type: 3, pts: 6749464581, ccData: 49698 }, - { type: 2, pts: 6749464581, ccData: 28787 }, - { type: 3, pts: 6749467584, ccData: 546 }, - { type: 2, pts: 6749467584, ccData: 10554 }, - { type: 3, pts: 6749470587, ccData: 18993 }, - { type: 2, pts: 6749470587, ccData: 39195 }, - { type: 2, pts: 6749470587, ccData: 16640 }, - { type: 2, pts: 6749470587, ccData: 287 }, - { type: 2, pts: 6749470587, ccData: 4240 }, - { type: 2, pts: 6749470587, ccData: 1283 }, - { type: 2, pts: 6749470587, ccData: 37162 }, - { type: 2, pts: 6749470587, ccData: 0 }, - { type: 2, pts: 6749470587, ccData: 37377 }, - { type: 2, pts: 6749470587, ccData: 2048 }, - { type: 3, pts: 6749476593, ccData: 33571 }, - { type: 2, pts: 6749476593, ccData: 37377 }, - { type: 2, pts: 6749476593, ccData: 2304 }, - { type: 3, pts: 6749482599, ccData: 49698 }, - { type: 2, pts: 6749482599, ccData: 20585 }, - { type: 3, pts: 6749485602, ccData: 546 }, - { type: 2, pts: 6749485602, ccData: 28267 }, - { type: 3, pts: 6749488605, ccData: 16930 }, - { type: 2, pts: 6749488605, ccData: 24940 }, - { type: 3, pts: 6749491608, ccData: 33314 }, - { type: 2, pts: 6749491608, ccData: 26979 }, - { type: 3, pts: 6749494611, ccData: 49698 }, - { type: 2, pts: 6749494611, ccData: 26991 }, - { type: 3, pts: 6749497614, ccData: 546 }, - { type: 2, pts: 6749497614, ccData: 30067 }, - { type: 3, pts: 6749500617, ccData: 16930 }, - { type: 2, pts: 6749500617, ccData: 8448 }, - { type: 3, pts: 6749503620, ccData: 33314 }, - { type: 2, pts: 6749503620, ccData: 35841 }, - { type: 3, pts: 6749509626, ccData: 49698 }, - { type: 2, pts: 6749509626, ccData: 35074 }, - { type: 3, pts: 6749674791, ccData: 2609 }, - { type: 2, pts: 6749674791, ccData: 38939 }, - { type: 2, pts: 6749674791, ccData: 17920 }, - { type: 2, pts: 6749674791, ccData: 31 }, - { type: 2, pts: 6749674791, ccData: 5264 }, - { type: 2, pts: 6749674791, ccData: 1283 }, - { type: 2, pts: 6749674791, ccData: 37162 }, - { type: 2, pts: 6749674791, ccData: 42 }, - { type: 2, pts: 6749674791, ccData: 37376 }, - { type: 2, pts: 6749674791, ccData: 2048 }, - { type: 3, pts: 6749680797, ccData: 17187 }, - { type: 2, pts: 6749680797, ccData: 37376 }, - { type: 2, pts: 6749680797, ccData: 2560 }, - { type: 3, pts: 6749686803, ccData: 33314 }, - { type: 2, pts: 6749686803, ccData: 19567 }, - { type: 3, pts: 6749689806, ccData: 49698 }, - { type: 2, pts: 6749689806, ccData: 28523 }, - { type: 3, pts: 6749692809, ccData: 546 }, - { type: 2, pts: 6749692809, ccData: 11359 }, - { type: 3, pts: 6749695812, ccData: 16930 }, - { type: 2, pts: 6749695812, ccData: 19823 }, - { type: 3, pts: 6749698815, ccData: 33314 }, - { type: 2, pts: 6749698815, ccData: 28013 }, - { type: 3, pts: 6749701818, ccData: 49698 }, - { type: 2, pts: 6749701818, ccData: 31022 }, - { type: 3, pts: 6749704821, ccData: 546 }, - { type: 2, pts: 6749704821, ccData: 35842 }, - { type: 3, pts: 6749710827, ccData: 16930 }, - { type: 2, pts: 6749710827, ccData: 35073 }, - { type: 3, pts: 6749773890, ccData: 35377 }, - { type: 2, pts: 6749773890, ccData: 39195 }, - { type: 2, pts: 6749773890, ccData: 17920 }, - { type: 2, pts: 6749773890, ccData: 31 }, - { type: 2, pts: 6749773890, ccData: 5264 }, - { type: 2, pts: 6749773890, ccData: 1283 }, - { type: 2, pts: 6749773890, ccData: 37162 }, - { type: 2, pts: 6749773890, ccData: 42 }, - { type: 2, pts: 6749773890, ccData: 37376 }, - { type: 2, pts: 6749773890, ccData: 1024 }, - { type: 3, pts: 6749779896, ccData: 49955 }, - { type: 2, pts: 6749779896, ccData: 37376 }, - { type: 2, pts: 6749779896, ccData: 1792 }, - { type: 3, pts: 6749785902, ccData: 546 }, - { type: 2, pts: 6749785902, ccData: 19833 }, - { type: 3, pts: 6749788905, ccData: 16930 }, - { type: 2, pts: 6749788905, ccData: 24424 }, - { type: 3, pts: 6749791908, ccData: 33314 }, - { type: 2, pts: 6749791908, ccData: 24937 }, - { type: 3, pts: 6749794911, ccData: 49698 }, - { type: 2, pts: 6749794911, ccData: 29223 }, - { type: 3, pts: 6749797914, ccData: 546 }, - { type: 2, pts: 6749797914, ccData: 29535 }, - { type: 3, pts: 6749800917, ccData: 16930 }, - { type: 2, pts: 6749800917, ccData: 26482 }, - { type: 3, pts: 6749803920, ccData: 33314 }, - { type: 2, pts: 6749803920, ccData: 28535 }, - { type: 3, pts: 6749806923, ccData: 49698 }, - { type: 2, pts: 6749806923, ccData: 26990 }, - { type: 3, pts: 6749809926, ccData: 546 }, - { type: 2, pts: 6749809926, ccData: 26401 }, - { type: 3, pts: 6749812929, ccData: 16930 }, - { type: 2, pts: 6749812929, ccData: 35841 }, - { type: 3, pts: 6749818935, ccData: 33314 }, - { type: 2, pts: 6749818935, ccData: 35074 }, - { type: 3, pts: 6749987103, ccData: 49698 }, - { type: 2, pts: 6749987103, ccData: 35842 }, - { type: 3, pts: 6750200316, ccData: 2609 }, - { type: 2, pts: 6750200316, ccData: 38939 }, - { type: 2, pts: 6750200316, ccData: 17920 }, - { type: 2, pts: 6750200316, ccData: 31 }, - { type: 2, pts: 6750200316, ccData: 5264 }, - { type: 2, pts: 6750200316, ccData: 1283 }, - { type: 2, pts: 6750200316, ccData: 37162 }, - { type: 2, pts: 6750200316, ccData: 42 }, - { type: 2, pts: 6750200316, ccData: 37376 }, - { type: 2, pts: 6750200316, ccData: 0 }, - { type: 3, pts: 6750206322, ccData: 16930 }, - { type: 2, pts: 6750206322, ccData: 17519 }, - { type: 3, pts: 6750209325, ccData: 33314 }, - { type: 2, pts: 6750209325, ccData: 28261 }, - { type: 3, pts: 6750212328, ccData: 49698 }, - { type: 2, pts: 6750212328, ccData: 8448 }, - { type: 3, pts: 6750221337, ccData: 546 }, - { type: 2, pts: 6750221337, ccData: 35073 }, - { type: 3, pts: 6750278394, ccData: 18993 }, - { type: 2, pts: 6750278394, ccData: 39195 }, - { type: 2, pts: 6750278394, ccData: 17920 }, - { type: 2, pts: 6750278394, ccData: 31 }, - { type: 2, pts: 6750278394, ccData: 5264 }, - { type: 2, pts: 6750278394, ccData: 1283 }, - { type: 2, pts: 6750278394, ccData: 37162 }, - { type: 2, pts: 6750278394, ccData: 42 }, - { type: 2, pts: 6750278394, ccData: 37376 }, - { type: 2, pts: 6750278394, ccData: 0 }, - { type: 3, pts: 6750284400, ccData: 33314 }, - { type: 2, pts: 6750284400, ccData: 22376 }, - { type: 3, pts: 6750287403, ccData: 49698 }, - { type: 2, pts: 6750287403, ccData: 24948 }, - { type: 3, pts: 6750290406, ccData: 546 }, - { type: 2, pts: 6750290406, ccData: 24420 }, - { type: 3, pts: 6750293409, ccData: 16930 }, - { type: 2, pts: 6750293409, ccData: 28511 }, - { type: 3, pts: 6750296412, ccData: 33314 }, - { type: 2, pts: 6750296412, ccData: 31087 }, - { type: 3, pts: 6750299415, ccData: 49698 }, - { type: 2, pts: 6750299415, ccData: 30047 }, - { type: 3, pts: 6750302418, ccData: 546 }, - { type: 2, pts: 6750302418, ccData: 29800 }, - { type: 3, pts: 6750305421, ccData: 16930 }, - { type: 2, pts: 6750305421, ccData: 26990 }, - { type: 3, pts: 6750308424, ccData: 33314 }, - { type: 2, pts: 6750308424, ccData: 27455 }, - { type: 3, pts: 6750311427, ccData: 49698 }, - { type: 2, pts: 6750311427, ccData: 35841 }, - { type: 3, pts: 6750317433, ccData: 546 }, - { type: 2, pts: 6750317433, ccData: 35074 }, - { type: 3, pts: 6750410526, ccData: 16930 }, - { type: 2, pts: 6750410526, ccData: 35842 }, - { type: 3, pts: 6750545661, ccData: 35377 }, - { type: 2, pts: 6750545661, ccData: 38939 }, - { type: 2, pts: 6750545661, ccData: 16640 }, - { type: 2, pts: 6750545661, ccData: 31 }, - { type: 2, pts: 6750545661, ccData: 5264 }, - { type: 2, pts: 6750545661, ccData: 1283 }, - { type: 2, pts: 6750545661, ccData: 37162 }, - { type: 2, pts: 6750545661, ccData: 42 }, - { type: 2, pts: 6750545661, ccData: 37376 }, - { type: 2, pts: 6750545661, ccData: 3072 }, - { type: 3, pts: 6750551667, ccData: 49698 }, - { type: 2, pts: 6750551667, ccData: 10343 }, - { type: 3, pts: 6750554670, ccData: 546 }, - { type: 2, pts: 6750554670, ccData: 24947 }, - { type: 3, pts: 6750557673, ccData: 16930 }, - { type: 2, pts: 6750557673, ccData: 28787 }, - { type: 3, pts: 6750560676, ccData: 33314 }, - { type: 2, pts: 6750560676, ccData: 10496 }, - { type: 3, pts: 6750563679, ccData: 51761 }, - { type: 2, pts: 6750563679, ccData: 38939 }, - { type: 2, pts: 6750563679, ccData: 16640 }, - { type: 2, pts: 6750563679, ccData: 287 }, - { type: 2, pts: 6750563679, ccData: 4240 }, - { type: 2, pts: 6750563679, ccData: 1283 }, - { type: 2, pts: 6750563679, ccData: 37162 }, - { type: 2, pts: 6750563679, ccData: 0 }, - { type: 2, pts: 6750563679, ccData: 37377 }, - { type: 2, pts: 6750563679, ccData: 1024 }, - { type: 3, pts: 6750569685, ccData: 803 }, - { type: 2, pts: 6750569685, ccData: 37377 }, - { type: 2, pts: 6750569685, ccData: 1792 }, - { type: 3, pts: 6750575691, ccData: 16930 }, - { type: 2, pts: 6750575691, ccData: 18804 }, - { type: 3, pts: 6750578694, ccData: 33314 }, - { type: 2, pts: 6750578694, ccData: 10099 }, - { type: 3, pts: 6750581697, ccData: 49698 }, - { type: 2, pts: 6750581697, ccData: 24432 }, - { type: 3, pts: 6750584700, ccData: 546 }, - { type: 2, pts: 6750584700, ccData: 26990 }, - { type: 3, pts: 6750587703, ccData: 16930 }, - { type: 2, pts: 6750587703, ccData: 27489 }, - { type: 3, pts: 6750590706, ccData: 33314 }, - { type: 2, pts: 6750590706, ccData: 28773 }, - { type: 3, pts: 6750593709, ccData: 49698 }, - { type: 2, pts: 6750593709, ccData: 29286 }, - { type: 3, pts: 6750596712, ccData: 546 }, - { type: 2, pts: 6750596712, ccData: 25955 }, - { type: 3, pts: 6750599715, ccData: 16930 }, - { type: 2, pts: 6750599715, ccData: 29729 }, - { type: 3, pts: 6750608724, ccData: 33314 }, - { type: 2, pts: 6750608724, ccData: 35073 }, - { type: 3, pts: 6750737853, ccData: 51761 }, - { type: 2, pts: 6750737853, ccData: 39195 }, - { type: 2, pts: 6750737853, ccData: 17920 }, - { type: 2, pts: 6750737853, ccData: 31 }, - { type: 2, pts: 6750737853, ccData: 5264 }, - { type: 2, pts: 6750737853, ccData: 1283 }, - { type: 2, pts: 6750737853, ccData: 37162 }, - { type: 2, pts: 6750737853, ccData: 42 }, - { type: 2, pts: 6750737853, ccData: 37376 }, - { type: 2, pts: 6750737853, ccData: 4096 }, - { type: 3, pts: 6750743859, ccData: 803 }, - { type: 2, pts: 6750743859, ccData: 37376 }, - { type: 2, pts: 6750743859, ccData: 4864 }, - { type: 3, pts: 6750749865, ccData: 16930 }, - { type: 2, pts: 6750749865, ccData: 19567 }, - { type: 3, pts: 6750752868, ccData: 33314 }, - { type: 2, pts: 6750752868, ccData: 28523 }, - { type: 3, pts: 6750755871, ccData: 49698 }, - { type: 2, pts: 6750755871, ccData: 29535 }, - { type: 3, pts: 6750758874, ccData: 546 }, - { type: 2, pts: 6750758874, ccData: 26479 }, - { type: 3, pts: 6750761877, ccData: 16930 }, - { type: 2, pts: 6750761877, ccData: 28516 }, - { type: 3, pts: 6750764880, ccData: 33314 }, - { type: 2, pts: 6750764880, ccData: 11776 }, - { type: 3, pts: 6750767883, ccData: 49698 }, - { type: 2, pts: 6750767883, ccData: 35841 }, - { type: 3, pts: 6750773889, ccData: 546 }, - { type: 2, pts: 6750773889, ccData: 35074 }, - { type: 3, pts: 6750863979, ccData: 18993 }, - { type: 2, pts: 6750863979, ccData: 38939 }, - { type: 2, pts: 6750863979, ccData: 17920 }, - { type: 2, pts: 6750863979, ccData: 31 }, - { type: 2, pts: 6750863979, ccData: 5264 }, - { type: 2, pts: 6750863979, ccData: 1283 }, - { type: 2, pts: 6750863979, ccData: 37162 }, - { type: 2, pts: 6750863979, ccData: 42 }, - { type: 2, pts: 6750863979, ccData: 37376 }, - { type: 2, pts: 6750863979, ccData: 0 }, - { type: 3, pts: 6750869985, ccData: 33314 }, - { type: 2, pts: 6750869985, ccData: 22383 }, - { type: 3, pts: 6750872988, ccData: 49698 }, - { type: 2, pts: 6750872988, ccData: 30508 }, - { type: 3, pts: 6750875991, ccData: 546 }, - { type: 2, pts: 6750875991, ccData: 24436 }, - { type: 3, pts: 6750878994, ccData: 16930 }, - { type: 2, pts: 6750878994, ccData: 26721 }, - { type: 3, pts: 6750881997, ccData: 33314 }, - { type: 2, pts: 6750881997, ccData: 29735 }, - { type: 3, pts: 6750885000, ccData: 49698 }, - { type: 2, pts: 6750885000, ccData: 29535 }, - { type: 3, pts: 6750888003, ccData: 546 }, - { type: 2, pts: 6750888003, ccData: 24941 }, - { type: 3, pts: 6750891006, ccData: 16930 }, - { type: 2, pts: 6750891006, ccData: 24954 }, - { type: 3, pts: 6750894009, ccData: 33314 }, - { type: 2, pts: 6750894009, ccData: 26990 }, - { type: 3, pts: 6750897012, ccData: 49698 }, - { type: 2, pts: 6750897012, ccData: 26414 }, - { type: 3, pts: 6750900015, ccData: 546 }, - { type: 2, pts: 6750900015, ccData: 35842 }, - { type: 3, pts: 6750906021, ccData: 16930 }, - { type: 2, pts: 6750906021, ccData: 35073 }, - { type: 3, pts: 6751014129, ccData: 35377 }, - { type: 2, pts: 6751014129, ccData: 39195 }, - { type: 2, pts: 6751014129, ccData: 16640 }, - { type: 2, pts: 6751014129, ccData: 31 }, - { type: 2, pts: 6751014129, ccData: 5264 }, - { type: 2, pts: 6751014129, ccData: 1283 }, - { type: 2, pts: 6751014129, ccData: 37162 }, - { type: 2, pts: 6751014129, ccData: 42 }, - { type: 2, pts: 6751014129, ccData: 37376 }, - { type: 2, pts: 6751014129, ccData: 1024 }, - { type: 3, pts: 6751020135, ccData: 49955 }, - { type: 2, pts: 6751020135, ccData: 37376 }, - { type: 2, pts: 6751020135, ccData: 1280 }, - { type: 3, pts: 6751026141, ccData: 546 }, - { type: 2, pts: 6751026141, ccData: 16750 }, - { type: 3, pts: 6751029144, ccData: 16930 }, - { type: 2, pts: 6751029144, ccData: 25695 }, - { type: 3, pts: 6751032147, ccData: 33314 }, - { type: 2, pts: 6751032147, ccData: 26996 }, - { type: 3, pts: 6751035150, ccData: 49698 }, - { type: 2, pts: 6751035150, ccData: 24428 }, - { type: 3, pts: 6751038153, ccData: 546 }, - { type: 2, pts: 6751038153, ccData: 28527 }, - { type: 3, pts: 6751041156, ccData: 16930 }, - { type: 2, pts: 6751041156, ccData: 27507 }, - { type: 3, pts: 6751044159, ccData: 33314 }, - { type: 2, pts: 6751044159, ccData: 24426 }, - { type: 3, pts: 6751047162, ccData: 49698 }, - { type: 2, pts: 6751047162, ccData: 30067 }, - { type: 3, pts: 6751050165, ccData: 546 }, - { type: 2, pts: 6751050165, ccData: 29791 }, - { type: 3, pts: 6751053168, ccData: 16930 }, - { type: 2, pts: 6751053168, ccData: 27753 }, - { type: 3, pts: 6751056171, ccData: 33314 }, - { type: 2, pts: 6751056171, ccData: 27493 }, - { type: 3, pts: 6751059174, ccData: 51761 }, - { type: 2, pts: 6751059174, ccData: 39195 }, - { type: 2, pts: 6751059174, ccData: 16640 }, - { type: 2, pts: 6751059174, ccData: 287 }, - { type: 2, pts: 6751059174, ccData: 4240 }, - { type: 2, pts: 6751059174, ccData: 1283 }, - { type: 2, pts: 6751059174, ccData: 37162 }, - { type: 2, pts: 6751059174, ccData: 0 }, - { type: 2, pts: 6751059174, ccData: 37377 }, - { type: 2, pts: 6751059174, ccData: 2048 }, - { type: 3, pts: 6751065180, ccData: 803 }, - { type: 2, pts: 6751065180, ccData: 37377 }, - { type: 2, pts: 6751065180, ccData: 2560 }, - { type: 3, pts: 6751071186, ccData: 16930 }, - { type: 2, pts: 6751071186, ccData: 28025 }, - { type: 3, pts: 6751074189, ccData: 33314 }, - { type: 2, pts: 6751074189, ccData: 24420 }, - { type: 3, pts: 6751077192, ccData: 49698 }, - { type: 2, pts: 6751077192, ccData: 29281 }, - { type: 3, pts: 6751080195, ccData: 546 }, - { type: 2, pts: 6751080195, ccData: 30569 }, - { type: 3, pts: 6751083198, ccData: 16930 }, - { type: 2, pts: 6751083198, ccData: 28263 }, - { type: 3, pts: 6751086201, ccData: 33314 }, - { type: 2, pts: 6751086201, ccData: 11776 }, - { type: 3, pts: 6751089204, ccData: 49698 }, - { type: 2, pts: 6751089204, ccData: 35841 }, - { type: 3, pts: 6751095210, ccData: 546 }, - { type: 2, pts: 6751095210, ccData: 35074 }, - { type: 3, pts: 6751320435, ccData: 18993 }, - { type: 2, pts: 6751320435, ccData: 38939 }, - { type: 2, pts: 6751320435, ccData: 17920 }, - { type: 2, pts: 6751320435, ccData: 31 }, - { type: 2, pts: 6751320435, ccData: 5264 }, - { type: 2, pts: 6751320435, ccData: 1283 }, - { type: 2, pts: 6751320435, ccData: 37162 }, - { type: 2, pts: 6751320435, ccData: 42 }, - { type: 2, pts: 6751320435, ccData: 37376 }, - { type: 2, pts: 6751320435, ccData: 0 }, - { type: 3, pts: 6751326441, ccData: 33571 }, - { type: 2, pts: 6751326441, ccData: 37376 }, - { type: 2, pts: 6751326441, ccData: 768 }, - { type: 3, pts: 6751332447, ccData: 49698 }, - { type: 2, pts: 6751332447, ccData: 21608 }, - { type: 3, pts: 6751335450, ccData: 546 }, - { type: 2, pts: 6751335450, ccData: 24942 }, - { type: 3, pts: 6751338453, ccData: 16930 }, - { type: 2, pts: 6751338453, ccData: 27487 }, - { type: 3, pts: 6751341456, ccData: 33314 }, - { type: 2, pts: 6751341456, ccData: 31087 }, - { type: 3, pts: 6751344459, ccData: 49698 }, - { type: 2, pts: 6751344459, ccData: 30047 }, - { type: 3, pts: 6751347462, ccData: 546 }, - { type: 2, pts: 6751347462, ccData: 29551 }, - { type: 3, pts: 6751350465, ccData: 16930 }, - { type: 2, pts: 6751350465, ccData: 24429 }, - { type: 3, pts: 6751353468, ccData: 33314 }, - { type: 2, pts: 6751353468, ccData: 30051 }, - { type: 3, pts: 6751356471, ccData: 49698 }, - { type: 2, pts: 6751356471, ccData: 26668 }, - { type: 3, pts: 6751359474, ccData: 546 }, - { type: 2, pts: 6751359474, ccData: 24385 }, - { type: 3, pts: 6751362477, ccData: 16930 }, - { type: 2, pts: 6751362477, ccData: 28260 }, - { type: 3, pts: 6751365480, ccData: 33314 }, - { type: 2, pts: 6751365480, ccData: 29285 }, - { type: 3, pts: 6751368483, ccData: 49698 }, - { type: 2, pts: 6751368483, ccData: 24878 }, - { type: 3, pts: 6751371486, ccData: 546 }, - { type: 2, pts: 6751371486, ccData: 35842 }, - { type: 3, pts: 6751377492, ccData: 16930 }, - { type: 2, pts: 6751377492, ccData: 35073 }, - { type: 3, pts: 6751479594, ccData: 35377 }, - { type: 2, pts: 6751479594, ccData: 39195 }, - { type: 2, pts: 6751479594, ccData: 16640 }, - { type: 2, pts: 6751479594, ccData: 31 }, - { type: 2, pts: 6751479594, ccData: 5264 }, - { type: 2, pts: 6751479594, ccData: 1283 }, - { type: 2, pts: 6751479594, ccData: 37162 }, - { type: 2, pts: 6751479594, ccData: 42 }, - { type: 2, pts: 6751479594, ccData: 37376 }, - { type: 2, pts: 6751479594, ccData: 1024 }, - { type: 3, pts: 6751485600, ccData: 49955 }, - { type: 2, pts: 6751485600, ccData: 37376 }, - { type: 2, pts: 6751485600, ccData: 1280 }, - { type: 3, pts: 6751491606, ccData: 546 }, - { type: 2, pts: 6751491606, ccData: 22895 }, - { type: 3, pts: 6751494609, ccData: 16930 }, - { type: 2, pts: 6751494609, ccData: 30047 }, - { type: 3, pts: 6751497612, ccData: 33314 }, - { type: 2, pts: 6751497612, ccData: 24946 }, - { type: 3, pts: 6751500615, ccData: 49698 }, - { type: 2, pts: 6751500615, ccData: 25951 }, - { type: 3, pts: 6751503618, ccData: 546 }, - { type: 2, pts: 6751503618, ccData: 30309 }, - { type: 3, pts: 6751506621, ccData: 16930 }, - { type: 2, pts: 6751506621, ccData: 29305 }, - { type: 3, pts: 6751509624, ccData: 33314 }, - { type: 2, pts: 6751509624, ccData: 24439 }, - { type: 3, pts: 6751512627, ccData: 49698 }, - { type: 2, pts: 6751512627, ccData: 25964 }, - { type: 3, pts: 6751515630, ccData: 546 }, - { type: 2, pts: 6751515630, ccData: 25455 }, - { type: 3, pts: 6751518633, ccData: 16930 }, - { type: 2, pts: 6751518633, ccData: 28005 }, - { type: 3, pts: 6751521636, ccData: 33314 }, - { type: 2, pts: 6751521636, ccData: 11264 }, - { type: 3, pts: 6751524639, ccData: 51761 }, - { type: 2, pts: 6751524639, ccData: 39195 }, - { type: 2, pts: 6751524639, ccData: 16640 }, - { type: 2, pts: 6751524639, ccData: 287 }, - { type: 2, pts: 6751524639, ccData: 4240 }, - { type: 2, pts: 6751524639, ccData: 1283 }, - { type: 2, pts: 6751524639, ccData: 37162 }, - { type: 2, pts: 6751524639, ccData: 0 }, - { type: 2, pts: 6751524639, ccData: 37377 }, - { type: 2, pts: 6751524639, ccData: 2048 }, - { type: 3, pts: 6751530645, ccData: 803 }, - { type: 2, pts: 6751530645, ccData: 37377 }, - { type: 2, pts: 6751530645, ccData: 2304 }, - { type: 3, pts: 6751536651, ccData: 16930 }, - { type: 2, pts: 6751536651, ccData: 20585 }, - { type: 3, pts: 6751539654, ccData: 33314 }, - { type: 2, pts: 6751539654, ccData: 28267 }, - { type: 3, pts: 6751542657, ccData: 49698 }, - { type: 2, pts: 6751542657, ccData: 24940 }, - { type: 3, pts: 6751545660, ccData: 546 }, - { type: 2, pts: 6751545660, ccData: 26979 }, - { type: 3, pts: 6751548663, ccData: 16930 }, - { type: 2, pts: 6751548663, ccData: 26991 }, - { type: 3, pts: 6751551666, ccData: 33314 }, - { type: 2, pts: 6751551666, ccData: 30067 }, - { type: 3, pts: 6751554669, ccData: 49698 }, - { type: 2, pts: 6751554669, ccData: 11776 }, - { type: 3, pts: 6751557672, ccData: 546 }, - { type: 2, pts: 6751557672, ccData: 35841 }, - { type: 3, pts: 6751563678, ccData: 16930 }, - { type: 2, pts: 6751563678, ccData: 35074 }, - { type: 3, pts: 6751770885, ccData: 35377 }, - { type: 2, pts: 6751770885, ccData: 38939 }, - { type: 2, pts: 6751770885, ccData: 17920 }, - { type: 2, pts: 6751770885, ccData: 31 }, - { type: 2, pts: 6751770885, ccData: 5264 }, - { type: 2, pts: 6751770885, ccData: 1283 }, - { type: 2, pts: 6751770885, ccData: 37162 }, - { type: 2, pts: 6751770885, ccData: 42 }, - { type: 2, pts: 6751770885, ccData: 37376 }, - { type: 2, pts: 6751770885, ccData: 3072 }, - { type: 3, pts: 6751776891, ccData: 49955 }, - { type: 2, pts: 6751776891, ccData: 37376 }, - { type: 2, pts: 6751776891, ccData: 3328 }, - { type: 3, pts: 6751782897, ccData: 546 }, - { type: 2, pts: 6751782897, ccData: 19823 }, - { type: 3, pts: 6751785900, ccData: 16930 }, - { type: 2, pts: 6751785900, ccData: 28013 }, - { type: 3, pts: 6751788903, ccData: 33314 }, - { type: 2, pts: 6751788903, ccData: 31020 }, - { type: 3, pts: 6751791906, ccData: 49698 }, - { type: 2, pts: 6751791906, ccData: 35842 }, - { type: 3, pts: 6751797912, ccData: 546 }, - { type: 2, pts: 6751797912, ccData: 35073 }, - { type: 3, pts: 6751830945, ccData: 18993 }, - { type: 2, pts: 6751830945, ccData: 39195 }, - { type: 2, pts: 6751830945, ccData: 16640 }, - { type: 2, pts: 6751830945, ccData: 31 }, - { type: 2, pts: 6751830945, ccData: 5264 }, - { type: 2, pts: 6751830945, ccData: 1283 }, - { type: 2, pts: 6751830945, ccData: 37162 }, - { type: 2, pts: 6751830945, ccData: 42 }, - { type: 2, pts: 6751830945, ccData: 37376 }, - { type: 2, pts: 6751830945, ccData: 1024 }, - { type: 3, pts: 6751836951, ccData: 33571 }, - { type: 2, pts: 6751836951, ccData: 37376 }, - { type: 2, pts: 6751836951, ccData: 1536 }, - { type: 3, pts: 6751842957, ccData: 49698 }, - { type: 2, pts: 6751842957, ccData: 19557 }, - { type: 3, pts: 6751845960, ccData: 546 }, - { type: 2, pts: 6751845960, ccData: 29735 }, - { type: 3, pts: 6751848963, ccData: 16930 }, - { type: 2, pts: 6751848963, ccData: 29535 }, - { type: 3, pts: 6751851966, ccData: 33314 }, - { type: 2, pts: 6751851966, ccData: 26479 }, - { type: 3, pts: 6751854969, ccData: 49698 }, - { type: 2, pts: 6751854969, ccData: 24435 }, - { type: 3, pts: 6751857972, ccData: 546 }, - { type: 2, pts: 6751857972, ccData: 26735 }, - { type: 3, pts: 6751860975, ccData: 16930 }, - { type: 2, pts: 6751860975, ccData: 30559 }, - { type: 3, pts: 6751863978, ccData: 33314 }, - { type: 2, pts: 6751863978, ccData: 17505 }, - { type: 3, pts: 6751866981, ccData: 49698 }, - { type: 2, pts: 6751866981, ccData: 25700 }, - { type: 3, pts: 6751869984, ccData: 546 }, - { type: 2, pts: 6751869984, ccData: 30976 }, - { type: 3, pts: 6751872987, ccData: 18993 }, - { type: 2, pts: 6751872987, ccData: 39195 }, - { type: 2, pts: 6751872987, ccData: 16640 }, - { type: 2, pts: 6751872987, ccData: 287 }, - { type: 2, pts: 6751872987, ccData: 4240 }, - { type: 2, pts: 6751872987, ccData: 1283 }, - { type: 2, pts: 6751872987, ccData: 37162 }, - { type: 2, pts: 6751872987, ccData: 0 }, - { type: 2, pts: 6751872987, ccData: 37377 }, - { type: 2, pts: 6751872987, ccData: 2048 }, - { type: 3, pts: 6751878993, ccData: 33571 }, - { type: 2, pts: 6751878993, ccData: 37377 }, - { type: 2, pts: 6751878993, ccData: 2816 }, - { type: 3, pts: 6751884999, ccData: 49698 }, - { type: 2, pts: 6751884999, ccData: 24942 }, - { type: 3, pts: 6751888002, ccData: 546 }, - { type: 2, pts: 6751888002, ccData: 25695 }, - { type: 3, pts: 6751891005, ccData: 16930 }, - { type: 2, pts: 6751891005, ccData: 20581 }, - { type: 3, pts: 6751894008, ccData: 33314 }, - { type: 2, pts: 6751894008, ccData: 29797 }, - { type: 3, pts: 6751897011, ccData: 49698 }, - { type: 2, pts: 6751897011, ccData: 29230 }, - { type: 3, pts: 6751900014, ccData: 546 }, - { type: 2, pts: 6751900014, ccData: 35841 }, - { type: 3, pts: 6751906020, ccData: 16930 }, - { type: 2, pts: 6751906020, ccData: 35074 }, - { type: 3, pts: 6752080194, ccData: 33314 }, - { type: 2, pts: 6752080194, ccData: 35842 }, - { type: 3, pts: 6752248362, ccData: 51761 }, - { type: 2, pts: 6752248362, ccData: 38939 }, - { type: 2, pts: 6752248362, ccData: 17920 }, - { type: 2, pts: 6752248362, ccData: 31 }, - { type: 2, pts: 6752248362, ccData: 5264 }, - { type: 2, pts: 6752248362, ccData: 1283 }, - { type: 2, pts: 6752248362, ccData: 37162 }, - { type: 2, pts: 6752248362, ccData: 42 }, - { type: 2, pts: 6752248362, ccData: 37376 }, - { type: 2, pts: 6752248362, ccData: 3072 }, - { type: 3, pts: 6752254368, ccData: 803 }, - { type: 2, pts: 6752254368, ccData: 37376 }, - { type: 2, pts: 6752254368, ccData: 3584 }, - { type: 3, pts: 6752260374, ccData: 16929 }, - { type: 2, pts: 6752260374, ccData: 32512 }, - { type: 3, pts: 6752263377, ccData: 33314 }, - { type: 2, pts: 6752263377, ccData: 24320 }, - { type: 3, pts: 6752266380, ccData: 49697 }, - { type: 2, pts: 6752266380, ccData: 32512 }, - { type: 3, pts: 6752275389, ccData: 546 }, - { type: 2, pts: 6752275389, ccData: 35073 }, - { type: 3, pts: 6752512626, ccData: 16930 }, - { type: 2, pts: 6752512626, ccData: 35841 }, - { type: 3, pts: 6752584698, ccData: 35377 }, - { type: 2, pts: 6752584698, ccData: 38939 }, - { type: 2, pts: 6752584698, ccData: 16640 }, - { type: 2, pts: 6752584698, ccData: 31 }, - { type: 2, pts: 6752584698, ccData: 5264 }, - { type: 2, pts: 6752584698, ccData: 1283 }, - { type: 2, pts: 6752584698, ccData: 37162 }, - { type: 2, pts: 6752584698, ccData: 0 }, - { type: 2, pts: 6752584698, ccData: 37376 }, - { type: 2, pts: 6752584698, ccData: 0 }, - { type: 3, pts: 6752590704, ccData: 49698 }, - { type: 2, pts: 6752590704, ccData: 20553 }, - { type: 3, pts: 6752593707, ccData: 546 }, - { type: 2, pts: 6752593707, ccData: 20043 }, - { type: 3, pts: 6752596710, ccData: 16930 }, - { type: 2, pts: 6752596710, ccData: 16716 }, - { type: 3, pts: 6752599713, ccData: 33314 }, - { type: 2, pts: 6752599713, ccData: 18755 }, - { type: 3, pts: 6752602716, ccData: 49698 }, - { type: 2, pts: 6752602716, ccData: 18767 }, - { type: 3, pts: 6752605719, ccData: 546 }, - { type: 2, pts: 6752605719, ccData: 21843 }, - { type: 3, pts: 6752608722, ccData: 16930 }, - { type: 2, pts: 6752608722, ccData: 14848 }, - { type: 3, pts: 6752611725, ccData: 35377 }, - { type: 2, pts: 6752611725, ccData: 38939 }, - { type: 2, pts: 6752611725, ccData: 16640 }, - { type: 2, pts: 6752611725, ccData: 287 }, - { type: 2, pts: 6752611725, ccData: 4240 }, - { type: 2, pts: 6752611725, ccData: 1283 }, - { type: 2, pts: 6752611725, ccData: 37162 }, - { type: 2, pts: 6752611725, ccData: 0 }, - { type: 2, pts: 6752611725, ccData: 37377 }, - { type: 2, pts: 6752611725, ccData: 0 }, - { type: 3, pts: 6752617731, ccData: 49698 }, - { type: 2, pts: 6752617731, ccData: 21365 }, - { type: 3, pts: 6752620734, ccData: 546 }, - { type: 2, pts: 6752620734, ccData: 29296 }, - { type: 3, pts: 6752623737, ccData: 16930 }, - { type: 2, pts: 6752623737, ccData: 29289 }, - { type: 3, pts: 6752626740, ccData: 33314 }, - { type: 2, pts: 6752626740, ccData: 29541 }, - { type: 3, pts: 6752629743, ccData: 49698 }, - { type: 2, pts: 6752629743, ccData: 8448 }, - { type: 3, pts: 6752638752, ccData: 546 }, - { type: 2, pts: 6752638752, ccData: 35073 }, - { type: 3, pts: 6752767881, ccData: 16930 }, - { type: 2, pts: 6752767881, ccData: 35841 }, - { type: 3, pts: 6752872986, ccData: 35377 }, - { type: 2, pts: 6752872986, ccData: 38939 }, - { type: 2, pts: 6752872986, ccData: 16640 }, - { type: 2, pts: 6752872986, ccData: 31 }, - { type: 2, pts: 6752872986, ccData: 5264 }, - { type: 2, pts: 6752872986, ccData: 1283 }, - { type: 2, pts: 6752872986, ccData: 37162 }, - { type: 2, pts: 6752872986, ccData: 0 }, - { type: 2, pts: 6752872986, ccData: 37376 }, - { type: 2, pts: 6752872986, ccData: 0 }, - { type: 3, pts: 6752878992, ccData: 49698 }, - { type: 2, pts: 6752878992, ccData: 22373 }, - { type: 3, pts: 6752881995, ccData: 546 }, - { type: 2, pts: 6752881995, ccData: 27756 }, - { type: 3, pts: 6752884998, ccData: 16930 }, - { type: 2, pts: 6752884998, ccData: 11359 }, - { type: 3, pts: 6752888001, ccData: 33314 }, - { type: 2, pts: 6752888001, ccData: 26735 }, - { type: 3, pts: 6752891004, ccData: 49698 }, - { type: 2, pts: 6752891004, ccData: 30559 }, - { type: 3, pts: 6752894007, ccData: 546 }, - { type: 2, pts: 6752894007, ccData: 25705 }, - { type: 3, pts: 6752897010, ccData: 16930 }, - { type: 2, pts: 6752897010, ccData: 25695 }, - { type: 3, pts: 6752900013, ccData: 33314 }, - { type: 2, pts: 6752900013, ccData: 24927 }, - { type: 3, pts: 6752903016, ccData: 49698 }, - { type: 2, pts: 6752903016, ccData: 29552 }, - { type: 3, pts: 6752906019, ccData: 546 }, - { type: 2, pts: 6752906019, ccData: 24946 }, - { type: 3, pts: 6752909022, ccData: 16930 }, - { type: 2, pts: 6752909022, ccData: 27500 }, - { type: 3, pts: 6752912025, ccData: 33314 }, - { type: 2, pts: 6752912025, ccData: 25951 }, - { type: 3, pts: 6752915028, ccData: 49698 }, - { type: 2, pts: 6752915028, ccData: 28786 }, - { type: 3, pts: 6752918031, ccData: 546 }, - { type: 2, pts: 6752918031, ccData: 26990 }, - { type: 3, pts: 6752921034, ccData: 16930 }, - { type: 2, pts: 6752921034, ccData: 25445 }, - { type: 3, pts: 6752924037, ccData: 33314 }, - { type: 2, pts: 6752924037, ccData: 29555 }, - { type: 3, pts: 6752927040, ccData: 51761 }, - { type: 2, pts: 6752927040, ccData: 38939 }, - { type: 2, pts: 6752927040, ccData: 16640 }, - { type: 2, pts: 6752927040, ccData: 287 }, - { type: 2, pts: 6752927040, ccData: 4240 }, - { type: 2, pts: 6752927040, ccData: 1283 }, - { type: 2, pts: 6752927040, ccData: 37162 }, - { type: 2, pts: 6752927040, ccData: 0 }, - { type: 2, pts: 6752927040, ccData: 37377 }, - { type: 2, pts: 6752927040, ccData: 2048 }, - { type: 3, pts: 6752933046, ccData: 803 }, - { type: 2, pts: 6752933046, ccData: 37377 }, - { type: 2, pts: 6752933046, ccData: 2560 }, - { type: 3, pts: 6752939052, ccData: 16930 }, - { type: 2, pts: 6752939052, ccData: 26469 }, - { type: 3, pts: 6752942055, ccData: 33314 }, - { type: 2, pts: 6752942055, ccData: 29791 }, - { type: 3, pts: 6752945058, ccData: 49698 }, - { type: 2, pts: 6752945058, ccData: 26990 }, - { type: 3, pts: 6752948061, ccData: 546 }, - { type: 2, pts: 6752948061, ccData: 24424 }, - { type: 3, pts: 6752951064, ccData: 16930 }, - { type: 2, pts: 6752951064, ccData: 25970 }, - { type: 3, pts: 6752954067, ccData: 33314 }, - { type: 2, pts: 6752954067, ccData: 25919 }, - { type: 3, pts: 6752963076, ccData: 49698 }, - { type: 2, pts: 6752963076, ccData: 35073 }, - { type: 3, pts: 6753227340, ccData: 2609 }, - { type: 2, pts: 6753227340, ccData: 39195 }, - { type: 2, pts: 6753227340, ccData: 16640 }, - { type: 2, pts: 6753227340, ccData: 31 }, - { type: 2, pts: 6753227340, ccData: 5264 }, - { type: 2, pts: 6753227340, ccData: 1283 }, - { type: 2, pts: 6753227340, ccData: 37162 }, - { type: 2, pts: 6753227340, ccData: 42 }, - { type: 2, pts: 6753227340, ccData: 37376 }, - { type: 2, pts: 6753227340, ccData: 2048 }, - { type: 3, pts: 6753233346, ccData: 17187 }, - { type: 2, pts: 6753233346, ccData: 37376 }, - { type: 2, pts: 6753233346, ccData: 2816 }, - { type: 3, pts: 6753239352, ccData: 33314 }, - { type: 2, pts: 6753239352, ccData: 10343 }, - { type: 3, pts: 6753242355, ccData: 49698 }, - { type: 2, pts: 6753242355, ccData: 26983 }, - { type: 3, pts: 6753245358, ccData: 546 }, - { type: 2, pts: 6753245358, ccData: 26476 }, - { type: 3, pts: 6753248361, ccData: 16930 }, - { type: 2, pts: 6753248361, ccData: 25971 }, - { type: 3, pts: 6753251364, ccData: 33314 }, - { type: 2, pts: 6753251364, ccData: 10554 }, - { type: 3, pts: 6753254367, ccData: 51761 }, - { type: 2, pts: 6753254367, ccData: 39195 }, - { type: 2, pts: 6753254367, ccData: 16640 }, - { type: 2, pts: 6753254367, ccData: 287 }, - { type: 2, pts: 6753254367, ccData: 4240 }, - { type: 2, pts: 6753254367, ccData: 1283 }, - { type: 2, pts: 6753254367, ccData: 37162 }, - { type: 2, pts: 6753254367, ccData: 0 }, - { type: 2, pts: 6753254367, ccData: 37377 }, - { type: 2, pts: 6753254367, ccData: 2048 }, - { type: 3, pts: 6753260373, ccData: 546 }, - { type: 2, pts: 6753260373, ccData: 17505 }, - { type: 3, pts: 6753263376, ccData: 16930 }, - { type: 2, pts: 6753263376, ccData: 25700 }, - { type: 3, pts: 6753266379, ccData: 33314 }, - { type: 2, pts: 6753266379, ccData: 31020 }, - { type: 3, pts: 6753269382, ccData: 49698 }, - { type: 2, pts: 6753269382, ccData: 24425 }, - { type: 3, pts: 6753272385, ccData: 546 }, - { type: 2, pts: 6753272385, ccData: 29735 }, - { type: 3, pts: 6753275388, ccData: 16930 }, - { type: 2, pts: 6753275388, ccData: 29535 }, - { type: 3, pts: 6753278391, ccData: 33314 }, - { type: 2, pts: 6753278391, ccData: 28005 }, - { type: 3, pts: 6753281394, ccData: 49698 }, - { type: 2, pts: 6753281394, ccData: 8448 }, - { type: 3, pts: 6753284397, ccData: 546 }, - { type: 2, pts: 6753284397, ccData: 35841 }, - { type: 3, pts: 6753290403, ccData: 16930 }, - { type: 2, pts: 6753290403, ccData: 35074 }, - { type: 3, pts: 6753461574, ccData: 35377 }, - { type: 2, pts: 6753461574, ccData: 38939 }, - { type: 2, pts: 6753461574, ccData: 17920 }, - { type: 2, pts: 6753461574, ccData: 31 }, - { type: 2, pts: 6753461574, ccData: 5264 }, - { type: 2, pts: 6753461574, ccData: 1283 }, - { type: 2, pts: 6753461574, ccData: 37162 }, - { type: 2, pts: 6753461574, ccData: 42 }, - { type: 2, pts: 6753461574, ccData: 37376 }, - { type: 2, pts: 6753461574, ccData: 2048 }, - { type: 3, pts: 6753467580, ccData: 49955 }, - { type: 2, pts: 6753467580, ccData: 37376 }, - { type: 2, pts: 6753467580, ccData: 2304 }, - { type: 3, pts: 6753473586, ccData: 546 }, - { type: 2, pts: 6753473586, ccData: 20585 }, - { type: 3, pts: 6753476589, ccData: 16930 }, - { type: 2, pts: 6753476589, ccData: 28267 }, - { type: 3, pts: 6753479592, ccData: 33314 }, - { type: 2, pts: 6753479592, ccData: 24940 }, - { type: 3, pts: 6753482595, ccData: 49698 }, - { type: 2, pts: 6753482595, ccData: 26979 }, - { type: 3, pts: 6753485598, ccData: 546 }, - { type: 2, pts: 6753485598, ccData: 26991 }, - { type: 3, pts: 6753488601, ccData: 16930 }, - { type: 2, pts: 6753488601, ccData: 30067 }, - { type: 3, pts: 6753491604, ccData: 33314 }, - { type: 2, pts: 6753491604, ccData: 11776 }, - { type: 3, pts: 6753494607, ccData: 49698 }, - { type: 2, pts: 6753494607, ccData: 35842 }, - { type: 3, pts: 6753500613, ccData: 546 }, - { type: 2, pts: 6753500613, ccData: 35073 }, - { type: 3, pts: 6753593706, ccData: 18993 }, - { type: 2, pts: 6753593706, ccData: 39195 }, - { type: 2, pts: 6753593706, ccData: 17920 }, - { type: 2, pts: 6753593706, ccData: 31 }, - { type: 2, pts: 6753593706, ccData: 5264 }, - { type: 2, pts: 6753593706, ccData: 1283 }, - { type: 2, pts: 6753593706, ccData: 37162 }, - { type: 2, pts: 6753593706, ccData: 42 }, - { type: 2, pts: 6753593706, ccData: 37376 }, - { type: 2, pts: 6753593706, ccData: 1024 }, - { type: 3, pts: 6753599712, ccData: 33571 }, - { type: 2, pts: 6753599712, ccData: 37376 }, - { type: 2, pts: 6753599712, ccData: 1792 }, - { type: 3, pts: 6753605718, ccData: 49698 }, - { type: 2, pts: 6753605718, ccData: 22369 }, - { type: 3, pts: 6753608721, ccData: 546 }, - { type: 2, pts: 6753608721, ccData: 26996 }, - { type: 3, pts: 6753611724, ccData: 16930 }, - { type: 2, pts: 6753611724, ccData: 11776 }, - { type: 3, pts: 6753614727, ccData: 33314 }, - { type: 2, pts: 6753614727, ccData: 35841 }, - { type: 3, pts: 6753620733, ccData: 49698 }, - { type: 2, pts: 6753620733, ccData: 35074 }, - { type: 3, pts: 6753662775, ccData: 2609 }, - { type: 2, pts: 6753662775, ccData: 38939 }, - { type: 2, pts: 6753662775, ccData: 16640 }, - { type: 2, pts: 6753662775, ccData: 31 }, - { type: 2, pts: 6753662775, ccData: 5264 }, - { type: 2, pts: 6753662775, ccData: 1283 }, - { type: 2, pts: 6753662775, ccData: 37162 }, - { type: 2, pts: 6753662775, ccData: 42 }, - { type: 2, pts: 6753662775, ccData: 37376 }, - { type: 2, pts: 6753662775, ccData: 0 }, - { type: 3, pts: 6753668781, ccData: 17187 }, - { type: 2, pts: 6753668781, ccData: 37376 }, - { type: 2, pts: 6753668781, ccData: 256 }, - { type: 3, pts: 6753674787, ccData: 33314 }, - { type: 2, pts: 6753674787, ccData: 18543 }, - { type: 3, pts: 6753677790, ccData: 49698 }, - { type: 2, pts: 6753677790, ccData: 30559 }, - { type: 3, pts: 6753680793, ccData: 546 }, - { type: 2, pts: 6753680793, ccData: 25705 }, - { type: 3, pts: 6753683796, ccData: 16930 }, - { type: 2, pts: 6753683796, ccData: 25695 }, - { type: 3, pts: 6753686799, ccData: 33314 }, - { type: 2, pts: 6753686799, ccData: 31087 }, - { type: 3, pts: 6753689802, ccData: 49698 }, - { type: 2, pts: 6753689802, ccData: 30066 }, - { type: 3, pts: 6753692805, ccData: 546 }, - { type: 2, pts: 6753692805, ccData: 24424 }, - { type: 3, pts: 6753695808, ccData: 16930 }, - { type: 2, pts: 6753695808, ccData: 24937 }, - { type: 3, pts: 6753698811, ccData: 33314 }, - { type: 2, pts: 6753698811, ccData: 29279 }, - { type: 3, pts: 6753701814, ccData: 49698 }, - { type: 2, pts: 6753701814, ccData: 26469 }, - { type: 3, pts: 6753704817, ccData: 546 }, - { type: 2, pts: 6753704817, ccData: 29696 }, - { type: 3, pts: 6753707820, ccData: 18993 }, - { type: 2, pts: 6753707820, ccData: 38939 }, - { type: 2, pts: 6753707820, ccData: 16640 }, - { type: 2, pts: 6753707820, ccData: 287 }, - { type: 2, pts: 6753707820, ccData: 4240 }, - { type: 2, pts: 6753707820, ccData: 1283 }, - { type: 2, pts: 6753707820, ccData: 37162 }, - { type: 2, pts: 6753707820, ccData: 0 }, - { type: 2, pts: 6753707820, ccData: 37377 }, - { type: 2, pts: 6753707820, ccData: 0 }, - { type: 3, pts: 6753713826, ccData: 33571 }, - { type: 2, pts: 6753713826, ccData: 37377 }, - { type: 2, pts: 6753713826, ccData: 256 }, - { type: 3, pts: 6753719832, ccData: 49698 }, - { type: 2, pts: 6753719832, ccData: 29551 }, - { type: 3, pts: 6753722835, ccData: 546 }, - { type: 2, pts: 6753722835, ccData: 24428 }, - { type: 3, pts: 6753725838, ccData: 16930 }, - { type: 2, pts: 6753725838, ccData: 28526 }, - { type: 3, pts: 6753728841, ccData: 33314 }, - { type: 2, pts: 6753728841, ccData: 26431 }, - { type: 3, pts: 6753731844, ccData: 49698 }, - { type: 2, pts: 6753731844, ccData: 35842 }, - { type: 3, pts: 6753737850, ccData: 546 }, - { type: 2, pts: 6753737850, ccData: 35073 }, - { type: 3, pts: 6753872985, ccData: 18993 }, - { type: 2, pts: 6753872985, ccData: 39195 }, - { type: 2, pts: 6753872985, ccData: 17920 }, - { type: 2, pts: 6753872985, ccData: 31 }, - { type: 2, pts: 6753872985, ccData: 5264 }, - { type: 2, pts: 6753872985, ccData: 1283 }, - { type: 2, pts: 6753872985, ccData: 37162 }, - { type: 2, pts: 6753872985, ccData: 42 }, - { type: 2, pts: 6753872985, ccData: 37376 }, - { type: 2, pts: 6753872985, ccData: 0 }, - { type: 3, pts: 6753878991, ccData: 33571 }, - { type: 2, pts: 6753878991, ccData: 37376 }, - { type: 2, pts: 6753878991, ccData: 768 }, - { type: 3, pts: 6753884997, ccData: 49698 }, - { type: 2, pts: 6753884997, ccData: 18783 }, - { type: 3, pts: 6753888000, ccData: 546 }, - { type: 2, pts: 6753888000, ccData: 30565 }, - { type: 3, pts: 6753891003, ccData: 16930 }, - { type: 2, pts: 6753891003, ccData: 28276 }, - { type: 3, pts: 6753894006, ccData: 33314 }, - { type: 2, pts: 6753894006, ccData: 24436 }, - { type: 3, pts: 6753897009, ccData: 49698 }, - { type: 2, pts: 6753897009, ccData: 28511 }, - { type: 3, pts: 6753900012, ccData: 546 }, - { type: 2, pts: 6753900012, ccData: 29800 }, - { type: 3, pts: 6753903015, ccData: 16930 }, - { type: 2, pts: 6753903015, ccData: 25951 }, - { type: 3, pts: 6753906018, ccData: 33314 }, - { type: 2, pts: 6753906018, ccData: 17522 }, - { type: 3, pts: 6753909021, ccData: 49698 }, - { type: 2, pts: 6753909021, ccData: 25953 }, - { type: 3, pts: 6753912024, ccData: 546 }, - { type: 2, pts: 6753912024, ccData: 27999 }, - { type: 3, pts: 6753915027, ccData: 16930 }, - { type: 2, pts: 6753915027, ccData: 21345 }, - { type: 3, pts: 6753918030, ccData: 33314 }, - { type: 2, pts: 6753918030, ccData: 27759 }, - { type: 3, pts: 6753921033, ccData: 49698 }, - { type: 2, pts: 6753921033, ccData: 28206 }, - { type: 3, pts: 6753924036, ccData: 546 }, - { type: 2, pts: 6753924036, ccData: 35841 }, - { type: 3, pts: 6753930042, ccData: 16930 }, - { type: 2, pts: 6753930042, ccData: 35074 }, - { type: 3, pts: 6754065177, ccData: 35377 }, - { type: 2, pts: 6754065177, ccData: 38939 }, - { type: 2, pts: 6754065177, ccData: 16640 }, - { type: 2, pts: 6754065177, ccData: 31 }, - { type: 2, pts: 6754065177, ccData: 5264 }, - { type: 2, pts: 6754065177, ccData: 1283 }, - { type: 2, pts: 6754065177, ccData: 37162 }, - { type: 2, pts: 6754065177, ccData: 42 }, - { type: 2, pts: 6754065177, ccData: 37376 }, - { type: 2, pts: 6754065177, ccData: 0 }, - { type: 3, pts: 6754071183, ccData: 49955 }, - { type: 2, pts: 6754071183, ccData: 37376 }, - { type: 2, pts: 6754071183, ccData: 768 }, - { type: 3, pts: 6754077189, ccData: 546 }, - { type: 2, pts: 6754077189, ccData: 22895 }, - { type: 3, pts: 6754080192, ccData: 16930 }, - { type: 2, pts: 6754080192, ccData: 30047 }, - { type: 3, pts: 6754083195, ccData: 33314 }, - { type: 2, pts: 6754083195, ccData: 25441 }, - { type: 3, pts: 6754086198, ccData: 49698 }, - { type: 2, pts: 6754086198, ccData: 28255 }, - { type: 3, pts: 6754089201, ccData: 546 }, - { type: 2, pts: 6754089201, ccData: 26721 }, - { type: 3, pts: 6754092204, ccData: 16930 }, - { type: 2, pts: 6754092204, ccData: 30309 }, - { type: 3, pts: 6754095207, ccData: 33314 }, - { type: 2, pts: 6754095207, ccData: 24417 }, - { type: 3, pts: 6754098210, ccData: 49698 }, - { type: 2, pts: 6754098210, ccData: 28281 }, - { type: 3, pts: 6754101213, ccData: 546 }, - { type: 2, pts: 6754101213, ccData: 24424 }, - { type: 3, pts: 6754104216, ccData: 16930 }, - { type: 2, pts: 6754104216, ccData: 24937 }, - { type: 3, pts: 6754107219, ccData: 33314 }, - { type: 2, pts: 6754107219, ccData: 29299 }, - { type: 3, pts: 6754110222, ccData: 49698 }, - { type: 2, pts: 6754110222, ccData: 29817 }, - { type: 3, pts: 6754113225, ccData: 546 }, - { type: 2, pts: 6754113225, ccData: 27749 }, - { type: 3, pts: 6754116228, ccData: 18993 }, - { type: 2, pts: 6754116228, ccData: 38939 }, - { type: 2, pts: 6754116228, ccData: 16640 }, - { type: 2, pts: 6754116228, ccData: 287 }, - { type: 2, pts: 6754116228, ccData: 4240 }, - { type: 2, pts: 6754116228, ccData: 1283 }, - { type: 2, pts: 6754116228, ccData: 37162 }, - { type: 2, pts: 6754116228, ccData: 0 }, - { type: 2, pts: 6754116228, ccData: 37377 }, - { type: 2, pts: 6754116228, ccData: 0 }, - { type: 3, pts: 6754122234, ccData: 33571 }, - { type: 2, pts: 6754122234, ccData: 37377 }, - { type: 2, pts: 6754122234, ccData: 768 }, - { type: 3, pts: 6754128240, ccData: 49698 }, - { type: 2, pts: 6754128240, ccData: 31087 }, - { type: 3, pts: 6754131243, ccData: 546 }, - { type: 2, pts: 6754131243, ccData: 30047 }, - { type: 3, pts: 6754134246, ccData: 16930 }, - { type: 2, pts: 6754134246, ccData: 25714 }, - { type: 3, pts: 6754137249, ccData: 33314 }, - { type: 2, pts: 6754137249, ccData: 25953 }, - { type: 3, pts: 6754140252, ccData: 49698 }, - { type: 2, pts: 6754140252, ccData: 27999 }, - { type: 3, pts: 6754143255, ccData: 546 }, - { type: 2, pts: 6754143255, ccData: 28518 }, - { type: 3, pts: 6754146258, ccData: 16930 }, - { type: 2, pts: 6754146258, ccData: 11776 }, - { type: 3, pts: 6754149261, ccData: 33314 }, - { type: 2, pts: 6754149261, ccData: 35842 }, - { type: 3, pts: 6754155267, ccData: 49698 }, - { type: 2, pts: 6754155267, ccData: 35073 }, - { type: 3, pts: 6754353465, ccData: 2609 }, - { type: 2, pts: 6754353465, ccData: 39195 }, - { type: 2, pts: 6754353465, ccData: 17920 }, - { type: 2, pts: 6754353465, ccData: 31 }, - { type: 2, pts: 6754353465, ccData: 5264 }, - { type: 2, pts: 6754353465, ccData: 1283 }, - { type: 2, pts: 6754353465, ccData: 37162 }, - { type: 2, pts: 6754353465, ccData: 42 }, - { type: 2, pts: 6754353465, ccData: 37376 }, - { type: 2, pts: 6754353465, ccData: 6144 }, - { type: 3, pts: 6754359471, ccData: 17187 }, - { type: 2, pts: 6754359471, ccData: 37376 }, - { type: 2, pts: 6754359471, ccData: 6400 }, - { type: 3, pts: 6754365477, ccData: 33314 }, - { type: 2, pts: 6754365477, ccData: 16750 }, - { type: 3, pts: 6754368480, ccData: 49698 }, - { type: 2, pts: 6754368480, ccData: 25695 }, - { type: 3, pts: 6754371483, ccData: 546 }, - { type: 2, pts: 6754371483, ccData: 28271 }, - { type: 3, pts: 6754374486, ccData: 16930 }, - { type: 2, pts: 6754374486, ccData: 30464 }, - { type: 3, pts: 6754377489, ccData: 33314 }, - { type: 2, pts: 6754377489, ccData: 35841 }, - { type: 3, pts: 6754383495, ccData: 49698 }, - { type: 2, pts: 6754383495, ccData: 35074 }, - { type: 3, pts: 6754401513, ccData: 2609 }, - { type: 2, pts: 6754401513, ccData: 38939 }, - { type: 2, pts: 6754401513, ccData: 16640 }, - { type: 2, pts: 6754401513, ccData: 31 }, - { type: 2, pts: 6754401513, ccData: 5264 }, - { type: 2, pts: 6754401513, ccData: 1283 }, - { type: 2, pts: 6754401513, ccData: 37162 }, - { type: 2, pts: 6754401513, ccData: 42 }, - { type: 2, pts: 6754401513, ccData: 37376 }, - { type: 2, pts: 6754401513, ccData: 2048 }, - { type: 3, pts: 6754407519, ccData: 17187 }, - { type: 2, pts: 6754407519, ccData: 37376 }, - { type: 2, pts: 6754407519, ccData: 2560 }, - { type: 3, pts: 6754413525, ccData: 33314 }, - { type: 2, pts: 6754413525, ccData: 31087 }, - { type: 3, pts: 6754416528, ccData: 49698 }, - { type: 2, pts: 6754416528, ccData: 30047 }, - { type: 3, pts: 6754419531, ccData: 546 }, - { type: 2, pts: 6754419531, ccData: 25441 }, - { type: 3, pts: 6754422534, ccData: 16930 }, - { type: 2, pts: 6754422534, ccData: 28255 }, - { type: 3, pts: 6754425537, ccData: 33314 }, - { type: 2, pts: 6754425537, ccData: 26721 }, - { type: 3, pts: 6754428540, ccData: 49698 }, - { type: 2, pts: 6754428540, ccData: 30309 }, - { type: 3, pts: 6754431543, ccData: 546 }, - { type: 2, pts: 6754431543, ccData: 24436 }, - { type: 3, pts: 6754434546, ccData: 16930 }, - { type: 2, pts: 6754434546, ccData: 26725 }, - { type: 3, pts: 6754437549, ccData: 33314 }, - { type: 2, pts: 6754437549, ccData: 24428 }, - { type: 3, pts: 6754440552, ccData: 49698 }, - { type: 2, pts: 6754440552, ccData: 30062 }, - { type: 3, pts: 6754443555, ccData: 546 }, - { type: 2, pts: 6754443555, ccData: 25448 }, - { type: 3, pts: 6754446558, ccData: 18993 }, - { type: 2, pts: 6754446558, ccData: 38939 }, - { type: 2, pts: 6754446558, ccData: 16640 }, - { type: 2, pts: 6754446558, ccData: 287 }, - { type: 2, pts: 6754446558, ccData: 4240 }, - { type: 2, pts: 6754446558, ccData: 1283 }, - { type: 2, pts: 6754446558, ccData: 37162 }, - { type: 2, pts: 6754446558, ccData: 0 }, - { type: 2, pts: 6754446558, ccData: 37377 }, - { type: 2, pts: 6754446558, ccData: 1024 }, - { type: 3, pts: 6754452564, ccData: 33314 }, - { type: 2, pts: 6754452564, ccData: 31087 }, - { type: 3, pts: 6754455567, ccData: 49698 }, - { type: 2, pts: 6754455567, ccData: 29991 }, - { type: 3, pts: 6754458570, ccData: 546 }, - { type: 2, pts: 6754458570, ccData: 30309 }, - { type: 3, pts: 6754461573, ccData: 16930 }, - { type: 2, pts: 6754461573, ccData: 24418 }, - { type: 3, pts: 6754464576, ccData: 33314 }, - { type: 2, pts: 6754464576, ccData: 25957 }, - { type: 3, pts: 6754467579, ccData: 49698 }, - { type: 2, pts: 6754467579, ccData: 28255 }, - { type: 3, pts: 6754470582, ccData: 546 }, - { type: 2, pts: 6754470582, ccData: 25714 }, - { type: 3, pts: 6754473585, ccData: 16930 }, - { type: 2, pts: 6754473585, ccData: 25953 }, - { type: 3, pts: 6754476588, ccData: 33314 }, - { type: 2, pts: 6754476588, ccData: 28009 }, - { type: 3, pts: 6754479591, ccData: 49698 }, - { type: 2, pts: 6754479591, ccData: 28263 }, - { type: 3, pts: 6754482594, ccData: 546 }, - { type: 2, pts: 6754482594, ccData: 24431 }, - { type: 3, pts: 6754485597, ccData: 16930 }, - { type: 2, pts: 6754485597, ccData: 26207 }, - { type: 3, pts: 6754488600, ccData: 33314 }, - { type: 2, pts: 6754488600, ccData: 29807 }, - { type: 3, pts: 6754491603, ccData: 49698 }, - { type: 2, pts: 6754491603, ccData: 28462 }, - { type: 3, pts: 6754494606, ccData: 546 }, - { type: 2, pts: 6754494606, ccData: 35842 }, - { type: 3, pts: 6754500612, ccData: 16930 }, - { type: 2, pts: 6754500612, ccData: 35073 }, - { type: 3, pts: 6754728840, ccData: 35377 }, - { type: 2, pts: 6754728840, ccData: 39195 }, - { type: 2, pts: 6754728840, ccData: 17920 }, - { type: 2, pts: 6754728840, ccData: 31 }, - { type: 2, pts: 6754728840, ccData: 5264 }, - { type: 2, pts: 6754728840, ccData: 1283 }, - { type: 2, pts: 6754728840, ccData: 37162 }, - { type: 2, pts: 6754728840, ccData: 42 }, - { type: 2, pts: 6754728840, ccData: 37376 }, - { type: 2, pts: 6754728840, ccData: 3072 }, - { type: 3, pts: 6754734846, ccData: 49955 }, - { type: 2, pts: 6754734846, ccData: 37376 }, - { type: 2, pts: 6754734846, ccData: 3328 }, - { type: 3, pts: 6754740852, ccData: 546 }, - { type: 2, pts: 6754740852, ccData: 21601 }, - { type: 3, pts: 6754743855, ccData: 16930 }, - { type: 2, pts: 6754743855, ccData: 11620 }, - { type: 3, pts: 6754746858, ccData: 33314 }, - { type: 2, pts: 6754746858, ccData: 24865 }, - { type: 3, pts: 6754749861, ccData: 49698 }, - { type: 2, pts: 6754749861, ccData: 35841 }, - { type: 3, pts: 6754755867, ccData: 546 }, - { type: 2, pts: 6754755867, ccData: 35074 }, - { type: 3, pts: 6754839951, ccData: 18993 }, - { type: 2, pts: 6754839951, ccData: 38939 }, - { type: 2, pts: 6754839951, ccData: 17920 }, - { type: 2, pts: 6754839951, ccData: 31 }, - { type: 2, pts: 6754839951, ccData: 5264 }, - { type: 2, pts: 6754839951, ccData: 1283 }, - { type: 2, pts: 6754839951, ccData: 37162 }, - { type: 2, pts: 6754839951, ccData: 42 }, - { type: 2, pts: 6754839951, ccData: 37376 }, - { type: 2, pts: 6754839951, ccData: 1024 }, - { type: 3, pts: 6754845957, ccData: 33314 }, - { type: 2, pts: 6754845957, ccData: 21360 }, - { type: 3, pts: 6754848960, ccData: 49698 }, - { type: 2, pts: 6754848960, ccData: 24935 }, - { type: 3, pts: 6754851963, ccData: 546 }, - { type: 2, pts: 6754851963, ccData: 26725 }, - { type: 3, pts: 6754854966, ccData: 16930 }, - { type: 2, pts: 6754854966, ccData: 29812 }, - { type: 3, pts: 6754857969, ccData: 33314 }, - { type: 2, pts: 6754857969, ccData: 26975 }, - { type: 3, pts: 6754860972, ccData: 49698 }, - { type: 2, pts: 6754860972, ccData: 24942 }, - { type: 3, pts: 6754863975, ccData: 546 }, - { type: 2, pts: 6754863975, ccData: 25695 }, - { type: 3, pts: 6754866978, ccData: 16930 }, - { type: 2, pts: 6754866978, ccData: 28005 }, - { type: 3, pts: 6754869981, ccData: 33314 }, - { type: 2, pts: 6754869981, ccData: 24948 }, - { type: 3, pts: 6754872984, ccData: 49698 }, - { type: 2, pts: 6754872984, ccData: 25185 }, - { type: 3, pts: 6754875987, ccData: 546 }, - { type: 2, pts: 6754875987, ccData: 27756 }, - { type: 3, pts: 6754878990, ccData: 16930 }, - { type: 2, pts: 6754878990, ccData: 29486 }, - { type: 3, pts: 6754881993, ccData: 33314 }, - { type: 2, pts: 6754881993, ccData: 35842 }, - { type: 3, pts: 6754887999, ccData: 49698 }, - { type: 2, pts: 6754887999, ccData: 35073 }, - { type: 3, pts: 6755053164, ccData: 2609 }, - { type: 2, pts: 6755053164, ccData: 39195 }, - { type: 2, pts: 6755053164, ccData: 17920 }, - { type: 2, pts: 6755053164, ccData: 31 }, - { type: 2, pts: 6755053164, ccData: 5264 }, - { type: 2, pts: 6755053164, ccData: 1283 }, - { type: 2, pts: 6755053164, ccData: 37162 }, - { type: 2, pts: 6755053164, ccData: 42 }, - { type: 2, pts: 6755053164, ccData: 37376 }, - { type: 2, pts: 6755053164, ccData: 2048 }, - { type: 3, pts: 6755059170, ccData: 17187 }, - { type: 2, pts: 6755059170, ccData: 37376 }, - { type: 2, pts: 6755059170, ccData: 2560 }, - { type: 3, pts: 6755065176, ccData: 33314 }, - { type: 2, pts: 6755065176, ccData: 19833 }, - { type: 3, pts: 6755068179, ccData: 49698 }, - { type: 2, pts: 6755068179, ccData: 24422 }, - { type: 3, pts: 6755071182, ccData: 546 }, - { type: 2, pts: 6755071182, ccData: 24950 }, - { type: 3, pts: 6755074185, ccData: 16930 }, - { type: 2, pts: 6755074185, ccData: 28530 }, - { type: 3, pts: 6755077188, ccData: 33314 }, - { type: 2, pts: 6755077188, ccData: 26996 }, - { type: 3, pts: 6755080191, ccData: 49698 }, - { type: 2, pts: 6755080191, ccData: 25889 }, - { type: 3, pts: 6755083194, ccData: 546 }, - { type: 2, pts: 6755083194, ccData: 35841 }, - { type: 3, pts: 6755089200, ccData: 16930 }, - { type: 2, pts: 6755089200, ccData: 35074 }, - { type: 3, pts: 6755203314, ccData: 35377 }, - { type: 2, pts: 6755203314, ccData: 38939 }, - { type: 2, pts: 6755203314, ccData: 17920 }, - { type: 2, pts: 6755203314, ccData: 31 }, - { type: 2, pts: 6755203314, ccData: 5264 }, - { type: 2, pts: 6755203314, ccData: 1283 }, - { type: 2, pts: 6755203314, ccData: 37162 }, - { type: 2, pts: 6755203314, ccData: 42 }, - { type: 2, pts: 6755203314, ccData: 37376 }, - { type: 2, pts: 6755203314, ccData: 2048 }, - { type: 3, pts: 6755209320, ccData: 49955 }, - { type: 2, pts: 6755209320, ccData: 37376 }, - { type: 2, pts: 6755209320, ccData: 2560 }, - { type: 3, pts: 6755215326, ccData: 546 }, - { type: 2, pts: 6755215326, ccData: 18529 }, - { type: 3, pts: 6755218329, ccData: 16930 }, - { type: 2, pts: 6755218329, ccData: 30309 }, - { type: 3, pts: 6755221332, ccData: 33314 }, - { type: 2, pts: 6755221332, ccData: 24417 }, - { type: 3, pts: 6755224335, ccData: 49698 }, - { type: 2, pts: 6755224335, ccData: 24435 }, - { type: 3, pts: 6755227338, ccData: 546 }, - { type: 2, pts: 6755227338, ccData: 25953 }, - { type: 3, pts: 6755230341, ccData: 16930 }, - { type: 2, pts: 6755230341, ccData: 29742 }, - { type: 3, pts: 6755233344, ccData: 33314 }, - { type: 2, pts: 6755233344, ccData: 35842 }, - { type: 3, pts: 6755239350, ccData: 49698 }, - { type: 2, pts: 6755239350, ccData: 35073 }, - { type: 3, pts: 6755350461, ccData: 546 }, - { type: 2, pts: 6755350461, ccData: 35841 }, - { type: 3, pts: 6755644755, ccData: 18993 }, - { type: 2, pts: 6755644755, ccData: 38939 }, - { type: 2, pts: 6755644755, ccData: 17920 }, - { type: 2, pts: 6755644755, ccData: 31 }, - { type: 2, pts: 6755644755, ccData: 5264 }, - { type: 2, pts: 6755644755, ccData: 1283 }, - { type: 2, pts: 6755644755, ccData: 37162 }, - { type: 2, pts: 6755644755, ccData: 0 }, - { type: 2, pts: 6755644755, ccData: 37376 }, - { type: 2, pts: 6755644755, ccData: 3072 }, - { type: 3, pts: 6755650761, ccData: 33314 }, - { type: 2, pts: 6755650761, ccData: 10343 }, - { type: 3, pts: 6755653764, ccData: 49698 }, - { type: 2, pts: 6755653764, ccData: 29295 }, - { type: 3, pts: 6755656767, ccData: 546 }, - { type: 2, pts: 6755656767, ccData: 24942 }, - { type: 3, pts: 6755659770, ccData: 16930 }, - { type: 2, pts: 6755659770, ccData: 29481 }, - { type: 3, pts: 6755668779, ccData: 33314 }, - { type: 2, pts: 6755668779, ccData: 35073 }, - { type: 3, pts: 6755773884, ccData: 49698 }, - { type: 2, pts: 6755773884, ccData: 35841 }, - { type: 3, pts: 6755872983, ccData: 2609 }, - { type: 2, pts: 6755872983, ccData: 38939 }, - { type: 2, pts: 6755872983, ccData: 0 }, - { type: 2, pts: 6755872983, ccData: 31 }, - { type: 2, pts: 6755872983, ccData: 5264 }, - { type: 2, pts: 6755872983, ccData: 1283 }, - { type: 2, pts: 6755872983, ccData: 37162 }, - { type: 2, pts: 6755872983, ccData: 0 }, - { type: 2, pts: 6755872983, ccData: 37376 }, - { type: 2, pts: 6755872983, ccData: 3072 }, - { type: 3, pts: 6755875986, ccData: 17187 }, - { type: 2, pts: 6755875986, ccData: 37376 }, - { type: 2, pts: 6755875986, ccData: 3584 }, - { type: 3, pts: 6755881992, ccData: 33314 }, - { type: 2, pts: 6755881992, ccData: 21864 }, - { type: 3, pts: 6755884995, ccData: 49698 }, - { type: 2, pts: 6755884995, ccData: 11359 }, - { type: 3, pts: 6755887998, ccData: 546 }, - { type: 2, pts: 6755887998, ccData: 17505 }, - { type: 3, pts: 6755891001, ccData: 16930 }, - { type: 2, pts: 6755891001, ccData: 25700 }, - { type: 3, pts: 6755894004, ccData: 33314 }, - { type: 2, pts: 6755894004, ccData: 31022 }, - { type: 3, pts: 6755903013, ccData: 49698 }, - { type: 2, pts: 6755903013, ccData: 35073 }, - { type: 3, pts: 6756008118, ccData: 2609 }, - { type: 2, pts: 6756008118, ccData: 39195 }, - { type: 2, pts: 6756008118, ccData: 0 }, - { type: 2, pts: 6756008118, ccData: 31 }, - { type: 2, pts: 6756008118, ccData: 5264 }, - { type: 2, pts: 6756008118, ccData: 1283 }, - { type: 2, pts: 6756008118, ccData: 37162 }, - { type: 2, pts: 6756008118, ccData: 42 }, - { type: 2, pts: 6756008118, ccData: 37376 }, - { type: 2, pts: 6756008118, ccData: 3072 }, - { type: 3, pts: 6756011121, ccData: 17187 }, - { type: 2, pts: 6756011121, ccData: 37376 }, - { type: 2, pts: 6756011121, ccData: 3328 }, - { type: 3, pts: 6756017127, ccData: 33314 }, - { type: 2, pts: 6756017127, ccData: 22895 }, - { type: 3, pts: 6756020130, ccData: 49698 }, - { type: 2, pts: 6756020130, ccData: 29991 }, - { type: 3, pts: 6756023133, ccData: 546 }, - { type: 2, pts: 6756023133, ccData: 29285 }, - { type: 3, pts: 6756026136, ccData: 16930 }, - { type: 2, pts: 6756026136, ccData: 24435 }, - { type: 3, pts: 6756029139, ccData: 33314 }, - { type: 2, pts: 6756029139, ccData: 29793 }, - { type: 3, pts: 6756032142, ccData: 49698 }, - { type: 2, pts: 6756032142, ccData: 28260 }, - { type: 3, pts: 6756035145, ccData: 546 }, - { type: 2, pts: 6756035145, ccData: 26990 }, - { type: 3, pts: 6756038148, ccData: 16930 }, - { type: 2, pts: 6756038148, ccData: 26368 }, - { type: 3, pts: 6756041151, ccData: 35377 }, - { type: 2, pts: 6756041151, ccData: 39195 }, - { type: 2, pts: 6756041151, ccData: 0 }, - { type: 2, pts: 6756041151, ccData: 287 }, - { type: 2, pts: 6756041151, ccData: 4240 }, - { type: 2, pts: 6756041151, ccData: 1283 }, - { type: 2, pts: 6756041151, ccData: 37162 }, - { type: 2, pts: 6756041151, ccData: 0 }, - { type: 2, pts: 6756041151, ccData: 37377 }, - { type: 2, pts: 6756041151, ccData: 4096 }, - { type: 3, pts: 6756044154, ccData: 49955 }, - { type: 2, pts: 6756044154, ccData: 37377 }, - { type: 2, pts: 6756044154, ccData: 4352 }, - { type: 3, pts: 6756050160, ccData: 546 }, - { type: 2, pts: 6756050160, ccData: 28526 }, - { type: 3, pts: 6756053163, ccData: 16930 }, - { type: 2, pts: 6756053163, ccData: 24429 }, - { type: 3, pts: 6756056166, ccData: 33314 }, - { type: 2, pts: 6756056166, ccData: 31071 }, - { type: 3, pts: 6756059169, ccData: 49698 }, - { type: 2, pts: 6756059169, ccData: 26721 }, - { type: 3, pts: 6756062172, ccData: 546 }, - { type: 2, pts: 6756062172, ccData: 26994 }, - { type: 3, pts: 6756065175, ccData: 16930 }, - { type: 2, pts: 6756065175, ccData: 11776 }, - { type: 3, pts: 6756068178, ccData: 33314 }, - { type: 2, pts: 6756068178, ccData: 35841 }, - { type: 3, pts: 6756074184, ccData: 49698 }, - { type: 2, pts: 6756074184, ccData: 35074 }, - { type: 3, pts: 6756170280, ccData: 2609 }, - { type: 2, pts: 6756170280, ccData: 38939 }, - { type: 2, pts: 6756170280, ccData: 0 }, - { type: 2, pts: 6756170280, ccData: 31 }, - { type: 2, pts: 6756170280, ccData: 5264 }, - { type: 2, pts: 6756170280, ccData: 1283 }, - { type: 2, pts: 6756170280, ccData: 37162 }, - { type: 2, pts: 6756170280, ccData: 42 }, - { type: 2, pts: 6756170280, ccData: 37376 }, - { type: 2, pts: 6756170280, ccData: 1024 }, - { type: 3, pts: 6756173283, ccData: 17187 }, - { type: 2, pts: 6756173283, ccData: 37376 }, - { type: 2, pts: 6756173283, ccData: 1536 }, - { type: 3, pts: 6756179289, ccData: 33314 }, - { type: 2, pts: 6756179289, ccData: 10339 }, - { type: 3, pts: 6756182292, ccData: 49698 }, - { type: 2, pts: 6756182292, ccData: 26741 }, - { type: 3, pts: 6756185295, ccData: 546 }, - { type: 2, pts: 6756185295, ccData: 25451 }, - { type: 3, pts: 6756188298, ccData: 16930 }, - { type: 2, pts: 6756188298, ccData: 27749 }, - { type: 3, pts: 6756191301, ccData: 33314 }, - { type: 2, pts: 6756191301, ccData: 29481 }, - { type: 3, pts: 6756194304, ccData: 49698 }, - { type: 2, pts: 6756194304, ccData: 14848 }, - { type: 3, pts: 6756197307, ccData: 2609 }, - { type: 2, pts: 6756197307, ccData: 38939 }, - { type: 2, pts: 6756197307, ccData: 0 }, - { type: 2, pts: 6756197307, ccData: 287 }, - { type: 2, pts: 6756197307, ccData: 4240 }, - { type: 2, pts: 6756197307, ccData: 1283 }, - { type: 2, pts: 6756197307, ccData: 37162 }, - { type: 2, pts: 6756197307, ccData: 0 }, - { type: 2, pts: 6756197307, ccData: 37377 }, - { type: 2, pts: 6756197307, ccData: 1024 }, - { type: 3, pts: 6756200310, ccData: 17187 }, - { type: 2, pts: 6756200310, ccData: 37377 }, - { type: 2, pts: 6756200310, ccData: 1536 }, - { type: 3, pts: 6756206316, ccData: 33314 }, - { type: 2, pts: 6756206316, ccData: 20335 }, - { type: 3, pts: 6756209319, ccData: 49698 }, - { type: 2, pts: 6756209319, ccData: 28787 }, - { type: 3, pts: 6756212322, ccData: 546 }, - { type: 2, pts: 6756212322, ccData: 8448 }, - { type: 3, pts: 6756215325, ccData: 16930 }, - { type: 2, pts: 6756215325, ccData: 35842 }, - { type: 3, pts: 6756221331, ccData: 33314 }, - { type: 2, pts: 6756221331, ccData: 35073 }, - { type: 3, pts: 6756329439, ccData: 51761 }, - { type: 2, pts: 6756329439, ccData: 39195 }, - { type: 2, pts: 6756329439, ccData: 0 }, - { type: 2, pts: 6756329439, ccData: 31 }, - { type: 2, pts: 6756329439, ccData: 5264 }, - { type: 2, pts: 6756329439, ccData: 1283 }, - { type: 2, pts: 6756329439, ccData: 37162 }, - { type: 2, pts: 6756329439, ccData: 42 }, - { type: 2, pts: 6756329439, ccData: 37376 }, - { type: 2, pts: 6756329439, ccData: 0 }, - { type: 3, pts: 6756332442, ccData: 546 }, - { type: 2, pts: 6756332442, ccData: 21359 }, - { type: 3, pts: 6756335445, ccData: 16930 }, - { type: 2, pts: 6756335445, ccData: 29298 }, - { type: 3, pts: 6756338448, ccData: 33314 }, - { type: 2, pts: 6756338448, ccData: 31022 }, - { type: 3, pts: 6756341451, ccData: 51761 }, - { type: 2, pts: 6756341451, ccData: 39195 }, - { type: 2, pts: 6756341451, ccData: 0 }, - { type: 2, pts: 6756341451, ccData: 543 }, - { type: 2, pts: 6756341451, ccData: 4240 }, - { type: 2, pts: 6756341451, ccData: 1283 }, - { type: 2, pts: 6756341451, ccData: 37162 }, - { type: 2, pts: 6756341451, ccData: 0 }, - { type: 2, pts: 6756341451, ccData: 37378 }, - { type: 2, pts: 6756341451, ccData: 2048 }, - { type: 3, pts: 6756347457, ccData: 546 }, - { type: 2, pts: 6756347457, ccData: 10337 }, - { type: 3, pts: 6756350460, ccData: 16930 }, - { type: 2, pts: 6756350460, ccData: 27756 }, - { type: 3, pts: 6756353463, ccData: 33314 }, - { type: 2, pts: 6756353463, ccData: 24419 }, - { type: 3, pts: 6756356466, ccData: 49698 }, - { type: 2, pts: 6756356466, ccData: 26741 }, - { type: 3, pts: 6756359469, ccData: 546 }, - { type: 2, pts: 6756359469, ccData: 25451 }, - { type: 3, pts: 6756362472, ccData: 16930 }, - { type: 2, pts: 6756362472, ccData: 27753 }, - { type: 3, pts: 6756365475, ccData: 33314 }, - { type: 2, pts: 6756365475, ccData: 28263 }, - { type: 3, pts: 6756368478, ccData: 49698 }, - { type: 2, pts: 6756368478, ccData: 10496 }, - { type: 3, pts: 6756371481, ccData: 546 }, - { type: 2, pts: 6756371481, ccData: 35841 }, - { type: 3, pts: 6756377487, ccData: 16930 }, - { type: 2, pts: 6756377487, ccData: 35074 }, - { type: 3, pts: 6756479589, ccData: 35377 }, - { type: 2, pts: 6756479589, ccData: 38939 }, - { type: 2, pts: 6756479589, ccData: 17920 }, - { type: 2, pts: 6756479589, ccData: 31 }, - { type: 2, pts: 6756479589, ccData: 5264 }, - { type: 2, pts: 6756479589, ccData: 1283 }, - { type: 2, pts: 6756479589, ccData: 37162 }, - { type: 2, pts: 6756479589, ccData: 42 }, - { type: 2, pts: 6756479589, ccData: 37376 }, - { type: 2, pts: 6756479589, ccData: 3072 }, - { type: 3, pts: 6756485595, ccData: 49698 }, - { type: 2, pts: 6756485595, ccData: 10343 }, - { type: 3, pts: 6756488598, ccData: 546 }, - { type: 2, pts: 6756488598, ccData: 29295 }, - { type: 3, pts: 6756491601, ccData: 16930 }, - { type: 2, pts: 6756491601, ccData: 24942 }, - { type: 3, pts: 6756494604, ccData: 33314 }, - { type: 2, pts: 6756494604, ccData: 29481 }, - { type: 3, pts: 6756497607, ccData: 49698 }, - { type: 2, pts: 6756497607, ccData: 35842 }, - { type: 3, pts: 6756503613, ccData: 546 }, - { type: 2, pts: 6756503613, ccData: 35073 }, - { type: 3, pts: 6756581691, ccData: 18993 }, - { type: 2, pts: 6756581691, ccData: 39195 }, - { type: 2, pts: 6756581691, ccData: 0 }, - { type: 2, pts: 6756581691, ccData: 31 }, - { type: 2, pts: 6756581691, ccData: 5264 }, - { type: 2, pts: 6756581691, ccData: 1283 }, - { type: 2, pts: 6756581691, ccData: 37162 }, - { type: 2, pts: 6756581691, ccData: 42 }, - { type: 2, pts: 6756581691, ccData: 37376 }, - { type: 2, pts: 6756581691, ccData: 2048 }, - { type: 3, pts: 6756584694, ccData: 33571 }, - { type: 2, pts: 6756584694, ccData: 37376 }, - { type: 2, pts: 6756584694, ccData: 2816 }, - { type: 3, pts: 6756590700, ccData: 49698 }, - { type: 2, pts: 6756590700, ccData: 19823 }, - { type: 3, pts: 6756593703, ccData: 546 }, - { type: 2, pts: 6756593703, ccData: 28013 }, - { type: 3, pts: 6756596706, ccData: 16930 }, - { type: 2, pts: 6756596706, ccData: 31020 }, - { type: 3, pts: 6756599709, ccData: 33314 }, - { type: 2, pts: 6756599709, ccData: 24430 }, - { type: 3, pts: 6756602712, ccData: 49698 }, - { type: 2, pts: 6756602712, ccData: 28535 }, - { type: 3, pts: 6756605715, ccData: 546 }, - { type: 2, pts: 6756605715, ccData: 24441 }, - { type: 3, pts: 6756608718, ccData: 16930 }, - { type: 2, pts: 6756608718, ccData: 28533 }, - { type: 3, pts: 6756611721, ccData: 33314 }, - { type: 2, pts: 6756611721, ccData: 10098 }, - { type: 3, pts: 6756614724, ccData: 49698 }, - { type: 2, pts: 6756614724, ccData: 25856 }, - { type: 3, pts: 6756617727, ccData: 2609 }, - { type: 2, pts: 6756617727, ccData: 39195 }, - { type: 2, pts: 6756617727, ccData: 0 }, - { type: 2, pts: 6756617727, ccData: 287 }, - { type: 2, pts: 6756617727, ccData: 4240 }, - { type: 2, pts: 6756617727, ccData: 1283 }, - { type: 2, pts: 6756617727, ccData: 37162 }, - { type: 2, pts: 6756617727, ccData: 0 }, - { type: 2, pts: 6756617727, ccData: 37377 }, - { type: 2, pts: 6756617727, ccData: 4096 }, - { type: 3, pts: 6756620730, ccData: 17187 }, - { type: 2, pts: 6756620730, ccData: 37377 }, - { type: 2, pts: 6756620730, ccData: 4352 }, - { type: 3, pts: 6756626736, ccData: 33314 }, - { type: 2, pts: 6756626736, ccData: 28526 }, - { type: 3, pts: 6756629739, ccData: 49698 }, - { type: 2, pts: 6756629739, ccData: 24429 }, - { type: 3, pts: 6756632742, ccData: 546 }, - { type: 2, pts: 6756632742, ccData: 31071 }, - { type: 3, pts: 6756635745, ccData: 16930 }, - { type: 2, pts: 6756635745, ccData: 26721 }, - { type: 3, pts: 6756638748, ccData: 33314 }, - { type: 2, pts: 6756638748, ccData: 26994 }, - { type: 3, pts: 6756641751, ccData: 49698 }, - { type: 2, pts: 6756641751, ccData: 8448 }, - { type: 3, pts: 6756644754, ccData: 546 }, - { type: 2, pts: 6756644754, ccData: 35841 }, - { type: 3, pts: 6756650760, ccData: 16930 }, - { type: 2, pts: 6756650760, ccData: 35074 }, - { type: 3, pts: 6756842952, ccData: 35377 }, - { type: 2, pts: 6756842952, ccData: 38939 }, - { type: 2, pts: 6756842952, ccData: 0 }, - { type: 2, pts: 6756842952, ccData: 31 }, - { type: 2, pts: 6756842952, ccData: 5264 }, - { type: 2, pts: 6756842952, ccData: 1283 }, - { type: 2, pts: 6756842952, ccData: 37162 }, - { type: 2, pts: 6756842952, ccData: 42 }, - { type: 2, pts: 6756842952, ccData: 37376 }, - { type: 2, pts: 6756842952, ccData: 2048 }, - { type: 3, pts: 6756845955, ccData: 49955 }, - { type: 2, pts: 6756845955, ccData: 37376 }, - { type: 2, pts: 6756845955, ccData: 2560 }, - { type: 3, pts: 6756851961, ccData: 546 }, - { type: 2, pts: 6756851961, ccData: 20335 }, - { type: 3, pts: 6756854964, ccData: 16930 }, - { type: 2, pts: 6756854964, ccData: 28787 }, - { type: 3, pts: 6756857967, ccData: 33314 }, - { type: 2, pts: 6756857967, ccData: 11359 }, - { type: 3, pts: 6756860970, ccData: 49698 }, - { type: 2, pts: 6756860970, ccData: 29551 }, - { type: 3, pts: 6756863973, ccData: 546 }, - { type: 2, pts: 6756863973, ccData: 29298 }, - { type: 3, pts: 6756866976, ccData: 16930 }, - { type: 2, pts: 6756866976, ccData: 31022 }, - { type: 3, pts: 6756869979, ccData: 35377 }, - { type: 2, pts: 6756869979, ccData: 38939 }, - { type: 2, pts: 6756869979, ccData: 0 }, - { type: 2, pts: 6756869979, ccData: 543 }, - { type: 2, pts: 6756869979, ccData: 4240 }, - { type: 2, pts: 6756869979, ccData: 1283 }, - { type: 2, pts: 6756869979, ccData: 37162 }, - { type: 2, pts: 6756869979, ccData: 0 }, - { type: 2, pts: 6756869979, ccData: 37378 }, - { type: 2, pts: 6756869979, ccData: 2048 }, - { type: 3, pts: 6756875985, ccData: 49698 }, - { type: 2, pts: 6756875985, ccData: 10337 }, - { type: 3, pts: 6756878988, ccData: 546 }, - { type: 2, pts: 6756878988, ccData: 27756 }, - { type: 3, pts: 6756881991, ccData: 16930 }, - { type: 2, pts: 6756881991, ccData: 24419 }, - { type: 3, pts: 6756884994, ccData: 33314 }, - { type: 2, pts: 6756884994, ccData: 26741 }, - { type: 3, pts: 6756887997, ccData: 49698 }, - { type: 2, pts: 6756887997, ccData: 25451 }, - { type: 3, pts: 6756891000, ccData: 546 }, - { type: 2, pts: 6756891000, ccData: 27753 }, - { type: 3, pts: 6756894003, ccData: 16930 }, - { type: 2, pts: 6756894003, ccData: 28263 }, - { type: 3, pts: 6756897006, ccData: 33314 }, - { type: 2, pts: 6756897006, ccData: 10496 }, - { type: 3, pts: 6756900009, ccData: 49698 }, - { type: 2, pts: 6756900009, ccData: 35842 }, - { type: 3, pts: 6756906015, ccData: 546 }, - { type: 2, pts: 6756906015, ccData: 35073 }, - { type: 3, pts: 6757113222, ccData: 16930 }, - { type: 2, pts: 6757113222, ccData: 35841 }, - { type: 3, pts: 6757158267, ccData: 35377 }, - { type: 2, pts: 6757158267, ccData: 38939 }, - { type: 2, pts: 6757158267, ccData: 0 }, - { type: 2, pts: 6757158267, ccData: 31 }, - { type: 2, pts: 6757158267, ccData: 5264 }, - { type: 2, pts: 6757158267, ccData: 1283 }, - { type: 2, pts: 6757158267, ccData: 37162 }, - { type: 2, pts: 6757158267, ccData: 0 }, - { type: 2, pts: 6757158267, ccData: 37376 }, - { type: 2, pts: 6757158267, ccData: 1024 }, - { type: 3, pts: 6757161270, ccData: 49698 }, - { type: 2, pts: 6757161270, ccData: 19821 }, - { type: 3, pts: 6757164273, ccData: 546 }, - { type: 2, pts: 6757164273, ccData: 27950 }, - { type: 3, pts: 6757167276, ccData: 16930 }, - { type: 2, pts: 6757167276, ccData: 11822 }, - { type: 3, pts: 6757170279, ccData: 33314 }, - { type: 2, pts: 6757170279, ccData: 24428 }, - { type: 3, pts: 6757173282, ccData: 49698 }, - { type: 2, pts: 6757173282, ccData: 28527 }, - { type: 3, pts: 6757176285, ccData: 546 }, - { type: 2, pts: 6757176285, ccData: 27507 }, - { type: 3, pts: 6757179288, ccData: 16930 }, - { type: 2, pts: 6757179288, ccData: 24420 }, - { type: 3, pts: 6757182291, ccData: 33314 }, - { type: 2, pts: 6757182291, ccData: 25964 }, - { type: 3, pts: 6757185294, ccData: 49698 }, - { type: 2, pts: 6757185294, ccData: 26979 }, - { type: 3, pts: 6757188297, ccData: 546 }, - { type: 2, pts: 6757188297, ccData: 26991 }, - { type: 3, pts: 6757191300, ccData: 16930 }, - { type: 2, pts: 6757191300, ccData: 30067 }, - { type: 3, pts: 6757194303, ccData: 33314 }, - { type: 2, pts: 6757194303, ccData: 11264 }, - { type: 3, pts: 6757197306, ccData: 51761 }, - { type: 2, pts: 6757197306, ccData: 38939 }, - { type: 2, pts: 6757197306, ccData: 0 }, - { type: 2, pts: 6757197306, ccData: 287 }, - { type: 2, pts: 6757197306, ccData: 4240 }, - { type: 2, pts: 6757197306, ccData: 1283 }, - { type: 2, pts: 6757197306, ccData: 37162 }, - { type: 2, pts: 6757197306, ccData: 0 }, - { type: 2, pts: 6757197306, ccData: 37377 }, - { type: 2, pts: 6757197306, ccData: 3072 }, - { type: 3, pts: 6757200309, ccData: 803 }, - { type: 2, pts: 6757200309, ccData: 37377 }, - { type: 2, pts: 6757200309, ccData: 3328 }, - { type: 3, pts: 6757206315, ccData: 16930 }, - { type: 2, pts: 6757206315, ccData: 17505 }, - { type: 3, pts: 6757209318, ccData: 33314 }, - { type: 2, pts: 6757209318, ccData: 25700 }, - { type: 3, pts: 6757212321, ccData: 49698 }, - { type: 2, pts: 6757212321, ccData: 31022 }, - { type: 3, pts: 6757221330, ccData: 546 }, - { type: 2, pts: 6757221330, ccData: 35073 }, - { type: 3, pts: 6757506615, ccData: 16930 }, - { type: 2, pts: 6757506615, ccData: 35841 }, - { type: 3, pts: 6757608717, ccData: 35377 }, - { type: 2, pts: 6757608717, ccData: 38939 }, - { type: 2, pts: 6757608717, ccData: 16640 }, - { type: 2, pts: 6757608717, ccData: 31 }, - { type: 2, pts: 6757608717, ccData: 5264 }, - { type: 2, pts: 6757608717, ccData: 1283 }, - { type: 2, pts: 6757608717, ccData: 37162 }, - { type: 2, pts: 6757608717, ccData: 0 }, - { type: 2, pts: 6757608717, ccData: 37376 }, - { type: 2, pts: 6757608717, ccData: 0 }, - { type: 3, pts: 6757614723, ccData: 49955 }, - { type: 2, pts: 6757614723, ccData: 37376 }, - { type: 2, pts: 6757614723, ccData: 768 }, - { type: 3, pts: 6757620729, ccData: 546 }, - { type: 2, pts: 6757620729, ccData: 18783 }, - { type: 3, pts: 6757623732, ccData: 16930 }, - { type: 2, pts: 6757623732, ccData: 25441 }, - { type: 3, pts: 6757626735, ccData: 33314 }, - { type: 2, pts: 6757626735, ccData: 28199 }, - { type: 3, pts: 6757629738, ccData: 49698 }, - { type: 2, pts: 6757629738, ccData: 29791 }, - { type: 3, pts: 6757632741, ccData: 546 }, - { type: 2, pts: 6757632741, ccData: 30561 }, - { type: 3, pts: 6757635744, ccData: 16930 }, - { type: 2, pts: 6757635744, ccData: 26996 }, - { type: 3, pts: 6757638747, ccData: 33314 }, - { type: 2, pts: 6757638747, ccData: 24422 }, - { type: 3, pts: 6757641750, ccData: 49698 }, - { type: 2, pts: 6757641750, ccData: 28530 }, - { type: 3, pts: 6757644753, ccData: 546 }, - { type: 2, pts: 6757644753, ccData: 24441 }, - { type: 3, pts: 6757647756, ccData: 16930 }, - { type: 2, pts: 6757647756, ccData: 28533 }, - { type: 3, pts: 6757650759, ccData: 33314 }, - { type: 2, pts: 6757650759, ccData: 24436 }, - { type: 3, pts: 6757653762, ccData: 49698 }, - { type: 2, pts: 6757653762, ccData: 28511 }, - { type: 3, pts: 6757656765, ccData: 546 }, - { type: 2, pts: 6757656765, ccData: 26479 }, - { type: 3, pts: 6757659768, ccData: 18993 }, - { type: 2, pts: 6757659768, ccData: 38939 }, - { type: 2, pts: 6757659768, ccData: 16640 }, - { type: 2, pts: 6757659768, ccData: 287 }, - { type: 2, pts: 6757659768, ccData: 4240 }, - { type: 2, pts: 6757659768, ccData: 1283 }, - { type: 2, pts: 6757659768, ccData: 37162 }, - { type: 2, pts: 6757659768, ccData: 0 }, - { type: 2, pts: 6757659768, ccData: 37377 }, - { type: 2, pts: 6757659768, ccData: 1024 }, - { type: 3, pts: 6757665774, ccData: 33571 }, - { type: 2, pts: 6757665774, ccData: 37377 }, - { type: 2, pts: 6757665774, ccData: 1536 }, - { type: 3, pts: 6757671780, ccData: 49698 }, - { type: 2, pts: 6757671780, ccData: 29807 }, - { type: 3, pts: 6757674783, ccData: 546 }, - { type: 2, pts: 6757674783, ccData: 24436 }, - { type: 3, pts: 6757677786, ccData: 16930 }, - { type: 2, pts: 6757677786, ccData: 26725 }, - { type: 3, pts: 6757680789, ccData: 33314 }, - { type: 2, pts: 6757680789, ccData: 24388 }, - { type: 3, pts: 6757683792, ccData: 49698 }, - { type: 2, pts: 6757683792, ccData: 29285 }, - { type: 3, pts: 6757686795, ccData: 546 }, - { type: 2, pts: 6757686795, ccData: 24941 }, - { type: 3, pts: 6757689798, ccData: 16930 }, - { type: 2, pts: 6757689798, ccData: 24403 }, - { type: 3, pts: 6757692801, ccData: 33314 }, - { type: 2, pts: 6757692801, ccData: 24940 }, - { type: 3, pts: 6757695804, ccData: 49698 }, - { type: 2, pts: 6757695804, ccData: 28526 }, - { type: 3, pts: 6757698807, ccData: 546 }, - { type: 2, pts: 6757698807, ccData: 11776 }, - { type: 3, pts: 6757707816, ccData: 16930 }, - { type: 2, pts: 6757707816, ccData: 35073 }, - { type: 3, pts: 6757954062, ccData: 33314 }, - { type: 2, pts: 6757954062, ccData: 35841 }, - { type: 3, pts: 6758044152, ccData: 51761 }, - { type: 2, pts: 6758044152, ccData: 38939 }, - { type: 2, pts: 6758044152, ccData: 17920 }, - { type: 2, pts: 6758044152, ccData: 31 }, - { type: 2, pts: 6758044152, ccData: 5264 }, - { type: 2, pts: 6758044152, ccData: 1283 }, - { type: 2, pts: 6758044152, ccData: 37162 }, - { type: 2, pts: 6758044152, ccData: 0 }, - { type: 2, pts: 6758044152, ccData: 37376 }, - { type: 2, pts: 6758044152, ccData: 1024 }, - { type: 3, pts: 6758050158, ccData: 803 }, - { type: 2, pts: 6758050158, ccData: 37376 }, - { type: 2, pts: 6758050158, ccData: 1792 }, - { type: 3, pts: 6758056164, ccData: 16930 }, - { type: 2, pts: 6758056164, ccData: 21869 }, - { type: 3, pts: 6758059167, ccData: 33314 }, - { type: 2, pts: 6758059167, ccData: 11359 }, - { type: 3, pts: 6758062170, ccData: 49698 }, - { type: 2, pts: 6758062170, ccData: 20585 }, - { type: 3, pts: 6758065173, ccData: 546 }, - { type: 2, pts: 6758065173, ccData: 28267 }, - { type: 3, pts: 6758068176, ccData: 16930 }, - { type: 2, pts: 6758068176, ccData: 24940 }, - { type: 3, pts: 6758071179, ccData: 33314 }, - { type: 2, pts: 6758071179, ccData: 26979 }, - { type: 3, pts: 6758074182, ccData: 49698 }, - { type: 2, pts: 6758074182, ccData: 26991 }, - { type: 3, pts: 6758077185, ccData: 546 }, - { type: 2, pts: 6758077185, ccData: 30067 }, - { type: 3, pts: 6758080188, ccData: 16930 }, - { type: 2, pts: 6758080188, ccData: 16128 }, - { type: 3, pts: 6758089197, ccData: 33314 }, - { type: 2, pts: 6758089197, ccData: 35073 }, - { type: 3, pts: 6758188296, ccData: 51761 }, - { type: 2, pts: 6758188296, ccData: 39195 }, - { type: 2, pts: 6758188296, ccData: 16640 }, - { type: 2, pts: 6758188296, ccData: 31 }, - { type: 2, pts: 6758188296, ccData: 5264 }, - { type: 2, pts: 6758188296, ccData: 1283 }, - { type: 2, pts: 6758188296, ccData: 37162 }, - { type: 2, pts: 6758188296, ccData: 42 }, - { type: 2, pts: 6758188296, ccData: 37376 }, - { type: 2, pts: 6758188296, ccData: 1024 }, - { type: 3, pts: 6758194302, ccData: 803 }, - { type: 2, pts: 6758194302, ccData: 37376 }, - { type: 2, pts: 6758194302, ccData: 1280 }, - { type: 3, pts: 6758200308, ccData: 16930 }, - { type: 2, pts: 6758200308, ccData: 22895 }, - { type: 3, pts: 6758203311, ccData: 33314 }, - { type: 2, pts: 6758203311, ccData: 30047 }, - { type: 3, pts: 6758206314, ccData: 49698 }, - { type: 2, pts: 6758206314, ccData: 30575 }, - { type: 3, pts: 6758209317, ccData: 546 }, - { type: 2, pts: 6758209317, ccData: 28199 }, - { type: 3, pts: 6758212320, ccData: 16930 }, - { type: 2, pts: 6758212320, ccData: 29791 }, - { type: 3, pts: 6758215323, ccData: 33314 }, - { type: 2, pts: 6758215323, ccData: 25189 }, - { type: 3, pts: 6758218326, ccData: 49698 }, - { type: 2, pts: 6758218326, ccData: 27753 }, - { type: 3, pts: 6758221329, ccData: 546 }, - { type: 2, pts: 6758221329, ccData: 25974 }, - { type: 3, pts: 6758224332, ccData: 16930 }, - { type: 2, pts: 6758224332, ccData: 25951 }, - { type: 3, pts: 6758227335, ccData: 33314 }, - { type: 2, pts: 6758227335, ccData: 24940 }, - { type: 3, pts: 6758230338, ccData: 49698 }, - { type: 2, pts: 6758230338, ccData: 27648 }, - { type: 3, pts: 6758233341, ccData: 2609 }, - { type: 2, pts: 6758233341, ccData: 39195 }, - { type: 2, pts: 6758233341, ccData: 16640 }, - { type: 2, pts: 6758233341, ccData: 287 }, - { type: 2, pts: 6758233341, ccData: 4240 }, - { type: 2, pts: 6758233341, ccData: 1283 }, - { type: 2, pts: 6758233341, ccData: 37162 }, - { type: 2, pts: 6758233341, ccData: 0 }, - { type: 2, pts: 6758233341, ccData: 37377 }, - { type: 2, pts: 6758233341, ccData: 0 }, - { type: 3, pts: 6758239347, ccData: 17187 }, - { type: 2, pts: 6758239347, ccData: 37377 }, - { type: 2, pts: 6758239347, ccData: 256 }, - { type: 3, pts: 6758245353, ccData: 33314 }, - { type: 2, pts: 6758245353, ccData: 29800 }, - { type: 3, pts: 6758248356, ccData: 49698 }, - { type: 2, pts: 6758248356, ccData: 25951 }, - { type: 3, pts: 6758251359, ccData: 546 }, - { type: 2, pts: 6758251359, ccData: 26721 }, - { type: 3, pts: 6758254362, ccData: 16930 }, - { type: 2, pts: 6758254362, ccData: 26994 }, - { type: 3, pts: 6758257365, ccData: 33314 }, - { type: 2, pts: 6758257365, ccData: 29556 }, - { type: 3, pts: 6758260368, ccData: 49698 }, - { type: 2, pts: 6758260368, ccData: 31084 }, - { type: 3, pts: 6758263371, ccData: 546 }, - { type: 2, pts: 6758263371, ccData: 25971 }, - { type: 3, pts: 6758266374, ccData: 16930 }, - { type: 2, pts: 6758266374, ccData: 24436 }, - { type: 3, pts: 6758269377, ccData: 33314 }, - { type: 2, pts: 6758269377, ccData: 26725 }, - { type: 3, pts: 6758272380, ccData: 49698 }, - { type: 2, pts: 6758272380, ccData: 31071 }, - { type: 3, pts: 6758275383, ccData: 546 }, - { type: 2, pts: 6758275383, ccData: 25441 }, - { type: 3, pts: 6758278386, ccData: 16930 }, - { type: 2, pts: 6758278386, ccData: 28255 }, - { type: 3, pts: 6758281389, ccData: 33314 }, - { type: 2, pts: 6758281389, ccData: 28001 }, - { type: 3, pts: 6758284392, ccData: 49698 }, - { type: 2, pts: 6758284392, ccData: 27493 }, - { type: 3, pts: 6758287395, ccData: 546 }, - { type: 2, pts: 6758287395, ccData: 11776 }, - { type: 3, pts: 6758290398, ccData: 16930 }, - { type: 2, pts: 6758290398, ccData: 35841 }, - { type: 3, pts: 6758296404, ccData: 33314 }, - { type: 2, pts: 6758296404, ccData: 35074 }, - { type: 3, pts: 6758581689, ccData: 51761 }, - { type: 2, pts: 6758581689, ccData: 38939 }, - { type: 2, pts: 6758581689, ccData: 17920 }, - { type: 2, pts: 6758581689, ccData: 31 }, - { type: 2, pts: 6758581689, ccData: 5264 }, - { type: 2, pts: 6758581689, ccData: 1283 }, - { type: 2, pts: 6758581689, ccData: 37162 }, - { type: 2, pts: 6758581689, ccData: 42 }, - { type: 2, pts: 6758581689, ccData: 37376 }, - { type: 2, pts: 6758581689, ccData: 1024 }, - { type: 3, pts: 6758587695, ccData: 803 }, - { type: 2, pts: 6758587695, ccData: 37376 }, - { type: 2, pts: 6758587695, ccData: 1536 }, - { type: 3, pts: 6758593701, ccData: 16930 }, - { type: 2, pts: 6758593701, ccData: 21864 }, - { type: 3, pts: 6758596704, ccData: 33314 }, - { type: 2, pts: 6758596704, ccData: 11359 }, - { type: 3, pts: 6758599707, ccData: 49698 }, - { type: 2, pts: 6758599707, ccData: 20585 }, - { type: 3, pts: 6758602710, ccData: 546 }, - { type: 2, pts: 6758602710, ccData: 28267 }, - { type: 3, pts: 6758605713, ccData: 16930 }, - { type: 2, pts: 6758605713, ccData: 24940 }, - { type: 3, pts: 6758608716, ccData: 33314 }, - { type: 2, pts: 6758608716, ccData: 26979 }, - { type: 3, pts: 6758611719, ccData: 49698 }, - { type: 2, pts: 6758611719, ccData: 26991 }, - { type: 3, pts: 6758614722, ccData: 546 }, - { type: 2, pts: 6758614722, ccData: 30067 }, - { type: 3, pts: 6758617725, ccData: 16930 }, - { type: 2, pts: 6758617725, ccData: 11822 }, - { type: 3, pts: 6758620728, ccData: 33314 }, - { type: 2, pts: 6758620728, ccData: 11776 }, - { type: 3, pts: 6758623731, ccData: 49698 }, - { type: 2, pts: 6758623731, ccData: 35842 }, - { type: 3, pts: 6758629737, ccData: 546 }, - { type: 2, pts: 6758629737, ccData: 35073 }, - { type: 3, pts: 6758764872, ccData: 18993 }, - { type: 2, pts: 6758764872, ccData: 39195 }, - { type: 2, pts: 6758764872, ccData: 17920 }, - { type: 2, pts: 6758764872, ccData: 31 }, - { type: 2, pts: 6758764872, ccData: 5264 }, - { type: 2, pts: 6758764872, ccData: 1283 }, - { type: 2, pts: 6758764872, ccData: 37162 }, - { type: 2, pts: 6758764872, ccData: 42 }, - { type: 2, pts: 6758764872, ccData: 37376 }, - { type: 2, pts: 6758764872, ccData: 1024 }, - { type: 3, pts: 6758770878, ccData: 33314 }, - { type: 2, pts: 6758770878, ccData: 21089 }, - { type: 3, pts: 6758773881, ccData: 49698 }, - { type: 2, pts: 6758773881, ccData: 26209 }, - { type: 3, pts: 6758776884, ccData: 546 }, - { type: 2, pts: 6758776884, ccData: 25964 }, - { type: 3, pts: 6758779887, ccData: 16930 }, - { type: 2, pts: 6758779887, ccData: 24424 }, - { type: 3, pts: 6758782890, ccData: 33314 }, - { type: 2, pts: 6758782890, ccData: 24947 }, - { type: 3, pts: 6758785893, ccData: 49698 }, - { type: 2, pts: 6758785893, ccData: 24434 }, - { type: 3, pts: 6758788896, ccData: 546 }, - { type: 2, pts: 6758788896, ccData: 24937 }, - { type: 3, pts: 6758791899, ccData: 16930 }, - { type: 2, pts: 6758791899, ccData: 28258 }, - { type: 3, pts: 6758794902, ccData: 33314 }, - { type: 2, pts: 6758794902, ccData: 28535 }, - { type: 3, pts: 6758797905, ccData: 49698 }, - { type: 2, pts: 6758797905, ccData: 24424 }, - { type: 3, pts: 6758800908, ccData: 546 }, - { type: 2, pts: 6758800908, ccData: 24937 }, - { type: 3, pts: 6758803911, ccData: 16930 }, - { type: 2, pts: 6758803911, ccData: 29230 }, - { type: 3, pts: 6758806914, ccData: 33314 }, - { type: 2, pts: 6758806914, ccData: 35841 }, - { type: 3, pts: 6758812920, ccData: 49698 }, - { type: 2, pts: 6758812920, ccData: 35074 }, - { type: 3, pts: 6759017124, ccData: 546 }, - { type: 2, pts: 6759017124, ccData: 35842 }, - { type: 3, pts: 6759176283, ccData: 18993 }, - { type: 2, pts: 6759176283, ccData: 38939 }, - { type: 2, pts: 6759176283, ccData: 16640 }, - { type: 2, pts: 6759176283, ccData: 31 }, - { type: 2, pts: 6759176283, ccData: 5264 }, - { type: 2, pts: 6759176283, ccData: 1283 }, - { type: 2, pts: 6759176283, ccData: 37162 }, - { type: 2, pts: 6759176283, ccData: 42 }, - { type: 2, pts: 6759176283, ccData: 37376 }, - { type: 2, pts: 6759176283, ccData: 5120 }, - { type: 3, pts: 6759182289, ccData: 33314 }, - { type: 2, pts: 6759182289, ccData: 16716 }, - { type: 3, pts: 6759185292, ccData: 49698 }, - { type: 2, pts: 6759185292, ccData: 19514 }, - { type: 3, pts: 6759188295, ccData: 2609 }, - { type: 2, pts: 6759188295, ccData: 38939 }, - { type: 2, pts: 6759188295, ccData: 16640 }, - { type: 2, pts: 6759188295, ccData: 287 }, - { type: 2, pts: 6759188295, ccData: 4240 }, - { type: 2, pts: 6759188295, ccData: 1283 }, - { type: 2, pts: 6759188295, ccData: 37162 }, - { type: 2, pts: 6759188295, ccData: 0 }, - { type: 2, pts: 6759188295, ccData: 37377 }, - { type: 2, pts: 6759188295, ccData: 2048 }, - { type: 3, pts: 6759194301, ccData: 17187 }, - { type: 2, pts: 6759194301, ccData: 37377 }, - { type: 2, pts: 6759194301, ccData: 2816 }, - { type: 3, pts: 6759200307, ccData: 33314 }, - { type: 2, pts: 6759200307, ccData: 20585 }, - { type: 3, pts: 6759203310, ccData: 49698 }, - { type: 2, pts: 6759203310, ccData: 28267 }, - { type: 3, pts: 6759206313, ccData: 546 }, - { type: 2, pts: 6759206313, ccData: 24940 }, - { type: 3, pts: 6759209316, ccData: 16930 }, - { type: 2, pts: 6759209316, ccData: 26979 }, - { type: 3, pts: 6759212319, ccData: 33314 }, - { type: 2, pts: 6759212319, ccData: 26991 }, - { type: 3, pts: 6759215322, ccData: 49698 }, - { type: 2, pts: 6759215322, ccData: 30067 }, - { type: 3, pts: 6759218325, ccData: 546 }, - { type: 2, pts: 6759218325, ccData: 8448 }, - { type: 3, pts: 6759227334, ccData: 16930 }, - { type: 2, pts: 6759227334, ccData: 35073 }, - { type: 3, pts: 6759407514, ccData: 35377 }, - { type: 2, pts: 6759407514, ccData: 39195 }, - { type: 2, pts: 6759407514, ccData: 17920 }, - { type: 2, pts: 6759407514, ccData: 31 }, - { type: 2, pts: 6759407514, ccData: 5264 }, - { type: 2, pts: 6759407514, ccData: 1283 }, - { type: 2, pts: 6759407514, ccData: 37162 }, - { type: 2, pts: 6759407514, ccData: 42 }, - { type: 2, pts: 6759407514, ccData: 37376 }, - { type: 2, pts: 6759407514, ccData: 0 }, - { type: 3, pts: 6759413520, ccData: 49698 }, - { type: 2, pts: 6759413520, ccData: 20328 }, - { type: 3, pts: 6759416523, ccData: 546 }, - { type: 2, pts: 6759416523, ccData: 11359 }, - { type: 3, pts: 6759419526, ccData: 16930 }, - { type: 2, pts: 6759419526, ccData: 28271 }, - { type: 3, pts: 6759422529, ccData: 33314 }, - { type: 2, pts: 6759422529, ccData: 8448 }, - { type: 3, pts: 6759425532, ccData: 49698 }, - { type: 2, pts: 6759425532, ccData: 35841 }, - { type: 3, pts: 6759431538, ccData: 546 }, - { type: 2, pts: 6759431538, ccData: 35074 }, - { type: 3, pts: 6759530637, ccData: 18993 }, - { type: 2, pts: 6759530637, ccData: 38939 }, - { type: 2, pts: 6759530637, ccData: 17920 }, - { type: 2, pts: 6759530637, ccData: 31 }, - { type: 2, pts: 6759530637, ccData: 5264 }, - { type: 2, pts: 6759530637, ccData: 1283 }, - { type: 2, pts: 6759530637, ccData: 37162 }, - { type: 2, pts: 6759530637, ccData: 42 }, - { type: 2, pts: 6759530637, ccData: 37376 }, - { type: 2, pts: 6759530637, ccData: 1024 }, - { type: 3, pts: 6759536643, ccData: 33571 }, - { type: 2, pts: 6759536643, ccData: 37376 }, - { type: 2, pts: 6759536643, ccData: 1280 }, - { type: 3, pts: 6759542649, ccData: 49698 }, - { type: 2, pts: 6759542649, ccData: 10343 }, - { type: 3, pts: 6759545652, ccData: 546 }, - { type: 2, pts: 6759545652, ccData: 29295 }, - { type: 3, pts: 6759548655, ccData: 16930 }, - { type: 2, pts: 6759548655, ccData: 24942 }, - { type: 3, pts: 6759551658, ccData: 33314 }, - { type: 2, pts: 6759551658, ccData: 29481 }, - { type: 3, pts: 6759554661, ccData: 49698 }, - { type: 2, pts: 6759554661, ccData: 35842 }, - { type: 3, pts: 6759560667, ccData: 546 }, - { type: 2, pts: 6759560667, ccData: 35073 }, - { type: 3, pts: 6759587694, ccData: 18993 }, - { type: 2, pts: 6759587694, ccData: 39195 }, - { type: 2, pts: 6759587694, ccData: 16640 }, - { type: 2, pts: 6759587694, ccData: 31 }, - { type: 2, pts: 6759587694, ccData: 5264 }, - { type: 2, pts: 6759587694, ccData: 1283 }, - { type: 2, pts: 6759587694, ccData: 37162 }, - { type: 2, pts: 6759587694, ccData: 42 }, - { type: 2, pts: 6759587694, ccData: 37376 }, - { type: 2, pts: 6759587694, ccData: 0 }, - { type: 3, pts: 6759593700, ccData: 33571 }, - { type: 2, pts: 6759593700, ccData: 37376 }, - { type: 2, pts: 6759593700, ccData: 512 }, - { type: 3, pts: 6759599706, ccData: 49698 }, - { type: 2, pts: 6759599706, ccData: 21608 }, - { type: 3, pts: 6759602709, ccData: 546 }, - { type: 2, pts: 6759602709, ccData: 26995 }, - { type: 3, pts: 6759605712, ccData: 16930 }, - { type: 2, pts: 6759605712, ccData: 24424 }, - { type: 3, pts: 6759608715, ccData: 33314 }, - { type: 2, pts: 6759608715, ccData: 24937 }, - { type: 3, pts: 6759611718, ccData: 49698 }, - { type: 2, pts: 6759611718, ccData: 29299 }, - { type: 3, pts: 6759614721, ccData: 546 }, - { type: 2, pts: 6759614721, ccData: 29817 }, - { type: 3, pts: 6759617724, ccData: 16930 }, - { type: 2, pts: 6759617724, ccData: 27749 }, - { type: 3, pts: 6759620727, ccData: 33314 }, - { type: 2, pts: 6759620727, ccData: 24425 }, - { type: 3, pts: 6759623730, ccData: 49698 }, - { type: 2, pts: 6759623730, ccData: 29550 }, - { type: 3, pts: 6759626733, ccData: 546 }, - { type: 2, pts: 6759626733, ccData: 10100 }, - { type: 3, pts: 6759629736, ccData: 16930 }, - { type: 2, pts: 6759629736, ccData: 24421 }, - { type: 3, pts: 6759632739, ccData: 33314 }, - { type: 2, pts: 6759632739, ccData: 30817 }, - { type: 3, pts: 6759635742, ccData: 49698 }, - { type: 2, pts: 6759635742, ccData: 25460 }, - { type: 3, pts: 6759638745, ccData: 546 }, - { type: 2, pts: 6759638745, ccData: 27769 }, - { type: 3, pts: 6759641748, ccData: 18993 }, - { type: 2, pts: 6759641748, ccData: 39195 }, - { type: 2, pts: 6759641748, ccData: 16640 }, - { type: 2, pts: 6759641748, ccData: 287 }, - { type: 2, pts: 6759641748, ccData: 4240 }, - { type: 2, pts: 6759641748, ccData: 1283 }, - { type: 2, pts: 6759641748, ccData: 37162 }, - { type: 2, pts: 6759641748, ccData: 0 }, - { type: 2, pts: 6759641748, ccData: 37377 }, - { type: 2, pts: 6759641748, ccData: 0 }, - { type: 3, pts: 6759647754, ccData: 33314 }, - { type: 2, pts: 6759647754, ccData: 30568 }, - { type: 3, pts: 6759650757, ccData: 49698 }, - { type: 2, pts: 6759650757, ccData: 24948 }, - { type: 3, pts: 6759653760, ccData: 546 }, - { type: 2, pts: 6759653760, ccData: 24393 }, - { type: 3, pts: 6759656763, ccData: 16930 }, - { type: 2, pts: 6759656763, ccData: 24439 }, - { type: 3, pts: 6759659766, ccData: 33314 }, - { type: 2, pts: 6759659766, ccData: 24947 }, - { type: 3, pts: 6759662769, ccData: 49698 }, - { type: 2, pts: 6759662769, ccData: 24420 }, - { type: 3, pts: 6759665772, ccData: 546 }, - { type: 2, pts: 6759665772, ccData: 29285 }, - { type: 3, pts: 6759668775, ccData: 16930 }, - { type: 2, pts: 6759668775, ccData: 24941 }, - { type: 3, pts: 6759671778, ccData: 33314 }, - { type: 2, pts: 6759671778, ccData: 26990 }, - { type: 3, pts: 6759674781, ccData: 49698 }, - { type: 2, pts: 6759674781, ccData: 26463 }, - { type: 3, pts: 6759677784, ccData: 546 }, - { type: 2, pts: 6759677784, ccData: 28518 }, - { type: 3, pts: 6759680787, ccData: 16930 }, - { type: 2, pts: 6759680787, ccData: 11776 }, - { type: 3, pts: 6759683790, ccData: 33314 }, - { type: 2, pts: 6759683790, ccData: 35841 }, - { type: 3, pts: 6759689796, ccData: 49698 }, - { type: 2, pts: 6759689796, ccData: 35074 }, - { type: 3, pts: 6759957063, ccData: 2609 }, - { type: 2, pts: 6759957063, ccData: 38939 }, - { type: 2, pts: 6759957063, ccData: 16640 }, - { type: 2, pts: 6759957063, ccData: 31 }, - { type: 2, pts: 6759957063, ccData: 5264 }, - { type: 2, pts: 6759957063, ccData: 1283 }, - { type: 2, pts: 6759957063, ccData: 37162 }, - { type: 2, pts: 6759957063, ccData: 42 }, - { type: 2, pts: 6759957063, ccData: 37376 }, - { type: 2, pts: 6759957063, ccData: 1024 }, - { type: 3, pts: 6759963069, ccData: 16930 }, - { type: 2, pts: 6759963069, ccData: 18804 }, - { type: 3, pts: 6759966072, ccData: 33314 }, - { type: 2, pts: 6759966072, ccData: 10099 }, - { type: 3, pts: 6759969075, ccData: 49698 }, - { type: 2, pts: 6759969075, ccData: 24434 }, - { type: 3, pts: 6759972078, ccData: 546 }, - { type: 2, pts: 6759972078, ccData: 25953 }, - { type: 3, pts: 6759975081, ccData: 16930 }, - { type: 2, pts: 6759975081, ccData: 27756 }, - { type: 3, pts: 6759978084, ccData: 33314 }, - { type: 2, pts: 6759978084, ccData: 31071 }, - { type: 3, pts: 6759981087, ccData: 49698 }, - { type: 2, pts: 6759981087, ccData: 26469 }, - { type: 3, pts: 6759984090, ccData: 546 }, - { type: 2, pts: 6759984090, ccData: 29812 }, - { type: 3, pts: 6759987093, ccData: 16930 }, - { type: 2, pts: 6759987093, ccData: 26990 }, - { type: 3, pts: 6759990096, ccData: 33314 }, - { type: 2, pts: 6759990096, ccData: 26368 }, - { type: 3, pts: 6759993099, ccData: 51761 }, - { type: 2, pts: 6759993099, ccData: 38939 }, - { type: 2, pts: 6759993099, ccData: 16640 }, - { type: 2, pts: 6759993099, ccData: 287 }, - { type: 2, pts: 6759993099, ccData: 4240 }, - { type: 2, pts: 6759993099, ccData: 1283 }, - { type: 2, pts: 6759993099, ccData: 37162 }, - { type: 2, pts: 6759993099, ccData: 0 }, - { type: 2, pts: 6759993099, ccData: 37377 }, - { type: 2, pts: 6759993099, ccData: 1024 }, - { type: 3, pts: 6759999105, ccData: 546 }, - { type: 2, pts: 6759999105, ccData: 26990 }, - { type: 3, pts: 6760002108, ccData: 16930 }, - { type: 2, pts: 6760002108, ccData: 24429 }, - { type: 3, pts: 6760005111, ccData: 33314 }, - { type: 2, pts: 6760005111, ccData: 31071 }, - { type: 3, pts: 6760008114, ccData: 49698 }, - { type: 2, pts: 6760008114, ccData: 30561 }, - { type: 3, pts: 6760011117, ccData: 546 }, - { type: 2, pts: 6760011117, ccData: 31022 }, - { type: 3, pts: 6760014120, ccData: 16930 }, - { type: 2, pts: 6760014120, ccData: 35842 }, - { type: 3, pts: 6760020126, ccData: 33314 }, - { type: 2, pts: 6760020126, ccData: 35073 }, - { type: 3, pts: 6760125231, ccData: 51761 }, - { type: 2, pts: 6760125231, ccData: 39195 }, - { type: 2, pts: 6760125231, ccData: 16640 }, - { type: 2, pts: 6760125231, ccData: 31 }, - { type: 2, pts: 6760125231, ccData: 5264 }, - { type: 2, pts: 6760125231, ccData: 1283 }, - { type: 2, pts: 6760125231, ccData: 37162 }, - { type: 2, pts: 6760125231, ccData: 42 }, - { type: 2, pts: 6760125231, ccData: 37376 }, - { type: 2, pts: 6760125231, ccData: 0 }, - { type: 3, pts: 6760131237, ccData: 546 }, - { type: 2, pts: 6760131237, ccData: 19823 }, - { type: 3, pts: 6760134240, ccData: 16930 }, - { type: 2, pts: 6760134240, ccData: 28013 }, - { type: 3, pts: 6760137243, ccData: 33314 }, - { type: 2, pts: 6760137243, ccData: 31020 }, - { type: 3, pts: 6760140246, ccData: 49698 }, - { type: 2, pts: 6760140246, ccData: 24419 }, - { type: 3, pts: 6760143249, ccData: 546 }, - { type: 2, pts: 6760143249, ccData: 24942 }, - { type: 3, pts: 6760146252, ccData: 16930 }, - { type: 2, pts: 6760146252, ccData: 24441 }, - { type: 3, pts: 6760149255, ccData: 33314 }, - { type: 2, pts: 6760149255, ccData: 28533 }, - { type: 3, pts: 6760152258, ccData: 49698 }, - { type: 2, pts: 6760152258, ccData: 24432 }, - { type: 3, pts: 6760155261, ccData: 546 }, - { type: 2, pts: 6760155261, ccData: 27749 }, - { type: 3, pts: 6760158264, ccData: 16930 }, - { type: 2, pts: 6760158264, ccData: 24947 }, - { type: 3, pts: 6760161267, ccData: 33314 }, - { type: 2, pts: 6760161267, ccData: 25951 }, - { type: 3, pts: 6760164270, ccData: 49698 }, - { type: 2, pts: 6760164270, ccData: 29793 }, - { type: 3, pts: 6760167273, ccData: 546 }, - { type: 2, pts: 6760167273, ccData: 27493 }, - { type: 3, pts: 6760170276, ccData: 16930 }, - { type: 2, pts: 6760170276, ccData: 24429 }, - { type: 3, pts: 6760173279, ccData: 33314 }, - { type: 2, pts: 6760173279, ccData: 25856 }, - { type: 3, pts: 6760176282, ccData: 51761 }, - { type: 2, pts: 6760176282, ccData: 39195 }, - { type: 2, pts: 6760176282, ccData: 16640 }, - { type: 2, pts: 6760176282, ccData: 287 }, - { type: 2, pts: 6760176282, ccData: 4240 }, - { type: 2, pts: 6760176282, ccData: 1283 }, - { type: 2, pts: 6760176282, ccData: 37162 }, - { type: 2, pts: 6760176282, ccData: 0 }, - { type: 2, pts: 6760176282, ccData: 37377 }, - { type: 2, pts: 6760176282, ccData: 0 }, - { type: 3, pts: 6760182288, ccData: 546 }, - { type: 2, pts: 6760182288, ccData: 25185 }, - { type: 3, pts: 6760185291, ccData: 16930 }, - { type: 2, pts: 6760185291, ccData: 25451 }, - { type: 3, pts: 6760188294, ccData: 33314 }, - { type: 2, pts: 6760188294, ccData: 24436 }, - { type: 3, pts: 6760191297, ccData: 49698 }, - { type: 2, pts: 6760191297, ccData: 28511 }, - { type: 3, pts: 6760194300, ccData: 546 }, - { type: 2, pts: 6760194300, ccData: 29800 }, - { type: 3, pts: 6760197303, ccData: 16930 }, - { type: 2, pts: 6760197303, ccData: 25951 }, - { type: 3, pts: 6760200306, ccData: 33314 }, - { type: 2, pts: 6760200306, ccData: 17522 }, - { type: 3, pts: 6760203309, ccData: 49698 }, - { type: 2, pts: 6760203309, ccData: 25953 }, - { type: 3, pts: 6760206312, ccData: 546 }, - { type: 2, pts: 6760206312, ccData: 27999 }, - { type: 3, pts: 6760209315, ccData: 16930 }, - { type: 2, pts: 6760209315, ccData: 21345 }, - { type: 3, pts: 6760212318, ccData: 33314 }, - { type: 2, pts: 6760212318, ccData: 27759 }, - { type: 3, pts: 6760215321, ccData: 49698 }, - { type: 2, pts: 6760215321, ccData: 28223 }, - { type: 3, pts: 6760218324, ccData: 546 }, - { type: 2, pts: 6760218324, ccData: 35841 }, - { type: 3, pts: 6760224330, ccData: 16930 }, - { type: 2, pts: 6760224330, ccData: 35074 }, - { type: 3, pts: 6760443549, ccData: 35377 }, - { type: 2, pts: 6760443549, ccData: 38939 }, - { type: 2, pts: 6760443549, ccData: 16640 }, - { type: 2, pts: 6760443549, ccData: 31 }, - { type: 2, pts: 6760443549, ccData: 5264 }, - { type: 2, pts: 6760443549, ccData: 1283 }, - { type: 2, pts: 6760443549, ccData: 37162 }, - { type: 2, pts: 6760443549, ccData: 42 }, - { type: 2, pts: 6760443549, ccData: 37376 }, - { type: 2, pts: 6760443549, ccData: 0 }, - { type: 3, pts: 6760449555, ccData: 49955 }, - { type: 2, pts: 6760449555, ccData: 37376 }, - { type: 2, pts: 6760449555, ccData: 768 }, - { type: 3, pts: 6760455561, ccData: 546 }, - { type: 2, pts: 6760455561, ccData: 20328 }, - { type: 3, pts: 6760458564, ccData: 16930 }, - { type: 2, pts: 6760458564, ccData: 11359 }, - { type: 3, pts: 6760461567, ccData: 33314 }, - { type: 2, pts: 6760461567, ccData: 30565 }, - { type: 3, pts: 6760464570, ccData: 49698 }, - { type: 2, pts: 6760464570, ccData: 24420 }, - { type: 3, pts: 6760467573, ccData: 546 }, - { type: 2, pts: 6760467573, ccData: 28526 }, - { type: 3, pts: 6760470576, ccData: 16930 }, - { type: 2, pts: 6760470576, ccData: 10100 }, - { type: 3, pts: 6760473579, ccData: 33314 }, - { type: 2, pts: 6760473579, ccData: 24424 }, - { type: 3, pts: 6760476582, ccData: 49698 }, - { type: 2, pts: 6760476582, ccData: 24950 }, - { type: 3, pts: 6760479585, ccData: 546 }, - { type: 2, pts: 6760479585, ccData: 25951 }, - { type: 3, pts: 6760482588, ccData: 16930 }, - { type: 2, pts: 6760482588, ccData: 25966 }, - { type: 3, pts: 6760485591, ccData: 33314 }, - { type: 2, pts: 6760485591, ccData: 28533 }, - { type: 3, pts: 6760488594, ccData: 49698 }, - { type: 2, pts: 6760488594, ccData: 26472 }, - { type: 3, pts: 6760491597, ccData: 546 }, - { type: 2, pts: 6760491597, ccData: 24436 }, - { type: 3, pts: 6760494600, ccData: 16930 }, - { type: 2, pts: 6760494600, ccData: 26989 }, - { type: 3, pts: 6760497603, ccData: 33314 }, - { type: 2, pts: 6760497603, ccData: 25856 }, - { type: 3, pts: 6760500606, ccData: 51761 }, - { type: 2, pts: 6760500606, ccData: 38939 }, - { type: 2, pts: 6760500606, ccData: 16640 }, - { type: 2, pts: 6760500606, ccData: 287 }, - { type: 2, pts: 6760500606, ccData: 4240 }, - { type: 2, pts: 6760500606, ccData: 1283 }, - { type: 2, pts: 6760500606, ccData: 37162 }, - { type: 2, pts: 6760500606, ccData: 0 }, - { type: 2, pts: 6760500606, ccData: 37377 }, - { type: 2, pts: 6760500606, ccData: 5120 }, - { type: 3, pts: 6760506612, ccData: 803 }, - { type: 2, pts: 6760506612, ccData: 37377 }, - { type: 2, pts: 6760506612, ccData: 5632 }, - { type: 3, pts: 6760512618, ccData: 16930 }, - { type: 2, pts: 6760512618, ccData: 29289 }, - { type: 3, pts: 6760515621, ccData: 33314 }, - { type: 2, pts: 6760515621, ccData: 26472 }, - { type: 3, pts: 6760518624, ccData: 49698 }, - { type: 2, pts: 6760518624, ccData: 29791 }, - { type: 3, pts: 6760521627, ccData: 546 }, - { type: 2, pts: 6760521627, ccData: 28271 }, - { type: 3, pts: 6760524630, ccData: 16930 }, - { type: 2, pts: 6760524630, ccData: 30510 }, - { type: 3, pts: 6760527633, ccData: 33314 }, - { type: 2, pts: 6760527633, ccData: 35842 }, - { type: 3, pts: 6760533639, ccData: 49698 }, - { type: 2, pts: 6760533639, ccData: 35073 }, - { type: 3, pts: 6760743849, ccData: 2609 }, - { type: 2, pts: 6760743849, ccData: 39195 }, - { type: 2, pts: 6760743849, ccData: 16640 }, - { type: 2, pts: 6760743849, ccData: 31 }, - { type: 2, pts: 6760743849, ccData: 5264 }, - { type: 2, pts: 6760743849, ccData: 1283 }, - { type: 2, pts: 6760743849, ccData: 37162 }, - { type: 2, pts: 6760743849, ccData: 42 }, - { type: 2, pts: 6760743849, ccData: 37376 }, - { type: 2, pts: 6760743849, ccData: 4096 }, - { type: 3, pts: 6760749855, ccData: 17187 }, - { type: 2, pts: 6760749855, ccData: 37376 }, - { type: 2, pts: 6760749855, ccData: 4608 }, - { type: 3, pts: 6760755861, ccData: 33314 }, - { type: 2, pts: 6760755861, ccData: 22373 }, - { type: 3, pts: 6760758864, ccData: 49698 }, - { type: 2, pts: 6760758864, ccData: 24424 }, - { type: 3, pts: 6760761867, ccData: 546 }, - { type: 2, pts: 6760761867, ccData: 24950 }, - { type: 3, pts: 6760764870, ccData: 16930 }, - { type: 2, pts: 6760764870, ccData: 25951 }, - { type: 3, pts: 6760767873, ccData: 33314 }, - { type: 2, pts: 6760767873, ccData: 29807 }, - { type: 3, pts: 6760770876, ccData: 49698 }, - { type: 2, pts: 6760770876, ccData: 24423 }, - { type: 3, pts: 6760773879, ccData: 546 }, - { type: 2, pts: 6760773879, ccData: 25972 }, - { type: 3, pts: 6760776882, ccData: 18993 }, - { type: 2, pts: 6760776882, ccData: 39195 }, - { type: 2, pts: 6760776882, ccData: 16640 }, - { type: 2, pts: 6760776882, ccData: 287 }, - { type: 2, pts: 6760776882, ccData: 4240 }, - { type: 2, pts: 6760776882, ccData: 1283 }, - { type: 2, pts: 6760776882, ccData: 37162 }, - { type: 2, pts: 6760776882, ccData: 0 }, - { type: 2, pts: 6760776882, ccData: 37377 }, - { type: 2, pts: 6760776882, ccData: 3072 }, - { type: 3, pts: 6760782888, ccData: 33314 }, - { type: 2, pts: 6760782888, ccData: 29807 }, - { type: 3, pts: 6760785891, ccData: 49698 }, - { type: 2, pts: 6760785891, ccData: 24441 }, - { type: 3, pts: 6760788894, ccData: 546 }, - { type: 2, pts: 6760788894, ccData: 28533 }, - { type: 3, pts: 6760791897, ccData: 16930 }, - { type: 2, pts: 6760791897, ccData: 29279 }, - { type: 3, pts: 6760794900, ccData: 33314 }, - { type: 2, pts: 6760794900, ccData: 29551 }, - { type: 3, pts: 6760797903, ccData: 49698 }, - { type: 2, pts: 6760797903, ccData: 25443 }, - { type: 3, pts: 6760800906, ccData: 546 }, - { type: 2, pts: 6760800906, ccData: 25970 }, - { type: 3, pts: 6760803909, ccData: 16930 }, - { type: 2, pts: 6760803909, ccData: 24423 }, - { type: 3, pts: 6760806912, ccData: 33314 }, - { type: 2, pts: 6760806912, ccData: 24941 }, - { type: 3, pts: 6760809915, ccData: 49698 }, - { type: 2, pts: 6760809915, ccData: 25902 }, - { type: 3, pts: 6760812918, ccData: 546 }, - { type: 2, pts: 6760812918, ccData: 35841 }, - { type: 3, pts: 6760818924, ccData: 16930 }, - { type: 2, pts: 6760818924, ccData: 35074 }, - { type: 3, pts: 6760936041, ccData: 35377 }, - { type: 2, pts: 6760936041, ccData: 38939 }, - { type: 2, pts: 6760936041, ccData: 17920 }, - { type: 2, pts: 6760936041, ccData: 31 }, - { type: 2, pts: 6760936041, ccData: 5264 }, - { type: 2, pts: 6760936041, ccData: 1283 }, - { type: 2, pts: 6760936041, ccData: 37162 }, - { type: 2, pts: 6760936041, ccData: 42 }, - { type: 2, pts: 6760936041, ccData: 37376 }, - { type: 2, pts: 6760936041, ccData: 2048 }, - { type: 3, pts: 6760942047, ccData: 49698 }, - { type: 2, pts: 6760942047, ccData: 16750 }, - { type: 3, pts: 6760945050, ccData: 546 }, - { type: 2, pts: 6760945050, ccData: 25695 }, - { type: 3, pts: 6760948053, ccData: 16930 }, - { type: 2, pts: 6760948053, ccData: 24934 }, - { type: 3, pts: 6760951056, ccData: 33314 }, - { type: 2, pts: 6760951056, ccData: 29797 }, - { type: 3, pts: 6760954059, ccData: 49698 }, - { type: 2, pts: 6760954059, ccData: 29279 }, - { type: 3, pts: 6760957062, ccData: 546 }, - { type: 2, pts: 6760957062, ccData: 29800 }, - { type: 3, pts: 6760960065, ccData: 16930 }, - { type: 2, pts: 6760960065, ccData: 24948 }, - { type: 3, pts: 6760963068, ccData: 33314 }, - { type: 2, pts: 6760963068, ccData: 11264 }, - { type: 3, pts: 6760966071, ccData: 49698 }, - { type: 2, pts: 6760966071, ccData: 35842 }, - { type: 3, pts: 6760972077, ccData: 546 }, - { type: 2, pts: 6760972077, ccData: 35073 }, - { type: 3, pts: 6761050155, ccData: 18993 }, - { type: 2, pts: 6761050155, ccData: 39195 }, - { type: 2, pts: 6761050155, ccData: 17920 }, - { type: 2, pts: 6761050155, ccData: 31 }, - { type: 2, pts: 6761050155, ccData: 5264 }, - { type: 2, pts: 6761050155, ccData: 1283 }, - { type: 2, pts: 6761050155, ccData: 37162 }, - { type: 2, pts: 6761050155, ccData: 42 }, - { type: 2, pts: 6761050155, ccData: 37376 }, - { type: 2, pts: 6761050155, ccData: 0 }, - { type: 3, pts: 6761056161, ccData: 33571 }, - { type: 2, pts: 6761056161, ccData: 37376 }, - { type: 2, pts: 6761056161, ccData: 512 }, - { type: 3, pts: 6761062167, ccData: 49698 }, - { type: 2, pts: 6761062167, ccData: 30565 }, - { type: 3, pts: 6761065170, ccData: 546 }, - { type: 2, pts: 6761065170, ccData: 10098 }, - { type: 3, pts: 6761068173, ccData: 16930 }, - { type: 2, pts: 6761068173, ccData: 25951 }, - { type: 3, pts: 6761071176, ccData: 33314 }, - { type: 2, pts: 6761071176, ccData: 26479 }, - { type: 3, pts: 6761074179, ccData: 49698 }, - { type: 2, pts: 6761074179, ccData: 26990 }, - { type: 3, pts: 6761077182, ccData: 546 }, - { type: 2, pts: 6761077182, ccData: 26463 }, - { type: 3, pts: 6761080185, ccData: 16930 }, - { type: 2, pts: 6761080185, ccData: 28526 }, - { type: 3, pts: 6761083188, ccData: 33314 }, - { type: 2, pts: 6761083188, ccData: 24417 }, - { type: 3, pts: 6761086191, ccData: 49698 }, - { type: 2, pts: 6761086191, ccData: 24418 }, - { type: 3, pts: 6761089194, ccData: 546 }, - { type: 2, pts: 6761089194, ccData: 26987 }, - { type: 3, pts: 6761092197, ccData: 16930 }, - { type: 2, pts: 6761092197, ccData: 25951 }, - { type: 3, pts: 6761095200, ccData: 33314 }, - { type: 2, pts: 6761095200, ccData: 29289 }, - { type: 3, pts: 6761098203, ccData: 49698 }, - { type: 2, pts: 6761098203, ccData: 25701 }, - { type: 3, pts: 6761101206, ccData: 546 }, - { type: 2, pts: 6761101206, ccData: 8448 }, - { type: 3, pts: 6761104209, ccData: 16930 }, - { type: 2, pts: 6761104209, ccData: 35841 }, - { type: 3, pts: 6761110215, ccData: 33314 }, - { type: 2, pts: 6761110215, ccData: 35074 }, - { type: 3, pts: 6761260365, ccData: 51761 }, - { type: 2, pts: 6761260365, ccData: 38939 }, - { type: 2, pts: 6761260365, ccData: 17920 }, - { type: 2, pts: 6761260365, ccData: 31 }, - { type: 2, pts: 6761260365, ccData: 5264 }, - { type: 2, pts: 6761260365, ccData: 1283 }, - { type: 2, pts: 6761260365, ccData: 37162 }, - { type: 2, pts: 6761260365, ccData: 42 }, - { type: 2, pts: 6761260365, ccData: 37376 }, - { type: 2, pts: 6761260365, ccData: 2048 }, - { type: 3, pts: 6761266371, ccData: 803 }, - { type: 2, pts: 6761266371, ccData: 37376 }, - { type: 2, pts: 6761266371, ccData: 2304 }, - { type: 3, pts: 6761272377, ccData: 16930 }, - { type: 2, pts: 6761272377, ccData: 21097 }, - { type: 3, pts: 6761275380, ccData: 33314 }, - { type: 2, pts: 6761275380, ccData: 26472 }, - { type: 3, pts: 6761278383, ccData: 49698 }, - { type: 2, pts: 6761278383, ccData: 29740 }, - { type: 3, pts: 6761281386, ccData: 546 }, - { type: 2, pts: 6761281386, ccData: 24388 }, - { type: 3, pts: 6761284389, ccData: 16930 }, - { type: 2, pts: 6761284389, ccData: 24932 }, - { type: 3, pts: 6761287392, ccData: 33314 }, - { type: 2, pts: 6761287392, ccData: 25721 }, - { type: 3, pts: 6761290395, ccData: 49698 }, - { type: 2, pts: 6761290395, ccData: 16128 }, - { type: 3, pts: 6761293398, ccData: 546 }, - { type: 2, pts: 6761293398, ccData: 35842 }, - { type: 3, pts: 6761299404, ccData: 16930 }, - { type: 2, pts: 6761299404, ccData: 35073 }, - { type: 3, pts: 6761341446, ccData: 35377 }, - { type: 2, pts: 6761341446, ccData: 39195 }, - { type: 2, pts: 6761341446, ccData: 16640 }, - { type: 2, pts: 6761341446, ccData: 31 }, - { type: 2, pts: 6761341446, ccData: 5264 }, - { type: 2, pts: 6761341446, ccData: 1283 }, - { type: 2, pts: 6761341446, ccData: 37162 }, - { type: 2, pts: 6761341446, ccData: 42 }, - { type: 2, pts: 6761341446, ccData: 37376 }, - { type: 2, pts: 6761341446, ccData: 3072 }, - { type: 3, pts: 6761347452, ccData: 49698 }, - { type: 2, pts: 6761347452, ccData: 21608 }, - { type: 3, pts: 6761350455, ccData: 546 }, - { type: 2, pts: 6761350455, ccData: 24948 }, - { type: 3, pts: 6761353458, ccData: 16930 }, - { type: 2, pts: 6761353458, ccData: 10099 }, - { type: 3, pts: 6761356461, ccData: 33314 }, - { type: 2, pts: 6761356461, ccData: 24434 }, - { type: 3, pts: 6761359464, ccData: 49698 }, - { type: 2, pts: 6761359464, ccData: 26983 }, - { type: 3, pts: 6761362467, ccData: 546 }, - { type: 2, pts: 6761362467, ccData: 26740 }, - { type: 3, pts: 6761365470, ccData: 16930 }, - { type: 2, pts: 6761365470, ccData: 11264 }, - { type: 3, pts: 6761368473, ccData: 35377 }, - { type: 2, pts: 6761368473, ccData: 39195 }, - { type: 2, pts: 6761368473, ccData: 16640 }, - { type: 2, pts: 6761368473, ccData: 287 }, - { type: 2, pts: 6761368473, ccData: 4240 }, - { type: 2, pts: 6761368473, ccData: 1283 }, - { type: 2, pts: 6761368473, ccData: 37162 }, - { type: 2, pts: 6761368473, ccData: 0 }, - { type: 2, pts: 6761368473, ccData: 37377 }, - { type: 2, pts: 6761368473, ccData: 1024 }, - { type: 3, pts: 6761374479, ccData: 49955 }, - { type: 2, pts: 6761374479, ccData: 37377 }, - { type: 2, pts: 6761374479, ccData: 1536 }, - { type: 3, pts: 6761380485, ccData: 546 }, - { type: 2, pts: 6761380485, ccData: 24927 }, - { type: 3, pts: 6761383488, ccData: 16930 }, - { type: 2, pts: 6761383488, ccData: 26209 }, - { type: 3, pts: 6761386491, ccData: 33314 }, - { type: 2, pts: 6761386491, ccData: 28009 }, - { type: 3, pts: 6761389494, ccData: 49698 }, - { type: 2, pts: 6761389494, ccData: 27769 }, - { type: 3, pts: 6761392497, ccData: 546 }, - { type: 2, pts: 6761392497, ccData: 24418 }, - { type: 3, pts: 6761395500, ccData: 16930 }, - { type: 2, pts: 6761395500, ccData: 26987 }, - { type: 3, pts: 6761398503, ccData: 33314 }, - { type: 2, pts: 6761398503, ccData: 25951 }, - { type: 3, pts: 6761401506, ccData: 49698 }, - { type: 2, pts: 6761401506, ccData: 29289 }, - { type: 3, pts: 6761404509, ccData: 546 }, - { type: 2, pts: 6761404509, ccData: 25701 }, - { type: 3, pts: 6761407512, ccData: 16930 }, - { type: 2, pts: 6761407512, ccData: 11776 }, - { type: 3, pts: 6761410515, ccData: 33314 }, - { type: 2, pts: 6761410515, ccData: 35841 }, - { type: 3, pts: 6761416521, ccData: 49698 }, - { type: 2, pts: 6761416521, ccData: 35074 }, - { type: 3, pts: 6761575680, ccData: 2609 }, - { type: 2, pts: 6761575680, ccData: 38939 }, - { type: 2, pts: 6761575680, ccData: 16640 }, - { type: 2, pts: 6761575680, ccData: 31 }, - { type: 2, pts: 6761575680, ccData: 5264 }, - { type: 2, pts: 6761575680, ccData: 1283 }, - { type: 2, pts: 6761575680, ccData: 37162 }, - { type: 2, pts: 6761575680, ccData: 42 }, - { type: 2, pts: 6761575680, ccData: 37376 }, - { type: 2, pts: 6761575680, ccData: 3072 }, - { type: 3, pts: 6761581686, ccData: 16930 }, - { type: 2, pts: 6761581686, ccData: 19061 }, - { type: 3, pts: 6761584689, ccData: 33314 }, - { type: 2, pts: 6761584689, ccData: 29556 }, - { type: 3, pts: 6761587692, ccData: 49698 }, - { type: 2, pts: 6761587692, ccData: 24436 }, - { type: 3, pts: 6761590695, ccData: 546 }, - { type: 2, pts: 6761590695, ccData: 26725 }, - { type: 3, pts: 6761593698, ccData: 16930 }, - { type: 2, pts: 6761593698, ccData: 24422 }, - { type: 3, pts: 6761596701, ccData: 33314 }, - { type: 2, pts: 6761596701, ccData: 28533 }, - { type: 3, pts: 6761599704, ccData: 49698 }, - { type: 2, pts: 6761599704, ccData: 29184 }, - { type: 3, pts: 6761602707, ccData: 2609 }, - { type: 2, pts: 6761602707, ccData: 38939 }, - { type: 2, pts: 6761602707, ccData: 16640 }, - { type: 2, pts: 6761602707, ccData: 287 }, - { type: 2, pts: 6761602707, ccData: 4240 }, - { type: 2, pts: 6761602707, ccData: 1283 }, - { type: 2, pts: 6761602707, ccData: 37162 }, - { type: 2, pts: 6761602707, ccData: 0 }, - { type: 2, pts: 6761602707, ccData: 37377 }, - { type: 2, pts: 6761602707, ccData: 4096 }, - { type: 3, pts: 6761608713, ccData: 17187 }, - { type: 2, pts: 6761608713, ccData: 37377 }, - { type: 2, pts: 6761608713, ccData: 4864 }, - { type: 3, pts: 6761614719, ccData: 33314 }, - { type: 2, pts: 6761614719, ccData: 28518 }, - { type: 3, pts: 6761617722, ccData: 49698 }, - { type: 2, pts: 6761617722, ccData: 24437 }, - { type: 3, pts: 6761620725, ccData: 546 }, - { type: 2, pts: 6761620725, ccData: 29486 }, - { type: 3, pts: 6761623728, ccData: 16930 }, - { type: 2, pts: 6761623728, ccData: 35842 }, - { type: 3, pts: 6761629734, ccData: 33314 }, - { type: 2, pts: 6761629734, ccData: 35073 }, - { type: 3, pts: 6761704809, ccData: 51761 }, - { type: 2, pts: 6761704809, ccData: 39195 }, - { type: 2, pts: 6761704809, ccData: 17920 }, - { type: 2, pts: 6761704809, ccData: 31 }, - { type: 2, pts: 6761704809, ccData: 5264 }, - { type: 2, pts: 6761704809, ccData: 1283 }, - { type: 2, pts: 6761704809, ccData: 37162 }, - { type: 2, pts: 6761704809, ccData: 42 }, - { type: 2, pts: 6761704809, ccData: 37376 }, - { type: 2, pts: 6761704809, ccData: 0 }, - { type: 3, pts: 6761710815, ccData: 803 }, - { type: 2, pts: 6761710815, ccData: 37376 }, - { type: 2, pts: 6761710815, ccData: 768 }, - { type: 3, pts: 6761716821, ccData: 16930 }, - { type: 2, pts: 6761716821, ccData: 20328 }, - { type: 3, pts: 6761719824, ccData: 33314 }, - { type: 2, pts: 6761719824, ccData: 8448 }, - { type: 3, pts: 6761722827, ccData: 49698 }, - { type: 2, pts: 6761722827, ccData: 35841 }, - { type: 3, pts: 6761728833, ccData: 546 }, - { type: 2, pts: 6761728833, ccData: 35074 }, - { type: 3, pts: 6761758863, ccData: 18993 }, - { type: 2, pts: 6761758863, ccData: 38939 }, - { type: 2, pts: 6761758863, ccData: 16640 }, - { type: 2, pts: 6761758863, ccData: 31 }, - { type: 2, pts: 6761758863, ccData: 5264 }, - { type: 2, pts: 6761758863, ccData: 1283 }, - { type: 2, pts: 6761758863, ccData: 37162 }, - { type: 2, pts: 6761758863, ccData: 42 }, - { type: 2, pts: 6761758863, ccData: 37376 }, - { type: 2, pts: 6761758863, ccData: 0 }, - { type: 3, pts: 6761764869, ccData: 33314 }, - { type: 2, pts: 6761764869, ccData: 17013 }, - { type: 3, pts: 6761767872, ccData: 49698 }, - { type: 2, pts: 6761767872, ccData: 29791 }, - { type: 3, pts: 6761770875, ccData: 546 }, - { type: 2, pts: 6761770875, ccData: 26735 }, - { type: 3, pts: 6761773878, ccData: 16930 }, - { type: 2, pts: 6761773878, ccData: 30559 }, - { type: 3, pts: 6761776881, ccData: 33314 }, - { type: 2, pts: 6761776881, ccData: 24941 }, - { type: 3, pts: 6761779884, ccData: 49698 }, - { type: 2, pts: 6761779884, ccData: 24393 }, - { type: 3, pts: 6761782887, ccData: 546 }, - { type: 2, pts: 6761782887, ccData: 24423 }, - { type: 3, pts: 6761785890, ccData: 16930 }, - { type: 2, pts: 6761785890, ccData: 28521 }, - { type: 3, pts: 6761788893, ccData: 33314 }, - { type: 2, pts: 6761788893, ccData: 28263 }, - { type: 3, pts: 6761791896, ccData: 51761 }, - { type: 2, pts: 6761791896, ccData: 38939 }, - { type: 2, pts: 6761791896, ccData: 16640 }, - { type: 2, pts: 6761791896, ccData: 287 }, - { type: 2, pts: 6761791896, ccData: 4240 }, - { type: 2, pts: 6761791896, ccData: 1283 }, - { type: 2, pts: 6761791896, ccData: 37162 }, - { type: 2, pts: 6761791896, ccData: 0 }, - { type: 2, pts: 6761791896, ccData: 37377 }, - { type: 2, pts: 6761791896, ccData: 0 }, - { type: 3, pts: 6761797902, ccData: 546 }, - { type: 2, pts: 6761797902, ccData: 29807 }, - { type: 3, pts: 6761800905, ccData: 16930 }, - { type: 2, pts: 6761800905, ccData: 24432 }, - { type: 3, pts: 6761803908, ccData: 33314 }, - { type: 2, pts: 6761803908, ccData: 27745 }, - { type: 3, pts: 6761806911, ccData: 49698 }, - { type: 2, pts: 6761806911, ccData: 31071 }, - { type: 3, pts: 6761809914, ccData: 546 }, - { type: 2, pts: 6761809914, ccData: 29551 }, - { type: 3, pts: 6761812917, ccData: 16930 }, - { type: 2, pts: 6761812917, ccData: 25443 }, - { type: 3, pts: 6761815920, ccData: 33314 }, - { type: 2, pts: 6761815920, ccData: 25970 }, - { type: 3, pts: 6761818923, ccData: 49698 }, - { type: 2, pts: 6761818923, ccData: 35842 }, - { type: 3, pts: 6761824929, ccData: 546 }, - { type: 2, pts: 6761824929, ccData: 35073 }, - { type: 3, pts: 6761942046, ccData: 18993 }, - { type: 2, pts: 6761942046, ccData: 39195 }, - { type: 2, pts: 6761942046, ccData: 17920 }, - { type: 2, pts: 6761942046, ccData: 31 }, - { type: 2, pts: 6761942046, ccData: 5264 }, - { type: 2, pts: 6761942046, ccData: 1283 }, - { type: 2, pts: 6761942046, ccData: 37162 }, - { type: 2, pts: 6761942046, ccData: 42 }, - { type: 2, pts: 6761942046, ccData: 37376 }, - { type: 2, pts: 6761942046, ccData: 0 }, - { type: 3, pts: 6761948052, ccData: 33314 }, - { type: 2, pts: 6761948052, ccData: 28530 }, - { type: 3, pts: 6761951055, ccData: 49698 }, - { type: 2, pts: 6761951055, ccData: 24434 }, - { type: 3, pts: 6761954058, ccData: 546 }, - { type: 2, pts: 6761954058, ccData: 26980 }, - { type: 3, pts: 6761957061, ccData: 16930 }, - { type: 2, pts: 6761957061, ccData: 25951 }, - { type: 3, pts: 6761960064, ccData: 33314 }, - { type: 2, pts: 6761960064, ccData: 24927 }, - { type: 3, pts: 6761963067, ccData: 49698 }, - { type: 2, pts: 6761963067, ccData: 25193 }, - { type: 3, pts: 6761966070, ccData: 546 }, - { type: 2, pts: 6761966070, ccData: 27493 }, - { type: 3, pts: 6761969073, ccData: 16930 }, - { type: 2, pts: 6761969073, ccData: 16128 }, - { type: 3, pts: 6761972076, ccData: 33314 }, - { type: 2, pts: 6761972076, ccData: 35841 }, - { type: 3, pts: 6761978082, ccData: 49698 }, - { type: 2, pts: 6761978082, ccData: 35074 }, - { type: 3, pts: 6762047151, ccData: 2609 }, - { type: 2, pts: 6762047151, ccData: 38939 }, - { type: 2, pts: 6762047151, ccData: 16640 }, - { type: 2, pts: 6762047151, ccData: 31 }, - { type: 2, pts: 6762047151, ccData: 5264 }, - { type: 2, pts: 6762047151, ccData: 1283 }, - { type: 2, pts: 6762047151, ccData: 37162 }, - { type: 2, pts: 6762047151, ccData: 42 }, - { type: 2, pts: 6762047151, ccData: 37376 }, - { type: 2, pts: 6762047151, ccData: 0 }, - { type: 3, pts: 6762053157, ccData: 16930 }, - { type: 2, pts: 6762053157, ccData: 19833 }, - { type: 3, pts: 6762056160, ccData: 33314 }, - { type: 2, pts: 6762056160, ccData: 24424 }, - { type: 3, pts: 6762059163, ccData: 49698 }, - { type: 2, pts: 6762059163, ccData: 24937 }, - { type: 3, pts: 6762062166, ccData: 546 }, - { type: 2, pts: 6762062166, ccData: 29279 }, - { type: 3, pts: 6762065169, ccData: 16930 }, - { type: 2, pts: 6762065169, ccData: 27493 }, - { type: 3, pts: 6762068172, ccData: 33314 }, - { type: 2, pts: 6762068172, ccData: 25968 }, - { type: 3, pts: 6762071175, ccData: 49698 }, - { type: 2, pts: 6762071175, ccData: 29535 }, - { type: 3, pts: 6762074178, ccData: 546 }, - { type: 2, pts: 6762074178, ccData: 26469 }, - { type: 3, pts: 6762077181, ccData: 16930 }, - { type: 2, pts: 6762077181, ccData: 29812 }, - { type: 3, pts: 6762080184, ccData: 33314 }, - { type: 2, pts: 6762080184, ccData: 26990 }, - { type: 3, pts: 6762083187, ccData: 49698 }, - { type: 2, pts: 6762083187, ccData: 26368 }, - { type: 3, pts: 6762086190, ccData: 2609 }, - { type: 2, pts: 6762086190, ccData: 38939 }, - { type: 2, pts: 6762086190, ccData: 16640 }, - { type: 2, pts: 6762086190, ccData: 287 }, - { type: 2, pts: 6762086190, ccData: 4240 }, - { type: 2, pts: 6762086190, ccData: 1283 }, - { type: 2, pts: 6762086190, ccData: 37162 }, - { type: 2, pts: 6762086190, ccData: 0 }, - { type: 2, pts: 6762086190, ccData: 37377 }, - { type: 2, pts: 6762086190, ccData: 0 }, - { type: 3, pts: 6762092196, ccData: 16930 }, - { type: 2, pts: 6762092196, ccData: 26990 }, - { type: 3, pts: 6762095199, ccData: 33314 }, - { type: 2, pts: 6762095199, ccData: 24429 }, - { type: 3, pts: 6762098202, ccData: 49698 }, - { type: 2, pts: 6762098202, ccData: 31071 }, - { type: 3, pts: 6762101205, ccData: 546 }, - { type: 2, pts: 6762101205, ccData: 30561 }, - { type: 3, pts: 6762104208, ccData: 16930 }, - { type: 2, pts: 6762104208, ccData: 31022 }, - { type: 3, pts: 6762107211, ccData: 33314 }, - { type: 2, pts: 6762107211, ccData: 35842 }, - { type: 3, pts: 6762113217, ccData: 49698 }, - { type: 2, pts: 6762113217, ccData: 35073 }, - { type: 3, pts: 6762239343, ccData: 2609 }, - { type: 2, pts: 6762239343, ccData: 39195 }, - { type: 2, pts: 6762239343, ccData: 16640 }, - { type: 2, pts: 6762239343, ccData: 31 }, - { type: 2, pts: 6762239343, ccData: 5264 }, - { type: 2, pts: 6762239343, ccData: 1283 }, - { type: 2, pts: 6762239343, ccData: 37162 }, - { type: 2, pts: 6762239343, ccData: 42 }, - { type: 2, pts: 6762239343, ccData: 37376 }, - { type: 2, pts: 6762239343, ccData: 0 }, - { type: 3, pts: 6762245349, ccData: 17187 }, - { type: 2, pts: 6762245349, ccData: 37376 }, - { type: 2, pts: 6762245349, ccData: 256 }, - { type: 3, pts: 6762251355, ccData: 33314 }, - { type: 2, pts: 6762251355, ccData: 22373 }, - { type: 3, pts: 6762254358, ccData: 49698 }, - { type: 2, pts: 6762254358, ccData: 27756 }, - { type: 3, pts: 6762257361, ccData: 546 }, - { type: 2, pts: 6762257361, ccData: 11359 }, - { type: 3, pts: 6762260364, ccData: 16930 }, - { type: 2, pts: 6762260364, ccData: 30568 }, - { type: 3, pts: 6762263367, ccData: 33314 }, - { type: 2, pts: 6762263367, ccData: 24948 }, - { type: 3, pts: 6762266370, ccData: 49698 }, - { type: 2, pts: 6762266370, ccData: 24425 }, - { type: 3, pts: 6762269373, ccData: 546 }, - { type: 2, pts: 6762269373, ccData: 26207 }, - { type: 3, pts: 6762272376, ccData: 16930 }, - { type: 2, pts: 6762272376, ccData: 18783 }, - { type: 3, pts: 6762275379, ccData: 33314 }, - { type: 2, pts: 6762275379, ccData: 28789 }, - { type: 3, pts: 6762278382, ccData: 49698 }, - { type: 2, pts: 6762278382, ccData: 29791 }, - { type: 3, pts: 6762281385, ccData: 546 }, - { type: 2, pts: 6762281385, ccData: 31087 }, - { type: 3, pts: 6762284388, ccData: 16930 }, - { type: 2, pts: 6762284388, ccData: 30066 }, - { type: 3, pts: 6762287391, ccData: 33314 }, - { type: 2, pts: 6762287391, ccData: 24424 }, - { type: 3, pts: 6762290394, ccData: 49698 }, - { type: 2, pts: 6762290394, ccData: 24937 }, - { type: 3, pts: 6762293397, ccData: 546 }, - { type: 2, pts: 6762293397, ccData: 29184 }, - { type: 3, pts: 6762296400, ccData: 18993 }, - { type: 2, pts: 6762296400, ccData: 39195 }, - { type: 2, pts: 6762296400, ccData: 16640 }, - { type: 2, pts: 6762296400, ccData: 287 }, - { type: 2, pts: 6762296400, ccData: 4240 }, - { type: 2, pts: 6762296400, ccData: 1283 }, - { type: 2, pts: 6762296400, ccData: 37162 }, - { type: 2, pts: 6762296400, ccData: 0 }, - { type: 2, pts: 6762296400, ccData: 37377 }, - { type: 2, pts: 6762296400, ccData: 2048 }, - { type: 3, pts: 6762302406, ccData: 33571 }, - { type: 2, pts: 6762302406, ccData: 37377 }, - { type: 2, pts: 6762302406, ccData: 2304 }, - { type: 3, pts: 6762308412, ccData: 49698 }, - { type: 2, pts: 6762308412, ccData: 26990 }, - { type: 3, pts: 6762311415, ccData: 546 }, - { type: 2, pts: 6762311415, ccData: 24417 }, - { type: 3, pts: 6762314418, ccData: 16930 }, - { type: 2, pts: 6762314418, ccData: 24432 }, - { type: 3, pts: 6762317421, ccData: 33314 }, - { type: 2, pts: 6762317421, ccData: 28526 }, - { type: 3, pts: 6762320424, ccData: 49698 }, - { type: 2, pts: 6762320424, ccData: 31092 }, - { type: 3, pts: 6762323427, ccData: 546 }, - { type: 2, pts: 6762323427, ccData: 24937 }, - { type: 3, pts: 6762326430, ccData: 16930 }, - { type: 2, pts: 6762326430, ccData: 27711 }, - { type: 3, pts: 6762329433, ccData: 33314 }, - { type: 2, pts: 6762329433, ccData: 35841 }, - { type: 3, pts: 6762335439, ccData: 49698 }, - { type: 2, pts: 6762335439, ccData: 35074 }, - { type: 3, pts: 6762584688, ccData: 2609 }, - { type: 2, pts: 6762584688, ccData: 38939 }, - { type: 2, pts: 6762584688, ccData: 17920 }, - { type: 2, pts: 6762584688, ccData: 31 }, - { type: 2, pts: 6762584688, ccData: 5264 }, - { type: 2, pts: 6762584688, ccData: 1283 }, - { type: 2, pts: 6762584688, ccData: 37162 }, - { type: 2, pts: 6762584688, ccData: 42 }, - { type: 2, pts: 6762584688, ccData: 37376 }, - { type: 2, pts: 6762584688, ccData: 0 }, - { type: 3, pts: 6762590694, ccData: 17187 }, - { type: 2, pts: 6762590694, ccData: 37376 }, - { type: 2, pts: 6762590694, ccData: 768 }, - { type: 3, pts: 6762596700, ccData: 33314 }, - { type: 2, pts: 6762596700, ccData: 21615 }, - { type: 3, pts: 6762599703, ccData: 49698 }, - { type: 2, pts: 6762599703, ccData: 24427 }, - { type: 3, pts: 6762602706, ccData: 546 }, - { type: 2, pts: 6762602706, ccData: 25957 }, - { type: 3, pts: 6762605709, ccData: 16930 }, - { type: 2, pts: 6762605709, ccData: 28767 }, - { type: 3, pts: 6762608712, ccData: 33314 }, - { type: 2, pts: 6762608712, ccData: 26996 }, - { type: 3, pts: 6762611715, ccData: 49698 }, - { type: 2, pts: 6762611715, ccData: 24431 }, - { type: 3, pts: 6762614718, ccData: 546 }, - { type: 2, pts: 6762614718, ccData: 30068 }, - { type: 3, pts: 6762617721, ccData: 16930 }, - { type: 2, pts: 6762617721, ccData: 24431 }, - { type: 3, pts: 6762620724, ccData: 33314 }, - { type: 2, pts: 6762620724, ccData: 26207 }, - { type: 3, pts: 6762623727, ccData: 49698 }, - { type: 2, pts: 6762623727, ccData: 29800 }, - { type: 3, pts: 6762626730, ccData: 546 }, - { type: 2, pts: 6762626730, ccData: 25951 }, - { type: 3, pts: 6762629733, ccData: 16930 }, - { type: 2, pts: 6762629733, ccData: 30561 }, - { type: 3, pts: 6762632736, ccData: 33314 }, - { type: 2, pts: 6762632736, ccData: 31039 }, - { type: 3, pts: 6762635739, ccData: 49698 }, - { type: 2, pts: 6762635739, ccData: 35842 }, - { type: 3, pts: 6762641745, ccData: 546 }, - { type: 2, pts: 6762641745, ccData: 35073 }, - { type: 3, pts: 6762719823, ccData: 18993 }, - { type: 2, pts: 6762719823, ccData: 39195 }, - { type: 2, pts: 6762719823, ccData: 16640 }, - { type: 2, pts: 6762719823, ccData: 31 }, - { type: 2, pts: 6762719823, ccData: 5264 }, - { type: 2, pts: 6762719823, ccData: 1283 }, - { type: 2, pts: 6762719823, ccData: 37162 }, - { type: 2, pts: 6762719823, ccData: 42 }, - { type: 2, pts: 6762719823, ccData: 37376 }, - { type: 2, pts: 6762719823, ccData: 0 }, - { type: 3, pts: 6762725829, ccData: 33314 }, - { type: 2, pts: 6762725829, ccData: 18290 }, - { type: 3, pts: 6762728832, ccData: 49698 }, - { type: 2, pts: 6762728832, ccData: 25953 }, - { type: 3, pts: 6762731835, ccData: 546 }, - { type: 2, pts: 6762731835, ccData: 29791 }, - { type: 3, pts: 6762734838, ccData: 16930 }, - { type: 2, pts: 6762734838, ccData: 26980 }, - { type: 3, pts: 6762737841, ccData: 33314 }, - { type: 2, pts: 6762737841, ccData: 25953 }, - { type: 3, pts: 6762740844, ccData: 49698 }, - { type: 2, pts: 6762740844, ccData: 11264 }, - { type: 3, pts: 6762743847, ccData: 2609 }, - { type: 2, pts: 6762743847, ccData: 39195 }, - { type: 2, pts: 6762743847, ccData: 16640 }, - { type: 2, pts: 6762743847, ccData: 287 }, - { type: 2, pts: 6762743847, ccData: 4240 }, - { type: 2, pts: 6762743847, ccData: 1283 }, - { type: 2, pts: 6762743847, ccData: 37162 }, - { type: 2, pts: 6762743847, ccData: 0 }, - { type: 2, pts: 6762743847, ccData: 37377 }, - { type: 2, pts: 6762743847, ccData: 0 }, - { type: 3, pts: 6762749853, ccData: 16930 }, - { type: 2, pts: 6762749853, ccData: 19823 }, - { type: 3, pts: 6762752856, ccData: 33314 }, - { type: 2, pts: 6762752856, ccData: 28013 }, - { type: 3, pts: 6762755859, ccData: 49698 }, - { type: 2, pts: 6762755859, ccData: 31022 }, - { type: 3, pts: 6762758862, ccData: 546 }, - { type: 2, pts: 6762758862, ccData: 35841 }, - { type: 3, pts: 6762764868, ccData: 16930 }, - { type: 2, pts: 6762764868, ccData: 35074 }, - { type: 3, pts: 6762909012, ccData: 35377 }, - { type: 2, pts: 6762909012, ccData: 38939 }, - { type: 2, pts: 6762909012, ccData: 16640 }, - { type: 2, pts: 6762909012, ccData: 31 }, - { type: 2, pts: 6762909012, ccData: 5264 }, - { type: 2, pts: 6762909012, ccData: 1283 }, - { type: 2, pts: 6762909012, ccData: 37162 }, - { type: 2, pts: 6762909012, ccData: 42 }, - { type: 2, pts: 6762909012, ccData: 37376 }, - { type: 2, pts: 6762909012, ccData: 0 }, - { type: 3, pts: 6762915018, ccData: 49698 }, - { type: 2, pts: 6762915018, ccData: 20328 }, - { type: 3, pts: 6762918021, ccData: 546 }, - { type: 2, pts: 6762918021, ccData: 11264 }, - { type: 3, pts: 6762921024, ccData: 18993 }, - { type: 2, pts: 6762921024, ccData: 38939 }, - { type: 2, pts: 6762921024, ccData: 16640 }, - { type: 2, pts: 6762921024, ccData: 287 }, - { type: 2, pts: 6762921024, ccData: 4240 }, - { type: 2, pts: 6762921024, ccData: 1283 }, - { type: 2, pts: 6762921024, ccData: 37162 }, - { type: 2, pts: 6762921024, ccData: 0 }, - { type: 2, pts: 6762921024, ccData: 37377 }, - { type: 2, pts: 6762921024, ccData: 0 }, - { type: 3, pts: 6762927030, ccData: 33314 }, - { type: 2, pts: 6762927030, ccData: 25205 }, - { type: 3, pts: 6762930033, ccData: 49698 }, - { type: 2, pts: 6762930033, ccData: 29791 }, - { type: 3, pts: 6762933036, ccData: 546 }, - { type: 2, pts: 6762933036, ccData: 18727 }, - { type: 3, pts: 6762936039, ccData: 16930 }, - { type: 2, pts: 6762936039, ccData: 30309 }, - { type: 3, pts: 6762939042, ccData: 33314 }, - { type: 2, pts: 6762939042, ccData: 24423 }, - { type: 3, pts: 6762942045, ccData: 49698 }, - { type: 2, pts: 6762942045, ccData: 28532 }, - { type: 3, pts: 6762945048, ccData: 546 }, - { type: 2, pts: 6762945048, ccData: 24435 }, - { type: 3, pts: 6762948051, ccData: 16930 }, - { type: 2, pts: 6762948051, ccData: 28511 }, - { type: 3, pts: 6762951054, ccData: 33314 }, - { type: 2, pts: 6762951054, ccData: 28021 }, - { type: 3, pts: 6762954057, ccData: 49698 }, - { type: 2, pts: 6762954057, ccData: 25448 }, - { type: 3, pts: 6762957060, ccData: 546 }, - { type: 2, pts: 6762957060, ccData: 24424 }, - { type: 3, pts: 6762960063, ccData: 16930 }, - { type: 2, pts: 6762960063, ccData: 24937 }, - { type: 3, pts: 6762963066, ccData: 33314 }, - { type: 2, pts: 6762963066, ccData: 29230 }, - { type: 3, pts: 6762966069, ccData: 49698 }, - { type: 2, pts: 6762966069, ccData: 35842 }, - { type: 3, pts: 6762972075, ccData: 546 }, - { type: 2, pts: 6762972075, ccData: 35073 }, - { type: 3, pts: 6763143246, ccData: 18993 }, - { type: 2, pts: 6763143246, ccData: 39195 }, - { type: 2, pts: 6763143246, ccData: 15360 }, - { type: 2, pts: 6763143246, ccData: 31 }, - { type: 2, pts: 6763143246, ccData: 5264 }, - { type: 2, pts: 6763143246, ccData: 1283 }, - { type: 2, pts: 6763143246, ccData: 37162 }, - { type: 2, pts: 6763143246, ccData: 42 }, - { type: 2, pts: 6763143246, ccData: 37376 }, - { type: 2, pts: 6763143246, ccData: 0 }, - { type: 3, pts: 6763149252, ccData: 33314 }, - { type: 2, pts: 6763149252, ccData: 10343 }, - { type: 3, pts: 6763152255, ccData: 49698 }, - { type: 2, pts: 6763152255, ccData: 24947 }, - { type: 3, pts: 6763155258, ccData: 546 }, - { type: 2, pts: 6763155258, ccData: 28787 }, - { type: 3, pts: 6763158261, ccData: 16930 }, - { type: 2, pts: 6763158261, ccData: 10554 }, - { type: 3, pts: 6763161264, ccData: 35377 }, - { type: 2, pts: 6763161264, ccData: 39195 }, - { type: 2, pts: 6763161264, ccData: 15360 }, - { type: 2, pts: 6763161264, ccData: 287 }, - { type: 2, pts: 6763161264, ccData: 4240 }, - { type: 2, pts: 6763161264, ccData: 1283 }, - { type: 2, pts: 6763161264, ccData: 37162 }, - { type: 2, pts: 6763161264, ccData: 0 }, - { type: 2, pts: 6763161264, ccData: 37377 }, - { type: 2, pts: 6763161264, ccData: 0 }, - { type: 3, pts: 6763167270, ccData: 49698 }, - { type: 2, pts: 6763167270, ccData: 22895 }, - { type: 3, pts: 6763170273, ccData: 546 }, - { type: 2, pts: 6763170273, ccData: 29991 }, - { type: 3, pts: 6763173276, ccData: 16930 }, - { type: 2, pts: 6763173276, ccData: 27756 }, - { type: 3, pts: 6763176279, ccData: 33314 }, - { type: 2, pts: 6763176279, ccData: 24424 }, - { type: 3, pts: 6763179282, ccData: 49698 }, - { type: 2, pts: 6763179282, ccData: 24950 }, - { type: 3, pts: 6763182285, ccData: 546 }, - { type: 2, pts: 6763182285, ccData: 25951 }, - { type: 3, pts: 6763185288, ccData: 16930 }, - { type: 2, pts: 6763185288, ccData: 29807 }, - { type: 3, pts: 6763188291, ccData: 33314 }, - { type: 2, pts: 6763188291, ccData: 24429 }, - { type: 3, pts: 6763191294, ccData: 49698 }, - { type: 2, pts: 6763191294, ccData: 24939 }, - { type: 3, pts: 6763194297, ccData: 546 }, - { type: 2, pts: 6763194297, ccData: 25951 }, - { type: 3, pts: 6763197300, ccData: 16930 }, - { type: 2, pts: 6763197300, ccData: 27759 }, - { type: 3, pts: 6763200303, ccData: 33314 }, - { type: 2, pts: 6763200303, ccData: 29811 }, - { type: 3, pts: 6763203306, ccData: 51761 }, - { type: 2, pts: 6763203306, ccData: 39195 }, - { type: 2, pts: 6763203306, ccData: 15360 }, - { type: 2, pts: 6763203306, ccData: 543 }, - { type: 2, pts: 6763203306, ccData: 4240 }, - { type: 2, pts: 6763203306, ccData: 1283 }, - { type: 2, pts: 6763203306, ccData: 37162 }, - { type: 2, pts: 6763203306, ccData: 0 }, - { type: 2, pts: 6763203306, ccData: 37378 }, - { type: 2, pts: 6763203306, ccData: 0 }, - { type: 3, pts: 6763209312, ccData: 546 }, - { type: 2, pts: 6763209312, ccData: 24942 }, - { type: 3, pts: 6763212315, ccData: 16930 }, - { type: 2, pts: 6763212315, ccData: 25695 }, - { type: 3, pts: 6763215318, ccData: 33314 }, - { type: 2, pts: 6763215318, ccData: 27759 }, - { type: 3, pts: 6763218321, ccData: 49698 }, - { type: 2, pts: 6763218321, ccData: 29811 }, - { type: 3, pts: 6763221324, ccData: 546 }, - { type: 2, pts: 6763221324, ccData: 24431 }, - { type: 3, pts: 6763224327, ccData: 16930 }, - { type: 2, pts: 6763224327, ccData: 26207 }, - { type: 3, pts: 6763227330, ccData: 33314 }, - { type: 2, pts: 6763227330, ccData: 28783 }, - { type: 3, pts: 6763230333, ccData: 49698 }, - { type: 2, pts: 6763230333, ccData: 28281 }, - { type: 3, pts: 6763233336, ccData: 546 }, - { type: 2, pts: 6763233336, ccData: 29793 }, - { type: 3, pts: 6763236339, ccData: 16930 }, - { type: 2, pts: 6763236339, ccData: 26988 }, - { type: 3, pts: 6763239342, ccData: 33314 }, - { type: 2, pts: 6763239342, ccData: 29473 }, - { type: 3, pts: 6763242345, ccData: 49698 }, - { type: 2, pts: 6763242345, ccData: 35841 }, - { type: 3, pts: 6763248351, ccData: 546 }, - { type: 2, pts: 6763248351, ccData: 35074 }, - { type: 3, pts: 6763545648, ccData: 18993 }, - { type: 2, pts: 6763545648, ccData: 38939 }, - { type: 2, pts: 6763545648, ccData: 17920 }, - { type: 2, pts: 6763545648, ccData: 31 }, - { type: 2, pts: 6763545648, ccData: 5264 }, - { type: 2, pts: 6763545648, ccData: 1283 }, - { type: 2, pts: 6763545648, ccData: 37162 }, - { type: 2, pts: 6763545648, ccData: 42 }, - { type: 2, pts: 6763545648, ccData: 37376 }, - { type: 2, pts: 6763545648, ccData: 4096 }, - { type: 3, pts: 6763551654, ccData: 33571 }, - { type: 2, pts: 6763551654, ccData: 37376 }, - { type: 2, pts: 6763551654, ccData: 4608 }, - { type: 3, pts: 6763557660, ccData: 49698 }, - { type: 2, pts: 6763557660, ccData: 19567 }, - { type: 3, pts: 6763560663, ccData: 546 }, - { type: 2, pts: 6763560663, ccData: 29811 }, - { type: 3, pts: 6763563666, ccData: 16930 }, - { type: 2, pts: 6763563666, ccData: 24417 }, - { type: 3, pts: 6763566669, ccData: 33314 }, - { type: 2, pts: 6763566669, ccData: 28260 }, - { type: 3, pts: 6763569672, ccData: 49698 }, - { type: 2, pts: 6763569672, ccData: 24428 }, - { type: 3, pts: 6763572675, ccData: 546 }, - { type: 2, pts: 6763572675, ccData: 28532 }, - { type: 3, pts: 6763575678, ccData: 16930 }, - { type: 2, pts: 6763575678, ccData: 29503 }, - { type: 3, pts: 6763578681, ccData: 33314 }, - { type: 2, pts: 6763578681, ccData: 35842 }, - { type: 3, pts: 6763584687, ccData: 49698 }, - { type: 2, pts: 6763584687, ccData: 35073 }, - { type: 3, pts: 6763668771, ccData: 2609 }, - { type: 2, pts: 6763668771, ccData: 39195 }, - { type: 2, pts: 6763668771, ccData: 16640 }, - { type: 2, pts: 6763668771, ccData: 31 }, - { type: 2, pts: 6763668771, ccData: 5264 }, - { type: 2, pts: 6763668771, ccData: 1283 }, - { type: 2, pts: 6763668771, ccData: 37162 }, - { type: 2, pts: 6763668771, ccData: 42 }, - { type: 2, pts: 6763668771, ccData: 37376 }, - { type: 2, pts: 6763668771, ccData: 0 }, - { type: 3, pts: 6763674777, ccData: 16930 }, - { type: 2, pts: 6763674777, ccData: 18727 }, - { type: 3, pts: 6763677780, ccData: 33314 }, - { type: 2, pts: 6763677780, ccData: 27756 }, - { type: 3, pts: 6763680783, ccData: 49698 }, - { type: 2, pts: 6763680783, ccData: 24420 }, - { type: 3, pts: 6763683786, ccData: 546 }, - { type: 2, pts: 6763683786, ccData: 29281 }, - { type: 3, pts: 6763686789, ccData: 16930 }, - { type: 2, pts: 6763686789, ccData: 30559 }, - { type: 3, pts: 6763689792, ccData: 33314 }, - { type: 2, pts: 6763689792, ccData: 24927 }, - { type: 3, pts: 6763692795, ccData: 49698 }, - { type: 2, pts: 6763692795, ccData: 28777 }, - { type: 3, pts: 6763695798, ccData: 546 }, - { type: 2, pts: 6763695798, ccData: 25460 }, - { type: 3, pts: 6763698801, ccData: 16930 }, - { type: 2, pts: 6763698801, ccData: 30066 }, - { type: 3, pts: 6763701804, ccData: 33314 }, - { type: 2, pts: 6763701804, ccData: 25856 }, - { type: 3, pts: 6763704807, ccData: 51761 }, - { type: 2, pts: 6763704807, ccData: 39195 }, - { type: 2, pts: 6763704807, ccData: 16640 }, - { type: 2, pts: 6763704807, ccData: 287 }, - { type: 2, pts: 6763704807, ccData: 4240 }, - { type: 2, pts: 6763704807, ccData: 1283 }, - { type: 2, pts: 6763704807, ccData: 37162 }, - { type: 2, pts: 6763704807, ccData: 0 }, - { type: 2, pts: 6763704807, ccData: 37377 }, - { type: 2, pts: 6763704807, ccData: 0 }, - { type: 3, pts: 6763710813, ccData: 546 }, - { type: 2, pts: 6763710813, ccData: 26223 }, - { type: 3, pts: 6763713816, ccData: 16930 }, - { type: 2, pts: 6763713816, ccData: 29279 }, - { type: 3, pts: 6763716819, ccData: 33314 }, - { type: 2, pts: 6763716819, ccData: 31087 }, - { type: 3, pts: 6763719822, ccData: 49698 }, - { type: 2, pts: 6763719822, ccData: 29998 }, - { type: 3, pts: 6763722825, ccData: 546 }, - { type: 2, pts: 6763722825, ccData: 35841 }, - { type: 3, pts: 6763728831, ccData: 16930 }, - { type: 2, pts: 6763728831, ccData: 35074 }, - { type: 3, pts: 6763909011, ccData: 35377 }, - { type: 2, pts: 6763909011, ccData: 38939 }, - { type: 2, pts: 6763909011, ccData: 17920 }, - { type: 2, pts: 6763909011, ccData: 31 }, - { type: 2, pts: 6763909011, ccData: 5264 }, - { type: 2, pts: 6763909011, ccData: 1283 }, - { type: 2, pts: 6763909011, ccData: 37162 }, - { type: 2, pts: 6763909011, ccData: 42 }, - { type: 2, pts: 6763909011, ccData: 37376 }, - { type: 2, pts: 6763909011, ccData: 3072 }, - { type: 3, pts: 6763915017, ccData: 49955 }, - { type: 2, pts: 6763915017, ccData: 37376 }, - { type: 2, pts: 6763915017, ccData: 3584 }, - { type: 3, pts: 6763921023, ccData: 545 }, - { type: 2, pts: 6763921023, ccData: 32512 }, - { type: 3, pts: 6763924026, ccData: 16930 }, - { type: 2, pts: 6763924026, ccData: 24320 }, - { type: 3, pts: 6763927029, ccData: 33313 }, - { type: 2, pts: 6763927029, ccData: 32512 }, - { type: 3, pts: 6763930032, ccData: 49698 }, - { type: 2, pts: 6763930032, ccData: 35842 }, - { type: 3, pts: 6763936038, ccData: 546 }, - { type: 2, pts: 6763936038, ccData: 35073 }, - { type: 3, pts: 6764437539, ccData: 18993 }, - { type: 2, pts: 6764437539, ccData: 39195 }, - { type: 2, pts: 6764437539, ccData: 17920 }, - { type: 2, pts: 6764437539, ccData: 31 }, - { type: 2, pts: 6764437539, ccData: 5264 }, - { type: 2, pts: 6764437539, ccData: 1283 }, - { type: 2, pts: 6764437539, ccData: 37162 }, - { type: 2, pts: 6764437539, ccData: 42 }, - { type: 2, pts: 6764437539, ccData: 37376 }, - { type: 2, pts: 6764437539, ccData: 2048 }, - { type: 3, pts: 6764443545, ccData: 33571 }, - { type: 2, pts: 6764443545, ccData: 37376 }, - { type: 2, pts: 6764443545, ccData: 2560 }, - { type: 3, pts: 6764449551, ccData: 49698 }, - { type: 2, pts: 6764449551, ccData: 22881 }, - { type: 3, pts: 6764452554, ccData: 546 }, - { type: 2, pts: 6764452554, ccData: 31020 }, - { type: 3, pts: 6764455557, ccData: 16930 }, - { type: 2, pts: 6764455557, ccData: 24397 }, - { type: 3, pts: 6764458560, ccData: 33314 }, - { type: 2, pts: 6764458560, ccData: 28525 }, - { type: 3, pts: 6764461563, ccData: 49698 }, - { type: 2, pts: 6764461563, ccData: 28025 }, - { type: 3, pts: 6764464566, ccData: 546 }, - { type: 2, pts: 6764464566, ccData: 8448 }, - { type: 3, pts: 6764467569, ccData: 16930 }, - { type: 2, pts: 6764467569, ccData: 35841 }, - { type: 3, pts: 6764473575, ccData: 33314 }, - { type: 2, pts: 6764473575, ccData: 35074 }, - { type: 3, pts: 6764524626, ccData: 51761 }, - { type: 2, pts: 6764524626, ccData: 38939 }, - { type: 2, pts: 6764524626, ccData: 16640 }, - { type: 2, pts: 6764524626, ccData: 31 }, - { type: 2, pts: 6764524626, ccData: 5264 }, - { type: 2, pts: 6764524626, ccData: 1283 }, - { type: 2, pts: 6764524626, ccData: 37162 }, - { type: 2, pts: 6764524626, ccData: 42 }, - { type: 2, pts: 6764524626, ccData: 37376 }, - { type: 2, pts: 6764524626, ccData: 1024 }, - { type: 3, pts: 6764530632, ccData: 546 }, - { type: 2, pts: 6764530632, ccData: 20334 }, - { type: 3, pts: 6764533635, ccData: 16930 }, - { type: 2, pts: 6764533635, ccData: 27769 }, - { type: 3, pts: 6764536638, ccData: 33314 }, - { type: 2, pts: 6764536638, ccData: 24422 }, - { type: 3, pts: 6764539641, ccData: 49698 }, - { type: 2, pts: 6764539641, ccData: 26998 }, - { type: 3, pts: 6764542644, ccData: 546 }, - { type: 2, pts: 6764542644, ccData: 25951 }, - { type: 3, pts: 6764545647, ccData: 16930 }, - { type: 2, pts: 6764545647, ccData: 28015 }, - { type: 3, pts: 6764548650, ccData: 33314 }, - { type: 2, pts: 6764548650, ccData: 29285 }, - { type: 3, pts: 6764551653, ccData: 49698 }, - { type: 2, pts: 6764551653, ccData: 24432 }, - { type: 3, pts: 6764554656, ccData: 546 }, - { type: 2, pts: 6764554656, ccData: 28526 }, - { type: 3, pts: 6764557659, ccData: 16930 }, - { type: 2, pts: 6764557659, ccData: 31092 }, - { type: 3, pts: 6764560662, ccData: 33314 }, - { type: 2, pts: 6764560662, ccData: 24937 }, - { type: 3, pts: 6764563665, ccData: 49698 }, - { type: 2, pts: 6764563665, ccData: 27763 }, - { type: 3, pts: 6764566668, ccData: 2609 }, - { type: 2, pts: 6764566668, ccData: 38939 }, - { type: 2, pts: 6764566668, ccData: 16640 }, - { type: 2, pts: 6764566668, ccData: 287 }, - { type: 2, pts: 6764566668, ccData: 4240 }, - { type: 2, pts: 6764566668, ccData: 1283 }, - { type: 2, pts: 6764566668, ccData: 37162 }, - { type: 2, pts: 6764566668, ccData: 0 }, - { type: 2, pts: 6764566668, ccData: 37377 }, - { type: 2, pts: 6764566668, ccData: 3072 }, - { type: 3, pts: 6764572674, ccData: 17187 }, - { type: 2, pts: 6764572674, ccData: 37377 }, - { type: 2, pts: 6764572674, ccData: 3328 }, - { type: 3, pts: 6764578680, ccData: 33314 }, - { type: 2, pts: 6764578680, ccData: 29807 }, - { type: 3, pts: 6764581683, ccData: 49698 }, - { type: 2, pts: 6764581683, ccData: 24423 }, - { type: 3, pts: 6764584686, ccData: 546 }, - { type: 2, pts: 6764584686, ccData: 28462 }, - { type: 3, pts: 6764587689, ccData: 16930 }, - { type: 2, pts: 6764587689, ccData: 35842 }, - { type: 3, pts: 6764593695, ccData: 33314 }, - { type: 2, pts: 6764593695, ccData: 35073 }, - { type: 3, pts: 6764860962, ccData: 49698 }, - { type: 2, pts: 6764860962, ccData: 35841 }, - { type: 3, pts: 6765068169, ccData: 2609 }, - { type: 2, pts: 6765068169, ccData: 38939 }, - { type: 2, pts: 6765068169, ccData: 16640 }, - { type: 2, pts: 6765068169, ccData: 31 }, - { type: 2, pts: 6765068169, ccData: 5264 }, - { type: 2, pts: 6765068169, ccData: 1283 }, - { type: 2, pts: 6765068169, ccData: 37162 }, - { type: 2, pts: 6765068169, ccData: 0 }, - { type: 2, pts: 6765068169, ccData: 37376 }, - { type: 2, pts: 6765068169, ccData: 1024 }, - { type: 3, pts: 6765074175, ccData: 17187 }, - { type: 2, pts: 6765074175, ccData: 37376 }, - { type: 2, pts: 6765074175, ccData: 1280 }, - { type: 3, pts: 6765080181, ccData: 33314 }, - { type: 2, pts: 6765080181, ccData: 21608 }, - { type: 3, pts: 6765083184, ccData: 49698 }, - { type: 2, pts: 6765083184, ccData: 25951 }, - { type: 3, pts: 6765086187, ccData: 546 }, - { type: 2, pts: 6765086187, ccData: 27745 }, - { type: 3, pts: 6765089190, ccData: 16930 }, - { type: 2, pts: 6765089190, ccData: 29556 }, - { type: 3, pts: 6765092193, ccData: 33314 }, - { type: 2, pts: 6765092193, ccData: 24432 }, - { type: 3, pts: 6765095196, ccData: 49698 }, - { type: 2, pts: 6765095196, ccData: 28526 }, - { type: 3, pts: 6765098199, ccData: 546 }, - { type: 2, pts: 6765098199, ccData: 31092 }, - { type: 3, pts: 6765101202, ccData: 16930 }, - { type: 2, pts: 6765101202, ccData: 24937 }, - { type: 3, pts: 6765104205, ccData: 33314 }, - { type: 2, pts: 6765104205, ccData: 27743 }, - { type: 3, pts: 6765107208, ccData: 49698 }, - { type: 2, pts: 6765107208, ccData: 26479 }, - { type: 3, pts: 6765110211, ccData: 546 }, - { type: 2, pts: 6765110211, ccData: 25971 }, - { type: 3, pts: 6765113214, ccData: 18993 }, - { type: 2, pts: 6765113214, ccData: 38939 }, - { type: 2, pts: 6765113214, ccData: 16640 }, - { type: 2, pts: 6765113214, ccData: 287 }, - { type: 2, pts: 6765113214, ccData: 4240 }, - { type: 2, pts: 6765113214, ccData: 1283 }, - { type: 2, pts: 6765113214, ccData: 37162 }, - { type: 2, pts: 6765113214, ccData: 0 }, - { type: 2, pts: 6765113214, ccData: 37377 }, - { type: 2, pts: 6765113214, ccData: 1024 }, - { type: 3, pts: 6765119220, ccData: 33571 }, - { type: 2, pts: 6765119220, ccData: 37377 }, - { type: 2, pts: 6765119220, ccData: 1792 }, - { type: 3, pts: 6765125226, ccData: 49698 }, - { type: 2, pts: 6765125226, ccData: 28526 }, - { type: 3, pts: 6765128229, ccData: 546 }, - { type: 2, pts: 6765128229, ccData: 24436 }, - { type: 3, pts: 6765131232, ccData: 16930 }, - { type: 2, pts: 6765131232, ccData: 26725 }, - { type: 3, pts: 6765134235, ccData: 33314 }, - { type: 2, pts: 6765134235, ccData: 24436 }, - { type: 3, pts: 6765137238, ccData: 49698 }, - { type: 2, pts: 6765137238, ccData: 26992 }, - { type: 3, pts: 6765140241, ccData: 546 }, - { type: 2, pts: 6765140241, ccData: 28793 }, - { type: 3, pts: 6765143244, ccData: 16930 }, - { type: 2, pts: 6765143244, ccData: 24436 }, - { type: 3, pts: 6765146247, ccData: 33314 }, - { type: 2, pts: 6765146247, ccData: 28528 }, - { type: 3, pts: 6765149250, ccData: 49698 }, - { type: 2, pts: 6765149250, ccData: 11776 }, - { type: 3, pts: 6765158259, ccData: 546 }, - { type: 2, pts: 6765158259, ccData: 35073 }, - { type: 3, pts: 6765431532, ccData: 16930 }, - { type: 2, pts: 6765431532, ccData: 35841 }, - { type: 3, pts: 6765620721, ccData: 35377 }, - { type: 2, pts: 6765620721, ccData: 38939 }, - { type: 2, pts: 6765620721, ccData: 17920 }, - { type: 2, pts: 6765620721, ccData: 31 }, - { type: 2, pts: 6765620721, ccData: 5264 }, - { type: 2, pts: 6765620721, ccData: 1283 }, - { type: 2, pts: 6765620721, ccData: 37162 }, - { type: 2, pts: 6765620721, ccData: 0 }, - { type: 2, pts: 6765620721, ccData: 37376 }, - { type: 2, pts: 6765620721, ccData: 0 }, - { type: 3, pts: 6765626727, ccData: 49955 }, - { type: 2, pts: 6765626727, ccData: 37376 }, - { type: 2, pts: 6765626727, ccData: 768 }, - { type: 3, pts: 6765632733, ccData: 546 }, - { type: 2, pts: 6765632733, ccData: 18533 }, - { type: 3, pts: 6765635736, ccData: 16930 }, - { type: 2, pts: 6765635736, ccData: 29285 }, - { type: 3, pts: 6765638739, ccData: 33314 }, - { type: 2, pts: 6765638739, ccData: 24441 }, - { type: 3, pts: 6765641742, ccData: 49698 }, - { type: 2, pts: 6765641742, ccData: 28533 }, - { type: 3, pts: 6765644745, ccData: 546 }, - { type: 2, pts: 6765644745, ccData: 24423 }, - { type: 3, pts: 6765647748, ccData: 16930 }, - { type: 2, pts: 6765647748, ccData: 28462 }, - { type: 3, pts: 6765656757, ccData: 33314 }, - { type: 2, pts: 6765656757, ccData: 35073 }, - { type: 3, pts: 6765701802, ccData: 51761 }, - { type: 2, pts: 6765701802, ccData: 39195 }, - { type: 2, pts: 6765701802, ccData: 16640 }, - { type: 2, pts: 6765701802, ccData: 31 }, - { type: 2, pts: 6765701802, ccData: 5264 }, - { type: 2, pts: 6765701802, ccData: 1283 }, - { type: 2, pts: 6765701802, ccData: 37162 }, - { type: 2, pts: 6765701802, ccData: 42 }, - { type: 2, pts: 6765701802, ccData: 37376 }, - { type: 2, pts: 6765701802, ccData: 3072 }, - { type: 3, pts: 6765707808, ccData: 546 }, - { type: 2, pts: 6765707808, ccData: 10343 }, - { type: 3, pts: 6765710811, ccData: 16930 }, - { type: 2, pts: 6765710811, ccData: 24947 }, - { type: 3, pts: 6765713814, ccData: 33314 }, - { type: 2, pts: 6765713814, ccData: 28787 }, - { type: 3, pts: 6765716817, ccData: 49698 }, - { type: 2, pts: 6765716817, ccData: 10554 }, - { type: 3, pts: 6765719820, ccData: 2609 }, - { type: 2, pts: 6765719820, ccData: 39195 }, - { type: 2, pts: 6765719820, ccData: 16640 }, - { type: 2, pts: 6765719820, ccData: 287 }, - { type: 2, pts: 6765719820, ccData: 4240 }, - { type: 2, pts: 6765719820, ccData: 1283 }, - { type: 2, pts: 6765719820, ccData: 37162 }, - { type: 2, pts: 6765719820, ccData: 0 }, - { type: 2, pts: 6765719820, ccData: 37377 }, - { type: 2, pts: 6765719820, ccData: 0 }, - { type: 3, pts: 6765725826, ccData: 17187 }, - { type: 2, pts: 6765725826, ccData: 37377 }, - { type: 2, pts: 6765725826, ccData: 256 }, - { type: 3, pts: 6765731832, ccData: 33314 }, - { type: 2, pts: 6765731832, ccData: 18804 }, - { type: 3, pts: 6765734835, ccData: 49698 }, - { type: 2, pts: 6765734835, ccData: 24428 }, - { type: 3, pts: 6765737838, ccData: 546 }, - { type: 2, pts: 6765737838, ccData: 28527 }, - { type: 3, pts: 6765740841, ccData: 16930 }, - { type: 2, pts: 6765740841, ccData: 27507 }, - { type: 3, pts: 6765743844, ccData: 33314 }, - { type: 2, pts: 6765743844, ccData: 24426 }, - { type: 3, pts: 6765746847, ccData: 49698 }, - { type: 2, pts: 6765746847, ccData: 30067 }, - { type: 3, pts: 6765749850, ccData: 546 }, - { type: 2, pts: 6765749850, ccData: 29791 }, - { type: 3, pts: 6765752853, ccData: 16930 }, - { type: 2, pts: 6765752853, ccData: 27753 }, - { type: 3, pts: 6765755856, ccData: 33314 }, - { type: 2, pts: 6765755856, ccData: 27493 }, - { type: 3, pts: 6765758859, ccData: 49698 }, - { type: 2, pts: 6765758859, ccData: 24429 }, - { type: 3, pts: 6765761862, ccData: 546 }, - { type: 2, pts: 6765761862, ccData: 31071 }, - { type: 3, pts: 6765764865, ccData: 16930 }, - { type: 2, pts: 6765764865, ccData: 28777 }, - { type: 3, pts: 6765767868, ccData: 33314 }, - { type: 2, pts: 6765767868, ccData: 25460 }, - { type: 3, pts: 6765770871, ccData: 49698 }, - { type: 2, pts: 6765770871, ccData: 30066 }, - { type: 3, pts: 6765773874, ccData: 546 }, - { type: 2, pts: 6765773874, ccData: 25902 }, - { type: 3, pts: 6765776877, ccData: 16930 }, - { type: 2, pts: 6765776877, ccData: 35841 }, - { type: 3, pts: 6765782883, ccData: 33314 }, - { type: 2, pts: 6765782883, ccData: 35074 }, - { type: 3, pts: 6766014114, ccData: 51761 }, - { type: 2, pts: 6766014114, ccData: 38939 }, - { type: 2, pts: 6766014114, ccData: 17920 }, - { type: 2, pts: 6766014114, ccData: 31 }, - { type: 2, pts: 6766014114, ccData: 5264 }, - { type: 2, pts: 6766014114, ccData: 1283 }, - { type: 2, pts: 6766014114, ccData: 37162 }, - { type: 2, pts: 6766014114, ccData: 42 }, - { type: 2, pts: 6766014114, ccData: 37376 }, - { type: 2, pts: 6766014114, ccData: 0 }, - { type: 3, pts: 6766020120, ccData: 803 }, - { type: 2, pts: 6766020120, ccData: 37376 }, - { type: 2, pts: 6766020120, ccData: 768 }, - { type: 3, pts: 6766026126, ccData: 16930 }, - { type: 2, pts: 6766026126, ccData: 21608 }, - { type: 3, pts: 6766029129, ccData: 33314 }, - { type: 2, pts: 6766029129, ccData: 24942 }, - { type: 3, pts: 6766032132, ccData: 49698 }, - { type: 2, pts: 6766032132, ccData: 27487 }, - { type: 3, pts: 6766035135, ccData: 546 }, - { type: 2, pts: 6766035135, ccData: 31087 }, - { type: 3, pts: 6766038138, ccData: 16930 }, - { type: 2, pts: 6766038138, ccData: 30047 }, - { type: 3, pts: 6766041141, ccData: 33314 }, - { type: 2, pts: 6766041141, ccData: 29551 }, - { type: 3, pts: 6766044144, ccData: 49698 }, - { type: 2, pts: 6766044144, ccData: 24429 }, - { type: 3, pts: 6766047147, ccData: 546 }, - { type: 2, pts: 6766047147, ccData: 30051 }, - { type: 3, pts: 6766050150, ccData: 16930 }, - { type: 2, pts: 6766050150, ccData: 26668 }, - { type: 3, pts: 6766053153, ccData: 33314 }, - { type: 2, pts: 6766053153, ccData: 24397 }, - { type: 3, pts: 6766056156, ccData: 49698 }, - { type: 2, pts: 6766056156, ccData: 28525 }, - { type: 3, pts: 6766059159, ccData: 546 }, - { type: 2, pts: 6766059159, ccData: 28025 }, - { type: 3, pts: 6766062162, ccData: 16930 }, - { type: 2, pts: 6766062162, ccData: 11776 }, - { type: 3, pts: 6766065165, ccData: 33314 }, - { type: 2, pts: 6766065165, ccData: 35842 }, - { type: 3, pts: 6766071171, ccData: 49698 }, - { type: 2, pts: 6766071171, ccData: 35073 }, - { type: 3, pts: 6766173273, ccData: 2609 }, - { type: 2, pts: 6766173273, ccData: 39195 }, - { type: 2, pts: 6766173273, ccData: 16640 }, - { type: 2, pts: 6766173273, ccData: 31 }, - { type: 2, pts: 6766173273, ccData: 5264 }, - { type: 2, pts: 6766173273, ccData: 1283 }, - { type: 2, pts: 6766173273, ccData: 37162 }, - { type: 2, pts: 6766173273, ccData: 42 }, - { type: 2, pts: 6766173273, ccData: 37376 }, - { type: 2, pts: 6766173273, ccData: 2048 }, - { type: 3, pts: 6766179279, ccData: 16930 }, - { type: 2, pts: 6766179279, ccData: 22895 }, - { type: 3, pts: 6766182282, ccData: 33314 }, - { type: 2, pts: 6766182282, ccData: 30047 }, - { type: 3, pts: 6766185285, ccData: 49698 }, - { type: 2, pts: 6766185285, ccData: 29544 }, - { type: 3, pts: 6766188288, ccData: 546 }, - { type: 2, pts: 6766188288, ccData: 28533 }, - { type: 3, pts: 6766191291, ccData: 16930 }, - { type: 2, pts: 6766191291, ccData: 27748 }, - { type: 3, pts: 6766194294, ccData: 33314 }, - { type: 2, pts: 6766194294, ccData: 24439 }, - { type: 3, pts: 6766197297, ccData: 49698 }, - { type: 2, pts: 6766197297, ccData: 28530 }, - { type: 3, pts: 6766200300, ccData: 546 }, - { type: 2, pts: 6766200300, ccData: 27392 }, - { type: 3, pts: 6766203303, ccData: 18993 }, - { type: 2, pts: 6766203303, ccData: 39195 }, - { type: 2, pts: 6766203303, ccData: 16640 }, - { type: 2, pts: 6766203303, ccData: 287 }, - { type: 2, pts: 6766203303, ccData: 4240 }, - { type: 2, pts: 6766203303, ccData: 1283 }, - { type: 2, pts: 6766203303, ccData: 37162 }, - { type: 2, pts: 6766203303, ccData: 0 }, - { type: 2, pts: 6766203303, ccData: 37377 }, - { type: 2, pts: 6766203303, ccData: 1024 }, - { type: 3, pts: 6766209309, ccData: 33571 }, - { type: 2, pts: 6766209309, ccData: 37377 }, - { type: 2, pts: 6766209309, ccData: 1536 }, - { type: 3, pts: 6766215315, ccData: 49698 }, - { type: 2, pts: 6766215315, ccData: 24948 }, - { type: 3, pts: 6766218318, ccData: 546 }, - { type: 2, pts: 6766218318, ccData: 24436 }, - { type: 3, pts: 6766221321, ccData: 16930 }, - { type: 2, pts: 6766221321, ccData: 26725 }, - { type: 3, pts: 6766224324, ccData: 33314 }, - { type: 2, pts: 6766224324, ccData: 24388 }, - { type: 3, pts: 6766227327, ccData: 49698 }, - { type: 2, pts: 6766227327, ccData: 29285 }, - { type: 3, pts: 6766230330, ccData: 546 }, - { type: 2, pts: 6766230330, ccData: 24941 }, - { type: 3, pts: 6766233333, ccData: 16930 }, - { type: 2, pts: 6766233333, ccData: 24403 }, - { type: 3, pts: 6766236336, ccData: 33314 }, - { type: 2, pts: 6766236336, ccData: 24940 }, - { type: 3, pts: 6766239339, ccData: 49698 }, - { type: 2, pts: 6766239339, ccData: 28526 }, - { type: 3, pts: 6766242342, ccData: 546 }, - { type: 2, pts: 6766242342, ccData: 11776 }, - { type: 3, pts: 6766245345, ccData: 16930 }, - { type: 2, pts: 6766245345, ccData: 35841 }, - { type: 3, pts: 6766251351, ccData: 33314 }, - { type: 2, pts: 6766251351, ccData: 35074 }, - { type: 3, pts: 6766389489, ccData: 51761 }, - { type: 2, pts: 6766389489, ccData: 38939 }, - { type: 2, pts: 6766389489, ccData: 17920 }, - { type: 2, pts: 6766389489, ccData: 31 }, - { type: 2, pts: 6766389489, ccData: 5264 }, - { type: 2, pts: 6766389489, ccData: 1283 }, - { type: 2, pts: 6766389489, ccData: 37162 }, - { type: 2, pts: 6766389489, ccData: 42 }, - { type: 2, pts: 6766389489, ccData: 37376 }, - { type: 2, pts: 6766389489, ccData: 2048 }, - { type: 3, pts: 6766395495, ccData: 546 }, - { type: 2, pts: 6766395495, ccData: 10338 }, - { type: 3, pts: 6766398498, ccData: 16930 }, - { type: 2, pts: 6766398498, ccData: 28532 }, - { type: 3, pts: 6766401501, ccData: 33314 }, - { type: 2, pts: 6766401501, ccData: 26719 }, - { type: 3, pts: 6766404504, ccData: 49698 }, - { type: 2, pts: 6766404504, ccData: 27745 }, - { type: 3, pts: 6766407507, ccData: 546 }, - { type: 2, pts: 6766407507, ccData: 30055 }, - { type: 3, pts: 6766410510, ccData: 16930 }, - { type: 2, pts: 6766410510, ccData: 26729 }, - { type: 3, pts: 6766413513, ccData: 33314 }, - { type: 2, pts: 6766413513, ccData: 28263 }, - { type: 3, pts: 6766416516, ccData: 49698 }, - { type: 2, pts: 6766416516, ccData: 10496 }, - { type: 3, pts: 6766419519, ccData: 546 }, - { type: 2, pts: 6766419519, ccData: 35842 }, - { type: 3, pts: 6766425525, ccData: 16930 }, - { type: 2, pts: 6766425525, ccData: 35073 }, - { type: 3, pts: 6766533633, ccData: 35377 }, - { type: 2, pts: 6766533633, ccData: 39195 }, - { type: 2, pts: 6766533633, ccData: 17920 }, - { type: 2, pts: 6766533633, ccData: 31 }, - { type: 2, pts: 6766533633, ccData: 5264 }, - { type: 2, pts: 6766533633, ccData: 1283 }, - { type: 2, pts: 6766533633, ccData: 37162 }, - { type: 2, pts: 6766533633, ccData: 42 }, - { type: 2, pts: 6766533633, ccData: 37376 }, - { type: 2, pts: 6766533633, ccData: 3072 }, - { type: 3, pts: 6766539639, ccData: 49698 }, - { type: 2, pts: 6766539639, ccData: 20328 }, - { type: 3, pts: 6766542642, ccData: 546 }, - { type: 2, pts: 6766542642, ccData: 11359 }, - { type: 3, pts: 6766545645, ccData: 16930 }, - { type: 2, pts: 6766545645, ccData: 28271 }, - { type: 3, pts: 6766548648, ccData: 33314 }, - { type: 2, pts: 6766548648, ccData: 11776 }, - { type: 3, pts: 6766551651, ccData: 49698 }, - { type: 2, pts: 6766551651, ccData: 35841 }, - { type: 3, pts: 6766557657, ccData: 546 }, - { type: 2, pts: 6766557657, ccData: 35074 }, - { type: 3, pts: 6766599699, ccData: 18993 }, - { type: 2, pts: 6766599699, ccData: 38939 }, - { type: 2, pts: 6766599699, ccData: 16640 }, - { type: 2, pts: 6766599699, ccData: 31 }, - { type: 2, pts: 6766599699, ccData: 5264 }, - { type: 2, pts: 6766599699, ccData: 1283 }, - { type: 2, pts: 6766599699, ccData: 37162 }, - { type: 2, pts: 6766599699, ccData: 42 }, - { type: 2, pts: 6766599699, ccData: 37376 }, - { type: 2, pts: 6766599699, ccData: 1024 }, - { type: 3, pts: 6766605705, ccData: 33571 }, - { type: 2, pts: 6766605705, ccData: 37376 }, - { type: 2, pts: 6766605705, ccData: 1792 }, - { type: 3, pts: 6766611711, ccData: 49698 }, - { type: 2, pts: 6766611711, ccData: 21608 }, - { type: 3, pts: 6766614714, ccData: 546 }, - { type: 2, pts: 6766614714, ccData: 25951 }, - { type: 3, pts: 6766617717, ccData: 16930 }, - { type: 2, pts: 6766617717, ccData: 29551 }, - { type: 3, pts: 6766620720, ccData: 33314 }, - { type: 2, pts: 6766620720, ccData: 25443 }, - { type: 3, pts: 6766623723, ccData: 49698 }, - { type: 2, pts: 6766623723, ccData: 25970 }, - { type: 3, pts: 6766626726, ccData: 546 }, - { type: 2, pts: 6766626726, ccData: 24423 }, - { type: 3, pts: 6766629729, ccData: 16930 }, - { type: 2, pts: 6766629729, ccData: 24941 }, - { type: 3, pts: 6766632732, ccData: 33314 }, - { type: 2, pts: 6766632732, ccData: 25895 }, - { type: 3, pts: 6766635735, ccData: 49698 }, - { type: 2, pts: 6766635735, ccData: 29440 }, - { type: 3, pts: 6766638738, ccData: 2609 }, - { type: 2, pts: 6766638738, ccData: 38939 }, - { type: 2, pts: 6766638738, ccData: 16640 }, - { type: 2, pts: 6766638738, ccData: 287 }, - { type: 2, pts: 6766638738, ccData: 4240 }, - { type: 2, pts: 6766638738, ccData: 1283 }, - { type: 2, pts: 6766638738, ccData: 37162 }, - { type: 2, pts: 6766638738, ccData: 0 }, - { type: 2, pts: 6766638738, ccData: 37377 }, - { type: 2, pts: 6766638738, ccData: 2048 }, - { type: 3, pts: 6766644744, ccData: 16930 }, - { type: 2, pts: 6766644744, ccData: 24930 }, - { type: 3, pts: 6766647747, ccData: 33314 }, - { type: 2, pts: 6766647747, ccData: 28533 }, - { type: 3, pts: 6766650750, ccData: 49698 }, - { type: 2, pts: 6766650750, ccData: 29791 }, - { type: 3, pts: 6766653753, ccData: 546 }, - { type: 2, pts: 6766653753, ccData: 29807 }, - { type: 3, pts: 6766656756, ccData: 16930 }, - { type: 2, pts: 6766656756, ccData: 24435 }, - { type: 3, pts: 6766659759, ccData: 33314 }, - { type: 2, pts: 6766659759, ccData: 29793 }, - { type: 3, pts: 6766662762, ccData: 49698 }, - { type: 2, pts: 6766662762, ccData: 29300 }, - { type: 3, pts: 6766665765, ccData: 546 }, - { type: 2, pts: 6766665765, ccData: 11776 }, - { type: 3, pts: 6766668768, ccData: 16930 }, - { type: 2, pts: 6766668768, ccData: 35842 }, - { type: 3, pts: 6766674774, ccData: 33314 }, - { type: 2, pts: 6766674774, ccData: 35073 }, - { type: 3, pts: 6766785885, ccData: 51761 }, - { type: 2, pts: 6766785885, ccData: 39195 }, - { type: 2, pts: 6766785885, ccData: 17920 }, - { type: 2, pts: 6766785885, ccData: 31 }, - { type: 2, pts: 6766785885, ccData: 5264 }, - { type: 2, pts: 6766785885, ccData: 1283 }, - { type: 2, pts: 6766785885, ccData: 37162 }, - { type: 2, pts: 6766785885, ccData: 42 }, - { type: 2, pts: 6766785885, ccData: 37376 }, - { type: 2, pts: 6766785885, ccData: 1024 }, - { type: 3, pts: 6766791891, ccData: 803 }, - { type: 2, pts: 6766791891, ccData: 37376 }, - { type: 2, pts: 6766791891, ccData: 1536 }, - { type: 3, pts: 6766797897, ccData: 16930 }, - { type: 2, pts: 6766797897, ccData: 22373 }, - { type: 3, pts: 6766800900, ccData: 33314 }, - { type: 2, pts: 6766800900, ccData: 24418 }, - { type: 3, pts: 6766803903, ccData: 49698 }, - { type: 2, pts: 6766803903, ccData: 25972 }, - { type: 3, pts: 6766806906, ccData: 546 }, - { type: 2, pts: 6766806906, ccData: 29797 }, - { type: 3, pts: 6766809909, ccData: 16930 }, - { type: 2, pts: 6766809909, ccData: 29279 }, - { type: 3, pts: 6766812912, ccData: 33314 }, - { type: 2, pts: 6766812912, ccData: 26469 }, - { type: 3, pts: 6766815915, ccData: 49698 }, - { type: 2, pts: 6766815915, ccData: 29791 }, - { type: 3, pts: 6766818918, ccData: 546 }, - { type: 2, pts: 6766818918, ccData: 26479 }, - { type: 3, pts: 6766821921, ccData: 16930 }, - { type: 2, pts: 6766821921, ccData: 26990 }, - { type: 3, pts: 6766824924, ccData: 33314 }, - { type: 2, pts: 6766824924, ccData: 26414 }, - { type: 3, pts: 6766827927, ccData: 49698 }, - { type: 2, pts: 6766827927, ccData: 35841 }, - { type: 3, pts: 6766833933, ccData: 546 }, - { type: 2, pts: 6766833933, ccData: 35074 }, - { type: 3, pts: 6766912011, ccData: 18993 }, - { type: 2, pts: 6766912011, ccData: 38939 }, - { type: 2, pts: 6766912011, ccData: 17920 }, - { type: 2, pts: 6766912011, ccData: 31 }, - { type: 2, pts: 6766912011, ccData: 5264 }, - { type: 2, pts: 6766912011, ccData: 1283 }, - { type: 2, pts: 6766912011, ccData: 37162 }, - { type: 2, pts: 6766912011, ccData: 42 }, - { type: 2, pts: 6766912011, ccData: 37376 }, - { type: 2, pts: 6766912011, ccData: 3072 }, - { type: 3, pts: 6766918017, ccData: 33314 }, - { type: 2, pts: 6766918017, ccData: 17263 }, - { type: 3, pts: 6766921020, ccData: 49698 }, - { type: 2, pts: 6766921020, ccData: 28005 }, - { type: 3, pts: 6766924023, ccData: 546 }, - { type: 2, pts: 6766924023, ccData: 24431 }, - { type: 3, pts: 6766927026, ccData: 16930 }, - { type: 2, pts: 6766927026, ccData: 28193 }, - { type: 3, pts: 6766930029, ccData: 33314 }, - { type: 2, pts: 6766930029, ccData: 35842 }, - { type: 3, pts: 6766936035, ccData: 49698 }, - { type: 2, pts: 6766936035, ccData: 35073 }, - { type: 3, pts: 6767020119, ccData: 546 }, - { type: 2, pts: 6767020119, ccData: 35841 }, - { type: 3, pts: 6767185284, ccData: 18993 }, - { type: 2, pts: 6767185284, ccData: 38939 }, - { type: 2, pts: 6767185284, ccData: 17920 }, - { type: 2, pts: 6767185284, ccData: 31 }, - { type: 2, pts: 6767185284, ccData: 5264 }, - { type: 2, pts: 6767185284, ccData: 1283 }, - { type: 2, pts: 6767185284, ccData: 37162 }, - { type: 2, pts: 6767185284, ccData: 0 }, - { type: 2, pts: 6767185284, ccData: 37376 }, - { type: 2, pts: 6767185284, ccData: 1024 }, - { type: 3, pts: 6767191290, ccData: 33571 }, - { type: 2, pts: 6767191290, ccData: 37376 }, - { type: 2, pts: 6767191290, ccData: 1792 }, - { type: 3, pts: 6767197296, ccData: 49698 }, - { type: 2, pts: 6767197296, ccData: 10352 }, - { type: 3, pts: 6767200299, ccData: 546 }, - { type: 2, pts: 6767200299, ccData: 24946 }, - { type: 3, pts: 6767203302, ccData: 16930 }, - { type: 2, pts: 6767203302, ccData: 25966 }, - { type: 3, pts: 6767206305, ccData: 33314 }, - { type: 2, pts: 6767206305, ccData: 29811 }, - { type: 3, pts: 6767209308, ccData: 49698 }, - { type: 2, pts: 6767209308, ccData: 24419 }, - { type: 3, pts: 6767212311, ccData: 546 }, - { type: 2, pts: 6767212311, ccData: 26725 }, - { type: 3, pts: 6767215314, ccData: 16930 }, - { type: 2, pts: 6767215314, ccData: 25970 }, - { type: 3, pts: 6767218317, ccData: 33314 }, - { type: 2, pts: 6767218317, ccData: 26990 }, - { type: 3, pts: 6767221320, ccData: 49698 }, - { type: 2, pts: 6767221320, ccData: 26409 }, - { type: 3, pts: 6767230329, ccData: 546 }, - { type: 2, pts: 6767230329, ccData: 35073 }, - { type: 3, pts: 6767404503, ccData: 18993 }, - { type: 2, pts: 6767404503, ccData: 39195 }, - { type: 2, pts: 6767404503, ccData: 16640 }, - { type: 2, pts: 6767404503, ccData: 31 }, - { type: 2, pts: 6767404503, ccData: 5264 }, - { type: 2, pts: 6767404503, ccData: 1283 }, - { type: 2, pts: 6767404503, ccData: 37162 }, - { type: 2, pts: 6767404503, ccData: 42 }, - { type: 2, pts: 6767404503, ccData: 37376 }, - { type: 2, pts: 6767404503, ccData: 6144 }, - { type: 3, pts: 6767410509, ccData: 33314 }, - { type: 2, pts: 6767410509, ccData: 19305 }, - { type: 3, pts: 6767413512, ccData: 49698 }, - { type: 2, pts: 6767413512, ccData: 25451 }, - { type: 3, pts: 6767416515, ccData: 546 }, - { type: 2, pts: 6767416515, ccData: 24425 }, - { type: 3, pts: 6767419518, ccData: 16930 }, - { type: 2, pts: 6767419518, ccData: 29740 }, - { type: 3, pts: 6767422521, ccData: 35377 }, - { type: 2, pts: 6767422521, ccData: 39195 }, - { type: 2, pts: 6767422521, ccData: 16640 }, - { type: 2, pts: 6767422521, ccData: 287 }, - { type: 2, pts: 6767422521, ccData: 4240 }, - { type: 2, pts: 6767422521, ccData: 1283 }, - { type: 2, pts: 6767422521, ccData: 37162 }, - { type: 2, pts: 6767422521, ccData: 0 }, - { type: 2, pts: 6767422521, ccData: 37377 }, - { type: 2, pts: 6767422521, ccData: 4096 }, - { type: 3, pts: 6767428527, ccData: 49955 }, - { type: 2, pts: 6767428527, ccData: 37377 }, - { type: 2, pts: 6767428527, ccData: 4864 }, - { type: 3, pts: 6767434533, ccData: 546 }, - { type: 2, pts: 6767434533, ccData: 20585 }, - { type: 3, pts: 6767437536, ccData: 16930 }, - { type: 2, pts: 6767437536, ccData: 28267 }, - { type: 3, pts: 6767440539, ccData: 33314 }, - { type: 2, pts: 6767440539, ccData: 24940 }, - { type: 3, pts: 6767443542, ccData: 49698 }, - { type: 2, pts: 6767443542, ccData: 26979 }, - { type: 3, pts: 6767446545, ccData: 546 }, - { type: 2, pts: 6767446545, ccData: 26991 }, - { type: 3, pts: 6767449548, ccData: 16930 }, - { type: 2, pts: 6767449548, ccData: 30067 }, - { type: 3, pts: 6767452551, ccData: 33314 }, - { type: 2, pts: 6767452551, ccData: 8448 }, - { type: 3, pts: 6767455554, ccData: 49698 }, - { type: 2, pts: 6767455554, ccData: 35841 }, - { type: 3, pts: 6767461560, ccData: 546 }, - { type: 2, pts: 6767461560, ccData: 35074 }, - { type: 3, pts: 6767629728, ccData: 18993 }, - { type: 2, pts: 6767629728, ccData: 38939 }, - { type: 2, pts: 6767629728, ccData: 17920 }, - { type: 2, pts: 6767629728, ccData: 31 }, - { type: 2, pts: 6767629728, ccData: 5264 }, - { type: 2, pts: 6767629728, ccData: 1283 }, - { type: 2, pts: 6767629728, ccData: 37162 }, - { type: 2, pts: 6767629728, ccData: 42 }, - { type: 2, pts: 6767629728, ccData: 37376 }, - { type: 2, pts: 6767629728, ccData: 2048 }, - { type: 3, pts: 6767635734, ccData: 33571 }, - { type: 2, pts: 6767635734, ccData: 37376 }, - { type: 2, pts: 6767635734, ccData: 2304 }, - { type: 3, pts: 6767641740, ccData: 49698 }, - { type: 2, pts: 6767641740, ccData: 16750 }, - { type: 3, pts: 6767644743, ccData: 546 }, - { type: 2, pts: 6767644743, ccData: 25695 }, - { type: 3, pts: 6767647746, ccData: 16930 }, - { type: 2, pts: 6767647746, ccData: 28265 }, - { type: 3, pts: 6767650749, ccData: 33314 }, - { type: 2, pts: 6767650749, ccData: 25445 }, - { type: 3, pts: 6767653752, ccData: 49698 }, - { type: 2, pts: 6767653752, ccData: 24424 }, - { type: 3, pts: 6767656755, ccData: 546 }, - { type: 2, pts: 6767656755, ccData: 24937 }, - { type: 3, pts: 6767659758, ccData: 16930 }, - { type: 2, pts: 6767659758, ccData: 29230 }, - { type: 3, pts: 6767662761, ccData: 33314 }, - { type: 2, pts: 6767662761, ccData: 35842 }, - { type: 3, pts: 6767668767, ccData: 49698 }, - { type: 2, pts: 6767668767, ccData: 35073 }, - { type: 3, pts: 6767791890, ccData: 2609 }, - { type: 2, pts: 6767791890, ccData: 39195 }, - { type: 2, pts: 6767791890, ccData: 17920 }, - { type: 2, pts: 6767791890, ccData: 31 }, - { type: 2, pts: 6767791890, ccData: 5264 }, - { type: 2, pts: 6767791890, ccData: 1283 }, - { type: 2, pts: 6767791890, ccData: 37162 }, - { type: 2, pts: 6767791890, ccData: 42 }, - { type: 2, pts: 6767791890, ccData: 37376 }, - { type: 2, pts: 6767791890, ccData: 1024 }, - { type: 3, pts: 6767797896, ccData: 17187 }, - { type: 2, pts: 6767797896, ccData: 37376 }, - { type: 2, pts: 6767797896, ccData: 1280 }, - { type: 3, pts: 6767803902, ccData: 33314 }, - { type: 2, pts: 6767803902, ccData: 21608 }, - { type: 3, pts: 6767806905, ccData: 49698 }, - { type: 2, pts: 6767806905, ccData: 24942 }, - { type: 3, pts: 6767809908, ccData: 546 }, - { type: 2, pts: 6767809908, ccData: 27507 }, - { type: 3, pts: 6767812911, ccData: 16930 }, - { type: 2, pts: 6767812911, ccData: 8448 }, - { type: 3, pts: 6767815914, ccData: 33314 }, - { type: 2, pts: 6767815914, ccData: 35841 }, - { type: 3, pts: 6767821920, ccData: 49698 }, - { type: 2, pts: 6767821920, ccData: 35074 }, - { type: 3, pts: 6767903001, ccData: 2609 }, - { type: 2, pts: 6767903001, ccData: 38939 }, - { type: 2, pts: 6767903001, ccData: 17920 }, - { type: 2, pts: 6767903001, ccData: 31 }, - { type: 2, pts: 6767903001, ccData: 5264 }, - { type: 2, pts: 6767903001, ccData: 1283 }, - { type: 2, pts: 6767903001, ccData: 37162 }, - { type: 2, pts: 6767903001, ccData: 42 }, - { type: 2, pts: 6767903001, ccData: 37376 }, - { type: 2, pts: 6767903001, ccData: 1024 }, - { type: 3, pts: 6767909007, ccData: 16930 }, - { type: 2, pts: 6767909007, ccData: 18287 }, - { type: 3, pts: 6767912010, ccData: 33314 }, - { type: 2, pts: 6767912010, ccData: 24400 }, - { type: 3, pts: 6767915013, ccData: 49698 }, - { type: 2, pts: 6767915013, ccData: 26990 }, - { type: 3, pts: 6767918016, ccData: 546 }, - { type: 2, pts: 6767918016, ccData: 27489 }, - { type: 3, pts: 6767921019, ccData: 16930 }, - { type: 2, pts: 6767921019, ccData: 27753 }, - { type: 3, pts: 6767924022, ccData: 33314 }, - { type: 2, pts: 6767924022, ccData: 25449 }, - { type: 3, pts: 6767927025, ccData: 49698 }, - { type: 2, pts: 6767927025, ccData: 28533 }, - { type: 3, pts: 6767930028, ccData: 546 }, - { type: 2, pts: 6767930028, ccData: 29484 }, - { type: 3, pts: 6767933031, ccData: 16930 }, - { type: 2, pts: 6767933031, ccData: 24423 }, - { type: 3, pts: 6767936034, ccData: 33314 }, - { type: 2, pts: 6767936034, ccData: 28460 }, - { type: 3, pts: 6767939037, ccData: 49698 }, - { type: 2, pts: 6767939037, ccData: 24423 }, - { type: 3, pts: 6767942040, ccData: 546 }, - { type: 2, pts: 6767942040, ccData: 28449 }, - { type: 3, pts: 6767945043, ccData: 16930 }, - { type: 2, pts: 6767945043, ccData: 35842 }, - { type: 3, pts: 6767951049, ccData: 33314 }, - { type: 2, pts: 6767951049, ccData: 35073 }, - { type: 3, pts: 6768104202, ccData: 51761 }, - { type: 2, pts: 6768104202, ccData: 39195 }, - { type: 2, pts: 6768104202, ccData: 17920 }, - { type: 2, pts: 6768104202, ccData: 31 }, - { type: 2, pts: 6768104202, ccData: 5264 }, - { type: 2, pts: 6768104202, ccData: 1283 }, - { type: 2, pts: 6768104202, ccData: 37162 }, - { type: 2, pts: 6768104202, ccData: 42 }, - { type: 2, pts: 6768104202, ccData: 37376 }, - { type: 2, pts: 6768104202, ccData: 2048 }, - { type: 3, pts: 6768110208, ccData: 803 }, - { type: 2, pts: 6768110208, ccData: 37376 }, - { type: 2, pts: 6768110208, ccData: 2816 }, - { type: 3, pts: 6768116214, ccData: 16930 }, - { type: 2, pts: 6768116214, ccData: 10339 }, - { type: 3, pts: 6768119217, ccData: 33314 }, - { type: 2, pts: 6768119217, ccData: 26725 }, - { type: 3, pts: 6768122220, ccData: 49698 }, - { type: 2, pts: 6768122220, ccData: 25970 }, - { type: 3, pts: 6768125223, ccData: 546 }, - { type: 2, pts: 6768125223, ccData: 26990 }, - { type: 3, pts: 6768128226, ccData: 16930 }, - { type: 2, pts: 6768128226, ccData: 26409 }, - { type: 3, pts: 6768131229, ccData: 33314 }, - { type: 2, pts: 6768131229, ccData: 35841 }, - { type: 3, pts: 6768137235, ccData: 49698 }, - { type: 2, pts: 6768137235, ccData: 35074 }, - { type: 3, pts: 6768272370, ccData: 546 }, - { type: 2, pts: 6768272370, ccData: 35842 }, - { type: 3, pts: 6768446544, ccData: 18993 }, - { type: 2, pts: 6768446544, ccData: 38939 }, - { type: 2, pts: 6768446544, ccData: 0 }, - { type: 2, pts: 6768446544, ccData: 31 }, - { type: 2, pts: 6768446544, ccData: 5264 }, - { type: 2, pts: 6768446544, ccData: 1283 }, - { type: 2, pts: 6768446544, ccData: 37162 }, - { type: 2, pts: 6768446544, ccData: 42 }, - { type: 2, pts: 6768446544, ccData: 37376 }, - { type: 2, pts: 6768446544, ccData: 1024 }, - { type: 3, pts: 6768449547, ccData: 33314 }, - { type: 2, pts: 6768449547, ccData: 18783 }, - { type: 3, pts: 6768452550, ccData: 49698 }, - { type: 2, pts: 6768452550, ccData: 26479 }, - { type: 3, pts: 6768455553, ccData: 546 }, - { type: 2, pts: 6768455553, ccData: 29791 }, - { type: 3, pts: 6768458556, ccData: 16930 }, - { type: 2, pts: 6768458556, ccData: 26996 }, - { type: 3, pts: 6768461559, ccData: 33314 }, - { type: 2, pts: 6768461559, ccData: 8448 }, - { type: 3, pts: 6768470568, ccData: 49698 }, - { type: 2, pts: 6768470568, ccData: 35073 }, - { type: 3, pts: 6768566664, ccData: 546 }, - { type: 2, pts: 6768566664, ccData: 35841 }, - { type: 3, pts: 6768674772, ccData: 18993 }, - { type: 2, pts: 6768674772, ccData: 38939 }, - { type: 2, pts: 6768674772, ccData: 17920 }, - { type: 2, pts: 6768674772, ccData: 31 }, - { type: 2, pts: 6768674772, ccData: 5264 }, - { type: 2, pts: 6768674772, ccData: 1283 }, - { type: 2, pts: 6768674772, ccData: 37162 }, - { type: 2, pts: 6768674772, ccData: 0 }, - { type: 2, pts: 6768674772, ccData: 37376 }, - { type: 2, pts: 6768674772, ccData: 3072 }, - { type: 3, pts: 6768680778, ccData: 33571 }, - { type: 2, pts: 6768680778, ccData: 37376 }, - { type: 2, pts: 6768680778, ccData: 3584 }, - { type: 3, pts: 6768686784, ccData: 49698 }, - { type: 2, pts: 6768686784, ccData: 20079 }, - { type: 3, pts: 6768689787, ccData: 546 }, - { type: 2, pts: 6768689787, ccData: 8448 }, - { type: 3, pts: 6768698796, ccData: 16930 }, - { type: 2, pts: 6768698796, ccData: 35073 }, - { type: 3, pts: 6768833931, ccData: 35377 }, - { type: 2, pts: 6768833931, ccData: 39195 }, - { type: 2, pts: 6768833931, ccData: 17920 }, - { type: 2, pts: 6768833931, ccData: 31 }, - { type: 2, pts: 6768833931, ccData: 5264 }, - { type: 2, pts: 6768833931, ccData: 1283 }, - { type: 2, pts: 6768833931, ccData: 37162 }, - { type: 2, pts: 6768833931, ccData: 42 }, - { type: 2, pts: 6768833931, ccData: 37376 }, - { type: 2, pts: 6768833931, ccData: 3072 }, - { type: 3, pts: 6768839937, ccData: 49955 }, - { type: 2, pts: 6768839937, ccData: 37376 }, - { type: 2, pts: 6768839937, ccData: 3328 }, - { type: 3, pts: 6768845943, ccData: 546 }, - { type: 2, pts: 6768845943, ccData: 21864 }, - { type: 3, pts: 6768848946, ccData: 16930 }, - { type: 2, pts: 6768848946, ccData: 11631 }, - { type: 3, pts: 6768851949, ccData: 33314 }, - { type: 2, pts: 6768851949, ccData: 26657 }, - { type: 3, pts: 6768854952, ccData: 49698 }, - { type: 2, pts: 6768854952, ccData: 35841 }, - { type: 3, pts: 6768860958, ccData: 546 }, - { type: 2, pts: 6768860958, ccData: 35074 }, - { type: 3, pts: 6768936033, ccData: 18993 }, - { type: 2, pts: 6768936033, ccData: 38939 }, - { type: 2, pts: 6768936033, ccData: 17920 }, - { type: 2, pts: 6768936033, ccData: 31 }, - { type: 2, pts: 6768936033, ccData: 5264 }, - { type: 2, pts: 6768936033, ccData: 1283 }, - { type: 2, pts: 6768936033, ccData: 37162 }, - { type: 2, pts: 6768936033, ccData: 42 }, - { type: 2, pts: 6768936033, ccData: 37376 }, - { type: 2, pts: 6768936033, ccData: 5120 }, - { type: 3, pts: 6768942039, ccData: 33571 }, - { type: 2, pts: 6768942039, ccData: 37376 }, - { type: 2, pts: 6768942039, ccData: 5632 }, - { type: 3, pts: 6768948045, ccData: 49698 }, - { type: 2, pts: 6768948045, ccData: 20328 }, - { type: 3, pts: 6768951048, ccData: 546 }, - { type: 2, pts: 6768951048, ccData: 11359 }, - { type: 3, pts: 6768954051, ccData: 16930 }, - { type: 2, pts: 6768954051, ccData: 28271 }, - { type: 3, pts: 6768957054, ccData: 33314 }, - { type: 2, pts: 6768957054, ccData: 8448 }, - { type: 3, pts: 6768960057, ccData: 49698 }, - { type: 2, pts: 6768960057, ccData: 35842 }, - { type: 3, pts: 6768966063, ccData: 546 }, - { type: 2, pts: 6768966063, ccData: 35073 }, - { type: 3, pts: 6769050147, ccData: 16930 }, - { type: 2, pts: 6769050147, ccData: 35841 }, - { type: 3, pts: 6769083180, ccData: 35377 }, - { type: 2, pts: 6769083180, ccData: 38939 }, - { type: 2, pts: 6769083180, ccData: 17920 }, - { type: 2, pts: 6769083180, ccData: 31 }, - { type: 2, pts: 6769083180, ccData: 5264 }, - { type: 2, pts: 6769083180, ccData: 1283 }, - { type: 2, pts: 6769083180, ccData: 37162 }, - { type: 2, pts: 6769083180, ccData: 0 }, - { type: 2, pts: 6769083180, ccData: 37376 }, - { type: 2, pts: 6769083180, ccData: 3072 }, - { type: 3, pts: 6769089186, ccData: 49698 }, - { type: 2, pts: 6769089186, ccData: 10343 }, - { type: 3, pts: 6769092189, ccData: 546 }, - { type: 2, pts: 6769092189, ccData: 29295 }, - { type: 3, pts: 6769095192, ccData: 16930 }, - { type: 2, pts: 6769095192, ccData: 24942 }, - { type: 3, pts: 6769098195, ccData: 33314 }, - { type: 2, pts: 6769098195, ccData: 29481 }, - { type: 3, pts: 6769107204, ccData: 49698 }, - { type: 2, pts: 6769107204, ccData: 35073 }, - { type: 3, pts: 6769167264, ccData: 2609 }, - { type: 2, pts: 6769167264, ccData: 39195 }, - { type: 2, pts: 6769167264, ccData: 16640 }, - { type: 2, pts: 6769167264, ccData: 31 }, - { type: 2, pts: 6769167264, ccData: 5264 }, - { type: 2, pts: 6769167264, ccData: 1283 }, - { type: 2, pts: 6769167264, ccData: 37162 }, - { type: 2, pts: 6769167264, ccData: 42 }, - { type: 2, pts: 6769167264, ccData: 37376 }, - { type: 2, pts: 6769167264, ccData: 0 }, - { type: 3, pts: 6769173270, ccData: 16930 }, - { type: 2, pts: 6769173270, ccData: 16716 }, - { type: 3, pts: 6769176273, ccData: 33314 }, - { type: 2, pts: 6769176273, ccData: 19514 }, - { type: 3, pts: 6769179276, ccData: 51761 }, - { type: 2, pts: 6769179276, ccData: 39195 }, - { type: 2, pts: 6769179276, ccData: 16640 }, - { type: 2, pts: 6769179276, ccData: 287 }, - { type: 2, pts: 6769179276, ccData: 4240 }, - { type: 2, pts: 6769179276, ccData: 1283 }, - { type: 2, pts: 6769179276, ccData: 37162 }, - { type: 2, pts: 6769179276, ccData: 0 }, - { type: 2, pts: 6769179276, ccData: 37377 }, - { type: 2, pts: 6769179276, ccData: 0 }, - { type: 3, pts: 6769185282, ccData: 546 }, - { type: 2, pts: 6769185282, ccData: 20328 }, - { type: 3, pts: 6769188285, ccData: 16930 }, - { type: 2, pts: 6769188285, ccData: 8448 }, - { type: 3, pts: 6769191288, ccData: 33314 }, - { type: 2, pts: 6769191288, ccData: 35841 }, - { type: 3, pts: 6769197294, ccData: 49698 }, - { type: 2, pts: 6769197294, ccData: 35074 }, - { type: 3, pts: 6769242339, ccData: 2609 }, - { type: 2, pts: 6769242339, ccData: 38939 }, - { type: 2, pts: 6769242339, ccData: 17920 }, - { type: 2, pts: 6769242339, ccData: 31 }, - { type: 2, pts: 6769242339, ccData: 5264 }, - { type: 2, pts: 6769242339, ccData: 1283 }, - { type: 2, pts: 6769242339, ccData: 37162 }, - { type: 2, pts: 6769242339, ccData: 42 }, - { type: 2, pts: 6769242339, ccData: 37376 }, - { type: 2, pts: 6769242339, ccData: 3072 }, - { type: 3, pts: 6769248345, ccData: 17187 }, - { type: 2, pts: 6769248345, ccData: 37376 }, - { type: 2, pts: 6769248345, ccData: 3840 }, - { type: 3, pts: 6769254351, ccData: 33314 }, - { type: 2, pts: 6769254351, ccData: 10359 }, - { type: 3, pts: 6769257354, ccData: 49698 }, - { type: 2, pts: 6769257354, ccData: 26729 }, - { type: 3, pts: 6769260357, ccData: 546 }, - { type: 2, pts: 6769260357, ccData: 29556 }, - { type: 3, pts: 6769263360, ccData: 16930 }, - { type: 2, pts: 6769263360, ccData: 27749 }, - { type: 3, pts: 6769266363, ccData: 33314 }, - { type: 2, pts: 6769266363, ccData: 24418 }, - { type: 3, pts: 6769269366, ccData: 49698 }, - { type: 2, pts: 6769269366, ccData: 27759 }, - { type: 3, pts: 6769272369, ccData: 546 }, - { type: 2, pts: 6769272369, ccData: 30569 }, - { type: 3, pts: 6769275372, ccData: 16930 }, - { type: 2, pts: 6769275372, ccData: 28263 }, - { type: 3, pts: 6769278375, ccData: 33314 }, - { type: 2, pts: 6769278375, ccData: 10496 }, - { type: 3, pts: 6769281378, ccData: 49698 }, - { type: 2, pts: 6769281378, ccData: 35842 }, - { type: 3, pts: 6769287384, ccData: 546 }, - { type: 2, pts: 6769287384, ccData: 35073 }, - { type: 3, pts: 6769353450, ccData: 18993 }, - { type: 2, pts: 6769353450, ccData: 39195 }, - { type: 2, pts: 6769353450, ccData: 17920 }, - { type: 2, pts: 6769353450, ccData: 31 }, - { type: 2, pts: 6769353450, ccData: 5264 }, - { type: 2, pts: 6769353450, ccData: 1283 }, - { type: 2, pts: 6769353450, ccData: 37162 }, - { type: 2, pts: 6769353450, ccData: 42 }, - { type: 2, pts: 6769353450, ccData: 37376 }, - { type: 2, pts: 6769353450, ccData: 3072 }, - { type: 3, pts: 6769359456, ccData: 33571 }, - { type: 2, pts: 6769359456, ccData: 37376 }, - { type: 2, pts: 6769359456, ccData: 3584 }, - { type: 3, pts: 6769365462, ccData: 49698 }, - { type: 2, pts: 6769365462, ccData: 20335 }, - { type: 3, pts: 6769368465, ccData: 546 }, - { type: 2, pts: 6769368465, ccData: 26670 }, - { type: 3, pts: 6769371468, ccData: 16930 }, - { type: 2, pts: 6769371468, ccData: 35841 }, - { type: 3, pts: 6769377474, ccData: 33314 }, - { type: 2, pts: 6769377474, ccData: 35074 }, - { type: 3, pts: 6769413510, ccData: 51761 }, - { type: 2, pts: 6769413510, ccData: 38939 }, - { type: 2, pts: 6769413510, ccData: 16640 }, - { type: 2, pts: 6769413510, ccData: 31 }, - { type: 2, pts: 6769413510, ccData: 5264 }, - { type: 2, pts: 6769413510, ccData: 1283 }, - { type: 2, pts: 6769413510, ccData: 37162 }, - { type: 2, pts: 6769413510, ccData: 42 }, - { type: 2, pts: 6769413510, ccData: 37376 }, - { type: 2, pts: 6769413510, ccData: 2048 }, - { type: 3, pts: 6769419516, ccData: 803 }, - { type: 2, pts: 6769419516, ccData: 37376 }, - { type: 2, pts: 6769419516, ccData: 2304 }, - { type: 3, pts: 6769425522, ccData: 16930 }, - { type: 2, pts: 6769425522, ccData: 20585 }, - { type: 3, pts: 6769428525, ccData: 33314 }, - { type: 2, pts: 6769428525, ccData: 28267 }, - { type: 3, pts: 6769431528, ccData: 49698 }, - { type: 2, pts: 6769431528, ccData: 24940 }, - { type: 3, pts: 6769434531, ccData: 546 }, - { type: 2, pts: 6769434531, ccData: 26979 }, - { type: 3, pts: 6769437534, ccData: 16930 }, - { type: 2, pts: 6769437534, ccData: 26991 }, - { type: 3, pts: 6769440537, ccData: 33314 }, - { type: 2, pts: 6769440537, ccData: 30067 }, - { type: 3, pts: 6769443540, ccData: 49698 }, - { type: 2, pts: 6769443540, ccData: 11264 }, - { type: 3, pts: 6769446543, ccData: 2609 }, - { type: 2, pts: 6769446543, ccData: 38939 }, - { type: 2, pts: 6769446543, ccData: 16640 }, - { type: 2, pts: 6769446543, ccData: 287 }, - { type: 2, pts: 6769446543, ccData: 4240 }, - { type: 2, pts: 6769446543, ccData: 1283 }, - { type: 2, pts: 6769446543, ccData: 37162 }, - { type: 2, pts: 6769446543, ccData: 0 }, - { type: 2, pts: 6769446543, ccData: 37377 }, - { type: 2, pts: 6769446543, ccData: 2048 }, - { type: 3, pts: 6769452549, ccData: 17187 }, - { type: 2, pts: 6769452549, ccData: 37377 }, - { type: 2, pts: 6769452549, ccData: 2304 }, - { type: 3, pts: 6769458555, ccData: 33314 }, - { type: 2, pts: 6769458555, ccData: 24946 }, - { type: 3, pts: 6769461558, ccData: 49698 }, - { type: 2, pts: 6769461558, ccData: 25951 }, - { type: 3, pts: 6769464561, ccData: 546 }, - { type: 2, pts: 6769464561, ccData: 31087 }, - { type: 3, pts: 6769467564, ccData: 16930 }, - { type: 2, pts: 6769467564, ccData: 30047 }, - { type: 3, pts: 6769470567, ccData: 33314 }, - { type: 2, pts: 6769470567, ccData: 28523 }, - { type: 3, pts: 6769473570, ccData: 49698 }, - { type: 2, pts: 6769473570, ccData: 24953 }, - { type: 3, pts: 6769476573, ccData: 546 }, - { type: 2, pts: 6769476573, ccData: 16128 }, - { type: 3, pts: 6769479576, ccData: 16930 }, - { type: 2, pts: 6769479576, ccData: 35842 }, - { type: 3, pts: 6769485582, ccData: 33314 }, - { type: 2, pts: 6769485582, ccData: 35073 }, - { type: 3, pts: 6769752849, ccData: 49698 }, - { type: 2, pts: 6769752849, ccData: 35841 }, - { type: 3, pts: 6769930026, ccData: 2609 }, - { type: 2, pts: 6769930026, ccData: 38939 }, - { type: 2, pts: 6769930026, ccData: 16640 }, - { type: 2, pts: 6769930026, ccData: 31 }, - { type: 2, pts: 6769930026, ccData: 5264 }, - { type: 2, pts: 6769930026, ccData: 1283 }, - { type: 2, pts: 6769930026, ccData: 37162 }, - { type: 2, pts: 6769930026, ccData: 0 }, - { type: 2, pts: 6769930026, ccData: 37376 }, - { type: 2, pts: 6769930026, ccData: 6144 }, - { type: 3, pts: 6769936032, ccData: 17187 }, - { type: 2, pts: 6769936032, ccData: 37376 }, - { type: 2, pts: 6769936032, ccData: 6656 }, - { type: 3, pts: 6769942038, ccData: 33314 }, - { type: 2, pts: 6769942038, ccData: 21359 }, - { type: 3, pts: 6769945041, ccData: 49698 }, - { type: 2, pts: 6769945041, ccData: 29298 }, - { type: 3, pts: 6769948044, ccData: 546 }, - { type: 2, pts: 6769948044, ccData: 31020 }, - { type: 3, pts: 6769951047, ccData: 18993 }, - { type: 2, pts: 6769951047, ccData: 38939 }, - { type: 2, pts: 6769951047, ccData: 16640 }, - { type: 2, pts: 6769951047, ccData: 287 }, - { type: 2, pts: 6769951047, ccData: 4240 }, - { type: 2, pts: 6769951047, ccData: 1283 }, - { type: 2, pts: 6769951047, ccData: 37162 }, - { type: 2, pts: 6769951047, ccData: 0 }, - { type: 2, pts: 6769951047, ccData: 37377 }, - { type: 2, pts: 6769951047, ccData: 4096 }, - { type: 3, pts: 6769957053, ccData: 33571 }, - { type: 2, pts: 6769957053, ccData: 37377 }, - { type: 2, pts: 6769957053, ccData: 4864 }, - { type: 3, pts: 6769963059, ccData: 49698 }, - { type: 2, pts: 6769963059, ccData: 18783 }, - { type: 3, pts: 6769966062, ccData: 546 }, - { type: 2, pts: 6769966062, ccData: 26721 }, - { type: 3, pts: 6769969065, ccData: 16930 }, - { type: 2, pts: 6769969065, ccData: 30309 }, - { type: 3, pts: 6769972068, ccData: 33314 }, - { type: 2, pts: 6769972068, ccData: 24436 }, - { type: 3, pts: 6769975071, ccData: 49698 }, - { type: 2, pts: 6769975071, ccData: 28511 }, - { type: 3, pts: 6769978074, ccData: 546 }, - { type: 2, pts: 6769978074, ccData: 26479 }, - { type: 3, pts: 6769981077, ccData: 16930 }, - { type: 2, pts: 6769981077, ccData: 11776 }, - { type: 3, pts: 6769990086, ccData: 33314 }, - { type: 2, pts: 6769990086, ccData: 35073 }, - { type: 3, pts: 6770113209, ccData: 51761 }, - { type: 2, pts: 6770113209, ccData: 39195 }, - { type: 2, pts: 6770113209, ccData: 16640 }, - { type: 2, pts: 6770113209, ccData: 31 }, - { type: 2, pts: 6770113209, ccData: 5264 }, - { type: 2, pts: 6770113209, ccData: 1283 }, - { type: 2, pts: 6770113209, ccData: 37162 }, - { type: 2, pts: 6770113209, ccData: 42 }, - { type: 2, pts: 6770113209, ccData: 37376 }, - { type: 2, pts: 6770113209, ccData: 1024 }, - { type: 3, pts: 6770119215, ccData: 546 }, - { type: 2, pts: 6770119215, ccData: 17013 }, - { type: 3, pts: 6770122218, ccData: 16930 }, - { type: 2, pts: 6770122218, ccData: 29791 }, - { type: 3, pts: 6770125221, ccData: 33314 }, - { type: 2, pts: 6770125221, ccData: 30565 }, - { type: 3, pts: 6770128224, ccData: 49698 }, - { type: 2, pts: 6770128224, ccData: 10098 }, - { type: 3, pts: 6770131227, ccData: 546 }, - { type: 2, pts: 6770131227, ccData: 25951 }, - { type: 3, pts: 6770134230, ccData: 16930 }, - { type: 2, pts: 6770134230, ccData: 26990 }, - { type: 3, pts: 6770137233, ccData: 33314 }, - { type: 2, pts: 6770137233, ccData: 24436 }, - { type: 3, pts: 6770140236, ccData: 49698 }, - { type: 2, pts: 6770140236, ccData: 26725 }, - { type: 3, pts: 6770143239, ccData: 546 }, - { type: 2, pts: 6770143239, ccData: 24429 }, - { type: 3, pts: 6770146242, ccData: 16930 }, - { type: 2, pts: 6770146242, ccData: 26980 }, - { type: 3, pts: 6770149245, ccData: 33314 }, - { type: 2, pts: 6770149245, ccData: 25708 }, - { type: 3, pts: 6770152248, ccData: 49698 }, - { type: 2, pts: 6770152248, ccData: 25856 }, - { type: 3, pts: 6770155251, ccData: 2609 }, - { type: 2, pts: 6770155251, ccData: 39195 }, - { type: 2, pts: 6770155251, ccData: 16640 }, - { type: 2, pts: 6770155251, ccData: 287 }, - { type: 2, pts: 6770155251, ccData: 4240 }, - { type: 2, pts: 6770155251, ccData: 1283 }, - { type: 2, pts: 6770155251, ccData: 37162 }, - { type: 2, pts: 6770155251, ccData: 0 }, - { type: 2, pts: 6770155251, ccData: 37377 }, - { type: 2, pts: 6770155251, ccData: 2048 }, - { type: 3, pts: 6770161257, ccData: 17187 }, - { type: 2, pts: 6770161257, ccData: 37377 }, - { type: 2, pts: 6770161257, ccData: 2816 }, - { type: 3, pts: 6770167263, ccData: 33314 }, - { type: 2, pts: 6770167263, ccData: 28518 }, - { type: 3, pts: 6770170266, ccData: 49698 }, - { type: 2, pts: 6770170266, ccData: 24417 }, - { type: 3, pts: 6770173269, ccData: 546 }, - { type: 2, pts: 6770173269, ccData: 24423 }, - { type: 3, pts: 6770176272, ccData: 16930 }, - { type: 2, pts: 6770176272, ccData: 24941 }, - { type: 3, pts: 6770179275, ccData: 33314 }, - { type: 2, pts: 6770179275, ccData: 25889 }, - { type: 3, pts: 6770182278, ccData: 49698 }, - { type: 2, pts: 6770182278, ccData: 35841 }, - { type: 3, pts: 6770188284, ccData: 546 }, - { type: 2, pts: 6770188284, ccData: 35074 }, - { type: 3, pts: 6770356452, ccData: 18993 }, - { type: 2, pts: 6770356452, ccData: 38939 }, - { type: 2, pts: 6770356452, ccData: 16640 }, - { type: 2, pts: 6770356452, ccData: 31 }, - { type: 2, pts: 6770356452, ccData: 5264 }, - { type: 2, pts: 6770356452, ccData: 1283 }, - { type: 2, pts: 6770356452, ccData: 37162 }, - { type: 2, pts: 6770356452, ccData: 42 }, - { type: 2, pts: 6770356452, ccData: 37376 }, - { type: 2, pts: 6770356452, ccData: 6144 }, - { type: 3, pts: 6770362458, ccData: 33571 }, - { type: 2, pts: 6770362458, ccData: 37376 }, - { type: 2, pts: 6770362458, ccData: 6400 }, - { type: 3, pts: 6770368464, ccData: 49698 }, - { type: 2, pts: 6770368464, ccData: 18783 }, - { type: 3, pts: 6770371467, ccData: 546 }, - { type: 2, pts: 6770371467, ccData: 27502 }, - { type: 3, pts: 6770374470, ccData: 16930 }, - { type: 2, pts: 6770374470, ccData: 28535 }, - { type: 3, pts: 6770377473, ccData: 33314 }, - { type: 2, pts: 6770377473, ccData: 11264 }, - { type: 3, pts: 6770380476, ccData: 51761 }, - { type: 2, pts: 6770380476, ccData: 38939 }, - { type: 2, pts: 6770380476, ccData: 16640 }, - { type: 2, pts: 6770380476, ccData: 287 }, - { type: 2, pts: 6770380476, ccData: 4240 }, - { type: 2, pts: 6770380476, ccData: 1283 }, - { type: 2, pts: 6770380476, ccData: 37162 }, - { type: 2, pts: 6770380476, ccData: 0 }, - { type: 2, pts: 6770380476, ccData: 37377 }, - { type: 2, pts: 6770380476, ccData: 5120 }, - { type: 3, pts: 6770386482, ccData: 803 }, - { type: 2, pts: 6770386482, ccData: 37377 }, - { type: 2, pts: 6770386482, ccData: 5632 }, - { type: 3, pts: 6770392488, ccData: 16930 }, - { type: 2, pts: 6770392488, ccData: 18727 }, - { type: 3, pts: 6770395491, ccData: 33314 }, - { type: 2, pts: 6770395491, ccData: 27999 }, - { type: 3, pts: 6770398494, ccData: 49698 }, - { type: 2, pts: 6770398494, ccData: 29551 }, - { type: 3, pts: 6770401497, ccData: 546 }, - { type: 2, pts: 6770401497, ccData: 29298 }, - { type: 3, pts: 6770404500, ccData: 16930 }, - { type: 2, pts: 6770404500, ccData: 31022 }, - { type: 3, pts: 6770407503, ccData: 33314 }, - { type: 2, pts: 6770407503, ccData: 35842 }, - { type: 3, pts: 6770413509, ccData: 49698 }, - { type: 2, pts: 6770413509, ccData: 35073 }, - { type: 3, pts: 6770452548, ccData: 2609 }, - { type: 2, pts: 6770452548, ccData: 39195 }, - { type: 2, pts: 6770452548, ccData: 16640 }, - { type: 2, pts: 6770452548, ccData: 31 }, - { type: 2, pts: 6770452548, ccData: 5264 }, - { type: 2, pts: 6770452548, ccData: 1283 }, - { type: 2, pts: 6770452548, ccData: 37162 }, - { type: 2, pts: 6770452548, ccData: 42 }, - { type: 2, pts: 6770452548, ccData: 37376 }, - { type: 2, pts: 6770452548, ccData: 2048 }, - { type: 3, pts: 6770458554, ccData: 17187 }, - { type: 2, pts: 6770458554, ccData: 37376 }, - { type: 2, pts: 6770458554, ccData: 2304 }, - { type: 3, pts: 6770464560, ccData: 33314 }, - { type: 2, pts: 6770464560, ccData: 17013 }, - { type: 3, pts: 6770467563, ccData: 49698 }, - { type: 2, pts: 6770467563, ccData: 29791 }, - { type: 3, pts: 6770470566, ccData: 546 }, - { type: 2, pts: 6770470566, ccData: 18727 }, - { type: 3, pts: 6770473569, ccData: 16930 }, - { type: 2, pts: 6770473569, ccData: 27999 }, - { type: 3, pts: 6770476572, ccData: 33314 }, - { type: 2, pts: 6770476572, ccData: 26721 }, - { type: 3, pts: 6770479575, ccData: 49698 }, - { type: 2, pts: 6770479575, ccData: 30313 }, - { type: 3, pts: 6770482578, ccData: 546 }, - { type: 2, pts: 6770482578, ccData: 28263 }, - { type: 3, pts: 6770485581, ccData: 16930 }, - { type: 2, pts: 6770485581, ccData: 24432 }, - { type: 3, pts: 6770488584, ccData: 33314 }, - { type: 2, pts: 6770488584, ccData: 28526 }, - { type: 3, pts: 6770491587, ccData: 49698 }, - { type: 2, pts: 6770491587, ccData: 31092 }, - { type: 3, pts: 6770494590, ccData: 546 }, - { type: 2, pts: 6770494590, ccData: 24937 }, - { type: 3, pts: 6770497593, ccData: 16930 }, - { type: 2, pts: 6770497593, ccData: 27648 }, - { type: 3, pts: 6770500596, ccData: 35377 }, - { type: 2, pts: 6770500596, ccData: 39195 }, - { type: 2, pts: 6770500596, ccData: 16640 }, - { type: 2, pts: 6770500596, ccData: 287 }, - { type: 2, pts: 6770500596, ccData: 4240 }, - { type: 2, pts: 6770500596, ccData: 1283 }, - { type: 2, pts: 6770500596, ccData: 37162 }, - { type: 2, pts: 6770500596, ccData: 0 }, - { type: 2, pts: 6770500596, ccData: 37377 }, - { type: 2, pts: 6770500596, ccData: 5120 }, - { type: 3, pts: 6770506602, ccData: 49955 }, - { type: 2, pts: 6770506602, ccData: 37377 }, - { type: 2, pts: 6770506602, ccData: 5888 }, - { type: 3, pts: 6770512608, ccData: 546 }, - { type: 2, pts: 6770512608, ccData: 28786 }, - { type: 3, pts: 6770515611, ccData: 16930 }, - { type: 2, pts: 6770515611, ccData: 28514 }, - { type: 3, pts: 6770518614, ccData: 33314 }, - { type: 2, pts: 6770518614, ccData: 27749 }, - { type: 3, pts: 6770521617, ccData: 49698 }, - { type: 2, pts: 6770521617, ccData: 28019 }, - { type: 3, pts: 6770524620, ccData: 546 }, - { type: 2, pts: 6770524620, ccData: 11776 }, - { type: 3, pts: 6770527623, ccData: 16930 }, - { type: 2, pts: 6770527623, ccData: 35841 }, - { type: 3, pts: 6770533629, ccData: 33314 }, - { type: 2, pts: 6770533629, ccData: 35074 }, - { type: 3, pts: 6770740836, ccData: 51761 }, - { type: 2, pts: 6770740836, ccData: 38939 }, - { type: 2, pts: 6770740836, ccData: 15360 }, - { type: 2, pts: 6770740836, ccData: 31 }, - { type: 2, pts: 6770740836, ccData: 5264 }, - { type: 2, pts: 6770740836, ccData: 1283 }, - { type: 2, pts: 6770740836, ccData: 37162 }, - { type: 2, pts: 6770740836, ccData: 42 }, - { type: 2, pts: 6770740836, ccData: 37376 }, - { type: 2, pts: 6770740836, ccData: 2048 }, - { type: 3, pts: 6770746842, ccData: 546 }, - { type: 2, pts: 6770746842, ccData: 20328 }, - { type: 3, pts: 6770749845, ccData: 16930 }, - { type: 2, pts: 6770749845, ccData: 11776 }, - { type: 3, pts: 6770752848, ccData: 35377 }, - { type: 2, pts: 6770752848, ccData: 38939 }, - { type: 2, pts: 6770752848, ccData: 15360 }, - { type: 2, pts: 6770752848, ccData: 543 }, - { type: 2, pts: 6770752848, ccData: 4240 }, - { type: 2, pts: 6770752848, ccData: 1283 }, - { type: 2, pts: 6770752848, ccData: 37162 }, - { type: 2, pts: 6770752848, ccData: 0 }, - { type: 2, pts: 6770752848, ccData: 37378 }, - { type: 2, pts: 6770752848, ccData: 5120 }, - { type: 3, pts: 6770758854, ccData: 49955 }, - { type: 2, pts: 6770758854, ccData: 37378 }, - { type: 2, pts: 6770758854, ccData: 5632 }, - { type: 3, pts: 6770764860, ccData: 546 }, - { type: 2, pts: 6770764860, ccData: 20328 }, - { type: 3, pts: 6770767863, ccData: 16930 }, - { type: 2, pts: 6770767863, ccData: 11776 }, - { type: 3, pts: 6770770866, ccData: 33314 }, - { type: 2, pts: 6770770866, ccData: 35842 }, - { type: 3, pts: 6770776872, ccData: 49698 }, - { type: 2, pts: 6770776872, ccData: 35073 }, - { type: 3, pts: 6770921016, ccData: 2609 }, - { type: 2, pts: 6770921016, ccData: 39195 }, - { type: 2, pts: 6770921016, ccData: 17920 }, - { type: 2, pts: 6770921016, ccData: 31 }, - { type: 2, pts: 6770921016, ccData: 5264 }, - { type: 2, pts: 6770921016, ccData: 1283 }, - { type: 2, pts: 6770921016, ccData: 37162 }, - { type: 2, pts: 6770921016, ccData: 42 }, - { type: 2, pts: 6770921016, ccData: 37376 }, - { type: 2, pts: 6770921016, ccData: 4096 }, - { type: 3, pts: 6770927022, ccData: 17187 }, - { type: 2, pts: 6770927022, ccData: 37376 }, - { type: 2, pts: 6770927022, ccData: 4608 }, - { type: 3, pts: 6770933028, ccData: 33314 }, - { type: 2, pts: 6770933028, ccData: 10341 }, - { type: 3, pts: 6770936031, ccData: 49698 }, - { type: 2, pts: 6770936031, ccData: 30824 }, - { type: 3, pts: 6770939034, ccData: 546 }, - { type: 2, pts: 6770939034, ccData: 24940 }, - { type: 3, pts: 6770942037, ccData: 16930 }, - { type: 2, pts: 6770942037, ccData: 26990 }, - { type: 3, pts: 6770945040, ccData: 33314 }, - { type: 2, pts: 6770945040, ccData: 26409 }, - { type: 3, pts: 6770948043, ccData: 49698 }, - { type: 2, pts: 6770948043, ccData: 35841 }, - { type: 3, pts: 6770954049, ccData: 546 }, - { type: 2, pts: 6770954049, ccData: 35074 }, - { type: 3, pts: 6771080175, ccData: 16930 }, - { type: 2, pts: 6771080175, ccData: 35842 }, - { type: 3, pts: 6771374469, ccData: 35377 }, - { type: 2, pts: 6771374469, ccData: 38939 }, - { type: 2, pts: 6771374469, ccData: 17920 }, - { type: 2, pts: 6771374469, ccData: 31 }, - { type: 2, pts: 6771374469, ccData: 5264 }, - { type: 2, pts: 6771374469, ccData: 1283 }, - { type: 2, pts: 6771374469, ccData: 37162 }, - { type: 2, pts: 6771374469, ccData: 42 }, - { type: 2, pts: 6771374469, ccData: 37376 }, - { type: 2, pts: 6771374469, ccData: 3072 }, - { type: 3, pts: 6771380475, ccData: 49955 }, - { type: 2, pts: 6771380475, ccData: 37376 }, - { type: 2, pts: 6771380475, ccData: 3584 }, - { type: 3, pts: 6771386481, ccData: 545 }, - { type: 2, pts: 6771386481, ccData: 32512 }, - { type: 3, pts: 6771389484, ccData: 16930 }, - { type: 2, pts: 6771389484, ccData: 24320 }, - { type: 3, pts: 6771392487, ccData: 33313 }, - { type: 2, pts: 6771392487, ccData: 32512 }, - { type: 3, pts: 6771401496, ccData: 49698 }, - { type: 2, pts: 6771401496, ccData: 35073 }, - { type: 3, pts: 6771596691, ccData: 546 }, - { type: 2, pts: 6771596691, ccData: 35841 }, - { type: 3, pts: 6771683778, ccData: 18993 }, - { type: 2, pts: 6771683778, ccData: 38939 }, - { type: 2, pts: 6771683778, ccData: 17920 }, - { type: 2, pts: 6771683778, ccData: 31 }, - { type: 2, pts: 6771683778, ccData: 5264 }, - { type: 2, pts: 6771683778, ccData: 1283 }, - { type: 2, pts: 6771683778, ccData: 37162 }, - { type: 2, pts: 6771683778, ccData: 0 }, - { type: 2, pts: 6771683778, ccData: 37376 }, - { type: 2, pts: 6771683778, ccData: 0 }, - { type: 3, pts: 6771689784, ccData: 33571 }, - { type: 2, pts: 6771689784, ccData: 37376 }, - { type: 2, pts: 6771689784, ccData: 512 }, - { type: 3, pts: 6771695790, ccData: 49698 }, - { type: 2, pts: 6771695790, ccData: 20585 }, - { type: 3, pts: 6771698793, ccData: 546 }, - { type: 2, pts: 6771698793, ccData: 28267 }, - { type: 3, pts: 6771701796, ccData: 16930 }, - { type: 2, pts: 6771701796, ccData: 24940 }, - { type: 3, pts: 6771704799, ccData: 33314 }, - { type: 2, pts: 6771704799, ccData: 26979 }, - { type: 3, pts: 6771707802, ccData: 49698 }, - { type: 2, pts: 6771707802, ccData: 26991 }, - { type: 3, pts: 6771710805, ccData: 546 }, - { type: 2, pts: 6771710805, ccData: 30067 }, - { type: 3, pts: 6771713808, ccData: 16930 }, - { type: 2, pts: 6771713808, ccData: 11776 }, - { type: 3, pts: 6771722817, ccData: 33314 }, - { type: 2, pts: 6771722817, ccData: 35073 }, - { type: 3, pts: 6771785880, ccData: 51761 }, - { type: 2, pts: 6771785880, ccData: 39195 }, - { type: 2, pts: 6771785880, ccData: 17920 }, - { type: 2, pts: 6771785880, ccData: 31 }, - { type: 2, pts: 6771785880, ccData: 5264 }, - { type: 2, pts: 6771785880, ccData: 1283 }, - { type: 2, pts: 6771785880, ccData: 37162 }, - { type: 2, pts: 6771785880, ccData: 42 }, - { type: 2, pts: 6771785880, ccData: 37376 }, - { type: 2, pts: 6771785880, ccData: 0 }, - { type: 3, pts: 6771791886, ccData: 803 }, - { type: 2, pts: 6771791886, ccData: 37376 }, - { type: 2, pts: 6771791886, ccData: 768 }, - { type: 3, pts: 6771797892, ccData: 16930 }, - { type: 2, pts: 6771797892, ccData: 22895 }, - { type: 3, pts: 6771800895, ccData: 33314 }, - { type: 2, pts: 6771800895, ccData: 29991 }, - { type: 3, pts: 6771803898, ccData: 49698 }, - { type: 2, pts: 6771803898, ccData: 29285 }, - { type: 3, pts: 6771806901, ccData: 546 }, - { type: 2, pts: 6771806901, ccData: 24418 }, - { type: 3, pts: 6771809904, ccData: 16930 }, - { type: 2, pts: 6771809904, ccData: 24931 }, - { type: 3, pts: 6771812907, ccData: 33314 }, - { type: 2, pts: 6771812907, ccData: 27455 }, - { type: 3, pts: 6771815910, ccData: 49698 }, - { type: 2, pts: 6771815910, ccData: 35841 }, - { type: 3, pts: 6771821916, ccData: 546 }, - { type: 2, pts: 6771821916, ccData: 35074 }, - { type: 3, pts: 6771893988, ccData: 18993 }, - { type: 2, pts: 6771893988, ccData: 38939 }, - { type: 2, pts: 6771893988, ccData: 16640 }, - { type: 2, pts: 6771893988, ccData: 31 }, - { type: 2, pts: 6771893988, ccData: 5264 }, - { type: 2, pts: 6771893988, ccData: 1283 }, - { type: 2, pts: 6771893988, ccData: 37162 }, - { type: 2, pts: 6771893988, ccData: 42 }, - { type: 2, pts: 6771893988, ccData: 37376 }, - { type: 2, pts: 6771893988, ccData: 4096 }, - { type: 3, pts: 6771899994, ccData: 33314 }, - { type: 2, pts: 6771899994, ccData: 10355 }, - { type: 3, pts: 6771902997, ccData: 49698 }, - { type: 2, pts: 6771902997, ccData: 26983 }, - { type: 3, pts: 6771906000, ccData: 546 }, - { type: 2, pts: 6771906000, ccData: 26739 }, - { type: 3, pts: 6771909003, ccData: 16930 }, - { type: 2, pts: 6771909003, ccData: 10496 }, - { type: 3, pts: 6771912006, ccData: 35377 }, - { type: 2, pts: 6771912006, ccData: 38939 }, - { type: 2, pts: 6771912006, ccData: 16640 }, - { type: 2, pts: 6771912006, ccData: 287 }, - { type: 2, pts: 6771912006, ccData: 4240 }, - { type: 2, pts: 6771912006, ccData: 1283 }, - { type: 2, pts: 6771912006, ccData: 37162 }, - { type: 2, pts: 6771912006, ccData: 0 }, - { type: 2, pts: 6771912006, ccData: 37377 }, - { type: 2, pts: 6771912006, ccData: 4096 }, - { type: 3, pts: 6771918012, ccData: 49955 }, - { type: 2, pts: 6771918012, ccData: 37377 }, - { type: 2, pts: 6771918012, ccData: 4864 }, - { type: 3, pts: 6771924018, ccData: 546 }, - { type: 2, pts: 6771924018, ccData: 22885 }, - { type: 3, pts: 6771927021, ccData: 16930 }, - { type: 2, pts: 6771927021, ccData: 29486 }, - { type: 3, pts: 6771930024, ccData: 33314 }, - { type: 2, pts: 6771930024, ccData: 35842 }, - { type: 3, pts: 6771936030, ccData: 49698 }, - { type: 2, pts: 6771936030, ccData: 35073 }, - { type: 3, pts: 6772017111, ccData: 2609 }, - { type: 2, pts: 6772017111, ccData: 39195 }, - { type: 2, pts: 6772017111, ccData: 17920 }, - { type: 2, pts: 6772017111, ccData: 31 }, - { type: 2, pts: 6772017111, ccData: 5264 }, - { type: 2, pts: 6772017111, ccData: 1283 }, - { type: 2, pts: 6772017111, ccData: 37162 }, - { type: 2, pts: 6772017111, ccData: 42 }, - { type: 2, pts: 6772017111, ccData: 37376 }, - { type: 2, pts: 6772017111, ccData: 2048 }, - { type: 3, pts: 6772023117, ccData: 17187 }, - { type: 2, pts: 6772023117, ccData: 37376 }, - { type: 2, pts: 6772023117, ccData: 2304 }, - { type: 3, pts: 6772029123, ccData: 33314 }, - { type: 2, pts: 6772029123, ccData: 18783 }, - { type: 3, pts: 6772032126, ccData: 49698 }, - { type: 2, pts: 6772032126, ccData: 27759 }, - { type: 3, pts: 6772035129, ccData: 546 }, - { type: 2, pts: 6772035129, ccData: 30309 }, - { type: 3, pts: 6772038132, ccData: 16930 }, - { type: 2, pts: 6772038132, ccData: 24429 }, - { type: 3, pts: 6772041135, ccData: 33314 }, - { type: 2, pts: 6772041135, ccData: 31071 }, - { type: 3, pts: 6772044138, ccData: 49698 }, - { type: 2, pts: 6772044138, ccData: 26721 }, - { type: 3, pts: 6772047141, ccData: 546 }, - { type: 2, pts: 6772047141, ccData: 26994 }, - { type: 3, pts: 6772050144, ccData: 16930 }, - { type: 2, pts: 6772050144, ccData: 29556 }, - { type: 3, pts: 6772053147, ccData: 33314 }, - { type: 2, pts: 6772053147, ccData: 31084 }, - { type: 3, pts: 6772056150, ccData: 49698 }, - { type: 2, pts: 6772056150, ccData: 25900 }, - { type: 3, pts: 6772059153, ccData: 546 }, - { type: 2, pts: 6772059153, ccData: 35841 }, - { type: 3, pts: 6772065159, ccData: 16930 }, - { type: 2, pts: 6772065159, ccData: 35074 }, - { type: 3, pts: 6772113207, ccData: 35377 }, - { type: 2, pts: 6772113207, ccData: 38939 }, - { type: 2, pts: 6772113207, ccData: 16640 }, - { type: 2, pts: 6772113207, ccData: 31 }, - { type: 2, pts: 6772113207, ccData: 5264 }, - { type: 2, pts: 6772113207, ccData: 1283 }, - { type: 2, pts: 6772113207, ccData: 37162 }, - { type: 2, pts: 6772113207, ccData: 42 }, - { type: 2, pts: 6772113207, ccData: 37376 }, - { type: 2, pts: 6772113207, ccData: 1024 }, - { type: 3, pts: 6772119213, ccData: 49955 }, - { type: 2, pts: 6772119213, ccData: 37376 }, - { type: 2, pts: 6772119213, ccData: 1536 }, - { type: 3, pts: 6772125219, ccData: 546 }, - { type: 2, pts: 6772125219, ccData: 25205 }, - { type: 3, pts: 6772128222, ccData: 16930 }, - { type: 2, pts: 6772128222, ccData: 29791 }, - { type: 3, pts: 6772131225, ccData: 33314 }, - { type: 2, pts: 6772131225, ccData: 26996 }, - { type: 3, pts: 6772134228, ccData: 49698 }, - { type: 2, pts: 6772134228, ccData: 24427 }, - { type: 3, pts: 6772137231, ccData: 546 }, - { type: 2, pts: 6772137231, ccData: 25957 }, - { type: 3, pts: 6772140234, ccData: 16930 }, - { type: 2, pts: 6772140234, ccData: 28787 }, - { type: 3, pts: 6772143237, ccData: 33314 }, - { type: 2, pts: 6772143237, ccData: 24423 }, - { type: 3, pts: 6772146240, ccData: 49698 }, - { type: 2, pts: 6772146240, ccData: 25972 }, - { type: 3, pts: 6772149243, ccData: 546 }, - { type: 2, pts: 6772149243, ccData: 29801 }, - { type: 3, pts: 6772152246, ccData: 16930 }, - { type: 2, pts: 6772152246, ccData: 28263 }, - { type: 3, pts: 6772155249, ccData: 35377 }, - { type: 2, pts: 6772155249, ccData: 38939 }, - { type: 2, pts: 6772155249, ccData: 16640 }, - { type: 2, pts: 6772155249, ccData: 287 }, - { type: 2, pts: 6772155249, ccData: 4240 }, - { type: 2, pts: 6772155249, ccData: 1283 }, - { type: 2, pts: 6772155249, ccData: 37162 }, - { type: 2, pts: 6772155249, ccData: 0 }, - { type: 2, pts: 6772155249, ccData: 37377 }, - { type: 2, pts: 6772155249, ccData: 4096 }, - { type: 3, pts: 6772161255, ccData: 49698 }, - { type: 2, pts: 6772161255, ccData: 26990 }, - { type: 3, pts: 6772164258, ccData: 546 }, - { type: 2, pts: 6772164258, ccData: 24429 }, - { type: 3, pts: 6772167261, ccData: 16930 }, - { type: 2, pts: 6772167261, ccData: 31071 }, - { type: 3, pts: 6772170264, ccData: 33314 }, - { type: 2, pts: 6772170264, ccData: 30561 }, - { type: 3, pts: 6772173267, ccData: 49698 }, - { type: 2, pts: 6772173267, ccData: 31022 }, - { type: 3, pts: 6772176270, ccData: 546 }, - { type: 2, pts: 6772176270, ccData: 35842 }, - { type: 3, pts: 6772182276, ccData: 16930 }, - { type: 2, pts: 6772182276, ccData: 35073 }, - { type: 3, pts: 6772314408, ccData: 35377 }, - { type: 2, pts: 6772314408, ccData: 39195 }, - { type: 2, pts: 6772314408, ccData: 16640 }, - { type: 2, pts: 6772314408, ccData: 31 }, - { type: 2, pts: 6772314408, ccData: 5264 }, - { type: 2, pts: 6772314408, ccData: 1283 }, - { type: 2, pts: 6772314408, ccData: 37162 }, - { type: 2, pts: 6772314408, ccData: 42 }, - { type: 2, pts: 6772314408, ccData: 37376 }, - { type: 2, pts: 6772314408, ccData: 3072 }, - { type: 3, pts: 6772320414, ccData: 49955 }, - { type: 2, pts: 6772320414, ccData: 37376 }, - { type: 2, pts: 6772320414, ccData: 3328 }, - { type: 3, pts: 6772326420, ccData: 546 }, - { type: 2, pts: 6772326420, ccData: 18783 }, - { type: 3, pts: 6772329423, ccData: 16930 }, - { type: 2, pts: 6772329423, ccData: 25974 }, - { type: 3, pts: 6772332426, ccData: 33314 }, - { type: 2, pts: 6772332426, ccData: 25966 }, - { type: 3, pts: 6772335429, ccData: 49698 }, - { type: 2, pts: 6772335429, ccData: 24429 }, - { type: 3, pts: 6772338432, ccData: 546 }, - { type: 2, pts: 6772338432, ccData: 26995 }, - { type: 3, pts: 6772341435, ccData: 16930 }, - { type: 2, pts: 6772341435, ccData: 29541 }, - { type: 3, pts: 6772344438, ccData: 33314 }, - { type: 2, pts: 6772344438, ccData: 25600 }, - { type: 3, pts: 6772347441, ccData: 51761 }, - { type: 2, pts: 6772347441, ccData: 39195 }, - { type: 2, pts: 6772347441, ccData: 16640 }, - { type: 2, pts: 6772347441, ccData: 287 }, - { type: 2, pts: 6772347441, ccData: 4240 }, - { type: 2, pts: 6772347441, ccData: 1283 }, - { type: 2, pts: 6772347441, ccData: 37162 }, - { type: 2, pts: 6772347441, ccData: 0 }, - { type: 2, pts: 6772347441, ccData: 37377 }, - { type: 2, pts: 6772347441, ccData: 4096 }, - { type: 3, pts: 6772353447, ccData: 803 }, - { type: 2, pts: 6772353447, ccData: 37377 }, - { type: 2, pts: 6772353447, ccData: 4864 }, - { type: 3, pts: 6772359453, ccData: 16930 }, - { type: 2, pts: 6772359453, ccData: 24927 }, - { type: 3, pts: 6772362456, ccData: 33314 }, - { type: 2, pts: 6772362456, ccData: 26479 }, - { type: 3, pts: 6772365459, ccData: 49698 }, - { type: 2, pts: 6772365459, ccData: 24940 }, - { type: 3, pts: 6772368462, ccData: 546 }, - { type: 2, pts: 6772368462, ccData: 11776 }, - { type: 3, pts: 6772371465, ccData: 16930 }, - { type: 2, pts: 6772371465, ccData: 35841 }, - { type: 3, pts: 6772377471, ccData: 33314 }, - { type: 2, pts: 6772377471, ccData: 35074 }, - { type: 3, pts: 6772515609, ccData: 51761 }, - { type: 2, pts: 6772515609, ccData: 38939 }, - { type: 2, pts: 6772515609, ccData: 16640 }, - { type: 2, pts: 6772515609, ccData: 31 }, - { type: 2, pts: 6772515609, ccData: 5264 }, - { type: 2, pts: 6772515609, ccData: 1283 }, - { type: 2, pts: 6772515609, ccData: 37162 }, - { type: 2, pts: 6772515609, ccData: 42 }, - { type: 2, pts: 6772515609, ccData: 37376 }, - { type: 2, pts: 6772515609, ccData: 1024 }, - { type: 3, pts: 6772521615, ccData: 803 }, - { type: 2, pts: 6772521615, ccData: 37376 }, - { type: 2, pts: 6772521615, ccData: 1792 }, - { type: 3, pts: 6772527621, ccData: 16930 }, - { type: 2, pts: 6772527621, ccData: 19809 }, - { type: 3, pts: 6772530624, ccData: 33314 }, - { type: 2, pts: 6772530624, ccData: 31071 }, - { type: 3, pts: 6772533627, ccData: 49698 }, - { type: 2, pts: 6772533627, ccData: 18783 }, - { type: 3, pts: 6772536630, ccData: 546 }, - { type: 2, pts: 6772536630, ccData: 28780 }, - { type: 3, pts: 6772539633, ccData: 16930 }, - { type: 2, pts: 6772539633, ccData: 25953 }, - { type: 3, pts: 6772542636, ccData: 33314 }, - { type: 2, pts: 6772542636, ccData: 29541 }, - { type: 3, pts: 6772545639, ccData: 49698 }, - { type: 2, pts: 6772545639, ccData: 24420 }, - { type: 3, pts: 6772548642, ccData: 546 }, - { type: 2, pts: 6772548642, ccData: 29285 }, - { type: 3, pts: 6772551645, ccData: 16930 }, - { type: 2, pts: 6772551645, ccData: 24941 }, - { type: 3, pts: 6772554648, ccData: 33314 }, - { type: 2, pts: 6772554648, ccData: 24437 }, - { type: 3, pts: 6772557651, ccData: 49698 }, - { type: 2, pts: 6772557651, ccData: 28672 }, - { type: 3, pts: 6772560654, ccData: 2609 }, - { type: 2, pts: 6772560654, ccData: 38939 }, - { type: 2, pts: 6772560654, ccData: 16640 }, - { type: 2, pts: 6772560654, ccData: 287 }, - { type: 2, pts: 6772560654, ccData: 4240 }, - { type: 2, pts: 6772560654, ccData: 1283 }, - { type: 2, pts: 6772560654, ccData: 37162 }, - { type: 2, pts: 6772560654, ccData: 0 }, - { type: 2, pts: 6772560654, ccData: 37377 }, - { type: 2, pts: 6772560654, ccData: 2048 }, - { type: 3, pts: 6772566660, ccData: 17187 }, - { type: 2, pts: 6772566660, ccData: 37377 }, - { type: 2, pts: 6772566660, ccData: 2560 }, - { type: 3, pts: 6772572666, ccData: 33314 }, - { type: 2, pts: 6772572666, ccData: 24942 }, - { type: 3, pts: 6772575669, ccData: 49698 }, - { type: 2, pts: 6772575669, ccData: 28532 }, - { type: 3, pts: 6772578672, ccData: 546 }, - { type: 2, pts: 6772578672, ccData: 26725 }, - { type: 3, pts: 6772581675, ccData: 16930 }, - { type: 2, pts: 6772581675, ccData: 29279 }, - { type: 3, pts: 6772584678, ccData: 33314 }, - { type: 2, pts: 6772584678, ccData: 26721 }, - { type: 3, pts: 6772587681, ccData: 49698 }, - { type: 2, pts: 6772587681, ccData: 26994 }, - { type: 3, pts: 6772590684, ccData: 546 }, - { type: 2, pts: 6772590684, ccData: 29556 }, - { type: 3, pts: 6772593687, ccData: 16930 }, - { type: 2, pts: 6772593687, ccData: 31084 }, - { type: 3, pts: 6772596690, ccData: 33314 }, - { type: 2, pts: 6772596690, ccData: 25919 }, - { type: 3, pts: 6772599693, ccData: 49698 }, - { type: 2, pts: 6772599693, ccData: 35842 }, - { type: 3, pts: 6772605699, ccData: 546 }, - { type: 2, pts: 6772605699, ccData: 35073 }, - { type: 3, pts: 6772818912, ccData: 18993 }, - { type: 2, pts: 6772818912, ccData: 39195 }, - { type: 2, pts: 6772818912, ccData: 17920 }, - { type: 2, pts: 6772818912, ccData: 31 }, - { type: 2, pts: 6772818912, ccData: 5264 }, - { type: 2, pts: 6772818912, ccData: 1283 }, - { type: 2, pts: 6772818912, ccData: 37162 }, - { type: 2, pts: 6772818912, ccData: 42 }, - { type: 2, pts: 6772818912, ccData: 37376 }, - { type: 2, pts: 6772818912, ccData: 0 }, - { type: 3, pts: 6772824918, ccData: 33314 }, - { type: 2, pts: 6772824918, ccData: 20328 }, - { type: 3, pts: 6772827921, ccData: 49698 }, - { type: 2, pts: 6772827921, ccData: 11359 }, - { type: 3, pts: 6772830924, ccData: 546 }, - { type: 2, pts: 6772830924, ccData: 28518 }, - { type: 3, pts: 6772833927, ccData: 16930 }, - { type: 2, pts: 6772833927, ccData: 24419 }, - { type: 3, pts: 6772836930, ccData: 33314 }, - { type: 2, pts: 6772836930, ccData: 28533 }, - { type: 3, pts: 6772839933, ccData: 49698 }, - { type: 2, pts: 6772839933, ccData: 29299 }, - { type: 3, pts: 6772842936, ccData: 546 }, - { type: 2, pts: 6772842936, ccData: 25889 }, - { type: 3, pts: 6772845939, ccData: 16930 }, - { type: 2, pts: 6772845939, ccData: 35841 }, - { type: 3, pts: 6772851945, ccData: 33314 }, - { type: 2, pts: 6772851945, ccData: 35074 }, - { type: 3, pts: 6772978071, ccData: 49698 }, - { type: 2, pts: 6772978071, ccData: 35842 }, - { type: 3, pts: 6773170263, ccData: 2609 }, - { type: 2, pts: 6773170263, ccData: 38939 }, - { type: 2, pts: 6773170263, ccData: 16640 }, - { type: 2, pts: 6773170263, ccData: 31 }, - { type: 2, pts: 6773170263, ccData: 5264 }, - { type: 2, pts: 6773170263, ccData: 1283 }, - { type: 2, pts: 6773170263, ccData: 37162 }, - { type: 2, pts: 6773170263, ccData: 42 }, - { type: 2, pts: 6773170263, ccData: 37376 }, - { type: 2, pts: 6773170263, ccData: 2048 }, - { type: 3, pts: 6773176269, ccData: 17187 }, - { type: 2, pts: 6773176269, ccData: 37376 }, - { type: 2, pts: 6773176269, ccData: 2560 }, - { type: 3, pts: 6773182275, ccData: 33314 }, - { type: 2, pts: 6773182275, ccData: 18727 }, - { type: 3, pts: 6773185278, ccData: 49698 }, - { type: 2, pts: 6773185278, ccData: 27999 }, - { type: 3, pts: 6773188281, ccData: 546 }, - { type: 2, pts: 6773188281, ccData: 25714 }, - { type: 3, pts: 6773191284, ccData: 16930 }, - { type: 2, pts: 6773191284, ccData: 25953 }, - { type: 3, pts: 6773194287, ccData: 33314 }, - { type: 2, pts: 6773194287, ccData: 28009 }, - { type: 3, pts: 6773197290, ccData: 49698 }, - { type: 2, pts: 6773197290, ccData: 28263 }, - { type: 3, pts: 6773200293, ccData: 2609 }, - { type: 2, pts: 6773200293, ccData: 38939 }, - { type: 2, pts: 6773200293, ccData: 16640 }, - { type: 2, pts: 6773200293, ccData: 287 }, - { type: 2, pts: 6773200293, ccData: 4240 }, - { type: 2, pts: 6773200293, ccData: 1283 }, - { type: 2, pts: 6773200293, ccData: 37162 }, - { type: 2, pts: 6773200293, ccData: 0 }, - { type: 2, pts: 6773200293, ccData: 37377 }, - { type: 2, pts: 6773200293, ccData: 2048 }, - { type: 3, pts: 6773206299, ccData: 17187 }, - { type: 2, pts: 6773206299, ccData: 37377 }, - { type: 2, pts: 6773206299, ccData: 2304 }, - { type: 3, pts: 6773212305, ccData: 33314 }, - { type: 2, pts: 6773212305, ccData: 28518 }, - { type: 3, pts: 6773215308, ccData: 49698 }, - { type: 2, pts: 6773215308, ccData: 24417 }, - { type: 3, pts: 6773218311, ccData: 546 }, - { type: 2, pts: 6773218311, ccData: 24424 }, - { type: 3, pts: 6773221314, ccData: 16930 }, - { type: 2, pts: 6773221314, ccData: 24937 }, - { type: 3, pts: 6773224317, ccData: 33314 }, - { type: 2, pts: 6773224317, ccData: 29299 }, - { type: 3, pts: 6773227320, ccData: 49698 }, - { type: 2, pts: 6773227320, ccData: 29817 }, - { type: 3, pts: 6773230323, ccData: 546 }, - { type: 2, pts: 6773230323, ccData: 27749 }, - { type: 3, pts: 6773239332, ccData: 16930 }, - { type: 2, pts: 6773239332, ccData: 35073 }, - { type: 3, pts: 6773317410, ccData: 35377 }, - { type: 2, pts: 6773317410, ccData: 39195 }, - { type: 2, pts: 6773317410, ccData: 16640 }, - { type: 2, pts: 6773317410, ccData: 31 }, - { type: 2, pts: 6773317410, ccData: 5264 }, - { type: 2, pts: 6773317410, ccData: 1283 }, - { type: 2, pts: 6773317410, ccData: 37162 }, - { type: 2, pts: 6773317410, ccData: 42 }, - { type: 2, pts: 6773317410, ccData: 37376 }, - { type: 2, pts: 6773317410, ccData: 0 }, - { type: 3, pts: 6773323416, ccData: 49698 }, - { type: 2, pts: 6773323416, ccData: 29800 }, - { type: 3, pts: 6773326419, ccData: 546 }, - { type: 2, pts: 6773326419, ccData: 24948 }, - { type: 3, pts: 6773329422, ccData: 16930 }, - { type: 2, pts: 6773329422, ccData: 24439 }, - { type: 3, pts: 6773332425, ccData: 33314 }, - { type: 2, pts: 6773332425, ccData: 28526 }, - { type: 3, pts: 6773335428, ccData: 49698 }, - { type: 2, pts: 6773335428, ccData: 10100 }, - { type: 3, pts: 6773338431, ccData: 546 }, - { type: 2, pts: 6773338431, ccData: 24423 }, - { type: 3, pts: 6773341434, ccData: 16930 }, - { type: 2, pts: 6773341434, ccData: 25972 }, - { type: 3, pts: 6773344437, ccData: 35377 }, - { type: 2, pts: 6773344437, ccData: 39195 }, - { type: 2, pts: 6773344437, ccData: 16640 }, - { type: 2, pts: 6773344437, ccData: 287 }, - { type: 2, pts: 6773344437, ccData: 4240 }, - { type: 2, pts: 6773344437, ccData: 1283 }, - { type: 2, pts: 6773344437, ccData: 37162 }, - { type: 2, pts: 6773344437, ccData: 0 }, - { type: 2, pts: 6773344437, ccData: 37377 }, - { type: 2, pts: 6773344437, ccData: 0 }, - { type: 3, pts: 6773350443, ccData: 49698 }, - { type: 2, pts: 6773350443, ccData: 29556 }, - { type: 3, pts: 6773353446, ccData: 546 }, - { type: 2, pts: 6773353446, ccData: 25968 }, - { type: 3, pts: 6773356449, ccData: 16930 }, - { type: 2, pts: 6773356449, ccData: 28773 }, - { type: 3, pts: 6773359452, ccData: 33314 }, - { type: 2, pts: 6773359452, ccData: 25695 }, - { type: 3, pts: 6773362455, ccData: 49698 }, - { type: 2, pts: 6773362455, ccData: 28526 }, - { type: 3, pts: 6773365458, ccData: 546 }, - { type: 2, pts: 6773365458, ccData: 11822 }, - { type: 3, pts: 6773368461, ccData: 16930 }, - { type: 2, pts: 6773368461, ccData: 11776 }, - { type: 3, pts: 6773371464, ccData: 33314 }, - { type: 2, pts: 6773371464, ccData: 35841 }, - { type: 3, pts: 6773377470, ccData: 49698 }, - { type: 2, pts: 6773377470, ccData: 35074 }, - { type: 3, pts: 6773749842, ccData: 2609 }, - { type: 2, pts: 6773749842, ccData: 38939 }, - { type: 2, pts: 6773749842, ccData: 17920 }, - { type: 2, pts: 6773749842, ccData: 31 }, - { type: 2, pts: 6773749842, ccData: 5264 }, - { type: 2, pts: 6773749842, ccData: 1283 }, - { type: 2, pts: 6773749842, ccData: 37162 }, - { type: 2, pts: 6773749842, ccData: 42 }, - { type: 2, pts: 6773749842, ccData: 37376 }, - { type: 2, pts: 6773749842, ccData: 2048 }, - { type: 3, pts: 6773755848, ccData: 16930 }, - { type: 2, pts: 6773755848, ccData: 28530 }, - { type: 3, pts: 6773758851, ccData: 33314 }, - { type: 2, pts: 6773758851, ccData: 24435 }, - { type: 3, pts: 6773761854, ccData: 49698 }, - { type: 2, pts: 6773761854, ccData: 29813 }, - { type: 3, pts: 6773764857, ccData: 546 }, - { type: 2, pts: 6773764857, ccData: 25451 }, - { type: 3, pts: 6773767860, ccData: 16930 }, - { type: 2, pts: 6773767860, ccData: 24425 }, - { type: 3, pts: 6773770863, ccData: 33314 }, - { type: 2, pts: 6773770863, ccData: 28255 }, - { type: 3, pts: 6773773866, ccData: 49698 }, - { type: 2, pts: 6773773866, ccData: 29552 }, - { type: 3, pts: 6773776869, ccData: 546 }, - { type: 2, pts: 6773776869, ccData: 24935 }, - { type: 3, pts: 6773779872, ccData: 16930 }, - { type: 2, pts: 6773779872, ccData: 26725 }, - { type: 3, pts: 6773782875, ccData: 33314 }, - { type: 2, pts: 6773782875, ccData: 29812 }, - { type: 3, pts: 6773785878, ccData: 49698 }, - { type: 2, pts: 6773785878, ccData: 26926 }, - { type: 3, pts: 6773788881, ccData: 546 }, - { type: 2, pts: 6773788881, ccData: 11822 }, - { type: 3, pts: 6773791884, ccData: 16930 }, - { type: 2, pts: 6773791884, ccData: 35842 }, - { type: 3, pts: 6773797890, ccData: 33314 }, - { type: 2, pts: 6773797890, ccData: 35073 }, - { type: 3, pts: 6774137229, ccData: 51761 }, - { type: 2, pts: 6774137229, ccData: 39195 }, - { type: 2, pts: 6774137229, ccData: 16640 }, - { type: 2, pts: 6774137229, ccData: 31 }, - { type: 2, pts: 6774137229, ccData: 5264 }, - { type: 2, pts: 6774137229, ccData: 1283 }, - { type: 2, pts: 6774137229, ccData: 37162 }, - { type: 2, pts: 6774137229, ccData: 42 }, - { type: 2, pts: 6774137229, ccData: 37376 }, - { type: 2, pts: 6774137229, ccData: 4096 }, - { type: 3, pts: 6774143235, ccData: 546 }, - { type: 2, pts: 6774143235, ccData: 24942 }, - { type: 3, pts: 6774146238, ccData: 16930 }, - { type: 2, pts: 6774146238, ccData: 25695 }, - { type: 3, pts: 6774149241, ccData: 33314 }, - { type: 2, pts: 6774149241, ccData: 18783 }, - { type: 3, pts: 6774152244, ccData: 49698 }, - { type: 2, pts: 6774152244, ccData: 30575 }, - { type: 3, pts: 6774155247, ccData: 546 }, - { type: 2, pts: 6774155247, ccData: 28199 }, - { type: 3, pts: 6774158250, ccData: 16930 }, - { type: 2, pts: 6774158250, ccData: 29791 }, - { type: 3, pts: 6774161253, ccData: 33314 }, - { type: 2, pts: 6774161253, ccData: 29810 }, - { type: 3, pts: 6774164256, ccData: 49698 }, - { type: 2, pts: 6774164256, ccData: 26992 }, - { type: 3, pts: 6774167259, ccData: 2609 }, - { type: 2, pts: 6774167259, ccData: 39195 }, - { type: 2, pts: 6774167259, ccData: 16640 }, - { type: 2, pts: 6774167259, ccData: 287 }, - { type: 2, pts: 6774167259, ccData: 4240 }, - { type: 2, pts: 6774167259, ccData: 1283 }, - { type: 2, pts: 6774167259, ccData: 37162 }, - { type: 2, pts: 6774167259, ccData: 0 }, - { type: 2, pts: 6774167259, ccData: 37377 }, - { type: 2, pts: 6774167259, ccData: 4096 }, - { type: 3, pts: 6774173265, ccData: 17187 }, - { type: 2, pts: 6774173265, ccData: 37377 }, - { type: 2, pts: 6774173265, ccData: 4352 }, - { type: 3, pts: 6774179271, ccData: 33314 }, - { type: 2, pts: 6774179271, ccData: 28534 }, - { type: 3, pts: 6774182274, ccData: 49698 }, - { type: 2, pts: 6774182274, ccData: 25970 }, - { type: 3, pts: 6774185277, ccData: 546 }, - { type: 2, pts: 6774185277, ccData: 24425 }, - { type: 3, pts: 6774188280, ccData: 16930 }, - { type: 2, pts: 6774188280, ccData: 29791 }, - { type: 3, pts: 6774191283, ccData: 33314 }, - { type: 2, pts: 6774191283, ccData: 25961 }, - { type: 3, pts: 6774194286, ccData: 49698 }, - { type: 2, pts: 6774194286, ccData: 29800 }, - { type: 3, pts: 6774197289, ccData: 546 }, - { type: 2, pts: 6774197289, ccData: 25970 }, - { type: 3, pts: 6774200292, ccData: 16930 }, - { type: 2, pts: 6774200292, ccData: 11776 }, - { type: 3, pts: 6774203295, ccData: 33314 }, - { type: 2, pts: 6774203295, ccData: 35841 }, - { type: 3, pts: 6774209301, ccData: 49698 }, - { type: 2, pts: 6774209301, ccData: 35074 }, - { type: 3, pts: 6774689781, ccData: 546 }, - { type: 2, pts: 6774689781, ccData: 35842 }, - { type: 3, pts: 6774902994, ccData: 18993 }, - { type: 2, pts: 6774902994, ccData: 38939 }, - { type: 2, pts: 6774902994, ccData: 17920 }, - { type: 2, pts: 6774902994, ccData: 31 }, - { type: 2, pts: 6774902994, ccData: 5264 }, - { type: 2, pts: 6774902994, ccData: 1283 }, - { type: 2, pts: 6774902994, ccData: 37162 }, - { type: 2, pts: 6774902994, ccData: 42 }, - { type: 2, pts: 6774902994, ccData: 37376 }, - { type: 2, pts: 6774902994, ccData: 7168 }, - { type: 3, pts: 6774909000, ccData: 33314 }, - { type: 2, pts: 6774909000, ccData: 20335 }, - { type: 3, pts: 6774912003, ccData: 49698 }, - { type: 2, pts: 6774912003, ccData: 26657 }, - { type: 3, pts: 6774921012, ccData: 546 }, - { type: 2, pts: 6774921012, ccData: 35073 }, - { type: 3, pts: 6774945036, ccData: 18993 }, - { type: 2, pts: 6774945036, ccData: 39195 }, - { type: 2, pts: 6774945036, ccData: 16640 }, - { type: 2, pts: 6774945036, ccData: 31 }, - { type: 2, pts: 6774945036, ccData: 5264 }, - { type: 2, pts: 6774945036, ccData: 1283 }, - { type: 2, pts: 6774945036, ccData: 37162 }, - { type: 2, pts: 6774945036, ccData: 42 }, - { type: 2, pts: 6774945036, ccData: 37376 }, - { type: 2, pts: 6774945036, ccData: 3072 }, - { type: 3, pts: 6774951042, ccData: 33571 }, - { type: 2, pts: 6774951042, ccData: 37376 }, - { type: 2, pts: 6774951042, ccData: 3328 }, - { type: 3, pts: 6774957048, ccData: 49698 }, - { type: 2, pts: 6774957048, ccData: 16750 }, - { type: 3, pts: 6774960051, ccData: 546 }, - { type: 2, pts: 6774960051, ccData: 25695 }, - { type: 3, pts: 6774963054, ccData: 16930 }, - { type: 2, pts: 6774963054, ccData: 29800 }, - { type: 3, pts: 6774966057, ccData: 33314 }, - { type: 2, pts: 6774966057, ccData: 25970 }, - { type: 3, pts: 6774969060, ccData: 49698 }, - { type: 2, pts: 6774969060, ccData: 25895 }, - { type: 3, pts: 6774972063, ccData: 546 }, - { type: 2, pts: 6774972063, ccData: 29535 }, - { type: 3, pts: 6774975066, ccData: 16930 }, - { type: 2, pts: 6774975066, ccData: 24927 }, - { type: 3, pts: 6774978069, ccData: 33314 }, - { type: 2, pts: 6774978069, ccData: 29801 }, - { type: 3, pts: 6774981072, ccData: 49698 }, - { type: 2, pts: 6774981072, ccData: 24946 }, - { type: 3, pts: 6774984075, ccData: 546 }, - { type: 2, pts: 6774984075, ccData: 24832 }, - { type: 3, pts: 6774987078, ccData: 18993 }, - { type: 2, pts: 6774987078, ccData: 39195 }, - { type: 2, pts: 6774987078, ccData: 16640 }, - { type: 2, pts: 6774987078, ccData: 287 }, - { type: 2, pts: 6774987078, ccData: 4240 }, - { type: 2, pts: 6774987078, ccData: 1283 }, - { type: 2, pts: 6774987078, ccData: 37162 }, - { type: 2, pts: 6774987078, ccData: 0 }, - { type: 2, pts: 6774987078, ccData: 37377 }, - { type: 2, pts: 6774987078, ccData: 5120 }, - { type: 3, pts: 6774993084, ccData: 33571 }, - { type: 2, pts: 6774993084, ccData: 37377 }, - { type: 2, pts: 6774993084, ccData: 5376 }, - { type: 3, pts: 6774999090, ccData: 49698 }, - { type: 2, pts: 6774999090, ccData: 24948 }, - { type: 3, pts: 6775002093, ccData: 546 }, - { type: 2, pts: 6775002093, ccData: 24436 }, - { type: 3, pts: 6775005096, ccData: 16930 }, - { type: 2, pts: 6775005096, ccData: 26725 }, - { type: 3, pts: 6775008099, ccData: 33314 }, - { type: 2, pts: 6775008099, ccData: 24436 }, - { type: 3, pts: 6775011102, ccData: 49698 }, - { type: 2, pts: 6775011102, ccData: 28528 }, - { type: 3, pts: 6775014105, ccData: 546 }, - { type: 2, pts: 6775014105, ccData: 11776 }, - { type: 3, pts: 6775017108, ccData: 16930 }, - { type: 2, pts: 6775017108, ccData: 35841 }, - { type: 3, pts: 6775023114, ccData: 33314 }, - { type: 2, pts: 6775023114, ccData: 35074 }, - { type: 3, pts: 6775206297, ccData: 49698 }, - { type: 2, pts: 6775206297, ccData: 35842 }, - { type: 3, pts: 6775551642, ccData: 2609 }, - { type: 2, pts: 6775551642, ccData: 38939 }, - { type: 2, pts: 6775551642, ccData: 17920 }, - { type: 2, pts: 6775551642, ccData: 31 }, - { type: 2, pts: 6775551642, ccData: 5264 }, - { type: 2, pts: 6775551642, ccData: 1283 }, - { type: 2, pts: 6775551642, ccData: 37162 }, - { type: 2, pts: 6775551642, ccData: 42 }, - { type: 2, pts: 6775551642, ccData: 37376 }, - { type: 2, pts: 6775551642, ccData: 0 }, - { type: 3, pts: 6775557648, ccData: 17187 }, - { type: 2, pts: 6775557648, ccData: 37376 }, - { type: 2, pts: 6775557648, ccData: 512 }, - { type: 3, pts: 6775563654, ccData: 33314 }, - { type: 2, pts: 6775563654, ccData: 18803 }, - { type: 3, pts: 6775566657, ccData: 49698 }, - { type: 2, pts: 6775566657, ccData: 28199 }, - { type: 3, pts: 6775569660, ccData: 546 }, - { type: 2, pts: 6775569660, ccData: 29791 }, - { type: 3, pts: 6775572663, ccData: 16930 }, - { type: 2, pts: 6775572663, ccData: 26996 }, - { type: 3, pts: 6775581672, ccData: 33314 }, - { type: 2, pts: 6775581672, ccData: 35073 }, - { type: 3, pts: 6775593684, ccData: 51761 }, - { type: 2, pts: 6775593684, ccData: 39195 }, - { type: 2, pts: 6775593684, ccData: 16640 }, - { type: 2, pts: 6775593684, ccData: 31 }, - { type: 2, pts: 6775593684, ccData: 5264 }, - { type: 2, pts: 6775593684, ccData: 1283 }, - { type: 2, pts: 6775593684, ccData: 37162 }, - { type: 2, pts: 6775593684, ccData: 42 }, - { type: 2, pts: 6775593684, ccData: 37376 }, - { type: 2, pts: 6775593684, ccData: 0 }, - { type: 3, pts: 6775599690, ccData: 803 }, - { type: 2, pts: 6775599690, ccData: 37376 }, - { type: 2, pts: 6775599690, ccData: 512 }, - { type: 3, pts: 6775605696, ccData: 16930 }, - { type: 2, pts: 6775605696, ccData: 29800 }, - { type: 3, pts: 6775608699, ccData: 33314 }, - { type: 2, pts: 6775608699, ccData: 25951 }, - { type: 3, pts: 6775611702, ccData: 49698 }, - { type: 2, pts: 6775611702, ccData: 28015 }, - { type: 3, pts: 6775614705, ccData: 546 }, - { type: 2, pts: 6775614705, ccData: 29556 }, - { type: 3, pts: 6775617708, ccData: 16930 }, - { type: 2, pts: 6775617708, ccData: 24432 }, - { type: 3, pts: 6775620711, ccData: 33314 }, - { type: 2, pts: 6775620711, ccData: 26990 }, - { type: 3, pts: 6775623714, ccData: 49698 }, - { type: 2, pts: 6775623714, ccData: 27491 }, - { type: 3, pts: 6775626717, ccData: 546 }, - { type: 2, pts: 6775626717, ccData: 29285 }, - { type: 3, pts: 6775629720, ccData: 16930 }, - { type: 2, pts: 6775629720, ccData: 25705 }, - { type: 3, pts: 6775632723, ccData: 33314 }, - { type: 2, pts: 6775632723, ccData: 25196 }, - { type: 3, pts: 6775635726, ccData: 49698 }, - { type: 2, pts: 6775635726, ccData: 25856 }, - { type: 3, pts: 6775638729, ccData: 2609 }, - { type: 2, pts: 6775638729, ccData: 39195 }, - { type: 2, pts: 6775638729, ccData: 16640 }, - { type: 2, pts: 6775638729, ccData: 287 }, - { type: 2, pts: 6775638729, ccData: 4240 }, - { type: 2, pts: 6775638729, ccData: 1283 }, - { type: 2, pts: 6775638729, ccData: 37162 }, - { type: 2, pts: 6775638729, ccData: 0 }, - { type: 2, pts: 6775638729, ccData: 37377 }, - { type: 2, pts: 6775638729, ccData: 0 }, - { type: 3, pts: 6775644735, ccData: 17187 }, - { type: 2, pts: 6775644735, ccData: 37377 }, - { type: 2, pts: 6775644735, ccData: 512 }, - { type: 3, pts: 6775650741, ccData: 33314 }, - { type: 2, pts: 6775650741, ccData: 26721 }, - { type: 3, pts: 6775653744, ccData: 49698 }, - { type: 2, pts: 6775653744, ccData: 26994 }, - { type: 3, pts: 6775656747, ccData: 546 }, - { type: 2, pts: 6775656747, ccData: 29556 }, - { type: 3, pts: 6775659750, ccData: 16930 }, - { type: 2, pts: 6775659750, ccData: 31084 }, - { type: 3, pts: 6775662753, ccData: 33314 }, - { type: 2, pts: 6775662753, ccData: 25951 }, - { type: 3, pts: 6775665756, ccData: 49698 }, - { type: 2, pts: 6775665756, ccData: 25974 }, - { type: 3, pts: 6775668759, ccData: 546 }, - { type: 2, pts: 6775668759, ccData: 25970 }, - { type: 3, pts: 6775671762, ccData: 16930 }, - { type: 2, pts: 6775671762, ccData: 16128 }, - { type: 3, pts: 6775674765, ccData: 33314 }, - { type: 2, pts: 6775674765, ccData: 35841 }, - { type: 3, pts: 6775680771, ccData: 49698 }, - { type: 2, pts: 6775680771, ccData: 35074 }, - { type: 3, pts: 6775860951, ccData: 2609 }, - { type: 2, pts: 6775860951, ccData: 38939 }, - { type: 2, pts: 6775860951, ccData: 17920 }, - { type: 2, pts: 6775860951, ccData: 31 }, - { type: 2, pts: 6775860951, ccData: 5264 }, - { type: 2, pts: 6775860951, ccData: 1283 }, - { type: 2, pts: 6775860951, ccData: 37162 }, - { type: 2, pts: 6775860951, ccData: 42 }, - { type: 2, pts: 6775860951, ccData: 37376 }, - { type: 2, pts: 6775860951, ccData: 3072 }, - { type: 3, pts: 6775866957, ccData: 17187 }, - { type: 2, pts: 6775866957, ccData: 37376 }, - { type: 2, pts: 6775866957, ccData: 3840 }, - { type: 3, pts: 6775872963, ccData: 33314 }, - { type: 2, pts: 6775872963, ccData: 16744 }, - { type: 3, pts: 6775875966, ccData: 49698 }, - { type: 2, pts: 6775875966, ccData: 11359 }, - { type: 3, pts: 6775878969, ccData: 546 }, - { type: 2, pts: 6775878969, ccData: 28777 }, - { type: 3, pts: 6775881972, ccData: 16930 }, - { type: 2, pts: 6775881972, ccData: 28267 }, - { type: 3, pts: 6775884975, ccData: 33314 }, - { type: 2, pts: 6775884975, ccData: 25458 }, - { type: 3, pts: 6775887978, ccData: 49698 }, - { type: 2, pts: 6775887978, ccData: 25956 }, - { type: 3, pts: 6775890981, ccData: 546 }, - { type: 2, pts: 6775890981, ccData: 26978 }, - { type: 3, pts: 6775893984, ccData: 16930 }, - { type: 2, pts: 6775893984, ccData: 27749 }, - { type: 3, pts: 6775896987, ccData: 33314 }, - { type: 2, pts: 6775896987, ccData: 11776 }, - { type: 3, pts: 6775899990, ccData: 49698 }, - { type: 2, pts: 6775899990, ccData: 35842 }, - { type: 3, pts: 6775905996, ccData: 546 }, - { type: 2, pts: 6775905996, ccData: 35073 }, - { type: 3, pts: 6776071161, ccData: 18993 }, - { type: 2, pts: 6776071161, ccData: 39195 }, - { type: 2, pts: 6776071161, ccData: 17920 }, - { type: 2, pts: 6776071161, ccData: 31 }, - { type: 2, pts: 6776071161, ccData: 5264 }, - { type: 2, pts: 6776071161, ccData: 1283 }, - { type: 2, pts: 6776071161, ccData: 37162 }, - { type: 2, pts: 6776071161, ccData: 42 }, - { type: 2, pts: 6776071161, ccData: 37376 }, - { type: 2, pts: 6776071161, ccData: 1024 }, - { type: 3, pts: 6776077167, ccData: 33571 }, - { type: 2, pts: 6776077167, ccData: 37376 }, - { type: 2, pts: 6776077167, ccData: 1280 }, - { type: 3, pts: 6776083173, ccData: 49698 }, - { type: 2, pts: 6776083173, ccData: 19557 }, - { type: 3, pts: 6776086176, ccData: 546 }, - { type: 2, pts: 6776086176, ccData: 29735 }, - { type: 3, pts: 6776089179, ccData: 16930 }, - { type: 2, pts: 6776089179, ccData: 29535 }, - { type: 3, pts: 6776092182, ccData: 33314 }, - { type: 2, pts: 6776092182, ccData: 26479 }, - { type: 3, pts: 6776095185, ccData: 49698 }, - { type: 2, pts: 6776095185, ccData: 8448 }, - { type: 3, pts: 6776098188, ccData: 546 }, - { type: 2, pts: 6776098188, ccData: 35841 }, - { type: 3, pts: 6776104194, ccData: 16930 }, - { type: 2, pts: 6776104194, ccData: 35074 }, - { type: 3, pts: 6776206296, ccData: 33314 }, - { type: 2, pts: 6776206296, ccData: 35842 }, - { type: 3, pts: 6776437527, ccData: 51761 }, - { type: 2, pts: 6776437527, ccData: 38939 }, - { type: 2, pts: 6776437527, ccData: 17920 }, - { type: 2, pts: 6776437527, ccData: 31 }, - { type: 2, pts: 6776437527, ccData: 5264 }, - { type: 2, pts: 6776437527, ccData: 1283 }, - { type: 2, pts: 6776437527, ccData: 37162 }, - { type: 2, pts: 6776437527, ccData: 42 }, - { type: 2, pts: 6776437527, ccData: 37376 }, - { type: 2, pts: 6776437527, ccData: 3072 }, - { type: 3, pts: 6776443533, ccData: 803 }, - { type: 2, pts: 6776443533, ccData: 37376 }, - { type: 2, pts: 6776443533, ccData: 3584 }, - { type: 3, pts: 6776449539, ccData: 16929 }, - { type: 2, pts: 6776449539, ccData: 32512 }, - { type: 3, pts: 6776452542, ccData: 33314 }, - { type: 2, pts: 6776452542, ccData: 24320 }, - { type: 3, pts: 6776455545, ccData: 49697 }, - { type: 2, pts: 6776455545, ccData: 32512 }, - { type: 3, pts: 6776464554, ccData: 546 }, - { type: 2, pts: 6776464554, ccData: 35073 }, - { type: 3, pts: 6776893983, ccData: 16930 }, - { type: 2, pts: 6776893983, ccData: 35841 }, - { type: 3, pts: 6777002091, ccData: 35377 }, - { type: 2, pts: 6777002091, ccData: 38939 }, - { type: 2, pts: 6777002091, ccData: 17920 }, - { type: 2, pts: 6777002091, ccData: 31 }, - { type: 2, pts: 6777002091, ccData: 5264 }, - { type: 2, pts: 6777002091, ccData: 1283 }, - { type: 2, pts: 6777002091, ccData: 37162 }, - { type: 2, pts: 6777002091, ccData: 0 }, - { type: 2, pts: 6777002091, ccData: 37376 }, - { type: 2, pts: 6777002091, ccData: 4096 }, - { type: 3, pts: 6777008097, ccData: 49955 }, - { type: 2, pts: 6777008097, ccData: 37376 }, - { type: 2, pts: 6777008097, ccData: 4864 }, - { type: 3, pts: 6777014103, ccData: 546 }, - { type: 2, pts: 6777014103, ccData: 21601 }, - { type: 3, pts: 6777017106, ccData: 16930 }, - { type: 2, pts: 6777017106, ccData: 11620 }, - { type: 3, pts: 6777020109, ccData: 33314 }, - { type: 2, pts: 6777020109, ccData: 24865 }, - { type: 3, pts: 6777029118, ccData: 49698 }, - { type: 2, pts: 6777029118, ccData: 35073 }, - { type: 3, pts: 6777146235, ccData: 2609 }, - { type: 2, pts: 6777146235, ccData: 39195 }, - { type: 2, pts: 6777146235, ccData: 16640 }, - { type: 2, pts: 6777146235, ccData: 31 }, - { type: 2, pts: 6777146235, ccData: 5264 }, - { type: 2, pts: 6777146235, ccData: 1283 }, - { type: 2, pts: 6777146235, ccData: 37162 }, - { type: 2, pts: 6777146235, ccData: 42 }, - { type: 2, pts: 6777146235, ccData: 37376 }, - { type: 2, pts: 6777146235, ccData: 3072 }, - { type: 3, pts: 6777152241, ccData: 16930 }, - { type: 2, pts: 6777152241, ccData: 22376 }, - { type: 3, pts: 6777155244, ccData: 33314 }, - { type: 2, pts: 6777155244, ccData: 24948 }, - { type: 3, pts: 6777158247, ccData: 49698 }, - { type: 2, pts: 6777158247, ccData: 24420 }, - { type: 3, pts: 6777161250, ccData: 546 }, - { type: 2, pts: 6777161250, ccData: 28511 }, - { type: 3, pts: 6777164253, ccData: 16930 }, - { type: 2, pts: 6777164253, ccData: 31087 }, - { type: 3, pts: 6777167256, ccData: 33314 }, - { type: 2, pts: 6777167256, ccData: 30047 }, - { type: 3, pts: 6777170259, ccData: 49698 }, - { type: 2, pts: 6777170259, ccData: 29800 }, - { type: 3, pts: 6777173262, ccData: 546 }, - { type: 2, pts: 6777173262, ccData: 26990 }, - { type: 3, pts: 6777176265, ccData: 16930 }, - { type: 2, pts: 6777176265, ccData: 27436 }, - { type: 3, pts: 6777179268, ccData: 35377 }, - { type: 2, pts: 6777179268, ccData: 39195 }, - { type: 2, pts: 6777179268, ccData: 16640 }, - { type: 2, pts: 6777179268, ccData: 287 }, - { type: 2, pts: 6777179268, ccData: 4240 }, - { type: 2, pts: 6777179268, ccData: 1283 }, - { type: 2, pts: 6777179268, ccData: 37162 }, - { type: 2, pts: 6777179268, ccData: 0 }, - { type: 2, pts: 6777179268, ccData: 37377 }, - { type: 2, pts: 6777179268, ccData: 4096 }, - { type: 3, pts: 6777185274, ccData: 49955 }, - { type: 2, pts: 6777185274, ccData: 37377 }, - { type: 2, pts: 6777185274, ccData: 4352 }, - { type: 3, pts: 6777191280, ccData: 546 }, - { type: 2, pts: 6777191280, ccData: 20585 }, - { type: 3, pts: 6777194283, ccData: 16930 }, - { type: 2, pts: 6777194283, ccData: 28267 }, - { type: 3, pts: 6777197286, ccData: 33314 }, - { type: 2, pts: 6777197286, ccData: 24940 }, - { type: 3, pts: 6777200289, ccData: 49698 }, - { type: 2, pts: 6777200289, ccData: 26979 }, - { type: 3, pts: 6777203292, ccData: 546 }, - { type: 2, pts: 6777203292, ccData: 26991 }, - { type: 3, pts: 6777206295, ccData: 16930 }, - { type: 2, pts: 6777206295, ccData: 30067 }, - { type: 3, pts: 6777209298, ccData: 33314 }, - { type: 2, pts: 6777209298, ccData: 16128 }, - { type: 3, pts: 6777212301, ccData: 49698 }, - { type: 2, pts: 6777212301, ccData: 35841 }, - { type: 3, pts: 6777218307, ccData: 546 }, - { type: 2, pts: 6777218307, ccData: 35074 }, - { type: 3, pts: 6777329418, ccData: 18993 }, - { type: 2, pts: 6777329418, ccData: 38939 }, - { type: 2, pts: 6777329418, ccData: 17920 }, - { type: 2, pts: 6777329418, ccData: 31 }, - { type: 2, pts: 6777329418, ccData: 5264 }, - { type: 2, pts: 6777329418, ccData: 1283 }, - { type: 2, pts: 6777329418, ccData: 37162 }, - { type: 2, pts: 6777329418, ccData: 42 }, - { type: 2, pts: 6777329418, ccData: 37376 }, - { type: 2, pts: 6777329418, ccData: 2048 }, - { type: 3, pts: 6777335424, ccData: 33571 }, - { type: 2, pts: 6777335424, ccData: 37376 }, - { type: 2, pts: 6777335424, ccData: 2304 }, - { type: 3, pts: 6777341430, ccData: 49698 }, - { type: 2, pts: 6777341430, ccData: 18541 }, - { type: 3, pts: 6777344433, ccData: 546 }, - { type: 2, pts: 6777344433, ccData: 27950 }, - { type: 3, pts: 6777347436, ccData: 16930 }, - { type: 2, pts: 6777347436, ccData: 11822 }, - { type: 3, pts: 6777350439, ccData: 33314 }, - { type: 2, pts: 6777350439, ccData: 35842 }, - { type: 3, pts: 6777356445, ccData: 49698 }, - { type: 2, pts: 6777356445, ccData: 35073 }, - { type: 3, pts: 6777518607, ccData: 2609 }, - { type: 2, pts: 6777518607, ccData: 39195 }, - { type: 2, pts: 6777518607, ccData: 17920 }, - { type: 2, pts: 6777518607, ccData: 31 }, - { type: 2, pts: 6777518607, ccData: 5264 }, - { type: 2, pts: 6777518607, ccData: 1283 }, - { type: 2, pts: 6777518607, ccData: 37162 }, - { type: 2, pts: 6777518607, ccData: 42 }, - { type: 2, pts: 6777518607, ccData: 37376 }, - { type: 2, pts: 6777518607, ccData: 2048 }, - { type: 3, pts: 6777524613, ccData: 17187 }, - { type: 2, pts: 6777524613, ccData: 37376 }, - { type: 2, pts: 6777524613, ccData: 2816 }, - { type: 3, pts: 6777530619, ccData: 33314 }, - { type: 2, pts: 6777530619, ccData: 18783 }, - { type: 3, pts: 6777533622, ccData: 49698 }, - { type: 2, pts: 6777533622, ccData: 27759 }, - { type: 3, pts: 6777536625, ccData: 546 }, - { type: 2, pts: 6777536625, ccData: 30309 }, - { type: 3, pts: 6777539628, ccData: 16930 }, - { type: 2, pts: 6777539628, ccData: 24425 }, - { type: 3, pts: 6777542631, ccData: 33314 }, - { type: 2, pts: 6777542631, ccData: 29729 }, - { type: 3, pts: 6777545634, ccData: 49698 }, - { type: 2, pts: 6777545634, ccData: 35841 }, - { type: 3, pts: 6777551640, ccData: 546 }, - { type: 2, pts: 6777551640, ccData: 35074 }, - { type: 3, pts: 6777770859, ccData: 18993 }, - { type: 2, pts: 6777770859, ccData: 38939 }, - { type: 2, pts: 6777770859, ccData: 17920 }, - { type: 2, pts: 6777770859, ccData: 31 }, - { type: 2, pts: 6777770859, ccData: 5264 }, - { type: 2, pts: 6777770859, ccData: 1283 }, - { type: 2, pts: 6777770859, ccData: 37162 }, - { type: 2, pts: 6777770859, ccData: 42 }, - { type: 2, pts: 6777770859, ccData: 37376 }, - { type: 2, pts: 6777770859, ccData: 3072 }, - { type: 3, pts: 6777776865, ccData: 33571 }, - { type: 2, pts: 6777776865, ccData: 37376 }, - { type: 2, pts: 6777776865, ccData: 3584 }, - { type: 3, pts: 6777782871, ccData: 49697 }, - { type: 2, pts: 6777782871, ccData: 32512 }, - { type: 3, pts: 6777785874, ccData: 546 }, - { type: 2, pts: 6777785874, ccData: 24320 }, - { type: 3, pts: 6777788877, ccData: 16929 }, - { type: 2, pts: 6777788877, ccData: 32512 }, - { type: 3, pts: 6777791880, ccData: 33314 }, - { type: 2, pts: 6777791880, ccData: 35842 }, - { type: 3, pts: 6777797886, ccData: 49698 }, - { type: 2, pts: 6777797886, ccData: 35073 }, - { type: 3, pts: 6777981069, ccData: 546 }, - { type: 2, pts: 6777981069, ccData: 35841 }, - { type: 3, pts: 6778551639, ccData: 18993 }, - { type: 2, pts: 6778551639, ccData: 38939 }, - { type: 2, pts: 6778551639, ccData: 16640 }, - { type: 2, pts: 6778551639, ccData: 31 }, - { type: 2, pts: 6778551639, ccData: 5264 }, - { type: 2, pts: 6778551639, ccData: 1283 }, - { type: 2, pts: 6778551639, ccData: 37162 }, - { type: 2, pts: 6778551639, ccData: 0 }, - { type: 2, pts: 6778551639, ccData: 37376 }, - { type: 2, pts: 6778551639, ccData: 4096 }, - { type: 3, pts: 6778557645, ccData: 33571 }, - { type: 2, pts: 6778557645, ccData: 37376 }, - { type: 2, pts: 6778557645, ccData: 4608 }, - { type: 3, pts: 6778563651, ccData: 49698 }, - { type: 2, pts: 6778563651, ccData: 10343 }, - { type: 3, pts: 6778566654, ccData: 546 }, - { type: 2, pts: 6778566654, ccData: 26983 }, - { type: 3, pts: 6778569657, ccData: 16930 }, - { type: 2, pts: 6778569657, ccData: 26476 }, - { type: 3, pts: 6778572660, ccData: 33314 }, - { type: 2, pts: 6778572660, ccData: 25971 }, - { type: 3, pts: 6778575663, ccData: 49698 }, - { type: 2, pts: 6778575663, ccData: 10554 }, - { type: 3, pts: 6778578666, ccData: 2609 }, - { type: 2, pts: 6778578666, ccData: 38939 }, - { type: 2, pts: 6778578666, ccData: 16640 }, - { type: 2, pts: 6778578666, ccData: 287 }, - { type: 2, pts: 6778578666, ccData: 4240 }, - { type: 2, pts: 6778578666, ccData: 1283 }, - { type: 2, pts: 6778578666, ccData: 37162 }, - { type: 2, pts: 6778578666, ccData: 0 }, - { type: 2, pts: 6778578666, ccData: 37377 }, - { type: 2, pts: 6778578666, ccData: 5120 }, - { type: 3, pts: 6778584672, ccData: 17187 }, - { type: 2, pts: 6778584672, ccData: 37377 }, - { type: 2, pts: 6778584672, ccData: 5888 }, - { type: 3, pts: 6778590678, ccData: 33314 }, - { type: 2, pts: 6778590678, ccData: 22376 }, - { type: 3, pts: 6778593681, ccData: 49698 }, - { type: 2, pts: 6778593681, ccData: 28513 }, - { type: 3, pts: 6778596684, ccData: 546 }, - { type: 2, pts: 6778596684, ccData: 8448 }, - { type: 3, pts: 6778605693, ccData: 16930 }, - { type: 2, pts: 6778605693, ccData: 35073 }, - { type: 3, pts: 6778719807, ccData: 35377 }, - { type: 2, pts: 6778719807, ccData: 39195 }, - { type: 2, pts: 6778719807, ccData: 16640 }, - { type: 2, pts: 6778719807, ccData: 31 }, - { type: 2, pts: 6778719807, ccData: 5264 }, - { type: 2, pts: 6778719807, ccData: 1283 }, - { type: 2, pts: 6778719807, ccData: 37162 }, - { type: 2, pts: 6778719807, ccData: 42 }, - { type: 2, pts: 6778719807, ccData: 37376 }, - { type: 2, pts: 6778719807, ccData: 2048 }, - { type: 3, pts: 6778725813, ccData: 49698 }, - { type: 2, pts: 6778725813, ccData: 18783 }, - { type: 3, pts: 6778728816, ccData: 546 }, - { type: 2, pts: 6778728816, ccData: 26485 }, - { type: 3, pts: 6778731819, ccData: 16930 }, - { type: 2, pts: 6778731819, ccData: 25971 }, - { type: 3, pts: 6778734822, ccData: 33314 }, - { type: 2, pts: 6778734822, ccData: 29535 }, - { type: 3, pts: 6778737825, ccData: 49698 }, - { type: 2, pts: 6778737825, ccData: 18727 }, - { type: 3, pts: 6778740828, ccData: 546 }, - { type: 2, pts: 6778740828, ccData: 27756 }, - { type: 3, pts: 6778743831, ccData: 16930 }, - { type: 2, pts: 6778743831, ccData: 24426 }, - { type: 3, pts: 6778746834, ccData: 33314 }, - { type: 2, pts: 6778746834, ccData: 30067 }, - { type: 3, pts: 6778749837, ccData: 49698 }, - { type: 2, pts: 6778749837, ccData: 29791 }, - { type: 3, pts: 6778752840, ccData: 546 }, - { type: 2, pts: 6778752840, ccData: 26721 }, - { type: 3, pts: 6778755843, ccData: 16930 }, - { type: 2, pts: 6778755843, ccData: 30309 }, - { type: 3, pts: 6778758846, ccData: 35377 }, - { type: 2, pts: 6778758846, ccData: 39195 }, - { type: 2, pts: 6778758846, ccData: 16640 }, - { type: 2, pts: 6778758846, ccData: 287 }, - { type: 2, pts: 6778758846, ccData: 4240 }, - { type: 2, pts: 6778758846, ccData: 1283 }, - { type: 2, pts: 6778758846, ccData: 37162 }, - { type: 2, pts: 6778758846, ccData: 0 }, - { type: 2, pts: 6778758846, ccData: 37377 }, - { type: 2, pts: 6778758846, ccData: 2048 }, - { type: 3, pts: 6778764852, ccData: 49955 }, - { type: 2, pts: 6778764852, ccData: 37377 }, - { type: 2, pts: 6778764852, ccData: 2816 }, - { type: 3, pts: 6778770858, ccData: 546 }, - { type: 2, pts: 6778770858, ccData: 29807 }, - { type: 3, pts: 6778773861, ccData: 16930 }, - { type: 2, pts: 6778773861, ccData: 24420 }, - { type: 3, pts: 6778776864, ccData: 33314 }, - { type: 2, pts: 6778776864, ccData: 30051 }, - { type: 3, pts: 6778779867, ccData: 49698 }, - { type: 2, pts: 6778779867, ccData: 27487 }, - { type: 3, pts: 6778782870, ccData: 546 }, - { type: 2, pts: 6778782870, ccData: 24927 }, - { type: 3, pts: 6778785873, ccData: 16930 }, - { type: 2, pts: 6778785873, ccData: 27753 }, - { type: 3, pts: 6778788876, ccData: 33314 }, - { type: 2, pts: 6778788876, ccData: 29812 }, - { type: 3, pts: 6778791879, ccData: 49698 }, - { type: 2, pts: 6778791879, ccData: 27749 }, - { type: 3, pts: 6778794882, ccData: 546 }, - { type: 2, pts: 6778794882, ccData: 24418 }, - { type: 3, pts: 6778797885, ccData: 16930 }, - { type: 2, pts: 6778797885, ccData: 26996 }, - { type: 3, pts: 6778800888, ccData: 33314 }, - { type: 2, pts: 6778800888, ccData: 11776 }, - { type: 3, pts: 6778803891, ccData: 49698 }, - { type: 2, pts: 6778803891, ccData: 35841 }, - { type: 3, pts: 6778809897, ccData: 546 }, - { type: 2, pts: 6778809897, ccData: 35074 }, - { type: 3, pts: 6779104191, ccData: 16930 }, - { type: 2, pts: 6779104191, ccData: 35842 }, - { type: 3, pts: 6779284371, ccData: 35377 }, - { type: 2, pts: 6779284371, ccData: 38939 }, - { type: 2, pts: 6779284371, ccData: 17920 }, - { type: 2, pts: 6779284371, ccData: 31 }, - { type: 2, pts: 6779284371, ccData: 5264 }, - { type: 2, pts: 6779284371, ccData: 1283 }, - { type: 2, pts: 6779284371, ccData: 37162 }, - { type: 2, pts: 6779284371, ccData: 42 }, - { type: 2, pts: 6779284371, ccData: 37376 }, - { type: 2, pts: 6779284371, ccData: 1024 }, - { type: 3, pts: 6779290377, ccData: 49955 }, - { type: 2, pts: 6779290377, ccData: 37376 }, - { type: 2, pts: 6779290377, ccData: 1536 }, - { type: 3, pts: 6779296383, ccData: 546 }, - { type: 2, pts: 6779296383, ccData: 19809 }, - { type: 3, pts: 6779299386, ccData: 16930 }, - { type: 2, pts: 6779299386, ccData: 31074 }, - { type: 3, pts: 6779302389, ccData: 33314 }, - { type: 2, pts: 6779302389, ccData: 25951 }, - { type: 3, pts: 6779305392, ccData: 49698 }, - { type: 2, pts: 6779305392, ccData: 24927 }, - { type: 3, pts: 6779308395, ccData: 546 }, - { type: 2, pts: 6779308395, ccData: 27753 }, - { type: 3, pts: 6779311398, ccData: 16930 }, - { type: 2, pts: 6779311398, ccData: 29812 }, - { type: 3, pts: 6779314401, ccData: 33314 }, - { type: 2, pts: 6779314401, ccData: 27749 }, - { type: 3, pts: 6779317404, ccData: 49698 }, - { type: 2, pts: 6779317404, ccData: 24429 }, - { type: 3, pts: 6779320407, ccData: 546 }, - { type: 2, pts: 6779320407, ccData: 28530 }, - { type: 3, pts: 6779323410, ccData: 16930 }, - { type: 2, pts: 6779323410, ccData: 25902 }, - { type: 3, pts: 6779332419, ccData: 33314 }, - { type: 2, pts: 6779332419, ccData: 35073 } -]; diff --git a/node_modules/mux.js/test/utils/id3-generator.js b/node_modules/mux.js/test/utils/id3-generator.js deleted file mode 100644 index 0eba8f2..0000000 --- a/node_modules/mux.js/test/utils/id3-generator.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Helper functions for creating ID3 metadata. - */ - -'use strict'; - -var stringToInts, stringToCString, id3Tag, id3Frame; - -stringToInts = function(string) { - var result = [], i; - for (i = 0; i < string.length; i++) { - result[i] = string.charCodeAt(i); - } - return result; -}; - -stringToCString = function(string) { - return stringToInts(string).concat([0x00]); -}; - -id3Tag = function() { - var - frames = Array.prototype.concat.apply([], Array.prototype.slice.call(arguments)), - result = stringToInts('ID3').concat([ - 0x03, 0x00, // version 3.0 of ID3v2 (aka ID3v.2.3.0) - 0x40, // flags. include an extended header - 0x00, 0x00, 0x00, 0x00, // size. set later - - // extended header - 0x00, 0x00, 0x00, 0x06, // extended header size. no CRC - 0x00, 0x00, // extended flags - 0x00, 0x00, 0x00, 0x02 // size of padding - ], frames), - size; - - // size is stored as a sequence of four 7-bit integers with the - // high bit of each byte set to zero - size = result.length - 10; - - result[6] = (size >>> 21) & 0x7f; - result[7] = (size >>> 14) & 0x7f; - result[8] = (size >>> 7) & 0x7f; - result[9] = size & 0x7f; - - return result; -}; - -id3Frame = function(type) { - var result = stringToInts(type).concat([ - 0x00, 0x00, 0x00, 0x00, // size - 0xe0, 0x00 // flags. tag/file alter preservation, read-only - ]), - size = result.length - 10; - - // append the fields of the ID3 frame - result = result.concat.apply(result, Array.prototype.slice.call(arguments, 1)); - - // set the size - size = result.length - 10; - - result[4] = (size >>> 21) & 0x7f; - result[5] = (size >>> 14) & 0x7f; - result[6] = (size >>> 7) & 0x7f; - result[7] = size & 0x7f; - - return result; -}; - -module.exports = { - stringToInts: stringToInts, - stringToCString: stringToCString, - id3Tag: id3Tag, - id3Frame: id3Frame -}; diff --git a/node_modules/mux.js/test/utils/mixed-608-708-captions.js b/node_modules/mux.js/test/utils/mixed-608-708-captions.js deleted file mode 100644 index ea114e9..0000000 --- a/node_modules/mux.js/test/utils/mixed-608-708-captions.js +++ /dev/null @@ -1,996 +0,0 @@ -module.exports = [ - { type: 1, pts: 7192231956, ccData: 36782 }, - { type: 0, pts: 7192231956, ccData: 38062 }, - { type: 3, pts: 7192231956, ccData: 17186 }, - { type: 2, pts: 7192234926, ccData: 0 }, - { type: 1, pts: 7192234926, ccData: 387 }, - { type: 2, pts: 7192234926, ccData: 36094 }, - { type: 0, pts: 7192234926, ccData: 38062 }, - { type: 2, pts: 7192240866, ccData: 16640 }, - { type: 2, pts: 7192240866, ccData: 39195 }, - { type: 2, pts: 7192240866, ccData: 1283 }, - { type: 2, pts: 7192240866, ccData: 37162 }, - { type: 2, pts: 7192240866, ccData: 42 }, - { type: 2, pts: 7192240866, ccData: 37376 }, - { type: 2, pts: 7192240866, ccData: 1024 }, - { type: 2, pts: 7192240866, ccData: 31 }, - { type: 0, pts: 7192240866, ccData: 37970 }, - { type: 1, pts: 7192240866, ccData: 62196 }, - { type: 2, pts: 7192240866, ccData: 5264 }, - { type: 1, pts: 7192243926, ccData: 26656 }, - { type: 3, pts: 7192243926, ccData: 49955 }, - { type: 0, pts: 7192243926, ccData: 38817 }, - { type: 1, pts: 7192246896, ccData: 22511 }, - { type: 0, pts: 7192246896, ccData: 38817 }, - { type: 2, pts: 7192246896, ccData: 37376 }, - { type: 2, pts: 7192246896, ccData: 1280 }, - { type: 1, pts: 7192249956, ccData: 61284 }, - { type: 0, pts: 7192249956, ccData: 49877 }, - { type: 3, pts: 7192249956, ccData: 802 }, - { type: 1, pts: 7192253016, ccData: 29472 }, - { type: 2, pts: 7192253016, ccData: 0 }, - { type: 0, pts: 7192253016, ccData: 21536 }, - { type: 2, pts: 7192253016, ccData: 16981 }, - { type: 3, pts: 7192253016, ccData: 17186 }, - { type: 3, pts: 7192255986, ccData: 33570 }, - { type: 1, pts: 7192255986, ccData: 19553 }, - { type: 0, pts: 7192255986, ccData: 18772 }, - { type: 2, pts: 7192255986, ccData: 21536 }, - { type: 2, pts: 7192255986, ccData: 0 }, - { type: 0, pts: 7192258956, ccData: 42963 }, - { type: 2, pts: 7192258956, ccData: 18772 }, - { type: 2, pts: 7192258956, ccData: 0 }, - { type: 3, pts: 7192258956, ccData: 49954 }, - { type: 1, pts: 7192258956, ccData: 63418 }, - { type: 0, pts: 7192261926, ccData: 8398 }, - { type: 1, pts: 7192261926, ccData: 8271 }, - { type: 2, pts: 7192261926, ccData: 10067 }, - { type: 2, pts: 7192261926, ccData: 0 }, - { type: 3, pts: 7192261926, ccData: 802 }, - { type: 3, pts: 7192264896, ccData: 17186 }, - { type: 2, pts: 7192264896, ccData: 0 }, - { type: 2, pts: 7192264896, ccData: 8270 }, - { type: 1, pts: 7192264896, ccData: 28192 }, - { type: 0, pts: 7192264896, ccData: 20308 }, - { type: 2, pts: 7192267956, ccData: 0 }, - { type: 2, pts: 7192267956, ccData: 20308 }, - { type: 1, pts: 7192267956, ccData: 62568 }, - { type: 0, pts: 7192267956, ccData: 8403 }, - { type: 3, pts: 7192267956, ccData: 33570 }, - { type: 3, pts: 7192270926, ccData: 49954 }, - { type: 0, pts: 7192270926, ccData: 54598 }, - { type: 2, pts: 7192270926, ccData: 8275 }, - { type: 2, pts: 7192270926, ccData: 0 }, - { type: 1, pts: 7192270926, ccData: 58656 }, - { type: 1, pts: 7192273986, ccData: 51317 }, - { type: 0, pts: 7192273986, ccData: 17989 }, - { type: 2, pts: 7192273986, ccData: 21830 }, - { type: 2, pts: 7192273986, ccData: 0 }, - { type: 3, pts: 7192273986, ccData: 802 }, - { type: 3, pts: 7192277046, ccData: 17186 }, - { type: 2, pts: 7192277046, ccData: 17989 }, - { type: 1, pts: 7192277046, ccData: 28404 }, - { type: 0, pts: 7192277046, ccData: 21065 }, - { type: 2, pts: 7192277046, ccData: 0 }, - { type: 1, pts: 7192279926, ccData: 8360 }, - { type: 2, pts: 7192279926, ccData: 21065 }, - { type: 2, pts: 7192279926, ccData: 0 }, - { type: 3, pts: 7192279926, ccData: 33570 }, - { type: 0, pts: 7192279926, ccData: 52935 }, - { type: 1, pts: 7192282986, ccData: 54245 }, - { type: 0, pts: 7192282986, ccData: 38132 }, - { type: 2, pts: 7192282986, ccData: 20039 }, - { type: 2, pts: 7192282986, ccData: 0 }, - { type: 3, pts: 7192282986, ccData: 51761 }, - { type: 1, pts: 7192285956, ccData: 36667 }, - { type: 2, pts: 7192285956, ccData: 2048 }, - { type: 2, pts: 7192285956, ccData: 39195 }, - { type: 2, pts: 7192285956, ccData: 16640 }, - { type: 2, pts: 7192285956, ccData: 287 }, - { type: 2, pts: 7192285956, ccData: 4240 }, - { type: 2, pts: 7192285956, ccData: 1283 }, - { type: 2, pts: 7192285956, ccData: 37162 }, - { type: 2, pts: 7192285956, ccData: 0 }, - { type: 0, pts: 7192285956, ccData: 38132 }, - { type: 2, pts: 7192285956, ccData: 37377 }, - { type: 3, pts: 7192288926, ccData: 803 }, - { type: 1, pts: 7192288926, ccData: 258 }, - { type: 0, pts: 7192288926, ccData: 38691 }, - { type: 1, pts: 7192291986, ccData: 16448 }, - { type: 2, pts: 7192291986, ccData: 37377 }, - { type: 2, pts: 7192291986, ccData: 2816 }, - { type: 0, pts: 7192291986, ccData: 38691 }, - { type: 1, pts: 7192294956, ccData: 16448 }, - { type: 0, pts: 7192294956, ccData: 21065 }, - { type: 3, pts: 7192294956, ccData: 17186 }, - { type: 0, pts: 7192298016, ccData: 51144 }, - { type: 2, pts: 7192298016, ccData: 21065 }, - { type: 2, pts: 7192298016, ccData: 0 }, - { type: 3, pts: 7192298016, ccData: 33570 }, - { type: 1, pts: 7192298016, ccData: 16512 }, - { type: 1, pts: 7192300986, ccData: 36782 }, - { type: 2, pts: 7192300986, ccData: 0 }, - { type: 2, pts: 7192300986, ccData: 18248 }, - { type: 3, pts: 7192309986, ccData: 33828 }, - { type: 2, pts: 7192309986, ccData: 0 }, - { type: 2, pts: 7192309986, ccData: 22318 }, - { type: 0, pts: 7192309986, ccData: 22446 }, - { type: 1, pts: 7192309986, ccData: 62196 }, - { type: 0, pts: 7192309986, ccData: 37935 }, - { type: 3, pts: 7192309986, ccData: 17186 }, - { type: 2, pts: 7192313046, ccData: 0 }, - { type: 0, pts: 7192313046, ccData: 37935 }, - { type: 1, pts: 7192313046, ccData: 26656 }, - { type: 2, pts: 7192313046, ccData: 35074 }, - { type: 2, pts: 7192313046, ccData: 35841 }, - { type: 0, pts: 7192316016, ccData: 32896 }, - { type: 1, pts: 7192316016, ccData: 22511 }, - { type: 1, pts: 7192318986, ccData: 61284 }, - { type: 0, pts: 7192318986, ccData: 32896 }, - { type: 1, pts: 7192322046, ccData: 29472 }, - { type: 0, pts: 7192322046, ccData: 32896 }, - { type: 1, pts: 7192324926, ccData: 389 }, - { type: 0, pts: 7192324926, ccData: 32896 }, - { type: 0, pts: 7192327986, ccData: 32896 }, - { type: 1, pts: 7192327986, ccData: 51396 }, - { type: 1, pts: 7192331046, ccData: 36831 }, - { type: 0, pts: 7192331046, ccData: 32896 }, - { type: 0, pts: 7192334016, ccData: 32896 }, - { type: 1, pts: 7192334016, ccData: 258 }, - { type: 0, pts: 7192337076, ccData: 32896 }, - { type: 1, pts: 7192337076, ccData: 16448 }, - { type: 1, pts: 7192340046, ccData: 16448 }, - { type: 0, pts: 7192340046, ccData: 32896 }, - { type: 0, pts: 7192343016, ccData: 32896 }, - { type: 1, pts: 7192343016, ccData: 16512 }, - { type: 1, pts: 7192346076, ccData: 36782 }, - { type: 0, pts: 7192346076, ccData: 32896 }, - { type: 0, pts: 7192348956, ccData: 32896 }, - { type: 1, pts: 7192348956, ccData: 387 }, - { type: 1, pts: 7192352016, ccData: 52975 }, - { type: 0, pts: 7192352016, ccData: 32896 }, - { type: 1, pts: 7192355076, ccData: 62196 }, - { type: 0, pts: 7192355076, ccData: 32896 }, - { type: 0, pts: 7192358046, ccData: 32896 }, - { type: 1, pts: 7192358046, ccData: 26656 }, - { type: 1, pts: 7192361106, ccData: 22511 }, - { type: 0, pts: 7192361106, ccData: 32896 }, - { type: 1, pts: 7192364076, ccData: 61284 }, - { type: 0, pts: 7192364076, ccData: 32896 }, - { type: 1, pts: 7192367046, ccData: 29472 }, - { type: 0, pts: 7192367046, ccData: 32896 }, - { type: 1, pts: 7192370016, ccData: 19553 }, - { type: 0, pts: 7192370016, ccData: 32896 }, - { type: 0, pts: 7192372986, ccData: 32896 }, - { type: 1, pts: 7192372986, ccData: 63418 }, - { type: 0, pts: 7192376046, ccData: 32896 }, - { type: 1, pts: 7192376046, ccData: 8271 }, - { type: 0, pts: 7192379106, ccData: 32896 }, - { type: 1, pts: 7192379106, ccData: 28192 }, - { type: 1, pts: 7192382076, ccData: 62568 }, - { type: 0, pts: 7192382076, ccData: 32896 }, - { type: 1, pts: 7192385136, ccData: 58656 }, - { type: 0, pts: 7192385136, ccData: 32896 }, - { type: 0, pts: 7192388106, ccData: 32896 }, - { type: 1, pts: 7192388106, ccData: 51317 }, - { type: 1, pts: 7192391076, ccData: 28404 }, - { type: 0, pts: 7192391076, ccData: 32896 }, - { type: 0, pts: 7192394046, ccData: 32896 }, - { type: 1, pts: 7192394046, ccData: 8360 }, - { type: 1, pts: 7192397016, ccData: 54245 }, - { type: 0, pts: 7192397016, ccData: 32896 }, - { type: 1, pts: 7192400076, ccData: 36667 }, - { type: 0, pts: 7192400076, ccData: 32896 }, - { type: 1, pts: 7192403046, ccData: 258 }, - { type: 0, pts: 7192403046, ccData: 32896 }, - { type: 1, pts: 7192406106, ccData: 16448 }, - { type: 0, pts: 7192406106, ccData: 32896 }, - { type: 1, pts: 7192409166, ccData: 16448 }, - { type: 0, pts: 7192409166, ccData: 32896 }, - { type: 1, pts: 7192412136, ccData: 16512 }, - { type: 0, pts: 7192412136, ccData: 32896 }, - { type: 0, pts: 7192415106, ccData: 32896 }, - { type: 1, pts: 7192415106, ccData: 36782 }, - { type: 1, pts: 7192418076, ccData: 387 }, - { type: 0, pts: 7192418076, ccData: 32896 }, - { type: 1, pts: 7192421046, ccData: 52975 }, - { type: 0, pts: 7192421046, ccData: 32896 }, - { type: 1, pts: 7192424106, ccData: 62196 }, - { type: 0, pts: 7192424106, ccData: 32896 }, - { type: 0, pts: 7192427076, ccData: 32896 }, - { type: 1, pts: 7192427076, ccData: 26656 }, - { type: 1, pts: 7192430136, ccData: 22511 }, - { type: 0, pts: 7192430136, ccData: 32896 }, - { type: 1, pts: 7192433196, ccData: 61284 }, - { type: 0, pts: 7192433196, ccData: 32896 }, - { type: 1, pts: 7192436166, ccData: 29472 }, - { type: 0, pts: 7192436166, ccData: 32896 }, - { type: 0, pts: 7192439136, ccData: 32896 }, - { type: 1, pts: 7192439136, ccData: 19553 }, - { type: 1, pts: 7192442106, ccData: 63418 }, - { type: 0, pts: 7192442106, ccData: 37920 }, - { type: 0, pts: 7192445076, ccData: 37920 }, - { type: 1, pts: 7192445076, ccData: 8271 }, - { type: 1, pts: 7192448136, ccData: 28192 }, - { type: 3, pts: 7192448136, ccData: 49954 }, - { type: 0, pts: 7192448136, ccData: 38062 }, - { type: 2, pts: 7192451106, ccData: 36093 }, - { type: 1, pts: 7192451106, ccData: 62568 }, - { type: 0, pts: 7192451106, ccData: 38062 }, - { type: 2, pts: 7192451106, ccData: 0 }, - { type: 0, pts: 7192454166, ccData: 38000 }, - { type: 3, pts: 7192454166, ccData: 2609 }, - { type: 1, pts: 7192454166, ccData: 58656 }, - { type: 0, pts: 7192457226, ccData: 38000 }, - { type: 2, pts: 7192457226, ccData: 38939 }, - { type: 2, pts: 7192457226, ccData: 17920 }, - { type: 2, pts: 7192457226, ccData: 31 }, - { type: 2, pts: 7192457226, ccData: 5264 }, - { type: 2, pts: 7192457226, ccData: 1283 }, - { type: 2, pts: 7192457226, ccData: 37162 }, - { type: 2, pts: 7192457226, ccData: 42 }, - { type: 2, pts: 7192457226, ccData: 37376 }, - { type: 2, pts: 7192457226, ccData: 0 }, - { type: 1, pts: 7192457226, ccData: 51317 }, - { type: 1, pts: 7192460106, ccData: 28404 }, - { type: 0, pts: 7192460106, ccData: 38818 }, - { type: 3, pts: 7192460106, ccData: 17187 }, - { type: 2, pts: 7192463166, ccData: 512 }, - { type: 1, pts: 7192463166, ccData: 8360 }, - { type: 0, pts: 7192463166, ccData: 38818 }, - { type: 2, pts: 7192463166, ccData: 37376 }, - { type: 0, pts: 7192466136, ccData: 18772 }, - { type: 1, pts: 7192466136, ccData: 54245 }, - { type: 3, pts: 7192466136, ccData: 33570 }, - { type: 3, pts: 7192469106, ccData: 49954 }, - { type: 2, pts: 7192469106, ccData: 0 }, - { type: 0, pts: 7192469106, ccData: 42963 }, - { type: 1, pts: 7192469106, ccData: 36667 }, - { type: 2, pts: 7192469106, ccData: 18772 }, - { type: 2, pts: 7192472166, ccData: 10067 }, - { type: 2, pts: 7192472166, ccData: 0 }, - { type: 3, pts: 7192472166, ccData: 802 }, - { type: 0, pts: 7192472166, ccData: 8398 }, - { type: 1, pts: 7192472166, ccData: 258 }, - { type: 2, pts: 7192475136, ccData: 8270 }, - { type: 0, pts: 7192475136, ccData: 20308 }, - { type: 3, pts: 7192475136, ccData: 17186 }, - { type: 2, pts: 7192475136, ccData: 0 }, - { type: 1, pts: 7192475136, ccData: 16448 }, - { type: 1, pts: 7192478196, ccData: 16448 }, - { type: 0, pts: 7192478196, ccData: 8385 }, - { type: 2, pts: 7192478196, ccData: 20308 }, - { type: 2, pts: 7192478196, ccData: 0 }, - { type: 3, pts: 7192478196, ccData: 33570 }, - { type: 2, pts: 7192481166, ccData: 8257 }, - { type: 0, pts: 7192481166, ccData: 8276 }, - { type: 2, pts: 7192481166, ccData: 0 }, - { type: 1, pts: 7192481166, ccData: 16512 }, - { type: 3, pts: 7192481166, ccData: 49954 }, - { type: 3, pts: 7192484136, ccData: 802 }, - { type: 2, pts: 7192484136, ccData: 0 }, - { type: 1, pts: 7192484136, ccData: 36782 }, - { type: 0, pts: 7192484136, ccData: 51282 }, - { type: 2, pts: 7192484136, ccData: 8276 }, - { type: 3, pts: 7192487196, ccData: 17186 }, - { type: 0, pts: 7192487196, ccData: 17857 }, - { type: 2, pts: 7192487196, ccData: 18514 }, - { type: 2, pts: 7192487196, ccData: 0 }, - { type: 1, pts: 7192487196, ccData: 387 }, - { type: 3, pts: 7192490166, ccData: 33570 }, - { type: 1, pts: 7192490166, ccData: 52975 }, - { type: 0, pts: 7192490166, ccData: 21536 }, - { type: 2, pts: 7192490166, ccData: 17729 }, - { type: 2, pts: 7192490166, ccData: 0 }, - { type: 2, pts: 7192493226, ccData: 21536 }, - { type: 3, pts: 7192493226, ccData: 49954 }, - { type: 2, pts: 7192493226, ccData: 0 }, - { type: 0, pts: 7192493226, ccData: 21583 }, - { type: 1, pts: 7192493226, ccData: 62196 }, - { type: 1, pts: 7192496196, ccData: 26656 }, - { type: 0, pts: 7192496196, ccData: 8385 }, - { type: 2, pts: 7192496196, ccData: 21583 }, - { type: 2, pts: 7192496196, ccData: 0 }, - { type: 3, pts: 7192496196, ccData: 802 }, - { type: 1, pts: 7192499166, ccData: 22511 }, - { type: 0, pts: 7192499166, ccData: 52953 }, - { type: 2, pts: 7192499166, ccData: 8257 }, - { type: 2, pts: 7192499166, ccData: 0 }, - { type: 3, pts: 7192499166, ccData: 17186 }, - { type: 2, pts: 7192502226, ccData: 0 }, - { type: 2, pts: 7192502226, ccData: 20057 }, - { type: 3, pts: 7192502226, ccData: 33570 }, - { type: 1, pts: 7192502226, ccData: 61284 }, - { type: 0, pts: 7192502226, ccData: 49743 }, - { type: 3, pts: 7192505106, ccData: 49954 }, - { type: 2, pts: 7192505106, ccData: 0 }, - { type: 0, pts: 7192505106, ccData: 50393 }, - { type: 1, pts: 7192505106, ccData: 29472 }, - { type: 2, pts: 7192505106, ccData: 16975 }, - { type: 2, pts: 7192508166, ccData: 17497 }, - { type: 3, pts: 7192508166, ccData: 802 }, - { type: 0, pts: 7192508166, ccData: 44672 }, - { type: 2, pts: 7192508166, ccData: 0 }, - { type: 1, pts: 7192508166, ccData: 389 }, - { type: 2, pts: 7192511226, ccData: 11776 }, - { type: 2, pts: 7192511226, ccData: 0 }, - { type: 1, pts: 7192511226, ccData: 51396 }, - { type: 0, pts: 7192511226, ccData: 37935 }, - { type: 3, pts: 7192511226, ccData: 17444 }, - { type: 0, pts: 7192514196, ccData: 37935 }, - { type: 2, pts: 7192514196, ccData: 35842 }, - { type: 2, pts: 7192514196, ccData: 35073 }, - { type: 2, pts: 7192514196, ccData: 0 }, - { type: 1, pts: 7192514196, ccData: 36831 }, - { type: 0, pts: 7192517256, ccData: 32896 }, - { type: 1, pts: 7192517256, ccData: 258 }, - { type: 1, pts: 7192520226, ccData: 16448 }, - { type: 0, pts: 7192520226, ccData: 32896 }, - { type: 1, pts: 7192523196, ccData: 16448 }, - { type: 0, pts: 7192523196, ccData: 32896 }, - { type: 1, pts: 7192526256, ccData: 16512 }, - { type: 0, pts: 7192526256, ccData: 32896 }, - { type: 1, pts: 7192529136, ccData: 36782 }, - { type: 0, pts: 7192529136, ccData: 32896 }, - { type: 1, pts: 7192532196, ccData: 387 }, - { type: 0, pts: 7192532196, ccData: 32896 }, - { type: 1, pts: 7192535256, ccData: 52975 }, - { type: 0, pts: 7192535256, ccData: 32896 }, - { type: 1, pts: 7192538226, ccData: 62196 }, - { type: 0, pts: 7192538226, ccData: 32896 }, - { type: 1, pts: 7192541286, ccData: 26656 }, - { type: 0, pts: 7192541286, ccData: 32896 }, - { type: 1, pts: 7192544256, ccData: 22511 }, - { type: 0, pts: 7192544256, ccData: 32896 }, - { type: 1, pts: 7192547226, ccData: 61284 }, - { type: 0, pts: 7192547226, ccData: 32896 }, - { type: 1, pts: 7192550196, ccData: 29472 }, - { type: 0, pts: 7192550196, ccData: 32896 }, - { type: 0, pts: 7192553166, ccData: 32896 }, - { type: 1, pts: 7192553166, ccData: 19553 }, - { type: 0, pts: 7192556226, ccData: 32896 }, - { type: 1, pts: 7192556226, ccData: 63418 }, - { type: 1, pts: 7192559286, ccData: 8271 }, - { type: 0, pts: 7192559286, ccData: 32896 }, - { type: 1, pts: 7192562256, ccData: 28192 }, - { type: 0, pts: 7192562256, ccData: 32896 }, - { type: 1, pts: 7192565316, ccData: 62568 }, - { type: 0, pts: 7192565316, ccData: 32896 }, - { type: 1, pts: 7192568286, ccData: 58656 }, - { type: 0, pts: 7192568286, ccData: 32896 }, - { type: 1, pts: 7192571256, ccData: 51317 }, - { type: 0, pts: 7192571256, ccData: 32896 }, - { type: 1, pts: 7192574226, ccData: 28404 }, - { type: 0, pts: 7192574226, ccData: 32896 }, - { type: 1, pts: 7192577196, ccData: 8360 }, - { type: 0, pts: 7192577196, ccData: 32896 }, - { type: 0, pts: 7192580256, ccData: 32896 }, - { type: 1, pts: 7192580256, ccData: 54245 }, - { type: 1, pts: 7192583226, ccData: 36667 }, - { type: 0, pts: 7192583226, ccData: 32896 }, - { type: 1, pts: 7192586286, ccData: 258 }, - { type: 0, pts: 7192586286, ccData: 32896 }, - { type: 0, pts: 7192589346, ccData: 32896 }, - { type: 1, pts: 7192589346, ccData: 16448 }, - { type: 1, pts: 7192592316, ccData: 16448 }, - { type: 0, pts: 7192592316, ccData: 32896 }, - { type: 0, pts: 7192595286, ccData: 32896 }, - { type: 1, pts: 7192595286, ccData: 16512 }, - { type: 0, pts: 7192598256, ccData: 32896 }, - { type: 1, pts: 7192598256, ccData: 36782 }, - { type: 1, pts: 7192601226, ccData: 387 }, - { type: 0, pts: 7192601226, ccData: 32896 }, - { type: 0, pts: 7192604286, ccData: 32896 }, - { type: 1, pts: 7192604286, ccData: 52975 }, - { type: 1, pts: 7192607256, ccData: 62196 }, - { type: 0, pts: 7192607256, ccData: 32896 }, - { type: 1, pts: 7192610316, ccData: 26656 }, - { type: 0, pts: 7192610316, ccData: 32896 }, - { type: 0, pts: 7192613376, ccData: 32896 }, - { type: 1, pts: 7192613376, ccData: 22511 }, - { type: 0, pts: 7192616346, ccData: 32896 }, - { type: 1, pts: 7192616346, ccData: 61284 }, - { type: 0, pts: 7192619316, ccData: 32896 }, - { type: 1, pts: 7192619316, ccData: 29472 }, - { type: 0, pts: 7192622286, ccData: 32896 }, - { type: 1, pts: 7192622286, ccData: 19553 }, - { type: 1, pts: 7192625256, ccData: 63418 }, - { type: 0, pts: 7192625256, ccData: 32896 }, - { type: 1, pts: 7192628316, ccData: 8271 }, - { type: 0, pts: 7192628316, ccData: 32896 }, - { type: 0, pts: 7192631286, ccData: 37920 }, - { type: 1, pts: 7192631286, ccData: 28192 }, - { type: 1, pts: 7192634346, ccData: 62568 }, - { type: 0, pts: 7192634346, ccData: 37920 }, - { type: 1, pts: 7192637406, ccData: 58656 }, - { type: 3, pts: 7192637406, ccData: 33570 }, - { type: 0, pts: 7192637406, ccData: 38062 }, - { type: 2, pts: 7192640286, ccData: 0 }, - { type: 1, pts: 7192640286, ccData: 51317 }, - { type: 0, pts: 7192640286, ccData: 38062 }, - { type: 2, pts: 7192640286, ccData: 36094 }, - { type: 1, pts: 7192643346, ccData: 28404 }, - { type: 3, pts: 7192643346, ccData: 51761 }, - { type: 0, pts: 7192643346, ccData: 38096 }, - { type: 1, pts: 7192646316, ccData: 8360 }, - { type: 0, pts: 7192646316, ccData: 38096 }, - { type: 2, pts: 7192646316, ccData: 39195 }, - { type: 2, pts: 7192646316, ccData: 16640 }, - { type: 2, pts: 7192646316, ccData: 31 }, - { type: 2, pts: 7192646316, ccData: 5264 }, - { type: 2, pts: 7192646316, ccData: 1283 }, - { type: 2, pts: 7192646316, ccData: 37162 }, - { type: 2, pts: 7192646316, ccData: 42 }, - { type: 2, pts: 7192646316, ccData: 37376 }, - { type: 2, pts: 7192646316, ccData: 0 }, - { type: 3, pts: 7192649286, ccData: 802 }, - { type: 0, pts: 7192649286, ccData: 22341 }, - { type: 1, pts: 7192649286, ccData: 54245 }, - { type: 0, pts: 7192652346, ccData: 8276 }, - { type: 1, pts: 7192652346, ccData: 36667 }, - { type: 2, pts: 7192652346, ccData: 0 }, - { type: 3, pts: 7192652346, ccData: 17186 }, - { type: 2, pts: 7192652346, ccData: 22341 }, - { type: 0, pts: 7192655316, ccData: 21209 }, - { type: 2, pts: 7192655316, ccData: 8276 }, - { type: 1, pts: 7192655316, ccData: 258 }, - { type: 3, pts: 7192655316, ccData: 33570 }, - { type: 2, pts: 7192655316, ccData: 0 }, - { type: 1, pts: 7192658376, ccData: 16448 }, - { type: 0, pts: 7192658376, ccData: 8398 }, - { type: 2, pts: 7192658376, ccData: 21081 }, - { type: 2, pts: 7192658376, ccData: 0 }, - { type: 3, pts: 7192658376, ccData: 49954 }, - { type: 0, pts: 7192661346, ccData: 20308 }, - { type: 2, pts: 7192661346, ccData: 8270 }, - { type: 2, pts: 7192661346, ccData: 0 }, - { type: 3, pts: 7192661346, ccData: 802 }, - { type: 1, pts: 7192661346, ccData: 16448 }, - { type: 0, pts: 7192664316, ccData: 8276 }, - { type: 2, pts: 7192664316, ccData: 20308 }, - { type: 2, pts: 7192664316, ccData: 0 }, - { type: 3, pts: 7192664316, ccData: 17186 }, - { type: 1, pts: 7192664316, ccData: 16512 }, - { type: 0, pts: 7192667376, ccData: 20256 }, - { type: 1, pts: 7192667376, ccData: 36782 }, - { type: 2, pts: 7192667376, ccData: 8276 }, - { type: 2, pts: 7192667376, ccData: 0 }, - { type: 3, pts: 7192667376, ccData: 33570 }, - { type: 3, pts: 7192670346, ccData: 49954 }, - { type: 1, pts: 7192670346, ccData: 387 }, - { type: 0, pts: 7192670346, ccData: 53461 }, - { type: 2, pts: 7192670346, ccData: 20256 }, - { type: 2, pts: 7192670346, ccData: 0 }, - { type: 0, pts: 7192673406, ccData: 21536 }, - { type: 3, pts: 7192673406, ccData: 802 }, - { type: 2, pts: 7192673406, ccData: 0 }, - { type: 2, pts: 7192673406, ccData: 20565 }, - { type: 1, pts: 7192673406, ccData: 52975 }, - { type: 1, pts: 7192676376, ccData: 62196 }, - { type: 2, pts: 7192676376, ccData: 21536 }, - { type: 2, pts: 7192676376, ccData: 0 }, - { type: 3, pts: 7192676376, ccData: 17186 }, - { type: 0, pts: 7192676376, ccData: 49614 }, - { type: 0, pts: 7192679346, ccData: 8385 }, - { type: 2, pts: 7192679346, ccData: 16718 }, - { type: 1, pts: 7192679346, ccData: 26656 }, - { type: 3, pts: 7192679346, ccData: 33570 }, - { type: 2, pts: 7192679346, ccData: 0 }, - { type: 1, pts: 7192682406, ccData: 22511 }, - { type: 0, pts: 7192682406, ccData: 52809 }, - { type: 2, pts: 7192682406, ccData: 8257 }, - { type: 2, pts: 7192682406, ccData: 0 }, - { type: 3, pts: 7192682406, ccData: 49954 }, - { type: 0, pts: 7192685286, ccData: 52673 }, - { type: 2, pts: 7192685286, ccData: 20041 }, - { type: 2, pts: 7192685286, ccData: 0 }, - { type: 3, pts: 7192685286, ccData: 802 }, - { type: 1, pts: 7192685286, ccData: 61284 }, - { type: 1, pts: 7192688346, ccData: 389 }, - { type: 0, pts: 7192688346, ccData: 19488 }, - { type: 2, pts: 7192688346, ccData: 19777 }, - { type: 2, pts: 7192688346, ccData: 0 }, - { type: 3, pts: 7192688346, ccData: 17186 }, - { type: 3, pts: 7192691406, ccData: 33570 }, - { type: 2, pts: 7192691406, ccData: 0 }, - { type: 2, pts: 7192691406, ccData: 19488 }, - { type: 0, pts: 7192691406, ccData: 50255 }, - { type: 1, pts: 7192691406, ccData: 51396 }, - { type: 1, pts: 7192694376, ccData: 36831 }, - { type: 0, pts: 7192694376, ccData: 22478 }, - { type: 2, pts: 7192694376, ccData: 17487 }, - { type: 2, pts: 7192694376, ccData: 0 }, - { type: 3, pts: 7192694376, ccData: 49954 }, - { type: 3, pts: 7192697436, ccData: 2609 }, - { type: 1, pts: 7192697436, ccData: 258 }, - { type: 2, pts: 7192697436, ccData: 22350 }, - { type: 2, pts: 7192697436, ccData: 0 }, - { type: 0, pts: 7192697436, ccData: 38130 }, - { type: 2, pts: 7192700406, ccData: 1024 }, - { type: 0, pts: 7192700406, ccData: 38130 }, - { type: 2, pts: 7192700406, ccData: 16640 }, - { type: 2, pts: 7192700406, ccData: 287 }, - { type: 2, pts: 7192700406, ccData: 4240 }, - { type: 2, pts: 7192700406, ccData: 1283 }, - { type: 2, pts: 7192700406, ccData: 37162 }, - { type: 2, pts: 7192700406, ccData: 0 }, - { type: 2, pts: 7192700406, ccData: 37377 }, - { type: 2, pts: 7192700406, ccData: 39195 }, - { type: 1, pts: 7192700406, ccData: 16448 }, - { type: 0, pts: 7192703376, ccData: 38818 }, - { type: 3, pts: 7192703376, ccData: 17187 }, - { type: 1, pts: 7192703376, ccData: 16448 }, - { type: 1, pts: 7192706436, ccData: 16512 }, - { type: 0, pts: 7192706436, ccData: 38818 }, - { type: 2, pts: 7192706436, ccData: 37377 }, - { type: 2, pts: 7192706436, ccData: 1536 }, - { type: 3, pts: 7192709316, ccData: 33570 }, - { type: 1, pts: 7192709316, ccData: 36782 }, - { type: 0, pts: 7192709316, ccData: 18758 }, - { type: 1, pts: 7192712376, ccData: 387 }, - { type: 0, pts: 7192712376, ccData: 8279 }, - { type: 2, pts: 7192712376, ccData: 18758 }, - { type: 2, pts: 7192712376, ccData: 0 }, - { type: 3, pts: 7192712376, ccData: 49954 }, - { type: 1, pts: 7192715436, ccData: 52975 }, - { type: 0, pts: 7192715436, ccData: 17696 }, - { type: 2, pts: 7192715436, ccData: 8279 }, - { type: 2, pts: 7192715436, ccData: 0 }, - { type: 3, pts: 7192715436, ccData: 802 }, - { type: 3, pts: 7192718406, ccData: 17186 }, - { type: 1, pts: 7192718406, ccData: 62196 }, - { type: 2, pts: 7192718406, ccData: 0 }, - { type: 0, pts: 7192718406, ccData: 50255 }, - { type: 2, pts: 7192718406, ccData: 17696 }, - { type: 3, pts: 7192721466, ccData: 33570 }, - { type: 2, pts: 7192721466, ccData: 17487 }, - { type: 0, pts: 7192721466, ccData: 52903 }, - { type: 1, pts: 7192721466, ccData: 26656 }, - { type: 2, pts: 7192721466, ccData: 0 }, - { type: 1, pts: 7192724436, ccData: 22511 }, - { type: 0, pts: 7192724436, ccData: 21536 }, - { type: 2, pts: 7192724436, ccData: 20007 }, - { type: 2, pts: 7192724436, ccData: 0 }, - { type: 3, pts: 7192724436, ccData: 49954 }, - { type: 2, pts: 7192727406, ccData: 0 }, - { type: 2, pts: 7192727406, ccData: 21536 }, - { type: 0, pts: 7192727406, ccData: 51393 }, - { type: 1, pts: 7192727406, ccData: 61284 }, - { type: 3, pts: 7192727406, ccData: 802 }, - { type: 0, pts: 7192730376, ccData: 54853 }, - { type: 1, pts: 7192730376, ccData: 29472 }, - { type: 2, pts: 7192730376, ccData: 18497 }, - { type: 2, pts: 7192730376, ccData: 0 }, - { type: 3, pts: 7192730376, ccData: 17186 }, - { type: 2, pts: 7192733346, ccData: 22085 }, - { type: 3, pts: 7192733346, ccData: 33570 }, - { type: 0, pts: 7192733346, ccData: 8276 }, - { type: 1, pts: 7192733346, ccData: 19553 }, - { type: 2, pts: 7192733346, ccData: 0 }, - { type: 1, pts: 7192736406, ccData: 63418 }, - { type: 2, pts: 7192736406, ccData: 0 }, - { type: 3, pts: 7192736406, ccData: 49954 }, - { type: 2, pts: 7192736406, ccData: 8276 }, - { type: 0, pts: 7192736406, ccData: 20398 }, - { type: 1, pts: 7192739466, ccData: 8271 }, - { type: 0, pts: 7192739466, ccData: 37935 }, - { type: 2, pts: 7192739466, ccData: 20270 }, - { type: 2, pts: 7192739466, ccData: 0 }, - { type: 3, pts: 7192739466, ccData: 1060 }, - { type: 0, pts: 7192742436, ccData: 37935 }, - { type: 2, pts: 7192742436, ccData: 35841 }, - { type: 2, pts: 7192742436, ccData: 35074 }, - { type: 2, pts: 7192742436, ccData: 0 }, - { type: 1, pts: 7192742436, ccData: 28192 }, - { type: 1, pts: 7192745496, ccData: 62568 }, - { type: 0, pts: 7192745496, ccData: 32896 }, - { type: 1, pts: 7192748466, ccData: 58656 }, - { type: 0, pts: 7192748466, ccData: 32896 }, - { type: 1, pts: 7192751436, ccData: 51317 }, - { type: 0, pts: 7192751436, ccData: 32896 }, - { type: 1, pts: 7192754406, ccData: 28404 }, - { type: 0, pts: 7192754406, ccData: 32896 }, - { type: 0, pts: 7192757376, ccData: 32896 }, - { type: 1, pts: 7192757376, ccData: 8360 }, - { type: 1, pts: 7192760436, ccData: 54245 }, - { type: 0, pts: 7192760436, ccData: 32896 }, - { type: 1, pts: 7192763406, ccData: 36667 }, - { type: 0, pts: 7192763406, ccData: 32896 }, - { type: 1, pts: 7192766466, ccData: 258 }, - { type: 0, pts: 7192766466, ccData: 32896 }, - { type: 1, pts: 7192769526, ccData: 16448 }, - { type: 0, pts: 7192769526, ccData: 32896 }, - { type: 1, pts: 7192772496, ccData: 16448 }, - { type: 0, pts: 7192772496, ccData: 32896 }, - { type: 1, pts: 7192775466, ccData: 16512 }, - { type: 0, pts: 7192775466, ccData: 32896 }, - { type: 1, pts: 7192778436, ccData: 36782 }, - { type: 0, pts: 7192778436, ccData: 32896 }, - { type: 1, pts: 7192781406, ccData: 387 }, - { type: 0, pts: 7192781406, ccData: 32896 }, - { type: 1, pts: 7192784466, ccData: 52975 }, - { type: 0, pts: 7192784466, ccData: 32896 }, - { type: 0, pts: 7192787436, ccData: 32896 }, - { type: 1, pts: 7192787436, ccData: 62196 }, - { type: 1, pts: 7192790496, ccData: 26656 }, - { type: 0, pts: 7192790496, ccData: 32896 }, - { type: 0, pts: 7192793556, ccData: 32896 }, - { type: 1, pts: 7192793556, ccData: 22511 }, - { type: 0, pts: 7192796526, ccData: 32896 }, - { type: 1, pts: 7192796526, ccData: 61284 }, - { type: 1, pts: 7192799496, ccData: 29472 }, - { type: 0, pts: 7192799496, ccData: 32896 }, - { type: 1, pts: 7192802466, ccData: 19553 }, - { type: 0, pts: 7192802466, ccData: 32896 }, - { type: 1, pts: 7192805436, ccData: 63418 }, - { type: 0, pts: 7192805436, ccData: 32896 }, - { type: 1, pts: 7192808496, ccData: 8271 }, - { type: 0, pts: 7192808496, ccData: 32896 }, - { type: 0, pts: 7192811466, ccData: 32896 }, - { type: 1, pts: 7192811466, ccData: 28192 }, - { type: 1, pts: 7192814526, ccData: 62568 }, - { type: 0, pts: 7192814526, ccData: 32896 }, - { type: 1, pts: 7192817586, ccData: 58656 }, - { type: 0, pts: 7192817586, ccData: 32896 }, - { type: 0, pts: 7192820466, ccData: 32896 }, - { type: 1, pts: 7192820466, ccData: 51317 }, - { type: 0, pts: 7192823526, ccData: 32896 }, - { type: 1, pts: 7192823526, ccData: 28404 }, - { type: 1, pts: 7192826496, ccData: 8360 }, - { type: 0, pts: 7192826496, ccData: 32896 }, - { type: 0, pts: 7192829466, ccData: 32896 }, - { type: 1, pts: 7192829466, ccData: 54245 }, - { type: 1, pts: 7192832526, ccData: 36667 }, - { type: 0, pts: 7192832526, ccData: 32896 }, - { type: 1, pts: 7192835496, ccData: 258 }, - { type: 0, pts: 7192835496, ccData: 32896 }, - { type: 1, pts: 7192838556, ccData: 16448 }, - { type: 0, pts: 7192838556, ccData: 32896 }, - { type: 0, pts: 7192841526, ccData: 32896 }, - { type: 1, pts: 7192841526, ccData: 16448 }, - { type: 1, pts: 7192844496, ccData: 16512 }, - { type: 0, pts: 7192844496, ccData: 32896 }, - { type: 1, pts: 7192847556, ccData: 36782 }, - { type: 0, pts: 7192847556, ccData: 32896 }, - { type: 1, pts: 7192850526, ccData: 387 }, - { type: 0, pts: 7192850526, ccData: 32896 }, - { type: 1, pts: 7192853586, ccData: 52975 }, - { type: 0, pts: 7192853586, ccData: 37920 }, - { type: 0, pts: 7192856556, ccData: 37920 }, - { type: 1, pts: 7192856556, ccData: 62196 }, - { type: 1, pts: 7192859526, ccData: 26656 }, - { type: 0, pts: 7192859526, ccData: 38062 }, - { type: 3, pts: 7192859526, ccData: 17186 }, - { type: 1, pts: 7192862586, ccData: 22511 }, - { type: 0, pts: 7192862586, ccData: 38062 }, - { type: 2, pts: 7192862586, ccData: 36093 }, - { type: 2, pts: 7192862586, ccData: 0 }, - { type: 0, pts: 7192865466, ccData: 4982 }, - { type: 1, pts: 7192865466, ccData: 61284 }, - { type: 3, pts: 7192865466, ccData: 35377 }, - { type: 2, pts: 7192868526, ccData: 3072 }, - { type: 2, pts: 7192868526, ccData: 37376 }, - { type: 2, pts: 7192868526, ccData: 42 }, - { type: 2, pts: 7192868526, ccData: 37162 }, - { type: 1, pts: 7192868526, ccData: 29472 }, - { type: 0, pts: 7192868526, ccData: 4982 }, - { type: 2, pts: 7192868526, ccData: 38939 }, - { type: 2, pts: 7192868526, ccData: 15360 }, - { type: 2, pts: 7192868526, ccData: 31 }, - { type: 2, pts: 7192868526, ccData: 5264 }, - { type: 2, pts: 7192868526, ccData: 1283 }, - { type: 1, pts: 7192871586, ccData: 389 }, - { type: 0, pts: 7192871586, ccData: 52833 }, - { type: 3, pts: 7192871586, ccData: 49954 }, - { type: 2, pts: 7192874556, ccData: 0 }, - { type: 1, pts: 7192874556, ccData: 51396 }, - { type: 0, pts: 7192874556, ccData: 62194 }, - { type: 2, pts: 7192874556, ccData: 20065 }, - { type: 3, pts: 7192874556, ccData: 802 }, - { type: 0, pts: 7192877616, ccData: 25076 }, - { type: 2, pts: 7192877616, ccData: 29298 }, - { type: 3, pts: 7192877616, ccData: 17186 }, - { type: 1, pts: 7192877616, ccData: 36831 }, - { type: 2, pts: 7192877616, ccData: 0 }, - { type: 3, pts: 7192880586, ccData: 33570 }, - { type: 2, pts: 7192880586, ccData: 0 }, - { type: 2, pts: 7192880586, ccData: 24948 }, - { type: 0, pts: 7192880586, ccData: 61426 }, - { type: 1, pts: 7192880586, ccData: 258 }, - { type: 3, pts: 7192883556, ccData: 49954 }, - { type: 2, pts: 7192883556, ccData: 0 }, - { type: 2, pts: 7192883556, ccData: 28530 }, - { type: 0, pts: 7192883556, ccData: 47744 }, - { type: 1, pts: 7192883556, ccData: 16448 }, - { type: 3, pts: 7192886616, ccData: 2609 }, - { type: 1, pts: 7192886616, ccData: 16448 }, - { type: 0, pts: 7192886616, ccData: 38096 }, - { type: 2, pts: 7192886616, ccData: 14848 }, - { type: 2, pts: 7192886616, ccData: 0 }, - { type: 2, pts: 7192889496, ccData: 287 }, - { type: 2, pts: 7192889496, ccData: 15360 }, - { type: 2, pts: 7192889496, ccData: 38939 }, - { type: 0, pts: 7192889496, ccData: 38096 }, - { type: 2, pts: 7192889496, ccData: 0 }, - { type: 2, pts: 7192889496, ccData: 37162 }, - { type: 2, pts: 7192889496, ccData: 1283 }, - { type: 2, pts: 7192889496, ccData: 4240 }, - { type: 2, pts: 7192889496, ccData: 0 }, - { type: 2, pts: 7192889496, ccData: 37377 }, - { type: 1, pts: 7192889496, ccData: 16512 }, - { type: 1, pts: 7192892556, ccData: 36782 }, - { type: 3, pts: 7192892556, ccData: 17187 }, - { type: 0, pts: 7192892556, ccData: 38817 }, - { type: 0, pts: 7192895616, ccData: 38817 }, - { type: 1, pts: 7192895616, ccData: 387 }, - { type: 2, pts: 7192895616, ccData: 256 }, - { type: 2, pts: 7192895616, ccData: 37377 }, - { type: 1, pts: 7192898586, ccData: 52975 }, - { type: 0, pts: 7192898586, ccData: 18758 }, - { type: 3, pts: 7192898586, ccData: 33570 }, - { type: 0, pts: 7192901646, ccData: 8276 }, - { type: 2, pts: 7192901646, ccData: 18758 }, - { type: 2, pts: 7192901646, ccData: 0 }, - { type: 3, pts: 7192901646, ccData: 49954 }, - { type: 1, pts: 7192901646, ccData: 62196 }, - { type: 1, pts: 7192904616, ccData: 26656 }, - { type: 0, pts: 7192904616, ccData: 51269 }, - { type: 2, pts: 7192904616, ccData: 8276 }, - { type: 2, pts: 7192904616, ccData: 0 }, - { type: 3, pts: 7192904616, ccData: 802 }, - { type: 3, pts: 7192907586, ccData: 17186 }, - { type: 2, pts: 7192907586, ccData: 0 }, - { type: 2, pts: 7192907586, ccData: 18501 }, - { type: 0, pts: 7192907586, ccData: 8403 }, - { type: 1, pts: 7192907586, ccData: 22511 }, - { type: 1, pts: 7192910556, ccData: 61284 }, - { type: 0, pts: 7192910556, ccData: 18755 }, - { type: 2, pts: 7192910556, ccData: 8275 }, - { type: 2, pts: 7192910556, ccData: 0 }, - { type: 3, pts: 7192910556, ccData: 33570 }, - { type: 3, pts: 7192913526, ccData: 49954 }, - { type: 1, pts: 7192913526, ccData: 29472 }, - { type: 2, pts: 7192913526, ccData: 18755 }, - { type: 2, pts: 7192913526, ccData: 0 }, - { type: 0, pts: 7192913526, ccData: 52000 }, - { type: 0, pts: 7192916586, ccData: 49614 }, - { type: 2, pts: 7192916586, ccData: 19232 }, - { type: 2, pts: 7192916586, ccData: 0 }, - { type: 3, pts: 7192916586, ccData: 802 }, - { type: 1, pts: 7192916586, ccData: 19553 }, - { type: 0, pts: 7192919646, ccData: 50208 }, - { type: 1, pts: 7192919646, ccData: 63418 }, - { type: 2, pts: 7192919646, ccData: 16718 }, - { type: 2, pts: 7192919646, ccData: 0 }, - { type: 3, pts: 7192919646, ccData: 17186 }, - { type: 3, pts: 7192922616, ccData: 33570 }, - { type: 1, pts: 7192922616, ccData: 8271 }, - { type: 0, pts: 7192922616, ccData: 17989 }, - { type: 2, pts: 7192922616, ccData: 17440 }, - { type: 2, pts: 7192922616, ccData: 0 }, - { type: 2, pts: 7192925676, ccData: 17989 }, - { type: 3, pts: 7192925676, ccData: 49954 }, - { type: 0, pts: 7192925676, ccData: 49490 }, - { type: 1, pts: 7192925676, ccData: 28192 }, - { type: 2, pts: 7192925676, ccData: 0 }, - { type: 0, pts: 7192928646, ccData: 19525 }, - { type: 2, pts: 7192928646, ccData: 16722 }, - { type: 2, pts: 7192928646, ccData: 0 }, - { type: 3, pts: 7192928646, ccData: 802 }, - { type: 1, pts: 7192928646, ccData: 62568 }, - { type: 0, pts: 7192931616, ccData: 54227 }, - { type: 1, pts: 7192931616, ccData: 58656 }, - { type: 3, pts: 7192931616, ccData: 17186 }, - { type: 2, pts: 7192931616, ccData: 19525 }, - { type: 2, pts: 7192931616, ccData: 0 }, - { type: 1, pts: 7192934586, ccData: 51317 }, - { type: 0, pts: 7192934586, ccData: 8397 }, - { type: 2, pts: 7192934586, ccData: 21331 }, - { type: 2, pts: 7192934586, ccData: 0 }, - { type: 3, pts: 7192934586, ccData: 33570 }, - { type: 2, pts: 7192937556, ccData: 0 }, - { type: 0, pts: 7192937556, ccData: 20303 }, - { type: 2, pts: 7192937556, ccData: 8269 }, - { type: 1, pts: 7192937556, ccData: 28404 }, - { type: 3, pts: 7192937556, ccData: 49954 }, - { type: 1, pts: 7192940616, ccData: 8360 }, - { type: 0, pts: 7192940616, ccData: 54085 }, - { type: 2, pts: 7192940616, ccData: 20303 }, - { type: 2, pts: 7192940616, ccData: 0 }, - { type: 3, pts: 7192940616, ccData: 802 }, - { type: 0, pts: 7192943586, ccData: 38000 }, - { type: 3, pts: 7192943586, ccData: 18993 }, - { type: 1, pts: 7192943586, ccData: 54245 }, - { type: 2, pts: 7192943586, ccData: 0 }, - { type: 2, pts: 7192943586, ccData: 21317 }, - { type: 2, pts: 7192946646, ccData: 1283 }, - { type: 1, pts: 7192946646, ccData: 36667 }, - { type: 2, pts: 7192946646, ccData: 38939 }, - { type: 2, pts: 7192946646, ccData: 15360 }, - { type: 2, pts: 7192946646, ccData: 543 }, - { type: 2, pts: 7192946646, ccData: 4240 }, - { type: 0, pts: 7192946646, ccData: 38000 }, - { type: 2, pts: 7192946646, ccData: 37162 }, - { type: 2, pts: 7192946646, ccData: 0 }, - { type: 2, pts: 7192946646, ccData: 37378 }, - { type: 2, pts: 7192946646, ccData: 0 }, - { type: 3, pts: 7192949706, ccData: 33571 }, - { type: 0, pts: 7192949706, ccData: 38817 }, - { type: 1, pts: 7192949706, ccData: 258 }, - { type: 2, pts: 7192952676, ccData: 256 }, - { type: 1, pts: 7192952676, ccData: 16448 }, - { type: 0, pts: 7192952676, ccData: 38817 }, - { type: 2, pts: 7192952676, ccData: 37378 }, - { type: 1, pts: 7192955646, ccData: 16448 }, - { type: 0, pts: 7192955646, ccData: 22465 }, - { type: 3, pts: 7192955646, ccData: 49954 }, - { type: 3, pts: 7192958616, ccData: 802 }, - { type: 2, pts: 7192958616, ccData: 22337 }, - { type: 2, pts: 7192958616, ccData: 0 }, - { type: 1, pts: 7192958616, ccData: 16512 }, - { type: 0, pts: 7192958616, ccData: 54048 }, - { type: 0, pts: 7192961586, ccData: 17228 }, - { type: 2, pts: 7192961586, ccData: 21280 }, - { type: 2, pts: 7192961586, ccData: 0 }, - { type: 3, pts: 7192961586, ccData: 17186 }, - { type: 1, pts: 7192961586, ccData: 36782 }, - { type: 0, pts: 7192964646, ccData: 20435 }, - { type: 2, pts: 7192964646, ccData: 17228 }, - { type: 2, pts: 7192964646, ccData: 0 }, - { type: 3, pts: 7192964646, ccData: 33570 }, - { type: 1, pts: 7192964646, ccData: 387 }, - { type: 0, pts: 7192967616, ccData: 17746 }, - { type: 1, pts: 7192967616, ccData: 52975 }, - { type: 2, pts: 7192967616, ccData: 0 }, - { type: 2, pts: 7192967616, ccData: 20307 }, - { type: 3, pts: 7192967616, ccData: 49954 }, - { type: 1, pts: 7192970676, ccData: 62196 }, - { type: 0, pts: 7192970676, ccData: 8276 }, - { type: 2, pts: 7192970676, ccData: 17746 }, - { type: 2, pts: 7192970676, ccData: 0 }, - { type: 3, pts: 7192970676, ccData: 802 }, - { type: 2, pts: 7192973736, ccData: 0 }, - { type: 2, pts: 7192973736, ccData: 8276 }, - { type: 3, pts: 7192973736, ccData: 17186 }, - { type: 0, pts: 7192973736, ccData: 20256 }, - { type: 1, pts: 7192973736, ccData: 26656 }, - { type: 1, pts: 7192976706, ccData: 22511 }, - { type: 0, pts: 7192976706, ccData: 49440 }, - { type: 2, pts: 7192976706, ccData: 20256 }, - { type: 2, pts: 7192976706, ccData: 0 }, - { type: 3, pts: 7192976706, ccData: 33570 }, - { type: 3, pts: 7192979676, ccData: 49954 }, - { type: 2, pts: 7192979676, ccData: 0 }, - { type: 2, pts: 7192979676, ccData: 16672 }, - { type: 0, pts: 7192979676, ccData: 53327 }, - { type: 1, pts: 7192979676, ccData: 61284 }, - { type: 1, pts: 7192982646, ccData: 29472 }, - { type: 0, pts: 7192982646, ccData: 53461 }, - { type: 2, pts: 7192982646, ccData: 20559 }, - { type: 2, pts: 7192982646, ccData: 0 }, - { type: 3, pts: 7192982646, ccData: 802 }, - { type: 3, pts: 7192985616, ccData: 17186 }, - { type: 1, pts: 7192985616, ccData: 19553 }, - { type: 2, pts: 7192985616, ccData: 20565 }, - { type: 2, pts: 7192985616, ccData: 0 }, - { type: 0, pts: 7192985616, ccData: 19649 }, - { type: 2, pts: 7192988676, ccData: 19521 }, - { type: 1, pts: 7192988676, ccData: 63418 }, - { type: 0, pts: 7192988676, ccData: 21573 }, - { type: 2, pts: 7192988676, ccData: 0 }, - { type: 3, pts: 7192988676, ccData: 33570 }, - { type: 2, pts: 7192991646, ccData: 0 }, - { type: 2, pts: 7192991646, ccData: 21573 }, - { type: 3, pts: 7192991646, ccData: 49954 }, - { type: 1, pts: 7192991646, ccData: 8271 }, - { type: 0, pts: 7192991646, ccData: 50208 }, - { type: 1, pts: 7192994706, ccData: 28192 }, - { type: 0, pts: 7192994706, ccData: 49490 }, - { type: 2, pts: 7192994706, ccData: 17440 }, - { type: 2, pts: 7192994706, ccData: 0 }, - { type: 3, pts: 7192994706, ccData: 802 }, - { type: 2, pts: 7192997766, ccData: 0 }, - { type: 0, pts: 7192997766, ccData: 17857 }, - { type: 3, pts: 7192997766, ccData: 17186 }, - { type: 1, pts: 7192997766, ccData: 62568 }, - { type: 2, pts: 7192997766, ccData: 16722 }, - { type: 3, pts: 7193000646, ccData: 33570 }, - { type: 1, pts: 7193000646, ccData: 58656 }, - { type: 0, pts: 7193000646, ccData: 11392 }, - { type: 2, pts: 7193000646, ccData: 17729 }, - { type: 2, pts: 7193000646, ccData: 0 }, - { type: 1, pts: 7193003706, ccData: 51317 }, - { type: 2, pts: 7193003706, ccData: 11264 }, - { type: 2, pts: 7193003706, ccData: 0 }, - { type: 3, pts: 7193003706, ccData: 50212 }, - { type: 0, pts: 7193003706, ccData: 37935 }, - { type: 1, pts: 7193006676, ccData: 28404 }, - { type: 0, pts: 7193006676, ccData: 37935 }, - { type: 2, pts: 7193006676, ccData: 35842 }, - { type: 2, pts: 7193006676, ccData: 35073 }, - { type: 2, pts: 7193006676, ccData: 0 }, - { type: 1, pts: 7193009646, ccData: 8360 }, - { type: 0, pts: 7193009646, ccData: 32896 }, - { type: 1, pts: 7193012706, ccData: 54245 }, - { type: 0, pts: 7193012706, ccData: 32896 }, - { type: 1, pts: 7193015676, ccData: 36667 }, - { type: 0, pts: 7193015676, ccData: 32896 }, - { type: 0, pts: 7193018736, ccData: 32896 }, - { type: 1, pts: 7193018736, ccData: 258 }, - { type: 0, pts: 7193021706, ccData: 32896 }, - { type: 1, pts: 7193021706, ccData: 16448 }, - { type: 1, pts: 7193024676, ccData: 16448 }, - { type: 0, pts: 7193024676, ccData: 32896 }, - { type: 1, pts: 7193027736, ccData: 16512 }, - { type: 0, pts: 7193027736, ccData: 32896 }, - { type: 0, pts: 7193030706, ccData: 32896 }, - { type: 1, pts: 7193030706, ccData: 36782 }, - { type: 1, pts: 7193033766, ccData: 387 }, - { type: 0, pts: 7193033766, ccData: 32896 }, - { type: 1, pts: 7193036736, ccData: 52975 }, - { type: 0, pts: 7193036736, ccData: 32896 }, - { type: 1, pts: 7193039706, ccData: 62196 }, - { type: 0, pts: 7193039706, ccData: 32896 }, - { type: 1, pts: 7193042766, ccData: 26656 }, - { type: 0, pts: 7193042766, ccData: 32896 }, - { type: 1, pts: 7193045646, ccData: 22511 }, - { type: 0, pts: 7193045646, ccData: 32896 }, - { type: 1, pts: 7193048706, ccData: 61284 }, - { type: 0, pts: 7193048706, ccData: 32896 }, - { type: 1, pts: 7193051766, ccData: 29472 }, - { type: 0, pts: 7193051766, ccData: 32896 }, - { type: 1, pts: 7193054736, ccData: 389 }, - { type: 0, pts: 7193054736, ccData: 32896 }, - { type: 1, pts: 7193057796, ccData: 51396 }, - { type: 0, pts: 7193057796, ccData: 32896 }, - { type: 1, pts: 7193060766, ccData: 36831 }, - { type: 0, pts: 7193060766, ccData: 32896 }, - { type: 1, pts: 7193063736, ccData: 258 }, - { type: 0, pts: 7193063736, ccData: 32896 }, - { type: 0, pts: 7193066796, ccData: 32896 }, - { type: 1, pts: 7193066796, ccData: 16448 }, - { type: 0, pts: 7193069676, ccData: 32896 }, - { type: 1, pts: 7193069676, ccData: 16448 }, - { type: 1, pts: 7193072736, ccData: 16512 }, - { type: 0, pts: 7193072736, ccData: 32896 }, - { type: 0, pts: 7193075796, ccData: 32896 }, - { type: 1, pts: 7193075796, ccData: 36782 }, - { type: 1, pts: 7193078766, ccData: 387 }, - { type: 0, pts: 7193078766, ccData: 32896 }, - { type: 1, pts: 7193081826, ccData: 52975 }, - { type: 0, pts: 7193081826, ccData: 32896 }, - { type: 1, pts: 7193084796, ccData: 62196 }, - { type: 0, pts: 7193084796, ccData: 32896 }, - { type: 0, pts: 7193087766, ccData: 32896 }, - { type: 1, pts: 7193087766, ccData: 26656 }, - { type: 0, pts: 7193090736, ccData: 32896 }, - { type: 1, pts: 7193090736, ccData: 22511 }, - { type: 0, pts: 7193093706, ccData: 32896 }, - { type: 1, pts: 7193093706, ccData: 61284 }, - { type: 1, pts: 7193096766, ccData: 29472 }, - { type: 0, pts: 7193096766, ccData: 32896 }, - { type: 1, pts: 7193099826, ccData: 19553 }, - { type: 0, pts: 7193099826, ccData: 32896 }, - { type: 1, pts: 7193102796, ccData: 63418 }, - { type: 0, pts: 7193102796, ccData: 32896 }, - { type: 0, pts: 7193105856, ccData: 32896 }, - { type: 1, pts: 7193105856, ccData: 8271 }, - { type: 0, pts: 7193108826, ccData: 32896 }, - { type: 1, pts: 7193108826, ccData: 28192 }, - { type: 1, pts: 7193111796, ccData: 62568 }, - { type: 0, pts: 7193111796, ccData: 32896 }, - { type: 1, pts: 7193114766, ccData: 58656 }, - { type: 0, pts: 7193114766, ccData: 32896 }, - { type: 0, pts: 7193117736, ccData: 32896 }, - { type: 1, pts: 7193117736, ccData: 51317 }, - { type: 0, pts: 7193120796, ccData: 32896 }, - { type: 1, pts: 7193120796, ccData: 28404 }, - { type: 1, pts: 7193123766, ccData: 8360 }, - { type: 0, pts: 7193123766, ccData: 32896 }, - { type: 1, pts: 7193126826, ccData: 54245 }, - { type: 0, pts: 7193126826, ccData: 32896 }, - { type: 0, pts: 7193129886, ccData: 32896 }, - { type: 1, pts: 7193129886, ccData: 36667 }, - { type: 1, pts: 7193138796, ccData: 16448 }, - { type: 0, pts: 7193138796, ccData: 32896 } -]; diff --git a/node_modules/mux.js/test/utils/mp4-helpers.js b/node_modules/mux.js/test/utils/mp4-helpers.js deleted file mode 100644 index 92f28f4..0000000 --- a/node_modules/mux.js/test/utils/mp4-helpers.js +++ /dev/null @@ -1,315 +0,0 @@ -/** - * Helper functions for creating test MP4 data. - */ -'use strict'; -var box, typeBytes, unityMatrix; - -module.exports = {}; - -// ---------------------- -// Box Generation Helpers -// ---------------------- - -module.exports.typeBytes = typeBytes = function(type) { - return [ - type.charCodeAt(0), - type.charCodeAt(1), - type.charCodeAt(2), - type.charCodeAt(3) - ]; -}; - -module.exports.box = box = function(type) { - var - array = Array.prototype.slice.call(arguments, 1), - result = [], - size, - i; - - // "unwrap" any arrays that were passed as arguments - // e.g. box('etc', 1, [2, 3], 4) -> box('etc', 1, 2, 3, 4) - for (i = 0; i < array.length; i++) { - if (array[i] instanceof Array) { - array.splice.apply(array, [i, 1].concat(array[i])); - } - } - - size = 8 + array.length; - - result[0] = (size & 0xFF000000) >> 24; - result[1] = (size & 0x00FF0000) >> 16; - result[2] = (size & 0x0000FF00) >> 8; - result[3] = size & 0xFF; - result = result.concat(typeBytes(type)); - result = result.concat(array); - return result; -}; - -module.exports.unityMatrix = unityMatrix = [ - 0, 0, 0x10, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - - 0, 0, 0, 0, - 0, 0, 0x10, 0, - 0, 0, 0, 0, - - 0, 0, 0, 0, - 0, 0, 0, 0, - 0x40, 0, 0, 0 -]; - -// ------------ -// Example Data -// ------------ - -module.exports.sampleMoov = - box('moov', - box('mvhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x00, 0x03, 0xe8, // timescale = 1000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - unityMatrix, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x00, 0x00, 0x00, 0x02), // next_track_ID - box('trak', - box('tkhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x00, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - unityMatrix, - 0x01, 0x2c, 0x00, 0x00, // 300 in 16.16 fixed-point - 0x00, 0x96, 0x00, 0x00), // 150 in 16.16 fixed-point - box('edts', - box('elst', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x00, // segment_duration - 0x00, 0x00, 0x04, 0x00, // media_time - 0x00, 0x01, 0x80, 0x00)), // media_rate - box('mdia', - box('mdhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale = 90000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7, // 'eng' language - 0x00, 0x00), - box('hdlr', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - typeBytes('vide'), // handler_type - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - typeBytes('one'), 0x00), // name - box('minf', - box('dinf', - box('dref', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - box('url ', - 0x00, // version - 0x00, 0x00, 0x01))), // flags - box('stbl', - box('stsd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // entry_count - box('avc1', - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, // box content - typeBytes('avcC'), // codec profile type - 0x00, 0x4d, 0x40, 0x0d)), // codec parameters - box('stts', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01, // sample_count - 0x00, 0x00, 0x00, 0x01), // sample_delta - box('stsc', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x02, // first_chunk - 0x00, 0x00, 0x00, 0x03, // samples_per_chunk - 0x00, 0x00, 0x00, 0x01), // sample_description_index - box('stco', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01), // chunk_offset - box('stss', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01), // sync_sample - box('ctts', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01, // sample_count - 0x00, 0x00, 0x00, 0x01))))), // sample_offset - box('trak', - box('tkhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x00, 0x02, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x00, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - unityMatrix, - 0x01, 0x2c, 0x00, 0x00, // 300 in 16.16 fixed-point - 0x00, 0x96, 0x00, 0x00), // 150 in 16.16 fixed-point - box('edts', - box('elst', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // segment_duration - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // media_time - 0x00, 0x01, 0x80, 0x00)), // media_rate - box('mdia', - box('mdhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale = 90000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7, // 'eng' language - 0x00, 0x00), - box('hdlr', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - typeBytes('soun'), // handler_type - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - typeBytes('one'), 0x00), // name - box('minf', - box('dinf', - box('dref', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - box('url ', - 0x00, // version - 0x00, 0x00, 0x01))), // flags - box('stbl', - box('stsd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // entry_count - box('mp4a', - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - typeBytes('esds'), // codec profile type - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, // box content - 0x40, 0x0a, // codec params - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00)), // codec params - box('stts', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01, // sample_count - 0x00, 0x00, 0x00, 0x01), // sample_delta - box('stsc', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x02, // first_chunk - 0x00, 0x00, 0x00, 0x03, // samples_per_chunk - 0x00, 0x00, 0x00, 0x01), // sample_description_index - box('ctts', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01, // sample_count - 0xff, 0xff, 0xff, 0xff), // sample_offset - box('stco', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01)))))); // chunk_offset diff --git a/node_modules/mux.js/test/utils/sei-nal-unit-generator.js b/node_modules/mux.js/test/utils/sei-nal-unit-generator.js deleted file mode 100644 index e0c2a39..0000000 --- a/node_modules/mux.js/test/utils/sei-nal-unit-generator.js +++ /dev/null @@ -1,137 +0,0 @@ -/** - * Helper functions for creating 608/708 SEI NAL units - */ - -'use strict'; - -var box = require('./mp4-helpers').box; - -// Create SEI nal-units from Caption packets -var makeSeiFromCaptionPacket = function(caption) { - return { - pts: caption.pts, - dts: caption.dts, - nalUnitType: 'sei_rbsp', - escapedRBSP: new Uint8Array([ - 0x04, // payload_type === user_data_registered_itu_t_t35 - - 0x0e, // payload_size - - 181, // itu_t_t35_country_code - 0x00, 0x31, // itu_t_t35_provider_code - 0x47, 0x41, 0x39, 0x34, // user_identifier, "GA94" - 0x03, // user_data_type_code, 0x03 is cc_data - - // 110 00001 - 0xc1, // process_cc_data, cc_count - 0xff, // reserved - // 1111 1100 - (0xfc | caption.type), // cc_valid, cc_type (608, field 1) - (caption.ccData & 0xff00) >> 8, // cc_data_1 - caption.ccData & 0xff, // cc_data_2 without parity bit set - - 0xff // marker_bits - ]) - }; -}; - -// Create SEI nal-units from Caption packets -var makeSeiFromMultipleCaptionPackets = function(captionHash) { - var pts = captionHash.pts, - dts = captionHash.dts, - captions = captionHash.captions; - - var data = []; - captions.forEach(function(caption) { - data.push(0xfc | caption.type); - data.push((caption.ccData & 0xff00) >> 8); - data.push(caption.ccData & 0xff); - }); - - return { - pts: pts, - dts: dts, - nalUnitType: 'sei_rbsp', - escapedRBSP: new Uint8Array([ - 0x04, // payload_type === user_data_registered_itu_t_t35 - - (0x0b + (captions.length * 3)), // payload_size - - 181, // itu_t_t35_country_code - 0x00, 0x31, // itu_t_t35_provider_code - 0x47, 0x41, 0x39, 0x34, // user_identifier, "GA94" - 0x03, // user_data_type_code, 0x03 is cc_data - - // 110 00001 - (0x6 << 5) | captions.length, // process_cc_data, cc_count - 0xff // reserved - ].concat(data).concat([0xff /* marker bits */]) - ) - }; -}; - -var makeMdatFromCaptionPackets = function(packets) { - var mdat = ['mdat']; - var seis = packets.map(makeSeiFromCaptionPacket); - - seis.forEach(function(sei) { - mdat.push(0x00); - mdat.push(0x00); - mdat.push(0x00); - mdat.push(sei.escapedRBSP.length + 1); // nal length - mdat.push(0x06); // declare nal type as SEI - // SEI message - for (var i = 0; i < sei.escapedRBSP.length; i++) { - var byte = sei.escapedRBSP[i]; - - mdat.push(byte); - } - }); - - return box.apply(null, mdat); -}; - -// Returns a ccData byte-pair for a two character string. That is, -// it converts a string like 'hi' into the two-byte number that -// would be parsed back as 'hi' when provided as ccData. -var characters = function(text) { - if (text.length !== 2) { - throw new Error('ccdata must be specified two characters at a time'); - } - return (text.charCodeAt(0) << 8) | text.charCodeAt(1); -}; - -// Returns a ccData byte-pair including -// Header for 708 packet -// Header for the first service block -// seq should increment by 1 for each byte pair mod 3 (0,1,2,0,1,2,...) -// sizeCode is the number of byte pairs in the packet (including header) -// serviceNum is the service number of the first service block -// blockSize is the size of the first service block in bytes (no header) -// If there's only one service block, the blockSize should be (sizeCode-1)*2 -var packetHeader708 = function(seq, sizeCode, serviceNum, blockSize) { - var b1 = (seq << 6) | sizeCode; - var b2 = (serviceNum << 5) | blockSize; - return (b1 << 8) | b2; -}; - -// Returns a ccData byte-pair to execute a 708 DSW command -// Takes an array of window indicies to display -var displayWindows708 = function(windows) { - var cmd = 0x8900; - - windows.forEach(function(winIdx) { - cmd |= (0x01 << winIdx); - }); - - return cmd; -}; - -module.exports = { - makeSeiFromCaptionPacket: makeSeiFromCaptionPacket, - makeSeiFromMultipleCaptionPackets: makeSeiFromMultipleCaptionPackets, - makeMdatFromCaptionPackets: makeMdatFromCaptionPackets, - characters: characters, - packetHeader708: packetHeader708, - displayWindows708: displayWindows708 -}; diff --git a/node_modules/nes.css/CODE_OF_CONDUCT.md b/node_modules/nes.css/CODE_OF_CONDUCT.md deleted file mode 100644 index 05115c7..0000000 --- a/node_modules/nes.css/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,56 +0,0 @@ -# Contributor Covenant Code of Conduct - -View this document in another language: -[简体中文](.github/CONTRIBUTING-zh-CN.md) / [日本語](.github/CONTRIBUTING-jp.md) / [Español](.github/CONTRIBUTING-es.md) / [Português](.github/CONTRIBUTING-pt-BR.md) - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [support@nostalgi.cc][support-email]. If contacting the full project team is not desirable, feel free to contact any of them individually: - -* B.C.Rikko <[b.c.rikko@gmail.com](mailto:b.c.rikko@gmail.com)> -* Igor Guastalla <[limaguastallaigor@gmail.com](mailto:limaguastallaigor@gmail.com)> -* Trezy <[tre@trezy.com](mailto:tre@trezy.com)> - -All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[support-email]: mailto:support@nostalgi.cc -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/node_modules/nes.css/CONTRIBUTING.md b/node_modules/nes.css/CONTRIBUTING.md deleted file mode 100644 index 0ac7ddd..0000000 --- a/node_modules/nes.css/CONTRIBUTING.md +++ /dev/null @@ -1,104 +0,0 @@ -# Contributing - -View this document in another language: -[简体中文](.github/CONTRIBUTING-zh-CN.md) / [日本語](.github/CONTRIBUTING-jp.md) / [Español](.github/CONTRIBUTING-es.md) / [Português](.github/CONTRIBUTING-pt-BR.md) / [Русский](.github/CONTRIBUTING-ru.md) - -You want to contribute to the project? Awesome! - -## Things to know - -This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please see our [Code of Conduct][code-of-conduct] for details on reporting unacceptable behavior. - -**Working on your first Pull Request?** -[How to Contribute to an Open Source Project on GitHub][egghead] - -## How do - -* Project setup? - [We've got you covered!](#project-setup) - -* Found a bug? - [Let us know!][new-issue] - -* Patched a bug? - [Make a PR!][new-pr] - -* Adding a new feature? - Make sure to [open an issue][new-issue] describing your feature, then open a [new PR][new-pr] when you're ready for feedback! - -## Project setup - -We're really happy you want to contribute to the project! ❤️ The following steps will get you up and running: - -1. Fork and clone the repo -2. Install the required dependencies: - ```sh - $ npm install - ``` -3. Start up the dev server: - To view all available components in an interactive interface, use storybook. - ```sh - $ npm run storybook - ``` - -### Directories -```sh -. -├── index.html: Demo page -├── style.css: Demo page style -├── css: Distribution files -├── docs: Storybook stories -└── scss: Source - ├── base - │ ├── reboot.scss: Don't change! (Bootstrap Reboot) - │ ├── generic.scss: Generic style and reboot.css - │ └── variables.scss: Common variables - ├── elements - ├── components - ├── form - ├── icons: 16x16 icons - ├── pixel-arts: For icons other than 16x16. - └── utilities -``` - -> Tip: Keep your `master` branch pointing at the original repository and make pull requests from branches on your fork. To do this, run: -> -> ``` -> git remote add upstream https://github.com/nostalgic-css/NES.css.git -> git fetch upstream -> git branch --set-upstream-to=upstream/master master -> ``` -> -> This will add the original repository as a "remote" called "upstream," fetch the git information from that remote, and set your local `master` branch to use the `upstream/master` branch whenever you run `git pull`. At that point, you can create all of your branches from this `master` branch. Whenever you want to update your version of `master`, do a regular `git pull`. - -## Contributing for members of the `nostalgic-css` organization - -Below are steps which must be followed by the members of the `nostalgic-css` organization. External collaborators only have to follow the above guidelines. - -### Steps for development - -1. Branch from `develop` using the formatting rules below. -2. Do the work required to satisfy the issue. If you identify work that is unrelated to the issue, please [create a new issue][new-issue] and do the work on a separate branch. -3. Submit your PRs to merge back into `develop`. - * Any change which would affect current development should be documented in the description. - * PRs with an issue should be include that issue's number in the title. IE: `[#33] Fix bug` - * Assign the PR to yourself. - * When the PR is ready to be merged, A review should be requested from the `nostalgic-css/NES.css` team. -4. Once the PR is approved, it is the responsibility of the **assignee** to merge the changes to the branch. - -### Commit formatting - -We use [Commitizen][commitizen] and [`commitlint`][commitlint] to make sure all of the commits to the project are easy to read, and [`semantic-release`][semantic-release] to ensure that our releases are automated, [unromantic, and unsentimental][sentimental-versioning]. - - - - - -[code-of-conduct]: CODE_OF_CONDUCT.md -[commitizen]: https://github.com/commitizen/cz-cli -[commitlint]: [https://github.com/marionebl/commitlint] -[egghead]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github -[new-issue]: https://github.com/nostalgic-css/NES.css/issues/new/choose -[new-pr]: https://github.com/nostalgic-css/NES.css/compare/develop...develop -[semantic-release]: https://github.com/semantic-release/semantic-release -[sentimental-versioning]: http://sentimentalversioning.org/ diff --git a/node_modules/nes.css/LICENSE b/node_modules/nes.css/LICENSE deleted file mode 100644 index baf7580..0000000 --- a/node_modules/nes.css/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 B.C.Rikko - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/nes.css/README.md b/node_modules/nes.css/README.md deleted file mode 100644 index a68a11e..0000000 --- a/node_modules/nes.css/README.md +++ /dev/null @@ -1,105 +0,0 @@ - - -NES.css is a **NES-style(8bit-like)** CSS Framework. - -[![Gitter][gitter-badge]][gitter] [![Commitizen friendly][commitizen-badge]][commitizen] - -## Installation - -### Styles - -NES.css is available via either npm (preferred), Yarn, or a CDN. - -#### via package manager - -```shell -npm install nes.css -# or -yarn add nes.css -``` - -Our `package.json` contains some additional metadata under the following keys: -* `sass` - path to our main Sass source file -* `style` - path to our non-minified CSS - -#### via CDN - -Import the CSS via a `` element: - -```html - - - - - - -``` - -### Fonts - -NES.css doesn't provide any fonts, but we do maintain the following list of fonts that we recommend for usage alongside the library. - -| Language | Font | -| --------- | ------------------------------------------------------------------ | -| (Default) | [Press Start 2P](https://fonts.google.com/specimen/Press+Start+2P) | -| English | [Kongtext](https://www.dafont.com/kongtext.font) | -| Japanese | [美咲フォント](http://littlelimit.net/misaki.htm) | -| Japanese | [Nu もち](http://kokagem.sakura.ne.jp/font/mochi/) | -| Korean | [둥근모꼴](http://cactus.tistory.com/193) | - -## Usage - -NES.css only provides components. You will need to define your own layout. - -The recommended font for NES.css is [Press Start 2P][press-start-2p-font]. However, [Press Start 2P][press-start-2p-font] only supports English characters. When you're using this framework with any language other than English, please use another font. Follow the Google Fonts [instructions][google-fonts-guide] about how to include them, or simply include it as below: - -```html - - - - - - -``` - -## CSS Only - -NES.css only requires CSS and doesn't depend on any JavaScript. - -## Browser Support - -NES.css is compatible with the newest version of the following browsers: -* Chrome -* Firefox -* Safari - -Untested -* IE/Edge - -## Copyright and license - -Code and documentation copyright 2018 [B.C.Rikko](https://github.com/BcRikko). Code released under the MIT License. Docs released under Creative Commons. - -## Development - -If you'd like to help us out with the project, we welcome contributions of all types! Check out our [`CONTRIBUTING.md`][contributing-document] for more details on how you can help make NES.css amazing! - - - - - -[commitizen]: http://commitizen.github.io/cz-cli/ -[commitizen-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg -[contributing-document]: CONTRIBUTING.md -[gitter]: https://gitter.im/nostalgic-css/Lobby -[gitter-badge]: https://img.shields.io/gitter/room/nostalgic-css/Lobby.svg -[google-fonts-guide]: https://developers.google.com/fonts/docs/getting_started -[press-start-2p-font]: https://fonts.google.com/specimen/Press+Start+2P?selection.family=Press+Start+2P diff --git a/node_modules/nes.css/assets/cursor-click.png b/node_modules/nes.css/assets/cursor-click.png deleted file mode 100644 index aff9b55..0000000 Binary files a/node_modules/nes.css/assets/cursor-click.png and /dev/null differ diff --git a/node_modules/nes.css/assets/cursor.png b/node_modules/nes.css/assets/cursor.png deleted file mode 100644 index 9969fbf..0000000 Binary files a/node_modules/nes.css/assets/cursor.png and /dev/null differ diff --git a/node_modules/nes.css/css/nes-core.css b/node_modules/nes.css/css/nes-core.css deleted file mode 100644 index 850ae01..0000000 --- a/node_modules/nes.css/css/nes-core.css +++ /dev/null @@ -1,2089 +0,0 @@ -/*!***************************************************************************\ - NES.css Framework - Version: development - -\*****************************************************************************/ -/*! - * Bootstrap Reboot v4.1.3 (https://getbootstrap.com/) - * Copyright 2011-2018 The Bootstrap Authors - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) - */ -*, -*::before, -*::after { - box-sizing: border-box; -} - -html { - font-family: sans-serif; - line-height: 1.15; - -webkit-text-size-adjust: 100%; - -ms-overflow-style: scrollbar; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} - -@-ms-viewport { - width: device-width; -} - -article, -aside, -figcaption, -figure, -footer, -header, -hgroup, -main, -nav, -section { - display: block; -} - -body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, Noto Sans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; - font-size: 1rem; - font-weight: 400; - line-height: 1.5; - color: #212529; - text-align: left; - background-color: #fff; -} - -[tabindex="-1"]:focus { - outline: 0 !important; -} - -hr { - box-sizing: content-box; - height: 0; - overflow: visible; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - margin-top: 0; - margin-bottom: 0.5rem; -} - -p { - margin-top: 0; - margin-bottom: 1rem; -} - -abbr[title], -abbr[data-original-title] { - -webkit-text-decoration: underline dotted; - text-decoration: underline; - text-decoration: underline dotted; - cursor: help; - border-bottom: 0; -} - -address { - margin-bottom: 1rem; - font-style: normal; - line-height: inherit; -} - -ol, -ul, -dl { - margin-top: 0; - margin-bottom: 1rem; -} - -ol ol, -ul ul, -ol ul, -ul ol { - margin-bottom: 0; -} - -dt { - font-weight: 700; -} - -dd { - margin-bottom: 0.5rem; - margin-left: 0; -} - -blockquote { - margin: 0 0 1rem; -} - -b, -strong { - font-weight: bolder; -} - -small { - font-size: 80%; -} - -sub, -sup { - position: relative; - font-size: 75%; - line-height: 0; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -a { - color: #007bff; - text-decoration: none; - background-color: transparent; -} - -a:hover { - color: #0056b3; - text-decoration: underline; -} - -a:not([href]):not([tabindex]) { - color: inherit; - text-decoration: none; -} - -a:not([href]):not([tabindex]):hover, -a:not([href]):not([tabindex]):focus { - color: inherit; - text-decoration: none; -} - -a:not([href]):not([tabindex]):focus { - outline: 0; -} - -pre, -code, -kbd, -samp { - font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; - font-size: 1em; -} - -pre { - margin-top: 0; - margin-bottom: 1rem; - overflow: auto; - -ms-overflow-style: scrollbar; -} - -figure { - margin: 0 0 1rem; -} - -img { - vertical-align: middle; - border-style: none; -} - -svg { - overflow: hidden; - vertical-align: middle; -} - -table { - border-collapse: collapse; -} - -caption { - padding-top: 0.75rem; - padding-bottom: 0.75rem; - color: #6c757d; - text-align: left; - caption-side: bottom; -} - -th { - text-align: inherit; -} - -label { - display: inline-block; - margin-bottom: 0.5rem; -} - -button { - border-radius: 0; -} - -input, -button, -select, -optgroup, -textarea { - margin: 0; - font-family: inherit; - font-size: inherit; - line-height: inherit; -} - -button, -input { - overflow: visible; -} - -button, -select { - text-transform: none; -} - -button, -[type="button"], -[type="reset"], -[type="submit"] { - -webkit-appearance: button; -} - -button::-moz-focus-inner, -[type="button"]::-moz-focus-inner, -[type="reset"]::-moz-focus-inner, -[type="submit"]::-moz-focus-inner { - padding: 0; - border-style: none; -} - -button:focus { - outline: 1px dotted; - outline: 5px auto -webkit-focus-ring-color; -} - -input[type="radio"], -input[type="checkbox"] { - box-sizing: border-box; - padding: 0; -} - -input[type="date"], -input[type="time"], -input[type="datetime-local"], -input[type="month"] { - -webkit-appearance: listbox; -} - -textarea { - overflow: auto; - resize: vertical; -} - -fieldset { - min-width: 0; - padding: 0; - margin: 0; - border: 0; -} - -legend { - display: block; - width: 100%; - max-width: 100%; - padding: 0; - margin-bottom: 0.5rem; - font-size: 1.5rem; - line-height: inherit; - color: inherit; - white-space: normal; -} - -progress { - vertical-align: baseline; -} - -[type="number"]::-webkit-inner-spin-button, -[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -[type="search"] { - outline-offset: -2px; - -webkit-appearance: none; -} - -[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -::-webkit-file-upload-button { - font: inherit; - -webkit-appearance: button; -} - -output { - display: inline-block; -} - -summary { - display: list-item; - cursor: pointer; -} - -template { - display: none; -} - -[hidden] { - display: none !important; -} - -html, -body, -pre, -code, -kbd, -samp { - font-family: "Press Start 2P"; -} - -html { - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABFklEQVRYR9WXURLDIAhE6/0PbSdOtUpcd1Gnpv1KGpTHBpCE1/cXq+vrMph7dGvXZTtpfW10DCA5jrH1H0Jhs5E0hnZdCR+vb5S8Nn8mQCeS9BdSalYJqMBjAGzq59xAESN7VFVUgV8AZB/dZBR7QTFDCqGquvUBVVoEtgIwpQRzmANSFHgWQKExHdIrPeuMvQNDarXe6nC/AutgV3JW+6bgqQLeV8FekRtgV+ToDKEKnACYKsfZjjkam7a0ZpYTytwmgainpC3HvwBocgKOxqRjehoR9DFKNFYtOwCGYCszobeCbl26N6yyQ6g8X/Wex/rBPsNEV6qAMaJPMynIHQCoSqS9JSMmwef51LflTgCRszU7DvAGiV6mHWfsaVUAAAAASUVORK5CYII=), auto; -} - -body { - font-size: 16px; - color: #212529; - background-color: #fff; - -webkit-font-smoothing: antialiased; -} - -label { - cursor: inherit; -} - -a, -button { - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; -} - -button, -[type="button"], -[type="reset"], -[type="submit"] { - -webkit-appearance: none; -} - -input[type="radio"], -input[type="checkbox"] { - outline: 0; -} - -@keyframes blink { - 0% { - opacity: 1; - } - 50% { - opacity: 0; - } -} - -.nes-balloon, .nes-balloon.is-dark, .nes-btn, .nes-container.is-rounded, .nes-container.is-rounded.is-dark, .nes-dialog.is-rounded, .nes-dialog.is-rounded.is-dark, .nes-progress, .nes-progress.is-rounded, .nes-table.is-bordered, .nes-table.is-dark.is-bordered, .nes-input, -.nes-textarea, .nes-select select { - border-style: solid; - border-width: 4px; -} - -/* https://medium.com/@matuzo/writing-css-with-accessibility-in-mind-8514a0007939 */ -.nes-pointer { - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; -} - -.nes-avatar { - width: 32px; - height: 32px; -} - -.nes-avatar.is-rounded { - border-radius: 50px; -} - -.nes-avatar.is-small { - width: 16px; - height: 16px; -} - -.nes-avatar.is-small.is-rounded { - border-radius: 50px; -} - -.nes-avatar.is-medium { - width: 48px; - height: 48px; -} - -.nes-avatar.is-medium.is-rounded { - border-radius: 50px; -} - -.nes-avatar.is-large { - width: 64px; - height: 64px; -} - -.nes-avatar.is-large.is-rounded { - border-radius: 50px; -} - -.nes-badge { - position: relative; - display: inline-block; - width: 10.5em; - height: 1.875em; - margin: 0.5em; - font-size: 0.9em; - white-space: nowrap; - vertical-align: top; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.nes-badge.is-splited span.is-dark:first-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #212529; - left: 0; - box-shadow: 0 0.5em #212529, 0 -0.5em #212529, 0 0 #212529, -0.5em 0 #212529; -} - -.nes-badge.is-splited span.is-dark:last-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #212529; - right: 0; - box-shadow: 0 0.5em #212529, 0 -0.5em #212529, 0.5em 0 #212529, 0 0 #212529; -} - -.nes-badge.is-icon { - width: 5.25em; -} - -.nes-badge.is-icon span.is-dark:first-child { - display: flex; - align-items: center; - justify-content: center; - width: 2.7em; - font-size: 0.5em; - color: #fff; - text-align: center; - background-color: #212529; - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; -} - -.nes-badge.is-icon span.is-dark:last-child { - display: inline-block; - align-items: center; - justify-content: center; - width: 6em; - font-size: 0.88em; - color: #fff; - text-align: center; - background-color: #212529; - box-shadow: 0 0.5em #212529, 0 -0.5em #212529, 0.5em 0 #212529, -0.5em 0 #212529; -} - -.nes-badge span.is-dark:first-child { - position: absolute; - top: 0; - width: 100%; - color: #fff; - text-align: center; - background-color: #212529; - box-shadow: 0 0.5em #212529, 0 -0.5em #212529, 0.5em 0 #212529, -0.5em 0 #212529; -} - -.nes-badge.is-splited span.is-primary:first-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #209cee; - left: 0; - box-shadow: 0 0.5em #209cee, 0 -0.5em #209cee, 0 0 #209cee, -0.5em 0 #209cee; -} - -.nes-badge.is-splited span.is-primary:last-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #209cee; - right: 0; - box-shadow: 0 0.5em #209cee, 0 -0.5em #209cee, 0.5em 0 #209cee, 0 0 #209cee; -} - -.nes-badge.is-icon { - width: 5.25em; -} - -.nes-badge.is-icon span.is-primary:first-child { - display: flex; - align-items: center; - justify-content: center; - width: 2.7em; - font-size: 0.5em; - color: #fff; - text-align: center; - background-color: #209cee; - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; -} - -.nes-badge.is-icon span.is-primary:last-child { - display: inline-block; - align-items: center; - justify-content: center; - width: 6em; - font-size: 0.88em; - color: #fff; - text-align: center; - background-color: #209cee; - box-shadow: 0 0.5em #209cee, 0 -0.5em #209cee, 0.5em 0 #209cee, -0.5em 0 #209cee; -} - -.nes-badge span.is-primary:first-child { - position: absolute; - top: 0; - width: 100%; - color: #fff; - text-align: center; - background-color: #209cee; - box-shadow: 0 0.5em #209cee, 0 -0.5em #209cee, 0.5em 0 #209cee, -0.5em 0 #209cee; -} - -.nes-badge.is-splited span.is-success:first-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #92cc41; - left: 0; - box-shadow: 0 0.5em #92cc41, 0 -0.5em #92cc41, 0 0 #92cc41, -0.5em 0 #92cc41; -} - -.nes-badge.is-splited span.is-success:last-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #92cc41; - right: 0; - box-shadow: 0 0.5em #92cc41, 0 -0.5em #92cc41, 0.5em 0 #92cc41, 0 0 #92cc41; -} - -.nes-badge.is-icon { - width: 5.25em; -} - -.nes-badge.is-icon span.is-success:first-child { - display: flex; - align-items: center; - justify-content: center; - width: 2.7em; - font-size: 0.5em; - color: #fff; - text-align: center; - background-color: #92cc41; - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; -} - -.nes-badge.is-icon span.is-success:last-child { - display: inline-block; - align-items: center; - justify-content: center; - width: 6em; - font-size: 0.88em; - color: #fff; - text-align: center; - background-color: #92cc41; - box-shadow: 0 0.5em #92cc41, 0 -0.5em #92cc41, 0.5em 0 #92cc41, -0.5em 0 #92cc41; -} - -.nes-badge span.is-success:first-child { - position: absolute; - top: 0; - width: 100%; - color: #fff; - text-align: center; - background-color: #92cc41; - box-shadow: 0 0.5em #92cc41, 0 -0.5em #92cc41, 0.5em 0 #92cc41, -0.5em 0 #92cc41; -} - -.nes-badge.is-splited span.is-warning:first-child { - position: absolute; - top: 0; - width: 50%; - color: #212529; - text-align: center; - background-color: #f7d51d; - left: 0; - box-shadow: 0 0.5em #f7d51d, 0 -0.5em #f7d51d, 0 0 #f7d51d, -0.5em 0 #f7d51d; -} - -.nes-badge.is-splited span.is-warning:last-child { - position: absolute; - top: 0; - width: 50%; - color: #212529; - text-align: center; - background-color: #f7d51d; - right: 0; - box-shadow: 0 0.5em #f7d51d, 0 -0.5em #f7d51d, 0.5em 0 #f7d51d, 0 0 #f7d51d; -} - -.nes-badge.is-icon { - width: 5.25em; -} - -.nes-badge.is-icon span.is-warning:first-child { - display: flex; - align-items: center; - justify-content: center; - width: 2.7em; - font-size: 0.5em; - color: #212529; - text-align: center; - background-color: #f7d51d; - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; -} - -.nes-badge.is-icon span.is-warning:last-child { - display: inline-block; - align-items: center; - justify-content: center; - width: 6em; - font-size: 0.88em; - color: #212529; - text-align: center; - background-color: #f7d51d; - box-shadow: 0 0.5em #f7d51d, 0 -0.5em #f7d51d, 0.5em 0 #f7d51d, -0.5em 0 #f7d51d; -} - -.nes-badge span.is-warning:first-child { - position: absolute; - top: 0; - width: 100%; - color: #212529; - text-align: center; - background-color: #f7d51d; - box-shadow: 0 0.5em #f7d51d, 0 -0.5em #f7d51d, 0.5em 0 #f7d51d, -0.5em 0 #f7d51d; -} - -.nes-badge.is-splited span.is-error:first-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #e76e55; - left: 0; - box-shadow: 0 0.5em #e76e55, 0 -0.5em #e76e55, 0 0 #e76e55, -0.5em 0 #e76e55; -} - -.nes-badge.is-splited span.is-error:last-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #e76e55; - right: 0; - box-shadow: 0 0.5em #e76e55, 0 -0.5em #e76e55, 0.5em 0 #e76e55, 0 0 #e76e55; -} - -.nes-badge.is-icon { - width: 5.25em; -} - -.nes-badge.is-icon span.is-error:first-child { - display: flex; - align-items: center; - justify-content: center; - width: 2.7em; - font-size: 0.5em; - color: #fff; - text-align: center; - background-color: #e76e55; - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; -} - -.nes-badge.is-icon span.is-error:last-child { - display: inline-block; - align-items: center; - justify-content: center; - width: 6em; - font-size: 0.88em; - color: #fff; - text-align: center; - background-color: #e76e55; - box-shadow: 0 0.5em #e76e55, 0 -0.5em #e76e55, 0.5em 0 #e76e55, -0.5em 0 #e76e55; -} - -.nes-badge span.is-error:first-child { - position: absolute; - top: 0; - width: 100%; - color: #fff; - text-align: center; - background-color: #e76e55; - box-shadow: 0 0.5em #e76e55, 0 -0.5em #e76e55, 0.5em 0 #e76e55, -0.5em 0 #e76e55; -} - -.nes-balloon { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - position: relative; - display: inline-block; - padding: 1rem 1.5rem; - margin: 8px; - margin-bottom: 30px; - background-color: #fff; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-balloon { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-balloon { - border-image-repeat: stretch; - } -} - -.nes-balloon > :last-child { - margin-bottom: 0; -} - -.nes-balloon::before, .nes-balloon::after { - position: absolute; - content: ""; -} - -.nes-balloon.is-dark { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 0; - color: #fff; - background: #212529; - border-image-outset: 2; - box-shadow: 0 0 0 8px #212529; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-balloon.is-dark { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-balloon.is-dark { - border-image-repeat: stretch; - } -} - -.nes-balloon.is-dark.from-left::before, .nes-balloon.is-dark.from-right::before { - background-color: #212529; - border-color: #fff; -} - -.nes-balloon.is-dark.from-left::after, .nes-balloon.is-dark.from-right::after { - color: #fff; - background-color: #212529; -} - -.nes-balloon.is-dark.from-left::before { - box-shadow: -5px 10px 0 6px #212529; -} - -.nes-balloon.is-dark.from-left::after { - box-shadow: -4px 0, 4px 0, -4px 4px #212529, 0 4px, -8px 4px, -4px 8px, -8px 8px; -} - -.nes-balloon.is-dark.from-right::before { - box-shadow: 5px 10px 0 6px #212529; -} - -.nes-balloon.is-dark.from-right::after { - box-shadow: -4px 0, 4px 0, 4px 4px #212529, 0 4px, 8px 4px, 4px 8px, 8px 8px; -} - -.nes-balloon.from-left::before, .nes-balloon.from-left::after { - left: 2rem; -} - -.nes-balloon.from-left::before { - bottom: -14px; - width: 26px; - height: 10px; - background-color: #fff; - border-right: 4px solid #212529; - border-left: 4px solid #212529; -} - -.nes-balloon.from-left::after { - bottom: -18px; - width: 18px; - height: 4px; - margin-right: 8px; - color: #212529; - background-color: #fff; - box-shadow: -4px 0, 4px 0, -4px 4px #fff, 0 4px, -8px 4px, -4px 8px, -8px 8px; -} - -.nes-balloon.from-right::before, .nes-balloon.from-right::after { - right: 2rem; -} - -.nes-balloon.from-right::before { - bottom: -14px; - width: 26px; - height: 10px; - background-color: #fff; - border-right: 4px solid #212529; - border-left: 4px solid #212529; -} - -.nes-balloon.from-right::after { - bottom: -18px; - width: 18px; - height: 4px; - margin-left: 8px; - background-color: #fff; - box-shadow: -4px 0, 4px 0, 4px 4px #fff, 0 4px, 8px 4px, 4px 8px, 8px 8px; -} - -.nes-btn { - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - position: relative; - display: inline-block; - padding: 6px 8px; - margin: 4px; - text-align: center; - vertical-align: middle; - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - color: #212529; - background-color: #fff; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-btn { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-btn { - border-image-repeat: stretch; - } -} - -.nes-btn::after { - position: absolute; - top: -4px; - right: -4px; - bottom: -4px; - left: -4px; - content: ""; - box-shadow: inset -4px -4px #adafbc; -} - -.nes-btn:hover { - color: #212529; - text-decoration: none; - background-color: #e7e7e7; -} - -.nes-btn:hover::after { - box-shadow: inset -6px -6px #adafbc; -} - -.nes-btn:focus { - box-shadow: 0 0 0 6px rgba(173, 175, 188, 0.3); -} - -.nes-btn:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px #adafbc; -} - -.nes-btn:focus { - outline: 0; -} - -.nes-btn.is-disabled, .nes-btn.is-disabled:hover, .nes-btn.is-disabled:focus { - color: #212529; - cursor: not-allowed; - background-color: #d3d3d3; - box-shadow: inset -4px -4px #adafbc; - opacity: 0.6; -} - -.nes-btn.is-primary { - color: #fff; - background-color: #209cee; -} - -.nes-btn.is-primary::after { - position: absolute; - top: -4px; - right: -4px; - bottom: -4px; - left: -4px; - content: ""; - box-shadow: inset -4px -4px #006bb3; -} - -.nes-btn.is-primary:hover { - color: #fff; - text-decoration: none; - background-color: #108de0; -} - -.nes-btn.is-primary:hover::after { - box-shadow: inset -6px -6px #006bb3; -} - -.nes-btn.is-primary:focus { - box-shadow: 0 0 0 6px rgba(0, 107, 179, 0.3); -} - -.nes-btn.is-primary:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px #006bb3; -} - -.nes-btn.is-success { - color: #fff; - background-color: #92cc41; -} - -.nes-btn.is-success::after { - position: absolute; - top: -4px; - right: -4px; - bottom: -4px; - left: -4px; - content: ""; - box-shadow: inset -4px -4px #4aa52e; -} - -.nes-btn.is-success:hover { - color: #fff; - text-decoration: none; - background-color: #76c442; -} - -.nes-btn.is-success:hover::after { - box-shadow: inset -6px -6px #4aa52e; -} - -.nes-btn.is-success:focus { - box-shadow: 0 0 0 6px rgba(74, 165, 46, 0.3); -} - -.nes-btn.is-success:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px #4aa52e; -} - -.nes-btn.is-warning { - color: #212529; - background-color: #f7d51d; -} - -.nes-btn.is-warning::after { - position: absolute; - top: -4px; - right: -4px; - bottom: -4px; - left: -4px; - content: ""; - box-shadow: inset -4px -4px #e59400; -} - -.nes-btn.is-warning:hover { - color: #212529; - text-decoration: none; - background-color: #f2c409; -} - -.nes-btn.is-warning:hover::after { - box-shadow: inset -6px -6px #e59400; -} - -.nes-btn.is-warning:focus { - box-shadow: 0 0 0 6px rgba(229, 148, 0, 0.3); -} - -.nes-btn.is-warning:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px #e59400; -} - -.nes-btn.is-error { - color: #fff; - background-color: #e76e55; -} - -.nes-btn.is-error::after { - position: absolute; - top: -4px; - right: -4px; - bottom: -4px; - left: -4px; - content: ""; - box-shadow: inset -4px -4px #8c2022; -} - -.nes-btn.is-error:hover { - color: #fff; - text-decoration: none; - background-color: #ce372b; -} - -.nes-btn.is-error:hover::after { - box-shadow: inset -6px -6px #8c2022; -} - -.nes-btn.is-error:focus { - box-shadow: 0 0 0 6px rgba(140, 32, 34, 0.3); -} - -.nes-btn.is-error:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px #8c2022; -} - -.nes-btn input[type="file"] { - position: absolute; - pointer-events: none; - opacity: 0; -} - -.nes-container { - position: relative; - padding: 1.5rem 2rem; - border-color: black; - border-style: solid; - border-width: 4px; -} - -.nes-container > :last-child { - margin-bottom: 0; -} - -.nes-container.is-centered { - text-align: center; -} - -.nes-container.is-right { - text-align: right; -} - -.nes-container.with-title > .title { - display: table; - padding: 0 0.5rem; - margin: -1.8rem 0 1rem; - font-size: 1rem; - background-color: #fff; -} - -.nes-container.with-title.is-centered > .title { - margin: -2rem auto 1rem; -} - -.nes-container.with-title.is-right > .title { - margin: -2rem 0 1rem auto; -} - -.nes-container.is-dark { - position: relative; - margin: 4px; - color: #fff; - background-color: #212529; - border-color: white; -} - -.nes-container.is-dark::after { - position: absolute; - top: -7.2px; - right: -7.2px; - bottom: -7.2px; - left: -7.2px; - z-index: -1; - content: ""; - background-color: #212529; -} - -.nes-container.is-dark.with-title > .title { - color: #fff; - background-color: #212529; -} - -.nes-container.is-rounded { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - padding: 1rem 1.5rem; - margin: 4px; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-container.is-rounded { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-container.is-rounded { - border-image-repeat: stretch; - } -} - -.nes-container.is-rounded.with-title > .title { - margin-top: -1.5rem; -} - -.nes-container.is-rounded.with-title.is-centered > .title { - margin: -1.5rem auto 1rem; -} - -.nes-container.is-rounded.with-title.is-right > .title { - margin: -1.5rem 0 1rem auto; -} - -.nes-container.is-rounded.is-dark { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 0; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-container.is-rounded.is-dark { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-container.is-rounded.is-dark { - border-image-repeat: stretch; - } -} - -.nes-container.is-rounded.is-dark::after { - content: none; -} - -.nes-container.is-rounded.is-dark.with-title > .title { - margin-top: -1.3rem; -} - -.nes-container.is-rounded.is-dark.with-title.is-centered > .title { - margin: -1.3rem auto 1rem; -} - -.nes-container.is-rounded.is-dark.with-title.is-right > .title { - margin: -1.3rem 0 1rem auto; -} - -.nes-dialog { - padding: 1.5rem 2rem; - border-width: 4px; -} - -.nes-dialog > .backdrop, .nes-dialog::-webkit-backdrop { - background-color: rgba(0, 0, 0, 0.3); -} - -.nes-dialog > .backdrop, .nes-dialog::backdrop { - background-color: rgba(0, 0, 0, 0.3); -} - -.nes-dialog > :last-child { - margin-bottom: 0; -} - -.nes-dialog.is-rounded { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-dialog.is-rounded { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-dialog.is-rounded { - border-image-repeat: stretch; - } -} - -.nes-dialog.is-rounded.is-dark { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 0; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-dialog.is-rounded.is-dark { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-dialog.is-rounded.is-dark { - border-image-repeat: stretch; - } -} - -.nes-dialog.is-dark { - color: #fff; - background-color: #212529; - border-color: #fff; -} - -.nes-dialog.is-dark:not(.is-rounded)::before { - position: absolute; - top: -8px; - right: -8px; - bottom: -8px; - left: -8px; - z-index: -1; - content: ""; - border: 4px solid #212529; -} - -.nes-list { - list-style-type: none; -} - -.nes-list li { - position: relative; -} - -.nes-list.is-disc li::before { - position: absolute; - top: calc(50% - 8px); - left: -22px; - content: ""; - width: 2px; - height: 2px; - color: #212529; - box-shadow: 8px 2px,10px 2px,6px 4px,8px 4px,10px 4px,12px 4px,4px 6px,6px 6px,8px 6px,10px 6px,12px 6px,14px 6px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,14px 8px,6px 10px,8px 10px,10px 10px,12px 10px,8px 12px,10px 12px; -} - -@supports (-moz-appearance: meterbar) { - .nes-list.is-disc li::before { - box-shadow: 8px 2px 0 0.020em,10px 2px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,10px 4px 0 0.020em,12px 4px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,8px 6px 0 0.020em,10px 6px 0 0.020em,12px 6px 0 0.020em,14px 6px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,8px 8px 0 0.020em,10px 8px 0 0.020em,12px 8px 0 0.020em,14px 8px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,12px 10px 0 0.020em,8px 12px 0 0.020em,10px 12px 0 0.020em; - } -} - -.nes-list.is-circle li::before { - position: absolute; - top: calc(50% - 8px); - left: -22px; - content: ""; - width: 2px; - height: 2px; - color: #212529; - box-shadow: 8px 2px,10px 2px,6px 4px,8px 4px,10px 4px,12px 4px,4px 6px,6px 6px,12px 6px,14px 6px,4px 8px,6px 8px,12px 8px,14px 8px,6px 10px,8px 10px,10px 10px,12px 10px,8px 12px,10px 12px; -} - -@supports (-moz-appearance: meterbar) { - .nes-list.is-circle li::before { - box-shadow: 8px 2px 0 0.020em,10px 2px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,10px 4px 0 0.020em,12px 4px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,12px 6px 0 0.020em,14px 6px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,12px 8px 0 0.020em,14px 8px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,12px 10px 0 0.020em,8px 12px 0 0.020em,10px 12px 0 0.020em; - } -} - -.nes-progress { - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - width: 100%; - height: 48px; - margin: 4px; - color: #212529; - background-color: #fff; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-progress { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-progress { - border-image-repeat: stretch; - } -} - -.nes-progress::-webkit-progress-bar { - background-color: #fff; -} - -.nes-progress::-webkit-progress-value { - background-color: #212529; -} - -.nes-progress::-moz-progress-bar { - background-color: #212529; -} - -.nes-progress::-ms-fill { - background-color: #212529; - border: none; -} - -.nes-progress.is-rounded { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-progress.is-rounded { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-progress.is-rounded { - border-image-repeat: stretch; - } -} - -.nes-progress.is-primary::-webkit-progress-bar { - background-color: #fff; -} - -.nes-progress.is-primary::-webkit-progress-value { - background-color: #209cee; -} - -.nes-progress.is-primary::-moz-progress-bar { - background-color: #209cee; -} - -.nes-progress.is-primary::-ms-fill { - background-color: #209cee; - border: none; -} - -.nes-progress.is-success::-webkit-progress-bar { - background-color: #fff; -} - -.nes-progress.is-success::-webkit-progress-value { - background-color: #92cc41; -} - -.nes-progress.is-success::-moz-progress-bar { - background-color: #92cc41; -} - -.nes-progress.is-success::-ms-fill { - background-color: #92cc41; - border: none; -} - -.nes-progress.is-warning::-webkit-progress-bar { - background-color: #fff; -} - -.nes-progress.is-warning::-webkit-progress-value { - background-color: #f7d51d; -} - -.nes-progress.is-warning::-moz-progress-bar { - background-color: #f7d51d; -} - -.nes-progress.is-warning::-ms-fill { - background-color: #f7d51d; - border: none; -} - -.nes-progress.is-error::-webkit-progress-bar { - background-color: #fff; -} - -.nes-progress.is-error::-webkit-progress-value { - background-color: #e76e55; -} - -.nes-progress.is-error::-moz-progress-bar { - background-color: #e76e55; -} - -.nes-progress.is-error::-ms-fill { - background-color: #e76e55; - border: none; -} - -.nes-progress.is-pattern::-webkit-progress-value { - background-color: #212529; - background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff); - background-position: 0 0, 10px 10px; - background-size: 20px 20px; -} - -.nes-progress.is-pattern::-moz-progress-bar { - background-color: #212529; - background-image: -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff); - background-position: 0 0, 10px 10px; - background-size: 20px 20px; -} - -.nes-progress.is-pattern::-ms-fill { - background-color: #212529; - background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff); - background-position: 0 0, 10px 10px; - background-size: 20px 20px; - border: none; -} - -.nes-table-responsive { - max-width: 100%; - overflow-x: auto; - overflow-y: hidden; -} - -.nes-table { - table-layout: fixed; - background-color: #fff; - /*************************************************************************** \ - This eliminates the gap between the last row in a table and the border, as - well as hiding the derelict pixels in the bottom right and bottom left of - the last row of a table - \ ***************************************************************************/ -} - -.nes-table tr { - margin-left: -0.25em; -} - -.nes-table th, -.nes-table td { - position: relative; - padding: 0.5rem; - word-wrap: break-word; - border-color: #212529; - border-style: solid; - border-width: 0 0.25em 0.25em 0; -} - -.nes-table th:last-child, -.nes-table td:last-child { - border-right-width: 0; -} - -.nes-table th::after, .nes-table th::before, -.nes-table td::after, -.nes-table td::before { - position: absolute; - display: block; - width: 0.25em; - height: 0.25em; - content: ""; - background-color: #212529; -} - -.nes-table th::after, -.nes-table td::after { - bottom: -0.25em; - left: -0.25em; -} - -.nes-table th::before, -.nes-table td::before { - top: -0.25em; - right: -0.25em; -} - -.nes-table th:last-child::before, -.nes-table td:last-child::before { - top: initial; - bottom: -0.25em; -} - -.nes-table.is-centered th { - text-align: center; -} - -.nes-table.is-bordered { - margin: 4px; - border-spacing: 0; - border-collapse: separate; - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-table.is-bordered { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-table.is-bordered { - border-image-repeat: stretch; - } -} - -.nes-table.is-dark { - color: #fff; - background-color: #212529; -} - -.nes-table.is-dark::before { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - content: ""; -} - -.nes-table.is-dark.is-bordered { - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 0; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-table.is-dark.is-bordered { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-table.is-dark.is-bordered { - border-image-repeat: stretch; - } -} - -.nes-table.is-dark th, -.nes-table.is-dark td { - border-color: #fff; -} - -.nes-table.is-dark th::after, .nes-table.is-dark th::before, -.nes-table.is-dark td::after, -.nes-table.is-dark td::before { - display: none; -} - -.nes-table tbody tr:last-child th, -.nes-table tbody tr:last-child td, -.nes-table thead:last-child tr:last-child th, -.nes-table thead:last-child tr:last-child td { - border-bottom-width: 0; -} - -.nes-table tbody tr:last-child th:first-child::after, .nes-table tbody tr:last-child th:last-child::before, -.nes-table tbody tr:last-child td:first-child::after, -.nes-table tbody tr:last-child td:last-child::before, -.nes-table thead:last-child tr:last-child th:first-child::after, -.nes-table thead:last-child tr:last-child th:last-child::before, -.nes-table thead:last-child tr:last-child td:first-child::after, -.nes-table thead:last-child tr:last-child td:last-child::before { - display: none; -} - -.nes-text.is-primary { - color: #209cee; -} - -.nes-text.is-success { - color: #92cc41; -} - -.nes-text.is-warning { - color: #f7d51d; -} - -.nes-text.is-error { - color: #e76e55; -} - -.nes-text.is-disabled { - color: #d3d3d3; -} - -.nes-input, -.nes-textarea { - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - width: calc(100% - 8px); - padding: 0.5rem 1rem; - margin: 4px; - background-clip: padding-box; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-input, - .nes-textarea { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-input, - .nes-textarea { - border-image-repeat: stretch; - } -} - -.nes-input.is-dark, -.nes-textarea.is-dark { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #e7e7e7; - color: #fff; - background-color: #212529; -} - -.nes-input.is-success, -.nes-textarea.is-success { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #76c442; -} - -.nes-input.is-warning, -.nes-textarea.is-warning { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #f2c409; -} - -.nes-input.is-error, -.nes-textarea.is-error { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #ce372b; -} - -.nes-field > label { - display: block; -} - -.nes-field .nes-input, -.nes-field .nes-textarea { - display: block; -} - -.nes-field.is-inline { - display: flex; - align-items: center; -} - -.nes-field.is-inline > label { - flex-basis: 0; - flex-grow: 1; - margin: 0; - margin-right: 1.5rem; - text-align: right; -} - -.nes-field.is-inline .nes-input, -.nes-field.is-inline .nes-textarea { - flex-basis: 0; - flex-grow: 5; -} - -@media screen and (max-width: 768px) { - .nes-field.is-inline { - display: block; - } - .nes-field.is-inline > label { - margin-bottom: 0.5rem; - text-align: left; - } - .nes-field.is-inline .nes-input { - max-width: 100%; - } -} - -.nes-radio { - margin-right: 20px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - width: 1px; - height: 1px; - padding: 0; - overflow: hidden; - clip: rect(0 0 0 0); - white-space: nowrap; - border: 0; - -webkit-clip-path: inset(50%); - clip-path: inset(50%); -} - -.nes-radio + span { - position: relative; - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; -} - -.nes-radio:checked + span::before { - position: absolute; - top: -2px; - left: -20px; - content: ""; - width: 2px; - height: 2px; - color: #212529; - box-shadow: 2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px; -} - -@supports (-moz-appearance: meterbar) { - .nes-radio:checked + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,2px 4px 0 0.020em,4px 4px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,2px 6px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,8px 6px 0 0.020em,10px 6px 0 0.020em,2px 8px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,8px 8px 0 0.020em,10px 8px 0 0.020em,12px 8px 0 0.020em,2px 10px 0 0.020em,4px 10px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,2px 12px 0 0.020em,4px 12px 0 0.020em,6px 12px 0 0.020em,8px 12px 0 0.020em,2px 14px 0 0.020em,4px 14px 0 0.020em; - } -} - -.nes-radio:checked:hover + span::before, .nes-radio:checked:focus + span::before { - animation: blink 1s infinite steps(1); -} - -.nes-radio:checked:focus + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px; -} - -@supports (-moz-appearance: meterbar) { - .nes-radio:checked:focus + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,2px 4px 0 0.020em,4px 4px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,2px 6px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,8px 6px 0 0.020em,10px 6px 0 0.020em,2px 8px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,8px 8px 0 0.020em,10px 8px 0 0.020em,12px 8px 0 0.020em,2px 10px 0 0.020em,4px 10px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,2px 12px 0 0.020em,4px 12px 0 0.020em,6px 12px 0 0.020em,8px 12px 0 0.020em,2px 14px 0 0.020em,4px 14px 0 0.020em; - } -} - -.nes-radio.is-dark + span { - color: #fff; -} - -.nes-radio.is-dark + span::before { - /* stylelint-disable-line no-descending-specificity */ - color: #fff; -} - -.nes-radio.is-dark:checked + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px; - color: #fff; -} - -@supports (-moz-appearance: meterbar) { - .nes-radio.is-dark:checked + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,2px 4px 0 0.020em,4px 4px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,2px 6px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,8px 6px 0 0.020em,10px 6px 0 0.020em,2px 8px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,8px 8px 0 0.020em,10px 8px 0 0.020em,12px 8px 0 0.020em,2px 10px 0 0.020em,4px 10px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,2px 12px 0 0.020em,4px 12px 0 0.020em,6px 12px 0 0.020em,8px 12px 0 0.020em,2px 14px 0 0.020em,4px 14px 0 0.020em; - } -} - -.nes-radio.is-dark:checked:focus + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px; - color: #fff; -} - -@supports (-moz-appearance: meterbar) { - .nes-radio.is-dark:checked:focus + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,2px 4px 0 0.020em,4px 4px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,2px 6px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,8px 6px 0 0.020em,10px 6px 0 0.020em,2px 8px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,8px 8px 0 0.020em,10px 8px 0 0.020em,12px 8px 0 0.020em,2px 10px 0 0.020em,4px 10px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,2px 12px 0 0.020em,4px 12px 0 0.020em,6px 12px 0 0.020em,8px 12px 0 0.020em,2px 14px 0 0.020em,4px 14px 0 0.020em; - } -} - -.nes-checkbox { - margin-left: 28px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - width: 1px; - height: 1px; - padding: 0; - overflow: hidden; - clip: rect(0 0 0 0); - white-space: nowrap; - border: 0; - -webkit-clip-path: inset(50%); - clip-path: inset(50%); -} - -.nes-checkbox + span { - position: relative; - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; -} - -.nes-checkbox + span::before, -.nes-checkbox:checked + span::before { - position: absolute; - top: -3px; - left: -28px; - content: ""; -} - -.nes-checkbox + span::before { - /* stylelint-disable-line no-descending-specificity */ - width: 2px; - height: 2px; - color: #212529; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,16px 2px,2px 4px,16px 4px,2px 6px,16px 6px,2px 8px,16px 8px,2px 10px,16px 10px,2px 12px,16px 12px,2px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,16px 2px 0 0.020em,2px 4px 0 0.020em,16px 4px 0 0.020em,2px 6px 0 0.020em,16px 6px 0 0.020em,2px 8px 0 0.020em,16px 8px 0 0.020em,2px 10px 0 0.020em,16px 10px 0 0.020em,2px 12px 0 0.020em,16px 12px 0 0.020em,2px 14px 0 0.020em,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-checkbox:focus + span::before { - /* stylelint-disable-line no-descending-specificity */ - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,16px 2px,2px 4px,16px 4px,2px 6px,16px 6px,2px 8px,16px 8px,2px 10px,16px 10px,2px 12px,16px 12px,2px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox:focus + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,16px 2px 0 0.020em,2px 4px 0 0.020em,16px 4px 0 0.020em,2px 6px 0 0.020em,16px 6px 0 0.020em,2px 8px 0 0.020em,16px 8px 0 0.020em,2px 10px 0 0.020em,16px 10px 0 0.020em,2px 12px 0 0.020em,16px 12px 0 0.020em,2px 14px 0 0.020em,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-checkbox:checked + span::before { - width: 2px; - height: 2px; - color: #212529; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px,20px 2px,2px 4px,16px 4px,18px 4px,20px 4px,2px 6px,14px 6px,16px 6px,2px 8px,4px 8px,12px 8px,14px 8px,2px 10px,4px 10px,6px 10px,10px 10px,12px 10px,16px 10px,2px 12px,6px 12px,8px 12px,10px 12px,16px 12px,2px 14px,8px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox:checked + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,18px 2px 0 0.020em,20px 2px 0 0.020em,2px 4px 0 0.020em,16px 4px 0 0.020em,18px 4px 0 0.020em,20px 4px 0 0.020em,2px 6px 0 0.020em,14px 6px 0 0.020em,16px 6px 0 0.020em,2px 8px 0 0.020em,4px 8px 0 0.020em,12px 8px 0 0.020em,14px 8px 0 0.020em,2px 10px 0 0.020em,4px 10px 0 0.020em,6px 10px 0 0.020em,10px 10px 0 0.020em,12px 10px 0 0.020em,16px 10px 0 0.020em,2px 12px 0 0.020em,6px 12px 0 0.020em,8px 12px 0 0.020em,10px 12px 0 0.020em,16px 12px 0 0.020em,2px 14px 0 0.020em,8px 14px 0 0.020em,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-checkbox:checked:focus + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #212529,20px 2px #212529,2px 4px,16px 4px #212529,18px 4px #212529,20px 4px #212529,2px 6px #212529,14px 6px #212529,16px 6px #212529,2px 8px #212529,4px 8px #212529,12px 8px #212529,14px 8px #212529,2px 10px,4px 10px #212529,6px 10px #212529,10px 10px #212529,12px 10px #212529,16px 10px,2px 12px,6px 12px #212529,8px 12px #212529,10px 12px #212529,16px 12px,2px 14px,8px 14px #212529,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox:checked:focus + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,18px 2px 0 0.020em #212529,20px 2px 0 0.020em #212529,2px 4px 0 0.020em,16px 4px 0 0.020em #212529,18px 4px 0 0.020em #212529,20px 4px 0 0.020em #212529,2px 6px 0 0.020em #212529,14px 6px 0 0.020em #212529,16px 6px 0 0.020em #212529,2px 8px 0 0.020em #212529,4px 8px 0 0.020em #212529,12px 8px 0 0.020em #212529,14px 8px 0 0.020em #212529,2px 10px 0 0.020em,4px 10px 0 0.020em #212529,6px 10px 0 0.020em #212529,10px 10px 0 0.020em #212529,12px 10px 0 0.020em #212529,16px 10px 0 0.020em,2px 12px 0 0.020em,6px 12px 0 0.020em #212529,8px 12px 0 0.020em #212529,10px 12px 0 0.020em #212529,16px 12px 0 0.020em,2px 14px 0 0.020em,8px 14px 0 0.020em #212529,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-checkbox.is-dark + span { - color: #fff; -} - -.nes-checkbox.is-dark + span::before { - /* stylelint-disable-line no-descending-specificity */ - color: #fff; -} - -.nes-checkbox.is-dark:checked + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #fff,20px 2px #fff,2px 4px,16px 4px #fff,18px 4px #fff,20px 4px #fff,2px 6px #fff,14px 6px #fff,16px 6px #fff,2px 8px #fff,4px 8px #fff,12px 8px #fff,14px 8px #fff,2px 10px,4px 10px #fff,6px 10px #fff,10px 10px #fff,12px 10px #fff,16px 10px,2px 12px,6px 12px #fff,8px 12px #fff,10px 12px #fff,16px 12px,2px 14px,8px 14px #fff,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; - color: #fff; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox.is-dark:checked + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,18px 2px 0 0.020em #fff,20px 2px 0 0.020em #fff,2px 4px 0 0.020em,16px 4px 0 0.020em #fff,18px 4px 0 0.020em #fff,20px 4px 0 0.020em #fff,2px 6px 0 0.020em #fff,14px 6px 0 0.020em #fff,16px 6px 0 0.020em #fff,2px 8px 0 0.020em #fff,4px 8px 0 0.020em #fff,12px 8px 0 0.020em #fff,14px 8px 0 0.020em #fff,2px 10px 0 0.020em,4px 10px 0 0.020em #fff,6px 10px 0 0.020em #fff,10px 10px 0 0.020em #fff,12px 10px 0 0.020em #fff,16px 10px 0 0.020em,2px 12px 0 0.020em,6px 12px 0 0.020em #fff,8px 12px 0 0.020em #fff,10px 12px 0 0.020em #fff,16px 12px 0 0.020em,2px 14px 0 0.020em,8px 14px 0 0.020em #fff,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-checkbox.is-dark:checked:focus + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #fff,20px 2px #fff,2px 4px,16px 4px #fff,18px 4px #fff,20px 4px #fff,2px 6px #fff,14px 6px #fff,16px 6px #fff,2px 8px #fff,4px 8px #fff,12px 8px #fff,14px 8px #fff,2px 10px,4px 10px #fff,6px 10px #fff,10px 10px #fff,12px 10px #fff,16px 10px,2px 12px,6px 12px #fff,8px 12px #fff,10px 12px #fff,16px 12px,2px 14px,8px 14px #fff,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; - color: #fff; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox.is-dark:checked:focus + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,18px 2px 0 0.020em #fff,20px 2px 0 0.020em #fff,2px 4px 0 0.020em,16px 4px 0 0.020em #fff,18px 4px 0 0.020em #fff,20px 4px 0 0.020em #fff,2px 6px 0 0.020em #fff,14px 6px 0 0.020em #fff,16px 6px 0 0.020em #fff,2px 8px 0 0.020em #fff,4px 8px 0 0.020em #fff,12px 8px 0 0.020em #fff,14px 8px 0 0.020em #fff,2px 10px 0 0.020em,4px 10px 0 0.020em #fff,6px 10px 0 0.020em #fff,10px 10px 0 0.020em #fff,12px 10px 0 0.020em #fff,16px 10px 0 0.020em,2px 12px 0 0.020em,6px 12px 0 0.020em #fff,8px 12px 0 0.020em #fff,10px 12px 0 0.020em #fff,16px 12px 0 0.020em,2px 14px 0 0.020em,8px 14px 0 0.020em #fff,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-select { - position: relative; - width: calc(100% - 8px); - margin: 4px; -} - -.nes-select select { - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - width: 100%; - padding: 0.5rem 2.5rem 0.5rem 1rem; - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; - border-radius: 0; - outline-color: #e7e7e7; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-select select { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-select select { - border-image-repeat: stretch; - } -} - -.nes-select select:invalid { - color: #adafbc; -} - -.nes-select.is-dark select { - color: #fff; - background-color: #212529; -} - -.nes-select::after { - width: 3px; - height: 3px; - color: #212529; - box-shadow: 3px 3px,6px 3px,9px 3px,12px 3px,15px 3px,18px 3px,21px 3px,3px 6px,6px 6px,9px 6px,12px 6px,15px 6px,18px 6px,21px 6px,6px 9px,9px 9px,12px 9px,15px 9px,18px 9px,6px 12px,9px 12px,12px 12px,15px 12px,18px 12px,9px 15px,12px 15px,15px 15px,12px 18px; - position: absolute; - top: calc(50% - 11px); - right: 36px; - pointer-events: none; - content: ""; -} - -@supports (-moz-appearance: meterbar) { - .nes-select::after { - box-shadow: 3px 3px 0 0.020em,6px 3px 0 0.020em,9px 3px 0 0.020em,12px 3px 0 0.020em,15px 3px 0 0.020em,18px 3px 0 0.020em,21px 3px 0 0.020em,3px 6px 0 0.020em,6px 6px 0 0.020em,9px 6px 0 0.020em,12px 6px 0 0.020em,15px 6px 0 0.020em,18px 6px 0 0.020em,21px 6px 0 0.020em,6px 9px 0 0.020em,9px 9px 0 0.020em,12px 9px 0 0.020em,15px 9px 0 0.020em,18px 9px 0 0.020em,6px 12px 0 0.020em,9px 12px 0 0.020em,12px 12px 0 0.020em,15px 12px 0 0.020em,18px 12px 0 0.020em,9px 15px 0 0.020em,12px 15px 0 0.020em,15px 15px 0 0.020em,12px 18px 0 0.020em; - } -} - -.nes-select.is-success::after { - color: #92cc41; -} - -.nes-select.is-success select { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #76c442; -} - -.nes-select.is-warning::after { - color: #f7d51d; -} - -.nes-select.is-warning select { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #f2c409; -} - -.nes-select.is-error::after { - color: #e76e55; -} - -.nes-select.is-error select { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #ce372b; -} - -.nes-select.is-dark::after { - color: #fff; -} - -.nes-select.is-dark select { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #e7e7e7; -} -/*# sourceMappingURL=nes-core.css.map */ \ No newline at end of file diff --git a/node_modules/nes.css/css/nes-core.css.map b/node_modules/nes.css/css/nes-core.css.map deleted file mode 100644 index 849a1e2..0000000 --- a/node_modules/nes.css/css/nes-core.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../scss/nes-core.scss","nes-core.css","../scss/base/reboot.scss","../scss/base/generic.scss","../scss/base/variables.scss","../scss/base/color-palette.scss","../scss/utilities/animations.scss","../scss/utilities/rounded-corners-mixin.scss","../scss/utilities/visually-hidden.scss","../scss/helpers/pointer.scss","../scss/elements/avatar.scss","../scss/elements/badges.scss","../scss/elements/balloons.scss","../scss/elements/buttons.scss","../scss/elements/containers.scss","../scss/elements/dialogs.scss","../scss/elements/lists.scss","../scss/utilities/icon-mixin.scss","../scss/elements/progress.scss","../scss/elements/tables.scss","../scss/elements/text.scss","../scss/form/inputs.scss","../scss/form/radios.scss","../scss/form/checkboxes.scss","../scss/form/selects.scss"],"names":[],"mappings":"AAEA;;;;8ECE8E;ACJ9E;;;;;;EDWE;ACJF;;;EAGE,sBAAsB;ADMxB;;ACHA;EACE,uBAAuB;EACvB,iBAAiB;EACjB,8BAA8B;EAC9B,6BAA6B;EAC7B,6CAA6C;ADM/C;;ACHA;EACE,mBAAmB;ADMrB;;ACHA;;;;;;;;;;EAUE,cAAc;ADMhB;;ACHA;EACE,SAAS;EACT,gMAEoB;EACpB,eAAe;EACf,gBAAgB;EAChB,gBAAgB;EAChB,cAAc;EACd,gBAAgB;EAChB,sBAAsB;ADIxB;;AAEA;ECFE,qBAAqB;ADIvB;;ACDA;EACE,uBAAuB;EACvB,SAAS;EACT,iBAAiB;ADInB;;ACDA;;;;;;EAME,aAAa;EACb,qBAAqB;ADIvB;;ACDA;EACE,aAAa;EACb,mBAAmB;ADIrB;;ACDA;;EAEE,yCAAyC;EACzC,0BAA0B;EAC1B,iCAAiC;EACjC,YAAY;EACZ,gBAAgB;ADIlB;;ACDA;EACE,mBAAmB;EACnB,kBAAkB;EAClB,oBAAoB;ADItB;;ACDA;;;EAGE,aAAa;EACb,mBAAmB;ADIrB;;ACDA;;;;EAIE,gBAAgB;ADIlB;;ACDA;EACE,gBAAgB;ADIlB;;ACDA;EACE,qBAAqB;EACrB,cAAc;ADIhB;;ACDA;EACE,gBAAgB;ADIlB;;ACDA;;EAEE,mBAAmB;ADIrB;;ACDA;EACE,cAAc;ADIhB;;ACDA;;EAEE,kBAAkB;EAClB,cAAc;EACd,cAAc;EACd,wBAAwB;ADI1B;;ACDA;EACE,eAAe;ADIjB;;ACDA;EACE,WAAW;ADIb;;ACDA;EACE,cAAc;EACd,qBAAqB;EACrB,6BAA6B;ADI/B;;ACDA;EACE,cAAc;EACd,0BAA0B;ADI5B;;ACDA;EACE,cAAc;EACd,qBAAqB;ADIvB;;ACDA;;EAEE,cAAc;EACd,qBAAqB;ADIvB;;ACDA;EACE,UAAU;ADIZ;;ACDA;;;;EAIE,iGAAiG;EACjG,cAAc;ADIhB;;ACDA;EACE,aAAa;EACb,mBAAmB;EACnB,cAAc;EACd,6BAA6B;ADI/B;;ACDA;EACE,gBAAgB;ADIlB;;ACDA;EACE,sBAAsB;EACtB,kBAAkB;ADIpB;;ACDA;EACE,gBAAgB;EAChB,sBAAsB;ADIxB;;ACDA;EACE,yBAAyB;ADI3B;;ACDA;EACE,oBAAoB;EACpB,uBAAuB;EACvB,cAAc;EACd,gBAAgB;EAChB,oBAAoB;ADItB;;ACDA;EACE,mBAAmB;ADIrB;;ACDA;EACE,qBAAqB;EACrB,qBAAqB;ADIvB;;ACDA;EACE,gBAAgB;ADIlB;;ACDA;;;;;EAKE,SAAS;EACT,oBAAoB;EACpB,kBAAkB;EAClB,oBAAoB;ADItB;;ACDA;;EAEE,iBAAiB;ADInB;;ACDA;;EAEE,oBAAoB;ADItB;;ACDA;;;;EAIE,0BAA0B;ADI5B;;ACDA;;;;EAIE,UAAU;EACV,kBAAkB;ADIpB;;ACDA;EACE,mBAAmB;EACnB,0CAA0C;ADI5C;;ACDA;;EAEE,sBAAsB;EACtB,UAAU;ADIZ;;ACDA;;;;EAIE,2BAA2B;ADI7B;;ACDA;EACE,cAAc;EACd,gBAAgB;ADIlB;;ACDA;EACE,YAAY;EACZ,UAAU;EACV,SAAS;EACT,SAAS;ADIX;;ACDA;EACE,cAAc;EACd,WAAW;EACX,eAAe;EACf,UAAU;EACV,qBAAqB;EACrB,iBAAiB;EACjB,oBAAoB;EACpB,cAAc;EACd,mBAAmB;ADIrB;;ACDA;EACE,wBAAwB;ADI1B;;AAEA;;ECDE,YAAY;ADId;;AAEA;ECFE,oBAAoB;EACpB,wBAAwB;ADI1B;;AAEA;ECFE,wBAAwB;ADI1B;;ACDA;EACE,aAAa;EACb,0BAA0B;ADI5B;;ACDA;EACE,qBAAqB;ADIvB;;ACDA;EACE,kBAAkB;EAClB,eAAe;ADIjB;;ACDA;EACE,aAAa;ADIf;;AAEA;ECFE,wBAAwB;ADI1B;;AEpVA;;;;;;EAME,6BCP4B;AH8V9B;;AClVA;ECDE,yeAAyB;AFuV3B;;AC7TA;ECtBE,eCdc;EDed,cEfmB;EFgBnB,sBEfgB;EFgBhB,mCAAmC;AFuVrC;;ACpJA;EC/LE,eAAe;AFuVjB;;AEpVA;;EAEE,6YAAkC;AFuVpC;;AC/HA;;;;ECjNE,wBAAwB;AFuV1B;;AClHA;;EC/NE,UAAU;AFsVZ;;AK/XA;EACE;IACE,UAAU;ELkYZ;EK/XA;IACE,UAAU;ELiYZ;AACF;;AMxYA;;EACE,mBAAmB;EACnB,iBHQe;AHoYjB;;AO9YA,mFAAA;ACAA;EACE,6YAAkC;ARkZpC;;ASzYA;EAPE,WAFkB;EAGlB,YAHkB;ATuZpB;;ASlZE;EACE,mBAAmB;ATqZvB;;ASlZA;EAPE,WAFkB;EAGlB,YAHkB;ATgapB;;AS3ZE;EACE,mBAAmB;AT8ZvB;;AS3ZA;EAPE,WAFkB;EAGlB,YAHkB;ATyapB;;ASpaE;EACE,mBAAmB;ATuavB;;ASpaA;EAPE,WAFkB;EAGlB,YAHkB;ATkbpB;;AS7aE;EACE,mBAAmB;ATgbvB;;AUvXA;EAGE,kBAAkB;EAClB,qBAAqB;EACrB,aAAe;EACf,eAAiB;EACjB,aAAa;EACb,gBAAoB;EACpB,mBAAmB;EACnB,mBAAmB;EACnB,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AVwXnB;;AUraI;EAlBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBNfmB;EMkBjB,OAAO;EAaL,4EN/Be;AJ4crB;;AU3aI;EAvBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBNfmB;EMoBjB,QAAQ;EAgBN,2ENpCe;AJudrB;;AUzZA;EA8BM,aAAc;AV+XpB;;AUpbI;EAxCF,aAyCyD;EAxCzD,mBAAmB;EACnB,uBAAuB;EACvB,YAsCgE;EArChE,gBAqCuE;EApCvE,WNHgB;EMIhB,kBAAkB;EAClB,yBNNmB;EM0Cf,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;AV6bnB;;AU3bI;EAhDF,qBAiDiE;EAhDjE,mBAAmB;EACnB,uBAAuB;EACvB,UA8CsE;EA7CtE,iBA6C8E;EA5C9E,WNHgB;EMIhB,kBAAkB;EAClB,yBNNmB;EMkDf,gFNlDe;AJsfrB;;AUjcI;EA3CF,kBAAkB;EAClB,MAAM;EACN,WA0CoD;EAzCpD,WNZgB;EMahB,kBAAkB;EAClB,yBNfmB;EMwDf,gFNxDe;AJggBrB;;AUpeI;EAlBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPKe;EOFb,OAAO;EAaL,4EPXW;AHufjB;;AU1eI;EAvBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPKe;EOAb,QAAQ;EAgBN,2EPhBW;AHkgBjB;;AUxdA;EA8BM,aAAc;AV8bpB;;AUnfI;EAxCF,aAyCyD;EAxCzD,mBAAmB;EACnB,uBAAuB;EACvB,YAsCgE;EArChE,gBAqCuE;EApCvE,WNHgB;EMIhB,kBAAkB;EAClB,yBPce;EOsBX,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;AV4fnB;;AU1fI;EAhDF,qBAiDiE;EAhDjE,mBAAmB;EACnB,uBAAuB;EACvB,UA8CsE;EA7CtE,iBA6C8E;EA5C9E,WNHgB;EMIhB,kBAAkB;EAClB,yBPce;EO8BX,gFP9BW;AHiiBjB;;AUhgBI;EA3CF,kBAAkB;EAClB,MAAM;EACN,WA0CoD;EAzCpD,WNZgB;EMahB,kBAAkB;EAClB,yBPKe;EOoCX,gFPpCW;AH2iBjB;;AUniBI;EAlBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPUe;EOPb,OAAO;EAaL,4EPNW;AHijBjB;;AUziBI;EAvBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPUe;EOLb,QAAQ;EAgBN,2EPXW;AH4jBjB;;AUvhBA;EA8BM,aAAc;AV6fpB;;AUljBI;EAxCF,aAyCyD;EAxCzD,mBAAmB;EACnB,uBAAuB;EACvB,YAsCgE;EArChE,gBAqCuE;EApCvE,WNHgB;EMIhB,kBAAkB;EAClB,yBPmBe;EOiBX,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;AV2jBnB;;AUzjBI;EAhDF,qBAiDiE;EAhDjE,mBAAmB;EACnB,uBAAuB;EACvB,UA8CsE;EA7CtE,iBA6C8E;EA5C9E,WNHgB;EMIhB,kBAAkB;EAClB,yBPmBe;EOyBX,gFPzBW;AH2lBjB;;AU/jBI;EA3CF,kBAAkB;EAClB,MAAM;EACN,WA0CoD;EAzCpD,WNZgB;EMahB,kBAAkB;EAClB,yBPUe;EO+BX,gFP/BW;AHqmBjB;;AUlmBI;EAlBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,cNbmB;EMcnB,kBAAkB;EAClB,yBPee;EOZb,OAAO;EAaL,4EPDW;AH2mBjB;;AUxmBI;EAvBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,cNbmB;EMcnB,kBAAkB;EAClB,yBPee;EOVb,QAAQ;EAgBN,2EPNW;AHsnBjB;;AUtlBA;EA8BM,aAAc;AV4jBpB;;AUjnBI;EAxCF,aAyCyD;EAxCzD,mBAAmB;EACnB,uBAAuB;EACvB,YAsCgE;EArChE,gBAqCuE;EApCvE,cNJmB;EMKnB,kBAAkB;EAClB,yBPwBe;EOYX,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;AV0nBnB;;AUxnBI;EAhDF,qBAiDiE;EAhDjE,mBAAmB;EACnB,uBAAuB;EACvB,UA8CsE;EA7CtE,iBA6C8E;EA5C9E,cNJmB;EMKnB,kBAAkB;EAClB,yBPwBe;EOoBX,gFPpBW;AHqpBjB;;AU9nBI;EA3CF,kBAAkB;EAClB,MAAM;EACN,WA0CoD;EAzCpD,cNbmB;EMcnB,kBAAkB;EAClB,yBPee;EO0BX,gFP1BW;AH+pBjB;;AUjqBI;EAlBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPoBe;EOjBb,OAAO;EAaL,4EPIW;AHqqBjB;;AUvqBI;EAvBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPoBe;EOfb,QAAQ;EAgBN,2EPDW;AHgrBjB;;AUrpBA;EA8BM,aAAc;AV2nBpB;;AUhrBI;EAxCF,aAyCyD;EAxCzD,mBAAmB;EACnB,uBAAuB;EACvB,YAsCgE;EArChE,gBAqCuE;EApCvE,WNHgB;EMIhB,kBAAkB;EAClB,yBP6Be;EOOX,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;AVyrBnB;;AUvrBI;EAhDF,qBAiDiE;EAhDjE,mBAAmB;EACnB,uBAAuB;EACvB,UA8CsE;EA7CtE,iBA6C8E;EA5C9E,WNHgB;EMIhB,kBAAkB;EAClB,yBP6Be;EOeX,gFPfW;AH+sBjB;;AU7rBI;EA3CF,kBAAkB;EAClB,MAAM;EACN,WA0CoD;EAzCpD,WNZgB;EMahB,kBAAkB;EAClB,yBPoBe;EOqBX,gFPrBW;AHytBjB;;AWtuBA;ELME,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,yZAAgc;EAoC9b,sBAAsB;EKfxB,kBAAkB;EAClB,qBAAqB;EACrB,oBAAoB;EACpB,WAAW;EACX,mBAAmB;EACnB,sBP7BgB;AJywBlB;;AM3vBE;EKOF;ILNI,0BAA0B;EN+vB5B;AACF;;AM5vBuC;EKEvC;ILDI,4BAA4B;ENgwB9B;AACF;;AWhwBA;EAWI,gBAAgB;AXyvBpB;;AWpwBA;EAgBI,kBAAkB;EAClB,WAAW;AXwvBf;;AWzwBA;ELME,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,4ZAAgc;EAgC9b,sBAAsB;EKStB,WP5Cc;EO6Cd,mBP9CiB;EO+CjB,sBAAsB;EACtB,6BPhDiB;AJ2yBrB;;AM5xBE;EKOF;ILNI,0BAA0B;ENgyB5B;AACF;;AM7xBuC;EKEvC;ILDI,4BAA4B;ENiyB9B;AACF;;AWjyBA;EA+BQ,yBPrDa;EOsDb,kBPrDU;AJ2zBlB;;AWtyBA;EAoCQ,WPzDU;EO0DV,yBP3Da;AJi0BrB;;AW3yBA;EA2CQ,mCPjEa;AJq0BrB;;AW/yBA;EArBI,gFAOU;AXi0Bd;;AWnzBA;EAoDQ,kCP1Ea;AJ60BrB;;AWvzBA;EAXI,4EAOS;AX+zBb;;AW3zBA;EA+DM,UAAU;AXgwBhB;;AW/zBA;EAmEM,aAAa;EACb,WAAW;EACX,YAAY;EACZ,sBP3FY;EO4FZ,+BP7Fe;EO8Ff,8BP9Fe;AJ81BrB;;AWx0BA;EA4EM,aAAa;EACb,WAAW;EACX,WAAW;EACX,iBAAiB;EACjB,cPtGe;EOuGf,sBPtGY;EOAd,6EAOU;AXg2Bd;;AWl1BA;EAyFM,WAAW;AX6vBjB;;AWt1BA;EA6FM,aAAa;EACb,WAAW;EACX,YAAY;EACZ,sBPrHY;EOsHZ,+BPvHe;EOwHf,8BPxHe;AJq3BrB;;AW/1BA;EAsGM,aAAa;EACb,WAAW;EACX,WAAW;EACX,gBAAgB;EAChB,sBP/HY;EOUd,yEAOS;AX42Bb;;AY91BA;ENeE,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,iRAAwT;EAmDtT,sBAAsB;EMxBxB,kBAAkB;EAClB,qBAAqB;EACrB,gBAAgB;EAChB,WT9Be;ES+Bf,kBAAkB;EAClB,sBAAsB;EACtB,6YAAkC;EAClC,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;EA3CjB,cRCmB;EQAnB,sBRCgB;AJ+4BlB;;AMj4BE;EMiBF;INhBI,0BAA0B;ENq4B5B;AACF;;AMl4BuC;EMYvC;INXI,4BAA4B;ENs4B9B;AACF;;AY15BE;EACE,kBAAkB;EAClB,STIa;ESHb,WTGa;ESFb,YTEa;ESDb,UTCa;ESAb,WAAW;EACX,mCTIa;AHy5BjB;;AY15BE;EACE,cRbiB;EQcjB,qBAAqB;EACrB,yBTHY;AHg6BhB;;AY35BI;EACE,mCTLW;AHm6BjB;;AY15BE;EACE,8CTVa;AHu6BjB;;AY15BE;EACE,iCTda;AH26BjB;;AYl6BE;EA8BE,UAAU;AZw4Bd;;AY55BA;EA0BI,cR1DiB;EQ2DjB,mBAAmB;EACnB,yBT5Ca;ES6Cb,mCT5Ca;ES6Cb,YAAY;AZs4BhB;;AYp6BA;EAjCE,WREgB;EQDhB,yBToBe;AHq7BjB;;AYv8BE;EACE,kBAAkB;EAClB,STIa;ESHb,WTGa;ESFb,YTEa;ESDb,UTCa;ESAb,WAAW;EACX,mCTaa;AH67BjB;;AYv8BE;EACE,WRZc;EQad,qBAAqB;EACrB,yBTMY;AHo8BhB;;AYx8BI;EACE,mCTIW;AHu8BjB;;AYv8BE;EACE,4CTDa;AH28BjB;;AYv8BE;EACE,iCTLa;AH+8BjB;;AYr8BA;EAjCE,WREgB;EQDhB,yBTyBe;AHi9BjB;;AYx+BE;EACE,kBAAkB;EAClB,STIa;ESHb,WTGa;ESFb,YTEa;ESDb,UTCa;ESAb,WAAW;EACX,mCTkBa;AHy9BjB;;AYx+BE;EACE,WRZc;EQad,qBAAqB;EACrB,yBTWY;AHg+BhB;;AYz+BI;EACE,mCTSW;AHm+BjB;;AYx+BE;EACE,4CTIa;AHu+BjB;;AYx+BE;EACE,iCTAa;AH2+BjB;;AYt+BA;EAjCE,cRCmB;EQAnB,yBT8Be;AH6+BjB;;AYzgCE;EACE,kBAAkB;EAClB,STIa;ESHb,WTGa;ESFb,YTEa;ESDb,UTCa;ESAb,WAAW;EACX,mCTuBa;AHq/BjB;;AYzgCE;EACE,cRbiB;EQcjB,qBAAqB;EACrB,yBTgBY;AH4/BhB;;AY1gCI;EACE,mCTcW;AH+/BjB;;AYzgCE;EACE,4CTSa;AHmgCjB;;AYzgCE;EACE,iCTKa;AHugCjB;;AYvgCA;EAjCE,WREgB;EQDhB,yBTmCe;AHygCjB;;AY1iCE;EACE,kBAAkB;EAClB,STIa;ESHb,WTGa;ESFb,YTEa;ESDb,UTCa;ESAb,WAAW;EACX,mCT4Ba;AHihCjB;;AY1iCE;EACE,WRZc;EQad,qBAAqB;EACrB,yBTqBY;AHwhChB;;AY3iCI;EACE,mCTmBW;AH2hCjB;;AY1iCE;EACE,4CTca;AH+hCjB;;AY1iCE;EACE,iCTUa;AHmiCjB;;AYxiCA;EAgDI,kBAAkB;EAClB,oBAAoB;EACpB,UAAU;AZ4/Bd;;AahlCA;EACE,kBAAkB;EAClB,oBAAoB;EACpB,mBAAmB;EACnB,mBAAmB;EACnB,iBAAiB;AbmlCnB;;AaxlCA;EAQI,gBAAgB;AbolCpB;;Aa5lCA;EAYI,kBAAkB;AbolCtB;;AahmCA;EAgBI,iBAAiB;AbolCrB;;AapmCA;EAqBM,cAAc;EACd,iBAAiB;EACjB,sBAAsB;EACtB,eAAe;EACf,sBTtBY;AJymClB;;Aa5mCA;EA8BQ,uBAAuB;AbklC/B;;AahnCA;EAoCQ,yBAAyB;AbglCjC;;AapnCA;EA0CI,kBAAkB;EAClB,WVjCa;EUkCb,WTzCc;ES0Cd,yBT3CiB;ES4CjB,mBAAmB;Ab8kCvB;;Aa5nCA;EAiDM,kBAAkB;EAClB,WAAwB;EACxB,aAA0B;EAC1B,cAA2B;EAC3B,YAAyB;EACzB,WAAW;EACX,WAAW;EACX,yBTtDe;AJqoCrB;;AavoCA;EA6DQ,WT1DU;ES2DV,yBT5Da;AJ0oCrB;;Aa5oCA;EP8BE,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,yZAAgc;EAoC9b,sBAAsB;EO4BtB,oBAAoB;EACpB,WV7Da;AH4oCjB;;AMroCE;EOjBF;IPkBI,0BAA0B;ENyoC5B;AACF;;AMtoCuC;EOtBvC;IPuBI,4BAA4B;EN0oC9B;AACF;;AalqCA;EA2EQ,mBAAmB;Ab2lC3B;;AatqCA;EAgFU,yBAAyB;Ab0lCnC;;Aa1qCA;EAsFU,2BAA2B;AbwlCrC;;Aa9qCA;EP8BE,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,4ZAAgc;EAgC9b,sBAAsB;ANgpC1B;;AMrqCE;EOjBF;IPkBI,0BAA0B;ENyqC5B;AACF;;AMtqCuC;EOtBvC;IPuBI,4BAA4B;EN0qC9B;AACF;;AalsCA;EA8FQ,aAAa;AbwmCrB;;AatsCA;EAmGU,mBAAmB;AbumC7B;;Aa1sCA;EAwGY,yBAAyB;AbsmCrC;;Aa9sCA;EA8GY,2BAA2B;AbomCvC;;AcltCA;EACE,oBAAoB;EACpB,iBXQe;AH6sCjB;;AcvtCA;EAMI,oCAAoC;AdqtCxC;;Ac3tCA;EAMI,oCAAoC;AdqtCxC;;Ac3tCA;EAUI,gBAAgB;AdqtCpB;;Ac/tCA;ER8BE,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,yZAAgc;EAoC9b,sBAAsB;AN6rC1B;;AMttCE;EQjBF;IRkBI,0BAA0B;EN0tC5B;AACF;;AMvtCuC;EQtBvC;IRuBI,4BAA4B;EN2tC9B;AACF;;AcnvCA;ER8BE,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,4ZAAgc;EAgC9b,sBAAsB;ANqtC1B;;AM1uCE;EQjBF;IRkBI,0BAA0B;EN8uC5B;AACF;;AM3uCuC;EQtBvC;IRuBI,4BAA4B;EN+uC9B;AACF;;AcvwCA;EAqBI,WVlBc;EUmBd,yBVpBiB;EUqBjB,kBVpBc;AJ0wClB;;Ac7wCA;EA0BM,kBAAkB;EAClB,SAAsB;EACtB,WAAwB;EACxB,YAAyB;EACzB,UAAuB;EACvB,WAAW;EACX,WAAW;EACX,yBV/Be;AJsxCrB;;AexxCA;EAsBE,qBAAqB;AfswCvB;;Ae5xCA;EAyBI,kBAAkB;AfuwCtB;;AehyCA;EA6BI,kBAAkB;EAClB,oBAAoB;EACpB,WAAW;EACX,WAAW;ECiBb,UDfuB;ECgBvB,WDhBuB;ECiBvB,cZjDmB;EYkDnB,6NAAyB;AhBuvC3B;;AgBpvCuC;EDvDvC;ICwDI,6cAAyB;EhBwvC3B;AACF;;AejzCA;EAsCI,kBAAkB;EAClB,oBAAoB;EACpB,WAAW;EACX,WAAW;ECQb,UDNuB;ECOvB,WDPuB;ECQvB,cZjDmB;EYkDnB,2LAAyB;AhBwwC3B;;AgBrwCuC;EDvDvC;ICwDI,mYAAyB;EhBywC3B;AACF;;AiBl0CA;EXiDE,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,iRAAwT;EAmDtT,sBAAsB;EW1DxB,WAAW;EACX,YAAY;EACZ,WAAW;EACX,cbJmB;EaKnB,sBbJgB;EaKhB,wBAAwB;EACxB,qBAAgB;OAAhB,gBAAgB;AjBw0ClB;;AMh0CE;EWjBF;IXkBI,0BAA0B;ENo0C5B;AACF;;AMj0CuC;EWtBvC;IXuBI,4BAA4B;ENq0C9B;AACF;;AiB71CA;EAaM,sBbVY;AJ81ClB;;AiBj2CA;EAgBM,yBbde;AJm2CrB;;AiBr2CA;EAmBM,yBbjBe;AJu2CrB;;AiBz2CA;EAsBM,yBbpBe;EaqBf,YAAY;AjBu1ClB;;AiB92CA;EX8BE,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,yZAAgc;EAoC9b,sBAAsB;AN40C1B;;AMr2CE;EWjBF;IXkBI,0BAA0B;ENy2C5B;AACF;;AMt2CuC;EWtBvC;IXuBI,4BAA4B;EN02C9B;AACF;;AiBl4CA;EAaM,sBbVY;AJm4ClB;;AiBt4CA;EAgBM,yBdMW;AHo3CjB;;AiB14CA;EAmBM,yBdGW;AHw3CjB;;AiB94CA;EAsBM,yBdAW;EcCX,YAAY;AjB43ClB;;AiBn5CA;EAaM,sBbVY;AJo5ClB;;AiBv5CA;EAgBM,yBdWW;AHg4CjB;;AiB35CA;EAmBM,yBdQW;AHo4CjB;;AiB/5CA;EAsBM,yBdKW;EcJX,YAAY;AjB64ClB;;AiBp6CA;EAaM,sBbVY;AJq6ClB;;AiBx6CA;EAgBM,yBdgBW;AH44CjB;;AiB56CA;EAmBM,yBdaW;AHg5CjB;;AiBh7CA;EAsBM,yBdUW;EcTX,YAAY;AjB85ClB;;AiBr7CA;EAaM,sBbVY;AJs7ClB;;AiBz7CA;EAgBM,yBdqBW;AHw5CjB;;AiB77CA;EAmBM,yBdkBW;AH45CjB;;AiBj8CA;EAsBM,yBdeW;EcdX,YAAY;AjB+6ClB;;AiBt8CA;EAkDM,yBbhDe;EaiDf,wLAeG;EACH,mCAAmC;EACnC,0BAA0B;AjBy4ChC;;AiB78CA;EAwEM,yBbtEe;EauEf,kMAS+B;EAC/B,mCAAmC;EACnC,0BAA0B;AjBg4ChC;;AiBp9CA;EAwFM,yBbtFe;EauFf,wLAeG;EACH,mCAAmC;EACnC,0BAA0B;EAC1B,YAAY;AjBi3ClB;;AkB59CA;EACE,eAAe;EACf,gBAAgB;EAChB,kBAAkB;AlB+9CpB;;AkB59CA;EACE,mBAAmB;EACnB,sBdLgB;Ec0FhB;;;;gFlB84C8E;AAChF;;AkBt+CA;EAKI,oBAAoB;AlBq+CxB;;AkB1+CA;;EAUI,kBAAkB;EAClB,eAAe;EACf,qBAAqB;EACrB,qBdjBiB;EckBjB,mBAAmB;EACnB,+BAA+B;AlBq+CnC;;AkBp/CA;;EAkBM,qBAAqB;AlBu+C3B;;AkBz/CA;;;EAuBM,kBAAkB;EAClB,cAAc;EACd,aAAa;EACb,cAAc;EACd,WAAW;EACX,yBdhCe;AJwgDrB;;AkBpgDA;;EAgCM,eAAe;EACf,aAAa;AlBy+CnB;;AkB1gDA;;EAqCM,YAAY;EACZ,cAAc;AlB0+CpB;;AkBhhDA;;EA0CM,YAAY;EACZ,eAAe;AlB2+CrB;;AkBthDA;EAgDI,kBAAkB;AlB0+CtB;;AkB1hDA;EAoDI,WAAW;EACX,iBAAiB;EACjB,yBAAyB;EZX3B,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,iRAAwT;EAmDtT,sBAAsB;AN8+C1B;;AM1hDE;EYXF;IZYI,0BAA0B;EN8hD5B;AACF;;AM3hDuC;EYhBvC;IZiBI,4BAA4B;EN+hD9B;AACF;;AkBjjDA;EA4DI,Wd/Dc;EcgEd,yBdjEiB;AJ0jDrB;;AkBtjDA;EAgEM,kBAAkB;EAClB,MAAM;EACN,QAAQ;EACR,SAAS;EACT,OAAO;EACP,WAAW;AlB0/CjB;;AkB/jDA;EZ2CE,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,oRAAwT;EA+CtT,sBAAsB;ANohD1B;;AM5jDE;EYXF;IZYI,0BAA0B;ENgkD5B;AACF;;AM7jDuC;EYhBvC;IZiBI,4BAA4B;ENikD9B;AACF;;AkBnlDA;;EA8EM,kBdjFY;AJ2lDlB;;AkBxlDA;;;EAkFQ,aAAa;AlB4gDrB;;AkB9lDA;;;;EAiGQ,sBAAsB;AlBogD9B;;AkBrmDA;;;;;;;EAqGU,aAAa;AlB0gDvB;;AmBrnDA;EAEI,chBoBa;AHmmDjB;;AmBznDA;EAMI,chBqBa;AHkmDjB;;AmB7nDA;EAUI,chBsBa;AHimDjB;;AmBjoDA;EAcI,chBuBa;AHgmDjB;;AmBroDA;EAkBI,chBAa;AHunDjB;;AoBzoDA;;EdiDE,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,iRAAwT;EAmDtT,sBAAsB;EcnDxB,uBAAuC;EACvC,oBAAoB;EACpB,WAAW;EACX,4BAA4B;ApByoD9B;;AMroDE;EcjBF;;IdkBI,0BAA0B;EN0oD5B;AACF;;AMvoDuC;EctBvC;;IduBI,4BAA4B;EN4oD9B;AACF;;AoBpqDA;;EdUE,oRAAwT;EcLtT,sBjBSY;EiBIZ,WhBfc;EgBgBd,yBhBjBiB;AJ0qDrB;;AoB5qDA;;EdUE,mRAAwT;EcLtT,sBjBuBY;AHspDhB;;AoBlrDA;;EdUE,mRAAwT;EcLtT,sBjB4BY;AHupDhB;;AoBxrDA;;EdUE,mRAAwT;EcLtT,sBjBiCY;AHwpDhB;;AoB9pDA;EAEI,cAAc;ApBgqDlB;;AoBlqDA;;EAMI,cAAc;ApBiqDlB;;AoBvqDA;EAUI,aAAa;EACb,mBAAmB;ApBiqDvB;;AoB5qDA;EAcM,aAAa;EACb,YAAY;EACZ,SAAS;EACT,oBAAoB;EACpB,iBAAiB;ApBkqDvB;;AoBprDA;;EAuBM,aAAa;EACb,YAAY;ApBkqDlB;;AoB7pDA;EA7BA;IA+BI,cAAc;EpBgqDhB;EoB/rDF;IAkCM,qBAAqB;IACrB,gBAAgB;EpBgqDpB;EoBrqDA;IASI,eAAe;EpB+pDnB;AACF;;AqBvuDA;EAwBE,kBAAkB;EAClB,wBAAwB;EACxB,qBAAqB;EACrB,gBAAgB;EdvBhB,UAAU;EACV,WAAW;EACX,UAAU;EACV,gBAAgB;EAChB,mBAAmB;EACnB,mBAAmB;EACnB,SAAS;EACT,6BAAqB;UAArB,qBAAqB;AP2uDvB;;AqBtvDA;EAgCI,kBAAkB;EAClB,6YAAkC;ArB0tDtC;;AqB3vDA;EAqCI,kBAAkB;EAClB,SAAS;EACT,WAAW;EACX,WAAW;ELSb,UKPuB;ELQvB,WKRuB;ELSvB,cZjDmB;EYkDnB,0PAAyB;AhBktD3B;;AgB/sDuC;EKvDvC;ILwDI,khBAAyB;EhBmtD3B;AACF;;AqB5wDA;EAgDM,qCAAqC;ArBguD3C;;AqBhxDA;ELiDE,UKIuB;ELHvB,WKGuB;ELFvB,cbpCe;EaqCf,0PAAyB;AhBmuD3B;;AgBhuDuC;EKvDvC;ILwDI,khBAAyB;EhBouD3B;AACF;;AqB7xDA;EAyDM,WjBtDY;AJ8xDlB;;AqBjyDA;EA4DqB,qDAAA;EACf,WjB1DY;AJmyDlB;;AqBtyDA;ELiDE,UKgByB;ELfzB,WKeyB;ELdzB,cbpCe;EaqCf,0PAAyB;EKerB,WjBhEY;AJ2yDlB;;AgBvvDuC;EKvDvC;ILwDI,khBAAyB;EhB2vD3B;AACF;;AqBpzDA;ELiDE,UKqByB;ELpBzB,WKoByB;ELnBzB,cbpCe;EaqCf,0PAAyB;EKoBrB,WjBrEY;AJyzDlB;;AgBrwDuC;EKvDvC;ILwDI,khBAAyB;EhBywD3B;AACF;;AsBl0DA;EAkDE,iBAAiB;EACjB,wBAAwB;EACxB,qBAAqB;EACrB,gBAAgB;EfjDhB,UAAU;EACV,WAAW;EACX,UAAU;EACV,gBAAgB;EAChB,mBAAmB;EACnB,mBAAmB;EACnB,SAAS;EACT,6BAAqB;UAArB,qBAAqB;APs0DvB;;AsBj1DA;EA0DI,kBAAkB;EAClB,6YAAkC;AtB2xDtC;;AsBt1DA;;EAgEI,kBAAkB;EAClB,SAAS;EACT,WAAW;EACX,WAAW;AtB2xDf;;AsB91DA;EAuEqB,qDAAA;ENtBnB,UMuBuB;ENtBvB,WMsBuB;ENrBvB,cZjDmB;EYkDnB,uQAAyB;AhBkzD3B;;AgB/yDuC;EMvDvC;INwDI,+hBAAyB;EhBmzD3B;AACF;;AsB52DA;EA2E2B,qDAAA;EN1BzB,UM2BuB;EN1BvB,WM0BuB;ENzBvB,cbpCe;EaqCf,uQAAyB;AhBg0D3B;;AgB7zDuC;EMvDvC;INwDI,+hBAAyB;EhBi0D3B;AACF;;AsB13DA;ENiDE,UM+BuB;EN9BvB,WM8BuB;EN7BvB,cZjDmB;EYkDnB,uYAAyB;AhB60D3B;;AgB10DuC;EMvDvC;INwDI,2yBAAyB;EhB80D3B;AACF;;AsBv4DA;ENiDE,UMkCuB;ENjCvB,WMiCuB;ENhCvB,cbpCe;EaqCf,uiBAAyB;AhB01D3B;;AgBv1DuC;EMvDvC;INwDI,28BAAyB;EhB21D3B;AACF;;AsBp5DA;EAuFM,WlBpFY;AJq5DlB;;AsBx5DA;EA0FqB,qDAAA;EACf,WlBxFY;AJ05DlB;;AsB75DA;ENiDE,UM8CyB;EN7CzB,WM6CyB;EN5CzB,cbpCe;EaqCf,2eAAyB;EM6CrB,WlB9FY;AJk6DlB;;AgB92DuC;EMvDvC;INwDI,+4BAAyB;EhBk3D3B;AACF;;AsB36DA;ENiDE,UMmDyB;ENlDzB,WMkDyB;ENjDzB,cbpCe;EaqCf,2eAAyB;EMkDrB,WlBnGY;AJg7DlB;;AgB53DuC;EMvDvC;INwDI,+4BAAyB;EhBg4D3B;AACF;;AuBz7DA;EAYE,kBAAkB;EAClB,uBAAuC;EACvC,WAAW;AvBi7Db;;AuB/7DA;EjBiDE,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,iRAAwT;EAmDtT,sBAAsB;EiB1CtB,WAAW;EACX,kCAAkC;EAClC,6YAAkC;EAClC,gBAAgB;EAChB,sBpBTY;EoBUZ,wBAAwB;EACxB,qBAAgB;OAAhB,gBAAgB;AvBq7DpB;;AM77DE;EiBjBF;IjBkBI,0BAA0B;ENi8D5B;AACF;;AM97DuC;EiBtBvC;IjBuBI,4BAA4B;ENk8D9B;AACF;;AuB19DA;EA4BM,cpBTW;AH28DjB;;AuB99DA;EAiCI,WnB9Bc;EmB+Bd,yBnBhCiB;AJi+DrB;;AuBn+DA;EPiDE,UOXuB;EPYvB,WOZuB;EPavB,cZjDmB;EYkDnB,qQAAyB;EOZvB,kBAAkB;EAClB,qBAAqB;EACrB,WAAW;EACX,oBAAoB;EACpB,WAAW;AvBm8Df;;AgBx7DuC;EOvDvC;IPwDI,6hBAAyB;EhB47D3B;AACF;;AuBr/DA;EA2DQ,cpBhCS;AH89DjB;;AuBz/DA;EjBUE,mRAAwT;EiBuDlT,sBpBrCQ;AHk+DhB;;AuB9/DA;EA2DQ,cpB3BS;AHk+DjB;;AuBlgEA;EjBUE,mRAAwT;EiBuDlT,sBpBhCQ;AHs+DhB;;AuBvgEA;EA2DQ,cpBtBS;AHs+DjB;;AuB3gEA;EjBUE,mRAAwT;EiBuDlT,sBpB3BQ;AH0+DhB;;AuBhhEA;EA2DQ,WnBxDU;AJihElB;;AuBphEA;EjBUE,oRAAwT;EiBuDlT,sBpBnDQ;AH2gEhB","file":"nes-core.css"} \ No newline at end of file diff --git a/node_modules/nes.css/css/nes-core.min.css b/node_modules/nes.css/css/nes-core.min.css deleted file mode 100644 index a8632d0..0000000 --- a/node_modules/nes.css/css/nes-core.min.css +++ /dev/null @@ -1,11 +0,0 @@ -/*!***************************************************************************\ - NES.css Framework - Version: development - -\*****************************************************************************//*! - * Bootstrap Reboot v4.1.3 (https://getbootstrap.com/) - * Copyright 2011-2018 The Bootstrap Authors - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) - */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}body,code,html,kbd,pre,samp{font-family:"Press Start 2P"}html{cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABFklEQVRYR9WXURLDIAhE6/0PbSdOtUpcd1Gnpv1KGpTHBpCE1/cXq+vrMph7dGvXZTtpfW10DCA5jrH1H0Jhs5E0hnZdCR+vb5S8Nn8mQCeS9BdSalYJqMBjAGzq59xAESN7VFVUgV8AZB/dZBR7QTFDCqGquvUBVVoEtgIwpQRzmANSFHgWQKExHdIrPeuMvQNDarXe6nC/AutgV3JW+6bgqQLeV8FekRtgV+ToDKEKnACYKsfZjjkam7a0ZpYTytwmgainpC3HvwBocgKOxqRjehoR9DFKNFYtOwCGYCszobeCbl26N6yyQ6g8X/Wex/rBPsNEV6qAMaJPMynIHQCoSqS9JSMmwef51LflTgCRszU7DvAGiV6mHWfsaVUAAAAASUVORK5CYII=),auto}body{font-size:16px;color:#212529;background-color:#fff;-webkit-font-smoothing:antialiased}label{cursor:inherit}a,button{cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer}[type=button],[type=reset],[type=submit],button{-webkit-appearance:none}input[type=checkbox],input[type=radio]{outline:0}@keyframes blink{0%{opacity:1}50%{opacity:0}}.nes-balloon,.nes-balloon.is-dark,.nes-btn,.nes-container.is-rounded,.nes-container.is-rounded.is-dark,.nes-dialog.is-rounded,.nes-dialog.is-rounded.is-dark,.nes-input,.nes-progress,.nes-progress.is-rounded,.nes-select select,.nes-table.is-bordered,.nes-table.is-dark.is-bordered,.nes-textarea{border-style:solid;border-width:4px}.nes-pointer{cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer}.nes-avatar{width:32px;height:32px}.nes-avatar.is-rounded{border-radius:50px}.nes-avatar.is-small{width:16px;height:16px}.nes-avatar.is-small.is-rounded{border-radius:50px}.nes-avatar.is-medium{width:48px;height:48px}.nes-avatar.is-medium.is-rounded{border-radius:50px}.nes-avatar.is-large{width:64px;height:64px}.nes-avatar.is-large.is-rounded{border-radius:50px}.nes-badge{position:relative;display:inline-block;width:10.5em;height:1.875em;margin:.5em;font-size:.9em;white-space:nowrap;vertical-align:top;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.nes-badge.is-splited span.is-dark:first-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#212529;left:0;box-shadow:0 .5em #212529,0 -.5em #212529,0 0 #212529,-.5em 0 #212529}.nes-badge.is-splited span.is-dark:last-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#212529;right:0;box-shadow:0 .5em #212529,0 -.5em #212529,.5em 0 #212529,0 0 #212529}.nes-badge.is-icon{width:5.25em}.nes-badge.is-icon span.is-dark:first-child{display:flex;align-items:center;justify-content:center;width:2.7em;font-size:.5em;color:#fff;text-align:center;background-color:#212529;position:absolute;top:-2.8em;left:-2.7em;height:2.7em}.nes-badge.is-icon span.is-dark:last-child{display:inline-block;align-items:center;justify-content:center;width:6em;font-size:.88em;color:#fff;text-align:center;background-color:#212529;box-shadow:0 .5em #212529,0 -.5em #212529,.5em 0 #212529,-.5em 0 #212529}.nes-badge span.is-dark:first-child{position:absolute;top:0;width:100%;color:#fff;text-align:center;background-color:#212529;box-shadow:0 .5em #212529,0 -.5em #212529,.5em 0 #212529,-.5em 0 #212529}.nes-badge.is-splited span.is-primary:first-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#209cee;left:0;box-shadow:0 .5em #209cee,0 -.5em #209cee,0 0 #209cee,-.5em 0 #209cee}.nes-badge.is-splited span.is-primary:last-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#209cee;right:0;box-shadow:0 .5em #209cee,0 -.5em #209cee,.5em 0 #209cee,0 0 #209cee}.nes-badge.is-icon{width:5.25em}.nes-badge.is-icon span.is-primary:first-child{display:flex;align-items:center;justify-content:center;width:2.7em;font-size:.5em;color:#fff;text-align:center;background-color:#209cee;position:absolute;top:-2.8em;left:-2.7em;height:2.7em}.nes-badge.is-icon span.is-primary:last-child{display:inline-block;align-items:center;justify-content:center;width:6em;font-size:.88em;color:#fff;text-align:center;background-color:#209cee;box-shadow:0 .5em #209cee,0 -.5em #209cee,.5em 0 #209cee,-.5em 0 #209cee}.nes-badge span.is-primary:first-child{position:absolute;top:0;width:100%;color:#fff;text-align:center;background-color:#209cee;box-shadow:0 .5em #209cee,0 -.5em #209cee,.5em 0 #209cee,-.5em 0 #209cee}.nes-badge.is-splited span.is-success:first-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#92cc41;left:0;box-shadow:0 .5em #92cc41,0 -.5em #92cc41,0 0 #92cc41,-.5em 0 #92cc41}.nes-badge.is-splited span.is-success:last-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#92cc41;right:0;box-shadow:0 .5em #92cc41,0 -.5em #92cc41,.5em 0 #92cc41,0 0 #92cc41}.nes-badge.is-icon{width:5.25em}.nes-badge.is-icon span.is-success:first-child{display:flex;align-items:center;justify-content:center;width:2.7em;font-size:.5em;color:#fff;text-align:center;background-color:#92cc41;position:absolute;top:-2.8em;left:-2.7em;height:2.7em}.nes-badge.is-icon span.is-success:last-child{display:inline-block;align-items:center;justify-content:center;width:6em;font-size:.88em;color:#fff;text-align:center;background-color:#92cc41;box-shadow:0 .5em #92cc41,0 -.5em #92cc41,.5em 0 #92cc41,-.5em 0 #92cc41}.nes-badge span.is-success:first-child{position:absolute;top:0;width:100%;color:#fff;text-align:center;background-color:#92cc41;box-shadow:0 .5em #92cc41,0 -.5em #92cc41,.5em 0 #92cc41,-.5em 0 #92cc41}.nes-badge.is-splited span.is-warning:first-child{position:absolute;top:0;width:50%;color:#212529;text-align:center;background-color:#f7d51d;left:0;box-shadow:0 .5em #f7d51d,0 -.5em #f7d51d,0 0 #f7d51d,-.5em 0 #f7d51d}.nes-badge.is-splited span.is-warning:last-child{position:absolute;top:0;width:50%;color:#212529;text-align:center;background-color:#f7d51d;right:0;box-shadow:0 .5em #f7d51d,0 -.5em #f7d51d,.5em 0 #f7d51d,0 0 #f7d51d}.nes-badge.is-icon{width:5.25em}.nes-badge.is-icon span.is-warning:first-child{display:flex;align-items:center;justify-content:center;width:2.7em;font-size:.5em;color:#212529;text-align:center;background-color:#f7d51d;position:absolute;top:-2.8em;left:-2.7em;height:2.7em}.nes-badge.is-icon span.is-warning:last-child{display:inline-block;align-items:center;justify-content:center;width:6em;font-size:.88em;color:#212529;text-align:center;background-color:#f7d51d;box-shadow:0 .5em #f7d51d,0 -.5em #f7d51d,.5em 0 #f7d51d,-.5em 0 #f7d51d}.nes-badge span.is-warning:first-child{position:absolute;top:0;width:100%;color:#212529;text-align:center;background-color:#f7d51d;box-shadow:0 .5em #f7d51d,0 -.5em #f7d51d,.5em 0 #f7d51d,-.5em 0 #f7d51d}.nes-badge.is-splited span.is-error:first-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#e76e55;left:0;box-shadow:0 .5em #e76e55,0 -.5em #e76e55,0 0 #e76e55,-.5em 0 #e76e55}.nes-badge.is-splited span.is-error:last-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#e76e55;right:0;box-shadow:0 .5em #e76e55,0 -.5em #e76e55,.5em 0 #e76e55,0 0 #e76e55}.nes-badge.is-icon{width:5.25em}.nes-badge.is-icon span.is-error:first-child{display:flex;align-items:center;justify-content:center;width:2.7em;font-size:.5em;color:#fff;text-align:center;background-color:#e76e55;position:absolute;top:-2.8em;left:-2.7em;height:2.7em}.nes-badge.is-icon span.is-error:last-child{display:inline-block;align-items:center;justify-content:center;width:6em;font-size:.88em;color:#fff;text-align:center;background-color:#e76e55;box-shadow:0 .5em #e76e55,0 -.5em #e76e55,.5em 0 #e76e55,-.5em 0 #e76e55}.nes-badge span.is-error:first-child{position:absolute;top:0;width:100%;color:#fff;text-align:center;background-color:#e76e55;box-shadow:0 .5em #e76e55,0 -.5em #e76e55,.5em 0 #e76e55,-.5em 0 #e76e55}.nes-balloon{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;position:relative;display:inline-block;padding:1rem 1.5rem;margin:8px;margin-bottom:30px;background-color:#fff}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-balloon{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-balloon{border-image-repeat:stretch}}.nes-balloon>:last-child{margin-bottom:0}.nes-balloon::after,.nes-balloon::before{position:absolute;content:""}.nes-balloon.is-dark{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:0;color:#fff;background:#212529;border-image-outset:2;box-shadow:0 0 0 8px #212529}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-balloon.is-dark{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-balloon.is-dark{border-image-repeat:stretch}}.nes-balloon.is-dark.from-left::before,.nes-balloon.is-dark.from-right::before{background-color:#212529;border-color:#fff}.nes-balloon.is-dark.from-left::after,.nes-balloon.is-dark.from-right::after{color:#fff;background-color:#212529}.nes-balloon.is-dark.from-left::before{box-shadow:-5px 10px 0 6px #212529}.nes-balloon.is-dark.from-left::after{box-shadow:-4px 0,4px 0,-4px 4px #212529,0 4px,-8px 4px,-4px 8px,-8px 8px}.nes-balloon.is-dark.from-right::before{box-shadow:5px 10px 0 6px #212529}.nes-balloon.is-dark.from-right::after{box-shadow:-4px 0,4px 0,4px 4px #212529,0 4px,8px 4px,4px 8px,8px 8px}.nes-balloon.from-left::after,.nes-balloon.from-left::before{left:2rem}.nes-balloon.from-left::before{bottom:-14px;width:26px;height:10px;background-color:#fff;border-right:4px solid #212529;border-left:4px solid #212529}.nes-balloon.from-left::after{bottom:-18px;width:18px;height:4px;margin-right:8px;color:#212529;background-color:#fff;box-shadow:-4px 0,4px 0,-4px 4px #fff,0 4px,-8px 4px,-4px 8px,-8px 8px}.nes-balloon.from-right::after,.nes-balloon.from-right::before{right:2rem}.nes-balloon.from-right::before{bottom:-14px;width:26px;height:10px;background-color:#fff;border-right:4px solid #212529;border-left:4px solid #212529}.nes-balloon.from-right::after{bottom:-18px;width:18px;height:4px;margin-left:8px;background-color:#fff;box-shadow:-4px 0,4px 0,4px 4px #fff,0 4px,8px 4px,4px 8px,8px 8px}.nes-btn{border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;position:relative;display:inline-block;padding:6px 8px;margin:4px;text-align:center;vertical-align:middle;cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:#212529;background-color:#fff}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-btn{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-btn{border-image-repeat:stretch}}.nes-btn::after{position:absolute;top:-4px;right:-4px;bottom:-4px;left:-4px;content:"";box-shadow:inset -4px -4px #adafbc}.nes-btn:hover{color:#212529;text-decoration:none;background-color:#e7e7e7}.nes-btn:hover::after{box-shadow:inset -6px -6px #adafbc}.nes-btn:focus{box-shadow:0 0 0 6px rgba(173,175,188,.3)}.nes-btn:active:not(.is-disabled)::after{box-shadow:inset 4px 4px #adafbc}.nes-btn:focus{outline:0}.nes-btn.is-disabled,.nes-btn.is-disabled:focus,.nes-btn.is-disabled:hover{color:#212529;cursor:not-allowed;background-color:#d3d3d3;box-shadow:inset -4px -4px #adafbc;opacity:.6}.nes-btn.is-primary{color:#fff;background-color:#209cee}.nes-btn.is-primary::after{position:absolute;top:-4px;right:-4px;bottom:-4px;left:-4px;content:"";box-shadow:inset -4px -4px #006bb3}.nes-btn.is-primary:hover{color:#fff;text-decoration:none;background-color:#108de0}.nes-btn.is-primary:hover::after{box-shadow:inset -6px -6px #006bb3}.nes-btn.is-primary:focus{box-shadow:0 0 0 6px rgba(0,107,179,.3)}.nes-btn.is-primary:active:not(.is-disabled)::after{box-shadow:inset 4px 4px #006bb3}.nes-btn.is-success{color:#fff;background-color:#92cc41}.nes-btn.is-success::after{position:absolute;top:-4px;right:-4px;bottom:-4px;left:-4px;content:"";box-shadow:inset -4px -4px #4aa52e}.nes-btn.is-success:hover{color:#fff;text-decoration:none;background-color:#76c442}.nes-btn.is-success:hover::after{box-shadow:inset -6px -6px #4aa52e}.nes-btn.is-success:focus{box-shadow:0 0 0 6px rgba(74,165,46,.3)}.nes-btn.is-success:active:not(.is-disabled)::after{box-shadow:inset 4px 4px #4aa52e}.nes-btn.is-warning{color:#212529;background-color:#f7d51d}.nes-btn.is-warning::after{position:absolute;top:-4px;right:-4px;bottom:-4px;left:-4px;content:"";box-shadow:inset -4px -4px #e59400}.nes-btn.is-warning:hover{color:#212529;text-decoration:none;background-color:#f2c409}.nes-btn.is-warning:hover::after{box-shadow:inset -6px -6px #e59400}.nes-btn.is-warning:focus{box-shadow:0 0 0 6px rgba(229,148,0,.3)}.nes-btn.is-warning:active:not(.is-disabled)::after{box-shadow:inset 4px 4px #e59400}.nes-btn.is-error{color:#fff;background-color:#e76e55}.nes-btn.is-error::after{position:absolute;top:-4px;right:-4px;bottom:-4px;left:-4px;content:"";box-shadow:inset -4px -4px #8c2022}.nes-btn.is-error:hover{color:#fff;text-decoration:none;background-color:#ce372b}.nes-btn.is-error:hover::after{box-shadow:inset -6px -6px #8c2022}.nes-btn.is-error:focus{box-shadow:0 0 0 6px rgba(140,32,34,.3)}.nes-btn.is-error:active:not(.is-disabled)::after{box-shadow:inset 4px 4px #8c2022}.nes-btn input[type=file]{position:absolute;pointer-events:none;opacity:0}.nes-container{position:relative;padding:1.5rem 2rem;border-color:#000;border-style:solid;border-width:4px}.nes-container>:last-child{margin-bottom:0}.nes-container.is-centered{text-align:center}.nes-container.is-right{text-align:right}.nes-container.with-title>.title{display:table;padding:0 .5rem;margin:-1.8rem 0 1rem;font-size:1rem;background-color:#fff}.nes-container.with-title.is-centered>.title{margin:-2rem auto 1rem}.nes-container.with-title.is-right>.title{margin:-2rem 0 1rem auto}.nes-container.is-dark{position:relative;margin:4px;color:#fff;background-color:#212529;border-color:#fff}.nes-container.is-dark::after{position:absolute;top:-7.2px;right:-7.2px;bottom:-7.2px;left:-7.2px;z-index:-1;content:"";background-color:#212529}.nes-container.is-dark.with-title>.title{color:#fff;background-color:#212529}.nes-container.is-rounded{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;padding:1rem 1.5rem;margin:4px}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-container.is-rounded{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-container.is-rounded{border-image-repeat:stretch}}.nes-container.is-rounded.with-title>.title{margin-top:-1.5rem}.nes-container.is-rounded.with-title.is-centered>.title{margin:-1.5rem auto 1rem}.nes-container.is-rounded.with-title.is-right>.title{margin:-1.5rem 0 1rem auto}.nes-container.is-rounded.is-dark{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:0}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-container.is-rounded.is-dark{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-container.is-rounded.is-dark{border-image-repeat:stretch}}.nes-container.is-rounded.is-dark::after{content:none}.nes-container.is-rounded.is-dark.with-title>.title{margin-top:-1.3rem}.nes-container.is-rounded.is-dark.with-title.is-centered>.title{margin:-1.3rem auto 1rem}.nes-container.is-rounded.is-dark.with-title.is-right>.title{margin:-1.3rem 0 1rem auto}.nes-dialog{padding:1.5rem 2rem;border-width:4px}.nes-dialog::-webkit-backdrop,.nes-dialog>.backdrop{background-color:rgba(0,0,0,.3)}.nes-dialog::backdrop,.nes-dialog>.backdrop{background-color:rgba(0,0,0,.3)}.nes-dialog>:last-child{margin-bottom:0}.nes-dialog.is-rounded{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-dialog.is-rounded{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-dialog.is-rounded{border-image-repeat:stretch}}.nes-dialog.is-rounded.is-dark{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:0}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-dialog.is-rounded.is-dark{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-dialog.is-rounded.is-dark{border-image-repeat:stretch}}.nes-dialog.is-dark{color:#fff;background-color:#212529;border-color:#fff}.nes-dialog.is-dark:not(.is-rounded)::before{position:absolute;top:-8px;right:-8px;bottom:-8px;left:-8px;z-index:-1;content:"";border:4px solid #212529}.nes-list{list-style-type:none}.nes-list li{position:relative}.nes-list.is-disc li::before{position:absolute;top:calc(50% - 8px);left:-22px;content:"";width:2px;height:2px;color:#212529;box-shadow:8px 2px,10px 2px,6px 4px,8px 4px,10px 4px,12px 4px,4px 6px,6px 6px,8px 6px,10px 6px,12px 6px,14px 6px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,14px 8px,6px 10px,8px 10px,10px 10px,12px 10px,8px 12px,10px 12px}@supports (-moz-appearance:meterbar){.nes-list.is-disc li::before{box-shadow:8px 2px 0 .020em,10px 2px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,10px 4px 0 .020em,12px 4px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,8px 6px 0 .020em,10px 6px 0 .020em,12px 6px 0 .020em,14px 6px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,8px 8px 0 .020em,10px 8px 0 .020em,12px 8px 0 .020em,14px 8px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,12px 10px 0 .020em,8px 12px 0 .020em,10px 12px 0 .020em}}.nes-list.is-circle li::before{position:absolute;top:calc(50% - 8px);left:-22px;content:"";width:2px;height:2px;color:#212529;box-shadow:8px 2px,10px 2px,6px 4px,8px 4px,10px 4px,12px 4px,4px 6px,6px 6px,12px 6px,14px 6px,4px 8px,6px 8px,12px 8px,14px 8px,6px 10px,8px 10px,10px 10px,12px 10px,8px 12px,10px 12px}@supports (-moz-appearance:meterbar){.nes-list.is-circle li::before{box-shadow:8px 2px 0 .020em,10px 2px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,10px 4px 0 .020em,12px 4px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,12px 6px 0 .020em,14px 6px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,12px 8px 0 .020em,14px 8px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,12px 10px 0 .020em,8px 12px 0 .020em,10px 12px 0 .020em}}.nes-progress{border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;width:100%;height:48px;margin:4px;color:#212529;background-color:#fff;-webkit-appearance:none;-moz-appearance:none;appearance:none}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-progress{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-progress{border-image-repeat:stretch}}.nes-progress::-webkit-progress-bar{background-color:#fff}.nes-progress::-webkit-progress-value{background-color:#212529}.nes-progress::-moz-progress-bar{background-color:#212529}.nes-progress::-ms-fill{background-color:#212529;border:none}.nes-progress.is-rounded{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-progress.is-rounded{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-progress.is-rounded{border-image-repeat:stretch}}.nes-progress.is-primary::-webkit-progress-bar{background-color:#fff}.nes-progress.is-primary::-webkit-progress-value{background-color:#209cee}.nes-progress.is-primary::-moz-progress-bar{background-color:#209cee}.nes-progress.is-primary::-ms-fill{background-color:#209cee;border:none}.nes-progress.is-success::-webkit-progress-bar{background-color:#fff}.nes-progress.is-success::-webkit-progress-value{background-color:#92cc41}.nes-progress.is-success::-moz-progress-bar{background-color:#92cc41}.nes-progress.is-success::-ms-fill{background-color:#92cc41;border:none}.nes-progress.is-warning::-webkit-progress-bar{background-color:#fff}.nes-progress.is-warning::-webkit-progress-value{background-color:#f7d51d}.nes-progress.is-warning::-moz-progress-bar{background-color:#f7d51d}.nes-progress.is-warning::-ms-fill{background-color:#f7d51d;border:none}.nes-progress.is-error::-webkit-progress-bar{background-color:#fff}.nes-progress.is-error::-webkit-progress-value{background-color:#e76e55}.nes-progress.is-error::-moz-progress-bar{background-color:#e76e55}.nes-progress.is-error::-ms-fill{background-color:#e76e55;border:none}.nes-progress.is-pattern::-webkit-progress-value{background-color:#212529;background-image:linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff),linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff);background-position:0 0,10px 10px;background-size:20px 20px}.nes-progress.is-pattern::-moz-progress-bar{background-color:#212529;background-image:-moz-linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff),-moz-linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff);background-position:0 0,10px 10px;background-size:20px 20px}.nes-progress.is-pattern::-ms-fill{background-color:#212529;background-image:linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff),linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff);background-position:0 0,10px 10px;background-size:20px 20px;border:none}.nes-table-responsive{max-width:100%;overflow-x:auto;overflow-y:hidden}.nes-table{table-layout:fixed;background-color:#fff}.nes-table tr{margin-left:-.25em}.nes-table td,.nes-table th{position:relative;padding:.5rem;word-wrap:break-word;border-color:#212529;border-style:solid;border-width:0 .25em .25em 0}.nes-table td:last-child,.nes-table th:last-child{border-right-width:0}.nes-table td::after,.nes-table td::before,.nes-table th::after,.nes-table th::before{position:absolute;display:block;width:.25em;height:.25em;content:"";background-color:#212529}.nes-table td::after,.nes-table th::after{bottom:-.25em;left:-.25em}.nes-table td::before,.nes-table th::before{top:-.25em;right:-.25em}.nes-table td:last-child::before,.nes-table th:last-child::before{top:initial;bottom:-.25em}.nes-table.is-centered th{text-align:center}.nes-table.is-bordered{margin:4px;border-spacing:0;border-collapse:separate;border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-table.is-bordered{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-table.is-bordered{border-image-repeat:stretch}}.nes-table.is-dark{color:#fff;background-color:#212529}.nes-table.is-dark::before{position:absolute;top:0;right:0;bottom:0;left:0;content:""}.nes-table.is-dark.is-bordered{border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:0}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-table.is-dark.is-bordered{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-table.is-dark.is-bordered{border-image-repeat:stretch}}.nes-table.is-dark td,.nes-table.is-dark th{border-color:#fff}.nes-table.is-dark td::after,.nes-table.is-dark td::before,.nes-table.is-dark th::after,.nes-table.is-dark th::before{display:none}.nes-table tbody tr:last-child td,.nes-table tbody tr:last-child th,.nes-table thead:last-child tr:last-child td,.nes-table thead:last-child tr:last-child th{border-bottom-width:0}.nes-table tbody tr:last-child td:first-child::after,.nes-table tbody tr:last-child td:last-child::before,.nes-table tbody tr:last-child th:first-child::after,.nes-table tbody tr:last-child th:last-child::before,.nes-table thead:last-child tr:last-child td:first-child::after,.nes-table thead:last-child tr:last-child td:last-child::before,.nes-table thead:last-child tr:last-child th:first-child::after,.nes-table thead:last-child tr:last-child th:last-child::before{display:none}.nes-text.is-primary{color:#209cee}.nes-text.is-success{color:#92cc41}.nes-text.is-warning{color:#f7d51d}.nes-text.is-error{color:#e76e55}.nes-text.is-disabled{color:#d3d3d3}.nes-input,.nes-textarea{border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;width:calc(100% - 8px);padding:.5rem 1rem;margin:4px;background-clip:padding-box}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-input,.nes-textarea{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-input,.nes-textarea{border-image-repeat:stretch}}.nes-input.is-dark,.nes-textarea.is-dark{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#e7e7e7;color:#fff;background-color:#212529}.nes-input.is-success,.nes-textarea.is-success{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#76c442}.nes-input.is-warning,.nes-textarea.is-warning{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#f2c409}.nes-input.is-error,.nes-textarea.is-error{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#ce372b}.nes-field>label{display:block}.nes-field .nes-input,.nes-field .nes-textarea{display:block}.nes-field.is-inline{display:flex;align-items:center}.nes-field.is-inline>label{flex-basis:0;flex-grow:1;margin:0;margin-right:1.5rem;text-align:right}.nes-field.is-inline .nes-input,.nes-field.is-inline .nes-textarea{flex-basis:0;flex-grow:5}@media screen and (max-width:768px){.nes-field.is-inline{display:block}.nes-field.is-inline>label{margin-bottom:.5rem;text-align:left}.nes-field.is-inline .nes-input{max-width:100%}}.nes-radio{margin-right:20px;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;-webkit-clip-path:inset(50%);clip-path:inset(50%)}.nes-radio+span{position:relative;cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer}.nes-radio:checked+span::before{position:absolute;top:-2px;left:-20px;content:"";width:2px;height:2px;color:#212529;box-shadow:2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px}@supports (-moz-appearance:meterbar){.nes-radio:checked+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,2px 4px 0 .020em,4px 4px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,2px 6px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,8px 6px 0 .020em,10px 6px 0 .020em,2px 8px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,8px 8px 0 .020em,10px 8px 0 .020em,12px 8px 0 .020em,2px 10px 0 .020em,4px 10px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,2px 12px 0 .020em,4px 12px 0 .020em,6px 12px 0 .020em,8px 12px 0 .020em,2px 14px 0 .020em,4px 14px 0 .020em}}.nes-radio:checked:focus+span::before,.nes-radio:checked:hover+span::before{animation:blink 1s infinite steps(1)}.nes-radio:checked:focus+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px}@supports (-moz-appearance:meterbar){.nes-radio:checked:focus+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,2px 4px 0 .020em,4px 4px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,2px 6px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,8px 6px 0 .020em,10px 6px 0 .020em,2px 8px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,8px 8px 0 .020em,10px 8px 0 .020em,12px 8px 0 .020em,2px 10px 0 .020em,4px 10px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,2px 12px 0 .020em,4px 12px 0 .020em,6px 12px 0 .020em,8px 12px 0 .020em,2px 14px 0 .020em,4px 14px 0 .020em}}.nes-radio.is-dark+span{color:#fff}.nes-radio.is-dark+span::before{color:#fff}.nes-radio.is-dark:checked+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px;color:#fff}@supports (-moz-appearance:meterbar){.nes-radio.is-dark:checked+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,2px 4px 0 .020em,4px 4px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,2px 6px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,8px 6px 0 .020em,10px 6px 0 .020em,2px 8px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,8px 8px 0 .020em,10px 8px 0 .020em,12px 8px 0 .020em,2px 10px 0 .020em,4px 10px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,2px 12px 0 .020em,4px 12px 0 .020em,6px 12px 0 .020em,8px 12px 0 .020em,2px 14px 0 .020em,4px 14px 0 .020em}}.nes-radio.is-dark:checked:focus+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px;color:#fff}@supports (-moz-appearance:meterbar){.nes-radio.is-dark:checked:focus+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,2px 4px 0 .020em,4px 4px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,2px 6px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,8px 6px 0 .020em,10px 6px 0 .020em,2px 8px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,8px 8px 0 .020em,10px 8px 0 .020em,12px 8px 0 .020em,2px 10px 0 .020em,4px 10px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,2px 12px 0 .020em,4px 12px 0 .020em,6px 12px 0 .020em,8px 12px 0 .020em,2px 14px 0 .020em,4px 14px 0 .020em}}.nes-checkbox{margin-left:28px;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;-webkit-clip-path:inset(50%);clip-path:inset(50%)}.nes-checkbox+span{position:relative;cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer}.nes-checkbox+span::before,.nes-checkbox:checked+span::before{position:absolute;top:-3px;left:-28px;content:""}.nes-checkbox+span::before{width:2px;height:2px;color:#212529;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,16px 2px,2px 4px,16px 4px,2px 6px,16px 6px,2px 8px,16px 8px,2px 10px,16px 10px,2px 12px,16px 12px,2px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px}@supports (-moz-appearance:meterbar){.nes-checkbox+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,16px 2px 0 .020em,2px 4px 0 .020em,16px 4px 0 .020em,2px 6px 0 .020em,16px 6px 0 .020em,2px 8px 0 .020em,16px 8px 0 .020em,2px 10px 0 .020em,16px 10px 0 .020em,2px 12px 0 .020em,16px 12px 0 .020em,2px 14px 0 .020em,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-checkbox:focus+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,16px 2px,2px 4px,16px 4px,2px 6px,16px 6px,2px 8px,16px 8px,2px 10px,16px 10px,2px 12px,16px 12px,2px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px}@supports (-moz-appearance:meterbar){.nes-checkbox:focus+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,16px 2px 0 .020em,2px 4px 0 .020em,16px 4px 0 .020em,2px 6px 0 .020em,16px 6px 0 .020em,2px 8px 0 .020em,16px 8px 0 .020em,2px 10px 0 .020em,16px 10px 0 .020em,2px 12px 0 .020em,16px 12px 0 .020em,2px 14px 0 .020em,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-checkbox:checked+span::before{width:2px;height:2px;color:#212529;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px,20px 2px,2px 4px,16px 4px,18px 4px,20px 4px,2px 6px,14px 6px,16px 6px,2px 8px,4px 8px,12px 8px,14px 8px,2px 10px,4px 10px,6px 10px,10px 10px,12px 10px,16px 10px,2px 12px,6px 12px,8px 12px,10px 12px,16px 12px,2px 14px,8px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px}@supports (-moz-appearance:meterbar){.nes-checkbox:checked+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,18px 2px 0 .020em,20px 2px 0 .020em,2px 4px 0 .020em,16px 4px 0 .020em,18px 4px 0 .020em,20px 4px 0 .020em,2px 6px 0 .020em,14px 6px 0 .020em,16px 6px 0 .020em,2px 8px 0 .020em,4px 8px 0 .020em,12px 8px 0 .020em,14px 8px 0 .020em,2px 10px 0 .020em,4px 10px 0 .020em,6px 10px 0 .020em,10px 10px 0 .020em,12px 10px 0 .020em,16px 10px 0 .020em,2px 12px 0 .020em,6px 12px 0 .020em,8px 12px 0 .020em,10px 12px 0 .020em,16px 12px 0 .020em,2px 14px 0 .020em,8px 14px 0 .020em,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-checkbox:checked:focus+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #212529,20px 2px #212529,2px 4px,16px 4px #212529,18px 4px #212529,20px 4px #212529,2px 6px #212529,14px 6px #212529,16px 6px #212529,2px 8px #212529,4px 8px #212529,12px 8px #212529,14px 8px #212529,2px 10px,4px 10px #212529,6px 10px #212529,10px 10px #212529,12px 10px #212529,16px 10px,2px 12px,6px 12px #212529,8px 12px #212529,10px 12px #212529,16px 12px,2px 14px,8px 14px #212529,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px}@supports (-moz-appearance:meterbar){.nes-checkbox:checked:focus+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,18px 2px 0 .020em #212529,20px 2px 0 .020em #212529,2px 4px 0 .020em,16px 4px 0 .020em #212529,18px 4px 0 .020em #212529,20px 4px 0 .020em #212529,2px 6px 0 .020em #212529,14px 6px 0 .020em #212529,16px 6px 0 .020em #212529,2px 8px 0 .020em #212529,4px 8px 0 .020em #212529,12px 8px 0 .020em #212529,14px 8px 0 .020em #212529,2px 10px 0 .020em,4px 10px 0 .020em #212529,6px 10px 0 .020em #212529,10px 10px 0 .020em #212529,12px 10px 0 .020em #212529,16px 10px 0 .020em,2px 12px 0 .020em,6px 12px 0 .020em #212529,8px 12px 0 .020em #212529,10px 12px 0 .020em #212529,16px 12px 0 .020em,2px 14px 0 .020em,8px 14px 0 .020em #212529,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-checkbox.is-dark+span{color:#fff}.nes-checkbox.is-dark+span::before{color:#fff}.nes-checkbox.is-dark:checked+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #fff,20px 2px #fff,2px 4px,16px 4px #fff,18px 4px #fff,20px 4px #fff,2px 6px #fff,14px 6px #fff,16px 6px #fff,2px 8px #fff,4px 8px #fff,12px 8px #fff,14px 8px #fff,2px 10px,4px 10px #fff,6px 10px #fff,10px 10px #fff,12px 10px #fff,16px 10px,2px 12px,6px 12px #fff,8px 12px #fff,10px 12px #fff,16px 12px,2px 14px,8px 14px #fff,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px;color:#fff}@supports (-moz-appearance:meterbar){.nes-checkbox.is-dark:checked+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,18px 2px 0 .020em #fff,20px 2px 0 .020em #fff,2px 4px 0 .020em,16px 4px 0 .020em #fff,18px 4px 0 .020em #fff,20px 4px 0 .020em #fff,2px 6px 0 .020em #fff,14px 6px 0 .020em #fff,16px 6px 0 .020em #fff,2px 8px 0 .020em #fff,4px 8px 0 .020em #fff,12px 8px 0 .020em #fff,14px 8px 0 .020em #fff,2px 10px 0 .020em,4px 10px 0 .020em #fff,6px 10px 0 .020em #fff,10px 10px 0 .020em #fff,12px 10px 0 .020em #fff,16px 10px 0 .020em,2px 12px 0 .020em,6px 12px 0 .020em #fff,8px 12px 0 .020em #fff,10px 12px 0 .020em #fff,16px 12px 0 .020em,2px 14px 0 .020em,8px 14px 0 .020em #fff,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-checkbox.is-dark:checked:focus+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #fff,20px 2px #fff,2px 4px,16px 4px #fff,18px 4px #fff,20px 4px #fff,2px 6px #fff,14px 6px #fff,16px 6px #fff,2px 8px #fff,4px 8px #fff,12px 8px #fff,14px 8px #fff,2px 10px,4px 10px #fff,6px 10px #fff,10px 10px #fff,12px 10px #fff,16px 10px,2px 12px,6px 12px #fff,8px 12px #fff,10px 12px #fff,16px 12px,2px 14px,8px 14px #fff,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px;color:#fff}@supports (-moz-appearance:meterbar){.nes-checkbox.is-dark:checked:focus+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,18px 2px 0 .020em #fff,20px 2px 0 .020em #fff,2px 4px 0 .020em,16px 4px 0 .020em #fff,18px 4px 0 .020em #fff,20px 4px 0 .020em #fff,2px 6px 0 .020em #fff,14px 6px 0 .020em #fff,16px 6px 0 .020em #fff,2px 8px 0 .020em #fff,4px 8px 0 .020em #fff,12px 8px 0 .020em #fff,14px 8px 0 .020em #fff,2px 10px 0 .020em,4px 10px 0 .020em #fff,6px 10px 0 .020em #fff,10px 10px 0 .020em #fff,12px 10px 0 .020em #fff,16px 10px 0 .020em,2px 12px 0 .020em,6px 12px 0 .020em #fff,8px 12px 0 .020em #fff,10px 12px 0 .020em #fff,16px 12px 0 .020em,2px 14px 0 .020em,8px 14px 0 .020em #fff,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-select{position:relative;width:calc(100% - 8px);margin:4px}.nes-select select{border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;width:100%;padding:.5rem 2.5rem .5rem 1rem;cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer;border-radius:0;outline-color:#e7e7e7;-webkit-appearance:none;-moz-appearance:none;appearance:none}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-select select{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-select select{border-image-repeat:stretch}}.nes-select select:invalid{color:#adafbc}.nes-select.is-dark select{color:#fff;background-color:#212529}.nes-select::after{width:3px;height:3px;color:#212529;box-shadow:3px 3px,6px 3px,9px 3px,12px 3px,15px 3px,18px 3px,21px 3px,3px 6px,6px 6px,9px 6px,12px 6px,15px 6px,18px 6px,21px 6px,6px 9px,9px 9px,12px 9px,15px 9px,18px 9px,6px 12px,9px 12px,12px 12px,15px 12px,18px 12px,9px 15px,12px 15px,15px 15px,12px 18px;position:absolute;top:calc(50% - 11px);right:36px;pointer-events:none;content:""}@supports (-moz-appearance:meterbar){.nes-select::after{box-shadow:3px 3px 0 .020em,6px 3px 0 .020em,9px 3px 0 .020em,12px 3px 0 .020em,15px 3px 0 .020em,18px 3px 0 .020em,21px 3px 0 .020em,3px 6px 0 .020em,6px 6px 0 .020em,9px 6px 0 .020em,12px 6px 0 .020em,15px 6px 0 .020em,18px 6px 0 .020em,21px 6px 0 .020em,6px 9px 0 .020em,9px 9px 0 .020em,12px 9px 0 .020em,15px 9px 0 .020em,18px 9px 0 .020em,6px 12px 0 .020em,9px 12px 0 .020em,12px 12px 0 .020em,15px 12px 0 .020em,18px 12px 0 .020em,9px 15px 0 .020em,12px 15px 0 .020em,15px 15px 0 .020em,12px 18px 0 .020em}}.nes-select.is-success::after{color:#92cc41}.nes-select.is-success select{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#76c442}.nes-select.is-warning::after{color:#f7d51d}.nes-select.is-warning select{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#f2c409}.nes-select.is-error::after{color:#e76e55}.nes-select.is-error select{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#ce372b}.nes-select.is-dark::after{color:#fff}.nes-select.is-dark select{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#e7e7e7} \ No newline at end of file diff --git a/node_modules/nes.css/css/nes.css b/node_modules/nes.css/css/nes.css deleted file mode 100644 index 09ce6bb..0000000 --- a/node_modules/nes.css/css/nes.css +++ /dev/null @@ -1,2870 +0,0 @@ -/*!***************************************************************************\ - NES.css Framework - Version: 2.3.0 - -\*****************************************************************************/ -/*! - * Bootstrap Reboot v4.1.3 (https://getbootstrap.com/) - * Copyright 2011-2018 The Bootstrap Authors - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) - */ -*, -*::before, -*::after { - box-sizing: border-box; -} - -html { - font-family: sans-serif; - line-height: 1.15; - -webkit-text-size-adjust: 100%; - -ms-overflow-style: scrollbar; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} - -@-ms-viewport { - width: device-width; -} - -article, -aside, -figcaption, -figure, -footer, -header, -hgroup, -main, -nav, -section { - display: block; -} - -body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, Noto Sans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; - font-size: 1rem; - font-weight: 400; - line-height: 1.5; - color: #212529; - text-align: left; - background-color: #fff; -} - -[tabindex="-1"]:focus { - outline: 0 !important; -} - -hr { - box-sizing: content-box; - height: 0; - overflow: visible; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - margin-top: 0; - margin-bottom: 0.5rem; -} - -p { - margin-top: 0; - margin-bottom: 1rem; -} - -abbr[title], -abbr[data-original-title] { - -webkit-text-decoration: underline dotted; - text-decoration: underline; - text-decoration: underline dotted; - cursor: help; - border-bottom: 0; -} - -address { - margin-bottom: 1rem; - font-style: normal; - line-height: inherit; -} - -ol, -ul, -dl { - margin-top: 0; - margin-bottom: 1rem; -} - -ol ol, -ul ul, -ol ul, -ul ol { - margin-bottom: 0; -} - -dt { - font-weight: 700; -} - -dd { - margin-bottom: 0.5rem; - margin-left: 0; -} - -blockquote { - margin: 0 0 1rem; -} - -b, -strong { - font-weight: bolder; -} - -small { - font-size: 80%; -} - -sub, -sup { - position: relative; - font-size: 75%; - line-height: 0; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -a { - color: #007bff; - text-decoration: none; - background-color: transparent; -} - -a:hover { - color: #0056b3; - text-decoration: underline; -} - -a:not([href]):not([tabindex]) { - color: inherit; - text-decoration: none; -} - -a:not([href]):not([tabindex]):hover, -a:not([href]):not([tabindex]):focus { - color: inherit; - text-decoration: none; -} - -a:not([href]):not([tabindex]):focus { - outline: 0; -} - -pre, -code, -kbd, -samp { - font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; - font-size: 1em; -} - -pre { - margin-top: 0; - margin-bottom: 1rem; - overflow: auto; - -ms-overflow-style: scrollbar; -} - -figure { - margin: 0 0 1rem; -} - -img { - vertical-align: middle; - border-style: none; -} - -svg { - overflow: hidden; - vertical-align: middle; -} - -table { - border-collapse: collapse; -} - -caption { - padding-top: 0.75rem; - padding-bottom: 0.75rem; - color: #6c757d; - text-align: left; - caption-side: bottom; -} - -th { - text-align: inherit; -} - -label { - display: inline-block; - margin-bottom: 0.5rem; -} - -button { - border-radius: 0; -} - -input, -button, -select, -optgroup, -textarea { - margin: 0; - font-family: inherit; - font-size: inherit; - line-height: inherit; -} - -button, -input { - overflow: visible; -} - -button, -select { - text-transform: none; -} - -button, -[type="button"], -[type="reset"], -[type="submit"] { - -webkit-appearance: button; -} - -button::-moz-focus-inner, -[type="button"]::-moz-focus-inner, -[type="reset"]::-moz-focus-inner, -[type="submit"]::-moz-focus-inner { - padding: 0; - border-style: none; -} - -button:focus { - outline: 1px dotted; - outline: 5px auto -webkit-focus-ring-color; -} - -input[type="radio"], -input[type="checkbox"] { - box-sizing: border-box; - padding: 0; -} - -input[type="date"], -input[type="time"], -input[type="datetime-local"], -input[type="month"] { - -webkit-appearance: listbox; -} - -textarea { - overflow: auto; - resize: vertical; -} - -fieldset { - min-width: 0; - padding: 0; - margin: 0; - border: 0; -} - -legend { - display: block; - width: 100%; - max-width: 100%; - padding: 0; - margin-bottom: 0.5rem; - font-size: 1.5rem; - line-height: inherit; - color: inherit; - white-space: normal; -} - -progress { - vertical-align: baseline; -} - -[type="number"]::-webkit-inner-spin-button, -[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -[type="search"] { - outline-offset: -2px; - -webkit-appearance: none; -} - -[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -::-webkit-file-upload-button { - font: inherit; - -webkit-appearance: button; -} - -output { - display: inline-block; -} - -summary { - display: list-item; - cursor: pointer; -} - -template { - display: none; -} - -[hidden] { - display: none !important; -} - -html, -body, -pre, -code, -kbd, -samp { - font-family: "Press Start 2P"; -} - -html { - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABFklEQVRYR9WXURLDIAhE6/0PbSdOtUpcd1Gnpv1KGpTHBpCE1/cXq+vrMph7dGvXZTtpfW10DCA5jrH1H0Jhs5E0hnZdCR+vb5S8Nn8mQCeS9BdSalYJqMBjAGzq59xAESN7VFVUgV8AZB/dZBR7QTFDCqGquvUBVVoEtgIwpQRzmANSFHgWQKExHdIrPeuMvQNDarXe6nC/AutgV3JW+6bgqQLeV8FekRtgV+ToDKEKnACYKsfZjjkam7a0ZpYTytwmgainpC3HvwBocgKOxqRjehoR9DFKNFYtOwCGYCszobeCbl26N6yyQ6g8X/Wex/rBPsNEV6qAMaJPMynIHQCoSqS9JSMmwef51LflTgCRszU7DvAGiV6mHWfsaVUAAAAASUVORK5CYII=), auto; -} - -body { - font-size: 16px; - color: #212529; - background-color: #fff; - -webkit-font-smoothing: antialiased; -} - -label { - cursor: inherit; -} - -a, -button { - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; -} - -button, -[type="button"], -[type="reset"], -[type="submit"] { - -webkit-appearance: none; -} - -input[type="radio"], -input[type="checkbox"] { - outline: 0; -} - -@keyframes blink { - 0% { - opacity: 1; - } - 50% { - opacity: 0; - } -} - -.nes-balloon, .nes-balloon.is-dark, .nes-btn, .nes-container.is-rounded, .nes-container.is-rounded.is-dark, .nes-dialog.is-rounded, .nes-dialog.is-rounded.is-dark, .nes-progress, .nes-progress.is-rounded, .nes-table.is-bordered, .nes-table.is-dark.is-bordered, .nes-input, -.nes-textarea, .nes-select select { - border-style: solid; - border-width: 4px; -} - -/* https://medium.com/@matuzo/writing-css-with-accessibility-in-mind-8514a0007939 */ -.nes-pointer { - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; -} - -.nes-avatar { - width: 32px; - height: 32px; -} - -.nes-avatar.is-rounded { - border-radius: 50px; -} - -.nes-avatar.is-small { - width: 16px; - height: 16px; -} - -.nes-avatar.is-small.is-rounded { - border-radius: 50px; -} - -.nes-avatar.is-medium { - width: 48px; - height: 48px; -} - -.nes-avatar.is-medium.is-rounded { - border-radius: 50px; -} - -.nes-avatar.is-large { - width: 64px; - height: 64px; -} - -.nes-avatar.is-large.is-rounded { - border-radius: 50px; -} - -.nes-badge { - position: relative; - display: inline-block; - width: 10.5em; - height: 1.875em; - margin: 0.5em; - font-size: 0.9em; - white-space: nowrap; - vertical-align: top; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.nes-badge.is-splited span.is-dark:first-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #212529; - left: 0; - box-shadow: 0 0.5em #212529, 0 -0.5em #212529, 0 0 #212529, -0.5em 0 #212529; -} - -.nes-badge.is-splited span.is-dark:last-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #212529; - right: 0; - box-shadow: 0 0.5em #212529, 0 -0.5em #212529, 0.5em 0 #212529, 0 0 #212529; -} - -.nes-badge.is-icon { - width: 5.25em; -} - -.nes-badge.is-icon span.is-dark:first-child { - display: flex; - align-items: center; - justify-content: center; - width: 2.7em; - font-size: 0.5em; - color: #fff; - text-align: center; - background-color: #212529; - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; -} - -.nes-badge.is-icon span.is-dark:last-child { - display: inline-block; - align-items: center; - justify-content: center; - width: 6em; - font-size: 0.88em; - color: #fff; - text-align: center; - background-color: #212529; - box-shadow: 0 0.5em #212529, 0 -0.5em #212529, 0.5em 0 #212529, -0.5em 0 #212529; -} - -.nes-badge span.is-dark:first-child { - position: absolute; - top: 0; - width: 100%; - color: #fff; - text-align: center; - background-color: #212529; - box-shadow: 0 0.5em #212529, 0 -0.5em #212529, 0.5em 0 #212529, -0.5em 0 #212529; -} - -.nes-badge.is-splited span.is-primary:first-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #209cee; - left: 0; - box-shadow: 0 0.5em #209cee, 0 -0.5em #209cee, 0 0 #209cee, -0.5em 0 #209cee; -} - -.nes-badge.is-splited span.is-primary:last-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #209cee; - right: 0; - box-shadow: 0 0.5em #209cee, 0 -0.5em #209cee, 0.5em 0 #209cee, 0 0 #209cee; -} - -.nes-badge.is-icon { - width: 5.25em; -} - -.nes-badge.is-icon span.is-primary:first-child { - display: flex; - align-items: center; - justify-content: center; - width: 2.7em; - font-size: 0.5em; - color: #fff; - text-align: center; - background-color: #209cee; - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; -} - -.nes-badge.is-icon span.is-primary:last-child { - display: inline-block; - align-items: center; - justify-content: center; - width: 6em; - font-size: 0.88em; - color: #fff; - text-align: center; - background-color: #209cee; - box-shadow: 0 0.5em #209cee, 0 -0.5em #209cee, 0.5em 0 #209cee, -0.5em 0 #209cee; -} - -.nes-badge span.is-primary:first-child { - position: absolute; - top: 0; - width: 100%; - color: #fff; - text-align: center; - background-color: #209cee; - box-shadow: 0 0.5em #209cee, 0 -0.5em #209cee, 0.5em 0 #209cee, -0.5em 0 #209cee; -} - -.nes-badge.is-splited span.is-success:first-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #92cc41; - left: 0; - box-shadow: 0 0.5em #92cc41, 0 -0.5em #92cc41, 0 0 #92cc41, -0.5em 0 #92cc41; -} - -.nes-badge.is-splited span.is-success:last-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #92cc41; - right: 0; - box-shadow: 0 0.5em #92cc41, 0 -0.5em #92cc41, 0.5em 0 #92cc41, 0 0 #92cc41; -} - -.nes-badge.is-icon { - width: 5.25em; -} - -.nes-badge.is-icon span.is-success:first-child { - display: flex; - align-items: center; - justify-content: center; - width: 2.7em; - font-size: 0.5em; - color: #fff; - text-align: center; - background-color: #92cc41; - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; -} - -.nes-badge.is-icon span.is-success:last-child { - display: inline-block; - align-items: center; - justify-content: center; - width: 6em; - font-size: 0.88em; - color: #fff; - text-align: center; - background-color: #92cc41; - box-shadow: 0 0.5em #92cc41, 0 -0.5em #92cc41, 0.5em 0 #92cc41, -0.5em 0 #92cc41; -} - -.nes-badge span.is-success:first-child { - position: absolute; - top: 0; - width: 100%; - color: #fff; - text-align: center; - background-color: #92cc41; - box-shadow: 0 0.5em #92cc41, 0 -0.5em #92cc41, 0.5em 0 #92cc41, -0.5em 0 #92cc41; -} - -.nes-badge.is-splited span.is-warning:first-child { - position: absolute; - top: 0; - width: 50%; - color: #212529; - text-align: center; - background-color: #f7d51d; - left: 0; - box-shadow: 0 0.5em #f7d51d, 0 -0.5em #f7d51d, 0 0 #f7d51d, -0.5em 0 #f7d51d; -} - -.nes-badge.is-splited span.is-warning:last-child { - position: absolute; - top: 0; - width: 50%; - color: #212529; - text-align: center; - background-color: #f7d51d; - right: 0; - box-shadow: 0 0.5em #f7d51d, 0 -0.5em #f7d51d, 0.5em 0 #f7d51d, 0 0 #f7d51d; -} - -.nes-badge.is-icon { - width: 5.25em; -} - -.nes-badge.is-icon span.is-warning:first-child { - display: flex; - align-items: center; - justify-content: center; - width: 2.7em; - font-size: 0.5em; - color: #212529; - text-align: center; - background-color: #f7d51d; - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; -} - -.nes-badge.is-icon span.is-warning:last-child { - display: inline-block; - align-items: center; - justify-content: center; - width: 6em; - font-size: 0.88em; - color: #212529; - text-align: center; - background-color: #f7d51d; - box-shadow: 0 0.5em #f7d51d, 0 -0.5em #f7d51d, 0.5em 0 #f7d51d, -0.5em 0 #f7d51d; -} - -.nes-badge span.is-warning:first-child { - position: absolute; - top: 0; - width: 100%; - color: #212529; - text-align: center; - background-color: #f7d51d; - box-shadow: 0 0.5em #f7d51d, 0 -0.5em #f7d51d, 0.5em 0 #f7d51d, -0.5em 0 #f7d51d; -} - -.nes-badge.is-splited span.is-error:first-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #e76e55; - left: 0; - box-shadow: 0 0.5em #e76e55, 0 -0.5em #e76e55, 0 0 #e76e55, -0.5em 0 #e76e55; -} - -.nes-badge.is-splited span.is-error:last-child { - position: absolute; - top: 0; - width: 50%; - color: #fff; - text-align: center; - background-color: #e76e55; - right: 0; - box-shadow: 0 0.5em #e76e55, 0 -0.5em #e76e55, 0.5em 0 #e76e55, 0 0 #e76e55; -} - -.nes-badge.is-icon { - width: 5.25em; -} - -.nes-badge.is-icon span.is-error:first-child { - display: flex; - align-items: center; - justify-content: center; - width: 2.7em; - font-size: 0.5em; - color: #fff; - text-align: center; - background-color: #e76e55; - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; -} - -.nes-badge.is-icon span.is-error:last-child { - display: inline-block; - align-items: center; - justify-content: center; - width: 6em; - font-size: 0.88em; - color: #fff; - text-align: center; - background-color: #e76e55; - box-shadow: 0 0.5em #e76e55, 0 -0.5em #e76e55, 0.5em 0 #e76e55, -0.5em 0 #e76e55; -} - -.nes-badge span.is-error:first-child { - position: absolute; - top: 0; - width: 100%; - color: #fff; - text-align: center; - background-color: #e76e55; - box-shadow: 0 0.5em #e76e55, 0 -0.5em #e76e55, 0.5em 0 #e76e55, -0.5em 0 #e76e55; -} - -.nes-balloon { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - position: relative; - display: inline-block; - padding: 1rem 1.5rem; - margin: 8px; - margin-bottom: 30px; - background-color: #fff; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-balloon { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-balloon { - border-image-repeat: stretch; - } -} - -.nes-balloon > :last-child { - margin-bottom: 0; -} - -.nes-balloon::before, .nes-balloon::after { - position: absolute; - content: ""; -} - -.nes-balloon.is-dark { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 0; - color: #fff; - background: #212529; - border-image-outset: 2; - box-shadow: 0 0 0 8px #212529; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-balloon.is-dark { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-balloon.is-dark { - border-image-repeat: stretch; - } -} - -.nes-balloon.is-dark.from-left::before, .nes-balloon.is-dark.from-right::before { - background-color: #212529; - border-color: #fff; -} - -.nes-balloon.is-dark.from-left::after, .nes-balloon.is-dark.from-right::after { - color: #fff; - background-color: #212529; -} - -.nes-balloon.is-dark.from-left::before { - box-shadow: -5px 10px 0 6px #212529; -} - -.nes-balloon.is-dark.from-left::after { - box-shadow: -4px 0, 4px 0, -4px 4px #212529, 0 4px, -8px 4px, -4px 8px, -8px 8px; -} - -.nes-balloon.is-dark.from-right::before { - box-shadow: 5px 10px 0 6px #212529; -} - -.nes-balloon.is-dark.from-right::after { - box-shadow: -4px 0, 4px 0, 4px 4px #212529, 0 4px, 8px 4px, 4px 8px, 8px 8px; -} - -.nes-balloon.from-left::before, .nes-balloon.from-left::after { - left: 2rem; -} - -.nes-balloon.from-left::before { - bottom: -14px; - width: 26px; - height: 10px; - background-color: #fff; - border-right: 4px solid #212529; - border-left: 4px solid #212529; -} - -.nes-balloon.from-left::after { - bottom: -18px; - width: 18px; - height: 4px; - margin-right: 8px; - color: #212529; - background-color: #fff; - box-shadow: -4px 0, 4px 0, -4px 4px #fff, 0 4px, -8px 4px, -4px 8px, -8px 8px; -} - -.nes-balloon.from-right::before, .nes-balloon.from-right::after { - right: 2rem; -} - -.nes-balloon.from-right::before { - bottom: -14px; - width: 26px; - height: 10px; - background-color: #fff; - border-right: 4px solid #212529; - border-left: 4px solid #212529; -} - -.nes-balloon.from-right::after { - bottom: -18px; - width: 18px; - height: 4px; - margin-left: 8px; - background-color: #fff; - box-shadow: -4px 0, 4px 0, 4px 4px #fff, 0 4px, 8px 4px, 4px 8px, 8px 8px; -} - -.nes-btn { - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - position: relative; - display: inline-block; - padding: 6px 8px; - margin: 4px; - text-align: center; - vertical-align: middle; - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - color: #212529; - background-color: #fff; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-btn { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-btn { - border-image-repeat: stretch; - } -} - -.nes-btn::after { - position: absolute; - top: -4px; - right: -4px; - bottom: -4px; - left: -4px; - content: ""; - box-shadow: inset -4px -4px #adafbc; -} - -.nes-btn:hover { - color: #212529; - text-decoration: none; - background-color: #e7e7e7; -} - -.nes-btn:hover::after { - box-shadow: inset -6px -6px #adafbc; -} - -.nes-btn:focus { - box-shadow: 0 0 0 6px rgba(173, 175, 188, 0.3); -} - -.nes-btn:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px #adafbc; -} - -.nes-btn:focus { - outline: 0; -} - -.nes-btn.is-disabled, .nes-btn.is-disabled:hover, .nes-btn.is-disabled:focus { - color: #212529; - cursor: not-allowed; - background-color: #d3d3d3; - box-shadow: inset -4px -4px #adafbc; - opacity: 0.6; -} - -.nes-btn.is-primary { - color: #fff; - background-color: #209cee; -} - -.nes-btn.is-primary::after { - position: absolute; - top: -4px; - right: -4px; - bottom: -4px; - left: -4px; - content: ""; - box-shadow: inset -4px -4px #006bb3; -} - -.nes-btn.is-primary:hover { - color: #fff; - text-decoration: none; - background-color: #108de0; -} - -.nes-btn.is-primary:hover::after { - box-shadow: inset -6px -6px #006bb3; -} - -.nes-btn.is-primary:focus { - box-shadow: 0 0 0 6px rgba(0, 107, 179, 0.3); -} - -.nes-btn.is-primary:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px #006bb3; -} - -.nes-btn.is-success { - color: #fff; - background-color: #92cc41; -} - -.nes-btn.is-success::after { - position: absolute; - top: -4px; - right: -4px; - bottom: -4px; - left: -4px; - content: ""; - box-shadow: inset -4px -4px #4aa52e; -} - -.nes-btn.is-success:hover { - color: #fff; - text-decoration: none; - background-color: #76c442; -} - -.nes-btn.is-success:hover::after { - box-shadow: inset -6px -6px #4aa52e; -} - -.nes-btn.is-success:focus { - box-shadow: 0 0 0 6px rgba(74, 165, 46, 0.3); -} - -.nes-btn.is-success:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px #4aa52e; -} - -.nes-btn.is-warning { - color: #212529; - background-color: #f7d51d; -} - -.nes-btn.is-warning::after { - position: absolute; - top: -4px; - right: -4px; - bottom: -4px; - left: -4px; - content: ""; - box-shadow: inset -4px -4px #e59400; -} - -.nes-btn.is-warning:hover { - color: #212529; - text-decoration: none; - background-color: #f2c409; -} - -.nes-btn.is-warning:hover::after { - box-shadow: inset -6px -6px #e59400; -} - -.nes-btn.is-warning:focus { - box-shadow: 0 0 0 6px rgba(229, 148, 0, 0.3); -} - -.nes-btn.is-warning:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px #e59400; -} - -.nes-btn.is-error { - color: #fff; - background-color: #e76e55; -} - -.nes-btn.is-error::after { - position: absolute; - top: -4px; - right: -4px; - bottom: -4px; - left: -4px; - content: ""; - box-shadow: inset -4px -4px #8c2022; -} - -.nes-btn.is-error:hover { - color: #fff; - text-decoration: none; - background-color: #ce372b; -} - -.nes-btn.is-error:hover::after { - box-shadow: inset -6px -6px #8c2022; -} - -.nes-btn.is-error:focus { - box-shadow: 0 0 0 6px rgba(140, 32, 34, 0.3); -} - -.nes-btn.is-error:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px #8c2022; -} - -.nes-btn input[type="file"] { - position: absolute; - pointer-events: none; - opacity: 0; -} - -.nes-container { - position: relative; - padding: 1.5rem 2rem; - border-color: black; - border-style: solid; - border-width: 4px; -} - -.nes-container > :last-child { - margin-bottom: 0; -} - -.nes-container.is-centered { - text-align: center; -} - -.nes-container.is-right { - text-align: right; -} - -.nes-container.with-title > .title { - display: table; - padding: 0 0.5rem; - margin: -1.8rem 0 1rem; - font-size: 1rem; - background-color: #fff; -} - -.nes-container.with-title.is-centered > .title { - margin: -2rem auto 1rem; -} - -.nes-container.with-title.is-right > .title { - margin: -2rem 0 1rem auto; -} - -.nes-container.is-dark { - position: relative; - margin: 4px; - color: #fff; - background-color: #212529; - border-color: white; -} - -.nes-container.is-dark::after { - position: absolute; - top: -7.2px; - right: -7.2px; - bottom: -7.2px; - left: -7.2px; - z-index: -1; - content: ""; - background-color: #212529; -} - -.nes-container.is-dark.with-title > .title { - color: #fff; - background-color: #212529; -} - -.nes-container.is-rounded { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - padding: 1rem 1.5rem; - margin: 4px; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-container.is-rounded { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-container.is-rounded { - border-image-repeat: stretch; - } -} - -.nes-container.is-rounded.with-title > .title { - margin-top: -1.5rem; -} - -.nes-container.is-rounded.with-title.is-centered > .title { - margin: -1.5rem auto 1rem; -} - -.nes-container.is-rounded.with-title.is-right > .title { - margin: -1.5rem 0 1rem auto; -} - -.nes-container.is-rounded.is-dark { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 0; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-container.is-rounded.is-dark { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-container.is-rounded.is-dark { - border-image-repeat: stretch; - } -} - -.nes-container.is-rounded.is-dark::after { - content: none; -} - -.nes-container.is-rounded.is-dark.with-title > .title { - margin-top: -1.3rem; -} - -.nes-container.is-rounded.is-dark.with-title.is-centered > .title { - margin: -1.3rem auto 1rem; -} - -.nes-container.is-rounded.is-dark.with-title.is-right > .title { - margin: -1.3rem 0 1rem auto; -} - -.nes-dialog { - padding: 1.5rem 2rem; - border-width: 4px; -} - -.nes-dialog > .backdrop, .nes-dialog::-webkit-backdrop { - background-color: rgba(0, 0, 0, 0.3); -} - -.nes-dialog > .backdrop, .nes-dialog::backdrop { - background-color: rgba(0, 0, 0, 0.3); -} - -.nes-dialog > :last-child { - margin-bottom: 0; -} - -.nes-dialog.is-rounded { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-dialog.is-rounded { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-dialog.is-rounded { - border-image-repeat: stretch; - } -} - -.nes-dialog.is-rounded.is-dark { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 0; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-dialog.is-rounded.is-dark { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-dialog.is-rounded.is-dark { - border-image-repeat: stretch; - } -} - -.nes-dialog.is-dark { - color: #fff; - background-color: #212529; - border-color: #fff; -} - -.nes-dialog.is-dark:not(.is-rounded)::before { - position: absolute; - top: -8px; - right: -8px; - bottom: -8px; - left: -8px; - z-index: -1; - content: ""; - border: 4px solid #212529; -} - -.nes-list { - list-style-type: none; -} - -.nes-list li { - position: relative; -} - -.nes-list.is-disc li::before { - position: absolute; - top: calc(50% - 8px); - left: -22px; - content: ""; - width: 2px; - height: 2px; - color: #212529; - box-shadow: 8px 2px,10px 2px,6px 4px,8px 4px,10px 4px,12px 4px,4px 6px,6px 6px,8px 6px,10px 6px,12px 6px,14px 6px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,14px 8px,6px 10px,8px 10px,10px 10px,12px 10px,8px 12px,10px 12px; -} - -@supports (-moz-appearance: meterbar) { - .nes-list.is-disc li::before { - box-shadow: 8px 2px 0 0.020em,10px 2px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,10px 4px 0 0.020em,12px 4px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,8px 6px 0 0.020em,10px 6px 0 0.020em,12px 6px 0 0.020em,14px 6px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,8px 8px 0 0.020em,10px 8px 0 0.020em,12px 8px 0 0.020em,14px 8px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,12px 10px 0 0.020em,8px 12px 0 0.020em,10px 12px 0 0.020em; - } -} - -.nes-list.is-circle li::before { - position: absolute; - top: calc(50% - 8px); - left: -22px; - content: ""; - width: 2px; - height: 2px; - color: #212529; - box-shadow: 8px 2px,10px 2px,6px 4px,8px 4px,10px 4px,12px 4px,4px 6px,6px 6px,12px 6px,14px 6px,4px 8px,6px 8px,12px 8px,14px 8px,6px 10px,8px 10px,10px 10px,12px 10px,8px 12px,10px 12px; -} - -@supports (-moz-appearance: meterbar) { - .nes-list.is-circle li::before { - box-shadow: 8px 2px 0 0.020em,10px 2px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,10px 4px 0 0.020em,12px 4px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,12px 6px 0 0.020em,14px 6px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,12px 8px 0 0.020em,14px 8px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,12px 10px 0 0.020em,8px 12px 0 0.020em,10px 12px 0 0.020em; - } -} - -.nes-progress { - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - width: 100%; - height: 48px; - margin: 4px; - color: #212529; - background-color: #fff; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-progress { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-progress { - border-image-repeat: stretch; - } -} - -.nes-progress::-webkit-progress-bar { - background-color: #fff; -} - -.nes-progress::-webkit-progress-value { - background-color: #212529; -} - -.nes-progress::-moz-progress-bar { - background-color: #212529; -} - -.nes-progress::-ms-fill { - background-color: #212529; - border: none; -} - -.nes-progress.is-rounded { - border-image-slice: 3; - border-image-width: 3; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-progress.is-rounded { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-progress.is-rounded { - border-image-repeat: stretch; - } -} - -.nes-progress.is-primary::-webkit-progress-bar { - background-color: #fff; -} - -.nes-progress.is-primary::-webkit-progress-value { - background-color: #209cee; -} - -.nes-progress.is-primary::-moz-progress-bar { - background-color: #209cee; -} - -.nes-progress.is-primary::-ms-fill { - background-color: #209cee; - border: none; -} - -.nes-progress.is-success::-webkit-progress-bar { - background-color: #fff; -} - -.nes-progress.is-success::-webkit-progress-value { - background-color: #92cc41; -} - -.nes-progress.is-success::-moz-progress-bar { - background-color: #92cc41; -} - -.nes-progress.is-success::-ms-fill { - background-color: #92cc41; - border: none; -} - -.nes-progress.is-warning::-webkit-progress-bar { - background-color: #fff; -} - -.nes-progress.is-warning::-webkit-progress-value { - background-color: #f7d51d; -} - -.nes-progress.is-warning::-moz-progress-bar { - background-color: #f7d51d; -} - -.nes-progress.is-warning::-ms-fill { - background-color: #f7d51d; - border: none; -} - -.nes-progress.is-error::-webkit-progress-bar { - background-color: #fff; -} - -.nes-progress.is-error::-webkit-progress-value { - background-color: #e76e55; -} - -.nes-progress.is-error::-moz-progress-bar { - background-color: #e76e55; -} - -.nes-progress.is-error::-ms-fill { - background-color: #e76e55; - border: none; -} - -.nes-progress.is-pattern::-webkit-progress-value { - background-color: #212529; - background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff); - background-position: 0 0, 10px 10px; - background-size: 20px 20px; -} - -.nes-progress.is-pattern::-moz-progress-bar { - background-color: #212529; - background-image: -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff); - background-position: 0 0, 10px 10px; - background-size: 20px 20px; -} - -.nes-progress.is-pattern::-ms-fill { - background-color: #212529; - background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff); - background-position: 0 0, 10px 10px; - background-size: 20px 20px; - border: none; -} - -.nes-table-responsive { - max-width: 100%; - overflow-x: auto; - overflow-y: hidden; -} - -.nes-table { - table-layout: fixed; - background-color: #fff; - /*************************************************************************** \ - This eliminates the gap between the last row in a table and the border, as - well as hiding the derelict pixels in the bottom right and bottom left of - the last row of a table - \ ***************************************************************************/ -} - -.nes-table tr { - margin-left: -0.25em; -} - -.nes-table th, -.nes-table td { - position: relative; - padding: 0.5rem; - word-wrap: break-word; - border-color: #212529; - border-style: solid; - border-width: 0 0.25em 0.25em 0; -} - -.nes-table th:last-child, -.nes-table td:last-child { - border-right-width: 0; -} - -.nes-table th::after, .nes-table th::before, -.nes-table td::after, -.nes-table td::before { - position: absolute; - display: block; - width: 0.25em; - height: 0.25em; - content: ""; - background-color: #212529; -} - -.nes-table th::after, -.nes-table td::after { - bottom: -0.25em; - left: -0.25em; -} - -.nes-table th::before, -.nes-table td::before { - top: -0.25em; - right: -0.25em; -} - -.nes-table th:last-child::before, -.nes-table td:last-child::before { - top: initial; - bottom: -0.25em; -} - -.nes-table.is-centered th { - text-align: center; -} - -.nes-table.is-bordered { - margin: 4px; - border-spacing: 0; - border-collapse: separate; - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-table.is-bordered { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-table.is-bordered { - border-image-repeat: stretch; - } -} - -.nes-table.is-dark { - color: #fff; - background-color: #212529; -} - -.nes-table.is-dark::before { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - content: ""; -} - -.nes-table.is-dark.is-bordered { - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 0; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-table.is-dark.is-bordered { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-table.is-dark.is-bordered { - border-image-repeat: stretch; - } -} - -.nes-table.is-dark th, -.nes-table.is-dark td { - border-color: #fff; -} - -.nes-table.is-dark th::after, .nes-table.is-dark th::before, -.nes-table.is-dark td::after, -.nes-table.is-dark td::before { - display: none; -} - -.nes-table tbody tr:last-child th, -.nes-table tbody tr:last-child td, -.nes-table thead:last-child tr:last-child th, -.nes-table thead:last-child tr:last-child td { - border-bottom-width: 0; -} - -.nes-table tbody tr:last-child th:first-child::after, .nes-table tbody tr:last-child th:last-child::before, -.nes-table tbody tr:last-child td:first-child::after, -.nes-table tbody tr:last-child td:last-child::before, -.nes-table thead:last-child tr:last-child th:first-child::after, -.nes-table thead:last-child tr:last-child th:last-child::before, -.nes-table thead:last-child tr:last-child td:first-child::after, -.nes-table thead:last-child tr:last-child td:last-child::before { - display: none; -} - -.nes-text.is-primary { - color: #209cee; -} - -.nes-text.is-success { - color: #92cc41; -} - -.nes-text.is-warning { - color: #f7d51d; -} - -.nes-text.is-error { - color: #e76e55; -} - -.nes-text.is-disabled { - color: #d3d3d3; -} - -.nes-input, -.nes-textarea { - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - width: calc(100% - 8px); - padding: 0.5rem 1rem; - margin: 4px; - background-clip: padding-box; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-input, - .nes-textarea { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-input, - .nes-textarea { - border-image-repeat: stretch; - } -} - -.nes-input.is-dark, -.nes-textarea.is-dark { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #e7e7e7; - color: #fff; - background-color: #212529; -} - -.nes-input.is-success, -.nes-textarea.is-success { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #76c442; -} - -.nes-input.is-warning, -.nes-textarea.is-warning { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #f2c409; -} - -.nes-input.is-error, -.nes-textarea.is-error { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #ce372b; -} - -.nes-field > label { - display: block; -} - -.nes-field .nes-input, -.nes-field .nes-textarea { - display: block; -} - -.nes-field.is-inline { - display: flex; - align-items: center; -} - -.nes-field.is-inline > label { - flex-basis: 0; - flex-grow: 1; - margin: 0; - margin-right: 1.5rem; - text-align: right; -} - -.nes-field.is-inline .nes-input, -.nes-field.is-inline .nes-textarea { - flex-basis: 0; - flex-grow: 5; -} - -@media screen and (max-width: 768px) { - .nes-field.is-inline { - display: block; - } - .nes-field.is-inline > label { - margin-bottom: 0.5rem; - text-align: left; - } - .nes-field.is-inline .nes-input { - max-width: 100%; - } -} - -.nes-radio { - margin-right: 20px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - width: 1px; - height: 1px; - padding: 0; - overflow: hidden; - clip: rect(0 0 0 0); - white-space: nowrap; - border: 0; - -webkit-clip-path: inset(50%); - clip-path: inset(50%); -} - -.nes-radio + span { - position: relative; - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; -} - -.nes-radio:checked + span::before { - position: absolute; - top: -2px; - left: -20px; - content: ""; - width: 2px; - height: 2px; - color: #212529; - box-shadow: 2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px; -} - -@supports (-moz-appearance: meterbar) { - .nes-radio:checked + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,2px 4px 0 0.020em,4px 4px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,2px 6px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,8px 6px 0 0.020em,10px 6px 0 0.020em,2px 8px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,8px 8px 0 0.020em,10px 8px 0 0.020em,12px 8px 0 0.020em,2px 10px 0 0.020em,4px 10px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,2px 12px 0 0.020em,4px 12px 0 0.020em,6px 12px 0 0.020em,8px 12px 0 0.020em,2px 14px 0 0.020em,4px 14px 0 0.020em; - } -} - -.nes-radio:checked:hover + span::before, .nes-radio:checked:focus + span::before { - animation: blink 1s infinite steps(1); -} - -.nes-radio:checked:focus + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px; -} - -@supports (-moz-appearance: meterbar) { - .nes-radio:checked:focus + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,2px 4px 0 0.020em,4px 4px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,2px 6px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,8px 6px 0 0.020em,10px 6px 0 0.020em,2px 8px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,8px 8px 0 0.020em,10px 8px 0 0.020em,12px 8px 0 0.020em,2px 10px 0 0.020em,4px 10px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,2px 12px 0 0.020em,4px 12px 0 0.020em,6px 12px 0 0.020em,8px 12px 0 0.020em,2px 14px 0 0.020em,4px 14px 0 0.020em; - } -} - -.nes-radio.is-dark + span { - color: #fff; -} - -.nes-radio.is-dark + span::before { - /* stylelint-disable-line no-descending-specificity */ - color: #fff; -} - -.nes-radio.is-dark:checked + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px; - color: #fff; -} - -@supports (-moz-appearance: meterbar) { - .nes-radio.is-dark:checked + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,2px 4px 0 0.020em,4px 4px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,2px 6px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,8px 6px 0 0.020em,10px 6px 0 0.020em,2px 8px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,8px 8px 0 0.020em,10px 8px 0 0.020em,12px 8px 0 0.020em,2px 10px 0 0.020em,4px 10px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,2px 12px 0 0.020em,4px 12px 0 0.020em,6px 12px 0 0.020em,8px 12px 0 0.020em,2px 14px 0 0.020em,4px 14px 0 0.020em; - } -} - -.nes-radio.is-dark:checked:focus + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px; - color: #fff; -} - -@supports (-moz-appearance: meterbar) { - .nes-radio.is-dark:checked:focus + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,2px 4px 0 0.020em,4px 4px 0 0.020em,6px 4px 0 0.020em,8px 4px 0 0.020em,2px 6px 0 0.020em,4px 6px 0 0.020em,6px 6px 0 0.020em,8px 6px 0 0.020em,10px 6px 0 0.020em,2px 8px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,8px 8px 0 0.020em,10px 8px 0 0.020em,12px 8px 0 0.020em,2px 10px 0 0.020em,4px 10px 0 0.020em,6px 10px 0 0.020em,8px 10px 0 0.020em,10px 10px 0 0.020em,2px 12px 0 0.020em,4px 12px 0 0.020em,6px 12px 0 0.020em,8px 12px 0 0.020em,2px 14px 0 0.020em,4px 14px 0 0.020em; - } -} - -.nes-checkbox { - margin-left: 28px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - width: 1px; - height: 1px; - padding: 0; - overflow: hidden; - clip: rect(0 0 0 0); - white-space: nowrap; - border: 0; - -webkit-clip-path: inset(50%); - clip-path: inset(50%); -} - -.nes-checkbox + span { - position: relative; - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; -} - -.nes-checkbox + span::before, -.nes-checkbox:checked + span::before { - position: absolute; - top: -3px; - left: -28px; - content: ""; -} - -.nes-checkbox + span::before { - /* stylelint-disable-line no-descending-specificity */ - width: 2px; - height: 2px; - color: #212529; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,16px 2px,2px 4px,16px 4px,2px 6px,16px 6px,2px 8px,16px 8px,2px 10px,16px 10px,2px 12px,16px 12px,2px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,16px 2px 0 0.020em,2px 4px 0 0.020em,16px 4px 0 0.020em,2px 6px 0 0.020em,16px 6px 0 0.020em,2px 8px 0 0.020em,16px 8px 0 0.020em,2px 10px 0 0.020em,16px 10px 0 0.020em,2px 12px 0 0.020em,16px 12px 0 0.020em,2px 14px 0 0.020em,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-checkbox:focus + span::before { - /* stylelint-disable-line no-descending-specificity */ - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,16px 2px,2px 4px,16px 4px,2px 6px,16px 6px,2px 8px,16px 8px,2px 10px,16px 10px,2px 12px,16px 12px,2px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox:focus + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,16px 2px 0 0.020em,2px 4px 0 0.020em,16px 4px 0 0.020em,2px 6px 0 0.020em,16px 6px 0 0.020em,2px 8px 0 0.020em,16px 8px 0 0.020em,2px 10px 0 0.020em,16px 10px 0 0.020em,2px 12px 0 0.020em,16px 12px 0 0.020em,2px 14px 0 0.020em,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-checkbox:checked + span::before { - width: 2px; - height: 2px; - color: #212529; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px,20px 2px,2px 4px,16px 4px,18px 4px,20px 4px,2px 6px,14px 6px,16px 6px,2px 8px,4px 8px,12px 8px,14px 8px,2px 10px,4px 10px,6px 10px,10px 10px,12px 10px,16px 10px,2px 12px,6px 12px,8px 12px,10px 12px,16px 12px,2px 14px,8px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox:checked + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,18px 2px 0 0.020em,20px 2px 0 0.020em,2px 4px 0 0.020em,16px 4px 0 0.020em,18px 4px 0 0.020em,20px 4px 0 0.020em,2px 6px 0 0.020em,14px 6px 0 0.020em,16px 6px 0 0.020em,2px 8px 0 0.020em,4px 8px 0 0.020em,12px 8px 0 0.020em,14px 8px 0 0.020em,2px 10px 0 0.020em,4px 10px 0 0.020em,6px 10px 0 0.020em,10px 10px 0 0.020em,12px 10px 0 0.020em,16px 10px 0 0.020em,2px 12px 0 0.020em,6px 12px 0 0.020em,8px 12px 0 0.020em,10px 12px 0 0.020em,16px 12px 0 0.020em,2px 14px 0 0.020em,8px 14px 0 0.020em,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-checkbox:checked:focus + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #212529,20px 2px #212529,2px 4px,16px 4px #212529,18px 4px #212529,20px 4px #212529,2px 6px #212529,14px 6px #212529,16px 6px #212529,2px 8px #212529,4px 8px #212529,12px 8px #212529,14px 8px #212529,2px 10px,4px 10px #212529,6px 10px #212529,10px 10px #212529,12px 10px #212529,16px 10px,2px 12px,6px 12px #212529,8px 12px #212529,10px 12px #212529,16px 12px,2px 14px,8px 14px #212529,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox:checked:focus + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,18px 2px 0 0.020em #212529,20px 2px 0 0.020em #212529,2px 4px 0 0.020em,16px 4px 0 0.020em #212529,18px 4px 0 0.020em #212529,20px 4px 0 0.020em #212529,2px 6px 0 0.020em #212529,14px 6px 0 0.020em #212529,16px 6px 0 0.020em #212529,2px 8px 0 0.020em #212529,4px 8px 0 0.020em #212529,12px 8px 0 0.020em #212529,14px 8px 0 0.020em #212529,2px 10px 0 0.020em,4px 10px 0 0.020em #212529,6px 10px 0 0.020em #212529,10px 10px 0 0.020em #212529,12px 10px 0 0.020em #212529,16px 10px 0 0.020em,2px 12px 0 0.020em,6px 12px 0 0.020em #212529,8px 12px 0 0.020em #212529,10px 12px 0 0.020em #212529,16px 12px 0 0.020em,2px 14px 0 0.020em,8px 14px 0 0.020em #212529,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-checkbox.is-dark + span { - color: #fff; -} - -.nes-checkbox.is-dark + span::before { - /* stylelint-disable-line no-descending-specificity */ - color: #fff; -} - -.nes-checkbox.is-dark:checked + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #fff,20px 2px #fff,2px 4px,16px 4px #fff,18px 4px #fff,20px 4px #fff,2px 6px #fff,14px 6px #fff,16px 6px #fff,2px 8px #fff,4px 8px #fff,12px 8px #fff,14px 8px #fff,2px 10px,4px 10px #fff,6px 10px #fff,10px 10px #fff,12px 10px #fff,16px 10px,2px 12px,6px 12px #fff,8px 12px #fff,10px 12px #fff,16px 12px,2px 14px,8px 14px #fff,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; - color: #fff; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox.is-dark:checked + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,18px 2px 0 0.020em #fff,20px 2px 0 0.020em #fff,2px 4px 0 0.020em,16px 4px 0 0.020em #fff,18px 4px 0 0.020em #fff,20px 4px 0 0.020em #fff,2px 6px 0 0.020em #fff,14px 6px 0 0.020em #fff,16px 6px 0 0.020em #fff,2px 8px 0 0.020em #fff,4px 8px 0 0.020em #fff,12px 8px 0 0.020em #fff,14px 8px 0 0.020em #fff,2px 10px 0 0.020em,4px 10px 0 0.020em #fff,6px 10px 0 0.020em #fff,10px 10px 0 0.020em #fff,12px 10px 0 0.020em #fff,16px 10px 0 0.020em,2px 12px 0 0.020em,6px 12px 0 0.020em #fff,8px 12px 0 0.020em #fff,10px 12px 0 0.020em #fff,16px 12px 0 0.020em,2px 14px 0 0.020em,8px 14px 0 0.020em #fff,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-checkbox.is-dark:checked:focus + span::before { - width: 2px; - height: 2px; - color: #adafbc; - box-shadow: 2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #fff,20px 2px #fff,2px 4px,16px 4px #fff,18px 4px #fff,20px 4px #fff,2px 6px #fff,14px 6px #fff,16px 6px #fff,2px 8px #fff,4px 8px #fff,12px 8px #fff,14px 8px #fff,2px 10px,4px 10px #fff,6px 10px #fff,10px 10px #fff,12px 10px #fff,16px 10px,2px 12px,6px 12px #fff,8px 12px #fff,10px 12px #fff,16px 12px,2px 14px,8px 14px #fff,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px; - color: #fff; -} - -@supports (-moz-appearance: meterbar) { - .nes-checkbox.is-dark:checked:focus + span::before { - box-shadow: 2px 2px 0 0.020em,4px 2px 0 0.020em,6px 2px 0 0.020em,8px 2px 0 0.020em,10px 2px 0 0.020em,12px 2px 0 0.020em,14px 2px 0 0.020em,18px 2px 0 0.020em #fff,20px 2px 0 0.020em #fff,2px 4px 0 0.020em,16px 4px 0 0.020em #fff,18px 4px 0 0.020em #fff,20px 4px 0 0.020em #fff,2px 6px 0 0.020em #fff,14px 6px 0 0.020em #fff,16px 6px 0 0.020em #fff,2px 8px 0 0.020em #fff,4px 8px 0 0.020em #fff,12px 8px 0 0.020em #fff,14px 8px 0 0.020em #fff,2px 10px 0 0.020em,4px 10px 0 0.020em #fff,6px 10px 0 0.020em #fff,10px 10px 0 0.020em #fff,12px 10px 0 0.020em #fff,16px 10px 0 0.020em,2px 12px 0 0.020em,6px 12px 0 0.020em #fff,8px 12px 0 0.020em #fff,10px 12px 0 0.020em #fff,16px 12px 0 0.020em,2px 14px 0 0.020em,8px 14px 0 0.020em #fff,16px 14px 0 0.020em,2px 16px 0 0.020em,4px 16px 0 0.020em,6px 16px 0 0.020em,8px 16px 0 0.020em,10px 16px 0 0.020em,12px 16px 0 0.020em,14px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-select { - position: relative; - width: calc(100% - 8px); - margin: 4px; -} - -.nes-select select { - border-image-slice: 2; - border-image-width: 2; - border-image-repeat: stretch; - border-image-source: url('data:image/svg+xml;utf8,'); - border-image-outset: 2; - width: 100%; - padding: 0.5rem 2.5rem 0.5rem 1rem; - cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0, pointer; - border-radius: 0; - outline-color: #e7e7e7; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} - -@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - .nes-select select { - border-image-repeat: space; - } -} - -@supports (-moz-appearance: meterbar) { - .nes-select select { - border-image-repeat: stretch; - } -} - -.nes-select select:invalid { - color: #adafbc; -} - -.nes-select.is-dark select { - color: #fff; - background-color: #212529; -} - -.nes-select::after { - width: 3px; - height: 3px; - color: #212529; - box-shadow: 3px 3px,6px 3px,9px 3px,12px 3px,15px 3px,18px 3px,21px 3px,3px 6px,6px 6px,9px 6px,12px 6px,15px 6px,18px 6px,21px 6px,6px 9px,9px 9px,12px 9px,15px 9px,18px 9px,6px 12px,9px 12px,12px 12px,15px 12px,18px 12px,9px 15px,12px 15px,15px 15px,12px 18px; - position: absolute; - top: calc(50% - 11px); - right: 36px; - pointer-events: none; - content: ""; -} - -@supports (-moz-appearance: meterbar) { - .nes-select::after { - box-shadow: 3px 3px 0 0.020em,6px 3px 0 0.020em,9px 3px 0 0.020em,12px 3px 0 0.020em,15px 3px 0 0.020em,18px 3px 0 0.020em,21px 3px 0 0.020em,3px 6px 0 0.020em,6px 6px 0 0.020em,9px 6px 0 0.020em,12px 6px 0 0.020em,15px 6px 0 0.020em,18px 6px 0 0.020em,21px 6px 0 0.020em,6px 9px 0 0.020em,9px 9px 0 0.020em,12px 9px 0 0.020em,15px 9px 0 0.020em,18px 9px 0 0.020em,6px 12px 0 0.020em,9px 12px 0 0.020em,12px 12px 0 0.020em,15px 12px 0 0.020em,18px 12px 0 0.020em,9px 15px 0 0.020em,12px 15px 0 0.020em,15px 15px 0 0.020em,12px 18px 0 0.020em; - } -} - -.nes-select.is-success::after { - color: #92cc41; -} - -.nes-select.is-success select { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #76c442; -} - -.nes-select.is-warning::after { - color: #f7d51d; -} - -.nes-select.is-warning select { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #f2c409; -} - -.nes-select.is-error::after { - color: #e76e55; -} - -.nes-select.is-error select { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #ce372b; -} - -.nes-select.is-dark::after { - color: #fff; -} - -.nes-select.is-dark select { - border-image-source: url('data:image/svg+xml;utf8,'); - outline-color: #e7e7e7; -} - -.nes-icon { - position: relative; - display: inline-block; - width: 16px; - height: 16px; - margin-right: 16px; - margin-bottom: 16px; - transform: scale(2); - transform-origin: top left; -} - -.nes-icon.is-small { - margin: 0; - transform: scale(1); -} - -.nes-icon.is-medium { - margin-right: 32px; - margin-bottom: 32px; - transform: scale(3); -} - -.nes-icon.is-large { - margin-right: 48px; - margin-bottom: 48px; - transform: scale(4); -} - -.nes-icon::before { - position: absolute; - top: -1px; - left: -1px; - display: block; - content: ""; - background: transparent; -} - -.nes-icon.heart::before { - width: 1px; - height: 1px; - color: #f22426; - box-shadow: 3px 2px #444,4px 2px #444,5px 2px #444,11px 2px #444,12px 2px #444,13px 2px #444,2px 3px #444,3px 3px,4px 3px,5px 3px,6px 3px #444,10px 3px #444,11px 3px,12px 3px,13px 3px #842300,14px 3px #444,1px 4px #444,2px 4px,3px 4px #fff,4px 4px #fff,5px 4px,6px 4px,7px 4px #444,9px 4px #444,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px #842300,15px 4px #444,1px 5px #444,2px 5px,3px 5px #fff,4px 5px,5px 5px,6px 5px,7px 5px,8px 5px #444,9px 5px,10px 5px,11px 5px,12px 5px,13px 5px,14px 5px #842300,15px 5px #444,1px 6px #444,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px #842300,15px 6px #444,1px 7px #444,2px 7px,3px 7px,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,14px 7px #842300,15px 7px #444,1px 8px #444,2px 8px,3px 8px,4px 8px,5px 8px,6px 8px,7px 8px,8px 8px,9px 8px,10px 8px,11px 8px,12px 8px,13px 8px,14px 8px #842300,15px 8px #444,2px 9px #444,3px 9px,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px,12px 9px,13px 9px #842300,14px 9px #444,3px 10px #444,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px,12px 10px #842300,13px 10px #444,4px 11px #444,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px,11px 11px #842300,12px 11px #444,5px 12px #444,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px #842300,11px 12px #444,6px 13px #444,7px 13px,8px 13px,9px 13px #842300,10px 13px #444,7px 14px #444,8px 14px #842300,9px 14px #444,8px 15px #444; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.heart::before { - box-shadow: 3px 2px 0 0.020em #444,4px 2px 0 0.020em #444,5px 2px 0 0.020em #444,11px 2px 0 0.020em #444,12px 2px 0 0.020em #444,13px 2px 0 0.020em #444,2px 3px 0 0.020em #444,3px 3px 0 0.020em,4px 3px 0 0.020em,5px 3px 0 0.020em,6px 3px 0 0.020em #444,10px 3px 0 0.020em #444,11px 3px 0 0.020em,12px 3px 0 0.020em,13px 3px 0 0.020em #842300,14px 3px 0 0.020em #444,1px 4px 0 0.020em #444,2px 4px 0 0.020em,3px 4px 0 0.020em #fff,4px 4px 0 0.020em #fff,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em #444,9px 4px 0 0.020em #444,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em,13px 4px 0 0.020em,14px 4px 0 0.020em #842300,15px 4px 0 0.020em #444,1px 5px 0 0.020em #444,2px 5px 0 0.020em,3px 5px 0 0.020em #fff,4px 5px 0 0.020em,5px 5px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em,8px 5px 0 0.020em #444,9px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em,12px 5px 0 0.020em,13px 5px 0 0.020em,14px 5px 0 0.020em #842300,15px 5px 0 0.020em #444,1px 6px 0 0.020em #444,2px 6px 0 0.020em,3px 6px 0 0.020em,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em,8px 6px 0 0.020em,9px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em #842300,15px 6px 0 0.020em #444,1px 7px 0 0.020em #444,2px 7px 0 0.020em,3px 7px 0 0.020em,4px 7px 0 0.020em,5px 7px 0 0.020em,6px 7px 0 0.020em,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em,11px 7px 0 0.020em,12px 7px 0 0.020em,13px 7px 0 0.020em,14px 7px 0 0.020em #842300,15px 7px 0 0.020em #444,1px 8px 0 0.020em #444,2px 8px 0 0.020em,3px 8px 0 0.020em,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em,7px 8px 0 0.020em,8px 8px 0 0.020em,9px 8px 0 0.020em,10px 8px 0 0.020em,11px 8px 0 0.020em,12px 8px 0 0.020em,13px 8px 0 0.020em,14px 8px 0 0.020em #842300,15px 8px 0 0.020em #444,2px 9px 0 0.020em #444,3px 9px 0 0.020em,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em,7px 9px 0 0.020em,8px 9px 0 0.020em,9px 9px 0 0.020em,10px 9px 0 0.020em,11px 9px 0 0.020em,12px 9px 0 0.020em,13px 9px 0 0.020em #842300,14px 9px 0 0.020em #444,3px 10px 0 0.020em #444,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em,7px 10px 0 0.020em,8px 10px 0 0.020em,9px 10px 0 0.020em,10px 10px 0 0.020em,11px 10px 0 0.020em,12px 10px 0 0.020em #842300,13px 10px 0 0.020em #444,4px 11px 0 0.020em #444,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em,8px 11px 0 0.020em,9px 11px 0 0.020em,10px 11px 0 0.020em,11px 11px 0 0.020em #842300,12px 11px 0 0.020em #444,5px 12px 0 0.020em #444,6px 12px 0 0.020em,7px 12px 0 0.020em,8px 12px 0 0.020em,9px 12px 0 0.020em,10px 12px 0 0.020em #842300,11px 12px 0 0.020em #444,6px 13px 0 0.020em #444,7px 13px 0 0.020em,8px 13px 0 0.020em,9px 13px 0 0.020em #842300,10px 13px 0 0.020em #444,7px 14px 0 0.020em #444,8px 14px 0 0.020em #842300,9px 14px 0 0.020em #444,8px 15px 0 0.020em #444; - } -} - -.nes-icon.heart.is-half::before { - width: 1px; - height: 1px; - color: #f22426; - box-shadow: 3px 2px #444,4px 2px #444,5px 2px #444,11px 2px #444,12px 2px #444,13px 2px #444,2px 3px #444,3px 3px,4px 3px,5px 3px,6px 3px #444,10px 3px #444,14px 3px #444,1px 4px #444,2px 4px,3px 4px #fff,4px 4px #fff,5px 4px,6px 4px,7px 4px #444,9px 4px #444,15px 4px #444,1px 5px #444,2px 5px,3px 5px #fff,4px 5px,5px 5px,6px 5px,7px 5px,8px 5px #444,15px 5px #444,1px 6px #444,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px,8px 6px,15px 6px #444,1px 7px #444,2px 7px,3px 7px,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px,15px 7px #444,1px 8px #444,2px 8px,3px 8px,4px 8px,5px 8px,6px 8px,7px 8px,8px 8px,15px 8px #444,2px 9px #444,3px 9px,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px,14px 9px #444,3px 10px #444,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,13px 10px #444,4px 11px #444,5px 11px,6px 11px,7px 11px,8px 11px,12px 11px #444,5px 12px #444,6px 12px,7px 12px,8px 12px,11px 12px #444,6px 13px #444,7px 13px,8px 13px,10px 13px #444,7px 14px #444,8px 14px #842300,9px 14px #444,8px 15px #444; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.heart.is-half::before { - box-shadow: 3px 2px 0 0.020em #444,4px 2px 0 0.020em #444,5px 2px 0 0.020em #444,11px 2px 0 0.020em #444,12px 2px 0 0.020em #444,13px 2px 0 0.020em #444,2px 3px 0 0.020em #444,3px 3px 0 0.020em,4px 3px 0 0.020em,5px 3px 0 0.020em,6px 3px 0 0.020em #444,10px 3px 0 0.020em #444,14px 3px 0 0.020em #444,1px 4px 0 0.020em #444,2px 4px 0 0.020em,3px 4px 0 0.020em #fff,4px 4px 0 0.020em #fff,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em #444,9px 4px 0 0.020em #444,15px 4px 0 0.020em #444,1px 5px 0 0.020em #444,2px 5px 0 0.020em,3px 5px 0 0.020em #fff,4px 5px 0 0.020em,5px 5px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em,8px 5px 0 0.020em #444,15px 5px 0 0.020em #444,1px 6px 0 0.020em #444,2px 6px 0 0.020em,3px 6px 0 0.020em,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em,8px 6px 0 0.020em,15px 6px 0 0.020em #444,1px 7px 0 0.020em #444,2px 7px 0 0.020em,3px 7px 0 0.020em,4px 7px 0 0.020em,5px 7px 0 0.020em,6px 7px 0 0.020em,7px 7px 0 0.020em,8px 7px 0 0.020em,15px 7px 0 0.020em #444,1px 8px 0 0.020em #444,2px 8px 0 0.020em,3px 8px 0 0.020em,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em,7px 8px 0 0.020em,8px 8px 0 0.020em,15px 8px 0 0.020em #444,2px 9px 0 0.020em #444,3px 9px 0 0.020em,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em,7px 9px 0 0.020em,8px 9px 0 0.020em,14px 9px 0 0.020em #444,3px 10px 0 0.020em #444,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em,7px 10px 0 0.020em,8px 10px 0 0.020em,13px 10px 0 0.020em #444,4px 11px 0 0.020em #444,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em,8px 11px 0 0.020em,12px 11px 0 0.020em #444,5px 12px 0 0.020em #444,6px 12px 0 0.020em,7px 12px 0 0.020em,8px 12px 0 0.020em,11px 12px 0 0.020em #444,6px 13px 0 0.020em #444,7px 13px 0 0.020em,8px 13px 0 0.020em,10px 13px 0 0.020em #444,7px 14px 0 0.020em #444,8px 14px 0 0.020em #842300,9px 14px 0 0.020em #444,8px 15px 0 0.020em #444; - } -} - -.nes-icon.heart.is-transparent::before { - width: 1px; - height: 1px; - color: #444; - box-shadow: 3px 2px,4px 2px,5px 2px,11px 2px,12px 2px,13px 2px,2px 3px,6px 3px,10px 3px,14px 3px,1px 4px,7px 4px,9px 4px,15px 4px,1px 5px,8px 5px,15px 5px,1px 6px,15px 6px,1px 7px,15px 7px,1px 8px,15px 8px,2px 9px,14px 9px,3px 10px,13px 10px,4px 11px,12px 11px,5px 12px,11px 12px,6px 13px,10px 13px,7px 14px,9px 14px,8px 15px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.heart.is-transparent::before { - box-shadow: 3px 2px 0 0.020em,4px 2px 0 0.020em,5px 2px 0 0.020em,11px 2px 0 0.020em,12px 2px 0 0.020em,13px 2px 0 0.020em,2px 3px 0 0.020em,6px 3px 0 0.020em,10px 3px 0 0.020em,14px 3px 0 0.020em,1px 4px 0 0.020em,7px 4px 0 0.020em,9px 4px 0 0.020em,15px 4px 0 0.020em,1px 5px 0 0.020em,8px 5px 0 0.020em,15px 5px 0 0.020em,1px 6px 0 0.020em,15px 6px 0 0.020em,1px 7px 0 0.020em,15px 7px 0 0.020em,1px 8px 0 0.020em,15px 8px 0 0.020em,2px 9px 0 0.020em,14px 9px 0 0.020em,3px 10px 0 0.020em,13px 10px 0 0.020em,4px 11px 0 0.020em,12px 11px 0 0.020em,5px 12px 0 0.020em,11px 12px 0 0.020em,6px 13px 0 0.020em,10px 13px 0 0.020em,7px 14px 0 0.020em,9px 14px 0 0.020em,8px 15px 0 0.020em; - } -} - -.nes-icon.heart.is-empty::before { - width: 1px; - height: 1px; - color: #adafbb; - box-shadow: 3px 2px,4px 2px,5px 2px,11px 2px,12px 2px,13px 2px,2px 3px,6px 3px,10px 3px,14px 3px,1px 4px,7px 4px,9px 4px,15px 4px,1px 5px,8px 5px,15px 5px,1px 6px,15px 6px,1px 7px,15px 7px,1px 8px,15px 8px,2px 9px,14px 9px,3px 10px,13px 10px,4px 11px,12px 11px,5px 12px,11px 12px,6px 13px,10px 13px,7px 14px,9px 14px,8px 15px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.heart.is-empty::before { - box-shadow: 3px 2px 0 0.020em,4px 2px 0 0.020em,5px 2px 0 0.020em,11px 2px 0 0.020em,12px 2px 0 0.020em,13px 2px 0 0.020em,2px 3px 0 0.020em,6px 3px 0 0.020em,10px 3px 0 0.020em,14px 3px 0 0.020em,1px 4px 0 0.020em,7px 4px 0 0.020em,9px 4px 0 0.020em,15px 4px 0 0.020em,1px 5px 0 0.020em,8px 5px 0 0.020em,15px 5px 0 0.020em,1px 6px 0 0.020em,15px 6px 0 0.020em,1px 7px 0 0.020em,15px 7px 0 0.020em,1px 8px 0 0.020em,15px 8px 0 0.020em,2px 9px 0 0.020em,14px 9px 0 0.020em,3px 10px 0 0.020em,13px 10px 0 0.020em,4px 11px 0 0.020em,12px 11px 0 0.020em,5px 12px 0 0.020em,11px 12px 0 0.020em,6px 13px 0 0.020em,10px 13px 0 0.020em,7px 14px 0 0.020em,9px 14px 0 0.020em,8px 15px 0 0.020em; - } -} - -.nes-icon.star::before { - width: 1px; - height: 1px; - color: #ebe527; - box-shadow: 8px 1px #444,7px 2px #444,8px 2px,9px 2px #444,7px 3px #444,8px 3px,9px 3px #444,6px 4px #444,7px 4px,8px 4px,9px 4px,10px 4px #444,6px 5px #444,7px 5px #fff,8px 5px #fff,9px 5px,10px 5px #444,1px 6px #444,2px 6px #444,3px 6px #444,4px 6px #444,5px 6px #444,6px 6px #444,7px 6px #fff,8px 6px,9px 6px,10px 6px,11px 6px #444,12px 6px #444,13px 6px #444,14px 6px #444,15px 6px #444,1px 7px #444,2px 7px,3px 7px,4px 7px,5px 7px #fff,6px 7px #fff,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,14px 7px,15px 7px #444,2px 8px #444,3px 8px,4px 8px,5px 8px #fff,6px 8px,7px 8px,8px 8px,9px 8px,10px 8px,11px 8px,12px 8px,13px 8px #f59f54,14px 8px #444,3px 9px #444,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px #f59f54,12px 9px #f59f54,13px 9px #444,4px 10px #444,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px,12px 10px #444,3px 11px #444,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px #f59f54,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px #444,3px 12px #444,4px 12px,5px 12px,6px 12px,7px 12px #f59f54,8px 12px #f59f54,9px 12px #f59f54,10px 12px,11px 12px,12px 12px,13px 12px #444,2px 13px #444,3px 13px,4px 13px,5px 13px #f59f54,6px 13px #f59f54,7px 13px #f59f54,8px 13px #444,9px 13px #f59f54,10px 13px #f59f54,11px 13px #f59f54,12px 13px,13px 13px,14px 13px #444,2px 14px #444,3px 14px,4px 14px #f59f54,5px 14px #f59f54,6px 14px #444,7px 14px #444,9px 14px #444,10px 14px #444,11px 14px #f59f54,12px 14px #f59f54,13px 14px,14px 14px #444,1px 15px #444,2px 15px #f59f54,3px 15px #f59f54,4px 15px #444,5px 15px #444,11px 15px #444,12px 15px #444,13px 15px #f59f54,14px 15px #f59f54,15px 15px #444,1px 16px #444,2px 16px #444,3px 16px #444,13px 16px #444,14px 16px #444,15px 16px #444; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.star::before { - box-shadow: 8px 1px 0 0.020em #444,7px 2px 0 0.020em #444,8px 2px 0 0.020em,9px 2px 0 0.020em #444,7px 3px 0 0.020em #444,8px 3px 0 0.020em,9px 3px 0 0.020em #444,6px 4px 0 0.020em #444,7px 4px 0 0.020em,8px 4px 0 0.020em,9px 4px 0 0.020em,10px 4px 0 0.020em #444,6px 5px 0 0.020em #444,7px 5px 0 0.020em #fff,8px 5px 0 0.020em #fff,9px 5px 0 0.020em,10px 5px 0 0.020em #444,1px 6px 0 0.020em #444,2px 6px 0 0.020em #444,3px 6px 0 0.020em #444,4px 6px 0 0.020em #444,5px 6px 0 0.020em #444,6px 6px 0 0.020em #444,7px 6px 0 0.020em #fff,8px 6px 0 0.020em,9px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em #444,12px 6px 0 0.020em #444,13px 6px 0 0.020em #444,14px 6px 0 0.020em #444,15px 6px 0 0.020em #444,1px 7px 0 0.020em #444,2px 7px 0 0.020em,3px 7px 0 0.020em,4px 7px 0 0.020em,5px 7px 0 0.020em #fff,6px 7px 0 0.020em #fff,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em,11px 7px 0 0.020em,12px 7px 0 0.020em,13px 7px 0 0.020em,14px 7px 0 0.020em,15px 7px 0 0.020em #444,2px 8px 0 0.020em #444,3px 8px 0 0.020em,4px 8px 0 0.020em,5px 8px 0 0.020em #fff,6px 8px 0 0.020em,7px 8px 0 0.020em,8px 8px 0 0.020em,9px 8px 0 0.020em,10px 8px 0 0.020em,11px 8px 0 0.020em,12px 8px 0 0.020em,13px 8px 0 0.020em #f59f54,14px 8px 0 0.020em #444,3px 9px 0 0.020em #444,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em,7px 9px 0 0.020em,8px 9px 0 0.020em,9px 9px 0 0.020em,10px 9px 0 0.020em,11px 9px 0 0.020em #f59f54,12px 9px 0 0.020em #f59f54,13px 9px 0 0.020em #444,4px 10px 0 0.020em #444,5px 10px 0 0.020em,6px 10px 0 0.020em,7px 10px 0 0.020em,8px 10px 0 0.020em,9px 10px 0 0.020em,10px 10px 0 0.020em,11px 10px 0 0.020em,12px 10px 0 0.020em #444,3px 11px 0 0.020em #444,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em,8px 11px 0 0.020em #f59f54,9px 11px 0 0.020em,10px 11px 0 0.020em,11px 11px 0 0.020em,12px 11px 0 0.020em,13px 11px 0 0.020em #444,3px 12px 0 0.020em #444,4px 12px 0 0.020em,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em #f59f54,8px 12px 0 0.020em #f59f54,9px 12px 0 0.020em #f59f54,10px 12px 0 0.020em,11px 12px 0 0.020em,12px 12px 0 0.020em,13px 12px 0 0.020em #444,2px 13px 0 0.020em #444,3px 13px 0 0.020em,4px 13px 0 0.020em,5px 13px 0 0.020em #f59f54,6px 13px 0 0.020em #f59f54,7px 13px 0 0.020em #f59f54,8px 13px 0 0.020em #444,9px 13px 0 0.020em #f59f54,10px 13px 0 0.020em #f59f54,11px 13px 0 0.020em #f59f54,12px 13px 0 0.020em,13px 13px 0 0.020em,14px 13px 0 0.020em #444,2px 14px 0 0.020em #444,3px 14px 0 0.020em,4px 14px 0 0.020em #f59f54,5px 14px 0 0.020em #f59f54,6px 14px 0 0.020em #444,7px 14px 0 0.020em #444,9px 14px 0 0.020em #444,10px 14px 0 0.020em #444,11px 14px 0 0.020em #f59f54,12px 14px 0 0.020em #f59f54,13px 14px 0 0.020em,14px 14px 0 0.020em #444,1px 15px 0 0.020em #444,2px 15px 0 0.020em #f59f54,3px 15px 0 0.020em #f59f54,4px 15px 0 0.020em #444,5px 15px 0 0.020em #444,11px 15px 0 0.020em #444,12px 15px 0 0.020em #444,13px 15px 0 0.020em #f59f54,14px 15px 0 0.020em #f59f54,15px 15px 0 0.020em #444,1px 16px 0 0.020em #444,2px 16px 0 0.020em #444,3px 16px 0 0.020em #444,13px 16px 0 0.020em #444,14px 16px 0 0.020em #444,15px 16px 0 0.020em #444; - } -} - -.nes-icon.star.is-empty::before { - width: 1px; - height: 1px; - color: #adafbb; - box-shadow: 8px 1px,7px 2px,9px 2px,7px 3px,9px 3px,6px 4px,10px 4px,6px 5px,10px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,1px 7px,15px 7px,2px 8px,14px 8px,3px 9px,13px 9px,4px 10px,12px 10px,3px 11px,13px 11px,3px 12px,13px 12px,2px 13px,8px 13px,14px 13px,2px 14px,6px 14px,7px 14px,9px 14px,10px 14px,14px 14px,1px 15px,4px 15px,5px 15px,11px 15px,12px 15px,15px 15px,1px 16px,2px 16px,3px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.star.is-empty::before { - box-shadow: 8px 1px 0 0.020em,7px 2px 0 0.020em,9px 2px 0 0.020em,7px 3px 0 0.020em,9px 3px 0 0.020em,6px 4px 0 0.020em,10px 4px 0 0.020em,6px 5px 0 0.020em,10px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em,1px 7px 0 0.020em,15px 7px 0 0.020em,2px 8px 0 0.020em,14px 8px 0 0.020em,3px 9px 0 0.020em,13px 9px 0 0.020em,4px 10px 0 0.020em,12px 10px 0 0.020em,3px 11px 0 0.020em,13px 11px 0 0.020em,3px 12px 0 0.020em,13px 12px 0 0.020em,2px 13px 0 0.020em,8px 13px 0 0.020em,14px 13px 0 0.020em,2px 14px 0 0.020em,6px 14px 0 0.020em,7px 14px 0 0.020em,9px 14px 0 0.020em,10px 14px 0 0.020em,14px 14px 0 0.020em,1px 15px 0 0.020em,4px 15px 0 0.020em,5px 15px 0 0.020em,11px 15px 0 0.020em,12px 15px 0 0.020em,15px 15px 0 0.020em,1px 16px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.star.is-half::before { - width: 1px; - height: 1px; - color: #444; - box-shadow: 8px 1px,7px 2px,8px 2px #ebe527,9px 2px,7px 3px,8px 3px #ebe527,9px 3px,6px 4px,7px 4px #ebe527,8px 4px #ebe527,10px 4px,6px 5px,7px 5px #ebe527,8px 5px #ebe527,10px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px #ebe527,8px 6px #ebe527,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,1px 7px,2px 7px #ebe527,3px 7px #ebe527,4px 7px #ebe527,5px 7px #ebe527,6px 7px #ebe527,7px 7px #ebe527,8px 7px #ebe527,15px 7px,2px 8px,3px 8px #ebe527,4px 8px #ebe527,5px 8px #ebe527,6px 8px #ebe527,7px 8px #ebe527,8px 8px #ebe527,14px 8px,3px 9px,4px 9px #ebe527,5px 9px #ebe527,6px 9px #ebe527,7px 9px #ebe527,8px 9px #ebe527,13px 9px,4px 10px,5px 10px #ebe527,6px 10px #ebe527,7px 10px #ebe527,8px 10px #ebe527,12px 10px,3px 11px,4px 11px #ebe527,5px 11px #ebe527,6px 11px #ebe527,7px 11px #ebe527,8px 11px #f59f54,13px 11px,3px 12px,4px 12px #ebe527,5px 12px #ebe527,6px 12px #ebe527,7px 12px #f59f54,8px 12px #f59f54,13px 12px,2px 13px,3px 13px #ebe527,4px 13px #ebe527,5px 13px #f59f54,6px 13px #f59f54,7px 13px #f59f54,8px 13px,14px 13px,2px 14px,3px 14px #ebe527,4px 14px #f59f54,5px 14px #f59f54,6px 14px,7px 14px,9px 14px,10px 14px,14px 14px,1px 15px,2px 15px #f59f54,3px 15px #f59f54,4px 15px,5px 15px,11px 15px,12px 15px,15px 15px,1px 16px,2px 16px,3px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.star.is-half::before { - box-shadow: 8px 1px 0 0.020em,7px 2px 0 0.020em,8px 2px 0 0.020em #ebe527,9px 2px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em #ebe527,9px 3px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em #ebe527,8px 4px 0 0.020em #ebe527,10px 4px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em #ebe527,8px 5px 0 0.020em #ebe527,10px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em #ebe527,8px 6px 0 0.020em #ebe527,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em,1px 7px 0 0.020em,2px 7px 0 0.020em #ebe527,3px 7px 0 0.020em #ebe527,4px 7px 0 0.020em #ebe527,5px 7px 0 0.020em #ebe527,6px 7px 0 0.020em #ebe527,7px 7px 0 0.020em #ebe527,8px 7px 0 0.020em #ebe527,15px 7px 0 0.020em,2px 8px 0 0.020em,3px 8px 0 0.020em #ebe527,4px 8px 0 0.020em #ebe527,5px 8px 0 0.020em #ebe527,6px 8px 0 0.020em #ebe527,7px 8px 0 0.020em #ebe527,8px 8px 0 0.020em #ebe527,14px 8px 0 0.020em,3px 9px 0 0.020em,4px 9px 0 0.020em #ebe527,5px 9px 0 0.020em #ebe527,6px 9px 0 0.020em #ebe527,7px 9px 0 0.020em #ebe527,8px 9px 0 0.020em #ebe527,13px 9px 0 0.020em,4px 10px 0 0.020em,5px 10px 0 0.020em #ebe527,6px 10px 0 0.020em #ebe527,7px 10px 0 0.020em #ebe527,8px 10px 0 0.020em #ebe527,12px 10px 0 0.020em,3px 11px 0 0.020em,4px 11px 0 0.020em #ebe527,5px 11px 0 0.020em #ebe527,6px 11px 0 0.020em #ebe527,7px 11px 0 0.020em #ebe527,8px 11px 0 0.020em #f59f54,13px 11px 0 0.020em,3px 12px 0 0.020em,4px 12px 0 0.020em #ebe527,5px 12px 0 0.020em #ebe527,6px 12px 0 0.020em #ebe527,7px 12px 0 0.020em #f59f54,8px 12px 0 0.020em #f59f54,13px 12px 0 0.020em,2px 13px 0 0.020em,3px 13px 0 0.020em #ebe527,4px 13px 0 0.020em #ebe527,5px 13px 0 0.020em #f59f54,6px 13px 0 0.020em #f59f54,7px 13px 0 0.020em #f59f54,8px 13px 0 0.020em,14px 13px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em #ebe527,4px 14px 0 0.020em #f59f54,5px 14px 0 0.020em #f59f54,6px 14px 0 0.020em,7px 14px 0 0.020em,9px 14px 0 0.020em,10px 14px 0 0.020em,14px 14px 0 0.020em,1px 15px 0 0.020em,2px 15px 0 0.020em #f59f54,3px 15px 0 0.020em #f59f54,4px 15px 0 0.020em,5px 15px 0 0.020em,11px 15px 0 0.020em,12px 15px 0 0.020em,15px 15px 0 0.020em,1px 16px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.star.is-transparent::before { - width: 1px; - height: 1px; - color: #444; - box-shadow: 8px 1px,7px 2px,9px 2px,7px 3px,9px 3px,6px 4px,10px 4px,6px 5px,10px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,1px 7px,15px 7px,2px 8px,14px 8px,3px 9px,13px 9px,4px 10px,12px 10px,3px 11px,13px 11px,3px 12px,13px 12px,2px 13px,8px 13px,14px 13px,2px 14px,6px 14px,7px 14px,9px 14px,10px 14px,14px 14px,1px 15px,4px 15px,5px 15px,11px 15px,12px 15px,15px 15px,1px 16px,2px 16px,3px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.star.is-transparent::before { - box-shadow: 8px 1px 0 0.020em,7px 2px 0 0.020em,9px 2px 0 0.020em,7px 3px 0 0.020em,9px 3px 0 0.020em,6px 4px 0 0.020em,10px 4px 0 0.020em,6px 5px 0 0.020em,10px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em,1px 7px 0 0.020em,15px 7px 0 0.020em,2px 8px 0 0.020em,14px 8px 0 0.020em,3px 9px 0 0.020em,13px 9px 0 0.020em,4px 10px 0 0.020em,12px 10px 0 0.020em,3px 11px 0 0.020em,13px 11px 0 0.020em,3px 12px 0 0.020em,13px 12px 0 0.020em,2px 13px 0 0.020em,8px 13px 0 0.020em,14px 13px 0 0.020em,2px 14px 0 0.020em,6px 14px 0 0.020em,7px 14px 0 0.020em,9px 14px 0 0.020em,10px 14px 0 0.020em,14px 14px 0 0.020em,1px 15px 0 0.020em,4px 15px 0 0.020em,5px 15px 0 0.020em,11px 15px 0 0.020em,12px 15px 0 0.020em,15px 15px 0 0.020em,1px 16px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.trophy::before { - width: 1px; - height: 1px; - color: #ebe527; - box-shadow: 3px 1px #444,4px 1px #444,5px 1px #444,6px 1px #444,7px 1px #444,8px 1px #444,9px 1px #444,10px 1px #444,11px 1px #444,12px 1px #444,13px 1px #444,3px 2px #444,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px #f59f54,13px 2px #444,1px 3px #444,2px 3px #444,3px 3px #444,4px 3px,5px 3px #fff,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px #f59f54,13px 3px #444,14px 3px #444,15px 3px #444,1px 4px #444,3px 4px #444,4px 4px,5px 4px #fff,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px #f59f54,13px 4px #444,15px 4px #444,1px 5px #444,3px 5px #444,4px 5px,5px 5px #fff,6px 5px,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px,12px 5px #f59f54,13px 5px #444,15px 5px #444,2px 6px #444,3px 6px #444,4px 6px,5px 6px #fff,6px 6px,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px #f59f54,13px 6px #444,14px 6px #444,3px 7px #444,4px 7px,5px 7px #fff,6px 7px,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px #f59f54,13px 7px #444,3px 8px #444,4px 8px,5px 8px,6px 8px,7px 8px,8px 8px,9px 8px,10px 8px,11px 8px,12px 8px #f59f54,13px 8px #444,4px 9px #444,5px 9px,6px 9px,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px #f59f54,12px 9px #444,5px 10px #444,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px #f59f54,11px 10px #444,6px 11px #444,7px 11px,8px 11px,9px 11px #f59f54,10px 11px #444,7px 12px #444,8px 12px,9px 12px #444,7px 13px #444,8px 13px,9px 13px #444,6px 14px #444,7px 14px #444,8px 14px,9px 14px #444,10px 14px #444,5px 15px #444,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px #f59f54,11px 15px #444,5px 16px #444,6px 16px #444,7px 16px #444,8px 16px #444,9px 16px #444,10px 16px #444,11px 16px #444; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.trophy::before { - box-shadow: 3px 1px 0 0.020em #444,4px 1px 0 0.020em #444,5px 1px 0 0.020em #444,6px 1px 0 0.020em #444,7px 1px 0 0.020em #444,8px 1px 0 0.020em #444,9px 1px 0 0.020em #444,10px 1px 0 0.020em #444,11px 1px 0 0.020em #444,12px 1px 0 0.020em #444,13px 1px 0 0.020em #444,3px 2px 0 0.020em #444,4px 2px 0 0.020em,5px 2px 0 0.020em,6px 2px 0 0.020em,7px 2px 0 0.020em,8px 2px 0 0.020em,9px 2px 0 0.020em,10px 2px 0 0.020em,11px 2px 0 0.020em,12px 2px 0 0.020em #f59f54,13px 2px 0 0.020em #444,1px 3px 0 0.020em #444,2px 3px 0 0.020em #444,3px 3px 0 0.020em #444,4px 3px 0 0.020em,5px 3px 0 0.020em #fff,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em #f59f54,13px 3px 0 0.020em #444,14px 3px 0 0.020em #444,15px 3px 0 0.020em #444,1px 4px 0 0.020em #444,3px 4px 0 0.020em #444,4px 4px 0 0.020em,5px 4px 0 0.020em #fff,6px 4px 0 0.020em,7px 4px 0 0.020em,8px 4px 0 0.020em,9px 4px 0 0.020em,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em #f59f54,13px 4px 0 0.020em #444,15px 4px 0 0.020em #444,1px 5px 0 0.020em #444,3px 5px 0 0.020em #444,4px 5px 0 0.020em,5px 5px 0 0.020em #fff,6px 5px 0 0.020em,7px 5px 0 0.020em,8px 5px 0 0.020em,9px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em,12px 5px 0 0.020em #f59f54,13px 5px 0 0.020em #444,15px 5px 0 0.020em #444,2px 6px 0 0.020em #444,3px 6px 0 0.020em #444,4px 6px 0 0.020em,5px 6px 0 0.020em #fff,6px 6px 0 0.020em,7px 6px 0 0.020em,8px 6px 0 0.020em,9px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em #f59f54,13px 6px 0 0.020em #444,14px 6px 0 0.020em #444,3px 7px 0 0.020em #444,4px 7px 0 0.020em,5px 7px 0 0.020em #fff,6px 7px 0 0.020em,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em,11px 7px 0 0.020em,12px 7px 0 0.020em #f59f54,13px 7px 0 0.020em #444,3px 8px 0 0.020em #444,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em,7px 8px 0 0.020em,8px 8px 0 0.020em,9px 8px 0 0.020em,10px 8px 0 0.020em,11px 8px 0 0.020em,12px 8px 0 0.020em #f59f54,13px 8px 0 0.020em #444,4px 9px 0 0.020em #444,5px 9px 0 0.020em,6px 9px 0 0.020em,7px 9px 0 0.020em,8px 9px 0 0.020em,9px 9px 0 0.020em,10px 9px 0 0.020em,11px 9px 0 0.020em #f59f54,12px 9px 0 0.020em #444,5px 10px 0 0.020em #444,6px 10px 0 0.020em,7px 10px 0 0.020em,8px 10px 0 0.020em,9px 10px 0 0.020em,10px 10px 0 0.020em #f59f54,11px 10px 0 0.020em #444,6px 11px 0 0.020em #444,7px 11px 0 0.020em,8px 11px 0 0.020em,9px 11px 0 0.020em #f59f54,10px 11px 0 0.020em #444,7px 12px 0 0.020em #444,8px 12px 0 0.020em,9px 12px 0 0.020em #444,7px 13px 0 0.020em #444,8px 13px 0 0.020em,9px 13px 0 0.020em #444,6px 14px 0 0.020em #444,7px 14px 0 0.020em #444,8px 14px 0 0.020em,9px 14px 0 0.020em #444,10px 14px 0 0.020em #444,5px 15px 0 0.020em #444,6px 15px 0 0.020em,7px 15px 0 0.020em,8px 15px 0 0.020em,9px 15px 0 0.020em,10px 15px 0 0.020em #f59f54,11px 15px 0 0.020em #444,5px 16px 0 0.020em #444,6px 16px 0 0.020em #444,7px 16px 0 0.020em #444,8px 16px 0 0.020em #444,9px 16px 0 0.020em #444,10px 16px 0 0.020em #444,11px 16px 0 0.020em #444; - } -} - -.nes-icon.trophy.is-empty::before { - width: 1px; - height: 1px; - color: #adafbb; - box-shadow: 3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,3px 2px,13px 2px,1px 3px,2px 3px,3px 3px,13px 3px,14px 3px,15px 3px,1px 4px,3px 4px,13px 4px,15px 4px,1px 5px,3px 5px,13px 5px,15px 5px,2px 6px,3px 6px,13px 6px,14px 6px,3px 7px,13px 7px,3px 8px,13px 8px,4px 9px,12px 9px,5px 10px,11px 10px,6px 11px,10px 11px,7px 12px,9px 12px,7px 13px,9px 13px,6px 14px,7px 14px,9px 14px,10px 14px,5px 15px,11px 15px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.trophy.is-empty::before { - box-shadow: 3px 1px 0 0.020em,4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,3px 2px 0 0.020em,13px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em,3px 3px 0 0.020em,13px 3px 0 0.020em,14px 3px 0 0.020em,15px 3px 0 0.020em,1px 4px 0 0.020em,3px 4px 0 0.020em,13px 4px 0 0.020em,15px 4px 0 0.020em,1px 5px 0 0.020em,3px 5px 0 0.020em,13px 5px 0 0.020em,15px 5px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,3px 7px 0 0.020em,13px 7px 0 0.020em,3px 8px 0 0.020em,13px 8px 0 0.020em,4px 9px 0 0.020em,12px 9px 0 0.020em,5px 10px 0 0.020em,11px 10px 0 0.020em,6px 11px 0 0.020em,10px 11px 0 0.020em,7px 12px 0 0.020em,9px 12px 0 0.020em,7px 13px 0 0.020em,9px 13px 0 0.020em,6px 14px 0 0.020em,7px 14px 0 0.020em,9px 14px 0 0.020em,10px 14px 0 0.020em,5px 15px 0 0.020em,11px 15px 0 0.020em,5px 16px 0 0.020em,6px 16px 0 0.020em,7px 16px 0 0.020em,8px 16px 0 0.020em,9px 16px 0 0.020em,10px 16px 0 0.020em,11px 16px 0 0.020em; - } -} - -.nes-icon.like::before { - width: 1px; - height: 1px; - color: #fff; - box-shadow: 8px 2px #333,9px 2px #333,8px 3px #333,9px 3px,10px 3px #333,8px 4px #333,9px 4px,10px 4px #333,7px 5px #333,8px 5px,9px 5px,10px 5px #333,7px 6px #333,8px 6px,9px 6px,10px 6px #333,11px 6px #333,12px 6px #333,13px 6px #333,14px 6px #333,15px 6px #333,6px 7px #333,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,14px 7px,15px 7px,16px 7px #333,2px 8px #333,3px 8px #333,4px 8px #333,6px 8px #333,7px 8px,8px 8px,9px 8px,10px 8px,11px 8px,12px 8px,13px 8px,14px 8px,15px 8px,16px 8px #333,1px 9px #333,2px 9px #2e77be,3px 9px #2e77be,4px 9px #2e77be,5px 9px #333,6px 9px,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px,12px 9px,13px 9px,14px 9px,15px 9px,16px 9px #333,1px 10px #333,2px 10px #2e77be,3px 10px #2e77be,4px 10px #2e77be,5px 10px #333,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px,12px 10px,13px 10px,14px 10px,15px 10px #333,1px 11px #333,2px 11px #2e77be,3px 11px #2e77be,4px 11px #2e77be,5px 11px #333,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px,14px 11px,15px 11px #333,1px 12px #333,2px 12px #2e77be,3px 12px #2e77be,4px 12px #2e77be,5px 12px #333,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px,13px 12px,14px 12px,15px 12px #333,1px 13px #333,2px 13px #2e77be,3px 13px #2e77be,4px 13px #2e77be,5px 13px #333,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px #333,1px 14px #333,2px 14px #2e77be,3px 14px #2e77be,4px 14px #2e77be,5px 14px #333,6px 14px,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px #333,2px 15px #333,3px 15px #333,4px 15px #333,6px 15px #333,7px 15px #333,8px 15px #333,9px 15px #333,10px 15px #333,11px 15px #333,12px 15px #333,13px 15px #333; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.like::before { - box-shadow: 8px 2px 0 0.020em #333,9px 2px 0 0.020em #333,8px 3px 0 0.020em #333,9px 3px 0 0.020em,10px 3px 0 0.020em #333,8px 4px 0 0.020em #333,9px 4px 0 0.020em,10px 4px 0 0.020em #333,7px 5px 0 0.020em #333,8px 5px 0 0.020em,9px 5px 0 0.020em,10px 5px 0 0.020em #333,7px 6px 0 0.020em #333,8px 6px 0 0.020em,9px 6px 0 0.020em,10px 6px 0 0.020em #333,11px 6px 0 0.020em #333,12px 6px 0 0.020em #333,13px 6px 0 0.020em #333,14px 6px 0 0.020em #333,15px 6px 0 0.020em #333,6px 7px 0 0.020em #333,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em,11px 7px 0 0.020em,12px 7px 0 0.020em,13px 7px 0 0.020em,14px 7px 0 0.020em,15px 7px 0 0.020em,16px 7px 0 0.020em #333,2px 8px 0 0.020em #333,3px 8px 0 0.020em #333,4px 8px 0 0.020em #333,6px 8px 0 0.020em #333,7px 8px 0 0.020em,8px 8px 0 0.020em,9px 8px 0 0.020em,10px 8px 0 0.020em,11px 8px 0 0.020em,12px 8px 0 0.020em,13px 8px 0 0.020em,14px 8px 0 0.020em,15px 8px 0 0.020em,16px 8px 0 0.020em #333,1px 9px 0 0.020em #333,2px 9px 0 0.020em #2e77be,3px 9px 0 0.020em #2e77be,4px 9px 0 0.020em #2e77be,5px 9px 0 0.020em #333,6px 9px 0 0.020em,7px 9px 0 0.020em,8px 9px 0 0.020em,9px 9px 0 0.020em,10px 9px 0 0.020em,11px 9px 0 0.020em,12px 9px 0 0.020em,13px 9px 0 0.020em,14px 9px 0 0.020em,15px 9px 0 0.020em,16px 9px 0 0.020em #333,1px 10px 0 0.020em #333,2px 10px 0 0.020em #2e77be,3px 10px 0 0.020em #2e77be,4px 10px 0 0.020em #2e77be,5px 10px 0 0.020em #333,6px 10px 0 0.020em,7px 10px 0 0.020em,8px 10px 0 0.020em,9px 10px 0 0.020em,10px 10px 0 0.020em,11px 10px 0 0.020em,12px 10px 0 0.020em,13px 10px 0 0.020em,14px 10px 0 0.020em,15px 10px 0 0.020em #333,1px 11px 0 0.020em #333,2px 11px 0 0.020em #2e77be,3px 11px 0 0.020em #2e77be,4px 11px 0 0.020em #2e77be,5px 11px 0 0.020em #333,6px 11px 0 0.020em,7px 11px 0 0.020em,8px 11px 0 0.020em,9px 11px 0 0.020em,10px 11px 0 0.020em,11px 11px 0 0.020em,12px 11px 0 0.020em,13px 11px 0 0.020em,14px 11px 0 0.020em,15px 11px 0 0.020em #333,1px 12px 0 0.020em #333,2px 12px 0 0.020em #2e77be,3px 12px 0 0.020em #2e77be,4px 12px 0 0.020em #2e77be,5px 12px 0 0.020em #333,6px 12px 0 0.020em,7px 12px 0 0.020em,8px 12px 0 0.020em,9px 12px 0 0.020em,10px 12px 0 0.020em,11px 12px 0 0.020em,12px 12px 0 0.020em,13px 12px 0 0.020em,14px 12px 0 0.020em,15px 12px 0 0.020em #333,1px 13px 0 0.020em #333,2px 13px 0 0.020em #2e77be,3px 13px 0 0.020em #2e77be,4px 13px 0 0.020em #2e77be,5px 13px 0 0.020em #333,6px 13px 0 0.020em,7px 13px 0 0.020em,8px 13px 0 0.020em,9px 13px 0 0.020em,10px 13px 0 0.020em,11px 13px 0 0.020em,12px 13px 0 0.020em,13px 13px 0 0.020em,14px 13px 0 0.020em #333,1px 14px 0 0.020em #333,2px 14px 0 0.020em #2e77be,3px 14px 0 0.020em #2e77be,4px 14px 0 0.020em #2e77be,5px 14px 0 0.020em #333,6px 14px 0 0.020em,7px 14px 0 0.020em,8px 14px 0 0.020em,9px 14px 0 0.020em,10px 14px 0 0.020em,11px 14px 0 0.020em,12px 14px 0 0.020em,13px 14px 0 0.020em,14px 14px 0 0.020em #333,2px 15px 0 0.020em #333,3px 15px 0 0.020em #333,4px 15px 0 0.020em #333,6px 15px 0 0.020em #333,7px 15px 0 0.020em #333,8px 15px 0 0.020em #333,9px 15px 0 0.020em #333,10px 15px 0 0.020em #333,11px 15px 0 0.020em #333,12px 15px 0 0.020em #333,13px 15px 0 0.020em #333; - } -} - -.nes-icon.like.is-empty::before { - width: 1px; - height: 1px; - color: #adafbb; - box-shadow: 8px 2px,9px 2px,8px 3px,10px 3px,8px 4px,10px 4px,7px 5px,10px 5px,7px 6px,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,6px 7px,16px 7px,2px 8px,3px 8px,4px 8px,6px 8px,16px 8px,1px 9px,5px 9px,16px 9px,1px 10px,5px 10px,15px 10px,1px 11px,5px 11px,15px 11px,1px 12px,5px 12px,15px 12px,1px 13px,5px 13px,14px 13px,1px 14px,5px 14px,14px 14px,2px 15px,3px 15px,4px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.like.is-empty::before { - box-shadow: 8px 2px 0 0.020em,9px 2px 0 0.020em,8px 3px 0 0.020em,10px 3px 0 0.020em,8px 4px 0 0.020em,10px 4px 0 0.020em,7px 5px 0 0.020em,10px 5px 0 0.020em,7px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em,6px 7px 0 0.020em,16px 7px 0 0.020em,2px 8px 0 0.020em,3px 8px 0 0.020em,4px 8px 0 0.020em,6px 8px 0 0.020em,16px 8px 0 0.020em,1px 9px 0 0.020em,5px 9px 0 0.020em,16px 9px 0 0.020em,1px 10px 0 0.020em,5px 10px 0 0.020em,15px 10px 0 0.020em,1px 11px 0 0.020em,5px 11px 0 0.020em,15px 11px 0 0.020em,1px 12px 0 0.020em,5px 12px 0 0.020em,15px 12px 0 0.020em,1px 13px 0 0.020em,5px 13px 0 0.020em,14px 13px 0 0.020em,1px 14px 0 0.020em,5px 14px 0 0.020em,14px 14px 0 0.020em,2px 15px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em,6px 15px 0 0.020em,7px 15px 0 0.020em,8px 15px 0 0.020em,9px 15px 0 0.020em,10px 15px 0 0.020em,11px 15px 0 0.020em,12px 15px 0 0.020em,13px 15px 0 0.020em; - } -} - -.nes-icon.twitter::before { - width: 1px; - height: 1px; - color: #2c9ceb; - box-shadow: 2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px,13px 2px,14px 2px,15px 2px,16px 2px,1px 3px,2px 3px #fff,3px 3px,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px #fff,11px 3px #fff,12px 3px #fff,13px 3px,14px 3px,15px 3px,16px 3px,1px 4px,2px 4px #fff,3px 4px #fff,4px 4px #fff,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px #fff,10px 4px #fff,11px 4px #fff,12px 4px #fff,13px 4px #fff,14px 4px,15px 4px,16px 4px,1px 5px,2px 5px #fff,3px 5px #fff,4px 5px #fff,5px 5px #fff,6px 5px #fff,7px 5px,8px 5px #fff,9px 5px #fff,10px 5px #fff,11px 5px #fff,12px 5px #fff,13px 5px #fff,14px 5px #fff,15px 5px #fff,16px 5px,1px 6px,2px 6px,3px 6px #fff,4px 6px #fff,5px 6px #fff,6px 6px #fff,7px 6px #fff,8px 6px #fff,9px 6px #fff,10px 6px #fff,11px 6px #fff,12px 6px #fff,13px 6px #fff,14px 6px #fff,15px 6px,16px 6px,1px 7px,2px 7px,3px 7px #fff,4px 7px #fff,5px 7px #fff,6px 7px #fff,7px 7px #fff,8px 7px #fff,9px 7px #fff,10px 7px #fff,11px 7px #fff,12px 7px #fff,13px 7px #fff,14px 7px #fff,15px 7px,16px 7px,1px 8px,2px 8px,3px 8px,4px 8px #fff,5px 8px #fff,6px 8px #fff,7px 8px #fff,8px 8px #fff,9px 8px #fff,10px 8px #fff,11px 8px #fff,12px 8px #fff,13px 8px #fff,14px 8px,15px 8px,16px 8px,1px 9px,2px 9px,3px 9px,4px 9px #fff,5px 9px #fff,6px 9px #fff,7px 9px #fff,8px 9px #fff,9px 9px #fff,10px 9px #fff,11px 9px #fff,12px 9px #fff,13px 9px,14px 9px,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px,4px 10px,5px 10px #fff,6px 10px #fff,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px #fff,12px 10px #fff,13px 10px,14px 10px,15px 10px,16px 10px,1px 11px,2px 11px,3px 11px,4px 11px,5px 11px,6px 11px #fff,7px 11px #fff,8px 11px #fff,9px 11px #fff,10px 11px #fff,11px 11px #fff,12px 11px #fff,13px 11px,14px 11px,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px,4px 12px,5px 12px #fff,6px 12px #fff,7px 12px #fff,8px 12px #fff,9px 12px #fff,10px 12px #fff,11px 12px #fff,12px 12px,13px 12px,14px 12px,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px #fff,4px 13px #fff,5px 13px #fff,6px 13px #fff,7px 13px #fff,8px 13px #fff,9px 13px #fff,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px #fff,5px 14px #fff,6px 14px #fff,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.twitter::before { - box-shadow: 2px 1px 0 0.020em,3px 1px 0 0.020em,4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,15px 1px 0 0.020em,1px 2px 0 0.020em,2px 2px 0 0.020em,3px 2px 0 0.020em,4px 2px 0 0.020em,5px 2px 0 0.020em,6px 2px 0 0.020em,7px 2px 0 0.020em,8px 2px 0 0.020em,9px 2px 0 0.020em,10px 2px 0 0.020em,11px 2px 0 0.020em,12px 2px 0 0.020em,13px 2px 0 0.020em,14px 2px 0 0.020em,15px 2px 0 0.020em,16px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em #fff,3px 3px 0 0.020em,4px 3px 0 0.020em,5px 3px 0 0.020em,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em #fff,11px 3px 0 0.020em #fff,12px 3px 0 0.020em #fff,13px 3px 0 0.020em,14px 3px 0 0.020em,15px 3px 0 0.020em,16px 3px 0 0.020em,1px 4px 0 0.020em,2px 4px 0 0.020em #fff,3px 4px 0 0.020em #fff,4px 4px 0 0.020em #fff,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em,8px 4px 0 0.020em,9px 4px 0 0.020em #fff,10px 4px 0 0.020em #fff,11px 4px 0 0.020em #fff,12px 4px 0 0.020em #fff,13px 4px 0 0.020em #fff,14px 4px 0 0.020em,15px 4px 0 0.020em,16px 4px 0 0.020em,1px 5px 0 0.020em,2px 5px 0 0.020em #fff,3px 5px 0 0.020em #fff,4px 5px 0 0.020em #fff,5px 5px 0 0.020em #fff,6px 5px 0 0.020em #fff,7px 5px 0 0.020em,8px 5px 0 0.020em #fff,9px 5px 0 0.020em #fff,10px 5px 0 0.020em #fff,11px 5px 0 0.020em #fff,12px 5px 0 0.020em #fff,13px 5px 0 0.020em #fff,14px 5px 0 0.020em #fff,15px 5px 0 0.020em #fff,16px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em #fff,4px 6px 0 0.020em #fff,5px 6px 0 0.020em #fff,6px 6px 0 0.020em #fff,7px 6px 0 0.020em #fff,8px 6px 0 0.020em #fff,9px 6px 0 0.020em #fff,10px 6px 0 0.020em #fff,11px 6px 0 0.020em #fff,12px 6px 0 0.020em #fff,13px 6px 0 0.020em #fff,14px 6px 0 0.020em #fff,15px 6px 0 0.020em,16px 6px 0 0.020em,1px 7px 0 0.020em,2px 7px 0 0.020em,3px 7px 0 0.020em #fff,4px 7px 0 0.020em #fff,5px 7px 0 0.020em #fff,6px 7px 0 0.020em #fff,7px 7px 0 0.020em #fff,8px 7px 0 0.020em #fff,9px 7px 0 0.020em #fff,10px 7px 0 0.020em #fff,11px 7px 0 0.020em #fff,12px 7px 0 0.020em #fff,13px 7px 0 0.020em #fff,14px 7px 0 0.020em #fff,15px 7px 0 0.020em,16px 7px 0 0.020em,1px 8px 0 0.020em,2px 8px 0 0.020em,3px 8px 0 0.020em,4px 8px 0 0.020em #fff,5px 8px 0 0.020em #fff,6px 8px 0 0.020em #fff,7px 8px 0 0.020em #fff,8px 8px 0 0.020em #fff,9px 8px 0 0.020em #fff,10px 8px 0 0.020em #fff,11px 8px 0 0.020em #fff,12px 8px 0 0.020em #fff,13px 8px 0 0.020em #fff,14px 8px 0 0.020em,15px 8px 0 0.020em,16px 8px 0 0.020em,1px 9px 0 0.020em,2px 9px 0 0.020em,3px 9px 0 0.020em,4px 9px 0 0.020em #fff,5px 9px 0 0.020em #fff,6px 9px 0 0.020em #fff,7px 9px 0 0.020em #fff,8px 9px 0 0.020em #fff,9px 9px 0 0.020em #fff,10px 9px 0 0.020em #fff,11px 9px 0 0.020em #fff,12px 9px 0 0.020em #fff,13px 9px 0 0.020em,14px 9px 0 0.020em,15px 9px 0 0.020em,16px 9px 0 0.020em,1px 10px 0 0.020em,2px 10px 0 0.020em,3px 10px 0 0.020em,4px 10px 0 0.020em,5px 10px 0 0.020em #fff,6px 10px 0 0.020em #fff,7px 10px 0 0.020em #fff,8px 10px 0 0.020em #fff,9px 10px 0 0.020em #fff,10px 10px 0 0.020em #fff,11px 10px 0 0.020em #fff,12px 10px 0 0.020em #fff,13px 10px 0 0.020em,14px 10px 0 0.020em,15px 10px 0 0.020em,16px 10px 0 0.020em,1px 11px 0 0.020em,2px 11px 0 0.020em,3px 11px 0 0.020em,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em #fff,7px 11px 0 0.020em #fff,8px 11px 0 0.020em #fff,9px 11px 0 0.020em #fff,10px 11px 0 0.020em #fff,11px 11px 0 0.020em #fff,12px 11px 0 0.020em #fff,13px 11px 0 0.020em,14px 11px 0 0.020em,15px 11px 0 0.020em,16px 11px 0 0.020em,1px 12px 0 0.020em,2px 12px 0 0.020em,3px 12px 0 0.020em,4px 12px 0 0.020em,5px 12px 0 0.020em #fff,6px 12px 0 0.020em #fff,7px 12px 0 0.020em #fff,8px 12px 0 0.020em #fff,9px 12px 0 0.020em #fff,10px 12px 0 0.020em #fff,11px 12px 0 0.020em #fff,12px 12px 0 0.020em,13px 12px 0 0.020em,14px 12px 0 0.020em,15px 12px 0 0.020em,16px 12px 0 0.020em,1px 13px 0 0.020em,2px 13px 0 0.020em,3px 13px 0 0.020em #fff,4px 13px 0 0.020em #fff,5px 13px 0 0.020em #fff,6px 13px 0 0.020em #fff,7px 13px 0 0.020em #fff,8px 13px 0 0.020em #fff,9px 13px 0 0.020em #fff,10px 13px 0 0.020em,11px 13px 0 0.020em,12px 13px 0 0.020em,13px 13px 0 0.020em,14px 13px 0 0.020em,15px 13px 0 0.020em,16px 13px 0 0.020em,1px 14px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em,4px 14px 0 0.020em #fff,5px 14px 0 0.020em #fff,6px 14px 0 0.020em #fff,7px 14px 0 0.020em,8px 14px 0 0.020em,9px 14px 0 0.020em,10px 14px 0 0.020em,11px 14px 0 0.020em,12px 14px 0 0.020em,13px 14px 0 0.020em,14px 14px 0 0.020em,15px 14px 0 0.020em,16px 14px 0 0.020em,1px 15px 0 0.020em,2px 15px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em,5px 15px 0 0.020em,6px 15px 0 0.020em,7px 15px 0 0.020em,8px 15px 0 0.020em,9px 15px 0 0.020em,10px 15px 0 0.020em,11px 15px 0 0.020em,12px 15px 0 0.020em,13px 15px 0 0.020em,14px 15px 0 0.020em,15px 15px 0 0.020em,16px 15px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,4px 16px 0 0.020em,5px 16px 0 0.020em,6px 16px 0 0.020em,7px 16px 0 0.020em,8px 16px 0 0.020em,9px 16px 0 0.020em,10px 16px 0 0.020em,11px 16px 0 0.020em,12px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.facebook::before { - width: 1px; - height: 1px; - color: #4566ae; - box-shadow: 2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px #fff,12px 2px #fff,13px 2px #fff,14px 2px #fff,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px #fff,11px 3px #fff,12px 3px #fff,13px 3px #fff,14px 3px #fff,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px,4px 4px,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px #fff,10px 4px #fff,11px 4px #fff,12px 4px #fff,13px 4px #fff,14px 4px #fff,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px,4px 5px,5px 5px,6px 5px,7px 5px,8px 5px,9px 5px #fff,10px 5px #fff,11px 5px #fff,12px 5px,13px 5px,14px 5px,15px 5px,16px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px,8px 6px,9px 6px #fff,10px 6px #fff,11px 6px #fff,12px 6px,13px 6px,14px 6px,15px 6px,16px 6px,1px 7px,2px 7px,3px 7px,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px,9px 7px #fff,10px 7px #fff,11px 7px #fff,12px 7px,13px 7px,14px 7px,15px 7px,16px 7px,1px 8px,2px 8px,3px 8px,4px 8px,5px 8px,6px 8px #fff,7px 8px #fff,8px 8px #fff,9px 8px #fff,10px 8px #fff,11px 8px #fff,12px 8px #fff,13px 8px #fff,14px 8px #fff,15px 8px,16px 8px,1px 9px,2px 9px,3px 9px,4px 9px,5px 9px,6px 9px #fff,7px 9px #fff,8px 9px #fff,9px 9px #fff,10px 9px #fff,11px 9px #fff,12px 9px #fff,13px 9px #fff,14px 9px #fff,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px,4px 10px,5px 10px,6px 10px #fff,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px #fff,12px 10px #fff,13px 10px #fff,14px 10px #fff,15px 10px,16px 10px,1px 11px,2px 11px,3px 11px,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px #fff,10px 11px #fff,11px 11px #fff,12px 11px,13px 11px,14px 11px,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px,4px 12px,5px 12px,6px 12px,7px 12px,8px 12px,9px 12px #fff,10px 12px #fff,11px 12px #fff,12px 12px,13px 12px,14px 12px,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px,4px 13px,5px 13px,6px 13px,7px 13px,8px 13px,9px 13px #fff,10px 13px #fff,11px 13px #fff,12px 13px,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,5px 14px,6px 14px,7px 14px,8px 14px,9px 14px #fff,10px 14px #fff,11px 14px #fff,12px 14px,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px #fff,10px 15px #fff,11px 15px #fff,12px 15px,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px #fff,10px 16px #fff,11px 16px #fff,12px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.facebook::before { - box-shadow: 2px 1px 0 0.020em,3px 1px 0 0.020em,4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,15px 1px 0 0.020em,1px 2px 0 0.020em,2px 2px 0 0.020em,3px 2px 0 0.020em,4px 2px 0 0.020em,5px 2px 0 0.020em,6px 2px 0 0.020em,7px 2px 0 0.020em,8px 2px 0 0.020em,9px 2px 0 0.020em,10px 2px 0 0.020em,11px 2px 0 0.020em #fff,12px 2px 0 0.020em #fff,13px 2px 0 0.020em #fff,14px 2px 0 0.020em #fff,15px 2px 0 0.020em,16px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em,3px 3px 0 0.020em,4px 3px 0 0.020em,5px 3px 0 0.020em,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em #fff,11px 3px 0 0.020em #fff,12px 3px 0 0.020em #fff,13px 3px 0 0.020em #fff,14px 3px 0 0.020em #fff,15px 3px 0 0.020em,16px 3px 0 0.020em,1px 4px 0 0.020em,2px 4px 0 0.020em,3px 4px 0 0.020em,4px 4px 0 0.020em,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em,8px 4px 0 0.020em,9px 4px 0 0.020em #fff,10px 4px 0 0.020em #fff,11px 4px 0 0.020em #fff,12px 4px 0 0.020em #fff,13px 4px 0 0.020em #fff,14px 4px 0 0.020em #fff,15px 4px 0 0.020em,16px 4px 0 0.020em,1px 5px 0 0.020em,2px 5px 0 0.020em,3px 5px 0 0.020em,4px 5px 0 0.020em,5px 5px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em,8px 5px 0 0.020em,9px 5px 0 0.020em #fff,10px 5px 0 0.020em #fff,11px 5px 0 0.020em #fff,12px 5px 0 0.020em,13px 5px 0 0.020em,14px 5px 0 0.020em,15px 5px 0 0.020em,16px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em,8px 6px 0 0.020em,9px 6px 0 0.020em #fff,10px 6px 0 0.020em #fff,11px 6px 0 0.020em #fff,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em,16px 6px 0 0.020em,1px 7px 0 0.020em,2px 7px 0 0.020em,3px 7px 0 0.020em,4px 7px 0 0.020em,5px 7px 0 0.020em,6px 7px 0 0.020em,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em #fff,10px 7px 0 0.020em #fff,11px 7px 0 0.020em #fff,12px 7px 0 0.020em,13px 7px 0 0.020em,14px 7px 0 0.020em,15px 7px 0 0.020em,16px 7px 0 0.020em,1px 8px 0 0.020em,2px 8px 0 0.020em,3px 8px 0 0.020em,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em #fff,7px 8px 0 0.020em #fff,8px 8px 0 0.020em #fff,9px 8px 0 0.020em #fff,10px 8px 0 0.020em #fff,11px 8px 0 0.020em #fff,12px 8px 0 0.020em #fff,13px 8px 0 0.020em #fff,14px 8px 0 0.020em #fff,15px 8px 0 0.020em,16px 8px 0 0.020em,1px 9px 0 0.020em,2px 9px 0 0.020em,3px 9px 0 0.020em,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em #fff,7px 9px 0 0.020em #fff,8px 9px 0 0.020em #fff,9px 9px 0 0.020em #fff,10px 9px 0 0.020em #fff,11px 9px 0 0.020em #fff,12px 9px 0 0.020em #fff,13px 9px 0 0.020em #fff,14px 9px 0 0.020em #fff,15px 9px 0 0.020em,16px 9px 0 0.020em,1px 10px 0 0.020em,2px 10px 0 0.020em,3px 10px 0 0.020em,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em #fff,7px 10px 0 0.020em #fff,8px 10px 0 0.020em #fff,9px 10px 0 0.020em #fff,10px 10px 0 0.020em #fff,11px 10px 0 0.020em #fff,12px 10px 0 0.020em #fff,13px 10px 0 0.020em #fff,14px 10px 0 0.020em #fff,15px 10px 0 0.020em,16px 10px 0 0.020em,1px 11px 0 0.020em,2px 11px 0 0.020em,3px 11px 0 0.020em,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em,8px 11px 0 0.020em,9px 11px 0 0.020em #fff,10px 11px 0 0.020em #fff,11px 11px 0 0.020em #fff,12px 11px 0 0.020em,13px 11px 0 0.020em,14px 11px 0 0.020em,15px 11px 0 0.020em,16px 11px 0 0.020em,1px 12px 0 0.020em,2px 12px 0 0.020em,3px 12px 0 0.020em,4px 12px 0 0.020em,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em,8px 12px 0 0.020em,9px 12px 0 0.020em #fff,10px 12px 0 0.020em #fff,11px 12px 0 0.020em #fff,12px 12px 0 0.020em,13px 12px 0 0.020em,14px 12px 0 0.020em,15px 12px 0 0.020em,16px 12px 0 0.020em,1px 13px 0 0.020em,2px 13px 0 0.020em,3px 13px 0 0.020em,4px 13px 0 0.020em,5px 13px 0 0.020em,6px 13px 0 0.020em,7px 13px 0 0.020em,8px 13px 0 0.020em,9px 13px 0 0.020em #fff,10px 13px 0 0.020em #fff,11px 13px 0 0.020em #fff,12px 13px 0 0.020em,13px 13px 0 0.020em,14px 13px 0 0.020em,15px 13px 0 0.020em,16px 13px 0 0.020em,1px 14px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em,4px 14px 0 0.020em,5px 14px 0 0.020em,6px 14px 0 0.020em,7px 14px 0 0.020em,8px 14px 0 0.020em,9px 14px 0 0.020em #fff,10px 14px 0 0.020em #fff,11px 14px 0 0.020em #fff,12px 14px 0 0.020em,13px 14px 0 0.020em,14px 14px 0 0.020em,15px 14px 0 0.020em,16px 14px 0 0.020em,1px 15px 0 0.020em,2px 15px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em,5px 15px 0 0.020em,6px 15px 0 0.020em,7px 15px 0 0.020em,8px 15px 0 0.020em,9px 15px 0 0.020em #fff,10px 15px 0 0.020em #fff,11px 15px 0 0.020em #fff,12px 15px 0 0.020em,13px 15px 0 0.020em,14px 15px 0 0.020em,15px 15px 0 0.020em,16px 15px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,4px 16px 0 0.020em,5px 16px 0 0.020em,6px 16px 0 0.020em,7px 16px 0 0.020em,8px 16px 0 0.020em,9px 16px 0 0.020em #fff,10px 16px 0 0.020em #fff,11px 16px 0 0.020em #fff,12px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.github::before { - width: 1px; - height: 1px; - color: #333; - box-shadow: 2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px #fff,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px,13px 2px,14px 2px #fff,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px,4px 3px,5px 3px #fff,6px 3px #fff,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px #fff,14px 3px #fff,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px,4px 4px,5px 4px #fff,6px 4px #fff,7px 4px #fff,8px 4px #fff,9px 4px #fff,10px 4px #fff,11px 4px #fff,12px 4px #fff,13px 4px #fff,14px 4px #fff,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px,4px 5px #fff,5px 5px #fff,6px 5px #fff,7px 5px #fff,8px 5px #fff,9px 5px #fff,10px 5px #fff,11px 5px #fff,12px 5px #fff,13px 5px #fff,14px 5px #fff,15px 5px #fff,16px 5px,1px 6px,2px 6px,3px 6px,4px 6px #fff,5px 6px #fff,6px 6px #fff,7px 6px #fff,8px 6px #fff,9px 6px #fff,10px 6px #fff,11px 6px #fff,12px 6px #fff,13px 6px #fff,14px 6px #fff,15px 6px #fff,16px 6px,1px 7px,2px 7px,3px 7px,4px 7px #fff,5px 7px #fff,6px 7px #fff,7px 7px #fff,8px 7px #fff,9px 7px #fff,10px 7px #fff,11px 7px #fff,12px 7px #fff,13px 7px #fff,14px 7px #fff,15px 7px #fff,16px 7px,1px 8px,2px 8px,3px 8px,4px 8px #fff,5px 8px #fff,6px 8px #fff,7px 8px #fff,8px 8px #fff,9px 8px #fff,10px 8px #fff,11px 8px #fff,12px 8px #fff,13px 8px #fff,14px 8px #fff,15px 8px #fff,16px 8px,1px 9px,2px 9px,3px 9px,4px 9px,5px 9px #fff,6px 9px #fff,7px 9px #fff,8px 9px #fff,9px 9px #fff,10px 9px #fff,11px 9px #fff,12px 9px #fff,13px 9px #fff,14px 9px #fff,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px,4px 10px,5px 10px,6px 10px #fff,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px #fff,12px 10px #fff,13px 10px #fff,14px 10px,15px 10px,16px 10px,1px 11px,2px 11px #fff,3px 11px #fff,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px #fff,9px 11px #fff,10px 11px #fff,11px 11px #fff,12px 11px,13px 11px,14px 11px,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px,4px 12px #fff,5px 12px,6px 12px,7px 12px #fff,8px 12px #fff,9px 12px #fff,10px 12px #fff,11px 12px #fff,12px 12px #fff,13px 12px,14px 12px,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px,4px 13px,5px 13px #fff,6px 13px #fff,7px 13px #fff,8px 13px #fff,9px 13px #fff,10px 13px #fff,11px 13px #fff,12px 13px #fff,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,5px 14px,6px 14px,7px 14px #fff,8px 14px #fff,9px 14px #fff,10px 14px #fff,11px 14px #fff,12px 14px #fff,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px #fff,8px 15px #fff,9px 15px #fff,10px 15px #fff,11px 15px #fff,12px 15px #fff,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.github::before { - box-shadow: 2px 1px 0 0.020em,3px 1px 0 0.020em,4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,15px 1px 0 0.020em,1px 2px 0 0.020em,2px 2px 0 0.020em,3px 2px 0 0.020em,4px 2px 0 0.020em,5px 2px 0 0.020em #fff,6px 2px 0 0.020em,7px 2px 0 0.020em,8px 2px 0 0.020em,9px 2px 0 0.020em,10px 2px 0 0.020em,11px 2px 0 0.020em,12px 2px 0 0.020em,13px 2px 0 0.020em,14px 2px 0 0.020em #fff,15px 2px 0 0.020em,16px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em,3px 3px 0 0.020em,4px 3px 0 0.020em,5px 3px 0 0.020em #fff,6px 3px 0 0.020em #fff,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em,13px 3px 0 0.020em #fff,14px 3px 0 0.020em #fff,15px 3px 0 0.020em,16px 3px 0 0.020em,1px 4px 0 0.020em,2px 4px 0 0.020em,3px 4px 0 0.020em,4px 4px 0 0.020em,5px 4px 0 0.020em #fff,6px 4px 0 0.020em #fff,7px 4px 0 0.020em #fff,8px 4px 0 0.020em #fff,9px 4px 0 0.020em #fff,10px 4px 0 0.020em #fff,11px 4px 0 0.020em #fff,12px 4px 0 0.020em #fff,13px 4px 0 0.020em #fff,14px 4px 0 0.020em #fff,15px 4px 0 0.020em,16px 4px 0 0.020em,1px 5px 0 0.020em,2px 5px 0 0.020em,3px 5px 0 0.020em,4px 5px 0 0.020em #fff,5px 5px 0 0.020em #fff,6px 5px 0 0.020em #fff,7px 5px 0 0.020em #fff,8px 5px 0 0.020em #fff,9px 5px 0 0.020em #fff,10px 5px 0 0.020em #fff,11px 5px 0 0.020em #fff,12px 5px 0 0.020em #fff,13px 5px 0 0.020em #fff,14px 5px 0 0.020em #fff,15px 5px 0 0.020em #fff,16px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em,4px 6px 0 0.020em #fff,5px 6px 0 0.020em #fff,6px 6px 0 0.020em #fff,7px 6px 0 0.020em #fff,8px 6px 0 0.020em #fff,9px 6px 0 0.020em #fff,10px 6px 0 0.020em #fff,11px 6px 0 0.020em #fff,12px 6px 0 0.020em #fff,13px 6px 0 0.020em #fff,14px 6px 0 0.020em #fff,15px 6px 0 0.020em #fff,16px 6px 0 0.020em,1px 7px 0 0.020em,2px 7px 0 0.020em,3px 7px 0 0.020em,4px 7px 0 0.020em #fff,5px 7px 0 0.020em #fff,6px 7px 0 0.020em #fff,7px 7px 0 0.020em #fff,8px 7px 0 0.020em #fff,9px 7px 0 0.020em #fff,10px 7px 0 0.020em #fff,11px 7px 0 0.020em #fff,12px 7px 0 0.020em #fff,13px 7px 0 0.020em #fff,14px 7px 0 0.020em #fff,15px 7px 0 0.020em #fff,16px 7px 0 0.020em,1px 8px 0 0.020em,2px 8px 0 0.020em,3px 8px 0 0.020em,4px 8px 0 0.020em #fff,5px 8px 0 0.020em #fff,6px 8px 0 0.020em #fff,7px 8px 0 0.020em #fff,8px 8px 0 0.020em #fff,9px 8px 0 0.020em #fff,10px 8px 0 0.020em #fff,11px 8px 0 0.020em #fff,12px 8px 0 0.020em #fff,13px 8px 0 0.020em #fff,14px 8px 0 0.020em #fff,15px 8px 0 0.020em #fff,16px 8px 0 0.020em,1px 9px 0 0.020em,2px 9px 0 0.020em,3px 9px 0 0.020em,4px 9px 0 0.020em,5px 9px 0 0.020em #fff,6px 9px 0 0.020em #fff,7px 9px 0 0.020em #fff,8px 9px 0 0.020em #fff,9px 9px 0 0.020em #fff,10px 9px 0 0.020em #fff,11px 9px 0 0.020em #fff,12px 9px 0 0.020em #fff,13px 9px 0 0.020em #fff,14px 9px 0 0.020em #fff,15px 9px 0 0.020em,16px 9px 0 0.020em,1px 10px 0 0.020em,2px 10px 0 0.020em,3px 10px 0 0.020em,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em #fff,7px 10px 0 0.020em #fff,8px 10px 0 0.020em #fff,9px 10px 0 0.020em #fff,10px 10px 0 0.020em #fff,11px 10px 0 0.020em #fff,12px 10px 0 0.020em #fff,13px 10px 0 0.020em #fff,14px 10px 0 0.020em,15px 10px 0 0.020em,16px 10px 0 0.020em,1px 11px 0 0.020em,2px 11px 0 0.020em #fff,3px 11px 0 0.020em #fff,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em,8px 11px 0 0.020em #fff,9px 11px 0 0.020em #fff,10px 11px 0 0.020em #fff,11px 11px 0 0.020em #fff,12px 11px 0 0.020em,13px 11px 0 0.020em,14px 11px 0 0.020em,15px 11px 0 0.020em,16px 11px 0 0.020em,1px 12px 0 0.020em,2px 12px 0 0.020em,3px 12px 0 0.020em,4px 12px 0 0.020em #fff,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em #fff,8px 12px 0 0.020em #fff,9px 12px 0 0.020em #fff,10px 12px 0 0.020em #fff,11px 12px 0 0.020em #fff,12px 12px 0 0.020em #fff,13px 12px 0 0.020em,14px 12px 0 0.020em,15px 12px 0 0.020em,16px 12px 0 0.020em,1px 13px 0 0.020em,2px 13px 0 0.020em,3px 13px 0 0.020em,4px 13px 0 0.020em,5px 13px 0 0.020em #fff,6px 13px 0 0.020em #fff,7px 13px 0 0.020em #fff,8px 13px 0 0.020em #fff,9px 13px 0 0.020em #fff,10px 13px 0 0.020em #fff,11px 13px 0 0.020em #fff,12px 13px 0 0.020em #fff,13px 13px 0 0.020em,14px 13px 0 0.020em,15px 13px 0 0.020em,16px 13px 0 0.020em,1px 14px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em,4px 14px 0 0.020em,5px 14px 0 0.020em,6px 14px 0 0.020em,7px 14px 0 0.020em #fff,8px 14px 0 0.020em #fff,9px 14px 0 0.020em #fff,10px 14px 0 0.020em #fff,11px 14px 0 0.020em #fff,12px 14px 0 0.020em #fff,13px 14px 0 0.020em,14px 14px 0 0.020em,15px 14px 0 0.020em,16px 14px 0 0.020em,1px 15px 0 0.020em,2px 15px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em,5px 15px 0 0.020em,6px 15px 0 0.020em,7px 15px 0 0.020em #fff,8px 15px 0 0.020em #fff,9px 15px 0 0.020em #fff,10px 15px 0 0.020em #fff,11px 15px 0 0.020em #fff,12px 15px 0 0.020em #fff,13px 15px 0 0.020em,14px 15px 0 0.020em,15px 15px 0 0.020em,16px 15px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,4px 16px 0 0.020em,5px 16px 0 0.020em,6px 16px 0 0.020em,7px 16px 0 0.020em,8px 16px 0 0.020em,9px 16px 0 0.020em,10px 16px 0 0.020em,11px 16px 0 0.020em,12px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.youtube::before { - width: 1px; - height: 1px; - color: #f00; - box-shadow: 2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px,13px 2px,14px 2px,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px,14px 3px,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px,4px 4px,5px 4px,6px 4px,7px 4px #fff,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px,4px 5px,5px 5px,6px 5px,7px 5px #fff,8px 5px #fff,9px 5px,10px 5px,11px 5px,12px 5px,13px 5px,14px 5px,15px 5px,16px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px #fff,8px 6px #fff,9px 6px #fff,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,16px 6px,1px 7px,2px 7px,3px 7px,4px 7px,5px 7px,6px 7px,7px 7px #fff,8px 7px #fff,9px 7px #fff,10px 7px #fff,11px 7px,12px 7px,13px 7px,14px 7px,15px 7px,16px 7px,1px 8px,2px 8px,3px 8px,4px 8px,5px 8px,6px 8px,7px 8px #fff,8px 8px #fff,9px 8px #fff,10px 8px #fff,11px 8px #fff,12px 8px,13px 8px,14px 8px,15px 8px,16px 8px,1px 9px,2px 9px,3px 9px,4px 9px,5px 9px,6px 9px,7px 9px #fff,8px 9px #fff,9px 9px #fff,10px 9px #fff,11px 9px,12px 9px,13px 9px,14px 9px,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px,4px 10px,5px 10px,6px 10px,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px,11px 10px,12px 10px,13px 10px,14px 10px,15px 10px,16px 10px,1px 11px,2px 11px,3px 11px,4px 11px,5px 11px,6px 11px,7px 11px #fff,8px 11px #fff,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px,14px 11px,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px,4px 12px,5px 12px,6px 12px,7px 12px #fff,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px,13px 12px,14px 12px,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px,4px 13px,5px 13px,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,5px 14px,6px 14px,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.youtube::before { - box-shadow: 2px 1px 0 0.020em,3px 1px 0 0.020em,4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,15px 1px 0 0.020em,1px 2px 0 0.020em,2px 2px 0 0.020em,3px 2px 0 0.020em,4px 2px 0 0.020em,5px 2px 0 0.020em,6px 2px 0 0.020em,7px 2px 0 0.020em,8px 2px 0 0.020em,9px 2px 0 0.020em,10px 2px 0 0.020em,11px 2px 0 0.020em,12px 2px 0 0.020em,13px 2px 0 0.020em,14px 2px 0 0.020em,15px 2px 0 0.020em,16px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em,3px 3px 0 0.020em,4px 3px 0 0.020em,5px 3px 0 0.020em,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em,13px 3px 0 0.020em,14px 3px 0 0.020em,15px 3px 0 0.020em,16px 3px 0 0.020em,1px 4px 0 0.020em,2px 4px 0 0.020em,3px 4px 0 0.020em,4px 4px 0 0.020em,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em #fff,8px 4px 0 0.020em,9px 4px 0 0.020em,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em,13px 4px 0 0.020em,14px 4px 0 0.020em,15px 4px 0 0.020em,16px 4px 0 0.020em,1px 5px 0 0.020em,2px 5px 0 0.020em,3px 5px 0 0.020em,4px 5px 0 0.020em,5px 5px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em #fff,8px 5px 0 0.020em #fff,9px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em,12px 5px 0 0.020em,13px 5px 0 0.020em,14px 5px 0 0.020em,15px 5px 0 0.020em,16px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em #fff,8px 6px 0 0.020em #fff,9px 6px 0 0.020em #fff,10px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em,16px 6px 0 0.020em,1px 7px 0 0.020em,2px 7px 0 0.020em,3px 7px 0 0.020em,4px 7px 0 0.020em,5px 7px 0 0.020em,6px 7px 0 0.020em,7px 7px 0 0.020em #fff,8px 7px 0 0.020em #fff,9px 7px 0 0.020em #fff,10px 7px 0 0.020em #fff,11px 7px 0 0.020em,12px 7px 0 0.020em,13px 7px 0 0.020em,14px 7px 0 0.020em,15px 7px 0 0.020em,16px 7px 0 0.020em,1px 8px 0 0.020em,2px 8px 0 0.020em,3px 8px 0 0.020em,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em,7px 8px 0 0.020em #fff,8px 8px 0 0.020em #fff,9px 8px 0 0.020em #fff,10px 8px 0 0.020em #fff,11px 8px 0 0.020em #fff,12px 8px 0 0.020em,13px 8px 0 0.020em,14px 8px 0 0.020em,15px 8px 0 0.020em,16px 8px 0 0.020em,1px 9px 0 0.020em,2px 9px 0 0.020em,3px 9px 0 0.020em,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em,7px 9px 0 0.020em #fff,8px 9px 0 0.020em #fff,9px 9px 0 0.020em #fff,10px 9px 0 0.020em #fff,11px 9px 0 0.020em,12px 9px 0 0.020em,13px 9px 0 0.020em,14px 9px 0 0.020em,15px 9px 0 0.020em,16px 9px 0 0.020em,1px 10px 0 0.020em,2px 10px 0 0.020em,3px 10px 0 0.020em,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em,7px 10px 0 0.020em #fff,8px 10px 0 0.020em #fff,9px 10px 0 0.020em #fff,10px 10px 0 0.020em,11px 10px 0 0.020em,12px 10px 0 0.020em,13px 10px 0 0.020em,14px 10px 0 0.020em,15px 10px 0 0.020em,16px 10px 0 0.020em,1px 11px 0 0.020em,2px 11px 0 0.020em,3px 11px 0 0.020em,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em #fff,8px 11px 0 0.020em #fff,9px 11px 0 0.020em,10px 11px 0 0.020em,11px 11px 0 0.020em,12px 11px 0 0.020em,13px 11px 0 0.020em,14px 11px 0 0.020em,15px 11px 0 0.020em,16px 11px 0 0.020em,1px 12px 0 0.020em,2px 12px 0 0.020em,3px 12px 0 0.020em,4px 12px 0 0.020em,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em #fff,8px 12px 0 0.020em,9px 12px 0 0.020em,10px 12px 0 0.020em,11px 12px 0 0.020em,12px 12px 0 0.020em,13px 12px 0 0.020em,14px 12px 0 0.020em,15px 12px 0 0.020em,16px 12px 0 0.020em,1px 13px 0 0.020em,2px 13px 0 0.020em,3px 13px 0 0.020em,4px 13px 0 0.020em,5px 13px 0 0.020em,6px 13px 0 0.020em,7px 13px 0 0.020em,8px 13px 0 0.020em,9px 13px 0 0.020em,10px 13px 0 0.020em,11px 13px 0 0.020em,12px 13px 0 0.020em,13px 13px 0 0.020em,14px 13px 0 0.020em,15px 13px 0 0.020em,16px 13px 0 0.020em,1px 14px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em,4px 14px 0 0.020em,5px 14px 0 0.020em,6px 14px 0 0.020em,7px 14px 0 0.020em,8px 14px 0 0.020em,9px 14px 0 0.020em,10px 14px 0 0.020em,11px 14px 0 0.020em,12px 14px 0 0.020em,13px 14px 0 0.020em,14px 14px 0 0.020em,15px 14px 0 0.020em,16px 14px 0 0.020em,1px 15px 0 0.020em,2px 15px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em,5px 15px 0 0.020em,6px 15px 0 0.020em,7px 15px 0 0.020em,8px 15px 0 0.020em,9px 15px 0 0.020em,10px 15px 0 0.020em,11px 15px 0 0.020em,12px 15px 0 0.020em,13px 15px 0 0.020em,14px 15px 0 0.020em,15px 15px 0 0.020em,16px 15px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,4px 16px 0 0.020em,5px 16px 0 0.020em,6px 16px 0 0.020em,7px 16px 0 0.020em,8px 16px 0 0.020em,9px 16px 0 0.020em,10px 16px 0 0.020em,11px 16px 0 0.020em,12px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.close::before { - width: 1px; - height: 1px; - color: #212529; - box-shadow: 1px 1px,2px 1px,3px 1px,4px 1px,13px 1px,14px 1px,15px 1px,16px 1px,1px 2px,2px 2px,3px 2px,4px 2px,13px 2px,14px 2px,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px,4px 3px,13px 3px,14px 3px,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px,4px 4px,5px 4px,6px 4px,7px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px,15px 4px,16px 4px,4px 5px,5px 5px,6px 5px,7px 5px,10px 5px,11px 5px,12px 5px,13px 5px,4px 6px,5px 6px,6px 6px,7px 6px,10px 6px,11px 6px,12px 6px,13px 6px,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,7px 8px,8px 8px,9px 8px,10px 8px,7px 9px,8px 9px,9px 9px,10px 9px,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px,12px 10px,13px 10px,4px 11px,5px 11px,6px 11px,7px 11px,10px 11px,11px 11px,12px 11px,13px 11px,4px 12px,5px 12px,6px 12px,7px 12px,10px 12px,11px 12px,12px 12px,13px 12px,1px 13px,2px 13px,3px 13px,4px 13px,5px 13px,6px 13px,7px 13px,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,13px 15px,14px 15px,15px 15px,16px 15px,1px 16px,2px 16px,3px 16px,4px 16px,13px 16px,14px 16px,15px 16px,16px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.close::before { - box-shadow: 1px 1px 0 0.020em,2px 1px 0 0.020em,3px 1px 0 0.020em,4px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,15px 1px 0 0.020em,16px 1px 0 0.020em,1px 2px 0 0.020em,2px 2px 0 0.020em,3px 2px 0 0.020em,4px 2px 0 0.020em,13px 2px 0 0.020em,14px 2px 0 0.020em,15px 2px 0 0.020em,16px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em,3px 3px 0 0.020em,4px 3px 0 0.020em,13px 3px 0 0.020em,14px 3px 0 0.020em,15px 3px 0 0.020em,16px 3px 0 0.020em,1px 4px 0 0.020em,2px 4px 0 0.020em,3px 4px 0 0.020em,4px 4px 0 0.020em,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em,13px 4px 0 0.020em,14px 4px 0 0.020em,15px 4px 0 0.020em,16px 4px 0 0.020em,4px 5px 0 0.020em,5px 5px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em,12px 5px 0 0.020em,13px 5px 0 0.020em,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,4px 7px 0 0.020em,5px 7px 0 0.020em,6px 7px 0 0.020em,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em,11px 7px 0 0.020em,12px 7px 0 0.020em,13px 7px 0 0.020em,7px 8px 0 0.020em,8px 8px 0 0.020em,9px 8px 0 0.020em,10px 8px 0 0.020em,7px 9px 0 0.020em,8px 9px 0 0.020em,9px 9px 0 0.020em,10px 9px 0 0.020em,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em,7px 10px 0 0.020em,8px 10px 0 0.020em,9px 10px 0 0.020em,10px 10px 0 0.020em,11px 10px 0 0.020em,12px 10px 0 0.020em,13px 10px 0 0.020em,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em,10px 11px 0 0.020em,11px 11px 0 0.020em,12px 11px 0 0.020em,13px 11px 0 0.020em,4px 12px 0 0.020em,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em,10px 12px 0 0.020em,11px 12px 0 0.020em,12px 12px 0 0.020em,13px 12px 0 0.020em,1px 13px 0 0.020em,2px 13px 0 0.020em,3px 13px 0 0.020em,4px 13px 0 0.020em,5px 13px 0 0.020em,6px 13px 0 0.020em,7px 13px 0 0.020em,10px 13px 0 0.020em,11px 13px 0 0.020em,12px 13px 0 0.020em,13px 13px 0 0.020em,14px 13px 0 0.020em,15px 13px 0 0.020em,16px 13px 0 0.020em,1px 14px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em,4px 14px 0 0.020em,13px 14px 0 0.020em,14px 14px 0 0.020em,15px 14px 0 0.020em,16px 14px 0 0.020em,1px 15px 0 0.020em,2px 15px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em,13px 15px 0 0.020em,14px 15px 0 0.020em,15px 15px 0 0.020em,16px 15px 0 0.020em,1px 16px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,4px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em,16px 16px 0 0.020em; - } -} - -.nes-icon.google::before { - width: 1px; - height: 1px; - color: #fff; - box-shadow: 2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px #db4437,7px 2px #db4437,8px 2px #db4437,9px 2px #db4437,10px 2px #db4437,11px 2px #db4437,12px 2px,13px 2px,14px 2px,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px,4px 3px #db4437,5px 3px #db4437,6px 3px #db4437,7px 3px #db4437,8px 3px #db4437,9px 3px #db4437,10px 3px #db4437,11px 3px #db4437,12px 3px #db4437,13px 3px #db4437,14px 3px,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px #db4437,4px 4px #db4437,5px 4px #db4437,6px 4px #db4437,7px 4px #db4437,8px 4px #db4437,9px 4px #db4437,10px 4px #db4437,11px 4px #db4437,12px 4px #db4437,13px 4px,14px 4px,15px 4px,16px 4px,1px 5px,2px 5px #db4437,3px 5px #db4437,4px 5px #db4437,5px 5px #db4437,6px 5px,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px #db4437,12px 5px,13px 5px,14px 5px,15px 5px,16px 5px,1px 6px #f4b400,2px 6px #db4437,3px 6px #db4437,4px 6px #db4437,5px 6px,6px 6px,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,16px 6px,1px 7px #f4b400,2px 7px #f4b400,3px 7px #db4437,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,14px 7px,15px 7px,16px 7px,1px 8px #f4b400,2px 8px #f4b400,3px 8px #f4b400,4px 8px,5px 8px,6px 8px,7px 8px,8px 8px,9px 8px #4285f4,10px 8px #4285f4,11px 8px #4285f4,12px 8px #4285f4,13px 8px #4285f4,14px 8px #4285f4,15px 8px #4285f4,16px 8px,1px 9px #f4b400,2px 9px #f4b400,3px 9px #f4b400,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px,9px 9px #4285f4,10px 9px #4285f4,11px 9px #4285f4,12px 9px #4285f4,13px 9px #4285f4,14px 9px #4285f4,15px 9px #4285f4,16px 9px,1px 10px #f4b400,2px 10px #f4b400,3px 10px #f4b400,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px #4285f4,10px 10px #4285f4,11px 10px #4285f4,12px 10px #4285f4,13px 10px #4285f4,14px 10px #4285f4,15px 10px #4285f4,16px 10px,1px 11px #f4b400,2px 11px #f4b400,3px 11px #0f9d58,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px #4285f4,14px 11px #4285f4,15px 11px #4285f4,16px 11px,1px 12px #f4b400,2px 12px #0f9d58,3px 12px #0f9d58,4px 12px #0f9d58,5px 12px,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px #4285f4,13px 12px #4285f4,14px 12px #4285f4,15px 12px #4285f4,16px 12px,1px 13px,2px 13px #0f9d58,3px 13px #0f9d58,4px 13px #0f9d58,5px 13px #0f9d58,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px #0f9d58,12px 13px #4285f4,13px 13px #4285f4,14px 13px #4285f4,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px #0f9d58,4px 14px #0f9d58,5px 14px #0f9d58,6px 14px #0f9d58,7px 14px #0f9d58,8px 14px #0f9d58,9px 14px #0f9d58,10px 14px #0f9d58,11px 14px #0f9d58,12px 14px #0f9d58,13px 14px #4285f4,14px 14px #4285f4,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px #0f9d58,5px 15px #0f9d58,6px 15px #0f9d58,7px 15px #0f9d58,8px 15px #0f9d58,9px 15px #0f9d58,10px 15px #0f9d58,11px 15px #0f9d58,12px 15px #0f9d58,13px 15px #0f9d58,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px #0f9d58,7px 16px #0f9d58,8px 16px #0f9d58,9px 16px #0f9d58,10px 16px #0f9d58,11px 16px #0f9d58,12px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.google::before { - box-shadow: 2px 1px 0 0.020em,3px 1px 0 0.020em,4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,15px 1px 0 0.020em,1px 2px 0 0.020em,2px 2px 0 0.020em,3px 2px 0 0.020em,4px 2px 0 0.020em,5px 2px 0 0.020em,6px 2px 0 0.020em #db4437,7px 2px 0 0.020em #db4437,8px 2px 0 0.020em #db4437,9px 2px 0 0.020em #db4437,10px 2px 0 0.020em #db4437,11px 2px 0 0.020em #db4437,12px 2px 0 0.020em,13px 2px 0 0.020em,14px 2px 0 0.020em,15px 2px 0 0.020em,16px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em,3px 3px 0 0.020em,4px 3px 0 0.020em #db4437,5px 3px 0 0.020em #db4437,6px 3px 0 0.020em #db4437,7px 3px 0 0.020em #db4437,8px 3px 0 0.020em #db4437,9px 3px 0 0.020em #db4437,10px 3px 0 0.020em #db4437,11px 3px 0 0.020em #db4437,12px 3px 0 0.020em #db4437,13px 3px 0 0.020em #db4437,14px 3px 0 0.020em,15px 3px 0 0.020em,16px 3px 0 0.020em,1px 4px 0 0.020em,2px 4px 0 0.020em,3px 4px 0 0.020em #db4437,4px 4px 0 0.020em #db4437,5px 4px 0 0.020em #db4437,6px 4px 0 0.020em #db4437,7px 4px 0 0.020em #db4437,8px 4px 0 0.020em #db4437,9px 4px 0 0.020em #db4437,10px 4px 0 0.020em #db4437,11px 4px 0 0.020em #db4437,12px 4px 0 0.020em #db4437,13px 4px 0 0.020em,14px 4px 0 0.020em,15px 4px 0 0.020em,16px 4px 0 0.020em,1px 5px 0 0.020em,2px 5px 0 0.020em #db4437,3px 5px 0 0.020em #db4437,4px 5px 0 0.020em #db4437,5px 5px 0 0.020em #db4437,6px 5px 0 0.020em,7px 5px 0 0.020em,8px 5px 0 0.020em,9px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em #db4437,12px 5px 0 0.020em,13px 5px 0 0.020em,14px 5px 0 0.020em,15px 5px 0 0.020em,16px 5px 0 0.020em,1px 6px 0 0.020em #f4b400,2px 6px 0 0.020em #db4437,3px 6px 0 0.020em #db4437,4px 6px 0 0.020em #db4437,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em,8px 6px 0 0.020em,9px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em,16px 6px 0 0.020em,1px 7px 0 0.020em #f4b400,2px 7px 0 0.020em #f4b400,3px 7px 0 0.020em #db4437,4px 7px 0 0.020em,5px 7px 0 0.020em,6px 7px 0 0.020em,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em,11px 7px 0 0.020em,12px 7px 0 0.020em,13px 7px 0 0.020em,14px 7px 0 0.020em,15px 7px 0 0.020em,16px 7px 0 0.020em,1px 8px 0 0.020em #f4b400,2px 8px 0 0.020em #f4b400,3px 8px 0 0.020em #f4b400,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em,7px 8px 0 0.020em,8px 8px 0 0.020em,9px 8px 0 0.020em #4285f4,10px 8px 0 0.020em #4285f4,11px 8px 0 0.020em #4285f4,12px 8px 0 0.020em #4285f4,13px 8px 0 0.020em #4285f4,14px 8px 0 0.020em #4285f4,15px 8px 0 0.020em #4285f4,16px 8px 0 0.020em,1px 9px 0 0.020em #f4b400,2px 9px 0 0.020em #f4b400,3px 9px 0 0.020em #f4b400,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em,7px 9px 0 0.020em,8px 9px 0 0.020em,9px 9px 0 0.020em #4285f4,10px 9px 0 0.020em #4285f4,11px 9px 0 0.020em #4285f4,12px 9px 0 0.020em #4285f4,13px 9px 0 0.020em #4285f4,14px 9px 0 0.020em #4285f4,15px 9px 0 0.020em #4285f4,16px 9px 0 0.020em,1px 10px 0 0.020em #f4b400,2px 10px 0 0.020em #f4b400,3px 10px 0 0.020em #f4b400,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em,7px 10px 0 0.020em,8px 10px 0 0.020em,9px 10px 0 0.020em #4285f4,10px 10px 0 0.020em #4285f4,11px 10px 0 0.020em #4285f4,12px 10px 0 0.020em #4285f4,13px 10px 0 0.020em #4285f4,14px 10px 0 0.020em #4285f4,15px 10px 0 0.020em #4285f4,16px 10px 0 0.020em,1px 11px 0 0.020em #f4b400,2px 11px 0 0.020em #f4b400,3px 11px 0 0.020em #0f9d58,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em,8px 11px 0 0.020em,9px 11px 0 0.020em,10px 11px 0 0.020em,11px 11px 0 0.020em,12px 11px 0 0.020em,13px 11px 0 0.020em #4285f4,14px 11px 0 0.020em #4285f4,15px 11px 0 0.020em #4285f4,16px 11px 0 0.020em,1px 12px 0 0.020em #f4b400,2px 12px 0 0.020em #0f9d58,3px 12px 0 0.020em #0f9d58,4px 12px 0 0.020em #0f9d58,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em,8px 12px 0 0.020em,9px 12px 0 0.020em,10px 12px 0 0.020em,11px 12px 0 0.020em,12px 12px 0 0.020em #4285f4,13px 12px 0 0.020em #4285f4,14px 12px 0 0.020em #4285f4,15px 12px 0 0.020em #4285f4,16px 12px 0 0.020em,1px 13px 0 0.020em,2px 13px 0 0.020em #0f9d58,3px 13px 0 0.020em #0f9d58,4px 13px 0 0.020em #0f9d58,5px 13px 0 0.020em #0f9d58,6px 13px 0 0.020em,7px 13px 0 0.020em,8px 13px 0 0.020em,9px 13px 0 0.020em,10px 13px 0 0.020em,11px 13px 0 0.020em #0f9d58,12px 13px 0 0.020em #4285f4,13px 13px 0 0.020em #4285f4,14px 13px 0 0.020em #4285f4,15px 13px 0 0.020em,16px 13px 0 0.020em,1px 14px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em #0f9d58,4px 14px 0 0.020em #0f9d58,5px 14px 0 0.020em #0f9d58,6px 14px 0 0.020em #0f9d58,7px 14px 0 0.020em #0f9d58,8px 14px 0 0.020em #0f9d58,9px 14px 0 0.020em #0f9d58,10px 14px 0 0.020em #0f9d58,11px 14px 0 0.020em #0f9d58,12px 14px 0 0.020em #0f9d58,13px 14px 0 0.020em #4285f4,14px 14px 0 0.020em #4285f4,15px 14px 0 0.020em,16px 14px 0 0.020em,1px 15px 0 0.020em,2px 15px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em #0f9d58,5px 15px 0 0.020em #0f9d58,6px 15px 0 0.020em #0f9d58,7px 15px 0 0.020em #0f9d58,8px 15px 0 0.020em #0f9d58,9px 15px 0 0.020em #0f9d58,10px 15px 0 0.020em #0f9d58,11px 15px 0 0.020em #0f9d58,12px 15px 0 0.020em #0f9d58,13px 15px 0 0.020em #0f9d58,14px 15px 0 0.020em,15px 15px 0 0.020em,16px 15px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,4px 16px 0 0.020em,5px 16px 0 0.020em,6px 16px 0 0.020em #0f9d58,7px 16px 0 0.020em #0f9d58,8px 16px 0 0.020em #0f9d58,9px 16px 0 0.020em #0f9d58,10px 16px 0 0.020em #0f9d58,11px 16px 0 0.020em #0f9d58,12px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.medium::before { - width: 1px; - height: 1px; - color: #12100e; - box-shadow: 2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px #fff,3px 2px #fff,4px 2px #fff,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px #fff,13px 2px #fff,14px 2px #fff,15px 2px #fff,16px 2px,1px 3px,2px 3px,3px 3px #fff,4px 3px #fff,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px #fff,13px 3px #fff,14px 3px #fff,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px #fff,4px 4px #fff,5px 4px #fff,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px #fff,13px 4px #fff,14px 4px #fff,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px #fff,4px 5px #fff,5px 5px #fff,6px 5px #fff,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px #fff,12px 5px #fff,13px 5px #fff,14px 5px #fff,15px 5px,16px 5px,1px 6px,2px 6px,3px 6px #fff,4px 6px #fff,5px 6px #fff,6px 6px #fff,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px #fff,12px 6px #fff,13px 6px #fff,14px 6px #fff,15px 6px,16px 6px,1px 7px,2px 7px,3px 7px #fff,4px 7px #fff,5px 7px #fff,6px 7px #fff,7px 7px,8px 7px,9px 7px,10px 7px #fff,11px 7px #fff,12px 7px #fff,13px 7px #fff,14px 7px #fff,15px 7px,16px 7px,1px 8px,2px 8px,3px 8px #fff,4px 8px,5px 8px #fff,6px 8px #fff,7px 8px #fff,8px 8px,9px 8px,10px 8px #fff,11px 8px #fff,12px 8px #fff,13px 8px #fff,14px 8px #fff,15px 8px,16px 8px,1px 9px,2px 9px,3px 9px #fff,4px 9px,5px 9px #fff,6px 9px #fff,7px 9px #fff,8px 9px,9px 9px #fff,10px 9px #fff,11px 9px,12px 9px #fff,13px 9px #fff,14px 9px #fff,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px #fff,4px 10px,5px 10px,6px 10px #fff,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px,12px 10px #fff,13px 10px #fff,14px 10px #fff,15px 10px,16px 10px,1px 11px,2px 11px,3px 11px #fff,4px 11px,5px 11px,6px 11px #fff,7px 11px #fff,8px 11px #fff,9px 11px #fff,10px 11px,11px 11px,12px 11px #fff,13px 11px #fff,14px 11px #fff,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px #fff,4px 12px,5px 12px,6px 12px,7px 12px #fff,8px 12px #fff,9px 12px #fff,10px 12px,11px 12px,12px 12px #fff,13px 12px #fff,14px 12px #fff,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px #fff,4px 13px,5px 13px,6px 13px,7px 13px #fff,8px 13px #fff,9px 13px,10px 13px,11px 13px,12px 13px #fff,13px 13px #fff,14px 13px #fff,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px #fff,4px 14px,5px 14px,6px 14px,7px 14px,8px 14px #fff,9px 14px,10px 14px,11px 14px,12px 14px #fff,13px 14px #fff,14px 14px #fff,15px 14px,16px 14px,1px 15px,2px 15px #fff,3px 15px #fff,4px 15px #fff,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px #fff,12px 15px #fff,13px 15px #fff,14px 15px #fff,15px 15px #fff,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.medium::before { - box-shadow: 2px 1px 0 0.020em,3px 1px 0 0.020em,4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,15px 1px 0 0.020em,1px 2px 0 0.020em,2px 2px 0 0.020em #fff,3px 2px 0 0.020em #fff,4px 2px 0 0.020em #fff,5px 2px 0 0.020em,6px 2px 0 0.020em,7px 2px 0 0.020em,8px 2px 0 0.020em,9px 2px 0 0.020em,10px 2px 0 0.020em,11px 2px 0 0.020em,12px 2px 0 0.020em #fff,13px 2px 0 0.020em #fff,14px 2px 0 0.020em #fff,15px 2px 0 0.020em #fff,16px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em,3px 3px 0 0.020em #fff,4px 3px 0 0.020em #fff,5px 3px 0 0.020em,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em #fff,13px 3px 0 0.020em #fff,14px 3px 0 0.020em #fff,15px 3px 0 0.020em,16px 3px 0 0.020em,1px 4px 0 0.020em,2px 4px 0 0.020em,3px 4px 0 0.020em #fff,4px 4px 0 0.020em #fff,5px 4px 0 0.020em #fff,6px 4px 0 0.020em,7px 4px 0 0.020em,8px 4px 0 0.020em,9px 4px 0 0.020em,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em #fff,13px 4px 0 0.020em #fff,14px 4px 0 0.020em #fff,15px 4px 0 0.020em,16px 4px 0 0.020em,1px 5px 0 0.020em,2px 5px 0 0.020em,3px 5px 0 0.020em #fff,4px 5px 0 0.020em #fff,5px 5px 0 0.020em #fff,6px 5px 0 0.020em #fff,7px 5px 0 0.020em,8px 5px 0 0.020em,9px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em #fff,12px 5px 0 0.020em #fff,13px 5px 0 0.020em #fff,14px 5px 0 0.020em #fff,15px 5px 0 0.020em,16px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em #fff,4px 6px 0 0.020em #fff,5px 6px 0 0.020em #fff,6px 6px 0 0.020em #fff,7px 6px 0 0.020em,8px 6px 0 0.020em,9px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em #fff,12px 6px 0 0.020em #fff,13px 6px 0 0.020em #fff,14px 6px 0 0.020em #fff,15px 6px 0 0.020em,16px 6px 0 0.020em,1px 7px 0 0.020em,2px 7px 0 0.020em,3px 7px 0 0.020em #fff,4px 7px 0 0.020em #fff,5px 7px 0 0.020em #fff,6px 7px 0 0.020em #fff,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em #fff,11px 7px 0 0.020em #fff,12px 7px 0 0.020em #fff,13px 7px 0 0.020em #fff,14px 7px 0 0.020em #fff,15px 7px 0 0.020em,16px 7px 0 0.020em,1px 8px 0 0.020em,2px 8px 0 0.020em,3px 8px 0 0.020em #fff,4px 8px 0 0.020em,5px 8px 0 0.020em #fff,6px 8px 0 0.020em #fff,7px 8px 0 0.020em #fff,8px 8px 0 0.020em,9px 8px 0 0.020em,10px 8px 0 0.020em #fff,11px 8px 0 0.020em #fff,12px 8px 0 0.020em #fff,13px 8px 0 0.020em #fff,14px 8px 0 0.020em #fff,15px 8px 0 0.020em,16px 8px 0 0.020em,1px 9px 0 0.020em,2px 9px 0 0.020em,3px 9px 0 0.020em #fff,4px 9px 0 0.020em,5px 9px 0 0.020em #fff,6px 9px 0 0.020em #fff,7px 9px 0 0.020em #fff,8px 9px 0 0.020em,9px 9px 0 0.020em #fff,10px 9px 0 0.020em #fff,11px 9px 0 0.020em,12px 9px 0 0.020em #fff,13px 9px 0 0.020em #fff,14px 9px 0 0.020em #fff,15px 9px 0 0.020em,16px 9px 0 0.020em,1px 10px 0 0.020em,2px 10px 0 0.020em,3px 10px 0 0.020em #fff,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em #fff,7px 10px 0 0.020em #fff,8px 10px 0 0.020em #fff,9px 10px 0 0.020em #fff,10px 10px 0 0.020em #fff,11px 10px 0 0.020em,12px 10px 0 0.020em #fff,13px 10px 0 0.020em #fff,14px 10px 0 0.020em #fff,15px 10px 0 0.020em,16px 10px 0 0.020em,1px 11px 0 0.020em,2px 11px 0 0.020em,3px 11px 0 0.020em #fff,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em #fff,7px 11px 0 0.020em #fff,8px 11px 0 0.020em #fff,9px 11px 0 0.020em #fff,10px 11px 0 0.020em,11px 11px 0 0.020em,12px 11px 0 0.020em #fff,13px 11px 0 0.020em #fff,14px 11px 0 0.020em #fff,15px 11px 0 0.020em,16px 11px 0 0.020em,1px 12px 0 0.020em,2px 12px 0 0.020em,3px 12px 0 0.020em #fff,4px 12px 0 0.020em,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em #fff,8px 12px 0 0.020em #fff,9px 12px 0 0.020em #fff,10px 12px 0 0.020em,11px 12px 0 0.020em,12px 12px 0 0.020em #fff,13px 12px 0 0.020em #fff,14px 12px 0 0.020em #fff,15px 12px 0 0.020em,16px 12px 0 0.020em,1px 13px 0 0.020em,2px 13px 0 0.020em,3px 13px 0 0.020em #fff,4px 13px 0 0.020em,5px 13px 0 0.020em,6px 13px 0 0.020em,7px 13px 0 0.020em #fff,8px 13px 0 0.020em #fff,9px 13px 0 0.020em,10px 13px 0 0.020em,11px 13px 0 0.020em,12px 13px 0 0.020em #fff,13px 13px 0 0.020em #fff,14px 13px 0 0.020em #fff,15px 13px 0 0.020em,16px 13px 0 0.020em,1px 14px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em #fff,4px 14px 0 0.020em,5px 14px 0 0.020em,6px 14px 0 0.020em,7px 14px 0 0.020em,8px 14px 0 0.020em #fff,9px 14px 0 0.020em,10px 14px 0 0.020em,11px 14px 0 0.020em,12px 14px 0 0.020em #fff,13px 14px 0 0.020em #fff,14px 14px 0 0.020em #fff,15px 14px 0 0.020em,16px 14px 0 0.020em,1px 15px 0 0.020em,2px 15px 0 0.020em #fff,3px 15px 0 0.020em #fff,4px 15px 0 0.020em #fff,5px 15px 0 0.020em,6px 15px 0 0.020em,7px 15px 0 0.020em,8px 15px 0 0.020em,9px 15px 0 0.020em,10px 15px 0 0.020em,11px 15px 0 0.020em #fff,12px 15px 0 0.020em #fff,13px 15px 0 0.020em #fff,14px 15px 0 0.020em #fff,15px 15px 0 0.020em #fff,16px 15px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,4px 16px 0 0.020em,5px 16px 0 0.020em,6px 16px 0 0.020em,7px 16px 0 0.020em,8px 16px 0 0.020em,9px 16px 0 0.020em,10px 16px 0 0.020em,11px 16px 0 0.020em,12px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.twitch::before { - width: 1px; - height: 1px; - color: #6441a4; - box-shadow: 2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px #fff,4px 2px #fff,5px 2px #fff,6px 2px #fff,7px 2px #fff,8px 2px #fff,9px 2px #fff,10px 2px #fff,11px 2px #fff,12px 2px #fff,13px 2px #fff,14px 2px #fff,15px 2px #fff,16px 2px,1px 3px,2px 3px #fff,3px 3px #fff,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px,14px 3px,15px 3px #fff,16px 3px,1px 4px,2px 4px #fff,3px 4px #fff,4px 4px,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px,15px 4px #fff,16px 4px,1px 5px,2px 5px #fff,3px 5px #fff,4px 5px,5px 5px,6px 5px,7px 5px,8px 5px #fff,9px 5px,10px 5px,11px 5px #fff,12px 5px,13px 5px,14px 5px,15px 5px #fff,16px 5px,1px 6px,2px 6px #fff,3px 6px #fff,4px 6px,5px 6px,6px 6px,7px 6px,8px 6px #fff,9px 6px,10px 6px,11px 6px #fff,12px 6px,13px 6px,14px 6px,15px 6px #fff,16px 6px,1px 7px,2px 7px #fff,3px 7px #fff,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px #fff,9px 7px,10px 7px,11px 7px #fff,12px 7px,13px 7px,14px 7px,15px 7px #fff,16px 7px,1px 8px,2px 8px #fff,3px 8px #fff,4px 8px,5px 8px,6px 8px,7px 8px,8px 8px #fff,9px 8px,10px 8px,11px 8px #fff,12px 8px,13px 8px,14px 8px,15px 8px #fff,16px 8px,1px 9px,2px 9px #fff,3px 9px #fff,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px,12px 9px,13px 9px,14px 9px,15px 9px #fff,16px 9px,1px 10px,2px 10px #fff,3px 10px #fff,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px,12px 10px,13px 10px,14px 10px #fff,15px 10px #fff,16px 10px,1px 11px,2px 11px #fff,3px 11px #fff,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px #fff,14px 11px #fff,15px 11px,16px 11px,1px 12px,2px 12px #fff,3px 12px #fff,4px 12px #fff,5px 12px #fff,6px 12px,7px 12px,8px 12px #fff,9px 12px #fff,10px 12px #fff,11px 12px #fff,12px 12px #fff,13px 12px #fff,14px 12px,15px 12px,16px 12px,1px 13px,2px 13px #fff,3px 13px #fff,4px 13px #fff,5px 13px #fff,6px 13px,7px 13px #fff,8px 13px #fff,9px 13px #fff,10px 13px #fff,11px 13px #fff,12px 13px #fff,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,5px 14px #fff,6px 14px #fff,7px 14px #fff,8px 14px #fff,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px #fff,6px 15px #fff,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.twitch::before { - box-shadow: 2px 1px 0 0.020em,3px 1px 0 0.020em,4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,15px 1px 0 0.020em,1px 2px 0 0.020em,2px 2px 0 0.020em,3px 2px 0 0.020em #fff,4px 2px 0 0.020em #fff,5px 2px 0 0.020em #fff,6px 2px 0 0.020em #fff,7px 2px 0 0.020em #fff,8px 2px 0 0.020em #fff,9px 2px 0 0.020em #fff,10px 2px 0 0.020em #fff,11px 2px 0 0.020em #fff,12px 2px 0 0.020em #fff,13px 2px 0 0.020em #fff,14px 2px 0 0.020em #fff,15px 2px 0 0.020em #fff,16px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em #fff,3px 3px 0 0.020em #fff,4px 3px 0 0.020em,5px 3px 0 0.020em,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em,13px 3px 0 0.020em,14px 3px 0 0.020em,15px 3px 0 0.020em #fff,16px 3px 0 0.020em,1px 4px 0 0.020em,2px 4px 0 0.020em #fff,3px 4px 0 0.020em #fff,4px 4px 0 0.020em,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em,8px 4px 0 0.020em,9px 4px 0 0.020em,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em,13px 4px 0 0.020em,14px 4px 0 0.020em,15px 4px 0 0.020em #fff,16px 4px 0 0.020em,1px 5px 0 0.020em,2px 5px 0 0.020em #fff,3px 5px 0 0.020em #fff,4px 5px 0 0.020em,5px 5px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em,8px 5px 0 0.020em #fff,9px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em #fff,12px 5px 0 0.020em,13px 5px 0 0.020em,14px 5px 0 0.020em,15px 5px 0 0.020em #fff,16px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em #fff,3px 6px 0 0.020em #fff,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em,8px 6px 0 0.020em #fff,9px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em #fff,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em #fff,16px 6px 0 0.020em,1px 7px 0 0.020em,2px 7px 0 0.020em #fff,3px 7px 0 0.020em #fff,4px 7px 0 0.020em,5px 7px 0 0.020em,6px 7px 0 0.020em,7px 7px 0 0.020em,8px 7px 0 0.020em #fff,9px 7px 0 0.020em,10px 7px 0 0.020em,11px 7px 0 0.020em #fff,12px 7px 0 0.020em,13px 7px 0 0.020em,14px 7px 0 0.020em,15px 7px 0 0.020em #fff,16px 7px 0 0.020em,1px 8px 0 0.020em,2px 8px 0 0.020em #fff,3px 8px 0 0.020em #fff,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em,7px 8px 0 0.020em,8px 8px 0 0.020em #fff,9px 8px 0 0.020em,10px 8px 0 0.020em,11px 8px 0 0.020em #fff,12px 8px 0 0.020em,13px 8px 0 0.020em,14px 8px 0 0.020em,15px 8px 0 0.020em #fff,16px 8px 0 0.020em,1px 9px 0 0.020em,2px 9px 0 0.020em #fff,3px 9px 0 0.020em #fff,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em,7px 9px 0 0.020em,8px 9px 0 0.020em,9px 9px 0 0.020em,10px 9px 0 0.020em,11px 9px 0 0.020em,12px 9px 0 0.020em,13px 9px 0 0.020em,14px 9px 0 0.020em,15px 9px 0 0.020em #fff,16px 9px 0 0.020em,1px 10px 0 0.020em,2px 10px 0 0.020em #fff,3px 10px 0 0.020em #fff,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em,7px 10px 0 0.020em,8px 10px 0 0.020em,9px 10px 0 0.020em,10px 10px 0 0.020em,11px 10px 0 0.020em,12px 10px 0 0.020em,13px 10px 0 0.020em,14px 10px 0 0.020em #fff,15px 10px 0 0.020em #fff,16px 10px 0 0.020em,1px 11px 0 0.020em,2px 11px 0 0.020em #fff,3px 11px 0 0.020em #fff,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em,8px 11px 0 0.020em,9px 11px 0 0.020em,10px 11px 0 0.020em,11px 11px 0 0.020em,12px 11px 0 0.020em,13px 11px 0 0.020em #fff,14px 11px 0 0.020em #fff,15px 11px 0 0.020em,16px 11px 0 0.020em,1px 12px 0 0.020em,2px 12px 0 0.020em #fff,3px 12px 0 0.020em #fff,4px 12px 0 0.020em #fff,5px 12px 0 0.020em #fff,6px 12px 0 0.020em,7px 12px 0 0.020em,8px 12px 0 0.020em #fff,9px 12px 0 0.020em #fff,10px 12px 0 0.020em #fff,11px 12px 0 0.020em #fff,12px 12px 0 0.020em #fff,13px 12px 0 0.020em #fff,14px 12px 0 0.020em,15px 12px 0 0.020em,16px 12px 0 0.020em,1px 13px 0 0.020em,2px 13px 0 0.020em #fff,3px 13px 0 0.020em #fff,4px 13px 0 0.020em #fff,5px 13px 0 0.020em #fff,6px 13px 0 0.020em,7px 13px 0 0.020em #fff,8px 13px 0 0.020em #fff,9px 13px 0 0.020em #fff,10px 13px 0 0.020em #fff,11px 13px 0 0.020em #fff,12px 13px 0 0.020em #fff,13px 13px 0 0.020em,14px 13px 0 0.020em,15px 13px 0 0.020em,16px 13px 0 0.020em,1px 14px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em,4px 14px 0 0.020em,5px 14px 0 0.020em #fff,6px 14px 0 0.020em #fff,7px 14px 0 0.020em #fff,8px 14px 0 0.020em #fff,9px 14px 0 0.020em,10px 14px 0 0.020em,11px 14px 0 0.020em,12px 14px 0 0.020em,13px 14px 0 0.020em,14px 14px 0 0.020em,15px 14px 0 0.020em,16px 14px 0 0.020em,1px 15px 0 0.020em,2px 15px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em,5px 15px 0 0.020em #fff,6px 15px 0 0.020em #fff,7px 15px 0 0.020em,8px 15px 0 0.020em,9px 15px 0 0.020em,10px 15px 0 0.020em,11px 15px 0 0.020em,12px 15px 0 0.020em,13px 15px 0 0.020em,14px 15px 0 0.020em,15px 15px 0 0.020em,16px 15px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,4px 16px 0 0.020em,5px 16px 0 0.020em,6px 16px 0 0.020em,7px 16px 0 0.020em,8px 16px 0 0.020em,9px 16px 0 0.020em,10px 16px 0 0.020em,11px 16px 0 0.020em,12px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.reddit::before { - width: 1px; - height: 1px; - color: #f40; - box-shadow: 3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px #fff,10px 2px #fff,11px 2px #fff,12px 2px,13px 2px #fff,14px 2px,15px 2px,1px 3px,2px 3px,3px 3px,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px #fff,9px 3px,10px 3px,11px 3px,12px 3px #fff,13px 3px #fff,14px 3px #fff,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px,4px 4px,5px 4px,6px 4px,7px 4px,8px 4px #fff,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px #fff,14px 4px,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px,4px 5px,5px 5px,6px 5px,7px 5px #fff,8px 5px #fff,9px 5px #fff,10px 5px #fff,11px 5px,12px 5px,13px 5px,14px 5px,15px 5px,16px 5px,1px 6px,2px 6px #fff,3px 6px #fff,4px 6px,5px 6px #fff,6px 6px #fff,7px 6px #fff,8px 6px #fff,9px 6px #fff,10px 6px #fff,11px 6px #fff,12px 6px #fff,13px 6px,14px 6px #fff,15px 6px #fff,16px 6px,1px 7px,2px 7px #fff,3px 7px,4px 7px #fff,5px 7px #fff,6px 7px #fff,7px 7px #fff,8px 7px #fff,9px 7px #fff,10px 7px #fff,11px 7px #fff,12px 7px #fff,13px 7px #fff,14px 7px,15px 7px #fff,16px 7px,1px 8px,2px 8px,3px 8px #fff,4px 8px #fff,5px 8px #fff,6px 8px,7px 8px,8px 8px #fff,9px 8px #fff,10px 8px,11px 8px,12px 8px #fff,13px 8px #fff,14px 8px #fff,15px 8px,16px 8px,1px 9px,2px 9px #fff,3px 9px #fff,4px 9px #fff,5px 9px #fff,6px 9px,7px 9px,8px 9px #fff,9px 9px #fff,10px 9px,11px 9px,12px 9px #fff,13px 9px #fff,14px 9px #fff,15px 9px #fff,16px 9px,1px 10px,2px 10px #fff,3px 10px #fff,4px 10px #fff,5px 10px #fff,6px 10px #fff,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px #fff,12px 10px #fff,13px 10px #fff,14px 10px #fff,15px 10px #fff,16px 10px,1px 11px,2px 11px #fff,3px 11px #fff,4px 11px #fff,5px 11px #fff,6px 11px #fff,7px 11px #fff,8px 11px #fff,9px 11px #fff,10px 11px #fff,11px 11px #fff,12px 11px #fff,13px 11px #fff,14px 11px #fff,15px 11px #fff,16px 11px,1px 12px,2px 12px,3px 12px #fff,4px 12px #fff,5px 12px #fff,6px 12px,7px 12px #fff,8px 12px #fff,9px 12px #fff,10px 12px #fff,11px 12px,12px 12px #fff,13px 12px #fff,14px 12px #fff,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px,4px 13px #fff,5px 13px #fff,6px 13px #fff,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px #fff,12px 13px #fff,13px 13px #fff,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,5px 14px #fff,6px 14px #fff,7px 14px #fff,8px 14px #fff,9px 14px #fff,10px 14px #fff,11px 14px #fff,12px 14px #fff,13px 14px,14px 14px,15px 14px,16px 14px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px #fff,8px 15px #fff,9px 15px #fff,10px 15px #fff,11px 15px,12px 15px,13px 15px,14px 15px,15px 15px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.reddit::before { - box-shadow: 3px 1px 0 0.020em,4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,2px 2px 0 0.020em,3px 2px 0 0.020em,4px 2px 0 0.020em,5px 2px 0 0.020em,6px 2px 0 0.020em,7px 2px 0 0.020em,8px 2px 0 0.020em,9px 2px 0 0.020em #fff,10px 2px 0 0.020em #fff,11px 2px 0 0.020em #fff,12px 2px 0 0.020em,13px 2px 0 0.020em #fff,14px 2px 0 0.020em,15px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em,3px 3px 0 0.020em,4px 3px 0 0.020em,5px 3px 0 0.020em,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em #fff,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em #fff,13px 3px 0 0.020em #fff,14px 3px 0 0.020em #fff,15px 3px 0 0.020em,16px 3px 0 0.020em,1px 4px 0 0.020em,2px 4px 0 0.020em,3px 4px 0 0.020em,4px 4px 0 0.020em,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em,8px 4px 0 0.020em #fff,9px 4px 0 0.020em,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em,13px 4px 0 0.020em #fff,14px 4px 0 0.020em,15px 4px 0 0.020em,16px 4px 0 0.020em,1px 5px 0 0.020em,2px 5px 0 0.020em,3px 5px 0 0.020em,4px 5px 0 0.020em,5px 5px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em #fff,8px 5px 0 0.020em #fff,9px 5px 0 0.020em #fff,10px 5px 0 0.020em #fff,11px 5px 0 0.020em,12px 5px 0 0.020em,13px 5px 0 0.020em,14px 5px 0 0.020em,15px 5px 0 0.020em,16px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em #fff,3px 6px 0 0.020em #fff,4px 6px 0 0.020em,5px 6px 0 0.020em #fff,6px 6px 0 0.020em #fff,7px 6px 0 0.020em #fff,8px 6px 0 0.020em #fff,9px 6px 0 0.020em #fff,10px 6px 0 0.020em #fff,11px 6px 0 0.020em #fff,12px 6px 0 0.020em #fff,13px 6px 0 0.020em,14px 6px 0 0.020em #fff,15px 6px 0 0.020em #fff,16px 6px 0 0.020em,1px 7px 0 0.020em,2px 7px 0 0.020em #fff,3px 7px 0 0.020em,4px 7px 0 0.020em #fff,5px 7px 0 0.020em #fff,6px 7px 0 0.020em #fff,7px 7px 0 0.020em #fff,8px 7px 0 0.020em #fff,9px 7px 0 0.020em #fff,10px 7px 0 0.020em #fff,11px 7px 0 0.020em #fff,12px 7px 0 0.020em #fff,13px 7px 0 0.020em #fff,14px 7px 0 0.020em,15px 7px 0 0.020em #fff,16px 7px 0 0.020em,1px 8px 0 0.020em,2px 8px 0 0.020em,3px 8px 0 0.020em #fff,4px 8px 0 0.020em #fff,5px 8px 0 0.020em #fff,6px 8px 0 0.020em,7px 8px 0 0.020em,8px 8px 0 0.020em #fff,9px 8px 0 0.020em #fff,10px 8px 0 0.020em,11px 8px 0 0.020em,12px 8px 0 0.020em #fff,13px 8px 0 0.020em #fff,14px 8px 0 0.020em #fff,15px 8px 0 0.020em,16px 8px 0 0.020em,1px 9px 0 0.020em,2px 9px 0 0.020em #fff,3px 9px 0 0.020em #fff,4px 9px 0 0.020em #fff,5px 9px 0 0.020em #fff,6px 9px 0 0.020em,7px 9px 0 0.020em,8px 9px 0 0.020em #fff,9px 9px 0 0.020em #fff,10px 9px 0 0.020em,11px 9px 0 0.020em,12px 9px 0 0.020em #fff,13px 9px 0 0.020em #fff,14px 9px 0 0.020em #fff,15px 9px 0 0.020em #fff,16px 9px 0 0.020em,1px 10px 0 0.020em,2px 10px 0 0.020em #fff,3px 10px 0 0.020em #fff,4px 10px 0 0.020em #fff,5px 10px 0 0.020em #fff,6px 10px 0 0.020em #fff,7px 10px 0 0.020em #fff,8px 10px 0 0.020em #fff,9px 10px 0 0.020em #fff,10px 10px 0 0.020em #fff,11px 10px 0 0.020em #fff,12px 10px 0 0.020em #fff,13px 10px 0 0.020em #fff,14px 10px 0 0.020em #fff,15px 10px 0 0.020em #fff,16px 10px 0 0.020em,1px 11px 0 0.020em,2px 11px 0 0.020em #fff,3px 11px 0 0.020em #fff,4px 11px 0 0.020em #fff,5px 11px 0 0.020em #fff,6px 11px 0 0.020em #fff,7px 11px 0 0.020em #fff,8px 11px 0 0.020em #fff,9px 11px 0 0.020em #fff,10px 11px 0 0.020em #fff,11px 11px 0 0.020em #fff,12px 11px 0 0.020em #fff,13px 11px 0 0.020em #fff,14px 11px 0 0.020em #fff,15px 11px 0 0.020em #fff,16px 11px 0 0.020em,1px 12px 0 0.020em,2px 12px 0 0.020em,3px 12px 0 0.020em #fff,4px 12px 0 0.020em #fff,5px 12px 0 0.020em #fff,6px 12px 0 0.020em,7px 12px 0 0.020em #fff,8px 12px 0 0.020em #fff,9px 12px 0 0.020em #fff,10px 12px 0 0.020em #fff,11px 12px 0 0.020em,12px 12px 0 0.020em #fff,13px 12px 0 0.020em #fff,14px 12px 0 0.020em #fff,15px 12px 0 0.020em,16px 12px 0 0.020em,1px 13px 0 0.020em,2px 13px 0 0.020em,3px 13px 0 0.020em,4px 13px 0 0.020em #fff,5px 13px 0 0.020em #fff,6px 13px 0 0.020em #fff,7px 13px 0 0.020em,8px 13px 0 0.020em,9px 13px 0 0.020em,10px 13px 0 0.020em,11px 13px 0 0.020em #fff,12px 13px 0 0.020em #fff,13px 13px 0 0.020em #fff,14px 13px 0 0.020em,15px 13px 0 0.020em,16px 13px 0 0.020em,1px 14px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em,4px 14px 0 0.020em,5px 14px 0 0.020em #fff,6px 14px 0 0.020em #fff,7px 14px 0 0.020em #fff,8px 14px 0 0.020em #fff,9px 14px 0 0.020em #fff,10px 14px 0 0.020em #fff,11px 14px 0 0.020em #fff,12px 14px 0 0.020em #fff,13px 14px 0 0.020em,14px 14px 0 0.020em,15px 14px 0 0.020em,16px 14px 0 0.020em,2px 15px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em,5px 15px 0 0.020em,6px 15px 0 0.020em,7px 15px 0 0.020em #fff,8px 15px 0 0.020em #fff,9px 15px 0 0.020em #fff,10px 15px 0 0.020em #fff,11px 15px 0 0.020em,12px 15px 0 0.020em,13px 15px 0 0.020em,14px 15px 0 0.020em,15px 15px 0 0.020em,3px 16px 0 0.020em,4px 16px 0 0.020em,5px 16px 0 0.020em,6px 16px 0 0.020em,7px 16px 0 0.020em,8px 16px 0 0.020em,9px 16px 0 0.020em,10px 16px 0 0.020em,11px 16px 0 0.020em,12px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em; - } -} - -.nes-icon.whatsapp::before { - width: 1px; - height: 1px; - color: #00ba37; - box-shadow: 4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,3px 2px,4px 2px,5px 2px,6px 2px #fff,7px 2px #fff,8px 2px #fff,9px 2px #fff,10px 2px #fff,11px 2px #fff,12px 2px #fff,13px 2px,14px 2px,15px 2px,2px 3px,3px 3px,4px 3px,5px 3px #fff,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px #fff,14px 3px,15px 3px,16px 3px,2px 4px,3px 4px,4px 4px #fff,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px #fff,15px 4px,16px 4px,2px 5px,3px 5px,4px 5px #fff,5px 5px,6px 5px #fff,7px 5px #fff,8px 5px,9px 5px,10px 5px,11px 5px,12px 5px,13px 5px,14px 5px #fff,15px 5px,16px 5px,2px 6px,3px 6px #fff,4px 6px,5px 6px,6px 6px #fff,7px 6px #fff,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px #fff,16px 6px,2px 7px,3px 7px #fff,4px 7px,5px 7px,6px 7px #fff,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,14px 7px,15px 7px #fff,16px 7px,2px 8px,3px 8px #fff,4px 8px,5px 8px,6px 8px,7px 8px #fff,8px 8px #fff,9px 8px,10px 8px,11px 8px,12px 8px,13px 8px,14px 8px,15px 8px #fff,16px 8px,2px 9px,3px 9px #fff,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px #fff,9px 9px #fff,10px 9px,11px 9px,12px 9px,13px 9px,14px 9px,15px 9px #fff,16px 9px,2px 10px,3px 10px #fff,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px #fff,10px 10px,11px 10px #fff,12px 10px #fff,13px 10px,14px 10px,15px 10px #fff,16px 10px,2px 11px,3px 11px,4px 11px #fff,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px #fff,11px 11px #fff,12px 11px #fff,13px 11px,14px 11px #fff,15px 11px,16px 11px,2px 12px,3px 12px,4px 12px #fff,5px 12px,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px,13px 12px,14px 12px #fff,15px 12px,16px 12px,2px 13px,3px 13px #fff,4px 13px,5px 13px #fff,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px,12px 13px,13px 13px #fff,14px 13px,15px 13px,16px 13px,2px 14px,3px 14px #fff,4px 14px #fff,5px 14px,6px 14px #fff,7px 14px #fff,8px 14px #fff,9px 14px #fff,10px 14px #fff,11px 14px #fff,12px 14px #fff,13px 14px,14px 14px,15px 14px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px,14px 15px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.whatsapp::before { - box-shadow: 4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,3px 2px 0 0.020em,4px 2px 0 0.020em,5px 2px 0 0.020em,6px 2px 0 0.020em #fff,7px 2px 0 0.020em #fff,8px 2px 0 0.020em #fff,9px 2px 0 0.020em #fff,10px 2px 0 0.020em #fff,11px 2px 0 0.020em #fff,12px 2px 0 0.020em #fff,13px 2px 0 0.020em,14px 2px 0 0.020em,15px 2px 0 0.020em,2px 3px 0 0.020em,3px 3px 0 0.020em,4px 3px 0 0.020em,5px 3px 0 0.020em #fff,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em,13px 3px 0 0.020em #fff,14px 3px 0 0.020em,15px 3px 0 0.020em,16px 3px 0 0.020em,2px 4px 0 0.020em,3px 4px 0 0.020em,4px 4px 0 0.020em #fff,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em,8px 4px 0 0.020em,9px 4px 0 0.020em,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em,13px 4px 0 0.020em,14px 4px 0 0.020em #fff,15px 4px 0 0.020em,16px 4px 0 0.020em,2px 5px 0 0.020em,3px 5px 0 0.020em,4px 5px 0 0.020em #fff,5px 5px 0 0.020em,6px 5px 0 0.020em #fff,7px 5px 0 0.020em #fff,8px 5px 0 0.020em,9px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em,12px 5px 0 0.020em,13px 5px 0 0.020em,14px 5px 0 0.020em #fff,15px 5px 0 0.020em,16px 5px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em #fff,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em #fff,7px 6px 0 0.020em #fff,8px 6px 0 0.020em,9px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em #fff,16px 6px 0 0.020em,2px 7px 0 0.020em,3px 7px 0 0.020em #fff,4px 7px 0 0.020em,5px 7px 0 0.020em,6px 7px 0 0.020em #fff,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em,11px 7px 0 0.020em,12px 7px 0 0.020em,13px 7px 0 0.020em,14px 7px 0 0.020em,15px 7px 0 0.020em #fff,16px 7px 0 0.020em,2px 8px 0 0.020em,3px 8px 0 0.020em #fff,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em,7px 8px 0 0.020em #fff,8px 8px 0 0.020em #fff,9px 8px 0 0.020em,10px 8px 0 0.020em,11px 8px 0 0.020em,12px 8px 0 0.020em,13px 8px 0 0.020em,14px 8px 0 0.020em,15px 8px 0 0.020em #fff,16px 8px 0 0.020em,2px 9px 0 0.020em,3px 9px 0 0.020em #fff,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em,7px 9px 0 0.020em,8px 9px 0 0.020em #fff,9px 9px 0 0.020em #fff,10px 9px 0 0.020em,11px 9px 0 0.020em,12px 9px 0 0.020em,13px 9px 0 0.020em,14px 9px 0 0.020em,15px 9px 0 0.020em #fff,16px 9px 0 0.020em,2px 10px 0 0.020em,3px 10px 0 0.020em #fff,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em,7px 10px 0 0.020em,8px 10px 0 0.020em,9px 10px 0 0.020em #fff,10px 10px 0 0.020em,11px 10px 0 0.020em #fff,12px 10px 0 0.020em #fff,13px 10px 0 0.020em,14px 10px 0 0.020em,15px 10px 0 0.020em #fff,16px 10px 0 0.020em,2px 11px 0 0.020em,3px 11px 0 0.020em,4px 11px 0 0.020em #fff,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em,8px 11px 0 0.020em,9px 11px 0 0.020em,10px 11px 0 0.020em #fff,11px 11px 0 0.020em #fff,12px 11px 0 0.020em #fff,13px 11px 0 0.020em,14px 11px 0 0.020em #fff,15px 11px 0 0.020em,16px 11px 0 0.020em,2px 12px 0 0.020em,3px 12px 0 0.020em,4px 12px 0 0.020em #fff,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em,8px 12px 0 0.020em,9px 12px 0 0.020em,10px 12px 0 0.020em,11px 12px 0 0.020em,12px 12px 0 0.020em,13px 12px 0 0.020em,14px 12px 0 0.020em #fff,15px 12px 0 0.020em,16px 12px 0 0.020em,2px 13px 0 0.020em,3px 13px 0 0.020em #fff,4px 13px 0 0.020em,5px 13px 0 0.020em #fff,6px 13px 0 0.020em,7px 13px 0 0.020em,8px 13px 0 0.020em,9px 13px 0 0.020em,10px 13px 0 0.020em,11px 13px 0 0.020em,12px 13px 0 0.020em,13px 13px 0 0.020em #fff,14px 13px 0 0.020em,15px 13px 0 0.020em,16px 13px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em #fff,4px 14px 0 0.020em #fff,5px 14px 0 0.020em,6px 14px 0 0.020em #fff,7px 14px 0 0.020em #fff,8px 14px 0 0.020em #fff,9px 14px 0 0.020em #fff,10px 14px 0 0.020em #fff,11px 14px 0 0.020em #fff,12px 14px 0 0.020em #fff,13px 14px 0 0.020em,14px 14px 0 0.020em,15px 14px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em,5px 15px 0 0.020em,6px 15px 0 0.020em,7px 15px 0 0.020em,8px 15px 0 0.020em,9px 15px 0 0.020em,10px 15px 0 0.020em,11px 15px 0 0.020em,12px 15px 0 0.020em,13px 15px 0 0.020em,14px 15px 0 0.020em; - } -} - -.nes-icon.gmail::before { - width: 1px; - height: 1px; - color: #eeecec; - box-shadow: 2px 3px #fd2b2b,3px 3px,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px,14px 3px,15px 3px #fd2b2b,1px 4px #fd2b2b,2px 4px #fd2b2b,3px 4px #fd2b2b,4px 4px,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px #fd2b2b,15px 4px #fd2b2b,16px 4px #fd2b2b,1px 5px #fd2b2b,2px 5px #fd2b2b,3px 5px #fd2b2b,4px 5px #fd2b2b,5px 5px,6px 5px,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px,12px 5px,13px 5px #fd2b2b,14px 5px #fd2b2b,15px 5px #fd2b2b,16px 5px #fd2b2b,1px 6px #fd2b2b,2px 6px #fd2b2b,3px 6px,4px 6px #fd2b2b,5px 6px #fd2b2b,6px 6px,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px #fd2b2b,13px 6px #fd2b2b,14px 6px,15px 6px #fd2b2b,16px 6px #fd2b2b,1px 7px #fd2b2b,2px 7px #fd2b2b,3px 7px,4px 7px,5px 7px #fd2b2b,6px 7px #fd2b2b,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px #fd2b2b,12px 7px #fd2b2b,13px 7px,14px 7px,15px 7px #fd2b2b,16px 7px #fd2b2b,1px 8px #fd2b2b,2px 8px #fd2b2b,3px 8px,4px 8px,5px 8px,6px 8px #fd2b2b,7px 8px #fd2b2b,8px 8px,9px 8px,10px 8px #fd2b2b,11px 8px #fd2b2b,12px 8px,13px 8px,14px 8px,15px 8px #fd2b2b,16px 8px #fd2b2b,1px 9px #fd2b2b,2px 9px #fd2b2b,3px 9px,4px 9px,5px 9px,6px 9px,7px 9px #fd2b2b,8px 9px #fd2b2b,9px 9px #fd2b2b,10px 9px #fd2b2b,11px 9px,12px 9px,13px 9px,14px 9px,15px 9px #fd2b2b,16px 9px #fd2b2b,1px 10px #fd2b2b,2px 10px #fd2b2b,3px 10px,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px #fd2b2b,9px 10px #fd2b2b,10px 10px,11px 10px,12px 10px,13px 10px,14px 10px,15px 10px #fd2b2b,16px 10px #fd2b2b,1px 11px #fd2b2b,2px 11px #fd2b2b,3px 11px,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px,14px 11px,15px 11px #fd2b2b,16px 11px #fd2b2b,1px 12px #fd2b2b,2px 12px #fd2b2b,3px 12px,4px 12px,5px 12px,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px,13px 12px,14px 12px,15px 12px #fd2b2b,16px 12px #fd2b2b,1px 13px #fd2b2b,2px 13px #fd2b2b,3px 13px,4px 13px,5px 13px,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px,15px 13px #fd2b2b,16px 13px #fd2b2b,2px 14px #fd2b2b,3px 14px,4px 14px,5px 14px,6px 14px,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px,15px 14px #fd2b2b; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.gmail::before { - box-shadow: 2px 3px 0 0.020em #fd2b2b,3px 3px 0 0.020em,4px 3px 0 0.020em,5px 3px 0 0.020em,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em,13px 3px 0 0.020em,14px 3px 0 0.020em,15px 3px 0 0.020em #fd2b2b,1px 4px 0 0.020em #fd2b2b,2px 4px 0 0.020em #fd2b2b,3px 4px 0 0.020em #fd2b2b,4px 4px 0 0.020em,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em,8px 4px 0 0.020em,9px 4px 0 0.020em,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em,13px 4px 0 0.020em,14px 4px 0 0.020em #fd2b2b,15px 4px 0 0.020em #fd2b2b,16px 4px 0 0.020em #fd2b2b,1px 5px 0 0.020em #fd2b2b,2px 5px 0 0.020em #fd2b2b,3px 5px 0 0.020em #fd2b2b,4px 5px 0 0.020em #fd2b2b,5px 5px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em,8px 5px 0 0.020em,9px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em,12px 5px 0 0.020em,13px 5px 0 0.020em #fd2b2b,14px 5px 0 0.020em #fd2b2b,15px 5px 0 0.020em #fd2b2b,16px 5px 0 0.020em #fd2b2b,1px 6px 0 0.020em #fd2b2b,2px 6px 0 0.020em #fd2b2b,3px 6px 0 0.020em,4px 6px 0 0.020em #fd2b2b,5px 6px 0 0.020em #fd2b2b,6px 6px 0 0.020em,7px 6px 0 0.020em,8px 6px 0 0.020em,9px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em #fd2b2b,13px 6px 0 0.020em #fd2b2b,14px 6px 0 0.020em,15px 6px 0 0.020em #fd2b2b,16px 6px 0 0.020em #fd2b2b,1px 7px 0 0.020em #fd2b2b,2px 7px 0 0.020em #fd2b2b,3px 7px 0 0.020em,4px 7px 0 0.020em,5px 7px 0 0.020em #fd2b2b,6px 7px 0 0.020em #fd2b2b,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em,11px 7px 0 0.020em #fd2b2b,12px 7px 0 0.020em #fd2b2b,13px 7px 0 0.020em,14px 7px 0 0.020em,15px 7px 0 0.020em #fd2b2b,16px 7px 0 0.020em #fd2b2b,1px 8px 0 0.020em #fd2b2b,2px 8px 0 0.020em #fd2b2b,3px 8px 0 0.020em,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em #fd2b2b,7px 8px 0 0.020em #fd2b2b,8px 8px 0 0.020em,9px 8px 0 0.020em,10px 8px 0 0.020em #fd2b2b,11px 8px 0 0.020em #fd2b2b,12px 8px 0 0.020em,13px 8px 0 0.020em,14px 8px 0 0.020em,15px 8px 0 0.020em #fd2b2b,16px 8px 0 0.020em #fd2b2b,1px 9px 0 0.020em #fd2b2b,2px 9px 0 0.020em #fd2b2b,3px 9px 0 0.020em,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em,7px 9px 0 0.020em #fd2b2b,8px 9px 0 0.020em #fd2b2b,9px 9px 0 0.020em #fd2b2b,10px 9px 0 0.020em #fd2b2b,11px 9px 0 0.020em,12px 9px 0 0.020em,13px 9px 0 0.020em,14px 9px 0 0.020em,15px 9px 0 0.020em #fd2b2b,16px 9px 0 0.020em #fd2b2b,1px 10px 0 0.020em #fd2b2b,2px 10px 0 0.020em #fd2b2b,3px 10px 0 0.020em,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em,7px 10px 0 0.020em,8px 10px 0 0.020em #fd2b2b,9px 10px 0 0.020em #fd2b2b,10px 10px 0 0.020em,11px 10px 0 0.020em,12px 10px 0 0.020em,13px 10px 0 0.020em,14px 10px 0 0.020em,15px 10px 0 0.020em #fd2b2b,16px 10px 0 0.020em #fd2b2b,1px 11px 0 0.020em #fd2b2b,2px 11px 0 0.020em #fd2b2b,3px 11px 0 0.020em,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em,8px 11px 0 0.020em,9px 11px 0 0.020em,10px 11px 0 0.020em,11px 11px 0 0.020em,12px 11px 0 0.020em,13px 11px 0 0.020em,14px 11px 0 0.020em,15px 11px 0 0.020em #fd2b2b,16px 11px 0 0.020em #fd2b2b,1px 12px 0 0.020em #fd2b2b,2px 12px 0 0.020em #fd2b2b,3px 12px 0 0.020em,4px 12px 0 0.020em,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em,8px 12px 0 0.020em,9px 12px 0 0.020em,10px 12px 0 0.020em,11px 12px 0 0.020em,12px 12px 0 0.020em,13px 12px 0 0.020em,14px 12px 0 0.020em,15px 12px 0 0.020em #fd2b2b,16px 12px 0 0.020em #fd2b2b,1px 13px 0 0.020em #fd2b2b,2px 13px 0 0.020em #fd2b2b,3px 13px 0 0.020em,4px 13px 0 0.020em,5px 13px 0 0.020em,6px 13px 0 0.020em,7px 13px 0 0.020em,8px 13px 0 0.020em,9px 13px 0 0.020em,10px 13px 0 0.020em,11px 13px 0 0.020em,12px 13px 0 0.020em,13px 13px 0 0.020em,14px 13px 0 0.020em,15px 13px 0 0.020em #fd2b2b,16px 13px 0 0.020em #fd2b2b,2px 14px 0 0.020em #fd2b2b,3px 14px 0 0.020em,4px 14px 0 0.020em,5px 14px 0 0.020em,6px 14px 0 0.020em,7px 14px 0 0.020em,8px 14px 0 0.020em,9px 14px 0 0.020em,10px 14px 0 0.020em,11px 14px 0 0.020em,12px 14px 0 0.020em,13px 14px 0 0.020em,14px 14px 0 0.020em,15px 14px 0 0.020em #fd2b2b; - } -} - -.nes-icon.linkedin::before { - width: 1px; - height: 1px; - color: #2577b9; - box-shadow: 2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px,13px 2px,14px 2px,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px #fff,4px 3px #fff,5px 3px #fff,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px,14px 3px,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px #fff,4px 4px #fff,5px 4px #fff,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px #fff,4px 5px #fff,5px 5px #fff,6px 5px,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px,12px 5px,13px 5px,14px 5px,15px 5px,16px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,16px 6px,1px 7px,2px 7px,3px 7px #fff,4px 7px #fff,5px 7px #fff,6px 7px,7px 7px #fff,8px 7px #fff,9px 7px #fff,10px 7px,11px 7px #fff,12px 7px #fff,13px 7px #fff,14px 7px,15px 7px,16px 7px,1px 8px,2px 8px,3px 8px #fff,4px 8px #fff,5px 8px #fff,6px 8px,7px 8px #fff,8px 8px #fff,9px 8px #fff,10px 8px #fff,11px 8px #fff,12px 8px #fff,13px 8px #fff,14px 8px #fff,15px 8px,16px 8px,1px 9px,2px 9px,3px 9px #fff,4px 9px #fff,5px 9px #fff,6px 9px,7px 9px #fff,8px 9px #fff,9px 9px #fff,10px 9px #fff,11px 9px #fff,12px 9px #fff,13px 9px #fff,14px 9px #fff,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px #fff,4px 10px #fff,5px 10px #fff,6px 10px,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px,12px 10px #fff,13px 10px #fff,14px 10px #fff,15px 10px,16px 10px,1px 11px,2px 11px,3px 11px #fff,4px 11px #fff,5px 11px #fff,6px 11px,7px 11px #fff,8px 11px #fff,9px 11px #fff,10px 11px,11px 11px,12px 11px #fff,13px 11px #fff,14px 11px #fff,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px #fff,4px 12px #fff,5px 12px #fff,6px 12px,7px 12px #fff,8px 12px #fff,9px 12px #fff,10px 12px,11px 12px,12px 12px #fff,13px 12px #fff,14px 12px #fff,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px #fff,4px 13px #fff,5px 13px #fff,6px 13px,7px 13px #fff,8px 13px #fff,9px 13px #fff,10px 13px,11px 13px,12px 13px #fff,13px 13px #fff,14px 13px #fff,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px #fff,4px 14px #fff,5px 14px #fff,6px 14px,7px 14px #fff,8px 14px #fff,9px 14px #fff,10px 14px,11px 14px,12px 14px #fff,13px 14px #fff,14px 14px #fff,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.linkedin::before { - box-shadow: 2px 1px 0 0.020em,3px 1px 0 0.020em,4px 1px 0 0.020em,5px 1px 0 0.020em,6px 1px 0 0.020em,7px 1px 0 0.020em,8px 1px 0 0.020em,9px 1px 0 0.020em,10px 1px 0 0.020em,11px 1px 0 0.020em,12px 1px 0 0.020em,13px 1px 0 0.020em,14px 1px 0 0.020em,15px 1px 0 0.020em,1px 2px 0 0.020em,2px 2px 0 0.020em,3px 2px 0 0.020em,4px 2px 0 0.020em,5px 2px 0 0.020em,6px 2px 0 0.020em,7px 2px 0 0.020em,8px 2px 0 0.020em,9px 2px 0 0.020em,10px 2px 0 0.020em,11px 2px 0 0.020em,12px 2px 0 0.020em,13px 2px 0 0.020em,14px 2px 0 0.020em,15px 2px 0 0.020em,16px 2px 0 0.020em,1px 3px 0 0.020em,2px 3px 0 0.020em,3px 3px 0 0.020em #fff,4px 3px 0 0.020em #fff,5px 3px 0 0.020em #fff,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em,13px 3px 0 0.020em,14px 3px 0 0.020em,15px 3px 0 0.020em,16px 3px 0 0.020em,1px 4px 0 0.020em,2px 4px 0 0.020em,3px 4px 0 0.020em #fff,4px 4px 0 0.020em #fff,5px 4px 0 0.020em #fff,6px 4px 0 0.020em,7px 4px 0 0.020em,8px 4px 0 0.020em,9px 4px 0 0.020em,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em,13px 4px 0 0.020em,14px 4px 0 0.020em,15px 4px 0 0.020em,16px 4px 0 0.020em,1px 5px 0 0.020em,2px 5px 0 0.020em,3px 5px 0 0.020em #fff,4px 5px 0 0.020em #fff,5px 5px 0 0.020em #fff,6px 5px 0 0.020em,7px 5px 0 0.020em,8px 5px 0 0.020em,9px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em,12px 5px 0 0.020em,13px 5px 0 0.020em,14px 5px 0 0.020em,15px 5px 0 0.020em,16px 5px 0 0.020em,1px 6px 0 0.020em,2px 6px 0 0.020em,3px 6px 0 0.020em,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em,8px 6px 0 0.020em,9px 6px 0 0.020em,10px 6px 0 0.020em,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em,16px 6px 0 0.020em,1px 7px 0 0.020em,2px 7px 0 0.020em,3px 7px 0 0.020em #fff,4px 7px 0 0.020em #fff,5px 7px 0 0.020em #fff,6px 7px 0 0.020em,7px 7px 0 0.020em #fff,8px 7px 0 0.020em #fff,9px 7px 0 0.020em #fff,10px 7px 0 0.020em,11px 7px 0 0.020em #fff,12px 7px 0 0.020em #fff,13px 7px 0 0.020em #fff,14px 7px 0 0.020em,15px 7px 0 0.020em,16px 7px 0 0.020em,1px 8px 0 0.020em,2px 8px 0 0.020em,3px 8px 0 0.020em #fff,4px 8px 0 0.020em #fff,5px 8px 0 0.020em #fff,6px 8px 0 0.020em,7px 8px 0 0.020em #fff,8px 8px 0 0.020em #fff,9px 8px 0 0.020em #fff,10px 8px 0 0.020em #fff,11px 8px 0 0.020em #fff,12px 8px 0 0.020em #fff,13px 8px 0 0.020em #fff,14px 8px 0 0.020em #fff,15px 8px 0 0.020em,16px 8px 0 0.020em,1px 9px 0 0.020em,2px 9px 0 0.020em,3px 9px 0 0.020em #fff,4px 9px 0 0.020em #fff,5px 9px 0 0.020em #fff,6px 9px 0 0.020em,7px 9px 0 0.020em #fff,8px 9px 0 0.020em #fff,9px 9px 0 0.020em #fff,10px 9px 0 0.020em #fff,11px 9px 0 0.020em #fff,12px 9px 0 0.020em #fff,13px 9px 0 0.020em #fff,14px 9px 0 0.020em #fff,15px 9px 0 0.020em,16px 9px 0 0.020em,1px 10px 0 0.020em,2px 10px 0 0.020em,3px 10px 0 0.020em #fff,4px 10px 0 0.020em #fff,5px 10px 0 0.020em #fff,6px 10px 0 0.020em,7px 10px 0 0.020em #fff,8px 10px 0 0.020em #fff,9px 10px 0 0.020em #fff,10px 10px 0 0.020em #fff,11px 10px 0 0.020em,12px 10px 0 0.020em #fff,13px 10px 0 0.020em #fff,14px 10px 0 0.020em #fff,15px 10px 0 0.020em,16px 10px 0 0.020em,1px 11px 0 0.020em,2px 11px 0 0.020em,3px 11px 0 0.020em #fff,4px 11px 0 0.020em #fff,5px 11px 0 0.020em #fff,6px 11px 0 0.020em,7px 11px 0 0.020em #fff,8px 11px 0 0.020em #fff,9px 11px 0 0.020em #fff,10px 11px 0 0.020em,11px 11px 0 0.020em,12px 11px 0 0.020em #fff,13px 11px 0 0.020em #fff,14px 11px 0 0.020em #fff,15px 11px 0 0.020em,16px 11px 0 0.020em,1px 12px 0 0.020em,2px 12px 0 0.020em,3px 12px 0 0.020em #fff,4px 12px 0 0.020em #fff,5px 12px 0 0.020em #fff,6px 12px 0 0.020em,7px 12px 0 0.020em #fff,8px 12px 0 0.020em #fff,9px 12px 0 0.020em #fff,10px 12px 0 0.020em,11px 12px 0 0.020em,12px 12px 0 0.020em #fff,13px 12px 0 0.020em #fff,14px 12px 0 0.020em #fff,15px 12px 0 0.020em,16px 12px 0 0.020em,1px 13px 0 0.020em,2px 13px 0 0.020em,3px 13px 0 0.020em #fff,4px 13px 0 0.020em #fff,5px 13px 0 0.020em #fff,6px 13px 0 0.020em,7px 13px 0 0.020em #fff,8px 13px 0 0.020em #fff,9px 13px 0 0.020em #fff,10px 13px 0 0.020em,11px 13px 0 0.020em,12px 13px 0 0.020em #fff,13px 13px 0 0.020em #fff,14px 13px 0 0.020em #fff,15px 13px 0 0.020em,16px 13px 0 0.020em,1px 14px 0 0.020em,2px 14px 0 0.020em,3px 14px 0 0.020em #fff,4px 14px 0 0.020em #fff,5px 14px 0 0.020em #fff,6px 14px 0 0.020em,7px 14px 0 0.020em #fff,8px 14px 0 0.020em #fff,9px 14px 0 0.020em #fff,10px 14px 0 0.020em,11px 14px 0 0.020em,12px 14px 0 0.020em #fff,13px 14px 0 0.020em #fff,14px 14px 0 0.020em #fff,15px 14px 0 0.020em,16px 14px 0 0.020em,1px 15px 0 0.020em,2px 15px 0 0.020em,3px 15px 0 0.020em,4px 15px 0 0.020em,5px 15px 0 0.020em,6px 15px 0 0.020em,7px 15px 0 0.020em,8px 15px 0 0.020em,9px 15px 0 0.020em,10px 15px 0 0.020em,11px 15px 0 0.020em,12px 15px 0 0.020em,13px 15px 0 0.020em,14px 15px 0 0.020em,15px 15px 0 0.020em,16px 15px 0 0.020em,2px 16px 0 0.020em,3px 16px 0 0.020em,4px 16px 0 0.020em,5px 16px 0 0.020em,6px 16px 0 0.020em,7px 16px 0 0.020em,8px 16px 0 0.020em,9px 16px 0 0.020em,10px 16px 0 0.020em,11px 16px 0 0.020em,12px 16px 0 0.020em,13px 16px 0 0.020em,14px 16px 0 0.020em,15px 16px 0 0.020em; - } -} - -.nes-icon.instagram::before { - width: 1px; - height: 1px; - color: #fff; - box-shadow: 3px 1px #8005c8,4px 1px #8005c8,5px 1px #8005c8,6px 1px #8005c8,7px 1px #8005c8,8px 1px #8005c8,9px 1px #8005c8,10px 1px #8005c8,11px 1px #8005c8,12px 1px #8005c8,13px 1px #8005c8,14px 1px #8005c8,2px 2px #8005c8,3px 2px #8005c8,4px 2px #8005c8,5px 2px #8005c8,6px 2px #8005c8,7px 2px #8005c8,8px 2px #8005c8,9px 2px #8005c8,10px 2px #8005c8,11px 2px #8005c8,12px 2px #8005c8,13px 2px #8005c8,14px 2px #8005c8,15px 2px #8005c8,1px 3px #8005c8,2px 3px #8005c8,3px 3px #8005c8,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px,14px 3px #8005c8,15px 3px #8005c8,16px 3px #8005c8,1px 4px #8005c8,2px 4px #8005c8,3px 4px,4px 4px,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px #8005c8,13px 4px #8005c8,14px 4px,15px 4px #8005c8,16px 4px #8005c8,1px 5px #8005c8,2px 5px #8005c8,3px 5px,4px 5px,5px 5px,6px 5px,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px,12px 5px #8005c8,13px 5px #8005c8,14px 5px,15px 5px #8005c8,16px 5px #8005c8,1px 6px #8005c8,2px 6px #8005c8,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px #8005c8,8px 6px #8005c8,9px 6px #8005c8,10px 6px #8005c8,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px #8005c8,16px 6px #8005c8,1px 7px #d40075,2px 7px #8005c8,3px 7px,4px 7px,5px 7px,6px 7px #8005c8,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px #8005c8,12px 7px,13px 7px,14px 7px,15px 7px #8005c8,16px 7px #d40075,1px 8px #d40075,2px 8px #d40075,3px 8px,4px 8px,5px 8px,6px 8px #8005c8,7px 8px,8px 8px,9px 8px,10px 8px,11px 8px #8005c8,12px 8px,13px 8px,14px 8px,15px 8px #d40075,16px 8px #d40075,1px 9px #d40075,2px 9px #d40075,3px 9px,4px 9px,5px 9px,6px 9px #d40075,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px #d40075,12px 9px,13px 9px,14px 9px,15px 9px #d40075,16px 9px #d40075,1px 10px #d40075,2px 10px #d40075,3px 10px,4px 10px,5px 10px,6px 10px #d40075,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px #d40075,12px 10px,13px 10px,14px 10px,15px 10px #d40075,16px 10px #d40075,1px 11px #e98c25,2px 11px #e98c25,3px 11px,4px 11px,5px 11px,6px 11px,7px 11px #d40075,8px 11px #d40075,9px 11px #d40075,10px 11px #d40075,11px 11px,12px 11px,13px 11px,14px 11px,15px 11px #d40075,16px 11px #d40075,1px 12px #e98c25,2px 12px #e98c25,3px 12px,4px 12px,5px 12px,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px,13px 12px,14px 12px,15px 12px #d40075,16px 12px #d40075,1px 13px #e98c25,2px 13px #e98c25,3px 13px,4px 13px,5px 13px,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px,15px 13px #d84646,16px 13px #d84646,1px 14px #e98c25,2px 14px #e98c25,3px 14px #e98c25,4px 14px,5px 14px,6px 14px,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px #d84646,15px 14px #d84646,16px 14px #d84646,2px 15px #e98c25,3px 15px #e98c25,4px 15px #e98c25,5px 15px #e98c25,6px 15px #e98c25,7px 15px #e98c25,8px 15px #e98c25,9px 15px #e98c25,10px 15px #d84646,11px 15px #d84646,12px 15px #d84646,13px 15px #d84646,14px 15px #d84646,15px 15px #d84646,3px 16px #e98c25,4px 16px #e98c25,5px 16px #e98c25,6px 16px #e98c25,7px 16px #e98c25,8px 16px #e98c25,9px 16px #d84646,10px 16px #d84646,11px 16px #d84646,12px 16px #d84646,13px 16px #d84646,14px 16px #d84646; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.instagram::before { - box-shadow: 3px 1px 0 0.020em #8005c8,4px 1px 0 0.020em #8005c8,5px 1px 0 0.020em #8005c8,6px 1px 0 0.020em #8005c8,7px 1px 0 0.020em #8005c8,8px 1px 0 0.020em #8005c8,9px 1px 0 0.020em #8005c8,10px 1px 0 0.020em #8005c8,11px 1px 0 0.020em #8005c8,12px 1px 0 0.020em #8005c8,13px 1px 0 0.020em #8005c8,14px 1px 0 0.020em #8005c8,2px 2px 0 0.020em #8005c8,3px 2px 0 0.020em #8005c8,4px 2px 0 0.020em #8005c8,5px 2px 0 0.020em #8005c8,6px 2px 0 0.020em #8005c8,7px 2px 0 0.020em #8005c8,8px 2px 0 0.020em #8005c8,9px 2px 0 0.020em #8005c8,10px 2px 0 0.020em #8005c8,11px 2px 0 0.020em #8005c8,12px 2px 0 0.020em #8005c8,13px 2px 0 0.020em #8005c8,14px 2px 0 0.020em #8005c8,15px 2px 0 0.020em #8005c8,1px 3px 0 0.020em #8005c8,2px 3px 0 0.020em #8005c8,3px 3px 0 0.020em #8005c8,4px 3px 0 0.020em,5px 3px 0 0.020em,6px 3px 0 0.020em,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em,13px 3px 0 0.020em,14px 3px 0 0.020em #8005c8,15px 3px 0 0.020em #8005c8,16px 3px 0 0.020em #8005c8,1px 4px 0 0.020em #8005c8,2px 4px 0 0.020em #8005c8,3px 4px 0 0.020em,4px 4px 0 0.020em,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em,8px 4px 0 0.020em,9px 4px 0 0.020em,10px 4px 0 0.020em,11px 4px 0 0.020em,12px 4px 0 0.020em #8005c8,13px 4px 0 0.020em #8005c8,14px 4px 0 0.020em,15px 4px 0 0.020em #8005c8,16px 4px 0 0.020em #8005c8,1px 5px 0 0.020em #8005c8,2px 5px 0 0.020em #8005c8,3px 5px 0 0.020em,4px 5px 0 0.020em,5px 5px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em,8px 5px 0 0.020em,9px 5px 0 0.020em,10px 5px 0 0.020em,11px 5px 0 0.020em,12px 5px 0 0.020em #8005c8,13px 5px 0 0.020em #8005c8,14px 5px 0 0.020em,15px 5px 0 0.020em #8005c8,16px 5px 0 0.020em #8005c8,1px 6px 0 0.020em #8005c8,2px 6px 0 0.020em #8005c8,3px 6px 0 0.020em,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em #8005c8,8px 6px 0 0.020em #8005c8,9px 6px 0 0.020em #8005c8,10px 6px 0 0.020em #8005c8,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em,15px 6px 0 0.020em #8005c8,16px 6px 0 0.020em #8005c8,1px 7px 0 0.020em #d40075,2px 7px 0 0.020em #8005c8,3px 7px 0 0.020em,4px 7px 0 0.020em,5px 7px 0 0.020em,6px 7px 0 0.020em #8005c8,7px 7px 0 0.020em,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em,11px 7px 0 0.020em #8005c8,12px 7px 0 0.020em,13px 7px 0 0.020em,14px 7px 0 0.020em,15px 7px 0 0.020em #8005c8,16px 7px 0 0.020em #d40075,1px 8px 0 0.020em #d40075,2px 8px 0 0.020em #d40075,3px 8px 0 0.020em,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em #8005c8,7px 8px 0 0.020em,8px 8px 0 0.020em,9px 8px 0 0.020em,10px 8px 0 0.020em,11px 8px 0 0.020em #8005c8,12px 8px 0 0.020em,13px 8px 0 0.020em,14px 8px 0 0.020em,15px 8px 0 0.020em #d40075,16px 8px 0 0.020em #d40075,1px 9px 0 0.020em #d40075,2px 9px 0 0.020em #d40075,3px 9px 0 0.020em,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em #d40075,7px 9px 0 0.020em,8px 9px 0 0.020em,9px 9px 0 0.020em,10px 9px 0 0.020em,11px 9px 0 0.020em #d40075,12px 9px 0 0.020em,13px 9px 0 0.020em,14px 9px 0 0.020em,15px 9px 0 0.020em #d40075,16px 9px 0 0.020em #d40075,1px 10px 0 0.020em #d40075,2px 10px 0 0.020em #d40075,3px 10px 0 0.020em,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em #d40075,7px 10px 0 0.020em,8px 10px 0 0.020em,9px 10px 0 0.020em,10px 10px 0 0.020em,11px 10px 0 0.020em #d40075,12px 10px 0 0.020em,13px 10px 0 0.020em,14px 10px 0 0.020em,15px 10px 0 0.020em #d40075,16px 10px 0 0.020em #d40075,1px 11px 0 0.020em #e98c25,2px 11px 0 0.020em #e98c25,3px 11px 0 0.020em,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em #d40075,8px 11px 0 0.020em #d40075,9px 11px 0 0.020em #d40075,10px 11px 0 0.020em #d40075,11px 11px 0 0.020em,12px 11px 0 0.020em,13px 11px 0 0.020em,14px 11px 0 0.020em,15px 11px 0 0.020em #d40075,16px 11px 0 0.020em #d40075,1px 12px 0 0.020em #e98c25,2px 12px 0 0.020em #e98c25,3px 12px 0 0.020em,4px 12px 0 0.020em,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em,8px 12px 0 0.020em,9px 12px 0 0.020em,10px 12px 0 0.020em,11px 12px 0 0.020em,12px 12px 0 0.020em,13px 12px 0 0.020em,14px 12px 0 0.020em,15px 12px 0 0.020em #d40075,16px 12px 0 0.020em #d40075,1px 13px 0 0.020em #e98c25,2px 13px 0 0.020em #e98c25,3px 13px 0 0.020em,4px 13px 0 0.020em,5px 13px 0 0.020em,6px 13px 0 0.020em,7px 13px 0 0.020em,8px 13px 0 0.020em,9px 13px 0 0.020em,10px 13px 0 0.020em,11px 13px 0 0.020em,12px 13px 0 0.020em,13px 13px 0 0.020em,14px 13px 0 0.020em,15px 13px 0 0.020em #d84646,16px 13px 0 0.020em #d84646,1px 14px 0 0.020em #e98c25,2px 14px 0 0.020em #e98c25,3px 14px 0 0.020em #e98c25,4px 14px 0 0.020em,5px 14px 0 0.020em,6px 14px 0 0.020em,7px 14px 0 0.020em,8px 14px 0 0.020em,9px 14px 0 0.020em,10px 14px 0 0.020em,11px 14px 0 0.020em,12px 14px 0 0.020em,13px 14px 0 0.020em,14px 14px 0 0.020em #d84646,15px 14px 0 0.020em #d84646,16px 14px 0 0.020em #d84646,2px 15px 0 0.020em #e98c25,3px 15px 0 0.020em #e98c25,4px 15px 0 0.020em #e98c25,5px 15px 0 0.020em #e98c25,6px 15px 0 0.020em #e98c25,7px 15px 0 0.020em #e98c25,8px 15px 0 0.020em #e98c25,9px 15px 0 0.020em #e98c25,10px 15px 0 0.020em #d84646,11px 15px 0 0.020em #d84646,12px 15px 0 0.020em #d84646,13px 15px 0 0.020em #d84646,14px 15px 0 0.020em #d84646,15px 15px 0 0.020em #d84646,3px 16px 0 0.020em #e98c25,4px 16px 0 0.020em #e98c25,5px 16px 0 0.020em #e98c25,6px 16px 0 0.020em #e98c25,7px 16px 0 0.020em #e98c25,8px 16px 0 0.020em #e98c25,9px 16px 0 0.020em #d84646,10px 16px 0 0.020em #d84646,11px 16px 0 0.020em #d84646,12px 16px 0 0.020em #d84646,13px 16px 0 0.020em #d84646,14px 16px 0 0.020em #d84646; - } -} - -.nes-icon.coin::before { - width: 1px; - height: 1px; - color: #ffc107; - box-shadow: 6px 1px #060606,7px 1px #060606,8px 1px #060606,9px 1px #060606,10px 1px #060606,11px 1px #060606,4px 2px #060606,5px 2px #060606,6px 2px #060606,7px 2px #fff,8px 2px #fff,9px 2px #fff,10px 2px #060606,11px 2px #060606,12px 2px #060606,13px 2px #060606,3px 3px #060606,4px 3px #060606,5px 3px #fff,6px 3px #fff,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px #060606,13px 3px #060606,3px 4px #060606,4px 4px #fff,5px 4px,6px 4px,7px 4px #fff,8px 4px #fff,9px 4px #fff,10px 4px #060606,11px 4px,12px 4px,13px 4px #060606,14px 4px #060606,2px 5px #060606,3px 5px #060606,4px 5px #fff,5px 5px,6px 5px,7px 5px #fff,8px 5px,9px 5px,10px 5px #060606,11px 5px,12px 5px,13px 5px #060606,14px 5px #060606,2px 6px #060606,3px 6px #fff,4px 6px,5px 6px,6px 6px,7px 6px #fff,8px 6px,9px 6px,10px 6px #060606,11px 6px,12px 6px,13px 6px,14px 6px #060606,15px 6px #060606,2px 7px #060606,3px 7px #fff,4px 7px,5px 7px,6px 7px,7px 7px #fff,8px 7px,9px 7px,10px 7px #060606,11px 7px,12px 7px,13px 7px,14px 7px #060606,15px 7px #060606,2px 8px #060606,3px 8px #fff,4px 8px,5px 8px,6px 8px,7px 8px #fff,8px 8px,9px 8px,10px 8px #060606,11px 8px,12px 8px,13px 8px,14px 8px #060606,15px 8px #060606,2px 9px #060606,3px 9px #fff,4px 9px,5px 9px,6px 9px,7px 9px #fff,8px 9px,9px 9px,10px 9px #060606,11px 9px,12px 9px,13px 9px,14px 9px #060606,15px 9px #060606,2px 10px #060606,3px 10px #fff,4px 10px,5px 10px,6px 10px,7px 10px #fff,8px 10px,9px 10px,10px 10px #060606,11px 10px,12px 10px,13px 10px,14px 10px #060606,15px 10px #060606,2px 11px #060606,3px 11px #fff,4px 11px,5px 11px,6px 11px,7px 11px #fff,8px 11px,9px 11px,10px 11px #060606,11px 11px,12px 11px,13px 11px,14px 11px #060606,15px 11px #060606,2px 12px #060606,3px 12px #060606,4px 12px #fff,5px 12px,6px 12px,7px 12px #fff,8px 12px,9px 12px,10px 12px #060606,11px 12px,12px 12px,13px 12px #060606,14px 12px #060606,3px 13px #060606,4px 13px #fff,5px 13px,6px 13px,7px 13px #fff,8px 13px #060606,9px 13px #060606,10px 13px #060606,11px 13px,12px 13px,13px 13px #060606,14px 13px #060606,3px 14px #060606,4px 14px #060606,5px 14px #fff,6px 14px,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px #060606,13px 14px #060606,4px 15px #060606,5px 15px #060606,6px 15px #060606,7px 15px,8px 15px,9px 15px,10px 15px #060606,11px 15px #060606,12px 15px #060606,13px 15px #060606,6px 16px #060606,7px 16px #060606,8px 16px #060606,9px 16px #060606,10px 16px #060606,11px 16px #060606; -} - -@supports (-moz-appearance: meterbar) { - .nes-icon.coin::before { - box-shadow: 6px 1px 0 0.020em #060606,7px 1px 0 0.020em #060606,8px 1px 0 0.020em #060606,9px 1px 0 0.020em #060606,10px 1px 0 0.020em #060606,11px 1px 0 0.020em #060606,4px 2px 0 0.020em #060606,5px 2px 0 0.020em #060606,6px 2px 0 0.020em #060606,7px 2px 0 0.020em #fff,8px 2px 0 0.020em #fff,9px 2px 0 0.020em #fff,10px 2px 0 0.020em #060606,11px 2px 0 0.020em #060606,12px 2px 0 0.020em #060606,13px 2px 0 0.020em #060606,3px 3px 0 0.020em #060606,4px 3px 0 0.020em #060606,5px 3px 0 0.020em #fff,6px 3px 0 0.020em #fff,7px 3px 0 0.020em,8px 3px 0 0.020em,9px 3px 0 0.020em,10px 3px 0 0.020em,11px 3px 0 0.020em,12px 3px 0 0.020em #060606,13px 3px 0 0.020em #060606,3px 4px 0 0.020em #060606,4px 4px 0 0.020em #fff,5px 4px 0 0.020em,6px 4px 0 0.020em,7px 4px 0 0.020em #fff,8px 4px 0 0.020em #fff,9px 4px 0 0.020em #fff,10px 4px 0 0.020em #060606,11px 4px 0 0.020em,12px 4px 0 0.020em,13px 4px 0 0.020em #060606,14px 4px 0 0.020em #060606,2px 5px 0 0.020em #060606,3px 5px 0 0.020em #060606,4px 5px 0 0.020em #fff,5px 5px 0 0.020em,6px 5px 0 0.020em,7px 5px 0 0.020em #fff,8px 5px 0 0.020em,9px 5px 0 0.020em,10px 5px 0 0.020em #060606,11px 5px 0 0.020em,12px 5px 0 0.020em,13px 5px 0 0.020em #060606,14px 5px 0 0.020em #060606,2px 6px 0 0.020em #060606,3px 6px 0 0.020em #fff,4px 6px 0 0.020em,5px 6px 0 0.020em,6px 6px 0 0.020em,7px 6px 0 0.020em #fff,8px 6px 0 0.020em,9px 6px 0 0.020em,10px 6px 0 0.020em #060606,11px 6px 0 0.020em,12px 6px 0 0.020em,13px 6px 0 0.020em,14px 6px 0 0.020em #060606,15px 6px 0 0.020em #060606,2px 7px 0 0.020em #060606,3px 7px 0 0.020em #fff,4px 7px 0 0.020em,5px 7px 0 0.020em,6px 7px 0 0.020em,7px 7px 0 0.020em #fff,8px 7px 0 0.020em,9px 7px 0 0.020em,10px 7px 0 0.020em #060606,11px 7px 0 0.020em,12px 7px 0 0.020em,13px 7px 0 0.020em,14px 7px 0 0.020em #060606,15px 7px 0 0.020em #060606,2px 8px 0 0.020em #060606,3px 8px 0 0.020em #fff,4px 8px 0 0.020em,5px 8px 0 0.020em,6px 8px 0 0.020em,7px 8px 0 0.020em #fff,8px 8px 0 0.020em,9px 8px 0 0.020em,10px 8px 0 0.020em #060606,11px 8px 0 0.020em,12px 8px 0 0.020em,13px 8px 0 0.020em,14px 8px 0 0.020em #060606,15px 8px 0 0.020em #060606,2px 9px 0 0.020em #060606,3px 9px 0 0.020em #fff,4px 9px 0 0.020em,5px 9px 0 0.020em,6px 9px 0 0.020em,7px 9px 0 0.020em #fff,8px 9px 0 0.020em,9px 9px 0 0.020em,10px 9px 0 0.020em #060606,11px 9px 0 0.020em,12px 9px 0 0.020em,13px 9px 0 0.020em,14px 9px 0 0.020em #060606,15px 9px 0 0.020em #060606,2px 10px 0 0.020em #060606,3px 10px 0 0.020em #fff,4px 10px 0 0.020em,5px 10px 0 0.020em,6px 10px 0 0.020em,7px 10px 0 0.020em #fff,8px 10px 0 0.020em,9px 10px 0 0.020em,10px 10px 0 0.020em #060606,11px 10px 0 0.020em,12px 10px 0 0.020em,13px 10px 0 0.020em,14px 10px 0 0.020em #060606,15px 10px 0 0.020em #060606,2px 11px 0 0.020em #060606,3px 11px 0 0.020em #fff,4px 11px 0 0.020em,5px 11px 0 0.020em,6px 11px 0 0.020em,7px 11px 0 0.020em #fff,8px 11px 0 0.020em,9px 11px 0 0.020em,10px 11px 0 0.020em #060606,11px 11px 0 0.020em,12px 11px 0 0.020em,13px 11px 0 0.020em,14px 11px 0 0.020em #060606,15px 11px 0 0.020em #060606,2px 12px 0 0.020em #060606,3px 12px 0 0.020em #060606,4px 12px 0 0.020em #fff,5px 12px 0 0.020em,6px 12px 0 0.020em,7px 12px 0 0.020em #fff,8px 12px 0 0.020em,9px 12px 0 0.020em,10px 12px 0 0.020em #060606,11px 12px 0 0.020em,12px 12px 0 0.020em,13px 12px 0 0.020em #060606,14px 12px 0 0.020em #060606,3px 13px 0 0.020em #060606,4px 13px 0 0.020em #fff,5px 13px 0 0.020em,6px 13px 0 0.020em,7px 13px 0 0.020em #fff,8px 13px 0 0.020em #060606,9px 13px 0 0.020em #060606,10px 13px 0 0.020em #060606,11px 13px 0 0.020em,12px 13px 0 0.020em,13px 13px 0 0.020em #060606,14px 13px 0 0.020em #060606,3px 14px 0 0.020em #060606,4px 14px 0 0.020em #060606,5px 14px 0 0.020em #fff,6px 14px 0 0.020em,7px 14px 0 0.020em,8px 14px 0 0.020em,9px 14px 0 0.020em,10px 14px 0 0.020em,11px 14px 0 0.020em,12px 14px 0 0.020em #060606,13px 14px 0 0.020em #060606,4px 15px 0 0.020em #060606,5px 15px 0 0.020em #060606,6px 15px 0 0.020em #060606,7px 15px 0 0.020em,8px 15px 0 0.020em,9px 15px 0 0.020em,10px 15px 0 0.020em #060606,11px 15px 0 0.020em #060606,12px 15px 0 0.020em #060606,13px 15px 0 0.020em #060606,6px 16px 0 0.020em #060606,7px 16px 0 0.020em #060606,8px 16px 0 0.020em #060606,9px 16px 0 0.020em #060606,10px 16px 0 0.020em #060606,11px 16px 0 0.020em #060606; - } -} - -.nes-logo { - position: relative; - display: inline-block; - width: 60px; - height: 40px; -} - -.nes-logo::before { - position: absolute; - top: -4px; - left: -4px; - content: ""; - background: transparent; - width: 4px; - height: 4px; - color: #3e3634; - box-shadow: 28px 4px,28px 8px,32px 12px,4px 16px #c3c3c3,8px 16px #c3c3c3,12px 16px #c3c3c3,16px 16px #c3c3c3,20px 16px #c3c3c3,24px 16px #c3c3c3,28px 16px #c3c3c3,32px 16px #c3c3c3,36px 16px #c3c3c3,40px 16px #c3c3c3,44px 16px #c3c3c3,48px 16px #c3c3c3,52px 16px #c3c3c3,56px 16px #c3c3c3,60px 16px #c3c3c3,4px 20px #c3c3c3,8px 20px,12px 20px,16px 20px,20px 20px,24px 20px,28px 20px,32px 20px,36px 20px,40px 20px,44px 20px,48px 20px,52px 20px,56px 20px,60px 20px #c3c3c3,4px 24px #c3c3c3,8px 24px,12px 24px,16px 24px #c3c3c3,20px 24px,24px 24px,28px 24px #787973,32px 24px #787973,36px 24px #787973,40px 24px,44px 24px,48px 24px,52px 24px,56px 24px,60px 24px #c3c3c3,4px 28px #c3c3c3,8px 28px,12px 28px #c3c3c3,16px 28px #c3c3c3,20px 28px #c3c3c3,24px 28px,28px 28px,32px 28px,36px 28px,40px 28px,44px 28px,48px 28px,52px 28px,56px 28px,60px 28px #c3c3c3,4px 32px #c3c3c3,8px 32px,12px 32px,16px 32px #c3c3c3,20px 32px,24px 32px,28px 32px #787973,32px 32px #787973,36px 32px #787973,40px 32px,44px 32px #bf1710,48px 32px,52px 32px #bf1710,56px 32px,60px 32px #c3c3c3,4px 36px #c3c3c3,8px 36px,12px 36px,16px 36px,20px 36px,24px 36px,28px 36px,32px 36px,36px 36px,40px 36px,44px 36px,48px 36px,52px 36px,56px 36px,60px 36px #c3c3c3,4px 40px #c3c3c3,8px 40px #c3c3c3,12px 40px #c3c3c3,16px 40px #c3c3c3,20px 40px #c3c3c3,24px 40px #c3c3c3,28px 40px #c3c3c3,32px 40px #c3c3c3,36px 40px #c3c3c3,40px 40px #c3c3c3,44px 40px #c3c3c3,48px 40px #c3c3c3,52px 40px #c3c3c3,56px 40px #c3c3c3,60px 40px #c3c3c3; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-logo::before { - box-shadow: 28px 4px 0 0.020em,28px 8px 0 0.020em,32px 12px 0 0.020em,4px 16px 0 0.020em #c3c3c3,8px 16px 0 0.020em #c3c3c3,12px 16px 0 0.020em #c3c3c3,16px 16px 0 0.020em #c3c3c3,20px 16px 0 0.020em #c3c3c3,24px 16px 0 0.020em #c3c3c3,28px 16px 0 0.020em #c3c3c3,32px 16px 0 0.020em #c3c3c3,36px 16px 0 0.020em #c3c3c3,40px 16px 0 0.020em #c3c3c3,44px 16px 0 0.020em #c3c3c3,48px 16px 0 0.020em #c3c3c3,52px 16px 0 0.020em #c3c3c3,56px 16px 0 0.020em #c3c3c3,60px 16px 0 0.020em #c3c3c3,4px 20px 0 0.020em #c3c3c3,8px 20px 0 0.020em,12px 20px 0 0.020em,16px 20px 0 0.020em,20px 20px 0 0.020em,24px 20px 0 0.020em,28px 20px 0 0.020em,32px 20px 0 0.020em,36px 20px 0 0.020em,40px 20px 0 0.020em,44px 20px 0 0.020em,48px 20px 0 0.020em,52px 20px 0 0.020em,56px 20px 0 0.020em,60px 20px 0 0.020em #c3c3c3,4px 24px 0 0.020em #c3c3c3,8px 24px 0 0.020em,12px 24px 0 0.020em,16px 24px 0 0.020em #c3c3c3,20px 24px 0 0.020em,24px 24px 0 0.020em,28px 24px 0 0.020em #787973,32px 24px 0 0.020em #787973,36px 24px 0 0.020em #787973,40px 24px 0 0.020em,44px 24px 0 0.020em,48px 24px 0 0.020em,52px 24px 0 0.020em,56px 24px 0 0.020em,60px 24px 0 0.020em #c3c3c3,4px 28px 0 0.020em #c3c3c3,8px 28px 0 0.020em,12px 28px 0 0.020em #c3c3c3,16px 28px 0 0.020em #c3c3c3,20px 28px 0 0.020em #c3c3c3,24px 28px 0 0.020em,28px 28px 0 0.020em,32px 28px 0 0.020em,36px 28px 0 0.020em,40px 28px 0 0.020em,44px 28px 0 0.020em,48px 28px 0 0.020em,52px 28px 0 0.020em,56px 28px 0 0.020em,60px 28px 0 0.020em #c3c3c3,4px 32px 0 0.020em #c3c3c3,8px 32px 0 0.020em,12px 32px 0 0.020em,16px 32px 0 0.020em #c3c3c3,20px 32px 0 0.020em,24px 32px 0 0.020em,28px 32px 0 0.020em #787973,32px 32px 0 0.020em #787973,36px 32px 0 0.020em #787973,40px 32px 0 0.020em,44px 32px 0 0.020em #bf1710,48px 32px 0 0.020em,52px 32px 0 0.020em #bf1710,56px 32px 0 0.020em,60px 32px 0 0.020em #c3c3c3,4px 36px 0 0.020em #c3c3c3,8px 36px 0 0.020em,12px 36px 0 0.020em,16px 36px 0 0.020em,20px 36px 0 0.020em,24px 36px 0 0.020em,28px 36px 0 0.020em,32px 36px 0 0.020em,36px 36px 0 0.020em,40px 36px 0 0.020em,44px 36px 0 0.020em,48px 36px 0 0.020em,52px 36px 0 0.020em,56px 36px 0 0.020em,60px 36px 0 0.020em #c3c3c3,4px 40px 0 0.020em #c3c3c3,8px 40px 0 0.020em #c3c3c3,12px 40px 0 0.020em #c3c3c3,16px 40px 0 0.020em #c3c3c3,20px 40px 0 0.020em #c3c3c3,24px 40px 0 0.020em #c3c3c3,28px 40px 0 0.020em #c3c3c3,32px 40px 0 0.020em #c3c3c3,36px 40px 0 0.020em #c3c3c3,40px 40px 0 0.020em #c3c3c3,44px 40px 0 0.020em #c3c3c3,48px 40px 0 0.020em #c3c3c3,52px 40px 0 0.020em #c3c3c3,56px 40px 0 0.020em #c3c3c3,60px 40px 0 0.020em #c3c3c3; - } -} - -.nes-jp-logo { - position: relative; - display: inline-block; - width: 60px; - height: 40px; -} - -.nes-jp-logo::before { - position: absolute; - top: -4px; - left: -4px; - content: ""; - background: transparent; - width: 4px; - height: 4px; - color: #871f37; - box-shadow: 28px 4px #333,28px 8px #333,32px 12px #333,4px 16px,8px 16px,12px 16px,16px 16px,20px 16px,24px 16px,28px 16px,32px 16px,36px 16px,40px 16px,44px 16px,48px 16px,52px 16px,56px 16px,60px 16px,4px 20px,8px 20px #dfd3b9,12px 20px #dfd3b9,16px 20px #dfd3b9,20px 20px #dfd3b9,24px 20px #dfd3b9,28px 20px,32px 20px,36px 20px,40px 20px,44px 20px,48px 20px,52px 20px,56px 20px,60px 20px,4px 24px,8px 24px #dfd3b9,12px 24px #dfd3b9,16px 24px #333,20px 24px #dfd3b9,24px 24px #dfd3b9,28px 24px,32px 24px,36px 24px,40px 24px,44px 24px,48px 24px,52px 24px,56px 24px,60px 24px,4px 28px,8px 28px #dfd3b9,12px 28px #333,16px 28px #333,20px 28px #333,24px 28px #dfd3b9,28px 28px #dfd3b9,32px 28px #dfd3b9,36px 28px #dfd3b9,40px 28px #dfd3b9,44px 28px #dfd3b9,48px 28px #dfd3b9,52px 28px #dfd3b9,56px 28px #dfd3b9,60px 28px,4px 32px,8px 32px #dfd3b9,12px 32px #dfd3b9,16px 32px #333,20px 32px #dfd3b9,24px 32px #dfd3b9,28px 32px #333,32px 32px,36px 32px #333,40px 32px #dfd3b9,44px 32px #333,48px 32px #dfd3b9,52px 32px #333,56px 32px #dfd3b9,60px 32px,4px 36px,8px 36px #dfd3b9,12px 36px #dfd3b9,16px 36px #dfd3b9,20px 36px #dfd3b9,24px 36px #dfd3b9,28px 36px #dfd3b9,32px 36px #dfd3b9,36px 36px #dfd3b9,40px 36px #dfd3b9,44px 36px #dfd3b9,48px 36px #dfd3b9,52px 36px #dfd3b9,56px 36px #dfd3b9,60px 36px,4px 40px,8px 40px,12px 40px,16px 40px,20px 40px,24px 40px,28px 40px,32px 40px,36px 40px,40px 40px,44px 40px,48px 40px,52px 40px,56px 40px,60px 40px; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-jp-logo::before { - box-shadow: 28px 4px 0 0.020em #333,28px 8px 0 0.020em #333,32px 12px 0 0.020em #333,4px 16px 0 0.020em,8px 16px 0 0.020em,12px 16px 0 0.020em,16px 16px 0 0.020em,20px 16px 0 0.020em,24px 16px 0 0.020em,28px 16px 0 0.020em,32px 16px 0 0.020em,36px 16px 0 0.020em,40px 16px 0 0.020em,44px 16px 0 0.020em,48px 16px 0 0.020em,52px 16px 0 0.020em,56px 16px 0 0.020em,60px 16px 0 0.020em,4px 20px 0 0.020em,8px 20px 0 0.020em #dfd3b9,12px 20px 0 0.020em #dfd3b9,16px 20px 0 0.020em #dfd3b9,20px 20px 0 0.020em #dfd3b9,24px 20px 0 0.020em #dfd3b9,28px 20px 0 0.020em,32px 20px 0 0.020em,36px 20px 0 0.020em,40px 20px 0 0.020em,44px 20px 0 0.020em,48px 20px 0 0.020em,52px 20px 0 0.020em,56px 20px 0 0.020em,60px 20px 0 0.020em,4px 24px 0 0.020em,8px 24px 0 0.020em #dfd3b9,12px 24px 0 0.020em #dfd3b9,16px 24px 0 0.020em #333,20px 24px 0 0.020em #dfd3b9,24px 24px 0 0.020em #dfd3b9,28px 24px 0 0.020em,32px 24px 0 0.020em,36px 24px 0 0.020em,40px 24px 0 0.020em,44px 24px 0 0.020em,48px 24px 0 0.020em,52px 24px 0 0.020em,56px 24px 0 0.020em,60px 24px 0 0.020em,4px 28px 0 0.020em,8px 28px 0 0.020em #dfd3b9,12px 28px 0 0.020em #333,16px 28px 0 0.020em #333,20px 28px 0 0.020em #333,24px 28px 0 0.020em #dfd3b9,28px 28px 0 0.020em #dfd3b9,32px 28px 0 0.020em #dfd3b9,36px 28px 0 0.020em #dfd3b9,40px 28px 0 0.020em #dfd3b9,44px 28px 0 0.020em #dfd3b9,48px 28px 0 0.020em #dfd3b9,52px 28px 0 0.020em #dfd3b9,56px 28px 0 0.020em #dfd3b9,60px 28px 0 0.020em,4px 32px 0 0.020em,8px 32px 0 0.020em #dfd3b9,12px 32px 0 0.020em #dfd3b9,16px 32px 0 0.020em #333,20px 32px 0 0.020em #dfd3b9,24px 32px 0 0.020em #dfd3b9,28px 32px 0 0.020em #333,32px 32px 0 0.020em,36px 32px 0 0.020em #333,40px 32px 0 0.020em #dfd3b9,44px 32px 0 0.020em #333,48px 32px 0 0.020em #dfd3b9,52px 32px 0 0.020em #333,56px 32px 0 0.020em #dfd3b9,60px 32px 0 0.020em,4px 36px 0 0.020em,8px 36px 0 0.020em #dfd3b9,12px 36px 0 0.020em #dfd3b9,16px 36px 0 0.020em #dfd3b9,20px 36px 0 0.020em #dfd3b9,24px 36px 0 0.020em #dfd3b9,28px 36px 0 0.020em #dfd3b9,32px 36px 0 0.020em #dfd3b9,36px 36px 0 0.020em #dfd3b9,40px 36px 0 0.020em #dfd3b9,44px 36px 0 0.020em #dfd3b9,48px 36px 0 0.020em #dfd3b9,52px 36px 0 0.020em #dfd3b9,56px 36px 0 0.020em #dfd3b9,60px 36px 0 0.020em,4px 40px 0 0.020em,8px 40px 0 0.020em,12px 40px 0 0.020em,16px 40px 0 0.020em,20px 40px 0 0.020em,24px 40px 0 0.020em,28px 40px 0 0.020em,32px 40px 0 0.020em,36px 40px 0 0.020em,40px 40px 0 0.020em,44px 40px 0 0.020em,48px 40px 0 0.020em,52px 40px 0 0.020em,56px 40px 0 0.020em,60px 40px 0 0.020em; - } -} - -.snes-logo { - position: relative; - display: inline-block; - width: 60px; - height: 40px; -} - -.snes-logo::before { - position: absolute; - top: -4px; - left: -4px; - content: ""; - background: transparent; - width: 4px; - height: 4px; - color: #d7d7d7; - box-shadow: 28px 4px #333,28px 8px #333,32px 12px #333,12px 16px #333,16px 16px #333,20px 16px #333,24px 16px #333,28px 16px #333,32px 16px #333,36px 16px #333,40px 16px #333,44px 16px #333,48px 16px #333,52px 16px #333,8px 20px #333,12px 20px,16px 20px,20px 20px,24px 20px,28px 20px,32px 20px,36px 20px,40px 20px,44px 20px,48px 20px,52px 20px,56px 20px #333,4px 24px #333,8px 24px,12px 24px,16px 24px #333,20px 24px,24px 24px,28px 24px,32px 24px,36px 24px,40px 24px,44px 24px,48px 24px #ad6df0,52px 24px,56px 24px,60px 24px #333,4px 28px #333,8px 28px,12px 28px #333,16px 28px #333,20px 28px #333,24px 28px,28px 28px,32px 28px,36px 28px,40px 28px,44px 28px #ad6df0,48px 28px,52px 28px #8932e5,56px 28px,60px 28px #333,4px 32px #333,8px 32px,12px 32px,16px 32px #333,20px 32px,24px 32px,28px 32px #333,32px 32px,36px 32px #333,40px 32px,44px 32px,48px 32px #8932e5,52px 32px,56px 32px,60px 32px #333,8px 36px #333,12px 36px,16px 36px,20px 36px,24px 36px,28px 36px,32px 36px,36px 36px,40px 36px,44px 36px,48px 36px,52px 36px,56px 36px #333,12px 40px #333,16px 40px #333,20px 40px #333,24px 40px #333,28px 40px #333,32px 40px #333,36px 40px #333,40px 40px #333,44px 40px #333,48px 40px #333,52px 40px #333; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .snes-logo::before { - box-shadow: 28px 4px 0 0.020em #333,28px 8px 0 0.020em #333,32px 12px 0 0.020em #333,12px 16px 0 0.020em #333,16px 16px 0 0.020em #333,20px 16px 0 0.020em #333,24px 16px 0 0.020em #333,28px 16px 0 0.020em #333,32px 16px 0 0.020em #333,36px 16px 0 0.020em #333,40px 16px 0 0.020em #333,44px 16px 0 0.020em #333,48px 16px 0 0.020em #333,52px 16px 0 0.020em #333,8px 20px 0 0.020em #333,12px 20px 0 0.020em,16px 20px 0 0.020em,20px 20px 0 0.020em,24px 20px 0 0.020em,28px 20px 0 0.020em,32px 20px 0 0.020em,36px 20px 0 0.020em,40px 20px 0 0.020em,44px 20px 0 0.020em,48px 20px 0 0.020em,52px 20px 0 0.020em,56px 20px 0 0.020em #333,4px 24px 0 0.020em #333,8px 24px 0 0.020em,12px 24px 0 0.020em,16px 24px 0 0.020em #333,20px 24px 0 0.020em,24px 24px 0 0.020em,28px 24px 0 0.020em,32px 24px 0 0.020em,36px 24px 0 0.020em,40px 24px 0 0.020em,44px 24px 0 0.020em,48px 24px 0 0.020em #ad6df0,52px 24px 0 0.020em,56px 24px 0 0.020em,60px 24px 0 0.020em #333,4px 28px 0 0.020em #333,8px 28px 0 0.020em,12px 28px 0 0.020em #333,16px 28px 0 0.020em #333,20px 28px 0 0.020em #333,24px 28px 0 0.020em,28px 28px 0 0.020em,32px 28px 0 0.020em,36px 28px 0 0.020em,40px 28px 0 0.020em,44px 28px 0 0.020em #ad6df0,48px 28px 0 0.020em,52px 28px 0 0.020em #8932e5,56px 28px 0 0.020em,60px 28px 0 0.020em #333,4px 32px 0 0.020em #333,8px 32px 0 0.020em,12px 32px 0 0.020em,16px 32px 0 0.020em #333,20px 32px 0 0.020em,24px 32px 0 0.020em,28px 32px 0 0.020em #333,32px 32px 0 0.020em,36px 32px 0 0.020em #333,40px 32px 0 0.020em,44px 32px 0 0.020em,48px 32px 0 0.020em #8932e5,52px 32px 0 0.020em,56px 32px 0 0.020em,60px 32px 0 0.020em #333,8px 36px 0 0.020em #333,12px 36px 0 0.020em,16px 36px 0 0.020em,20px 36px 0 0.020em,24px 36px 0 0.020em,28px 36px 0 0.020em,32px 36px 0 0.020em,36px 36px 0 0.020em,40px 36px 0 0.020em,44px 36px 0 0.020em,48px 36px 0 0.020em,52px 36px 0 0.020em,56px 36px 0 0.020em #333,12px 40px 0 0.020em #333,16px 40px 0 0.020em #333,20px 40px 0 0.020em #333,24px 40px 0 0.020em #333,28px 40px 0 0.020em #333,32px 40px 0 0.020em #333,36px 40px 0 0.020em #333,40px 40px 0 0.020em #333,44px 40px 0 0.020em #333,48px 40px 0 0.020em #333,52px 40px 0 0.020em #333; - } -} - -.snes-jp-logo { - position: relative; - display: inline-block; - width: 60px; - height: 40px; -} - -.snes-jp-logo::before { - position: absolute; - top: -4px; - left: -4px; - content: ""; - background: transparent; - width: 4px; - height: 4px; - color: #d7d7d7; - box-shadow: 28px 4px #333,28px 8px #333,32px 12px #333,12px 16px #333,16px 16px #333,20px 16px #333,24px 16px #333,28px 16px #333,32px 16px #333,36px 16px #333,40px 16px #333,44px 16px #333,48px 16px #333,52px 16px #333,8px 20px #333,12px 20px,16px 20px,20px 20px,24px 20px,28px 20px,32px 20px,36px 20px,40px 20px,44px 20px,48px 20px,52px 20px,56px 20px #333,4px 24px #333,8px 24px,12px 24px,16px 24px #333,20px 24px,24px 24px,28px 24px,32px 24px,36px 24px,40px 24px,44px 24px,48px 24px #999cf7,52px 24px,56px 24px,60px 24px #333,4px 28px #333,8px 28px,12px 28px #333,16px 28px #333,20px 28px #333,24px 28px,28px 28px,32px 28px,36px 28px,40px 28px,44px 28px #7dbb78,48px 28px,52px 28px #f40500,56px 28px,60px 28px #333,4px 32px #333,8px 32px,12px 32px,16px 32px #333,20px 32px,24px 32px,28px 32px #333,32px 32px,36px 32px #333,40px 32px,44px 32px,48px 32px #f6f504,52px 32px,56px 32px,60px 32px #333,8px 36px #333,12px 36px,16px 36px,20px 36px,24px 36px,28px 36px,32px 36px,36px 36px,40px 36px,44px 36px,48px 36px,52px 36px,56px 36px #333,12px 40px #333,16px 40px #333,20px 40px #333,24px 40px #333,28px 40px #333,32px 40px #333,36px 40px #333,40px 40px #333,44px 40px #333,48px 40px #333,52px 40px #333; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .snes-jp-logo::before { - box-shadow: 28px 4px 0 0.020em #333,28px 8px 0 0.020em #333,32px 12px 0 0.020em #333,12px 16px 0 0.020em #333,16px 16px 0 0.020em #333,20px 16px 0 0.020em #333,24px 16px 0 0.020em #333,28px 16px 0 0.020em #333,32px 16px 0 0.020em #333,36px 16px 0 0.020em #333,40px 16px 0 0.020em #333,44px 16px 0 0.020em #333,48px 16px 0 0.020em #333,52px 16px 0 0.020em #333,8px 20px 0 0.020em #333,12px 20px 0 0.020em,16px 20px 0 0.020em,20px 20px 0 0.020em,24px 20px 0 0.020em,28px 20px 0 0.020em,32px 20px 0 0.020em,36px 20px 0 0.020em,40px 20px 0 0.020em,44px 20px 0 0.020em,48px 20px 0 0.020em,52px 20px 0 0.020em,56px 20px 0 0.020em #333,4px 24px 0 0.020em #333,8px 24px 0 0.020em,12px 24px 0 0.020em,16px 24px 0 0.020em #333,20px 24px 0 0.020em,24px 24px 0 0.020em,28px 24px 0 0.020em,32px 24px 0 0.020em,36px 24px 0 0.020em,40px 24px 0 0.020em,44px 24px 0 0.020em,48px 24px 0 0.020em #999cf7,52px 24px 0 0.020em,56px 24px 0 0.020em,60px 24px 0 0.020em #333,4px 28px 0 0.020em #333,8px 28px 0 0.020em,12px 28px 0 0.020em #333,16px 28px 0 0.020em #333,20px 28px 0 0.020em #333,24px 28px 0 0.020em,28px 28px 0 0.020em,32px 28px 0 0.020em,36px 28px 0 0.020em,40px 28px 0 0.020em,44px 28px 0 0.020em #7dbb78,48px 28px 0 0.020em,52px 28px 0 0.020em #f40500,56px 28px 0 0.020em,60px 28px 0 0.020em #333,4px 32px 0 0.020em #333,8px 32px 0 0.020em,12px 32px 0 0.020em,16px 32px 0 0.020em #333,20px 32px 0 0.020em,24px 32px 0 0.020em,28px 32px 0 0.020em #333,32px 32px 0 0.020em,36px 32px 0 0.020em #333,40px 32px 0 0.020em,44px 32px 0 0.020em,48px 32px 0 0.020em #f6f504,52px 32px 0 0.020em,56px 32px 0 0.020em,60px 32px 0 0.020em #333,8px 36px 0 0.020em #333,12px 36px 0 0.020em,16px 36px 0 0.020em,20px 36px 0 0.020em,24px 36px 0 0.020em,28px 36px 0 0.020em,32px 36px 0 0.020em,36px 36px 0 0.020em,40px 36px 0 0.020em,44px 36px 0 0.020em,48px 36px 0 0.020em,52px 36px 0 0.020em,56px 36px 0 0.020em #333,12px 40px 0 0.020em #333,16px 40px 0 0.020em #333,20px 40px 0 0.020em #333,24px 40px 0 0.020em #333,28px 40px 0 0.020em #333,32px 40px 0 0.020em #333,36px 40px 0 0.020em #333,40px 40px 0 0.020em #333,44px 40px 0 0.020em #333,48px 40px 0 0.020em #333,52px 40px 0 0.020em #333; - } -} - -.nes-bcrikko { - position: relative; - display: inline-block; - width: 96px; - height: 96px; -} - -.nes-bcrikko::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #f9f2d7; - box-shadow: 12px 6px,18px 6px,24px 6px,30px 6px,36px 6px,42px 6px,48px 6px,54px 6px,60px 6px,66px 6px,72px 6px,78px 6px,84px 6px,90px 6px,6px 12px,12px 12px,18px 12px,24px 12px,30px 12px,36px 12px,42px 12px,48px 12px,54px 12px,60px 12px,66px 12px,72px 12px,78px 12px,84px 12px,90px 12px,96px 12px,6px 18px,12px 18px,18px 18px,24px 18px,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px,66px 18px,72px 18px,78px 18px,84px 18px,90px 18px,96px 18px,6px 24px,12px 24px,18px 24px,24px 24px,30px 24px #333,36px 24px #333,42px 24px,48px 24px,54px 24px,60px 24px,66px 24px #333,72px 24px #333,78px 24px,84px 24px,90px 24px,96px 24px,6px 30px,12px 30px,18px 30px,24px 30px #333,30px 30px #333,36px 30px #fff,42px 30px #333,48px 30px,54px 30px,60px 30px #333,66px 30px #333,72px 30px #fff,78px 30px #333,84px 30px,90px 30px,96px 30px,6px 36px,12px 36px,18px 36px,24px 36px #333,30px 36px #333,36px 36px #333,42px 36px #333,48px 36px,54px 36px,60px 36px #333,66px 36px #333,72px 36px #333,78px 36px #333,84px 36px,90px 36px,96px 36px,6px 42px,12px 42px,18px 42px,24px 42px #333,30px 42px #333,36px 42px #333,42px 42px #333,48px 42px,54px 42px,60px 42px #333,66px 42px #333,72px 42px #333,78px 42px #333,84px 42px,90px 42px,96px 42px,6px 48px,12px 48px,18px 48px,24px 48px #333,30px 48px #333,36px 48px #333,42px 48px #333,48px 48px,54px 48px,60px 48px #333,66px 48px #333,72px 48px #333,78px 48px #333,84px 48px,90px 48px,96px 48px,6px 54px,12px 54px,18px 54px,24px 54px,30px 54px #333,36px 54px #333,42px 54px,48px 54px,54px 54px,60px 54px,66px 54px #333,72px 54px #333,78px 54px,84px 54px,90px 54px,96px 54px,6px 60px,12px 60px,18px 60px,24px 60px,30px 60px,36px 60px,42px 60px,48px 60px,54px 60px,60px 60px,66px 60px,72px 60px,78px 60px,84px 60px,90px 60px,96px 60px,6px 66px,12px 66px,18px 66px,24px 66px,30px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,66px 66px,72px 66px,78px 66px,84px 66px,90px 66px,96px 66px,6px 72px,12px 72px,18px 72px,24px 72px #c5090c,30px 72px,36px 72px,42px 72px,48px 72px,54px 72px,60px 72px,66px 72px,72px 72px,78px 72px #c5090c,84px 72px,90px 72px,96px 72px,6px 78px,12px 78px,18px 78px,24px 78px #c5090c,30px 78px,36px 78px,42px 78px,48px 78px,54px 78px,60px 78px,66px 78px,72px 78px,78px 78px #c5090c,84px 78px,90px 78px,96px 78px,6px 84px,12px 84px,18px 84px,24px 84px,30px 84px #c5090c,36px 84px #c5090c,42px 84px #c5090c,48px 84px #c5090c,54px 84px #c5090c,60px 84px #c5090c,66px 84px #c5090c,72px 84px #c5090c,78px 84px,84px 84px,90px 84px,96px 84px,6px 90px,12px 90px,18px 90px,24px 90px,30px 90px,36px 90px,42px 90px,48px 90px,54px 90px,60px 90px,66px 90px,72px 90px,78px 90px,84px 90px,90px 90px,96px 90px,12px 96px,18px 96px,24px 96px,30px 96px,36px 96px,42px 96px,48px 96px,54px 96px,60px 96px,66px 96px,72px 96px,78px 96px,84px 96px,90px 96px; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-bcrikko::before { - box-shadow: 12px 6px 0 0.020em,18px 6px 0 0.020em,24px 6px 0 0.020em,30px 6px 0 0.020em,36px 6px 0 0.020em,42px 6px 0 0.020em,48px 6px 0 0.020em,54px 6px 0 0.020em,60px 6px 0 0.020em,66px 6px 0 0.020em,72px 6px 0 0.020em,78px 6px 0 0.020em,84px 6px 0 0.020em,90px 6px 0 0.020em,6px 12px 0 0.020em,12px 12px 0 0.020em,18px 12px 0 0.020em,24px 12px 0 0.020em,30px 12px 0 0.020em,36px 12px 0 0.020em,42px 12px 0 0.020em,48px 12px 0 0.020em,54px 12px 0 0.020em,60px 12px 0 0.020em,66px 12px 0 0.020em,72px 12px 0 0.020em,78px 12px 0 0.020em,84px 12px 0 0.020em,90px 12px 0 0.020em,96px 12px 0 0.020em,6px 18px 0 0.020em,12px 18px 0 0.020em,18px 18px 0 0.020em,24px 18px 0 0.020em,30px 18px 0 0.020em,36px 18px 0 0.020em,42px 18px 0 0.020em,48px 18px 0 0.020em,54px 18px 0 0.020em,60px 18px 0 0.020em,66px 18px 0 0.020em,72px 18px 0 0.020em,78px 18px 0 0.020em,84px 18px 0 0.020em,90px 18px 0 0.020em,96px 18px 0 0.020em,6px 24px 0 0.020em,12px 24px 0 0.020em,18px 24px 0 0.020em,24px 24px 0 0.020em,30px 24px 0 0.020em #333,36px 24px 0 0.020em #333,42px 24px 0 0.020em,48px 24px 0 0.020em,54px 24px 0 0.020em,60px 24px 0 0.020em,66px 24px 0 0.020em #333,72px 24px 0 0.020em #333,78px 24px 0 0.020em,84px 24px 0 0.020em,90px 24px 0 0.020em,96px 24px 0 0.020em,6px 30px 0 0.020em,12px 30px 0 0.020em,18px 30px 0 0.020em,24px 30px 0 0.020em #333,30px 30px 0 0.020em #333,36px 30px 0 0.020em #fff,42px 30px 0 0.020em #333,48px 30px 0 0.020em,54px 30px 0 0.020em,60px 30px 0 0.020em #333,66px 30px 0 0.020em #333,72px 30px 0 0.020em #fff,78px 30px 0 0.020em #333,84px 30px 0 0.020em,90px 30px 0 0.020em,96px 30px 0 0.020em,6px 36px 0 0.020em,12px 36px 0 0.020em,18px 36px 0 0.020em,24px 36px 0 0.020em #333,30px 36px 0 0.020em #333,36px 36px 0 0.020em #333,42px 36px 0 0.020em #333,48px 36px 0 0.020em,54px 36px 0 0.020em,60px 36px 0 0.020em #333,66px 36px 0 0.020em #333,72px 36px 0 0.020em #333,78px 36px 0 0.020em #333,84px 36px 0 0.020em,90px 36px 0 0.020em,96px 36px 0 0.020em,6px 42px 0 0.020em,12px 42px 0 0.020em,18px 42px 0 0.020em,24px 42px 0 0.020em #333,30px 42px 0 0.020em #333,36px 42px 0 0.020em #333,42px 42px 0 0.020em #333,48px 42px 0 0.020em,54px 42px 0 0.020em,60px 42px 0 0.020em #333,66px 42px 0 0.020em #333,72px 42px 0 0.020em #333,78px 42px 0 0.020em #333,84px 42px 0 0.020em,90px 42px 0 0.020em,96px 42px 0 0.020em,6px 48px 0 0.020em,12px 48px 0 0.020em,18px 48px 0 0.020em,24px 48px 0 0.020em #333,30px 48px 0 0.020em #333,36px 48px 0 0.020em #333,42px 48px 0 0.020em #333,48px 48px 0 0.020em,54px 48px 0 0.020em,60px 48px 0 0.020em #333,66px 48px 0 0.020em #333,72px 48px 0 0.020em #333,78px 48px 0 0.020em #333,84px 48px 0 0.020em,90px 48px 0 0.020em,96px 48px 0 0.020em,6px 54px 0 0.020em,12px 54px 0 0.020em,18px 54px 0 0.020em,24px 54px 0 0.020em,30px 54px 0 0.020em #333,36px 54px 0 0.020em #333,42px 54px 0 0.020em,48px 54px 0 0.020em,54px 54px 0 0.020em,60px 54px 0 0.020em,66px 54px 0 0.020em #333,72px 54px 0 0.020em #333,78px 54px 0 0.020em,84px 54px 0 0.020em,90px 54px 0 0.020em,96px 54px 0 0.020em,6px 60px 0 0.020em,12px 60px 0 0.020em,18px 60px 0 0.020em,24px 60px 0 0.020em,30px 60px 0 0.020em,36px 60px 0 0.020em,42px 60px 0 0.020em,48px 60px 0 0.020em,54px 60px 0 0.020em,60px 60px 0 0.020em,66px 60px 0 0.020em,72px 60px 0 0.020em,78px 60px 0 0.020em,84px 60px 0 0.020em,90px 60px 0 0.020em,96px 60px 0 0.020em,6px 66px 0 0.020em,12px 66px 0 0.020em,18px 66px 0 0.020em,24px 66px 0 0.020em,30px 66px 0 0.020em,36px 66px 0 0.020em,42px 66px 0 0.020em,48px 66px 0 0.020em,54px 66px 0 0.020em,60px 66px 0 0.020em,66px 66px 0 0.020em,72px 66px 0 0.020em,78px 66px 0 0.020em,84px 66px 0 0.020em,90px 66px 0 0.020em,96px 66px 0 0.020em,6px 72px 0 0.020em,12px 72px 0 0.020em,18px 72px 0 0.020em,24px 72px 0 0.020em #c5090c,30px 72px 0 0.020em,36px 72px 0 0.020em,42px 72px 0 0.020em,48px 72px 0 0.020em,54px 72px 0 0.020em,60px 72px 0 0.020em,66px 72px 0 0.020em,72px 72px 0 0.020em,78px 72px 0 0.020em #c5090c,84px 72px 0 0.020em,90px 72px 0 0.020em,96px 72px 0 0.020em,6px 78px 0 0.020em,12px 78px 0 0.020em,18px 78px 0 0.020em,24px 78px 0 0.020em #c5090c,30px 78px 0 0.020em,36px 78px 0 0.020em,42px 78px 0 0.020em,48px 78px 0 0.020em,54px 78px 0 0.020em,60px 78px 0 0.020em,66px 78px 0 0.020em,72px 78px 0 0.020em,78px 78px 0 0.020em #c5090c,84px 78px 0 0.020em,90px 78px 0 0.020em,96px 78px 0 0.020em,6px 84px 0 0.020em,12px 84px 0 0.020em,18px 84px 0 0.020em,24px 84px 0 0.020em,30px 84px 0 0.020em #c5090c,36px 84px 0 0.020em #c5090c,42px 84px 0 0.020em #c5090c,48px 84px 0 0.020em #c5090c,54px 84px 0 0.020em #c5090c,60px 84px 0 0.020em #c5090c,66px 84px 0 0.020em #c5090c,72px 84px 0 0.020em #c5090c,78px 84px 0 0.020em,84px 84px 0 0.020em,90px 84px 0 0.020em,96px 84px 0 0.020em,6px 90px 0 0.020em,12px 90px 0 0.020em,18px 90px 0 0.020em,24px 90px 0 0.020em,30px 90px 0 0.020em,36px 90px 0 0.020em,42px 90px 0 0.020em,48px 90px 0 0.020em,54px 90px 0 0.020em,60px 90px 0 0.020em,66px 90px 0 0.020em,72px 90px 0 0.020em,78px 90px 0 0.020em,84px 90px 0 0.020em,90px 90px 0 0.020em,96px 90px 0 0.020em,12px 96px 0 0.020em,18px 96px 0 0.020em,24px 96px 0 0.020em,30px 96px 0 0.020em,36px 96px 0 0.020em,42px 96px 0 0.020em,48px 96px 0 0.020em,54px 96px 0 0.020em,60px 96px 0 0.020em,66px 96px 0 0.020em,72px 96px 0 0.020em,78px 96px 0 0.020em,84px 96px 0 0.020em,90px 96px 0 0.020em; - } -} - -.nes-ash { - position: relative; - display: inline-block; - width: 84px; - height: 90px; -} - -.nes-ash::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #181818; - box-shadow: 30px 6px,36px 6px,42px 6px,48px 6px,54px 6px,60px 6px,24px 12px,30px 12px #ff614e,36px 12px #ff614e,42px 12px #ff614e,48px 12px #f8f8ff,54px 12px #f8f8ff,60px 12px #007f7f,66px 12px,18px 18px,24px 18px #ff614e,30px 18px #ff614e,36px 18px #ff614e,42px 18px #ff614e,48px 18px #f8f8ff,54px 18px #f8f8ff,60px 18px #f8f8ff,66px 18px #f8f8ff,72px 18px,18px 24px,24px 24px #ff614e,30px 24px #ff614e,36px 24px #ff614e,42px 24px #ff614e,48px 24px #f8f8ff,54px 24px #f8f8ff,60px 24px #007f7f,66px 24px #007f7f,72px 24px,78px 24px,12px 30px,18px 30px,24px 30px,30px 30px #ff614e,36px 30px #ff614e,42px 30px #ff614e,48px 30px #ff614e,54px 30px #ff614e,60px 30px #ff614e,66px 30px #ff614e,72px 30px #ff614e,78px 30px #ff614e,84px 30px,12px 36px,18px 36px,24px 36px,30px 36px,36px 36px,42px 36px,48px 36px,54px 36px #ff614e,60px 36px #ff614e,66px 36px #ff614e,72px 36px,78px 36px,6px 42px,12px 42px,18px 42px,24px 42px,30px 42px,36px 42px,42px 42px,48px 42px #ffe3c5,54px 42px #ffe3c5,60px 42px,66px 42px #ffe3c5,72px 42px,12px 48px,18px 48px,24px 48px #ffe3c5,30px 48px #ffe3c5,36px 48px #ffe3c5,42px 48px,48px 48px #ffe3c5,54px 48px #ffe3c5,60px 48px,66px 48px #ffe3c5,72px 48px,18px 54px,24px 54px #ffe3c5,30px 54px #ffe3c5,36px 54px #ffe3c5,42px 54px #ffe3c5,48px 54px #ffe3c5,54px 54px #ffe3c5,60px 54px #ffe3c5,66px 54px #ffe3c5,72px 54px,12px 60px,18px 60px #4169e1,24px 60px,30px 60px,36px 60px #ffe3c5,42px 60px #ffe3c5,48px 60px #ffe3c5,54px 60px #ffe3c5,60px 60px #ffe3c5,66px 60px,12px 66px,18px 66px #4169e1,24px 66px,30px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,12px 72px,18px 72px,24px 72px #ffe3c5,30px 72px #ffe3c5,36px 72px,42px 72px #4169e1,48px 72px #4169e1,54px 72px,60px 72px,66px 72px,6px 78px,12px 78px #007f7f,18px 78px,24px 78px #ffe3c5,30px 78px #ffe3c5,36px 78px,42px 78px #4169e1,48px 78px,54px 78px,60px 78px #007f7f,66px 78px #007f7f,72px 78px,6px 84px,12px 84px #007f7f,18px 84px #007f7f,24px 84px,30px 84px,36px 84px,42px 84px,48px 84px,54px 84px #007f7f,60px 84px #007f7f,66px 84px,12px 90px,18px 90px,54px 90px,60px 90px; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-ash::before { - box-shadow: 30px 6px 0 0.020em,36px 6px 0 0.020em,42px 6px 0 0.020em,48px 6px 0 0.020em,54px 6px 0 0.020em,60px 6px 0 0.020em,24px 12px 0 0.020em,30px 12px 0 0.020em #ff614e,36px 12px 0 0.020em #ff614e,42px 12px 0 0.020em #ff614e,48px 12px 0 0.020em #f8f8ff,54px 12px 0 0.020em #f8f8ff,60px 12px 0 0.020em #007f7f,66px 12px 0 0.020em,18px 18px 0 0.020em,24px 18px 0 0.020em #ff614e,30px 18px 0 0.020em #ff614e,36px 18px 0 0.020em #ff614e,42px 18px 0 0.020em #ff614e,48px 18px 0 0.020em #f8f8ff,54px 18px 0 0.020em #f8f8ff,60px 18px 0 0.020em #f8f8ff,66px 18px 0 0.020em #f8f8ff,72px 18px 0 0.020em,18px 24px 0 0.020em,24px 24px 0 0.020em #ff614e,30px 24px 0 0.020em #ff614e,36px 24px 0 0.020em #ff614e,42px 24px 0 0.020em #ff614e,48px 24px 0 0.020em #f8f8ff,54px 24px 0 0.020em #f8f8ff,60px 24px 0 0.020em #007f7f,66px 24px 0 0.020em #007f7f,72px 24px 0 0.020em,78px 24px 0 0.020em,12px 30px 0 0.020em,18px 30px 0 0.020em,24px 30px 0 0.020em,30px 30px 0 0.020em #ff614e,36px 30px 0 0.020em #ff614e,42px 30px 0 0.020em #ff614e,48px 30px 0 0.020em #ff614e,54px 30px 0 0.020em #ff614e,60px 30px 0 0.020em #ff614e,66px 30px 0 0.020em #ff614e,72px 30px 0 0.020em #ff614e,78px 30px 0 0.020em #ff614e,84px 30px 0 0.020em,12px 36px 0 0.020em,18px 36px 0 0.020em,24px 36px 0 0.020em,30px 36px 0 0.020em,36px 36px 0 0.020em,42px 36px 0 0.020em,48px 36px 0 0.020em,54px 36px 0 0.020em #ff614e,60px 36px 0 0.020em #ff614e,66px 36px 0 0.020em #ff614e,72px 36px 0 0.020em,78px 36px 0 0.020em,6px 42px 0 0.020em,12px 42px 0 0.020em,18px 42px 0 0.020em,24px 42px 0 0.020em,30px 42px 0 0.020em,36px 42px 0 0.020em,42px 42px 0 0.020em,48px 42px 0 0.020em #ffe3c5,54px 42px 0 0.020em #ffe3c5,60px 42px 0 0.020em,66px 42px 0 0.020em #ffe3c5,72px 42px 0 0.020em,12px 48px 0 0.020em,18px 48px 0 0.020em,24px 48px 0 0.020em #ffe3c5,30px 48px 0 0.020em #ffe3c5,36px 48px 0 0.020em #ffe3c5,42px 48px 0 0.020em,48px 48px 0 0.020em #ffe3c5,54px 48px 0 0.020em #ffe3c5,60px 48px 0 0.020em,66px 48px 0 0.020em #ffe3c5,72px 48px 0 0.020em,18px 54px 0 0.020em,24px 54px 0 0.020em #ffe3c5,30px 54px 0 0.020em #ffe3c5,36px 54px 0 0.020em #ffe3c5,42px 54px 0 0.020em #ffe3c5,48px 54px 0 0.020em #ffe3c5,54px 54px 0 0.020em #ffe3c5,60px 54px 0 0.020em #ffe3c5,66px 54px 0 0.020em #ffe3c5,72px 54px 0 0.020em,12px 60px 0 0.020em,18px 60px 0 0.020em #4169e1,24px 60px 0 0.020em,30px 60px 0 0.020em,36px 60px 0 0.020em #ffe3c5,42px 60px 0 0.020em #ffe3c5,48px 60px 0 0.020em #ffe3c5,54px 60px 0 0.020em #ffe3c5,60px 60px 0 0.020em #ffe3c5,66px 60px 0 0.020em,12px 66px 0 0.020em,18px 66px 0 0.020em #4169e1,24px 66px 0 0.020em,30px 66px 0 0.020em,36px 66px 0 0.020em,42px 66px 0 0.020em,48px 66px 0 0.020em,54px 66px 0 0.020em,60px 66px 0 0.020em,12px 72px 0 0.020em,18px 72px 0 0.020em,24px 72px 0 0.020em #ffe3c5,30px 72px 0 0.020em #ffe3c5,36px 72px 0 0.020em,42px 72px 0 0.020em #4169e1,48px 72px 0 0.020em #4169e1,54px 72px 0 0.020em,60px 72px 0 0.020em,66px 72px 0 0.020em,6px 78px 0 0.020em,12px 78px 0 0.020em #007f7f,18px 78px 0 0.020em,24px 78px 0 0.020em #ffe3c5,30px 78px 0 0.020em #ffe3c5,36px 78px 0 0.020em,42px 78px 0 0.020em #4169e1,48px 78px 0 0.020em,54px 78px 0 0.020em,60px 78px 0 0.020em #007f7f,66px 78px 0 0.020em #007f7f,72px 78px 0 0.020em,6px 84px 0 0.020em,12px 84px 0 0.020em #007f7f,18px 84px 0 0.020em #007f7f,24px 84px 0 0.020em,30px 84px 0 0.020em,36px 84px 0 0.020em,42px 84px 0 0.020em,48px 84px 0 0.020em,54px 84px 0 0.020em #007f7f,60px 84px 0 0.020em #007f7f,66px 84px 0 0.020em,12px 90px 0 0.020em,18px 90px 0 0.020em,54px 90px 0 0.020em,60px 90px 0 0.020em; - } -} - -.nes-pokeball { - position: relative; - display: inline-block; - width: 84px; - height: 84px; -} - -.nes-pokeball::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #060606; - box-shadow: 36px 6px,42px 6px,48px 6px,54px 6px,24px 12px,30px 12px,36px 12px #ff001d,42px 12px #ff001d,48px 12px #ff001d,54px 12px #ff001d,60px 12px,66px 12px,18px 18px,24px 18px #fff,30px 18px #fff,36px 18px #ff001d,42px 18px #ff001d,48px 18px #ff001d,54px 18px #ff001d,60px 18px #ff001d,66px 18px #ff001d,72px 18px,12px 24px,18px 24px #fff,24px 24px #fff,30px 24px #ff001d,36px 24px #ff001d,42px 24px #ff001d,48px 24px #ff001d,54px 24px #ff001d,60px 24px #ff001d,66px 24px #ff001d,72px 24px,78px 24px,12px 30px,18px 30px #fff,24px 30px #ff001d,30px 30px #ff001d,36px 30px #ff001d,42px 30px #ff001d,48px 30px #ff001d,54px 30px #ff001d,60px 30px #ff001d,66px 30px #ff001d,72px 30px #ff001d,78px 30px,6px 36px,12px 36px #fff,18px 36px #ff001d,24px 36px #ff001d,30px 36px #ff001d,36px 36px #ff001d,42px 36px #ff001d,48px 36px #ff001d,54px 36px #ff001d,60px 36px #ff001d,66px 36px #ff001d,72px 36px #ff001d,78px 36px #ff001d,84px 36px,6px 42px,12px 42px,18px 42px,24px 42px #ff001d,30px 42px #ff001d,36px 42px #ff001d,42px 42px #ff001d,48px 42px,54px 42px,60px 42px,66px 42px #ff001d,72px 42px #ff001d,78px 42px #ff001d,84px 42px,6px 48px,12px 48px,18px 48px,24px 48px,30px 48px #ff001d,36px 48px #ff001d,42px 48px,48px 48px #fff,54px 48px #fff,60px 48px #fff,66px 48px,72px 48px #ff001d,78px 48px #ff001d,84px 48px,6px 54px,12px 54px #9fa1a1,18px 54px #fff,24px 54px,30px 54px,36px 54px,42px 54px,48px 54px #fff,54px 54px #fff,60px 54px #fff,66px 54px,72px 54px,78px 54px,84px 54px,12px 60px,18px 60px #fff,24px 60px #fff,30px 60px #fff,36px 60px,42px 60px,48px 60px #fff,54px 60px #fff,60px 60px #fff,66px 60px,72px 60px #fff,78px 60px,12px 66px,18px 66px #fff,24px 66px #fff,30px 66px #fff,36px 66px #fff,42px 66px #fff,48px 66px,54px 66px,60px 66px,66px 66px #fff,72px 66px #fff,78px 66px,18px 72px,24px 72px #9fa1a1,30px 72px #9fa1a1,36px 72px #fff,42px 72px #fff,48px 72px #fff,54px 72px #fff,60px 72px #fff,66px 72px #fff,72px 72px,24px 78px,30px 78px,36px 78px #9fa1a1,42px 78px #9fa1a1,48px 78px #9fa1a1,54px 78px #9fa1a1,60px 78px,66px 78px,36px 84px,42px 84px,48px 84px,54px 84px; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-pokeball::before { - box-shadow: 36px 6px 0 0.020em,42px 6px 0 0.020em,48px 6px 0 0.020em,54px 6px 0 0.020em,24px 12px 0 0.020em,30px 12px 0 0.020em,36px 12px 0 0.020em #ff001d,42px 12px 0 0.020em #ff001d,48px 12px 0 0.020em #ff001d,54px 12px 0 0.020em #ff001d,60px 12px 0 0.020em,66px 12px 0 0.020em,18px 18px 0 0.020em,24px 18px 0 0.020em #fff,30px 18px 0 0.020em #fff,36px 18px 0 0.020em #ff001d,42px 18px 0 0.020em #ff001d,48px 18px 0 0.020em #ff001d,54px 18px 0 0.020em #ff001d,60px 18px 0 0.020em #ff001d,66px 18px 0 0.020em #ff001d,72px 18px 0 0.020em,12px 24px 0 0.020em,18px 24px 0 0.020em #fff,24px 24px 0 0.020em #fff,30px 24px 0 0.020em #ff001d,36px 24px 0 0.020em #ff001d,42px 24px 0 0.020em #ff001d,48px 24px 0 0.020em #ff001d,54px 24px 0 0.020em #ff001d,60px 24px 0 0.020em #ff001d,66px 24px 0 0.020em #ff001d,72px 24px 0 0.020em,78px 24px 0 0.020em,12px 30px 0 0.020em,18px 30px 0 0.020em #fff,24px 30px 0 0.020em #ff001d,30px 30px 0 0.020em #ff001d,36px 30px 0 0.020em #ff001d,42px 30px 0 0.020em #ff001d,48px 30px 0 0.020em #ff001d,54px 30px 0 0.020em #ff001d,60px 30px 0 0.020em #ff001d,66px 30px 0 0.020em #ff001d,72px 30px 0 0.020em #ff001d,78px 30px 0 0.020em,6px 36px 0 0.020em,12px 36px 0 0.020em #fff,18px 36px 0 0.020em #ff001d,24px 36px 0 0.020em #ff001d,30px 36px 0 0.020em #ff001d,36px 36px 0 0.020em #ff001d,42px 36px 0 0.020em #ff001d,48px 36px 0 0.020em #ff001d,54px 36px 0 0.020em #ff001d,60px 36px 0 0.020em #ff001d,66px 36px 0 0.020em #ff001d,72px 36px 0 0.020em #ff001d,78px 36px 0 0.020em #ff001d,84px 36px 0 0.020em,6px 42px 0 0.020em,12px 42px 0 0.020em,18px 42px 0 0.020em,24px 42px 0 0.020em #ff001d,30px 42px 0 0.020em #ff001d,36px 42px 0 0.020em #ff001d,42px 42px 0 0.020em #ff001d,48px 42px 0 0.020em,54px 42px 0 0.020em,60px 42px 0 0.020em,66px 42px 0 0.020em #ff001d,72px 42px 0 0.020em #ff001d,78px 42px 0 0.020em #ff001d,84px 42px 0 0.020em,6px 48px 0 0.020em,12px 48px 0 0.020em,18px 48px 0 0.020em,24px 48px 0 0.020em,30px 48px 0 0.020em #ff001d,36px 48px 0 0.020em #ff001d,42px 48px 0 0.020em,48px 48px 0 0.020em #fff,54px 48px 0 0.020em #fff,60px 48px 0 0.020em #fff,66px 48px 0 0.020em,72px 48px 0 0.020em #ff001d,78px 48px 0 0.020em #ff001d,84px 48px 0 0.020em,6px 54px 0 0.020em,12px 54px 0 0.020em #9fa1a1,18px 54px 0 0.020em #fff,24px 54px 0 0.020em,30px 54px 0 0.020em,36px 54px 0 0.020em,42px 54px 0 0.020em,48px 54px 0 0.020em #fff,54px 54px 0 0.020em #fff,60px 54px 0 0.020em #fff,66px 54px 0 0.020em,72px 54px 0 0.020em,78px 54px 0 0.020em,84px 54px 0 0.020em,12px 60px 0 0.020em,18px 60px 0 0.020em #fff,24px 60px 0 0.020em #fff,30px 60px 0 0.020em #fff,36px 60px 0 0.020em,42px 60px 0 0.020em,48px 60px 0 0.020em #fff,54px 60px 0 0.020em #fff,60px 60px 0 0.020em #fff,66px 60px 0 0.020em,72px 60px 0 0.020em #fff,78px 60px 0 0.020em,12px 66px 0 0.020em,18px 66px 0 0.020em #fff,24px 66px 0 0.020em #fff,30px 66px 0 0.020em #fff,36px 66px 0 0.020em #fff,42px 66px 0 0.020em #fff,48px 66px 0 0.020em,54px 66px 0 0.020em,60px 66px 0 0.020em,66px 66px 0 0.020em #fff,72px 66px 0 0.020em #fff,78px 66px 0 0.020em,18px 72px 0 0.020em,24px 72px 0 0.020em #9fa1a1,30px 72px 0 0.020em #9fa1a1,36px 72px 0 0.020em #fff,42px 72px 0 0.020em #fff,48px 72px 0 0.020em #fff,54px 72px 0 0.020em #fff,60px 72px 0 0.020em #fff,66px 72px 0 0.020em #fff,72px 72px 0 0.020em,24px 78px 0 0.020em,30px 78px 0 0.020em,36px 78px 0 0.020em #9fa1a1,42px 78px 0 0.020em #9fa1a1,48px 78px 0 0.020em #9fa1a1,54px 78px 0 0.020em #9fa1a1,60px 78px 0 0.020em,66px 78px 0 0.020em,36px 84px 0 0.020em,42px 84px 0 0.020em,48px 84px 0 0.020em,54px 84px 0 0.020em; - } -} - -.nes-bulbasaur { - position: relative; - display: inline-block; - width: 120px; - height: 102px; -} - -.nes-bulbasaur::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #000; - box-shadow: 78px 6px,84px 6px,90px 6px,72px 12px,78px 12px #8beb46,84px 12px #8beb46,90px 12px #8beb46,96px 12px,60px 18px,66px 18px,72px 18px,78px 18px #8beb46,84px 18px #8beb46,90px 18px #8beb46,96px 18px,48px 24px,54px 24px,60px 24px #8beb46,66px 24px #8beb46,72px 24px #2d8d22,78px 24px #8beb46,84px 24px #8beb46,90px 24px #2d8d22,96px 24px #8beb46,102px 24px,108px 24px,24px 30px,30px 30px,42px 30px,48px 30px #8beb46,54px 30px #8beb46,60px 30px #8beb46,66px 30px #2d8d22,72px 30px #2d8d22,78px 30px #8beb46,84px 30px #8beb46,90px 30px #2d8d22,96px 30px #8beb46,102px 30px #8beb46,108px 30px #8beb46,114px 30px,18px 36px,24px 36px #5ceee1,30px 36px #5ceee1,36px 36px,42px 36px,48px 36px #8beb46,54px 36px #8beb46,60px 36px #2d8d22,66px 36px #8beb46,72px 36px #2d8d22,78px 36px #8beb46,84px 36px #8beb46,90px 36px #8beb46,96px 36px #2d8d22,102px 36px #8beb46,108px 36px #8beb46,114px 36px #8beb46,120px 36px,18px 42px,24px 42px #5ceee1,30px 42px #5ceee1,36px 42px #5ceee1,42px 42px,48px 42px,54px 42px #2d8d22,60px 42px #8beb46,66px 42px #2d8d22,72px 42px #8beb46,78px 42px #8beb46,84px 42px #8beb46,90px 42px #8beb46,96px 42px #8beb46,102px 42px #2d8d22,108px 42px #8beb46,114px 42px #8beb46,120px 42px,18px 48px,24px 48px #5ceee1,30px 48px #5ceee1,36px 48px #5ceee1,42px 48px #5ceee1,48px 48px #3fc3b5,54px 48px,60px 48px #8beb46,66px 48px #2d8d22,72px 48px #8beb46,78px 48px #8beb46,84px 48px #8beb46,90px 48px #8beb46,96px 48px #8beb46,102px 48px #2d8d22,108px 48px #8beb46,114px 48px #8beb46,120px 48px,12px 54px,18px 54px #5ceee1,24px 54px #5ceee1,30px 54px #3fc3b5,36px 54px #5ceee1,42px 54px #3fc3b5,48px 54px #3fc3b5,54px 54px #5ceee1,60px 54px,66px 54px,72px 54px,78px 54px #8beb46,84px 54px #8beb46,90px 54px #8beb46,96px 54px #8beb46,102px 54px #2d8d22,108px 54px #8beb46,114px 54px,6px 60px,12px 60px,18px 60px #3fc3b5,24px 60px #5ceee1,30px 60px #5ceee1,36px 60px #5ceee1,42px 60px #5ceee1,48px 60px #5ceee1,54px 60px #5ceee1,60px 60px #5ceee1,66px 60px #5ceee1,72px 60px,78px 60px #8beb46,84px 60px #8beb46,90px 60px #8beb46,96px 60px,102px 60px,108px 60px,114px 60px,6px 66px,12px 66px,18px 66px #3fc3b5,24px 66px #5ceee1,30px 66px #5ceee1,36px 66px #5ceee1,42px 66px #3fc3b5,48px 66px #5ceee1,54px 66px #5ceee1,60px 66px #5ceee1,66px 66px,72px 66px #3fc3b5,78px 66px,84px 66px,90px 66px,96px 66px #3fc3b5,102px 66px #3fc3b5,108px 66px #3fc3b5,114px 66px,6px 72px,12px 72px #5ceee1,18px 72px #5ceee1,24px 72px #5ceee1,30px 72px #5ceee1,36px 72px #3fc3b5,42px 72px #5ceee1,48px 72px,54px 72px,60px 72px #5ceee1,66px 72px #3fc3b5,72px 72px #3fc3b5,78px 72px #3fc3b5,84px 72px #3fc3b5,90px 72px #3fc3b5,96px 72px,102px 72px #3fc3b5,108px 72px #fdfdf5,114px 72px,6px 78px,12px 78px #3fc3b5,18px 78px #5ceee1,24px 78px #5ceee1,30px 78px #5ceee1,36px 78px #5ceee1,42px 78px,48px 78px #ca242a,54px 78px #fdfdf5,60px 78px #fdfdf5,66px 78px #3fc3b5,72px 78px #3fc3b5,78px 78px,84px 78px #3fc3b5,90px 78px #3fc3b5,96px 78px,102px 78px,108px 78px,12px 84px,18px 84px #3fc3b5,24px 84px #5ceee1,30px 84px #5ceee1,36px 84px #5ceee1,42px 84px,48px 84px #ca242a,54px 84px #fdfdf5,60px 84px #5ceee1,66px 84px #3fc3b5,72px 84px,78px 84px #3fc3b5,84px 84px #3fc3b5,90px 84px,18px 90px,24px 90px,30px 90px #3fc3b5,36px 90px #3fc3b5,42px 90px #3fc3b5,48px 90px #3fc3b5,54px 90px #3fc3b5,60px 90px #3fc3b5,66px 90px,72px 90px #3fc3b5,78px 90px #3fc3b5,84px 90px #3fc3b5,90px 90px,30px 96px,36px 96px,42px 96px,48px 96px,54px 96px,60px 96px,66px 96px,72px 96px #fdfdf5,78px 96px #3fc3b5,84px 96px #fdfdf5,90px 96px,72px 102px,78px 102px,84px 102px; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-bulbasaur::before { - box-shadow: 78px 6px 0 0.020em,84px 6px 0 0.020em,90px 6px 0 0.020em,72px 12px 0 0.020em,78px 12px 0 0.020em #8beb46,84px 12px 0 0.020em #8beb46,90px 12px 0 0.020em #8beb46,96px 12px 0 0.020em,60px 18px 0 0.020em,66px 18px 0 0.020em,72px 18px 0 0.020em,78px 18px 0 0.020em #8beb46,84px 18px 0 0.020em #8beb46,90px 18px 0 0.020em #8beb46,96px 18px 0 0.020em,48px 24px 0 0.020em,54px 24px 0 0.020em,60px 24px 0 0.020em #8beb46,66px 24px 0 0.020em #8beb46,72px 24px 0 0.020em #2d8d22,78px 24px 0 0.020em #8beb46,84px 24px 0 0.020em #8beb46,90px 24px 0 0.020em #2d8d22,96px 24px 0 0.020em #8beb46,102px 24px 0 0.020em,108px 24px 0 0.020em,24px 30px 0 0.020em,30px 30px 0 0.020em,42px 30px 0 0.020em,48px 30px 0 0.020em #8beb46,54px 30px 0 0.020em #8beb46,60px 30px 0 0.020em #8beb46,66px 30px 0 0.020em #2d8d22,72px 30px 0 0.020em #2d8d22,78px 30px 0 0.020em #8beb46,84px 30px 0 0.020em #8beb46,90px 30px 0 0.020em #2d8d22,96px 30px 0 0.020em #8beb46,102px 30px 0 0.020em #8beb46,108px 30px 0 0.020em #8beb46,114px 30px 0 0.020em,18px 36px 0 0.020em,24px 36px 0 0.020em #5ceee1,30px 36px 0 0.020em #5ceee1,36px 36px 0 0.020em,42px 36px 0 0.020em,48px 36px 0 0.020em #8beb46,54px 36px 0 0.020em #8beb46,60px 36px 0 0.020em #2d8d22,66px 36px 0 0.020em #8beb46,72px 36px 0 0.020em #2d8d22,78px 36px 0 0.020em #8beb46,84px 36px 0 0.020em #8beb46,90px 36px 0 0.020em #8beb46,96px 36px 0 0.020em #2d8d22,102px 36px 0 0.020em #8beb46,108px 36px 0 0.020em #8beb46,114px 36px 0 0.020em #8beb46,120px 36px 0 0.020em,18px 42px 0 0.020em,24px 42px 0 0.020em #5ceee1,30px 42px 0 0.020em #5ceee1,36px 42px 0 0.020em #5ceee1,42px 42px 0 0.020em,48px 42px 0 0.020em,54px 42px 0 0.020em #2d8d22,60px 42px 0 0.020em #8beb46,66px 42px 0 0.020em #2d8d22,72px 42px 0 0.020em #8beb46,78px 42px 0 0.020em #8beb46,84px 42px 0 0.020em #8beb46,90px 42px 0 0.020em #8beb46,96px 42px 0 0.020em #8beb46,102px 42px 0 0.020em #2d8d22,108px 42px 0 0.020em #8beb46,114px 42px 0 0.020em #8beb46,120px 42px 0 0.020em,18px 48px 0 0.020em,24px 48px 0 0.020em #5ceee1,30px 48px 0 0.020em #5ceee1,36px 48px 0 0.020em #5ceee1,42px 48px 0 0.020em #5ceee1,48px 48px 0 0.020em #3fc3b5,54px 48px 0 0.020em,60px 48px 0 0.020em #8beb46,66px 48px 0 0.020em #2d8d22,72px 48px 0 0.020em #8beb46,78px 48px 0 0.020em #8beb46,84px 48px 0 0.020em #8beb46,90px 48px 0 0.020em #8beb46,96px 48px 0 0.020em #8beb46,102px 48px 0 0.020em #2d8d22,108px 48px 0 0.020em #8beb46,114px 48px 0 0.020em #8beb46,120px 48px 0 0.020em,12px 54px 0 0.020em,18px 54px 0 0.020em #5ceee1,24px 54px 0 0.020em #5ceee1,30px 54px 0 0.020em #3fc3b5,36px 54px 0 0.020em #5ceee1,42px 54px 0 0.020em #3fc3b5,48px 54px 0 0.020em #3fc3b5,54px 54px 0 0.020em #5ceee1,60px 54px 0 0.020em,66px 54px 0 0.020em,72px 54px 0 0.020em,78px 54px 0 0.020em #8beb46,84px 54px 0 0.020em #8beb46,90px 54px 0 0.020em #8beb46,96px 54px 0 0.020em #8beb46,102px 54px 0 0.020em #2d8d22,108px 54px 0 0.020em #8beb46,114px 54px 0 0.020em,6px 60px 0 0.020em,12px 60px 0 0.020em,18px 60px 0 0.020em #3fc3b5,24px 60px 0 0.020em #5ceee1,30px 60px 0 0.020em #5ceee1,36px 60px 0 0.020em #5ceee1,42px 60px 0 0.020em #5ceee1,48px 60px 0 0.020em #5ceee1,54px 60px 0 0.020em #5ceee1,60px 60px 0 0.020em #5ceee1,66px 60px 0 0.020em #5ceee1,72px 60px 0 0.020em,78px 60px 0 0.020em #8beb46,84px 60px 0 0.020em #8beb46,90px 60px 0 0.020em #8beb46,96px 60px 0 0.020em,102px 60px 0 0.020em,108px 60px 0 0.020em,114px 60px 0 0.020em,6px 66px 0 0.020em,12px 66px 0 0.020em,18px 66px 0 0.020em #3fc3b5,24px 66px 0 0.020em #5ceee1,30px 66px 0 0.020em #5ceee1,36px 66px 0 0.020em #5ceee1,42px 66px 0 0.020em #3fc3b5,48px 66px 0 0.020em #5ceee1,54px 66px 0 0.020em #5ceee1,60px 66px 0 0.020em #5ceee1,66px 66px 0 0.020em,72px 66px 0 0.020em #3fc3b5,78px 66px 0 0.020em,84px 66px 0 0.020em,90px 66px 0 0.020em,96px 66px 0 0.020em #3fc3b5,102px 66px 0 0.020em #3fc3b5,108px 66px 0 0.020em #3fc3b5,114px 66px 0 0.020em,6px 72px 0 0.020em,12px 72px 0 0.020em #5ceee1,18px 72px 0 0.020em #5ceee1,24px 72px 0 0.020em #5ceee1,30px 72px 0 0.020em #5ceee1,36px 72px 0 0.020em #3fc3b5,42px 72px 0 0.020em #5ceee1,48px 72px 0 0.020em,54px 72px 0 0.020em,60px 72px 0 0.020em #5ceee1,66px 72px 0 0.020em #3fc3b5,72px 72px 0 0.020em #3fc3b5,78px 72px 0 0.020em #3fc3b5,84px 72px 0 0.020em #3fc3b5,90px 72px 0 0.020em #3fc3b5,96px 72px 0 0.020em,102px 72px 0 0.020em #3fc3b5,108px 72px 0 0.020em #fdfdf5,114px 72px 0 0.020em,6px 78px 0 0.020em,12px 78px 0 0.020em #3fc3b5,18px 78px 0 0.020em #5ceee1,24px 78px 0 0.020em #5ceee1,30px 78px 0 0.020em #5ceee1,36px 78px 0 0.020em #5ceee1,42px 78px 0 0.020em,48px 78px 0 0.020em #ca242a,54px 78px 0 0.020em #fdfdf5,60px 78px 0 0.020em #fdfdf5,66px 78px 0 0.020em #3fc3b5,72px 78px 0 0.020em #3fc3b5,78px 78px 0 0.020em,84px 78px 0 0.020em #3fc3b5,90px 78px 0 0.020em #3fc3b5,96px 78px 0 0.020em,102px 78px 0 0.020em,108px 78px 0 0.020em,12px 84px 0 0.020em,18px 84px 0 0.020em #3fc3b5,24px 84px 0 0.020em #5ceee1,30px 84px 0 0.020em #5ceee1,36px 84px 0 0.020em #5ceee1,42px 84px 0 0.020em,48px 84px 0 0.020em #ca242a,54px 84px 0 0.020em #fdfdf5,60px 84px 0 0.020em #5ceee1,66px 84px 0 0.020em #3fc3b5,72px 84px 0 0.020em,78px 84px 0 0.020em #3fc3b5,84px 84px 0 0.020em #3fc3b5,90px 84px 0 0.020em,18px 90px 0 0.020em,24px 90px 0 0.020em,30px 90px 0 0.020em #3fc3b5,36px 90px 0 0.020em #3fc3b5,42px 90px 0 0.020em #3fc3b5,48px 90px 0 0.020em #3fc3b5,54px 90px 0 0.020em #3fc3b5,60px 90px 0 0.020em #3fc3b5,66px 90px 0 0.020em,72px 90px 0 0.020em #3fc3b5,78px 90px 0 0.020em #3fc3b5,84px 90px 0 0.020em #3fc3b5,90px 90px 0 0.020em,30px 96px 0 0.020em,36px 96px 0 0.020em,42px 96px 0 0.020em,48px 96px 0 0.020em,54px 96px 0 0.020em,60px 96px 0 0.020em,66px 96px 0 0.020em,72px 96px 0 0.020em #fdfdf5,78px 96px 0 0.020em #3fc3b5,84px 96px 0 0.020em #fdfdf5,90px 96px 0 0.020em,72px 102px 0 0.020em,78px 102px 0 0.020em,84px 102px 0 0.020em; - } -} - -.nes-charmander { - position: relative; - display: inline-block; - width: 126px; - height: 108px; -} - -.nes-charmander::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #f77702; - box-shadow: 30px 6px #000202,36px 6px #000202,42px 6px #000202,48px 6px #000202,108px 6px #000202,24px 12px #000202,30px 12px,36px 12px,42px 12px,48px 12px,54px 12px #000202,102px 12px #000202,108px 12px #eb2010,114px 12px #000202,18px 18px #000202,24px 18px,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px #000202,102px 18px #000202,108px 18px #eb2010,114px 18px #eb2010,120px 18px #000202,18px 24px #000202,24px 24px,30px 24px,36px 24px,42px 24px,48px 24px,54px 24px,60px 24px #000202,102px 24px #000202,108px 24px #eb2010,114px 24px #eb2010,120px 24px #000202,12px 30px #000202,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px,48px 30px,54px 30px,60px 30px,66px 30px #000202,96px 30px #000202,102px 30px #eb2010,108px 30px #eb2010,114px 30px,120px 30px #eb2010,126px 30px #000202,6px 36px #000202,12px 36px,18px 36px,24px 36px,30px 36px,36px 36px #fdfcff,42px 36px #000202,48px 36px,54px 36px,60px 36px,66px 36px #000202,96px 36px #000202,102px 36px #eb2010,108px 36px,114px 36px #e7d70e,120px 36px #eb2010,126px 36px #000202,6px 42px #000202,12px 42px,18px 42px,24px 42px,30px 42px,36px 42px #000202,42px 42px #000202,48px 42px,54px 42px,60px 42px,66px 42px,72px 42px #000202,96px 42px #000202,102px 42px #eb2010,108px 42px #e5d70a,114px 42px #e5d70a,120px 42px #eb2010,126px 42px #000202,6px 48px #000202,12px 48px,18px 48px,24px 48px,30px 48px,36px 48px #000202,42px 48px #000202,48px 48px,54px 48px,60px 48px,66px 48px,72px 48px #000202,102px 48px #000202,108px 48px #e5d70a,114px 48px #000202,120px 48px #000202,12px 54px #000202,18px 54px,24px 54px,30px 54px,36px 54px,42px 54px,48px 54px,54px 54px,60px 54px,66px 54px,72px 54px,78px 54px #000202,102px 54px #000202,108px 54px,114px 54px #000202,18px 60px #000202,24px 60px #000202,30px 60px,36px 60px,42px 60px,48px 60px,54px 60px,60px 60px,66px 60px,72px 60px,78px 60px,84px 60px #000202,96px 60px #000202,102px 60px,108px 60px,114px 60px #000202,30px 66px #000202,36px 66px #000202,42px 66px #000202,48px 66px,54px 66px,60px 66px #000202,66px 66px,72px 66px,78px 66px,84px 66px #000202,90px 66px #000202,96px 66px,102px 66px,108px 66px #000202,36px 72px #000202,42px 72px #e7d70e,48px 72px #e5d70a,54px 72px #000202,60px 72px,66px 72px,72px 72px,78px 72px,84px 72px,90px 72px #000202,96px 72px,102px 72px,108px 72px #000202,36px 78px #000202,42px 78px #e5d70a,48px 78px #e5d70a,54px 78px #e5d70a,60px 78px #000202,66px 78px #000202,72px 78px,78px 78px,84px 78px,90px 78px #000202,96px 78px,102px 78px #000202,30px 84px #000202,36px 84px #fdfcff,42px 84px #000202,48px 84px #e7d70e,54px 84px #e5d70a,60px 84px #e5d70a,66px 84px,72px 84px,78px 84px,84px 84px,90px 84px #000202,96px 84px #000202,36px 90px #000202,42px 90px #000202,48px 90px #000202,54px 90px #e5d70a,60px 90px #e5d70a,66px 90px,72px 90px,78px 90px,84px 90px #000202,90px 90px #000202,54px 96px #000202,60px 96px #000202,66px 96px #000202,78px 96px #000202,84px 96px #000202,60px 102px #000202,66px 102px #fdfcff,78px 102px #fdfcff,84px 102px #000202,66px 108px #000202,72px 108px #000202,78px 108px #000202; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-charmander::before { - box-shadow: 30px 6px 0 0.020em #000202,36px 6px 0 0.020em #000202,42px 6px 0 0.020em #000202,48px 6px 0 0.020em #000202,108px 6px 0 0.020em #000202,24px 12px 0 0.020em #000202,30px 12px 0 0.020em,36px 12px 0 0.020em,42px 12px 0 0.020em,48px 12px 0 0.020em,54px 12px 0 0.020em #000202,102px 12px 0 0.020em #000202,108px 12px 0 0.020em #eb2010,114px 12px 0 0.020em #000202,18px 18px 0 0.020em #000202,24px 18px 0 0.020em,30px 18px 0 0.020em,36px 18px 0 0.020em,42px 18px 0 0.020em,48px 18px 0 0.020em,54px 18px 0 0.020em,60px 18px 0 0.020em #000202,102px 18px 0 0.020em #000202,108px 18px 0 0.020em #eb2010,114px 18px 0 0.020em #eb2010,120px 18px 0 0.020em #000202,18px 24px 0 0.020em #000202,24px 24px 0 0.020em,30px 24px 0 0.020em,36px 24px 0 0.020em,42px 24px 0 0.020em,48px 24px 0 0.020em,54px 24px 0 0.020em,60px 24px 0 0.020em #000202,102px 24px 0 0.020em #000202,108px 24px 0 0.020em #eb2010,114px 24px 0 0.020em #eb2010,120px 24px 0 0.020em #000202,12px 30px 0 0.020em #000202,18px 30px 0 0.020em,24px 30px 0 0.020em,30px 30px 0 0.020em,36px 30px 0 0.020em,42px 30px 0 0.020em,48px 30px 0 0.020em,54px 30px 0 0.020em,60px 30px 0 0.020em,66px 30px 0 0.020em #000202,96px 30px 0 0.020em #000202,102px 30px 0 0.020em #eb2010,108px 30px 0 0.020em #eb2010,114px 30px 0 0.020em,120px 30px 0 0.020em #eb2010,126px 30px 0 0.020em #000202,6px 36px 0 0.020em #000202,12px 36px 0 0.020em,18px 36px 0 0.020em,24px 36px 0 0.020em,30px 36px 0 0.020em,36px 36px 0 0.020em #fdfcff,42px 36px 0 0.020em #000202,48px 36px 0 0.020em,54px 36px 0 0.020em,60px 36px 0 0.020em,66px 36px 0 0.020em #000202,96px 36px 0 0.020em #000202,102px 36px 0 0.020em #eb2010,108px 36px 0 0.020em,114px 36px 0 0.020em #e7d70e,120px 36px 0 0.020em #eb2010,126px 36px 0 0.020em #000202,6px 42px 0 0.020em #000202,12px 42px 0 0.020em,18px 42px 0 0.020em,24px 42px 0 0.020em,30px 42px 0 0.020em,36px 42px 0 0.020em #000202,42px 42px 0 0.020em #000202,48px 42px 0 0.020em,54px 42px 0 0.020em,60px 42px 0 0.020em,66px 42px 0 0.020em,72px 42px 0 0.020em #000202,96px 42px 0 0.020em #000202,102px 42px 0 0.020em #eb2010,108px 42px 0 0.020em #e5d70a,114px 42px 0 0.020em #e5d70a,120px 42px 0 0.020em #eb2010,126px 42px 0 0.020em #000202,6px 48px 0 0.020em #000202,12px 48px 0 0.020em,18px 48px 0 0.020em,24px 48px 0 0.020em,30px 48px 0 0.020em,36px 48px 0 0.020em #000202,42px 48px 0 0.020em #000202,48px 48px 0 0.020em,54px 48px 0 0.020em,60px 48px 0 0.020em,66px 48px 0 0.020em,72px 48px 0 0.020em #000202,102px 48px 0 0.020em #000202,108px 48px 0 0.020em #e5d70a,114px 48px 0 0.020em #000202,120px 48px 0 0.020em #000202,12px 54px 0 0.020em #000202,18px 54px 0 0.020em,24px 54px 0 0.020em,30px 54px 0 0.020em,36px 54px 0 0.020em,42px 54px 0 0.020em,48px 54px 0 0.020em,54px 54px 0 0.020em,60px 54px 0 0.020em,66px 54px 0 0.020em,72px 54px 0 0.020em,78px 54px 0 0.020em #000202,102px 54px 0 0.020em #000202,108px 54px 0 0.020em,114px 54px 0 0.020em #000202,18px 60px 0 0.020em #000202,24px 60px 0 0.020em #000202,30px 60px 0 0.020em,36px 60px 0 0.020em,42px 60px 0 0.020em,48px 60px 0 0.020em,54px 60px 0 0.020em,60px 60px 0 0.020em,66px 60px 0 0.020em,72px 60px 0 0.020em,78px 60px 0 0.020em,84px 60px 0 0.020em #000202,96px 60px 0 0.020em #000202,102px 60px 0 0.020em,108px 60px 0 0.020em,114px 60px 0 0.020em #000202,30px 66px 0 0.020em #000202,36px 66px 0 0.020em #000202,42px 66px 0 0.020em #000202,48px 66px 0 0.020em,54px 66px 0 0.020em,60px 66px 0 0.020em #000202,66px 66px 0 0.020em,72px 66px 0 0.020em,78px 66px 0 0.020em,84px 66px 0 0.020em #000202,90px 66px 0 0.020em #000202,96px 66px 0 0.020em,102px 66px 0 0.020em,108px 66px 0 0.020em #000202,36px 72px 0 0.020em #000202,42px 72px 0 0.020em #e7d70e,48px 72px 0 0.020em #e5d70a,54px 72px 0 0.020em #000202,60px 72px 0 0.020em,66px 72px 0 0.020em,72px 72px 0 0.020em,78px 72px 0 0.020em,84px 72px 0 0.020em,90px 72px 0 0.020em #000202,96px 72px 0 0.020em,102px 72px 0 0.020em,108px 72px 0 0.020em #000202,36px 78px 0 0.020em #000202,42px 78px 0 0.020em #e5d70a,48px 78px 0 0.020em #e5d70a,54px 78px 0 0.020em #e5d70a,60px 78px 0 0.020em #000202,66px 78px 0 0.020em #000202,72px 78px 0 0.020em,78px 78px 0 0.020em,84px 78px 0 0.020em,90px 78px 0 0.020em #000202,96px 78px 0 0.020em,102px 78px 0 0.020em #000202,30px 84px 0 0.020em #000202,36px 84px 0 0.020em #fdfcff,42px 84px 0 0.020em #000202,48px 84px 0 0.020em #e7d70e,54px 84px 0 0.020em #e5d70a,60px 84px 0 0.020em #e5d70a,66px 84px 0 0.020em,72px 84px 0 0.020em,78px 84px 0 0.020em,84px 84px 0 0.020em,90px 84px 0 0.020em #000202,96px 84px 0 0.020em #000202,36px 90px 0 0.020em #000202,42px 90px 0 0.020em #000202,48px 90px 0 0.020em #000202,54px 90px 0 0.020em #e5d70a,60px 90px 0 0.020em #e5d70a,66px 90px 0 0.020em,72px 90px 0 0.020em,78px 90px 0 0.020em,84px 90px 0 0.020em #000202,90px 90px 0 0.020em #000202,54px 96px 0 0.020em #000202,60px 96px 0 0.020em #000202,66px 96px 0 0.020em #000202,78px 96px 0 0.020em #000202,84px 96px 0 0.020em #000202,60px 102px 0 0.020em #000202,66px 102px 0 0.020em #fdfcff,78px 102px 0 0.020em #fdfcff,84px 102px 0 0.020em #000202,66px 108px 0 0.020em #000202,72px 108px 0 0.020em #000202,78px 108px 0 0.020em #000202; - } -} - -.nes-squirtle { - position: relative; - display: inline-block; - width: 126px; - height: 102px; -} - -.nes-squirtle::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #9cf; - box-shadow: 24px 6px #000,30px 6px #000,36px 6px #000,42px 6px #000,102px 6px #000,108px 6px #000,114px 6px #000,18px 12px #000,24px 12px,30px 12px,36px 12px,42px 12px,48px 12px #000,54px 12px #000,96px 12px #000,102px 12px,108px 12px,114px 12px,120px 12px #000,12px 18px #000,18px 18px,24px 18px,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px #000,66px 18px #000,90px 18px #000,96px 18px,102px 18px,108px 18px,114px 18px,120px 18px,126px 18px #000,12px 24px #000,18px 24px,24px 24px,30px 24px,36px 24px,42px 24px,48px 24px,54px 24px,60px 24px #000,66px 24px #f89934,72px 24px #000,78px 24px #000,90px 24px #000,96px 24px,102px 24px,108px 24px,114px 24px #000,120px 24px,126px 24px #000,6px 30px #000,12px 30px #cb6633,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px,48px 30px,54px 30px,60px 30px,66px 30px #f89934,72px 30px #f89934,78px 30px #f89934,84px 30px #000,90px 30px,96px 30px,102px 30px,108px 30px #000,114px 30px,120px 30px,126px 30px #000,6px 36px #000,12px 36px,18px 36px,24px 36px,30px 36px,36px 36px #fff,42px 36px #000,48px 36px,54px 36px,60px 36px,66px 36px #fff,72px 36px #f89934,78px 36px #f89934,84px 36px #f89934,90px 36px #000,96px 36px,102px 36px,108px 36px #000,114px 36px,120px 36px #000,6px 42px #000,12px 42px,18px 42px,24px 42px,30px 42px,36px 42px #000,42px 42px #cb6633,48px 42px,54px 42px,60px 42px,66px 42px #fff,72px 42px #f89934,78px 42px #f89934,84px 42px #f89934,90px 42px #000,96px 42px,102px 42px #000,108px 42px #000,114px 42px #000,12px 48px #000,18px 48px,24px 48px,30px 48px,36px 48px #000,42px 48px #cb6633,48px 48px,54px 48px,60px 48px,66px 48px #000,72px 48px #fff,78px 48px #f89934,84px 48px #f89934,90px 48px #f89934,96px 48px #000,102px 48px #000,18px 54px #000,24px 54px #000,30px 54px,36px 54px,42px 54px,48px 54px,54px 54px #000,60px 54px #000,66px 54px,72px 54px,78px 54px #fff,84px 54px #f89934,90px 54px #f89934,96px 54px #000,18px 60px #000,24px 60px,30px 60px #000,36px 60px #000,42px 60px #000,48px 60px #000,54px 60px,60px 60px,66px 60px,72px 60px,78px 60px #fff,84px 60px #f89934,90px 60px #f89934,96px 60px #000,24px 66px #000,30px 66px #000,36px 66px #ff3,42px 66px #ff3,48px 66px #000,54px 66px,60px 66px,66px 66px,72px 66px #000,78px 66px #fff,84px 66px #f89934,90px 66px #f89934,96px 66px #000,36px 72px #000,42px 72px #ff3,48px 72px #ff3,54px 72px #000,60px 72px #000,66px 72px #000,72px 72px #000,78px 72px #fff,84px 72px #f89934,90px 72px #f89934,96px 72px #000,30px 78px #000,36px 78px,42px 78px #000,48px 78px #ff3,54px 78px #ff3,60px 78px #ff3,66px 78px #ff3,72px 78px #ff3,78px 78px #000,84px 78px #fff,90px 78px #000,36px 84px #000,42px 84px #000,48px 84px #000,54px 84px #000,60px 84px #ff3,66px 84px #ff3,72px 84px,78px 84px #000,84px 84px #fff,90px 84px #000,54px 90px #000,60px 90px #000,66px 90px #000,72px 90px,78px 90px #000,84px 90px #000,60px 96px #000,66px 96px,72px 96px,78px 96px,84px 96px #000,66px 102px #000,72px 102px #000,78px 102px #000; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-squirtle::before { - box-shadow: 24px 6px 0 0.020em #000,30px 6px 0 0.020em #000,36px 6px 0 0.020em #000,42px 6px 0 0.020em #000,102px 6px 0 0.020em #000,108px 6px 0 0.020em #000,114px 6px 0 0.020em #000,18px 12px 0 0.020em #000,24px 12px 0 0.020em,30px 12px 0 0.020em,36px 12px 0 0.020em,42px 12px 0 0.020em,48px 12px 0 0.020em #000,54px 12px 0 0.020em #000,96px 12px 0 0.020em #000,102px 12px 0 0.020em,108px 12px 0 0.020em,114px 12px 0 0.020em,120px 12px 0 0.020em #000,12px 18px 0 0.020em #000,18px 18px 0 0.020em,24px 18px 0 0.020em,30px 18px 0 0.020em,36px 18px 0 0.020em,42px 18px 0 0.020em,48px 18px 0 0.020em,54px 18px 0 0.020em,60px 18px 0 0.020em #000,66px 18px 0 0.020em #000,90px 18px 0 0.020em #000,96px 18px 0 0.020em,102px 18px 0 0.020em,108px 18px 0 0.020em,114px 18px 0 0.020em,120px 18px 0 0.020em,126px 18px 0 0.020em #000,12px 24px 0 0.020em #000,18px 24px 0 0.020em,24px 24px 0 0.020em,30px 24px 0 0.020em,36px 24px 0 0.020em,42px 24px 0 0.020em,48px 24px 0 0.020em,54px 24px 0 0.020em,60px 24px 0 0.020em #000,66px 24px 0 0.020em #f89934,72px 24px 0 0.020em #000,78px 24px 0 0.020em #000,90px 24px 0 0.020em #000,96px 24px 0 0.020em,102px 24px 0 0.020em,108px 24px 0 0.020em,114px 24px 0 0.020em #000,120px 24px 0 0.020em,126px 24px 0 0.020em #000,6px 30px 0 0.020em #000,12px 30px 0 0.020em #cb6633,18px 30px 0 0.020em,24px 30px 0 0.020em,30px 30px 0 0.020em,36px 30px 0 0.020em,42px 30px 0 0.020em,48px 30px 0 0.020em,54px 30px 0 0.020em,60px 30px 0 0.020em,66px 30px 0 0.020em #f89934,72px 30px 0 0.020em #f89934,78px 30px 0 0.020em #f89934,84px 30px 0 0.020em #000,90px 30px 0 0.020em,96px 30px 0 0.020em,102px 30px 0 0.020em,108px 30px 0 0.020em #000,114px 30px 0 0.020em,120px 30px 0 0.020em,126px 30px 0 0.020em #000,6px 36px 0 0.020em #000,12px 36px 0 0.020em,18px 36px 0 0.020em,24px 36px 0 0.020em,30px 36px 0 0.020em,36px 36px 0 0.020em #fff,42px 36px 0 0.020em #000,48px 36px 0 0.020em,54px 36px 0 0.020em,60px 36px 0 0.020em,66px 36px 0 0.020em #fff,72px 36px 0 0.020em #f89934,78px 36px 0 0.020em #f89934,84px 36px 0 0.020em #f89934,90px 36px 0 0.020em #000,96px 36px 0 0.020em,102px 36px 0 0.020em,108px 36px 0 0.020em #000,114px 36px 0 0.020em,120px 36px 0 0.020em #000,6px 42px 0 0.020em #000,12px 42px 0 0.020em,18px 42px 0 0.020em,24px 42px 0 0.020em,30px 42px 0 0.020em,36px 42px 0 0.020em #000,42px 42px 0 0.020em #cb6633,48px 42px 0 0.020em,54px 42px 0 0.020em,60px 42px 0 0.020em,66px 42px 0 0.020em #fff,72px 42px 0 0.020em #f89934,78px 42px 0 0.020em #f89934,84px 42px 0 0.020em #f89934,90px 42px 0 0.020em #000,96px 42px 0 0.020em,102px 42px 0 0.020em #000,108px 42px 0 0.020em #000,114px 42px 0 0.020em #000,12px 48px 0 0.020em #000,18px 48px 0 0.020em,24px 48px 0 0.020em,30px 48px 0 0.020em,36px 48px 0 0.020em #000,42px 48px 0 0.020em #cb6633,48px 48px 0 0.020em,54px 48px 0 0.020em,60px 48px 0 0.020em,66px 48px 0 0.020em #000,72px 48px 0 0.020em #fff,78px 48px 0 0.020em #f89934,84px 48px 0 0.020em #f89934,90px 48px 0 0.020em #f89934,96px 48px 0 0.020em #000,102px 48px 0 0.020em #000,18px 54px 0 0.020em #000,24px 54px 0 0.020em #000,30px 54px 0 0.020em,36px 54px 0 0.020em,42px 54px 0 0.020em,48px 54px 0 0.020em,54px 54px 0 0.020em #000,60px 54px 0 0.020em #000,66px 54px 0 0.020em,72px 54px 0 0.020em,78px 54px 0 0.020em #fff,84px 54px 0 0.020em #f89934,90px 54px 0 0.020em #f89934,96px 54px 0 0.020em #000,18px 60px 0 0.020em #000,24px 60px 0 0.020em,30px 60px 0 0.020em #000,36px 60px 0 0.020em #000,42px 60px 0 0.020em #000,48px 60px 0 0.020em #000,54px 60px 0 0.020em,60px 60px 0 0.020em,66px 60px 0 0.020em,72px 60px 0 0.020em,78px 60px 0 0.020em #fff,84px 60px 0 0.020em #f89934,90px 60px 0 0.020em #f89934,96px 60px 0 0.020em #000,24px 66px 0 0.020em #000,30px 66px 0 0.020em #000,36px 66px 0 0.020em #ff3,42px 66px 0 0.020em #ff3,48px 66px 0 0.020em #000,54px 66px 0 0.020em,60px 66px 0 0.020em,66px 66px 0 0.020em,72px 66px 0 0.020em #000,78px 66px 0 0.020em #fff,84px 66px 0 0.020em #f89934,90px 66px 0 0.020em #f89934,96px 66px 0 0.020em #000,36px 72px 0 0.020em #000,42px 72px 0 0.020em #ff3,48px 72px 0 0.020em #ff3,54px 72px 0 0.020em #000,60px 72px 0 0.020em #000,66px 72px 0 0.020em #000,72px 72px 0 0.020em #000,78px 72px 0 0.020em #fff,84px 72px 0 0.020em #f89934,90px 72px 0 0.020em #f89934,96px 72px 0 0.020em #000,30px 78px 0 0.020em #000,36px 78px 0 0.020em,42px 78px 0 0.020em #000,48px 78px 0 0.020em #ff3,54px 78px 0 0.020em #ff3,60px 78px 0 0.020em #ff3,66px 78px 0 0.020em #ff3,72px 78px 0 0.020em #ff3,78px 78px 0 0.020em #000,84px 78px 0 0.020em #fff,90px 78px 0 0.020em #000,36px 84px 0 0.020em #000,42px 84px 0 0.020em #000,48px 84px 0 0.020em #000,54px 84px 0 0.020em #000,60px 84px 0 0.020em #ff3,66px 84px 0 0.020em #ff3,72px 84px 0 0.020em,78px 84px 0 0.020em #000,84px 84px 0 0.020em #fff,90px 84px 0 0.020em #000,54px 90px 0 0.020em #000,60px 90px 0 0.020em #000,66px 90px 0 0.020em #000,72px 90px 0 0.020em,78px 90px 0 0.020em #000,84px 90px 0 0.020em #000,60px 96px 0 0.020em #000,66px 96px 0 0.020em,72px 96px 0 0.020em,78px 96px 0 0.020em,84px 96px 0 0.020em #000,66px 102px 0 0.020em #000,72px 102px 0 0.020em #000,78px 102px 0 0.020em #000; - } -} - -.nes-phone { - position: relative; - display: inline-block; - width: 48px; - height: 126px; -} - -.nes-phone::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #000; - box-shadow: 18px 6px,24px 6px,30px 6px,36px 6px,42px 6px,48px 6px,12px 12px,18px 12px,24px 12px #3c4665,30px 12px #3c4665,36px 12px #3c4665,42px 12px #596985,48px 12px,6px 18px,12px 18px,18px 18px #3c4665,24px 18px #3c4665,30px 18px #3c4665,36px 18px #3c4665,42px 18px #596985,48px 18px,6px 24px,12px 24px #3c4665,18px 24px #3c4665,24px 24px #3c4665,30px 24px #3c4665,36px 24px #3c4665,42px 24px #596985,48px 24px,6px 30px,12px 30px #3c4665,18px 30px #3c4665,24px 30px #3c4665,30px 30px #3c4665,36px 30px #3c4665,42px 30px #596985,48px 30px,6px 36px,12px 36px #3c4665,18px 36px #3c4665,24px 36px #3c4665,30px 36px #3c4665,36px 36px #3c4665,42px 36px #596985,48px 36px,6px 42px,12px 42px #3c4665,18px 42px #3c4665,24px 42px,30px 42px,36px 42px,42px 42px,48px 42px,6px 48px,12px 48px #3c4665,18px 48px #3c4665,24px 48px,6px 54px,12px 54px #3c4665,18px 54px #3c4665,24px 54px,6px 60px,12px 60px #3c4665,18px 60px #3c4665,24px 60px,6px 66px,12px 66px #3c4665,18px 66px #3c4665,24px 66px,6px 72px,12px 72px #3c4665,18px 72px #3c4665,24px 72px,6px 78px,12px 78px #3c4665,18px 78px #3c4665,24px 78px,6px 84px,12px 84px #3c4665,18px 84px #3c4665,24px 84px,6px 90px,12px 90px #3c4665,18px 90px #3c4665,24px 90px,30px 90px,36px 90px,42px 90px,48px 90px,6px 96px,12px 96px #3c4665,18px 96px #3c4665,24px 96px #3c4665,30px 96px #3c4665,36px 96px #3c4665,42px 96px #596985,48px 96px,6px 102px,12px 102px #3c4665,18px 102px #3c4665,24px 102px #3c4665,30px 102px #3c4665,36px 102px #3c4665,42px 102px #596985,48px 102px,6px 108px,12px 108px #3c4665,18px 108px #3c4665,24px 108px #3c4665,30px 108px #3c4665,36px 108px #3c4665,42px 108px #596985,48px 108px,6px 114px,12px 114px,18px 114px #3c4665,24px 114px #3c4665,30px 114px #3c4665,36px 114px #3c4665,42px 114px #596985,48px 114px,12px 120px,18px 120px,24px 120px #3c4665,30px 120px #3c4665,36px 120px #3c4665,42px 120px #596985,48px 120px,18px 126px,24px 126px,30px 126px,36px 126px,42px 126px,48px 126px; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-phone::before { - box-shadow: 18px 6px 0 0.020em,24px 6px 0 0.020em,30px 6px 0 0.020em,36px 6px 0 0.020em,42px 6px 0 0.020em,48px 6px 0 0.020em,12px 12px 0 0.020em,18px 12px 0 0.020em,24px 12px 0 0.020em #3c4665,30px 12px 0 0.020em #3c4665,36px 12px 0 0.020em #3c4665,42px 12px 0 0.020em #596985,48px 12px 0 0.020em,6px 18px 0 0.020em,12px 18px 0 0.020em,18px 18px 0 0.020em #3c4665,24px 18px 0 0.020em #3c4665,30px 18px 0 0.020em #3c4665,36px 18px 0 0.020em #3c4665,42px 18px 0 0.020em #596985,48px 18px 0 0.020em,6px 24px 0 0.020em,12px 24px 0 0.020em #3c4665,18px 24px 0 0.020em #3c4665,24px 24px 0 0.020em #3c4665,30px 24px 0 0.020em #3c4665,36px 24px 0 0.020em #3c4665,42px 24px 0 0.020em #596985,48px 24px 0 0.020em,6px 30px 0 0.020em,12px 30px 0 0.020em #3c4665,18px 30px 0 0.020em #3c4665,24px 30px 0 0.020em #3c4665,30px 30px 0 0.020em #3c4665,36px 30px 0 0.020em #3c4665,42px 30px 0 0.020em #596985,48px 30px 0 0.020em,6px 36px 0 0.020em,12px 36px 0 0.020em #3c4665,18px 36px 0 0.020em #3c4665,24px 36px 0 0.020em #3c4665,30px 36px 0 0.020em #3c4665,36px 36px 0 0.020em #3c4665,42px 36px 0 0.020em #596985,48px 36px 0 0.020em,6px 42px 0 0.020em,12px 42px 0 0.020em #3c4665,18px 42px 0 0.020em #3c4665,24px 42px 0 0.020em,30px 42px 0 0.020em,36px 42px 0 0.020em,42px 42px 0 0.020em,48px 42px 0 0.020em,6px 48px 0 0.020em,12px 48px 0 0.020em #3c4665,18px 48px 0 0.020em #3c4665,24px 48px 0 0.020em,6px 54px 0 0.020em,12px 54px 0 0.020em #3c4665,18px 54px 0 0.020em #3c4665,24px 54px 0 0.020em,6px 60px 0 0.020em,12px 60px 0 0.020em #3c4665,18px 60px 0 0.020em #3c4665,24px 60px 0 0.020em,6px 66px 0 0.020em,12px 66px 0 0.020em #3c4665,18px 66px 0 0.020em #3c4665,24px 66px 0 0.020em,6px 72px 0 0.020em,12px 72px 0 0.020em #3c4665,18px 72px 0 0.020em #3c4665,24px 72px 0 0.020em,6px 78px 0 0.020em,12px 78px 0 0.020em #3c4665,18px 78px 0 0.020em #3c4665,24px 78px 0 0.020em,6px 84px 0 0.020em,12px 84px 0 0.020em #3c4665,18px 84px 0 0.020em #3c4665,24px 84px 0 0.020em,6px 90px 0 0.020em,12px 90px 0 0.020em #3c4665,18px 90px 0 0.020em #3c4665,24px 90px 0 0.020em,30px 90px 0 0.020em,36px 90px 0 0.020em,42px 90px 0 0.020em,48px 90px 0 0.020em,6px 96px 0 0.020em,12px 96px 0 0.020em #3c4665,18px 96px 0 0.020em #3c4665,24px 96px 0 0.020em #3c4665,30px 96px 0 0.020em #3c4665,36px 96px 0 0.020em #3c4665,42px 96px 0 0.020em #596985,48px 96px 0 0.020em,6px 102px 0 0.020em,12px 102px 0 0.020em #3c4665,18px 102px 0 0.020em #3c4665,24px 102px 0 0.020em #3c4665,30px 102px 0 0.020em #3c4665,36px 102px 0 0.020em #3c4665,42px 102px 0 0.020em #596985,48px 102px 0 0.020em,6px 108px 0 0.020em,12px 108px 0 0.020em #3c4665,18px 108px 0 0.020em #3c4665,24px 108px 0 0.020em #3c4665,30px 108px 0 0.020em #3c4665,36px 108px 0 0.020em #3c4665,42px 108px 0 0.020em #596985,48px 108px 0 0.020em,6px 114px 0 0.020em,12px 114px 0 0.020em,18px 114px 0 0.020em #3c4665,24px 114px 0 0.020em #3c4665,30px 114px 0 0.020em #3c4665,36px 114px 0 0.020em #3c4665,42px 114px 0 0.020em #596985,48px 114px 0 0.020em,12px 120px 0 0.020em,18px 120px 0 0.020em,24px 120px 0 0.020em #3c4665,30px 120px 0 0.020em #3c4665,36px 120px 0 0.020em #3c4665,42px 120px 0 0.020em #596985,48px 120px 0 0.020em,18px 126px 0 0.020em,24px 126px 0 0.020em,30px 126px 0 0.020em,36px 126px 0 0.020em,42px 126px 0 0.020em,48px 126px 0 0.020em; - } -} - -.nes-smartphone { - position: relative; - display: inline-block; - width: 90px; - height: 162px; -} - -.nes-smartphone::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #060606; - box-shadow: 12px 6px,18px 6px,24px 6px,30px 6px,36px 6px,42px 6px,48px 6px,54px 6px,60px 6px,66px 6px,72px 6px,78px 6px,84px 6px,6px 12px,12px 12px,18px 12px #fff,24px 12px #fff,30px 12px #fff,36px 12px #fff,42px 12px #fff,48px 12px #fff,54px 12px #fff,60px 12px #fff,66px 12px #fff,72px 12px #fff,78px 12px #fff,84px 12px,90px 12px,6px 18px,12px 18px #fff,18px 18px #fff,24px 18px #fff,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px,66px 18px,72px 18px #fff,78px 18px #fff,84px 18px #fff,90px 18px,6px 24px,12px 24px #fff,18px 24px #fff,24px 24px #fff,30px 24px #fff,36px 24px #fff,42px 24px #fff,48px 24px #fff,54px 24px #fff,60px 24px #fff,66px 24px #fff,72px 24px #fff,78px 24px #fff,84px 24px #fff,90px 24px,6px 30px,12px 30px #fff,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px,48px 30px,54px 30px,60px 30px,66px 30px,72px 30px,78px 30px,84px 30px #fff,90px 30px,6px 36px,12px 36px #fff,18px 36px,24px 36px,30px 36px,36px 36px,42px 36px,48px 36px,54px 36px,60px 36px,66px 36px,72px 36px,78px 36px,84px 36px #fff,90px 36px,6px 42px,12px 42px #fff,18px 42px,24px 42px,30px 42px,36px 42px,42px 42px,48px 42px,54px 42px,60px 42px,66px 42px,72px 42px,78px 42px,84px 42px #fff,90px 42px,6px 48px,12px 48px #fff,18px 48px,24px 48px,30px 48px,36px 48px,42px 48px,48px 48px,54px 48px,60px 48px,66px 48px,72px 48px,78px 48px,84px 48px #fff,90px 48px,6px 54px,12px 54px #fff,18px 54px,24px 54px,30px 54px,36px 54px,42px 54px,48px 54px,54px 54px,60px 54px,66px 54px,72px 54px,78px 54px,84px 54px #fff,90px 54px,6px 60px,12px 60px #fff,18px 60px,24px 60px,30px 60px,36px 60px,42px 60px,48px 60px,54px 60px,60px 60px,66px 60px,72px 60px,78px 60px,84px 60px #fff,90px 60px,6px 66px,12px 66px #fff,18px 66px,24px 66px,30px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,66px 66px,72px 66px,78px 66px,84px 66px #fff,90px 66px,6px 72px,12px 72px #fff,18px 72px,24px 72px,30px 72px,36px 72px,42px 72px,48px 72px,54px 72px,60px 72px,66px 72px,72px 72px,78px 72px,84px 72px #fff,90px 72px,6px 78px,12px 78px #fff,18px 78px,24px 78px,30px 78px,36px 78px,42px 78px,48px 78px,54px 78px,60px 78px,66px 78px,72px 78px,78px 78px,84px 78px #fff,90px 78px,6px 84px,12px 84px #fff,18px 84px,24px 84px,30px 84px,36px 84px,42px 84px,48px 84px,54px 84px,60px 84px,66px 84px,72px 84px,78px 84px,84px 84px #fff,90px 84px,6px 90px,12px 90px #fff,18px 90px,24px 90px,30px 90px,36px 90px,42px 90px,48px 90px,54px 90px,60px 90px,66px 90px,72px 90px,78px 90px,84px 90px #fff,90px 90px,6px 96px,12px 96px #fff,18px 96px,24px 96px,30px 96px,36px 96px,42px 96px,48px 96px,54px 96px,60px 96px,66px 96px,72px 96px,78px 96px,84px 96px #fff,90px 96px,6px 102px,12px 102px #fff,18px 102px,24px 102px,30px 102px,36px 102px,42px 102px,48px 102px,54px 102px,60px 102px,66px 102px,72px 102px,78px 102px,84px 102px #fff,90px 102px,6px 108px,12px 108px #fff,18px 108px,24px 108px,30px 108px,36px 108px,42px 108px,48px 108px,54px 108px,60px 108px,66px 108px,72px 108px,78px 108px,84px 108px #fff,90px 108px,6px 114px,12px 114px #fff,18px 114px,24px 114px,30px 114px,36px 114px,42px 114px,48px 114px,54px 114px,60px 114px,66px 114px,72px 114px,78px 114px,84px 114px #fff,90px 114px,6px 120px,12px 120px #fff,18px 120px,24px 120px,30px 120px,36px 120px,42px 120px,48px 120px,54px 120px,60px 120px,66px 120px,72px 120px,78px 120px,84px 120px #fff,90px 120px,6px 126px,12px 126px #fff,18px 126px,24px 126px,30px 126px,36px 126px,42px 126px,48px 126px,54px 126px,60px 126px,66px 126px,72px 126px,78px 126px,84px 126px #fff,90px 126px,6px 132px,12px 132px #fff,18px 132px,24px 132px,30px 132px,36px 132px,42px 132px,48px 132px,54px 132px,60px 132px,66px 132px,72px 132px,78px 132px,84px 132px #fff,90px 132px,6px 138px,12px 138px #fff,18px 138px #fff,24px 138px #fff,30px 138px #fff,36px 138px #fff,42px 138px #fff,48px 138px #fff,54px 138px #fff,60px 138px #fff,66px 138px #fff,72px 138px #fff,78px 138px #fff,84px 138px #fff,90px 138px,6px 144px,12px 144px #fff,18px 144px #fff,24px 144px #fff,30px 144px #fff,36px 144px #fff,42px 144px #fff,48px 144px,54px 144px,60px 144px #fff,66px 144px #fff,72px 144px #fff,78px 144px #fff,84px 144px #fff,90px 144px,6px 150px,12px 150px #fff,18px 150px #fff,24px 150px #fff,30px 150px #fff,36px 150px #fff,42px 150px #fff,48px 150px,54px 150px,60px 150px #fff,66px 150px #fff,72px 150px #fff,78px 150px #fff,84px 150px #fff,90px 150px,6px 156px,12px 156px,18px 156px #fff,24px 156px #fff,30px 156px #fff,36px 156px #fff,42px 156px #fff,48px 156px #fff,54px 156px #fff,60px 156px #fff,66px 156px #fff,72px 156px #fff,78px 156px #fff,84px 156px,90px 156px,12px 162px,18px 162px,24px 162px,30px 162px,36px 162px,42px 162px,48px 162px,54px 162px,60px 162px,66px 162px,72px 162px,78px 162px,84px 162px; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-smartphone::before { - box-shadow: 12px 6px 0 0.020em,18px 6px 0 0.020em,24px 6px 0 0.020em,30px 6px 0 0.020em,36px 6px 0 0.020em,42px 6px 0 0.020em,48px 6px 0 0.020em,54px 6px 0 0.020em,60px 6px 0 0.020em,66px 6px 0 0.020em,72px 6px 0 0.020em,78px 6px 0 0.020em,84px 6px 0 0.020em,6px 12px 0 0.020em,12px 12px 0 0.020em,18px 12px 0 0.020em #fff,24px 12px 0 0.020em #fff,30px 12px 0 0.020em #fff,36px 12px 0 0.020em #fff,42px 12px 0 0.020em #fff,48px 12px 0 0.020em #fff,54px 12px 0 0.020em #fff,60px 12px 0 0.020em #fff,66px 12px 0 0.020em #fff,72px 12px 0 0.020em #fff,78px 12px 0 0.020em #fff,84px 12px 0 0.020em,90px 12px 0 0.020em,6px 18px 0 0.020em,12px 18px 0 0.020em #fff,18px 18px 0 0.020em #fff,24px 18px 0 0.020em #fff,30px 18px 0 0.020em,36px 18px 0 0.020em,42px 18px 0 0.020em,48px 18px 0 0.020em,54px 18px 0 0.020em,60px 18px 0 0.020em,66px 18px 0 0.020em,72px 18px 0 0.020em #fff,78px 18px 0 0.020em #fff,84px 18px 0 0.020em #fff,90px 18px 0 0.020em,6px 24px 0 0.020em,12px 24px 0 0.020em #fff,18px 24px 0 0.020em #fff,24px 24px 0 0.020em #fff,30px 24px 0 0.020em #fff,36px 24px 0 0.020em #fff,42px 24px 0 0.020em #fff,48px 24px 0 0.020em #fff,54px 24px 0 0.020em #fff,60px 24px 0 0.020em #fff,66px 24px 0 0.020em #fff,72px 24px 0 0.020em #fff,78px 24px 0 0.020em #fff,84px 24px 0 0.020em #fff,90px 24px 0 0.020em,6px 30px 0 0.020em,12px 30px 0 0.020em #fff,18px 30px 0 0.020em,24px 30px 0 0.020em,30px 30px 0 0.020em,36px 30px 0 0.020em,42px 30px 0 0.020em,48px 30px 0 0.020em,54px 30px 0 0.020em,60px 30px 0 0.020em,66px 30px 0 0.020em,72px 30px 0 0.020em,78px 30px 0 0.020em,84px 30px 0 0.020em #fff,90px 30px 0 0.020em,6px 36px 0 0.020em,12px 36px 0 0.020em #fff,18px 36px 0 0.020em,24px 36px 0 0.020em,30px 36px 0 0.020em,36px 36px 0 0.020em,42px 36px 0 0.020em,48px 36px 0 0.020em,54px 36px 0 0.020em,60px 36px 0 0.020em,66px 36px 0 0.020em,72px 36px 0 0.020em,78px 36px 0 0.020em,84px 36px 0 0.020em #fff,90px 36px 0 0.020em,6px 42px 0 0.020em,12px 42px 0 0.020em #fff,18px 42px 0 0.020em,24px 42px 0 0.020em,30px 42px 0 0.020em,36px 42px 0 0.020em,42px 42px 0 0.020em,48px 42px 0 0.020em,54px 42px 0 0.020em,60px 42px 0 0.020em,66px 42px 0 0.020em,72px 42px 0 0.020em,78px 42px 0 0.020em,84px 42px 0 0.020em #fff,90px 42px 0 0.020em,6px 48px 0 0.020em,12px 48px 0 0.020em #fff,18px 48px 0 0.020em,24px 48px 0 0.020em,30px 48px 0 0.020em,36px 48px 0 0.020em,42px 48px 0 0.020em,48px 48px 0 0.020em,54px 48px 0 0.020em,60px 48px 0 0.020em,66px 48px 0 0.020em,72px 48px 0 0.020em,78px 48px 0 0.020em,84px 48px 0 0.020em #fff,90px 48px 0 0.020em,6px 54px 0 0.020em,12px 54px 0 0.020em #fff,18px 54px 0 0.020em,24px 54px 0 0.020em,30px 54px 0 0.020em,36px 54px 0 0.020em,42px 54px 0 0.020em,48px 54px 0 0.020em,54px 54px 0 0.020em,60px 54px 0 0.020em,66px 54px 0 0.020em,72px 54px 0 0.020em,78px 54px 0 0.020em,84px 54px 0 0.020em #fff,90px 54px 0 0.020em,6px 60px 0 0.020em,12px 60px 0 0.020em #fff,18px 60px 0 0.020em,24px 60px 0 0.020em,30px 60px 0 0.020em,36px 60px 0 0.020em,42px 60px 0 0.020em,48px 60px 0 0.020em,54px 60px 0 0.020em,60px 60px 0 0.020em,66px 60px 0 0.020em,72px 60px 0 0.020em,78px 60px 0 0.020em,84px 60px 0 0.020em #fff,90px 60px 0 0.020em,6px 66px 0 0.020em,12px 66px 0 0.020em #fff,18px 66px 0 0.020em,24px 66px 0 0.020em,30px 66px 0 0.020em,36px 66px 0 0.020em,42px 66px 0 0.020em,48px 66px 0 0.020em,54px 66px 0 0.020em,60px 66px 0 0.020em,66px 66px 0 0.020em,72px 66px 0 0.020em,78px 66px 0 0.020em,84px 66px 0 0.020em #fff,90px 66px 0 0.020em,6px 72px 0 0.020em,12px 72px 0 0.020em #fff,18px 72px 0 0.020em,24px 72px 0 0.020em,30px 72px 0 0.020em,36px 72px 0 0.020em,42px 72px 0 0.020em,48px 72px 0 0.020em,54px 72px 0 0.020em,60px 72px 0 0.020em,66px 72px 0 0.020em,72px 72px 0 0.020em,78px 72px 0 0.020em,84px 72px 0 0.020em #fff,90px 72px 0 0.020em,6px 78px 0 0.020em,12px 78px 0 0.020em #fff,18px 78px 0 0.020em,24px 78px 0 0.020em,30px 78px 0 0.020em,36px 78px 0 0.020em,42px 78px 0 0.020em,48px 78px 0 0.020em,54px 78px 0 0.020em,60px 78px 0 0.020em,66px 78px 0 0.020em,72px 78px 0 0.020em,78px 78px 0 0.020em,84px 78px 0 0.020em #fff,90px 78px 0 0.020em,6px 84px 0 0.020em,12px 84px 0 0.020em #fff,18px 84px 0 0.020em,24px 84px 0 0.020em,30px 84px 0 0.020em,36px 84px 0 0.020em,42px 84px 0 0.020em,48px 84px 0 0.020em,54px 84px 0 0.020em,60px 84px 0 0.020em,66px 84px 0 0.020em,72px 84px 0 0.020em,78px 84px 0 0.020em,84px 84px 0 0.020em #fff,90px 84px 0 0.020em,6px 90px 0 0.020em,12px 90px 0 0.020em #fff,18px 90px 0 0.020em,24px 90px 0 0.020em,30px 90px 0 0.020em,36px 90px 0 0.020em,42px 90px 0 0.020em,48px 90px 0 0.020em,54px 90px 0 0.020em,60px 90px 0 0.020em,66px 90px 0 0.020em,72px 90px 0 0.020em,78px 90px 0 0.020em,84px 90px 0 0.020em #fff,90px 90px 0 0.020em,6px 96px 0 0.020em,12px 96px 0 0.020em #fff,18px 96px 0 0.020em,24px 96px 0 0.020em,30px 96px 0 0.020em,36px 96px 0 0.020em,42px 96px 0 0.020em,48px 96px 0 0.020em,54px 96px 0 0.020em,60px 96px 0 0.020em,66px 96px 0 0.020em,72px 96px 0 0.020em,78px 96px 0 0.020em,84px 96px 0 0.020em #fff,90px 96px 0 0.020em,6px 102px 0 0.020em,12px 102px 0 0.020em #fff,18px 102px 0 0.020em,24px 102px 0 0.020em,30px 102px 0 0.020em,36px 102px 0 0.020em,42px 102px 0 0.020em,48px 102px 0 0.020em,54px 102px 0 0.020em,60px 102px 0 0.020em,66px 102px 0 0.020em,72px 102px 0 0.020em,78px 102px 0 0.020em,84px 102px 0 0.020em #fff,90px 102px 0 0.020em,6px 108px 0 0.020em,12px 108px 0 0.020em #fff,18px 108px 0 0.020em,24px 108px 0 0.020em,30px 108px 0 0.020em,36px 108px 0 0.020em,42px 108px 0 0.020em,48px 108px 0 0.020em,54px 108px 0 0.020em,60px 108px 0 0.020em,66px 108px 0 0.020em,72px 108px 0 0.020em,78px 108px 0 0.020em,84px 108px 0 0.020em #fff,90px 108px 0 0.020em,6px 114px 0 0.020em,12px 114px 0 0.020em #fff,18px 114px 0 0.020em,24px 114px 0 0.020em,30px 114px 0 0.020em,36px 114px 0 0.020em,42px 114px 0 0.020em,48px 114px 0 0.020em,54px 114px 0 0.020em,60px 114px 0 0.020em,66px 114px 0 0.020em,72px 114px 0 0.020em,78px 114px 0 0.020em,84px 114px 0 0.020em #fff,90px 114px 0 0.020em,6px 120px 0 0.020em,12px 120px 0 0.020em #fff,18px 120px 0 0.020em,24px 120px 0 0.020em,30px 120px 0 0.020em,36px 120px 0 0.020em,42px 120px 0 0.020em,48px 120px 0 0.020em,54px 120px 0 0.020em,60px 120px 0 0.020em,66px 120px 0 0.020em,72px 120px 0 0.020em,78px 120px 0 0.020em,84px 120px 0 0.020em #fff,90px 120px 0 0.020em,6px 126px 0 0.020em,12px 126px 0 0.020em #fff,18px 126px 0 0.020em,24px 126px 0 0.020em,30px 126px 0 0.020em,36px 126px 0 0.020em,42px 126px 0 0.020em,48px 126px 0 0.020em,54px 126px 0 0.020em,60px 126px 0 0.020em,66px 126px 0 0.020em,72px 126px 0 0.020em,78px 126px 0 0.020em,84px 126px 0 0.020em #fff,90px 126px 0 0.020em,6px 132px 0 0.020em,12px 132px 0 0.020em #fff,18px 132px 0 0.020em,24px 132px 0 0.020em,30px 132px 0 0.020em,36px 132px 0 0.020em,42px 132px 0 0.020em,48px 132px 0 0.020em,54px 132px 0 0.020em,60px 132px 0 0.020em,66px 132px 0 0.020em,72px 132px 0 0.020em,78px 132px 0 0.020em,84px 132px 0 0.020em #fff,90px 132px 0 0.020em,6px 138px 0 0.020em,12px 138px 0 0.020em #fff,18px 138px 0 0.020em #fff,24px 138px 0 0.020em #fff,30px 138px 0 0.020em #fff,36px 138px 0 0.020em #fff,42px 138px 0 0.020em #fff,48px 138px 0 0.020em #fff,54px 138px 0 0.020em #fff,60px 138px 0 0.020em #fff,66px 138px 0 0.020em #fff,72px 138px 0 0.020em #fff,78px 138px 0 0.020em #fff,84px 138px 0 0.020em #fff,90px 138px 0 0.020em,6px 144px 0 0.020em,12px 144px 0 0.020em #fff,18px 144px 0 0.020em #fff,24px 144px 0 0.020em #fff,30px 144px 0 0.020em #fff,36px 144px 0 0.020em #fff,42px 144px 0 0.020em #fff,48px 144px 0 0.020em,54px 144px 0 0.020em,60px 144px 0 0.020em #fff,66px 144px 0 0.020em #fff,72px 144px 0 0.020em #fff,78px 144px 0 0.020em #fff,84px 144px 0 0.020em #fff,90px 144px 0 0.020em,6px 150px 0 0.020em,12px 150px 0 0.020em #fff,18px 150px 0 0.020em #fff,24px 150px 0 0.020em #fff,30px 150px 0 0.020em #fff,36px 150px 0 0.020em #fff,42px 150px 0 0.020em #fff,48px 150px 0 0.020em,54px 150px 0 0.020em,60px 150px 0 0.020em #fff,66px 150px 0 0.020em #fff,72px 150px 0 0.020em #fff,78px 150px 0 0.020em #fff,84px 150px 0 0.020em #fff,90px 150px 0 0.020em,6px 156px 0 0.020em,12px 156px 0 0.020em,18px 156px 0 0.020em #fff,24px 156px 0 0.020em #fff,30px 156px 0 0.020em #fff,36px 156px 0 0.020em #fff,42px 156px 0 0.020em #fff,48px 156px 0 0.020em #fff,54px 156px 0 0.020em #fff,60px 156px 0 0.020em #fff,66px 156px 0 0.020em #fff,72px 156px 0 0.020em #fff,78px 156px 0 0.020em #fff,84px 156px 0 0.020em,90px 156px 0 0.020em,12px 162px 0 0.020em,18px 162px 0 0.020em,24px 162px 0 0.020em,30px 162px 0 0.020em,36px 162px 0 0.020em,42px 162px 0 0.020em,48px 162px 0 0.020em,54px 162px 0 0.020em,60px 162px 0 0.020em,66px 162px 0 0.020em,72px 162px 0 0.020em,78px 162px 0 0.020em,84px 162px 0 0.020em; - } -} - -.nes-mario { - position: relative; - display: inline-block; - width: 84px; - height: 96px; -} - -.nes-mario::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #f81c2f; - box-shadow: 30px 6px,36px 6px,42px 6px,48px 6px,54px 6px,24px 12px,30px 12px,36px 12px,42px 12px,48px 12px,54px 12px,60px 12px,66px 12px,72px 12px,24px 18px #65352b,30px 18px #65352b,36px 18px #65352b,42px 18px #ffbb8e,48px 18px #ffbb8e,54px 18px #000,60px 18px #ffbb8e,18px 24px #65352b,24px 24px #ffbb8e,30px 24px #65352b,36px 24px #ffbb8e,42px 24px #ffbb8e,48px 24px #ffbb8e,54px 24px #000,60px 24px #ffbb8e,66px 24px #ffbb8e,72px 24px #ffbb8e,18px 30px #65352b,24px 30px #ffbb8e,30px 30px #65352b,36px 30px #65352b,42px 30px #ffbb8e,48px 30px #ffbb8e,54px 30px #ffbb8e,60px 30px #000,66px 30px #ffbb8e,72px 30px #ffbb8e,78px 30px #ffbb8e,18px 36px #65352b,24px 36px #65352b,30px 36px #ffbb8e,36px 36px #ffbb8e,42px 36px #ffbb8e,48px 36px #ffbb8e,54px 36px #000,60px 36px #000,66px 36px #000,72px 36px #000,30px 42px #ffbb8e,36px 42px #ffbb8e,42px 42px #ffbb8e,48px 42px #ffbb8e,54px 42px #ffbb8e,60px 42px #ffbb8e,66px 42px #ffbb8e,30px 48px,36px 48px #1560ad,42px 48px,48px 48px,54px 48px #1560ad,18px 54px,24px 54px,30px 54px,36px 54px #1560ad,42px 54px,48px 54px,54px 54px #1560ad,60px 54px,66px 54px,72px 54px,12px 60px,18px 60px,24px 60px,30px 60px,36px 60px #1560ad,42px 60px #1560ad,48px 60px #1560ad,54px 60px #1560ad,60px 60px,66px 60px,72px 60px,78px 60px,12px 66px #aeaeac,18px 66px #aeaeac,24px 66px,30px 66px #1560ad,36px 66px #fef102,42px 66px #1560ad,48px 66px #1560ad,54px 66px #fef102,60px 66px #1560ad,66px 66px,72px 66px #aeaeac,78px 66px #aeaeac,12px 72px #aeaeac,18px 72px #aeaeac,24px 72px #aeaeac,30px 72px #1560ad,36px 72px #1560ad,42px 72px #1560ad,48px 72px #1560ad,54px 72px #1560ad,60px 72px #1560ad,66px 72px #aeaeac,72px 72px #aeaeac,78px 72px #aeaeac,12px 78px #aeaeac,18px 78px #aeaeac,24px 78px #1560ad,30px 78px #1560ad,36px 78px #1560ad,42px 78px #1560ad,48px 78px #1560ad,54px 78px #1560ad,60px 78px #1560ad,66px 78px #1560ad,72px 78px #aeaeac,78px 78px #aeaeac,24px 84px #1560ad,30px 84px #1560ad,36px 84px #1560ad,54px 84px #1560ad,60px 84px #1560ad,66px 84px #1560ad,18px 90px #65352b,24px 90px #65352b,30px 90px #65352b,60px 90px #65352b,66px 90px #65352b,72px 90px #65352b,12px 96px #65352b,18px 96px #65352b,24px 96px #65352b,30px 96px #65352b,60px 96px #65352b,66px 96px #65352b,72px 96px #65352b,78px 96px #65352b; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-mario::before { - box-shadow: 30px 6px 0 0.020em,36px 6px 0 0.020em,42px 6px 0 0.020em,48px 6px 0 0.020em,54px 6px 0 0.020em,24px 12px 0 0.020em,30px 12px 0 0.020em,36px 12px 0 0.020em,42px 12px 0 0.020em,48px 12px 0 0.020em,54px 12px 0 0.020em,60px 12px 0 0.020em,66px 12px 0 0.020em,72px 12px 0 0.020em,24px 18px 0 0.020em #65352b,30px 18px 0 0.020em #65352b,36px 18px 0 0.020em #65352b,42px 18px 0 0.020em #ffbb8e,48px 18px 0 0.020em #ffbb8e,54px 18px 0 0.020em #000,60px 18px 0 0.020em #ffbb8e,18px 24px 0 0.020em #65352b,24px 24px 0 0.020em #ffbb8e,30px 24px 0 0.020em #65352b,36px 24px 0 0.020em #ffbb8e,42px 24px 0 0.020em #ffbb8e,48px 24px 0 0.020em #ffbb8e,54px 24px 0 0.020em #000,60px 24px 0 0.020em #ffbb8e,66px 24px 0 0.020em #ffbb8e,72px 24px 0 0.020em #ffbb8e,18px 30px 0 0.020em #65352b,24px 30px 0 0.020em #ffbb8e,30px 30px 0 0.020em #65352b,36px 30px 0 0.020em #65352b,42px 30px 0 0.020em #ffbb8e,48px 30px 0 0.020em #ffbb8e,54px 30px 0 0.020em #ffbb8e,60px 30px 0 0.020em #000,66px 30px 0 0.020em #ffbb8e,72px 30px 0 0.020em #ffbb8e,78px 30px 0 0.020em #ffbb8e,18px 36px 0 0.020em #65352b,24px 36px 0 0.020em #65352b,30px 36px 0 0.020em #ffbb8e,36px 36px 0 0.020em #ffbb8e,42px 36px 0 0.020em #ffbb8e,48px 36px 0 0.020em #ffbb8e,54px 36px 0 0.020em #000,60px 36px 0 0.020em #000,66px 36px 0 0.020em #000,72px 36px 0 0.020em #000,30px 42px 0 0.020em #ffbb8e,36px 42px 0 0.020em #ffbb8e,42px 42px 0 0.020em #ffbb8e,48px 42px 0 0.020em #ffbb8e,54px 42px 0 0.020em #ffbb8e,60px 42px 0 0.020em #ffbb8e,66px 42px 0 0.020em #ffbb8e,30px 48px 0 0.020em,36px 48px 0 0.020em #1560ad,42px 48px 0 0.020em,48px 48px 0 0.020em,54px 48px 0 0.020em #1560ad,18px 54px 0 0.020em,24px 54px 0 0.020em,30px 54px 0 0.020em,36px 54px 0 0.020em #1560ad,42px 54px 0 0.020em,48px 54px 0 0.020em,54px 54px 0 0.020em #1560ad,60px 54px 0 0.020em,66px 54px 0 0.020em,72px 54px 0 0.020em,12px 60px 0 0.020em,18px 60px 0 0.020em,24px 60px 0 0.020em,30px 60px 0 0.020em,36px 60px 0 0.020em #1560ad,42px 60px 0 0.020em #1560ad,48px 60px 0 0.020em #1560ad,54px 60px 0 0.020em #1560ad,60px 60px 0 0.020em,66px 60px 0 0.020em,72px 60px 0 0.020em,78px 60px 0 0.020em,12px 66px 0 0.020em #aeaeac,18px 66px 0 0.020em #aeaeac,24px 66px 0 0.020em,30px 66px 0 0.020em #1560ad,36px 66px 0 0.020em #fef102,42px 66px 0 0.020em #1560ad,48px 66px 0 0.020em #1560ad,54px 66px 0 0.020em #fef102,60px 66px 0 0.020em #1560ad,66px 66px 0 0.020em,72px 66px 0 0.020em #aeaeac,78px 66px 0 0.020em #aeaeac,12px 72px 0 0.020em #aeaeac,18px 72px 0 0.020em #aeaeac,24px 72px 0 0.020em #aeaeac,30px 72px 0 0.020em #1560ad,36px 72px 0 0.020em #1560ad,42px 72px 0 0.020em #1560ad,48px 72px 0 0.020em #1560ad,54px 72px 0 0.020em #1560ad,60px 72px 0 0.020em #1560ad,66px 72px 0 0.020em #aeaeac,72px 72px 0 0.020em #aeaeac,78px 72px 0 0.020em #aeaeac,12px 78px 0 0.020em #aeaeac,18px 78px 0 0.020em #aeaeac,24px 78px 0 0.020em #1560ad,30px 78px 0 0.020em #1560ad,36px 78px 0 0.020em #1560ad,42px 78px 0 0.020em #1560ad,48px 78px 0 0.020em #1560ad,54px 78px 0 0.020em #1560ad,60px 78px 0 0.020em #1560ad,66px 78px 0 0.020em #1560ad,72px 78px 0 0.020em #aeaeac,78px 78px 0 0.020em #aeaeac,24px 84px 0 0.020em #1560ad,30px 84px 0 0.020em #1560ad,36px 84px 0 0.020em #1560ad,54px 84px 0 0.020em #1560ad,60px 84px 0 0.020em #1560ad,66px 84px 0 0.020em #1560ad,18px 90px 0 0.020em #65352b,24px 90px 0 0.020em #65352b,30px 90px 0 0.020em #65352b,60px 90px 0 0.020em #65352b,66px 90px 0 0.020em #65352b,72px 90px 0 0.020em #65352b,12px 96px 0 0.020em #65352b,18px 96px 0 0.020em #65352b,24px 96px 0 0.020em #65352b,30px 96px 0 0.020em #65352b,60px 96px 0 0.020em #65352b,66px 96px 0 0.020em #65352b,72px 96px 0 0.020em #65352b,78px 96px 0 0.020em #65352b; - } -} - -.nes-kirby { - position: relative; - display: inline-block; - width: 96px; - height: 96px; -} - -.nes-kirby::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #ffaccc; - box-shadow: 18px 6px #000,24px 6px #000,36px 6px #000,42px 6px #000,48px 6px #000,54px 6px #000,60px 6px #000,12px 12px #000,18px 12px,24px 12px,30px 12px #000,36px 12px,42px 12px,48px 12px,54px 12px,60px 12px,66px 12px #000,72px 12px #000,6px 18px #000,12px 18px,18px 18px,24px 18px #000,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px,66px 18px,72px 18px,78px 18px #000,6px 24px #000,12px 24px,18px 24px,24px 24px,30px 24px,36px 24px,42px 24px #000,48px 24px,54px 24px #000,60px 24px,66px 24px,72px 24px,78px 24px,84px 24px #000,6px 30px #000,12px 30px,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px #000,48px 30px,54px 30px #000,60px 30px,66px 30px,72px 30px,78px 30px,84px 30px #000,6px 36px #000,12px 36px,18px 36px,24px 36px,30px 36px,36px 36px,42px 36px #000,48px 36px,54px 36px #000,60px 36px,66px 36px,72px 36px,78px 36px,84px 36px,90px 36px #000,6px 42px #000,12px 42px,18px 42px,24px 42px,30px 42px #ff5478,36px 42px #ff5478,42px 42px,48px 42px,54px 42px,60px 42px #ff5478,66px 42px #ff5478,72px 42px,78px 42px,84px 42px,90px 42px,96px 42px #000,6px 48px #000,12px 48px,18px 48px,24px 48px,30px 48px,36px 48px,42px 48px,48px 48px #000,54px 48px,60px 48px,66px 48px,72px 48px,78px 48px,84px 48px,90px 48px,96px 48px #000,12px 54px #000,18px 54px,24px 54px,30px 54px,36px 54px,42px 54px,48px 54px #000,54px 54px,60px 54px,66px 54px,72px 54px,78px 54px,84px 54px,90px 54px,96px 54px #000,12px 60px #000,18px 60px,24px 60px,30px 60px,36px 60px,42px 60px,48px 60px,54px 60px,60px 60px,66px 60px,72px 60px,78px 60px #000,84px 60px #000,90px 60px #000,12px 66px #000,18px 66px,24px 66px,30px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,66px 66px,72px 66px #000,78px 66px #ff5478,84px 66px #ff5478,90px 66px #ff5478,96px 66px #000,18px 72px #000,24px 72px,30px 72px,36px 72px,42px 72px,48px 72px,54px 72px,60px 72px,66px 72px #000,72px 72px #ff5478,78px 72px #ff5478,84px 72px #ff5478,90px 72px #ff5478,96px 72px #000,18px 78px #000,24px 78px #000,30px 78px,36px 78px,42px 78px,48px 78px,54px 78px,60px 78px,66px 78px #000,72px 78px #ff5478,78px 78px #ff5478,84px 78px #ff5478,90px 78px #ff5478,96px 78px #000,12px 84px #000,18px 84px #ff5478,24px 84px #ff5478,30px 84px #000,36px 84px #000,42px 84px,48px 84px,54px 84px,60px 84px #000,66px 84px #ff5478,72px 84px #ff5478,78px 84px #ff5478,84px 84px #ff5478,90px 84px #000,6px 90px #000,12px 90px #ff5478,18px 90px #ff5478,24px 90px #ff5478,30px 90px #ff5478,36px 90px #ff5478,42px 90px #000,48px 90px #000,54px 90px #000,60px 90px #000,66px 90px #000,72px 90px #ff5478,78px 90px #ff5478,84px 90px #000,12px 96px #000,18px 96px #000,24px 96px #000,30px 96px #000,36px 96px #000,42px 96px #000,66px 96px #000,72px 96px #000,78px 96px #000; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-kirby::before { - box-shadow: 18px 6px 0 0.020em #000,24px 6px 0 0.020em #000,36px 6px 0 0.020em #000,42px 6px 0 0.020em #000,48px 6px 0 0.020em #000,54px 6px 0 0.020em #000,60px 6px 0 0.020em #000,12px 12px 0 0.020em #000,18px 12px 0 0.020em,24px 12px 0 0.020em,30px 12px 0 0.020em #000,36px 12px 0 0.020em,42px 12px 0 0.020em,48px 12px 0 0.020em,54px 12px 0 0.020em,60px 12px 0 0.020em,66px 12px 0 0.020em #000,72px 12px 0 0.020em #000,6px 18px 0 0.020em #000,12px 18px 0 0.020em,18px 18px 0 0.020em,24px 18px 0 0.020em #000,30px 18px 0 0.020em,36px 18px 0 0.020em,42px 18px 0 0.020em,48px 18px 0 0.020em,54px 18px 0 0.020em,60px 18px 0 0.020em,66px 18px 0 0.020em,72px 18px 0 0.020em,78px 18px 0 0.020em #000,6px 24px 0 0.020em #000,12px 24px 0 0.020em,18px 24px 0 0.020em,24px 24px 0 0.020em,30px 24px 0 0.020em,36px 24px 0 0.020em,42px 24px 0 0.020em #000,48px 24px 0 0.020em,54px 24px 0 0.020em #000,60px 24px 0 0.020em,66px 24px 0 0.020em,72px 24px 0 0.020em,78px 24px 0 0.020em,84px 24px 0 0.020em #000,6px 30px 0 0.020em #000,12px 30px 0 0.020em,18px 30px 0 0.020em,24px 30px 0 0.020em,30px 30px 0 0.020em,36px 30px 0 0.020em,42px 30px 0 0.020em #000,48px 30px 0 0.020em,54px 30px 0 0.020em #000,60px 30px 0 0.020em,66px 30px 0 0.020em,72px 30px 0 0.020em,78px 30px 0 0.020em,84px 30px 0 0.020em #000,6px 36px 0 0.020em #000,12px 36px 0 0.020em,18px 36px 0 0.020em,24px 36px 0 0.020em,30px 36px 0 0.020em,36px 36px 0 0.020em,42px 36px 0 0.020em #000,48px 36px 0 0.020em,54px 36px 0 0.020em #000,60px 36px 0 0.020em,66px 36px 0 0.020em,72px 36px 0 0.020em,78px 36px 0 0.020em,84px 36px 0 0.020em,90px 36px 0 0.020em #000,6px 42px 0 0.020em #000,12px 42px 0 0.020em,18px 42px 0 0.020em,24px 42px 0 0.020em,30px 42px 0 0.020em #ff5478,36px 42px 0 0.020em #ff5478,42px 42px 0 0.020em,48px 42px 0 0.020em,54px 42px 0 0.020em,60px 42px 0 0.020em #ff5478,66px 42px 0 0.020em #ff5478,72px 42px 0 0.020em,78px 42px 0 0.020em,84px 42px 0 0.020em,90px 42px 0 0.020em,96px 42px 0 0.020em #000,6px 48px 0 0.020em #000,12px 48px 0 0.020em,18px 48px 0 0.020em,24px 48px 0 0.020em,30px 48px 0 0.020em,36px 48px 0 0.020em,42px 48px 0 0.020em,48px 48px 0 0.020em #000,54px 48px 0 0.020em,60px 48px 0 0.020em,66px 48px 0 0.020em,72px 48px 0 0.020em,78px 48px 0 0.020em,84px 48px 0 0.020em,90px 48px 0 0.020em,96px 48px 0 0.020em #000,12px 54px 0 0.020em #000,18px 54px 0 0.020em,24px 54px 0 0.020em,30px 54px 0 0.020em,36px 54px 0 0.020em,42px 54px 0 0.020em,48px 54px 0 0.020em #000,54px 54px 0 0.020em,60px 54px 0 0.020em,66px 54px 0 0.020em,72px 54px 0 0.020em,78px 54px 0 0.020em,84px 54px 0 0.020em,90px 54px 0 0.020em,96px 54px 0 0.020em #000,12px 60px 0 0.020em #000,18px 60px 0 0.020em,24px 60px 0 0.020em,30px 60px 0 0.020em,36px 60px 0 0.020em,42px 60px 0 0.020em,48px 60px 0 0.020em,54px 60px 0 0.020em,60px 60px 0 0.020em,66px 60px 0 0.020em,72px 60px 0 0.020em,78px 60px 0 0.020em #000,84px 60px 0 0.020em #000,90px 60px 0 0.020em #000,12px 66px 0 0.020em #000,18px 66px 0 0.020em,24px 66px 0 0.020em,30px 66px 0 0.020em,36px 66px 0 0.020em,42px 66px 0 0.020em,48px 66px 0 0.020em,54px 66px 0 0.020em,60px 66px 0 0.020em,66px 66px 0 0.020em,72px 66px 0 0.020em #000,78px 66px 0 0.020em #ff5478,84px 66px 0 0.020em #ff5478,90px 66px 0 0.020em #ff5478,96px 66px 0 0.020em #000,18px 72px 0 0.020em #000,24px 72px 0 0.020em,30px 72px 0 0.020em,36px 72px 0 0.020em,42px 72px 0 0.020em,48px 72px 0 0.020em,54px 72px 0 0.020em,60px 72px 0 0.020em,66px 72px 0 0.020em #000,72px 72px 0 0.020em #ff5478,78px 72px 0 0.020em #ff5478,84px 72px 0 0.020em #ff5478,90px 72px 0 0.020em #ff5478,96px 72px 0 0.020em #000,18px 78px 0 0.020em #000,24px 78px 0 0.020em #000,30px 78px 0 0.020em,36px 78px 0 0.020em,42px 78px 0 0.020em,48px 78px 0 0.020em,54px 78px 0 0.020em,60px 78px 0 0.020em,66px 78px 0 0.020em #000,72px 78px 0 0.020em #ff5478,78px 78px 0 0.020em #ff5478,84px 78px 0 0.020em #ff5478,90px 78px 0 0.020em #ff5478,96px 78px 0 0.020em #000,12px 84px 0 0.020em #000,18px 84px 0 0.020em #ff5478,24px 84px 0 0.020em #ff5478,30px 84px 0 0.020em #000,36px 84px 0 0.020em #000,42px 84px 0 0.020em,48px 84px 0 0.020em,54px 84px 0 0.020em,60px 84px 0 0.020em #000,66px 84px 0 0.020em #ff5478,72px 84px 0 0.020em #ff5478,78px 84px 0 0.020em #ff5478,84px 84px 0 0.020em #ff5478,90px 84px 0 0.020em #000,6px 90px 0 0.020em #000,12px 90px 0 0.020em #ff5478,18px 90px 0 0.020em #ff5478,24px 90px 0 0.020em #ff5478,30px 90px 0 0.020em #ff5478,36px 90px 0 0.020em #ff5478,42px 90px 0 0.020em #000,48px 90px 0 0.020em #000,54px 90px 0 0.020em #000,60px 90px 0 0.020em #000,66px 90px 0 0.020em #000,72px 90px 0 0.020em #ff5478,78px 90px 0 0.020em #ff5478,84px 90px 0 0.020em #000,12px 96px 0 0.020em #000,18px 96px 0 0.020em #000,24px 96px 0 0.020em #000,30px 96px 0 0.020em #000,36px 96px 0 0.020em #000,42px 96px 0 0.020em #000,66px 96px 0 0.020em #000,72px 96px 0 0.020em #000,78px 96px 0 0.020em #000; - } -} - -.nes-octocat { - position: relative; - display: inline-block; - width: 84px; - height: 90px; -} - -.nes-octocat::before { - position: absolute; - top: -6px; - left: -6px; - content: ""; - background: transparent; - width: 6px; - height: 6px; - color: #333; - box-shadow: 24px 6px,78px 6px,24px 12px,30px 12px,72px 12px,78px 12px,24px 18px,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px,66px 18px,72px 18px,78px 18px,18px 24px,24px 24px,30px 24px,36px 24px,42px 24px,48px 24px,54px 24px,60px 24px,66px 24px,72px 24px,78px 24px,84px 24px,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px,48px 30px,54px 30px,60px 30px,66px 30px,72px 30px,78px 30px,84px 30px,18px 36px,24px 36px,30px 36px,36px 36px #ffdec4,42px 36px #ffdec4,48px 36px #ffdec4,54px 36px #ffdec4,60px 36px #ffdec4,66px 36px #ffdec4,72px 36px,78px 36px,84px 36px,18px 42px,24px 42px,30px 42px #ffdec4,36px 42px #cb7066,42px 42px #ffdec4,48px 42px #ffdec4,54px 42px #ffdec4,60px 42px #ffdec4,66px 42px #cb7066,72px 42px #ffdec4,78px 42px,84px 42px,18px 48px,24px 48px,30px 48px #ffdec4,36px 48px #cb7066,42px 48px #ffdec4,48px 48px #ffdec4,54px 48px #ffdec4,60px 48px #ffdec4,66px 48px #cb7066,72px 48px #ffdec4,78px 48px,84px 48px,24px 54px,30px 54px,36px 54px #ffdec4,42px 54px #ffdec4,48px 54px #cb7066,54px 54px #cb7066,60px 54px #ffdec4,66px 54px #ffdec4,72px 54px,78px 54px,6px 60px,12px 60px,42px 60px,48px 60px,54px 60px,60px 60px,18px 66px,24px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,66px 66px,24px 72px,30px 72px,36px 72px,42px 72px,48px 72px,54px 72px,60px 72px,66px 72px,36px 78px,48px 78px,54px 78px,66px 78px,36px 84px,48px 84px,54px 84px,66px 84px,30px 90px,42px 90px,60px 90px,72px 90px; - transform: rotate(0); -} - -@supports (-moz-appearance: meterbar) { - .nes-octocat::before { - box-shadow: 24px 6px 0 0.020em,78px 6px 0 0.020em,24px 12px 0 0.020em,30px 12px 0 0.020em,72px 12px 0 0.020em,78px 12px 0 0.020em,24px 18px 0 0.020em,30px 18px 0 0.020em,36px 18px 0 0.020em,42px 18px 0 0.020em,48px 18px 0 0.020em,54px 18px 0 0.020em,60px 18px 0 0.020em,66px 18px 0 0.020em,72px 18px 0 0.020em,78px 18px 0 0.020em,18px 24px 0 0.020em,24px 24px 0 0.020em,30px 24px 0 0.020em,36px 24px 0 0.020em,42px 24px 0 0.020em,48px 24px 0 0.020em,54px 24px 0 0.020em,60px 24px 0 0.020em,66px 24px 0 0.020em,72px 24px 0 0.020em,78px 24px 0 0.020em,84px 24px 0 0.020em,18px 30px 0 0.020em,24px 30px 0 0.020em,30px 30px 0 0.020em,36px 30px 0 0.020em,42px 30px 0 0.020em,48px 30px 0 0.020em,54px 30px 0 0.020em,60px 30px 0 0.020em,66px 30px 0 0.020em,72px 30px 0 0.020em,78px 30px 0 0.020em,84px 30px 0 0.020em,18px 36px 0 0.020em,24px 36px 0 0.020em,30px 36px 0 0.020em,36px 36px 0 0.020em #ffdec4,42px 36px 0 0.020em #ffdec4,48px 36px 0 0.020em #ffdec4,54px 36px 0 0.020em #ffdec4,60px 36px 0 0.020em #ffdec4,66px 36px 0 0.020em #ffdec4,72px 36px 0 0.020em,78px 36px 0 0.020em,84px 36px 0 0.020em,18px 42px 0 0.020em,24px 42px 0 0.020em,30px 42px 0 0.020em #ffdec4,36px 42px 0 0.020em #cb7066,42px 42px 0 0.020em #ffdec4,48px 42px 0 0.020em #ffdec4,54px 42px 0 0.020em #ffdec4,60px 42px 0 0.020em #ffdec4,66px 42px 0 0.020em #cb7066,72px 42px 0 0.020em #ffdec4,78px 42px 0 0.020em,84px 42px 0 0.020em,18px 48px 0 0.020em,24px 48px 0 0.020em,30px 48px 0 0.020em #ffdec4,36px 48px 0 0.020em #cb7066,42px 48px 0 0.020em #ffdec4,48px 48px 0 0.020em #ffdec4,54px 48px 0 0.020em #ffdec4,60px 48px 0 0.020em #ffdec4,66px 48px 0 0.020em #cb7066,72px 48px 0 0.020em #ffdec4,78px 48px 0 0.020em,84px 48px 0 0.020em,24px 54px 0 0.020em,30px 54px 0 0.020em,36px 54px 0 0.020em #ffdec4,42px 54px 0 0.020em #ffdec4,48px 54px 0 0.020em #cb7066,54px 54px 0 0.020em #cb7066,60px 54px 0 0.020em #ffdec4,66px 54px 0 0.020em #ffdec4,72px 54px 0 0.020em,78px 54px 0 0.020em,6px 60px 0 0.020em,12px 60px 0 0.020em,42px 60px 0 0.020em,48px 60px 0 0.020em,54px 60px 0 0.020em,60px 60px 0 0.020em,18px 66px 0 0.020em,24px 66px 0 0.020em,36px 66px 0 0.020em,42px 66px 0 0.020em,48px 66px 0 0.020em,54px 66px 0 0.020em,60px 66px 0 0.020em,66px 66px 0 0.020em,24px 72px 0 0.020em,30px 72px 0 0.020em,36px 72px 0 0.020em,42px 72px 0 0.020em,48px 72px 0 0.020em,54px 72px 0 0.020em,60px 72px 0 0.020em,66px 72px 0 0.020em,36px 78px 0 0.020em,48px 78px 0 0.020em,54px 78px 0 0.020em,66px 78px 0 0.020em,36px 84px 0 0.020em,48px 84px 0 0.020em,54px 84px 0 0.020em,66px 84px 0 0.020em,30px 90px 0 0.020em,42px 90px 0 0.020em,60px 90px 0 0.020em,72px 90px 0 0.020em; - } -} - -.nes-octocat.animate::before { - animation: wave 0.5s infinite steps(1); -} - -@keyframes wave { - 50% { - width: 6px; - height: 6px; - color: #333; - box-shadow: 24px 6px,78px 6px,24px 12px,30px 12px,72px 12px,78px 12px,24px 18px,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px,66px 18px,72px 18px,78px 18px,18px 24px,24px 24px,30px 24px,36px 24px,42px 24px,48px 24px,54px 24px,60px 24px,66px 24px,72px 24px,78px 24px,84px 24px,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px,48px 30px,54px 30px,60px 30px,66px 30px,72px 30px,78px 30px,84px 30px,18px 36px,24px 36px,30px 36px,36px 36px #ffdec4,42px 36px #ffdec4,48px 36px #ffdec4,54px 36px #ffdec4,60px 36px #ffdec4,66px 36px #ffdec4,72px 36px,78px 36px,84px 36px,18px 42px,24px 42px,30px 42px #ffdec4,36px 42px #ffdec4,42px 42px #ffdec4,48px 42px #ffdec4,54px 42px #ffdec4,60px 42px #ffdec4,66px 42px #ffdec4,72px 42px #ffdec4,78px 42px,84px 42px,12px 48px,18px 48px,24px 48px,30px 48px #ffdec4,36px 48px #cb7066,42px 48px #ffdec4,48px 48px #ffdec4,54px 48px #ffdec4,60px 48px #ffdec4,66px 48px #cb7066,72px 48px #ffdec4,78px 48px,84px 48px,12px 54px,24px 54px,30px 54px,36px 54px #ffdec4,42px 54px #ffdec4,48px 54px #cb7066,54px 54px #cb7066,60px 54px #ffdec4,66px 54px #ffdec4,72px 54px,78px 54px,18px 60px,42px 60px,48px 60px,54px 60px,60px 60px,24px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,66px 66px,24px 72px,30px 72px,36px 72px,42px 72px,48px 72px,54px 72px,60px 72px,66px 72px,36px 78px,48px 78px,54px 78px,66px 78px,36px 84px,48px 84px,54px 84px,66px 84px,30px 90px,42px 90px,60px 90px,72px 90px; - @supports (-moz-appearance: meterbar) { - box-shadow: 24px 6px 0 0.020em,78px 6px 0 0.020em,24px 12px 0 0.020em,30px 12px 0 0.020em,72px 12px 0 0.020em,78px 12px 0 0.020em,24px 18px 0 0.020em,30px 18px 0 0.020em,36px 18px 0 0.020em,42px 18px 0 0.020em,48px 18px 0 0.020em,54px 18px 0 0.020em,60px 18px 0 0.020em,66px 18px 0 0.020em,72px 18px 0 0.020em,78px 18px 0 0.020em,18px 24px 0 0.020em,24px 24px 0 0.020em,30px 24px 0 0.020em,36px 24px 0 0.020em,42px 24px 0 0.020em,48px 24px 0 0.020em,54px 24px 0 0.020em,60px 24px 0 0.020em,66px 24px 0 0.020em,72px 24px 0 0.020em,78px 24px 0 0.020em,84px 24px 0 0.020em,18px 30px 0 0.020em,24px 30px 0 0.020em,30px 30px 0 0.020em,36px 30px 0 0.020em,42px 30px 0 0.020em,48px 30px 0 0.020em,54px 30px 0 0.020em,60px 30px 0 0.020em,66px 30px 0 0.020em,72px 30px 0 0.020em,78px 30px 0 0.020em,84px 30px 0 0.020em,18px 36px 0 0.020em,24px 36px 0 0.020em,30px 36px 0 0.020em,36px 36px 0 0.020em #ffdec4,42px 36px 0 0.020em #ffdec4,48px 36px 0 0.020em #ffdec4,54px 36px 0 0.020em #ffdec4,60px 36px 0 0.020em #ffdec4,66px 36px 0 0.020em #ffdec4,72px 36px 0 0.020em,78px 36px 0 0.020em,84px 36px 0 0.020em,18px 42px 0 0.020em,24px 42px 0 0.020em,30px 42px 0 0.020em #ffdec4,36px 42px 0 0.020em #ffdec4,42px 42px 0 0.020em #ffdec4,48px 42px 0 0.020em #ffdec4,54px 42px 0 0.020em #ffdec4,60px 42px 0 0.020em #ffdec4,66px 42px 0 0.020em #ffdec4,72px 42px 0 0.020em #ffdec4,78px 42px 0 0.020em,84px 42px 0 0.020em,12px 48px 0 0.020em,18px 48px 0 0.020em,24px 48px 0 0.020em,30px 48px 0 0.020em #ffdec4,36px 48px 0 0.020em #cb7066,42px 48px 0 0.020em #ffdec4,48px 48px 0 0.020em #ffdec4,54px 48px 0 0.020em #ffdec4,60px 48px 0 0.020em #ffdec4,66px 48px 0 0.020em #cb7066,72px 48px 0 0.020em #ffdec4,78px 48px 0 0.020em,84px 48px 0 0.020em,12px 54px 0 0.020em,24px 54px 0 0.020em,30px 54px 0 0.020em,36px 54px 0 0.020em #ffdec4,42px 54px 0 0.020em #ffdec4,48px 54px 0 0.020em #cb7066,54px 54px 0 0.020em #cb7066,60px 54px 0 0.020em #ffdec4,66px 54px 0 0.020em #ffdec4,72px 54px 0 0.020em,78px 54px 0 0.020em,18px 60px 0 0.020em,42px 60px 0 0.020em,48px 60px 0 0.020em,54px 60px 0 0.020em,60px 60px 0 0.020em,24px 66px 0 0.020em,36px 66px 0 0.020em,42px 66px 0 0.020em,48px 66px 0 0.020em,54px 66px 0 0.020em,60px 66px 0 0.020em,66px 66px 0 0.020em,24px 72px 0 0.020em,30px 72px 0 0.020em,36px 72px 0 0.020em,42px 72px 0 0.020em,48px 72px 0 0.020em,54px 72px 0 0.020em,60px 72px 0 0.020em,66px 72px 0 0.020em,36px 78px 0 0.020em,48px 78px 0 0.020em,54px 78px 0 0.020em,66px 78px 0 0.020em,36px 84px 0 0.020em,48px 84px 0 0.020em,54px 84px 0 0.020em,66px 84px 0 0.020em,30px 90px 0 0.020em,42px 90px 0 0.020em,60px 90px 0 0.020em,72px 90px 0 0.020em; - } - } -} -/*# sourceMappingURL=nes.css.map */ \ No newline at end of file diff --git a/node_modules/nes.css/css/nes.css.map b/node_modules/nes.css/css/nes.css.map deleted file mode 100644 index 546d259..0000000 --- a/node_modules/nes.css/css/nes.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../scss/nes-core.scss","nes.css","../scss/base/reboot.scss","../scss/base/generic.scss","../scss/base/variables.scss","../scss/base/color-palette.scss","../scss/utilities/animations.scss","../scss/utilities/rounded-corners-mixin.scss","../scss/utilities/visually-hidden.scss","../scss/helpers/pointer.scss","../scss/elements/avatar.scss","../scss/elements/badges.scss","../scss/elements/balloons.scss","../scss/elements/buttons.scss","../scss/elements/containers.scss","../scss/elements/dialogs.scss","../scss/elements/lists.scss","../scss/utilities/icon-mixin.scss","../scss/elements/progress.scss","../scss/elements/tables.scss","../scss/elements/text.scss","../scss/form/inputs.scss","../scss/form/radios.scss","../scss/form/checkboxes.scss","../scss/form/selects.scss","../scss/icons/icons.scss","../scss/icons/heart.scss","../scss/icons/star.scss","../scss/icons/trophy.scss","../scss/icons/like.scss","../scss/icons/twitter.scss","../scss/icons/facebook.scss","../scss/icons/github.scss","../scss/icons/youtube.scss","../scss/icons/google.scss","../scss/icons/medium.scss","../scss/icons/twitch.scss","../scss/icons/reddit.scss","../scss/icons/whatsapp.scss","../scss/icons/gmail.scss","../scss/icons/linkedin.scss","../scss/icons/instagram.scss","../scss/icons/coin.scss","../scss/pixel-arts/nes-icon.scss","../scss/utilities/fill-gaps.scss","../scss/pixel-arts/nes-jp-icon.scss","../scss/pixel-arts/snes-icon.scss","../scss/pixel-arts/snes-jp-icon.scss","../scss/pixel-arts/bcrikko.scss","../scss/pixel-arts/ash.scss","../scss/pixel-arts/pokeball.scss","../scss/pixel-arts/bulbasaur.scss","../scss/pixel-arts/charmander.scss","../scss/pixel-arts/squirtle.scss","../scss/pixel-arts/phone.scss","../scss/pixel-arts/smartphone.scss","../scss/pixel-arts/mario.scss","../scss/pixel-arts/kirby.scss","../scss/pixel-arts/octocat.scss"],"names":[],"mappings":"AAEA;;;;8ECE8E;ACJ9E;;;;;;EDWE;ACJF;;;EAGE,sBAAsB;ADMxB;;ACHA;EACE,uBAAuB;EACvB,iBAAiB;EACjB,8BAA8B;EAC9B,6BAA6B;EAC7B,6CAA6C;ADM/C;;ACHA;EACE,mBAAmB;ADMrB;;ACHA;;;;;;;;;;EAUE,cAAc;ADMhB;;ACHA;EACE,SAAS;EACT,gMAEoB;EACpB,eAAe;EACf,gBAAgB;EAChB,gBAAgB;EAChB,cAAc;EACd,gBAAgB;EAChB,sBAAsB;ADIxB;;AAEA;ECFE,qBAAqB;ADIvB;;ACDA;EACE,uBAAuB;EACvB,SAAS;EACT,iBAAiB;ADInB;;ACDA;;;;;;EAME,aAAa;EACb,qBAAqB;ADIvB;;ACDA;EACE,aAAa;EACb,mBAAmB;ADIrB;;ACDA;;EAEE,yCAAyC;EACzC,0BAA0B;EAC1B,iCAAiC;EACjC,YAAY;EACZ,gBAAgB;ADIlB;;ACDA;EACE,mBAAmB;EACnB,kBAAkB;EAClB,oBAAoB;ADItB;;ACDA;;;EAGE,aAAa;EACb,mBAAmB;ADIrB;;ACDA;;;;EAIE,gBAAgB;ADIlB;;ACDA;EACE,gBAAgB;ADIlB;;ACDA;EACE,qBAAqB;EACrB,cAAc;ADIhB;;ACDA;EACE,gBAAgB;ADIlB;;ACDA;;EAEE,mBAAmB;ADIrB;;ACDA;EACE,cAAc;ADIhB;;ACDA;;EAEE,kBAAkB;EAClB,cAAc;EACd,cAAc;EACd,wBAAwB;ADI1B;;ACDA;EACE,eAAe;ADIjB;;ACDA;EACE,WAAW;ADIb;;ACDA;EACE,cAAc;EACd,qBAAqB;EACrB,6BAA6B;ADI/B;;ACDA;EACE,cAAc;EACd,0BAA0B;ADI5B;;ACDA;EACE,cAAc;EACd,qBAAqB;ADIvB;;ACDA;;EAEE,cAAc;EACd,qBAAqB;ADIvB;;ACDA;EACE,UAAU;ADIZ;;ACDA;;;;EAIE,iGAAiG;EACjG,cAAc;ADIhB;;ACDA;EACE,aAAa;EACb,mBAAmB;EACnB,cAAc;EACd,6BAA6B;ADI/B;;ACDA;EACE,gBAAgB;ADIlB;;ACDA;EACE,sBAAsB;EACtB,kBAAkB;ADIpB;;ACDA;EACE,gBAAgB;EAChB,sBAAsB;ADIxB;;ACDA;EACE,yBAAyB;ADI3B;;ACDA;EACE,oBAAoB;EACpB,uBAAuB;EACvB,cAAc;EACd,gBAAgB;EAChB,oBAAoB;ADItB;;ACDA;EACE,mBAAmB;ADIrB;;ACDA;EACE,qBAAqB;EACrB,qBAAqB;ADIvB;;ACDA;EACE,gBAAgB;ADIlB;;ACDA;;;;;EAKE,SAAS;EACT,oBAAoB;EACpB,kBAAkB;EAClB,oBAAoB;ADItB;;ACDA;;EAEE,iBAAiB;ADInB;;ACDA;;EAEE,oBAAoB;ADItB;;ACDA;;;;EAIE,0BAA0B;ADI5B;;ACDA;;;;EAIE,UAAU;EACV,kBAAkB;ADIpB;;ACDA;EACE,mBAAmB;EACnB,0CAA0C;ADI5C;;ACDA;;EAEE,sBAAsB;EACtB,UAAU;ADIZ;;ACDA;;;;EAIE,2BAA2B;ADI7B;;ACDA;EACE,cAAc;EACd,gBAAgB;ADIlB;;ACDA;EACE,YAAY;EACZ,UAAU;EACV,SAAS;EACT,SAAS;ADIX;;ACDA;EACE,cAAc;EACd,WAAW;EACX,eAAe;EACf,UAAU;EACV,qBAAqB;EACrB,iBAAiB;EACjB,oBAAoB;EACpB,cAAc;EACd,mBAAmB;ADIrB;;ACDA;EACE,wBAAwB;ADI1B;;AAEA;;ECDE,YAAY;ADId;;AAEA;ECFE,oBAAoB;EACpB,wBAAwB;ADI1B;;AAEA;ECFE,wBAAwB;ADI1B;;ACDA;EACE,aAAa;EACb,0BAA0B;ADI5B;;ACDA;EACE,qBAAqB;ADIvB;;ACDA;EACE,kBAAkB;EAClB,eAAe;ADIjB;;ACDA;EACE,aAAa;ADIf;;AAEA;ECFE,wBAAwB;ADI1B;;AEpVA;;;;;;EAME,6BCP4B;AH8V9B;;AClVA;ECDE,yeAAyB;AFuV3B;;AC7TA;ECtBE,eCdc;EDed,cEfmB;EFgBnB,sBEfgB;EFgBhB,mCAAmC;AFuVrC;;ACpJA;EC/LE,eAAe;AFuVjB;;AEpVA;;EAEE,6YAAkC;AFuVpC;;AC/HA;;;;ECjNE,wBAAwB;AFuV1B;;AClHA;;EC/NE,UAAU;AFsVZ;;AK/XA;EACE;IACE,UAAU;ELkYZ;EK/XA;IACE,UAAU;ELiYZ;AACF;;AMxYA;;EACE,mBAAmB;EACnB,iBHQe;AHoYjB;;AO9YA,mFAAA;ACAA;EACE,6YAAkC;ARkZpC;;ASzYA;EAPE,WAFkB;EAGlB,YAHkB;ATuZpB;;ASlZE;EACE,mBAAmB;ATqZvB;;ASlZA;EAPE,WAFkB;EAGlB,YAHkB;ATgapB;;AS3ZE;EACE,mBAAmB;AT8ZvB;;AS3ZA;EAPE,WAFkB;EAGlB,YAHkB;ATyapB;;ASpaE;EACE,mBAAmB;ATuavB;;ASpaA;EAPE,WAFkB;EAGlB,YAHkB;ATkbpB;;AS7aE;EACE,mBAAmB;ATgbvB;;AUvXA;EAGE,kBAAkB;EAClB,qBAAqB;EACrB,aAAe;EACf,eAAiB;EACjB,aAAa;EACb,gBAAoB;EACpB,mBAAmB;EACnB,mBAAmB;EACnB,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AVwXnB;;AUraI;EAlBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBNfmB;EMkBjB,OAAO;EAaL,4EN/Be;AJ4crB;;AU3aI;EAvBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBNfmB;EMoBjB,QAAQ;EAgBN,2ENpCe;AJudrB;;AUzZA;EA8BM,aAAc;AV+XpB;;AUpbI;EAxCF,aAyCyD;EAxCzD,mBAAmB;EACnB,uBAAuB;EACvB,YAsCgE;EArChE,gBAqCuE;EApCvE,WNHgB;EMIhB,kBAAkB;EAClB,yBNNmB;EM0Cf,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;AV6bnB;;AU3bI;EAhDF,qBAiDiE;EAhDjE,mBAAmB;EACnB,uBAAuB;EACvB,UA8CsE;EA7CtE,iBA6C8E;EA5C9E,WNHgB;EMIhB,kBAAkB;EAClB,yBNNmB;EMkDf,gFNlDe;AJsfrB;;AUjcI;EA3CF,kBAAkB;EAClB,MAAM;EACN,WA0CoD;EAzCpD,WNZgB;EMahB,kBAAkB;EAClB,yBNfmB;EMwDf,gFNxDe;AJggBrB;;AUpeI;EAlBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPKe;EOFb,OAAO;EAaL,4EPXW;AHufjB;;AU1eI;EAvBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPKe;EOAb,QAAQ;EAgBN,2EPhBW;AHkgBjB;;AUxdA;EA8BM,aAAc;AV8bpB;;AUnfI;EAxCF,aAyCyD;EAxCzD,mBAAmB;EACnB,uBAAuB;EACvB,YAsCgE;EArChE,gBAqCuE;EApCvE,WNHgB;EMIhB,kBAAkB;EAClB,yBPce;EOsBX,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;AV4fnB;;AU1fI;EAhDF,qBAiDiE;EAhDjE,mBAAmB;EACnB,uBAAuB;EACvB,UA8CsE;EA7CtE,iBA6C8E;EA5C9E,WNHgB;EMIhB,kBAAkB;EAClB,yBPce;EO8BX,gFP9BW;AHiiBjB;;AUhgBI;EA3CF,kBAAkB;EAClB,MAAM;EACN,WA0CoD;EAzCpD,WNZgB;EMahB,kBAAkB;EAClB,yBPKe;EOoCX,gFPpCW;AH2iBjB;;AUniBI;EAlBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPUe;EOPb,OAAO;EAaL,4EPNW;AHijBjB;;AUziBI;EAvBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPUe;EOLb,QAAQ;EAgBN,2EPXW;AH4jBjB;;AUvhBA;EA8BM,aAAc;AV6fpB;;AUljBI;EAxCF,aAyCyD;EAxCzD,mBAAmB;EACnB,uBAAuB;EACvB,YAsCgE;EArChE,gBAqCuE;EApCvE,WNHgB;EMIhB,kBAAkB;EAClB,yBPmBe;EOiBX,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;AV2jBnB;;AUzjBI;EAhDF,qBAiDiE;EAhDjE,mBAAmB;EACnB,uBAAuB;EACvB,UA8CsE;EA7CtE,iBA6C8E;EA5C9E,WNHgB;EMIhB,kBAAkB;EAClB,yBPmBe;EOyBX,gFPzBW;AH2lBjB;;AU/jBI;EA3CF,kBAAkB;EAClB,MAAM;EACN,WA0CoD;EAzCpD,WNZgB;EMahB,kBAAkB;EAClB,yBPUe;EO+BX,gFP/BW;AHqmBjB;;AUlmBI;EAlBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,cNbmB;EMcnB,kBAAkB;EAClB,yBPee;EOZb,OAAO;EAaL,4EPDW;AH2mBjB;;AUxmBI;EAvBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,cNbmB;EMcnB,kBAAkB;EAClB,yBPee;EOVb,QAAQ;EAgBN,2EPNW;AHsnBjB;;AUtlBA;EA8BM,aAAc;AV4jBpB;;AUjnBI;EAxCF,aAyCyD;EAxCzD,mBAAmB;EACnB,uBAAuB;EACvB,YAsCgE;EArChE,gBAqCuE;EApCvE,cNJmB;EMKnB,kBAAkB;EAClB,yBPwBe;EOYX,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;AV0nBnB;;AUxnBI;EAhDF,qBAiDiE;EAhDjE,mBAAmB;EACnB,uBAAuB;EACvB,UA8CsE;EA7CtE,iBA6C8E;EA5C9E,cNJmB;EMKnB,kBAAkB;EAClB,yBPwBe;EOoBX,gFPpBW;AHqpBjB;;AU9nBI;EA3CF,kBAAkB;EAClB,MAAM;EACN,WA0CoD;EAzCpD,cNbmB;EMcnB,kBAAkB;EAClB,yBPee;EO0BX,gFP1BW;AH+pBjB;;AUjqBI;EAlBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPoBe;EOjBb,OAAO;EAaL,4EPIW;AHqqBjB;;AUvqBI;EAvBF,kBAAkB;EAClB,MAAM;EACN,UAHyD;EAIzD,WNZgB;EMahB,kBAAkB;EAClB,yBPoBe;EOfb,QAAQ;EAgBN,2EPDW;AHgrBjB;;AUrpBA;EA8BM,aAAc;AV2nBpB;;AUhrBI;EAxCF,aAyCyD;EAxCzD,mBAAmB;EACnB,uBAAuB;EACvB,YAsCgE;EArChE,gBAqCuE;EApCvE,WNHgB;EMIhB,kBAAkB;EAClB,yBP6Be;EOOX,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;AVyrBnB;;AUvrBI;EAhDF,qBAiDiE;EAhDjE,mBAAmB;EACnB,uBAAuB;EACvB,UA8CsE;EA7CtE,iBA6C8E;EA5C9E,WNHgB;EMIhB,kBAAkB;EAClB,yBP6Be;EOeX,gFPfW;AH+sBjB;;AU7rBI;EA3CF,kBAAkB;EAClB,MAAM;EACN,WA0CoD;EAzCpD,WNZgB;EMahB,kBAAkB;EAClB,yBPoBe;EOqBX,gFPrBW;AHytBjB;;AWtuBA;ELME,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,yZAAgc;EAoC9b,sBAAsB;EKfxB,kBAAkB;EAClB,qBAAqB;EACrB,oBAAoB;EACpB,WAAW;EACX,mBAAmB;EACnB,sBP7BgB;AJywBlB;;AM3vBE;EKOF;ILNI,0BAA0B;EN+vB5B;AACF;;AM5vBuC;EKEvC;ILDI,4BAA4B;ENgwB9B;AACF;;AWhwBA;EAWI,gBAAgB;AXyvBpB;;AWpwBA;EAgBI,kBAAkB;EAClB,WAAW;AXwvBf;;AWzwBA;ELME,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,4ZAAgc;EAgC9b,sBAAsB;EKStB,WP5Cc;EO6Cd,mBP9CiB;EO+CjB,sBAAsB;EACtB,6BPhDiB;AJ2yBrB;;AM5xBE;EKOF;ILNI,0BAA0B;ENgyB5B;AACF;;AM7xBuC;EKEvC;ILDI,4BAA4B;ENiyB9B;AACF;;AWjyBA;EA+BQ,yBPrDa;EOsDb,kBPrDU;AJ2zBlB;;AWtyBA;EAoCQ,WPzDU;EO0DV,yBP3Da;AJi0BrB;;AW3yBA;EA2CQ,mCPjEa;AJq0BrB;;AW/yBA;EArBI,gFAOU;AXi0Bd;;AWnzBA;EAoDQ,kCP1Ea;AJ60BrB;;AWvzBA;EAXI,4EAOS;AX+zBb;;AW3zBA;EA+DM,UAAU;AXgwBhB;;AW/zBA;EAmEM,aAAa;EACb,WAAW;EACX,YAAY;EACZ,sBP3FY;EO4FZ,+BP7Fe;EO8Ff,8BP9Fe;AJ81BrB;;AWx0BA;EA4EM,aAAa;EACb,WAAW;EACX,WAAW;EACX,iBAAiB;EACjB,cPtGe;EOuGf,sBPtGY;EOAd,6EAOU;AXg2Bd;;AWl1BA;EAyFM,WAAW;AX6vBjB;;AWt1BA;EA6FM,aAAa;EACb,WAAW;EACX,YAAY;EACZ,sBPrHY;EOsHZ,+BPvHe;EOwHf,8BPxHe;AJq3BrB;;AW/1BA;EAsGM,aAAa;EACb,WAAW;EACX,WAAW;EACX,gBAAgB;EAChB,sBP/HY;EOUd,yEAOS;AX42Bb;;AY91BA;ENeE,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,iRAAwT;EAmDtT,sBAAsB;EMxBxB,kBAAkB;EAClB,qBAAqB;EACrB,gBAAgB;EAChB,WT9Be;ES+Bf,kBAAkB;EAClB,sBAAsB;EACtB,6YAAkC;EAClC,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;EA3CjB,cRCmB;EQAnB,sBRCgB;AJ+4BlB;;AMj4BE;EMiBF;INhBI,0BAA0B;ENq4B5B;AACF;;AMl4BuC;EMYvC;INXI,4BAA4B;ENs4B9B;AACF;;AY15BE;EACE,kBAAkB;EAClB,STIa;ESHb,WTGa;ESFb,YTEa;ESDb,UTCa;ESAb,WAAW;EACX,mCTIa;AHy5BjB;;AY15BE;EACE,cRbiB;EQcjB,qBAAqB;EACrB,yBTHY;AHg6BhB;;AY35BI;EACE,mCTLW;AHm6BjB;;AY15BE;EACE,8CTVa;AHu6BjB;;AY15BE;EACE,iCTda;AH26BjB;;AYl6BE;EA8BE,UAAU;AZw4Bd;;AY55BA;EA0BI,cR1DiB;EQ2DjB,mBAAmB;EACnB,yBT5Ca;ES6Cb,mCT5Ca;ES6Cb,YAAY;AZs4BhB;;AYp6BA;EAjCE,WREgB;EQDhB,yBToBe;AHq7BjB;;AYv8BE;EACE,kBAAkB;EAClB,STIa;ESHb,WTGa;ESFb,YTEa;ESDb,UTCa;ESAb,WAAW;EACX,mCTaa;AH67BjB;;AYv8BE;EACE,WRZc;EQad,qBAAqB;EACrB,yBTMY;AHo8BhB;;AYx8BI;EACE,mCTIW;AHu8BjB;;AYv8BE;EACE,4CTDa;AH28BjB;;AYv8BE;EACE,iCTLa;AH+8BjB;;AYr8BA;EAjCE,WREgB;EQDhB,yBTyBe;AHi9BjB;;AYx+BE;EACE,kBAAkB;EAClB,STIa;ESHb,WTGa;ESFb,YTEa;ESDb,UTCa;ESAb,WAAW;EACX,mCTkBa;AHy9BjB;;AYx+BE;EACE,WRZc;EQad,qBAAqB;EACrB,yBTWY;AHg+BhB;;AYz+BI;EACE,mCTSW;AHm+BjB;;AYx+BE;EACE,4CTIa;AHu+BjB;;AYx+BE;EACE,iCTAa;AH2+BjB;;AYt+BA;EAjCE,cRCmB;EQAnB,yBT8Be;AH6+BjB;;AYzgCE;EACE,kBAAkB;EAClB,STIa;ESHb,WTGa;ESFb,YTEa;ESDb,UTCa;ESAb,WAAW;EACX,mCTuBa;AHq/BjB;;AYzgCE;EACE,cRbiB;EQcjB,qBAAqB;EACrB,yBTgBY;AH4/BhB;;AY1gCI;EACE,mCTcW;AH+/BjB;;AYzgCE;EACE,4CTSa;AHmgCjB;;AYzgCE;EACE,iCTKa;AHugCjB;;AYvgCA;EAjCE,WREgB;EQDhB,yBTmCe;AHygCjB;;AY1iCE;EACE,kBAAkB;EAClB,STIa;ESHb,WTGa;ESFb,YTEa;ESDb,UTCa;ESAb,WAAW;EACX,mCT4Ba;AHihCjB;;AY1iCE;EACE,WRZc;EQad,qBAAqB;EACrB,yBTqBY;AHwhChB;;AY3iCI;EACE,mCTmBW;AH2hCjB;;AY1iCE;EACE,4CTca;AH+hCjB;;AY1iCE;EACE,iCTUa;AHmiCjB;;AYxiCA;EAgDI,kBAAkB;EAClB,oBAAoB;EACpB,UAAU;AZ4/Bd;;AahlCA;EACE,kBAAkB;EAClB,oBAAoB;EACpB,mBAAmB;EACnB,mBAAmB;EACnB,iBAAiB;AbmlCnB;;AaxlCA;EAQI,gBAAgB;AbolCpB;;Aa5lCA;EAYI,kBAAkB;AbolCtB;;AahmCA;EAgBI,iBAAiB;AbolCrB;;AapmCA;EAqBM,cAAc;EACd,iBAAiB;EACjB,sBAAsB;EACtB,eAAe;EACf,sBTtBY;AJymClB;;Aa5mCA;EA8BQ,uBAAuB;AbklC/B;;AahnCA;EAoCQ,yBAAyB;AbglCjC;;AapnCA;EA0CI,kBAAkB;EAClB,WVjCa;EUkCb,WTzCc;ES0Cd,yBT3CiB;ES4CjB,mBAAmB;Ab8kCvB;;Aa5nCA;EAiDM,kBAAkB;EAClB,WAAwB;EACxB,aAA0B;EAC1B,cAA2B;EAC3B,YAAyB;EACzB,WAAW;EACX,WAAW;EACX,yBTtDe;AJqoCrB;;AavoCA;EA6DQ,WT1DU;ES2DV,yBT5Da;AJ0oCrB;;Aa5oCA;EP8BE,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,yZAAgc;EAoC9b,sBAAsB;EO4BtB,oBAAoB;EACpB,WV7Da;AH4oCjB;;AMroCE;EOjBF;IPkBI,0BAA0B;ENyoC5B;AACF;;AMtoCuC;EOtBvC;IPuBI,4BAA4B;EN0oC9B;AACF;;AalqCA;EA2EQ,mBAAmB;Ab2lC3B;;AatqCA;EAgFU,yBAAyB;Ab0lCnC;;Aa1qCA;EAsFU,2BAA2B;AbwlCrC;;Aa9qCA;EP8BE,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,4ZAAgc;EAgC9b,sBAAsB;ANgpC1B;;AMrqCE;EOjBF;IPkBI,0BAA0B;ENyqC5B;AACF;;AMtqCuC;EOtBvC;IPuBI,4BAA4B;EN0qC9B;AACF;;AalsCA;EA8FQ,aAAa;AbwmCrB;;AatsCA;EAmGU,mBAAmB;AbumC7B;;Aa1sCA;EAwGY,yBAAyB;AbsmCrC;;Aa9sCA;EA8GY,2BAA2B;AbomCvC;;AcltCA;EACE,oBAAoB;EACpB,iBXQe;AH6sCjB;;AcvtCA;EAMI,oCAAoC;AdqtCxC;;Ac3tCA;EAMI,oCAAoC;AdqtCxC;;Ac3tCA;EAUI,gBAAgB;AdqtCpB;;Ac/tCA;ER8BE,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,yZAAgc;EAoC9b,sBAAsB;AN6rC1B;;AMttCE;EQjBF;IRkBI,0BAA0B;EN0tC5B;AACF;;AMvtCuC;EQtBvC;IRuBI,4BAA4B;EN2tC9B;AACF;;AcnvCA;ER8BE,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,4ZAAgc;EAgC9b,sBAAsB;ANqtC1B;;AM1uCE;EQjBF;IRkBI,0BAA0B;EN8uC5B;AACF;;AM3uCuC;EQtBvC;IRuBI,4BAA4B;EN+uC9B;AACF;;AcvwCA;EAqBI,WVlBc;EUmBd,yBVpBiB;EUqBjB,kBVpBc;AJ0wClB;;Ac7wCA;EA0BM,kBAAkB;EAClB,SAAsB;EACtB,WAAwB;EACxB,YAAyB;EACzB,UAAuB;EACvB,WAAW;EACX,WAAW;EACX,yBV/Be;AJsxCrB;;AexxCA;EAsBE,qBAAqB;AfswCvB;;Ae5xCA;EAyBI,kBAAkB;AfuwCtB;;AehyCA;EA6BI,kBAAkB;EAClB,oBAAoB;EACpB,WAAW;EACX,WAAW;ECiBb,UDfuB;ECgBvB,WDhBuB;ECiBvB,cZjDmB;EYkDnB,6NAAyB;AhBuvC3B;;AgBpvCuC;EDvDvC;ICwDI,6cAAyB;EhBwvC3B;AACF;;AejzCA;EAsCI,kBAAkB;EAClB,oBAAoB;EACpB,WAAW;EACX,WAAW;ECQb,UDNuB;ECOvB,WDPuB;ECQvB,cZjDmB;EYkDnB,2LAAyB;AhBwwC3B;;AgBrwCuC;EDvDvC;ICwDI,mYAAyB;EhBywC3B;AACF;;AiBl0CA;EXiDE,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,iRAAwT;EAmDtT,sBAAsB;EW1DxB,WAAW;EACX,YAAY;EACZ,WAAW;EACX,cbJmB;EaKnB,sBbJgB;EaKhB,wBAAwB;EACxB,qBAAgB;OAAhB,gBAAgB;AjBw0ClB;;AMh0CE;EWjBF;IXkBI,0BAA0B;ENo0C5B;AACF;;AMj0CuC;EWtBvC;IXuBI,4BAA4B;ENq0C9B;AACF;;AiB71CA;EAaM,sBbVY;AJ81ClB;;AiBj2CA;EAgBM,yBbde;AJm2CrB;;AiBr2CA;EAmBM,yBbjBe;AJu2CrB;;AiBz2CA;EAsBM,yBbpBe;EaqBf,YAAY;AjBu1ClB;;AiB92CA;EX8BE,qBAAqB;EACrB,qBAAqB;EAjBrB,4BAA4B;EAR5B,yZAAgc;EAoC9b,sBAAsB;AN40C1B;;AMr2CE;EWjBF;IXkBI,0BAA0B;ENy2C5B;AACF;;AMt2CuC;EWtBvC;IXuBI,4BAA4B;EN02C9B;AACF;;AiBl4CA;EAaM,sBbVY;AJm4ClB;;AiBt4CA;EAgBM,yBdMW;AHo3CjB;;AiB14CA;EAmBM,yBdGW;AHw3CjB;;AiB94CA;EAsBM,yBdAW;EcCX,YAAY;AjB43ClB;;AiBn5CA;EAaM,sBbVY;AJo5ClB;;AiBv5CA;EAgBM,yBdWW;AHg4CjB;;AiB35CA;EAmBM,yBdQW;AHo4CjB;;AiB/5CA;EAsBM,yBdKW;EcJX,YAAY;AjB64ClB;;AiBp6CA;EAaM,sBbVY;AJq6ClB;;AiBx6CA;EAgBM,yBdgBW;AH44CjB;;AiB56CA;EAmBM,yBdaW;AHg5CjB;;AiBh7CA;EAsBM,yBdUW;EcTX,YAAY;AjB85ClB;;AiBr7CA;EAaM,sBbVY;AJs7ClB;;AiBz7CA;EAgBM,yBdqBW;AHw5CjB;;AiB77CA;EAmBM,yBdkBW;AH45CjB;;AiBj8CA;EAsBM,yBdeW;EcdX,YAAY;AjB+6ClB;;AiBt8CA;EAkDM,yBbhDe;EaiDf,wLAeG;EACH,mCAAmC;EACnC,0BAA0B;AjBy4ChC;;AiB78CA;EAwEM,yBbtEe;EauEf,kMAS+B;EAC/B,mCAAmC;EACnC,0BAA0B;AjBg4ChC;;AiBp9CA;EAwFM,yBbtFe;EauFf,wLAeG;EACH,mCAAmC;EACnC,0BAA0B;EAC1B,YAAY;AjBi3ClB;;AkB59CA;EACE,eAAe;EACf,gBAAgB;EAChB,kBAAkB;AlB+9CpB;;AkB59CA;EACE,mBAAmB;EACnB,sBdLgB;Ec0FhB;;;;gFlB84C8E;AAChF;;AkBt+CA;EAKI,oBAAoB;AlBq+CxB;;AkB1+CA;;EAUI,kBAAkB;EAClB,eAAe;EACf,qBAAqB;EACrB,qBdjBiB;EckBjB,mBAAmB;EACnB,+BAA+B;AlBq+CnC;;AkBp/CA;;EAkBM,qBAAqB;AlBu+C3B;;AkBz/CA;;;EAuBM,kBAAkB;EAClB,cAAc;EACd,aAAa;EACb,cAAc;EACd,WAAW;EACX,yBdhCe;AJwgDrB;;AkBpgDA;;EAgCM,eAAe;EACf,aAAa;AlBy+CnB;;AkB1gDA;;EAqCM,YAAY;EACZ,cAAc;AlB0+CpB;;AkBhhDA;;EA0CM,YAAY;EACZ,eAAe;AlB2+CrB;;AkBthDA;EAgDI,kBAAkB;AlB0+CtB;;AkB1hDA;EAoDI,WAAW;EACX,iBAAiB;EACjB,yBAAyB;EZX3B,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,iRAAwT;EAmDtT,sBAAsB;AN8+C1B;;AM1hDE;EYXF;IZYI,0BAA0B;EN8hD5B;AACF;;AM3hDuC;EYhBvC;IZiBI,4BAA4B;EN+hD9B;AACF;;AkBjjDA;EA4DI,Wd/Dc;EcgEd,yBdjEiB;AJ0jDrB;;AkBtjDA;EAgEM,kBAAkB;EAClB,MAAM;EACN,QAAQ;EACR,SAAS;EACT,OAAO;EACP,WAAW;AlB0/CjB;;AkB/jDA;EZ2CE,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,oRAAwT;EA+CtT,sBAAsB;ANohD1B;;AM5jDE;EYXF;IZYI,0BAA0B;ENgkD5B;AACF;;AM7jDuC;EYhBvC;IZiBI,4BAA4B;ENikD9B;AACF;;AkBnlDA;;EA8EM,kBdjFY;AJ2lDlB;;AkBxlDA;;;EAkFQ,aAAa;AlB4gDrB;;AkB9lDA;;;;EAiGQ,sBAAsB;AlBogD9B;;AkBrmDA;;;;;;;EAqGU,aAAa;AlB0gDvB;;AmBrnDA;EAEI,chBoBa;AHmmDjB;;AmBznDA;EAMI,chBqBa;AHkmDjB;;AmB7nDA;EAUI,chBsBa;AHimDjB;;AmBjoDA;EAcI,chBuBa;AHgmDjB;;AmBroDA;EAkBI,chBAa;AHunDjB;;AoBzoDA;;EdiDE,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,iRAAwT;EAmDtT,sBAAsB;EcnDxB,uBAAuC;EACvC,oBAAoB;EACpB,WAAW;EACX,4BAA4B;ApByoD9B;;AMroDE;EcjBF;;IdkBI,0BAA0B;EN0oD5B;AACF;;AMvoDuC;EctBvC;;IduBI,4BAA4B;EN4oD9B;AACF;;AoBpqDA;;EdUE,oRAAwT;EcLtT,sBjBSY;EiBIZ,WhBfc;EgBgBd,yBhBjBiB;AJ0qDrB;;AoB5qDA;;EdUE,mRAAwT;EcLtT,sBjBuBY;AHspDhB;;AoBlrDA;;EdUE,mRAAwT;EcLtT,sBjB4BY;AHupDhB;;AoBxrDA;;EdUE,mRAAwT;EcLtT,sBjBiCY;AHwpDhB;;AoB9pDA;EAEI,cAAc;ApBgqDlB;;AoBlqDA;;EAMI,cAAc;ApBiqDlB;;AoBvqDA;EAUI,aAAa;EACb,mBAAmB;ApBiqDvB;;AoB5qDA;EAcM,aAAa;EACb,YAAY;EACZ,SAAS;EACT,oBAAoB;EACpB,iBAAiB;ApBkqDvB;;AoBprDA;;EAuBM,aAAa;EACb,YAAY;ApBkqDlB;;AoB7pDA;EA7BA;IA+BI,cAAc;EpBgqDhB;EoB/rDF;IAkCM,qBAAqB;IACrB,gBAAgB;EpBgqDpB;EoBrqDA;IASI,eAAe;EpB+pDnB;AACF;;AqBvuDA;EAwBE,kBAAkB;EAClB,wBAAwB;EACxB,qBAAqB;EACrB,gBAAgB;EdvBhB,UAAU;EACV,WAAW;EACX,UAAU;EACV,gBAAgB;EAChB,mBAAmB;EACnB,mBAAmB;EACnB,SAAS;EACT,6BAAqB;UAArB,qBAAqB;AP2uDvB;;AqBtvDA;EAgCI,kBAAkB;EAClB,6YAAkC;ArB0tDtC;;AqB3vDA;EAqCI,kBAAkB;EAClB,SAAS;EACT,WAAW;EACX,WAAW;ELSb,UKPuB;ELQvB,WKRuB;ELSvB,cZjDmB;EYkDnB,0PAAyB;AhBktD3B;;AgB/sDuC;EKvDvC;ILwDI,khBAAyB;EhBmtD3B;AACF;;AqB5wDA;EAgDM,qCAAqC;ArBguD3C;;AqBhxDA;ELiDE,UKIuB;ELHvB,WKGuB;ELFvB,cbpCe;EaqCf,0PAAyB;AhBmuD3B;;AgBhuDuC;EKvDvC;ILwDI,khBAAyB;EhBouD3B;AACF;;AqB7xDA;EAyDM,WjBtDY;AJ8xDlB;;AqBjyDA;EA4DqB,qDAAA;EACf,WjB1DY;AJmyDlB;;AqBtyDA;ELiDE,UKgByB;ELfzB,WKeyB;ELdzB,cbpCe;EaqCf,0PAAyB;EKerB,WjBhEY;AJ2yDlB;;AgBvvDuC;EKvDvC;ILwDI,khBAAyB;EhB2vD3B;AACF;;AqBpzDA;ELiDE,UKqByB;ELpBzB,WKoByB;ELnBzB,cbpCe;EaqCf,0PAAyB;EKoBrB,WjBrEY;AJyzDlB;;AgBrwDuC;EKvDvC;ILwDI,khBAAyB;EhBywD3B;AACF;;AsBl0DA;EAkDE,iBAAiB;EACjB,wBAAwB;EACxB,qBAAqB;EACrB,gBAAgB;EfjDhB,UAAU;EACV,WAAW;EACX,UAAU;EACV,gBAAgB;EAChB,mBAAmB;EACnB,mBAAmB;EACnB,SAAS;EACT,6BAAqB;UAArB,qBAAqB;APs0DvB;;AsBj1DA;EA0DI,kBAAkB;EAClB,6YAAkC;AtB2xDtC;;AsBt1DA;;EAgEI,kBAAkB;EAClB,SAAS;EACT,WAAW;EACX,WAAW;AtB2xDf;;AsB91DA;EAuEqB,qDAAA;ENtBnB,UMuBuB;ENtBvB,WMsBuB;ENrBvB,cZjDmB;EYkDnB,uQAAyB;AhBkzD3B;;AgB/yDuC;EMvDvC;INwDI,+hBAAyB;EhBmzD3B;AACF;;AsB52DA;EA2E2B,qDAAA;EN1BzB,UM2BuB;EN1BvB,WM0BuB;ENzBvB,cbpCe;EaqCf,uQAAyB;AhBg0D3B;;AgB7zDuC;EMvDvC;INwDI,+hBAAyB;EhBi0D3B;AACF;;AsB13DA;ENiDE,UM+BuB;EN9BvB,WM8BuB;EN7BvB,cZjDmB;EYkDnB,uYAAyB;AhB60D3B;;AgB10DuC;EMvDvC;INwDI,2yBAAyB;EhB80D3B;AACF;;AsBv4DA;ENiDE,UMkCuB;ENjCvB,WMiCuB;ENhCvB,cbpCe;EaqCf,uiBAAyB;AhB01D3B;;AgBv1DuC;EMvDvC;INwDI,28BAAyB;EhB21D3B;AACF;;AsBp5DA;EAuFM,WlBpFY;AJq5DlB;;AsBx5DA;EA0FqB,qDAAA;EACf,WlBxFY;AJ05DlB;;AsB75DA;ENiDE,UM8CyB;EN7CzB,WM6CyB;EN5CzB,cbpCe;EaqCf,2eAAyB;EM6CrB,WlB9FY;AJk6DlB;;AgB92DuC;EMvDvC;INwDI,+4BAAyB;EhBk3D3B;AACF;;AsB36DA;ENiDE,UMmDyB;ENlDzB,WMkDyB;ENjDzB,cbpCe;EaqCf,2eAAyB;EMkDrB,WlBnGY;AJg7DlB;;AgB53DuC;EMvDvC;INwDI,+4BAAyB;EhBg4D3B;AACF;;AuBz7DA;EAYE,kBAAkB;EAClB,uBAAuC;EACvC,WAAW;AvBi7Db;;AuB/7DA;EjBiDE,qBAAqB;EACrB,qBAAqB;EApCrB,4BAA4B;EAJ5B,iRAAwT;EAmDtT,sBAAsB;EiB1CtB,WAAW;EACX,kCAAkC;EAClC,6YAAkC;EAClC,gBAAgB;EAChB,sBpBTY;EoBUZ,wBAAwB;EACxB,qBAAgB;OAAhB,gBAAgB;AvBq7DpB;;AM77DE;EiBjBF;IjBkBI,0BAA0B;ENi8D5B;AACF;;AM97DuC;EiBtBvC;IjBuBI,4BAA4B;ENk8D9B;AACF;;AuB19DA;EA4BM,cpBTW;AH28DjB;;AuB99DA;EAiCI,WnB9Bc;EmB+Bd,yBnBhCiB;AJi+DrB;;AuBn+DA;EPiDE,UOXuB;EPYvB,WOZuB;EPavB,cZjDmB;EYkDnB,qQAAyB;EOZvB,kBAAkB;EAClB,qBAAqB;EACrB,WAAW;EACX,oBAAoB;EACpB,WAAW;AvBm8Df;;AgBx7DuC;EOvDvC;IPwDI,6hBAAyB;EhB47D3B;AACF;;AuBr/DA;EA2DQ,cpBhCS;AH89DjB;;AuBz/DA;EjBUE,mRAAwT;EiBuDlT,sBpBrCQ;AHk+DhB;;AuB9/DA;EA2DQ,cpB3BS;AHk+DjB;;AuBlgEA;EjBUE,mRAAwT;EiBuDlT,sBpBhCQ;AHs+DhB;;AuBvgEA;EA2DQ,cpBtBS;AHs+DjB;;AuB3gEA;EjBUE,mRAAwT;EiBuDlT,sBpB3BQ;AH0+DhB;;AuBhhEA;EA2DQ,WnBxDU;AJihElB;;AuBphEA;EjBUE,oRAAwT;EiBuDlT,sBpBnDQ;AH2gEhB;;AwBjgEA;EAIE,kBAAkB;EAClB,qBAAqB;EACrB,WAJ8B;EAK9B,YAL8B;EAM9B,kBAN8B;EAO9B,mBAP8B;EAW9B,mBAAmB;EACnB,0BAA0B;AxB8/D5B;;AwB5gEA;EAiBI,SAAS;EAET,mBAAmB;AxB8/DvB;;AwBjhEA;EAuBI,kBAA4B;EAC5B,mBAA6B;EAE7B,mBAAmB;AxB6/DvB;;AwBvhEA;EA8BI,kBAA4B;EAC5B,mBAA6B;EAE7B,mBAAmB;AxB4/DvB;;AwB7hEA;EAqCI,kBAAkB;EAClB,SAAuB;EACvB,UAAwB;EACxB,cAAc;EACd,WAAW;EACX,uBAAuB;AxB4/D3B;;AwBtiEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cSnDsC;EToDtC,+9CAAyB;AhBihE3B;;AgB9gEuC;EQ/BvC;IRgCI,60FAAyB;EhBkhE3B;AACF;;AwBnjEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cSnDsC;EToDtC,+9BAAyB;AhB8hE3B;;AgB3hEuC;EQ/BvC;IRgCI,u3DAAyB;EhB+hE3B;AACF;;AwBhkEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,WSnD6B;EToD7B,qUAAyB;AhB2iE3B;;AgBxiEuC;EQ/BvC;IRgCI,6qBAAyB;EhB4iE3B;AACF;;AwB7kEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cSUiC;ETTjC,qUAAyB;AhBwjE3B;;AgBrjEuC;EQ/BvC;IRgCI,6qBAAyB;EhByjE3B;AACF;;AwB1lEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cUnDqC;EVoDrC,8sDAAyB;AhBqkE3B;;AgBlkEuC;EQ/BvC;IRgCI,omGAAyB;EhBskE3B;AACF;;AwBvmEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cU9BgC;EV+BhC,oeAAyB;AhBklE3B;;AgB/kEuC;EQ/BvC;IRgCI,s/BAAyB;EhBmlE3B;AACF;;AwBpnEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,WUnD4B;EVoD5B,4xCAAyB;AhB+lE3B;;AgB5lEuC;EQ/BvC;IRgCI,kyEAAyB;EhBgmE3B;AACF;;AwBjoEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,WUnD4B;EVoD5B,oeAAyB;AhB4mE3B;;AgBzmEuC;EQ/BvC;IRgCI,s/BAAyB;EhB6mE3B;AACF;;AwB9oEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cWnDuC;EXoDvC,mnDAAyB;AhBynE3B;;AgBtnEuC;EQ/BvC;IRgCI,mhGAAyB;EhB0nE3B;AACF;;AwB3pEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cW9BkC;EX+BlC,ugBAAyB;AhBsoE3B;;AgBnoEuC;EQ/BvC;IRgCI,2kCAAyB;EhBuoE3B;AACF;;AwBxqEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,WYnDsB;EZoDtB,4rDAAyB;AhBmpE3B;;AgBhpEuC;EQ/BvC;IRgCI,gnGAAyB;EhBopE3B;AACF;;AwBrrEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cY9BgC;EZ+BhC,kdAAyB;AhBgqE3B;;AgB7pEuC;EQ/BvC;IRgCI,g9BAAyB;EhBiqE3B;AACF;;AwBlsEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,canDkC;EboDlC,2rFAAyB;AhB6qE3B;;AgB1qEuC;EQ/BvC;IRgCI,mpKAAyB;EhB8qE3B;AACF;;AwB/sEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,ccnDmC;EdoDnC,giFAAyB;AhB0rE3B;;AgBvrEuC;EQ/BvC;IRgCI,w/JAAyB;EhB2rE3B;AACF;;AwB5tEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,WenD8B;EfoD9B,swFAAyB;AhBusE3B;;AgBpsEuC;EQ/BvC;IRgCI,8tKAAyB;EhBwsE3B;AACF;;AwBzuEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,WgBnD+B;EhBoD/B,o0EAAyB;AhBotE3B;;AgBjtEuC;EQ/BvC;IRgCI,4xJAAyB;EhBqtE3B;AACF;;AwBtvEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cZjDmB;EYkDnB,2sCAAyB;AhBiuE3B;;AgB9tEuC;EQ/BvC;IRgCI,2hFAAyB;EhBkuE3B;AACF;;AwBnwEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,WiBnDiC;EjBoDjC,unGAAyB;AhB8uE3B;;AgB3uEuC;EQ/BvC;IRgCI,+kLAAyB;EhB+uE3B;AACF;;AwBhxEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,ckBnDiC;ElBoDjC,+sFAAyB;AhB2vE3B;;AgBxvEuC;EQ/BvC;IRgCI,uqKAAyB;EhB4vE3B;AACF;;AwB7xEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cmBnDiC;EnBoDjC,mkFAAyB;AhBwwE3B;;AgBrwEuC;EQ/BvC;IRgCI,2hKAAyB;EhBywE3B;AACF;;AwB1yEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,WoBnD8B;EpBoD9B,+qFAAyB;AhBqxE3B;;AgBlxEuC;EQ/BvC;IRgCI,ujKAAyB;EhBsxE3B;AACF;;AwBvzEA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cqBnD6B;ErBoD7B,0oEAAyB;AhBkyE3B;;AgB/xEuC;EQ/BvC;IRgCI,gvIAAyB;EhBmyE3B;AACF;;AwBp0EA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,csBnD0B;EtBoD1B,2qEAAyB;AhB+yE3B;;AgB5yEuC;EQ/BvC;IRgCI,mgIAAyB;EhBgzE3B;AACF;;AwBj1EA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cuBnDmC;EvBoDnC,qnFAAyB;AhB4zE3B;;AgBzzEuC;EQ/BvC;IRgCI,6kKAAyB;EhB6zE3B;AACF;;AwB91EA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,WwBnD2B;ExBoD3B,+lGAAyB;AhBy0E3B;;AgBt0EuC;EQ/BvC;IRgCI,u+KAAyB;EhB00E3B;AACF;;AwB32EA;ERyBE,UQxBkB;ERyBlB,WQzBkB;ER0BlB,cyBnDwC;EzBoDxC,m4EAAyB;AhBs1E3B;;AgBn1EuC;EQ/BvC;IRgCI,2tIAAyB;EhBu1E3B;AACF;;A0Ch5EA;EAkBE,kBAAkB;EAClB,qBAAqB;EACrB,WAAoC;EACpC,YAA6B;A1Ck4E/B;;A0Cv5EA;EAwBI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;E1BqBzB,U0BjCU;E1BkCV,W0BlCU;E1BmCV,c0BlDsB;E1BmDtB,29CAAyB;E2BjDzB,oBAAoB;A3Ci6EtB;;AgB72EuC;E0BvDvC;I1BwDI,mhFAAyB;EhBi3E3B;AACF;;A4C16EA;EAkBE,kBAAkB;EAClB,qBAAqB;EACrB,WAAoC;EACpC,YAA6B;A5C45E/B;;A4Cj7EA;EAwBI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;E5BqBzB,U4BjCU;E5BkCV,W4BlCU;E5BmCV,c4BlD4B;E5BmD5B,u6CAAyB;E2BjDzB,oBAAoB;A3C27EtB;;AgBv4EuC;E4BvDvC;I5BwDI,+9EAAyB;EhB24E3B;AACF;;A6Cp8EA;EAkBE,kBAAkB;EAClB,qBAAqB;EACrB,WAAoC;EACpC,YAA6B;A7Cs7E/B;;A6C38EA;EAwBI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;E7BqBzB,U6BjCU;E7BkCV,W6BlCU;E7BmCV,c6BlD4B;E7BmD5B,mrCAAyB;E2BjDzB,oBAAoB;A3Cq9EtB;;AgBj6EuC;E6BvDvC;I7BwDI,mnEAAyB;EhBq6E3B;AACF;;A8C99EA;EAmBE,kBAAkB;EAClB,qBAAqB;EACrB,WAAoC;EACpC,YAA6B;A9C+8E/B;;A8Cr+EA;EAyBI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;E9BoBzB,U8BhCU;E9BiCV,W8BjCU;E9BkCV,c8BjD4B;E9BkD5B,mrCAAyB;E2BjDzB,oBAAoB;A3C++EtB;;AgB37EuC;E8BvDvC;I9BwDI,mnEAAyB;EhB+7E3B;AACF;;A+Cx/EA;EAwBE,kBAAkB;EAClB,qBAAqB;EACrB,WAAuC;EACvC,YAAgC;A/Co+ElC;;A+C//EA;EA8BI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;E/BezB,U+B3BU;E/B4BV,W+B5BU;E/B6BV,c+BlD+B;E/BmD/B,+uFAAyB;E2BjDzB,oBAAoB;A3CygFtB;;AgBr9EuC;E+BvDvC;I/BwDI,usKAAyB;EhBy9E3B;AACF;;AgDlhFA;EAsBE,kBAAkB;EAClB,qBAAqB;EACrB,WAAmC;EACnC,YAA4B;AhDggF9B;;AgDzhFA;EA4BI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;EhCiBzB,UgC7BU;EhC8BV,WgC9BU;EhC+BV,cgClDgD;EhCmDhD,ohEAAyB;E2BjDzB,oBAAoB;A3CmiFtB;;AgB/+EuC;EgCvDvC;IhCwDI,s+GAAyB;EhBm/E3B;AACF;;AiD5iFA;EAqBE,kBAAkB;EAClB,qBAAqB;EACrB,WAAwC;EACxC,YAAiC;AjD2hFnC;;AiDnjFA;EA2BI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;EjCkBzB,UiC9BU;EjC+BV,WiC/BU;EjCgCV,ciClD0B;EjCmD1B,wiEAAyB;E2BjDzB,oBAAoB;A3C6jFtB;;AgBzgFuC;EiCvDvC;IjCwDI,g/GAAyB;EhB6gF3B;AACF;;AkDtkFA;EAwBE,kBAAkB;EAClB,qBAAqB;EACrB,YAAyC;EACzC,aAAkC;AlDkjFpC;;AkD7kFA;EA8BI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;ElCezB,UkC3BU;ElC4BV,WkC5BU;ElC6BV,WkClDwB;ElCmDxB,w9GAAyB;E2BjDzB,oBAAoB;A3CulFtB;;AgBniFuC;EkCvDvC;IlCwDI,0sLAAyB;EhBuiF3B;AACF;;AmDhmFA;EAyBE,kBAAkB;EAClB,qBAAqB;EACrB,YAA0C;EAC1C,aAAmC;AnD2kFrC;;AmDvmFA;EA+BI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;EnCczB,UmC1BU;EnC2BV,WmC3BU;EnC4BV,cmClDqC;EnCmDrC,s+FAAyB;E2BjDzB,oBAAoB;A3CinFtB;;AgB7jFuC;EmCvDvC;InCwDI,ghKAAyB;EhBikF3B;AACF;;AoD1nFA;EAwBE,kBAAkB;EAClB,qBAAqB;EACrB,YAAwC;EACxC,aAAiC;ApDsmFnC;;AoDjoFA;EA8BI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;EpCezB,UoC3BU;EpC4BV,WoC5BU;EpC6BV,WoClD6B;EpCmD7B,63FAAyB;E2BjDzB,oBAAoB;A3C2oFtB;;AgBvlFuC;EoCvDvC;IpCwDI,igKAAyB;EhB2lF3B;AACF;;AqDppFA;EA4BE,kBAAkB;EAClB,qBAAqB;EACrB,WAAqC;EACrC,aAA8B;ArD4nFhC;;AqD3pFA;EAkCI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;ErCWzB,UqCvBU;ErCwBV,WqCxBU;ErCyBV,WqClDsC;ErCmDtC,q5DAAyB;E2BjDzB,oBAAoB;A3CqqFtB;;AgBjnFuC;EqCvDvC;IrCwDI,itGAAyB;EhBqnF3B;AACF;;AsD9qFA;EAkCE,kBAAkB;EAClB,qBAAqB;EACrB,WAA0C;EAC1C,aAAmC;AtDgpFrC;;AsDrrFA;EAwCI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;EtCKzB,UsCjBU;EtCkBV,WsClBU;EtCmBV,csClDkC;EtCmDlC,kmJAAyB;E2BjDzB,oBAAoB;A3C+rFtB;;AgB3oFuC;EsCvDvC;ItCwDI,4gRAAyB;EhB+oF3B;AACF;;AuDxsFA;EAuBE,kBAAkB;EAClB,qBAAqB;EACrB,WAAqC;EACrC,YAA8B;AvDqrFhC;;AuD/sFA;EA6BI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;EvCgBzB,UuC5BU;EvC6BV,WuC7BU;EvC8BV,cuClDuB;EvCmDvB,qtEAAyB;E2BjDzB,oBAAoB;A3CytFtB;;AgBrqFuC;EuCvDvC;IvCwDI,imHAAyB;EhByqF3B;AACF;;AwDluFA;EAuBE,kBAAkB;EAClB,qBAAqB;EACrB,WAAqC;EACrC,YAA8B;AxD+sFhC;;AwDzuFA;EA6BI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;ExCgBzB,UwC5BU;ExC6BV,WwC7BU;ExC8BV,cwClD6B;ExCmD7B,4pFAAyB;E2BjDzB,oBAAoB;A3CmvFtB;;AgB/rFuC;EwCvDvC;IxCwDI,kwJAAyB;EhBmsF3B;AACF;;AyD5vFA;EAwCE,kBAAkB;EAClB,qBAAqB;EACrB,WAAyC;EACzC,YAAkC;AzDwtFpC;;AyDnwFA;EA8CI,kBAAkB;EAClB,SATQ;EAUR,UAVQ;EAWR,WAAW;EACX,uBAAuB;EzCDzB,UyCXU;EzCYV,WyCZU;EzCaV,WyClDsB;EzCmDtB,w5CAAyB;E2BjDzB,oBAAoB;A3C6wFtB;;AgBztFuC;EyCvDvC;IzCwDI,wkFAAyB;EhB6tF3B;AACF;;AyDtxFA;EAyDI,sCAAsC;AzDiuF1C;;AyD9tFE;EACE;IzCZF,UyCXU;IzCYV,WyCZU;IzCaV,WyClDsB;IzCmDtB,y5CAAyB;IAGY;MACnC,ykFAAyB;IhB4uFzB;EACF;AACF","file":"nes.css"} \ No newline at end of file diff --git a/node_modules/nes.css/css/nes.min.css b/node_modules/nes.css/css/nes.min.css deleted file mode 100644 index 1373fd2..0000000 --- a/node_modules/nes.css/css/nes.min.css +++ /dev/null @@ -1,11 +0,0 @@ -/*!***************************************************************************\ - NES.css Framework - Version: development - -\*****************************************************************************//*! - * Bootstrap Reboot v4.1.3 (https://getbootstrap.com/) - * Copyright 2011-2018 The Bootstrap Authors - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) - */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}body,code,html,kbd,pre,samp{font-family:"Press Start 2P"}html{cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABFklEQVRYR9WXURLDIAhE6/0PbSdOtUpcd1Gnpv1KGpTHBpCE1/cXq+vrMph7dGvXZTtpfW10DCA5jrH1H0Jhs5E0hnZdCR+vb5S8Nn8mQCeS9BdSalYJqMBjAGzq59xAESN7VFVUgV8AZB/dZBR7QTFDCqGquvUBVVoEtgIwpQRzmANSFHgWQKExHdIrPeuMvQNDarXe6nC/AutgV3JW+6bgqQLeV8FekRtgV+ToDKEKnACYKsfZjjkam7a0ZpYTytwmgainpC3HvwBocgKOxqRjehoR9DFKNFYtOwCGYCszobeCbl26N6yyQ6g8X/Wex/rBPsNEV6qAMaJPMynIHQCoSqS9JSMmwef51LflTgCRszU7DvAGiV6mHWfsaVUAAAAASUVORK5CYII=),auto}body{font-size:16px;color:#212529;background-color:#fff;-webkit-font-smoothing:antialiased}label{cursor:inherit}a,button{cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer}[type=button],[type=reset],[type=submit],button{-webkit-appearance:none}input[type=checkbox],input[type=radio]{outline:0}@keyframes blink{0%{opacity:1}50%{opacity:0}}.nes-balloon,.nes-balloon.is-dark,.nes-btn,.nes-container.is-rounded,.nes-container.is-rounded.is-dark,.nes-dialog.is-rounded,.nes-dialog.is-rounded.is-dark,.nes-input,.nes-progress,.nes-progress.is-rounded,.nes-select select,.nes-table.is-bordered,.nes-table.is-dark.is-bordered,.nes-textarea{border-style:solid;border-width:4px}.nes-pointer{cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer}.nes-avatar{width:32px;height:32px}.nes-avatar.is-rounded{border-radius:50px}.nes-avatar.is-small{width:16px;height:16px}.nes-avatar.is-small.is-rounded{border-radius:50px}.nes-avatar.is-medium{width:48px;height:48px}.nes-avatar.is-medium.is-rounded{border-radius:50px}.nes-avatar.is-large{width:64px;height:64px}.nes-avatar.is-large.is-rounded{border-radius:50px}.nes-badge{position:relative;display:inline-block;width:10.5em;height:1.875em;margin:.5em;font-size:.9em;white-space:nowrap;vertical-align:top;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.nes-badge.is-splited span.is-dark:first-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#212529;left:0;box-shadow:0 .5em #212529,0 -.5em #212529,0 0 #212529,-.5em 0 #212529}.nes-badge.is-splited span.is-dark:last-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#212529;right:0;box-shadow:0 .5em #212529,0 -.5em #212529,.5em 0 #212529,0 0 #212529}.nes-badge.is-icon{width:5.25em}.nes-badge.is-icon span.is-dark:first-child{display:flex;align-items:center;justify-content:center;width:2.7em;font-size:.5em;color:#fff;text-align:center;background-color:#212529;position:absolute;top:-2.8em;left:-2.7em;height:2.7em}.nes-badge.is-icon span.is-dark:last-child{display:inline-block;align-items:center;justify-content:center;width:6em;font-size:.88em;color:#fff;text-align:center;background-color:#212529;box-shadow:0 .5em #212529,0 -.5em #212529,.5em 0 #212529,-.5em 0 #212529}.nes-badge span.is-dark:first-child{position:absolute;top:0;width:100%;color:#fff;text-align:center;background-color:#212529;box-shadow:0 .5em #212529,0 -.5em #212529,.5em 0 #212529,-.5em 0 #212529}.nes-badge.is-splited span.is-primary:first-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#209cee;left:0;box-shadow:0 .5em #209cee,0 -.5em #209cee,0 0 #209cee,-.5em 0 #209cee}.nes-badge.is-splited span.is-primary:last-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#209cee;right:0;box-shadow:0 .5em #209cee,0 -.5em #209cee,.5em 0 #209cee,0 0 #209cee}.nes-badge.is-icon{width:5.25em}.nes-badge.is-icon span.is-primary:first-child{display:flex;align-items:center;justify-content:center;width:2.7em;font-size:.5em;color:#fff;text-align:center;background-color:#209cee;position:absolute;top:-2.8em;left:-2.7em;height:2.7em}.nes-badge.is-icon span.is-primary:last-child{display:inline-block;align-items:center;justify-content:center;width:6em;font-size:.88em;color:#fff;text-align:center;background-color:#209cee;box-shadow:0 .5em #209cee,0 -.5em #209cee,.5em 0 #209cee,-.5em 0 #209cee}.nes-badge span.is-primary:first-child{position:absolute;top:0;width:100%;color:#fff;text-align:center;background-color:#209cee;box-shadow:0 .5em #209cee,0 -.5em #209cee,.5em 0 #209cee,-.5em 0 #209cee}.nes-badge.is-splited span.is-success:first-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#92cc41;left:0;box-shadow:0 .5em #92cc41,0 -.5em #92cc41,0 0 #92cc41,-.5em 0 #92cc41}.nes-badge.is-splited span.is-success:last-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#92cc41;right:0;box-shadow:0 .5em #92cc41,0 -.5em #92cc41,.5em 0 #92cc41,0 0 #92cc41}.nes-badge.is-icon{width:5.25em}.nes-badge.is-icon span.is-success:first-child{display:flex;align-items:center;justify-content:center;width:2.7em;font-size:.5em;color:#fff;text-align:center;background-color:#92cc41;position:absolute;top:-2.8em;left:-2.7em;height:2.7em}.nes-badge.is-icon span.is-success:last-child{display:inline-block;align-items:center;justify-content:center;width:6em;font-size:.88em;color:#fff;text-align:center;background-color:#92cc41;box-shadow:0 .5em #92cc41,0 -.5em #92cc41,.5em 0 #92cc41,-.5em 0 #92cc41}.nes-badge span.is-success:first-child{position:absolute;top:0;width:100%;color:#fff;text-align:center;background-color:#92cc41;box-shadow:0 .5em #92cc41,0 -.5em #92cc41,.5em 0 #92cc41,-.5em 0 #92cc41}.nes-badge.is-splited span.is-warning:first-child{position:absolute;top:0;width:50%;color:#212529;text-align:center;background-color:#f7d51d;left:0;box-shadow:0 .5em #f7d51d,0 -.5em #f7d51d,0 0 #f7d51d,-.5em 0 #f7d51d}.nes-badge.is-splited span.is-warning:last-child{position:absolute;top:0;width:50%;color:#212529;text-align:center;background-color:#f7d51d;right:0;box-shadow:0 .5em #f7d51d,0 -.5em #f7d51d,.5em 0 #f7d51d,0 0 #f7d51d}.nes-badge.is-icon{width:5.25em}.nes-badge.is-icon span.is-warning:first-child{display:flex;align-items:center;justify-content:center;width:2.7em;font-size:.5em;color:#212529;text-align:center;background-color:#f7d51d;position:absolute;top:-2.8em;left:-2.7em;height:2.7em}.nes-badge.is-icon span.is-warning:last-child{display:inline-block;align-items:center;justify-content:center;width:6em;font-size:.88em;color:#212529;text-align:center;background-color:#f7d51d;box-shadow:0 .5em #f7d51d,0 -.5em #f7d51d,.5em 0 #f7d51d,-.5em 0 #f7d51d}.nes-badge span.is-warning:first-child{position:absolute;top:0;width:100%;color:#212529;text-align:center;background-color:#f7d51d;box-shadow:0 .5em #f7d51d,0 -.5em #f7d51d,.5em 0 #f7d51d,-.5em 0 #f7d51d}.nes-badge.is-splited span.is-error:first-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#e76e55;left:0;box-shadow:0 .5em #e76e55,0 -.5em #e76e55,0 0 #e76e55,-.5em 0 #e76e55}.nes-badge.is-splited span.is-error:last-child{position:absolute;top:0;width:50%;color:#fff;text-align:center;background-color:#e76e55;right:0;box-shadow:0 .5em #e76e55,0 -.5em #e76e55,.5em 0 #e76e55,0 0 #e76e55}.nes-badge.is-icon{width:5.25em}.nes-badge.is-icon span.is-error:first-child{display:flex;align-items:center;justify-content:center;width:2.7em;font-size:.5em;color:#fff;text-align:center;background-color:#e76e55;position:absolute;top:-2.8em;left:-2.7em;height:2.7em}.nes-badge.is-icon span.is-error:last-child{display:inline-block;align-items:center;justify-content:center;width:6em;font-size:.88em;color:#fff;text-align:center;background-color:#e76e55;box-shadow:0 .5em #e76e55,0 -.5em #e76e55,.5em 0 #e76e55,-.5em 0 #e76e55}.nes-badge span.is-error:first-child{position:absolute;top:0;width:100%;color:#fff;text-align:center;background-color:#e76e55;box-shadow:0 .5em #e76e55,0 -.5em #e76e55,.5em 0 #e76e55,-.5em 0 #e76e55}.nes-balloon{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;position:relative;display:inline-block;padding:1rem 1.5rem;margin:8px;margin-bottom:30px;background-color:#fff}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-balloon{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-balloon{border-image-repeat:stretch}}.nes-balloon>:last-child{margin-bottom:0}.nes-balloon::after,.nes-balloon::before{position:absolute;content:""}.nes-balloon.is-dark{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:0;color:#fff;background:#212529;border-image-outset:2;box-shadow:0 0 0 8px #212529}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-balloon.is-dark{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-balloon.is-dark{border-image-repeat:stretch}}.nes-balloon.is-dark.from-left::before,.nes-balloon.is-dark.from-right::before{background-color:#212529;border-color:#fff}.nes-balloon.is-dark.from-left::after,.nes-balloon.is-dark.from-right::after{color:#fff;background-color:#212529}.nes-balloon.is-dark.from-left::before{box-shadow:-5px 10px 0 6px #212529}.nes-balloon.is-dark.from-left::after{box-shadow:-4px 0,4px 0,-4px 4px #212529,0 4px,-8px 4px,-4px 8px,-8px 8px}.nes-balloon.is-dark.from-right::before{box-shadow:5px 10px 0 6px #212529}.nes-balloon.is-dark.from-right::after{box-shadow:-4px 0,4px 0,4px 4px #212529,0 4px,8px 4px,4px 8px,8px 8px}.nes-balloon.from-left::after,.nes-balloon.from-left::before{left:2rem}.nes-balloon.from-left::before{bottom:-14px;width:26px;height:10px;background-color:#fff;border-right:4px solid #212529;border-left:4px solid #212529}.nes-balloon.from-left::after{bottom:-18px;width:18px;height:4px;margin-right:8px;color:#212529;background-color:#fff;box-shadow:-4px 0,4px 0,-4px 4px #fff,0 4px,-8px 4px,-4px 8px,-8px 8px}.nes-balloon.from-right::after,.nes-balloon.from-right::before{right:2rem}.nes-balloon.from-right::before{bottom:-14px;width:26px;height:10px;background-color:#fff;border-right:4px solid #212529;border-left:4px solid #212529}.nes-balloon.from-right::after{bottom:-18px;width:18px;height:4px;margin-left:8px;background-color:#fff;box-shadow:-4px 0,4px 0,4px 4px #fff,0 4px,8px 4px,4px 8px,8px 8px}.nes-btn{border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;position:relative;display:inline-block;padding:6px 8px;margin:4px;text-align:center;vertical-align:middle;cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:#212529;background-color:#fff}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-btn{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-btn{border-image-repeat:stretch}}.nes-btn::after{position:absolute;top:-4px;right:-4px;bottom:-4px;left:-4px;content:"";box-shadow:inset -4px -4px #adafbc}.nes-btn:hover{color:#212529;text-decoration:none;background-color:#e7e7e7}.nes-btn:hover::after{box-shadow:inset -6px -6px #adafbc}.nes-btn:focus{box-shadow:0 0 0 6px rgba(173,175,188,.3)}.nes-btn:active:not(.is-disabled)::after{box-shadow:inset 4px 4px #adafbc}.nes-btn:focus{outline:0}.nes-btn.is-disabled,.nes-btn.is-disabled:focus,.nes-btn.is-disabled:hover{color:#212529;cursor:not-allowed;background-color:#d3d3d3;box-shadow:inset -4px -4px #adafbc;opacity:.6}.nes-btn.is-primary{color:#fff;background-color:#209cee}.nes-btn.is-primary::after{position:absolute;top:-4px;right:-4px;bottom:-4px;left:-4px;content:"";box-shadow:inset -4px -4px #006bb3}.nes-btn.is-primary:hover{color:#fff;text-decoration:none;background-color:#108de0}.nes-btn.is-primary:hover::after{box-shadow:inset -6px -6px #006bb3}.nes-btn.is-primary:focus{box-shadow:0 0 0 6px rgba(0,107,179,.3)}.nes-btn.is-primary:active:not(.is-disabled)::after{box-shadow:inset 4px 4px #006bb3}.nes-btn.is-success{color:#fff;background-color:#92cc41}.nes-btn.is-success::after{position:absolute;top:-4px;right:-4px;bottom:-4px;left:-4px;content:"";box-shadow:inset -4px -4px #4aa52e}.nes-btn.is-success:hover{color:#fff;text-decoration:none;background-color:#76c442}.nes-btn.is-success:hover::after{box-shadow:inset -6px -6px #4aa52e}.nes-btn.is-success:focus{box-shadow:0 0 0 6px rgba(74,165,46,.3)}.nes-btn.is-success:active:not(.is-disabled)::after{box-shadow:inset 4px 4px #4aa52e}.nes-btn.is-warning{color:#212529;background-color:#f7d51d}.nes-btn.is-warning::after{position:absolute;top:-4px;right:-4px;bottom:-4px;left:-4px;content:"";box-shadow:inset -4px -4px #e59400}.nes-btn.is-warning:hover{color:#212529;text-decoration:none;background-color:#f2c409}.nes-btn.is-warning:hover::after{box-shadow:inset -6px -6px #e59400}.nes-btn.is-warning:focus{box-shadow:0 0 0 6px rgba(229,148,0,.3)}.nes-btn.is-warning:active:not(.is-disabled)::after{box-shadow:inset 4px 4px #e59400}.nes-btn.is-error{color:#fff;background-color:#e76e55}.nes-btn.is-error::after{position:absolute;top:-4px;right:-4px;bottom:-4px;left:-4px;content:"";box-shadow:inset -4px -4px #8c2022}.nes-btn.is-error:hover{color:#fff;text-decoration:none;background-color:#ce372b}.nes-btn.is-error:hover::after{box-shadow:inset -6px -6px #8c2022}.nes-btn.is-error:focus{box-shadow:0 0 0 6px rgba(140,32,34,.3)}.nes-btn.is-error:active:not(.is-disabled)::after{box-shadow:inset 4px 4px #8c2022}.nes-btn input[type=file]{position:absolute;pointer-events:none;opacity:0}.nes-container{position:relative;padding:1.5rem 2rem;border-color:#000;border-style:solid;border-width:4px}.nes-container>:last-child{margin-bottom:0}.nes-container.is-centered{text-align:center}.nes-container.is-right{text-align:right}.nes-container.with-title>.title{display:table;padding:0 .5rem;margin:-1.8rem 0 1rem;font-size:1rem;background-color:#fff}.nes-container.with-title.is-centered>.title{margin:-2rem auto 1rem}.nes-container.with-title.is-right>.title{margin:-2rem 0 1rem auto}.nes-container.is-dark{position:relative;margin:4px;color:#fff;background-color:#212529;border-color:#fff}.nes-container.is-dark::after{position:absolute;top:-7.2px;right:-7.2px;bottom:-7.2px;left:-7.2px;z-index:-1;content:"";background-color:#212529}.nes-container.is-dark.with-title>.title{color:#fff;background-color:#212529}.nes-container.is-rounded{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;padding:1rem 1.5rem;margin:4px}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-container.is-rounded{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-container.is-rounded{border-image-repeat:stretch}}.nes-container.is-rounded.with-title>.title{margin-top:-1.5rem}.nes-container.is-rounded.with-title.is-centered>.title{margin:-1.5rem auto 1rem}.nes-container.is-rounded.with-title.is-right>.title{margin:-1.5rem 0 1rem auto}.nes-container.is-rounded.is-dark{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:0}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-container.is-rounded.is-dark{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-container.is-rounded.is-dark{border-image-repeat:stretch}}.nes-container.is-rounded.is-dark::after{content:none}.nes-container.is-rounded.is-dark.with-title>.title{margin-top:-1.3rem}.nes-container.is-rounded.is-dark.with-title.is-centered>.title{margin:-1.3rem auto 1rem}.nes-container.is-rounded.is-dark.with-title.is-right>.title{margin:-1.3rem 0 1rem auto}.nes-dialog{padding:1.5rem 2rem;border-width:4px}.nes-dialog::-webkit-backdrop,.nes-dialog>.backdrop{background-color:rgba(0,0,0,.3)}.nes-dialog::backdrop,.nes-dialog>.backdrop{background-color:rgba(0,0,0,.3)}.nes-dialog>:last-child{margin-bottom:0}.nes-dialog.is-rounded{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-dialog.is-rounded{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-dialog.is-rounded{border-image-repeat:stretch}}.nes-dialog.is-rounded.is-dark{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:0}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-dialog.is-rounded.is-dark{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-dialog.is-rounded.is-dark{border-image-repeat:stretch}}.nes-dialog.is-dark{color:#fff;background-color:#212529;border-color:#fff}.nes-dialog.is-dark:not(.is-rounded)::before{position:absolute;top:-8px;right:-8px;bottom:-8px;left:-8px;z-index:-1;content:"";border:4px solid #212529}.nes-list{list-style-type:none}.nes-list li{position:relative}.nes-list.is-disc li::before{position:absolute;top:calc(50% - 8px);left:-22px;content:"";width:2px;height:2px;color:#212529;box-shadow:8px 2px,10px 2px,6px 4px,8px 4px,10px 4px,12px 4px,4px 6px,6px 6px,8px 6px,10px 6px,12px 6px,14px 6px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,14px 8px,6px 10px,8px 10px,10px 10px,12px 10px,8px 12px,10px 12px}@supports (-moz-appearance:meterbar){.nes-list.is-disc li::before{box-shadow:8px 2px 0 .020em,10px 2px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,10px 4px 0 .020em,12px 4px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,8px 6px 0 .020em,10px 6px 0 .020em,12px 6px 0 .020em,14px 6px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,8px 8px 0 .020em,10px 8px 0 .020em,12px 8px 0 .020em,14px 8px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,12px 10px 0 .020em,8px 12px 0 .020em,10px 12px 0 .020em}}.nes-list.is-circle li::before{position:absolute;top:calc(50% - 8px);left:-22px;content:"";width:2px;height:2px;color:#212529;box-shadow:8px 2px,10px 2px,6px 4px,8px 4px,10px 4px,12px 4px,4px 6px,6px 6px,12px 6px,14px 6px,4px 8px,6px 8px,12px 8px,14px 8px,6px 10px,8px 10px,10px 10px,12px 10px,8px 12px,10px 12px}@supports (-moz-appearance:meterbar){.nes-list.is-circle li::before{box-shadow:8px 2px 0 .020em,10px 2px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,10px 4px 0 .020em,12px 4px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,12px 6px 0 .020em,14px 6px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,12px 8px 0 .020em,14px 8px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,12px 10px 0 .020em,8px 12px 0 .020em,10px 12px 0 .020em}}.nes-progress{border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;width:100%;height:48px;margin:4px;color:#212529;background-color:#fff;-webkit-appearance:none;-moz-appearance:none;appearance:none}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-progress{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-progress{border-image-repeat:stretch}}.nes-progress::-webkit-progress-bar{background-color:#fff}.nes-progress::-webkit-progress-value{background-color:#212529}.nes-progress::-moz-progress-bar{background-color:#212529}.nes-progress::-ms-fill{background-color:#212529;border:none}.nes-progress.is-rounded{border-image-slice:3;border-image-width:3;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-progress.is-rounded{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-progress.is-rounded{border-image-repeat:stretch}}.nes-progress.is-primary::-webkit-progress-bar{background-color:#fff}.nes-progress.is-primary::-webkit-progress-value{background-color:#209cee}.nes-progress.is-primary::-moz-progress-bar{background-color:#209cee}.nes-progress.is-primary::-ms-fill{background-color:#209cee;border:none}.nes-progress.is-success::-webkit-progress-bar{background-color:#fff}.nes-progress.is-success::-webkit-progress-value{background-color:#92cc41}.nes-progress.is-success::-moz-progress-bar{background-color:#92cc41}.nes-progress.is-success::-ms-fill{background-color:#92cc41;border:none}.nes-progress.is-warning::-webkit-progress-bar{background-color:#fff}.nes-progress.is-warning::-webkit-progress-value{background-color:#f7d51d}.nes-progress.is-warning::-moz-progress-bar{background-color:#f7d51d}.nes-progress.is-warning::-ms-fill{background-color:#f7d51d;border:none}.nes-progress.is-error::-webkit-progress-bar{background-color:#fff}.nes-progress.is-error::-webkit-progress-value{background-color:#e76e55}.nes-progress.is-error::-moz-progress-bar{background-color:#e76e55}.nes-progress.is-error::-ms-fill{background-color:#e76e55;border:none}.nes-progress.is-pattern::-webkit-progress-value{background-color:#212529;background-image:linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff),linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff);background-position:0 0,10px 10px;background-size:20px 20px}.nes-progress.is-pattern::-moz-progress-bar{background-color:#212529;background-image:-moz-linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff),-moz-linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff);background-position:0 0,10px 10px;background-size:20px 20px}.nes-progress.is-pattern::-ms-fill{background-color:#212529;background-image:linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff),linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff);background-position:0 0,10px 10px;background-size:20px 20px;border:none}.nes-table-responsive{max-width:100%;overflow-x:auto;overflow-y:hidden}.nes-table{table-layout:fixed;background-color:#fff}.nes-table tr{margin-left:-.25em}.nes-table td,.nes-table th{position:relative;padding:.5rem;word-wrap:break-word;border-color:#212529;border-style:solid;border-width:0 .25em .25em 0}.nes-table td:last-child,.nes-table th:last-child{border-right-width:0}.nes-table td::after,.nes-table td::before,.nes-table th::after,.nes-table th::before{position:absolute;display:block;width:.25em;height:.25em;content:"";background-color:#212529}.nes-table td::after,.nes-table th::after{bottom:-.25em;left:-.25em}.nes-table td::before,.nes-table th::before{top:-.25em;right:-.25em}.nes-table td:last-child::before,.nes-table th:last-child::before{top:initial;bottom:-.25em}.nes-table.is-centered th{text-align:center}.nes-table.is-bordered{margin:4px;border-spacing:0;border-collapse:separate;border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-table.is-bordered{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-table.is-bordered{border-image-repeat:stretch}}.nes-table.is-dark{color:#fff;background-color:#212529}.nes-table.is-dark::before{position:absolute;top:0;right:0;bottom:0;left:0;content:""}.nes-table.is-dark.is-bordered{border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:0}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-table.is-dark.is-bordered{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-table.is-dark.is-bordered{border-image-repeat:stretch}}.nes-table.is-dark td,.nes-table.is-dark th{border-color:#fff}.nes-table.is-dark td::after,.nes-table.is-dark td::before,.nes-table.is-dark th::after,.nes-table.is-dark th::before{display:none}.nes-table tbody tr:last-child td,.nes-table tbody tr:last-child th,.nes-table thead:last-child tr:last-child td,.nes-table thead:last-child tr:last-child th{border-bottom-width:0}.nes-table tbody tr:last-child td:first-child::after,.nes-table tbody tr:last-child td:last-child::before,.nes-table tbody tr:last-child th:first-child::after,.nes-table tbody tr:last-child th:last-child::before,.nes-table thead:last-child tr:last-child td:first-child::after,.nes-table thead:last-child tr:last-child td:last-child::before,.nes-table thead:last-child tr:last-child th:first-child::after,.nes-table thead:last-child tr:last-child th:last-child::before{display:none}.nes-text.is-primary{color:#209cee}.nes-text.is-success{color:#92cc41}.nes-text.is-warning{color:#f7d51d}.nes-text.is-error{color:#e76e55}.nes-text.is-disabled{color:#d3d3d3}.nes-input,.nes-textarea{border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;width:calc(100% - 8px);padding:.5rem 1rem;margin:4px;background-clip:padding-box}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-input,.nes-textarea{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-input,.nes-textarea{border-image-repeat:stretch}}.nes-input.is-dark,.nes-textarea.is-dark{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#e7e7e7;color:#fff;background-color:#212529}.nes-input.is-success,.nes-textarea.is-success{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#76c442}.nes-input.is-warning,.nes-textarea.is-warning{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#f2c409}.nes-input.is-error,.nes-textarea.is-error{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#ce372b}.nes-field>label{display:block}.nes-field .nes-input,.nes-field .nes-textarea{display:block}.nes-field.is-inline{display:flex;align-items:center}.nes-field.is-inline>label{flex-basis:0;flex-grow:1;margin:0;margin-right:1.5rem;text-align:right}.nes-field.is-inline .nes-input,.nes-field.is-inline .nes-textarea{flex-basis:0;flex-grow:5}@media screen and (max-width:768px){.nes-field.is-inline{display:block}.nes-field.is-inline>label{margin-bottom:.5rem;text-align:left}.nes-field.is-inline .nes-input{max-width:100%}}.nes-radio{margin-right:20px;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;-webkit-clip-path:inset(50%);clip-path:inset(50%)}.nes-radio+span{position:relative;cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer}.nes-radio:checked+span::before{position:absolute;top:-2px;left:-20px;content:"";width:2px;height:2px;color:#212529;box-shadow:2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px}@supports (-moz-appearance:meterbar){.nes-radio:checked+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,2px 4px 0 .020em,4px 4px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,2px 6px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,8px 6px 0 .020em,10px 6px 0 .020em,2px 8px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,8px 8px 0 .020em,10px 8px 0 .020em,12px 8px 0 .020em,2px 10px 0 .020em,4px 10px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,2px 12px 0 .020em,4px 12px 0 .020em,6px 12px 0 .020em,8px 12px 0 .020em,2px 14px 0 .020em,4px 14px 0 .020em}}.nes-radio:checked:focus+span::before,.nes-radio:checked:hover+span::before{animation:blink 1s infinite steps(1)}.nes-radio:checked:focus+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px}@supports (-moz-appearance:meterbar){.nes-radio:checked:focus+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,2px 4px 0 .020em,4px 4px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,2px 6px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,8px 6px 0 .020em,10px 6px 0 .020em,2px 8px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,8px 8px 0 .020em,10px 8px 0 .020em,12px 8px 0 .020em,2px 10px 0 .020em,4px 10px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,2px 12px 0 .020em,4px 12px 0 .020em,6px 12px 0 .020em,8px 12px 0 .020em,2px 14px 0 .020em,4px 14px 0 .020em}}.nes-radio.is-dark+span{color:#fff}.nes-radio.is-dark+span::before{color:#fff}.nes-radio.is-dark:checked+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px;color:#fff}@supports (-moz-appearance:meterbar){.nes-radio.is-dark:checked+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,2px 4px 0 .020em,4px 4px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,2px 6px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,8px 6px 0 .020em,10px 6px 0 .020em,2px 8px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,8px 8px 0 .020em,10px 8px 0 .020em,12px 8px 0 .020em,2px 10px 0 .020em,4px 10px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,2px 12px 0 .020em,4px 12px 0 .020em,6px 12px 0 .020em,8px 12px 0 .020em,2px 14px 0 .020em,4px 14px 0 .020em}}.nes-radio.is-dark:checked:focus+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,2px 4px,4px 4px,6px 4px,8px 4px,2px 6px,4px 6px,6px 6px,8px 6px,10px 6px,2px 8px,4px 8px,6px 8px,8px 8px,10px 8px,12px 8px,2px 10px,4px 10px,6px 10px,8px 10px,10px 10px,2px 12px,4px 12px,6px 12px,8px 12px,2px 14px,4px 14px;color:#fff}@supports (-moz-appearance:meterbar){.nes-radio.is-dark:checked:focus+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,2px 4px 0 .020em,4px 4px 0 .020em,6px 4px 0 .020em,8px 4px 0 .020em,2px 6px 0 .020em,4px 6px 0 .020em,6px 6px 0 .020em,8px 6px 0 .020em,10px 6px 0 .020em,2px 8px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,8px 8px 0 .020em,10px 8px 0 .020em,12px 8px 0 .020em,2px 10px 0 .020em,4px 10px 0 .020em,6px 10px 0 .020em,8px 10px 0 .020em,10px 10px 0 .020em,2px 12px 0 .020em,4px 12px 0 .020em,6px 12px 0 .020em,8px 12px 0 .020em,2px 14px 0 .020em,4px 14px 0 .020em}}.nes-checkbox{margin-left:28px;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;-webkit-clip-path:inset(50%);clip-path:inset(50%)}.nes-checkbox+span{position:relative;cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer}.nes-checkbox+span::before,.nes-checkbox:checked+span::before{position:absolute;top:-3px;left:-28px;content:""}.nes-checkbox+span::before{width:2px;height:2px;color:#212529;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,16px 2px,2px 4px,16px 4px,2px 6px,16px 6px,2px 8px,16px 8px,2px 10px,16px 10px,2px 12px,16px 12px,2px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px}@supports (-moz-appearance:meterbar){.nes-checkbox+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,16px 2px 0 .020em,2px 4px 0 .020em,16px 4px 0 .020em,2px 6px 0 .020em,16px 6px 0 .020em,2px 8px 0 .020em,16px 8px 0 .020em,2px 10px 0 .020em,16px 10px 0 .020em,2px 12px 0 .020em,16px 12px 0 .020em,2px 14px 0 .020em,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-checkbox:focus+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,16px 2px,2px 4px,16px 4px,2px 6px,16px 6px,2px 8px,16px 8px,2px 10px,16px 10px,2px 12px,16px 12px,2px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px}@supports (-moz-appearance:meterbar){.nes-checkbox:focus+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,16px 2px 0 .020em,2px 4px 0 .020em,16px 4px 0 .020em,2px 6px 0 .020em,16px 6px 0 .020em,2px 8px 0 .020em,16px 8px 0 .020em,2px 10px 0 .020em,16px 10px 0 .020em,2px 12px 0 .020em,16px 12px 0 .020em,2px 14px 0 .020em,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-checkbox:checked+span::before{width:2px;height:2px;color:#212529;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px,20px 2px,2px 4px,16px 4px,18px 4px,20px 4px,2px 6px,14px 6px,16px 6px,2px 8px,4px 8px,12px 8px,14px 8px,2px 10px,4px 10px,6px 10px,10px 10px,12px 10px,16px 10px,2px 12px,6px 12px,8px 12px,10px 12px,16px 12px,2px 14px,8px 14px,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px}@supports (-moz-appearance:meterbar){.nes-checkbox:checked+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,18px 2px 0 .020em,20px 2px 0 .020em,2px 4px 0 .020em,16px 4px 0 .020em,18px 4px 0 .020em,20px 4px 0 .020em,2px 6px 0 .020em,14px 6px 0 .020em,16px 6px 0 .020em,2px 8px 0 .020em,4px 8px 0 .020em,12px 8px 0 .020em,14px 8px 0 .020em,2px 10px 0 .020em,4px 10px 0 .020em,6px 10px 0 .020em,10px 10px 0 .020em,12px 10px 0 .020em,16px 10px 0 .020em,2px 12px 0 .020em,6px 12px 0 .020em,8px 12px 0 .020em,10px 12px 0 .020em,16px 12px 0 .020em,2px 14px 0 .020em,8px 14px 0 .020em,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-checkbox:checked:focus+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #212529,20px 2px #212529,2px 4px,16px 4px #212529,18px 4px #212529,20px 4px #212529,2px 6px #212529,14px 6px #212529,16px 6px #212529,2px 8px #212529,4px 8px #212529,12px 8px #212529,14px 8px #212529,2px 10px,4px 10px #212529,6px 10px #212529,10px 10px #212529,12px 10px #212529,16px 10px,2px 12px,6px 12px #212529,8px 12px #212529,10px 12px #212529,16px 12px,2px 14px,8px 14px #212529,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px}@supports (-moz-appearance:meterbar){.nes-checkbox:checked:focus+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,18px 2px 0 .020em #212529,20px 2px 0 .020em #212529,2px 4px 0 .020em,16px 4px 0 .020em #212529,18px 4px 0 .020em #212529,20px 4px 0 .020em #212529,2px 6px 0 .020em #212529,14px 6px 0 .020em #212529,16px 6px 0 .020em #212529,2px 8px 0 .020em #212529,4px 8px 0 .020em #212529,12px 8px 0 .020em #212529,14px 8px 0 .020em #212529,2px 10px 0 .020em,4px 10px 0 .020em #212529,6px 10px 0 .020em #212529,10px 10px 0 .020em #212529,12px 10px 0 .020em #212529,16px 10px 0 .020em,2px 12px 0 .020em,6px 12px 0 .020em #212529,8px 12px 0 .020em #212529,10px 12px 0 .020em #212529,16px 12px 0 .020em,2px 14px 0 .020em,8px 14px 0 .020em #212529,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-checkbox.is-dark+span{color:#fff}.nes-checkbox.is-dark+span::before{color:#fff}.nes-checkbox.is-dark:checked+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #fff,20px 2px #fff,2px 4px,16px 4px #fff,18px 4px #fff,20px 4px #fff,2px 6px #fff,14px 6px #fff,16px 6px #fff,2px 8px #fff,4px 8px #fff,12px 8px #fff,14px 8px #fff,2px 10px,4px 10px #fff,6px 10px #fff,10px 10px #fff,12px 10px #fff,16px 10px,2px 12px,6px 12px #fff,8px 12px #fff,10px 12px #fff,16px 12px,2px 14px,8px 14px #fff,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px;color:#fff}@supports (-moz-appearance:meterbar){.nes-checkbox.is-dark:checked+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,18px 2px 0 .020em #fff,20px 2px 0 .020em #fff,2px 4px 0 .020em,16px 4px 0 .020em #fff,18px 4px 0 .020em #fff,20px 4px 0 .020em #fff,2px 6px 0 .020em #fff,14px 6px 0 .020em #fff,16px 6px 0 .020em #fff,2px 8px 0 .020em #fff,4px 8px 0 .020em #fff,12px 8px 0 .020em #fff,14px 8px 0 .020em #fff,2px 10px 0 .020em,4px 10px 0 .020em #fff,6px 10px 0 .020em #fff,10px 10px 0 .020em #fff,12px 10px 0 .020em #fff,16px 10px 0 .020em,2px 12px 0 .020em,6px 12px 0 .020em #fff,8px 12px 0 .020em #fff,10px 12px 0 .020em #fff,16px 12px 0 .020em,2px 14px 0 .020em,8px 14px 0 .020em #fff,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-checkbox.is-dark:checked:focus+span::before{width:2px;height:2px;color:#adafbc;box-shadow:2px 2px,4px 2px,6px 2px,8px 2px,10px 2px,12px 2px,14px 2px,18px 2px #fff,20px 2px #fff,2px 4px,16px 4px #fff,18px 4px #fff,20px 4px #fff,2px 6px #fff,14px 6px #fff,16px 6px #fff,2px 8px #fff,4px 8px #fff,12px 8px #fff,14px 8px #fff,2px 10px,4px 10px #fff,6px 10px #fff,10px 10px #fff,12px 10px #fff,16px 10px,2px 12px,6px 12px #fff,8px 12px #fff,10px 12px #fff,16px 12px,2px 14px,8px 14px #fff,16px 14px,2px 16px,4px 16px,6px 16px,8px 16px,10px 16px,12px 16px,14px 16px,16px 16px;color:#fff}@supports (-moz-appearance:meterbar){.nes-checkbox.is-dark:checked:focus+span::before{box-shadow:2px 2px 0 .020em,4px 2px 0 .020em,6px 2px 0 .020em,8px 2px 0 .020em,10px 2px 0 .020em,12px 2px 0 .020em,14px 2px 0 .020em,18px 2px 0 .020em #fff,20px 2px 0 .020em #fff,2px 4px 0 .020em,16px 4px 0 .020em #fff,18px 4px 0 .020em #fff,20px 4px 0 .020em #fff,2px 6px 0 .020em #fff,14px 6px 0 .020em #fff,16px 6px 0 .020em #fff,2px 8px 0 .020em #fff,4px 8px 0 .020em #fff,12px 8px 0 .020em #fff,14px 8px 0 .020em #fff,2px 10px 0 .020em,4px 10px 0 .020em #fff,6px 10px 0 .020em #fff,10px 10px 0 .020em #fff,12px 10px 0 .020em #fff,16px 10px 0 .020em,2px 12px 0 .020em,6px 12px 0 .020em #fff,8px 12px 0 .020em #fff,10px 12px 0 .020em #fff,16px 12px 0 .020em,2px 14px 0 .020em,8px 14px 0 .020em #fff,16px 14px 0 .020em,2px 16px 0 .020em,4px 16px 0 .020em,6px 16px 0 .020em,8px 16px 0 .020em,10px 16px 0 .020em,12px 16px 0 .020em,14px 16px 0 .020em,16px 16px 0 .020em}}.nes-select{position:relative;width:calc(100% - 8px);margin:4px}.nes-select select{border-image-slice:2;border-image-width:2;border-image-repeat:stretch;border-image-source:url('data:image/svg+xml;utf8,');border-image-outset:2;width:100%;padding:.5rem 2.5rem .5rem 1rem;cursor:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC) 14 0,pointer;border-radius:0;outline-color:#e7e7e7;-webkit-appearance:none;-moz-appearance:none;appearance:none}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.nes-select select{border-image-repeat:space}}@supports (-moz-appearance:meterbar){.nes-select select{border-image-repeat:stretch}}.nes-select select:invalid{color:#adafbc}.nes-select.is-dark select{color:#fff;background-color:#212529}.nes-select::after{width:3px;height:3px;color:#212529;box-shadow:3px 3px,6px 3px,9px 3px,12px 3px,15px 3px,18px 3px,21px 3px,3px 6px,6px 6px,9px 6px,12px 6px,15px 6px,18px 6px,21px 6px,6px 9px,9px 9px,12px 9px,15px 9px,18px 9px,6px 12px,9px 12px,12px 12px,15px 12px,18px 12px,9px 15px,12px 15px,15px 15px,12px 18px;position:absolute;top:calc(50% - 11px);right:36px;pointer-events:none;content:""}@supports (-moz-appearance:meterbar){.nes-select::after{box-shadow:3px 3px 0 .020em,6px 3px 0 .020em,9px 3px 0 .020em,12px 3px 0 .020em,15px 3px 0 .020em,18px 3px 0 .020em,21px 3px 0 .020em,3px 6px 0 .020em,6px 6px 0 .020em,9px 6px 0 .020em,12px 6px 0 .020em,15px 6px 0 .020em,18px 6px 0 .020em,21px 6px 0 .020em,6px 9px 0 .020em,9px 9px 0 .020em,12px 9px 0 .020em,15px 9px 0 .020em,18px 9px 0 .020em,6px 12px 0 .020em,9px 12px 0 .020em,12px 12px 0 .020em,15px 12px 0 .020em,18px 12px 0 .020em,9px 15px 0 .020em,12px 15px 0 .020em,15px 15px 0 .020em,12px 18px 0 .020em}}.nes-select.is-success::after{color:#92cc41}.nes-select.is-success select{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#76c442}.nes-select.is-warning::after{color:#f7d51d}.nes-select.is-warning select{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#f2c409}.nes-select.is-error::after{color:#e76e55}.nes-select.is-error select{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#ce372b}.nes-select.is-dark::after{color:#fff}.nes-select.is-dark select{border-image-source:url('data:image/svg+xml;utf8,');outline-color:#e7e7e7}.nes-icon{position:relative;display:inline-block;width:16px;height:16px;margin-right:16px;margin-bottom:16px;transform:scale(2);transform-origin:top left}.nes-icon.is-small{margin:0;transform:scale(1)}.nes-icon.is-medium{margin-right:32px;margin-bottom:32px;transform:scale(3)}.nes-icon.is-large{margin-right:48px;margin-bottom:48px;transform:scale(4)}.nes-icon::before{position:absolute;top:-1px;left:-1px;display:block;content:"";background:0 0}.nes-icon.heart::before{width:1px;height:1px;color:#f22426;box-shadow:3px 2px #444,4px 2px #444,5px 2px #444,11px 2px #444,12px 2px #444,13px 2px #444,2px 3px #444,3px 3px,4px 3px,5px 3px,6px 3px #444,10px 3px #444,11px 3px,12px 3px,13px 3px #842300,14px 3px #444,1px 4px #444,2px 4px,3px 4px #fff,4px 4px #fff,5px 4px,6px 4px,7px 4px #444,9px 4px #444,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px #842300,15px 4px #444,1px 5px #444,2px 5px,3px 5px #fff,4px 5px,5px 5px,6px 5px,7px 5px,8px 5px #444,9px 5px,10px 5px,11px 5px,12px 5px,13px 5px,14px 5px #842300,15px 5px #444,1px 6px #444,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px #842300,15px 6px #444,1px 7px #444,2px 7px,3px 7px,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,14px 7px #842300,15px 7px #444,1px 8px #444,2px 8px,3px 8px,4px 8px,5px 8px,6px 8px,7px 8px,8px 8px,9px 8px,10px 8px,11px 8px,12px 8px,13px 8px,14px 8px #842300,15px 8px #444,2px 9px #444,3px 9px,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px,12px 9px,13px 9px #842300,14px 9px #444,3px 10px #444,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px,12px 10px #842300,13px 10px #444,4px 11px #444,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px,11px 11px #842300,12px 11px #444,5px 12px #444,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px #842300,11px 12px #444,6px 13px #444,7px 13px,8px 13px,9px 13px #842300,10px 13px #444,7px 14px #444,8px 14px #842300,9px 14px #444,8px 15px #444}@supports (-moz-appearance:meterbar){.nes-icon.heart::before{box-shadow:3px 2px 0 .020em #444,4px 2px 0 .020em #444,5px 2px 0 .020em #444,11px 2px 0 .020em #444,12px 2px 0 .020em #444,13px 2px 0 .020em #444,2px 3px 0 .020em #444,3px 3px 0 .020em,4px 3px 0 .020em,5px 3px 0 .020em,6px 3px 0 .020em #444,10px 3px 0 .020em #444,11px 3px 0 .020em,12px 3px 0 .020em,13px 3px 0 .020em #842300,14px 3px 0 .020em #444,1px 4px 0 .020em #444,2px 4px 0 .020em,3px 4px 0 .020em #fff,4px 4px 0 .020em #fff,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em #444,9px 4px 0 .020em #444,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em,13px 4px 0 .020em,14px 4px 0 .020em #842300,15px 4px 0 .020em #444,1px 5px 0 .020em #444,2px 5px 0 .020em,3px 5px 0 .020em #fff,4px 5px 0 .020em,5px 5px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em,8px 5px 0 .020em #444,9px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em,12px 5px 0 .020em,13px 5px 0 .020em,14px 5px 0 .020em #842300,15px 5px 0 .020em #444,1px 6px 0 .020em #444,2px 6px 0 .020em,3px 6px 0 .020em,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em,8px 6px 0 .020em,9px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em #842300,15px 6px 0 .020em #444,1px 7px 0 .020em #444,2px 7px 0 .020em,3px 7px 0 .020em,4px 7px 0 .020em,5px 7px 0 .020em,6px 7px 0 .020em,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em,11px 7px 0 .020em,12px 7px 0 .020em,13px 7px 0 .020em,14px 7px 0 .020em #842300,15px 7px 0 .020em #444,1px 8px 0 .020em #444,2px 8px 0 .020em,3px 8px 0 .020em,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em,7px 8px 0 .020em,8px 8px 0 .020em,9px 8px 0 .020em,10px 8px 0 .020em,11px 8px 0 .020em,12px 8px 0 .020em,13px 8px 0 .020em,14px 8px 0 .020em #842300,15px 8px 0 .020em #444,2px 9px 0 .020em #444,3px 9px 0 .020em,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em,7px 9px 0 .020em,8px 9px 0 .020em,9px 9px 0 .020em,10px 9px 0 .020em,11px 9px 0 .020em,12px 9px 0 .020em,13px 9px 0 .020em #842300,14px 9px 0 .020em #444,3px 10px 0 .020em #444,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em,7px 10px 0 .020em,8px 10px 0 .020em,9px 10px 0 .020em,10px 10px 0 .020em,11px 10px 0 .020em,12px 10px 0 .020em #842300,13px 10px 0 .020em #444,4px 11px 0 .020em #444,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em,8px 11px 0 .020em,9px 11px 0 .020em,10px 11px 0 .020em,11px 11px 0 .020em #842300,12px 11px 0 .020em #444,5px 12px 0 .020em #444,6px 12px 0 .020em,7px 12px 0 .020em,8px 12px 0 .020em,9px 12px 0 .020em,10px 12px 0 .020em #842300,11px 12px 0 .020em #444,6px 13px 0 .020em #444,7px 13px 0 .020em,8px 13px 0 .020em,9px 13px 0 .020em #842300,10px 13px 0 .020em #444,7px 14px 0 .020em #444,8px 14px 0 .020em #842300,9px 14px 0 .020em #444,8px 15px 0 .020em #444}}.nes-icon.heart.is-half::before{width:1px;height:1px;color:#f22426;box-shadow:3px 2px #444,4px 2px #444,5px 2px #444,11px 2px #444,12px 2px #444,13px 2px #444,2px 3px #444,3px 3px,4px 3px,5px 3px,6px 3px #444,10px 3px #444,14px 3px #444,1px 4px #444,2px 4px,3px 4px #fff,4px 4px #fff,5px 4px,6px 4px,7px 4px #444,9px 4px #444,15px 4px #444,1px 5px #444,2px 5px,3px 5px #fff,4px 5px,5px 5px,6px 5px,7px 5px,8px 5px #444,15px 5px #444,1px 6px #444,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px,8px 6px,15px 6px #444,1px 7px #444,2px 7px,3px 7px,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px,15px 7px #444,1px 8px #444,2px 8px,3px 8px,4px 8px,5px 8px,6px 8px,7px 8px,8px 8px,15px 8px #444,2px 9px #444,3px 9px,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px,14px 9px #444,3px 10px #444,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,13px 10px #444,4px 11px #444,5px 11px,6px 11px,7px 11px,8px 11px,12px 11px #444,5px 12px #444,6px 12px,7px 12px,8px 12px,11px 12px #444,6px 13px #444,7px 13px,8px 13px,10px 13px #444,7px 14px #444,8px 14px #842300,9px 14px #444,8px 15px #444}@supports (-moz-appearance:meterbar){.nes-icon.heart.is-half::before{box-shadow:3px 2px 0 .020em #444,4px 2px 0 .020em #444,5px 2px 0 .020em #444,11px 2px 0 .020em #444,12px 2px 0 .020em #444,13px 2px 0 .020em #444,2px 3px 0 .020em #444,3px 3px 0 .020em,4px 3px 0 .020em,5px 3px 0 .020em,6px 3px 0 .020em #444,10px 3px 0 .020em #444,14px 3px 0 .020em #444,1px 4px 0 .020em #444,2px 4px 0 .020em,3px 4px 0 .020em #fff,4px 4px 0 .020em #fff,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em #444,9px 4px 0 .020em #444,15px 4px 0 .020em #444,1px 5px 0 .020em #444,2px 5px 0 .020em,3px 5px 0 .020em #fff,4px 5px 0 .020em,5px 5px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em,8px 5px 0 .020em #444,15px 5px 0 .020em #444,1px 6px 0 .020em #444,2px 6px 0 .020em,3px 6px 0 .020em,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em,8px 6px 0 .020em,15px 6px 0 .020em #444,1px 7px 0 .020em #444,2px 7px 0 .020em,3px 7px 0 .020em,4px 7px 0 .020em,5px 7px 0 .020em,6px 7px 0 .020em,7px 7px 0 .020em,8px 7px 0 .020em,15px 7px 0 .020em #444,1px 8px 0 .020em #444,2px 8px 0 .020em,3px 8px 0 .020em,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em,7px 8px 0 .020em,8px 8px 0 .020em,15px 8px 0 .020em #444,2px 9px 0 .020em #444,3px 9px 0 .020em,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em,7px 9px 0 .020em,8px 9px 0 .020em,14px 9px 0 .020em #444,3px 10px 0 .020em #444,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em,7px 10px 0 .020em,8px 10px 0 .020em,13px 10px 0 .020em #444,4px 11px 0 .020em #444,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em,8px 11px 0 .020em,12px 11px 0 .020em #444,5px 12px 0 .020em #444,6px 12px 0 .020em,7px 12px 0 .020em,8px 12px 0 .020em,11px 12px 0 .020em #444,6px 13px 0 .020em #444,7px 13px 0 .020em,8px 13px 0 .020em,10px 13px 0 .020em #444,7px 14px 0 .020em #444,8px 14px 0 .020em #842300,9px 14px 0 .020em #444,8px 15px 0 .020em #444}}.nes-icon.heart.is-transparent::before{width:1px;height:1px;color:#444;box-shadow:3px 2px,4px 2px,5px 2px,11px 2px,12px 2px,13px 2px,2px 3px,6px 3px,10px 3px,14px 3px,1px 4px,7px 4px,9px 4px,15px 4px,1px 5px,8px 5px,15px 5px,1px 6px,15px 6px,1px 7px,15px 7px,1px 8px,15px 8px,2px 9px,14px 9px,3px 10px,13px 10px,4px 11px,12px 11px,5px 12px,11px 12px,6px 13px,10px 13px,7px 14px,9px 14px,8px 15px}@supports (-moz-appearance:meterbar){.nes-icon.heart.is-transparent::before{box-shadow:3px 2px 0 .020em,4px 2px 0 .020em,5px 2px 0 .020em,11px 2px 0 .020em,12px 2px 0 .020em,13px 2px 0 .020em,2px 3px 0 .020em,6px 3px 0 .020em,10px 3px 0 .020em,14px 3px 0 .020em,1px 4px 0 .020em,7px 4px 0 .020em,9px 4px 0 .020em,15px 4px 0 .020em,1px 5px 0 .020em,8px 5px 0 .020em,15px 5px 0 .020em,1px 6px 0 .020em,15px 6px 0 .020em,1px 7px 0 .020em,15px 7px 0 .020em,1px 8px 0 .020em,15px 8px 0 .020em,2px 9px 0 .020em,14px 9px 0 .020em,3px 10px 0 .020em,13px 10px 0 .020em,4px 11px 0 .020em,12px 11px 0 .020em,5px 12px 0 .020em,11px 12px 0 .020em,6px 13px 0 .020em,10px 13px 0 .020em,7px 14px 0 .020em,9px 14px 0 .020em,8px 15px 0 .020em}}.nes-icon.heart.is-empty::before{width:1px;height:1px;color:#adafbb;box-shadow:3px 2px,4px 2px,5px 2px,11px 2px,12px 2px,13px 2px,2px 3px,6px 3px,10px 3px,14px 3px,1px 4px,7px 4px,9px 4px,15px 4px,1px 5px,8px 5px,15px 5px,1px 6px,15px 6px,1px 7px,15px 7px,1px 8px,15px 8px,2px 9px,14px 9px,3px 10px,13px 10px,4px 11px,12px 11px,5px 12px,11px 12px,6px 13px,10px 13px,7px 14px,9px 14px,8px 15px}@supports (-moz-appearance:meterbar){.nes-icon.heart.is-empty::before{box-shadow:3px 2px 0 .020em,4px 2px 0 .020em,5px 2px 0 .020em,11px 2px 0 .020em,12px 2px 0 .020em,13px 2px 0 .020em,2px 3px 0 .020em,6px 3px 0 .020em,10px 3px 0 .020em,14px 3px 0 .020em,1px 4px 0 .020em,7px 4px 0 .020em,9px 4px 0 .020em,15px 4px 0 .020em,1px 5px 0 .020em,8px 5px 0 .020em,15px 5px 0 .020em,1px 6px 0 .020em,15px 6px 0 .020em,1px 7px 0 .020em,15px 7px 0 .020em,1px 8px 0 .020em,15px 8px 0 .020em,2px 9px 0 .020em,14px 9px 0 .020em,3px 10px 0 .020em,13px 10px 0 .020em,4px 11px 0 .020em,12px 11px 0 .020em,5px 12px 0 .020em,11px 12px 0 .020em,6px 13px 0 .020em,10px 13px 0 .020em,7px 14px 0 .020em,9px 14px 0 .020em,8px 15px 0 .020em}}.nes-icon.star::before{width:1px;height:1px;color:#ebe527;box-shadow:8px 1px #444,7px 2px #444,8px 2px,9px 2px #444,7px 3px #444,8px 3px,9px 3px #444,6px 4px #444,7px 4px,8px 4px,9px 4px,10px 4px #444,6px 5px #444,7px 5px #fff,8px 5px #fff,9px 5px,10px 5px #444,1px 6px #444,2px 6px #444,3px 6px #444,4px 6px #444,5px 6px #444,6px 6px #444,7px 6px #fff,8px 6px,9px 6px,10px 6px,11px 6px #444,12px 6px #444,13px 6px #444,14px 6px #444,15px 6px #444,1px 7px #444,2px 7px,3px 7px,4px 7px,5px 7px #fff,6px 7px #fff,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,14px 7px,15px 7px #444,2px 8px #444,3px 8px,4px 8px,5px 8px #fff,6px 8px,7px 8px,8px 8px,9px 8px,10px 8px,11px 8px,12px 8px,13px 8px #f59f54,14px 8px #444,3px 9px #444,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px #f59f54,12px 9px #f59f54,13px 9px #444,4px 10px #444,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px,12px 10px #444,3px 11px #444,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px #f59f54,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px #444,3px 12px #444,4px 12px,5px 12px,6px 12px,7px 12px #f59f54,8px 12px #f59f54,9px 12px #f59f54,10px 12px,11px 12px,12px 12px,13px 12px #444,2px 13px #444,3px 13px,4px 13px,5px 13px #f59f54,6px 13px #f59f54,7px 13px #f59f54,8px 13px #444,9px 13px #f59f54,10px 13px #f59f54,11px 13px #f59f54,12px 13px,13px 13px,14px 13px #444,2px 14px #444,3px 14px,4px 14px #f59f54,5px 14px #f59f54,6px 14px #444,7px 14px #444,9px 14px #444,10px 14px #444,11px 14px #f59f54,12px 14px #f59f54,13px 14px,14px 14px #444,1px 15px #444,2px 15px #f59f54,3px 15px #f59f54,4px 15px #444,5px 15px #444,11px 15px #444,12px 15px #444,13px 15px #f59f54,14px 15px #f59f54,15px 15px #444,1px 16px #444,2px 16px #444,3px 16px #444,13px 16px #444,14px 16px #444,15px 16px #444}@supports (-moz-appearance:meterbar){.nes-icon.star::before{box-shadow:8px 1px 0 .020em #444,7px 2px 0 .020em #444,8px 2px 0 .020em,9px 2px 0 .020em #444,7px 3px 0 .020em #444,8px 3px 0 .020em,9px 3px 0 .020em #444,6px 4px 0 .020em #444,7px 4px 0 .020em,8px 4px 0 .020em,9px 4px 0 .020em,10px 4px 0 .020em #444,6px 5px 0 .020em #444,7px 5px 0 .020em #fff,8px 5px 0 .020em #fff,9px 5px 0 .020em,10px 5px 0 .020em #444,1px 6px 0 .020em #444,2px 6px 0 .020em #444,3px 6px 0 .020em #444,4px 6px 0 .020em #444,5px 6px 0 .020em #444,6px 6px 0 .020em #444,7px 6px 0 .020em #fff,8px 6px 0 .020em,9px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em #444,12px 6px 0 .020em #444,13px 6px 0 .020em #444,14px 6px 0 .020em #444,15px 6px 0 .020em #444,1px 7px 0 .020em #444,2px 7px 0 .020em,3px 7px 0 .020em,4px 7px 0 .020em,5px 7px 0 .020em #fff,6px 7px 0 .020em #fff,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em,11px 7px 0 .020em,12px 7px 0 .020em,13px 7px 0 .020em,14px 7px 0 .020em,15px 7px 0 .020em #444,2px 8px 0 .020em #444,3px 8px 0 .020em,4px 8px 0 .020em,5px 8px 0 .020em #fff,6px 8px 0 .020em,7px 8px 0 .020em,8px 8px 0 .020em,9px 8px 0 .020em,10px 8px 0 .020em,11px 8px 0 .020em,12px 8px 0 .020em,13px 8px 0 .020em #f59f54,14px 8px 0 .020em #444,3px 9px 0 .020em #444,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em,7px 9px 0 .020em,8px 9px 0 .020em,9px 9px 0 .020em,10px 9px 0 .020em,11px 9px 0 .020em #f59f54,12px 9px 0 .020em #f59f54,13px 9px 0 .020em #444,4px 10px 0 .020em #444,5px 10px 0 .020em,6px 10px 0 .020em,7px 10px 0 .020em,8px 10px 0 .020em,9px 10px 0 .020em,10px 10px 0 .020em,11px 10px 0 .020em,12px 10px 0 .020em #444,3px 11px 0 .020em #444,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em,8px 11px 0 .020em #f59f54,9px 11px 0 .020em,10px 11px 0 .020em,11px 11px 0 .020em,12px 11px 0 .020em,13px 11px 0 .020em #444,3px 12px 0 .020em #444,4px 12px 0 .020em,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em #f59f54,8px 12px 0 .020em #f59f54,9px 12px 0 .020em #f59f54,10px 12px 0 .020em,11px 12px 0 .020em,12px 12px 0 .020em,13px 12px 0 .020em #444,2px 13px 0 .020em #444,3px 13px 0 .020em,4px 13px 0 .020em,5px 13px 0 .020em #f59f54,6px 13px 0 .020em #f59f54,7px 13px 0 .020em #f59f54,8px 13px 0 .020em #444,9px 13px 0 .020em #f59f54,10px 13px 0 .020em #f59f54,11px 13px 0 .020em #f59f54,12px 13px 0 .020em,13px 13px 0 .020em,14px 13px 0 .020em #444,2px 14px 0 .020em #444,3px 14px 0 .020em,4px 14px 0 .020em #f59f54,5px 14px 0 .020em #f59f54,6px 14px 0 .020em #444,7px 14px 0 .020em #444,9px 14px 0 .020em #444,10px 14px 0 .020em #444,11px 14px 0 .020em #f59f54,12px 14px 0 .020em #f59f54,13px 14px 0 .020em,14px 14px 0 .020em #444,1px 15px 0 .020em #444,2px 15px 0 .020em #f59f54,3px 15px 0 .020em #f59f54,4px 15px 0 .020em #444,5px 15px 0 .020em #444,11px 15px 0 .020em #444,12px 15px 0 .020em #444,13px 15px 0 .020em #f59f54,14px 15px 0 .020em #f59f54,15px 15px 0 .020em #444,1px 16px 0 .020em #444,2px 16px 0 .020em #444,3px 16px 0 .020em #444,13px 16px 0 .020em #444,14px 16px 0 .020em #444,15px 16px 0 .020em #444}}.nes-icon.star.is-empty::before{width:1px;height:1px;color:#adafbb;box-shadow:8px 1px,7px 2px,9px 2px,7px 3px,9px 3px,6px 4px,10px 4px,6px 5px,10px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,1px 7px,15px 7px,2px 8px,14px 8px,3px 9px,13px 9px,4px 10px,12px 10px,3px 11px,13px 11px,3px 12px,13px 12px,2px 13px,8px 13px,14px 13px,2px 14px,6px 14px,7px 14px,9px 14px,10px 14px,14px 14px,1px 15px,4px 15px,5px 15px,11px 15px,12px 15px,15px 15px,1px 16px,2px 16px,3px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.star.is-empty::before{box-shadow:8px 1px 0 .020em,7px 2px 0 .020em,9px 2px 0 .020em,7px 3px 0 .020em,9px 3px 0 .020em,6px 4px 0 .020em,10px 4px 0 .020em,6px 5px 0 .020em,10px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em,1px 7px 0 .020em,15px 7px 0 .020em,2px 8px 0 .020em,14px 8px 0 .020em,3px 9px 0 .020em,13px 9px 0 .020em,4px 10px 0 .020em,12px 10px 0 .020em,3px 11px 0 .020em,13px 11px 0 .020em,3px 12px 0 .020em,13px 12px 0 .020em,2px 13px 0 .020em,8px 13px 0 .020em,14px 13px 0 .020em,2px 14px 0 .020em,6px 14px 0 .020em,7px 14px 0 .020em,9px 14px 0 .020em,10px 14px 0 .020em,14px 14px 0 .020em,1px 15px 0 .020em,4px 15px 0 .020em,5px 15px 0 .020em,11px 15px 0 .020em,12px 15px 0 .020em,15px 15px 0 .020em,1px 16px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.star.is-half::before{width:1px;height:1px;color:#444;box-shadow:8px 1px,7px 2px,8px 2px #ebe527,9px 2px,7px 3px,8px 3px #ebe527,9px 3px,6px 4px,7px 4px #ebe527,8px 4px #ebe527,10px 4px,6px 5px,7px 5px #ebe527,8px 5px #ebe527,10px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px #ebe527,8px 6px #ebe527,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,1px 7px,2px 7px #ebe527,3px 7px #ebe527,4px 7px #ebe527,5px 7px #ebe527,6px 7px #ebe527,7px 7px #ebe527,8px 7px #ebe527,15px 7px,2px 8px,3px 8px #ebe527,4px 8px #ebe527,5px 8px #ebe527,6px 8px #ebe527,7px 8px #ebe527,8px 8px #ebe527,14px 8px,3px 9px,4px 9px #ebe527,5px 9px #ebe527,6px 9px #ebe527,7px 9px #ebe527,8px 9px #ebe527,13px 9px,4px 10px,5px 10px #ebe527,6px 10px #ebe527,7px 10px #ebe527,8px 10px #ebe527,12px 10px,3px 11px,4px 11px #ebe527,5px 11px #ebe527,6px 11px #ebe527,7px 11px #ebe527,8px 11px #f59f54,13px 11px,3px 12px,4px 12px #ebe527,5px 12px #ebe527,6px 12px #ebe527,7px 12px #f59f54,8px 12px #f59f54,13px 12px,2px 13px,3px 13px #ebe527,4px 13px #ebe527,5px 13px #f59f54,6px 13px #f59f54,7px 13px #f59f54,8px 13px,14px 13px,2px 14px,3px 14px #ebe527,4px 14px #f59f54,5px 14px #f59f54,6px 14px,7px 14px,9px 14px,10px 14px,14px 14px,1px 15px,2px 15px #f59f54,3px 15px #f59f54,4px 15px,5px 15px,11px 15px,12px 15px,15px 15px,1px 16px,2px 16px,3px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.star.is-half::before{box-shadow:8px 1px 0 .020em,7px 2px 0 .020em,8px 2px 0 .020em #ebe527,9px 2px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em #ebe527,9px 3px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em #ebe527,8px 4px 0 .020em #ebe527,10px 4px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em #ebe527,8px 5px 0 .020em #ebe527,10px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em #ebe527,8px 6px 0 .020em #ebe527,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em,1px 7px 0 .020em,2px 7px 0 .020em #ebe527,3px 7px 0 .020em #ebe527,4px 7px 0 .020em #ebe527,5px 7px 0 .020em #ebe527,6px 7px 0 .020em #ebe527,7px 7px 0 .020em #ebe527,8px 7px 0 .020em #ebe527,15px 7px 0 .020em,2px 8px 0 .020em,3px 8px 0 .020em #ebe527,4px 8px 0 .020em #ebe527,5px 8px 0 .020em #ebe527,6px 8px 0 .020em #ebe527,7px 8px 0 .020em #ebe527,8px 8px 0 .020em #ebe527,14px 8px 0 .020em,3px 9px 0 .020em,4px 9px 0 .020em #ebe527,5px 9px 0 .020em #ebe527,6px 9px 0 .020em #ebe527,7px 9px 0 .020em #ebe527,8px 9px 0 .020em #ebe527,13px 9px 0 .020em,4px 10px 0 .020em,5px 10px 0 .020em #ebe527,6px 10px 0 .020em #ebe527,7px 10px 0 .020em #ebe527,8px 10px 0 .020em #ebe527,12px 10px 0 .020em,3px 11px 0 .020em,4px 11px 0 .020em #ebe527,5px 11px 0 .020em #ebe527,6px 11px 0 .020em #ebe527,7px 11px 0 .020em #ebe527,8px 11px 0 .020em #f59f54,13px 11px 0 .020em,3px 12px 0 .020em,4px 12px 0 .020em #ebe527,5px 12px 0 .020em #ebe527,6px 12px 0 .020em #ebe527,7px 12px 0 .020em #f59f54,8px 12px 0 .020em #f59f54,13px 12px 0 .020em,2px 13px 0 .020em,3px 13px 0 .020em #ebe527,4px 13px 0 .020em #ebe527,5px 13px 0 .020em #f59f54,6px 13px 0 .020em #f59f54,7px 13px 0 .020em #f59f54,8px 13px 0 .020em,14px 13px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em #ebe527,4px 14px 0 .020em #f59f54,5px 14px 0 .020em #f59f54,6px 14px 0 .020em,7px 14px 0 .020em,9px 14px 0 .020em,10px 14px 0 .020em,14px 14px 0 .020em,1px 15px 0 .020em,2px 15px 0 .020em #f59f54,3px 15px 0 .020em #f59f54,4px 15px 0 .020em,5px 15px 0 .020em,11px 15px 0 .020em,12px 15px 0 .020em,15px 15px 0 .020em,1px 16px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.star.is-transparent::before{width:1px;height:1px;color:#444;box-shadow:8px 1px,7px 2px,9px 2px,7px 3px,9px 3px,6px 4px,10px 4px,6px 5px,10px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,1px 7px,15px 7px,2px 8px,14px 8px,3px 9px,13px 9px,4px 10px,12px 10px,3px 11px,13px 11px,3px 12px,13px 12px,2px 13px,8px 13px,14px 13px,2px 14px,6px 14px,7px 14px,9px 14px,10px 14px,14px 14px,1px 15px,4px 15px,5px 15px,11px 15px,12px 15px,15px 15px,1px 16px,2px 16px,3px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.star.is-transparent::before{box-shadow:8px 1px 0 .020em,7px 2px 0 .020em,9px 2px 0 .020em,7px 3px 0 .020em,9px 3px 0 .020em,6px 4px 0 .020em,10px 4px 0 .020em,6px 5px 0 .020em,10px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em,1px 7px 0 .020em,15px 7px 0 .020em,2px 8px 0 .020em,14px 8px 0 .020em,3px 9px 0 .020em,13px 9px 0 .020em,4px 10px 0 .020em,12px 10px 0 .020em,3px 11px 0 .020em,13px 11px 0 .020em,3px 12px 0 .020em,13px 12px 0 .020em,2px 13px 0 .020em,8px 13px 0 .020em,14px 13px 0 .020em,2px 14px 0 .020em,6px 14px 0 .020em,7px 14px 0 .020em,9px 14px 0 .020em,10px 14px 0 .020em,14px 14px 0 .020em,1px 15px 0 .020em,4px 15px 0 .020em,5px 15px 0 .020em,11px 15px 0 .020em,12px 15px 0 .020em,15px 15px 0 .020em,1px 16px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.trophy::before{width:1px;height:1px;color:#ebe527;box-shadow:3px 1px #444,4px 1px #444,5px 1px #444,6px 1px #444,7px 1px #444,8px 1px #444,9px 1px #444,10px 1px #444,11px 1px #444,12px 1px #444,13px 1px #444,3px 2px #444,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px #f59f54,13px 2px #444,1px 3px #444,2px 3px #444,3px 3px #444,4px 3px,5px 3px #fff,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px #f59f54,13px 3px #444,14px 3px #444,15px 3px #444,1px 4px #444,3px 4px #444,4px 4px,5px 4px #fff,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px #f59f54,13px 4px #444,15px 4px #444,1px 5px #444,3px 5px #444,4px 5px,5px 5px #fff,6px 5px,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px,12px 5px #f59f54,13px 5px #444,15px 5px #444,2px 6px #444,3px 6px #444,4px 6px,5px 6px #fff,6px 6px,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px #f59f54,13px 6px #444,14px 6px #444,3px 7px #444,4px 7px,5px 7px #fff,6px 7px,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px #f59f54,13px 7px #444,3px 8px #444,4px 8px,5px 8px,6px 8px,7px 8px,8px 8px,9px 8px,10px 8px,11px 8px,12px 8px #f59f54,13px 8px #444,4px 9px #444,5px 9px,6px 9px,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px #f59f54,12px 9px #444,5px 10px #444,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px #f59f54,11px 10px #444,6px 11px #444,7px 11px,8px 11px,9px 11px #f59f54,10px 11px #444,7px 12px #444,8px 12px,9px 12px #444,7px 13px #444,8px 13px,9px 13px #444,6px 14px #444,7px 14px #444,8px 14px,9px 14px #444,10px 14px #444,5px 15px #444,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px #f59f54,11px 15px #444,5px 16px #444,6px 16px #444,7px 16px #444,8px 16px #444,9px 16px #444,10px 16px #444,11px 16px #444}@supports (-moz-appearance:meterbar){.nes-icon.trophy::before{box-shadow:3px 1px 0 .020em #444,4px 1px 0 .020em #444,5px 1px 0 .020em #444,6px 1px 0 .020em #444,7px 1px 0 .020em #444,8px 1px 0 .020em #444,9px 1px 0 .020em #444,10px 1px 0 .020em #444,11px 1px 0 .020em #444,12px 1px 0 .020em #444,13px 1px 0 .020em #444,3px 2px 0 .020em #444,4px 2px 0 .020em,5px 2px 0 .020em,6px 2px 0 .020em,7px 2px 0 .020em,8px 2px 0 .020em,9px 2px 0 .020em,10px 2px 0 .020em,11px 2px 0 .020em,12px 2px 0 .020em #f59f54,13px 2px 0 .020em #444,1px 3px 0 .020em #444,2px 3px 0 .020em #444,3px 3px 0 .020em #444,4px 3px 0 .020em,5px 3px 0 .020em #fff,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em #f59f54,13px 3px 0 .020em #444,14px 3px 0 .020em #444,15px 3px 0 .020em #444,1px 4px 0 .020em #444,3px 4px 0 .020em #444,4px 4px 0 .020em,5px 4px 0 .020em #fff,6px 4px 0 .020em,7px 4px 0 .020em,8px 4px 0 .020em,9px 4px 0 .020em,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em #f59f54,13px 4px 0 .020em #444,15px 4px 0 .020em #444,1px 5px 0 .020em #444,3px 5px 0 .020em #444,4px 5px 0 .020em,5px 5px 0 .020em #fff,6px 5px 0 .020em,7px 5px 0 .020em,8px 5px 0 .020em,9px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em,12px 5px 0 .020em #f59f54,13px 5px 0 .020em #444,15px 5px 0 .020em #444,2px 6px 0 .020em #444,3px 6px 0 .020em #444,4px 6px 0 .020em,5px 6px 0 .020em #fff,6px 6px 0 .020em,7px 6px 0 .020em,8px 6px 0 .020em,9px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em #f59f54,13px 6px 0 .020em #444,14px 6px 0 .020em #444,3px 7px 0 .020em #444,4px 7px 0 .020em,5px 7px 0 .020em #fff,6px 7px 0 .020em,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em,11px 7px 0 .020em,12px 7px 0 .020em #f59f54,13px 7px 0 .020em #444,3px 8px 0 .020em #444,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em,7px 8px 0 .020em,8px 8px 0 .020em,9px 8px 0 .020em,10px 8px 0 .020em,11px 8px 0 .020em,12px 8px 0 .020em #f59f54,13px 8px 0 .020em #444,4px 9px 0 .020em #444,5px 9px 0 .020em,6px 9px 0 .020em,7px 9px 0 .020em,8px 9px 0 .020em,9px 9px 0 .020em,10px 9px 0 .020em,11px 9px 0 .020em #f59f54,12px 9px 0 .020em #444,5px 10px 0 .020em #444,6px 10px 0 .020em,7px 10px 0 .020em,8px 10px 0 .020em,9px 10px 0 .020em,10px 10px 0 .020em #f59f54,11px 10px 0 .020em #444,6px 11px 0 .020em #444,7px 11px 0 .020em,8px 11px 0 .020em,9px 11px 0 .020em #f59f54,10px 11px 0 .020em #444,7px 12px 0 .020em #444,8px 12px 0 .020em,9px 12px 0 .020em #444,7px 13px 0 .020em #444,8px 13px 0 .020em,9px 13px 0 .020em #444,6px 14px 0 .020em #444,7px 14px 0 .020em #444,8px 14px 0 .020em,9px 14px 0 .020em #444,10px 14px 0 .020em #444,5px 15px 0 .020em #444,6px 15px 0 .020em,7px 15px 0 .020em,8px 15px 0 .020em,9px 15px 0 .020em,10px 15px 0 .020em #f59f54,11px 15px 0 .020em #444,5px 16px 0 .020em #444,6px 16px 0 .020em #444,7px 16px 0 .020em #444,8px 16px 0 .020em #444,9px 16px 0 .020em #444,10px 16px 0 .020em #444,11px 16px 0 .020em #444}}.nes-icon.trophy.is-empty::before{width:1px;height:1px;color:#adafbb;box-shadow:3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,3px 2px,13px 2px,1px 3px,2px 3px,3px 3px,13px 3px,14px 3px,15px 3px,1px 4px,3px 4px,13px 4px,15px 4px,1px 5px,3px 5px,13px 5px,15px 5px,2px 6px,3px 6px,13px 6px,14px 6px,3px 7px,13px 7px,3px 8px,13px 8px,4px 9px,12px 9px,5px 10px,11px 10px,6px 11px,10px 11px,7px 12px,9px 12px,7px 13px,9px 13px,6px 14px,7px 14px,9px 14px,10px 14px,5px 15px,11px 15px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px}@supports (-moz-appearance:meterbar){.nes-icon.trophy.is-empty::before{box-shadow:3px 1px 0 .020em,4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,3px 2px 0 .020em,13px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em,3px 3px 0 .020em,13px 3px 0 .020em,14px 3px 0 .020em,15px 3px 0 .020em,1px 4px 0 .020em,3px 4px 0 .020em,13px 4px 0 .020em,15px 4px 0 .020em,1px 5px 0 .020em,3px 5px 0 .020em,13px 5px 0 .020em,15px 5px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,3px 7px 0 .020em,13px 7px 0 .020em,3px 8px 0 .020em,13px 8px 0 .020em,4px 9px 0 .020em,12px 9px 0 .020em,5px 10px 0 .020em,11px 10px 0 .020em,6px 11px 0 .020em,10px 11px 0 .020em,7px 12px 0 .020em,9px 12px 0 .020em,7px 13px 0 .020em,9px 13px 0 .020em,6px 14px 0 .020em,7px 14px 0 .020em,9px 14px 0 .020em,10px 14px 0 .020em,5px 15px 0 .020em,11px 15px 0 .020em,5px 16px 0 .020em,6px 16px 0 .020em,7px 16px 0 .020em,8px 16px 0 .020em,9px 16px 0 .020em,10px 16px 0 .020em,11px 16px 0 .020em}}.nes-icon.like::before{width:1px;height:1px;color:#fff;box-shadow:8px 2px #333,9px 2px #333,8px 3px #333,9px 3px,10px 3px #333,8px 4px #333,9px 4px,10px 4px #333,7px 5px #333,8px 5px,9px 5px,10px 5px #333,7px 6px #333,8px 6px,9px 6px,10px 6px #333,11px 6px #333,12px 6px #333,13px 6px #333,14px 6px #333,15px 6px #333,6px 7px #333,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,14px 7px,15px 7px,16px 7px #333,2px 8px #333,3px 8px #333,4px 8px #333,6px 8px #333,7px 8px,8px 8px,9px 8px,10px 8px,11px 8px,12px 8px,13px 8px,14px 8px,15px 8px,16px 8px #333,1px 9px #333,2px 9px #2e77be,3px 9px #2e77be,4px 9px #2e77be,5px 9px #333,6px 9px,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px,12px 9px,13px 9px,14px 9px,15px 9px,16px 9px #333,1px 10px #333,2px 10px #2e77be,3px 10px #2e77be,4px 10px #2e77be,5px 10px #333,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px,12px 10px,13px 10px,14px 10px,15px 10px #333,1px 11px #333,2px 11px #2e77be,3px 11px #2e77be,4px 11px #2e77be,5px 11px #333,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px,14px 11px,15px 11px #333,1px 12px #333,2px 12px #2e77be,3px 12px #2e77be,4px 12px #2e77be,5px 12px #333,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px,13px 12px,14px 12px,15px 12px #333,1px 13px #333,2px 13px #2e77be,3px 13px #2e77be,4px 13px #2e77be,5px 13px #333,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px #333,1px 14px #333,2px 14px #2e77be,3px 14px #2e77be,4px 14px #2e77be,5px 14px #333,6px 14px,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px #333,2px 15px #333,3px 15px #333,4px 15px #333,6px 15px #333,7px 15px #333,8px 15px #333,9px 15px #333,10px 15px #333,11px 15px #333,12px 15px #333,13px 15px #333}@supports (-moz-appearance:meterbar){.nes-icon.like::before{box-shadow:8px 2px 0 .020em #333,9px 2px 0 .020em #333,8px 3px 0 .020em #333,9px 3px 0 .020em,10px 3px 0 .020em #333,8px 4px 0 .020em #333,9px 4px 0 .020em,10px 4px 0 .020em #333,7px 5px 0 .020em #333,8px 5px 0 .020em,9px 5px 0 .020em,10px 5px 0 .020em #333,7px 6px 0 .020em #333,8px 6px 0 .020em,9px 6px 0 .020em,10px 6px 0 .020em #333,11px 6px 0 .020em #333,12px 6px 0 .020em #333,13px 6px 0 .020em #333,14px 6px 0 .020em #333,15px 6px 0 .020em #333,6px 7px 0 .020em #333,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em,11px 7px 0 .020em,12px 7px 0 .020em,13px 7px 0 .020em,14px 7px 0 .020em,15px 7px 0 .020em,16px 7px 0 .020em #333,2px 8px 0 .020em #333,3px 8px 0 .020em #333,4px 8px 0 .020em #333,6px 8px 0 .020em #333,7px 8px 0 .020em,8px 8px 0 .020em,9px 8px 0 .020em,10px 8px 0 .020em,11px 8px 0 .020em,12px 8px 0 .020em,13px 8px 0 .020em,14px 8px 0 .020em,15px 8px 0 .020em,16px 8px 0 .020em #333,1px 9px 0 .020em #333,2px 9px 0 .020em #2e77be,3px 9px 0 .020em #2e77be,4px 9px 0 .020em #2e77be,5px 9px 0 .020em #333,6px 9px 0 .020em,7px 9px 0 .020em,8px 9px 0 .020em,9px 9px 0 .020em,10px 9px 0 .020em,11px 9px 0 .020em,12px 9px 0 .020em,13px 9px 0 .020em,14px 9px 0 .020em,15px 9px 0 .020em,16px 9px 0 .020em #333,1px 10px 0 .020em #333,2px 10px 0 .020em #2e77be,3px 10px 0 .020em #2e77be,4px 10px 0 .020em #2e77be,5px 10px 0 .020em #333,6px 10px 0 .020em,7px 10px 0 .020em,8px 10px 0 .020em,9px 10px 0 .020em,10px 10px 0 .020em,11px 10px 0 .020em,12px 10px 0 .020em,13px 10px 0 .020em,14px 10px 0 .020em,15px 10px 0 .020em #333,1px 11px 0 .020em #333,2px 11px 0 .020em #2e77be,3px 11px 0 .020em #2e77be,4px 11px 0 .020em #2e77be,5px 11px 0 .020em #333,6px 11px 0 .020em,7px 11px 0 .020em,8px 11px 0 .020em,9px 11px 0 .020em,10px 11px 0 .020em,11px 11px 0 .020em,12px 11px 0 .020em,13px 11px 0 .020em,14px 11px 0 .020em,15px 11px 0 .020em #333,1px 12px 0 .020em #333,2px 12px 0 .020em #2e77be,3px 12px 0 .020em #2e77be,4px 12px 0 .020em #2e77be,5px 12px 0 .020em #333,6px 12px 0 .020em,7px 12px 0 .020em,8px 12px 0 .020em,9px 12px 0 .020em,10px 12px 0 .020em,11px 12px 0 .020em,12px 12px 0 .020em,13px 12px 0 .020em,14px 12px 0 .020em,15px 12px 0 .020em #333,1px 13px 0 .020em #333,2px 13px 0 .020em #2e77be,3px 13px 0 .020em #2e77be,4px 13px 0 .020em #2e77be,5px 13px 0 .020em #333,6px 13px 0 .020em,7px 13px 0 .020em,8px 13px 0 .020em,9px 13px 0 .020em,10px 13px 0 .020em,11px 13px 0 .020em,12px 13px 0 .020em,13px 13px 0 .020em,14px 13px 0 .020em #333,1px 14px 0 .020em #333,2px 14px 0 .020em #2e77be,3px 14px 0 .020em #2e77be,4px 14px 0 .020em #2e77be,5px 14px 0 .020em #333,6px 14px 0 .020em,7px 14px 0 .020em,8px 14px 0 .020em,9px 14px 0 .020em,10px 14px 0 .020em,11px 14px 0 .020em,12px 14px 0 .020em,13px 14px 0 .020em,14px 14px 0 .020em #333,2px 15px 0 .020em #333,3px 15px 0 .020em #333,4px 15px 0 .020em #333,6px 15px 0 .020em #333,7px 15px 0 .020em #333,8px 15px 0 .020em #333,9px 15px 0 .020em #333,10px 15px 0 .020em #333,11px 15px 0 .020em #333,12px 15px 0 .020em #333,13px 15px 0 .020em #333}}.nes-icon.like.is-empty::before{width:1px;height:1px;color:#adafbb;box-shadow:8px 2px,9px 2px,8px 3px,10px 3px,8px 4px,10px 4px,7px 5px,10px 5px,7px 6px,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,6px 7px,16px 7px,2px 8px,3px 8px,4px 8px,6px 8px,16px 8px,1px 9px,5px 9px,16px 9px,1px 10px,5px 10px,15px 10px,1px 11px,5px 11px,15px 11px,1px 12px,5px 12px,15px 12px,1px 13px,5px 13px,14px 13px,1px 14px,5px 14px,14px 14px,2px 15px,3px 15px,4px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px}@supports (-moz-appearance:meterbar){.nes-icon.like.is-empty::before{box-shadow:8px 2px 0 .020em,9px 2px 0 .020em,8px 3px 0 .020em,10px 3px 0 .020em,8px 4px 0 .020em,10px 4px 0 .020em,7px 5px 0 .020em,10px 5px 0 .020em,7px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em,6px 7px 0 .020em,16px 7px 0 .020em,2px 8px 0 .020em,3px 8px 0 .020em,4px 8px 0 .020em,6px 8px 0 .020em,16px 8px 0 .020em,1px 9px 0 .020em,5px 9px 0 .020em,16px 9px 0 .020em,1px 10px 0 .020em,5px 10px 0 .020em,15px 10px 0 .020em,1px 11px 0 .020em,5px 11px 0 .020em,15px 11px 0 .020em,1px 12px 0 .020em,5px 12px 0 .020em,15px 12px 0 .020em,1px 13px 0 .020em,5px 13px 0 .020em,14px 13px 0 .020em,1px 14px 0 .020em,5px 14px 0 .020em,14px 14px 0 .020em,2px 15px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em,6px 15px 0 .020em,7px 15px 0 .020em,8px 15px 0 .020em,9px 15px 0 .020em,10px 15px 0 .020em,11px 15px 0 .020em,12px 15px 0 .020em,13px 15px 0 .020em}}.nes-icon.twitter::before{width:1px;height:1px;color:#2c9ceb;box-shadow:2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px,13px 2px,14px 2px,15px 2px,16px 2px,1px 3px,2px 3px #fff,3px 3px,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px #fff,11px 3px #fff,12px 3px #fff,13px 3px,14px 3px,15px 3px,16px 3px,1px 4px,2px 4px #fff,3px 4px #fff,4px 4px #fff,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px #fff,10px 4px #fff,11px 4px #fff,12px 4px #fff,13px 4px #fff,14px 4px,15px 4px,16px 4px,1px 5px,2px 5px #fff,3px 5px #fff,4px 5px #fff,5px 5px #fff,6px 5px #fff,7px 5px,8px 5px #fff,9px 5px #fff,10px 5px #fff,11px 5px #fff,12px 5px #fff,13px 5px #fff,14px 5px #fff,15px 5px #fff,16px 5px,1px 6px,2px 6px,3px 6px #fff,4px 6px #fff,5px 6px #fff,6px 6px #fff,7px 6px #fff,8px 6px #fff,9px 6px #fff,10px 6px #fff,11px 6px #fff,12px 6px #fff,13px 6px #fff,14px 6px #fff,15px 6px,16px 6px,1px 7px,2px 7px,3px 7px #fff,4px 7px #fff,5px 7px #fff,6px 7px #fff,7px 7px #fff,8px 7px #fff,9px 7px #fff,10px 7px #fff,11px 7px #fff,12px 7px #fff,13px 7px #fff,14px 7px #fff,15px 7px,16px 7px,1px 8px,2px 8px,3px 8px,4px 8px #fff,5px 8px #fff,6px 8px #fff,7px 8px #fff,8px 8px #fff,9px 8px #fff,10px 8px #fff,11px 8px #fff,12px 8px #fff,13px 8px #fff,14px 8px,15px 8px,16px 8px,1px 9px,2px 9px,3px 9px,4px 9px #fff,5px 9px #fff,6px 9px #fff,7px 9px #fff,8px 9px #fff,9px 9px #fff,10px 9px #fff,11px 9px #fff,12px 9px #fff,13px 9px,14px 9px,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px,4px 10px,5px 10px #fff,6px 10px #fff,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px #fff,12px 10px #fff,13px 10px,14px 10px,15px 10px,16px 10px,1px 11px,2px 11px,3px 11px,4px 11px,5px 11px,6px 11px #fff,7px 11px #fff,8px 11px #fff,9px 11px #fff,10px 11px #fff,11px 11px #fff,12px 11px #fff,13px 11px,14px 11px,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px,4px 12px,5px 12px #fff,6px 12px #fff,7px 12px #fff,8px 12px #fff,9px 12px #fff,10px 12px #fff,11px 12px #fff,12px 12px,13px 12px,14px 12px,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px #fff,4px 13px #fff,5px 13px #fff,6px 13px #fff,7px 13px #fff,8px 13px #fff,9px 13px #fff,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px #fff,5px 14px #fff,6px 14px #fff,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.twitter::before{box-shadow:2px 1px 0 .020em,3px 1px 0 .020em,4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,15px 1px 0 .020em,1px 2px 0 .020em,2px 2px 0 .020em,3px 2px 0 .020em,4px 2px 0 .020em,5px 2px 0 .020em,6px 2px 0 .020em,7px 2px 0 .020em,8px 2px 0 .020em,9px 2px 0 .020em,10px 2px 0 .020em,11px 2px 0 .020em,12px 2px 0 .020em,13px 2px 0 .020em,14px 2px 0 .020em,15px 2px 0 .020em,16px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em #fff,3px 3px 0 .020em,4px 3px 0 .020em,5px 3px 0 .020em,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em #fff,11px 3px 0 .020em #fff,12px 3px 0 .020em #fff,13px 3px 0 .020em,14px 3px 0 .020em,15px 3px 0 .020em,16px 3px 0 .020em,1px 4px 0 .020em,2px 4px 0 .020em #fff,3px 4px 0 .020em #fff,4px 4px 0 .020em #fff,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em,8px 4px 0 .020em,9px 4px 0 .020em #fff,10px 4px 0 .020em #fff,11px 4px 0 .020em #fff,12px 4px 0 .020em #fff,13px 4px 0 .020em #fff,14px 4px 0 .020em,15px 4px 0 .020em,16px 4px 0 .020em,1px 5px 0 .020em,2px 5px 0 .020em #fff,3px 5px 0 .020em #fff,4px 5px 0 .020em #fff,5px 5px 0 .020em #fff,6px 5px 0 .020em #fff,7px 5px 0 .020em,8px 5px 0 .020em #fff,9px 5px 0 .020em #fff,10px 5px 0 .020em #fff,11px 5px 0 .020em #fff,12px 5px 0 .020em #fff,13px 5px 0 .020em #fff,14px 5px 0 .020em #fff,15px 5px 0 .020em #fff,16px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em #fff,4px 6px 0 .020em #fff,5px 6px 0 .020em #fff,6px 6px 0 .020em #fff,7px 6px 0 .020em #fff,8px 6px 0 .020em #fff,9px 6px 0 .020em #fff,10px 6px 0 .020em #fff,11px 6px 0 .020em #fff,12px 6px 0 .020em #fff,13px 6px 0 .020em #fff,14px 6px 0 .020em #fff,15px 6px 0 .020em,16px 6px 0 .020em,1px 7px 0 .020em,2px 7px 0 .020em,3px 7px 0 .020em #fff,4px 7px 0 .020em #fff,5px 7px 0 .020em #fff,6px 7px 0 .020em #fff,7px 7px 0 .020em #fff,8px 7px 0 .020em #fff,9px 7px 0 .020em #fff,10px 7px 0 .020em #fff,11px 7px 0 .020em #fff,12px 7px 0 .020em #fff,13px 7px 0 .020em #fff,14px 7px 0 .020em #fff,15px 7px 0 .020em,16px 7px 0 .020em,1px 8px 0 .020em,2px 8px 0 .020em,3px 8px 0 .020em,4px 8px 0 .020em #fff,5px 8px 0 .020em #fff,6px 8px 0 .020em #fff,7px 8px 0 .020em #fff,8px 8px 0 .020em #fff,9px 8px 0 .020em #fff,10px 8px 0 .020em #fff,11px 8px 0 .020em #fff,12px 8px 0 .020em #fff,13px 8px 0 .020em #fff,14px 8px 0 .020em,15px 8px 0 .020em,16px 8px 0 .020em,1px 9px 0 .020em,2px 9px 0 .020em,3px 9px 0 .020em,4px 9px 0 .020em #fff,5px 9px 0 .020em #fff,6px 9px 0 .020em #fff,7px 9px 0 .020em #fff,8px 9px 0 .020em #fff,9px 9px 0 .020em #fff,10px 9px 0 .020em #fff,11px 9px 0 .020em #fff,12px 9px 0 .020em #fff,13px 9px 0 .020em,14px 9px 0 .020em,15px 9px 0 .020em,16px 9px 0 .020em,1px 10px 0 .020em,2px 10px 0 .020em,3px 10px 0 .020em,4px 10px 0 .020em,5px 10px 0 .020em #fff,6px 10px 0 .020em #fff,7px 10px 0 .020em #fff,8px 10px 0 .020em #fff,9px 10px 0 .020em #fff,10px 10px 0 .020em #fff,11px 10px 0 .020em #fff,12px 10px 0 .020em #fff,13px 10px 0 .020em,14px 10px 0 .020em,15px 10px 0 .020em,16px 10px 0 .020em,1px 11px 0 .020em,2px 11px 0 .020em,3px 11px 0 .020em,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em #fff,7px 11px 0 .020em #fff,8px 11px 0 .020em #fff,9px 11px 0 .020em #fff,10px 11px 0 .020em #fff,11px 11px 0 .020em #fff,12px 11px 0 .020em #fff,13px 11px 0 .020em,14px 11px 0 .020em,15px 11px 0 .020em,16px 11px 0 .020em,1px 12px 0 .020em,2px 12px 0 .020em,3px 12px 0 .020em,4px 12px 0 .020em,5px 12px 0 .020em #fff,6px 12px 0 .020em #fff,7px 12px 0 .020em #fff,8px 12px 0 .020em #fff,9px 12px 0 .020em #fff,10px 12px 0 .020em #fff,11px 12px 0 .020em #fff,12px 12px 0 .020em,13px 12px 0 .020em,14px 12px 0 .020em,15px 12px 0 .020em,16px 12px 0 .020em,1px 13px 0 .020em,2px 13px 0 .020em,3px 13px 0 .020em #fff,4px 13px 0 .020em #fff,5px 13px 0 .020em #fff,6px 13px 0 .020em #fff,7px 13px 0 .020em #fff,8px 13px 0 .020em #fff,9px 13px 0 .020em #fff,10px 13px 0 .020em,11px 13px 0 .020em,12px 13px 0 .020em,13px 13px 0 .020em,14px 13px 0 .020em,15px 13px 0 .020em,16px 13px 0 .020em,1px 14px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em,4px 14px 0 .020em #fff,5px 14px 0 .020em #fff,6px 14px 0 .020em #fff,7px 14px 0 .020em,8px 14px 0 .020em,9px 14px 0 .020em,10px 14px 0 .020em,11px 14px 0 .020em,12px 14px 0 .020em,13px 14px 0 .020em,14px 14px 0 .020em,15px 14px 0 .020em,16px 14px 0 .020em,1px 15px 0 .020em,2px 15px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em,5px 15px 0 .020em,6px 15px 0 .020em,7px 15px 0 .020em,8px 15px 0 .020em,9px 15px 0 .020em,10px 15px 0 .020em,11px 15px 0 .020em,12px 15px 0 .020em,13px 15px 0 .020em,14px 15px 0 .020em,15px 15px 0 .020em,16px 15px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,4px 16px 0 .020em,5px 16px 0 .020em,6px 16px 0 .020em,7px 16px 0 .020em,8px 16px 0 .020em,9px 16px 0 .020em,10px 16px 0 .020em,11px 16px 0 .020em,12px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.facebook::before{width:1px;height:1px;color:#4566ae;box-shadow:2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px #fff,12px 2px #fff,13px 2px #fff,14px 2px #fff,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px #fff,11px 3px #fff,12px 3px #fff,13px 3px #fff,14px 3px #fff,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px,4px 4px,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px #fff,10px 4px #fff,11px 4px #fff,12px 4px #fff,13px 4px #fff,14px 4px #fff,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px,4px 5px,5px 5px,6px 5px,7px 5px,8px 5px,9px 5px #fff,10px 5px #fff,11px 5px #fff,12px 5px,13px 5px,14px 5px,15px 5px,16px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px,8px 6px,9px 6px #fff,10px 6px #fff,11px 6px #fff,12px 6px,13px 6px,14px 6px,15px 6px,16px 6px,1px 7px,2px 7px,3px 7px,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px,9px 7px #fff,10px 7px #fff,11px 7px #fff,12px 7px,13px 7px,14px 7px,15px 7px,16px 7px,1px 8px,2px 8px,3px 8px,4px 8px,5px 8px,6px 8px #fff,7px 8px #fff,8px 8px #fff,9px 8px #fff,10px 8px #fff,11px 8px #fff,12px 8px #fff,13px 8px #fff,14px 8px #fff,15px 8px,16px 8px,1px 9px,2px 9px,3px 9px,4px 9px,5px 9px,6px 9px #fff,7px 9px #fff,8px 9px #fff,9px 9px #fff,10px 9px #fff,11px 9px #fff,12px 9px #fff,13px 9px #fff,14px 9px #fff,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px,4px 10px,5px 10px,6px 10px #fff,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px #fff,12px 10px #fff,13px 10px #fff,14px 10px #fff,15px 10px,16px 10px,1px 11px,2px 11px,3px 11px,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px #fff,10px 11px #fff,11px 11px #fff,12px 11px,13px 11px,14px 11px,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px,4px 12px,5px 12px,6px 12px,7px 12px,8px 12px,9px 12px #fff,10px 12px #fff,11px 12px #fff,12px 12px,13px 12px,14px 12px,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px,4px 13px,5px 13px,6px 13px,7px 13px,8px 13px,9px 13px #fff,10px 13px #fff,11px 13px #fff,12px 13px,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,5px 14px,6px 14px,7px 14px,8px 14px,9px 14px #fff,10px 14px #fff,11px 14px #fff,12px 14px,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px #fff,10px 15px #fff,11px 15px #fff,12px 15px,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px #fff,10px 16px #fff,11px 16px #fff,12px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.facebook::before{box-shadow:2px 1px 0 .020em,3px 1px 0 .020em,4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,15px 1px 0 .020em,1px 2px 0 .020em,2px 2px 0 .020em,3px 2px 0 .020em,4px 2px 0 .020em,5px 2px 0 .020em,6px 2px 0 .020em,7px 2px 0 .020em,8px 2px 0 .020em,9px 2px 0 .020em,10px 2px 0 .020em,11px 2px 0 .020em #fff,12px 2px 0 .020em #fff,13px 2px 0 .020em #fff,14px 2px 0 .020em #fff,15px 2px 0 .020em,16px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em,3px 3px 0 .020em,4px 3px 0 .020em,5px 3px 0 .020em,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em #fff,11px 3px 0 .020em #fff,12px 3px 0 .020em #fff,13px 3px 0 .020em #fff,14px 3px 0 .020em #fff,15px 3px 0 .020em,16px 3px 0 .020em,1px 4px 0 .020em,2px 4px 0 .020em,3px 4px 0 .020em,4px 4px 0 .020em,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em,8px 4px 0 .020em,9px 4px 0 .020em #fff,10px 4px 0 .020em #fff,11px 4px 0 .020em #fff,12px 4px 0 .020em #fff,13px 4px 0 .020em #fff,14px 4px 0 .020em #fff,15px 4px 0 .020em,16px 4px 0 .020em,1px 5px 0 .020em,2px 5px 0 .020em,3px 5px 0 .020em,4px 5px 0 .020em,5px 5px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em,8px 5px 0 .020em,9px 5px 0 .020em #fff,10px 5px 0 .020em #fff,11px 5px 0 .020em #fff,12px 5px 0 .020em,13px 5px 0 .020em,14px 5px 0 .020em,15px 5px 0 .020em,16px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em,8px 6px 0 .020em,9px 6px 0 .020em #fff,10px 6px 0 .020em #fff,11px 6px 0 .020em #fff,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em,16px 6px 0 .020em,1px 7px 0 .020em,2px 7px 0 .020em,3px 7px 0 .020em,4px 7px 0 .020em,5px 7px 0 .020em,6px 7px 0 .020em,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em #fff,10px 7px 0 .020em #fff,11px 7px 0 .020em #fff,12px 7px 0 .020em,13px 7px 0 .020em,14px 7px 0 .020em,15px 7px 0 .020em,16px 7px 0 .020em,1px 8px 0 .020em,2px 8px 0 .020em,3px 8px 0 .020em,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em #fff,7px 8px 0 .020em #fff,8px 8px 0 .020em #fff,9px 8px 0 .020em #fff,10px 8px 0 .020em #fff,11px 8px 0 .020em #fff,12px 8px 0 .020em #fff,13px 8px 0 .020em #fff,14px 8px 0 .020em #fff,15px 8px 0 .020em,16px 8px 0 .020em,1px 9px 0 .020em,2px 9px 0 .020em,3px 9px 0 .020em,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em #fff,7px 9px 0 .020em #fff,8px 9px 0 .020em #fff,9px 9px 0 .020em #fff,10px 9px 0 .020em #fff,11px 9px 0 .020em #fff,12px 9px 0 .020em #fff,13px 9px 0 .020em #fff,14px 9px 0 .020em #fff,15px 9px 0 .020em,16px 9px 0 .020em,1px 10px 0 .020em,2px 10px 0 .020em,3px 10px 0 .020em,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em #fff,7px 10px 0 .020em #fff,8px 10px 0 .020em #fff,9px 10px 0 .020em #fff,10px 10px 0 .020em #fff,11px 10px 0 .020em #fff,12px 10px 0 .020em #fff,13px 10px 0 .020em #fff,14px 10px 0 .020em #fff,15px 10px 0 .020em,16px 10px 0 .020em,1px 11px 0 .020em,2px 11px 0 .020em,3px 11px 0 .020em,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em,8px 11px 0 .020em,9px 11px 0 .020em #fff,10px 11px 0 .020em #fff,11px 11px 0 .020em #fff,12px 11px 0 .020em,13px 11px 0 .020em,14px 11px 0 .020em,15px 11px 0 .020em,16px 11px 0 .020em,1px 12px 0 .020em,2px 12px 0 .020em,3px 12px 0 .020em,4px 12px 0 .020em,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em,8px 12px 0 .020em,9px 12px 0 .020em #fff,10px 12px 0 .020em #fff,11px 12px 0 .020em #fff,12px 12px 0 .020em,13px 12px 0 .020em,14px 12px 0 .020em,15px 12px 0 .020em,16px 12px 0 .020em,1px 13px 0 .020em,2px 13px 0 .020em,3px 13px 0 .020em,4px 13px 0 .020em,5px 13px 0 .020em,6px 13px 0 .020em,7px 13px 0 .020em,8px 13px 0 .020em,9px 13px 0 .020em #fff,10px 13px 0 .020em #fff,11px 13px 0 .020em #fff,12px 13px 0 .020em,13px 13px 0 .020em,14px 13px 0 .020em,15px 13px 0 .020em,16px 13px 0 .020em,1px 14px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em,4px 14px 0 .020em,5px 14px 0 .020em,6px 14px 0 .020em,7px 14px 0 .020em,8px 14px 0 .020em,9px 14px 0 .020em #fff,10px 14px 0 .020em #fff,11px 14px 0 .020em #fff,12px 14px 0 .020em,13px 14px 0 .020em,14px 14px 0 .020em,15px 14px 0 .020em,16px 14px 0 .020em,1px 15px 0 .020em,2px 15px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em,5px 15px 0 .020em,6px 15px 0 .020em,7px 15px 0 .020em,8px 15px 0 .020em,9px 15px 0 .020em #fff,10px 15px 0 .020em #fff,11px 15px 0 .020em #fff,12px 15px 0 .020em,13px 15px 0 .020em,14px 15px 0 .020em,15px 15px 0 .020em,16px 15px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,4px 16px 0 .020em,5px 16px 0 .020em,6px 16px 0 .020em,7px 16px 0 .020em,8px 16px 0 .020em,9px 16px 0 .020em #fff,10px 16px 0 .020em #fff,11px 16px 0 .020em #fff,12px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.github::before{width:1px;height:1px;color:#333;box-shadow:2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px #fff,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px,13px 2px,14px 2px #fff,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px,4px 3px,5px 3px #fff,6px 3px #fff,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px #fff,14px 3px #fff,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px,4px 4px,5px 4px #fff,6px 4px #fff,7px 4px #fff,8px 4px #fff,9px 4px #fff,10px 4px #fff,11px 4px #fff,12px 4px #fff,13px 4px #fff,14px 4px #fff,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px,4px 5px #fff,5px 5px #fff,6px 5px #fff,7px 5px #fff,8px 5px #fff,9px 5px #fff,10px 5px #fff,11px 5px #fff,12px 5px #fff,13px 5px #fff,14px 5px #fff,15px 5px #fff,16px 5px,1px 6px,2px 6px,3px 6px,4px 6px #fff,5px 6px #fff,6px 6px #fff,7px 6px #fff,8px 6px #fff,9px 6px #fff,10px 6px #fff,11px 6px #fff,12px 6px #fff,13px 6px #fff,14px 6px #fff,15px 6px #fff,16px 6px,1px 7px,2px 7px,3px 7px,4px 7px #fff,5px 7px #fff,6px 7px #fff,7px 7px #fff,8px 7px #fff,9px 7px #fff,10px 7px #fff,11px 7px #fff,12px 7px #fff,13px 7px #fff,14px 7px #fff,15px 7px #fff,16px 7px,1px 8px,2px 8px,3px 8px,4px 8px #fff,5px 8px #fff,6px 8px #fff,7px 8px #fff,8px 8px #fff,9px 8px #fff,10px 8px #fff,11px 8px #fff,12px 8px #fff,13px 8px #fff,14px 8px #fff,15px 8px #fff,16px 8px,1px 9px,2px 9px,3px 9px,4px 9px,5px 9px #fff,6px 9px #fff,7px 9px #fff,8px 9px #fff,9px 9px #fff,10px 9px #fff,11px 9px #fff,12px 9px #fff,13px 9px #fff,14px 9px #fff,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px,4px 10px,5px 10px,6px 10px #fff,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px #fff,12px 10px #fff,13px 10px #fff,14px 10px,15px 10px,16px 10px,1px 11px,2px 11px #fff,3px 11px #fff,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px #fff,9px 11px #fff,10px 11px #fff,11px 11px #fff,12px 11px,13px 11px,14px 11px,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px,4px 12px #fff,5px 12px,6px 12px,7px 12px #fff,8px 12px #fff,9px 12px #fff,10px 12px #fff,11px 12px #fff,12px 12px #fff,13px 12px,14px 12px,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px,4px 13px,5px 13px #fff,6px 13px #fff,7px 13px #fff,8px 13px #fff,9px 13px #fff,10px 13px #fff,11px 13px #fff,12px 13px #fff,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,5px 14px,6px 14px,7px 14px #fff,8px 14px #fff,9px 14px #fff,10px 14px #fff,11px 14px #fff,12px 14px #fff,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px #fff,8px 15px #fff,9px 15px #fff,10px 15px #fff,11px 15px #fff,12px 15px #fff,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.github::before{box-shadow:2px 1px 0 .020em,3px 1px 0 .020em,4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,15px 1px 0 .020em,1px 2px 0 .020em,2px 2px 0 .020em,3px 2px 0 .020em,4px 2px 0 .020em,5px 2px 0 .020em #fff,6px 2px 0 .020em,7px 2px 0 .020em,8px 2px 0 .020em,9px 2px 0 .020em,10px 2px 0 .020em,11px 2px 0 .020em,12px 2px 0 .020em,13px 2px 0 .020em,14px 2px 0 .020em #fff,15px 2px 0 .020em,16px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em,3px 3px 0 .020em,4px 3px 0 .020em,5px 3px 0 .020em #fff,6px 3px 0 .020em #fff,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em,13px 3px 0 .020em #fff,14px 3px 0 .020em #fff,15px 3px 0 .020em,16px 3px 0 .020em,1px 4px 0 .020em,2px 4px 0 .020em,3px 4px 0 .020em,4px 4px 0 .020em,5px 4px 0 .020em #fff,6px 4px 0 .020em #fff,7px 4px 0 .020em #fff,8px 4px 0 .020em #fff,9px 4px 0 .020em #fff,10px 4px 0 .020em #fff,11px 4px 0 .020em #fff,12px 4px 0 .020em #fff,13px 4px 0 .020em #fff,14px 4px 0 .020em #fff,15px 4px 0 .020em,16px 4px 0 .020em,1px 5px 0 .020em,2px 5px 0 .020em,3px 5px 0 .020em,4px 5px 0 .020em #fff,5px 5px 0 .020em #fff,6px 5px 0 .020em #fff,7px 5px 0 .020em #fff,8px 5px 0 .020em #fff,9px 5px 0 .020em #fff,10px 5px 0 .020em #fff,11px 5px 0 .020em #fff,12px 5px 0 .020em #fff,13px 5px 0 .020em #fff,14px 5px 0 .020em #fff,15px 5px 0 .020em #fff,16px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em,4px 6px 0 .020em #fff,5px 6px 0 .020em #fff,6px 6px 0 .020em #fff,7px 6px 0 .020em #fff,8px 6px 0 .020em #fff,9px 6px 0 .020em #fff,10px 6px 0 .020em #fff,11px 6px 0 .020em #fff,12px 6px 0 .020em #fff,13px 6px 0 .020em #fff,14px 6px 0 .020em #fff,15px 6px 0 .020em #fff,16px 6px 0 .020em,1px 7px 0 .020em,2px 7px 0 .020em,3px 7px 0 .020em,4px 7px 0 .020em #fff,5px 7px 0 .020em #fff,6px 7px 0 .020em #fff,7px 7px 0 .020em #fff,8px 7px 0 .020em #fff,9px 7px 0 .020em #fff,10px 7px 0 .020em #fff,11px 7px 0 .020em #fff,12px 7px 0 .020em #fff,13px 7px 0 .020em #fff,14px 7px 0 .020em #fff,15px 7px 0 .020em #fff,16px 7px 0 .020em,1px 8px 0 .020em,2px 8px 0 .020em,3px 8px 0 .020em,4px 8px 0 .020em #fff,5px 8px 0 .020em #fff,6px 8px 0 .020em #fff,7px 8px 0 .020em #fff,8px 8px 0 .020em #fff,9px 8px 0 .020em #fff,10px 8px 0 .020em #fff,11px 8px 0 .020em #fff,12px 8px 0 .020em #fff,13px 8px 0 .020em #fff,14px 8px 0 .020em #fff,15px 8px 0 .020em #fff,16px 8px 0 .020em,1px 9px 0 .020em,2px 9px 0 .020em,3px 9px 0 .020em,4px 9px 0 .020em,5px 9px 0 .020em #fff,6px 9px 0 .020em #fff,7px 9px 0 .020em #fff,8px 9px 0 .020em #fff,9px 9px 0 .020em #fff,10px 9px 0 .020em #fff,11px 9px 0 .020em #fff,12px 9px 0 .020em #fff,13px 9px 0 .020em #fff,14px 9px 0 .020em #fff,15px 9px 0 .020em,16px 9px 0 .020em,1px 10px 0 .020em,2px 10px 0 .020em,3px 10px 0 .020em,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em #fff,7px 10px 0 .020em #fff,8px 10px 0 .020em #fff,9px 10px 0 .020em #fff,10px 10px 0 .020em #fff,11px 10px 0 .020em #fff,12px 10px 0 .020em #fff,13px 10px 0 .020em #fff,14px 10px 0 .020em,15px 10px 0 .020em,16px 10px 0 .020em,1px 11px 0 .020em,2px 11px 0 .020em #fff,3px 11px 0 .020em #fff,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em,8px 11px 0 .020em #fff,9px 11px 0 .020em #fff,10px 11px 0 .020em #fff,11px 11px 0 .020em #fff,12px 11px 0 .020em,13px 11px 0 .020em,14px 11px 0 .020em,15px 11px 0 .020em,16px 11px 0 .020em,1px 12px 0 .020em,2px 12px 0 .020em,3px 12px 0 .020em,4px 12px 0 .020em #fff,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em #fff,8px 12px 0 .020em #fff,9px 12px 0 .020em #fff,10px 12px 0 .020em #fff,11px 12px 0 .020em #fff,12px 12px 0 .020em #fff,13px 12px 0 .020em,14px 12px 0 .020em,15px 12px 0 .020em,16px 12px 0 .020em,1px 13px 0 .020em,2px 13px 0 .020em,3px 13px 0 .020em,4px 13px 0 .020em,5px 13px 0 .020em #fff,6px 13px 0 .020em #fff,7px 13px 0 .020em #fff,8px 13px 0 .020em #fff,9px 13px 0 .020em #fff,10px 13px 0 .020em #fff,11px 13px 0 .020em #fff,12px 13px 0 .020em #fff,13px 13px 0 .020em,14px 13px 0 .020em,15px 13px 0 .020em,16px 13px 0 .020em,1px 14px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em,4px 14px 0 .020em,5px 14px 0 .020em,6px 14px 0 .020em,7px 14px 0 .020em #fff,8px 14px 0 .020em #fff,9px 14px 0 .020em #fff,10px 14px 0 .020em #fff,11px 14px 0 .020em #fff,12px 14px 0 .020em #fff,13px 14px 0 .020em,14px 14px 0 .020em,15px 14px 0 .020em,16px 14px 0 .020em,1px 15px 0 .020em,2px 15px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em,5px 15px 0 .020em,6px 15px 0 .020em,7px 15px 0 .020em #fff,8px 15px 0 .020em #fff,9px 15px 0 .020em #fff,10px 15px 0 .020em #fff,11px 15px 0 .020em #fff,12px 15px 0 .020em #fff,13px 15px 0 .020em,14px 15px 0 .020em,15px 15px 0 .020em,16px 15px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,4px 16px 0 .020em,5px 16px 0 .020em,6px 16px 0 .020em,7px 16px 0 .020em,8px 16px 0 .020em,9px 16px 0 .020em,10px 16px 0 .020em,11px 16px 0 .020em,12px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.youtube::before{width:1px;height:1px;color:red;box-shadow:2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px,13px 2px,14px 2px,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px,14px 3px,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px,4px 4px,5px 4px,6px 4px,7px 4px #fff,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px,4px 5px,5px 5px,6px 5px,7px 5px #fff,8px 5px #fff,9px 5px,10px 5px,11px 5px,12px 5px,13px 5px,14px 5px,15px 5px,16px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px #fff,8px 6px #fff,9px 6px #fff,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,16px 6px,1px 7px,2px 7px,3px 7px,4px 7px,5px 7px,6px 7px,7px 7px #fff,8px 7px #fff,9px 7px #fff,10px 7px #fff,11px 7px,12px 7px,13px 7px,14px 7px,15px 7px,16px 7px,1px 8px,2px 8px,3px 8px,4px 8px,5px 8px,6px 8px,7px 8px #fff,8px 8px #fff,9px 8px #fff,10px 8px #fff,11px 8px #fff,12px 8px,13px 8px,14px 8px,15px 8px,16px 8px,1px 9px,2px 9px,3px 9px,4px 9px,5px 9px,6px 9px,7px 9px #fff,8px 9px #fff,9px 9px #fff,10px 9px #fff,11px 9px,12px 9px,13px 9px,14px 9px,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px,4px 10px,5px 10px,6px 10px,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px,11px 10px,12px 10px,13px 10px,14px 10px,15px 10px,16px 10px,1px 11px,2px 11px,3px 11px,4px 11px,5px 11px,6px 11px,7px 11px #fff,8px 11px #fff,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px,14px 11px,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px,4px 12px,5px 12px,6px 12px,7px 12px #fff,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px,13px 12px,14px 12px,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px,4px 13px,5px 13px,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,5px 14px,6px 14px,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.youtube::before{box-shadow:2px 1px 0 .020em,3px 1px 0 .020em,4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,15px 1px 0 .020em,1px 2px 0 .020em,2px 2px 0 .020em,3px 2px 0 .020em,4px 2px 0 .020em,5px 2px 0 .020em,6px 2px 0 .020em,7px 2px 0 .020em,8px 2px 0 .020em,9px 2px 0 .020em,10px 2px 0 .020em,11px 2px 0 .020em,12px 2px 0 .020em,13px 2px 0 .020em,14px 2px 0 .020em,15px 2px 0 .020em,16px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em,3px 3px 0 .020em,4px 3px 0 .020em,5px 3px 0 .020em,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em,13px 3px 0 .020em,14px 3px 0 .020em,15px 3px 0 .020em,16px 3px 0 .020em,1px 4px 0 .020em,2px 4px 0 .020em,3px 4px 0 .020em,4px 4px 0 .020em,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em #fff,8px 4px 0 .020em,9px 4px 0 .020em,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em,13px 4px 0 .020em,14px 4px 0 .020em,15px 4px 0 .020em,16px 4px 0 .020em,1px 5px 0 .020em,2px 5px 0 .020em,3px 5px 0 .020em,4px 5px 0 .020em,5px 5px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em #fff,8px 5px 0 .020em #fff,9px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em,12px 5px 0 .020em,13px 5px 0 .020em,14px 5px 0 .020em,15px 5px 0 .020em,16px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em #fff,8px 6px 0 .020em #fff,9px 6px 0 .020em #fff,10px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em,16px 6px 0 .020em,1px 7px 0 .020em,2px 7px 0 .020em,3px 7px 0 .020em,4px 7px 0 .020em,5px 7px 0 .020em,6px 7px 0 .020em,7px 7px 0 .020em #fff,8px 7px 0 .020em #fff,9px 7px 0 .020em #fff,10px 7px 0 .020em #fff,11px 7px 0 .020em,12px 7px 0 .020em,13px 7px 0 .020em,14px 7px 0 .020em,15px 7px 0 .020em,16px 7px 0 .020em,1px 8px 0 .020em,2px 8px 0 .020em,3px 8px 0 .020em,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em,7px 8px 0 .020em #fff,8px 8px 0 .020em #fff,9px 8px 0 .020em #fff,10px 8px 0 .020em #fff,11px 8px 0 .020em #fff,12px 8px 0 .020em,13px 8px 0 .020em,14px 8px 0 .020em,15px 8px 0 .020em,16px 8px 0 .020em,1px 9px 0 .020em,2px 9px 0 .020em,3px 9px 0 .020em,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em,7px 9px 0 .020em #fff,8px 9px 0 .020em #fff,9px 9px 0 .020em #fff,10px 9px 0 .020em #fff,11px 9px 0 .020em,12px 9px 0 .020em,13px 9px 0 .020em,14px 9px 0 .020em,15px 9px 0 .020em,16px 9px 0 .020em,1px 10px 0 .020em,2px 10px 0 .020em,3px 10px 0 .020em,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em,7px 10px 0 .020em #fff,8px 10px 0 .020em #fff,9px 10px 0 .020em #fff,10px 10px 0 .020em,11px 10px 0 .020em,12px 10px 0 .020em,13px 10px 0 .020em,14px 10px 0 .020em,15px 10px 0 .020em,16px 10px 0 .020em,1px 11px 0 .020em,2px 11px 0 .020em,3px 11px 0 .020em,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em #fff,8px 11px 0 .020em #fff,9px 11px 0 .020em,10px 11px 0 .020em,11px 11px 0 .020em,12px 11px 0 .020em,13px 11px 0 .020em,14px 11px 0 .020em,15px 11px 0 .020em,16px 11px 0 .020em,1px 12px 0 .020em,2px 12px 0 .020em,3px 12px 0 .020em,4px 12px 0 .020em,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em #fff,8px 12px 0 .020em,9px 12px 0 .020em,10px 12px 0 .020em,11px 12px 0 .020em,12px 12px 0 .020em,13px 12px 0 .020em,14px 12px 0 .020em,15px 12px 0 .020em,16px 12px 0 .020em,1px 13px 0 .020em,2px 13px 0 .020em,3px 13px 0 .020em,4px 13px 0 .020em,5px 13px 0 .020em,6px 13px 0 .020em,7px 13px 0 .020em,8px 13px 0 .020em,9px 13px 0 .020em,10px 13px 0 .020em,11px 13px 0 .020em,12px 13px 0 .020em,13px 13px 0 .020em,14px 13px 0 .020em,15px 13px 0 .020em,16px 13px 0 .020em,1px 14px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em,4px 14px 0 .020em,5px 14px 0 .020em,6px 14px 0 .020em,7px 14px 0 .020em,8px 14px 0 .020em,9px 14px 0 .020em,10px 14px 0 .020em,11px 14px 0 .020em,12px 14px 0 .020em,13px 14px 0 .020em,14px 14px 0 .020em,15px 14px 0 .020em,16px 14px 0 .020em,1px 15px 0 .020em,2px 15px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em,5px 15px 0 .020em,6px 15px 0 .020em,7px 15px 0 .020em,8px 15px 0 .020em,9px 15px 0 .020em,10px 15px 0 .020em,11px 15px 0 .020em,12px 15px 0 .020em,13px 15px 0 .020em,14px 15px 0 .020em,15px 15px 0 .020em,16px 15px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,4px 16px 0 .020em,5px 16px 0 .020em,6px 16px 0 .020em,7px 16px 0 .020em,8px 16px 0 .020em,9px 16px 0 .020em,10px 16px 0 .020em,11px 16px 0 .020em,12px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.close::before{width:1px;height:1px;color:#212529;box-shadow:1px 1px,2px 1px,3px 1px,4px 1px,13px 1px,14px 1px,15px 1px,16px 1px,1px 2px,2px 2px,3px 2px,4px 2px,13px 2px,14px 2px,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px,4px 3px,13px 3px,14px 3px,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px,4px 4px,5px 4px,6px 4px,7px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px,15px 4px,16px 4px,4px 5px,5px 5px,6px 5px,7px 5px,10px 5px,11px 5px,12px 5px,13px 5px,4px 6px,5px 6px,6px 6px,7px 6px,10px 6px,11px 6px,12px 6px,13px 6px,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,7px 8px,8px 8px,9px 8px,10px 8px,7px 9px,8px 9px,9px 9px,10px 9px,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px,12px 10px,13px 10px,4px 11px,5px 11px,6px 11px,7px 11px,10px 11px,11px 11px,12px 11px,13px 11px,4px 12px,5px 12px,6px 12px,7px 12px,10px 12px,11px 12px,12px 12px,13px 12px,1px 13px,2px 13px,3px 13px,4px 13px,5px 13px,6px 13px,7px 13px,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,13px 15px,14px 15px,15px 15px,16px 15px,1px 16px,2px 16px,3px 16px,4px 16px,13px 16px,14px 16px,15px 16px,16px 16px}@supports (-moz-appearance:meterbar){.nes-icon.close::before{box-shadow:1px 1px 0 .020em,2px 1px 0 .020em,3px 1px 0 .020em,4px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,15px 1px 0 .020em,16px 1px 0 .020em,1px 2px 0 .020em,2px 2px 0 .020em,3px 2px 0 .020em,4px 2px 0 .020em,13px 2px 0 .020em,14px 2px 0 .020em,15px 2px 0 .020em,16px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em,3px 3px 0 .020em,4px 3px 0 .020em,13px 3px 0 .020em,14px 3px 0 .020em,15px 3px 0 .020em,16px 3px 0 .020em,1px 4px 0 .020em,2px 4px 0 .020em,3px 4px 0 .020em,4px 4px 0 .020em,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em,13px 4px 0 .020em,14px 4px 0 .020em,15px 4px 0 .020em,16px 4px 0 .020em,4px 5px 0 .020em,5px 5px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em,12px 5px 0 .020em,13px 5px 0 .020em,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,4px 7px 0 .020em,5px 7px 0 .020em,6px 7px 0 .020em,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em,11px 7px 0 .020em,12px 7px 0 .020em,13px 7px 0 .020em,7px 8px 0 .020em,8px 8px 0 .020em,9px 8px 0 .020em,10px 8px 0 .020em,7px 9px 0 .020em,8px 9px 0 .020em,9px 9px 0 .020em,10px 9px 0 .020em,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em,7px 10px 0 .020em,8px 10px 0 .020em,9px 10px 0 .020em,10px 10px 0 .020em,11px 10px 0 .020em,12px 10px 0 .020em,13px 10px 0 .020em,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em,10px 11px 0 .020em,11px 11px 0 .020em,12px 11px 0 .020em,13px 11px 0 .020em,4px 12px 0 .020em,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em,10px 12px 0 .020em,11px 12px 0 .020em,12px 12px 0 .020em,13px 12px 0 .020em,1px 13px 0 .020em,2px 13px 0 .020em,3px 13px 0 .020em,4px 13px 0 .020em,5px 13px 0 .020em,6px 13px 0 .020em,7px 13px 0 .020em,10px 13px 0 .020em,11px 13px 0 .020em,12px 13px 0 .020em,13px 13px 0 .020em,14px 13px 0 .020em,15px 13px 0 .020em,16px 13px 0 .020em,1px 14px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em,4px 14px 0 .020em,13px 14px 0 .020em,14px 14px 0 .020em,15px 14px 0 .020em,16px 14px 0 .020em,1px 15px 0 .020em,2px 15px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em,13px 15px 0 .020em,14px 15px 0 .020em,15px 15px 0 .020em,16px 15px 0 .020em,1px 16px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,4px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em,16px 16px 0 .020em}}.nes-icon.google::before{width:1px;height:1px;color:#fff;box-shadow:2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px #db4437,7px 2px #db4437,8px 2px #db4437,9px 2px #db4437,10px 2px #db4437,11px 2px #db4437,12px 2px,13px 2px,14px 2px,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px,4px 3px #db4437,5px 3px #db4437,6px 3px #db4437,7px 3px #db4437,8px 3px #db4437,9px 3px #db4437,10px 3px #db4437,11px 3px #db4437,12px 3px #db4437,13px 3px #db4437,14px 3px,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px #db4437,4px 4px #db4437,5px 4px #db4437,6px 4px #db4437,7px 4px #db4437,8px 4px #db4437,9px 4px #db4437,10px 4px #db4437,11px 4px #db4437,12px 4px #db4437,13px 4px,14px 4px,15px 4px,16px 4px,1px 5px,2px 5px #db4437,3px 5px #db4437,4px 5px #db4437,5px 5px #db4437,6px 5px,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px #db4437,12px 5px,13px 5px,14px 5px,15px 5px,16px 5px,1px 6px #f4b400,2px 6px #db4437,3px 6px #db4437,4px 6px #db4437,5px 6px,6px 6px,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,16px 6px,1px 7px #f4b400,2px 7px #f4b400,3px 7px #db4437,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,14px 7px,15px 7px,16px 7px,1px 8px #f4b400,2px 8px #f4b400,3px 8px #f4b400,4px 8px,5px 8px,6px 8px,7px 8px,8px 8px,9px 8px #4285f4,10px 8px #4285f4,11px 8px #4285f4,12px 8px #4285f4,13px 8px #4285f4,14px 8px #4285f4,15px 8px #4285f4,16px 8px,1px 9px #f4b400,2px 9px #f4b400,3px 9px #f4b400,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px,9px 9px #4285f4,10px 9px #4285f4,11px 9px #4285f4,12px 9px #4285f4,13px 9px #4285f4,14px 9px #4285f4,15px 9px #4285f4,16px 9px,1px 10px #f4b400,2px 10px #f4b400,3px 10px #f4b400,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px #4285f4,10px 10px #4285f4,11px 10px #4285f4,12px 10px #4285f4,13px 10px #4285f4,14px 10px #4285f4,15px 10px #4285f4,16px 10px,1px 11px #f4b400,2px 11px #f4b400,3px 11px #0f9d58,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px #4285f4,14px 11px #4285f4,15px 11px #4285f4,16px 11px,1px 12px #f4b400,2px 12px #0f9d58,3px 12px #0f9d58,4px 12px #0f9d58,5px 12px,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px #4285f4,13px 12px #4285f4,14px 12px #4285f4,15px 12px #4285f4,16px 12px,1px 13px,2px 13px #0f9d58,3px 13px #0f9d58,4px 13px #0f9d58,5px 13px #0f9d58,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px #0f9d58,12px 13px #4285f4,13px 13px #4285f4,14px 13px #4285f4,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px #0f9d58,4px 14px #0f9d58,5px 14px #0f9d58,6px 14px #0f9d58,7px 14px #0f9d58,8px 14px #0f9d58,9px 14px #0f9d58,10px 14px #0f9d58,11px 14px #0f9d58,12px 14px #0f9d58,13px 14px #4285f4,14px 14px #4285f4,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px #0f9d58,5px 15px #0f9d58,6px 15px #0f9d58,7px 15px #0f9d58,8px 15px #0f9d58,9px 15px #0f9d58,10px 15px #0f9d58,11px 15px #0f9d58,12px 15px #0f9d58,13px 15px #0f9d58,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px #0f9d58,7px 16px #0f9d58,8px 16px #0f9d58,9px 16px #0f9d58,10px 16px #0f9d58,11px 16px #0f9d58,12px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.google::before{box-shadow:2px 1px 0 .020em,3px 1px 0 .020em,4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,15px 1px 0 .020em,1px 2px 0 .020em,2px 2px 0 .020em,3px 2px 0 .020em,4px 2px 0 .020em,5px 2px 0 .020em,6px 2px 0 .020em #db4437,7px 2px 0 .020em #db4437,8px 2px 0 .020em #db4437,9px 2px 0 .020em #db4437,10px 2px 0 .020em #db4437,11px 2px 0 .020em #db4437,12px 2px 0 .020em,13px 2px 0 .020em,14px 2px 0 .020em,15px 2px 0 .020em,16px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em,3px 3px 0 .020em,4px 3px 0 .020em #db4437,5px 3px 0 .020em #db4437,6px 3px 0 .020em #db4437,7px 3px 0 .020em #db4437,8px 3px 0 .020em #db4437,9px 3px 0 .020em #db4437,10px 3px 0 .020em #db4437,11px 3px 0 .020em #db4437,12px 3px 0 .020em #db4437,13px 3px 0 .020em #db4437,14px 3px 0 .020em,15px 3px 0 .020em,16px 3px 0 .020em,1px 4px 0 .020em,2px 4px 0 .020em,3px 4px 0 .020em #db4437,4px 4px 0 .020em #db4437,5px 4px 0 .020em #db4437,6px 4px 0 .020em #db4437,7px 4px 0 .020em #db4437,8px 4px 0 .020em #db4437,9px 4px 0 .020em #db4437,10px 4px 0 .020em #db4437,11px 4px 0 .020em #db4437,12px 4px 0 .020em #db4437,13px 4px 0 .020em,14px 4px 0 .020em,15px 4px 0 .020em,16px 4px 0 .020em,1px 5px 0 .020em,2px 5px 0 .020em #db4437,3px 5px 0 .020em #db4437,4px 5px 0 .020em #db4437,5px 5px 0 .020em #db4437,6px 5px 0 .020em,7px 5px 0 .020em,8px 5px 0 .020em,9px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em #db4437,12px 5px 0 .020em,13px 5px 0 .020em,14px 5px 0 .020em,15px 5px 0 .020em,16px 5px 0 .020em,1px 6px 0 .020em #f4b400,2px 6px 0 .020em #db4437,3px 6px 0 .020em #db4437,4px 6px 0 .020em #db4437,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em,8px 6px 0 .020em,9px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em,16px 6px 0 .020em,1px 7px 0 .020em #f4b400,2px 7px 0 .020em #f4b400,3px 7px 0 .020em #db4437,4px 7px 0 .020em,5px 7px 0 .020em,6px 7px 0 .020em,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em,11px 7px 0 .020em,12px 7px 0 .020em,13px 7px 0 .020em,14px 7px 0 .020em,15px 7px 0 .020em,16px 7px 0 .020em,1px 8px 0 .020em #f4b400,2px 8px 0 .020em #f4b400,3px 8px 0 .020em #f4b400,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em,7px 8px 0 .020em,8px 8px 0 .020em,9px 8px 0 .020em #4285f4,10px 8px 0 .020em #4285f4,11px 8px 0 .020em #4285f4,12px 8px 0 .020em #4285f4,13px 8px 0 .020em #4285f4,14px 8px 0 .020em #4285f4,15px 8px 0 .020em #4285f4,16px 8px 0 .020em,1px 9px 0 .020em #f4b400,2px 9px 0 .020em #f4b400,3px 9px 0 .020em #f4b400,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em,7px 9px 0 .020em,8px 9px 0 .020em,9px 9px 0 .020em #4285f4,10px 9px 0 .020em #4285f4,11px 9px 0 .020em #4285f4,12px 9px 0 .020em #4285f4,13px 9px 0 .020em #4285f4,14px 9px 0 .020em #4285f4,15px 9px 0 .020em #4285f4,16px 9px 0 .020em,1px 10px 0 .020em #f4b400,2px 10px 0 .020em #f4b400,3px 10px 0 .020em #f4b400,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em,7px 10px 0 .020em,8px 10px 0 .020em,9px 10px 0 .020em #4285f4,10px 10px 0 .020em #4285f4,11px 10px 0 .020em #4285f4,12px 10px 0 .020em #4285f4,13px 10px 0 .020em #4285f4,14px 10px 0 .020em #4285f4,15px 10px 0 .020em #4285f4,16px 10px 0 .020em,1px 11px 0 .020em #f4b400,2px 11px 0 .020em #f4b400,3px 11px 0 .020em #0f9d58,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em,8px 11px 0 .020em,9px 11px 0 .020em,10px 11px 0 .020em,11px 11px 0 .020em,12px 11px 0 .020em,13px 11px 0 .020em #4285f4,14px 11px 0 .020em #4285f4,15px 11px 0 .020em #4285f4,16px 11px 0 .020em,1px 12px 0 .020em #f4b400,2px 12px 0 .020em #0f9d58,3px 12px 0 .020em #0f9d58,4px 12px 0 .020em #0f9d58,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em,8px 12px 0 .020em,9px 12px 0 .020em,10px 12px 0 .020em,11px 12px 0 .020em,12px 12px 0 .020em #4285f4,13px 12px 0 .020em #4285f4,14px 12px 0 .020em #4285f4,15px 12px 0 .020em #4285f4,16px 12px 0 .020em,1px 13px 0 .020em,2px 13px 0 .020em #0f9d58,3px 13px 0 .020em #0f9d58,4px 13px 0 .020em #0f9d58,5px 13px 0 .020em #0f9d58,6px 13px 0 .020em,7px 13px 0 .020em,8px 13px 0 .020em,9px 13px 0 .020em,10px 13px 0 .020em,11px 13px 0 .020em #0f9d58,12px 13px 0 .020em #4285f4,13px 13px 0 .020em #4285f4,14px 13px 0 .020em #4285f4,15px 13px 0 .020em,16px 13px 0 .020em,1px 14px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em #0f9d58,4px 14px 0 .020em #0f9d58,5px 14px 0 .020em #0f9d58,6px 14px 0 .020em #0f9d58,7px 14px 0 .020em #0f9d58,8px 14px 0 .020em #0f9d58,9px 14px 0 .020em #0f9d58,10px 14px 0 .020em #0f9d58,11px 14px 0 .020em #0f9d58,12px 14px 0 .020em #0f9d58,13px 14px 0 .020em #4285f4,14px 14px 0 .020em #4285f4,15px 14px 0 .020em,16px 14px 0 .020em,1px 15px 0 .020em,2px 15px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em #0f9d58,5px 15px 0 .020em #0f9d58,6px 15px 0 .020em #0f9d58,7px 15px 0 .020em #0f9d58,8px 15px 0 .020em #0f9d58,9px 15px 0 .020em #0f9d58,10px 15px 0 .020em #0f9d58,11px 15px 0 .020em #0f9d58,12px 15px 0 .020em #0f9d58,13px 15px 0 .020em #0f9d58,14px 15px 0 .020em,15px 15px 0 .020em,16px 15px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,4px 16px 0 .020em,5px 16px 0 .020em,6px 16px 0 .020em #0f9d58,7px 16px 0 .020em #0f9d58,8px 16px 0 .020em #0f9d58,9px 16px 0 .020em #0f9d58,10px 16px 0 .020em #0f9d58,11px 16px 0 .020em #0f9d58,12px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.medium::before{width:1px;height:1px;color:#12100e;box-shadow:2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px #fff,3px 2px #fff,4px 2px #fff,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px #fff,13px 2px #fff,14px 2px #fff,15px 2px #fff,16px 2px,1px 3px,2px 3px,3px 3px #fff,4px 3px #fff,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px #fff,13px 3px #fff,14px 3px #fff,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px #fff,4px 4px #fff,5px 4px #fff,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px #fff,13px 4px #fff,14px 4px #fff,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px #fff,4px 5px #fff,5px 5px #fff,6px 5px #fff,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px #fff,12px 5px #fff,13px 5px #fff,14px 5px #fff,15px 5px,16px 5px,1px 6px,2px 6px,3px 6px #fff,4px 6px #fff,5px 6px #fff,6px 6px #fff,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px #fff,12px 6px #fff,13px 6px #fff,14px 6px #fff,15px 6px,16px 6px,1px 7px,2px 7px,3px 7px #fff,4px 7px #fff,5px 7px #fff,6px 7px #fff,7px 7px,8px 7px,9px 7px,10px 7px #fff,11px 7px #fff,12px 7px #fff,13px 7px #fff,14px 7px #fff,15px 7px,16px 7px,1px 8px,2px 8px,3px 8px #fff,4px 8px,5px 8px #fff,6px 8px #fff,7px 8px #fff,8px 8px,9px 8px,10px 8px #fff,11px 8px #fff,12px 8px #fff,13px 8px #fff,14px 8px #fff,15px 8px,16px 8px,1px 9px,2px 9px,3px 9px #fff,4px 9px,5px 9px #fff,6px 9px #fff,7px 9px #fff,8px 9px,9px 9px #fff,10px 9px #fff,11px 9px,12px 9px #fff,13px 9px #fff,14px 9px #fff,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px #fff,4px 10px,5px 10px,6px 10px #fff,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px,12px 10px #fff,13px 10px #fff,14px 10px #fff,15px 10px,16px 10px,1px 11px,2px 11px,3px 11px #fff,4px 11px,5px 11px,6px 11px #fff,7px 11px #fff,8px 11px #fff,9px 11px #fff,10px 11px,11px 11px,12px 11px #fff,13px 11px #fff,14px 11px #fff,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px #fff,4px 12px,5px 12px,6px 12px,7px 12px #fff,8px 12px #fff,9px 12px #fff,10px 12px,11px 12px,12px 12px #fff,13px 12px #fff,14px 12px #fff,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px #fff,4px 13px,5px 13px,6px 13px,7px 13px #fff,8px 13px #fff,9px 13px,10px 13px,11px 13px,12px 13px #fff,13px 13px #fff,14px 13px #fff,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px #fff,4px 14px,5px 14px,6px 14px,7px 14px,8px 14px #fff,9px 14px,10px 14px,11px 14px,12px 14px #fff,13px 14px #fff,14px 14px #fff,15px 14px,16px 14px,1px 15px,2px 15px #fff,3px 15px #fff,4px 15px #fff,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px #fff,12px 15px #fff,13px 15px #fff,14px 15px #fff,15px 15px #fff,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.medium::before{box-shadow:2px 1px 0 .020em,3px 1px 0 .020em,4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,15px 1px 0 .020em,1px 2px 0 .020em,2px 2px 0 .020em #fff,3px 2px 0 .020em #fff,4px 2px 0 .020em #fff,5px 2px 0 .020em,6px 2px 0 .020em,7px 2px 0 .020em,8px 2px 0 .020em,9px 2px 0 .020em,10px 2px 0 .020em,11px 2px 0 .020em,12px 2px 0 .020em #fff,13px 2px 0 .020em #fff,14px 2px 0 .020em #fff,15px 2px 0 .020em #fff,16px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em,3px 3px 0 .020em #fff,4px 3px 0 .020em #fff,5px 3px 0 .020em,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em #fff,13px 3px 0 .020em #fff,14px 3px 0 .020em #fff,15px 3px 0 .020em,16px 3px 0 .020em,1px 4px 0 .020em,2px 4px 0 .020em,3px 4px 0 .020em #fff,4px 4px 0 .020em #fff,5px 4px 0 .020em #fff,6px 4px 0 .020em,7px 4px 0 .020em,8px 4px 0 .020em,9px 4px 0 .020em,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em #fff,13px 4px 0 .020em #fff,14px 4px 0 .020em #fff,15px 4px 0 .020em,16px 4px 0 .020em,1px 5px 0 .020em,2px 5px 0 .020em,3px 5px 0 .020em #fff,4px 5px 0 .020em #fff,5px 5px 0 .020em #fff,6px 5px 0 .020em #fff,7px 5px 0 .020em,8px 5px 0 .020em,9px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em #fff,12px 5px 0 .020em #fff,13px 5px 0 .020em #fff,14px 5px 0 .020em #fff,15px 5px 0 .020em,16px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em #fff,4px 6px 0 .020em #fff,5px 6px 0 .020em #fff,6px 6px 0 .020em #fff,7px 6px 0 .020em,8px 6px 0 .020em,9px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em #fff,12px 6px 0 .020em #fff,13px 6px 0 .020em #fff,14px 6px 0 .020em #fff,15px 6px 0 .020em,16px 6px 0 .020em,1px 7px 0 .020em,2px 7px 0 .020em,3px 7px 0 .020em #fff,4px 7px 0 .020em #fff,5px 7px 0 .020em #fff,6px 7px 0 .020em #fff,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em #fff,11px 7px 0 .020em #fff,12px 7px 0 .020em #fff,13px 7px 0 .020em #fff,14px 7px 0 .020em #fff,15px 7px 0 .020em,16px 7px 0 .020em,1px 8px 0 .020em,2px 8px 0 .020em,3px 8px 0 .020em #fff,4px 8px 0 .020em,5px 8px 0 .020em #fff,6px 8px 0 .020em #fff,7px 8px 0 .020em #fff,8px 8px 0 .020em,9px 8px 0 .020em,10px 8px 0 .020em #fff,11px 8px 0 .020em #fff,12px 8px 0 .020em #fff,13px 8px 0 .020em #fff,14px 8px 0 .020em #fff,15px 8px 0 .020em,16px 8px 0 .020em,1px 9px 0 .020em,2px 9px 0 .020em,3px 9px 0 .020em #fff,4px 9px 0 .020em,5px 9px 0 .020em #fff,6px 9px 0 .020em #fff,7px 9px 0 .020em #fff,8px 9px 0 .020em,9px 9px 0 .020em #fff,10px 9px 0 .020em #fff,11px 9px 0 .020em,12px 9px 0 .020em #fff,13px 9px 0 .020em #fff,14px 9px 0 .020em #fff,15px 9px 0 .020em,16px 9px 0 .020em,1px 10px 0 .020em,2px 10px 0 .020em,3px 10px 0 .020em #fff,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em #fff,7px 10px 0 .020em #fff,8px 10px 0 .020em #fff,9px 10px 0 .020em #fff,10px 10px 0 .020em #fff,11px 10px 0 .020em,12px 10px 0 .020em #fff,13px 10px 0 .020em #fff,14px 10px 0 .020em #fff,15px 10px 0 .020em,16px 10px 0 .020em,1px 11px 0 .020em,2px 11px 0 .020em,3px 11px 0 .020em #fff,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em #fff,7px 11px 0 .020em #fff,8px 11px 0 .020em #fff,9px 11px 0 .020em #fff,10px 11px 0 .020em,11px 11px 0 .020em,12px 11px 0 .020em #fff,13px 11px 0 .020em #fff,14px 11px 0 .020em #fff,15px 11px 0 .020em,16px 11px 0 .020em,1px 12px 0 .020em,2px 12px 0 .020em,3px 12px 0 .020em #fff,4px 12px 0 .020em,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em #fff,8px 12px 0 .020em #fff,9px 12px 0 .020em #fff,10px 12px 0 .020em,11px 12px 0 .020em,12px 12px 0 .020em #fff,13px 12px 0 .020em #fff,14px 12px 0 .020em #fff,15px 12px 0 .020em,16px 12px 0 .020em,1px 13px 0 .020em,2px 13px 0 .020em,3px 13px 0 .020em #fff,4px 13px 0 .020em,5px 13px 0 .020em,6px 13px 0 .020em,7px 13px 0 .020em #fff,8px 13px 0 .020em #fff,9px 13px 0 .020em,10px 13px 0 .020em,11px 13px 0 .020em,12px 13px 0 .020em #fff,13px 13px 0 .020em #fff,14px 13px 0 .020em #fff,15px 13px 0 .020em,16px 13px 0 .020em,1px 14px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em #fff,4px 14px 0 .020em,5px 14px 0 .020em,6px 14px 0 .020em,7px 14px 0 .020em,8px 14px 0 .020em #fff,9px 14px 0 .020em,10px 14px 0 .020em,11px 14px 0 .020em,12px 14px 0 .020em #fff,13px 14px 0 .020em #fff,14px 14px 0 .020em #fff,15px 14px 0 .020em,16px 14px 0 .020em,1px 15px 0 .020em,2px 15px 0 .020em #fff,3px 15px 0 .020em #fff,4px 15px 0 .020em #fff,5px 15px 0 .020em,6px 15px 0 .020em,7px 15px 0 .020em,8px 15px 0 .020em,9px 15px 0 .020em,10px 15px 0 .020em,11px 15px 0 .020em #fff,12px 15px 0 .020em #fff,13px 15px 0 .020em #fff,14px 15px 0 .020em #fff,15px 15px 0 .020em #fff,16px 15px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,4px 16px 0 .020em,5px 16px 0 .020em,6px 16px 0 .020em,7px 16px 0 .020em,8px 16px 0 .020em,9px 16px 0 .020em,10px 16px 0 .020em,11px 16px 0 .020em,12px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.twitch::before{width:1px;height:1px;color:#6441a4;box-shadow:2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px #fff,4px 2px #fff,5px 2px #fff,6px 2px #fff,7px 2px #fff,8px 2px #fff,9px 2px #fff,10px 2px #fff,11px 2px #fff,12px 2px #fff,13px 2px #fff,14px 2px #fff,15px 2px #fff,16px 2px,1px 3px,2px 3px #fff,3px 3px #fff,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px,14px 3px,15px 3px #fff,16px 3px,1px 4px,2px 4px #fff,3px 4px #fff,4px 4px,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px,15px 4px #fff,16px 4px,1px 5px,2px 5px #fff,3px 5px #fff,4px 5px,5px 5px,6px 5px,7px 5px,8px 5px #fff,9px 5px,10px 5px,11px 5px #fff,12px 5px,13px 5px,14px 5px,15px 5px #fff,16px 5px,1px 6px,2px 6px #fff,3px 6px #fff,4px 6px,5px 6px,6px 6px,7px 6px,8px 6px #fff,9px 6px,10px 6px,11px 6px #fff,12px 6px,13px 6px,14px 6px,15px 6px #fff,16px 6px,1px 7px,2px 7px #fff,3px 7px #fff,4px 7px,5px 7px,6px 7px,7px 7px,8px 7px #fff,9px 7px,10px 7px,11px 7px #fff,12px 7px,13px 7px,14px 7px,15px 7px #fff,16px 7px,1px 8px,2px 8px #fff,3px 8px #fff,4px 8px,5px 8px,6px 8px,7px 8px,8px 8px #fff,9px 8px,10px 8px,11px 8px #fff,12px 8px,13px 8px,14px 8px,15px 8px #fff,16px 8px,1px 9px,2px 9px #fff,3px 9px #fff,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px,12px 9px,13px 9px,14px 9px,15px 9px #fff,16px 9px,1px 10px,2px 10px #fff,3px 10px #fff,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px,12px 10px,13px 10px,14px 10px #fff,15px 10px #fff,16px 10px,1px 11px,2px 11px #fff,3px 11px #fff,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px #fff,14px 11px #fff,15px 11px,16px 11px,1px 12px,2px 12px #fff,3px 12px #fff,4px 12px #fff,5px 12px #fff,6px 12px,7px 12px,8px 12px #fff,9px 12px #fff,10px 12px #fff,11px 12px #fff,12px 12px #fff,13px 12px #fff,14px 12px,15px 12px,16px 12px,1px 13px,2px 13px #fff,3px 13px #fff,4px 13px #fff,5px 13px #fff,6px 13px,7px 13px #fff,8px 13px #fff,9px 13px #fff,10px 13px #fff,11px 13px #fff,12px 13px #fff,13px 13px,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,5px 14px #fff,6px 14px #fff,7px 14px #fff,8px 14px #fff,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px #fff,6px 15px #fff,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.twitch::before{box-shadow:2px 1px 0 .020em,3px 1px 0 .020em,4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,15px 1px 0 .020em,1px 2px 0 .020em,2px 2px 0 .020em,3px 2px 0 .020em #fff,4px 2px 0 .020em #fff,5px 2px 0 .020em #fff,6px 2px 0 .020em #fff,7px 2px 0 .020em #fff,8px 2px 0 .020em #fff,9px 2px 0 .020em #fff,10px 2px 0 .020em #fff,11px 2px 0 .020em #fff,12px 2px 0 .020em #fff,13px 2px 0 .020em #fff,14px 2px 0 .020em #fff,15px 2px 0 .020em #fff,16px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em #fff,3px 3px 0 .020em #fff,4px 3px 0 .020em,5px 3px 0 .020em,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em,13px 3px 0 .020em,14px 3px 0 .020em,15px 3px 0 .020em #fff,16px 3px 0 .020em,1px 4px 0 .020em,2px 4px 0 .020em #fff,3px 4px 0 .020em #fff,4px 4px 0 .020em,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em,8px 4px 0 .020em,9px 4px 0 .020em,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em,13px 4px 0 .020em,14px 4px 0 .020em,15px 4px 0 .020em #fff,16px 4px 0 .020em,1px 5px 0 .020em,2px 5px 0 .020em #fff,3px 5px 0 .020em #fff,4px 5px 0 .020em,5px 5px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em,8px 5px 0 .020em #fff,9px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em #fff,12px 5px 0 .020em,13px 5px 0 .020em,14px 5px 0 .020em,15px 5px 0 .020em #fff,16px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em #fff,3px 6px 0 .020em #fff,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em,8px 6px 0 .020em #fff,9px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em #fff,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em #fff,16px 6px 0 .020em,1px 7px 0 .020em,2px 7px 0 .020em #fff,3px 7px 0 .020em #fff,4px 7px 0 .020em,5px 7px 0 .020em,6px 7px 0 .020em,7px 7px 0 .020em,8px 7px 0 .020em #fff,9px 7px 0 .020em,10px 7px 0 .020em,11px 7px 0 .020em #fff,12px 7px 0 .020em,13px 7px 0 .020em,14px 7px 0 .020em,15px 7px 0 .020em #fff,16px 7px 0 .020em,1px 8px 0 .020em,2px 8px 0 .020em #fff,3px 8px 0 .020em #fff,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em,7px 8px 0 .020em,8px 8px 0 .020em #fff,9px 8px 0 .020em,10px 8px 0 .020em,11px 8px 0 .020em #fff,12px 8px 0 .020em,13px 8px 0 .020em,14px 8px 0 .020em,15px 8px 0 .020em #fff,16px 8px 0 .020em,1px 9px 0 .020em,2px 9px 0 .020em #fff,3px 9px 0 .020em #fff,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em,7px 9px 0 .020em,8px 9px 0 .020em,9px 9px 0 .020em,10px 9px 0 .020em,11px 9px 0 .020em,12px 9px 0 .020em,13px 9px 0 .020em,14px 9px 0 .020em,15px 9px 0 .020em #fff,16px 9px 0 .020em,1px 10px 0 .020em,2px 10px 0 .020em #fff,3px 10px 0 .020em #fff,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em,7px 10px 0 .020em,8px 10px 0 .020em,9px 10px 0 .020em,10px 10px 0 .020em,11px 10px 0 .020em,12px 10px 0 .020em,13px 10px 0 .020em,14px 10px 0 .020em #fff,15px 10px 0 .020em #fff,16px 10px 0 .020em,1px 11px 0 .020em,2px 11px 0 .020em #fff,3px 11px 0 .020em #fff,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em,8px 11px 0 .020em,9px 11px 0 .020em,10px 11px 0 .020em,11px 11px 0 .020em,12px 11px 0 .020em,13px 11px 0 .020em #fff,14px 11px 0 .020em #fff,15px 11px 0 .020em,16px 11px 0 .020em,1px 12px 0 .020em,2px 12px 0 .020em #fff,3px 12px 0 .020em #fff,4px 12px 0 .020em #fff,5px 12px 0 .020em #fff,6px 12px 0 .020em,7px 12px 0 .020em,8px 12px 0 .020em #fff,9px 12px 0 .020em #fff,10px 12px 0 .020em #fff,11px 12px 0 .020em #fff,12px 12px 0 .020em #fff,13px 12px 0 .020em #fff,14px 12px 0 .020em,15px 12px 0 .020em,16px 12px 0 .020em,1px 13px 0 .020em,2px 13px 0 .020em #fff,3px 13px 0 .020em #fff,4px 13px 0 .020em #fff,5px 13px 0 .020em #fff,6px 13px 0 .020em,7px 13px 0 .020em #fff,8px 13px 0 .020em #fff,9px 13px 0 .020em #fff,10px 13px 0 .020em #fff,11px 13px 0 .020em #fff,12px 13px 0 .020em #fff,13px 13px 0 .020em,14px 13px 0 .020em,15px 13px 0 .020em,16px 13px 0 .020em,1px 14px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em,4px 14px 0 .020em,5px 14px 0 .020em #fff,6px 14px 0 .020em #fff,7px 14px 0 .020em #fff,8px 14px 0 .020em #fff,9px 14px 0 .020em,10px 14px 0 .020em,11px 14px 0 .020em,12px 14px 0 .020em,13px 14px 0 .020em,14px 14px 0 .020em,15px 14px 0 .020em,16px 14px 0 .020em,1px 15px 0 .020em,2px 15px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em,5px 15px 0 .020em #fff,6px 15px 0 .020em #fff,7px 15px 0 .020em,8px 15px 0 .020em,9px 15px 0 .020em,10px 15px 0 .020em,11px 15px 0 .020em,12px 15px 0 .020em,13px 15px 0 .020em,14px 15px 0 .020em,15px 15px 0 .020em,16px 15px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,4px 16px 0 .020em,5px 16px 0 .020em,6px 16px 0 .020em,7px 16px 0 .020em,8px 16px 0 .020em,9px 16px 0 .020em,10px 16px 0 .020em,11px 16px 0 .020em,12px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.reddit::before{width:1px;height:1px;color:#f40;box-shadow:3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px #fff,10px 2px #fff,11px 2px #fff,12px 2px,13px 2px #fff,14px 2px,15px 2px,1px 3px,2px 3px,3px 3px,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px #fff,9px 3px,10px 3px,11px 3px,12px 3px #fff,13px 3px #fff,14px 3px #fff,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px,4px 4px,5px 4px,6px 4px,7px 4px,8px 4px #fff,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px #fff,14px 4px,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px,4px 5px,5px 5px,6px 5px,7px 5px #fff,8px 5px #fff,9px 5px #fff,10px 5px #fff,11px 5px,12px 5px,13px 5px,14px 5px,15px 5px,16px 5px,1px 6px,2px 6px #fff,3px 6px #fff,4px 6px,5px 6px #fff,6px 6px #fff,7px 6px #fff,8px 6px #fff,9px 6px #fff,10px 6px #fff,11px 6px #fff,12px 6px #fff,13px 6px,14px 6px #fff,15px 6px #fff,16px 6px,1px 7px,2px 7px #fff,3px 7px,4px 7px #fff,5px 7px #fff,6px 7px #fff,7px 7px #fff,8px 7px #fff,9px 7px #fff,10px 7px #fff,11px 7px #fff,12px 7px #fff,13px 7px #fff,14px 7px,15px 7px #fff,16px 7px,1px 8px,2px 8px,3px 8px #fff,4px 8px #fff,5px 8px #fff,6px 8px,7px 8px,8px 8px #fff,9px 8px #fff,10px 8px,11px 8px,12px 8px #fff,13px 8px #fff,14px 8px #fff,15px 8px,16px 8px,1px 9px,2px 9px #fff,3px 9px #fff,4px 9px #fff,5px 9px #fff,6px 9px,7px 9px,8px 9px #fff,9px 9px #fff,10px 9px,11px 9px,12px 9px #fff,13px 9px #fff,14px 9px #fff,15px 9px #fff,16px 9px,1px 10px,2px 10px #fff,3px 10px #fff,4px 10px #fff,5px 10px #fff,6px 10px #fff,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px #fff,12px 10px #fff,13px 10px #fff,14px 10px #fff,15px 10px #fff,16px 10px,1px 11px,2px 11px #fff,3px 11px #fff,4px 11px #fff,5px 11px #fff,6px 11px #fff,7px 11px #fff,8px 11px #fff,9px 11px #fff,10px 11px #fff,11px 11px #fff,12px 11px #fff,13px 11px #fff,14px 11px #fff,15px 11px #fff,16px 11px,1px 12px,2px 12px,3px 12px #fff,4px 12px #fff,5px 12px #fff,6px 12px,7px 12px #fff,8px 12px #fff,9px 12px #fff,10px 12px #fff,11px 12px,12px 12px #fff,13px 12px #fff,14px 12px #fff,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px,4px 13px #fff,5px 13px #fff,6px 13px #fff,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px #fff,12px 13px #fff,13px 13px #fff,14px 13px,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px,4px 14px,5px 14px #fff,6px 14px #fff,7px 14px #fff,8px 14px #fff,9px 14px #fff,10px 14px #fff,11px 14px #fff,12px 14px #fff,13px 14px,14px 14px,15px 14px,16px 14px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px #fff,8px 15px #fff,9px 15px #fff,10px 15px #fff,11px 15px,12px 15px,13px 15px,14px 15px,15px 15px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px}@supports (-moz-appearance:meterbar){.nes-icon.reddit::before{box-shadow:3px 1px 0 .020em,4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,2px 2px 0 .020em,3px 2px 0 .020em,4px 2px 0 .020em,5px 2px 0 .020em,6px 2px 0 .020em,7px 2px 0 .020em,8px 2px 0 .020em,9px 2px 0 .020em #fff,10px 2px 0 .020em #fff,11px 2px 0 .020em #fff,12px 2px 0 .020em,13px 2px 0 .020em #fff,14px 2px 0 .020em,15px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em,3px 3px 0 .020em,4px 3px 0 .020em,5px 3px 0 .020em,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em #fff,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em #fff,13px 3px 0 .020em #fff,14px 3px 0 .020em #fff,15px 3px 0 .020em,16px 3px 0 .020em,1px 4px 0 .020em,2px 4px 0 .020em,3px 4px 0 .020em,4px 4px 0 .020em,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em,8px 4px 0 .020em #fff,9px 4px 0 .020em,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em,13px 4px 0 .020em #fff,14px 4px 0 .020em,15px 4px 0 .020em,16px 4px 0 .020em,1px 5px 0 .020em,2px 5px 0 .020em,3px 5px 0 .020em,4px 5px 0 .020em,5px 5px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em #fff,8px 5px 0 .020em #fff,9px 5px 0 .020em #fff,10px 5px 0 .020em #fff,11px 5px 0 .020em,12px 5px 0 .020em,13px 5px 0 .020em,14px 5px 0 .020em,15px 5px 0 .020em,16px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em #fff,3px 6px 0 .020em #fff,4px 6px 0 .020em,5px 6px 0 .020em #fff,6px 6px 0 .020em #fff,7px 6px 0 .020em #fff,8px 6px 0 .020em #fff,9px 6px 0 .020em #fff,10px 6px 0 .020em #fff,11px 6px 0 .020em #fff,12px 6px 0 .020em #fff,13px 6px 0 .020em,14px 6px 0 .020em #fff,15px 6px 0 .020em #fff,16px 6px 0 .020em,1px 7px 0 .020em,2px 7px 0 .020em #fff,3px 7px 0 .020em,4px 7px 0 .020em #fff,5px 7px 0 .020em #fff,6px 7px 0 .020em #fff,7px 7px 0 .020em #fff,8px 7px 0 .020em #fff,9px 7px 0 .020em #fff,10px 7px 0 .020em #fff,11px 7px 0 .020em #fff,12px 7px 0 .020em #fff,13px 7px 0 .020em #fff,14px 7px 0 .020em,15px 7px 0 .020em #fff,16px 7px 0 .020em,1px 8px 0 .020em,2px 8px 0 .020em,3px 8px 0 .020em #fff,4px 8px 0 .020em #fff,5px 8px 0 .020em #fff,6px 8px 0 .020em,7px 8px 0 .020em,8px 8px 0 .020em #fff,9px 8px 0 .020em #fff,10px 8px 0 .020em,11px 8px 0 .020em,12px 8px 0 .020em #fff,13px 8px 0 .020em #fff,14px 8px 0 .020em #fff,15px 8px 0 .020em,16px 8px 0 .020em,1px 9px 0 .020em,2px 9px 0 .020em #fff,3px 9px 0 .020em #fff,4px 9px 0 .020em #fff,5px 9px 0 .020em #fff,6px 9px 0 .020em,7px 9px 0 .020em,8px 9px 0 .020em #fff,9px 9px 0 .020em #fff,10px 9px 0 .020em,11px 9px 0 .020em,12px 9px 0 .020em #fff,13px 9px 0 .020em #fff,14px 9px 0 .020em #fff,15px 9px 0 .020em #fff,16px 9px 0 .020em,1px 10px 0 .020em,2px 10px 0 .020em #fff,3px 10px 0 .020em #fff,4px 10px 0 .020em #fff,5px 10px 0 .020em #fff,6px 10px 0 .020em #fff,7px 10px 0 .020em #fff,8px 10px 0 .020em #fff,9px 10px 0 .020em #fff,10px 10px 0 .020em #fff,11px 10px 0 .020em #fff,12px 10px 0 .020em #fff,13px 10px 0 .020em #fff,14px 10px 0 .020em #fff,15px 10px 0 .020em #fff,16px 10px 0 .020em,1px 11px 0 .020em,2px 11px 0 .020em #fff,3px 11px 0 .020em #fff,4px 11px 0 .020em #fff,5px 11px 0 .020em #fff,6px 11px 0 .020em #fff,7px 11px 0 .020em #fff,8px 11px 0 .020em #fff,9px 11px 0 .020em #fff,10px 11px 0 .020em #fff,11px 11px 0 .020em #fff,12px 11px 0 .020em #fff,13px 11px 0 .020em #fff,14px 11px 0 .020em #fff,15px 11px 0 .020em #fff,16px 11px 0 .020em,1px 12px 0 .020em,2px 12px 0 .020em,3px 12px 0 .020em #fff,4px 12px 0 .020em #fff,5px 12px 0 .020em #fff,6px 12px 0 .020em,7px 12px 0 .020em #fff,8px 12px 0 .020em #fff,9px 12px 0 .020em #fff,10px 12px 0 .020em #fff,11px 12px 0 .020em,12px 12px 0 .020em #fff,13px 12px 0 .020em #fff,14px 12px 0 .020em #fff,15px 12px 0 .020em,16px 12px 0 .020em,1px 13px 0 .020em,2px 13px 0 .020em,3px 13px 0 .020em,4px 13px 0 .020em #fff,5px 13px 0 .020em #fff,6px 13px 0 .020em #fff,7px 13px 0 .020em,8px 13px 0 .020em,9px 13px 0 .020em,10px 13px 0 .020em,11px 13px 0 .020em #fff,12px 13px 0 .020em #fff,13px 13px 0 .020em #fff,14px 13px 0 .020em,15px 13px 0 .020em,16px 13px 0 .020em,1px 14px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em,4px 14px 0 .020em,5px 14px 0 .020em #fff,6px 14px 0 .020em #fff,7px 14px 0 .020em #fff,8px 14px 0 .020em #fff,9px 14px 0 .020em #fff,10px 14px 0 .020em #fff,11px 14px 0 .020em #fff,12px 14px 0 .020em #fff,13px 14px 0 .020em,14px 14px 0 .020em,15px 14px 0 .020em,16px 14px 0 .020em,2px 15px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em,5px 15px 0 .020em,6px 15px 0 .020em,7px 15px 0 .020em #fff,8px 15px 0 .020em #fff,9px 15px 0 .020em #fff,10px 15px 0 .020em #fff,11px 15px 0 .020em,12px 15px 0 .020em,13px 15px 0 .020em,14px 15px 0 .020em,15px 15px 0 .020em,3px 16px 0 .020em,4px 16px 0 .020em,5px 16px 0 .020em,6px 16px 0 .020em,7px 16px 0 .020em,8px 16px 0 .020em,9px 16px 0 .020em,10px 16px 0 .020em,11px 16px 0 .020em,12px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em}}.nes-icon.whatsapp::before{width:1px;height:1px;color:#00ba37;box-shadow:4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,3px 2px,4px 2px,5px 2px,6px 2px #fff,7px 2px #fff,8px 2px #fff,9px 2px #fff,10px 2px #fff,11px 2px #fff,12px 2px #fff,13px 2px,14px 2px,15px 2px,2px 3px,3px 3px,4px 3px,5px 3px #fff,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px #fff,14px 3px,15px 3px,16px 3px,2px 4px,3px 4px,4px 4px #fff,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px #fff,15px 4px,16px 4px,2px 5px,3px 5px,4px 5px #fff,5px 5px,6px 5px #fff,7px 5px #fff,8px 5px,9px 5px,10px 5px,11px 5px,12px 5px,13px 5px,14px 5px #fff,15px 5px,16px 5px,2px 6px,3px 6px #fff,4px 6px,5px 6px,6px 6px #fff,7px 6px #fff,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px #fff,16px 6px,2px 7px,3px 7px #fff,4px 7px,5px 7px,6px 7px #fff,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px,12px 7px,13px 7px,14px 7px,15px 7px #fff,16px 7px,2px 8px,3px 8px #fff,4px 8px,5px 8px,6px 8px,7px 8px #fff,8px 8px #fff,9px 8px,10px 8px,11px 8px,12px 8px,13px 8px,14px 8px,15px 8px #fff,16px 8px,2px 9px,3px 9px #fff,4px 9px,5px 9px,6px 9px,7px 9px,8px 9px #fff,9px 9px #fff,10px 9px,11px 9px,12px 9px,13px 9px,14px 9px,15px 9px #fff,16px 9px,2px 10px,3px 10px #fff,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px,9px 10px #fff,10px 10px,11px 10px #fff,12px 10px #fff,13px 10px,14px 10px,15px 10px #fff,16px 10px,2px 11px,3px 11px,4px 11px #fff,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px #fff,11px 11px #fff,12px 11px #fff,13px 11px,14px 11px #fff,15px 11px,16px 11px,2px 12px,3px 12px,4px 12px #fff,5px 12px,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px,13px 12px,14px 12px #fff,15px 12px,16px 12px,2px 13px,3px 13px #fff,4px 13px,5px 13px #fff,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px,12px 13px,13px 13px #fff,14px 13px,15px 13px,16px 13px,2px 14px,3px 14px #fff,4px 14px #fff,5px 14px,6px 14px #fff,7px 14px #fff,8px 14px #fff,9px 14px #fff,10px 14px #fff,11px 14px #fff,12px 14px #fff,13px 14px,14px 14px,15px 14px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px,14px 15px}@supports (-moz-appearance:meterbar){.nes-icon.whatsapp::before{box-shadow:4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,3px 2px 0 .020em,4px 2px 0 .020em,5px 2px 0 .020em,6px 2px 0 .020em #fff,7px 2px 0 .020em #fff,8px 2px 0 .020em #fff,9px 2px 0 .020em #fff,10px 2px 0 .020em #fff,11px 2px 0 .020em #fff,12px 2px 0 .020em #fff,13px 2px 0 .020em,14px 2px 0 .020em,15px 2px 0 .020em,2px 3px 0 .020em,3px 3px 0 .020em,4px 3px 0 .020em,5px 3px 0 .020em #fff,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em,13px 3px 0 .020em #fff,14px 3px 0 .020em,15px 3px 0 .020em,16px 3px 0 .020em,2px 4px 0 .020em,3px 4px 0 .020em,4px 4px 0 .020em #fff,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em,8px 4px 0 .020em,9px 4px 0 .020em,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em,13px 4px 0 .020em,14px 4px 0 .020em #fff,15px 4px 0 .020em,16px 4px 0 .020em,2px 5px 0 .020em,3px 5px 0 .020em,4px 5px 0 .020em #fff,5px 5px 0 .020em,6px 5px 0 .020em #fff,7px 5px 0 .020em #fff,8px 5px 0 .020em,9px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em,12px 5px 0 .020em,13px 5px 0 .020em,14px 5px 0 .020em #fff,15px 5px 0 .020em,16px 5px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em #fff,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em #fff,7px 6px 0 .020em #fff,8px 6px 0 .020em,9px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em #fff,16px 6px 0 .020em,2px 7px 0 .020em,3px 7px 0 .020em #fff,4px 7px 0 .020em,5px 7px 0 .020em,6px 7px 0 .020em #fff,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em,11px 7px 0 .020em,12px 7px 0 .020em,13px 7px 0 .020em,14px 7px 0 .020em,15px 7px 0 .020em #fff,16px 7px 0 .020em,2px 8px 0 .020em,3px 8px 0 .020em #fff,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em,7px 8px 0 .020em #fff,8px 8px 0 .020em #fff,9px 8px 0 .020em,10px 8px 0 .020em,11px 8px 0 .020em,12px 8px 0 .020em,13px 8px 0 .020em,14px 8px 0 .020em,15px 8px 0 .020em #fff,16px 8px 0 .020em,2px 9px 0 .020em,3px 9px 0 .020em #fff,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em,7px 9px 0 .020em,8px 9px 0 .020em #fff,9px 9px 0 .020em #fff,10px 9px 0 .020em,11px 9px 0 .020em,12px 9px 0 .020em,13px 9px 0 .020em,14px 9px 0 .020em,15px 9px 0 .020em #fff,16px 9px 0 .020em,2px 10px 0 .020em,3px 10px 0 .020em #fff,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em,7px 10px 0 .020em,8px 10px 0 .020em,9px 10px 0 .020em #fff,10px 10px 0 .020em,11px 10px 0 .020em #fff,12px 10px 0 .020em #fff,13px 10px 0 .020em,14px 10px 0 .020em,15px 10px 0 .020em #fff,16px 10px 0 .020em,2px 11px 0 .020em,3px 11px 0 .020em,4px 11px 0 .020em #fff,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em,8px 11px 0 .020em,9px 11px 0 .020em,10px 11px 0 .020em #fff,11px 11px 0 .020em #fff,12px 11px 0 .020em #fff,13px 11px 0 .020em,14px 11px 0 .020em #fff,15px 11px 0 .020em,16px 11px 0 .020em,2px 12px 0 .020em,3px 12px 0 .020em,4px 12px 0 .020em #fff,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em,8px 12px 0 .020em,9px 12px 0 .020em,10px 12px 0 .020em,11px 12px 0 .020em,12px 12px 0 .020em,13px 12px 0 .020em,14px 12px 0 .020em #fff,15px 12px 0 .020em,16px 12px 0 .020em,2px 13px 0 .020em,3px 13px 0 .020em #fff,4px 13px 0 .020em,5px 13px 0 .020em #fff,6px 13px 0 .020em,7px 13px 0 .020em,8px 13px 0 .020em,9px 13px 0 .020em,10px 13px 0 .020em,11px 13px 0 .020em,12px 13px 0 .020em,13px 13px 0 .020em #fff,14px 13px 0 .020em,15px 13px 0 .020em,16px 13px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em #fff,4px 14px 0 .020em #fff,5px 14px 0 .020em,6px 14px 0 .020em #fff,7px 14px 0 .020em #fff,8px 14px 0 .020em #fff,9px 14px 0 .020em #fff,10px 14px 0 .020em #fff,11px 14px 0 .020em #fff,12px 14px 0 .020em #fff,13px 14px 0 .020em,14px 14px 0 .020em,15px 14px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em,5px 15px 0 .020em,6px 15px 0 .020em,7px 15px 0 .020em,8px 15px 0 .020em,9px 15px 0 .020em,10px 15px 0 .020em,11px 15px 0 .020em,12px 15px 0 .020em,13px 15px 0 .020em,14px 15px 0 .020em}}.nes-icon.gmail::before{width:1px;height:1px;color:#eeecec;box-shadow:2px 3px #fd2b2b,3px 3px,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px,14px 3px,15px 3px #fd2b2b,1px 4px #fd2b2b,2px 4px #fd2b2b,3px 4px #fd2b2b,4px 4px,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px #fd2b2b,15px 4px #fd2b2b,16px 4px #fd2b2b,1px 5px #fd2b2b,2px 5px #fd2b2b,3px 5px #fd2b2b,4px 5px #fd2b2b,5px 5px,6px 5px,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px,12px 5px,13px 5px #fd2b2b,14px 5px #fd2b2b,15px 5px #fd2b2b,16px 5px #fd2b2b,1px 6px #fd2b2b,2px 6px #fd2b2b,3px 6px,4px 6px #fd2b2b,5px 6px #fd2b2b,6px 6px,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px #fd2b2b,13px 6px #fd2b2b,14px 6px,15px 6px #fd2b2b,16px 6px #fd2b2b,1px 7px #fd2b2b,2px 7px #fd2b2b,3px 7px,4px 7px,5px 7px #fd2b2b,6px 7px #fd2b2b,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px #fd2b2b,12px 7px #fd2b2b,13px 7px,14px 7px,15px 7px #fd2b2b,16px 7px #fd2b2b,1px 8px #fd2b2b,2px 8px #fd2b2b,3px 8px,4px 8px,5px 8px,6px 8px #fd2b2b,7px 8px #fd2b2b,8px 8px,9px 8px,10px 8px #fd2b2b,11px 8px #fd2b2b,12px 8px,13px 8px,14px 8px,15px 8px #fd2b2b,16px 8px #fd2b2b,1px 9px #fd2b2b,2px 9px #fd2b2b,3px 9px,4px 9px,5px 9px,6px 9px,7px 9px #fd2b2b,8px 9px #fd2b2b,9px 9px #fd2b2b,10px 9px #fd2b2b,11px 9px,12px 9px,13px 9px,14px 9px,15px 9px #fd2b2b,16px 9px #fd2b2b,1px 10px #fd2b2b,2px 10px #fd2b2b,3px 10px,4px 10px,5px 10px,6px 10px,7px 10px,8px 10px #fd2b2b,9px 10px #fd2b2b,10px 10px,11px 10px,12px 10px,13px 10px,14px 10px,15px 10px #fd2b2b,16px 10px #fd2b2b,1px 11px #fd2b2b,2px 11px #fd2b2b,3px 11px,4px 11px,5px 11px,6px 11px,7px 11px,8px 11px,9px 11px,10px 11px,11px 11px,12px 11px,13px 11px,14px 11px,15px 11px #fd2b2b,16px 11px #fd2b2b,1px 12px #fd2b2b,2px 12px #fd2b2b,3px 12px,4px 12px,5px 12px,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px,13px 12px,14px 12px,15px 12px #fd2b2b,16px 12px #fd2b2b,1px 13px #fd2b2b,2px 13px #fd2b2b,3px 13px,4px 13px,5px 13px,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px,15px 13px #fd2b2b,16px 13px #fd2b2b,2px 14px #fd2b2b,3px 14px,4px 14px,5px 14px,6px 14px,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px,15px 14px #fd2b2b}@supports (-moz-appearance:meterbar){.nes-icon.gmail::before{box-shadow:2px 3px 0 .020em #fd2b2b,3px 3px 0 .020em,4px 3px 0 .020em,5px 3px 0 .020em,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em,13px 3px 0 .020em,14px 3px 0 .020em,15px 3px 0 .020em #fd2b2b,1px 4px 0 .020em #fd2b2b,2px 4px 0 .020em #fd2b2b,3px 4px 0 .020em #fd2b2b,4px 4px 0 .020em,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em,8px 4px 0 .020em,9px 4px 0 .020em,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em,13px 4px 0 .020em,14px 4px 0 .020em #fd2b2b,15px 4px 0 .020em #fd2b2b,16px 4px 0 .020em #fd2b2b,1px 5px 0 .020em #fd2b2b,2px 5px 0 .020em #fd2b2b,3px 5px 0 .020em #fd2b2b,4px 5px 0 .020em #fd2b2b,5px 5px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em,8px 5px 0 .020em,9px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em,12px 5px 0 .020em,13px 5px 0 .020em #fd2b2b,14px 5px 0 .020em #fd2b2b,15px 5px 0 .020em #fd2b2b,16px 5px 0 .020em #fd2b2b,1px 6px 0 .020em #fd2b2b,2px 6px 0 .020em #fd2b2b,3px 6px 0 .020em,4px 6px 0 .020em #fd2b2b,5px 6px 0 .020em #fd2b2b,6px 6px 0 .020em,7px 6px 0 .020em,8px 6px 0 .020em,9px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em #fd2b2b,13px 6px 0 .020em #fd2b2b,14px 6px 0 .020em,15px 6px 0 .020em #fd2b2b,16px 6px 0 .020em #fd2b2b,1px 7px 0 .020em #fd2b2b,2px 7px 0 .020em #fd2b2b,3px 7px 0 .020em,4px 7px 0 .020em,5px 7px 0 .020em #fd2b2b,6px 7px 0 .020em #fd2b2b,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em,11px 7px 0 .020em #fd2b2b,12px 7px 0 .020em #fd2b2b,13px 7px 0 .020em,14px 7px 0 .020em,15px 7px 0 .020em #fd2b2b,16px 7px 0 .020em #fd2b2b,1px 8px 0 .020em #fd2b2b,2px 8px 0 .020em #fd2b2b,3px 8px 0 .020em,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em #fd2b2b,7px 8px 0 .020em #fd2b2b,8px 8px 0 .020em,9px 8px 0 .020em,10px 8px 0 .020em #fd2b2b,11px 8px 0 .020em #fd2b2b,12px 8px 0 .020em,13px 8px 0 .020em,14px 8px 0 .020em,15px 8px 0 .020em #fd2b2b,16px 8px 0 .020em #fd2b2b,1px 9px 0 .020em #fd2b2b,2px 9px 0 .020em #fd2b2b,3px 9px 0 .020em,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em,7px 9px 0 .020em #fd2b2b,8px 9px 0 .020em #fd2b2b,9px 9px 0 .020em #fd2b2b,10px 9px 0 .020em #fd2b2b,11px 9px 0 .020em,12px 9px 0 .020em,13px 9px 0 .020em,14px 9px 0 .020em,15px 9px 0 .020em #fd2b2b,16px 9px 0 .020em #fd2b2b,1px 10px 0 .020em #fd2b2b,2px 10px 0 .020em #fd2b2b,3px 10px 0 .020em,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em,7px 10px 0 .020em,8px 10px 0 .020em #fd2b2b,9px 10px 0 .020em #fd2b2b,10px 10px 0 .020em,11px 10px 0 .020em,12px 10px 0 .020em,13px 10px 0 .020em,14px 10px 0 .020em,15px 10px 0 .020em #fd2b2b,16px 10px 0 .020em #fd2b2b,1px 11px 0 .020em #fd2b2b,2px 11px 0 .020em #fd2b2b,3px 11px 0 .020em,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em,8px 11px 0 .020em,9px 11px 0 .020em,10px 11px 0 .020em,11px 11px 0 .020em,12px 11px 0 .020em,13px 11px 0 .020em,14px 11px 0 .020em,15px 11px 0 .020em #fd2b2b,16px 11px 0 .020em #fd2b2b,1px 12px 0 .020em #fd2b2b,2px 12px 0 .020em #fd2b2b,3px 12px 0 .020em,4px 12px 0 .020em,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em,8px 12px 0 .020em,9px 12px 0 .020em,10px 12px 0 .020em,11px 12px 0 .020em,12px 12px 0 .020em,13px 12px 0 .020em,14px 12px 0 .020em,15px 12px 0 .020em #fd2b2b,16px 12px 0 .020em #fd2b2b,1px 13px 0 .020em #fd2b2b,2px 13px 0 .020em #fd2b2b,3px 13px 0 .020em,4px 13px 0 .020em,5px 13px 0 .020em,6px 13px 0 .020em,7px 13px 0 .020em,8px 13px 0 .020em,9px 13px 0 .020em,10px 13px 0 .020em,11px 13px 0 .020em,12px 13px 0 .020em,13px 13px 0 .020em,14px 13px 0 .020em,15px 13px 0 .020em #fd2b2b,16px 13px 0 .020em #fd2b2b,2px 14px 0 .020em #fd2b2b,3px 14px 0 .020em,4px 14px 0 .020em,5px 14px 0 .020em,6px 14px 0 .020em,7px 14px 0 .020em,8px 14px 0 .020em,9px 14px 0 .020em,10px 14px 0 .020em,11px 14px 0 .020em,12px 14px 0 .020em,13px 14px 0 .020em,14px 14px 0 .020em,15px 14px 0 .020em #fd2b2b}}.nes-icon.linkedin::before{width:1px;height:1px;color:#2577b9;box-shadow:2px 1px,3px 1px,4px 1px,5px 1px,6px 1px,7px 1px,8px 1px,9px 1px,10px 1px,11px 1px,12px 1px,13px 1px,14px 1px,15px 1px,1px 2px,2px 2px,3px 2px,4px 2px,5px 2px,6px 2px,7px 2px,8px 2px,9px 2px,10px 2px,11px 2px,12px 2px,13px 2px,14px 2px,15px 2px,16px 2px,1px 3px,2px 3px,3px 3px #fff,4px 3px #fff,5px 3px #fff,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px,14px 3px,15px 3px,16px 3px,1px 4px,2px 4px,3px 4px #fff,4px 4px #fff,5px 4px #fff,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px,13px 4px,14px 4px,15px 4px,16px 4px,1px 5px,2px 5px,3px 5px #fff,4px 5px #fff,5px 5px #fff,6px 5px,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px,12px 5px,13px 5px,14px 5px,15px 5px,16px 5px,1px 6px,2px 6px,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px,8px 6px,9px 6px,10px 6px,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px,16px 6px,1px 7px,2px 7px,3px 7px #fff,4px 7px #fff,5px 7px #fff,6px 7px,7px 7px #fff,8px 7px #fff,9px 7px #fff,10px 7px,11px 7px #fff,12px 7px #fff,13px 7px #fff,14px 7px,15px 7px,16px 7px,1px 8px,2px 8px,3px 8px #fff,4px 8px #fff,5px 8px #fff,6px 8px,7px 8px #fff,8px 8px #fff,9px 8px #fff,10px 8px #fff,11px 8px #fff,12px 8px #fff,13px 8px #fff,14px 8px #fff,15px 8px,16px 8px,1px 9px,2px 9px,3px 9px #fff,4px 9px #fff,5px 9px #fff,6px 9px,7px 9px #fff,8px 9px #fff,9px 9px #fff,10px 9px #fff,11px 9px #fff,12px 9px #fff,13px 9px #fff,14px 9px #fff,15px 9px,16px 9px,1px 10px,2px 10px,3px 10px #fff,4px 10px #fff,5px 10px #fff,6px 10px,7px 10px #fff,8px 10px #fff,9px 10px #fff,10px 10px #fff,11px 10px,12px 10px #fff,13px 10px #fff,14px 10px #fff,15px 10px,16px 10px,1px 11px,2px 11px,3px 11px #fff,4px 11px #fff,5px 11px #fff,6px 11px,7px 11px #fff,8px 11px #fff,9px 11px #fff,10px 11px,11px 11px,12px 11px #fff,13px 11px #fff,14px 11px #fff,15px 11px,16px 11px,1px 12px,2px 12px,3px 12px #fff,4px 12px #fff,5px 12px #fff,6px 12px,7px 12px #fff,8px 12px #fff,9px 12px #fff,10px 12px,11px 12px,12px 12px #fff,13px 12px #fff,14px 12px #fff,15px 12px,16px 12px,1px 13px,2px 13px,3px 13px #fff,4px 13px #fff,5px 13px #fff,6px 13px,7px 13px #fff,8px 13px #fff,9px 13px #fff,10px 13px,11px 13px,12px 13px #fff,13px 13px #fff,14px 13px #fff,15px 13px,16px 13px,1px 14px,2px 14px,3px 14px #fff,4px 14px #fff,5px 14px #fff,6px 14px,7px 14px #fff,8px 14px #fff,9px 14px #fff,10px 14px,11px 14px,12px 14px #fff,13px 14px #fff,14px 14px #fff,15px 14px,16px 14px,1px 15px,2px 15px,3px 15px,4px 15px,5px 15px,6px 15px,7px 15px,8px 15px,9px 15px,10px 15px,11px 15px,12px 15px,13px 15px,14px 15px,15px 15px,16px 15px,2px 16px,3px 16px,4px 16px,5px 16px,6px 16px,7px 16px,8px 16px,9px 16px,10px 16px,11px 16px,12px 16px,13px 16px,14px 16px,15px 16px}@supports (-moz-appearance:meterbar){.nes-icon.linkedin::before{box-shadow:2px 1px 0 .020em,3px 1px 0 .020em,4px 1px 0 .020em,5px 1px 0 .020em,6px 1px 0 .020em,7px 1px 0 .020em,8px 1px 0 .020em,9px 1px 0 .020em,10px 1px 0 .020em,11px 1px 0 .020em,12px 1px 0 .020em,13px 1px 0 .020em,14px 1px 0 .020em,15px 1px 0 .020em,1px 2px 0 .020em,2px 2px 0 .020em,3px 2px 0 .020em,4px 2px 0 .020em,5px 2px 0 .020em,6px 2px 0 .020em,7px 2px 0 .020em,8px 2px 0 .020em,9px 2px 0 .020em,10px 2px 0 .020em,11px 2px 0 .020em,12px 2px 0 .020em,13px 2px 0 .020em,14px 2px 0 .020em,15px 2px 0 .020em,16px 2px 0 .020em,1px 3px 0 .020em,2px 3px 0 .020em,3px 3px 0 .020em #fff,4px 3px 0 .020em #fff,5px 3px 0 .020em #fff,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em,13px 3px 0 .020em,14px 3px 0 .020em,15px 3px 0 .020em,16px 3px 0 .020em,1px 4px 0 .020em,2px 4px 0 .020em,3px 4px 0 .020em #fff,4px 4px 0 .020em #fff,5px 4px 0 .020em #fff,6px 4px 0 .020em,7px 4px 0 .020em,8px 4px 0 .020em,9px 4px 0 .020em,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em,13px 4px 0 .020em,14px 4px 0 .020em,15px 4px 0 .020em,16px 4px 0 .020em,1px 5px 0 .020em,2px 5px 0 .020em,3px 5px 0 .020em #fff,4px 5px 0 .020em #fff,5px 5px 0 .020em #fff,6px 5px 0 .020em,7px 5px 0 .020em,8px 5px 0 .020em,9px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em,12px 5px 0 .020em,13px 5px 0 .020em,14px 5px 0 .020em,15px 5px 0 .020em,16px 5px 0 .020em,1px 6px 0 .020em,2px 6px 0 .020em,3px 6px 0 .020em,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em,8px 6px 0 .020em,9px 6px 0 .020em,10px 6px 0 .020em,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em,16px 6px 0 .020em,1px 7px 0 .020em,2px 7px 0 .020em,3px 7px 0 .020em #fff,4px 7px 0 .020em #fff,5px 7px 0 .020em #fff,6px 7px 0 .020em,7px 7px 0 .020em #fff,8px 7px 0 .020em #fff,9px 7px 0 .020em #fff,10px 7px 0 .020em,11px 7px 0 .020em #fff,12px 7px 0 .020em #fff,13px 7px 0 .020em #fff,14px 7px 0 .020em,15px 7px 0 .020em,16px 7px 0 .020em,1px 8px 0 .020em,2px 8px 0 .020em,3px 8px 0 .020em #fff,4px 8px 0 .020em #fff,5px 8px 0 .020em #fff,6px 8px 0 .020em,7px 8px 0 .020em #fff,8px 8px 0 .020em #fff,9px 8px 0 .020em #fff,10px 8px 0 .020em #fff,11px 8px 0 .020em #fff,12px 8px 0 .020em #fff,13px 8px 0 .020em #fff,14px 8px 0 .020em #fff,15px 8px 0 .020em,16px 8px 0 .020em,1px 9px 0 .020em,2px 9px 0 .020em,3px 9px 0 .020em #fff,4px 9px 0 .020em #fff,5px 9px 0 .020em #fff,6px 9px 0 .020em,7px 9px 0 .020em #fff,8px 9px 0 .020em #fff,9px 9px 0 .020em #fff,10px 9px 0 .020em #fff,11px 9px 0 .020em #fff,12px 9px 0 .020em #fff,13px 9px 0 .020em #fff,14px 9px 0 .020em #fff,15px 9px 0 .020em,16px 9px 0 .020em,1px 10px 0 .020em,2px 10px 0 .020em,3px 10px 0 .020em #fff,4px 10px 0 .020em #fff,5px 10px 0 .020em #fff,6px 10px 0 .020em,7px 10px 0 .020em #fff,8px 10px 0 .020em #fff,9px 10px 0 .020em #fff,10px 10px 0 .020em #fff,11px 10px 0 .020em,12px 10px 0 .020em #fff,13px 10px 0 .020em #fff,14px 10px 0 .020em #fff,15px 10px 0 .020em,16px 10px 0 .020em,1px 11px 0 .020em,2px 11px 0 .020em,3px 11px 0 .020em #fff,4px 11px 0 .020em #fff,5px 11px 0 .020em #fff,6px 11px 0 .020em,7px 11px 0 .020em #fff,8px 11px 0 .020em #fff,9px 11px 0 .020em #fff,10px 11px 0 .020em,11px 11px 0 .020em,12px 11px 0 .020em #fff,13px 11px 0 .020em #fff,14px 11px 0 .020em #fff,15px 11px 0 .020em,16px 11px 0 .020em,1px 12px 0 .020em,2px 12px 0 .020em,3px 12px 0 .020em #fff,4px 12px 0 .020em #fff,5px 12px 0 .020em #fff,6px 12px 0 .020em,7px 12px 0 .020em #fff,8px 12px 0 .020em #fff,9px 12px 0 .020em #fff,10px 12px 0 .020em,11px 12px 0 .020em,12px 12px 0 .020em #fff,13px 12px 0 .020em #fff,14px 12px 0 .020em #fff,15px 12px 0 .020em,16px 12px 0 .020em,1px 13px 0 .020em,2px 13px 0 .020em,3px 13px 0 .020em #fff,4px 13px 0 .020em #fff,5px 13px 0 .020em #fff,6px 13px 0 .020em,7px 13px 0 .020em #fff,8px 13px 0 .020em #fff,9px 13px 0 .020em #fff,10px 13px 0 .020em,11px 13px 0 .020em,12px 13px 0 .020em #fff,13px 13px 0 .020em #fff,14px 13px 0 .020em #fff,15px 13px 0 .020em,16px 13px 0 .020em,1px 14px 0 .020em,2px 14px 0 .020em,3px 14px 0 .020em #fff,4px 14px 0 .020em #fff,5px 14px 0 .020em #fff,6px 14px 0 .020em,7px 14px 0 .020em #fff,8px 14px 0 .020em #fff,9px 14px 0 .020em #fff,10px 14px 0 .020em,11px 14px 0 .020em,12px 14px 0 .020em #fff,13px 14px 0 .020em #fff,14px 14px 0 .020em #fff,15px 14px 0 .020em,16px 14px 0 .020em,1px 15px 0 .020em,2px 15px 0 .020em,3px 15px 0 .020em,4px 15px 0 .020em,5px 15px 0 .020em,6px 15px 0 .020em,7px 15px 0 .020em,8px 15px 0 .020em,9px 15px 0 .020em,10px 15px 0 .020em,11px 15px 0 .020em,12px 15px 0 .020em,13px 15px 0 .020em,14px 15px 0 .020em,15px 15px 0 .020em,16px 15px 0 .020em,2px 16px 0 .020em,3px 16px 0 .020em,4px 16px 0 .020em,5px 16px 0 .020em,6px 16px 0 .020em,7px 16px 0 .020em,8px 16px 0 .020em,9px 16px 0 .020em,10px 16px 0 .020em,11px 16px 0 .020em,12px 16px 0 .020em,13px 16px 0 .020em,14px 16px 0 .020em,15px 16px 0 .020em}}.nes-icon.instagram::before{width:1px;height:1px;color:#fff;box-shadow:3px 1px #8005c8,4px 1px #8005c8,5px 1px #8005c8,6px 1px #8005c8,7px 1px #8005c8,8px 1px #8005c8,9px 1px #8005c8,10px 1px #8005c8,11px 1px #8005c8,12px 1px #8005c8,13px 1px #8005c8,14px 1px #8005c8,2px 2px #8005c8,3px 2px #8005c8,4px 2px #8005c8,5px 2px #8005c8,6px 2px #8005c8,7px 2px #8005c8,8px 2px #8005c8,9px 2px #8005c8,10px 2px #8005c8,11px 2px #8005c8,12px 2px #8005c8,13px 2px #8005c8,14px 2px #8005c8,15px 2px #8005c8,1px 3px #8005c8,2px 3px #8005c8,3px 3px #8005c8,4px 3px,5px 3px,6px 3px,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px,13px 3px,14px 3px #8005c8,15px 3px #8005c8,16px 3px #8005c8,1px 4px #8005c8,2px 4px #8005c8,3px 4px,4px 4px,5px 4px,6px 4px,7px 4px,8px 4px,9px 4px,10px 4px,11px 4px,12px 4px #8005c8,13px 4px #8005c8,14px 4px,15px 4px #8005c8,16px 4px #8005c8,1px 5px #8005c8,2px 5px #8005c8,3px 5px,4px 5px,5px 5px,6px 5px,7px 5px,8px 5px,9px 5px,10px 5px,11px 5px,12px 5px #8005c8,13px 5px #8005c8,14px 5px,15px 5px #8005c8,16px 5px #8005c8,1px 6px #8005c8,2px 6px #8005c8,3px 6px,4px 6px,5px 6px,6px 6px,7px 6px #8005c8,8px 6px #8005c8,9px 6px #8005c8,10px 6px #8005c8,11px 6px,12px 6px,13px 6px,14px 6px,15px 6px #8005c8,16px 6px #8005c8,1px 7px #d40075,2px 7px #8005c8,3px 7px,4px 7px,5px 7px,6px 7px #8005c8,7px 7px,8px 7px,9px 7px,10px 7px,11px 7px #8005c8,12px 7px,13px 7px,14px 7px,15px 7px #8005c8,16px 7px #d40075,1px 8px #d40075,2px 8px #d40075,3px 8px,4px 8px,5px 8px,6px 8px #8005c8,7px 8px,8px 8px,9px 8px,10px 8px,11px 8px #8005c8,12px 8px,13px 8px,14px 8px,15px 8px #d40075,16px 8px #d40075,1px 9px #d40075,2px 9px #d40075,3px 9px,4px 9px,5px 9px,6px 9px #d40075,7px 9px,8px 9px,9px 9px,10px 9px,11px 9px #d40075,12px 9px,13px 9px,14px 9px,15px 9px #d40075,16px 9px #d40075,1px 10px #d40075,2px 10px #d40075,3px 10px,4px 10px,5px 10px,6px 10px #d40075,7px 10px,8px 10px,9px 10px,10px 10px,11px 10px #d40075,12px 10px,13px 10px,14px 10px,15px 10px #d40075,16px 10px #d40075,1px 11px #e98c25,2px 11px #e98c25,3px 11px,4px 11px,5px 11px,6px 11px,7px 11px #d40075,8px 11px #d40075,9px 11px #d40075,10px 11px #d40075,11px 11px,12px 11px,13px 11px,14px 11px,15px 11px #d40075,16px 11px #d40075,1px 12px #e98c25,2px 12px #e98c25,3px 12px,4px 12px,5px 12px,6px 12px,7px 12px,8px 12px,9px 12px,10px 12px,11px 12px,12px 12px,13px 12px,14px 12px,15px 12px #d40075,16px 12px #d40075,1px 13px #e98c25,2px 13px #e98c25,3px 13px,4px 13px,5px 13px,6px 13px,7px 13px,8px 13px,9px 13px,10px 13px,11px 13px,12px 13px,13px 13px,14px 13px,15px 13px #d84646,16px 13px #d84646,1px 14px #e98c25,2px 14px #e98c25,3px 14px #e98c25,4px 14px,5px 14px,6px 14px,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px,13px 14px,14px 14px #d84646,15px 14px #d84646,16px 14px #d84646,2px 15px #e98c25,3px 15px #e98c25,4px 15px #e98c25,5px 15px #e98c25,6px 15px #e98c25,7px 15px #e98c25,8px 15px #e98c25,9px 15px #e98c25,10px 15px #d84646,11px 15px #d84646,12px 15px #d84646,13px 15px #d84646,14px 15px #d84646,15px 15px #d84646,3px 16px #e98c25,4px 16px #e98c25,5px 16px #e98c25,6px 16px #e98c25,7px 16px #e98c25,8px 16px #e98c25,9px 16px #d84646,10px 16px #d84646,11px 16px #d84646,12px 16px #d84646,13px 16px #d84646,14px 16px #d84646}@supports (-moz-appearance:meterbar){.nes-icon.instagram::before{box-shadow:3px 1px 0 .020em #8005c8,4px 1px 0 .020em #8005c8,5px 1px 0 .020em #8005c8,6px 1px 0 .020em #8005c8,7px 1px 0 .020em #8005c8,8px 1px 0 .020em #8005c8,9px 1px 0 .020em #8005c8,10px 1px 0 .020em #8005c8,11px 1px 0 .020em #8005c8,12px 1px 0 .020em #8005c8,13px 1px 0 .020em #8005c8,14px 1px 0 .020em #8005c8,2px 2px 0 .020em #8005c8,3px 2px 0 .020em #8005c8,4px 2px 0 .020em #8005c8,5px 2px 0 .020em #8005c8,6px 2px 0 .020em #8005c8,7px 2px 0 .020em #8005c8,8px 2px 0 .020em #8005c8,9px 2px 0 .020em #8005c8,10px 2px 0 .020em #8005c8,11px 2px 0 .020em #8005c8,12px 2px 0 .020em #8005c8,13px 2px 0 .020em #8005c8,14px 2px 0 .020em #8005c8,15px 2px 0 .020em #8005c8,1px 3px 0 .020em #8005c8,2px 3px 0 .020em #8005c8,3px 3px 0 .020em #8005c8,4px 3px 0 .020em,5px 3px 0 .020em,6px 3px 0 .020em,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em,13px 3px 0 .020em,14px 3px 0 .020em #8005c8,15px 3px 0 .020em #8005c8,16px 3px 0 .020em #8005c8,1px 4px 0 .020em #8005c8,2px 4px 0 .020em #8005c8,3px 4px 0 .020em,4px 4px 0 .020em,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em,8px 4px 0 .020em,9px 4px 0 .020em,10px 4px 0 .020em,11px 4px 0 .020em,12px 4px 0 .020em #8005c8,13px 4px 0 .020em #8005c8,14px 4px 0 .020em,15px 4px 0 .020em #8005c8,16px 4px 0 .020em #8005c8,1px 5px 0 .020em #8005c8,2px 5px 0 .020em #8005c8,3px 5px 0 .020em,4px 5px 0 .020em,5px 5px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em,8px 5px 0 .020em,9px 5px 0 .020em,10px 5px 0 .020em,11px 5px 0 .020em,12px 5px 0 .020em #8005c8,13px 5px 0 .020em #8005c8,14px 5px 0 .020em,15px 5px 0 .020em #8005c8,16px 5px 0 .020em #8005c8,1px 6px 0 .020em #8005c8,2px 6px 0 .020em #8005c8,3px 6px 0 .020em,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em #8005c8,8px 6px 0 .020em #8005c8,9px 6px 0 .020em #8005c8,10px 6px 0 .020em #8005c8,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em,15px 6px 0 .020em #8005c8,16px 6px 0 .020em #8005c8,1px 7px 0 .020em #d40075,2px 7px 0 .020em #8005c8,3px 7px 0 .020em,4px 7px 0 .020em,5px 7px 0 .020em,6px 7px 0 .020em #8005c8,7px 7px 0 .020em,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em,11px 7px 0 .020em #8005c8,12px 7px 0 .020em,13px 7px 0 .020em,14px 7px 0 .020em,15px 7px 0 .020em #8005c8,16px 7px 0 .020em #d40075,1px 8px 0 .020em #d40075,2px 8px 0 .020em #d40075,3px 8px 0 .020em,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em #8005c8,7px 8px 0 .020em,8px 8px 0 .020em,9px 8px 0 .020em,10px 8px 0 .020em,11px 8px 0 .020em #8005c8,12px 8px 0 .020em,13px 8px 0 .020em,14px 8px 0 .020em,15px 8px 0 .020em #d40075,16px 8px 0 .020em #d40075,1px 9px 0 .020em #d40075,2px 9px 0 .020em #d40075,3px 9px 0 .020em,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em #d40075,7px 9px 0 .020em,8px 9px 0 .020em,9px 9px 0 .020em,10px 9px 0 .020em,11px 9px 0 .020em #d40075,12px 9px 0 .020em,13px 9px 0 .020em,14px 9px 0 .020em,15px 9px 0 .020em #d40075,16px 9px 0 .020em #d40075,1px 10px 0 .020em #d40075,2px 10px 0 .020em #d40075,3px 10px 0 .020em,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em #d40075,7px 10px 0 .020em,8px 10px 0 .020em,9px 10px 0 .020em,10px 10px 0 .020em,11px 10px 0 .020em #d40075,12px 10px 0 .020em,13px 10px 0 .020em,14px 10px 0 .020em,15px 10px 0 .020em #d40075,16px 10px 0 .020em #d40075,1px 11px 0 .020em #e98c25,2px 11px 0 .020em #e98c25,3px 11px 0 .020em,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em #d40075,8px 11px 0 .020em #d40075,9px 11px 0 .020em #d40075,10px 11px 0 .020em #d40075,11px 11px 0 .020em,12px 11px 0 .020em,13px 11px 0 .020em,14px 11px 0 .020em,15px 11px 0 .020em #d40075,16px 11px 0 .020em #d40075,1px 12px 0 .020em #e98c25,2px 12px 0 .020em #e98c25,3px 12px 0 .020em,4px 12px 0 .020em,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em,8px 12px 0 .020em,9px 12px 0 .020em,10px 12px 0 .020em,11px 12px 0 .020em,12px 12px 0 .020em,13px 12px 0 .020em,14px 12px 0 .020em,15px 12px 0 .020em #d40075,16px 12px 0 .020em #d40075,1px 13px 0 .020em #e98c25,2px 13px 0 .020em #e98c25,3px 13px 0 .020em,4px 13px 0 .020em,5px 13px 0 .020em,6px 13px 0 .020em,7px 13px 0 .020em,8px 13px 0 .020em,9px 13px 0 .020em,10px 13px 0 .020em,11px 13px 0 .020em,12px 13px 0 .020em,13px 13px 0 .020em,14px 13px 0 .020em,15px 13px 0 .020em #d84646,16px 13px 0 .020em #d84646,1px 14px 0 .020em #e98c25,2px 14px 0 .020em #e98c25,3px 14px 0 .020em #e98c25,4px 14px 0 .020em,5px 14px 0 .020em,6px 14px 0 .020em,7px 14px 0 .020em,8px 14px 0 .020em,9px 14px 0 .020em,10px 14px 0 .020em,11px 14px 0 .020em,12px 14px 0 .020em,13px 14px 0 .020em,14px 14px 0 .020em #d84646,15px 14px 0 .020em #d84646,16px 14px 0 .020em #d84646,2px 15px 0 .020em #e98c25,3px 15px 0 .020em #e98c25,4px 15px 0 .020em #e98c25,5px 15px 0 .020em #e98c25,6px 15px 0 .020em #e98c25,7px 15px 0 .020em #e98c25,8px 15px 0 .020em #e98c25,9px 15px 0 .020em #e98c25,10px 15px 0 .020em #d84646,11px 15px 0 .020em #d84646,12px 15px 0 .020em #d84646,13px 15px 0 .020em #d84646,14px 15px 0 .020em #d84646,15px 15px 0 .020em #d84646,3px 16px 0 .020em #e98c25,4px 16px 0 .020em #e98c25,5px 16px 0 .020em #e98c25,6px 16px 0 .020em #e98c25,7px 16px 0 .020em #e98c25,8px 16px 0 .020em #e98c25,9px 16px 0 .020em #d84646,10px 16px 0 .020em #d84646,11px 16px 0 .020em #d84646,12px 16px 0 .020em #d84646,13px 16px 0 .020em #d84646,14px 16px 0 .020em #d84646}}.nes-icon.coin::before{width:1px;height:1px;color:#ffc107;box-shadow:6px 1px #060606,7px 1px #060606,8px 1px #060606,9px 1px #060606,10px 1px #060606,11px 1px #060606,4px 2px #060606,5px 2px #060606,6px 2px #060606,7px 2px #fff,8px 2px #fff,9px 2px #fff,10px 2px #060606,11px 2px #060606,12px 2px #060606,13px 2px #060606,3px 3px #060606,4px 3px #060606,5px 3px #fff,6px 3px #fff,7px 3px,8px 3px,9px 3px,10px 3px,11px 3px,12px 3px #060606,13px 3px #060606,3px 4px #060606,4px 4px #fff,5px 4px,6px 4px,7px 4px #fff,8px 4px #fff,9px 4px #fff,10px 4px #060606,11px 4px,12px 4px,13px 4px #060606,14px 4px #060606,2px 5px #060606,3px 5px #060606,4px 5px #fff,5px 5px,6px 5px,7px 5px #fff,8px 5px,9px 5px,10px 5px #060606,11px 5px,12px 5px,13px 5px #060606,14px 5px #060606,2px 6px #060606,3px 6px #fff,4px 6px,5px 6px,6px 6px,7px 6px #fff,8px 6px,9px 6px,10px 6px #060606,11px 6px,12px 6px,13px 6px,14px 6px #060606,15px 6px #060606,2px 7px #060606,3px 7px #fff,4px 7px,5px 7px,6px 7px,7px 7px #fff,8px 7px,9px 7px,10px 7px #060606,11px 7px,12px 7px,13px 7px,14px 7px #060606,15px 7px #060606,2px 8px #060606,3px 8px #fff,4px 8px,5px 8px,6px 8px,7px 8px #fff,8px 8px,9px 8px,10px 8px #060606,11px 8px,12px 8px,13px 8px,14px 8px #060606,15px 8px #060606,2px 9px #060606,3px 9px #fff,4px 9px,5px 9px,6px 9px,7px 9px #fff,8px 9px,9px 9px,10px 9px #060606,11px 9px,12px 9px,13px 9px,14px 9px #060606,15px 9px #060606,2px 10px #060606,3px 10px #fff,4px 10px,5px 10px,6px 10px,7px 10px #fff,8px 10px,9px 10px,10px 10px #060606,11px 10px,12px 10px,13px 10px,14px 10px #060606,15px 10px #060606,2px 11px #060606,3px 11px #fff,4px 11px,5px 11px,6px 11px,7px 11px #fff,8px 11px,9px 11px,10px 11px #060606,11px 11px,12px 11px,13px 11px,14px 11px #060606,15px 11px #060606,2px 12px #060606,3px 12px #060606,4px 12px #fff,5px 12px,6px 12px,7px 12px #fff,8px 12px,9px 12px,10px 12px #060606,11px 12px,12px 12px,13px 12px #060606,14px 12px #060606,3px 13px #060606,4px 13px #fff,5px 13px,6px 13px,7px 13px #fff,8px 13px #060606,9px 13px #060606,10px 13px #060606,11px 13px,12px 13px,13px 13px #060606,14px 13px #060606,3px 14px #060606,4px 14px #060606,5px 14px #fff,6px 14px,7px 14px,8px 14px,9px 14px,10px 14px,11px 14px,12px 14px #060606,13px 14px #060606,4px 15px #060606,5px 15px #060606,6px 15px #060606,7px 15px,8px 15px,9px 15px,10px 15px #060606,11px 15px #060606,12px 15px #060606,13px 15px #060606,6px 16px #060606,7px 16px #060606,8px 16px #060606,9px 16px #060606,10px 16px #060606,11px 16px #060606}@supports (-moz-appearance:meterbar){.nes-icon.coin::before{box-shadow:6px 1px 0 .020em #060606,7px 1px 0 .020em #060606,8px 1px 0 .020em #060606,9px 1px 0 .020em #060606,10px 1px 0 .020em #060606,11px 1px 0 .020em #060606,4px 2px 0 .020em #060606,5px 2px 0 .020em #060606,6px 2px 0 .020em #060606,7px 2px 0 .020em #fff,8px 2px 0 .020em #fff,9px 2px 0 .020em #fff,10px 2px 0 .020em #060606,11px 2px 0 .020em #060606,12px 2px 0 .020em #060606,13px 2px 0 .020em #060606,3px 3px 0 .020em #060606,4px 3px 0 .020em #060606,5px 3px 0 .020em #fff,6px 3px 0 .020em #fff,7px 3px 0 .020em,8px 3px 0 .020em,9px 3px 0 .020em,10px 3px 0 .020em,11px 3px 0 .020em,12px 3px 0 .020em #060606,13px 3px 0 .020em #060606,3px 4px 0 .020em #060606,4px 4px 0 .020em #fff,5px 4px 0 .020em,6px 4px 0 .020em,7px 4px 0 .020em #fff,8px 4px 0 .020em #fff,9px 4px 0 .020em #fff,10px 4px 0 .020em #060606,11px 4px 0 .020em,12px 4px 0 .020em,13px 4px 0 .020em #060606,14px 4px 0 .020em #060606,2px 5px 0 .020em #060606,3px 5px 0 .020em #060606,4px 5px 0 .020em #fff,5px 5px 0 .020em,6px 5px 0 .020em,7px 5px 0 .020em #fff,8px 5px 0 .020em,9px 5px 0 .020em,10px 5px 0 .020em #060606,11px 5px 0 .020em,12px 5px 0 .020em,13px 5px 0 .020em #060606,14px 5px 0 .020em #060606,2px 6px 0 .020em #060606,3px 6px 0 .020em #fff,4px 6px 0 .020em,5px 6px 0 .020em,6px 6px 0 .020em,7px 6px 0 .020em #fff,8px 6px 0 .020em,9px 6px 0 .020em,10px 6px 0 .020em #060606,11px 6px 0 .020em,12px 6px 0 .020em,13px 6px 0 .020em,14px 6px 0 .020em #060606,15px 6px 0 .020em #060606,2px 7px 0 .020em #060606,3px 7px 0 .020em #fff,4px 7px 0 .020em,5px 7px 0 .020em,6px 7px 0 .020em,7px 7px 0 .020em #fff,8px 7px 0 .020em,9px 7px 0 .020em,10px 7px 0 .020em #060606,11px 7px 0 .020em,12px 7px 0 .020em,13px 7px 0 .020em,14px 7px 0 .020em #060606,15px 7px 0 .020em #060606,2px 8px 0 .020em #060606,3px 8px 0 .020em #fff,4px 8px 0 .020em,5px 8px 0 .020em,6px 8px 0 .020em,7px 8px 0 .020em #fff,8px 8px 0 .020em,9px 8px 0 .020em,10px 8px 0 .020em #060606,11px 8px 0 .020em,12px 8px 0 .020em,13px 8px 0 .020em,14px 8px 0 .020em #060606,15px 8px 0 .020em #060606,2px 9px 0 .020em #060606,3px 9px 0 .020em #fff,4px 9px 0 .020em,5px 9px 0 .020em,6px 9px 0 .020em,7px 9px 0 .020em #fff,8px 9px 0 .020em,9px 9px 0 .020em,10px 9px 0 .020em #060606,11px 9px 0 .020em,12px 9px 0 .020em,13px 9px 0 .020em,14px 9px 0 .020em #060606,15px 9px 0 .020em #060606,2px 10px 0 .020em #060606,3px 10px 0 .020em #fff,4px 10px 0 .020em,5px 10px 0 .020em,6px 10px 0 .020em,7px 10px 0 .020em #fff,8px 10px 0 .020em,9px 10px 0 .020em,10px 10px 0 .020em #060606,11px 10px 0 .020em,12px 10px 0 .020em,13px 10px 0 .020em,14px 10px 0 .020em #060606,15px 10px 0 .020em #060606,2px 11px 0 .020em #060606,3px 11px 0 .020em #fff,4px 11px 0 .020em,5px 11px 0 .020em,6px 11px 0 .020em,7px 11px 0 .020em #fff,8px 11px 0 .020em,9px 11px 0 .020em,10px 11px 0 .020em #060606,11px 11px 0 .020em,12px 11px 0 .020em,13px 11px 0 .020em,14px 11px 0 .020em #060606,15px 11px 0 .020em #060606,2px 12px 0 .020em #060606,3px 12px 0 .020em #060606,4px 12px 0 .020em #fff,5px 12px 0 .020em,6px 12px 0 .020em,7px 12px 0 .020em #fff,8px 12px 0 .020em,9px 12px 0 .020em,10px 12px 0 .020em #060606,11px 12px 0 .020em,12px 12px 0 .020em,13px 12px 0 .020em #060606,14px 12px 0 .020em #060606,3px 13px 0 .020em #060606,4px 13px 0 .020em #fff,5px 13px 0 .020em,6px 13px 0 .020em,7px 13px 0 .020em #fff,8px 13px 0 .020em #060606,9px 13px 0 .020em #060606,10px 13px 0 .020em #060606,11px 13px 0 .020em,12px 13px 0 .020em,13px 13px 0 .020em #060606,14px 13px 0 .020em #060606,3px 14px 0 .020em #060606,4px 14px 0 .020em #060606,5px 14px 0 .020em #fff,6px 14px 0 .020em,7px 14px 0 .020em,8px 14px 0 .020em,9px 14px 0 .020em,10px 14px 0 .020em,11px 14px 0 .020em,12px 14px 0 .020em #060606,13px 14px 0 .020em #060606,4px 15px 0 .020em #060606,5px 15px 0 .020em #060606,6px 15px 0 .020em #060606,7px 15px 0 .020em,8px 15px 0 .020em,9px 15px 0 .020em,10px 15px 0 .020em #060606,11px 15px 0 .020em #060606,12px 15px 0 .020em #060606,13px 15px 0 .020em #060606,6px 16px 0 .020em #060606,7px 16px 0 .020em #060606,8px 16px 0 .020em #060606,9px 16px 0 .020em #060606,10px 16px 0 .020em #060606,11px 16px 0 .020em #060606}}.nes-logo{position:relative;display:inline-block;width:60px;height:40px}.nes-logo::before{position:absolute;top:-4px;left:-4px;content:"";background:0 0;width:4px;height:4px;color:#3e3634;box-shadow:28px 4px,28px 8px,32px 12px,4px 16px #c3c3c3,8px 16px #c3c3c3,12px 16px #c3c3c3,16px 16px #c3c3c3,20px 16px #c3c3c3,24px 16px #c3c3c3,28px 16px #c3c3c3,32px 16px #c3c3c3,36px 16px #c3c3c3,40px 16px #c3c3c3,44px 16px #c3c3c3,48px 16px #c3c3c3,52px 16px #c3c3c3,56px 16px #c3c3c3,60px 16px #c3c3c3,4px 20px #c3c3c3,8px 20px,12px 20px,16px 20px,20px 20px,24px 20px,28px 20px,32px 20px,36px 20px,40px 20px,44px 20px,48px 20px,52px 20px,56px 20px,60px 20px #c3c3c3,4px 24px #c3c3c3,8px 24px,12px 24px,16px 24px #c3c3c3,20px 24px,24px 24px,28px 24px #787973,32px 24px #787973,36px 24px #787973,40px 24px,44px 24px,48px 24px,52px 24px,56px 24px,60px 24px #c3c3c3,4px 28px #c3c3c3,8px 28px,12px 28px #c3c3c3,16px 28px #c3c3c3,20px 28px #c3c3c3,24px 28px,28px 28px,32px 28px,36px 28px,40px 28px,44px 28px,48px 28px,52px 28px,56px 28px,60px 28px #c3c3c3,4px 32px #c3c3c3,8px 32px,12px 32px,16px 32px #c3c3c3,20px 32px,24px 32px,28px 32px #787973,32px 32px #787973,36px 32px #787973,40px 32px,44px 32px #bf1710,48px 32px,52px 32px #bf1710,56px 32px,60px 32px #c3c3c3,4px 36px #c3c3c3,8px 36px,12px 36px,16px 36px,20px 36px,24px 36px,28px 36px,32px 36px,36px 36px,40px 36px,44px 36px,48px 36px,52px 36px,56px 36px,60px 36px #c3c3c3,4px 40px #c3c3c3,8px 40px #c3c3c3,12px 40px #c3c3c3,16px 40px #c3c3c3,20px 40px #c3c3c3,24px 40px #c3c3c3,28px 40px #c3c3c3,32px 40px #c3c3c3,36px 40px #c3c3c3,40px 40px #c3c3c3,44px 40px #c3c3c3,48px 40px #c3c3c3,52px 40px #c3c3c3,56px 40px #c3c3c3,60px 40px #c3c3c3;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-logo::before{box-shadow:28px 4px 0 .020em,28px 8px 0 .020em,32px 12px 0 .020em,4px 16px 0 .020em #c3c3c3,8px 16px 0 .020em #c3c3c3,12px 16px 0 .020em #c3c3c3,16px 16px 0 .020em #c3c3c3,20px 16px 0 .020em #c3c3c3,24px 16px 0 .020em #c3c3c3,28px 16px 0 .020em #c3c3c3,32px 16px 0 .020em #c3c3c3,36px 16px 0 .020em #c3c3c3,40px 16px 0 .020em #c3c3c3,44px 16px 0 .020em #c3c3c3,48px 16px 0 .020em #c3c3c3,52px 16px 0 .020em #c3c3c3,56px 16px 0 .020em #c3c3c3,60px 16px 0 .020em #c3c3c3,4px 20px 0 .020em #c3c3c3,8px 20px 0 .020em,12px 20px 0 .020em,16px 20px 0 .020em,20px 20px 0 .020em,24px 20px 0 .020em,28px 20px 0 .020em,32px 20px 0 .020em,36px 20px 0 .020em,40px 20px 0 .020em,44px 20px 0 .020em,48px 20px 0 .020em,52px 20px 0 .020em,56px 20px 0 .020em,60px 20px 0 .020em #c3c3c3,4px 24px 0 .020em #c3c3c3,8px 24px 0 .020em,12px 24px 0 .020em,16px 24px 0 .020em #c3c3c3,20px 24px 0 .020em,24px 24px 0 .020em,28px 24px 0 .020em #787973,32px 24px 0 .020em #787973,36px 24px 0 .020em #787973,40px 24px 0 .020em,44px 24px 0 .020em,48px 24px 0 .020em,52px 24px 0 .020em,56px 24px 0 .020em,60px 24px 0 .020em #c3c3c3,4px 28px 0 .020em #c3c3c3,8px 28px 0 .020em,12px 28px 0 .020em #c3c3c3,16px 28px 0 .020em #c3c3c3,20px 28px 0 .020em #c3c3c3,24px 28px 0 .020em,28px 28px 0 .020em,32px 28px 0 .020em,36px 28px 0 .020em,40px 28px 0 .020em,44px 28px 0 .020em,48px 28px 0 .020em,52px 28px 0 .020em,56px 28px 0 .020em,60px 28px 0 .020em #c3c3c3,4px 32px 0 .020em #c3c3c3,8px 32px 0 .020em,12px 32px 0 .020em,16px 32px 0 .020em #c3c3c3,20px 32px 0 .020em,24px 32px 0 .020em,28px 32px 0 .020em #787973,32px 32px 0 .020em #787973,36px 32px 0 .020em #787973,40px 32px 0 .020em,44px 32px 0 .020em #bf1710,48px 32px 0 .020em,52px 32px 0 .020em #bf1710,56px 32px 0 .020em,60px 32px 0 .020em #c3c3c3,4px 36px 0 .020em #c3c3c3,8px 36px 0 .020em,12px 36px 0 .020em,16px 36px 0 .020em,20px 36px 0 .020em,24px 36px 0 .020em,28px 36px 0 .020em,32px 36px 0 .020em,36px 36px 0 .020em,40px 36px 0 .020em,44px 36px 0 .020em,48px 36px 0 .020em,52px 36px 0 .020em,56px 36px 0 .020em,60px 36px 0 .020em #c3c3c3,4px 40px 0 .020em #c3c3c3,8px 40px 0 .020em #c3c3c3,12px 40px 0 .020em #c3c3c3,16px 40px 0 .020em #c3c3c3,20px 40px 0 .020em #c3c3c3,24px 40px 0 .020em #c3c3c3,28px 40px 0 .020em #c3c3c3,32px 40px 0 .020em #c3c3c3,36px 40px 0 .020em #c3c3c3,40px 40px 0 .020em #c3c3c3,44px 40px 0 .020em #c3c3c3,48px 40px 0 .020em #c3c3c3,52px 40px 0 .020em #c3c3c3,56px 40px 0 .020em #c3c3c3,60px 40px 0 .020em #c3c3c3}}.nes-jp-logo{position:relative;display:inline-block;width:60px;height:40px}.nes-jp-logo::before{position:absolute;top:-4px;left:-4px;content:"";background:0 0;width:4px;height:4px;color:#871f37;box-shadow:28px 4px #333,28px 8px #333,32px 12px #333,4px 16px,8px 16px,12px 16px,16px 16px,20px 16px,24px 16px,28px 16px,32px 16px,36px 16px,40px 16px,44px 16px,48px 16px,52px 16px,56px 16px,60px 16px,4px 20px,8px 20px #dfd3b9,12px 20px #dfd3b9,16px 20px #dfd3b9,20px 20px #dfd3b9,24px 20px #dfd3b9,28px 20px,32px 20px,36px 20px,40px 20px,44px 20px,48px 20px,52px 20px,56px 20px,60px 20px,4px 24px,8px 24px #dfd3b9,12px 24px #dfd3b9,16px 24px #333,20px 24px #dfd3b9,24px 24px #dfd3b9,28px 24px,32px 24px,36px 24px,40px 24px,44px 24px,48px 24px,52px 24px,56px 24px,60px 24px,4px 28px,8px 28px #dfd3b9,12px 28px #333,16px 28px #333,20px 28px #333,24px 28px #dfd3b9,28px 28px #dfd3b9,32px 28px #dfd3b9,36px 28px #dfd3b9,40px 28px #dfd3b9,44px 28px #dfd3b9,48px 28px #dfd3b9,52px 28px #dfd3b9,56px 28px #dfd3b9,60px 28px,4px 32px,8px 32px #dfd3b9,12px 32px #dfd3b9,16px 32px #333,20px 32px #dfd3b9,24px 32px #dfd3b9,28px 32px #333,32px 32px,36px 32px #333,40px 32px #dfd3b9,44px 32px #333,48px 32px #dfd3b9,52px 32px #333,56px 32px #dfd3b9,60px 32px,4px 36px,8px 36px #dfd3b9,12px 36px #dfd3b9,16px 36px #dfd3b9,20px 36px #dfd3b9,24px 36px #dfd3b9,28px 36px #dfd3b9,32px 36px #dfd3b9,36px 36px #dfd3b9,40px 36px #dfd3b9,44px 36px #dfd3b9,48px 36px #dfd3b9,52px 36px #dfd3b9,56px 36px #dfd3b9,60px 36px,4px 40px,8px 40px,12px 40px,16px 40px,20px 40px,24px 40px,28px 40px,32px 40px,36px 40px,40px 40px,44px 40px,48px 40px,52px 40px,56px 40px,60px 40px;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-jp-logo::before{box-shadow:28px 4px 0 .020em #333,28px 8px 0 .020em #333,32px 12px 0 .020em #333,4px 16px 0 .020em,8px 16px 0 .020em,12px 16px 0 .020em,16px 16px 0 .020em,20px 16px 0 .020em,24px 16px 0 .020em,28px 16px 0 .020em,32px 16px 0 .020em,36px 16px 0 .020em,40px 16px 0 .020em,44px 16px 0 .020em,48px 16px 0 .020em,52px 16px 0 .020em,56px 16px 0 .020em,60px 16px 0 .020em,4px 20px 0 .020em,8px 20px 0 .020em #dfd3b9,12px 20px 0 .020em #dfd3b9,16px 20px 0 .020em #dfd3b9,20px 20px 0 .020em #dfd3b9,24px 20px 0 .020em #dfd3b9,28px 20px 0 .020em,32px 20px 0 .020em,36px 20px 0 .020em,40px 20px 0 .020em,44px 20px 0 .020em,48px 20px 0 .020em,52px 20px 0 .020em,56px 20px 0 .020em,60px 20px 0 .020em,4px 24px 0 .020em,8px 24px 0 .020em #dfd3b9,12px 24px 0 .020em #dfd3b9,16px 24px 0 .020em #333,20px 24px 0 .020em #dfd3b9,24px 24px 0 .020em #dfd3b9,28px 24px 0 .020em,32px 24px 0 .020em,36px 24px 0 .020em,40px 24px 0 .020em,44px 24px 0 .020em,48px 24px 0 .020em,52px 24px 0 .020em,56px 24px 0 .020em,60px 24px 0 .020em,4px 28px 0 .020em,8px 28px 0 .020em #dfd3b9,12px 28px 0 .020em #333,16px 28px 0 .020em #333,20px 28px 0 .020em #333,24px 28px 0 .020em #dfd3b9,28px 28px 0 .020em #dfd3b9,32px 28px 0 .020em #dfd3b9,36px 28px 0 .020em #dfd3b9,40px 28px 0 .020em #dfd3b9,44px 28px 0 .020em #dfd3b9,48px 28px 0 .020em #dfd3b9,52px 28px 0 .020em #dfd3b9,56px 28px 0 .020em #dfd3b9,60px 28px 0 .020em,4px 32px 0 .020em,8px 32px 0 .020em #dfd3b9,12px 32px 0 .020em #dfd3b9,16px 32px 0 .020em #333,20px 32px 0 .020em #dfd3b9,24px 32px 0 .020em #dfd3b9,28px 32px 0 .020em #333,32px 32px 0 .020em,36px 32px 0 .020em #333,40px 32px 0 .020em #dfd3b9,44px 32px 0 .020em #333,48px 32px 0 .020em #dfd3b9,52px 32px 0 .020em #333,56px 32px 0 .020em #dfd3b9,60px 32px 0 .020em,4px 36px 0 .020em,8px 36px 0 .020em #dfd3b9,12px 36px 0 .020em #dfd3b9,16px 36px 0 .020em #dfd3b9,20px 36px 0 .020em #dfd3b9,24px 36px 0 .020em #dfd3b9,28px 36px 0 .020em #dfd3b9,32px 36px 0 .020em #dfd3b9,36px 36px 0 .020em #dfd3b9,40px 36px 0 .020em #dfd3b9,44px 36px 0 .020em #dfd3b9,48px 36px 0 .020em #dfd3b9,52px 36px 0 .020em #dfd3b9,56px 36px 0 .020em #dfd3b9,60px 36px 0 .020em,4px 40px 0 .020em,8px 40px 0 .020em,12px 40px 0 .020em,16px 40px 0 .020em,20px 40px 0 .020em,24px 40px 0 .020em,28px 40px 0 .020em,32px 40px 0 .020em,36px 40px 0 .020em,40px 40px 0 .020em,44px 40px 0 .020em,48px 40px 0 .020em,52px 40px 0 .020em,56px 40px 0 .020em,60px 40px 0 .020em}}.snes-logo{position:relative;display:inline-block;width:60px;height:40px}.snes-logo::before{position:absolute;top:-4px;left:-4px;content:"";background:0 0;width:4px;height:4px;color:#d7d7d7;box-shadow:28px 4px #333,28px 8px #333,32px 12px #333,12px 16px #333,16px 16px #333,20px 16px #333,24px 16px #333,28px 16px #333,32px 16px #333,36px 16px #333,40px 16px #333,44px 16px #333,48px 16px #333,52px 16px #333,8px 20px #333,12px 20px,16px 20px,20px 20px,24px 20px,28px 20px,32px 20px,36px 20px,40px 20px,44px 20px,48px 20px,52px 20px,56px 20px #333,4px 24px #333,8px 24px,12px 24px,16px 24px #333,20px 24px,24px 24px,28px 24px,32px 24px,36px 24px,40px 24px,44px 24px,48px 24px #ad6df0,52px 24px,56px 24px,60px 24px #333,4px 28px #333,8px 28px,12px 28px #333,16px 28px #333,20px 28px #333,24px 28px,28px 28px,32px 28px,36px 28px,40px 28px,44px 28px #ad6df0,48px 28px,52px 28px #8932e5,56px 28px,60px 28px #333,4px 32px #333,8px 32px,12px 32px,16px 32px #333,20px 32px,24px 32px,28px 32px #333,32px 32px,36px 32px #333,40px 32px,44px 32px,48px 32px #8932e5,52px 32px,56px 32px,60px 32px #333,8px 36px #333,12px 36px,16px 36px,20px 36px,24px 36px,28px 36px,32px 36px,36px 36px,40px 36px,44px 36px,48px 36px,52px 36px,56px 36px #333,12px 40px #333,16px 40px #333,20px 40px #333,24px 40px #333,28px 40px #333,32px 40px #333,36px 40px #333,40px 40px #333,44px 40px #333,48px 40px #333,52px 40px #333;transform:rotate(0)}@supports (-moz-appearance:meterbar){.snes-logo::before{box-shadow:28px 4px 0 .020em #333,28px 8px 0 .020em #333,32px 12px 0 .020em #333,12px 16px 0 .020em #333,16px 16px 0 .020em #333,20px 16px 0 .020em #333,24px 16px 0 .020em #333,28px 16px 0 .020em #333,32px 16px 0 .020em #333,36px 16px 0 .020em #333,40px 16px 0 .020em #333,44px 16px 0 .020em #333,48px 16px 0 .020em #333,52px 16px 0 .020em #333,8px 20px 0 .020em #333,12px 20px 0 .020em,16px 20px 0 .020em,20px 20px 0 .020em,24px 20px 0 .020em,28px 20px 0 .020em,32px 20px 0 .020em,36px 20px 0 .020em,40px 20px 0 .020em,44px 20px 0 .020em,48px 20px 0 .020em,52px 20px 0 .020em,56px 20px 0 .020em #333,4px 24px 0 .020em #333,8px 24px 0 .020em,12px 24px 0 .020em,16px 24px 0 .020em #333,20px 24px 0 .020em,24px 24px 0 .020em,28px 24px 0 .020em,32px 24px 0 .020em,36px 24px 0 .020em,40px 24px 0 .020em,44px 24px 0 .020em,48px 24px 0 .020em #ad6df0,52px 24px 0 .020em,56px 24px 0 .020em,60px 24px 0 .020em #333,4px 28px 0 .020em #333,8px 28px 0 .020em,12px 28px 0 .020em #333,16px 28px 0 .020em #333,20px 28px 0 .020em #333,24px 28px 0 .020em,28px 28px 0 .020em,32px 28px 0 .020em,36px 28px 0 .020em,40px 28px 0 .020em,44px 28px 0 .020em #ad6df0,48px 28px 0 .020em,52px 28px 0 .020em #8932e5,56px 28px 0 .020em,60px 28px 0 .020em #333,4px 32px 0 .020em #333,8px 32px 0 .020em,12px 32px 0 .020em,16px 32px 0 .020em #333,20px 32px 0 .020em,24px 32px 0 .020em,28px 32px 0 .020em #333,32px 32px 0 .020em,36px 32px 0 .020em #333,40px 32px 0 .020em,44px 32px 0 .020em,48px 32px 0 .020em #8932e5,52px 32px 0 .020em,56px 32px 0 .020em,60px 32px 0 .020em #333,8px 36px 0 .020em #333,12px 36px 0 .020em,16px 36px 0 .020em,20px 36px 0 .020em,24px 36px 0 .020em,28px 36px 0 .020em,32px 36px 0 .020em,36px 36px 0 .020em,40px 36px 0 .020em,44px 36px 0 .020em,48px 36px 0 .020em,52px 36px 0 .020em,56px 36px 0 .020em #333,12px 40px 0 .020em #333,16px 40px 0 .020em #333,20px 40px 0 .020em #333,24px 40px 0 .020em #333,28px 40px 0 .020em #333,32px 40px 0 .020em #333,36px 40px 0 .020em #333,40px 40px 0 .020em #333,44px 40px 0 .020em #333,48px 40px 0 .020em #333,52px 40px 0 .020em #333}}.snes-jp-logo{position:relative;display:inline-block;width:60px;height:40px}.snes-jp-logo::before{position:absolute;top:-4px;left:-4px;content:"";background:0 0;width:4px;height:4px;color:#d7d7d7;box-shadow:28px 4px #333,28px 8px #333,32px 12px #333,12px 16px #333,16px 16px #333,20px 16px #333,24px 16px #333,28px 16px #333,32px 16px #333,36px 16px #333,40px 16px #333,44px 16px #333,48px 16px #333,52px 16px #333,8px 20px #333,12px 20px,16px 20px,20px 20px,24px 20px,28px 20px,32px 20px,36px 20px,40px 20px,44px 20px,48px 20px,52px 20px,56px 20px #333,4px 24px #333,8px 24px,12px 24px,16px 24px #333,20px 24px,24px 24px,28px 24px,32px 24px,36px 24px,40px 24px,44px 24px,48px 24px #999cf7,52px 24px,56px 24px,60px 24px #333,4px 28px #333,8px 28px,12px 28px #333,16px 28px #333,20px 28px #333,24px 28px,28px 28px,32px 28px,36px 28px,40px 28px,44px 28px #7dbb78,48px 28px,52px 28px #f40500,56px 28px,60px 28px #333,4px 32px #333,8px 32px,12px 32px,16px 32px #333,20px 32px,24px 32px,28px 32px #333,32px 32px,36px 32px #333,40px 32px,44px 32px,48px 32px #f6f504,52px 32px,56px 32px,60px 32px #333,8px 36px #333,12px 36px,16px 36px,20px 36px,24px 36px,28px 36px,32px 36px,36px 36px,40px 36px,44px 36px,48px 36px,52px 36px,56px 36px #333,12px 40px #333,16px 40px #333,20px 40px #333,24px 40px #333,28px 40px #333,32px 40px #333,36px 40px #333,40px 40px #333,44px 40px #333,48px 40px #333,52px 40px #333;transform:rotate(0)}@supports (-moz-appearance:meterbar){.snes-jp-logo::before{box-shadow:28px 4px 0 .020em #333,28px 8px 0 .020em #333,32px 12px 0 .020em #333,12px 16px 0 .020em #333,16px 16px 0 .020em #333,20px 16px 0 .020em #333,24px 16px 0 .020em #333,28px 16px 0 .020em #333,32px 16px 0 .020em #333,36px 16px 0 .020em #333,40px 16px 0 .020em #333,44px 16px 0 .020em #333,48px 16px 0 .020em #333,52px 16px 0 .020em #333,8px 20px 0 .020em #333,12px 20px 0 .020em,16px 20px 0 .020em,20px 20px 0 .020em,24px 20px 0 .020em,28px 20px 0 .020em,32px 20px 0 .020em,36px 20px 0 .020em,40px 20px 0 .020em,44px 20px 0 .020em,48px 20px 0 .020em,52px 20px 0 .020em,56px 20px 0 .020em #333,4px 24px 0 .020em #333,8px 24px 0 .020em,12px 24px 0 .020em,16px 24px 0 .020em #333,20px 24px 0 .020em,24px 24px 0 .020em,28px 24px 0 .020em,32px 24px 0 .020em,36px 24px 0 .020em,40px 24px 0 .020em,44px 24px 0 .020em,48px 24px 0 .020em #999cf7,52px 24px 0 .020em,56px 24px 0 .020em,60px 24px 0 .020em #333,4px 28px 0 .020em #333,8px 28px 0 .020em,12px 28px 0 .020em #333,16px 28px 0 .020em #333,20px 28px 0 .020em #333,24px 28px 0 .020em,28px 28px 0 .020em,32px 28px 0 .020em,36px 28px 0 .020em,40px 28px 0 .020em,44px 28px 0 .020em #7dbb78,48px 28px 0 .020em,52px 28px 0 .020em #f40500,56px 28px 0 .020em,60px 28px 0 .020em #333,4px 32px 0 .020em #333,8px 32px 0 .020em,12px 32px 0 .020em,16px 32px 0 .020em #333,20px 32px 0 .020em,24px 32px 0 .020em,28px 32px 0 .020em #333,32px 32px 0 .020em,36px 32px 0 .020em #333,40px 32px 0 .020em,44px 32px 0 .020em,48px 32px 0 .020em #f6f504,52px 32px 0 .020em,56px 32px 0 .020em,60px 32px 0 .020em #333,8px 36px 0 .020em #333,12px 36px 0 .020em,16px 36px 0 .020em,20px 36px 0 .020em,24px 36px 0 .020em,28px 36px 0 .020em,32px 36px 0 .020em,36px 36px 0 .020em,40px 36px 0 .020em,44px 36px 0 .020em,48px 36px 0 .020em,52px 36px 0 .020em,56px 36px 0 .020em #333,12px 40px 0 .020em #333,16px 40px 0 .020em #333,20px 40px 0 .020em #333,24px 40px 0 .020em #333,28px 40px 0 .020em #333,32px 40px 0 .020em #333,36px 40px 0 .020em #333,40px 40px 0 .020em #333,44px 40px 0 .020em #333,48px 40px 0 .020em #333,52px 40px 0 .020em #333}}.nes-bcrikko{position:relative;display:inline-block;width:96px;height:96px}.nes-bcrikko::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#f9f2d7;box-shadow:12px 6px,18px 6px,24px 6px,30px 6px,36px 6px,42px 6px,48px 6px,54px 6px,60px 6px,66px 6px,72px 6px,78px 6px,84px 6px,90px 6px,6px 12px,12px 12px,18px 12px,24px 12px,30px 12px,36px 12px,42px 12px,48px 12px,54px 12px,60px 12px,66px 12px,72px 12px,78px 12px,84px 12px,90px 12px,96px 12px,6px 18px,12px 18px,18px 18px,24px 18px,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px,66px 18px,72px 18px,78px 18px,84px 18px,90px 18px,96px 18px,6px 24px,12px 24px,18px 24px,24px 24px,30px 24px #333,36px 24px #333,42px 24px,48px 24px,54px 24px,60px 24px,66px 24px #333,72px 24px #333,78px 24px,84px 24px,90px 24px,96px 24px,6px 30px,12px 30px,18px 30px,24px 30px #333,30px 30px #333,36px 30px #fff,42px 30px #333,48px 30px,54px 30px,60px 30px #333,66px 30px #333,72px 30px #fff,78px 30px #333,84px 30px,90px 30px,96px 30px,6px 36px,12px 36px,18px 36px,24px 36px #333,30px 36px #333,36px 36px #333,42px 36px #333,48px 36px,54px 36px,60px 36px #333,66px 36px #333,72px 36px #333,78px 36px #333,84px 36px,90px 36px,96px 36px,6px 42px,12px 42px,18px 42px,24px 42px #333,30px 42px #333,36px 42px #333,42px 42px #333,48px 42px,54px 42px,60px 42px #333,66px 42px #333,72px 42px #333,78px 42px #333,84px 42px,90px 42px,96px 42px,6px 48px,12px 48px,18px 48px,24px 48px #333,30px 48px #333,36px 48px #333,42px 48px #333,48px 48px,54px 48px,60px 48px #333,66px 48px #333,72px 48px #333,78px 48px #333,84px 48px,90px 48px,96px 48px,6px 54px,12px 54px,18px 54px,24px 54px,30px 54px #333,36px 54px #333,42px 54px,48px 54px,54px 54px,60px 54px,66px 54px #333,72px 54px #333,78px 54px,84px 54px,90px 54px,96px 54px,6px 60px,12px 60px,18px 60px,24px 60px,30px 60px,36px 60px,42px 60px,48px 60px,54px 60px,60px 60px,66px 60px,72px 60px,78px 60px,84px 60px,90px 60px,96px 60px,6px 66px,12px 66px,18px 66px,24px 66px,30px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,66px 66px,72px 66px,78px 66px,84px 66px,90px 66px,96px 66px,6px 72px,12px 72px,18px 72px,24px 72px #c5090c,30px 72px,36px 72px,42px 72px,48px 72px,54px 72px,60px 72px,66px 72px,72px 72px,78px 72px #c5090c,84px 72px,90px 72px,96px 72px,6px 78px,12px 78px,18px 78px,24px 78px #c5090c,30px 78px,36px 78px,42px 78px,48px 78px,54px 78px,60px 78px,66px 78px,72px 78px,78px 78px #c5090c,84px 78px,90px 78px,96px 78px,6px 84px,12px 84px,18px 84px,24px 84px,30px 84px #c5090c,36px 84px #c5090c,42px 84px #c5090c,48px 84px #c5090c,54px 84px #c5090c,60px 84px #c5090c,66px 84px #c5090c,72px 84px #c5090c,78px 84px,84px 84px,90px 84px,96px 84px,6px 90px,12px 90px,18px 90px,24px 90px,30px 90px,36px 90px,42px 90px,48px 90px,54px 90px,60px 90px,66px 90px,72px 90px,78px 90px,84px 90px,90px 90px,96px 90px,12px 96px,18px 96px,24px 96px,30px 96px,36px 96px,42px 96px,48px 96px,54px 96px,60px 96px,66px 96px,72px 96px,78px 96px,84px 96px,90px 96px;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-bcrikko::before{box-shadow:12px 6px 0 .020em,18px 6px 0 .020em,24px 6px 0 .020em,30px 6px 0 .020em,36px 6px 0 .020em,42px 6px 0 .020em,48px 6px 0 .020em,54px 6px 0 .020em,60px 6px 0 .020em,66px 6px 0 .020em,72px 6px 0 .020em,78px 6px 0 .020em,84px 6px 0 .020em,90px 6px 0 .020em,6px 12px 0 .020em,12px 12px 0 .020em,18px 12px 0 .020em,24px 12px 0 .020em,30px 12px 0 .020em,36px 12px 0 .020em,42px 12px 0 .020em,48px 12px 0 .020em,54px 12px 0 .020em,60px 12px 0 .020em,66px 12px 0 .020em,72px 12px 0 .020em,78px 12px 0 .020em,84px 12px 0 .020em,90px 12px 0 .020em,96px 12px 0 .020em,6px 18px 0 .020em,12px 18px 0 .020em,18px 18px 0 .020em,24px 18px 0 .020em,30px 18px 0 .020em,36px 18px 0 .020em,42px 18px 0 .020em,48px 18px 0 .020em,54px 18px 0 .020em,60px 18px 0 .020em,66px 18px 0 .020em,72px 18px 0 .020em,78px 18px 0 .020em,84px 18px 0 .020em,90px 18px 0 .020em,96px 18px 0 .020em,6px 24px 0 .020em,12px 24px 0 .020em,18px 24px 0 .020em,24px 24px 0 .020em,30px 24px 0 .020em #333,36px 24px 0 .020em #333,42px 24px 0 .020em,48px 24px 0 .020em,54px 24px 0 .020em,60px 24px 0 .020em,66px 24px 0 .020em #333,72px 24px 0 .020em #333,78px 24px 0 .020em,84px 24px 0 .020em,90px 24px 0 .020em,96px 24px 0 .020em,6px 30px 0 .020em,12px 30px 0 .020em,18px 30px 0 .020em,24px 30px 0 .020em #333,30px 30px 0 .020em #333,36px 30px 0 .020em #fff,42px 30px 0 .020em #333,48px 30px 0 .020em,54px 30px 0 .020em,60px 30px 0 .020em #333,66px 30px 0 .020em #333,72px 30px 0 .020em #fff,78px 30px 0 .020em #333,84px 30px 0 .020em,90px 30px 0 .020em,96px 30px 0 .020em,6px 36px 0 .020em,12px 36px 0 .020em,18px 36px 0 .020em,24px 36px 0 .020em #333,30px 36px 0 .020em #333,36px 36px 0 .020em #333,42px 36px 0 .020em #333,48px 36px 0 .020em,54px 36px 0 .020em,60px 36px 0 .020em #333,66px 36px 0 .020em #333,72px 36px 0 .020em #333,78px 36px 0 .020em #333,84px 36px 0 .020em,90px 36px 0 .020em,96px 36px 0 .020em,6px 42px 0 .020em,12px 42px 0 .020em,18px 42px 0 .020em,24px 42px 0 .020em #333,30px 42px 0 .020em #333,36px 42px 0 .020em #333,42px 42px 0 .020em #333,48px 42px 0 .020em,54px 42px 0 .020em,60px 42px 0 .020em #333,66px 42px 0 .020em #333,72px 42px 0 .020em #333,78px 42px 0 .020em #333,84px 42px 0 .020em,90px 42px 0 .020em,96px 42px 0 .020em,6px 48px 0 .020em,12px 48px 0 .020em,18px 48px 0 .020em,24px 48px 0 .020em #333,30px 48px 0 .020em #333,36px 48px 0 .020em #333,42px 48px 0 .020em #333,48px 48px 0 .020em,54px 48px 0 .020em,60px 48px 0 .020em #333,66px 48px 0 .020em #333,72px 48px 0 .020em #333,78px 48px 0 .020em #333,84px 48px 0 .020em,90px 48px 0 .020em,96px 48px 0 .020em,6px 54px 0 .020em,12px 54px 0 .020em,18px 54px 0 .020em,24px 54px 0 .020em,30px 54px 0 .020em #333,36px 54px 0 .020em #333,42px 54px 0 .020em,48px 54px 0 .020em,54px 54px 0 .020em,60px 54px 0 .020em,66px 54px 0 .020em #333,72px 54px 0 .020em #333,78px 54px 0 .020em,84px 54px 0 .020em,90px 54px 0 .020em,96px 54px 0 .020em,6px 60px 0 .020em,12px 60px 0 .020em,18px 60px 0 .020em,24px 60px 0 .020em,30px 60px 0 .020em,36px 60px 0 .020em,42px 60px 0 .020em,48px 60px 0 .020em,54px 60px 0 .020em,60px 60px 0 .020em,66px 60px 0 .020em,72px 60px 0 .020em,78px 60px 0 .020em,84px 60px 0 .020em,90px 60px 0 .020em,96px 60px 0 .020em,6px 66px 0 .020em,12px 66px 0 .020em,18px 66px 0 .020em,24px 66px 0 .020em,30px 66px 0 .020em,36px 66px 0 .020em,42px 66px 0 .020em,48px 66px 0 .020em,54px 66px 0 .020em,60px 66px 0 .020em,66px 66px 0 .020em,72px 66px 0 .020em,78px 66px 0 .020em,84px 66px 0 .020em,90px 66px 0 .020em,96px 66px 0 .020em,6px 72px 0 .020em,12px 72px 0 .020em,18px 72px 0 .020em,24px 72px 0 .020em #c5090c,30px 72px 0 .020em,36px 72px 0 .020em,42px 72px 0 .020em,48px 72px 0 .020em,54px 72px 0 .020em,60px 72px 0 .020em,66px 72px 0 .020em,72px 72px 0 .020em,78px 72px 0 .020em #c5090c,84px 72px 0 .020em,90px 72px 0 .020em,96px 72px 0 .020em,6px 78px 0 .020em,12px 78px 0 .020em,18px 78px 0 .020em,24px 78px 0 .020em #c5090c,30px 78px 0 .020em,36px 78px 0 .020em,42px 78px 0 .020em,48px 78px 0 .020em,54px 78px 0 .020em,60px 78px 0 .020em,66px 78px 0 .020em,72px 78px 0 .020em,78px 78px 0 .020em #c5090c,84px 78px 0 .020em,90px 78px 0 .020em,96px 78px 0 .020em,6px 84px 0 .020em,12px 84px 0 .020em,18px 84px 0 .020em,24px 84px 0 .020em,30px 84px 0 .020em #c5090c,36px 84px 0 .020em #c5090c,42px 84px 0 .020em #c5090c,48px 84px 0 .020em #c5090c,54px 84px 0 .020em #c5090c,60px 84px 0 .020em #c5090c,66px 84px 0 .020em #c5090c,72px 84px 0 .020em #c5090c,78px 84px 0 .020em,84px 84px 0 .020em,90px 84px 0 .020em,96px 84px 0 .020em,6px 90px 0 .020em,12px 90px 0 .020em,18px 90px 0 .020em,24px 90px 0 .020em,30px 90px 0 .020em,36px 90px 0 .020em,42px 90px 0 .020em,48px 90px 0 .020em,54px 90px 0 .020em,60px 90px 0 .020em,66px 90px 0 .020em,72px 90px 0 .020em,78px 90px 0 .020em,84px 90px 0 .020em,90px 90px 0 .020em,96px 90px 0 .020em,12px 96px 0 .020em,18px 96px 0 .020em,24px 96px 0 .020em,30px 96px 0 .020em,36px 96px 0 .020em,42px 96px 0 .020em,48px 96px 0 .020em,54px 96px 0 .020em,60px 96px 0 .020em,66px 96px 0 .020em,72px 96px 0 .020em,78px 96px 0 .020em,84px 96px 0 .020em,90px 96px 0 .020em}}.nes-ash{position:relative;display:inline-block;width:84px;height:90px}.nes-ash::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#181818;box-shadow:30px 6px,36px 6px,42px 6px,48px 6px,54px 6px,60px 6px,24px 12px,30px 12px #ff614e,36px 12px #ff614e,42px 12px #ff614e,48px 12px #f8f8ff,54px 12px #f8f8ff,60px 12px #007f7f,66px 12px,18px 18px,24px 18px #ff614e,30px 18px #ff614e,36px 18px #ff614e,42px 18px #ff614e,48px 18px #f8f8ff,54px 18px #f8f8ff,60px 18px #f8f8ff,66px 18px #f8f8ff,72px 18px,18px 24px,24px 24px #ff614e,30px 24px #ff614e,36px 24px #ff614e,42px 24px #ff614e,48px 24px #f8f8ff,54px 24px #f8f8ff,60px 24px #007f7f,66px 24px #007f7f,72px 24px,78px 24px,12px 30px,18px 30px,24px 30px,30px 30px #ff614e,36px 30px #ff614e,42px 30px #ff614e,48px 30px #ff614e,54px 30px #ff614e,60px 30px #ff614e,66px 30px #ff614e,72px 30px #ff614e,78px 30px #ff614e,84px 30px,12px 36px,18px 36px,24px 36px,30px 36px,36px 36px,42px 36px,48px 36px,54px 36px #ff614e,60px 36px #ff614e,66px 36px #ff614e,72px 36px,78px 36px,6px 42px,12px 42px,18px 42px,24px 42px,30px 42px,36px 42px,42px 42px,48px 42px #ffe3c5,54px 42px #ffe3c5,60px 42px,66px 42px #ffe3c5,72px 42px,12px 48px,18px 48px,24px 48px #ffe3c5,30px 48px #ffe3c5,36px 48px #ffe3c5,42px 48px,48px 48px #ffe3c5,54px 48px #ffe3c5,60px 48px,66px 48px #ffe3c5,72px 48px,18px 54px,24px 54px #ffe3c5,30px 54px #ffe3c5,36px 54px #ffe3c5,42px 54px #ffe3c5,48px 54px #ffe3c5,54px 54px #ffe3c5,60px 54px #ffe3c5,66px 54px #ffe3c5,72px 54px,12px 60px,18px 60px #4169e1,24px 60px,30px 60px,36px 60px #ffe3c5,42px 60px #ffe3c5,48px 60px #ffe3c5,54px 60px #ffe3c5,60px 60px #ffe3c5,66px 60px,12px 66px,18px 66px #4169e1,24px 66px,30px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,12px 72px,18px 72px,24px 72px #ffe3c5,30px 72px #ffe3c5,36px 72px,42px 72px #4169e1,48px 72px #4169e1,54px 72px,60px 72px,66px 72px,6px 78px,12px 78px #007f7f,18px 78px,24px 78px #ffe3c5,30px 78px #ffe3c5,36px 78px,42px 78px #4169e1,48px 78px,54px 78px,60px 78px #007f7f,66px 78px #007f7f,72px 78px,6px 84px,12px 84px #007f7f,18px 84px #007f7f,24px 84px,30px 84px,36px 84px,42px 84px,48px 84px,54px 84px #007f7f,60px 84px #007f7f,66px 84px,12px 90px,18px 90px,54px 90px,60px 90px;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-ash::before{box-shadow:30px 6px 0 .020em,36px 6px 0 .020em,42px 6px 0 .020em,48px 6px 0 .020em,54px 6px 0 .020em,60px 6px 0 .020em,24px 12px 0 .020em,30px 12px 0 .020em #ff614e,36px 12px 0 .020em #ff614e,42px 12px 0 .020em #ff614e,48px 12px 0 .020em #f8f8ff,54px 12px 0 .020em #f8f8ff,60px 12px 0 .020em #007f7f,66px 12px 0 .020em,18px 18px 0 .020em,24px 18px 0 .020em #ff614e,30px 18px 0 .020em #ff614e,36px 18px 0 .020em #ff614e,42px 18px 0 .020em #ff614e,48px 18px 0 .020em #f8f8ff,54px 18px 0 .020em #f8f8ff,60px 18px 0 .020em #f8f8ff,66px 18px 0 .020em #f8f8ff,72px 18px 0 .020em,18px 24px 0 .020em,24px 24px 0 .020em #ff614e,30px 24px 0 .020em #ff614e,36px 24px 0 .020em #ff614e,42px 24px 0 .020em #ff614e,48px 24px 0 .020em #f8f8ff,54px 24px 0 .020em #f8f8ff,60px 24px 0 .020em #007f7f,66px 24px 0 .020em #007f7f,72px 24px 0 .020em,78px 24px 0 .020em,12px 30px 0 .020em,18px 30px 0 .020em,24px 30px 0 .020em,30px 30px 0 .020em #ff614e,36px 30px 0 .020em #ff614e,42px 30px 0 .020em #ff614e,48px 30px 0 .020em #ff614e,54px 30px 0 .020em #ff614e,60px 30px 0 .020em #ff614e,66px 30px 0 .020em #ff614e,72px 30px 0 .020em #ff614e,78px 30px 0 .020em #ff614e,84px 30px 0 .020em,12px 36px 0 .020em,18px 36px 0 .020em,24px 36px 0 .020em,30px 36px 0 .020em,36px 36px 0 .020em,42px 36px 0 .020em,48px 36px 0 .020em,54px 36px 0 .020em #ff614e,60px 36px 0 .020em #ff614e,66px 36px 0 .020em #ff614e,72px 36px 0 .020em,78px 36px 0 .020em,6px 42px 0 .020em,12px 42px 0 .020em,18px 42px 0 .020em,24px 42px 0 .020em,30px 42px 0 .020em,36px 42px 0 .020em,42px 42px 0 .020em,48px 42px 0 .020em #ffe3c5,54px 42px 0 .020em #ffe3c5,60px 42px 0 .020em,66px 42px 0 .020em #ffe3c5,72px 42px 0 .020em,12px 48px 0 .020em,18px 48px 0 .020em,24px 48px 0 .020em #ffe3c5,30px 48px 0 .020em #ffe3c5,36px 48px 0 .020em #ffe3c5,42px 48px 0 .020em,48px 48px 0 .020em #ffe3c5,54px 48px 0 .020em #ffe3c5,60px 48px 0 .020em,66px 48px 0 .020em #ffe3c5,72px 48px 0 .020em,18px 54px 0 .020em,24px 54px 0 .020em #ffe3c5,30px 54px 0 .020em #ffe3c5,36px 54px 0 .020em #ffe3c5,42px 54px 0 .020em #ffe3c5,48px 54px 0 .020em #ffe3c5,54px 54px 0 .020em #ffe3c5,60px 54px 0 .020em #ffe3c5,66px 54px 0 .020em #ffe3c5,72px 54px 0 .020em,12px 60px 0 .020em,18px 60px 0 .020em #4169e1,24px 60px 0 .020em,30px 60px 0 .020em,36px 60px 0 .020em #ffe3c5,42px 60px 0 .020em #ffe3c5,48px 60px 0 .020em #ffe3c5,54px 60px 0 .020em #ffe3c5,60px 60px 0 .020em #ffe3c5,66px 60px 0 .020em,12px 66px 0 .020em,18px 66px 0 .020em #4169e1,24px 66px 0 .020em,30px 66px 0 .020em,36px 66px 0 .020em,42px 66px 0 .020em,48px 66px 0 .020em,54px 66px 0 .020em,60px 66px 0 .020em,12px 72px 0 .020em,18px 72px 0 .020em,24px 72px 0 .020em #ffe3c5,30px 72px 0 .020em #ffe3c5,36px 72px 0 .020em,42px 72px 0 .020em #4169e1,48px 72px 0 .020em #4169e1,54px 72px 0 .020em,60px 72px 0 .020em,66px 72px 0 .020em,6px 78px 0 .020em,12px 78px 0 .020em #007f7f,18px 78px 0 .020em,24px 78px 0 .020em #ffe3c5,30px 78px 0 .020em #ffe3c5,36px 78px 0 .020em,42px 78px 0 .020em #4169e1,48px 78px 0 .020em,54px 78px 0 .020em,60px 78px 0 .020em #007f7f,66px 78px 0 .020em #007f7f,72px 78px 0 .020em,6px 84px 0 .020em,12px 84px 0 .020em #007f7f,18px 84px 0 .020em #007f7f,24px 84px 0 .020em,30px 84px 0 .020em,36px 84px 0 .020em,42px 84px 0 .020em,48px 84px 0 .020em,54px 84px 0 .020em #007f7f,60px 84px 0 .020em #007f7f,66px 84px 0 .020em,12px 90px 0 .020em,18px 90px 0 .020em,54px 90px 0 .020em,60px 90px 0 .020em}}.nes-pokeball{position:relative;display:inline-block;width:84px;height:84px}.nes-pokeball::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#060606;box-shadow:36px 6px,42px 6px,48px 6px,54px 6px,24px 12px,30px 12px,36px 12px #ff001d,42px 12px #ff001d,48px 12px #ff001d,54px 12px #ff001d,60px 12px,66px 12px,18px 18px,24px 18px #fff,30px 18px #fff,36px 18px #ff001d,42px 18px #ff001d,48px 18px #ff001d,54px 18px #ff001d,60px 18px #ff001d,66px 18px #ff001d,72px 18px,12px 24px,18px 24px #fff,24px 24px #fff,30px 24px #ff001d,36px 24px #ff001d,42px 24px #ff001d,48px 24px #ff001d,54px 24px #ff001d,60px 24px #ff001d,66px 24px #ff001d,72px 24px,78px 24px,12px 30px,18px 30px #fff,24px 30px #ff001d,30px 30px #ff001d,36px 30px #ff001d,42px 30px #ff001d,48px 30px #ff001d,54px 30px #ff001d,60px 30px #ff001d,66px 30px #ff001d,72px 30px #ff001d,78px 30px,6px 36px,12px 36px #fff,18px 36px #ff001d,24px 36px #ff001d,30px 36px #ff001d,36px 36px #ff001d,42px 36px #ff001d,48px 36px #ff001d,54px 36px #ff001d,60px 36px #ff001d,66px 36px #ff001d,72px 36px #ff001d,78px 36px #ff001d,84px 36px,6px 42px,12px 42px,18px 42px,24px 42px #ff001d,30px 42px #ff001d,36px 42px #ff001d,42px 42px #ff001d,48px 42px,54px 42px,60px 42px,66px 42px #ff001d,72px 42px #ff001d,78px 42px #ff001d,84px 42px,6px 48px,12px 48px,18px 48px,24px 48px,30px 48px #ff001d,36px 48px #ff001d,42px 48px,48px 48px #fff,54px 48px #fff,60px 48px #fff,66px 48px,72px 48px #ff001d,78px 48px #ff001d,84px 48px,6px 54px,12px 54px #9fa1a1,18px 54px #fff,24px 54px,30px 54px,36px 54px,42px 54px,48px 54px #fff,54px 54px #fff,60px 54px #fff,66px 54px,72px 54px,78px 54px,84px 54px,12px 60px,18px 60px #fff,24px 60px #fff,30px 60px #fff,36px 60px,42px 60px,48px 60px #fff,54px 60px #fff,60px 60px #fff,66px 60px,72px 60px #fff,78px 60px,12px 66px,18px 66px #fff,24px 66px #fff,30px 66px #fff,36px 66px #fff,42px 66px #fff,48px 66px,54px 66px,60px 66px,66px 66px #fff,72px 66px #fff,78px 66px,18px 72px,24px 72px #9fa1a1,30px 72px #9fa1a1,36px 72px #fff,42px 72px #fff,48px 72px #fff,54px 72px #fff,60px 72px #fff,66px 72px #fff,72px 72px,24px 78px,30px 78px,36px 78px #9fa1a1,42px 78px #9fa1a1,48px 78px #9fa1a1,54px 78px #9fa1a1,60px 78px,66px 78px,36px 84px,42px 84px,48px 84px,54px 84px;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-pokeball::before{box-shadow:36px 6px 0 .020em,42px 6px 0 .020em,48px 6px 0 .020em,54px 6px 0 .020em,24px 12px 0 .020em,30px 12px 0 .020em,36px 12px 0 .020em #ff001d,42px 12px 0 .020em #ff001d,48px 12px 0 .020em #ff001d,54px 12px 0 .020em #ff001d,60px 12px 0 .020em,66px 12px 0 .020em,18px 18px 0 .020em,24px 18px 0 .020em #fff,30px 18px 0 .020em #fff,36px 18px 0 .020em #ff001d,42px 18px 0 .020em #ff001d,48px 18px 0 .020em #ff001d,54px 18px 0 .020em #ff001d,60px 18px 0 .020em #ff001d,66px 18px 0 .020em #ff001d,72px 18px 0 .020em,12px 24px 0 .020em,18px 24px 0 .020em #fff,24px 24px 0 .020em #fff,30px 24px 0 .020em #ff001d,36px 24px 0 .020em #ff001d,42px 24px 0 .020em #ff001d,48px 24px 0 .020em #ff001d,54px 24px 0 .020em #ff001d,60px 24px 0 .020em #ff001d,66px 24px 0 .020em #ff001d,72px 24px 0 .020em,78px 24px 0 .020em,12px 30px 0 .020em,18px 30px 0 .020em #fff,24px 30px 0 .020em #ff001d,30px 30px 0 .020em #ff001d,36px 30px 0 .020em #ff001d,42px 30px 0 .020em #ff001d,48px 30px 0 .020em #ff001d,54px 30px 0 .020em #ff001d,60px 30px 0 .020em #ff001d,66px 30px 0 .020em #ff001d,72px 30px 0 .020em #ff001d,78px 30px 0 .020em,6px 36px 0 .020em,12px 36px 0 .020em #fff,18px 36px 0 .020em #ff001d,24px 36px 0 .020em #ff001d,30px 36px 0 .020em #ff001d,36px 36px 0 .020em #ff001d,42px 36px 0 .020em #ff001d,48px 36px 0 .020em #ff001d,54px 36px 0 .020em #ff001d,60px 36px 0 .020em #ff001d,66px 36px 0 .020em #ff001d,72px 36px 0 .020em #ff001d,78px 36px 0 .020em #ff001d,84px 36px 0 .020em,6px 42px 0 .020em,12px 42px 0 .020em,18px 42px 0 .020em,24px 42px 0 .020em #ff001d,30px 42px 0 .020em #ff001d,36px 42px 0 .020em #ff001d,42px 42px 0 .020em #ff001d,48px 42px 0 .020em,54px 42px 0 .020em,60px 42px 0 .020em,66px 42px 0 .020em #ff001d,72px 42px 0 .020em #ff001d,78px 42px 0 .020em #ff001d,84px 42px 0 .020em,6px 48px 0 .020em,12px 48px 0 .020em,18px 48px 0 .020em,24px 48px 0 .020em,30px 48px 0 .020em #ff001d,36px 48px 0 .020em #ff001d,42px 48px 0 .020em,48px 48px 0 .020em #fff,54px 48px 0 .020em #fff,60px 48px 0 .020em #fff,66px 48px 0 .020em,72px 48px 0 .020em #ff001d,78px 48px 0 .020em #ff001d,84px 48px 0 .020em,6px 54px 0 .020em,12px 54px 0 .020em #9fa1a1,18px 54px 0 .020em #fff,24px 54px 0 .020em,30px 54px 0 .020em,36px 54px 0 .020em,42px 54px 0 .020em,48px 54px 0 .020em #fff,54px 54px 0 .020em #fff,60px 54px 0 .020em #fff,66px 54px 0 .020em,72px 54px 0 .020em,78px 54px 0 .020em,84px 54px 0 .020em,12px 60px 0 .020em,18px 60px 0 .020em #fff,24px 60px 0 .020em #fff,30px 60px 0 .020em #fff,36px 60px 0 .020em,42px 60px 0 .020em,48px 60px 0 .020em #fff,54px 60px 0 .020em #fff,60px 60px 0 .020em #fff,66px 60px 0 .020em,72px 60px 0 .020em #fff,78px 60px 0 .020em,12px 66px 0 .020em,18px 66px 0 .020em #fff,24px 66px 0 .020em #fff,30px 66px 0 .020em #fff,36px 66px 0 .020em #fff,42px 66px 0 .020em #fff,48px 66px 0 .020em,54px 66px 0 .020em,60px 66px 0 .020em,66px 66px 0 .020em #fff,72px 66px 0 .020em #fff,78px 66px 0 .020em,18px 72px 0 .020em,24px 72px 0 .020em #9fa1a1,30px 72px 0 .020em #9fa1a1,36px 72px 0 .020em #fff,42px 72px 0 .020em #fff,48px 72px 0 .020em #fff,54px 72px 0 .020em #fff,60px 72px 0 .020em #fff,66px 72px 0 .020em #fff,72px 72px 0 .020em,24px 78px 0 .020em,30px 78px 0 .020em,36px 78px 0 .020em #9fa1a1,42px 78px 0 .020em #9fa1a1,48px 78px 0 .020em #9fa1a1,54px 78px 0 .020em #9fa1a1,60px 78px 0 .020em,66px 78px 0 .020em,36px 84px 0 .020em,42px 84px 0 .020em,48px 84px 0 .020em,54px 84px 0 .020em}}.nes-bulbasaur{position:relative;display:inline-block;width:120px;height:102px}.nes-bulbasaur::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#000;box-shadow:78px 6px,84px 6px,90px 6px,72px 12px,78px 12px #8beb46,84px 12px #8beb46,90px 12px #8beb46,96px 12px,60px 18px,66px 18px,72px 18px,78px 18px #8beb46,84px 18px #8beb46,90px 18px #8beb46,96px 18px,48px 24px,54px 24px,60px 24px #8beb46,66px 24px #8beb46,72px 24px #2d8d22,78px 24px #8beb46,84px 24px #8beb46,90px 24px #2d8d22,96px 24px #8beb46,102px 24px,108px 24px,24px 30px,30px 30px,42px 30px,48px 30px #8beb46,54px 30px #8beb46,60px 30px #8beb46,66px 30px #2d8d22,72px 30px #2d8d22,78px 30px #8beb46,84px 30px #8beb46,90px 30px #2d8d22,96px 30px #8beb46,102px 30px #8beb46,108px 30px #8beb46,114px 30px,18px 36px,24px 36px #5ceee1,30px 36px #5ceee1,36px 36px,42px 36px,48px 36px #8beb46,54px 36px #8beb46,60px 36px #2d8d22,66px 36px #8beb46,72px 36px #2d8d22,78px 36px #8beb46,84px 36px #8beb46,90px 36px #8beb46,96px 36px #2d8d22,102px 36px #8beb46,108px 36px #8beb46,114px 36px #8beb46,120px 36px,18px 42px,24px 42px #5ceee1,30px 42px #5ceee1,36px 42px #5ceee1,42px 42px,48px 42px,54px 42px #2d8d22,60px 42px #8beb46,66px 42px #2d8d22,72px 42px #8beb46,78px 42px #8beb46,84px 42px #8beb46,90px 42px #8beb46,96px 42px #8beb46,102px 42px #2d8d22,108px 42px #8beb46,114px 42px #8beb46,120px 42px,18px 48px,24px 48px #5ceee1,30px 48px #5ceee1,36px 48px #5ceee1,42px 48px #5ceee1,48px 48px #3fc3b5,54px 48px,60px 48px #8beb46,66px 48px #2d8d22,72px 48px #8beb46,78px 48px #8beb46,84px 48px #8beb46,90px 48px #8beb46,96px 48px #8beb46,102px 48px #2d8d22,108px 48px #8beb46,114px 48px #8beb46,120px 48px,12px 54px,18px 54px #5ceee1,24px 54px #5ceee1,30px 54px #3fc3b5,36px 54px #5ceee1,42px 54px #3fc3b5,48px 54px #3fc3b5,54px 54px #5ceee1,60px 54px,66px 54px,72px 54px,78px 54px #8beb46,84px 54px #8beb46,90px 54px #8beb46,96px 54px #8beb46,102px 54px #2d8d22,108px 54px #8beb46,114px 54px,6px 60px,12px 60px,18px 60px #3fc3b5,24px 60px #5ceee1,30px 60px #5ceee1,36px 60px #5ceee1,42px 60px #5ceee1,48px 60px #5ceee1,54px 60px #5ceee1,60px 60px #5ceee1,66px 60px #5ceee1,72px 60px,78px 60px #8beb46,84px 60px #8beb46,90px 60px #8beb46,96px 60px,102px 60px,108px 60px,114px 60px,6px 66px,12px 66px,18px 66px #3fc3b5,24px 66px #5ceee1,30px 66px #5ceee1,36px 66px #5ceee1,42px 66px #3fc3b5,48px 66px #5ceee1,54px 66px #5ceee1,60px 66px #5ceee1,66px 66px,72px 66px #3fc3b5,78px 66px,84px 66px,90px 66px,96px 66px #3fc3b5,102px 66px #3fc3b5,108px 66px #3fc3b5,114px 66px,6px 72px,12px 72px #5ceee1,18px 72px #5ceee1,24px 72px #5ceee1,30px 72px #5ceee1,36px 72px #3fc3b5,42px 72px #5ceee1,48px 72px,54px 72px,60px 72px #5ceee1,66px 72px #3fc3b5,72px 72px #3fc3b5,78px 72px #3fc3b5,84px 72px #3fc3b5,90px 72px #3fc3b5,96px 72px,102px 72px #3fc3b5,108px 72px #fdfdf5,114px 72px,6px 78px,12px 78px #3fc3b5,18px 78px #5ceee1,24px 78px #5ceee1,30px 78px #5ceee1,36px 78px #5ceee1,42px 78px,48px 78px #ca242a,54px 78px #fdfdf5,60px 78px #fdfdf5,66px 78px #3fc3b5,72px 78px #3fc3b5,78px 78px,84px 78px #3fc3b5,90px 78px #3fc3b5,96px 78px,102px 78px,108px 78px,12px 84px,18px 84px #3fc3b5,24px 84px #5ceee1,30px 84px #5ceee1,36px 84px #5ceee1,42px 84px,48px 84px #ca242a,54px 84px #fdfdf5,60px 84px #5ceee1,66px 84px #3fc3b5,72px 84px,78px 84px #3fc3b5,84px 84px #3fc3b5,90px 84px,18px 90px,24px 90px,30px 90px #3fc3b5,36px 90px #3fc3b5,42px 90px #3fc3b5,48px 90px #3fc3b5,54px 90px #3fc3b5,60px 90px #3fc3b5,66px 90px,72px 90px #3fc3b5,78px 90px #3fc3b5,84px 90px #3fc3b5,90px 90px,30px 96px,36px 96px,42px 96px,48px 96px,54px 96px,60px 96px,66px 96px,72px 96px #fdfdf5,78px 96px #3fc3b5,84px 96px #fdfdf5,90px 96px,72px 102px,78px 102px,84px 102px;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-bulbasaur::before{box-shadow:78px 6px 0 .020em,84px 6px 0 .020em,90px 6px 0 .020em,72px 12px 0 .020em,78px 12px 0 .020em #8beb46,84px 12px 0 .020em #8beb46,90px 12px 0 .020em #8beb46,96px 12px 0 .020em,60px 18px 0 .020em,66px 18px 0 .020em,72px 18px 0 .020em,78px 18px 0 .020em #8beb46,84px 18px 0 .020em #8beb46,90px 18px 0 .020em #8beb46,96px 18px 0 .020em,48px 24px 0 .020em,54px 24px 0 .020em,60px 24px 0 .020em #8beb46,66px 24px 0 .020em #8beb46,72px 24px 0 .020em #2d8d22,78px 24px 0 .020em #8beb46,84px 24px 0 .020em #8beb46,90px 24px 0 .020em #2d8d22,96px 24px 0 .020em #8beb46,102px 24px 0 .020em,108px 24px 0 .020em,24px 30px 0 .020em,30px 30px 0 .020em,42px 30px 0 .020em,48px 30px 0 .020em #8beb46,54px 30px 0 .020em #8beb46,60px 30px 0 .020em #8beb46,66px 30px 0 .020em #2d8d22,72px 30px 0 .020em #2d8d22,78px 30px 0 .020em #8beb46,84px 30px 0 .020em #8beb46,90px 30px 0 .020em #2d8d22,96px 30px 0 .020em #8beb46,102px 30px 0 .020em #8beb46,108px 30px 0 .020em #8beb46,114px 30px 0 .020em,18px 36px 0 .020em,24px 36px 0 .020em #5ceee1,30px 36px 0 .020em #5ceee1,36px 36px 0 .020em,42px 36px 0 .020em,48px 36px 0 .020em #8beb46,54px 36px 0 .020em #8beb46,60px 36px 0 .020em #2d8d22,66px 36px 0 .020em #8beb46,72px 36px 0 .020em #2d8d22,78px 36px 0 .020em #8beb46,84px 36px 0 .020em #8beb46,90px 36px 0 .020em #8beb46,96px 36px 0 .020em #2d8d22,102px 36px 0 .020em #8beb46,108px 36px 0 .020em #8beb46,114px 36px 0 .020em #8beb46,120px 36px 0 .020em,18px 42px 0 .020em,24px 42px 0 .020em #5ceee1,30px 42px 0 .020em #5ceee1,36px 42px 0 .020em #5ceee1,42px 42px 0 .020em,48px 42px 0 .020em,54px 42px 0 .020em #2d8d22,60px 42px 0 .020em #8beb46,66px 42px 0 .020em #2d8d22,72px 42px 0 .020em #8beb46,78px 42px 0 .020em #8beb46,84px 42px 0 .020em #8beb46,90px 42px 0 .020em #8beb46,96px 42px 0 .020em #8beb46,102px 42px 0 .020em #2d8d22,108px 42px 0 .020em #8beb46,114px 42px 0 .020em #8beb46,120px 42px 0 .020em,18px 48px 0 .020em,24px 48px 0 .020em #5ceee1,30px 48px 0 .020em #5ceee1,36px 48px 0 .020em #5ceee1,42px 48px 0 .020em #5ceee1,48px 48px 0 .020em #3fc3b5,54px 48px 0 .020em,60px 48px 0 .020em #8beb46,66px 48px 0 .020em #2d8d22,72px 48px 0 .020em #8beb46,78px 48px 0 .020em #8beb46,84px 48px 0 .020em #8beb46,90px 48px 0 .020em #8beb46,96px 48px 0 .020em #8beb46,102px 48px 0 .020em #2d8d22,108px 48px 0 .020em #8beb46,114px 48px 0 .020em #8beb46,120px 48px 0 .020em,12px 54px 0 .020em,18px 54px 0 .020em #5ceee1,24px 54px 0 .020em #5ceee1,30px 54px 0 .020em #3fc3b5,36px 54px 0 .020em #5ceee1,42px 54px 0 .020em #3fc3b5,48px 54px 0 .020em #3fc3b5,54px 54px 0 .020em #5ceee1,60px 54px 0 .020em,66px 54px 0 .020em,72px 54px 0 .020em,78px 54px 0 .020em #8beb46,84px 54px 0 .020em #8beb46,90px 54px 0 .020em #8beb46,96px 54px 0 .020em #8beb46,102px 54px 0 .020em #2d8d22,108px 54px 0 .020em #8beb46,114px 54px 0 .020em,6px 60px 0 .020em,12px 60px 0 .020em,18px 60px 0 .020em #3fc3b5,24px 60px 0 .020em #5ceee1,30px 60px 0 .020em #5ceee1,36px 60px 0 .020em #5ceee1,42px 60px 0 .020em #5ceee1,48px 60px 0 .020em #5ceee1,54px 60px 0 .020em #5ceee1,60px 60px 0 .020em #5ceee1,66px 60px 0 .020em #5ceee1,72px 60px 0 .020em,78px 60px 0 .020em #8beb46,84px 60px 0 .020em #8beb46,90px 60px 0 .020em #8beb46,96px 60px 0 .020em,102px 60px 0 .020em,108px 60px 0 .020em,114px 60px 0 .020em,6px 66px 0 .020em,12px 66px 0 .020em,18px 66px 0 .020em #3fc3b5,24px 66px 0 .020em #5ceee1,30px 66px 0 .020em #5ceee1,36px 66px 0 .020em #5ceee1,42px 66px 0 .020em #3fc3b5,48px 66px 0 .020em #5ceee1,54px 66px 0 .020em #5ceee1,60px 66px 0 .020em #5ceee1,66px 66px 0 .020em,72px 66px 0 .020em #3fc3b5,78px 66px 0 .020em,84px 66px 0 .020em,90px 66px 0 .020em,96px 66px 0 .020em #3fc3b5,102px 66px 0 .020em #3fc3b5,108px 66px 0 .020em #3fc3b5,114px 66px 0 .020em,6px 72px 0 .020em,12px 72px 0 .020em #5ceee1,18px 72px 0 .020em #5ceee1,24px 72px 0 .020em #5ceee1,30px 72px 0 .020em #5ceee1,36px 72px 0 .020em #3fc3b5,42px 72px 0 .020em #5ceee1,48px 72px 0 .020em,54px 72px 0 .020em,60px 72px 0 .020em #5ceee1,66px 72px 0 .020em #3fc3b5,72px 72px 0 .020em #3fc3b5,78px 72px 0 .020em #3fc3b5,84px 72px 0 .020em #3fc3b5,90px 72px 0 .020em #3fc3b5,96px 72px 0 .020em,102px 72px 0 .020em #3fc3b5,108px 72px 0 .020em #fdfdf5,114px 72px 0 .020em,6px 78px 0 .020em,12px 78px 0 .020em #3fc3b5,18px 78px 0 .020em #5ceee1,24px 78px 0 .020em #5ceee1,30px 78px 0 .020em #5ceee1,36px 78px 0 .020em #5ceee1,42px 78px 0 .020em,48px 78px 0 .020em #ca242a,54px 78px 0 .020em #fdfdf5,60px 78px 0 .020em #fdfdf5,66px 78px 0 .020em #3fc3b5,72px 78px 0 .020em #3fc3b5,78px 78px 0 .020em,84px 78px 0 .020em #3fc3b5,90px 78px 0 .020em #3fc3b5,96px 78px 0 .020em,102px 78px 0 .020em,108px 78px 0 .020em,12px 84px 0 .020em,18px 84px 0 .020em #3fc3b5,24px 84px 0 .020em #5ceee1,30px 84px 0 .020em #5ceee1,36px 84px 0 .020em #5ceee1,42px 84px 0 .020em,48px 84px 0 .020em #ca242a,54px 84px 0 .020em #fdfdf5,60px 84px 0 .020em #5ceee1,66px 84px 0 .020em #3fc3b5,72px 84px 0 .020em,78px 84px 0 .020em #3fc3b5,84px 84px 0 .020em #3fc3b5,90px 84px 0 .020em,18px 90px 0 .020em,24px 90px 0 .020em,30px 90px 0 .020em #3fc3b5,36px 90px 0 .020em #3fc3b5,42px 90px 0 .020em #3fc3b5,48px 90px 0 .020em #3fc3b5,54px 90px 0 .020em #3fc3b5,60px 90px 0 .020em #3fc3b5,66px 90px 0 .020em,72px 90px 0 .020em #3fc3b5,78px 90px 0 .020em #3fc3b5,84px 90px 0 .020em #3fc3b5,90px 90px 0 .020em,30px 96px 0 .020em,36px 96px 0 .020em,42px 96px 0 .020em,48px 96px 0 .020em,54px 96px 0 .020em,60px 96px 0 .020em,66px 96px 0 .020em,72px 96px 0 .020em #fdfdf5,78px 96px 0 .020em #3fc3b5,84px 96px 0 .020em #fdfdf5,90px 96px 0 .020em,72px 102px 0 .020em,78px 102px 0 .020em,84px 102px 0 .020em}}.nes-charmander{position:relative;display:inline-block;width:126px;height:108px}.nes-charmander::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#f77702;box-shadow:30px 6px #000202,36px 6px #000202,42px 6px #000202,48px 6px #000202,108px 6px #000202,24px 12px #000202,30px 12px,36px 12px,42px 12px,48px 12px,54px 12px #000202,102px 12px #000202,108px 12px #eb2010,114px 12px #000202,18px 18px #000202,24px 18px,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px #000202,102px 18px #000202,108px 18px #eb2010,114px 18px #eb2010,120px 18px #000202,18px 24px #000202,24px 24px,30px 24px,36px 24px,42px 24px,48px 24px,54px 24px,60px 24px #000202,102px 24px #000202,108px 24px #eb2010,114px 24px #eb2010,120px 24px #000202,12px 30px #000202,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px,48px 30px,54px 30px,60px 30px,66px 30px #000202,96px 30px #000202,102px 30px #eb2010,108px 30px #eb2010,114px 30px,120px 30px #eb2010,126px 30px #000202,6px 36px #000202,12px 36px,18px 36px,24px 36px,30px 36px,36px 36px #fdfcff,42px 36px #000202,48px 36px,54px 36px,60px 36px,66px 36px #000202,96px 36px #000202,102px 36px #eb2010,108px 36px,114px 36px #e7d70e,120px 36px #eb2010,126px 36px #000202,6px 42px #000202,12px 42px,18px 42px,24px 42px,30px 42px,36px 42px #000202,42px 42px #000202,48px 42px,54px 42px,60px 42px,66px 42px,72px 42px #000202,96px 42px #000202,102px 42px #eb2010,108px 42px #e5d70a,114px 42px #e5d70a,120px 42px #eb2010,126px 42px #000202,6px 48px #000202,12px 48px,18px 48px,24px 48px,30px 48px,36px 48px #000202,42px 48px #000202,48px 48px,54px 48px,60px 48px,66px 48px,72px 48px #000202,102px 48px #000202,108px 48px #e5d70a,114px 48px #000202,120px 48px #000202,12px 54px #000202,18px 54px,24px 54px,30px 54px,36px 54px,42px 54px,48px 54px,54px 54px,60px 54px,66px 54px,72px 54px,78px 54px #000202,102px 54px #000202,108px 54px,114px 54px #000202,18px 60px #000202,24px 60px #000202,30px 60px,36px 60px,42px 60px,48px 60px,54px 60px,60px 60px,66px 60px,72px 60px,78px 60px,84px 60px #000202,96px 60px #000202,102px 60px,108px 60px,114px 60px #000202,30px 66px #000202,36px 66px #000202,42px 66px #000202,48px 66px,54px 66px,60px 66px #000202,66px 66px,72px 66px,78px 66px,84px 66px #000202,90px 66px #000202,96px 66px,102px 66px,108px 66px #000202,36px 72px #000202,42px 72px #e7d70e,48px 72px #e5d70a,54px 72px #000202,60px 72px,66px 72px,72px 72px,78px 72px,84px 72px,90px 72px #000202,96px 72px,102px 72px,108px 72px #000202,36px 78px #000202,42px 78px #e5d70a,48px 78px #e5d70a,54px 78px #e5d70a,60px 78px #000202,66px 78px #000202,72px 78px,78px 78px,84px 78px,90px 78px #000202,96px 78px,102px 78px #000202,30px 84px #000202,36px 84px #fdfcff,42px 84px #000202,48px 84px #e7d70e,54px 84px #e5d70a,60px 84px #e5d70a,66px 84px,72px 84px,78px 84px,84px 84px,90px 84px #000202,96px 84px #000202,36px 90px #000202,42px 90px #000202,48px 90px #000202,54px 90px #e5d70a,60px 90px #e5d70a,66px 90px,72px 90px,78px 90px,84px 90px #000202,90px 90px #000202,54px 96px #000202,60px 96px #000202,66px 96px #000202,78px 96px #000202,84px 96px #000202,60px 102px #000202,66px 102px #fdfcff,78px 102px #fdfcff,84px 102px #000202,66px 108px #000202,72px 108px #000202,78px 108px #000202;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-charmander::before{box-shadow:30px 6px 0 .020em #000202,36px 6px 0 .020em #000202,42px 6px 0 .020em #000202,48px 6px 0 .020em #000202,108px 6px 0 .020em #000202,24px 12px 0 .020em #000202,30px 12px 0 .020em,36px 12px 0 .020em,42px 12px 0 .020em,48px 12px 0 .020em,54px 12px 0 .020em #000202,102px 12px 0 .020em #000202,108px 12px 0 .020em #eb2010,114px 12px 0 .020em #000202,18px 18px 0 .020em #000202,24px 18px 0 .020em,30px 18px 0 .020em,36px 18px 0 .020em,42px 18px 0 .020em,48px 18px 0 .020em,54px 18px 0 .020em,60px 18px 0 .020em #000202,102px 18px 0 .020em #000202,108px 18px 0 .020em #eb2010,114px 18px 0 .020em #eb2010,120px 18px 0 .020em #000202,18px 24px 0 .020em #000202,24px 24px 0 .020em,30px 24px 0 .020em,36px 24px 0 .020em,42px 24px 0 .020em,48px 24px 0 .020em,54px 24px 0 .020em,60px 24px 0 .020em #000202,102px 24px 0 .020em #000202,108px 24px 0 .020em #eb2010,114px 24px 0 .020em #eb2010,120px 24px 0 .020em #000202,12px 30px 0 .020em #000202,18px 30px 0 .020em,24px 30px 0 .020em,30px 30px 0 .020em,36px 30px 0 .020em,42px 30px 0 .020em,48px 30px 0 .020em,54px 30px 0 .020em,60px 30px 0 .020em,66px 30px 0 .020em #000202,96px 30px 0 .020em #000202,102px 30px 0 .020em #eb2010,108px 30px 0 .020em #eb2010,114px 30px 0 .020em,120px 30px 0 .020em #eb2010,126px 30px 0 .020em #000202,6px 36px 0 .020em #000202,12px 36px 0 .020em,18px 36px 0 .020em,24px 36px 0 .020em,30px 36px 0 .020em,36px 36px 0 .020em #fdfcff,42px 36px 0 .020em #000202,48px 36px 0 .020em,54px 36px 0 .020em,60px 36px 0 .020em,66px 36px 0 .020em #000202,96px 36px 0 .020em #000202,102px 36px 0 .020em #eb2010,108px 36px 0 .020em,114px 36px 0 .020em #e7d70e,120px 36px 0 .020em #eb2010,126px 36px 0 .020em #000202,6px 42px 0 .020em #000202,12px 42px 0 .020em,18px 42px 0 .020em,24px 42px 0 .020em,30px 42px 0 .020em,36px 42px 0 .020em #000202,42px 42px 0 .020em #000202,48px 42px 0 .020em,54px 42px 0 .020em,60px 42px 0 .020em,66px 42px 0 .020em,72px 42px 0 .020em #000202,96px 42px 0 .020em #000202,102px 42px 0 .020em #eb2010,108px 42px 0 .020em #e5d70a,114px 42px 0 .020em #e5d70a,120px 42px 0 .020em #eb2010,126px 42px 0 .020em #000202,6px 48px 0 .020em #000202,12px 48px 0 .020em,18px 48px 0 .020em,24px 48px 0 .020em,30px 48px 0 .020em,36px 48px 0 .020em #000202,42px 48px 0 .020em #000202,48px 48px 0 .020em,54px 48px 0 .020em,60px 48px 0 .020em,66px 48px 0 .020em,72px 48px 0 .020em #000202,102px 48px 0 .020em #000202,108px 48px 0 .020em #e5d70a,114px 48px 0 .020em #000202,120px 48px 0 .020em #000202,12px 54px 0 .020em #000202,18px 54px 0 .020em,24px 54px 0 .020em,30px 54px 0 .020em,36px 54px 0 .020em,42px 54px 0 .020em,48px 54px 0 .020em,54px 54px 0 .020em,60px 54px 0 .020em,66px 54px 0 .020em,72px 54px 0 .020em,78px 54px 0 .020em #000202,102px 54px 0 .020em #000202,108px 54px 0 .020em,114px 54px 0 .020em #000202,18px 60px 0 .020em #000202,24px 60px 0 .020em #000202,30px 60px 0 .020em,36px 60px 0 .020em,42px 60px 0 .020em,48px 60px 0 .020em,54px 60px 0 .020em,60px 60px 0 .020em,66px 60px 0 .020em,72px 60px 0 .020em,78px 60px 0 .020em,84px 60px 0 .020em #000202,96px 60px 0 .020em #000202,102px 60px 0 .020em,108px 60px 0 .020em,114px 60px 0 .020em #000202,30px 66px 0 .020em #000202,36px 66px 0 .020em #000202,42px 66px 0 .020em #000202,48px 66px 0 .020em,54px 66px 0 .020em,60px 66px 0 .020em #000202,66px 66px 0 .020em,72px 66px 0 .020em,78px 66px 0 .020em,84px 66px 0 .020em #000202,90px 66px 0 .020em #000202,96px 66px 0 .020em,102px 66px 0 .020em,108px 66px 0 .020em #000202,36px 72px 0 .020em #000202,42px 72px 0 .020em #e7d70e,48px 72px 0 .020em #e5d70a,54px 72px 0 .020em #000202,60px 72px 0 .020em,66px 72px 0 .020em,72px 72px 0 .020em,78px 72px 0 .020em,84px 72px 0 .020em,90px 72px 0 .020em #000202,96px 72px 0 .020em,102px 72px 0 .020em,108px 72px 0 .020em #000202,36px 78px 0 .020em #000202,42px 78px 0 .020em #e5d70a,48px 78px 0 .020em #e5d70a,54px 78px 0 .020em #e5d70a,60px 78px 0 .020em #000202,66px 78px 0 .020em #000202,72px 78px 0 .020em,78px 78px 0 .020em,84px 78px 0 .020em,90px 78px 0 .020em #000202,96px 78px 0 .020em,102px 78px 0 .020em #000202,30px 84px 0 .020em #000202,36px 84px 0 .020em #fdfcff,42px 84px 0 .020em #000202,48px 84px 0 .020em #e7d70e,54px 84px 0 .020em #e5d70a,60px 84px 0 .020em #e5d70a,66px 84px 0 .020em,72px 84px 0 .020em,78px 84px 0 .020em,84px 84px 0 .020em,90px 84px 0 .020em #000202,96px 84px 0 .020em #000202,36px 90px 0 .020em #000202,42px 90px 0 .020em #000202,48px 90px 0 .020em #000202,54px 90px 0 .020em #e5d70a,60px 90px 0 .020em #e5d70a,66px 90px 0 .020em,72px 90px 0 .020em,78px 90px 0 .020em,84px 90px 0 .020em #000202,90px 90px 0 .020em #000202,54px 96px 0 .020em #000202,60px 96px 0 .020em #000202,66px 96px 0 .020em #000202,78px 96px 0 .020em #000202,84px 96px 0 .020em #000202,60px 102px 0 .020em #000202,66px 102px 0 .020em #fdfcff,78px 102px 0 .020em #fdfcff,84px 102px 0 .020em #000202,66px 108px 0 .020em #000202,72px 108px 0 .020em #000202,78px 108px 0 .020em #000202}}.nes-squirtle{position:relative;display:inline-block;width:126px;height:102px}.nes-squirtle::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#9cf;box-shadow:24px 6px #000,30px 6px #000,36px 6px #000,42px 6px #000,102px 6px #000,108px 6px #000,114px 6px #000,18px 12px #000,24px 12px,30px 12px,36px 12px,42px 12px,48px 12px #000,54px 12px #000,96px 12px #000,102px 12px,108px 12px,114px 12px,120px 12px #000,12px 18px #000,18px 18px,24px 18px,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px #000,66px 18px #000,90px 18px #000,96px 18px,102px 18px,108px 18px,114px 18px,120px 18px,126px 18px #000,12px 24px #000,18px 24px,24px 24px,30px 24px,36px 24px,42px 24px,48px 24px,54px 24px,60px 24px #000,66px 24px #f89934,72px 24px #000,78px 24px #000,90px 24px #000,96px 24px,102px 24px,108px 24px,114px 24px #000,120px 24px,126px 24px #000,6px 30px #000,12px 30px #cb6633,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px,48px 30px,54px 30px,60px 30px,66px 30px #f89934,72px 30px #f89934,78px 30px #f89934,84px 30px #000,90px 30px,96px 30px,102px 30px,108px 30px #000,114px 30px,120px 30px,126px 30px #000,6px 36px #000,12px 36px,18px 36px,24px 36px,30px 36px,36px 36px #fff,42px 36px #000,48px 36px,54px 36px,60px 36px,66px 36px #fff,72px 36px #f89934,78px 36px #f89934,84px 36px #f89934,90px 36px #000,96px 36px,102px 36px,108px 36px #000,114px 36px,120px 36px #000,6px 42px #000,12px 42px,18px 42px,24px 42px,30px 42px,36px 42px #000,42px 42px #cb6633,48px 42px,54px 42px,60px 42px,66px 42px #fff,72px 42px #f89934,78px 42px #f89934,84px 42px #f89934,90px 42px #000,96px 42px,102px 42px #000,108px 42px #000,114px 42px #000,12px 48px #000,18px 48px,24px 48px,30px 48px,36px 48px #000,42px 48px #cb6633,48px 48px,54px 48px,60px 48px,66px 48px #000,72px 48px #fff,78px 48px #f89934,84px 48px #f89934,90px 48px #f89934,96px 48px #000,102px 48px #000,18px 54px #000,24px 54px #000,30px 54px,36px 54px,42px 54px,48px 54px,54px 54px #000,60px 54px #000,66px 54px,72px 54px,78px 54px #fff,84px 54px #f89934,90px 54px #f89934,96px 54px #000,18px 60px #000,24px 60px,30px 60px #000,36px 60px #000,42px 60px #000,48px 60px #000,54px 60px,60px 60px,66px 60px,72px 60px,78px 60px #fff,84px 60px #f89934,90px 60px #f89934,96px 60px #000,24px 66px #000,30px 66px #000,36px 66px #ff3,42px 66px #ff3,48px 66px #000,54px 66px,60px 66px,66px 66px,72px 66px #000,78px 66px #fff,84px 66px #f89934,90px 66px #f89934,96px 66px #000,36px 72px #000,42px 72px #ff3,48px 72px #ff3,54px 72px #000,60px 72px #000,66px 72px #000,72px 72px #000,78px 72px #fff,84px 72px #f89934,90px 72px #f89934,96px 72px #000,30px 78px #000,36px 78px,42px 78px #000,48px 78px #ff3,54px 78px #ff3,60px 78px #ff3,66px 78px #ff3,72px 78px #ff3,78px 78px #000,84px 78px #fff,90px 78px #000,36px 84px #000,42px 84px #000,48px 84px #000,54px 84px #000,60px 84px #ff3,66px 84px #ff3,72px 84px,78px 84px #000,84px 84px #fff,90px 84px #000,54px 90px #000,60px 90px #000,66px 90px #000,72px 90px,78px 90px #000,84px 90px #000,60px 96px #000,66px 96px,72px 96px,78px 96px,84px 96px #000,66px 102px #000,72px 102px #000,78px 102px #000;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-squirtle::before{box-shadow:24px 6px 0 .020em #000,30px 6px 0 .020em #000,36px 6px 0 .020em #000,42px 6px 0 .020em #000,102px 6px 0 .020em #000,108px 6px 0 .020em #000,114px 6px 0 .020em #000,18px 12px 0 .020em #000,24px 12px 0 .020em,30px 12px 0 .020em,36px 12px 0 .020em,42px 12px 0 .020em,48px 12px 0 .020em #000,54px 12px 0 .020em #000,96px 12px 0 .020em #000,102px 12px 0 .020em,108px 12px 0 .020em,114px 12px 0 .020em,120px 12px 0 .020em #000,12px 18px 0 .020em #000,18px 18px 0 .020em,24px 18px 0 .020em,30px 18px 0 .020em,36px 18px 0 .020em,42px 18px 0 .020em,48px 18px 0 .020em,54px 18px 0 .020em,60px 18px 0 .020em #000,66px 18px 0 .020em #000,90px 18px 0 .020em #000,96px 18px 0 .020em,102px 18px 0 .020em,108px 18px 0 .020em,114px 18px 0 .020em,120px 18px 0 .020em,126px 18px 0 .020em #000,12px 24px 0 .020em #000,18px 24px 0 .020em,24px 24px 0 .020em,30px 24px 0 .020em,36px 24px 0 .020em,42px 24px 0 .020em,48px 24px 0 .020em,54px 24px 0 .020em,60px 24px 0 .020em #000,66px 24px 0 .020em #f89934,72px 24px 0 .020em #000,78px 24px 0 .020em #000,90px 24px 0 .020em #000,96px 24px 0 .020em,102px 24px 0 .020em,108px 24px 0 .020em,114px 24px 0 .020em #000,120px 24px 0 .020em,126px 24px 0 .020em #000,6px 30px 0 .020em #000,12px 30px 0 .020em #cb6633,18px 30px 0 .020em,24px 30px 0 .020em,30px 30px 0 .020em,36px 30px 0 .020em,42px 30px 0 .020em,48px 30px 0 .020em,54px 30px 0 .020em,60px 30px 0 .020em,66px 30px 0 .020em #f89934,72px 30px 0 .020em #f89934,78px 30px 0 .020em #f89934,84px 30px 0 .020em #000,90px 30px 0 .020em,96px 30px 0 .020em,102px 30px 0 .020em,108px 30px 0 .020em #000,114px 30px 0 .020em,120px 30px 0 .020em,126px 30px 0 .020em #000,6px 36px 0 .020em #000,12px 36px 0 .020em,18px 36px 0 .020em,24px 36px 0 .020em,30px 36px 0 .020em,36px 36px 0 .020em #fff,42px 36px 0 .020em #000,48px 36px 0 .020em,54px 36px 0 .020em,60px 36px 0 .020em,66px 36px 0 .020em #fff,72px 36px 0 .020em #f89934,78px 36px 0 .020em #f89934,84px 36px 0 .020em #f89934,90px 36px 0 .020em #000,96px 36px 0 .020em,102px 36px 0 .020em,108px 36px 0 .020em #000,114px 36px 0 .020em,120px 36px 0 .020em #000,6px 42px 0 .020em #000,12px 42px 0 .020em,18px 42px 0 .020em,24px 42px 0 .020em,30px 42px 0 .020em,36px 42px 0 .020em #000,42px 42px 0 .020em #cb6633,48px 42px 0 .020em,54px 42px 0 .020em,60px 42px 0 .020em,66px 42px 0 .020em #fff,72px 42px 0 .020em #f89934,78px 42px 0 .020em #f89934,84px 42px 0 .020em #f89934,90px 42px 0 .020em #000,96px 42px 0 .020em,102px 42px 0 .020em #000,108px 42px 0 .020em #000,114px 42px 0 .020em #000,12px 48px 0 .020em #000,18px 48px 0 .020em,24px 48px 0 .020em,30px 48px 0 .020em,36px 48px 0 .020em #000,42px 48px 0 .020em #cb6633,48px 48px 0 .020em,54px 48px 0 .020em,60px 48px 0 .020em,66px 48px 0 .020em #000,72px 48px 0 .020em #fff,78px 48px 0 .020em #f89934,84px 48px 0 .020em #f89934,90px 48px 0 .020em #f89934,96px 48px 0 .020em #000,102px 48px 0 .020em #000,18px 54px 0 .020em #000,24px 54px 0 .020em #000,30px 54px 0 .020em,36px 54px 0 .020em,42px 54px 0 .020em,48px 54px 0 .020em,54px 54px 0 .020em #000,60px 54px 0 .020em #000,66px 54px 0 .020em,72px 54px 0 .020em,78px 54px 0 .020em #fff,84px 54px 0 .020em #f89934,90px 54px 0 .020em #f89934,96px 54px 0 .020em #000,18px 60px 0 .020em #000,24px 60px 0 .020em,30px 60px 0 .020em #000,36px 60px 0 .020em #000,42px 60px 0 .020em #000,48px 60px 0 .020em #000,54px 60px 0 .020em,60px 60px 0 .020em,66px 60px 0 .020em,72px 60px 0 .020em,78px 60px 0 .020em #fff,84px 60px 0 .020em #f89934,90px 60px 0 .020em #f89934,96px 60px 0 .020em #000,24px 66px 0 .020em #000,30px 66px 0 .020em #000,36px 66px 0 .020em #ff3,42px 66px 0 .020em #ff3,48px 66px 0 .020em #000,54px 66px 0 .020em,60px 66px 0 .020em,66px 66px 0 .020em,72px 66px 0 .020em #000,78px 66px 0 .020em #fff,84px 66px 0 .020em #f89934,90px 66px 0 .020em #f89934,96px 66px 0 .020em #000,36px 72px 0 .020em #000,42px 72px 0 .020em #ff3,48px 72px 0 .020em #ff3,54px 72px 0 .020em #000,60px 72px 0 .020em #000,66px 72px 0 .020em #000,72px 72px 0 .020em #000,78px 72px 0 .020em #fff,84px 72px 0 .020em #f89934,90px 72px 0 .020em #f89934,96px 72px 0 .020em #000,30px 78px 0 .020em #000,36px 78px 0 .020em,42px 78px 0 .020em #000,48px 78px 0 .020em #ff3,54px 78px 0 .020em #ff3,60px 78px 0 .020em #ff3,66px 78px 0 .020em #ff3,72px 78px 0 .020em #ff3,78px 78px 0 .020em #000,84px 78px 0 .020em #fff,90px 78px 0 .020em #000,36px 84px 0 .020em #000,42px 84px 0 .020em #000,48px 84px 0 .020em #000,54px 84px 0 .020em #000,60px 84px 0 .020em #ff3,66px 84px 0 .020em #ff3,72px 84px 0 .020em,78px 84px 0 .020em #000,84px 84px 0 .020em #fff,90px 84px 0 .020em #000,54px 90px 0 .020em #000,60px 90px 0 .020em #000,66px 90px 0 .020em #000,72px 90px 0 .020em,78px 90px 0 .020em #000,84px 90px 0 .020em #000,60px 96px 0 .020em #000,66px 96px 0 .020em,72px 96px 0 .020em,78px 96px 0 .020em,84px 96px 0 .020em #000,66px 102px 0 .020em #000,72px 102px 0 .020em #000,78px 102px 0 .020em #000}}.nes-phone{position:relative;display:inline-block;width:48px;height:126px}.nes-phone::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#000;box-shadow:18px 6px,24px 6px,30px 6px,36px 6px,42px 6px,48px 6px,12px 12px,18px 12px,24px 12px #3c4665,30px 12px #3c4665,36px 12px #3c4665,42px 12px #596985,48px 12px,6px 18px,12px 18px,18px 18px #3c4665,24px 18px #3c4665,30px 18px #3c4665,36px 18px #3c4665,42px 18px #596985,48px 18px,6px 24px,12px 24px #3c4665,18px 24px #3c4665,24px 24px #3c4665,30px 24px #3c4665,36px 24px #3c4665,42px 24px #596985,48px 24px,6px 30px,12px 30px #3c4665,18px 30px #3c4665,24px 30px #3c4665,30px 30px #3c4665,36px 30px #3c4665,42px 30px #596985,48px 30px,6px 36px,12px 36px #3c4665,18px 36px #3c4665,24px 36px #3c4665,30px 36px #3c4665,36px 36px #3c4665,42px 36px #596985,48px 36px,6px 42px,12px 42px #3c4665,18px 42px #3c4665,24px 42px,30px 42px,36px 42px,42px 42px,48px 42px,6px 48px,12px 48px #3c4665,18px 48px #3c4665,24px 48px,6px 54px,12px 54px #3c4665,18px 54px #3c4665,24px 54px,6px 60px,12px 60px #3c4665,18px 60px #3c4665,24px 60px,6px 66px,12px 66px #3c4665,18px 66px #3c4665,24px 66px,6px 72px,12px 72px #3c4665,18px 72px #3c4665,24px 72px,6px 78px,12px 78px #3c4665,18px 78px #3c4665,24px 78px,6px 84px,12px 84px #3c4665,18px 84px #3c4665,24px 84px,6px 90px,12px 90px #3c4665,18px 90px #3c4665,24px 90px,30px 90px,36px 90px,42px 90px,48px 90px,6px 96px,12px 96px #3c4665,18px 96px #3c4665,24px 96px #3c4665,30px 96px #3c4665,36px 96px #3c4665,42px 96px #596985,48px 96px,6px 102px,12px 102px #3c4665,18px 102px #3c4665,24px 102px #3c4665,30px 102px #3c4665,36px 102px #3c4665,42px 102px #596985,48px 102px,6px 108px,12px 108px #3c4665,18px 108px #3c4665,24px 108px #3c4665,30px 108px #3c4665,36px 108px #3c4665,42px 108px #596985,48px 108px,6px 114px,12px 114px,18px 114px #3c4665,24px 114px #3c4665,30px 114px #3c4665,36px 114px #3c4665,42px 114px #596985,48px 114px,12px 120px,18px 120px,24px 120px #3c4665,30px 120px #3c4665,36px 120px #3c4665,42px 120px #596985,48px 120px,18px 126px,24px 126px,30px 126px,36px 126px,42px 126px,48px 126px;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-phone::before{box-shadow:18px 6px 0 .020em,24px 6px 0 .020em,30px 6px 0 .020em,36px 6px 0 .020em,42px 6px 0 .020em,48px 6px 0 .020em,12px 12px 0 .020em,18px 12px 0 .020em,24px 12px 0 .020em #3c4665,30px 12px 0 .020em #3c4665,36px 12px 0 .020em #3c4665,42px 12px 0 .020em #596985,48px 12px 0 .020em,6px 18px 0 .020em,12px 18px 0 .020em,18px 18px 0 .020em #3c4665,24px 18px 0 .020em #3c4665,30px 18px 0 .020em #3c4665,36px 18px 0 .020em #3c4665,42px 18px 0 .020em #596985,48px 18px 0 .020em,6px 24px 0 .020em,12px 24px 0 .020em #3c4665,18px 24px 0 .020em #3c4665,24px 24px 0 .020em #3c4665,30px 24px 0 .020em #3c4665,36px 24px 0 .020em #3c4665,42px 24px 0 .020em #596985,48px 24px 0 .020em,6px 30px 0 .020em,12px 30px 0 .020em #3c4665,18px 30px 0 .020em #3c4665,24px 30px 0 .020em #3c4665,30px 30px 0 .020em #3c4665,36px 30px 0 .020em #3c4665,42px 30px 0 .020em #596985,48px 30px 0 .020em,6px 36px 0 .020em,12px 36px 0 .020em #3c4665,18px 36px 0 .020em #3c4665,24px 36px 0 .020em #3c4665,30px 36px 0 .020em #3c4665,36px 36px 0 .020em #3c4665,42px 36px 0 .020em #596985,48px 36px 0 .020em,6px 42px 0 .020em,12px 42px 0 .020em #3c4665,18px 42px 0 .020em #3c4665,24px 42px 0 .020em,30px 42px 0 .020em,36px 42px 0 .020em,42px 42px 0 .020em,48px 42px 0 .020em,6px 48px 0 .020em,12px 48px 0 .020em #3c4665,18px 48px 0 .020em #3c4665,24px 48px 0 .020em,6px 54px 0 .020em,12px 54px 0 .020em #3c4665,18px 54px 0 .020em #3c4665,24px 54px 0 .020em,6px 60px 0 .020em,12px 60px 0 .020em #3c4665,18px 60px 0 .020em #3c4665,24px 60px 0 .020em,6px 66px 0 .020em,12px 66px 0 .020em #3c4665,18px 66px 0 .020em #3c4665,24px 66px 0 .020em,6px 72px 0 .020em,12px 72px 0 .020em #3c4665,18px 72px 0 .020em #3c4665,24px 72px 0 .020em,6px 78px 0 .020em,12px 78px 0 .020em #3c4665,18px 78px 0 .020em #3c4665,24px 78px 0 .020em,6px 84px 0 .020em,12px 84px 0 .020em #3c4665,18px 84px 0 .020em #3c4665,24px 84px 0 .020em,6px 90px 0 .020em,12px 90px 0 .020em #3c4665,18px 90px 0 .020em #3c4665,24px 90px 0 .020em,30px 90px 0 .020em,36px 90px 0 .020em,42px 90px 0 .020em,48px 90px 0 .020em,6px 96px 0 .020em,12px 96px 0 .020em #3c4665,18px 96px 0 .020em #3c4665,24px 96px 0 .020em #3c4665,30px 96px 0 .020em #3c4665,36px 96px 0 .020em #3c4665,42px 96px 0 .020em #596985,48px 96px 0 .020em,6px 102px 0 .020em,12px 102px 0 .020em #3c4665,18px 102px 0 .020em #3c4665,24px 102px 0 .020em #3c4665,30px 102px 0 .020em #3c4665,36px 102px 0 .020em #3c4665,42px 102px 0 .020em #596985,48px 102px 0 .020em,6px 108px 0 .020em,12px 108px 0 .020em #3c4665,18px 108px 0 .020em #3c4665,24px 108px 0 .020em #3c4665,30px 108px 0 .020em #3c4665,36px 108px 0 .020em #3c4665,42px 108px 0 .020em #596985,48px 108px 0 .020em,6px 114px 0 .020em,12px 114px 0 .020em,18px 114px 0 .020em #3c4665,24px 114px 0 .020em #3c4665,30px 114px 0 .020em #3c4665,36px 114px 0 .020em #3c4665,42px 114px 0 .020em #596985,48px 114px 0 .020em,12px 120px 0 .020em,18px 120px 0 .020em,24px 120px 0 .020em #3c4665,30px 120px 0 .020em #3c4665,36px 120px 0 .020em #3c4665,42px 120px 0 .020em #596985,48px 120px 0 .020em,18px 126px 0 .020em,24px 126px 0 .020em,30px 126px 0 .020em,36px 126px 0 .020em,42px 126px 0 .020em,48px 126px 0 .020em}}.nes-smartphone{position:relative;display:inline-block;width:90px;height:162px}.nes-smartphone::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#060606;box-shadow:12px 6px,18px 6px,24px 6px,30px 6px,36px 6px,42px 6px,48px 6px,54px 6px,60px 6px,66px 6px,72px 6px,78px 6px,84px 6px,6px 12px,12px 12px,18px 12px #fff,24px 12px #fff,30px 12px #fff,36px 12px #fff,42px 12px #fff,48px 12px #fff,54px 12px #fff,60px 12px #fff,66px 12px #fff,72px 12px #fff,78px 12px #fff,84px 12px,90px 12px,6px 18px,12px 18px #fff,18px 18px #fff,24px 18px #fff,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px,66px 18px,72px 18px #fff,78px 18px #fff,84px 18px #fff,90px 18px,6px 24px,12px 24px #fff,18px 24px #fff,24px 24px #fff,30px 24px #fff,36px 24px #fff,42px 24px #fff,48px 24px #fff,54px 24px #fff,60px 24px #fff,66px 24px #fff,72px 24px #fff,78px 24px #fff,84px 24px #fff,90px 24px,6px 30px,12px 30px #fff,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px,48px 30px,54px 30px,60px 30px,66px 30px,72px 30px,78px 30px,84px 30px #fff,90px 30px,6px 36px,12px 36px #fff,18px 36px,24px 36px,30px 36px,36px 36px,42px 36px,48px 36px,54px 36px,60px 36px,66px 36px,72px 36px,78px 36px,84px 36px #fff,90px 36px,6px 42px,12px 42px #fff,18px 42px,24px 42px,30px 42px,36px 42px,42px 42px,48px 42px,54px 42px,60px 42px,66px 42px,72px 42px,78px 42px,84px 42px #fff,90px 42px,6px 48px,12px 48px #fff,18px 48px,24px 48px,30px 48px,36px 48px,42px 48px,48px 48px,54px 48px,60px 48px,66px 48px,72px 48px,78px 48px,84px 48px #fff,90px 48px,6px 54px,12px 54px #fff,18px 54px,24px 54px,30px 54px,36px 54px,42px 54px,48px 54px,54px 54px,60px 54px,66px 54px,72px 54px,78px 54px,84px 54px #fff,90px 54px,6px 60px,12px 60px #fff,18px 60px,24px 60px,30px 60px,36px 60px,42px 60px,48px 60px,54px 60px,60px 60px,66px 60px,72px 60px,78px 60px,84px 60px #fff,90px 60px,6px 66px,12px 66px #fff,18px 66px,24px 66px,30px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,66px 66px,72px 66px,78px 66px,84px 66px #fff,90px 66px,6px 72px,12px 72px #fff,18px 72px,24px 72px,30px 72px,36px 72px,42px 72px,48px 72px,54px 72px,60px 72px,66px 72px,72px 72px,78px 72px,84px 72px #fff,90px 72px,6px 78px,12px 78px #fff,18px 78px,24px 78px,30px 78px,36px 78px,42px 78px,48px 78px,54px 78px,60px 78px,66px 78px,72px 78px,78px 78px,84px 78px #fff,90px 78px,6px 84px,12px 84px #fff,18px 84px,24px 84px,30px 84px,36px 84px,42px 84px,48px 84px,54px 84px,60px 84px,66px 84px,72px 84px,78px 84px,84px 84px #fff,90px 84px,6px 90px,12px 90px #fff,18px 90px,24px 90px,30px 90px,36px 90px,42px 90px,48px 90px,54px 90px,60px 90px,66px 90px,72px 90px,78px 90px,84px 90px #fff,90px 90px,6px 96px,12px 96px #fff,18px 96px,24px 96px,30px 96px,36px 96px,42px 96px,48px 96px,54px 96px,60px 96px,66px 96px,72px 96px,78px 96px,84px 96px #fff,90px 96px,6px 102px,12px 102px #fff,18px 102px,24px 102px,30px 102px,36px 102px,42px 102px,48px 102px,54px 102px,60px 102px,66px 102px,72px 102px,78px 102px,84px 102px #fff,90px 102px,6px 108px,12px 108px #fff,18px 108px,24px 108px,30px 108px,36px 108px,42px 108px,48px 108px,54px 108px,60px 108px,66px 108px,72px 108px,78px 108px,84px 108px #fff,90px 108px,6px 114px,12px 114px #fff,18px 114px,24px 114px,30px 114px,36px 114px,42px 114px,48px 114px,54px 114px,60px 114px,66px 114px,72px 114px,78px 114px,84px 114px #fff,90px 114px,6px 120px,12px 120px #fff,18px 120px,24px 120px,30px 120px,36px 120px,42px 120px,48px 120px,54px 120px,60px 120px,66px 120px,72px 120px,78px 120px,84px 120px #fff,90px 120px,6px 126px,12px 126px #fff,18px 126px,24px 126px,30px 126px,36px 126px,42px 126px,48px 126px,54px 126px,60px 126px,66px 126px,72px 126px,78px 126px,84px 126px #fff,90px 126px,6px 132px,12px 132px #fff,18px 132px,24px 132px,30px 132px,36px 132px,42px 132px,48px 132px,54px 132px,60px 132px,66px 132px,72px 132px,78px 132px,84px 132px #fff,90px 132px,6px 138px,12px 138px #fff,18px 138px #fff,24px 138px #fff,30px 138px #fff,36px 138px #fff,42px 138px #fff,48px 138px #fff,54px 138px #fff,60px 138px #fff,66px 138px #fff,72px 138px #fff,78px 138px #fff,84px 138px #fff,90px 138px,6px 144px,12px 144px #fff,18px 144px #fff,24px 144px #fff,30px 144px #fff,36px 144px #fff,42px 144px #fff,48px 144px,54px 144px,60px 144px #fff,66px 144px #fff,72px 144px #fff,78px 144px #fff,84px 144px #fff,90px 144px,6px 150px,12px 150px #fff,18px 150px #fff,24px 150px #fff,30px 150px #fff,36px 150px #fff,42px 150px #fff,48px 150px,54px 150px,60px 150px #fff,66px 150px #fff,72px 150px #fff,78px 150px #fff,84px 150px #fff,90px 150px,6px 156px,12px 156px,18px 156px #fff,24px 156px #fff,30px 156px #fff,36px 156px #fff,42px 156px #fff,48px 156px #fff,54px 156px #fff,60px 156px #fff,66px 156px #fff,72px 156px #fff,78px 156px #fff,84px 156px,90px 156px,12px 162px,18px 162px,24px 162px,30px 162px,36px 162px,42px 162px,48px 162px,54px 162px,60px 162px,66px 162px,72px 162px,78px 162px,84px 162px;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-smartphone::before{box-shadow:12px 6px 0 .020em,18px 6px 0 .020em,24px 6px 0 .020em,30px 6px 0 .020em,36px 6px 0 .020em,42px 6px 0 .020em,48px 6px 0 .020em,54px 6px 0 .020em,60px 6px 0 .020em,66px 6px 0 .020em,72px 6px 0 .020em,78px 6px 0 .020em,84px 6px 0 .020em,6px 12px 0 .020em,12px 12px 0 .020em,18px 12px 0 .020em #fff,24px 12px 0 .020em #fff,30px 12px 0 .020em #fff,36px 12px 0 .020em #fff,42px 12px 0 .020em #fff,48px 12px 0 .020em #fff,54px 12px 0 .020em #fff,60px 12px 0 .020em #fff,66px 12px 0 .020em #fff,72px 12px 0 .020em #fff,78px 12px 0 .020em #fff,84px 12px 0 .020em,90px 12px 0 .020em,6px 18px 0 .020em,12px 18px 0 .020em #fff,18px 18px 0 .020em #fff,24px 18px 0 .020em #fff,30px 18px 0 .020em,36px 18px 0 .020em,42px 18px 0 .020em,48px 18px 0 .020em,54px 18px 0 .020em,60px 18px 0 .020em,66px 18px 0 .020em,72px 18px 0 .020em #fff,78px 18px 0 .020em #fff,84px 18px 0 .020em #fff,90px 18px 0 .020em,6px 24px 0 .020em,12px 24px 0 .020em #fff,18px 24px 0 .020em #fff,24px 24px 0 .020em #fff,30px 24px 0 .020em #fff,36px 24px 0 .020em #fff,42px 24px 0 .020em #fff,48px 24px 0 .020em #fff,54px 24px 0 .020em #fff,60px 24px 0 .020em #fff,66px 24px 0 .020em #fff,72px 24px 0 .020em #fff,78px 24px 0 .020em #fff,84px 24px 0 .020em #fff,90px 24px 0 .020em,6px 30px 0 .020em,12px 30px 0 .020em #fff,18px 30px 0 .020em,24px 30px 0 .020em,30px 30px 0 .020em,36px 30px 0 .020em,42px 30px 0 .020em,48px 30px 0 .020em,54px 30px 0 .020em,60px 30px 0 .020em,66px 30px 0 .020em,72px 30px 0 .020em,78px 30px 0 .020em,84px 30px 0 .020em #fff,90px 30px 0 .020em,6px 36px 0 .020em,12px 36px 0 .020em #fff,18px 36px 0 .020em,24px 36px 0 .020em,30px 36px 0 .020em,36px 36px 0 .020em,42px 36px 0 .020em,48px 36px 0 .020em,54px 36px 0 .020em,60px 36px 0 .020em,66px 36px 0 .020em,72px 36px 0 .020em,78px 36px 0 .020em,84px 36px 0 .020em #fff,90px 36px 0 .020em,6px 42px 0 .020em,12px 42px 0 .020em #fff,18px 42px 0 .020em,24px 42px 0 .020em,30px 42px 0 .020em,36px 42px 0 .020em,42px 42px 0 .020em,48px 42px 0 .020em,54px 42px 0 .020em,60px 42px 0 .020em,66px 42px 0 .020em,72px 42px 0 .020em,78px 42px 0 .020em,84px 42px 0 .020em #fff,90px 42px 0 .020em,6px 48px 0 .020em,12px 48px 0 .020em #fff,18px 48px 0 .020em,24px 48px 0 .020em,30px 48px 0 .020em,36px 48px 0 .020em,42px 48px 0 .020em,48px 48px 0 .020em,54px 48px 0 .020em,60px 48px 0 .020em,66px 48px 0 .020em,72px 48px 0 .020em,78px 48px 0 .020em,84px 48px 0 .020em #fff,90px 48px 0 .020em,6px 54px 0 .020em,12px 54px 0 .020em #fff,18px 54px 0 .020em,24px 54px 0 .020em,30px 54px 0 .020em,36px 54px 0 .020em,42px 54px 0 .020em,48px 54px 0 .020em,54px 54px 0 .020em,60px 54px 0 .020em,66px 54px 0 .020em,72px 54px 0 .020em,78px 54px 0 .020em,84px 54px 0 .020em #fff,90px 54px 0 .020em,6px 60px 0 .020em,12px 60px 0 .020em #fff,18px 60px 0 .020em,24px 60px 0 .020em,30px 60px 0 .020em,36px 60px 0 .020em,42px 60px 0 .020em,48px 60px 0 .020em,54px 60px 0 .020em,60px 60px 0 .020em,66px 60px 0 .020em,72px 60px 0 .020em,78px 60px 0 .020em,84px 60px 0 .020em #fff,90px 60px 0 .020em,6px 66px 0 .020em,12px 66px 0 .020em #fff,18px 66px 0 .020em,24px 66px 0 .020em,30px 66px 0 .020em,36px 66px 0 .020em,42px 66px 0 .020em,48px 66px 0 .020em,54px 66px 0 .020em,60px 66px 0 .020em,66px 66px 0 .020em,72px 66px 0 .020em,78px 66px 0 .020em,84px 66px 0 .020em #fff,90px 66px 0 .020em,6px 72px 0 .020em,12px 72px 0 .020em #fff,18px 72px 0 .020em,24px 72px 0 .020em,30px 72px 0 .020em,36px 72px 0 .020em,42px 72px 0 .020em,48px 72px 0 .020em,54px 72px 0 .020em,60px 72px 0 .020em,66px 72px 0 .020em,72px 72px 0 .020em,78px 72px 0 .020em,84px 72px 0 .020em #fff,90px 72px 0 .020em,6px 78px 0 .020em,12px 78px 0 .020em #fff,18px 78px 0 .020em,24px 78px 0 .020em,30px 78px 0 .020em,36px 78px 0 .020em,42px 78px 0 .020em,48px 78px 0 .020em,54px 78px 0 .020em,60px 78px 0 .020em,66px 78px 0 .020em,72px 78px 0 .020em,78px 78px 0 .020em,84px 78px 0 .020em #fff,90px 78px 0 .020em,6px 84px 0 .020em,12px 84px 0 .020em #fff,18px 84px 0 .020em,24px 84px 0 .020em,30px 84px 0 .020em,36px 84px 0 .020em,42px 84px 0 .020em,48px 84px 0 .020em,54px 84px 0 .020em,60px 84px 0 .020em,66px 84px 0 .020em,72px 84px 0 .020em,78px 84px 0 .020em,84px 84px 0 .020em #fff,90px 84px 0 .020em,6px 90px 0 .020em,12px 90px 0 .020em #fff,18px 90px 0 .020em,24px 90px 0 .020em,30px 90px 0 .020em,36px 90px 0 .020em,42px 90px 0 .020em,48px 90px 0 .020em,54px 90px 0 .020em,60px 90px 0 .020em,66px 90px 0 .020em,72px 90px 0 .020em,78px 90px 0 .020em,84px 90px 0 .020em #fff,90px 90px 0 .020em,6px 96px 0 .020em,12px 96px 0 .020em #fff,18px 96px 0 .020em,24px 96px 0 .020em,30px 96px 0 .020em,36px 96px 0 .020em,42px 96px 0 .020em,48px 96px 0 .020em,54px 96px 0 .020em,60px 96px 0 .020em,66px 96px 0 .020em,72px 96px 0 .020em,78px 96px 0 .020em,84px 96px 0 .020em #fff,90px 96px 0 .020em,6px 102px 0 .020em,12px 102px 0 .020em #fff,18px 102px 0 .020em,24px 102px 0 .020em,30px 102px 0 .020em,36px 102px 0 .020em,42px 102px 0 .020em,48px 102px 0 .020em,54px 102px 0 .020em,60px 102px 0 .020em,66px 102px 0 .020em,72px 102px 0 .020em,78px 102px 0 .020em,84px 102px 0 .020em #fff,90px 102px 0 .020em,6px 108px 0 .020em,12px 108px 0 .020em #fff,18px 108px 0 .020em,24px 108px 0 .020em,30px 108px 0 .020em,36px 108px 0 .020em,42px 108px 0 .020em,48px 108px 0 .020em,54px 108px 0 .020em,60px 108px 0 .020em,66px 108px 0 .020em,72px 108px 0 .020em,78px 108px 0 .020em,84px 108px 0 .020em #fff,90px 108px 0 .020em,6px 114px 0 .020em,12px 114px 0 .020em #fff,18px 114px 0 .020em,24px 114px 0 .020em,30px 114px 0 .020em,36px 114px 0 .020em,42px 114px 0 .020em,48px 114px 0 .020em,54px 114px 0 .020em,60px 114px 0 .020em,66px 114px 0 .020em,72px 114px 0 .020em,78px 114px 0 .020em,84px 114px 0 .020em #fff,90px 114px 0 .020em,6px 120px 0 .020em,12px 120px 0 .020em #fff,18px 120px 0 .020em,24px 120px 0 .020em,30px 120px 0 .020em,36px 120px 0 .020em,42px 120px 0 .020em,48px 120px 0 .020em,54px 120px 0 .020em,60px 120px 0 .020em,66px 120px 0 .020em,72px 120px 0 .020em,78px 120px 0 .020em,84px 120px 0 .020em #fff,90px 120px 0 .020em,6px 126px 0 .020em,12px 126px 0 .020em #fff,18px 126px 0 .020em,24px 126px 0 .020em,30px 126px 0 .020em,36px 126px 0 .020em,42px 126px 0 .020em,48px 126px 0 .020em,54px 126px 0 .020em,60px 126px 0 .020em,66px 126px 0 .020em,72px 126px 0 .020em,78px 126px 0 .020em,84px 126px 0 .020em #fff,90px 126px 0 .020em,6px 132px 0 .020em,12px 132px 0 .020em #fff,18px 132px 0 .020em,24px 132px 0 .020em,30px 132px 0 .020em,36px 132px 0 .020em,42px 132px 0 .020em,48px 132px 0 .020em,54px 132px 0 .020em,60px 132px 0 .020em,66px 132px 0 .020em,72px 132px 0 .020em,78px 132px 0 .020em,84px 132px 0 .020em #fff,90px 132px 0 .020em,6px 138px 0 .020em,12px 138px 0 .020em #fff,18px 138px 0 .020em #fff,24px 138px 0 .020em #fff,30px 138px 0 .020em #fff,36px 138px 0 .020em #fff,42px 138px 0 .020em #fff,48px 138px 0 .020em #fff,54px 138px 0 .020em #fff,60px 138px 0 .020em #fff,66px 138px 0 .020em #fff,72px 138px 0 .020em #fff,78px 138px 0 .020em #fff,84px 138px 0 .020em #fff,90px 138px 0 .020em,6px 144px 0 .020em,12px 144px 0 .020em #fff,18px 144px 0 .020em #fff,24px 144px 0 .020em #fff,30px 144px 0 .020em #fff,36px 144px 0 .020em #fff,42px 144px 0 .020em #fff,48px 144px 0 .020em,54px 144px 0 .020em,60px 144px 0 .020em #fff,66px 144px 0 .020em #fff,72px 144px 0 .020em #fff,78px 144px 0 .020em #fff,84px 144px 0 .020em #fff,90px 144px 0 .020em,6px 150px 0 .020em,12px 150px 0 .020em #fff,18px 150px 0 .020em #fff,24px 150px 0 .020em #fff,30px 150px 0 .020em #fff,36px 150px 0 .020em #fff,42px 150px 0 .020em #fff,48px 150px 0 .020em,54px 150px 0 .020em,60px 150px 0 .020em #fff,66px 150px 0 .020em #fff,72px 150px 0 .020em #fff,78px 150px 0 .020em #fff,84px 150px 0 .020em #fff,90px 150px 0 .020em,6px 156px 0 .020em,12px 156px 0 .020em,18px 156px 0 .020em #fff,24px 156px 0 .020em #fff,30px 156px 0 .020em #fff,36px 156px 0 .020em #fff,42px 156px 0 .020em #fff,48px 156px 0 .020em #fff,54px 156px 0 .020em #fff,60px 156px 0 .020em #fff,66px 156px 0 .020em #fff,72px 156px 0 .020em #fff,78px 156px 0 .020em #fff,84px 156px 0 .020em,90px 156px 0 .020em,12px 162px 0 .020em,18px 162px 0 .020em,24px 162px 0 .020em,30px 162px 0 .020em,36px 162px 0 .020em,42px 162px 0 .020em,48px 162px 0 .020em,54px 162px 0 .020em,60px 162px 0 .020em,66px 162px 0 .020em,72px 162px 0 .020em,78px 162px 0 .020em,84px 162px 0 .020em}}.nes-mario{position:relative;display:inline-block;width:84px;height:96px}.nes-mario::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#f81c2f;box-shadow:30px 6px,36px 6px,42px 6px,48px 6px,54px 6px,24px 12px,30px 12px,36px 12px,42px 12px,48px 12px,54px 12px,60px 12px,66px 12px,72px 12px,24px 18px #65352b,30px 18px #65352b,36px 18px #65352b,42px 18px #ffbb8e,48px 18px #ffbb8e,54px 18px #000,60px 18px #ffbb8e,18px 24px #65352b,24px 24px #ffbb8e,30px 24px #65352b,36px 24px #ffbb8e,42px 24px #ffbb8e,48px 24px #ffbb8e,54px 24px #000,60px 24px #ffbb8e,66px 24px #ffbb8e,72px 24px #ffbb8e,18px 30px #65352b,24px 30px #ffbb8e,30px 30px #65352b,36px 30px #65352b,42px 30px #ffbb8e,48px 30px #ffbb8e,54px 30px #ffbb8e,60px 30px #000,66px 30px #ffbb8e,72px 30px #ffbb8e,78px 30px #ffbb8e,18px 36px #65352b,24px 36px #65352b,30px 36px #ffbb8e,36px 36px #ffbb8e,42px 36px #ffbb8e,48px 36px #ffbb8e,54px 36px #000,60px 36px #000,66px 36px #000,72px 36px #000,30px 42px #ffbb8e,36px 42px #ffbb8e,42px 42px #ffbb8e,48px 42px #ffbb8e,54px 42px #ffbb8e,60px 42px #ffbb8e,66px 42px #ffbb8e,30px 48px,36px 48px #1560ad,42px 48px,48px 48px,54px 48px #1560ad,18px 54px,24px 54px,30px 54px,36px 54px #1560ad,42px 54px,48px 54px,54px 54px #1560ad,60px 54px,66px 54px,72px 54px,12px 60px,18px 60px,24px 60px,30px 60px,36px 60px #1560ad,42px 60px #1560ad,48px 60px #1560ad,54px 60px #1560ad,60px 60px,66px 60px,72px 60px,78px 60px,12px 66px #aeaeac,18px 66px #aeaeac,24px 66px,30px 66px #1560ad,36px 66px #fef102,42px 66px #1560ad,48px 66px #1560ad,54px 66px #fef102,60px 66px #1560ad,66px 66px,72px 66px #aeaeac,78px 66px #aeaeac,12px 72px #aeaeac,18px 72px #aeaeac,24px 72px #aeaeac,30px 72px #1560ad,36px 72px #1560ad,42px 72px #1560ad,48px 72px #1560ad,54px 72px #1560ad,60px 72px #1560ad,66px 72px #aeaeac,72px 72px #aeaeac,78px 72px #aeaeac,12px 78px #aeaeac,18px 78px #aeaeac,24px 78px #1560ad,30px 78px #1560ad,36px 78px #1560ad,42px 78px #1560ad,48px 78px #1560ad,54px 78px #1560ad,60px 78px #1560ad,66px 78px #1560ad,72px 78px #aeaeac,78px 78px #aeaeac,24px 84px #1560ad,30px 84px #1560ad,36px 84px #1560ad,54px 84px #1560ad,60px 84px #1560ad,66px 84px #1560ad,18px 90px #65352b,24px 90px #65352b,30px 90px #65352b,60px 90px #65352b,66px 90px #65352b,72px 90px #65352b,12px 96px #65352b,18px 96px #65352b,24px 96px #65352b,30px 96px #65352b,60px 96px #65352b,66px 96px #65352b,72px 96px #65352b,78px 96px #65352b;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-mario::before{box-shadow:30px 6px 0 .020em,36px 6px 0 .020em,42px 6px 0 .020em,48px 6px 0 .020em,54px 6px 0 .020em,24px 12px 0 .020em,30px 12px 0 .020em,36px 12px 0 .020em,42px 12px 0 .020em,48px 12px 0 .020em,54px 12px 0 .020em,60px 12px 0 .020em,66px 12px 0 .020em,72px 12px 0 .020em,24px 18px 0 .020em #65352b,30px 18px 0 .020em #65352b,36px 18px 0 .020em #65352b,42px 18px 0 .020em #ffbb8e,48px 18px 0 .020em #ffbb8e,54px 18px 0 .020em #000,60px 18px 0 .020em #ffbb8e,18px 24px 0 .020em #65352b,24px 24px 0 .020em #ffbb8e,30px 24px 0 .020em #65352b,36px 24px 0 .020em #ffbb8e,42px 24px 0 .020em #ffbb8e,48px 24px 0 .020em #ffbb8e,54px 24px 0 .020em #000,60px 24px 0 .020em #ffbb8e,66px 24px 0 .020em #ffbb8e,72px 24px 0 .020em #ffbb8e,18px 30px 0 .020em #65352b,24px 30px 0 .020em #ffbb8e,30px 30px 0 .020em #65352b,36px 30px 0 .020em #65352b,42px 30px 0 .020em #ffbb8e,48px 30px 0 .020em #ffbb8e,54px 30px 0 .020em #ffbb8e,60px 30px 0 .020em #000,66px 30px 0 .020em #ffbb8e,72px 30px 0 .020em #ffbb8e,78px 30px 0 .020em #ffbb8e,18px 36px 0 .020em #65352b,24px 36px 0 .020em #65352b,30px 36px 0 .020em #ffbb8e,36px 36px 0 .020em #ffbb8e,42px 36px 0 .020em #ffbb8e,48px 36px 0 .020em #ffbb8e,54px 36px 0 .020em #000,60px 36px 0 .020em #000,66px 36px 0 .020em #000,72px 36px 0 .020em #000,30px 42px 0 .020em #ffbb8e,36px 42px 0 .020em #ffbb8e,42px 42px 0 .020em #ffbb8e,48px 42px 0 .020em #ffbb8e,54px 42px 0 .020em #ffbb8e,60px 42px 0 .020em #ffbb8e,66px 42px 0 .020em #ffbb8e,30px 48px 0 .020em,36px 48px 0 .020em #1560ad,42px 48px 0 .020em,48px 48px 0 .020em,54px 48px 0 .020em #1560ad,18px 54px 0 .020em,24px 54px 0 .020em,30px 54px 0 .020em,36px 54px 0 .020em #1560ad,42px 54px 0 .020em,48px 54px 0 .020em,54px 54px 0 .020em #1560ad,60px 54px 0 .020em,66px 54px 0 .020em,72px 54px 0 .020em,12px 60px 0 .020em,18px 60px 0 .020em,24px 60px 0 .020em,30px 60px 0 .020em,36px 60px 0 .020em #1560ad,42px 60px 0 .020em #1560ad,48px 60px 0 .020em #1560ad,54px 60px 0 .020em #1560ad,60px 60px 0 .020em,66px 60px 0 .020em,72px 60px 0 .020em,78px 60px 0 .020em,12px 66px 0 .020em #aeaeac,18px 66px 0 .020em #aeaeac,24px 66px 0 .020em,30px 66px 0 .020em #1560ad,36px 66px 0 .020em #fef102,42px 66px 0 .020em #1560ad,48px 66px 0 .020em #1560ad,54px 66px 0 .020em #fef102,60px 66px 0 .020em #1560ad,66px 66px 0 .020em,72px 66px 0 .020em #aeaeac,78px 66px 0 .020em #aeaeac,12px 72px 0 .020em #aeaeac,18px 72px 0 .020em #aeaeac,24px 72px 0 .020em #aeaeac,30px 72px 0 .020em #1560ad,36px 72px 0 .020em #1560ad,42px 72px 0 .020em #1560ad,48px 72px 0 .020em #1560ad,54px 72px 0 .020em #1560ad,60px 72px 0 .020em #1560ad,66px 72px 0 .020em #aeaeac,72px 72px 0 .020em #aeaeac,78px 72px 0 .020em #aeaeac,12px 78px 0 .020em #aeaeac,18px 78px 0 .020em #aeaeac,24px 78px 0 .020em #1560ad,30px 78px 0 .020em #1560ad,36px 78px 0 .020em #1560ad,42px 78px 0 .020em #1560ad,48px 78px 0 .020em #1560ad,54px 78px 0 .020em #1560ad,60px 78px 0 .020em #1560ad,66px 78px 0 .020em #1560ad,72px 78px 0 .020em #aeaeac,78px 78px 0 .020em #aeaeac,24px 84px 0 .020em #1560ad,30px 84px 0 .020em #1560ad,36px 84px 0 .020em #1560ad,54px 84px 0 .020em #1560ad,60px 84px 0 .020em #1560ad,66px 84px 0 .020em #1560ad,18px 90px 0 .020em #65352b,24px 90px 0 .020em #65352b,30px 90px 0 .020em #65352b,60px 90px 0 .020em #65352b,66px 90px 0 .020em #65352b,72px 90px 0 .020em #65352b,12px 96px 0 .020em #65352b,18px 96px 0 .020em #65352b,24px 96px 0 .020em #65352b,30px 96px 0 .020em #65352b,60px 96px 0 .020em #65352b,66px 96px 0 .020em #65352b,72px 96px 0 .020em #65352b,78px 96px 0 .020em #65352b}}.nes-kirby{position:relative;display:inline-block;width:96px;height:96px}.nes-kirby::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#ffaccc;box-shadow:18px 6px #000,24px 6px #000,36px 6px #000,42px 6px #000,48px 6px #000,54px 6px #000,60px 6px #000,12px 12px #000,18px 12px,24px 12px,30px 12px #000,36px 12px,42px 12px,48px 12px,54px 12px,60px 12px,66px 12px #000,72px 12px #000,6px 18px #000,12px 18px,18px 18px,24px 18px #000,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px,66px 18px,72px 18px,78px 18px #000,6px 24px #000,12px 24px,18px 24px,24px 24px,30px 24px,36px 24px,42px 24px #000,48px 24px,54px 24px #000,60px 24px,66px 24px,72px 24px,78px 24px,84px 24px #000,6px 30px #000,12px 30px,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px #000,48px 30px,54px 30px #000,60px 30px,66px 30px,72px 30px,78px 30px,84px 30px #000,6px 36px #000,12px 36px,18px 36px,24px 36px,30px 36px,36px 36px,42px 36px #000,48px 36px,54px 36px #000,60px 36px,66px 36px,72px 36px,78px 36px,84px 36px,90px 36px #000,6px 42px #000,12px 42px,18px 42px,24px 42px,30px 42px #ff5478,36px 42px #ff5478,42px 42px,48px 42px,54px 42px,60px 42px #ff5478,66px 42px #ff5478,72px 42px,78px 42px,84px 42px,90px 42px,96px 42px #000,6px 48px #000,12px 48px,18px 48px,24px 48px,30px 48px,36px 48px,42px 48px,48px 48px #000,54px 48px,60px 48px,66px 48px,72px 48px,78px 48px,84px 48px,90px 48px,96px 48px #000,12px 54px #000,18px 54px,24px 54px,30px 54px,36px 54px,42px 54px,48px 54px #000,54px 54px,60px 54px,66px 54px,72px 54px,78px 54px,84px 54px,90px 54px,96px 54px #000,12px 60px #000,18px 60px,24px 60px,30px 60px,36px 60px,42px 60px,48px 60px,54px 60px,60px 60px,66px 60px,72px 60px,78px 60px #000,84px 60px #000,90px 60px #000,12px 66px #000,18px 66px,24px 66px,30px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,66px 66px,72px 66px #000,78px 66px #ff5478,84px 66px #ff5478,90px 66px #ff5478,96px 66px #000,18px 72px #000,24px 72px,30px 72px,36px 72px,42px 72px,48px 72px,54px 72px,60px 72px,66px 72px #000,72px 72px #ff5478,78px 72px #ff5478,84px 72px #ff5478,90px 72px #ff5478,96px 72px #000,18px 78px #000,24px 78px #000,30px 78px,36px 78px,42px 78px,48px 78px,54px 78px,60px 78px,66px 78px #000,72px 78px #ff5478,78px 78px #ff5478,84px 78px #ff5478,90px 78px #ff5478,96px 78px #000,12px 84px #000,18px 84px #ff5478,24px 84px #ff5478,30px 84px #000,36px 84px #000,42px 84px,48px 84px,54px 84px,60px 84px #000,66px 84px #ff5478,72px 84px #ff5478,78px 84px #ff5478,84px 84px #ff5478,90px 84px #000,6px 90px #000,12px 90px #ff5478,18px 90px #ff5478,24px 90px #ff5478,30px 90px #ff5478,36px 90px #ff5478,42px 90px #000,48px 90px #000,54px 90px #000,60px 90px #000,66px 90px #000,72px 90px #ff5478,78px 90px #ff5478,84px 90px #000,12px 96px #000,18px 96px #000,24px 96px #000,30px 96px #000,36px 96px #000,42px 96px #000,66px 96px #000,72px 96px #000,78px 96px #000;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-kirby::before{box-shadow:18px 6px 0 .020em #000,24px 6px 0 .020em #000,36px 6px 0 .020em #000,42px 6px 0 .020em #000,48px 6px 0 .020em #000,54px 6px 0 .020em #000,60px 6px 0 .020em #000,12px 12px 0 .020em #000,18px 12px 0 .020em,24px 12px 0 .020em,30px 12px 0 .020em #000,36px 12px 0 .020em,42px 12px 0 .020em,48px 12px 0 .020em,54px 12px 0 .020em,60px 12px 0 .020em,66px 12px 0 .020em #000,72px 12px 0 .020em #000,6px 18px 0 .020em #000,12px 18px 0 .020em,18px 18px 0 .020em,24px 18px 0 .020em #000,30px 18px 0 .020em,36px 18px 0 .020em,42px 18px 0 .020em,48px 18px 0 .020em,54px 18px 0 .020em,60px 18px 0 .020em,66px 18px 0 .020em,72px 18px 0 .020em,78px 18px 0 .020em #000,6px 24px 0 .020em #000,12px 24px 0 .020em,18px 24px 0 .020em,24px 24px 0 .020em,30px 24px 0 .020em,36px 24px 0 .020em,42px 24px 0 .020em #000,48px 24px 0 .020em,54px 24px 0 .020em #000,60px 24px 0 .020em,66px 24px 0 .020em,72px 24px 0 .020em,78px 24px 0 .020em,84px 24px 0 .020em #000,6px 30px 0 .020em #000,12px 30px 0 .020em,18px 30px 0 .020em,24px 30px 0 .020em,30px 30px 0 .020em,36px 30px 0 .020em,42px 30px 0 .020em #000,48px 30px 0 .020em,54px 30px 0 .020em #000,60px 30px 0 .020em,66px 30px 0 .020em,72px 30px 0 .020em,78px 30px 0 .020em,84px 30px 0 .020em #000,6px 36px 0 .020em #000,12px 36px 0 .020em,18px 36px 0 .020em,24px 36px 0 .020em,30px 36px 0 .020em,36px 36px 0 .020em,42px 36px 0 .020em #000,48px 36px 0 .020em,54px 36px 0 .020em #000,60px 36px 0 .020em,66px 36px 0 .020em,72px 36px 0 .020em,78px 36px 0 .020em,84px 36px 0 .020em,90px 36px 0 .020em #000,6px 42px 0 .020em #000,12px 42px 0 .020em,18px 42px 0 .020em,24px 42px 0 .020em,30px 42px 0 .020em #ff5478,36px 42px 0 .020em #ff5478,42px 42px 0 .020em,48px 42px 0 .020em,54px 42px 0 .020em,60px 42px 0 .020em #ff5478,66px 42px 0 .020em #ff5478,72px 42px 0 .020em,78px 42px 0 .020em,84px 42px 0 .020em,90px 42px 0 .020em,96px 42px 0 .020em #000,6px 48px 0 .020em #000,12px 48px 0 .020em,18px 48px 0 .020em,24px 48px 0 .020em,30px 48px 0 .020em,36px 48px 0 .020em,42px 48px 0 .020em,48px 48px 0 .020em #000,54px 48px 0 .020em,60px 48px 0 .020em,66px 48px 0 .020em,72px 48px 0 .020em,78px 48px 0 .020em,84px 48px 0 .020em,90px 48px 0 .020em,96px 48px 0 .020em #000,12px 54px 0 .020em #000,18px 54px 0 .020em,24px 54px 0 .020em,30px 54px 0 .020em,36px 54px 0 .020em,42px 54px 0 .020em,48px 54px 0 .020em #000,54px 54px 0 .020em,60px 54px 0 .020em,66px 54px 0 .020em,72px 54px 0 .020em,78px 54px 0 .020em,84px 54px 0 .020em,90px 54px 0 .020em,96px 54px 0 .020em #000,12px 60px 0 .020em #000,18px 60px 0 .020em,24px 60px 0 .020em,30px 60px 0 .020em,36px 60px 0 .020em,42px 60px 0 .020em,48px 60px 0 .020em,54px 60px 0 .020em,60px 60px 0 .020em,66px 60px 0 .020em,72px 60px 0 .020em,78px 60px 0 .020em #000,84px 60px 0 .020em #000,90px 60px 0 .020em #000,12px 66px 0 .020em #000,18px 66px 0 .020em,24px 66px 0 .020em,30px 66px 0 .020em,36px 66px 0 .020em,42px 66px 0 .020em,48px 66px 0 .020em,54px 66px 0 .020em,60px 66px 0 .020em,66px 66px 0 .020em,72px 66px 0 .020em #000,78px 66px 0 .020em #ff5478,84px 66px 0 .020em #ff5478,90px 66px 0 .020em #ff5478,96px 66px 0 .020em #000,18px 72px 0 .020em #000,24px 72px 0 .020em,30px 72px 0 .020em,36px 72px 0 .020em,42px 72px 0 .020em,48px 72px 0 .020em,54px 72px 0 .020em,60px 72px 0 .020em,66px 72px 0 .020em #000,72px 72px 0 .020em #ff5478,78px 72px 0 .020em #ff5478,84px 72px 0 .020em #ff5478,90px 72px 0 .020em #ff5478,96px 72px 0 .020em #000,18px 78px 0 .020em #000,24px 78px 0 .020em #000,30px 78px 0 .020em,36px 78px 0 .020em,42px 78px 0 .020em,48px 78px 0 .020em,54px 78px 0 .020em,60px 78px 0 .020em,66px 78px 0 .020em #000,72px 78px 0 .020em #ff5478,78px 78px 0 .020em #ff5478,84px 78px 0 .020em #ff5478,90px 78px 0 .020em #ff5478,96px 78px 0 .020em #000,12px 84px 0 .020em #000,18px 84px 0 .020em #ff5478,24px 84px 0 .020em #ff5478,30px 84px 0 .020em #000,36px 84px 0 .020em #000,42px 84px 0 .020em,48px 84px 0 .020em,54px 84px 0 .020em,60px 84px 0 .020em #000,66px 84px 0 .020em #ff5478,72px 84px 0 .020em #ff5478,78px 84px 0 .020em #ff5478,84px 84px 0 .020em #ff5478,90px 84px 0 .020em #000,6px 90px 0 .020em #000,12px 90px 0 .020em #ff5478,18px 90px 0 .020em #ff5478,24px 90px 0 .020em #ff5478,30px 90px 0 .020em #ff5478,36px 90px 0 .020em #ff5478,42px 90px 0 .020em #000,48px 90px 0 .020em #000,54px 90px 0 .020em #000,60px 90px 0 .020em #000,66px 90px 0 .020em #000,72px 90px 0 .020em #ff5478,78px 90px 0 .020em #ff5478,84px 90px 0 .020em #000,12px 96px 0 .020em #000,18px 96px 0 .020em #000,24px 96px 0 .020em #000,30px 96px 0 .020em #000,36px 96px 0 .020em #000,42px 96px 0 .020em #000,66px 96px 0 .020em #000,72px 96px 0 .020em #000,78px 96px 0 .020em #000}}.nes-octocat{position:relative;display:inline-block;width:84px;height:90px}.nes-octocat::before{position:absolute;top:-6px;left:-6px;content:"";background:0 0;width:6px;height:6px;color:#333;box-shadow:24px 6px,78px 6px,24px 12px,30px 12px,72px 12px,78px 12px,24px 18px,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px,66px 18px,72px 18px,78px 18px,18px 24px,24px 24px,30px 24px,36px 24px,42px 24px,48px 24px,54px 24px,60px 24px,66px 24px,72px 24px,78px 24px,84px 24px,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px,48px 30px,54px 30px,60px 30px,66px 30px,72px 30px,78px 30px,84px 30px,18px 36px,24px 36px,30px 36px,36px 36px #ffdec4,42px 36px #ffdec4,48px 36px #ffdec4,54px 36px #ffdec4,60px 36px #ffdec4,66px 36px #ffdec4,72px 36px,78px 36px,84px 36px,18px 42px,24px 42px,30px 42px #ffdec4,36px 42px #cb7066,42px 42px #ffdec4,48px 42px #ffdec4,54px 42px #ffdec4,60px 42px #ffdec4,66px 42px #cb7066,72px 42px #ffdec4,78px 42px,84px 42px,18px 48px,24px 48px,30px 48px #ffdec4,36px 48px #cb7066,42px 48px #ffdec4,48px 48px #ffdec4,54px 48px #ffdec4,60px 48px #ffdec4,66px 48px #cb7066,72px 48px #ffdec4,78px 48px,84px 48px,24px 54px,30px 54px,36px 54px #ffdec4,42px 54px #ffdec4,48px 54px #cb7066,54px 54px #cb7066,60px 54px #ffdec4,66px 54px #ffdec4,72px 54px,78px 54px,6px 60px,12px 60px,42px 60px,48px 60px,54px 60px,60px 60px,18px 66px,24px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,66px 66px,24px 72px,30px 72px,36px 72px,42px 72px,48px 72px,54px 72px,60px 72px,66px 72px,36px 78px,48px 78px,54px 78px,66px 78px,36px 84px,48px 84px,54px 84px,66px 84px,30px 90px,42px 90px,60px 90px,72px 90px;transform:rotate(0)}@supports (-moz-appearance:meterbar){.nes-octocat::before{box-shadow:24px 6px 0 .020em,78px 6px 0 .020em,24px 12px 0 .020em,30px 12px 0 .020em,72px 12px 0 .020em,78px 12px 0 .020em,24px 18px 0 .020em,30px 18px 0 .020em,36px 18px 0 .020em,42px 18px 0 .020em,48px 18px 0 .020em,54px 18px 0 .020em,60px 18px 0 .020em,66px 18px 0 .020em,72px 18px 0 .020em,78px 18px 0 .020em,18px 24px 0 .020em,24px 24px 0 .020em,30px 24px 0 .020em,36px 24px 0 .020em,42px 24px 0 .020em,48px 24px 0 .020em,54px 24px 0 .020em,60px 24px 0 .020em,66px 24px 0 .020em,72px 24px 0 .020em,78px 24px 0 .020em,84px 24px 0 .020em,18px 30px 0 .020em,24px 30px 0 .020em,30px 30px 0 .020em,36px 30px 0 .020em,42px 30px 0 .020em,48px 30px 0 .020em,54px 30px 0 .020em,60px 30px 0 .020em,66px 30px 0 .020em,72px 30px 0 .020em,78px 30px 0 .020em,84px 30px 0 .020em,18px 36px 0 .020em,24px 36px 0 .020em,30px 36px 0 .020em,36px 36px 0 .020em #ffdec4,42px 36px 0 .020em #ffdec4,48px 36px 0 .020em #ffdec4,54px 36px 0 .020em #ffdec4,60px 36px 0 .020em #ffdec4,66px 36px 0 .020em #ffdec4,72px 36px 0 .020em,78px 36px 0 .020em,84px 36px 0 .020em,18px 42px 0 .020em,24px 42px 0 .020em,30px 42px 0 .020em #ffdec4,36px 42px 0 .020em #cb7066,42px 42px 0 .020em #ffdec4,48px 42px 0 .020em #ffdec4,54px 42px 0 .020em #ffdec4,60px 42px 0 .020em #ffdec4,66px 42px 0 .020em #cb7066,72px 42px 0 .020em #ffdec4,78px 42px 0 .020em,84px 42px 0 .020em,18px 48px 0 .020em,24px 48px 0 .020em,30px 48px 0 .020em #ffdec4,36px 48px 0 .020em #cb7066,42px 48px 0 .020em #ffdec4,48px 48px 0 .020em #ffdec4,54px 48px 0 .020em #ffdec4,60px 48px 0 .020em #ffdec4,66px 48px 0 .020em #cb7066,72px 48px 0 .020em #ffdec4,78px 48px 0 .020em,84px 48px 0 .020em,24px 54px 0 .020em,30px 54px 0 .020em,36px 54px 0 .020em #ffdec4,42px 54px 0 .020em #ffdec4,48px 54px 0 .020em #cb7066,54px 54px 0 .020em #cb7066,60px 54px 0 .020em #ffdec4,66px 54px 0 .020em #ffdec4,72px 54px 0 .020em,78px 54px 0 .020em,6px 60px 0 .020em,12px 60px 0 .020em,42px 60px 0 .020em,48px 60px 0 .020em,54px 60px 0 .020em,60px 60px 0 .020em,18px 66px 0 .020em,24px 66px 0 .020em,36px 66px 0 .020em,42px 66px 0 .020em,48px 66px 0 .020em,54px 66px 0 .020em,60px 66px 0 .020em,66px 66px 0 .020em,24px 72px 0 .020em,30px 72px 0 .020em,36px 72px 0 .020em,42px 72px 0 .020em,48px 72px 0 .020em,54px 72px 0 .020em,60px 72px 0 .020em,66px 72px 0 .020em,36px 78px 0 .020em,48px 78px 0 .020em,54px 78px 0 .020em,66px 78px 0 .020em,36px 84px 0 .020em,48px 84px 0 .020em,54px 84px 0 .020em,66px 84px 0 .020em,30px 90px 0 .020em,42px 90px 0 .020em,60px 90px 0 .020em,72px 90px 0 .020em}}.nes-octocat.animate::before{animation:wave .5s infinite steps(1)}@keyframes wave{50%{width:6px;height:6px;color:#333;box-shadow:24px 6px,78px 6px,24px 12px,30px 12px,72px 12px,78px 12px,24px 18px,30px 18px,36px 18px,42px 18px,48px 18px,54px 18px,60px 18px,66px 18px,72px 18px,78px 18px,18px 24px,24px 24px,30px 24px,36px 24px,42px 24px,48px 24px,54px 24px,60px 24px,66px 24px,72px 24px,78px 24px,84px 24px,18px 30px,24px 30px,30px 30px,36px 30px,42px 30px,48px 30px,54px 30px,60px 30px,66px 30px,72px 30px,78px 30px,84px 30px,18px 36px,24px 36px,30px 36px,36px 36px #ffdec4,42px 36px #ffdec4,48px 36px #ffdec4,54px 36px #ffdec4,60px 36px #ffdec4,66px 36px #ffdec4,72px 36px,78px 36px,84px 36px,18px 42px,24px 42px,30px 42px #ffdec4,36px 42px #ffdec4,42px 42px #ffdec4,48px 42px #ffdec4,54px 42px #ffdec4,60px 42px #ffdec4,66px 42px #ffdec4,72px 42px #ffdec4,78px 42px,84px 42px,12px 48px,18px 48px,24px 48px,30px 48px #ffdec4,36px 48px #cb7066,42px 48px #ffdec4,48px 48px #ffdec4,54px 48px #ffdec4,60px 48px #ffdec4,66px 48px #cb7066,72px 48px #ffdec4,78px 48px,84px 48px,12px 54px,24px 54px,30px 54px,36px 54px #ffdec4,42px 54px #ffdec4,48px 54px #cb7066,54px 54px #cb7066,60px 54px #ffdec4,66px 54px #ffdec4,72px 54px,78px 54px,18px 60px,42px 60px,48px 60px,54px 60px,60px 60px,24px 66px,36px 66px,42px 66px,48px 66px,54px 66px,60px 66px,66px 66px,24px 72px,30px 72px,36px 72px,42px 72px,48px 72px,54px 72px,60px 72px,66px 72px,36px 78px,48px 78px,54px 78px,66px 78px,36px 84px,48px 84px,54px 84px,66px 84px,30px 90px,42px 90px,60px 90px,72px 90px}} \ No newline at end of file diff --git a/node_modules/nes.css/package.json b/node_modules/nes.css/package.json deleted file mode 100644 index eab3bdd..0000000 --- a/node_modules/nes.css/package.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "_args": [ - [ - "nes.css@2.3.0", - "F:\\Documents\\websites\\BMM" - ] - ], - "_from": "nes.css@2.3.0", - "_id": "nes.css@2.3.0", - "_inBundle": false, - "_integrity": "sha512-lCFZs9vj3f5RVdbvTL/kSxiYsOARwSeAdJaMNo+bCgmWOO9x8ay7QpT4yQVKHy3r5Dttzd0uqVdpt3fvvx6EpQ==", - "_location": "/nes.css", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "nes.css@2.3.0", - "name": "nes.css", - "escapedName": "nes.css", - "rawSpec": "2.3.0", - "saveSpec": null, - "fetchSpec": "2.3.0" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/nes.css/-/nes.css-2.3.0.tgz", - "_spec": "2.3.0", - "_where": "F:\\Documents\\websites\\BMM", - "author": { - "name": "BcRikko", - "url": "https://github.com/Bcrikko" - }, - "browserslist": [ - "> 1%" - ], - "bugs": { - "url": "https://github.com/nostalgic-css/NES.css/issues" - }, - "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ], - "rules": { - "subject-case": [ - 0, - "never", - "sentence-case" - ], - "subject-full-stop": [ - 0, - "never", - "." - ] - } - }, - "config": { - "commitizen": { - "path": "./node_modules/cz-conventional-changelog" - } - }, - "description": "NES.css is NES-style CSS Framework.", - "devDependencies": { - "@commitlint/cli": "^7.2.1", - "@commitlint/config-conventional": "^7.1.2", - "@semantic-release/exec": "^3.3.0", - "@storybook/addon-backgrounds": "^5.0.11", - "@storybook/addon-knobs": "^5.0.11", - "@storybook/html": "^5.0.0", - "autoprefixer": "^9.1.5", - "babel-loader": "^8.0.4", - "classnames": "^2.2.6", - "clean-css-cli": "^4.2.1", - "commitizen": "^3.1.1", - "css-loader": "^2.0.0", - "cz-conventional-changelog": "^2.1.0", - "eslint": "^5.9.0", - "eslint-config-airbnb-base": "^13.1.0", - "eslint-plugin-import": "^2.14.0", - "file-type": "^11.0.0", - "git-rev-sync": "^1.12.0", - "husky": "^1.0.0", - "lint-staged": "^7.3.0", - "node-sass": "^4.12.0", - "npm-run-all": "^4.1.5", - "postcss-cli": "^6.0.0", - "prettier": "^1.15.2", - "rimraf": "^2.6.2", - "sass-loader": "^7.1.0", - "semantic-release": "^15.13.14", - "style-loader": "^0.23.1", - "stylelint": "^9.5.0", - "stylelint-config-prettier": "^4.0.0", - "stylelint-config-recess-order": "^2.0.0", - "stylelint-config-standard": "^18.2.0", - "stylelint-prettier": "^1.0.5", - "stylelint-scss": "^3.3.1", - "url-loader": "^1.1.2" - }, - "engines": { - "node": "10.x" - }, - "eslintConfig": { - "extends": "airbnb-base", - "rules": { - "import/no-extraneous-dependencies": [ - "error", - { - "devDependencies": [ - "**/*.stories.js", - "**/*.template.js" - ] - } - ] - } - }, - "eslintIgnore": [ - "docs/*" - ], - "homepage": "https://github.com/nostalgic-css/NES.css#readme", - "husky": { - "hooks": { - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS", - "pre-commit": "lint-staged" - } - }, - "keywords": [ - "css", - "scss", - "nes", - "framework" - ], - "license": "MIT", - "lint-staged": { - "scss/**/*.scss": [ - "npm run prebuild:stylelint", - "npm run postbuild", - "git add" - ], - "*.js": [ - "eslint '.storybook/**/*.js' 'story/**/*.js'" - ] - }, - "name": "nes.css", - "prettier": { - "printWidth": 100 - }, - "release": { - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/npm", - "@semantic-release/github", - [ - "@semantic-release/exec", - { - "prepareCmd": "./scripts/updatePackageHeader.js ${nextRelease.version}" - } - ] - ] - }, - "repository": { - "type": "git", - "url": "git+https://github.com/nostalgic-css/NES.css.git" - }, - "scripts": { - "// Build task": "", - "// For nes-core.css": "", - "// For nes.css": "", - "// Misc": "", - "build": "run-p build:core build:main", - "build:autoprefix": "postcss --use autoprefixer --map false --output css/nes.css css/nes.css", - "build:autoprefix-core": "postcss --use autoprefixer --map false --output css/nes-core.css css/nes-core.css", - "build:cleancss": "cleancss -o css/nes.min.css css/nes.css", - "build:cleancss-core": "cleancss -o css/nes-core.min.css css/nes-core.css", - "build:core": "npm run build:sass-core && npm run build:autoprefix-core && npm run build:cleancss-core", - "build:main": "npm run build:sass && npm run build:autoprefix && npm run build:cleancss", - "build:sass": "node-sass --output-style expanded --source-map true --functions scripts/scssFunctions.js scss/nes.scss css/nes.css", - "build:sass-core": "node-sass --output-style expanded --source-map true --functions scripts/scssFunctions.js scss/nes-core.scss css/nes-core.css", - "build:storybook": "build-storybook", - "commit": "git-cz", - "commit:retry": "git-cz --retry", - "commitmsg": "commitlint -e", - "deploy": "npm run build", - "postbuild": "npm run build:storybook", - "prebuild": "run-p prebuild:*", - "prebuild:clean": "rimraf css", - "prebuild:stylelint": "npm run stylelint -- --fix", - "semantic-release": "semantic-release", - "storybook": "start-storybook -p 6006", - "stylelint": "stylelint scss/**/*.scss", - "watch": "npm run build:sass -- --watch" - }, - "stylelint": { - "plugins": [ - "stylelint-scss", - "stylelint-prettier" - ], - "extends": [ - "stylelint-config-standard", - "stylelint-config-recess-order", - "stylelint-prettier/recommended" - ], - "rules": { - "prettier/prettier": true, - "string-quotes": "double", - "at-rule-no-unknown": null, - "scss/at-rule-no-unknown": true - }, - "ignoreFiles": [ - "docs/*" - ] - }, - "version": "2.3.0" -} diff --git a/node_modules/nes.css/scripts/getBuildData.js b/node_modules/nes.css/scripts/getBuildData.js deleted file mode 100644 index 9a52330..0000000 --- a/node_modules/nes.css/scripts/getBuildData.js +++ /dev/null @@ -1,24 +0,0 @@ -const git = require('git-rev-sync'); /* eslint-disable-line import/no-extraneous-dependencies */ - -module.exports = (isCompiled = false) => { - let buildData = ''; - - if (git.branch() !== 'master') { - if (isCompiled) { - buildData += ` - Build Date: ${(new Date()).toISOString()} - Node Version: ${process.version}`; - } - - buildData += ` - Branch: ${git.branch()} - Commit: ${git.long()}`; - - if (process.env.CIRCLECI) { - buildData += ` - Build Number (CircleCI): ${process.env.CIRCLE_BUILD_NUM}`; - } - } - - return buildData.replace(/^ +/gm, ' '); -}; diff --git a/node_modules/nes.css/scripts/getFileAsDataURI.js b/node_modules/nes.css/scripts/getFileAsDataURI.js deleted file mode 100644 index 83e1114..0000000 --- a/node_modules/nes.css/scripts/getFileAsDataURI.js +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable import/no-extraneous-dependencies */ -const filetype = require('file-type'); -const fs = require('fs'); -const path = require('path'); -/* eslint-enable */ - -module.exports = (fileString) => { - const filepath = path.resolve(__dirname, fileString.getValue()); - const fileBuffer = fs.readFileSync(filepath); - - const fileDataURI = fileBuffer.toString('base64'); - const { mime } = filetype(fileBuffer); - - return `data:${mime};base64,${fileDataURI}`; -}; diff --git a/node_modules/nes.css/scripts/scssFunctions.js b/node_modules/nes.css/scripts/scssFunctions.js deleted file mode 100644 index 8c61b92..0000000 --- a/node_modules/nes.css/scripts/scssFunctions.js +++ /dev/null @@ -1,9 +0,0 @@ -const { types } = require('node-sass'); /* eslint-disable-line import/no-extraneous-dependencies */ - -const getBuildData = require('./getBuildData'); -const getFileAsDataURI = require('./getFileAsDataURI'); - -module.exports = { - 'build-data()': () => types.String(getBuildData(true)), - 'get-file-as-data-uri($filepath)': filepath => types.String(getFileAsDataURI(filepath)), -}; diff --git a/node_modules/nes.css/scripts/updatePackageHeader.js b/node_modules/nes.css/scripts/updatePackageHeader.js deleted file mode 100644 index c347dd9..0000000 --- a/node_modules/nes.css/scripts/updatePackageHeader.js +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env node - -const fs = require('fs'); -const path = require('path'); - -const getBuildData = require('./getBuildData'); - -const nextVersion = process.argv[2]; - -if (!nextVersion) { - throw new Error('This script requires a version number to be provided'); -} - -// Update the SCSS Package Header -const SCSSFilePath = path.resolve('scss', 'nes-core.scss'); -let SCSSFile = fs.readFileSync(SCSSFilePath, 'utf8'); - -SCSSFile = SCSSFile.replace(/^ {2}Version: development/m, ` Version: ${nextVersion}`); -SCSSFile = SCSSFile.replace(/^#{build-data\(\)}/m, getBuildData()); - -fs.writeFileSync(SCSSFilePath, SCSSFile, 'utf8'); - -// Update the SCSS Package Header -const CSSFilePath = path.resolve('css', 'nes.css'); -let CSSFile = fs.readFileSync(CSSFilePath, 'utf8'); - -CSSFile = CSSFile.replace(/^ {2}Version: development/m, ` Version: ${nextVersion}`); - -fs.writeFileSync(CSSFilePath, CSSFile, 'utf8'); diff --git a/node_modules/nes.css/scss/base/_index.scss b/node_modules/nes.css/scss/base/_index.scss deleted file mode 100644 index c981eac..0000000 --- a/node_modules/nes.css/scss/base/_index.scss +++ /dev/null @@ -1,6 +0,0 @@ -@charset "utf-8"; - -@import "reboot.scss"; -@import "color-palette.scss"; -@import "variables.scss"; -@import "generic.scss"; diff --git a/node_modules/nes.css/scss/base/color-palette.scss b/node_modules/nes.css/scss/base/color-palette.scss deleted file mode 100644 index 19e0195..0000000 --- a/node_modules/nes.css/scss/base/color-palette.scss +++ /dev/null @@ -1,72 +0,0 @@ -// https://en.wikipedia.org/wiki/List_of_video_game_console_palettes#NES - -$color-black: #212529; -$color-white: #fff; - -$color-00: #7c7c7c; -$color-01: #0000fc; -$color-02: #0000bc; -$color-03: #4428bc; -$color-04: #940084; -$color-05: #a80020; -$color-06: #a81000; -$color-07: #881400; -$color-08: #503000; -$color-09: #007800; -$color-0A: #006800; -$color-0B: #005800; -$color-0C: #004058; -$color-0D: #000; -$color-0E: #000; -$color-0F: #000; - -$color-10: #bcbcbc; -$color-11: #0078f8; -$color-12: #0058f8; -$color-13: #6844fc; -$color-14: #d800cc; -$color-15: #e40058; -$color-16: #f83800; -$color-17: #e45c10; -$color-18: #ac7c00; -$color-19: #00b800; -$color-1A: #00a800; -$color-1B: #00a844; -$color-1C: #088; -$color-1D: #000; -$color-1E: #000; -$color-1F: #000; - -$color-20: #f8f8f8; -$color-21: #3cbcfc; -$color-22: #6888fc; -$color-23: #9878f8; -$color-24: #f878f8; -$color-25: #f85898; -$color-26: #f87858; -$color-27: #fca044; -$color-28: #f8b800; -$color-29: #b8f818; -$color-2A: #58d854; -$color-2B: #58f898; -$color-2C: #00e8d8; -$color-2D: #787878; -$color-2E: #000; -$color-2F: #000; - -$color-30: #fcfcfc; -$color-31: #a4e4fc; -$color-32: #b8b8f8; -$color-33: #d8b8f8; -$color-34: #f8b8f8; -$color-35: #f8a4c0; -$color-36: #f0d0b0; -$color-37: #fbdfa6; -$color-38: #f8d878; -$color-39: #d8f878; -$color-3A: #b8f8b8; -$color-3B: #b8f8d8; -$color-3C: #00fcfc; -$color-3D: #d8d8d8; -$color-3E: #000; -$color-3F: #000; diff --git a/node_modules/nes.css/scss/base/generic.scss b/node_modules/nes.css/scss/base/generic.scss deleted file mode 100644 index 854f411..0000000 --- a/node_modules/nes.css/scss/base/generic.scss +++ /dev/null @@ -1,43 +0,0 @@ -// Override reboot.scss - -html, -body, -pre, -code, -kbd, -samp { - font-family: $font-family; -} - -html { - cursor: $cursor-url, auto; -} - -body { - font-size: $font-size; - color: $base-color; - background-color: $background-color; - -webkit-font-smoothing: antialiased; -} - -label { - cursor: inherit; -} - -a, -button { - cursor: $cursor-click-url, pointer; -} - -button, -[type="button"], -[type="reset"], -[type="submit"] { - -webkit-appearance: none; -} - -// Prevent stray pixels on focused inputs such as checkboxes and radios -input[type="radio"], -input[type="checkbox"] { - outline: 0; -} diff --git a/node_modules/nes.css/scss/base/reboot.scss b/node_modules/nes.css/scss/base/reboot.scss deleted file mode 100644 index 02c5d00..0000000 --- a/node_modules/nes.css/scss/base/reboot.scss +++ /dev/null @@ -1,340 +0,0 @@ -/*! - * Bootstrap Reboot v4.1.3 (https://getbootstrap.com/) - * Copyright 2011-2018 The Bootstrap Authors - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) - */ -*, -*::before, -*::after { - box-sizing: border-box; -} - -html { - font-family: sans-serif; - line-height: 1.15; - -webkit-text-size-adjust: 100%; - -ms-overflow-style: scrollbar; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} - -@-ms-viewport { - width: device-width; -} - -article, -aside, -figcaption, -figure, -footer, -header, -hgroup, -main, -nav, -section { - display: block; -} - -body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, - Noto Sans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", - "Noto Color Emoji"; - font-size: 1rem; - font-weight: 400; - line-height: 1.5; - color: #212529; - text-align: left; - background-color: #fff; -} - -[tabindex="-1"]:focus { - outline: 0 !important; -} - -hr { - box-sizing: content-box; - height: 0; - overflow: visible; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - margin-top: 0; - margin-bottom: 0.5rem; -} - -p { - margin-top: 0; - margin-bottom: 1rem; -} - -abbr[title], -abbr[data-original-title] { - -webkit-text-decoration: underline dotted; - text-decoration: underline; - text-decoration: underline dotted; - cursor: help; - border-bottom: 0; -} - -address { - margin-bottom: 1rem; - font-style: normal; - line-height: inherit; -} - -ol, -ul, -dl { - margin-top: 0; - margin-bottom: 1rem; -} - -ol ol, -ul ul, -ol ul, -ul ol { - margin-bottom: 0; -} - -dt { - font-weight: 700; -} - -dd { - margin-bottom: 0.5rem; - margin-left: 0; -} - -blockquote { - margin: 0 0 1rem; -} - -b, -strong { - font-weight: bolder; -} - -small { - font-size: 80%; -} - -sub, -sup { - position: relative; - font-size: 75%; - line-height: 0; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -a { - color: #007bff; - text-decoration: none; - background-color: transparent; -} - -a:hover { - color: #0056b3; - text-decoration: underline; -} - -a:not([href]):not([tabindex]) { - color: inherit; - text-decoration: none; -} - -a:not([href]):not([tabindex]):hover, -a:not([href]):not([tabindex]):focus { - color: inherit; - text-decoration: none; -} - -a:not([href]):not([tabindex]):focus { - outline: 0; -} - -pre, -code, -kbd, -samp { - font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; - font-size: 1em; -} - -pre { - margin-top: 0; - margin-bottom: 1rem; - overflow: auto; - -ms-overflow-style: scrollbar; -} - -figure { - margin: 0 0 1rem; -} - -img { - vertical-align: middle; - border-style: none; -} - -svg { - overflow: hidden; - vertical-align: middle; -} - -table { - border-collapse: collapse; -} - -caption { - padding-top: 0.75rem; - padding-bottom: 0.75rem; - color: #6c757d; - text-align: left; - caption-side: bottom; -} - -th { - text-align: inherit; -} - -label { - display: inline-block; - margin-bottom: 0.5rem; -} - -button { - border-radius: 0; -} - -input, -button, -select, -optgroup, -textarea { - margin: 0; - font-family: inherit; - font-size: inherit; - line-height: inherit; -} - -button, -input { - overflow: visible; -} - -button, -select { - text-transform: none; -} - -button, -[type="button"], -[type="reset"], -[type="submit"] { - -webkit-appearance: button; -} - -button::-moz-focus-inner, -[type="button"]::-moz-focus-inner, -[type="reset"]::-moz-focus-inner, -[type="submit"]::-moz-focus-inner { - padding: 0; - border-style: none; -} - -button:focus { - outline: 1px dotted; - outline: 5px auto -webkit-focus-ring-color; -} - -input[type="radio"], -input[type="checkbox"] { - box-sizing: border-box; - padding: 0; -} - -input[type="date"], -input[type="time"], -input[type="datetime-local"], -input[type="month"] { - -webkit-appearance: listbox; -} - -textarea { - overflow: auto; - resize: vertical; -} - -fieldset { - min-width: 0; - padding: 0; - margin: 0; - border: 0; -} - -legend { - display: block; - width: 100%; - max-width: 100%; - padding: 0; - margin-bottom: 0.5rem; - font-size: 1.5rem; - line-height: inherit; - color: inherit; - white-space: normal; -} - -progress { - vertical-align: baseline; -} - -[type="number"]::-webkit-inner-spin-button, -[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -[type="search"] { - outline-offset: -2px; - -webkit-appearance: none; -} - -[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -::-webkit-file-upload-button { - font: inherit; - -webkit-appearance: button; -} - -output { - display: inline-block; -} - -summary { - display: list-item; - cursor: pointer; -} - -template { - display: none; -} - -[hidden] { - display: none !important; -} diff --git a/node_modules/nes.css/scss/base/variables.scss b/node_modules/nes.css/scss/base/variables.scss deleted file mode 100644 index 108d051..0000000 --- a/node_modules/nes.css/scss/base/variables.scss +++ /dev/null @@ -1,41 +0,0 @@ -// Font -$font-family: "Press Start 2P" !default; -$font-size: 16px !default; - -$base-color: $color-black !default; -$background-color: $color-white !default; - -$cursor-url: url(get-file-as-data-uri("../assets/cursor.png")) !default; -$cursor-click-url: url(get-file-as-data-uri("../assets/cursor-click.png")) 14 0 !default; - -$border-size: 4px !default; - -$default-colors: ( - normal: $background-color, - hover: #e7e7e7, - shadow: #adafbc -) !default; -$disabled-colors: ( - normal: #d3d3d3, - shadow: #adafbc -) !default; -$primary-colors: ( - normal: #209cee, - hover: #108de0, - shadow: #006bb3 -) !default; -$success-colors: ( - normal: #92cc41, - hover: #76c442, - shadow: #4aa52e -) !default; -$warning-colors: ( - normal: #f7d51d, - hover: #f2c409, - shadow: #e59400 -) !default; -$error-colors: ( - normal: #e76e55, - hover: #ce372b, - shadow: #8c2022 -) !default; diff --git a/node_modules/nes.css/scss/components/_index.scss b/node_modules/nes.css/scss/components/_index.scss deleted file mode 100644 index e63c05c..0000000 --- a/node_modules/nes.css/scss/components/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@charset "utf-8"; diff --git a/node_modules/nes.css/scss/elements/_index.scss b/node_modules/nes.css/scss/elements/_index.scss deleted file mode 100644 index 60183ef..0000000 --- a/node_modules/nes.css/scss/elements/_index.scss +++ /dev/null @@ -1,12 +0,0 @@ -@charset "utf-8"; - -@import "avatar.scss"; -@import "badges.scss"; -@import "balloons.scss"; -@import "buttons.scss"; -@import "containers.scss"; -@import "dialogs.scss"; -@import "lists.scss"; -@import "progress.scss"; -@import "tables.scss"; -@import "text.scss"; diff --git a/node_modules/nes.css/scss/elements/avatar.scss b/node_modules/nes.css/scss/elements/avatar.scss deleted file mode 100644 index c31fc62..0000000 --- a/node_modules/nes.css/scss/elements/avatar.scss +++ /dev/null @@ -1,23 +0,0 @@ -@mixin img-style($param) { - $size: $param * 16; - - width: $size; - height: $size; - - &.is-rounded { - border-radius: 50px; - } -} -.nes-avatar { - @include img-style(2px); - - &.is-small { - @include img-style(1px); - } - &.is-medium { - @include img-style(3px); - } - &.is-large { - @include img-style(4px); - } -} diff --git a/node_modules/nes.css/scss/elements/badges.scss b/node_modules/nes.css/scss/elements/badges.scss deleted file mode 100644 index 1ac1286..0000000 --- a/node_modules/nes.css/scss/elements/badges.scss +++ /dev/null @@ -1,105 +0,0 @@ -@mixin span-style-is-icon($color, $background-color, $display, $width, $font-size) { - display: $display; - align-items: center; - justify-content: center; - width: $width; - font-size: $font-size; - color: $color; - text-align: center; - background-color: $background-color; -} - -@mixin span-style($color, $background, $option, $width: 50%) { - position: absolute; - top: 0; - width: $width; - color: $color; - text-align: center; - background-color: $background; - - @if $option == left { - left: 0; - } @else if $option == right { - right: 0; - } -} - -@mixin badge-style($color, $background, $option: is-default) { - $box-shadow-first-two: 0 0.5em $background, 0 -0.5em $background; - - @if $option == is-splited { - &:first-child { - @include span-style($color, $background, left); - - box-shadow: $box-shadow-first-two, 0 0 $background, -0.5em 0 $background; - } - &:last-child { - @include span-style($color, $background, right); - - box-shadow: $box-shadow-first-two, 0.5em 0 $background, 0 0 $background; - } - } @else if $option == is-icon { - &:first-child { - @include span-style-is-icon($color, $background, flex, 2.7em, 0.5em); - - position: absolute; - top: -2.8em; - left: -2.7em; - height: 2.7em; - } - &:last-child { - @include span-style-is-icon($color, $background, inline-block, 6em, 0.88em); - - box-shadow: $box-shadow-first-two, 0.5em 0 $background, -0.5em 0 $background; - } - } @else { - &:first-child { - @include span-style($color, $background, 0, 100%); - - box-shadow: $box-shadow-first-two, 0.5em 0 $background, -0.5em 0 $background; - } - } -} - -// Default style -.nes-badge { - $em: 0.75em; - - position: relative; - display: inline-block; - width: $em * 14; - height: $em * 2.5; - margin: 0.5em; - font-size: $em * 1.2; - white-space: nowrap; - vertical-align: top; - user-select: none; - - // Other styles - // prettier-ignore - $types: - "dark" $background-color $base-color, - "primary" $background-color map-get($primary-colors, "normal"), - "success" $background-color map-get($success-colors, "normal"), - "warning" $base-color map-get($warning-colors, "normal"), - "error" $background-color map-get($error-colors, "normal"); - - @each $type in $types { - &.is-splited { - & span.is-#{nth($type, 1)} { - @include badge-style(nth($type, 2), nth($type, 3), is-splited); - } - } - - &.is-icon { - width: $em * 7; - & span.is-#{nth($type, 1)} { - @include badge-style(nth($type, 2), nth($type, 3), is-icon); - } - } - - & span.is-#{nth($type, 1)} { - @include badge-style(nth($type, 2), nth($type, 3)); - } - } -} diff --git a/node_modules/nes.css/scss/elements/balloons.scss b/node_modules/nes.css/scss/elements/balloons.scss deleted file mode 100644 index 0b20711..0000000 --- a/node_modules/nes.css/scss/elements/balloons.scss +++ /dev/null @@ -1,135 +0,0 @@ -@mixin box-shadow($color, $fromLeft: true) { - @if $fromLeft { - // prettier-ignore - box-shadow: - -4px 0, - 4px 0, - -4px 4px $color, - 0 4px, - -8px 4px, - -4px 8px, - -8px 8px; - } @else { - // prettier-ignore - box-shadow: - -4px 0, - 4px 0, - 4px 4px $color, - 0 4px, - 8px 4px, - 4px 8px, - 8px 8px; - } -} - -.nes-balloon { - @include rounded-corners(); - - position: relative; - display: inline-block; - padding: 1rem 1.5rem; - margin: 8px; - margin-bottom: 30px; - background-color: $background-color; - - > :last-child { - margin-bottom: 0; - } - - &::before, - &::after { - position: absolute; - content: ""; - } - - &.is-dark { - @include rounded-corners(true); - - color: $background-color; - background: $base-color; - border-image-outset: 2; - box-shadow: 0 0 0 8px $base-color; - - &.from-left, - &.from-right { - &::before { - background-color: $base-color; - border-color: $background-color; - } - - &::after { - color: $background-color; - background-color: $base-color; - } - } - - &.from-left { - &::before { - box-shadow: -5px 10px 0 6px $base-color; - } - &::after { - @include box-shadow($base-color); - } - } - - &.from-right { - &::before { - box-shadow: 5px 10px 0 6px $base-color; - } - &::after { - @include box-shadow($base-color, false); - } - } - } - - &.from-left { - &::before, - &::after { - left: 2rem; - } - - &::before { - bottom: -14px; - width: 26px; - height: 10px; - background-color: $background-color; - border-right: 4px solid $base-color; - border-left: 4px solid $base-color; - } - - &::after { - bottom: -18px; - width: 18px; - height: 4px; - margin-right: 8px; - color: $base-color; - background-color: $background-color; - @include box-shadow($background-color); - } - } - - &.from-right { - &::before, - &::after { - right: 2rem; - } - - &::before { - bottom: -14px; - width: 26px; - height: 10px; - background-color: $background-color; - border-right: 4px solid $base-color; - border-left: 4px solid $base-color; - } - - &::after { - bottom: -18px; - width: 18px; - height: 4px; - margin-left: 8px; - background-color: $background-color; - @include box-shadow($background-color, false); - } - } -} diff --git a/node_modules/nes.css/scss/elements/buttons.scss b/node_modules/nes.css/scss/elements/buttons.scss deleted file mode 100644 index 764fd8d..0000000 --- a/node_modules/nes.css/scss/elements/buttons.scss +++ /dev/null @@ -1,87 +0,0 @@ -@mixin btn-style($color, $background, $hover-background, $shadow) { - color: $color; - background-color: $background; - - &::after { - position: absolute; - top: -$border-size; - right: -$border-size; - bottom: -$border-size; - left: -$border-size; - content: ""; - box-shadow: inset -4px -4px $shadow; - } - - &:hover { - color: $color; - text-decoration: none; - background-color: $hover-background; - - &::after { - box-shadow: inset -6px -6px $shadow; - } - } - - &:focus { - box-shadow: 0 0 0 6px rgba($shadow, 0.3); - } - - &:active:not(.is-disabled)::after { - box-shadow: inset 4px 4px $shadow; - } -} - -// Default style -.nes-btn { - @include compact-rounded-corners(); - - position: relative; - display: inline-block; - padding: 6px 8px; - margin: $border-size; - text-align: center; - vertical-align: middle; - cursor: $cursor-click-url, pointer; - user-select: none; - - @include btn-style( - $base-color, - map-get($default-colors, "normal"), - map-get($default-colors, "hover"), - map-get($default-colors, "shadow") - ); - - &:focus { - outline: 0; - } - - &.is-disabled, - &.is-disabled:hover, - &.is-disabled:focus { - color: $base-color; - cursor: not-allowed; - background-color: map-get($disabled-colors, "normal"); - box-shadow: inset -4px -4px map-get($disabled-colors, "shadow"); - opacity: 0.6; - } - - // Other styles - // prettier-ignore - $types: - "primary" $background-color map-get($primary-colors, "normal") map-get($primary-colors, "hover") map-get($primary-colors, "shadow"), - "success" $background-color map-get($success-colors, "normal") map-get($success-colors, "hover") map-get($success-colors, "shadow"), - "warning" $base-color map-get($warning-colors, "normal") map-get($warning-colors, "hover") map-get($warning-colors, "shadow"), - "error" $background-color map-get($error-colors, "normal") map-get($error-colors, "hover") map-get($error-colors, "shadow"); - - @each $type in $types { - &.is-#{nth($type, 1)} { - @include btn-style(nth($type, 2), nth($type, 3), nth($type, 4), nth($type, 5)); - } - } - - input[type="file"] { - position: absolute; - pointer-events: none; - opacity: 0; - } -} diff --git a/node_modules/nes.css/scss/elements/containers.scss b/node_modules/nes.css/scss/elements/containers.scss deleted file mode 100644 index 19d95a9..0000000 --- a/node_modules/nes.css/scss/elements/containers.scss +++ /dev/null @@ -1,117 +0,0 @@ -.nes-container { - position: relative; - padding: 1.5rem 2rem; - border-color: black; - border-style: solid; - border-width: 4px; - - > :last-child { - margin-bottom: 0; - } - - &.is-centered { - text-align: center; - } - - &.is-right { - text-align: right; - } - - &.with-title { - > .title { - display: table; - padding: 0 0.5rem; - margin: -1.8rem 0 1rem; - font-size: 1rem; - background-color: $background-color; - } - - &.is-centered { - > .title { - margin: -2rem auto 1rem; - } - } - - &.is-right { - > .title { - margin: -2rem 0 1rem auto; - } - } - } - - &.is-dark { - position: relative; - margin: $border-size; - color: $background-color; - background-color: $base-color; - border-color: white; - - &::after { - position: absolute; - top: -$border-size * 1.8; - right: -$border-size * 1.8; - bottom: -$border-size * 1.8; - left: -$border-size * 1.8; - z-index: -1; - content: ""; - background-color: $base-color; - } - - &.with-title { - > .title { - color: $background-color; - background-color: $base-color; - } - } - } - - &.is-rounded { - @include rounded-corners(); - - padding: 1rem 1.5rem; - margin: $border-size; - - &.with-title { - > .title { - margin-top: -1.5rem; - } - - &.is-centered { - > .title { - margin: -1.5rem auto 1rem; - } - } - - &.is-right { - > .title { - margin: -1.5rem 0 1rem auto; - } - } - } - - &.is-dark { - @include rounded-corners(true); - &::after { - content: none; - } - - &.with-title { - > .title { - margin-top: -1.3rem; - } - - &.is-centered { - > .title { - margin: -1.3rem auto 1rem; - } - } - - &.is-right { - > .title { - margin: -1.3rem 0 1rem auto; - } - } - } - } - } -} diff --git a/node_modules/nes.css/scss/elements/dialogs.scss b/node_modules/nes.css/scss/elements/dialogs.scss deleted file mode 100644 index 32cad4a..0000000 --- a/node_modules/nes.css/scss/elements/dialogs.scss +++ /dev/null @@ -1,37 +0,0 @@ -.nes-dialog { - padding: 1.5rem 2rem; - border-width: $border-size; - - > .backdrop, - &::backdrop { - background-color: rgba(0, 0, 0, 0.3); - } - - > :last-child { - margin-bottom: 0; - } - - &.is-rounded { - @include rounded-corners(); - - &.is-dark { - @include rounded-corners(true); - } - } - &.is-dark { - color: $background-color; - background-color: $base-color; - border-color: $background-color; - - &:not(.is-rounded)::before { - position: absolute; - top: -$border-size * 2; - right: -$border-size * 2; - bottom: -$border-size * 2; - left: -$border-size * 2; - z-index: -1; - content: ""; - border: $border-size solid $base-color; - } - } -} diff --git a/node_modules/nes.css/scss/elements/lists.scss b/node_modules/nes.css/scss/elements/lists.scss deleted file mode 100644 index 485b3f6..0000000 --- a/node_modules/nes.css/scss/elements/lists.scss +++ /dev/null @@ -1,46 +0,0 @@ -.nes-list { - // prettier-ignore - $disc: ( - (0,0,0,1,1,0,0,0), - (0,0,1,1,1,1,0,0), - (0,1,1,1,1,1,1,0), - (0,1,1,1,1,1,1,0), - (0,0,1,1,1,1,0,0), - (0,0,0,1,1,0,0,0) - ); - - // prettier-ignore - $circle: ( - (0,0,0,1,1,0,0,0), - (0,0,1,1,1,1,0,0), - (0,1,1,0,0,1,1,0), - (0,1,1,0,0,1,1,0), - (0,0,1,1,1,1,0,0), - (0,0,0,1,1,0,0,0) - ); - $colors: ($base-color, map-get($default-colors, "shadow")); - - list-style-type: none; - - & li { - position: relative; - } - - &.is-disc li::before { - position: absolute; - top: calc(50% - 8px); - left: -22px; - content: ""; - - @include pixelize(2px, $disc, $colors); - } - - &.is-circle li::before { - position: absolute; - top: calc(50% - 8px); - left: -22px; - content: ""; - - @include pixelize(2px, $circle, $colors); - } -} diff --git a/node_modules/nes.css/scss/elements/progress.scss b/node_modules/nes.css/scss/elements/progress.scss deleted file mode 100644 index 2b10444..0000000 --- a/node_modules/nes.css/scss/elements/progress.scss +++ /dev/null @@ -1,111 +0,0 @@ -.nes-progress { - @include compact-rounded-corners(); - - width: 100%; - height: 48px; - margin: 4px; - color: $base-color; - background-color: $background-color; - -webkit-appearance: none; - appearance: none; - - @mixin progress-style($color) { - &::-webkit-progress-bar { - background-color: $background-color; - } - &::-webkit-progress-value { - background-color: $color; - } - &::-moz-progress-bar { - background-color: $color; - } - &::-ms-fill { - background-color: $color; - border: none; - } - } - - @include progress-style($base-color); - - &.is-rounded { - @include rounded-corners(); - } - &.is-primary { - @include progress-style(map-get($primary-colors, "normal")); - } - - &.is-success { - @include progress-style(map-get($success-colors, "normal")); - } - - &.is-warning { - @include progress-style(map-get($warning-colors, "normal")); - } - - &.is-error { - @include progress-style(map-get($error-colors, "normal")); - } - - &.is-pattern { - &::-webkit-progress-value { - background-color: $base-color; - background-image: linear-gradient( - 45deg, - $background-color 25%, - transparent 25%, - transparent 75%, - $background-color 75%, - $background-color - ), - linear-gradient( - 45deg, - $background-color 25%, - transparent 25%, - transparent 75%, - $background-color 75%, - $background-color - ); - background-position: 0 0, 10px 10px; - background-size: 20px 20px; - } - - &::-moz-progress-bar { - background-color: $base-color; - background-image: -moz-linear-gradient( - 45deg, - $background-color 25%, - transparent 25%, - transparent 75%, - $background-color 75%, - $background-color - ), - -moz-linear-gradient(45deg, $background-color 25%, transparent 25%, transparent 75%, $background-color - 75%, $background-color); - background-position: 0 0, 10px 10px; - background-size: 20px 20px; - } - - &::-ms-fill { - background-color: $base-color; - background-image: linear-gradient( - 45deg, - $background-color 25%, - transparent 25%, - transparent 75%, - $background-color 75%, - $background-color - ), - linear-gradient( - 45deg, - $background-color 25%, - transparent 25%, - transparent 75%, - $background-color 75%, - $background-color - ); - background-position: 0 0, 10px 10px; - background-size: 20px 20px; - border: none; - } - } -} diff --git a/node_modules/nes.css/scss/elements/tables.scss b/node_modules/nes.css/scss/elements/tables.scss deleted file mode 100644 index 17b7dfd..0000000 --- a/node_modules/nes.css/scss/elements/tables.scss +++ /dev/null @@ -1,113 +0,0 @@ -.nes-table-responsive { - max-width: 100%; - overflow-x: auto; - overflow-y: hidden; -} - -.nes-table { - table-layout: fixed; - background-color: $background-color; - - tr { - margin-left: -0.25em; - } - - th, - td { - position: relative; - padding: 0.5rem; - word-wrap: break-word; - border-color: $base-color; - border-style: solid; - border-width: 0 0.25em 0.25em 0; - - &:last-child { - border-right-width: 0; - } - - &::after, - &::before { - position: absolute; - display: block; - width: 0.25em; - height: 0.25em; - content: ""; - background-color: $base-color; - } - - &::after { - bottom: -0.25em; - left: -0.25em; - } - - &::before { - top: -0.25em; - right: -0.25em; - } - - &:last-child::before { - top: initial; - bottom: -0.25em; - } - } - - &.is-centered th { - text-align: center; - } - - &.is-bordered { - margin: 4px; - border-spacing: 0; - border-collapse: separate; - - @include compact-rounded-corners(); - } - - &.is-dark { - color: $background-color; - background-color: $base-color; - - &::before { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - content: ""; - } - - &.is-bordered { - @include compact-rounded-corners(true); - } - - th, - td { - border-color: $background-color; - - &::after, - &::before { - display: none; - } - } - } - - /*************************************************************************** \ - This eliminates the gap between the last row in a table and the border, as - well as hiding the derelict pixels in the bottom right and bottom left of - the last row of a table - \ ***************************************************************************/ - tbody, - thead:last-child { - tr:last-child { - th, - td { - border-bottom-width: 0; - - &:first-child::after, - &:last-child::before { - display: none; - } - } - } - } -} diff --git a/node_modules/nes.css/scss/elements/text.scss b/node_modules/nes.css/scss/elements/text.scss deleted file mode 100644 index df4c6b5..0000000 --- a/node_modules/nes.css/scss/elements/text.scss +++ /dev/null @@ -1,21 +0,0 @@ -.nes-text { - &.is-primary { - color: map-get($primary-colors, "normal"); - } - - &.is-success { - color: map-get($success-colors, "normal"); - } - - &.is-warning { - color: map-get($warning-colors, "normal"); - } - - &.is-error { - color: map_get($error-colors, "normal"); - } - - &.is-disabled { - color: map_get($disabled-colors, "normal"); - } -} diff --git a/node_modules/nes.css/scss/form/_index.scss b/node_modules/nes.css/scss/form/_index.scss deleted file mode 100644 index 7ca43be..0000000 --- a/node_modules/nes.css/scss/form/_index.scss +++ /dev/null @@ -1,6 +0,0 @@ -@charset "utf-8"; - -@import "inputs.scss"; -@import "radios.scss"; -@import "checkboxes.scss"; -@import "selects.scss"; diff --git a/node_modules/nes.css/scss/form/checkboxes.scss b/node_modules/nes.css/scss/form/checkboxes.scss deleted file mode 100644 index 962b810..0000000 --- a/node_modules/nes.css/scss/form/checkboxes.scss +++ /dev/null @@ -1,106 +0,0 @@ -.nes-checkbox { - // prettier-ignore - $checkbox: ( - (1,1,1,1,1,1,1,1,0,0), - (1,0,0,0,0,0,0,1,0,0), - (1,0,0,0,0,0,0,1,0,0), - (1,0,0,0,0,0,0,1,0,0), - (1,0,0,0,0,0,0,1,0,0), - (1,0,0,0,0,0,0,1,0,0), - (1,0,0,0,0,0,0,1,0,0), - (1,1,1,1,1,1,1,1,0,0), - ); - - // prettier-ignore - $checkbox-checked: ( - (1,1,1,1,1,1,1,0,1,1), - (1,0,0,0,0,0,0,1,1,1), - (1,0,0,0,0,0,1,1,0,0), - (1,1,0,0,0,1,1,0,0,0), - (1,1,1,0,1,1,0,1,0,0), - (1,0,1,1,1,0,0,1,0,0), - (1,0,0,1,0,0,0,1,0,0), - (1,1,1,1,1,1,1,1,0,0) - ); - // prettier-ignore - $checkbox-focus: ( - (2,2,2,2,2,2,2,2,0,0), - (2,0,0,0,0,0,0,2,0,0), - (2,0,0,0,0,0,0,2,0,0), - (2,0,0,0,0,0,0,2,0,0), - (2,0,0,0,0,0,0,2,0,0), - (2,0,0,0,0,0,0,2,0,0), - (2,0,0,0,0,0,0,2,0,0), - (2,2,2,2,2,2,2,2,0,0), - ); - - // prettier-ignore - $checkbox-checked-focus: ( - (2,2,2,2,2,2,2,0,1,1), - (2,0,0,0,0,0,0,1,1,1), - (1,0,0,0,0,0,1,1,0,0), - (1,1,0,0,0,1,1,0,0,0), - (2,1,1,0,1,1,0,2,0,0), - (2,0,1,1,1,0,0,2,0,0), - (2,0,0,1,0,0,0,2,0,0), - (2,2,2,2,2,2,2,2,0,0) - ); - $colors: ($base-color, map-get($default-colors, "shadow")); - $colors-checkbox-dark: ($color-white, map-get($default-colors, "shadow")); - - margin-left: 28px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - - @include visually-hidden(); - - & + span { - position: relative; - cursor: $cursor-click-url, pointer; - } - - & + span::before, - &:checked + span::before { - position: absolute; - top: -3px; - left: -28px; - content: ""; - } - - // prettier-ignore - & + span::before { /* stylelint-disable-line no-descending-specificity */ - @include pixelize(2px, $checkbox, $colors); - } - // prettier-ignore - &:focus + span::before { /* stylelint-disable-line no-descending-specificity */ - @include pixelize(2px, $checkbox-focus, $colors); - } - - &:checked + span::before { - @include pixelize(2px, $checkbox-checked, $colors); - } - &:checked:focus + span::before { - @include pixelize(2px, $checkbox-checked-focus, $colors); - } - &.is-dark { - + span { - color: $color-white; - } - // prettier-ignore - + span::before { /* stylelint-disable-line no-descending-specificity */ - color: $color-white; - } - - &:checked + span::before { - @include pixelize(2px, $checkbox-checked-focus, $colors-checkbox-dark); - - color: $color-white; - } - &:checked:focus + span::before { - @include pixelize(2px, $checkbox-checked-focus, $colors-checkbox-dark); - - color: $color-white; - } - } -} diff --git a/node_modules/nes.css/scss/form/inputs.scss b/node_modules/nes.css/scss/form/inputs.scss deleted file mode 100644 index c2e35ff..0000000 --- a/node_modules/nes.css/scss/form/inputs.scss +++ /dev/null @@ -1,75 +0,0 @@ -.nes-input, -.nes-textarea { - @mixin border-style($border, $outline) { - @include compact-border-image($border); - - outline-color: $outline; - } - - @include compact-rounded-corners(); - - width: calc(100% - #{2 * $border-size}); - padding: 0.5rem 1rem; - margin: 4px; - background-clip: padding-box; - - &.is-dark { - @include border-style(map-get($default-colors, "normal"), map-get($default-colors, "hover")); - - color: $background-color; - background-color: $base-color; - } - &.is-success { - @include border-style(map-get($success-colors, "normal"), map-get($success-colors, "hover")); - } - &.is-warning { - @include border-style(map-get($warning-colors, "normal"), map-get($warning-colors, "hover")); - } - &.is-error { - @include border-style(map-get($error-colors, "normal"), map-get($error-colors, "hover")); - } -} - -.nes-field { - > label { - display: block; - } - .nes-input, - .nes-textarea { - display: block; - } - - &.is-inline { - display: flex; - align-items: center; - - > label { - flex-basis: 0; - flex-grow: 1; - margin: 0; - margin-right: 1.5rem; - text-align: right; - } - - .nes-input, - .nes-textarea { - flex-basis: 0; - flex-grow: 5; - } - } -} - -@media screen and (max-width: 768px) { - .nes-field.is-inline { - display: block; - - > label { - margin-bottom: 0.5rem; // reboot.css:label - text-align: left; - } - - .nes-input { - max-width: 100%; - } - } -} diff --git a/node_modules/nes.css/scss/form/radios.scss b/node_modules/nes.css/scss/form/radios.scss deleted file mode 100644 index ae00536..0000000 --- a/node_modules/nes.css/scss/form/radios.scss +++ /dev/null @@ -1,76 +0,0 @@ -.nes-radio { - // prettier-ignore - $radio: ( - (1,1,0,0,0,0), - (1,1,1,1,0,0), - (1,1,1,1,1,0), - (1,1,1,1,1,1), - (1,1,1,1,1,0), - (1,1,1,1,0,0), - (1,1,0,0,0,0), - ); - // prettier-ignore - $radio-checked-focus: ( - (2,2,0,0,0,0), - (2,2,2,2,0,0), - (2,2,2,2,2,0), - (2,2,2,2,2,2), - (2,2,2,2,2,0), - (2,2,2,2,0,0), - (2,2,0,0,0,0), - ); - $colors: ($base-color, map-get($default-colors, "shadow")); - $colors-radio-dark: ($color-white, map-get($default-colors, "shadow")); - - margin-right: 20px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - - @include visually-hidden(); - - & + span { - position: relative; - cursor: $cursor-click-url, pointer; - } - - &:checked + span::before { - position: absolute; - top: -2px; - left: -20px; - content: ""; - - @include pixelize(2px, $radio, $colors); - } - - &:checked:hover, - &:checked:focus { - & + span::before { - animation: blink 1s infinite steps(1); - } - } - - &:checked:focus + span::before { - @include pixelize(2px, $radio-checked-focus, $colors); - } - &.is-dark { - + span { - color: $color-white; - } - // prettier-ignore - + span::before { /* stylelint-disable-line no-descending-specificity */ - color: $color-white; - } - - &:checked + span::before { - @include pixelize(2px, $radio-checked-focus, $colors-radio-dark); - - color: $color-white; - } - &:checked:focus + span::before { - @include pixelize(2px, $radio-checked-focus, $colors-radio-dark); - - color: $color-white; - } - } -} diff --git a/node_modules/nes.css/scss/form/selects.scss b/node_modules/nes.css/scss/form/selects.scss deleted file mode 100644 index f6f3e7d..0000000 --- a/node_modules/nes.css/scss/form/selects.scss +++ /dev/null @@ -1,70 +0,0 @@ -.nes-select { - // prettier-ignore - $dropdown: ( - (1,1,1,1,1,1,1), - (1,1,1,1,1,1,1), - (0,1,1,1,1,1,0), - (0,1,1,1,1,1,0), - (0,0,1,1,1,0,0), - (0,0,0,1,0,0,0), - ); - $colors: ($base-color, map-get($default-colors, "shadow")); - - position: relative; - width: calc(100% - #{2 * $border-size}); - margin: 4px; - - select { - @include compact-rounded-corners(); - - width: 100%; - padding: 0.5rem 2.5rem 0.5rem 1rem; - cursor: $cursor-click-url, pointer; - border-radius: 0; - outline-color: map-get($default-colors, "hover"); - -webkit-appearance: none; - appearance: none; - - &:invalid { - color: map-get($disabled-colors, shadow); - } - } - - &.is-dark select { - color: $background-color; - background-color: $base-color; - } - - &::after { - @include pixelize(3px, $dropdown, $colors); - - position: absolute; - top: calc(50% - 11px); - right: 36px; - pointer-events: none; - content: ""; - } - - // prettier-ignore - $types: - "success" map-get($success-colors, "normal") map-get($success-colors, "hover"), - "warning" map-get($warning-colors, "normal") map-get($warning-colors, "hover"), - "error" map-get($error-colors, "normal") map-get($error-colors, "hover"), - "dark" map-get($default-colors, "normal") map-get($default-colors, "hover"); - - @each $type in $types { - &.is-#{nth($type, 1)} { - $color: nth($type, 2); - - &::after { - color: $color; - } - - select { - @include compact-border-image($color); - - outline-color: nth($type, 3); - } - } - } -} diff --git a/node_modules/nes.css/scss/helpers/_index.scss b/node_modules/nes.css/scss/helpers/_index.scss deleted file mode 100644 index f768225..0000000 --- a/node_modules/nes.css/scss/helpers/_index.scss +++ /dev/null @@ -1,3 +0,0 @@ -@charset "utf-8"; - -@import "pointer.scss"; diff --git a/node_modules/nes.css/scss/helpers/pointer.scss b/node_modules/nes.css/scss/helpers/pointer.scss deleted file mode 100644 index abcc69e..0000000 --- a/node_modules/nes.css/scss/helpers/pointer.scss +++ /dev/null @@ -1,3 +0,0 @@ -.nes-pointer { - cursor: $cursor-click-url, pointer; -} diff --git a/node_modules/nes.css/scss/icons/_index.scss b/node_modules/nes.css/scss/icons/_index.scss deleted file mode 100644 index dbe440e..0000000 --- a/node_modules/nes.css/scss/icons/_index.scss +++ /dev/null @@ -1,3 +0,0 @@ -@charset "utf-8"; - -@import "icons.scss"; diff --git a/node_modules/nes.css/scss/icons/close.scss b/node_modules/nes.css/scss/icons/close.scss deleted file mode 100644 index 97503ae..0000000 --- a/node_modules/nes.css/scss/icons/close.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-close-colors: ($base-color); -// prettier-ignore -$icon-close: ( - (1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1), - (1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1), - (1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1), - (1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1), - (0,0,0,1,1,1,1,0,0,1,1,1,1,0,0,0), - (0,0,0,1,1,1,1,0,0,1,1,1,1,0,0,0), - (0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0), - (0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0), - (0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0), - (0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0), - (0,0,0,1,1,1,1,0,0,1,1,1,1,0,0,0), - (0,0,0,1,1,1,1,0,0,1,1,1,1,0,0,0), - (1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1), - (1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1), - (1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1), - (1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1), -); diff --git a/node_modules/nes.css/scss/icons/coin.scss b/node_modules/nes.css/scss/icons/coin.scss deleted file mode 100644 index 93b1d81..0000000 --- a/node_modules/nes.css/scss/icons/coin.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-coin-colors: (#060606, #fff, #ffc107); -// prettier-ignore -$icon-coin: ( - (0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0), - (0,0,0,1,1,1,2,2,2,1,1,1,1,0,0,0), - (0,0,1,1,2,2,3,3,3,3,3,1,1,0,0,0), - (0,0,1,2,3,3,2,2,2,1,3,3,1,1,0,0), - (0,1,1,2,3,3,2,3,3,1,3,3,1,1,0,0), - (0,1,2,3,3,3,2,3,3,1,3,3,3,1,1,0), - (0,1,2,3,3,3,2,3,3,1,3,3,3,1,1,0), - (0,1,2,3,3,3,2,3,3,1,3,3,3,1,1,0), - (0,1,2,3,3,3,2,3,3,1,3,3,3,1,1,0), - (0,1,2,3,3,3,2,3,3,1,3,3,3,1,1,0), - (0,1,2,3,3,3,2,3,3,1,3,3,3,1,1,0), - (0,1,1,2,3,3,2,3,3,1,3,3,1,1,0,0), - (0,0,1,2,3,3,2,1,1,1,3,3,1,1,0,0), - (0,0,1,1,2,3,3,3,3,3,3,1,1,0,0,0), - (0,0,0,1,1,1,3,3,3,1,1,1,1,0,0,0), - (0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0), -); diff --git a/node_modules/nes.css/scss/icons/facebook.scss b/node_modules/nes.css/scss/icons/facebook.scss deleted file mode 100644 index e066cff..0000000 --- a/node_modules/nes.css/scss/icons/facebook.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-facebook-colors: (#fff, #4566ae); -// prettier-ignore -$icon-facebook: ( - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0), - ( 2,2,2,2,2,2,2,2,2,2,1,1,1,1,2,2), - ( 2,2,2,2,2,2,2,2,2,1,1,1,1,1,2,2), - ( 2,2,2,2,2,2,2,2,1,1,1,1,1,1,2,2), - ( 2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2), - ( 2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2), - ( 2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2), - ( 2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2), - ( 2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2), - ( 2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2), - ( 2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2), - ( 2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2), - ( 2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2), - ( 2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2), - ( 2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2), - ( 0,2,2,2,2,2,2,2,1,1,1,2,2,2,2,0) -); diff --git a/node_modules/nes.css/scss/icons/github.scss b/node_modules/nes.css/scss/icons/github.scss deleted file mode 100644 index 9ecfe87..0000000 --- a/node_modules/nes.css/scss/icons/github.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-github-colors: (#fff, #333); -// prettier-ignore -$icon-github: ( - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ), - ( 2,2,2,2,1,2,2,2,2,2,2,2,2,1,2,2 ), - ( 2,2,2,2,1,1,2,2,2,2,2,2,1,1,2,2 ), - ( 2,2,2,2,1,1,1,1,1,1,1,1,1,1,2,2 ), - ( 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2 ), - ( 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2 ), - ( 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2 ), - ( 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2 ), - ( 2,2,2,2,1,1,1,1,1,1,1,1,1,1,2,2 ), - ( 2,2,2,2,2,1,1,1,1,1,1,1,1,2,2,2 ), - ( 2,1,1,2,2,2,2,1,1,1,1,2,2,2,2,2 ), - ( 2,2,2,1,2,2,1,1,1,1,1,1,2,2,2,2 ), - ( 2,2,2,2,1,1,1,1,1,1,1,1,2,2,2,2 ), - ( 2,2,2,2,2,2,1,1,1,1,1,1,2,2,2,2 ), - ( 2,2,2,2,2,2,1,1,1,1,1,1,2,2,2,2 ), - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ) -); diff --git a/node_modules/nes.css/scss/icons/gmail.scss b/node_modules/nes.css/scss/icons/gmail.scss deleted file mode 100644 index 644b0cd..0000000 --- a/node_modules/nes.css/scss/icons/gmail.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-gmail-colors: (#eeecec, #fd2b2b); -// prettier-ignore -$icon-gmail: ( - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - (0,2,1,1,1,1,1,1,1,1,1,1,1,1,2,0), - (2,2,2,1,1,1,1,1,1,1,1,1,1,2,2,2), - (2,2,2,2,1,1,1,1,1,1,1,1,2,2,2,2), - (2,2,1,2,2,1,1,1,1,1,1,2,2,1,2,2), - (2,2,1,1,2,2,1,1,1,1,2,2,1,1,2,2), - (2,2,1,1,1,2,2,1,1,2,2,1,1,1,2,2), - (2,2,1,1,1,1,2,2,2,2,1,1,1,1,2,2), - (2,2,1,1,1,1,1,2,2,1,1,1,1,1,2,2), - (2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2), - (2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2), - (2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2), - (0,2,1,1,1,1,1,1,1,1,1,1,1,1,2,0), - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) -); diff --git a/node_modules/nes.css/scss/icons/google.scss b/node_modules/nes.css/scss/icons/google.scss deleted file mode 100644 index d328b1c..0000000 --- a/node_modules/nes.css/scss/icons/google.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-google-colors: (#4285f4, #fff, #db4437, #f4b400, #0f9d58); -// prettier-ignore -$icon-google: ( - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ), - ( 2,2,2,2,2,3,3,3,3,3,3,2,2,2,2,2 ), - ( 2,2,2,3,3,3,3,3,3,3,3,3,3,2,2,2 ), - ( 2,2,3,3,3,3,3,3,3,3,3,3,2,2,2,2 ), - ( 2,3,3,3,3,2,2,2,2,2,3,2,2,2,2,2 ), - ( 4,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2 ), - ( 4,4,3,2,2,2,2,2,2,2,2,2,2,2,2,2 ), - ( 4,4,4,2,2,2,2,2,1,1,1,1,1,1,1,2 ), - ( 4,4,4,2,2,2,2,2,1,1,1,1,1,1,1,2 ), - ( 4,4,4,2,2,2,2,2,1,1,1,1,1,1,1,2 ), - ( 4,4,5,2,2,2,2,2,2,2,2,2,1,1,1,2 ), - ( 4,5,5,5,2,2,2,2,2,2,2,1,1,1,1,2 ), - ( 2,5,5,5,5,2,2,2,2,2,5,1,1,1,2,2 ), - ( 2,2,5,5,5,5,5,5,5,5,5,5,1,1,2,2 ), - ( 2,2,2,5,5,5,5,5,5,5,5,5,5,2,2,2 ), - ( 0,2,2,2,2,5,5,5,5,5,5,2,2,2,2,0 ) -); diff --git a/node_modules/nes.css/scss/icons/heart.scss b/node_modules/nes.css/scss/icons/heart.scss deleted file mode 100644 index 9f006e5..0000000 --- a/node_modules/nes.css/scss/icons/heart.scss +++ /dev/null @@ -1,81 +0,0 @@ -$icon-heart-colors: (#fff, #444, #f22426, #842300); -// prettier-ignore -$icon-heart: ( - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - (0,0,2,2,2,0,0,0,0,0,2,2,2,0,0,0), - (0,2,3,3,3,2,0,0,0,2,3,3,4,2,0,0), - (2,3,1,1,3,3,2,0,2,3,3,3,3,4,2,0), - (2,3,1,3,3,3,3,2,3,3,3,3,3,4,2,0), - (2,3,3,3,3,3,3,3,3,3,3,3,3,4,2,0), - (2,3,3,3,3,3,3,3,3,3,3,3,3,4,2,0), - (2,3,3,3,3,3,3,3,3,3,3,3,3,4,2,0), - (0,2,3,3,3,3,3,3,3,3,3,3,4,2,0,0), - (0,0,2,3,3,3,3,3,3,3,3,4,2,0,0,0), - (0,0,0,2,3,3,3,3,3,3,4,2,0,0,0,0), - (0,0,0,0,2,3,3,3,3,4,2,0,0,0,0,0), - (0,0,0,0,0,2,3,3,4,2,0,0,0,0,0,0), - (0,0,0,0,0,0,2,4,2,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) -); - -// prettier-ignore -$icon-heart-half: ( - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - (0,0,2,2,2,0,0,0,0,0,2,2,2,0,0,0), - (0,2,3,3,3,2,0,0,0,2,0,0,0,2,0,0), - (2,3,1,1,3,3,2,0,2,0,0,0,0,0,2,0), - (2,3,1,3,3,3,3,2,0,0,0,0,0,0,2,0), - (2,3,3,3,3,3,3,3,0,0,0,0,0,0,2,0), - (2,3,3,3,3,3,3,3,0,0,0,0,0,0,2,0), - (2,3,3,3,3,3,3,3,0,0,0,0,0,0,2,0), - (0,2,3,3,3,3,3,3,0,0,0,0,0,2,0,0), - (0,0,2,3,3,3,3,3,0,0,0,0,2,0,0,0), - (0,0,0,2,3,3,3,3,0,0,0,2,0,0,0,0), - (0,0,0,0,2,3,3,3,0,0,2,0,0,0,0,0), - (0,0,0,0,0,2,3,3,0,2,0,0,0,0,0,0), - (0,0,0,0,0,0,2,4,2,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) -); - -// prettier-ignore -$icon-heart-transparent: ( - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - (0,0,2,2,2,0,0,0,0,0,2,2,2,0,0,0), - (0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0), - (2,0,0,0,0,0,2,0,2,0,0,0,0,0,2,0), - (2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0), - (2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0), - (2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0), - (2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0), - (0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0), - (0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0), - (0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0), - (0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0), - (0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0), - (0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) -); - -$icon-heart-empty-colors: (#adafbb); -// prettier-ignore -$icon-heart-empty: ( - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - (0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,0), - (0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0), - (1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0), - (1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0), - (1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0), - (1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0), - (1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0), - (0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0), - (0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0), - (0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0), - (0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0), - (0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) -); diff --git a/node_modules/nes.css/scss/icons/icons.scss b/node_modules/nes.css/scss/icons/icons.scss deleted file mode 100644 index 0c59b69..0000000 --- a/node_modules/nes.css/scss/icons/icons.scss +++ /dev/null @@ -1,165 +0,0 @@ -// reaction -@import "heart.scss"; -@import "star.scss"; -@import "like.scss"; - -// sns -@import "twitter.scss"; -@import "facebook.scss"; -@import "github.scss"; -@import "youtube.scss"; -@import "google.scss"; -@import "medium.scss"; -@import "twitch.scss"; -@import "reddit.scss"; -@import "whatsapp.scss"; -@import "gmail.scss"; -@import "linkedin.scss"; -@import "instagram.scss"; - -// others -@import "close.scss"; -@import "trophy.scss"; -@import "coin.scss"; - -.nes-icon { - $default-size: 1px; - $icon-size: $default-size * 16; - - position: relative; - display: inline-block; - width: $icon-size; - height: $icon-size; - margin-right: $icon-size; - margin-bottom: $icon-size; - - // NOTE: Use `transform: scale()` because cannot use font-size less than 10px on Chrome - // default 2px - transform: scale(2); - transform-origin: top left; - - &.is-small { - margin: 0; - // 1px - transform: scale(1); - } - - &.is-medium { - margin-right: $icon-size * 2; - margin-bottom: $icon-size * 2; - // 3px - transform: scale(3); - } - - &.is-large { - margin-right: $icon-size * 3; - margin-bottom: $icon-size * 3; - // 4px - transform: scale(4); - } - - &::before { - position: absolute; - top: $default-size * -1; - left: $default-size * -1; - display: block; - content: ""; - background: transparent; - } - - &.heart::before { - @include pixelize($default-size, $icon-heart, $icon-heart-colors); - } - &.heart.is-half::before { - @include pixelize($default-size, $icon-heart-half, $icon-heart-colors); - } - &.heart.is-transparent::before { - @include pixelize($default-size, $icon-heart-transparent, $icon-heart-colors); - } - &.heart.is-empty::before { - @include pixelize($default-size, $icon-heart-empty, $icon-heart-empty-colors); - } - - &.star::before { - @include pixelize($default-size, $icon-star, $icon-star-colors); - } - &.star.is-empty::before { - @include pixelize($default-size, $icon-star-empty, $icon-star-empty-colors); - } - &.star.is-half::before { - @include pixelize($default-size, $icon-star-half, $icon-star-colors); - } - &.star.is-transparent::before { - @include pixelize($default-size, $icon-star-transparent, $icon-star-colors); - } - - &.trophy::before { - @include pixelize($default-size, $icon-trophy, $icon-trophy-colors); - } - &.trophy.is-empty::before { - @include pixelize($default-size, $icon-trophy-empty, $icon-trophy-empty-colors); - } - - &.like::before { - @include pixelize($default-size, $icon-like, $icon-like-colors); - } - &.like.is-empty::before { - @include pixelize($default-size, $icon-like-empty, $icon-like-empty-colors); - } - - &.twitter::before { - @include pixelize($default-size, $icon-twitter, $icon-twitter-colors); - } - - &.facebook::before { - @include pixelize($default-size, $icon-facebook, $icon-facebook-colors); - } - - &.github::before { - @include pixelize($default-size, $icon-github, $icon-github-colors); - } - - &.youtube::before { - @include pixelize($default-size, $icon-youtube, $icon-youtube-colors); - } - - &.close::before { - @include pixelize($default-size, $icon-close, $icon-close-colors); - } - - &.google::before { - @include pixelize($default-size, $icon-google, $icon-google-colors); - } - - &.medium::before { - @include pixelize($default-size, $icon-medium, $icon-medium-colors); - } - - &.twitch::before { - @include pixelize($default-size, $icon-twitch, $icon-twitch-colors); - } - - &.reddit::before { - @include pixelize($default-size, $icon-reddit, $icon-reddit-colors); - } - - &.whatsapp::before { - @include pixelize($default-size, $icon-whatsapp, $icon-whatsapp-colors); - } - - &.gmail::before { - @include pixelize($default-size, $icon-gmail, $icon-gmail-colors); - } - - &.linkedin::before { - @include pixelize($default-size, $icon-linkedin, $icon-linkedin-colors); - } - - &.instagram::before { - @include pixelize($default-size, $icon-instagram, $icon-instagram-colors); - } - - &.coin::before { - @include pixelize($default-size, $icon-coin, $icon-coin-colors); - } -} diff --git a/node_modules/nes.css/scss/icons/instagram.scss b/node_modules/nes.css/scss/icons/instagram.scss deleted file mode 100644 index 5ac00db..0000000 --- a/node_modules/nes.css/scss/icons/instagram.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-instagram-colors: (#fff, #8005c8, #d40075, #e98c25, #d84646); -// prettier-ignore -$icon-instagram: ( - ( 0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0), - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0), - ( 2,2,2,1,1,1,1,1,1,1,1,1,1,2,2,2), - ( 2,2,1,1,1,1,1,1,1,1,1,2,2,1,2,2), - ( 2,2,1,1,1,1,1,1,1,1,1,2,2,1,2,2), - ( 2,2,1,1,1,1,2,2,2,2,1,1,1,1,2,2), - ( 3,2,1,1,1,2,1,1,1,1,2,1,1,1,2,3), - ( 3,3,1,1,1,2,1,1,1,1,2,1,1,1,3,3), - ( 3,3,1,1,1,3,1,1,1,1,3,1,1,1,3,3), - ( 3,3,1,1,1,3,1,1,1,1,3,1,1,1,3,3), - ( 4,4,1,1,1,1,3,3,3,3,1,1,1,1,3,3), - ( 4,4,1,1,1,1,1,1,1,1,1,1,1,1,3,3), - ( 4,4,1,1,1,1,1,1,1,1,1,1,1,1,5,5), - ( 4,4,4,1,1,1,1,1,1,1,1,1,1,5,5,5), - ( 0,4,4,4,4,4,4,4,4,5,5,5,5,5,5,0), - ( 0,0,4,4,4,4,4,4,5,5,5,5,5,5,0,0) -); diff --git a/node_modules/nes.css/scss/icons/like.scss b/node_modules/nes.css/scss/icons/like.scss deleted file mode 100644 index 1b798fe..0000000 --- a/node_modules/nes.css/scss/icons/like.scss +++ /dev/null @@ -1,41 +0,0 @@ -$icon-like-colors: (#fff, #333, #2e77be); -// prettier-ignore -$icon-like: ( - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,2,1,2,0,0,0,0,0,0), - (0,0,0,0,0,0,0,2,1,2,0,0,0,0,0,0), - (0,0,0,0,0,0,2,1,1,2,0,0,0,0,0,0), - (0,0,0,0,0,0,2,1,1,2,2,2,2,2,2,0), - (0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,2), - (0,2,2,2,0,2,1,1,1,1,1,1,1,1,1,2), - (2,3,3,3,2,1,1,1,1,1,1,1,1,1,1,2), - (2,3,3,3,2,1,1,1,1,1,1,1,1,1,2,0), - (2,3,3,3,2,1,1,1,1,1,1,1,1,1,2,0), - (2,3,3,3,2,1,1,1,1,1,1,1,1,1,2,0), - (2,3,3,3,2,1,1,1,1,1,1,1,1,2,0,0), - (2,3,3,3,2,1,1,1,1,1,1,1,1,2,0,0), - (0,2,2,2,0,2,2,2,2,2,2,2,2,0,0,0), - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) -); - -$icon-like-empty-colors: (#adafbb); -// prettier-ignore -$icon-like-empty: ( - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0), - (0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,0), - (0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1), - (0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,1), - (1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1), - (1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0), - (1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0), - (1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0), - (1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0), - (1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0), - (0,1,1,1,0,1,1,1,1,1,1,1,1,0,0,0), - (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) -); diff --git a/node_modules/nes.css/scss/icons/linkedin.scss b/node_modules/nes.css/scss/icons/linkedin.scss deleted file mode 100644 index e78e09c..0000000 --- a/node_modules/nes.css/scss/icons/linkedin.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-linkedin-colors: (#fff, #2577b9); -// prettier-ignore -$icon-linkedin: ( - (0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2), - (2,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2), - (2,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2), - (2,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2), - (2,2,1,1,1,2,1,1,1,2,1,1,1,2,2,2), - (2,2,1,1,1,2,1,1,1,1,1,1,1,1,2,2), - (2,2,1,1,1,2,1,1,1,1,1,1,1,1,2,2), - (2,2,1,1,1,2,1,1,1,1,2,1,1,1,2,2), - (2,2,1,1,1,2,1,1,1,2,2,1,1,1,2,2), - (2,2,1,1,1,2,1,1,1,2,2,1,1,1,2,2), - (2,2,1,1,1,2,1,1,1,2,2,1,1,1,2,2), - (2,2,1,1,1,2,1,1,1,2,2,1,1,1,2,2), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2), - (0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0), -); diff --git a/node_modules/nes.css/scss/icons/medium.scss b/node_modules/nes.css/scss/icons/medium.scss deleted file mode 100644 index 744d163..0000000 --- a/node_modules/nes.css/scss/icons/medium.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-medium-colors: (#fff, #12100e); -// prettier-ignore -$icon-medium: ( - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ), - ( 2,1,1,1,2,2,2,2,2,2,2,1,1,1,1,2 ), - ( 2,2,1,1,2,2,2,2,2,2,2,1,1,1,2,2 ), - ( 2,2,1,1,1,2,2,2,2,2,2,1,1,1,2,2 ), - ( 2,2,1,1,1,1,2,2,2,2,1,1,1,1,2,2 ), - ( 2,2,1,1,1,1,2,2,2,2,1,1,1,1,2,2 ), - ( 2,2,1,1,1,1,2,2,2,1,1,1,1,1,2,2 ), - ( 2,2,1,2,1,1,1,2,2,1,1,1,1,1,2,2 ), - ( 2,2,1,2,1,1,1,2,1,1,2,1,1,1,2,2 ), - ( 2,2,1,2,2,1,1,1,1,1,2,1,1,1,2,2 ), - ( 2,2,1,2,2,1,1,1,1,2,2,1,1,1,2,2 ), - ( 2,2,1,2,2,2,1,1,1,2,2,1,1,1,2,2 ), - ( 2,2,1,2,2,2,1,1,2,2,2,1,1,1,2,2 ), - ( 2,2,1,2,2,2,2,1,2,2,2,1,1,1,2,2 ), - ( 2,1,1,1,2,2,2,2,2,2,1,1,1,1,1,2 ), - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ), -); diff --git a/node_modules/nes.css/scss/icons/reddit.scss b/node_modules/nes.css/scss/icons/reddit.scss deleted file mode 100644 index d3f415c..0000000 --- a/node_modules/nes.css/scss/icons/reddit.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-reddit-colors: (#fff, #f40); -// prettier-ignore -$icon-reddit: ( - ( 0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0 ), - ( 0,2,2,2,2,2,2,2,1,1,1,2,1,2,2,0 ), - ( 2,2,2,2,2,2,2,1,2,2,2,1,1,1,2,2 ), - ( 2,2,2,2,2,2,2,1,2,2,2,2,1,2,2,2 ), - ( 2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2 ), - ( 2,1,1,2,1,1,1,1,1,1,1,1,2,1,1,2 ), - ( 2,1,2,1,1,1,1,1,1,1,1,1,1,2,1,2 ), - ( 2,2,1,1,1,2,2,1,1,2,2,1,1,1,2,2 ), - ( 2,1,1,1,1,2,2,1,1,2,2,1,1,1,1,2 ), - ( 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2 ), - ( 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2 ), - ( 2,2,1,1,1,2,1,1,1,1,2,1,1,1,2,2 ), - ( 2,2,2,1,1,1,2,2,2,2,1,1,1,2,2,2 ), - ( 2,2,2,2,1,1,1,1,1,1,1,1,2,2,2,2 ), - ( 0,2,2,2,2,2,1,1,1,1,2,2,2,2,2,0 ), - ( 0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0 ) -); diff --git a/node_modules/nes.css/scss/icons/star.scss b/node_modules/nes.css/scss/icons/star.scss deleted file mode 100644 index 6d58939..0000000 --- a/node_modules/nes.css/scss/icons/star.scss +++ /dev/null @@ -1,79 +0,0 @@ -$icon-star-colors: (#fff, #444, #ebe527, #f59f54); -// prettier-ignore -$icon-star: ( - (0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,2,3,2,0,0,0,0,0,0,0), - (0,0,0,0,0,0,2,3,2,0,0,0,0,0,0,0), - (0,0,0,0,0,2,3,3,3,2,0,0,0,0,0,0), - (0,0,0,0,0,2,1,1,3,2,0,0,0,0,0,0), - (2,2,2,2,2,2,1,3,3,3,2,2,2,2,2,0), - (2,3,3,3,1,1,3,3,3,3,3,3,3,3,2,0), - (0,2,3,3,1,3,3,3,3,3,3,3,4,2,0,0), - (0,0,2,3,3,3,3,3,3,3,4,4,2,0,0,0), - (0,0,0,2,3,3,3,3,3,3,3,2,0,0,0,0), - (0,0,2,3,3,3,3,4,3,3,3,3,2,0,0,0), - (0,0,2,3,3,3,4,4,4,3,3,3,2,0,0,0), - (0,2,3,3,4,4,4,2,4,4,4,3,3,2,0,0), - (0,2,3,4,4,2,2,0,2,2,4,4,3,2,0,0), - (2,4,4,2,2,0,0,0,0,0,2,2,4,4,2,0), - (2,2,2,0,0,0,0,0,0,0,0,0,2,2,2,0) -); - -$icon-star-empty-colors: (#adafbb); -// prettier-ignore -$icon-star-empty: ( - (0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0), - (0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0), - (0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0), - (1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0), - (1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0), - (0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0), - (0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0), - (0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0), - (0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0), - (0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0), - (0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0), - (0,1,0,0,0,1,1,0,1,1,0,0,0,1,0,0), - (1,0,0,1,1,0,0,0,0,0,1,1,0,0,1,0), - (1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0) -); - -$icon-star-half: ( - (0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0), - (0, 0, 0, 0, 0, 0, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0), - (0, 0, 0, 0, 0, 0, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0), - (0, 0, 0, 0, 0, 2, 3, 3, 0, 2, 0, 0, 0, 0, 0, 0), - (0, 0, 0, 0, 0, 2, 3, 3, 0, 2, 0, 0, 0, 0, 0, 0), - (2, 2, 2, 2, 2, 2, 3, 3, 0, 0, 2, 2, 2, 2, 2, 0), - (2, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 2, 0), - (0, 2, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 2, 0, 0), - (0, 0, 2, 3, 3, 3, 3, 3, 0, 0, 0, 0, 2, 0, 0, 0), - (0, 0, 0, 2, 3, 3, 3, 3, 0, 0, 0, 2, 0, 0, 0, 0), - (0, 0, 2, 3, 3, 3, 3, 4, 0, 0, 0, 0, 2, 0, 0, 0), - (0, 0, 2, 3, 3, 3, 4, 4, 0, 0, 0, 0, 2, 0, 0, 0), - (0, 2, 3, 3, 4, 4, 4, 2, 0, 0, 0, 0, 0, 2, 0, 0), - (0, 2, 3, 4, 4, 2, 2, 0, 2, 2, 0, 0, 0, 2, 0, 0), - (2, 4, 4, 2, 2, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0), - (2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0) -); - -$icon-star-transparent: ( - (0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0), - (0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0), - (0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0), - (0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0), - (0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0), - (2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0), - (2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0), - (0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), - (0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), - (0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0), - (0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), - (0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), - (0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0), - (0, 2, 0, 0, 0, 2, 2, 0, 2, 2, 0, 0, 0, 2, 0, 0), - (2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0), - (2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0) -); diff --git a/node_modules/nes.css/scss/icons/trophy.scss b/node_modules/nes.css/scss/icons/trophy.scss deleted file mode 100644 index ed18eb3..0000000 --- a/node_modules/nes.css/scss/icons/trophy.scss +++ /dev/null @@ -1,41 +0,0 @@ -$icon-trophy-colors: (#fff, #444, #ebe527, #f59f54); -// prettier-ignore -$icon-trophy: ( - (0,0,2,2,2,2,2,2,2,2,2,2,2,0,0,0), - (0,0,2,3,3,3,3,3,3,3,3,4,2,0,0,0), - (2,2,2,3,1,3,3,3,3,3,3,4,2,2,2,0), - (2,0,2,3,1,3,3,3,3,3,3,4,2,0,2,0), - (2,0,2,3,1,3,3,3,3,3,3,4,2,0,2,0), - (0,2,2,3,1,3,3,3,3,3,3,4,2,2,0,0), - (0,0,2,3,1,3,3,3,3,3,3,4,2,0,0,0), - (0,0,2,3,3,3,3,3,3,3,3,4,2,0,0,0), - (0,0,0,2,3,3,3,3,3,3,4,2,0,0,0,0), - (0,0,0,0,2,3,3,3,3,4,2,0,0,0,0,0), - (0,0,0,0,0,2,3,3,4,2,0,0,0,0,0,0), - (0,0,0,0,0,0,2,3,2,0,0,0,0,0,0,0), - (0,0,0,0,0,0,2,3,2,0,0,0,0,0,0,0), - (0,0,0,0,0,2,2,3,2,2,0,0,0,0,0,0), - (0,0,0,0,2,3,3,3,3,4,2,0,0,0,0,0), - (0,0,0,0,2,2,2,2,2,2,2,0,0,0,0,0) -); - -$icon-trophy-empty-colors: (#adafbb); -// prettier-ignore -$icon-trophy-empty: ( - (0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0), - (0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0), - (1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0), - (1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0), - (1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0), - (0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0), - (0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0), - (0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0), - (0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0), - (0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0), - (0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0), - (0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0), - (0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0), - (0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0) -); diff --git a/node_modules/nes.css/scss/icons/twitch.scss b/node_modules/nes.css/scss/icons/twitch.scss deleted file mode 100644 index c70bad2..0000000 --- a/node_modules/nes.css/scss/icons/twitch.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-twitch-colors: (#fff, #6441a4); -// prettier-ignore -$icon-twitch: ( - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ), - ( 2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2 ), - ( 2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,2 ), - ( 2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,2 ), - ( 2,1,1,2,2,2,2,1,2,2,1,2,2,2,1,2 ), - ( 2,1,1,2,2,2,2,1,2,2,1,2,2,2,1,2 ), - ( 2,1,1,2,2,2,2,1,2,2,1,2,2,2,1,2 ), - ( 2,1,1,2,2,2,2,1,2,2,1,2,2,2,1,2 ), - ( 2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,2 ), - ( 2,1,1,2,2,2,2,2,2,2,2,2,2,1,1,2 ), - ( 2,1,1,2,2,2,2,2,2,2,2,2,1,1,2,2 ), - ( 2,1,1,1,1,2,2,1,1,1,1,1,1,2,2,2 ), - ( 2,1,1,1,1,2,1,1,1,1,1,1,2,2,2,2 ), - ( 2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2 ), - ( 2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2 ), - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ) -); diff --git a/node_modules/nes.css/scss/icons/twitter.scss b/node_modules/nes.css/scss/icons/twitter.scss deleted file mode 100644 index 78f6bc5..0000000 --- a/node_modules/nes.css/scss/icons/twitter.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-twitter-colors: (#fff, #2c9ceb); -// prettier-ignore -$icon-twitter: ( - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ), - ( 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ), - ( 2,1,2,2,2,2,2,2,2,1,1,1,2,2,2,2 ), - ( 2,1,1,1,2,2,2,2,1,1,1,1,1,2,2,2 ), - ( 2,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2 ), - ( 2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2 ), - ( 2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2 ), - ( 2,2,2,1,1,1,1,1,1,1,1,1,1,2,2,2 ), - ( 2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2 ), - ( 2,2,2,2,1,1,1,1,1,1,1,1,2,2,2,2 ), - ( 2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2 ), - ( 2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2 ), - ( 2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2 ), - ( 2,2,2,1,1,1,2,2,2,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ), - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ) -); diff --git a/node_modules/nes.css/scss/icons/whatsapp.scss b/node_modules/nes.css/scss/icons/whatsapp.scss deleted file mode 100644 index 55fe49f..0000000 --- a/node_modules/nes.css/scss/icons/whatsapp.scss +++ /dev/null @@ -1,19 +0,0 @@ -$icon-whatsapp-colors: (#00ba37, #fff); -// prettier-ignore -$icon-whatsapp: ( - ( 0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0 ), - ( 0,0,1,1,1,2,2,2,2,2,2,2,1,1,1,0 ), - ( 0,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1 ), - ( 0,1,1,2,1,1,1,1,1,1,1,1,1,2,1,1 ), - ( 0,1,1,2,1,2,2,1,1,1,1,1,1,2,1,1 ), - ( 0,1,2,1,1,2,2,1,1,1,1,1,1,1,2,1 ), - ( 0,1,2,1,1,2,1,1,1,1,1,1,1,1,2,1 ), - ( 0,1,2,1,1,1,2,2,1,1,1,1,1,1,2,1 ), - ( 0,1,2,1,1,1,1,2,2,1,1,1,1,1,2,1 ), - ( 0,1,2,1,1,1,1,1,2,1,2,2,1,1,2,1 ), - ( 0,1,1,2,1,1,1,1,1,2,2,2,1,2,1,1 ), - ( 0,1,1,2,1,1,1,1,1,1,1,1,1,2,1,1 ), - ( 0,1,2,1,2,1,1,1,1,1,1,1,2,1,1,1 ), - ( 0,1,2,2,1,2,2,2,2,2,2,2,1,1,1,0 ), - ( 0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0 ) -); diff --git a/node_modules/nes.css/scss/icons/youtube.scss b/node_modules/nes.css/scss/icons/youtube.scss deleted file mode 100644 index 3866e5b..0000000 --- a/node_modules/nes.css/scss/icons/youtube.scss +++ /dev/null @@ -1,20 +0,0 @@ -$icon-youtube-colors: (#fff, #f00); -// prettier-ignore -$icon-youtube: ( - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ), - ( 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2 ), - ( 2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ), - ( 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ), - ( 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ) -); diff --git a/node_modules/nes.css/scss/nes-core.scss b/node_modules/nes.css/scss/nes-core.scss deleted file mode 100644 index a7bbb21..0000000 --- a/node_modules/nes.css/scss/nes-core.scss +++ /dev/null @@ -1,13 +0,0 @@ -@charset "utf-8"; - -/*!***************************************************************************\ - NES.css Framework - Version: 2.3.0 - -\*****************************************************************************/ - -@import "base/_index.scss"; -@import "utilities/_index.scss"; -@import "helpers/_index.scss"; -@import "elements/_index.scss"; -@import "form/_index.scss"; diff --git a/node_modules/nes.css/scss/nes.scss b/node_modules/nes.css/scss/nes.scss deleted file mode 100644 index 151b76b..0000000 --- a/node_modules/nes.css/scss/nes.scss +++ /dev/null @@ -1,6 +0,0 @@ -@charset "utf-8"; - -@import "nes-core.scss"; -@import "components/_index.scss"; -@import "icons/_index.scss"; -@import "pixel-arts/_index.scss"; diff --git a/node_modules/nes.css/scss/pixel-arts/_index.scss b/node_modules/nes.css/scss/pixel-arts/_index.scss deleted file mode 100644 index 8303885..0000000 --- a/node_modules/nes.css/scss/pixel-arts/_index.scss +++ /dev/null @@ -1,17 +0,0 @@ -@charset "utf-8"; - -@import "nes-icon.scss"; -@import "nes-jp-icon.scss"; -@import "snes-icon.scss"; -@import "snes-jp-icon.scss"; -@import "bcrikko.scss"; -@import "ash.scss"; -@import "pokeball.scss"; -@import "bulbasaur.scss"; -@import "charmander.scss"; -@import "squirtle.scss"; -@import "phone.scss"; -@import "smartphone.scss"; -@import "mario.scss"; -@import "kirby.scss"; -@import "octocat.scss"; diff --git a/node_modules/nes.css/scss/pixel-arts/ash.scss b/node_modules/nes.css/scss/pixel-arts/ash.scss deleted file mode 100644 index a63268a..0000000 --- a/node_modules/nes.css/scss/pixel-arts/ash.scss +++ /dev/null @@ -1,38 +0,0 @@ -.nes-ash { - $ash-colors: (#f8f8ff, #ff614e, #007f7f, #181818, #ffe3c5, #426adb, #4169e1); - // prettier-ignore - $ash: ( - (0,0,0,0,4,4,4,4,4,4,0,0,0,0), - (0,0,0,4,2,2,2,1,1,3,4,0,0,0), - (0,0,4,2,2,2,2,1,1,1,1,4,0,0), - (0,0,4,2,2,2,2,1,1,3,3,4,4,0), - (0,4,4,4,2,2,2,2,2,2,2,2,2,4), - (0,4,4,4,4,4,4,4,2,2,2,4,4,0), - (4,4,4,4,4,4,4,5,5,4,5,4,0,0), - (0,4,4,5,5,5,4,5,5,4,5,4,0,0), - (0,0,4,5,5,5,5,5,5,5,5,4,0,0), - (0,4,7,4,4,5,5,5,5,5,4,0,0,0), - (0,4,7,4,4,4,4,4,4,4,0,0,0,0), - (0,4,4,5,5,4,7,7,4,4,4,0,0,0), - (4,3,4,5,5,4,7,4,4,3,3,4,0,0), - (4,3,3,4,4,4,4,4,3,3,4,0,0,0), - (0,4,4,0,0,0,0,0,4,4,0,0,0,0) - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($ash, 1)); - height: $size * length($ash); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $ash, $ash-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/bcrikko.scss b/node_modules/nes.css/scss/pixel-arts/bcrikko.scss deleted file mode 100644 index d904851..0000000 --- a/node_modules/nes.css/scss/pixel-arts/bcrikko.scss +++ /dev/null @@ -1,40 +0,0 @@ -.nes-bcrikko { - $bcrikko-colors: (#333, #f9f2d7, #c5090c, #fff); - - // prettier-ignore - $bcrikko: ( - (0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2), - (2,2,2,2,1,1,2,2,2,2,1,1,2,2,2,2), - (2,2,2,1,1,4,1,2,2,1,1,4,1,2,2,2), - (2,2,2,1,1,1,1,2,2,1,1,1,1,2,2,2), - (2,2,2,1,1,1,1,2,2,1,1,1,1,2,2,2), - (2,2,2,1,1,1,1,2,2,1,1,1,1,2,2,2), - (2,2,2,2,1,1,2,2,2,2,1,1,2,2,2,2), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2), - (2,2,2,3,2,2,2,2,2,2,2,2,3,2,2,2), - (2,2,2,3,2,2,2,2,2,2,2,2,3,2,2,2), - (2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2), - (0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0), - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($bcrikko, 1)); - height: $size * length($bcrikko); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $bcrikko, $bcrikko-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/bulbasaur.scss b/node_modules/nes.css/scss/pixel-arts/bulbasaur.scss deleted file mode 100644 index 857632f..0000000 --- a/node_modules/nes.css/scss/pixel-arts/bulbasaur.scss +++ /dev/null @@ -1,40 +0,0 @@ -.nes-bulbasaur { - $bulbasaur-colors: (#000, #8beb46, #2d8d22, #5ceee1, #3fc3b5, #fdfdf5, #ca242a); - // prettier-ignore - $bulbasaur: ( - (0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,0,0,1,2,2,2,1,0,0,0,0), - (0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,1,0,0,0,0), - (0,0,0,0,0,0,0,1,1,2,2,3,2,2,3,2,1,1,0,0), - (0,0,0,1,1,0,1,2,2,2,3,3,2,2,3,2,2,2,1,0), - (0,0,1,4,4,1,1,2,2,3,2,3,2,2,2,3,2,2,2,1), - (0,0,1,4,4,4,1,1,3,2,3,2,2,2,2,2,3,2,2,1), - (0,0,1,4,4,4,4,5,1,2,3,2,2,2,2,2,3,2,2,1), - (0,1,4,4,5,4,5,5,4,1,1,1,2,2,2,2,3,2,1,0), - (1,1,5,4,4,4,4,4,4,4,4,1,2,2,2,1,1,1,1,0), - (1,1,5,4,4,4,5,4,4,4,1,5,1,1,1,5,5,5,1,0), - (1,4,4,4,4,5,4,1,1,4,5,5,5,5,5,1,5,6,1,0), - (1,5,4,4,4,4,1,7,6,6,5,5,1,5,5,1,1,1,0,0), - (0,1,5,4,4,4,1,7,6,4,5,1,5,5,1,0,0,0,0,0), - (0,0,1,1,5,5,5,5,5,5,1,5,5,5,1,0,0,0,0,0), - (0,0,0,0,1,1,1,1,1,1,1,6,5,6,1,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0), - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($bulbasaur, 1)); - height: $size * length($bulbasaur); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $bulbasaur, $bulbasaur-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/charmander.scss b/node_modules/nes.css/scss/pixel-arts/charmander.scss deleted file mode 100644 index 4741f10..0000000 --- a/node_modules/nes.css/scss/pixel-arts/charmander.scss +++ /dev/null @@ -1,41 +0,0 @@ -.nes-charmander { - $charmander-colors: (#000202, #f77702, #eb2010, #fdfcff, #e5d70a, #e7d70e); - // prettier-ignore - $charmander: ( - (0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0), - (0,0,0,1,2,2,2,2,1,0,0,0,0,0,0,0,1,3,1,0,0), - (0,0,1,2,2,2,2,2,2,1,0,0,0,0,0,0,1,3,3,1,0), - (0,0,1,2,2,2,2,2,2,1,0,0,0,0,0,0,1,3,3,1,0), - (0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,1,3,3,2,3,1), - (1,2,2,2,2,4,1,2,2,2,1,0,0,0,0,1,3,2,6,3,1), - (1,2,2,2,2,1,1,2,2,2,2,1,0,0,0,1,3,5,5,3,1), - (1,2,2,2,2,1,1,2,2,2,2,1,0,0,0,0,1,5,1,1,0), - (0,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,1,2,1,0,0), - (0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,1,2,2,1,0,0), - (0,0,0,0,1,1,1,2,2,1,2,2,2,1,1,2,2,1,0,0,0), - (0,0,0,0,0,1,6,5,1,2,2,2,2,2,1,2,2,1,0,0,0), - (0,0,0,0,0,1,5,5,5,1,1,2,2,2,1,2,1,0,0,0,0), - (0,0,0,0,1,4,1,6,5,5,2,2,2,2,1,1,0,0,0,0,0), - (0,0,0,0,0,1,1,1,5,5,2,2,2,1,1,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,1,4,0,4,1,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0) - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($charmander, 1)); - height: $size * length($charmander); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $charmander, $charmander-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/kirby.scss b/node_modules/nes.css/scss/pixel-arts/kirby.scss deleted file mode 100644 index 73c938c..0000000 --- a/node_modules/nes.css/scss/pixel-arts/kirby.scss +++ /dev/null @@ -1,39 +0,0 @@ -.nes-kirby { - $kirby-colors: (#000, #ffaccc, #ff5478); - // prettier-ignore - $kirby: ( - (0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0), - (0,1,2,2,1,2,2,2,2,2,1,1,0,0,0,0), - (1,2,2,1,2,2,2,2,2,2,2,2,1,0,0,0), - (1,2,2,2,2,2,1,2,1,2,2,2,2,1,0,0), - (1,2,2,2,2,2,1,2,1,2,2,2,2,1,0,0), - (1,2,2,2,2,2,1,2,1,2,2,2,2,2,1,0), - (1,2,2,2,3,3,2,2,2,3,3,2,2,2,2,1), - (1,2,2,2,2,2,2,1,2,2,2,2,2,2,2,1), - (0,1,2,2,2,2,2,1,2,2,2,2,2,2,2,1), - (0,1,2,2,2,2,2,2,2,2,2,2,1,1,1,0), - (0,1,2,2,2,2,2,2,2,2,2,1,3,3,3,1), - (0,0,1,2,2,2,2,2,2,2,1,3,3,3,3,1), - (0,0,1,1,2,2,2,2,2,2,1,3,3,3,3,1), - (0,1,3,3,1,1,2,2,2,1,3,3,3,3,1,0), - (1,3,3,3,3,3,1,1,1,1,1,3,3,1,0,0), - (0,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0) - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($kirby, 1)); - height: $size * length($kirby); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $kirby, $kirby-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/mario.scss b/node_modules/nes.css/scss/pixel-arts/mario.scss deleted file mode 100644 index afc437f..0000000 --- a/node_modules/nes.css/scss/pixel-arts/mario.scss +++ /dev/null @@ -1,39 +0,0 @@ -.nes-mario { - $mario-colors: (#f81c2f, #65352b, #ffbb8e, #000, #1560ad, #aeaeac, #fef102); - // prettier-ignore - $mario: ( - (0,0,0,0,1,1,1,1,1,0,0,0,0,0), - (0,0,0,1,1,1,1,1,1,1,1,1,0,0), - (0,0,0,2,2,2,3,3,4,3,0,0,0,0), - (0,0,2,3,2,3,3,3,4,3,3,3,0,0), - (0,0,2,3,2,2,3,3,3,4,3,3,3,0), - (0,0,2,2,3,3,3,3,4,4,4,4,0,0), - (0,0,0,0,3,3,3,3,3,3,3,0,0,0), - (0,0,0,0,1,5,1,1,5,0,0,0,0,0), - (0,0,1,1,1,5,1,1,5,1,1,1,0,0), - (0,1,1,1,1,5,5,5,5,1,1,1,1,0), - (0,6,6,1,5,7,5,5,7,5,1,6,6,0), - (0,6,6,6,5,5,5,5,5,5,6,6,6,0), - (0,6,6,5,5,5,5,5,5,5,5,6,6,0), - (0,0,0,5,5,5,0,0,5,5,5,0,0,0), - (0,0,2,2,2,0,0,0,0,2,2,2,0,0), - (0,2,2,2,2,0,0,0,0,2,2,2,2,0) - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($mario, 1)); - height: $size * length($mario); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $mario, $mario-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/nes-icon.scss b/node_modules/nes.css/scss/pixel-arts/nes-icon.scss deleted file mode 100644 index de48917..0000000 --- a/node_modules/nes.css/scss/pixel-arts/nes-icon.scss +++ /dev/null @@ -1,34 +0,0 @@ -.nes-logo { - $logo-colors: (#3e3634, #c3c3c3, #787973, #bf1710); - - // prettier-ignore - $logo: ( - (0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2), - (2,1,1,1,1,1,1,1,1,1,1,1,1,1,2), - (2,1,1,2,1,1,3,3,3,1,1,1,1,1,2), - (2,1,2,2,2,1,1,1,1,1,1,1,1,1,2), - (2,1,1,2,1,1,3,3,3,1,4,1,4,1,2), - (2,1,1,1,1,1,1,1,1,1,1,1,1,1,2), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2) - ); - $size: 4px; - - position: relative; - display: inline-block; - width: $size * length(nth($logo, 1)); - height: $size * length($logo); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $logo, $logo-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/nes-jp-icon.scss b/node_modules/nes.css/scss/pixel-arts/nes-jp-icon.scss deleted file mode 100644 index de43ff7..0000000 --- a/node_modules/nes.css/scss/pixel-arts/nes-jp-icon.scss +++ /dev/null @@ -1,34 +0,0 @@ -.nes-jp-logo { - $logo-colors: (#333, #871f37, #dfd3b9); - - // prettier-ignore - $logo: ( - (0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2), - (2,3,3,3,3,3,2,2,2,2,2,2,2,2,2), - (2,3,3,1,3,3,2,2,2,2,2,2,2,2,2), - (2,3,1,1,1,3,3,3,3,3,3,3,3,3,2), - (2,3,3,1,3,3,1,2,1,3,1,3,1,3,2), - (2,3,3,3,3,3,3,3,3,3,3,3,3,3,2), - (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2) - ); - $size: 4px; - - position: relative; - display: inline-block; - width: $size * length(nth($logo, 1)); - height: $size * length($logo); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $logo, $logo-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/octocat.scss b/node_modules/nes.css/scss/pixel-arts/octocat.scss deleted file mode 100644 index 4b818b0..0000000 --- a/node_modules/nes.css/scss/pixel-arts/octocat.scss +++ /dev/null @@ -1,66 +0,0 @@ -.nes-octocat { - $octocat-colors: (#333, #ffdec4, #cb7066); - // prettier-ignore - $octocat-1: ( - (0,0,0,1,0,0,0,0,0,0,0,0,1,0), - (0,0,0,1,1,0,0,0,0,0,0,1,1,0), - (0,0,0,1,1,1,1,1,1,1,1,1,1,0), - (0,0,1,1,1,1,1,1,1,1,1,1,1,1), - (0,0,1,1,1,1,1,1,1,1,1,1,1,1), - (0,0,1,1,1,2,2,2,2,2,2,1,1,1), - (0,0,1,1,2,3,2,2,2,2,3,2,1,1), - (0,0,1,1,2,3,2,2,2,2,3,2,1,1), - (0,0,0,1,1,2,2,3,3,2,2,1,1,0), - (1,1,0,0,0,0,1,1,1,1,0,0,0,0), - (0,0,1,1,0,1,1,1,1,1,1,0,0,0), - (0,0,0,1,1,1,1,1,1,1,1,0,0,0), - (0,0,0,0,0,1,0,1,1,0,1,0,0,0), - (0,0,0,0,0,1,0,1,1,0,1,0,0,0), - (0,0,0,0,1,0,1,0,0,1,0,1,0,0) - ); - // prettier-ignore - $octocat-2: ( - (0,0,0,1,0,0,0,0,0,0,0,0,1,0), - (0,0,0,1,1,0,0,0,0,0,0,1,1,0), - (0,0,0,1,1,1,1,1,1,1,1,1,1,0), - (0,0,1,1,1,1,1,1,1,1,1,1,1,1), - (0,0,1,1,1,1,1,1,1,1,1,1,1,1), - (0,0,1,1,1,2,2,2,2,2,2,1,1,1), - (0,0,1,1,2,2,2,2,2,2,2,2,1,1), - (0,1,1,1,2,3,2,2,2,2,3,2,1,1), - (0,1,0,1,1,2,2,3,3,2,2,1,1,0), - (0,0,1,0,0,0,1,1,1,1,0,0,0,0), - (0,0,0,1,0,1,1,1,1,1,1,0,0,0), - (0,0,0,1,1,1,1,1,1,1,1,0,0,0), - (0,0,0,0,0,1,0,1,1,0,1,0,0,0), - (0,0,0,0,0,1,0,1,1,0,1,0,0,0), - (0,0,0,0,1,0,1,0,0,1,0,1,0,0) - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($octocat-1, 1)); - height: $size * length($octocat-1); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $octocat-1, $octocat-colors); - @include fill-gaps(); - } - - &.animate::before { - animation: wave 0.5s infinite steps(1); - } - - @keyframes wave { - 50% { - @include pixelize($size, $octocat-2, $octocat-colors); - } - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/phone.scss b/node_modules/nes.css/scss/pixel-arts/phone.scss deleted file mode 100644 index 36cc11c..0000000 --- a/node_modules/nes.css/scss/pixel-arts/phone.scss +++ /dev/null @@ -1,44 +0,0 @@ -.nes-phone { - $phone-colors: (#596985, #3c4665, #000); - // prettier-ignore - $phone: ( - (0,0,3,3,3,3,3,3), - (0,3,3,2,2,2,1,3), - (3,3,2,2,2,2,1,3), - (3,2,2,2,2,2,1,3), - (3,2,2,2,2,2,1,3), - (3,2,2,2,2,2,1,3), - (3,2,2,3,3,3,3,3), - (3,2,2,3,0,0,0,0), - (3,2,2,3,0,0,0,0), - (3,2,2,3,0,0,0,0), - (3,2,2,3,0,0,0,0), - (3,2,2,3,0,0,0,0), - (3,2,2,3,0,0,0,0), - (3,2,2,3,0,0,0,0), - (3,2,2,3,3,3,3,3), - (3,2,2,2,2,2,1,3), - (3,2,2,2,2,2,1,3), - (3,2,2,2,2,2,1,3), - (3,3,2,2,2,2,1,3), - (0,3,3,2,2,2,1,3), - (0,0,3,3,3,3,3,3) - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($phone, 1)); - height: $size * length($phone); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $phone, $phone-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/pokeball.scss b/node_modules/nes.css/scss/pixel-arts/pokeball.scss deleted file mode 100644 index f5daa24..0000000 --- a/node_modules/nes.css/scss/pixel-arts/pokeball.scss +++ /dev/null @@ -1,37 +0,0 @@ -.nes-pokeball { - $pokeball-colors: (#060606, #ff001d, #fff, #9fa1a1); - // prettier-ignore - $pokeball: ( - (0,0,0,0,0,1,1,1,1,0,0,0,0,0), - (0,0,0,1,1,2,2,2,2,1,1,0,0,0), - (0,0,1,3,3,2,2,2,2,2,2,1,0,0), - (0,1,3,3,2,2,2,2,2,2,2,1,1,0), - (0,1,3,2,2,2,2,2,2,2,2,2,1,0), - (1,3,2,2,2,2,2,2,2,2,2,2,2,1), - (1,1,1,2,2,2,2,1,1,1,2,2,2,1), - (1,1,1,1,2,2,1,3,3,3,1,2,2,1), - (1,4,3,1,1,1,1,3,3,3,1,1,1,1), - (0,1,3,3,3,1,1,3,3,3,1,3,1,0), - (0,1,3,3,3,3,3,1,1,1,3,3,1,0), - (0,0,1,4,4,3,3,3,3,3,3,1,0,0), - (0,0,0,1,1,4,4,4,4,1,1,0,0,0), - (0,0,0,0,0,1,1,1,1,0,0,0,0,0), - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($pokeball, 1)); - height: $size * length($pokeball); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $pokeball, $pokeball-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/smartphone.scss b/node_modules/nes.css/scss/pixel-arts/smartphone.scss deleted file mode 100644 index 65836a9..0000000 --- a/node_modules/nes.css/scss/pixel-arts/smartphone.scss +++ /dev/null @@ -1,50 +0,0 @@ -.nes-smartphone { - $smartphone-colors: (#fff, #060606); - // prettier-ignore - $smartphone: ( - (0,2,2,2,2,2,2,2,2,2,2,2,2,2,0), - (2,2,1,1,1,1,1,1,1,1,1,1,1,2,2), - (2,1,1,1,2,2,2,2,2,2,2,1,1,1,2), - (2,1,1,1,1,1,1,1,1,1,1,1,1,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,2,2,2,2,2,2,2,2,2,2,2,1,2), - (2,1,1,1,1,1,1,1,1,1,1,1,1,1,2), - (2,1,1,1,1,1,1,2,2,1,1,1,1,1,2), - (2,1,1,1,1,1,1,2,2,1,1,1,1,1,2), - (2,2,1,1,1,1,1,1,1,1,1,1,1,2,2), - (0,2,2,2,2,2,2,2,2,2,2,2,2,2,0) - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($smartphone, 1)); - height: $size * length($smartphone); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $smartphone, $smartphone-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/snes-icon.scss b/node_modules/nes.css/scss/pixel-arts/snes-icon.scss deleted file mode 100644 index 3e4fbde..0000000 --- a/node_modules/nes.css/scss/pixel-arts/snes-icon.scss +++ /dev/null @@ -1,34 +0,0 @@ -.snes-logo { - $logo-colors: (#333, #d7d7d7, #8932e5, #ad6df0); - - // prettier-ignore - $logo: ( - (0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), - (0,0,1,1,1,1,1,1,1,1,1,1,1,0,0), - (0,1,2,2,2,2,2,2,2,2,2,2,2,1,0), - (1,2,2,1,2,2,2,2,2,2,2,4,2,2,1), - (1,2,1,1,1,2,2,2,2,2,4,2,3,2,1), - (1,2,2,1,2,2,1,2,1,2,2,3,2,2,1), - (0,1,2,2,2,2,2,2,2,2,2,2,2,1,0), - (0,0,1,1,1,1,1,1,1,1,1,1,1,0,0) - ); - $size: 4px; - - position: relative; - display: inline-block; - width: $size * length(nth($logo, 1)); - height: $size * length($logo); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $logo, $logo-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/snes-jp-icon.scss b/node_modules/nes.css/scss/pixel-arts/snes-jp-icon.scss deleted file mode 100644 index b9a30fc..0000000 --- a/node_modules/nes.css/scss/pixel-arts/snes-jp-icon.scss +++ /dev/null @@ -1,35 +0,0 @@ -.snes-jp-logo { - $px: 3px; - $logo-colors: (#333, #d7d7d7, #7dbb78, #999cf7, #f40500, #f6f504); - - // prettier-ignore - $logo: ( - (0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), - (0,0,1,1,1,1,1,1,1,1,1,1,1,0,0), - (0,1,2,2,2,2,2,2,2,2,2,2,2,1,0), - (1,2,2,1,2,2,2,2,2,2,2,4,2,2,1), - (1,2,1,1,1,2,2,2,2,2,3,2,5,2,1), - (1,2,2,1,2,2,1,2,1,2,2,6,2,2,1), - (0,1,2,2,2,2,2,2,2,2,2,2,2,1,0), - (0,0,1,1,1,1,1,1,1,1,1,1,1,0,0) - ); - $size: 4px; - - position: relative; - display: inline-block; - width: $size * length(nth($logo, 1)); - height: $size * length($logo); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $logo, $logo-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/pixel-arts/squirtle.scss b/node_modules/nes.css/scss/pixel-arts/squirtle.scss deleted file mode 100644 index 2eeed33..0000000 --- a/node_modules/nes.css/scss/pixel-arts/squirtle.scss +++ /dev/null @@ -1,40 +0,0 @@ -.nes-squirtle { - $squirtle-colors: (#000, #9cf, #cb6633, #9fa1a1, #fff, #f89934, #ff3); - // prettier-ignore - $squirtle: ( - (0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0), - (0,0,1,2,2,2,2,1,1,0,0,0,0,0,0,1,2,2,2,1,0), - (0,1,2,2,2,2,2,2,2,1,1,0,0,0,1,2,2,2,2,2,1), - (0,1,2,2,2,2,2,2,2,1,6,1,1,0,1,2,2,2,1,2,1), - (1,3,2,2,2,2,2,2,2,2,6,6,6,1,2,2,2,1,2,2,1), - (1,2,2,2,2,5,1,2,2,2,5,6,6,6,1,2,2,1,2,1,0), - (1,2,2,2,2,1,3,2,2,2,5,6,6,6,1,2,1,1,1,0,0), - (0,1,2,2,2,1,3,2,2,2,1,5,6,6,6,1,1,0,0,0,0), - (0,0,1,1,2,2,2,2,1,1,2,2,5,6,6,1,0,0,0,0,0), - (0,0,1,2,1,1,1,1,2,2,2,2,5,6,6,1,0,0,0,0,0), - (0,0,0,1,1,7,7,1,2,2,2,1,5,6,6,1,0,0,0,0,0), - (0,0,0,0,0,1,7,7,1,1,1,1,5,6,6,1,0,0,0,0,0), - (0,0,0,0,1,2,1,7,7,7,7,7,1,5,1,0,0,0,0,0,0), - (0,0,0,0,0,1,1,1,1,7,7,2,1,5,1,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,1,1,1,2,1,1,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,1,2,2,2,1,0,0,0,0,0,0,0), - (0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0), - ); - $size: 6px; - - position: relative; - display: inline-block; - width: $size * length(nth($squirtle, 1)); - height: $size * length($squirtle); - - &::before { - position: absolute; - top: -$size; - left: -$size; - content: ""; - background: transparent; - - @include pixelize($size, $squirtle, $squirtle-colors); - @include fill-gaps(); - } -} diff --git a/node_modules/nes.css/scss/utilities/_index.scss b/node_modules/nes.css/scss/utilities/_index.scss deleted file mode 100644 index 5af0dd7..0000000 --- a/node_modules/nes.css/scss/utilities/_index.scss +++ /dev/null @@ -1,7 +0,0 @@ -@charset "utf-8"; - -@import "animations.scss"; -@import "fill-gaps.scss"; -@import "icon-mixin.scss"; -@import "rounded-corners-mixin.scss"; -@import "visually-hidden.scss"; diff --git a/node_modules/nes.css/scss/utilities/animations.scss b/node_modules/nes.css/scss/utilities/animations.scss deleted file mode 100644 index f0f088b..0000000 --- a/node_modules/nes.css/scss/utilities/animations.scss +++ /dev/null @@ -1,9 +0,0 @@ -@keyframes blink { - 0% { - opacity: 1; - } - - 50% { - opacity: 0; - } -} diff --git a/node_modules/nes.css/scss/utilities/fill-gaps.scss b/node_modules/nes.css/scss/utilities/fill-gaps.scss deleted file mode 100644 index 93a82ab..0000000 --- a/node_modules/nes.css/scss/utilities/fill-gaps.scss +++ /dev/null @@ -1,5 +0,0 @@ -// Fill gaps in pixel art dots -// `transform` property conflict when used for nes-icon -@mixin fill-gaps() { - transform: rotate(0); -} diff --git a/node_modules/nes.css/scss/utilities/icon-mixin.scss b/node_modules/nes.css/scss/utilities/icon-mixin.scss deleted file mode 100644 index d884bc5..0000000 --- a/node_modules/nes.css/scss/utilities/icon-mixin.scss +++ /dev/null @@ -1,59 +0,0 @@ -@mixin pixelize($size, $matrix, $colors, $default-color: null) { - $ret: ""; - $moz: ""; - @if ($default-color == null) { - // count number of each color in matrix and decide main color by highest count - $matrix-colors: (); - $counts: (); - @each $row in $matrix { - @each $item in $row { - @if $item != 0 { - $index: index($matrix-colors, $item); - @if not $index { - $matrix-colors: append($matrix-colors, $item); - $counts: append($counts, 1); - } @else { - $count: nth($counts, $index) + 1; - $counts: set-nth($counts, $index, $count); - } - } - } - } - // use index of the highest count to get the corresponding matrix color - $default-color: nth($colors, nth($matrix-colors, index($counts, max($counts...)))); - } - - @for $i from 1 through length($matrix) { - $row: nth($matrix, $i); - - @for $j from 1 through length($row) { - $dot: nth($row, $j); - - @if $dot != 0 { - @if $ret != "" { - $ret: $ret + ","; - $moz: $moz + ","; - } - - $color: nth($colors, $dot); - @if $color == $default-color { - $ret: $ret + ($j * $size) + " " + ($i * $size); - $moz: $moz + ($j * $size) + " " + ($i * $size) + " 0 0.020em"; - } @else { - $ret: $ret + ($j * $size) + " " + ($i * $size) + " " + $color; - $moz: $moz + ($j * $size) + " " + ($i * $size) + " 0 0.020em " + $color; - } - } - } - } - - width: $size; - height: $size; - color: $default-color; - box-shadow: unquote($ret); - - // firefox only style - @supports (-moz-appearance: meterbar) { - box-shadow: unquote($moz); - } -} diff --git a/node_modules/nes.css/scss/utilities/rounded-corners-mixin.scss b/node_modules/nes.css/scss/utilities/rounded-corners-mixin.scss deleted file mode 100644 index 608c9bd..0000000 --- a/node_modules/nes.css/scss/utilities/rounded-corners-mixin.scss +++ /dev/null @@ -1,64 +0,0 @@ -%rounded-corner-defaults { - border-style: solid; - border-width: $border-size; -} - -@mixin border-image($color) { - border-image-source: url('data:image/svg+xml;utf8,'); -} - -@mixin compact-border-image($color) { - border-image-source: url('data:image/svg+xml;utf8,'); -} - -@mixin border-image-repeat() { - border-image-repeat: stretch; - - // for chrome - @media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) { - border-image-repeat: space; - } - - // for firefox - @supports (-moz-appearance: meterbar) { - border-image-repeat: stretch; - } -} - -@mixin rounded-corners($isDark: false) { - @extend %rounded-corner-defaults; - - border-image-slice: 3; - border-image-width: 3; - - @include border-image-repeat(); - - @if $isDark { - @include border-image($color-white); - - border-image-outset: 0; - } @else { - @include border-image($color-black); - - border-image-outset: 2; - } -} - -@mixin compact-rounded-corners($isDark: false) { - @extend %rounded-corner-defaults; - - border-image-slice: 2; - border-image-width: 2; - - @include border-image-repeat(); - - @if $isDark { - @include compact-border-image($color-white); - - border-image-outset: 0; - } @else { - @include compact-border-image($color-black); - - border-image-outset: 2; - } -} diff --git a/node_modules/nes.css/scss/utilities/visually-hidden.scss b/node_modules/nes.css/scss/utilities/visually-hidden.scss deleted file mode 100644 index 4941073..0000000 --- a/node_modules/nes.css/scss/utilities/visually-hidden.scss +++ /dev/null @@ -1,13 +0,0 @@ -/* https://medium.com/@matuzo/writing-css-with-accessibility-in-mind-8514a0007939 */ -@mixin visually-hidden() { - // position: absolute; - // margin: -1px; - width: 1px; - height: 1px; - padding: 0; - overflow: hidden; - clip: rect(0 0 0 0); - white-space: nowrap; - border: 0; - clip-path: inset(50%); -} diff --git a/node_modules/nes.css/sketch/NES-css-index.sketch b/node_modules/nes.css/sketch/NES-css-index.sketch deleted file mode 100644 index 4f8c749..0000000 Binary files a/node_modules/nes.css/sketch/NES-css-index.sketch and /dev/null differ diff --git a/node_modules/nes.css/story/_helpers/icons.js b/node_modules/nes.css/story/_helpers/icons.js deleted file mode 100644 index 82f44c6..0000000 --- a/node_modules/nes.css/story/_helpers/icons.js +++ /dev/null @@ -1,44 +0,0 @@ -export const Icons = { - twitter: 'twitter', - facebook: 'facebook', - github: 'github', - google: 'google', - youtube: 'youtube', - whatsapp: 'whatsapp', - gmail: 'gmail', - linkedin: 'linkedin', - instagram: 'instagram', - close: 'close', - coin: 'coin', - trophy: 'trophy', -}; - -export const Sprites = { - 'nes-pokeball': 'nes-pokeball', - 'nes-bulbasaur': 'nes-bulbasaur', - 'nes-charmander': 'nes-charmander', - 'nes-squirtle': 'nes-squirtle', - 'nes-smartphone': 'nes-smartphone', - 'nes-kirby': 'nes-kirby', - 'nes-phone': 'nes-phone', - 'nes-octocat animate': 'nes-octocat animate', - 'nes-ash': 'nes-ash', - 'nes-mario': 'nes-mario', - 'nes-logo': 'nes-logo', - 'nes-jp-logo': 'nes-jp-logo', - 'snes-logo': 'snes-logo', - 'snes-jp-logo': 'snes-jp-logo', -}; - -export const Reactions = { - heart: 'heart', - star: 'star', - like: 'like', -}; - -export const Size = { - default: '', - 'is-small': 'is-small', - 'is-medium': 'is-medium', - 'is-large': 'is-large', -}; diff --git a/node_modules/nes.css/story/_helpers/shared.js b/node_modules/nes.css/story/_helpers/shared.js deleted file mode 100644 index b8083e3..0000000 --- a/node_modules/nes.css/story/_helpers/shared.js +++ /dev/null @@ -1,5 +0,0 @@ -export default { - 'is-success': 'is-success', - 'is-warning': 'is-warning', - 'is-error': 'is-error', -}; diff --git a/node_modules/nes.css/story/avatars/avatars.stories.js b/node_modules/nes.css/story/avatars/avatars.stories.js deleted file mode 100644 index 6f53671..0000000 --- a/node_modules/nes.css/story/avatars/avatars.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Avatars from './avatars.template'; - -storiesOf('Avatars', module) - .addDecorator(withKnobs) - .add('Avatar', () => Avatars()); diff --git a/node_modules/nes.css/story/avatars/avatars.template.js b/node_modules/nes.css/story/avatars/avatars.template.js deleted file mode 100644 index cf61e67..0000000 --- a/node_modules/nes.css/story/avatars/avatars.template.js +++ /dev/null @@ -1,26 +0,0 @@ -import { select, boolean } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -export default () => { - const isRounded = boolean('is-rounded', false); - const avatarSize = select('Avatar Classes', { - default: '', - 'is-small': 'is-small', - 'is-medium': 'is-medium', - 'is-large': 'is-large', - }, ''); - - const avatarClasses = classNames( - 'nes-avatar', - avatarSize, - { - 'is-rounded': isRounded, - }, - ); - - return ` - Gravatar Image Example - `; -}; diff --git a/node_modules/nes.css/story/badge/badge.stories.js b/node_modules/nes.css/story/badge/badge.stories.js deleted file mode 100644 index 70cfc56..0000000 --- a/node_modules/nes.css/story/badge/badge.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Badge from './badge.template'; - -storiesOf('Badges', module) - .addDecorator(withKnobs) - .add('Badge', () => Badge()); diff --git a/node_modules/nes.css/story/badge/badge.template.js b/node_modules/nes.css/story/badge/badge.template.js deleted file mode 100644 index 8f7a9c3..0000000 --- a/node_modules/nes.css/story/badge/badge.template.js +++ /dev/null @@ -1,38 +0,0 @@ -import { select } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -import sharedOptions from '../_helpers/shared'; - -export default () => { - const sharedComponentOptions = { - 'is-dark': 'is-dark', - 'is-primary': 'is-primary', - ...sharedOptions, - }; - - const iconStyle = select('Badge Display', { - default: '', - 'is-splited': 'is-splited', - 'is-icon': 'is-icon', - }, 'is-splited'); - - const leftOptions = select('Left Style', { - ...sharedComponentOptions, - }, 'is-dark'); - - const rightOptions = select('Right Style', { - ...sharedComponentOptions, - }, 'is-success'); - - const badgeClasses = classNames( - 'nes-badge', - iconStyle, - ); - - return ` - - npm - 1.0.0 - - `; -}; diff --git a/node_modules/nes.css/story/balloons/balloons.stories.js b/node_modules/nes.css/story/balloons/balloons.stories.js deleted file mode 100644 index 0daf80b..0000000 --- a/node_modules/nes.css/story/balloons/balloons.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Ballons from './balloons.template'; - -storiesOf('Balloons', module) - .addDecorator(withKnobs) - .add('Balloon', () => Ballons()); diff --git a/node_modules/nes.css/story/balloons/balloons.template.js b/node_modules/nes.css/story/balloons/balloons.template.js deleted file mode 100644 index b42646e..0000000 --- a/node_modules/nes.css/story/balloons/balloons.template.js +++ /dev/null @@ -1,25 +0,0 @@ -import { select, boolean } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -export default () => { - const isDark = boolean('is-dark', false); - const balloonDirection = select('Direction', { - default: '', - 'from-left': 'from-left', - 'from-right': 'from-right', - }, ''); - - const balloonClasses = classNames( - 'nes-balloon', - balloonDirection, - { - 'is-dark': isDark, - }, - ); - - return ` -
    -

    Hello NES.css

    -
    - `; -}; diff --git a/node_modules/nes.css/story/buttons/buttons.stories.js b/node_modules/nes.css/story/buttons/buttons.stories.js deleted file mode 100644 index d354449..0000000 --- a/node_modules/nes.css/story/buttons/buttons.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Buttons from './buttons.template'; - -storiesOf('Buttons', module) - .addDecorator(withKnobs) - .add('Buttons', () => Buttons()); diff --git a/node_modules/nes.css/story/buttons/buttons.template.js b/node_modules/nes.css/story/buttons/buttons.template.js deleted file mode 100644 index 7291c40..0000000 --- a/node_modules/nes.css/story/buttons/buttons.template.js +++ /dev/null @@ -1,26 +0,0 @@ -import { select } from '@storybook/addon-knobs'; - -import sharedOption from '../_helpers/shared'; - -export default () => { - const buttonType = select('Button Type', { - button: 'button', - file: 'file', - }, 'button'); - - const buttonClasses = select('Button Classes', { - default: '', - 'is-primary': 'is-primary', - ...sharedOption, - 'is-disabled': 'is-disabled', - }, ''); - - return buttonType === 'button' ? ` - - ` : ` - - `; -}; diff --git a/node_modules/nes.css/story/containers/containers.stories.js b/node_modules/nes.css/story/containers/containers.stories.js deleted file mode 100644 index 77e0fde..0000000 --- a/node_modules/nes.css/story/containers/containers.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Containers from './containers.template'; - -storiesOf('Containers', module) - .addDecorator(withKnobs) - .add('Container', () => Containers()); diff --git a/node_modules/nes.css/story/containers/containers.template.js b/node_modules/nes.css/story/containers/containers.template.js deleted file mode 100644 index 517c026..0000000 --- a/node_modules/nes.css/story/containers/containers.template.js +++ /dev/null @@ -1,31 +0,0 @@ -import { select, boolean } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -export default () => { - const isDark = boolean('is-dark', false); - const isRounded = boolean('is-rounded', false); - const withTitle = boolean('with-title', false); - - const containerAlignment = select('Alignment', { - default: '', - 'is-centered': 'is-centered', - 'is-right': 'is-right', - }, ''); - - const containerClasses = classNames( - 'nes-container', - containerAlignment, - { - 'is-dark': isDark, - 'is-rounded': isRounded, - 'with-title': withTitle, - }, - ); - - return ` -
    - ${withTitle ? '

    Container

    ' : ''} -

    Good morning. Thou hast had a good night's sleep, I hope.

    -
    - `; -}; diff --git a/node_modules/nes.css/story/dialogs/dialogs.stories.js b/node_modules/nes.css/story/dialogs/dialogs.stories.js deleted file mode 100644 index 9907fa8..0000000 --- a/node_modules/nes.css/story/dialogs/dialogs.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Dialogs from './dialogs.template'; - -storiesOf('Dialogs', module) - .addDecorator(withKnobs) - .add('Dialog', () => Dialogs()); diff --git a/node_modules/nes.css/story/dialogs/dialogs.template.js b/node_modules/nes.css/story/dialogs/dialogs.template.js deleted file mode 100644 index b7dadda..0000000 --- a/node_modules/nes.css/story/dialogs/dialogs.template.js +++ /dev/null @@ -1,23 +0,0 @@ -import { boolean } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -export default () => { - const isOpen = boolean('Open', true) ? 'open' : ''; - const isRounded = boolean('is-rounded', false); - const isDark = boolean('is-dark', false); - - const dialogClasses = classNames( - 'nes-dialog', - { - 'is-rounded': isRounded, - 'is-dark': isDark, - }, - ); - - return ` - -

    Dialog

    -

    Alert: this is a dialog.

    -
    - `; -}; diff --git a/node_modules/nes.css/story/icons/icons.stories.js b/node_modules/nes.css/story/icons/icons.stories.js deleted file mode 100644 index 4271dab..0000000 --- a/node_modules/nes.css/story/icons/icons.stories.js +++ /dev/null @@ -1,12 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Icons from './icons.template'; -import Sprites from './sprites.template'; -import Reactions from './reactions.template'; - -storiesOf('Icons', module) - .addDecorator(withKnobs) - .add('Icons', () => Icons()) - .add('Sprites', () => Sprites()) - .add('Reactions', () => Reactions()); diff --git a/node_modules/nes.css/story/icons/icons.template.js b/node_modules/nes.css/story/icons/icons.template.js deleted file mode 100644 index 59017f7..0000000 --- a/node_modules/nes.css/story/icons/icons.template.js +++ /dev/null @@ -1,23 +0,0 @@ -import { radios, select } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -import { Icons, Size } from '../_helpers/icons'; - -export default () => { - const selectedIcon = select('class', { - ...Icons, - }, 'twitter'); - - const iconSize = radios('Icon Size', { - ...Size, - }, ''); - - const iconClasses = classNames( - 'nes-icon', - selectedIcon, - iconSize, - ); - return ` - - `; -}; diff --git a/node_modules/nes.css/story/icons/reactions.template.js b/node_modules/nes.css/story/icons/reactions.template.js deleted file mode 100644 index 4a5e87d..0000000 --- a/node_modules/nes.css/story/icons/reactions.template.js +++ /dev/null @@ -1,33 +0,0 @@ -import { select } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -import { Reactions } from '../_helpers/icons'; - -export default () => { - const reactionIcon = select('Reaction Icon', { - ...Reactions, - }, 'heart'); - - const reactionSize = select('Size Class', { - 'is-small': 'is-small', - 'is-medium': 'is-medium', - 'is-large': 'is-large', - }, 'is-large'); - - const reactionFill = select('Fill Class', { - default: '', - 'is-half': 'is-half', - 'is-transparent': 'is-transparent', - 'is-empty': 'is-empty', - }); - - const reactionClasses = classNames( - 'nes-icon', - reactionIcon, - reactionSize, - reactionFill, - ); - return ` - - `; -}; diff --git a/node_modules/nes.css/story/icons/sprites.template.js b/node_modules/nes.css/story/icons/sprites.template.js deleted file mode 100644 index c4b707e..0000000 --- a/node_modules/nes.css/story/icons/sprites.template.js +++ /dev/null @@ -1,13 +0,0 @@ -import { select } from '@storybook/addon-knobs'; - -import { Sprites } from '../_helpers/icons'; - -export default () => { - const selectedSprite = select('class', { - ...Sprites, - }, 'nes-pokeball'); - - return ` - - `; -}; diff --git a/node_modules/nes.css/story/inputs/checkboxes.template.js b/node_modules/nes.css/story/inputs/checkboxes.template.js deleted file mode 100644 index efa3d61..0000000 --- a/node_modules/nes.css/story/inputs/checkboxes.template.js +++ /dev/null @@ -1,22 +0,0 @@ -import { boolean } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -export default () => { - const isDark = boolean('is-dark', false); - - const checkBoxClasses = classNames( - 'nes-checkbox', - { - 'is-dark': isDark, - }, - ); - - return ` -
    - -
    - `; -}; diff --git a/node_modules/nes.css/story/inputs/input.template.js b/node_modules/nes.css/story/inputs/input.template.js deleted file mode 100644 index 156cc51..0000000 --- a/node_modules/nes.css/story/inputs/input.template.js +++ /dev/null @@ -1,20 +0,0 @@ -import { select } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -import sharedOptions from '../_helpers/shared'; - -export default () => { - const inputOptions = select('Input Classes', { - default: '', - ...sharedOptions, - }, ''); - - const inputClasses = classNames( - 'nes-input', - inputOptions, - ); - - return ` - - `; -}; diff --git a/node_modules/nes.css/story/inputs/inputs.stories.js b/node_modules/nes.css/story/inputs/inputs.stories.js deleted file mode 100644 index def5ac8..0000000 --- a/node_modules/nes.css/story/inputs/inputs.stories.js +++ /dev/null @@ -1,12 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Input from './input.template'; -import CheckBox from './checkboxes.template'; -import Radio from './radio.template'; - -storiesOf('Inputs', module) - .addDecorator(withKnobs) - .add('Input', () => Input()) - .add('Checkbox', () => CheckBox()) - .add('Radio', () => Radio()); diff --git a/node_modules/nes.css/story/inputs/radio.template.js b/node_modules/nes.css/story/inputs/radio.template.js deleted file mode 100644 index a78dd99..0000000 --- a/node_modules/nes.css/story/inputs/radio.template.js +++ /dev/null @@ -1,27 +0,0 @@ -import { boolean } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - - -export default () => { - const isDark = boolean('is-dark', false); - - const radioClasses = classNames( - 'nes-radio', - { - 'is-dark': isDark, - }, - ); - - return ` -
    - - -
    - `; -}; diff --git a/node_modules/nes.css/story/lists/lists.stories.js b/node_modules/nes.css/story/lists/lists.stories.js deleted file mode 100644 index ab60393..0000000 --- a/node_modules/nes.css/story/lists/lists.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Lists from './lists.template'; - -storiesOf('Lists', module) - .addDecorator(withKnobs) - .add('List', () => Lists()); diff --git a/node_modules/nes.css/story/lists/lists.template.js b/node_modules/nes.css/story/lists/lists.template.js deleted file mode 100644 index f396476..0000000 --- a/node_modules/nes.css/story/lists/lists.template.js +++ /dev/null @@ -1,23 +0,0 @@ -import { radios } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -export default () => { - const listOptions = radios('List Type', { - 'is-disc': 'is-disc', - 'is-circle': 'is-circle', - }, 'is-disc'); - - const listClasses = classNames( - 'nes-list', - listOptions, - ); - - return ` -
      -
    • Good morning.
    • -
    • Thou hast had a good night's sleep, I hope.
    • -
    • Thou hast had a good afternoon
    • -
    • Good night.
    • -
    - `; -}; diff --git a/node_modules/nes.css/story/progress/progress.stories.js b/node_modules/nes.css/story/progress/progress.stories.js deleted file mode 100644 index eba1513..0000000 --- a/node_modules/nes.css/story/progress/progress.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Progress from './progress.template'; - -storiesOf('Progress', module) - .addDecorator(withKnobs) - .add('Progress', () => Progress()); diff --git a/node_modules/nes.css/story/progress/progress.template.js b/node_modules/nes.css/story/progress/progress.template.js deleted file mode 100644 index 86d7e70..0000000 --- a/node_modules/nes.css/story/progress/progress.template.js +++ /dev/null @@ -1,32 +0,0 @@ -import { select, boolean, number } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -import sharedOption from '../_helpers/shared'; - -export default () => { - const isRounded = boolean('is-rounded', false); - const progressTypes = select('Progress Style', { - default: '', - 'is-dark': 'is-dark', - ...sharedOption, - }, ''); - - const percentage = number('Percentage', 30, { - range: true, - min: 0, - max: 100, - step: 1, - }); - - const progessClasses = classNames( - 'nes-progress', - progressTypes, - { - 'is-rounded': isRounded, - }, - ); - - return ` - - `; -}; diff --git a/node_modules/nes.css/story/select/select.stories.js b/node_modules/nes.css/story/select/select.stories.js deleted file mode 100644 index 1c340ef..0000000 --- a/node_modules/nes.css/story/select/select.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Select from './select.template'; - -storiesOf('Selects', module) - .addDecorator(withKnobs) - .add('Select', () => Select()); diff --git a/node_modules/nes.css/story/select/select.template.js b/node_modules/nes.css/story/select/select.template.js deleted file mode 100644 index 81a66d2..0000000 --- a/node_modules/nes.css/story/select/select.template.js +++ /dev/null @@ -1,21 +0,0 @@ -import { select } from '@storybook/addon-knobs'; - -import sharedOptions from '../_helpers/shared'; - -export default () => { - const selectedClass = select('class', { - default: '', - ...sharedOptions, - 'is-dark': 'is-dark', - }, ''); - - return ` -
    - -
    - `; -}; diff --git a/node_modules/nes.css/story/table/table.stories.js b/node_modules/nes.css/story/table/table.stories.js deleted file mode 100644 index 98c2d41..0000000 --- a/node_modules/nes.css/story/table/table.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Table from './table.template'; - -storiesOf('Tables', module) - .addDecorator(withKnobs) - .add('Table', () => Table()); diff --git a/node_modules/nes.css/story/table/table.template.js b/node_modules/nes.css/story/table/table.template.js deleted file mode 100644 index a2f96b9..0000000 --- a/node_modules/nes.css/story/table/table.template.js +++ /dev/null @@ -1,41 +0,0 @@ -import { boolean } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -export default () => { - const isBorderd = boolean('is-bordered', true); - const isCentered = boolean('is-centered', false); - const isDark = boolean('is-dark', false); - - const tableClasses = classNames( - 'nes-table', - { - 'is-bordered': isBorderd, - 'is-centered': isCentered, - 'is-dark': isDark, - }, - ); - - return ` - - - - - - - - - - - - - - - - - - - - -
    Table.is-darkTable.is-borderedTable.is-centered
    Thou hast had a good morningThou hast had a good afternoonThou hast had a good night
    Thou hast had a good morningThou hast had a good afternoonThou hast had a good night
    - `; -}; diff --git a/node_modules/nes.css/story/text/text.stories.js b/node_modules/nes.css/story/text/text.stories.js deleted file mode 100644 index 0602ff2..0000000 --- a/node_modules/nes.css/story/text/text.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Text from './text.template'; - -storiesOf('Text', module) - .addDecorator(withKnobs) - .add('Text', () => Text()); diff --git a/node_modules/nes.css/story/text/text.template.js b/node_modules/nes.css/story/text/text.template.js deleted file mode 100644 index 2583149..0000000 --- a/node_modules/nes.css/story/text/text.template.js +++ /dev/null @@ -1,22 +0,0 @@ -import { select } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -import sharedOptions from '../_helpers/shared'; - -export default () => { - const textOptions = select('Radio Classes', { - default: '', - 'is-primary': 'is-primary', - ...sharedOptions, - 'is-disabled': 'is-disabled', - }, ''); - - const textClasses = classNames( - 'nes-text', - textOptions, - ); - - return ` - NES.css - `; -}; diff --git a/node_modules/nes.css/story/textarea/textarea.stories.js b/node_modules/nes.css/story/textarea/textarea.stories.js deleted file mode 100644 index 5904bfa..0000000 --- a/node_modules/nes.css/story/textarea/textarea.stories.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storiesOf } from '@storybook/html'; -import { withKnobs } from '@storybook/addon-knobs'; - -import Textarea from './textarea.template'; - -storiesOf('Textareas', module) - .addDecorator(withKnobs) - .add('Textarea', () => Textarea()); diff --git a/node_modules/nes.css/story/textarea/textarea.template.js b/node_modules/nes.css/story/textarea/textarea.template.js deleted file mode 100644 index 97f0d85..0000000 --- a/node_modules/nes.css/story/textarea/textarea.template.js +++ /dev/null @@ -1,20 +0,0 @@ -import { select } from '@storybook/addon-knobs'; -import classNames from 'classnames'; - -import sharedOptions from '../_helpers/shared'; - -export default () => { - const textareaOption = select('Textarea Classes', { - default: '', - ...sharedOptions, - }, ''); - - const textareaClasses = classNames( - 'nes-textarea', - textareaOption, - ); - - return ` - - `; -}; diff --git a/node_modules/pkcs7/CHANGELOG.md b/node_modules/pkcs7/CHANGELOG.md deleted file mode 100644 index f88fa69..0000000 --- a/node_modules/pkcs7/CHANGELOG.md +++ /dev/null @@ -1,18 +0,0 @@ - -## [1.0.4](https://github.com/brightcove/pkcs7/compare/v1.0.3...v1.0.4) (2020-09-09) - -### Chores - -* **package:** remove postcss-cli ([aed7b3a](https://github.com/brightcove/pkcs7/commit/aed7b3a)) - - -## [1.0.3](https://github.com/brightcove/pkcs7/compare/v1.0.2...v1.0.3) (2019-08-21) - -### Chores - -* generator 7.7.3 update ([#13](https://github.com/brightcove/pkcs7/issues/13)) ([da31c29](https://github.com/brightcove/pkcs7/commit/da31c29)) -* remove pkg.engines field ([#9](https://github.com/brightcove/pkcs7/issues/9)) ([17a1d1d](https://github.com/brightcove/pkcs7/commit/17a1d1d)) -* update npm-run-all to fix security issue ([#11](https://github.com/brightcove/pkcs7/issues/11)) ([a07d6d7](https://github.com/brightcove/pkcs7/commit/a07d6d7)) -* Update to generator v7 standards ([#10](https://github.com/brightcove/pkcs7/issues/10)) ([e075fe6](https://github.com/brightcove/pkcs7/commit/e075fe6)) -* update videojs-generator-verify to fix security issue ([c1e6bd7](https://github.com/brightcove/pkcs7/commit/c1e6bd7)) - diff --git a/node_modules/pkcs7/CONTRIBUTING.md b/node_modules/pkcs7/CONTRIBUTING.md deleted file mode 100644 index 7840f8c..0000000 --- a/node_modules/pkcs7/CONTRIBUTING.md +++ /dev/null @@ -1,30 +0,0 @@ -# CONTRIBUTING - -We welcome contributions from everyone! - -## Getting Started - -Make sure you have Node.js 4.8 or higher and npm installed. - -1. Fork this repository and clone your fork -1. Install dependencies: `npm install` -1. Run a development server: `npm start` - -### Making Changes - -Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship. - -When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository. - -### Running Tests - -Testing is a crucial part of any software project. For all but the most trivial changes (typos, etc) test cases are expected. Tests are run in actual browsers using [Karma][karma]. - -- In all available and supported browsers: `npm test` -- In a specific browser: `npm run test:chrome`, `npm run test:firefox`, etc. -- While development server is running (`npm start`), navigate to [`http://localhost:9999/test/`][local] - - -[karma]: http://karma-runner.github.io/ -[local]: http://localhost:9999/test/ -[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md diff --git a/node_modules/pkcs7/LICENSE b/node_modules/pkcs7/LICENSE deleted file mode 100644 index d735a61..0000000 --- a/node_modules/pkcs7/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright Brightcove Inc - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/node_modules/pkcs7/README.md b/node_modules/pkcs7/README.md deleted file mode 100644 index 1a0fc3f..0000000 --- a/node_modules/pkcs7/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# pkcs7 - -[![Build Status](https://travis-ci.org/brightcove/pkcs7.svg?branch=master)](https://travis-ci.org/brightcove/pkcs7) -[![Greenkeeper badge](https://badges.greenkeeper.io/brightcove/pkcs7.svg)](https://greenkeeper.io/) -[![Slack Status](http://slack.videojs.com/badge.svg)](http://slack.videojs.com) - -[![NPM](https://nodei.co/npm/pkcs7.png?downloads=true&downloadRank=true)](https://nodei.co/npm/pkcs7/) - -> Add and remove pkcs7-style padding. - - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Getting Started](#getting-started) -- [Documentation](#documentation) -- [Examples](#examples) -- [Contributing](#contributing) -- [License](#license) - - - -## Getting Started - -Install the module with: `npm install pkcs7` - -```js -var pkcs7 = require('pkcs7'), encrypted; -// pad a buffer! -enctcrypted = encrypt(pkcs7.pad(buffer)); - -// later, you can unpad it: -console.log('the secret is out! ' + pkcs7.unpad(decrypt(encrypted))); -``` - -Install with cli command - -```sh -$ npm install -g pkcs7 -$ pkcs7 --help -$ pkcs7 --version -``` - -## Documentation - -PKCS#7 padding a really simple transformation some crytographic algorithms use to ensure the number of input bytes is a multiple of some constant. Here's how it works: - - 01 -- if lth mod k = k-1 - 02 02 -- if lth mod k = k-2 - . - . - . - k k ... k k -- if lth mod k = 0 - -`k` is the constant value the encryption algorithm wants your input to be a multiple of. This project assumes `k` is *always* sixteen. Not much to it, right? If reading specs is your thing, check out [RFC 5652](http://tools.ietf.org/html/rfc5652). - - -## Examples - -You can run pkcs7 from the command line: - -```shell -# pad a string generated by echo and the hex dump the result -echo -n "0123456789AB" | pkcs7 | xxd -``` - -## Contributing - -In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com). - - -## License - -Copyright (c) 2014 Brightcove -Licensed under the Apache-2 license. diff --git a/node_modules/pkcs7/bin/cli.js b/node_modules/pkcs7/bin/cli.js deleted file mode 100644 index 070c472..0000000 --- a/node_modules/pkcs7/bin/cli.js +++ /dev/null @@ -1,46 +0,0 @@ -#! /usr/bin/env node - -'use strict'; - -const pkcs7 = require('../dist/pkcs7.cjs.js'); -const fs = require('fs'); -const path = require('path'); - -const userArgs = process.argv; - -if (userArgs.indexOf('-h') !== -1 || userArgs.indexOf('--help') !== -1) { - // eslint-disable-next-line - console.log('usage: pkcs7'); - // eslint-disable-next-line - console.log('pkcs7 expects input on stdin and outputs to stdout'); - process.exit(); -} - -if (userArgs.indexOf('-v') !== -1 || userArgs.indexOf('--version') !== -1) { - // eslint-disable-next-line - console.log(JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'))).version); - process.exit(); -} - -const data = []; - -process.stdin.on('readable', function() { - const chunk = process.stdin.read(); - - if (chunk !== null) { - data.push(chunk); - } -}); - -process.stdin.on('end', function() { - const buffer = Buffer.concat(data); - const bytes = new Uint8Array(buffer.length); - let i = buffer.length; - - while (i--) { - bytes[i] = buffer[i]; - } - - // output the padded input - process.stdout.write(new Buffer(pkcs7.pad(bytes))); -}); diff --git a/node_modules/pkcs7/dist/pkcs7.cjs.js b/node_modules/pkcs7/dist/pkcs7.cjs.js deleted file mode 100644 index bf49129..0000000 --- a/node_modules/pkcs7/dist/pkcs7.cjs.js +++ /dev/null @@ -1,47 +0,0 @@ -/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -/* - * pkcs7.pad - * https://github.com/brightcove/pkcs7 - * - * Copyright (c) 2014 Brightcove - * Licensed under the apache2 license. - */ -var PADDING; -/** - * Returns a new Uint8Array that is padded with PKCS#7 padding. - * - * @param plaintext {Uint8Array} the input bytes before encryption - * @return {Uint8Array} the padded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - -function pad(plaintext) { - var padding = PADDING[plaintext.byteLength % 16 || 0]; - var result = new Uint8Array(plaintext.byteLength + padding.length); - result.set(plaintext); - result.set(padding, plaintext.byteLength); - return result; -} // pre-define the padding values - -PADDING = [[16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16], [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15], [14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14], [13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13], [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [9, 9, 9, 9, 9, 9, 9, 9, 9], [8, 8, 8, 8, 8, 8, 8, 8], [7, 7, 7, 7, 7, 7, 7], [6, 6, 6, 6, 6, 6], [5, 5, 5, 5, 5], [4, 4, 4, 4], [3, 3, 3], [2, 2], [1]]; - -/** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ -function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); -} - -var version = "1.0.4"; - -exports.VERSION = version; -exports.pad = pad; -exports.unpad = unpad; diff --git a/node_modules/pkcs7/dist/pkcs7.es.js b/node_modules/pkcs7/dist/pkcs7.es.js deleted file mode 100644 index 709c2cd..0000000 --- a/node_modules/pkcs7/dist/pkcs7.es.js +++ /dev/null @@ -1,41 +0,0 @@ -/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ -/* - * pkcs7.pad - * https://github.com/brightcove/pkcs7 - * - * Copyright (c) 2014 Brightcove - * Licensed under the apache2 license. - */ -var PADDING; -/** - * Returns a new Uint8Array that is padded with PKCS#7 padding. - * - * @param plaintext {Uint8Array} the input bytes before encryption - * @return {Uint8Array} the padded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - -function pad(plaintext) { - var padding = PADDING[plaintext.byteLength % 16 || 0]; - var result = new Uint8Array(plaintext.byteLength + padding.length); - result.set(plaintext); - result.set(padding, plaintext.byteLength); - return result; -} // pre-define the padding values - -PADDING = [[16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16], [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15], [14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14], [13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13], [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [9, 9, 9, 9, 9, 9, 9, 9, 9], [8, 8, 8, 8, 8, 8, 8, 8], [7, 7, 7, 7, 7, 7, 7], [6, 6, 6, 6, 6, 6], [5, 5, 5, 5, 5], [4, 4, 4, 4], [3, 3, 3], [2, 2], [1]]; - -/** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ -function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); -} - -var version = "1.0.4"; - -export { version as VERSION, pad, unpad }; diff --git a/node_modules/pkcs7/dist/pkcs7.js b/node_modules/pkcs7/dist/pkcs7.js deleted file mode 100644 index 8eeb14a..0000000 --- a/node_modules/pkcs7/dist/pkcs7.js +++ /dev/null @@ -1,53 +0,0 @@ -/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.pkcs7 = {})); -}(this, function (exports) { 'use strict'; - - /* - * pkcs7.pad - * https://github.com/brightcove/pkcs7 - * - * Copyright (c) 2014 Brightcove - * Licensed under the apache2 license. - */ - var PADDING; - /** - * Returns a new Uint8Array that is padded with PKCS#7 padding. - * - * @param plaintext {Uint8Array} the input bytes before encryption - * @return {Uint8Array} the padded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - - function pad(plaintext) { - var padding = PADDING[plaintext.byteLength % 16 || 0]; - var result = new Uint8Array(plaintext.byteLength + padding.length); - result.set(plaintext); - result.set(padding, plaintext.byteLength); - return result; - } // pre-define the padding values - - PADDING = [[16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16], [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15], [14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14], [13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13], [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [9, 9, 9, 9, 9, 9, 9, 9, 9], [8, 8, 8, 8, 8, 8, 8, 8], [7, 7, 7, 7, 7, 7, 7], [6, 6, 6, 6, 6, 6], [5, 5, 5, 5, 5], [4, 4, 4, 4], [3, 3, 3], [2, 2], [1]]; - - /** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); - } - - var version = "1.0.4"; - - exports.VERSION = version; - exports.pad = pad; - exports.unpad = unpad; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/pkcs7/dist/pkcs7.min.js b/node_modules/pkcs7/dist/pkcs7.min.js deleted file mode 100644 index 299a414..0000000 --- a/node_modules/pkcs7/dist/pkcs7.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).pkcs7={})}(this,function(e){"use strict";var t;t=[[16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16],[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15],[14,14,14,14,14,14,14,14,14,14,14,14,14,14],[13,13,13,13,13,13,13,13,13,13,13,13,13],[12,12,12,12,12,12,12,12,12,12,12,12],[11,11,11,11,11,11,11,11,11,11,11],[10,10,10,10,10,10,10,10,10,10],[9,9,9,9,9,9,9,9,9],[8,8,8,8,8,8,8,8],[7,7,7,7,7,7,7],[6,6,6,6,6,6],[5,5,5,5,5],[4,4,4,4],[3,3,3],[2,2],[1]];e.VERSION="1.0.4",e.pad=function(e){var n=t[e.byteLength%16||0],r=new Uint8Array(e.byteLength+n.length);return r.set(e),r.set(n,e.byteLength),r},e.unpad=function(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])},Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/node_modules/pkcs7/dist/pkcs7.pad.js b/node_modules/pkcs7/dist/pkcs7.pad.js deleted file mode 100644 index 4c05f6d..0000000 --- a/node_modules/pkcs7/dist/pkcs7.pad.js +++ /dev/null @@ -1,36 +0,0 @@ -/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, (global.pkcs7 = global.pkcs7 || {}, global.pkcs7.pad = factory())); -}(this, function () { 'use strict'; - - /* - * pkcs7.pad - * https://github.com/brightcove/pkcs7 - * - * Copyright (c) 2014 Brightcove - * Licensed under the apache2 license. - */ - var PADDING; - /** - * Returns a new Uint8Array that is padded with PKCS#7 padding. - * - * @param plaintext {Uint8Array} the input bytes before encryption - * @return {Uint8Array} the padded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - - function pad(plaintext) { - var padding = PADDING[plaintext.byteLength % 16 || 0]; - var result = new Uint8Array(plaintext.byteLength + padding.length); - result.set(plaintext); - result.set(padding, plaintext.byteLength); - return result; - } // pre-define the padding values - - PADDING = [[16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16], [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15], [14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14], [13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13], [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [9, 9, 9, 9, 9, 9, 9, 9, 9], [8, 8, 8, 8, 8, 8, 8, 8], [7, 7, 7, 7, 7, 7, 7], [6, 6, 6, 6, 6, 6], [5, 5, 5, 5, 5], [4, 4, 4, 4], [3, 3, 3], [2, 2], [1]]; - - return pad; - -})); diff --git a/node_modules/pkcs7/dist/pkcs7.pad.min.js b/node_modules/pkcs7/dist/pkcs7.pad.min.js deleted file mode 100644 index f785387..0000000 --- a/node_modules/pkcs7/dist/pkcs7.pad.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e=e||self).pkcs7=e.pkcs7||{},e.pkcs7.pad=t())}(this,function(){"use strict";var e;return e=[[16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16],[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15],[14,14,14,14,14,14,14,14,14,14,14,14,14,14],[13,13,13,13,13,13,13,13,13,13,13,13,13],[12,12,12,12,12,12,12,12,12,12,12,12],[11,11,11,11,11,11,11,11,11,11,11],[10,10,10,10,10,10,10,10,10,10],[9,9,9,9,9,9,9,9,9],[8,8,8,8,8,8,8,8],[7,7,7,7,7,7,7],[6,6,6,6,6,6],[5,5,5,5,5],[4,4,4,4],[3,3,3],[2,2],[1]],function(t){var n=e[t.byteLength%16||0],f=new Uint8Array(t.byteLength+n.length);return f.set(t),f.set(n,t.byteLength),f}}); diff --git a/node_modules/pkcs7/dist/pkcs7.unpad.js b/node_modules/pkcs7/dist/pkcs7.unpad.js deleted file mode 100644 index a5e76ee..0000000 --- a/node_modules/pkcs7/dist/pkcs7.unpad.js +++ /dev/null @@ -1,21 +0,0 @@ -/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, (global.pkcs7 = global.pkcs7 || {}, global.pkcs7.unpad = factory())); -}(this, function () { 'use strict'; - - /** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ - function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); - } - - return unpad; - -})); diff --git a/node_modules/pkcs7/dist/pkcs7.unpad.min.js b/node_modules/pkcs7/dist/pkcs7.unpad.min.js deleted file mode 100644 index a7e0cc5..0000000 --- a/node_modules/pkcs7/dist/pkcs7.unpad.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e=e||self).pkcs7=e.pkcs7||{},e.pkcs7.unpad=t())}(this,function(){"use strict";return function(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}}); diff --git a/node_modules/pkcs7/package.json b/node_modules/pkcs7/package.json deleted file mode 100644 index d23f3d8..0000000 --- a/node_modules/pkcs7/package.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "_from": "pkcs7@^1.0.4", - "_id": "pkcs7@1.0.4", - "_inBundle": false, - "_integrity": "sha512-afRERtHn54AlwaF2/+LFszyAANTCggGilmcmILUzEjvs3XgFZT+xE6+QWQcAGmu4xajy+Xtj7acLOPdx5/eXWQ==", - "_location": "/pkcs7", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "pkcs7@^1.0.4", - "name": "pkcs7", - "escapedName": "pkcs7", - "rawSpec": "^1.0.4", - "saveSpec": null, - "fetchSpec": "^1.0.4" - }, - "_requiredBy": [ - "/aes-decrypter" - ], - "_resolved": "https://registry.npmjs.org/pkcs7/-/pkcs7-1.0.4.tgz", - "_shasum": "6090b9e71160dabf69209d719cbafa538b00a1cb", - "_spec": "pkcs7@^1.0.4", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\aes-decrypter", - "author": { - "name": "Brightcove" - }, - "bin": { - "pkcs7": "bin/cli.js" - }, - "browserslist": [ - "defaults", - "ie 11" - ], - "bugs": { - "url": "https://github.com/brightcove/pkcs7/issues" - }, - "bundleDependencies": false, - "dependencies": { - "@babel/runtime": "^7.5.5" - }, - "deprecated": false, - "description": "Add and remove pkcs7-style padding.", - "devDependencies": { - "@videojs/generator-helpers": "~1.2.0", - "karma": "^4.0.0", - "rollup": "^1.19.4", - "sinon": "^7.2.2", - "videojs-generate-karma-config": "~5.3.1", - "videojs-generate-rollup-config": "~5.0.0", - "videojs-generator-verify": "~2.0.0", - "videojs-standard": "^8.0.3" - }, - "files": [ - "CONTRIBUTING.md", - "dist/", - "docs/", - "index.html", - "scripts/", - "src/", - "test/", - "bin" - ], - "generator-videojs-plugin": { - "version": "7.7.3" - }, - "homepage": "https://github.com/brightcove/pkcs7", - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "keywords": [ - "pkcs7", - "pkcs7 encrypt decrypt padding pkcs", - "videojs", - "videojs-plugin" - ], - "license": "Apache-2.0", - "lint-staged": { - "*.js": [ - "vjsstandard --fix", - "git add" - ], - "README.md": [ - "doctoc --notitle", - "git add" - ] - }, - "main": "dist/pkcs7.cjs.js", - "module": "dist/pkcs7.es.js", - "name": "pkcs7", - "repository": { - "type": "git", - "url": "git+https://github.com/brightcove/pkcs7.git" - }, - "scripts": { - "build": "npm-run-all -s clean -p build:*", - "build-prod": "cross-env-shell NO_TEST_BUNDLE=1 'npm run build'", - "build-test": "cross-env-shell TEST_BUNDLE_ONLY=1 'npm run build'", - "build:js": "rollup -c scripts/rollup.config.js", - "clean": "shx rm -rf ./dist ./test/dist && shx mkdir -p ./dist ./test/dist", - "lint": "vjsstandard", - "posttest": "shx cat test/dist/coverage/text.txt", - "prepublishOnly": "npm-run-all build-prod && vjsverify --verbose", - "preversion": "npm test", - "server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch", - "start": "npm-run-all -p server watch", - "test": "npm-run-all lint build-test -p test:*", - "test:browser": "karma start scripts/karma.conf.js", - "test:node": "qunit test/dist/bundle.js", - "update-changelog": "conventional-changelog -p videojs -i CHANGELOG.md -s", - "version": "is-prerelease || npm run update-changelog && git add CHANGELOG.md", - "watch": "npm-run-all -p watch:*", - "watch:js": "npm run build:js -- -w" - }, - "version": "1.0.4", - "vjsstandard": { - "ignore": [ - "dist", - "docs", - "test/dist" - ] - } -} diff --git a/node_modules/pkcs7/scripts/karma.conf.js b/node_modules/pkcs7/scripts/karma.conf.js deleted file mode 100644 index ac53a18..0000000 --- a/node_modules/pkcs7/scripts/karma.conf.js +++ /dev/null @@ -1,12 +0,0 @@ -const generate = require('videojs-generate-karma-config'); - -module.exports = function(config) { - - // see https://github.com/videojs/videojs-generate-karma-config - // for options - const options = {}; - - config = generate(config, options); - - // any other custom stuff not supported by options here! -}; diff --git a/node_modules/pkcs7/scripts/rollup.config.js b/node_modules/pkcs7/scripts/rollup.config.js deleted file mode 100644 index 2ba9c47..0000000 --- a/node_modules/pkcs7/scripts/rollup.config.js +++ /dev/null @@ -1,38 +0,0 @@ -const generate = require('videojs-generate-rollup-config'); - -// see https://github.com/videojs/videojs-generate-rollup-config -// for options -const options = {input: 'src/pkcs7.js'}; -const config = generate(options); - -// Add additonal builds/customization here! - -config.builds = Object.assign(config.builds, { - pad: config.makeBuild('browser', { - input: 'src/pad.js', - output: [{ - name: 'pkcs7.pad', - file: 'dist/pkcs7.pad.js', - format: 'umd' - }, { - name: 'pkcs7.pad', - file: 'dist/pkcs7.pad.min.js', - format: 'umd' - }] - }), - unpad: config.makeBuild('browser', { - input: 'src/unpad.js', - output: [{ - name: 'pkcs7.unpad', - file: 'dist/pkcs7.unpad.js', - format: 'umd' - }, { - name: 'pkcs7.unpad', - file: 'dist/pkcs7.unpad.min.js', - format: 'umd' - }] - }) -}); - -// export the builds to rollup -export default Object.values(config.builds); diff --git a/node_modules/pkcs7/src/pad.js b/node_modules/pkcs7/src/pad.js deleted file mode 100644 index 2b0325a..0000000 --- a/node_modules/pkcs7/src/pad.js +++ /dev/null @@ -1,85 +0,0 @@ -/* - * pkcs7.pad - * https://github.com/brightcove/pkcs7 - * - * Copyright (c) 2014 Brightcove - * Licensed under the apache2 license. - */ - -let PADDING; - -/** - * Returns a new Uint8Array that is padded with PKCS#7 padding. - * - * @param plaintext {Uint8Array} the input bytes before encryption - * @return {Uint8Array} the padded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ -export default function pad(plaintext) { - const padding = PADDING[(plaintext.byteLength % 16) || 0]; - const result = new Uint8Array(plaintext.byteLength + padding.length); - - result.set(plaintext); - result.set(padding, plaintext.byteLength); - - return result; -} - -// pre-define the padding values -PADDING = [ - [16, 16, 16, 16, - 16, 16, 16, 16, - 16, 16, 16, 16, - 16, 16, 16, 16], - - [15, 15, 15, 15, - 15, 15, 15, 15, - 15, 15, 15, 15, - 15, 15, 15], - - [14, 14, 14, 14, - 14, 14, 14, 14, - 14, 14, 14, 14, - 14, 14], - - [13, 13, 13, 13, - 13, 13, 13, 13, - 13, 13, 13, 13, - 13], - - [12, 12, 12, 12, - 12, 12, 12, 12, - 12, 12, 12, 12], - - [11, 11, 11, 11, - 11, 11, 11, 11, - 11, 11, 11], - - [10, 10, 10, 10, - 10, 10, 10, 10, - 10, 10], - - [9, 9, 9, 9, - 9, 9, 9, 9, - 9], - - [8, 8, 8, 8, - 8, 8, 8, 8], - - [7, 7, 7, 7, - 7, 7, 7], - - [6, 6, 6, 6, - 6, 6], - - [5, 5, 5, 5, - 5], - - [4, 4, 4, 4], - - [3, 3, 3], - - [2, 2], - - [1] -]; diff --git a/node_modules/pkcs7/src/pkcs7.js b/node_modules/pkcs7/src/pkcs7.js deleted file mode 100644 index 521df98..0000000 --- a/node_modules/pkcs7/src/pkcs7.js +++ /dev/null @@ -1,5 +0,0 @@ -import pad from './pad.js'; -import unpad from './unpad.js'; -import {version as VERSION} from '../package.json'; - -export { pad, unpad, VERSION }; diff --git a/node_modules/pkcs7/src/unpad.js b/node_modules/pkcs7/src/unpad.js deleted file mode 100644 index a8a47a4..0000000 --- a/node_modules/pkcs7/src/unpad.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ -export default function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); -} diff --git a/node_modules/pkcs7/test/pkcs7.test.js b/node_modules/pkcs7/test/pkcs7.test.js deleted file mode 100644 index 6c63ad0..0000000 --- a/node_modules/pkcs7/test/pkcs7.test.js +++ /dev/null @@ -1,64 +0,0 @@ -/* eslint-disable object-shorthand */ - -import {pad, unpad} from '../src/pkcs7.js'; -import QUnit from 'qunit'; - -const pkcs7 = {pad, unpad}; - -QUnit.module('pkcs7'); - -QUnit.test('pads empty buffers', function(assert) { - assert.expect(1); - - const result = pkcs7.unpad(pkcs7.pad(new Uint8Array([]))); - - assert.deepEqual( - new Uint8Array(result, result.byteOffset, result.byteLength), - new Uint8Array(0), - 'accepts an empty buffer' - ); -}); - -QUnit.test('pads non-empty buffers', function(assert) { - - let i = 16; - - assert.expect(i * 3); - - while (i--) { - // build the test buffer - const buffer = new Uint8Array(i + 1); - let result; - - result = pkcs7.pad(buffer); - assert.equal(result.length % 16, 0, 'padded length is a multiple of 16'); - assert.equal(result.slice(-1)[0], 16 - ((i + 1) % 16), 'appended the correct value'); - - result = pkcs7.unpad(result); - - assert.deepEqual( - new Uint8Array(result, result.byteOffset, result.byteLength), - buffer, - 'padding is reversible' - ); - } -}); - -QUnit.test('works on buffers greater than sixteen bytes', function(assert) { - const buffer = new Uint8Array(16 * 3 + 9); - - assert.expect(2); - - assert.equal( - pkcs7.pad(buffer).length - buffer.length, - 16 - 9, - 'adds the correct amount of padding' - ); - const result = pkcs7.unpad(pkcs7.pad(buffer)); - - assert.deepEqual( - new Uint8Array(result, result.byteOffset, result.byteLength), - buffer, - 'is reversible' - ); -}); diff --git a/node_modules/process/.eslintrc b/node_modules/process/.eslintrc deleted file mode 100644 index 1e7aab7..0000000 --- a/node_modules/process/.eslintrc +++ /dev/null @@ -1,21 +0,0 @@ -{ -extends: "eslint:recommended", - "env": { - "node": true, - "browser": true, - "es6" : true, - "mocha": true - }, - "rules": { - "indent": [2, 4], - "brace-style": [2, "1tbs"], - "quotes": [2, "single"], - "no-console": 0, - "no-shadow": 0, - "no-use-before-define": [2, "nofunc"], - "no-underscore-dangle": 0, - "no-constant-condition": 0, - "space-after-function-name": 0, - "consistent-return": 0 - } -} diff --git a/node_modules/process/LICENSE b/node_modules/process/LICENSE deleted file mode 100644 index b8c1246..0000000 --- a/node_modules/process/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2013 Roman Shtylman - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS 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. diff --git a/node_modules/process/README.md b/node_modules/process/README.md deleted file mode 100644 index 6570729..0000000 --- a/node_modules/process/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# process - -```require('process');``` just like any other module. - -Works in node.js and browsers via the browser.js shim provided with the module. - -## browser implementation - -The goal of this module is not to be a full-fledged alternative to the builtin process module. This module mostly exists to provide the nextTick functionality and little more. We keep this module lean because it will often be included by default by tools like browserify when it detects a module has used the `process` global. - -It also exposes a "browser" member (i.e. `process.browser`) which is `true` in this implementation but `undefined` in node. This can be used in isomorphic code that adjusts it's behavior depending on which environment it's running in. - -If you are looking to provide other process methods, I suggest you monkey patch them onto the process global in your app. A list of user created patches is below. - -* [hrtime](https://github.com/kumavis/browser-process-hrtime) -* [stdout](https://github.com/kumavis/browser-stdout) - -## package manager notes - -If you are writing a bundler to package modules for client side use, make sure you use the ```browser``` field hint in package.json. - -See https://gist.github.com/4339901 for details. - -The [browserify](https://github.com/substack/node-browserify) module will properly handle this field when bundling your files. - - diff --git a/node_modules/process/browser.js b/node_modules/process/browser.js deleted file mode 100644 index d059362..0000000 --- a/node_modules/process/browser.js +++ /dev/null @@ -1,184 +0,0 @@ -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; diff --git a/node_modules/process/index.js b/node_modules/process/index.js deleted file mode 100644 index 8d8ed7d..0000000 --- a/node_modules/process/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// for now just expose the builtin process global from node.js -module.exports = global.process; diff --git a/node_modules/process/package.json b/node_modules/process/package.json deleted file mode 100644 index 687f242..0000000 --- a/node_modules/process/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "_from": "process@^0.11.10", - "_id": "process@0.11.10", - "_inBundle": false, - "_integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "_location": "/process", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "process@^0.11.10", - "name": "process", - "escapedName": "process", - "rawSpec": "^0.11.10", - "saveSpec": null, - "fetchSpec": "^0.11.10" - }, - "_requiredBy": [ - "/global" - ], - "_resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "_shasum": "7332300e840161bda3e69a1d1d91a7d4bc16f182", - "_spec": "process@^0.11.10", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\global", - "author": { - "name": "Roman Shtylman", - "email": "shtylman@gmail.com" - }, - "browser": "./browser.js", - "bugs": { - "url": "https://github.com/shtylman/node-process/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "process information for node.js and browsers", - "devDependencies": { - "mocha": "2.2.1", - "zuul": "^3.10.3" - }, - "engines": { - "node": ">= 0.6.0" - }, - "homepage": "https://github.com/shtylman/node-process#readme", - "keywords": [ - "process" - ], - "license": "MIT", - "main": "./index.js", - "name": "process", - "repository": { - "type": "git", - "url": "git://github.com/shtylman/node-process.git" - }, - "scripts": { - "browser": "zuul --no-coverage --ui mocha-bdd --local 8080 -- test.js", - "test": "mocha test.js" - }, - "version": "0.11.10" -} diff --git a/node_modules/process/test.js b/node_modules/process/test.js deleted file mode 100644 index 8ba579c..0000000 --- a/node_modules/process/test.js +++ /dev/null @@ -1,199 +0,0 @@ -var assert = require('assert'); -var ourProcess = require('./browser'); -describe('test against our process', function () { - test(ourProcess); -}); -if (!process.browser) { - describe('test against node', function () { - test(process); - }); - vmtest(); -} -function test (ourProcess) { - describe('test arguments', function () { - it ('works', function (done) { - var order = 0; - - - ourProcess.nextTick(function (num) { - assert.equal(num, order++, 'first one works'); - ourProcess.nextTick(function (num) { - assert.equal(num, order++, 'recursive one is 4th'); - }, 3); - }, 0); - ourProcess.nextTick(function (num) { - assert.equal(num, order++, 'second one starts'); - ourProcess.nextTick(function (num) { - assert.equal(num, order++, 'this is third'); - ourProcess.nextTick(function (num) { - assert.equal(num, order++, 'this is last'); - done(); - }, 5); - }, 4); - }, 1); - ourProcess.nextTick(function (num) { - - assert.equal(num, order++, '3rd schedualed happens after the error'); - }, 2); - }); - }); -if (!process.browser) { - describe('test errors', function (t) { - it ('works', function (done) { - var order = 0; - process.removeAllListeners('uncaughtException'); - process.once('uncaughtException', function(err) { - assert.equal(2, order++, 'error is third'); - ourProcess.nextTick(function () { - assert.equal(5, order++, 'schedualed in error is last'); - done(); - }); - }); - ourProcess.nextTick(function () { - assert.equal(0, order++, 'first one works'); - ourProcess.nextTick(function () { - assert.equal(4, order++, 'recursive one is 4th'); - }); - }); - ourProcess.nextTick(function () { - assert.equal(1, order++, 'second one starts'); - throw(new Error('an error is thrown')); - }); - ourProcess.nextTick(function () { - assert.equal(3, order++, '3rd schedualed happens after the error'); - }); - }); - }); -} - describe('rename globals', function (t) { - var oldTimeout = setTimeout; - var oldClear = clearTimeout; - - it('clearTimeout', function (done){ - - var ok = true; - clearTimeout = function () { - ok = false; - } - var ran = false; - function cleanup() { - clearTimeout = oldClear; - var err; - try { - assert.ok(ok, 'fake clearTimeout ran'); - assert.ok(ran, 'should have run'); - } catch (e) { - err = e; - } - done(err); - } - setTimeout(cleanup, 1000); - ourProcess.nextTick(function () { - ran = true; - }); - }); - it('just setTimeout', function (done){ - - - setTimeout = function () { - setTimeout = oldTimeout; - try { - assert.ok(false, 'fake setTimeout called') - } catch (e) { - done(e); - } - - } - - ourProcess.nextTick(function () { - setTimeout = oldTimeout; - done(); - }); - }); - }); -} -function vmtest() { - var vm = require('vm'); - var fs = require('fs'); - var process = fs.readFileSync('./browser.js', {encoding: 'utf8'}); - - - describe('should work in vm in strict mode with no globals', function () { - it('should parse', function (done) { - var str = '"use strict";var module = {exports:{}};'; - str += process; - str += 'this.works = process.browser;'; - var script = new vm.Script(str); - var context = { - works: false - }; - script.runInNewContext(context); - assert.ok(context.works); - done(); - }); - it('setTimeout throws error', function (done) { - var str = '"use strict";var module = {exports:{}};'; - str += process; - str += 'try {process.nextTick(function () {})} catch (e){this.works = e;}'; - var script = new vm.Script(str); - var context = { - works: false - }; - script.runInNewContext(context); - assert.ok(context.works); - done(); - }); - it('should generally work', function (done) { - var str = '"use strict";var module = {exports:{}};'; - str += process; - str += 'process.nextTick(function () {assert.ok(true);done();})'; - var script = new vm.Script(str); - var context = { - clearTimeout: clearTimeout, - setTimeout: setTimeout, - done: done, - assert: assert - }; - script.runInNewContext(context); - }); - it('late defs setTimeout', function (done) { - var str = '"use strict";var module = {exports:{}};'; - str += process; - str += 'var setTimeout = hiddenSetTimeout;process.nextTick(function () {assert.ok(true);done();})'; - var script = new vm.Script(str); - var context = { - clearTimeout: clearTimeout, - hiddenSetTimeout: setTimeout, - done: done, - assert: assert - }; - script.runInNewContext(context); - }); - it('late defs clearTimeout', function (done) { - var str = '"use strict";var module = {exports:{}};'; - str += process; - str += 'var clearTimeout = hiddenClearTimeout;process.nextTick(function () {assert.ok(true);done();})'; - var script = new vm.Script(str); - var context = { - hiddenClearTimeout: clearTimeout, - setTimeout: setTimeout, - done: done, - assert: assert - }; - script.runInNewContext(context); - }); - it('late defs setTimeout and then redefine', function (done) { - var str = '"use strict";var module = {exports:{}};'; - str += process; - str += 'var setTimeout = hiddenSetTimeout;process.nextTick(function () {setTimeout = function (){throw new Error("foo")};hiddenSetTimeout(function(){process.nextTick(function (){assert.ok(true);done();});});});'; - var script = new vm.Script(str); - var context = { - clearTimeout: clearTimeout, - hiddenSetTimeout: setTimeout, - done: done, - assert: assert - }; - script.runInNewContext(context); - }); - }); -} diff --git a/node_modules/quicklink/CHANGELOG.md b/node_modules/quicklink/CHANGELOG.md deleted file mode 100644 index 58f632e..0000000 --- a/node_modules/quicklink/CHANGELOG.md +++ /dev/null @@ -1,296 +0,0 @@ -## 2.2.0 (2021-06-18) - -This release includes support for a new `threshold` option [PR](https://github.com/GoogleChromeLabs/quicklink/pull/214) to allow users select the % of link areas that entered the viewport before prefetching. This can reduce the number of links to prefetch at a time, and ultimately reduce the impact on CDNs and servers. - -Thanks to [@verlock](https://github.com/verlok) from YNAP for this contribution. - -* Added `threshold` option to allow users select the % of link areas that entered the viewport before ([d3746e1](https://github.com/GoogleChromeLabs/quicklink/commit/d3746e1)), closes [#214](https://github.com/GoogleChromeLabs/quicklink/issues/214) -* Add Magento Quicklink module (Readme + Site) (#216) ([c77e057](https://github.com/GoogleChromeLabs/quicklink/commit/c77e057)), closes [#216](https://github.com/GoogleChromeLabs/quicklink/issues/216) -* Instructions to debug Quicklink ([2b3dc21](https://github.com/GoogleChromeLabs/quicklink/commit/2b3dc21)) - -## 2.1.0 (2021-02-07) - -* [docs] Add React SPA demos to repo and site (#179) ([179cb56](https://github.com/GoogleChromeLabs/quicklink/commit/179cb56)), closes [#179](https://github.com/GoogleChromeLabs/quicklink/issues/179) -* [docs] drop highlightjs reference and link up prism styles ([b91872b](https://github.com/GoogleChromeLabs/quicklink/commit/b91872b)) -* [docs] Fix quicklink logo ([25829de](https://github.com/GoogleChromeLabs/quicklink/commit/25829de)) -* [docs] minor tweak to header text ([cd31382](https://github.com/GoogleChromeLabs/quicklink/commit/cd31382)) -* [docs] refactor api docs syntax highlighting ([59f7eca](https://github.com/GoogleChromeLabs/quicklink/commit/59f7eca)) -* [docs] refactor copy-snippets syntax highlighting ([5445a8b](https://github.com/GoogleChromeLabs/quicklink/commit/5445a8b)) -* [docs] refactor measure docs syntax highlighting ([eaa87ac](https://github.com/GoogleChromeLabs/quicklink/commit/eaa87ac)) -* [docs] refactor over-prefetching docs syntax highlighting ([6ec1287](https://github.com/GoogleChromeLabs/quicklink/commit/6ec1287)) -* [docs] refactor react docs syntax highlighting ([ba5984d](https://github.com/GoogleChromeLabs/quicklink/commit/ba5984d)) -* [docs] refactor usage docs syntax highlighting ([25367f4](https://github.com/GoogleChromeLabs/quicklink/commit/25367f4)) -* [docs] remainder of syntax highlighting fixes ([cf32a85](https://github.com/GoogleChromeLabs/quicklink/commit/cf32a85)) -* [docs] remove highlightjs ([7ff8c8f](https://github.com/GoogleChromeLabs/quicklink/commit/7ff8c8f)) -* [docs] Update CHANGELOG ([c4a4726](https://github.com/GoogleChromeLabs/quicklink/commit/c4a4726)) -* [docs] various style theme improvements ([06786fb](https://github.com/GoogleChromeLabs/quicklink/commit/06786fb)) -* [feat] (options): Add a `hrefFn` option to build the URL to prefetch. (#201) ([ee072d4](https://github.com/GoogleChromeLabs/quicklink/commit/ee072d4)), closes [#201](https://github.com/GoogleChromeLabs/quicklink/issues/201) -* [feat] `delay` option to reduce impact on CDNs and servers [alternative without data-attributes] (#2 ([5cdf569](https://github.com/GoogleChromeLabs/quicklink/commit/5cdf569)), closes [#217](https://github.com/GoogleChromeLabs/quicklink/issues/217) -* [infra] add eleventy syntax highlighting ([b48f80d](https://github.com/GoogleChromeLabs/quicklink/commit/b48f80d)) -* [infra] Add site to firebase hosting config ([fe43486](https://github.com/GoogleChromeLabs/quicklink/commit/fe43486)) -* [infra] bump version to 2.1.0 ([81232e8](https://github.com/GoogleChromeLabs/quicklink/commit/81232e8)) -* Added Ray-Ban and Oakley from Luxxotica to trustedByLogos section (#202) ([b4494b0](https://github.com/GoogleChromeLabs/quicklink/commit/b4494b0)), closes [#202](https://github.com/GoogleChromeLabs/quicklink/issues/202) -* Correct typo, duplicate "passing" (#185) ([932f655](https://github.com/GoogleChromeLabs/quicklink/commit/932f655)), closes [#185](https://github.com/GoogleChromeLabs/quicklink/issues/185) -* Fix issues typo in 'network-idle.js' (#218) ([534e7b3](https://github.com/GoogleChromeLabs/quicklink/commit/534e7b3)), closes [#218](https://github.com/GoogleChromeLabs/quicklink/issues/218) -* New demo page (#205) ([5205d62](https://github.com/GoogleChromeLabs/quicklink/commit/5205d62)), closes [#205](https://github.com/GoogleChromeLabs/quicklink/issues/205) -* update homepage url in package.json (#184) ([172275b](https://github.com/GoogleChromeLabs/quicklink/commit/172275b)), closes [#184](https://github.com/GoogleChromeLabs/quicklink/issues/184) -* Updating broken link ([224df77](https://github.com/GoogleChromeLabs/quicklink/commit/224df77)) -* Fix: Cannot read property 'then' of undefined (#188) ([a8872b8](https://github.com/GoogleChromeLabs/quicklink/commit/a8872b8)), closes [#188](https://github.com/GoogleChromeLabs/quicklink/issues/188) -* chore(deps): bump http-proxy from 1.18.0 to 1.18.1 (#200) ([0aa5157](https://github.com/GoogleChromeLabs/quicklink/commit/0aa5157)), closes [#200](https://github.com/GoogleChromeLabs/quicklink/issues/200) - - - -## 2.0.0 (2020-05-07) - -* [infra] Add site updates for 2.0.0 (#178) ([8aa512b](https://github.com/GoogleChromeLabs/quicklink/commit/8aa512b)), closes [#178](https://github.com/GoogleChromeLabs/quicklink/issues/178) -* [infra] Bump versions to 2.0.0 ([08d9a39](https://github.com/GoogleChromeLabs/quicklink/commit/08d9a39)) -* 2.0.0 ([735caf6](https://github.com/GoogleChromeLabs/quicklink/commit/735caf6)) - - - -## 2.0.0-beta (2020-04-24) - -* [core] Adds withQuicklink HOC (#172) ([89cd6a9](https://github.com/GoogleChromeLabs/quicklink/commit/89cd6a9)), closes [#172](https://github.com/GoogleChromeLabs/quicklink/issues/172) [#175](https://github.com/GoogleChromeLabs/quicklink/issues/175) [#176](https://github.com/GoogleChromeLabs/quicklink/issues/176) [#177](https://github.com/GoogleChromeLabs/quicklink/issues/177) -* [core] Introduce prefetch chunks build (#171) ([301aedb](https://github.com/GoogleChromeLabs/quicklink/commit/301aedb)), closes [#171](https://github.com/GoogleChromeLabs/quicklink/issues/171) [#168](https://github.com/GoogleChromeLabs/quicklink/issues/168) [#169](https://github.com/GoogleChromeLabs/quicklink/issues/169) -* [docs] Add initial site ([e934a2b](https://github.com/GoogleChromeLabs/quicklink/commit/e934a2b)) -* [docs] Add notes on double-keyed caching ([03d3c97](https://github.com/GoogleChromeLabs/quicklink/commit/03d3c97)) -* [docs] Added Newegg to trustedByLogos section (#153) ([453a661](https://github.com/GoogleChromeLabs/quicklink/commit/453a661)), closes [#153](https://github.com/GoogleChromeLabs/quicklink/issues/153) -* [docs] Bugfix/syntax highlighting site (#147) ([0f644e7](https://github.com/GoogleChromeLabs/quicklink/commit/0f644e7)), closes [#147](https://github.com/GoogleChromeLabs/quicklink/issues/147) -* [docs] Compress site resources w/ImageOptim ([179e18e](https://github.com/GoogleChromeLabs/quicklink/commit/179e18e)) -* [docs] Measuring impact of QuickLink in sites guide (#146) ([2ce99e3](https://github.com/GoogleChromeLabs/quicklink/commit/2ce99e3)), closes [#146](https://github.com/GoogleChromeLabs/quicklink/issues/146) -* [docs] New section "Quicklink extension" for home page. (#150) ([468c231](https://github.com/GoogleChromeLabs/quicklink/commit/468c231)), closes [#150](https://github.com/GoogleChromeLabs/quicklink/issues/150) -* [docs] Over-prefetching section for home page (#148) ([75aa643](https://github.com/GoogleChromeLabs/quicklink/commit/75aa643)), closes [#148](https://github.com/GoogleChromeLabs/quicklink/issues/148) -* [docs] Update the Angular logo (#158) ([836f170](https://github.com/GoogleChromeLabs/quicklink/commit/836f170)), closes [#158](https://github.com/GoogleChromeLabs/quicklink/issues/158) -* [infra] Add firebase deployment ([89ab866](https://github.com/GoogleChromeLabs/quicklink/commit/89ab866)) -* [infra] Fix tests (#142) ([6644860](https://github.com/GoogleChromeLabs/quicklink/commit/6644860)), closes [#142](https://github.com/GoogleChromeLabs/quicklink/issues/142) -* [infra] Publish dist directory (#98) ([9cdf06f](https://github.com/GoogleChromeLabs/quicklink/commit/9cdf06f)), closes [#98](https://github.com/GoogleChromeLabs/quicklink/issues/98) -* 2.0.0-beta ([185d1e8](https://github.com/GoogleChromeLabs/quicklink/commit/185d1e8)) -* Add support for Quicklink 2.0.0-alpha ([7c7c917](https://github.com/GoogleChromeLabs/quicklink/commit/7c7c917)) -* Add twitter metadata ([74d3224](https://github.com/GoogleChromeLabs/quicklink/commit/74d3224)) -* Adding SPA section to README.md ([ea3229a](https://github.com/GoogleChromeLabs/quicklink/commit/ea3229a)) -* Fix typo on README (#127) ([5acb27e](https://github.com/GoogleChromeLabs/quicklink/commit/5acb27e)), closes [#127](https://github.com/GoogleChromeLabs/quicklink/issues/127) -* package.json: bump version to 2.0.0-alpha ([d5d5ca5](https://github.com/GoogleChromeLabs/quicklink/commit/d5d5ca5)) -* Updates to initial site (#144) ([3f796f6](https://github.com/GoogleChromeLabs/quicklink/commit/3f796f6)), closes [#144](https://github.com/GoogleChromeLabs/quicklink/issues/144) -* chore(deps): bump acorn from 6.4.0 to 6.4.1 (#167) ([8b62949](https://github.com/GoogleChromeLabs/quicklink/commit/8b62949)), closes [#167](https://github.com/GoogleChromeLabs/quicklink/issues/167) - - - -## 2.0.0-alpha (2019-09-25) - -* (docs) update to remove TODOs from README ([8cd1183](https://github.com/GoogleChromeLabs/quicklink/commit/8cd1183)) -* Update docs with ad-related considerations (#122) ([7ac672f](https://github.com/GoogleChromeLabs/quicklink/commit/7ac672f)), closes [#122](https://github.com/GoogleChromeLabs/quicklink/issues/122) -* Major: Rework exports; Add `throttle` and `limit` options (#120) ([4044de0](https://github.com/GoogleChromeLabs/quicklink/commit/4044de0)), closes [#120](https://github.com/GoogleChromeLabs/quicklink/issues/120) [#1](https://github.com/GoogleChromeLabs/quicklink/issues/1) - - - -## 1.0.1 (2019-08-17) - -* (demo) Introduce new demos for basic + workbox usage ([9eb7fa0](https://github.com/GoogleChromeLabs/quicklink/commit/9eb7fa0)) -* (demos) Add new demos to README ([85729aa](https://github.com/GoogleChromeLabs/quicklink/commit/85729aa)) -* (docs) Update README: note on session stitching ([ba9795c](https://github.com/GoogleChromeLabs/quicklink/commit/ba9795c)) -* (infra) Bump version to 1.0.1 ([d75188d](https://github.com/GoogleChromeLabs/quicklink/commit/d75188d)) -* A few quick size optimizations ([201c217](https://github.com/GoogleChromeLabs/quicklink/commit/201c217)) -* Add homepage and bugs links to package.json (#116) ([002645b](https://github.com/GoogleChromeLabs/quicklink/commit/002645b)), closes [#116](https://github.com/GoogleChromeLabs/quicklink/issues/116) -* Add note to README about Drupal module. ([d94ff80](https://github.com/GoogleChromeLabs/quicklink/commit/d94ff80)) -* Check if `requestIdleCallback` exists in `window` (#112) ([089da91](https://github.com/GoogleChromeLabs/quicklink/commit/089da91)), closes [#112](https://github.com/GoogleChromeLabs/quicklink/issues/112) -* Create .editorconfig (#61) ([beae09b](https://github.com/GoogleChromeLabs/quicklink/commit/beae09b)), closes [#61](https://github.com/GoogleChromeLabs/quicklink/issues/61) -* Fail silently, don’t throw an error, when IntersectionObserver isn’t available (#113) ([32e5b61](https://github.com/GoogleChromeLabs/quicklink/commit/32e5b61)), closes [#113](https://github.com/GoogleChromeLabs/quicklink/issues/113) -* Fix ES Module import syntax ([a2b90ff](https://github.com/GoogleChromeLabs/quicklink/commit/a2b90ff)) -* GitHub Issue Templates (#109) ([2e6401e](https://github.com/GoogleChromeLabs/quicklink/commit/2e6401e)), closes [#109](https://github.com/GoogleChromeLabs/quicklink/issues/109) -* HTML formatting tidy for Tests & Demos (#114) ([f4aef2e](https://github.com/GoogleChromeLabs/quicklink/commit/f4aef2e)), closes [#114](https://github.com/GoogleChromeLabs/quicklink/issues/114) -* HTTPS link to gruntjs.com (#100) ([47f49e7](https://github.com/GoogleChromeLabs/quicklink/commit/47f49e7)), closes [#100](https://github.com/GoogleChromeLabs/quicklink/issues/100) -* HTTPS link to nodejs.org (#110) ([cf9551e](https://github.com/GoogleChromeLabs/quicklink/commit/cf9551e)), closes [#110](https://github.com/GoogleChromeLabs/quicklink/issues/110) -* Mention instant.page as a related project ([0bc8aec](https://github.com/GoogleChromeLabs/quicklink/commit/0bc8aec)) -* Mention Safari ≥ 12.1 working without polyfills (#111) ([b01e5bb](https://github.com/GoogleChromeLabs/quicklink/commit/b01e5bb)), closes [#111](https://github.com/GoogleChromeLabs/quicklink/issues/111) -* remove extraneous full stops / periods from comment (#105) ([23737af](https://github.com/GoogleChromeLabs/quicklink/commit/23737af)), closes [#105](https://github.com/GoogleChromeLabs/quicklink/issues/105) -* remove unneeded type="text/css" from demo (#106) ([4dc74f1](https://github.com/GoogleChromeLabs/quicklink/commit/4dc74f1)), closes [#106](https://github.com/GoogleChromeLabs/quicklink/issues/106) -* remove unneeded type="text/css" from demo page (#104) ([24919bd](https://github.com/GoogleChromeLabs/quicklink/commit/24919bd)), closes [#104](https://github.com/GoogleChromeLabs/quicklink/issues/104) -* Update link to Gatsby with Guess.js (#108) ([dc02d33](https://github.com/GoogleChromeLabs/quicklink/commit/dc02d33)), closes [#108](https://github.com/GoogleChromeLabs/quicklink/issues/108) -* Update microbundle to fix "missing JSX plugin" issue ([8f5cf22](https://github.com/GoogleChromeLabs/quicklink/commit/8f5cf22)) -* Update repo path in package.json ([45e9bbd](https://github.com/GoogleChromeLabs/quicklink/commit/45e9bbd)) -* Update the Readme and add a mention of the WordPress plugin ([0f15f45](https://github.com/GoogleChromeLabs/quicklink/commit/0f15f45)) -* Use latest version of polyfill.io JS (#92) ([b15c8ba](https://github.com/GoogleChromeLabs/quicklink/commit/b15c8ba)), closes [#92](https://github.com/GoogleChromeLabs/quicklink/issues/92) -* fix: Attempt to address build issues (Travis) ([9755280](https://github.com/GoogleChromeLabs/quicklink/commit/9755280)) -* fix: stop observing links once prefetched; ([ce0011c](https://github.com/GoogleChromeLabs/quicklink/commit/ce0011c)) -* fix(README): use UMD file for - - -``` - -For example, you can initialize after the `load` event fires: - -```html - -``` - -ES Module import: - -```js -import { listen, prefetch } from "quicklink"; -``` - -## Single page apps (React) - -### Installation - -First, install the packages with [node](https://nodejs.org) and [npm](https://npmjs.com): - -```sh -npm install quicklink webpack-route-manifest --save-dev -``` - -Then, configure Webpack route manifest into your project, as explained [here](https://github.com/lukeed/webpack-route-manifest). -This will generate a map of routes and chunks called `rmanifest.json`. It can be obtained at: - -* URL: `site_url/rmanifest.json` -* Window object: `window.__rmanifest` - -### Usage - -Import `quicklink` React HOC where want to add prefetching functionality. -Wrap your routes with the `withQuicklink()` HOC. - -Example: - -```sh -import { withQuicklink } from 'quicklink/dist/react/hoc.js'; - -const options = { - origins: [] -}; - -Loading...}> - - - - - -``` - - - -## API - -### quicklink.listen(options) -Returns: `Function` - -A "reset" function is returned, which will empty the active `IntersectionObserver` and the cache of URLs that have already been prefetched. This can be used between page navigations and/or when significant DOM changes have occurred. - -#### options.delay -Type: `Number`
    -Default: `0` - -The _amount of time_ each link needs to stay inside the viewport before being prefetched, in milliseconds. - -#### options.el -Type: `HTMLElement`
    -Default: `document.body` - -The DOM element to observe for in-viewport links to prefetch. - -#### options.limit -Type: `Number`
    -Default: `Infinity` - -The _total_ requests that can be prefetched while observing the `options.el` container. - -#### options.threshold -Type: `Number`
    -Default: `0` - -The _area percentage_ of each link that must have entered the viewport to be fetched, in its decimal form (e.g. 0.25 = 25%). - -#### options.throttle -Type: `Number`
    -Default: `Infinity` - -The _concurrency limit_ for simultaneous requests while observing the `options.el` container. - -#### options.timeout -Type: `Number`
    -Default: `2000` - -The `requestIdleCallback` timeout, in milliseconds. - -> **Note:** The browser must be idle for the configured duration before prefetching. - -#### options.timeoutFn -Type: `Function`
    -Default: `requestIdleCallback` - -A function used for specifying a `timeout` delay.
    -This can be swapped out for a custom function like [networkIdleCallback](https://github.com/pastelsky/network-idle-callback) (see demos). - -By default, this uses [`requestIdleCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback) or the embedded polyfill. - -#### options.priority -Type: `Boolean`
    -Default: `false` - -Whether or not the URLs within the `options.el` container should be treated as high priority. - -When `true`, quicklink will attempt to use the `fetch()` API if supported (rather than `link[rel=prefetch]`). - -#### options.origins -Type: `Array`
    -Default: `[location.hostname]` - -A static array of URL hostnames that are allowed to be prefetched.
    -Defaults to the same domain origin, which prevents _any_ cross-origin requests. - -**Important:** An empty array (`[]`) allows ***all origins*** to be prefetched. - -#### options.ignores -Type: `RegExp` or `Function` or `Array`
    -Default: `[]` - -Determine if a URL should be prefetched. - -When a `RegExp` tests positive, a `Function` returns `true`, or an `Array` contains the string, then the URL is _not_ prefetched. - -> **Note:** An `Array` may contain `String`, `RegExp`, or `Function` values. - -> **Important:** This logic is executed _after_ origin matching! - -#### options.onError -Type: `Function`
    -Default: None - -An optional error handler that will receive any errors from prefetched requests.
    -By default, these errors are silently ignored. - -#### options.hrefFn -Type: `Function`
    -Default: None - -An optional function to generate the URL to prefetch. It receives an [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) as the argument. - -### quicklink.prefetch(urls, isPriority) -Returns: `Promise` - -The `urls` provided are always passed through `Promise.all`, which means the result will always resolve to an Array. - -> **Important:** You much `catch` you own request error(s). - -#### urls -Type: `String` or `Array`
    -Required: `true` - -One or many URLs to be prefetched. - -> **Note:** Each `url` value is resolved from the current location. - -#### isPriority -Type: `Boolean`
    -Default: `false` - -Whether or not the URL(s) should be treated as "high priority" targets.
    -By default, calls to `prefetch()` are low priority. - -> **Note:** This behaves identically to `listen()`'s `priority` option. - -## Polyfills - -`quicklink`: - -* Includes a very small fallback for [requestIdleCallback](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback) -* Requires `IntersectionObserver` to be supported (see [CanIUse](https://caniuse.com/#feat=intersectionobserver)). We recommend conditionally polyfilling this feature with a service like Polyfill.io: - -```html - -``` - -Alternatively, see the [Intersection Observer polyfill](https://github.com/w3c/IntersectionObserver/tree/master/polyfill). - -## Recipes - -### Set a custom timeout for prefetching resources - -Defaults to 2 seconds (via `requestIdleCallback`). Here we override it to 4 seconds: - -```js -quicklink.listen({ - timeout: 4000 -}); -``` - -### Set the DOM element to observe for in-viewport links - -Defaults to `document` otherwise. - -```js -quicklink.listen({ - el: document.getElementById('carousel') -}); -``` - -### Programmatically `prefetch()` URLs - -If you would prefer to provide a static list of URLs to be prefetched, instead of detecting those in-viewport, customizing URLs is supported. - -```js -// Single URL -quicklink.prefetch('2.html'); - -// Multiple URLs -quicklink.prefetch(['2.html', '3.html', '4.js']); - -// Multiple URLs, with high priority -// Note: Can also be use with single URL! -quicklink.prefetch(['2.html', '3.html', '4.js'], true); -``` - -### Set the request priority for prefetches while scrolling - -Defaults to low-priority (`rel=prefetch` or XHR). For high-priority (`priority: true`), attempts to use `fetch()` or falls back to XHR. - -> **Note:** This runs `prefetch(..., true)` with URLs found within the `options.el` container. - -```js -quicklink.listen({ priority: true }); -``` - -### Specify a custom list of allowed origins - -Provide a list of hostnames that should be prefetch-able. Only the same origin is allowed by default. - -> **Important:** You must also include your own hostname! - -```js -quicklink.listen({ - origins: [ - // add mine - 'my-website.com', - 'api.my-website.com', - // add third-parties - 'other-website.com', - 'example.com', - // ... - ] -}); -``` - -### Allow all origins - -Enables all cross-origin requests to be made. - -> **Note:** You may run into [CORB](https://chromium.googlesource.com/chromium/src/+/master/services/network/cross_origin_read_blocking_explainer.md) and [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues! - -```js -quicklink.listen({ - origins: true, - // or - origins: [] -}); -``` - -### Custom Ignore Patterns - -These filters run _after_ the `origins` matching has run. Ignores can be useful for avoiding large file downloads or for responding to DOM attributes dynamically. - -```js -// Same-origin restraint is enabled by default. -// -// This example will ignore all requests to: -// - all "/api/*" pathnames -// - all ".zip" extensions -// - all tags with "noprefetch" attribute -// -quicklink.listen({ - ignores: [ - /\/api\/?/, - uri => uri.includes('.zip'), - (uri, elem) => elem.hasAttribute('noprefetch') - ] -}); -``` - -You may also wish to ignore prefetches to URLs which contain a URL fragment (e.g. `index.html#top`). This can be useful if you (1) are using anchors to headings in a page or (2) have URL fragments setup for a single-page application, and which to avoid firing prefetches for similar URLs. - -Using `ignores` this can be achieved as follows: - -```js -quicklink.listen({ - ignores: [ - uri => uri.includes('#') - // or RegExp: /#(.+)/ - // or element matching: (uri, elem) => !!elem.hash - ] -}); -``` - -### Custom URL to prefetch via hrefFn callback - -The hrefFn method allows to build the URL to prefetch (e.g. API endpoint) on the fly instead of the prefetching the `href` attribute URL. - -```js -quicklink.listen({ - hrefFn: function(element) { - return element.href.replace('html','json'); - } -}); -``` - -## Browser Support - -The prefetching provided by `quicklink` can be viewed as a [progressive enhancement](https://www.smashingmagazine.com/2009/04/progressive-enhancement-what-it-is-and-how-to-use-it/). Cross-browser support is as follows: - -* Without polyfills: Chrome, Safari ≥ 12.1, Firefox, Edge, Opera, Android Browser, Samsung Internet. -* With [Intersection Observer polyfill](https://github.com/w3c/IntersectionObserver/tree/master/polyfill) ~6KB gzipped/minified: Safari ≤ 12.0, IE11 -* With the above and a [Set()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) and [Array.from](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) polyfill: IE9 and IE10. [Core.js](https://github.com/zloirock/core-js) provides both `Set()` and `Array.from()` shims. Projects like [es6-shim](https://github.com/paulmillr/es6-shim/blob/master/README.md) are an alternative you can consider. - -Certain features have layered support: - -* The [Network Information API](https://wicg.github.io/netinfo/), which is used to check if the user has a slow effective connection type (via `navigator.connection.effectiveType`) is only available in [Chrome 61+ and Opera 57+](https://caniuse.com/#feat=netinfo) -* If opting for `{priority: true}` and the [Fetch API](https://fetch.spec.whatwg.org/) isn't available, XHR will be used instead. - -## Using the prefetcher directly - -A `prefetch` method can be individually imported for use in other projects.
    -This method includes the logic to respect Data Saver and 2G connections. It also issues requests thru `fetch()`, XHRs, or `link[rel=prefetch]` depending on (a) the `isPriority` value and (b) the current browser's support. - -After installing `quicklink` as a dependency, you can use it as follows: - -```html - -``` - -## Demo - -### Glitch demos - -* [Using Quicklink in a multi-page site](https://github.com/GoogleChromeLabs/quicklink/tree/master/demos/news) -* [Using Quicklink with Service Workers (via Workbox)](https://github.com/GoogleChromeLabs/quicklink/tree/master/demos/news-workbox) -* [Using Quicklink to prefetch API calls instead of `href` attribute](https://github.com/GoogleChromeLabs/quicklink/tree/master/demos/hrefFn) - -### Research - -Here's a [WebPageTest run](https://www.webpagetest.org/video/view.php?id=181212_4c294265117680f2636676721cc886613fe2eede&data=1) for our [demo](https://keyword-2-ecd7b.firebaseapp.com/) improving page-load performance by up to 4 seconds via quicklink's prefetching. A [video](https://youtu.be/rQ75YEbJicw) comparison of the before/after prefetching is on YouTube. - -For demo purposes, we deployed a version of the [Google Blog](https://blog.google) on -Firebase hosting. We then deployed another version of it, adding quicklink to the homepage and benchmarked navigating from the homepage to an article that was -automatically prefetched. The prefetched version loaded faster. - -Please note: this is by no means an exhaustive benchmark of the pros and cons of in-viewport link prefetching. Just a demo of the potential improvements the approach can offer. Your own mileage may heavily vary. - -## Additional notes - -### Session Stitching - -Cross-origin prefetching (e.g a.com/foo.html prefetches b.com/bar.html) has a number of limitations. One such limitation is with session-stitching. b.com may expect a.com's navigation requests to include session information (e.g a temporary ID - e.g b.com/bar.html?hash=<>×tamp=<>), where this information is used to customize the experience or log information to analytics. If session-stitching requires a timestamp in the URL, what is prefetched and stored in the HTTP cache may not be the same as the one the user ultimately navigates to. This introduces a challenge as it can result in double prefetches. - -To workaround this problem, you can consider passing along session information via the [ping attribute](https://caniuse.com/#feat=ping) (separately) so the origin can stitch a session together asynchronously. - -### Ad-related considerations - -Sites that rely on ads as a source of monetization should not prefetch ad-links, to avoid unintentionally counting clicks against those ad placements, which can lead to inflated Ad CTR (click-through-rate). - -Ads appear on sites mostly in two ways: - -- **Inside iframes:** By default, most ad-servers render ads within iframes. In these cases, those ad-links won't be prefetched by Quicklink, unless a developer explicitly passes in the URL of an ads iframe. The reason is that the library look-up for in-viewport elements is restricted to those of the top-level origin. - -- **Outside iframes:**: In cases when the site shows same-origin ads, displayed in the top-level document (e.g. by hosting the ads themselves and by displaying the ads in the page directly), the developer needs to explicitly tell Quicklink to avoid prefetching these links. This can be achieved by passing the URL or subpath of the ad-link, or the element containing it to the [custom ignore patterns list](https://github.com/GoogleChromeLabs/quicklink#custom-ignore-patterns). - -## Related projects - -* Using [Gatsby](https://gatsbyjs.org)? You already get most of this for free baked in. It uses `Intersection Observer` to prefetch all of the links that are in view and provided heavy inspiration for this project. -* Want a more data-driven approach? See [Guess.js](https://guess-js.github.io). It uses analytics and machine-learning to prefetch resources based on how users navigate your site. It also has plugins for [Webpack](https://www.npmjs.com/package/guess-webpack) and [Gatsby](https://www.gatsbyjs.org/docs/optimizing-site-performance-with-guessjs/). -* WordPress users can now get quicklink as a [WordPress Plugin from the plugin repository](https://wordpress.org/plugins/quicklink/). -* Drupal users can install the [Quicklink Drupal module](https://www.drupal.org/project/quicklink). -* Magento 2 users can install the [Quicklink Magento 2 module](https://marketplace.magento.com/rafaelcg-magento2-quicklink.html). -* Want less aggressive prefetching? [instant.page](https://instant.page/) prefetches on mouseover and touchstart, right before a click. - -## License - -Licensed under the Apache-2.0 license. diff --git a/node_modules/quicklink/dist/quicklink.js b/node_modules/quicklink/dist/quicklink.js deleted file mode 100644 index b30999f..0000000 --- a/node_modules/quicklink/dist/quicklink.js +++ /dev/null @@ -1 +0,0 @@ -function e(e){return new Promise(function(n,t,r){(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=function(){200===r.status?n():t()},r.send()})}var n,t=(n=document.createElement("link")).relList&&n.relList.supports&&n.relList.supports("prefetch")?function(e){return new Promise(function(n,t,r){(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=n,r.onerror=t,document.head.appendChild(r)})}:e,r=window.requestIdleCallback||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},o=new Set;function i(n,r,i){if(i=navigator.connection){if(i.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(i.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(n).map(function(n){if(!o.has(n))return o.add(n),(r?function(n){return window.fetch?fetch(n,{credentials:"include"}):e(n)}:t)(new URL(n,location.href).toString())}))}exports.listen=function(e){if(e||(e={}),window.IntersectionObserver){var n=function(e){e=e||1;var n=[],t=0;function r(){t0&&(n.shift()(),t++)}return[function(e){n.push(e)>1||r()},function(){t--,r()}]}(e.throttle||1/0),t=n[0],c=n[1],u=e.limit||1/0,f=e.origins||[location.hostname],s=e.ignores||[],a=e.delay||0,l=[],h=e.timeoutFn||r,d="function"==typeof e.hrefFn&&e.hrefFn,m=new IntersectionObserver(function(n){n.forEach(function(n){if(n.isIntersecting)l.push((n=n.target).href),function(e,n){n?setTimeout(e,n):e()}(function(){-1!==l.indexOf(n.href)&&(m.unobserve(n),o.size-1&&l.splice(r)}})},{threshold:e.threshold||0});return h(function(){(e.el||document).querySelectorAll("a").forEach(function(e){f.length&&!f.includes(e.hostname)||function e(n,t){return Array.isArray(t)?t.some(function(t){return e(n,t)}):(t.test||t).call(t,n.href,n)}(e,s)||m.observe(e)})},{timeout:e.timeout||2e3}),function(){o.clear(),m.disconnect()}}},exports.prefetch=i; diff --git a/node_modules/quicklink/dist/quicklink.mjs b/node_modules/quicklink/dist/quicklink.mjs deleted file mode 100644 index 48f8ae6..0000000 --- a/node_modules/quicklink/dist/quicklink.mjs +++ /dev/null @@ -1 +0,0 @@ -function e(e){return new Promise(function(n,t,r){(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=function(){200===r.status?n():t()},r.send()})}var n,t=(n=document.createElement("link")).relList&&n.relList.supports&&n.relList.supports("prefetch")?function(e){return new Promise(function(n,t,r){(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=n,r.onerror=t,document.head.appendChild(r)})}:e,r=window.requestIdleCallback||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},o=new Set;function i(e){if(e||(e={}),window.IntersectionObserver){var n=function(e){e=e||1;var n=[],t=0;function r(){t0&&(n.shift()(),t++)}return[function(e){n.push(e)>1||r()},function(){t--,r()}]}(e.throttle||1/0),t=n[0],i=n[1],u=e.limit||1/0,f=e.origins||[location.hostname],a=e.ignores||[],s=e.delay||0,l=[],h=e.timeoutFn||r,d="function"==typeof e.hrefFn&&e.hrefFn,m=new IntersectionObserver(function(n){n.forEach(function(n){if(n.isIntersecting)l.push((n=n.target).href),function(e,n){n?setTimeout(e,n):e()}(function(){-1!==l.indexOf(n.href)&&(m.unobserve(n),o.size-1&&l.splice(r)}})},{threshold:e.threshold||0});return h(function(){(e.el||document).querySelectorAll("a").forEach(function(e){f.length&&!f.includes(e.hostname)||function e(n,t){return Array.isArray(t)?t.some(function(t){return e(n,t)}):(t.test||t).call(t,n.href,n)}(e,a)||m.observe(e)})},{timeout:e.timeout||2e3}),function(){o.clear(),m.disconnect()}}}function c(n,r,i){if(i=navigator.connection){if(i.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(i.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(n).map(function(n){if(!o.has(n))return o.add(n),(r?function(n){return window.fetch?fetch(n,{credentials:"include"}):e(n)}:t)(new URL(n,location.href).toString())}))}export{i as listen,c as prefetch}; diff --git a/node_modules/quicklink/dist/quicklink.modern.js b/node_modules/quicklink/dist/quicklink.modern.js deleted file mode 100644 index eddb94e..0000000 --- a/node_modules/quicklink/dist/quicklink.modern.js +++ /dev/null @@ -1 +0,0 @@ -function e(e){return new Promise((t,n,r)=>{(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=()=>{200===r.status?t():n()},r.send()})}function t(t){return window.fetch?fetch(t,{credentials:"include"}):e(t)}const n=(r=document.createElement("link")).relList&&r.relList.supports&&r.relList.supports("prefetch")?function(e){return new Promise((t,n,r)=>{(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=t,r.onerror=n,document.head.appendChild(r)})}:e;var r;const o=window.requestIdleCallback||function(e){const t=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},i=new Set;function c(e){if(e||(e={}),!window.IntersectionObserver)return;const[t,n]=function(e){e=e||1;var t=[],n=0;function r(){n0&&(t.shift()(),n++)}return[function(e){t.push(e)>1||r()},function(){n--,r()}]}(e.throttle||1/0),r=e.limit||1/0,c=e.origins||[location.hostname],a=e.ignores||[],u=e.delay||0,f=[],l=e.timeoutFn||o,h="function"==typeof e.hrefFn&&e.hrefFn,d=new IntersectionObserver(o=>{o.forEach(o=>{if(o.isIntersecting)f.push((o=o.target).href),((e,t)=>{t?setTimeout(e,t):e()})(()=>{-1!==f.indexOf(o.href)&&(d.unobserve(o),i.size{s(h?h(o):o.href,e.priority).then(n).catch(t=>{n(),e.onError&&e.onError(t)})}))},u);else{const e=f.indexOf((o=o.target).href);e>-1&&f.splice(e)}})});return l(()=>{(e.el||document).querySelectorAll("a").forEach(e=>{c.length&&!c.includes(e.hostname)||function e(t,n){return Array.isArray(n)?n.some(n=>e(t,n)):(n.test||n).call(n,t.href,t)}(e,a)||d.observe(e)})},{timeout:e.timeout||2e3}),function(){i.clear(),d.disconnect()}}function s(e,r,o){if(o=navigator.connection){if(o.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(o.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(e).map(e=>{if(!i.has(e))return i.add(e),(r?t:n)(new URL(e,location.href).toString())}))}export{c as listen,s as prefetch}; diff --git a/node_modules/quicklink/dist/quicklink.umd.js b/node_modules/quicklink/dist/quicklink.umd.js deleted file mode 100644 index 0c7bb5d..0000000 --- a/node_modules/quicklink/dist/quicklink.umd.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.quicklink={})}(this,function(e){function n(e){return new Promise(function(n,t,r){(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=function(){200===r.status?n():t()},r.send()})}var t,r=(t=document.createElement("link")).relList&&t.relList.supports&&t.relList.supports("prefetch")?function(e){return new Promise(function(n,t,r){(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=n,r.onerror=t,document.head.appendChild(r)})}:n,o=window.requestIdleCallback||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},i=new Set;function c(e,t,o){if(o=navigator.connection){if(o.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(o.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(e).map(function(e){if(!i.has(e))return i.add(e),(t?function(e){return window.fetch?fetch(e,{credentials:"include"}):n(e)}:r)(new URL(e,location.href).toString())}))}e.listen=function(e){if(e||(e={}),window.IntersectionObserver){var n=function(e){e=e||1;var n=[],t=0;function r(){t0&&(n.shift()(),t++)}return[function(e){n.push(e)>1||r()},function(){t--,r()}]}(e.throttle||1/0),t=n[0],r=n[1],f=e.limit||1/0,u=e.origins||[location.hostname],s=e.ignores||[],a=e.delay||0,l=[],h=e.timeoutFn||o,d="function"==typeof e.hrefFn&&e.hrefFn,m=new IntersectionObserver(function(n){n.forEach(function(n){if(n.isIntersecting)l.push((n=n.target).href),function(e,n){n?setTimeout(e,n):e()}(function(){-1!==l.indexOf(n.href)&&(m.unobserve(n),i.size-1&&l.splice(o)}})},{threshold:e.threshold||0});return h(function(){(e.el||document).querySelectorAll("a").forEach(function(e){u.length&&!u.includes(e.hostname)||function e(n,t){return Array.isArray(t)?t.some(function(t){return e(n,t)}):(t.test||t).call(t,n.href,n)}(e,s)||m.observe(e)})},{timeout:e.timeout||2e3}),function(){i.clear(),m.disconnect()}}},e.prefetch=c}); diff --git a/node_modules/quicklink/dist/react/hoc.js b/node_modules/quicklink/dist/react/hoc.js deleted file mode 100644 index 001631a..0000000 --- a/node_modules/quicklink/dist/react/hoc.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.withQuicklink = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _routeManifest = _interopRequireDefault(require("route-manifest")); - -var _quicklink = require("./quicklink"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -var useIntersect = function useIntersect() { - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref$root = _ref.root, - root = _ref$root === void 0 ? null : _ref$root, - rootMargin = _ref.rootMargin, - _ref$threshold = _ref.threshold, - threshold = _ref$threshold === void 0 ? 0 : _ref$threshold; - - var _useState = (0, _react.useState)({}), - _useState2 = _slicedToArray(_useState, 2), - entry = _useState2[0], - updateEntry = _useState2[1]; - - var _useState3 = (0, _react.useState)(null), - _useState4 = _slicedToArray(_useState3, 2), - node = _useState4[0], - setNode = _useState4[1]; - - var observer = (0, _react.useRef)(null); - (0, _react.useEffect)(function () { - if (observer.current) observer.current.disconnect(); - observer.current = new window.IntersectionObserver(function (_ref2) { - var _ref3 = _slicedToArray(_ref2, 1), - entry = _ref3[0]; - - return updateEntry(entry); - }, { - root: root, - rootMargin: rootMargin, - threshold: threshold - }); - var currentObserver = observer.current; - if (node) currentObserver.observe(node); - return function () { - return currentObserver.disconnect(); - }; - }, [node, root, rootMargin, threshold]); - return [setNode, entry]; -}; - -var __defaultAccessor = function __defaultAccessor(mix) { - return mix && mix.href || mix || ''; -}; - -var prefetchChunks = function prefetchChunks(entry, prefetchHandler) { - var accessor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : __defaultAccessor; - - var _rmanifest = (0, _routeManifest["default"])(window.__rmanifest, entry.pathname), - files = _rmanifest.files; - - var chunkURLs = files.map(accessor).filter(Boolean); - - if (chunkURLs.length) { - prefetchHandler(chunkURLs); - } else { - // also prefetch regular links in-viewport - prefetchHandler(entry.href); - } -}; - -var withQuicklink = function withQuicklink(Component) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - return function (props) { - var _useIntersect = useIntersect({ - root: document.body.parentElement - }), - _useIntersect2 = _slicedToArray(_useIntersect, 2), - ref = _useIntersect2[0], - entry = _useIntersect2[1]; - - var intersectionRatio = entry.intersectionRatio; - (0, _react.useEffect)(function () { - options.prefetchChunks = prefetchChunks; - - if (intersectionRatio > 0) { - (0, _quicklink.listen)(options); - } - }, [intersectionRatio]); - return /*#__PURE__*/_react["default"].createElement("div", { - ref: ref - }, /*#__PURE__*/_react["default"].createElement(Component, props)); - }; -}; - -exports.withQuicklink = withQuicklink; - -//# sourceMappingURL=hoc.js.map \ No newline at end of file diff --git a/node_modules/quicklink/dist/react/hoc.js.map b/node_modules/quicklink/dist/react/hoc.js.map deleted file mode 100644 index 47327cf..0000000 --- a/node_modules/quicklink/dist/react/hoc.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/react-chunks.js"],"names":[],"mappings":";;;;;;;;;AAgBA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,YAAY,GAAG,SAAf,YAAe,GAAqD;AAAA,iFAAP,EAAO;AAAA,uBAAlD,IAAkD;AAAA,MAAlD,IAAkD,0BAA3C,IAA2C;AAAA,MAArC,UAAqC,QAArC,UAAqC;AAAA,4BAAzB,SAAyB;AAAA,MAAzB,SAAyB,+BAAb,CAAa;;AAAA,kBAC3C,qBAAS,EAAT,CAD2C;AAAA;AAAA,MACjE,KADiE;AAAA,MAC1D,WAD0D;;AAAA,mBAEhD,qBAAS,IAAT,CAFgD;AAAA;AAAA,MAEjE,IAFiE;AAAA,MAE3D,OAF2D;;AAGxE,MAAM,QAAQ,GAAG,mBAAO,IAAP,CAAjB;AAEA,wBAAU,YAAM;AACd,QAAI,QAAQ,CAAC,OAAb,EAAsB,QAAQ,CAAC,OAAT,CAAiB,UAAjB;AACtB,IAAA,QAAQ,CAAC,OAAT,GAAmB,IAAI,MAAM,CAAC,oBAAX,CACjB;AAAA;AAAA,UAAE,KAAF;;AAAA,aAAa,WAAW,CAAC,KAAD,CAAxB;AAAA,KADiB,EAEjB;AACE,MAAA,IAAI,EAAJ,IADF;AAEE,MAAA,UAAU,EAAV,UAFF;AAGE,MAAA,SAAS,EAAT;AAHF,KAFiB,CAAnB;AAFc,QAWG,eAXH,GAWuB,QAXvB,CAWN,OAXM;AAYd,QAAI,IAAJ,EAAU,eAAe,CAAC,OAAhB,CAAwB,IAAxB;AAEV,WAAO;AAAA,aAAM,eAAe,CAAC,UAAhB,EAAN;AAAA,KAAP;AACD,GAfD,EAeG,CAAC,IAAD,EAAO,IAAP,EAAa,UAAb,EAAyB,SAAzB,CAfH;AAiBA,SAAO,CAAC,OAAD,EAAU,KAAV,CAAP;AACD,CAvBD;;AAyBA,IAAM,iBAAiB,GAAG,SAApB,iBAAoB,CAAA,GAAG,EAAI;AAC/B,SAAQ,GAAG,IAAI,GAAG,CAAC,IAAZ,IAAqB,GAArB,IAA4B,EAAnC;AACD,CAFD;;AAIA,IAAM,cAAc,GAAG,SAAjB,cAAiB,CAAC,KAAD,EAAQ,eAAR,EAA0D;AAAA,MAAjC,QAAiC,uEAAtB,iBAAsB;;AAAA,mBAC7D,+BAAU,MAAM,CAAC,WAAjB,EAA8B,KAAK,CAAC,QAApC,CAD6D;AAAA,MACvE,KADuE,cACvE,KADuE;;AAE/E,MAAM,SAAS,GAAG,KAAK,CAAC,GAAN,CAAU,QAAV,EAAoB,MAApB,CAA2B,OAA3B,CAAlB;;AACA,MAAI,SAAS,CAAC,MAAd,EAAsB;AACpB,IAAA,eAAe,CAAC,SAAD,CAAf;AACD,GAFD,MAEO;AACL;AACA,IAAA,eAAe,CAAC,KAAK,CAAC,IAAP,CAAf;AACD;AACF,CATD;;AAWA,IAAM,aAAa,GAAG,SAAhB,aAAgB,CAAC,SAAD,EAA6B;AAAA,MAAjB,OAAiB,uEAAP,EAAO;AACjD,SAAO,UAAA,KAAK,EAAI;AAAA,wBACK,YAAY,CAAC;AAAC,MAAA,IAAI,EAAE,QAAQ,CAAC,IAAT,CAAc;AAArB,KAAD,CADjB;AAAA;AAAA,QACT,GADS;AAAA,QACJ,KADI;;AAEd,QAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAhC;AAEF,0BAAU,YAAM;AACZ,MAAA,OAAO,CAAC,cAAR,GAAyB,cAAzB;;AAEA,UAAI,iBAAiB,GAAG,CAAxB,EAA2B;AACzB,+BAAO,OAAP;AACD;AACF,KANH,EAMK,CAAC,iBAAD,CANL;AAQA,wBACC;AAAK,MAAA,GAAG,EAAE;AAAV,oBACK,gCAAC,SAAD,EAAe,KAAf,CADL,CADD;AAKA,GAjBA;AAkBD,CAnBD","file":"hoc.js","sourcesContent":["/*\n * Copyright 2019-2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport rmanifest from 'route-manifest';\nimport { listen } from './quicklink';\n\nconst useIntersect = ({ root = null, rootMargin, threshold = 0 } = {}) => {\n const [entry, updateEntry] = useState({});\n const [node, setNode] = useState(null);\n const observer = useRef(null);\n\n useEffect(() => {\n if (observer.current) observer.current.disconnect();\n observer.current = new window.IntersectionObserver(\n ([entry]) => updateEntry(entry),\n {\n root,\n rootMargin,\n threshold\n }\n );\n\n const { current: currentObserver } = observer;\n if (node) currentObserver.observe(node);\n\n return () => currentObserver.disconnect();\n }, [node, root, rootMargin, threshold]);\n\n return [setNode, entry];\n};\n\nconst __defaultAccessor = mix => {\n return (mix && mix.href) || mix || '';\n};\n\nconst prefetchChunks = (entry, prefetchHandler, accessor = __defaultAccessor) => {\n const { files } = rmanifest(window.__rmanifest, entry.pathname);\n const chunkURLs = files.map(accessor).filter(Boolean);\n if (chunkURLs.length) {\n prefetchHandler(chunkURLs);\n } else {\n // also prefetch regular links in-viewport\n prefetchHandler(entry.href);\n }\n};\n\nconst withQuicklink = (Component, options = {}) => {\n return props => {\n\t\tconst [ref, entry] = useIntersect({root: document.body.parentElement});\n const intersectionRatio = entry.intersectionRatio;\n \n\t\tuseEffect(() => {\n options.prefetchChunks = prefetchChunks;\n\n if (intersectionRatio > 0) {\n listen(options);\n }\n }, [intersectionRatio]); \n\t\t\n\t\treturn (\n\t\t\t
    \n \n\t\t\t
    \n\t\t);\n\t};\n};\n\nexport {\n withQuicklink\n};\n"]} \ No newline at end of file diff --git a/node_modules/quicklink/dist/react/quicklink.js b/node_modules/quicklink/dist/react/quicklink.js deleted file mode 100644 index 2c0b307..0000000 --- a/node_modules/quicklink/dist/react/quicklink.js +++ /dev/null @@ -1 +0,0 @@ -function e(e){return new Promise(function(n,t,r){(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=function(){200===r.status?n():t()},r.send()})}var n,t=(n=document.createElement("link")).relList&&n.relList.supports&&n.relList.supports("prefetch")?function(e){return new Promise(function(n,t,r){(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=n,r.onerror=t,document.head.appendChild(r)})}:e,r=window.requestIdleCallback||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},o=new Set;function i(n,r,i){if(i=navigator.connection){if(i.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(i.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(n).map(function(n){if(!o.has(n))return o.add(n),(r?function(n){return window.fetch?fetch(n,{credentials:"include"}):e(n)}:t)(new URL(n,location.href).toString())}))}exports.listen=function(e){if(e||(e={}),window.IntersectionObserver){var n=function(e){e=e||1;var n=[],t=0;function r(){t0&&(n.shift()(),t++)}return[function(e){n.push(e)>1||r()},function(){t--,r()}]}(e.throttle||1/0),t=n[0],c=n[1],u=e.limit||1/0,a=e.origins||[location.hostname],s=e.ignores||[],f=e.timeoutFn||r,l=e.prefetchChunks,h=function(n){i(n,e.priority).then(c).catch(function(n){c(),e.onError&&e.onError(n)})},d=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(d.unobserve(e=e.target),o.size0&&(n.shift()(),t++)}return[function(e){n.push(e)>1||r()},function(){t--,r()}]}(e.throttle||1/0),t=n[0],i=n[1],u=e.limit||1/0,a=e.origins||[location.hostname],f=e.ignores||[],s=e.timeoutFn||r,l=e.prefetchChunks,h=function(n){c(n,e.priority).then(i).catch(function(n){i(),e.onError&&e.onError(n)})},d=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(d.unobserve(e=e.target),o.size{(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=()=>{200===r.status?t():n()},r.send()})}function t(t){return window.fetch?fetch(t,{credentials:"include"}):e(t)}const n=(r=document.createElement("link")).relList&&r.relList.supports&&r.relList.supports("prefetch")?function(e){return new Promise((t,n,r)=>{(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=t,r.onerror=n,document.head.appendChild(r)})}:e;var r;const o=window.requestIdleCallback||function(e){const t=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},i=new Set;function c(e){if(e||(e={}),!window.IntersectionObserver)return;const[t,n]=function(e){e=e||1;var t=[],n=0;function r(){n0&&(t.shift()(),n++)}return[function(e){t.push(e)>1||r()},function(){n--,r()}]}(e.throttle||1/0),r=e.limit||1/0,c=e.origins||[location.hostname],a=e.ignores||[],u=e.timeoutFn||o,f=e.prefetchChunks,l=t=>{s(t,e.priority).then(n).catch(t=>{n(),e.onError&&e.onError(t)})},h=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(h.unobserve(e=e.target),i.size{f?f(e,l):l(e.href)}))})});return u(()=>{(e.el||document).querySelectorAll("a").forEach(e=>{c.length&&!c.includes(e.hostname)||function e(t,n){return Array.isArray(n)?n.some(n=>e(t,n)):(n.test||n).call(n,t.href,t)}(e,a)||h.observe(e)})},{timeout:e.timeout||2e3}),function(){i.clear(),h.disconnect()}}function s(e,r,o){if(o=navigator.connection){if(o.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(o.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(e).map(e=>{if(!i.has(e))return i.add(e),(r?t:n)(new URL(e,location.href).toString())}))}export{c as listen,s as prefetch}; diff --git a/node_modules/quicklink/dist/react/quicklink.umd.js b/node_modules/quicklink/dist/react/quicklink.umd.js deleted file mode 100644 index 64d79be..0000000 --- a/node_modules/quicklink/dist/react/quicklink.umd.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.quicklink={})}(this,function(e){function n(e){return new Promise(function(n,t,r){(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=function(){200===r.status?n():t()},r.send()})}var t,r=(t=document.createElement("link")).relList&&t.relList.supports&&t.relList.supports("prefetch")?function(e){return new Promise(function(n,t,r){(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=n,r.onerror=t,document.head.appendChild(r)})}:n,o=window.requestIdleCallback||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},i=new Set;function c(e,t,o){if(o=navigator.connection){if(o.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(o.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(e).map(function(e){if(!i.has(e))return i.add(e),(t?function(e){return window.fetch?fetch(e,{credentials:"include"}):n(e)}:r)(new URL(e,location.href).toString())}))}e.listen=function(e){if(e||(e={}),window.IntersectionObserver){var n=function(e){e=e||1;var n=[],t=0;function r(){t0&&(n.shift()(),t++)}return[function(e){n.push(e)>1||r()},function(){t--,r()}]}(e.throttle||1/0),t=n[0],r=n[1],u=e.limit||1/0,f=e.origins||[location.hostname],a=e.ignores||[],s=e.timeoutFn||o,l=e.prefetchChunks,d=function(n){c(n,e.priority).then(r).catch(function(n){r(),e.onError&&e.onError(n)})},h=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(h.unobserve(e=e.target),i.size result for the - // current iteration. - result.value = unwrapped; - resolve(result); - }, function(error) { - // If a rejected Promise was yielded, throw the rejection back - // into the async generator function so it can be handled there. - return invoke("throw", error, resolve, reject); - }); - } - } - - var previousPromise; - - function enqueue(method, arg) { - function callInvokeWithMethodAndArg() { - return new PromiseImpl(function(resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - - return previousPromise = - // If enqueue has been called before, then we want to wait until - // all previous Promises have been resolved before calling invoke, - // so that results are always delivered in the correct order. If - // enqueue has not been called before, then it is important to - // call invoke immediately, without waiting on a callback to fire, - // so that the async generator function has the opportunity to do - // any necessary setup in a predictable way. This predictability - // is why the Promise constructor synchronously invokes its - // executor callback, and why async functions synchronously - // execute code before the first await. Since we implement simple - // async functions in terms of async generators, it is especially - // important to get this right, even though it requires care. - previousPromise ? previousPromise.then( - callInvokeWithMethodAndArg, - // Avoid propagating failures to Promises returned by later - // invocations of the iterator. - callInvokeWithMethodAndArg - ) : callInvokeWithMethodAndArg(); - } - - // Define the unified helper method that is used to implement .next, - // .throw, and .return (see defineIteratorMethods). - this._invoke = enqueue; - } - - defineIteratorMethods(AsyncIterator.prototype); - AsyncIterator.prototype[asyncIteratorSymbol] = function () { - return this; - }; - exports.AsyncIterator = AsyncIterator; - - // Note that simple async functions are implemented on top of - // AsyncIterator objects; they just return a Promise for the value of - // the final result produced by the iterator. - exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { - if (PromiseImpl === void 0) PromiseImpl = Promise; - - var iter = new AsyncIterator( - wrap(innerFn, outerFn, self, tryLocsList), - PromiseImpl - ); - - return exports.isGeneratorFunction(outerFn) - ? iter // If outerFn is a generator, return the full iterator. - : iter.next().then(function(result) { - return result.done ? result.value : iter.next(); - }); - }; - - function makeInvokeMethod(innerFn, self, context) { - var state = GenStateSuspendedStart; - - return function invoke(method, arg) { - if (state === GenStateExecuting) { - throw new Error("Generator is already running"); - } - - if (state === GenStateCompleted) { - if (method === "throw") { - throw arg; - } - - // Be forgiving, per 25.3.3.3.3 of the spec: - // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume - return doneResult(); - } - - context.method = method; - context.arg = arg; - - while (true) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - - if (context.method === "next") { - // Setting context._sent for legacy support of Babel's - // function.sent implementation. - context.sent = context._sent = context.arg; - - } else if (context.method === "throw") { - if (state === GenStateSuspendedStart) { - state = GenStateCompleted; - throw context.arg; - } - - context.dispatchException(context.arg); - - } else if (context.method === "return") { - context.abrupt("return", context.arg); - } - - state = GenStateExecuting; - - var record = tryCatch(innerFn, self, context); - if (record.type === "normal") { - // If an exception is thrown from innerFn, we leave state === - // GenStateExecuting and loop back for another invocation. - state = context.done - ? GenStateCompleted - : GenStateSuspendedYield; - - if (record.arg === ContinueSentinel) { - continue; - } - - return { - value: record.arg, - done: context.done - }; - - } else if (record.type === "throw") { - state = GenStateCompleted; - // Dispatch the exception by looping back around to the - // context.dispatchException(context.arg) call above. - context.method = "throw"; - context.arg = record.arg; - } - } - }; - } - - // Call delegate.iterator[context.method](context.arg) and handle the - // result, either by returning a { value, done } result from the - // delegate iterator, or by modifying context.method and context.arg, - // setting context.delegate to null, and returning the ContinueSentinel. - function maybeInvokeDelegate(delegate, context) { - var method = delegate.iterator[context.method]; - if (method === undefined) { - // A .throw or .return when the delegate iterator has no .throw - // method always terminates the yield* loop. - context.delegate = null; - - if (context.method === "throw") { - // Note: ["return"] must be used for ES3 parsing compatibility. - if (delegate.iterator["return"]) { - // If the delegate iterator has a return method, give it a - // chance to clean up. - context.method = "return"; - context.arg = undefined; - maybeInvokeDelegate(delegate, context); - - if (context.method === "throw") { - // If maybeInvokeDelegate(context) changed context.method from - // "return" to "throw", let that override the TypeError below. - return ContinueSentinel; - } - } - - context.method = "throw"; - context.arg = new TypeError( - "The iterator does not provide a 'throw' method"); - } - - return ContinueSentinel; - } - - var record = tryCatch(method, delegate.iterator, context.arg); - - if (record.type === "throw") { - context.method = "throw"; - context.arg = record.arg; - context.delegate = null; - return ContinueSentinel; - } - - var info = record.arg; - - if (! info) { - context.method = "throw"; - context.arg = new TypeError("iterator result is not an object"); - context.delegate = null; - return ContinueSentinel; - } - - if (info.done) { - // Assign the result of the finished delegate to the temporary - // variable specified by delegate.resultName (see delegateYield). - context[delegate.resultName] = info.value; - - // Resume execution at the desired location (see delegateYield). - context.next = delegate.nextLoc; - - // If context.method was "throw" but the delegate handled the - // exception, let the outer generator proceed normally. If - // context.method was "next", forget context.arg since it has been - // "consumed" by the delegate iterator. If context.method was - // "return", allow the original .return call to continue in the - // outer generator. - if (context.method !== "return") { - context.method = "next"; - context.arg = undefined; - } - - } else { - // Re-yield the result returned by the delegate method. - return info; - } - - // The delegate iterator is finished, so forget it and continue with - // the outer generator. - context.delegate = null; - return ContinueSentinel; - } - - // Define Generator.prototype.{next,throw,return} in terms of the - // unified ._invoke helper method. - defineIteratorMethods(Gp); - - define(Gp, toStringTagSymbol, "Generator"); - - // A Generator should always return itself as the iterator object when the - // @@iterator function is called on it. Some browsers' implementations of the - // iterator prototype chain incorrectly implement this, causing the Generator - // object to not be returned from this call. This ensures that doesn't happen. - // See https://github.com/facebook/regenerator/issues/274 for more details. - Gp[iteratorSymbol] = function() { - return this; - }; - - Gp.toString = function() { - return "[object Generator]"; - }; - - function pushTryEntry(locs) { - var entry = { tryLoc: locs[0] }; - - if (1 in locs) { - entry.catchLoc = locs[1]; - } - - if (2 in locs) { - entry.finallyLoc = locs[2]; - entry.afterLoc = locs[3]; - } - - this.tryEntries.push(entry); - } - - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal"; - delete record.arg; - entry.completion = record; - } - - function Context(tryLocsList) { - // The root entry object (effectively a try statement without a catch - // or a finally block) gives us a place to store values thrown from - // locations where there is no enclosing try statement. - this.tryEntries = [{ tryLoc: "root" }]; - tryLocsList.forEach(pushTryEntry, this); - this.reset(true); - } - - exports.keys = function(object) { - var keys = []; - for (var key in object) { - keys.push(key); - } - keys.reverse(); - - // Rather than returning an object with a next method, we keep - // things simple and return the next function itself. - return function next() { - while (keys.length) { - var key = keys.pop(); - if (key in object) { - next.value = key; - next.done = false; - return next; - } - } - - // To avoid creating an additional object, we just hang the .value - // and .done properties off the next function object itself. This - // also ensures that the minifier will not anonymize the function. - next.done = true; - return next; - }; - }; - - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) { - return iteratorMethod.call(iterable); - } - - if (typeof iterable.next === "function") { - return iterable; - } - - if (!isNaN(iterable.length)) { - var i = -1, next = function next() { - while (++i < iterable.length) { - if (hasOwn.call(iterable, i)) { - next.value = iterable[i]; - next.done = false; - return next; - } - } - - next.value = undefined; - next.done = true; - - return next; - }; - - return next.next = next; - } - } - - // Return an iterator with no values. - return { next: doneResult }; - } - exports.values = values; - - function doneResult() { - return { value: undefined, done: true }; - } - - Context.prototype = { - constructor: Context, - - reset: function(skipTempReset) { - this.prev = 0; - this.next = 0; - // Resetting context._sent for legacy support of Babel's - // function.sent implementation. - this.sent = this._sent = undefined; - this.done = false; - this.delegate = null; - - this.method = "next"; - this.arg = undefined; - - this.tryEntries.forEach(resetTryEntry); - - if (!skipTempReset) { - for (var name in this) { - // Not sure about the optimal order of these conditions: - if (name.charAt(0) === "t" && - hasOwn.call(this, name) && - !isNaN(+name.slice(1))) { - this[name] = undefined; - } - } - } - }, - - stop: function() { - this.done = true; - - var rootEntry = this.tryEntries[0]; - var rootRecord = rootEntry.completion; - if (rootRecord.type === "throw") { - throw rootRecord.arg; - } - - return this.rval; - }, - - dispatchException: function(exception) { - if (this.done) { - throw exception; - } - - var context = this; - function handle(loc, caught) { - record.type = "throw"; - record.arg = exception; - context.next = loc; - - if (caught) { - // If the dispatched exception was caught by a catch block, - // then let that catch block handle the exception normally. - context.method = "next"; - context.arg = undefined; - } - - return !! caught; - } - - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - var record = entry.completion; - - if (entry.tryLoc === "root") { - // Exception thrown outside of any try block that could handle - // it, so set the completion value of the entire function to - // throw the exception. - return handle("end"); - } - - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"); - var hasFinally = hasOwn.call(entry, "finallyLoc"); - - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } else if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else if (hasCatch) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } - - } else if (hasFinally) { - if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else { - throw new Error("try statement without catch or finally"); - } - } - } - }, - - abrupt: function(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && - hasOwn.call(entry, "finallyLoc") && - this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - - if (finallyEntry && - (type === "break" || - type === "continue") && - finallyEntry.tryLoc <= arg && - arg <= finallyEntry.finallyLoc) { - // Ignore the finally entry if control is not jumping to a - // location outside the try/catch block. - finallyEntry = null; - } - - var record = finallyEntry ? finallyEntry.completion : {}; - record.type = type; - record.arg = arg; - - if (finallyEntry) { - this.method = "next"; - this.next = finallyEntry.finallyLoc; - return ContinueSentinel; - } - - return this.complete(record); - }, - - complete: function(record, afterLoc) { - if (record.type === "throw") { - throw record.arg; - } - - if (record.type === "break" || - record.type === "continue") { - this.next = record.arg; - } else if (record.type === "return") { - this.rval = this.arg = record.arg; - this.method = "return"; - this.next = "end"; - } else if (record.type === "normal" && afterLoc) { - this.next = afterLoc; - } - - return ContinueSentinel; - }, - - finish: function(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) { - this.complete(entry.completion, entry.afterLoc); - resetTryEntry(entry); - return ContinueSentinel; - } - } - }, - - "catch": function(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if (record.type === "throw") { - var thrown = record.arg; - resetTryEntry(entry); - } - return thrown; - } - } - - // The context.catch method must only be called with a location - // argument that corresponds to a known catch block. - throw new Error("illegal catch attempt"); - }, - - delegateYield: function(iterable, resultName, nextLoc) { - this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }; - - if (this.method === "next") { - // Deliberately forget the last sent value so that we don't - // accidentally pass it on to the delegate. - this.arg = undefined; - } - - return ContinueSentinel; - } - }; - - // Regardless of whether this script is executing as a CommonJS module - // or not, return the runtime object so that we can declare the variable - // regeneratorRuntime in the outer scope, which allows this module to be - // injected easily by `bin/regenerator --include-runtime script.js`. - return exports; - -}( - // If this script is executing as a CommonJS module, use module.exports - // as the regeneratorRuntime namespace. Otherwise create a new empty - // object. Either way, the resulting object will be used to initialize - // the regeneratorRuntime variable at the top of this file. - typeof module === "object" ? module.exports : {} -)); - -try { - regeneratorRuntime = runtime; -} catch (accidentalStrictMode) { - // This module should not be running in strict mode, so the above - // assignment should always work unless something is misconfigured. Just - // in case runtime.js accidentally runs in strict mode, we can escape - // strict mode using a global Function call. This could conceivably fail - // if a Content Security Policy forbids using Function, but in that case - // the proper solution is to fix the accidental strict mode problem. If - // you've misconfigured your bundler to force strict mode and applied a - // CSP to forbid Function, and you're not willing to fix either of those - // problems, please detail your unique predicament in a GitHub issue. - Function("r", "regeneratorRuntime = r")(runtime); -} diff --git a/node_modules/regexparam/dist/regexparam.js b/node_modules/regexparam/dist/regexparam.js deleted file mode 100644 index 575a6f6..0000000 --- a/node_modules/regexparam/dist/regexparam.js +++ /dev/null @@ -1,26 +0,0 @@ -module.exports = function (str, loose) { - if (str instanceof RegExp) return { keys:false, pattern:str }; - var c, o, tmp, ext, keys=[], pattern='', arr = str.split('/'); - arr[0] || arr.shift(); - - while (tmp = arr.shift()) { - c = tmp[0]; - if (c === '*') { - keys.push('wild'); - pattern += '/(.*)'; - } else if (c === ':') { - o = tmp.indexOf('?', 1); - ext = tmp.indexOf('.', 1); - keys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) ); - pattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)'; - if (!!~ext) pattern += (!!~o ? '?' : '') + '\\' + tmp.substring(ext); - } else { - pattern += '/' + tmp; - } - } - - return { - keys: keys, - pattern: new RegExp('^' + pattern + (loose ? '(?=$|\/)' : '\/?$'), 'i') - }; -} diff --git a/node_modules/regexparam/dist/regexparam.min.js b/node_modules/regexparam/dist/regexparam.min.js deleted file mode 100644 index 65dd154..0000000 --- a/node_modules/regexparam/dist/regexparam.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.regexparam=n()}(this,function(){return function(e,n){if(e instanceof RegExp)return{keys:!1,pattern:e};var t,i,f,r,s=[],o="",u=e.split("/");for(u[0]||u.shift();f=u.shift();)"*"===(t=f[0])?(s.push("wild"),o+="/(.*)"):":"===t?(i=f.indexOf("?",1),r=f.indexOf(".",1),s.push(f.substring(1,~i?i:~r?r:f.length)),o+=~i&&!~r?"(?:/([^/]+?))?":"/([^/]+?)",~r&&(o+=(~i?"?":"")+"\\"+f.substring(r))):o+="/"+f;return{keys:s,pattern:new RegExp("^"+o+(n?"(?=$|/)":"/?$"),"i")}}}); \ No newline at end of file diff --git a/node_modules/regexparam/dist/regexparam.mjs b/node_modules/regexparam/dist/regexparam.mjs deleted file mode 100644 index 9f6181a..0000000 --- a/node_modules/regexparam/dist/regexparam.mjs +++ /dev/null @@ -1,26 +0,0 @@ -export default function (str, loose) { - if (str instanceof RegExp) return { keys:false, pattern:str }; - var c, o, tmp, ext, keys=[], pattern='', arr = str.split('/'); - arr[0] || arr.shift(); - - while (tmp = arr.shift()) { - c = tmp[0]; - if (c === '*') { - keys.push('wild'); - pattern += '/(.*)'; - } else if (c === ':') { - o = tmp.indexOf('?', 1); - ext = tmp.indexOf('.', 1); - keys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) ); - pattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)'; - if (!!~ext) pattern += (!!~o ? '?' : '') + '\\' + tmp.substring(ext); - } else { - pattern += '/' + tmp; - } - } - - return { - keys: keys, - pattern: new RegExp('^' + pattern + (loose ? '(?=$|\/)' : '\/?$'), 'i') - }; -} diff --git a/node_modules/regexparam/license b/node_modules/regexparam/license deleted file mode 100644 index a3f96f8..0000000 --- a/node_modules/regexparam/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Luke Edwards (lukeed.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/regexparam/package.json b/node_modules/regexparam/package.json deleted file mode 100644 index c14dbd9..0000000 --- a/node_modules/regexparam/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_args": [ - [ - "regexparam@1.3.0", - "F:\\Documents\\websites\\BMM" - ] - ], - "_from": "regexparam@1.3.0", - "_id": "regexparam@1.3.0", - "_inBundle": false, - "_integrity": "sha512-6IQpFBv6e5vz1QAqI+V4k8P2e/3gRrqfCJ9FI+O1FLQTO+Uz6RXZEZOPmTJ6hlGj7gkERzY5BRCv09whKP96/g==", - "_location": "/regexparam", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "regexparam@1.3.0", - "name": "regexparam", - "escapedName": "regexparam", - "rawSpec": "1.3.0", - "saveSpec": null, - "fetchSpec": "1.3.0" - }, - "_requiredBy": [ - "/route-manifest" - ], - "_resolved": "https://registry.npmjs.org/regexparam/-/regexparam-1.3.0.tgz", - "_spec": "1.3.0", - "_where": "F:\\Documents\\websites\\BMM", - "author": { - "name": "Luke Edwards", - "email": "luke.edwards05@gmail.com", - "url": "lukeed.com" - }, - "bugs": { - "url": "https://github.com/lukeed/regexparam/issues" - }, - "description": "A tiny (308B) utility that converts route patterns into RegExp. Limited alternative to `path-to-regexp` 🙇‍", - "devDependencies": { - "bundt": "^0.3.0", - "tap-spec": "^4.1.1", - "tape": "^4.8.0" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "*.d.ts", - "dist" - ], - "homepage": "https://github.com/lukeed/regexparam#readme", - "keywords": [ - "regexp", - "route", - "routing" - ], - "license": "MIT", - "main": "dist/regexparam.js", - "module": "dist/regexparam.mjs", - "name": "regexparam", - "repository": { - "type": "git", - "url": "git+https://github.com/lukeed/regexparam.git" - }, - "scripts": { - "build": "bundt", - "pretest": "npm run build", - "test": "tape test/*.js | tap-spec" - }, - "types": "types.d.ts", - "unpkg": "dist/regexparam.min.js", - "version": "1.3.0" -} diff --git a/node_modules/regexparam/readme.md b/node_modules/regexparam/readme.md deleted file mode 100644 index 91a696e..0000000 --- a/node_modules/regexparam/readme.md +++ /dev/null @@ -1,175 +0,0 @@ -# regexparam [![Build Status](https://badgen.now.sh/travis/lukeed/regexparam)](https://travis-ci.org/lukeed/regexparam) - -> A tiny (308B) utility that converts route patterns into RegExp. Limited alternative to [`path-to-regexp`](https://github.com/pillarjs/path-to-regexp) 🙇 - -With `regexparam`, you may turn a pathing string (eg, `/users/:id`) into a regular expression. - -An object with shape of `{ keys, pattern }` is returned, where `pattern` is the `RegExp` and `keys` is an array of your parameter name(s) in the order that they appeared. - -Unlike [`path-to-regexp`](https://github.com/pillarjs/path-to-regexp), this module does not create a `keys` dictionary, nor mutate an existing variable. Also, this only ships a parser, which only accept strings. Similarly, and most importantly, `regexparam` **only** handles basic pathing operators: - -* Static (`/foo`, `/foo/bar`) -* Parameter (`/:title`, `/books/:title`, `/books/:genre/:title`) -* Parameter w/ Suffix (`/movies/:title.mp4`, `/movies/:title.(mp4|mov)`) -* Optional Parameters (`/:title?`, `/books/:title?`, `/books/:genre/:title?`) -* Wildcards (`*`, `/books/*`, `/books/:genre/*`) - -This module exposes two module definitions: - -* **CommonJS**: `dist/regexparam.js` -* **ESModule**: `dist/regexparam.mjs` - -## Install - -``` -$ npm install --save regexparam -``` - - -## Usage - -```js -const regexparam = require('regexparam'); - -// Example param-assignment -function exec(path, result) { - let i=0, out={}; - let matches = result.pattern.exec(path); - while (i < result.keys.length) { - out[ result.keys[i] ] = matches[++i] || null; - } - return out; -} - - -// Parameter, with Optional Parameter -// --- -let foo = regexparam('/books/:genre/:title?') -// foo.pattern => /^\/books\/([^\/]+?)(?:\/([^\/]+?))?\/?$/i -// foo.keys => ['genre', 'title'] - -foo.pattern.test('/books/horror'); //=> true -foo.pattern.test('/books/horror/goosebumps'); //=> true - -exec('/books/horror', foo); -//=> { genre: 'horror', title: null } - -exec('/books/horror/goosebumps', foo); -//=> { genre: 'horror', title: 'goosebumps' } - - -// Parameter, with suffix -// --- -let bar = regexparam('/movies/:title.(mp4|mov)'); -// bar.pattern => /^\/movies\/([^\/]+?)\.(mp4|mov)\/?$/i -// bar.keys => ['title'] - -bar.pattern.test('/movies/narnia'); //=> false -bar.pattern.test('/movies/narnia.mp3'); //=> false -bar.pattern.test('/movies/narnia.mp4'); //=> true - -exec('/movies/narnia.mp4', bar); -//=> { title: 'narnia' } - - -// Wildcard -// --- -let baz = regexparam('users/*'); -// baz.pattern => /^\/users\/(.*)\/?$/i -// baz.keys => ['wild'] - -baz.pattern.test('/users'); //=> false -baz.pattern.test('/users/lukeed'); //=> true - -exec('/users/lukeed/repos/new', baz); -//=> { wild: 'lukeed/repos/new' } -``` - -> **Important:** When matching/testing against a generated RegExp, your path **must** begin with a leading slash (`"/"`)! - -## Regular Expressions - -For fine-tuned control, you may pass a `RegExp` value directly to `regexparam` as its only parameter. - -In these situations, `regexparam` **does not** parse nor manipulate your pattern in any way! Because of this, `regexparam` has no "insight" on your route, and instead trusts your input fully. In code, this means that the return value's `keys` is always equal to `false` and the `pattern` is identical to your input value. - -This also means that you must manage and parse your own `keys`~!
    -You may use [named capture groups](https://javascript.info/regexp-groups#named-groups) or traverse the matched segments manually the "old-fashioned" way: - -> **Important:** Please check your target browsers' and target [Node.js runtimes' support](https://node.green/#ES2018-features--RegExp-named-capture-groups)! - -```js -// Named capture group -const named = regexparam(/^\/posts[/](?[0-9]{4})[/](?[0-9]{2})[/](?[^\/]+)/i); -const { groups } = named.pattern.exec('/posts/2019/05/hello-world'); -console.log(groups); -//=> { year: '2019', month: '05', title: 'hello-world' } - -// Widely supported / "Old-fashioned" -const named = regexparam(/^\/posts[/]([0-9]{4})[/]([0-9]{2})[/]([^\/]+)/i); -const [url, year, month, title] = named.pattern.exec('/posts/2019/05/hello-world'); -console.log(year, month, title); -//=> 2019 05 hello-world -``` - - -## API - -There are two API variants: - -1) When passing a `String` input, the `loose` parameter is able to affect the output. [View API](#regexparamstr-loose) - -2) When passing a `RegExp` value, that must be `regexparam`'s _only_ argument.<br> -Your pattern is saved as written, so `loose` is ignored entirely. [View API](#regexparamrgx) - -### regexparam(str, loose) -Returns: `Object` - -Returns a `{ keys, pattern }` object, where `pattern` is a generated `RegExp` instance and `keys` is a list of extracted parameter names. - -#### str -Type: `String` - -The route/pathing string to convert. - -> **Note:** It does not matter if your `str` begins with a `/` — it will be added if missing. - -#### loose -Type: `Boolean`<br> -Default: `false` - -Should the `RegExp` match URLs that are longer than the [`str`](#str) pattern itself?<br> -By default, the generated `RegExp` will test that the URL begins and _ends with_ the pattern. - -```js -const rgx = require('regexparam'); - -rgx('/users').pattern.test('/users/lukeed'); //=> false -rgx('/users', true).pattern.test('/users/lukeed'); //=> true - -rgx('/users/:name').pattern.test('/users/lukeed/repos'); //=> false -rgx('/users/:name', true).pattern.test('/users/lukeed/repos'); //=> true -``` - -### regexparam(rgx) -Returns: `Object` - -Returns a `{ keys, pattern }` object, where pattern is _identical_ to your `rgx` and `keys` is `false`, always. - -#### rgx -Type: `RegExp` - -Your RegExp pattern. - -> **Important:** This pattern is used _as is_! No parsing or interpreting is done on your behalf. - - -## Related - -- [trouter](https://github.com/lukeed/trouter) - A server-side HTTP router that extends from this module. -- [matchit](https://github.com/lukeed/matchit) - Similar (650B) library, but relies on String comparison instead of `RegExp`s. - - -## License - -MIT © [Luke Edwards](https://lukeed.com) diff --git a/node_modules/regexparam/types.d.ts b/node_modules/regexparam/types.d.ts deleted file mode 100644 index 5aa4f10..0000000 --- a/node_modules/regexparam/types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -declare function regexparam(route: string, loose?: boolean): { - keys: Array<string>, - pattern: RegExp -} - -declare function regexparam(route: RegExp): { - keys: false, - pattern: RegExp -} - -export default regexparam; diff --git a/node_modules/route-manifest/dist/rmanifest.js b/node_modules/route-manifest/dist/rmanifest.js deleted file mode 100644 index 4fc90b1..0000000 --- a/node_modules/route-manifest/dist/rmanifest.js +++ /dev/null @@ -1,22 +0,0 @@ -var toRegExp = require('regexparam'); - -module.exports = function (manifest, uri, wCommon) { - var k, - tmp = wCommon && manifest['*'] || [], - headers = tmp.headers || [], - files = tmp.files || tmp; - - for (k in manifest) { - if (k != '*' && toRegExp(k).pattern.test(uri)) { - tmp = manifest[k]; - files = files.concat(tmp.files || tmp); - headers = headers.concat(tmp.headers || []); - break; - } - } - - return { - files: files, - headers: headers, - }; -} diff --git a/node_modules/route-manifest/dist/rmanifest.min.js b/node_modules/route-manifest/dist/rmanifest.min.js deleted file mode 100644 index 1229b8b..0000000 --- a/node_modules/route-manifest/dist/rmanifest.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.rmanifest=t()}(this,function(){function e(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,s,i,f=[],a="",u=e.split("/");for(u[0]||u.shift();s=u.shift();)"*"===(n=s[0])?(f.push("wild"),a+="/(.*)"):":"===n?(r=s.indexOf("?",1),i=s.indexOf(".",1),f.push(s.substring(1,~r?r:~i?i:s.length)),a+=~r&&!~i?"(?:/([^/]+?))?":"/([^/]+?)",~i&&(a+=(~r?"?":"")+"\\"+s.substring(i))):a+="/"+s;return{keys:f,pattern:new RegExp("^"+a+(t?"(?=$|/)":"/?$"),"i")}}return function(t,n,r){var s,i=r&&t["*"]||[],f=i.headers||[],a=i.files||i;for(s in t)if("*"!=s&&e(s).pattern.test(n)){i=t[s],a=a.concat(i.files||i),f=f.concat(i.headers||[]);break}return{files:a,headers:f}};}); \ No newline at end of file diff --git a/node_modules/route-manifest/dist/rmanifest.mjs b/node_modules/route-manifest/dist/rmanifest.mjs deleted file mode 100644 index 3e9c15a..0000000 --- a/node_modules/route-manifest/dist/rmanifest.mjs +++ /dev/null @@ -1,22 +0,0 @@ -import toRegExp from 'regexparam'; - -export default function (manifest, uri, wCommon) { - var k, - tmp = wCommon && manifest['*'] || [], - headers = tmp.headers || [], - files = tmp.files || tmp; - - for (k in manifest) { - if (k != '*' && toRegExp(k).pattern.test(uri)) { - tmp = manifest[k]; - files = files.concat(tmp.files || tmp); - headers = headers.concat(tmp.headers || []); - break; - } - } - - return { - files: files, - headers: headers, - }; -} diff --git a/node_modules/route-manifest/license b/node_modules/route-manifest/license deleted file mode 100644 index a3f96f8..0000000 --- a/node_modules/route-manifest/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/route-manifest/package.json b/node_modules/route-manifest/package.json deleted file mode 100644 index 8651a47..0000000 --- a/node_modules/route-manifest/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "_args": [ - [ - "route-manifest@1.0.0", - "F:\\Documents\\websites\\BMM" - ] - ], - "_from": "route-manifest@1.0.0", - "_id": "route-manifest@1.0.0", - "_inBundle": false, - "_integrity": "sha512-qn0xJr4nnF4caj0erOLLAHYiNyzqhzpUbgDQcEHrmBoG4sWCDLnIXLH7VccNSxe9cWgbP2Kw/OjME+eH3CeRSA==", - "_location": "/route-manifest", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "route-manifest@1.0.0", - "name": "route-manifest", - "escapedName": "route-manifest", - "rawSpec": "1.0.0", - "saveSpec": null, - "fetchSpec": "1.0.0" - }, - "_requiredBy": [ - "/quicklink" - ], - "_resolved": "https://registry.npmjs.org/route-manifest/-/route-manifest-1.0.0.tgz", - "_spec": "1.0.0", - "_where": "F:\\Documents\\websites\\BMM", - "author": { - "name": "Luke Edwards", - "email": "luke.edwards05@gmail.com", - "url": "https://lukeed.com" - }, - "bugs": { - "url": "https://github.com/lukeed/route-manifest/issues" - }, - "dependencies": { - "regexparam": "^1.3.0" - }, - "description": "A tiny (412B) runtime to retrieve the correct entry from a Route Manifest file", - "devDependencies": { - "esm": "3.2.25", - "gzip-size": "5.1.1", - "mk-dirs": "2.0.0", - "pretty-bytes": "4.0.2", - "tap-spec": "5.0.0", - "tape": "4.11.0", - "terser": "4.1.4" - }, - "engines": { - "node": ">= 6" - }, - "files": [ - "*.d.ts", - "dist" - ], - "homepage": "https://github.com/lukeed/route-manifest#readme", - "keywords": [ - "route", - "runtime", - "manifest", - "parser" - ], - "license": "MIT", - "main": "dist/rmanifest.js", - "module": "dist/rmanifest.mjs", - "name": "route-manifest", - "repository": { - "type": "git", - "url": "git+https://github.com/lukeed/route-manifest.git" - }, - "scripts": { - "build": "node bin", - "pretest": "npm run build", - "test": "tape -r esm test/*.js | tap-spec" - }, - "types": "rmanifest.d.ts", - "umd:name": "rmanifest", - "unpkg": "dist/rmanifest.min.js", - "version": "1.0.0" -} diff --git a/node_modules/route-manifest/readme.md b/node_modules/route-manifest/readme.md deleted file mode 100644 index 6b5e6ff..0000000 --- a/node_modules/route-manifest/readme.md +++ /dev/null @@ -1,102 +0,0 @@ -# route-manifest [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/route-manifest)](https://codecov.io/gh/lukeed/route-manifest) - -> A tiny (412B) runtime to retrieve the correct entry from a Route Manifest file. - -This is the runtime/client-side component for [`webpack-route-manifest`](https://github.com/lukeed/webpack-route-manifest).<br> -It is **required** that your manifest's routes be [sorted by specificity](https://github.com/lukeed/route-sort#specificity), which _is_ the webpack plugin's default setting. - -> **Important:** This `route-manifest` _does not_ fetch files or apply headers on your behalf! - -The module is available in three formats: - -* **ES Module**: `dist/rmanifest.mjs` -* **CommonJS**: `dist/rmanifest.js` -* **UMD**: `dist/rmanifest.min.js` - - -## Install - -``` -$ npm install --save route-manifest -``` - - -## Usage - -```js -import { preload } from 'quicklink'; -import rmanifest from 'route-manifest'; - -// Manually fetch Manifest file contents -fetch('/manifest.json').then(r => r.json()).then(data => { - /* - Assume Manifest (`data`) is: - { - [pattern]: { - files: { href: string, type: string } - headers: [...skip...] - } - } - */ - - const files = new Set(); - - // We want to preload these pages' assets - ['/blog', '/about', '/features'].forEach(str => { - let entry = rmanifest(data, str); - entry.files.forEach(x => files.add(x.href)); - }); - - // Note: - // The `quicklink` module will do the actual prefetching! - // We just have have to give it a file path, or an array - // of file paths in this case~! - return preload([...files]); -}); -``` - - -## API - -### rmanifest(contents, uri, withCommons) -Returns: `{ files: Array, headers: Array }` - -Returns an object containing `files` and `headers` keys, both of which will be arrays. The arrays' items are copied from your Manifest file directly, so you will (presumably) already know the shape of your data. - - -#### contents -Type: `Object` - -The Manifest file's contents.<br> -Any format returned by [`webpack-route-manifest`](https://github.com/lukeed/webpack-route-manifest) is valid. - -> **Important:** The route pattern keys [must be sorted](https://github.com/lukeed/webpack-route-manifest#optionssort) for matching correctness. - -#### uri -Type: `String` - -The URL for which you want to find files or headers. - -> **Note:** _Only_ include the `pathname` segment of a URL, unless a pattern is explicitly looking for other segments. - -#### withCommons -Type: `Boolean`<br> -Default: `false` - -Whether or not the base/root-wildcard entry should be included. - -When `true` and when a `"*"` pattern is defined, this will include the wildcard's entry _in addition to_ the route's own specific entry too, if any. The result is still a single object of `{ files, headers }` shape – the difference is just that the two entries have their keys' items concatenated into a single array. - -When `false`, this module will _only_ return the entry _specific to_ the requested `uri` pathname. - - -## Related - -* [webpack-route-manifest](https://github.com/lukeed/webpack-route-manifest) – generate a Route Manifest file for your webpack build -* [quicklink](https://github.com/GoogleChromeLabs/quicklink) – preloading utility that reacts to connection speed and browser support -* [route-sort](https://github.com/lukeed/route-sort) – the route pattern sorter required for safe sequential matching - - -## License - -MIT © [Luke Edwards](https://lukeed.com) diff --git a/node_modules/route-manifest/rmanifest.d.ts b/node_modules/route-manifest/rmanifest.d.ts deleted file mode 100644 index 9c7eb16..0000000 --- a/node_modules/route-manifest/rmanifest.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type Pattern = string; - -export interface Asset { - type: string; - href: string; -} - -export interface Entry<T> { - files: T[]; - headers: any[]; -} - -export type FileMap<T = Asset> = Record<Pattern, T[]>; -export type Manifest<T = Asset> = Record<Pattern, Entry<T>>; - -declare function rmanifest<T = Asset>(contents: FileMap<T> | Manifest<T>, uri: string, withCommons?: boolean): Entry<T>; - -export default rmanifest; diff --git a/node_modules/rust-result/.editorconfig b/node_modules/rust-result/.editorconfig deleted file mode 100644 index 3b281f2..0000000 --- a/node_modules/rust-result/.editorconfig +++ /dev/null @@ -1,11 +0,0 @@ -# EditorConfig is awesome: http://EditorConfig.org - -# top-most EditorConfig file -root = true - -# Unix-style newlines with a newline ending every file -[*] -end_of_line = lf -insert_final_newline = true -indent_style = space -indent_size = 2 diff --git a/node_modules/rust-result/.jshintrc b/node_modules/rust-result/.jshintrc deleted file mode 100644 index fba2446..0000000 --- a/node_modules/rust-result/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "indent": 2 -} diff --git a/node_modules/rust-result/.npmignore b/node_modules/rust-result/.npmignore deleted file mode 100644 index dac0400..0000000 --- a/node_modules/rust-result/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -npm-debug.log -coverage/ -node_modules diff --git a/node_modules/rust-result/LICENSE b/node_modules/rust-result/LICENSE deleted file mode 100644 index 6795545..0000000 --- a/node_modules/rust-result/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2014 by Maciej Małecki - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/rust-result/README.md b/node_modules/rust-result/README.md deleted file mode 100644 index a2f03f5..0000000 --- a/node_modules/rust-result/README.md +++ /dev/null @@ -1,120 +0,0 @@ -# rust-result.js - -Mimic Rust's [`std::result`][result]. - -## Installation - -```sh -npm install rust-result -``` - -## Usage - -```js -var fs = require('fs'); -var Result = require('./'); - - -// If you want async just get a promise or something. -var readFile = function (path, encoding) { - try { - return Result.Ok(fs.readFileSync(path, encoding)) - } - catch (ex) { - return Result.Err(ex) - } -} - -var result = readFile(__filename); -var v, err; - -if (Result.isOk(result)) { - v = Result.Ok(result); - console.log('got ' + v.length + ' bytes') -} -else if (Result.isErr(result)) { - err = Result.Err(result); - console.error('oops!', err.message) -} - -result = readFile(__filename + 'I do not exist') -if (Result.isOk(result)) { - v = Result.Ok(result) - console.log('got ' + v.length + ' bytes') -} -else if (Result.isErr(result)) { - err = Result.Err(result) - console.error('oops!', err.message) -} - -``` - -## Documentation - -```jsig -type OkResult<T> : { - v: T -} -type ErrResult<E <: Error> : { - err: E -} - -rust-result : { - Ok: ((T) => OkResult<T>) | - ((OkResult<T>) => T) | - ((ErrResult<E>) => void), - isOk: ((OkResult<T>) => true) | - ((ErrResult<E>) => false) - Err: ((E <: Error) => ErrResult<E>) | - ((ErrResult<E>) => E) | - ((OkResult<T>) => void), - isErr: ((ErrResult<E>) => true) | - ((OkResult<T>) => false) -} -``` - -### `Result.Ok` - -The `Result.Ok` function is overloaded to do one of two things. - It can create a new `Ok` instance or it can check whether - the argument is an instance of `Ok` - -If you call `Result.Ok` with a plain value it will return an - instance of `Ok` that boxes your plain value. - -If you call `Result.Ok` with either an `Err` or an `Ok` instance - then it will return `undefined` for the `Err` and return the - value boxed in the `Ok` - -### `Result.isOk` - -The `Result.isOk` function just checks whether the argument - is an instance of `Ok`. - -This predicate function returns true if you pass it an `Ok` and - returns false if you pass it an `Err` - -### `Result.Err` - -The `Result.Err` function is overloaded to do one of two things. - It can create a new `Err` instance or it can check whether - the argument is an instance of `Err` - -If you call `Result.Err` with a plain error it will return an - instance of `Err` that boxes your plain error. - -If you call `Result.Err` with either an `Err` or an `Ok` instance - then it will return `undefined` for the `Ok` and return the - value err in the `Err` - -### `Result.isErr` - -The `Result.isErr` function just checks whether the argument - is an instance of `Err`. - -This predicate function returns true if you pass it an `Err` and - returns false if you pass it an `Ok` - -## MIT Licenced. - - [result]: http://doc.rust-lang.org/std/result/ diff --git a/node_modules/rust-result/example.js b/node_modules/rust-result/example.js deleted file mode 100644 index fe7e00e..0000000 --- a/node_modules/rust-result/example.js +++ /dev/null @@ -1,35 +0,0 @@ -var fs = require('fs'); -var Result = require('./'); - - -// If you want async just get a promise or something. -var readFile = function (path, encoding) { - try { - return Result.Ok(fs.readFileSync(path, encoding)) - } - catch (ex) { - return Result.Err(ex) - } -} - -var result = readFile(__filename); -var v, err; - -if (Result.isOk(result)) { - v = Result.Ok(result); - console.log('got ' + v.length + ' bytes') -} -else if (Result.isErr(result)) { - err = Result.Err(result); - console.error('oops!', err.message) -} - -result = readFile(__filename + 'I do not exist') -if (Result.isOk(result)) { - v = Result.Ok(result) - console.log('got ' + v.length + ' bytes') -} -else if (Result.isErr(result)) { - err = Result.Err(result) - console.error('oops!', err.message) -} diff --git a/node_modules/rust-result/index.js b/node_modules/rust-result/index.js deleted file mode 100644 index 35bde14..0000000 --- a/node_modules/rust-result/index.js +++ /dev/null @@ -1,81 +0,0 @@ -var Individual = require('individual') - -var VERSION_KEY = '1'; -var ERROR_CACHE_KEY = '__RUST_RESULT_ERROR_UUID@' + VERSION_KEY -var OK_CACHE_KEY = '__RUST_RESULT_OK_UUID@' + VERSION_KEY - -var ERROR_UUID = Individual(ERROR_CACHE_KEY, fakeUUID('Error')) -var OK_UUID = Individual(OK_CACHE_KEY, fakeUUID('Ok')) - -function Ok(v) { - this.v = v - - this[OK_UUID] = true -} - -function Err(err) { - this.err = err - - this[ERROR_UUID] = true -} - -function createOk(v) { - if (isObject(v) && OK_UUID in v) { - return v.v - } else if (isObject(v) && ERROR_UUID in v) { - return undefined - } else { - if (v === undefined) { - throw Error('rust-result: Cannot box `undefined` in Result.Ok') - } - - return new Ok(v) - } -} - -function createErr(err) { - if (isObject(err) && ERROR_UUID in err) { - return err.err - } else if (isObject(err) && OK_UUID in err) { - return undefined - } else { - if (!isError(err)) { - throw Error('rust-result: Cannot box a non-error in Result.Err') - } - - return new Err(err) - } -} - -function isOk(v) { - return createOk(v) !== undefined -} - -function isErr(err) { - return createErr(err) !== undefined -} - -module.exports = { - isOk: isOk, - Ok: createOk, - isErr: isErr, - Err: createErr -} - -function fakeUUID(word) { - return 'rust-result:' + word + ':' + - Math.random().toString(32).slice(2) + ':' + - Math.random().toString(32).slice(2) + ':' + - Math.random().toString(32).slice(2) + ':' + - Math.random().toString(32).slice(2) + ':' -} - -function isObject(o) { - return typeof o === 'object' && o !== null -} - -function isError(e) { - return isObject(e) && - (Object.prototype.toString.call(e) === '[object Error]' || - /* istanbul ignore next */ e instanceof Error) -} diff --git a/node_modules/rust-result/package.json b/node_modules/rust-result/package.json deleted file mode 100644 index bcc9437..0000000 --- a/node_modules/rust-result/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "_from": "rust-result@^1.0.0", - "_id": "rust-result@1.0.0", - "_inBundle": false, - "_integrity": "sha1-NMdbLm3Dn+WHXlveyFteD5FTb3I=", - "_location": "/rust-result", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "rust-result@^1.0.0", - "name": "rust-result", - "escapedName": "rust-result", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/safe-json-parse" - ], - "_resolved": "https://registry.npmjs.org/rust-result/-/rust-result-1.0.0.tgz", - "_shasum": "34c75b2e6dc39fe5875e5bdec85b5e0f91536f72", - "_spec": "rust-result@^1.0.0", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\safe-json-parse", - "author": { - "name": "Maciej Małecki", - "email": "me@mmalecki.com" - }, - "bugs": { - "url": "https://github.com/mmalecki/rust-result.js/issues" - }, - "bundleDependencies": false, - "dependencies": { - "individual": "^2.0.0" - }, - "deprecated": false, - "description": "Mimic Rust's `std::result`", - "devDependencies": { - "istanbul": "^0.3.5", - "opn": "^1.0.0", - "tape": "^3.0.1" - }, - "homepage": "https://github.com/mmalecki/rust-result.js", - "license": "MIT", - "main": "index", - "name": "rust-result", - "repository": { - "type": "git", - "url": "git://github.com/mmalecki/rust-result.js.git" - }, - "scripts": { - "cover": "istanbul cover --print detail --report html test.js", - "test": "node test.js", - "view-cover": "istanbul report html && opn ./coverage/index.html" - }, - "version": "1.0.0" -} diff --git a/node_modules/rust-result/test.js b/node_modules/rust-result/test.js deleted file mode 100644 index d9fab15..0000000 --- a/node_modules/rust-result/test.js +++ /dev/null @@ -1,88 +0,0 @@ -var test = require('tape') - -var Result = require('./index.js') - -test('can create Ok', function t(assert) { - var v = Result.Ok(42) - - assert.equal(!!v, true) - assert.equal(v.v, 42) - - assert.end() -}) - -test('can check for Ok', function t(assert) { - var result = Result.Ok(42) - - assert.equal(Result.isOk(result), true) - assert.equal(Result.Ok(result), 42) - - assert.end() -}) - -test('check for Ok fails for Err', function t(assert) { - var result = Result.Err(new Error('foo')) - - assert.equal(Result.isOk(result), false) - assert.equal(Result.Ok(result), undefined) - - assert.end() -}) - -test('can create Err', function t(assert) { - var err = Result.Err(new Error('foo')) - - assert.equal(!!err, true) - assert.equal(err.err.message, 'foo') - - assert.end() -}) - -test('can check for Err', function t(assert) { - var result = Result.Err(new Error('foo')) - - assert.equal(Result.isErr(result), true) - assert.equal(Result.Err(result).message, 'foo') - - assert.end() -}) - -test('check for Err fails for Ok', function t(assert) { - var result = Result.Ok(42) - - assert.equal(Result.isErr(result), false) - assert.equal(Result.Err(result), undefined) - - assert.end() -}) - -test('Ok can support null value', function t(assert) { - var result = Result.Ok(null) - - assert.equal(!!result, true) - assert.equal(result.v, null) - - assert.equal(Result.isOk(result), true) - assert.equal(Result.Ok(result), null) - - assert.equal(Result.isErr(result), false) - assert.equal(Result.Err(result), undefined) - - assert.end() -}) - -test('Ok throws if you box undefined', function t(assert) { - assert.throws(function () { - Result.Ok(undefined) - }, /Cannot box `undefined` in Result.Ok/) - - assert.end() -}) - -test('Err throws if you box non-error', function t(assert) { - assert.throws(function () { - Result.Err(42) - }, /Cannot box a non-error in Result.Err/) - - assert.end() -}) diff --git a/node_modules/safe-json-parse/.npmignore b/node_modules/safe-json-parse/.npmignore deleted file mode 100644 index fd31f5e..0000000 --- a/node_modules/safe-json-parse/.npmignore +++ /dev/null @@ -1,15 +0,0 @@ -.DS_Store -.monitor -.*.swp -.nodemonignore -releases -*.log -*.err -fleet.json -public/browserify -bin/*.json -.bin -build -compile -.lock-wscript -node_modules diff --git a/node_modules/safe-json-parse/.testem.json b/node_modules/safe-json-parse/.testem.json deleted file mode 100644 index 41ab90e..0000000 --- a/node_modules/safe-json-parse/.testem.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "launchers": { - "node": { - "command": "node ./test" - } - }, - "src_files": [ - "./**/*.js" - ], - "before_tests": "npm run build-test", - "on_exit": "rm test/static/bundle.js", - "test_page": "test/static/index.html", - "launch_in_dev": ["node", "phantomjs"] -} diff --git a/node_modules/safe-json-parse/.travis.yml b/node_modules/safe-json-parse/.travis.yml deleted file mode 100644 index 52424f8..0000000 --- a/node_modules/safe-json-parse/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - 0.8 - - 0.9 - - 0.10 -script: node ./test/index.js diff --git a/node_modules/safe-json-parse/LICENCE b/node_modules/safe-json-parse/LICENCE deleted file mode 100644 index 5b1b5dc..0000000 --- a/node_modules/safe-json-parse/LICENCE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Raynos. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/safe-json-parse/README.md b/node_modules/safe-json-parse/README.md deleted file mode 100644 index c1c99ee..0000000 --- a/node_modules/safe-json-parse/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# safe-json-parse - -[![build status][1]][2] [![dependency status][3]][4] - -<!-- [![browser support][5]][6] --> - -Parse JSON safely without throwing - -## Example (callback) - -```js -var safeParse = require("safe-json-parse/callback") - -safeParse("{}", function (err, json) { - /* we have json */ -}) - -safeparse("WRONG", function (err) { - /* we have err! */ -}) -``` - -## Example (tuple) - -```js -var safeParse = require("safe-json-parse/tuple") - -var tuple1 = safeParse("{}") -var json = tuple1[1] /* we have json */ - -var tuple2 = safeparse("WRONG") -var err = tuple2[0] /* we have err! */ - -var tuple3 = safeParse(something) -if (tuple3[0]) { - var err = tuple3[0] - // handle err -} else { - var json = tuple3[1] - // handle json -} -``` - -## Example (result) - -```js -var Result = require('rust-result') -var safeParse = require('safe-json-parse/result') - -var result1 = safeParse("{}") -var json = Result.Ok(result1) /* we have json */ - -var result2 = safeparse("WRONG") -var err = Result.Err(result2) /* we have err! */ - -var result3 = safeParse(something) -if (Result.ifErr(result3)) { - var err = Result.Err(result3) - // handle err -} else if (Result.ifOk(result3)) { - var json = Result.Ok(result3) - // handle json -} -``` - -## Installation - -`npm install safe-json-parse` - -## Contributors - - - Raynos - -## MIT Licenced - - - [1]: https://secure.travis-ci.org/Raynos/safe-json-parse.png - [2]: https://travis-ci.org/Raynos/safe-json-parse - [3]: https://david-dm.org/Raynos/safe-json-parse.png - [4]: https://david-dm.org/Raynos/safe-json-parse - [5]: https://ci.testling.com/Raynos/safe-json-parse.png - [6]: https://ci.testling.com/Raynos/safe-json-parse diff --git a/node_modules/safe-json-parse/callback.js b/node_modules/safe-json-parse/callback.js deleted file mode 100644 index 4db9623..0000000 --- a/node_modules/safe-json-parse/callback.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = SafeParseCallback - -function SafeParseCallback(obj, reviver, callback) { - if (arguments.length === 2) { - callback = reviver - reviver = null - } - - var json - - try { - json = JSON.parse(obj, reviver) - } catch (err) { - return callback(err) - } - - callback(null, json) -} diff --git a/node_modules/safe-json-parse/examples/simple.js b/node_modules/safe-json-parse/examples/simple.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/safe-json-parse/package.json b/node_modules/safe-json-parse/package.json deleted file mode 100644 index 9743f47..0000000 --- a/node_modules/safe-json-parse/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "_from": "safe-json-parse@4.0.0", - "_id": "safe-json-parse@4.0.0", - "_inBundle": false, - "_integrity": "sha1-fA9XjPzNEtM6ccDgVBPi7KFx6qw=", - "_location": "/safe-json-parse", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "safe-json-parse@4.0.0", - "name": "safe-json-parse", - "escapedName": "safe-json-parse", - "rawSpec": "4.0.0", - "saveSpec": null, - "fetchSpec": "4.0.0" - }, - "_requiredBy": [ - "/video.js" - ], - "_resolved": "https://registry.npmjs.org/safe-json-parse/-/safe-json-parse-4.0.0.tgz", - "_shasum": "7c0f578cfccd12d33a71c0e05413e2eca171eaac", - "_spec": "safe-json-parse@4.0.0", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js", - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "bugs": { - "url": "https://github.com/Raynos/safe-json-parse/issues", - "email": "raynos2@gmail.com" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Raynos" - } - ], - "dependencies": { - "rust-result": "^1.0.0" - }, - "deprecated": false, - "description": "Parse JSON safely without throwing", - "devDependencies": { - "tape": "~1.0.2" - }, - "homepage": "https://github.com/Raynos/safe-json-parse", - "keywords": [], - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/Raynos/safe-json-parse/raw/master/LICENSE" - } - ], - "main": "callback", - "name": "safe-json-parse", - "repository": { - "type": "git", - "url": "git://github.com/Raynos/safe-json-parse.git" - }, - "scripts": { - "test": "node ./test/index.js" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "ie/8..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "4.0.0" -} diff --git a/node_modules/safe-json-parse/result.js b/node_modules/safe-json-parse/result.js deleted file mode 100644 index b64c3c8..0000000 --- a/node_modules/safe-json-parse/result.js +++ /dev/null @@ -1,15 +0,0 @@ -var Result = require('rust-result'); - -module.exports = SafeParseTuple - -function SafeParseTuple(obj, reviver) { - var json - - try { - json = JSON.parse(obj, reviver); - } catch (err) { - return Result.Err(err); - } - - return Result.Ok(json); -} diff --git a/node_modules/safe-json-parse/test/index.js b/node_modules/safe-json-parse/test/index.js deleted file mode 100644 index b57d292..0000000 --- a/node_modules/safe-json-parse/test/index.js +++ /dev/null @@ -1,65 +0,0 @@ -var test = require("tape") -var Result = require("rust-result") - -var safeParse = require("../callback") -var safeParseTuple = require("../tuple") -var safeParseResult = require("../result") - -test("safeParse is a function", function (assert) { - assert.equal(typeof safeParse, "function") - assert.end() -}) - -test("safeParse valid json", function (assert) { - safeParse("{ \"foo\": true }", function (err, json) { - assert.ifError(err) - assert.equal(json.foo, true) - - assert.end() - }) -}) - -test("safeParse faulty", function (assert) { - safeParse("WRONG", function (err) { - assert.ok(err) - assert.equal(err.message, "Unexpected token W") - - assert.end() - }) -}) - -test("safeParseTuple valid json", function (assert) { - var t = safeParseTuple("{ \"foo\": true }") - - assert.ifError(t[0]) - assert.equal(t[1].foo, true) - - assert.end() -}) - -test("safeParseTuple faulty", function (assert) { - var t = safeParseTuple("WRONG") - - assert.ok(t[0]) - assert.equal(t[0].message, "Unexpected token W") - - assert.end() -}) - -test("safeParseResult valid json", function (assert) { - var t = safeParseResult("{ \"foo\": true }") - - assert.ifError(Result.isErr(t)) - assert.equal(Result.Ok(t).foo, true) - - assert.end() -}) - -test("safeParseResult faulty", function (assert) { - var t = safeParseResult("WRONG") - - assert.ok(Result.Err(t)) - assert.equal(Result.Err(t).message, "Unexpected token W") - - assert.end() -}) diff --git a/node_modules/safe-json-parse/test/static/index.html b/node_modules/safe-json-parse/test/static/index.html deleted file mode 100644 index 60f6ef8..0000000 --- a/node_modules/safe-json-parse/test/static/index.html +++ /dev/null @@ -1,11 +0,0 @@ -<!doctype html> -<html> -<head> - <title>TAPE Example - - - - - - - diff --git a/node_modules/safe-json-parse/test/static/test-adapter.js b/node_modules/safe-json-parse/test/static/test-adapter.js deleted file mode 100644 index c512792..0000000 --- a/node_modules/safe-json-parse/test/static/test-adapter.js +++ /dev/null @@ -1,49 +0,0 @@ -(function () { - var Testem = window.Testem - var regex = /^((?:not )?ok) (\d+) (.+)$/ - - Testem.useCustomAdapter(tapAdapter) - - function tapAdapter(socket){ - var results = { - failed: 0 - , passed: 0 - , total: 0 - , tests: [] - } - - socket.emit('tests-start') - - Testem.handleConsoleMessage = function(msg){ - var m = msg.match(regex) - if (m) { - var passed = m[1] === 'ok' - var test = { - passed: passed ? 1 : 0, - failed: passed ? 0 : 1, - total: 1, - id: m[2], - name: m[3], - items: [] - } - - if (passed) { - results.passed++ - } else { - results.failed++ - } - - results.total++ - - socket.emit('test-result', test) - results.tests.push(test) - } else if (msg === '# ok' || msg.match(/^# tests \d+/)){ - socket.emit('all-test-results', results) - } - - // return false if you want to prevent the console message from - // going to the console - // return false - } - } -}()) diff --git a/node_modules/safe-json-parse/tuple.js b/node_modules/safe-json-parse/tuple.js deleted file mode 100644 index 345842b..0000000 --- a/node_modules/safe-json-parse/tuple.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = SafeParseTuple - -function SafeParseTuple(obj, reviver) { - var json - var error = null - - try { - json = JSON.parse(obj, reviver) - } catch (err) { - error = err - } - - return [error, json] -} diff --git a/node_modules/throttles/dist/index.js b/node_modules/throttles/dist/index.js deleted file mode 100644 index 4e146f5..0000000 --- a/node_modules/throttles/dist/index.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = function (limit) { - limit = limit || 1; - var queue=[], wip=0; - - function toAdd(fn) { - queue.push(fn) > 1 || run(); // initializes if 1st - } - - function isDone() { - wip--; // make room for next - run(); - } - - function run() { - if (wip < limit && queue.length > 0) { - queue.shift()(); wip++; // is now WIP - } - } - - return [toAdd, isDone]; -} diff --git a/node_modules/throttles/dist/index.min.js b/node_modules/throttles/dist/index.min.js deleted file mode 100644 index 0e75e10..0000000 --- a/node_modules/throttles/dist/index.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=function(n){n=n||1;var t=[],f=0;function u(){f0&&(t.shift()(),f++)}return[function(n){t.push(n)>1||u()},function(){f--,u()}]}:"function"==typeof define&&define.amd?define(t):n.throttles=function(n){n=n||1;var t=[],f=0;function u(){f0&&(t.shift()(),f++)}return[function(n){t.push(n)>1||u()},function(){f--,u()}]}}(this,(function(){return function(n){n=n||1;var t=[],f=0;function u(){f0&&(t.shift()(),f++)}return[function(n){t.push(n)>1||u()},function(){f--,u()}]}})); \ No newline at end of file diff --git a/node_modules/throttles/dist/index.mjs b/node_modules/throttles/dist/index.mjs deleted file mode 100644 index 1b5d2e7..0000000 --- a/node_modules/throttles/dist/index.mjs +++ /dev/null @@ -1,21 +0,0 @@ -export default function (limit) { - limit = limit || 1; - var queue=[], wip=0; - - function toAdd(fn) { - queue.push(fn) > 1 || run(); // initializes if 1st - } - - function isDone() { - wip--; // make room for next - run(); - } - - function run() { - if (wip < limit && queue.length > 0) { - queue.shift()(); wip++; // is now WIP - } - } - - return [toAdd, isDone]; -} diff --git a/node_modules/throttles/index.d.ts b/node_modules/throttles/index.d.ts deleted file mode 100644 index 9e1e569..0000000 --- a/node_modules/throttles/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -declare module 'throttles' { - type isDone = () => void; - type toAdd = (fn: Function) => void; - function throttles(limit?: number): [toAdd, isDone]; - export = throttles; -} - -declare module 'throttles/priority' { - type isDone = () => void; - type toAdd = (fn: Function, isHigh?: boolean) => void; - function throttles(limit?: number): [toAdd, isDone]; - export = throttles; -} diff --git a/node_modules/throttles/license b/node_modules/throttles/license deleted file mode 100644 index a3f96f8..0000000 --- a/node_modules/throttles/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Luke Edwards (lukeed.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS 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. diff --git a/node_modules/throttles/package.json b/node_modules/throttles/package.json deleted file mode 100644 index f1363b4..0000000 --- a/node_modules/throttles/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_args": [ - [ - "throttles@1.0.1", - "F:\\Documents\\websites\\BMM" - ] - ], - "_from": "throttles@1.0.1", - "_id": "throttles@1.0.1", - "_inBundle": false, - "_integrity": "sha512-fab7Xg+zELr9KOv4fkaBoe/b3L0GMGLd0IBSCn16GoE/Qx6/OfCr1eGNyEcDU2pUA79qQfZ8kPQWlRuok4YwTw==", - "_location": "/throttles", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "throttles@1.0.1", - "name": "throttles", - "escapedName": "throttles", - "rawSpec": "1.0.1", - "saveSpec": null, - "fetchSpec": "1.0.1" - }, - "_requiredBy": [ - "/quicklink" - ], - "_resolved": "https://registry.npmjs.org/throttles/-/throttles-1.0.1.tgz", - "_spec": "1.0.1", - "_where": "F:\\Documents\\websites\\BMM", - "author": { - "name": "Luke Edwards", - "email": "luke.edwards05@gmail.com", - "url": "https://lukeed.com" - }, - "bugs": { - "url": "https://github.com/lukeed/throttles/issues" - }, - "description": "A tiny (139B to 204B) utility to regulate the execution rate of your functions", - "devDependencies": { - "bundt": "1.0.1", - "esm": "3.2.25", - "uvu": "0.0.14" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "index.d.ts", - "priority", - "dist" - ], - "homepage": "https://github.com/lukeed/throttles#readme", - "license": "MIT", - "main": "dist/index.js", - "modes": { - "default": "src/single.js", - "priority": "src/priority.js" - }, - "module": "dist/index.mjs", - "name": "throttles", - "repository": { - "type": "git", - "url": "git+https://github.com/lukeed/throttles.git" - }, - "scripts": { - "build": "bundt", - "postbuild": "cp priority.d.ts priority/index.d.ts", - "pretest": "npm run build", - "test": "uvu -r esm test -i utils" - }, - "types": "index.d.ts", - "unpkg": "dist/index.min.js", - "version": "1.0.1" -} diff --git a/node_modules/throttles/priority/index.d.ts b/node_modules/throttles/priority/index.d.ts deleted file mode 100644 index 9c8123c..0000000 --- a/node_modules/throttles/priority/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -type isDone = () => void; -type toAdd = (fn: Function, isHigh?: boolean) => void; -declare function throttles(limit?: number): [toAdd, isDone]; -export default throttles; diff --git a/node_modules/throttles/priority/index.js b/node_modules/throttles/priority/index.js deleted file mode 100644 index a081151..0000000 --- a/node_modules/throttles/priority/index.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = function (limit) { - limit = limit || 1; - var qlow=[], idx, qhigh=[], sum=0, wip=0; - - function toAdd(fn, isHigh) { - if (fn.__t) { - if (isHigh) { - idx = qlow.indexOf(fn); - // must decrement (increments again) - if (!!~idx) qlow.splice(idx, 1).length && sum--; - } else return; - } - fn.__t = 1; - (isHigh ? qhigh : qlow).push(fn); - sum++ || run(); // initializes if 1st - } - - function isDone() { - wip--; // make room for next - run(); - } - - function run() { - if (wip < limit && sum > 0) { - (qhigh.shift() || qlow.shift())(); - sum--; wip++; // is now WIP - } - } - - return [toAdd, isDone]; -} diff --git a/node_modules/throttles/priority/index.min.js b/node_modules/throttles/priority/index.min.js deleted file mode 100644 index ec54ead..0000000 --- a/node_modules/throttles/priority/index.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=function(n){n=n||1;var t,i=[],f=[],e=0,u=0;function o(){u0&&((f.shift()||i.shift())(),e--,u++)}return[function(n,u){if(n.__t){if(!u)return;~(t=i.indexOf(n))&&i.splice(t,1).length&&e--}n.__t=1,(u?f:i).push(n),e++||o()},function(){u--,o()}]}:"function"==typeof define&&define.amd?define(t):n.throttles=function(n){n=n||1;var t,i=[],f=[],e=0,u=0;function o(){u0&&((f.shift()||i.shift())(),e--,u++)}return[function(n,u){if(n.__t){if(!u)return;~(t=i.indexOf(n))&&i.splice(t,1).length&&e--}n.__t=1,(u?f:i).push(n),e++||o()},function(){u--,o()}]}}(this,(function(){return function(n){n=n||1;var t,i=[],f=[],e=0,u=0;function o(){u0&&((f.shift()||i.shift())(),e--,u++)}return[function(n,u){if(n.__t){if(!u)return;~(t=i.indexOf(n))&&i.splice(t,1).length&&e--}n.__t=1,(u?f:i).push(n),e++||o()},function(){u--,o()}]}})); \ No newline at end of file diff --git a/node_modules/throttles/priority/index.mjs b/node_modules/throttles/priority/index.mjs deleted file mode 100644 index ed6f4c2..0000000 --- a/node_modules/throttles/priority/index.mjs +++ /dev/null @@ -1,31 +0,0 @@ -export default function (limit) { - limit = limit || 1; - var qlow=[], idx, qhigh=[], sum=0, wip=0; - - function toAdd(fn, isHigh) { - if (fn.__t) { - if (isHigh) { - idx = qlow.indexOf(fn); - // must decrement (increments again) - if (!!~idx) qlow.splice(idx, 1).length && sum--; - } else return; - } - fn.__t = 1; - (isHigh ? qhigh : qlow).push(fn); - sum++ || run(); // initializes if 1st - } - - function isDone() { - wip--; // make room for next - run(); - } - - function run() { - if (wip < limit && sum > 0) { - (qhigh.shift() || qlow.shift())(); - sum--; wip++; // is now WIP - } - } - - return [toAdd, isDone]; -} diff --git a/node_modules/throttles/readme.md b/node_modules/throttles/readme.md deleted file mode 100644 index c88ad44..0000000 --- a/node_modules/throttles/readme.md +++ /dev/null @@ -1,119 +0,0 @@ -# throttles [![build status](https://badgen.now.sh/github/status/lukeed/throttles)](https://github.com/lukeed/throttles/actions) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/throttles)](https://codecov.io/gh/lukeed/throttles) - -> A tiny (139B to 204B) utility to regulate the execution rate of your functions - - -## Install - -``` -$ npm install --save throttles -``` - - -## Modes - -There are two "versions" of `throttles`, each of which different purpose: - -#### "single" -> **Size (gzip):** 139 bytes
    -> **Availability:** [UMD](https://unpkg.com/throttles), [CommonJS](https://unpkg.com/throttles/dist/index.js), [ES Module](https://unpkg.com/throttles?module) - -This is the primary/default mode, meant for managing single queues. - -#### "priority" -> **Size (gzip):** 204 bytes
    -> **Availability:** [UMD](https://unpkg.com/throttles/priority), [ES Module](https://unpkg.com/throttles/priority/index.mjs) - -This is the opt-in mode, meant for managing a low priority _and_ a high priority queue system.
    -Items within the "high priority" queue are handled before the low/general queue. The `limit` is still enforced. - - -## Usage - -***Selecting a Mode*** - -```js -// import via npm module -import throttles from 'throttles'; -import throttles from 'throttles/priority'; - -// import via unpkg -import throttles from 'https://unpkg.com/throttles/index.mjs'; -import throttles from 'https://unpkg.com/throttles/priority/index.mjs'; -``` - -***Example Usage*** - -```js -import throttles from 'throttles'; - -const API = 'https://pokeapi.co/api/v2/pokemon'; -const getPokemon = id => fetch(`${API}/${id}`).then(r => r.json()); - -// Limit concurrency to 3 -const [toAdd, isDone] = throttles(3); - -// What we'll fetch -const pokemon = ['bulbasaur', 'ivysaur', 'venusaur', 'charmander', 'charmeleon', 'charizard', ...]; - -// Loop list, enqueuing each Pokemon -// ~> Always keeps 3 requests active at a time -// ~> When complete, marks itself complete via `isDone()` -pokemon.forEach(name => { - toAdd(() => { - getPokemon(name).then(isDone); - }); -}); - -// Or, use `Array.map` to wrap our `getPokemon` function -// ~> This still fetches Pokemon 3 at once -pokemon.map(x => () => getPokemon(x).then(isDone)).forEach(toAdd); -``` - - -## API - -### throttles(limit) -Returns: `Array` - -Returns a tuple of [[`toAdd`](#toaddfn-ishigh), [`isDone`](#isdone)] actions. - -#### limit -Type: `Number`
    -Default: `1` - -The throttle's concurrency limit. By default, runs your functions one at a time. - - -### toAdd(fn[, isHigh]) -Type: `Function`
    -Returns: `void` - -Add a function to the throttle's queue. - -> **Important:** In "priority" mode, identical functions are ignored. - -#### fn -Type: `Function`
    -The function to add to the queue. - -#### isHigh -Type: `Boolean`
    -Default: `false`
    -If the `fn` should be added to the "high priority" queue. - -> **Important:** Only available in "priority" mode! - - -### isDone -Type: `Function`
    -Returns: `void` - -Signifies that a function has been completed. - -> **Important:** Failure to call this will prevent `throttles` from continuing to the next item! - - -## License - -MIT © [Luke Edwards](https://lukeed.com) diff --git a/node_modules/url-toolkit/.github/dependabot.yml b/node_modules/url-toolkit/.github/dependabot.yml deleted file mode 100644 index 3b94054..0000000 --- a/node_modules/url-toolkit/.github/dependabot.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: 2 -updates: - - package-ecosystem: npm - directory: '/' - schedule: - interval: daily - open-pull-requests-limit: 99 - versioning-strategy: widen diff --git a/node_modules/url-toolkit/.github/workflows/automerge.yml b/node_modules/url-toolkit/.github/workflows/automerge.yml deleted file mode 100644 index d579cf7..0000000 --- a/node_modules/url-toolkit/.github/workflows/automerge.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Auto Merge Dependency Updates - -on: - - pull_request_target - - pull_request_review - -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: tjenkinson/gh-action-auto-merge-dependency-updates@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - allowed-actors: dependabot-preview[bot], dependabot[bot], tjenkinson diff --git a/node_modules/url-toolkit/.github/workflows/nodejs.yml b/node_modules/url-toolkit/.github/workflows/nodejs.yml deleted file mode 100644 index e6ae66b..0000000 --- a/node_modules/url-toolkit/.github/workflows/nodejs.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Node CI - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: ['10', '12', '15'] - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - name: npm install and test - run: | - npm ci - npm run lint - npm test - env: - CI: true diff --git a/node_modules/url-toolkit/.prettierrc b/node_modules/url-toolkit/.prettierrc deleted file mode 100644 index 6a8af5e..0000000 --- a/node_modules/url-toolkit/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "tabWidth": 2, - "semi": true, - "singleQuote": true -} diff --git a/node_modules/url-toolkit/LICENSE b/node_modules/url-toolkit/LICENSE deleted file mode 100644 index fa12219..0000000 --- a/node_modules/url-toolkit/LICENSE +++ /dev/null @@ -1,190 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2016 Tom Jenkinson - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/url-toolkit/README.md b/node_modules/url-toolkit/README.md deleted file mode 100644 index 9ce6389..0000000 --- a/node_modules/url-toolkit/README.md +++ /dev/null @@ -1,90 +0,0 @@ -[![npm version](https://badge.fury.io/js/url-toolkit.svg)](https://badge.fury.io/js/url-toolkit) - -# URL Toolkit - -Lightweight library to build an absolute URL from a base URL and a relative URL, written from [the spec (RFC 1808)](https://tools.ietf.org/html/rfc1808). Initially part of [HLS.JS](https://github.com/dailymotion/hls.js). - -## Methods - -### `buildAbsoluteURL(baseURL, relativeURL, opts={})` - -Build an absolute URL from a relative and base one. - -```javascript -URLToolkit.buildAbsoluteURL('http://a.com/b/cd', 'e/f/../g'); // => http://a.com/b/e/g -``` - -If you want to ensure that the URL is treated as a relative one you should prefix it with `./`. - -```javascript -URLToolkit.buildAbsoluteURL('http://a.com/b/cd', 'a:b'); // => a:b -URLToolkit.buildAbsoluteURL('http://a.com/b/cd', './a:b'); // => http://a.com/b/a:b -``` - -By default the paths will not be normalized unless necessary, according to the spec. However you can ensure paths are always normalized by setting the `opts.alwaysNormalize` option to `true`. - -```javascript -URLToolkit.buildAbsoluteURL('http://a.com/b/cd', '/e/f/../g'); // => http://a.com/e/f/../g -URLToolkit.buildAbsoluteURL('http://a.com/b/cd', '/e/f/../g', { - alwaysNormalize: true, -}); // => http://a.com/e/g -``` - -### `normalizePath(url)` - -Normalizes a path. - -```javascript -URLToolkit.normalizePath('a/b/../c'); // => a/c -``` - -### `parseURL(url)` - -Parse a URL into its separate components. - -```javascript -URLToolkit.parseURL('http://a/b/c/d;p?q#f'); // => -/* { - scheme: 'http:', - netLoc: '//a', - path: '/b/c/d', - params: ';p', - query: '?q', - fragment: '#f' -} */ -``` - -### `buildURLFromParts(parts)` - -Puts all the parts from `parseURL()` back together into a string. - -## Example - -```javascript -var URLToolkit = require('url-toolkit'); -var url = URLToolkit.buildAbsoluteURL( - 'https://a.com/b/cd/e.m3u8?test=1#something', - '../z.ts?abc=1#test' -); -console.log(url); // 'https://a.com/b/z.ts?abc=1#test' -``` - -## Browser - -This can also be used in the browser thanks to [jsDelivr](https://github.com/jsdelivr/jsdelivr): - -```html - - - - -``` diff --git a/node_modules/url-toolkit/jest.config.js b/node_modules/url-toolkit/jest.config.js deleted file mode 100644 index 85f0e08..0000000 --- a/node_modules/url-toolkit/jest.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - testEnvironment: 'node', - testMatch: ['**/test/**/*.js'], -}; diff --git a/node_modules/url-toolkit/package.json b/node_modules/url-toolkit/package.json deleted file mode 100644 index fe7bf37..0000000 --- a/node_modules/url-toolkit/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "_from": "url-toolkit@^2.2.1", - "_id": "url-toolkit@2.2.2", - "_inBundle": false, - "_integrity": "sha512-l25w6Sy+Iy3/IbogunxhWwljPaDnqpiKvrQRoLBm6DfISco7NyRIS7Zf6+Oxhy1T8kHxWdwLND7ZZba6NjXMug==", - "_location": "/url-toolkit", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "url-toolkit@^2.2.1", - "name": "url-toolkit", - "escapedName": "url-toolkit", - "rawSpec": "^2.2.1", - "saveSpec": null, - "fetchSpec": "^2.2.1" - }, - "_requiredBy": [ - "/@videojs/vhs-utils" - ], - "_resolved": "https://registry.npmjs.org/url-toolkit/-/url-toolkit-2.2.2.tgz", - "_shasum": "51ef27b56d3187185f9ecf4a8ac7e8f55203c89d", - "_spec": "url-toolkit@^2.2.1", - "_where": "F:\\Documents\\websites\\BMM\\node_modules\\@videojs\\vhs-utils", - "author": { - "name": "Tom Jenkinson", - "email": "tjcode@outlook.com" - }, - "bugs": { - "url": "https://github.com/tjenkinson/url-toolkit/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Build an absolute URL from a base URL and a relative URL (RFC 1808). No dependencies!", - "devDependencies": { - "husky": "^4.2.5", - "jest": "^26.0.1", - "prettier": "^2.0.5" - }, - "homepage": "https://github.com/tjenkinson/url-toolkit#readme", - "hooks": { - "pre-commit": "npm run prettier" - }, - "keywords": [ - "url", - "relative", - "absolute", - "parser" - ], - "license": "Apache-2.0", - "main": "src/url-toolkit.js", - "name": "url-toolkit", - "repository": { - "type": "git", - "url": "git+https://github.com/tjenkinson/url-toolkit.git" - }, - "scripts": { - "lint": "prettier --check .", - "prettier": "prettier --write .", - "test": "jest" - }, - "types": "src/url-toolkit.d.ts", - "version": "2.2.2" -} diff --git a/node_modules/url-toolkit/src/url-toolkit.d.ts b/node_modules/url-toolkit/src/url-toolkit.d.ts deleted file mode 100644 index 2b2360b..0000000 --- a/node_modules/url-toolkit/src/url-toolkit.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export as namespace URLToolkit; - -export type URLParts = { - scheme: string; - netLoc: string; - path: string; - params: string; - query: string; - fragment: string; -}; - -export function buildAbsoluteURL( - baseURL: string, - relativeURL: string, - opts?: { alwaysNormalize?: boolean } -): string; - -export function parseURL(url: string): URLParts | null; - -export function normalizePath(path: string): string; - -export function buildURLFromParts(parts: URLParts): string; diff --git a/node_modules/url-toolkit/src/url-toolkit.js b/node_modules/url-toolkit/src/url-toolkit.js deleted file mode 100644 index d86091a..0000000 --- a/node_modules/url-toolkit/src/url-toolkit.js +++ /dev/null @@ -1,173 +0,0 @@ -// see https://tools.ietf.org/html/rfc1808 - -(function (root) { - var URL_REGEX = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/; - var FIRST_SEGMENT_REGEX = /^([^\/?#]*)([^]*)$/; - var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g; - var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g; - - var URLToolkit = { - // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or // - // E.g - // With opts.alwaysNormalize = false (default, spec compliant) - // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g - // With opts.alwaysNormalize = true (not spec compliant) - // http://a.com/b/cd + /e/f/../g => http://a.com/e/g - buildAbsoluteURL: function (baseURL, relativeURL, opts) { - opts = opts || {}; - // remove any remaining space and CRLF - baseURL = baseURL.trim(); - relativeURL = relativeURL.trim(); - if (!relativeURL) { - // 2a) If the embedded URL is entirely empty, it inherits the - // entire base URL (i.e., is set equal to the base URL) - // and we are done. - if (!opts.alwaysNormalize) { - return baseURL; - } - var basePartsForNormalise = URLToolkit.parseURL(baseURL); - if (!basePartsForNormalise) { - throw new Error('Error trying to parse base URL.'); - } - basePartsForNormalise.path = URLToolkit.normalizePath( - basePartsForNormalise.path - ); - return URLToolkit.buildURLFromParts(basePartsForNormalise); - } - var relativeParts = URLToolkit.parseURL(relativeURL); - if (!relativeParts) { - throw new Error('Error trying to parse relative URL.'); - } - if (relativeParts.scheme) { - // 2b) If the embedded URL starts with a scheme name, it is - // interpreted as an absolute URL and we are done. - if (!opts.alwaysNormalize) { - return relativeURL; - } - relativeParts.path = URLToolkit.normalizePath(relativeParts.path); - return URLToolkit.buildURLFromParts(relativeParts); - } - var baseParts = URLToolkit.parseURL(baseURL); - if (!baseParts) { - throw new Error('Error trying to parse base URL.'); - } - if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') { - // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc - // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a' - var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path); - baseParts.netLoc = pathParts[1]; - baseParts.path = pathParts[2]; - } - if (baseParts.netLoc && !baseParts.path) { - baseParts.path = '/'; - } - var builtParts = { - // 2c) Otherwise, the embedded URL inherits the scheme of - // the base URL. - scheme: baseParts.scheme, - netLoc: relativeParts.netLoc, - path: null, - params: relativeParts.params, - query: relativeParts.query, - fragment: relativeParts.fragment, - }; - if (!relativeParts.netLoc) { - // 3) If the embedded URL's is non-empty, we skip to - // Step 7. Otherwise, the embedded URL inherits the - // (if any) of the base URL. - builtParts.netLoc = baseParts.netLoc; - // 4) If the embedded URL path is preceded by a slash "/", the - // path is not relative and we skip to Step 7. - if (relativeParts.path[0] !== '/') { - if (!relativeParts.path) { - // 5) If the embedded URL path is empty (and not preceded by a - // slash), then the embedded URL inherits the base URL path - builtParts.path = baseParts.path; - // 5a) if the embedded URL's is non-empty, we skip to - // step 7; otherwise, it inherits the of the base - // URL (if any) and - if (!relativeParts.params) { - builtParts.params = baseParts.params; - // 5b) if the embedded URL's is non-empty, we skip to - // step 7; otherwise, it inherits the of the base - // URL (if any) and we skip to step 7. - if (!relativeParts.query) { - builtParts.query = baseParts.query; - } - } - } else { - // 6) The last segment of the base URL's path (anything - // following the rightmost slash "/", or the entire path if no - // slash is present) is removed and the embedded URL's path is - // appended in its place. - var baseURLPath = baseParts.path; - var newPath = - baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + - relativeParts.path; - builtParts.path = URLToolkit.normalizePath(newPath); - } - } - } - if (builtParts.path === null) { - builtParts.path = opts.alwaysNormalize - ? URLToolkit.normalizePath(relativeParts.path) - : relativeParts.path; - } - return URLToolkit.buildURLFromParts(builtParts); - }, - parseURL: function (url) { - var parts = URL_REGEX.exec(url); - if (!parts) { - return null; - } - return { - scheme: parts[1] || '', - netLoc: parts[2] || '', - path: parts[3] || '', - params: parts[4] || '', - query: parts[5] || '', - fragment: parts[6] || '', - }; - }, - normalizePath: function (path) { - // The following operations are - // then applied, in order, to the new path: - // 6a) All occurrences of "./", where "." is a complete path - // segment, are removed. - // 6b) If the path ends with "." as a complete path segment, - // that "." is removed. - path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, ''); - // 6c) All occurrences of "/../", where is a - // complete path segment not equal to "..", are removed. - // Removal of these path segments is performed iteratively, - // removing the leftmost matching pattern on each iteration, - // until no matching pattern remains. - // 6d) If the path ends with "/..", where is a - // complete path segment not equal to "..", that - // "/.." is removed. - while ( - path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length - ) {} - return path.split('').reverse().join(''); - }, - buildURLFromParts: function (parts) { - return ( - parts.scheme + - parts.netLoc + - parts.path + - parts.params + - parts.query + - parts.fragment - ); - }, - }; - - if (typeof exports === 'object' && typeof module === 'object') - module.exports = URLToolkit; - else if (typeof define === 'function' && define.amd) - define([], function () { - return URLToolkit; - }); - else if (typeof exports === 'object') exports['URLToolkit'] = URLToolkit; - else root['URLToolkit'] = URLToolkit; -})(this); diff --git a/node_modules/url-toolkit/test/url-toolkit.js b/node_modules/url-toolkit/test/url-toolkit.js deleted file mode 100644 index 9e79c0e..0000000 --- a/node_modules/url-toolkit/test/url-toolkit.js +++ /dev/null @@ -1,309 +0,0 @@ -const assert = require('assert'); -const URLToolkit = require('../src/url-toolkit'); - -describe('url toolkit', () => { - describe('works with a selection of valid urls', () => { - // From spec: https://tools.ietf.org/html/rfc1808#section-5.1 - test('http://a/b/c/d;p?q#f', 'g:h', 'g:h'); - test('http://a/b/c/d;p?q#f', 'g', 'http://a/b/c/g'); - test('http://a/b/c/d;p?q#f', './g', 'http://a/b/c/g'); - test('http://a/b/c/d;p?q#f', 'g/', 'http://a/b/c/g/'); - test('http://a/b/c/d;p?q#f', '/g', 'http://a/g'); - test('http://a/b/c/d;p?q#f', '//g', 'http://g'); - test('http://a/b/c/d;p?q#f', '?y', 'http://a/b/c/d;p?y'); - test('http://a/b/c/d;p?q#f', 'g?y', 'http://a/b/c/g?y'); - test('http://a/b/c/d;p?q#f', 'g?y/./x', 'http://a/b/c/g?y/./x'); - test('http://a/b/c/d;p?q#f', '#s', 'http://a/b/c/d;p?q#s'); - test('http://a/b/c/d;p?q#f', 'g#s', 'http://a/b/c/g#s'); - test('http://a/b/c/d;p?q#f', 'g#s/./x', 'http://a/b/c/g#s/./x'); - test('http://a/b/c/d;p?q#f', 'g?y#s', 'http://a/b/c/g?y#s'); - test('http://a/b/c/d;p?q#f', ';x', 'http://a/b/c/d;x'); - test('http://a/b/c/d;p?q#f', 'g;x', 'http://a/b/c/g;x'); - test('http://a/b/c/d;p?q#f', 'g;x?y#s', 'http://a/b/c/g;x?y#s'); - test('http://a/b/c/d;p?q#f', '.', 'http://a/b/c/'); - test('http://a/b/c/d;p?q#f', './', 'http://a/b/c/'); - test('http://a/b/c/d;p?q#f', '..', 'http://a/b/'); - test('http://a/b/c/d;p?q#f', '../', 'http://a/b/'); - test('http://a/b/c/d;p?q#f', '../g', 'http://a/b/g'); - test('http://a/b/c/d;p?q#f', '../..', 'http://a/'); - test('http://a/b/c/d;p?q#f', '../../', 'http://a/'); - test('http://a/b/c/d;p?q#f', '../../g', 'http://a/g'); - - test('http://a/b/c/d;p?q#f', '', 'http://a/b/c/d;p?q#f'); - test('http://a/b/c/d;p?q#f', '../../../g', 'http://a/../g'); - test('http://a/b/c/d;p?q#f', '../../../../g', 'http://a/../../g'); - test('http://a/b/c/d;p?q#f', '/./g', 'http://a/./g'); - test('http://a/b/c/d;p?q#f', '/../g', 'http://a/../g'); - test('http://a/b/c/d;p?q#f', 'g.', 'http://a/b/c/g.'); - test('http://a/b/c/d;p?q#f', '.g', 'http://a/b/c/.g'); - test('http://a/b/c/d;p?q#f', 'g..', 'http://a/b/c/g..'); - test('http://a/b/c/d;p?q#f', '..g', 'http://a/b/c/..g'); - test('http://a/b/c/d;p?q#f', './../g', 'http://a/b/g'); - test('http://a/b/c/d;p?q#f', './g/.', 'http://a/b/c/g/'); - test('http://a/b/c/d;p?q#f', 'g/./h', 'http://a/b/c/g/h'); - test('http://a/b/c/d;p?q#f', 'g/../h', 'http://a/b/c/h'); - - test('http://a/b/c/d;p?q#f', 'http:g', 'http:g'); - test('http://a/b/c/d;p?q#f', 'http:', 'http:'); - - // Custom - test( - 'http://a.com/b/cd/./e.m3u8?test=1#something', - '', - 'http://a.com/b/cd/./e.m3u8?test=1#something' - ); - test( - 'http://a.com/b/cd/./e.m3u8?test=1#something', - '', - 'http://a.com/b/cd/e.m3u8?test=1#something', - { alwaysNormalize: true } - ); - - test( - 'http://a.com/b/cd/e.m3u8', - 'https://example.com/z.ts', - 'https://example.com/z.ts' - ); - test('http://a.com/b/cd/e.m3u8', 'g:h', 'g:h'); - test( - 'http://a.com/b/cd/e.m3u8', - 'https://example.com:8080/z.ts', - 'https://example.com:8080/z.ts' - ); - - test('http://a.com/b/cd/e.m3u8', 'z.ts', 'http://a.com/b/cd/z.ts'); - test( - 'http://a.com:8080/b/cd/e.m3u8', - 'z.ts', - 'http://a.com:8080/b/cd/z.ts' - ); - test('http://a.com/b/cd/', 'z.ts', 'http://a.com/b/cd/z.ts'); - test('http://a.com/b/cd', 'z.ts', 'http://a.com/b/z.ts'); - test('http://a.com/', 'z.ts', 'http://a.com/z.ts'); - test('http://a.com/?test=1', 'z.ts', 'http://a.com/z.ts'); - test('http://a.com', 'z.ts', 'http://a.com/z.ts'); - test('http://a.com?test=1', 'z.ts', 'http://a.com/z.ts'); - test('http://a.com/b/cd?test=1', 'z.ts', 'http://a.com/b/z.ts'); - test('http://a.com/b/cd#something', 'z.ts', 'http://a.com/b/z.ts'); - test('http://a.com/b/cd?test=1#something', 'z.ts', 'http://a.com/b/z.ts'); - test( - 'http://a.com/b/cd?test=1#something', - 'z.ts?abc=1', - 'http://a.com/b/z.ts?abc=1' - ); - test( - 'http://a.com/b/cd?test=1#something', - 'z.ts#test', - 'http://a.com/b/z.ts#test' - ); - test( - 'http://a.com/b/cd?test=1#something', - 'z.ts?abc=1#test', - 'http://a.com/b/z.ts?abc=1#test' - ); - - test('http://a.com/b/cd?test=1#something', ';x', 'http://a.com/b/cd;x'); - test('http://a.com/b/cd?test=1#something', './;x', 'http://a.com/b/;x'); - test('http://a.com/b/cd?test=1#something', 'g;x', 'http://a.com/b/g;x'); - test('http://a_b.com/b/cd?test=1#something', 'g;x', 'http://a_b.com/b/g;x'); - test('http://a-b.com/b/cd?test=1#something', 'g;x', 'http://a-b.com/b/g;x'); - test('http://a.b.com/b/cd?test=1#something', 'g;x', 'http://a.b.com/b/g;x'); - test('http://a~b.com/b/cd?test=1#something', 'g;x', 'http://a~b.com/b/g;x'); - - test('a.com', 'z.ts', 'a.com/z.ts'); - test('a.com/', 'z.ts', 'a.com/z.ts'); - test('a.com/b/cd', 'z.ts', 'a.com/b/z.ts'); - test('a.com/b/cd', '../z.ts', 'a.com/z.ts'); - test('a.com/b/cd', '/z.ts', 'a.com/z.ts'); - test('a.com/b/cd', '/b/z.ts', 'a.com/b/z.ts'); - - test( - 'http://a.com/b/cd/e.m3u8?test=1#something', - 'subdir/z.ts?abc=1#test', - 'http://a.com/b/cd/subdir/z.ts?abc=1#test' - ); - test( - 'http://a.com/b/cd/e.m3u8?test=1#something', - '/subdir/z.ts?abc=1#test', - 'http://a.com/subdir/z.ts?abc=1#test' - ); - test( - 'http://a.com/b/cd/e.m3u8?test=1#something', - '//example.com/z.ts?abc=1#test', - 'http://example.com/z.ts?abc=1#test' - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - '//example.com/z.ts?abc=1#test', - 'https://example.com/z.ts?abc=1#test' - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - './z.ts?abc=1#test', - 'https://a.com/b/cd/z.ts?abc=1#test' - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - '../z.ts?abc=1#test', - 'https://a.com/b/z.ts?abc=1#test' - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - './../z.ts?abc=1#test', - 'https://a.com/b/z.ts?abc=1#test' - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - '././z.ts?abc=1#test', - 'https://a.com/b/cd/z.ts?abc=1#test' - ); - test( - 'https://a.com/b/cd/e/f.m3u8?test=1#something', - '../../z.ts?abc=1#test', - 'https://a.com/b/z.ts?abc=1#test' - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - '../../z.ts?abc=1#test', - 'https://a.com/z.ts?abc=1#test' - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - '../../z.ts?abc=1&something=blah/./../test#test', - 'https://a.com/z.ts?abc=1&something=blah/./../test#test' - ); - test( - 'https://a.com/b/cd/e/f.m3u8?test=1#something', - './../../z.ts?abc=1#test', - 'https://a.com/b/z.ts?abc=1#test' - ); - - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - 'subdir/pointless/../z.ts?abc=1#test', - 'https://a.com/b/cd/subdir/z.ts?abc=1#test' - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - '/subdir/pointless/../z.ts?abc=1#test', - 'https://a.com/subdir/z.ts?abc=1#test', - { alwaysNormalize: true } - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - '/subdir/pointless/../z.ts?abc=1#test', - 'https://a.com/subdir/pointless/../z.ts?abc=1#test' - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - '//example.com/subdir/pointless/../z.ts?abc=1#test', - 'https://example.com/subdir/z.ts?abc=1#test', - { alwaysNormalize: true } - ); - test( - 'https://a.com/b/cd/e.m3u8?test=1#something', - '//example.com/subdir/pointless/../z.ts?abc=1#test', - 'https://example.com/subdir/pointless/../z.ts?abc=1#test' - ); - - test( - 'https://a-b.something.com/b/cd/e.m3u8?test=1#something', - '//example.com/subdir/pointless/../z.ts?abc=1#test', - 'https://example.com/subdir/z.ts?abc=1#test', - { alwaysNormalize: true } - ); - test( - 'https://a-b.something.com/b/cd/e.m3u8?test=1#something', - '//example.com/subdir/pointless/../z.ts?abc=1#test', - 'https://example.com/subdir/pointless/../z.ts?abc=1#test' - ); - - test( - '//a.com/b/cd/e.m3u8', - 'https://example.com/z.ts', - 'https://example.com/z.ts' - ); - test('//a.com/b/cd/e.m3u8', '//example.com/z.ts', '//example.com/z.ts'); - test( - '//a.com/b/cd/e.m3u8', - '/example.com/z.ts', - '//a.com/example.com/z.ts' - ); - test('//a.com/b/cd/e.m3u8', 'g:h', 'g:h'); - test( - '//a.com/b/cd/e.m3u8', - 'https://example.com:8080/z.ts', - 'https://example.com:8080/z.ts' - ); - test('//a.com/b/cd/e.m3u8', 'z.ts', '//a.com/b/cd/z.ts'); - test('//a.com/b/cd/e.m3u8', '../../z.ts', '//a.com/z.ts'); - - test('//a.com/b/cd/e.m3u8', '../../../z.ts', '//a.com/../z.ts'); - - test( - '/a/b/cd/e.m3u8', - 'https://example.com/z.ts', - 'https://example.com/z.ts' - ); - test('/a/b/cd/e.m3u8', '/example.com/z.ts', '/example.com/z.ts'); - test('/a/b/cd/e.m3u8', '//example.com/z.ts', '//example.com/z.ts'); - test('/a/b/cd/e.m3u8', 'g:h', 'g:h'); - test( - '/a/b/cd/e.m3u8', - 'https://example.com:8080/z.ts', - 'https://example.com:8080/z.ts' - ); - test('/a/b/cd/e.m3u8', 'z.ts', '/a/b/cd/z.ts'); - test('/a/b/cd/e.m3u8', '../../../z.ts', '/z.ts'); - - test('http://ö.de/a/b', 'z.ts', 'http://ö.de/a/z.ts'); - test('http://ö.de/a', 'z.ts', 'http://ö.de/z.ts'); - test('http://ö.de/', 'z.ts', 'http://ö.de/z.ts'); - test('http://ö.de', 'z.ts', 'http://ö.de/z.ts'); - test('ö.de', 'z.ts', 'ö.de/z.ts'); - - test('http://a/b/c/d;p?q', './', 'http://a/b/c/'); - test('http://a/b/c/d;p?q', '.', 'http://a/b/c/'); - test('http://a/b/c/d;p?q', '../', 'http://a/b/'); - test('http://a/b/c/d;p?q', '..', 'http://a/b/'); - - test( - 'http://a.com/b/cd/e.m3u8?test=1#something', - '', - 'http://a.com/b/cd/e.m3u8?test=1#something' - ); - - test( - 'http://a.com/b/cd/e.m3u8?test=1#something', - 'a_:b', - 'http://a.com/b/cd/a_:b' - ); - test('http://a.com/b/cd/e.m3u8?test=1#something', 'a:b', 'a:b'); - test( - 'http://a.com/b/cd/e.m3u8?test=1#something', - './a:b', - 'http://a.com/b/cd/a:b' - ); - - test( - 'http://a.com/expiretime=111;dirmatch=true/master.m3u8', - './a:b', - 'http://a.com/expiretime=111;dirmatch=true/a:b' - ); - - test('http://0.0.0.0/a/b.c', 'd', 'http://0.0.0.0/a/d'); - test('http://[0:0:0:0::0]/a/b.c', 'd', 'http://[0:0:0:0::0]/a/d'); - - test('http://example.com/', 'a#\nb', 'http://example.com/a#\nb'); - }); -}); - -function test(base, relative, expected, opts) { - opts = opts || {}; - it(`"${base}" + "${relative}" ${JSON.stringify(opts)}`, () => { - assert.strictEqual( - URLToolkit.buildAbsoluteURL(base, relative, opts), - expected - ); - }); -} diff --git a/node_modules/video.js/CHANGELOG.md b/node_modules/video.js/CHANGELOG.md deleted file mode 100644 index cf2acc6..0000000 --- a/node_modules/video.js/CHANGELOG.md +++ /dev/null @@ -1,3313 +0,0 @@ -
    -## [7.13.3](https://github.com/videojs/video.js/compare/v7.13.2...v7.13.3) (2021-06-23) - -### Chores - -* republish with VHS 2.9.1 ([4b50f82](https://github.com/videojs/video.js/commit/4b50f82)) - - -## [7.13.2](https://github.com/videojs/video.js/compare/v7.13.1...v7.13.2) (2021-06-22) - -### Bug Fixes - -* **package:** update to VHS 2.9.1 ([#7284](https://github.com/videojs/video.js/issues/7284)) ([cee5fa3](https://github.com/videojs/video.js/commit/cee5fa3)), closes [#7230](https://github.com/videojs/video.js/issues/7230) - - -## [7.13.1](https://github.com/videojs/video.js/compare/v7.13.0...v7.13.1) (2021-06-14) - -### Bug Fixes - -* do a null check on playbackRates player method ([#7273](https://github.com/videojs/video.js/issues/7273)) ([6888798](https://github.com/videojs/video.js/commit/6888798)) - - -# [7.13.0](https://github.com/videojs/video.js/compare/v7.12.4...v7.13.0) (2021-06-11) - -### Features - -* Add helper classes for 9:16 and 1:1 ([#7219](https://github.com/videojs/video.js/issues/7219)) ([35ad17a](https://github.com/videojs/video.js/commit/35ad17a)) -* Add normalizeAutoplay option to treat autoplay: true as autoplay: "play" ([#7190](https://github.com/videojs/video.js/issues/7190)) ([b4ad93a](https://github.com/videojs/video.js/commit/b4ad93a)) -* Add option to use full window mode instead of using tech's fullscreen ([#7218](https://github.com/videojs/video.js/issues/7218)) ([b86f083](https://github.com/videojs/video.js/commit/b86f083)) -* update to VHS[@2](https://github.com/2).9.0 and mpd-parser[@0](https://github.com/0).17.0 ([#7269](https://github.com/videojs/video.js/issues/7269)) ([2ea05b4](https://github.com/videojs/video.js/commit/2ea05b4)) -* **package:** add VHS deps as Video.js deps ([#7263](https://github.com/videojs/video.js/issues/7263)) ([39de502](https://github.com/videojs/video.js/commit/39de502)), closes [#7091](https://github.com/videojs/video.js/issues/7091) [#7209](https://github.com/videojs/video.js/issues/7209) [#7144](https://github.com/videojs/video.js/issues/7144) [#7109](https://github.com/videojs/video.js/issues/7109) -* **player:** Add playbackRates() method ([#7228](https://github.com/videojs/video.js/issues/7228)) ([6259ef7](https://github.com/videojs/video.js/commit/6259ef7)), closes [#7198](https://github.com/videojs/video.js/issues/7198) - -### Documentation - -* Fix typo in CONTRIBUTING.md ([#7260](https://github.com/videojs/video.js/issues/7260)) ([380a9b5](https://github.com/videojs/video.js/commit/380a9b5)) - - -## [7.12.4](https://github.com/videojs/video.js/compare/v7.12.3...v7.12.4) (2021-06-02) - -### Bug Fixes - -* allow Video.js to be required in an env without setTimeout ([#7247](https://github.com/videojs/video.js/issues/7247)) ([8082c5a](https://github.com/videojs/video.js/commit/8082c5a)) -* **player:** accept data for fullscreenchange and error events from the tech ([#7254](https://github.com/videojs/video.js/issues/7254)) ([41d5eb3](https://github.com/videojs/video.js/commit/41d5eb3)) -* **seek-bar:** remove event listener on dispose ([#7258](https://github.com/videojs/video.js/issues/7258)) ([c70c298](https://github.com/videojs/video.js/commit/c70c298)) - -### Chores - -* **component:** update comment around triggering ready in component ([#7256](https://github.com/videojs/video.js/issues/7256)) ([11ac0b9](https://github.com/videojs/video.js/commit/11ac0b9)) -* Update sass and remove now deprecated / for division. ([#7253](https://github.com/videojs/video.js/issues/7253)) ([b3503c9](https://github.com/videojs/video.js/commit/b3503c9)), closes [#7244](https://github.com/videojs/video.js/issues/7244) - - -## [7.12.3](https://github.com/videojs/video.js/compare/v7.12.2...v7.12.3) (2021-05-20) - -### Bug Fixes - -* update to VHS 2.8.2 ([#7242](https://github.com/videojs/video.js/issues/7242)) ([f528767](https://github.com/videojs/video.js/commit/f528767)), closes [#7240](https://github.com/videojs/video.js/issues/7240) - -### Chores - -* revert back to gh-release[@3](https://github.com/3).5.0 for now ([#7241](https://github.com/videojs/video.js/issues/7241)) ([a4c9b12](https://github.com/videojs/video.js/commit/a4c9b12)) - - -## [7.12.2](https://github.com/videojs/video.js/compare/v7.12.1...v7.12.2) (2021-05-19) - -### Bug Fixes - -* update to VHS 2.8.1 ([#7238](https://github.com/videojs/video.js/issues/7238)) ([c4cfa55](https://github.com/videojs/video.js/commit/c4cfa55)) -* **utils:** add try and catch for computedStyle ([#7214](https://github.com/videojs/video.js/issues/7214)) ([90ce2d7](https://github.com/videojs/video.js/commit/90ce2d7)) -* Better text for exit fullscreen ([#7183](https://github.com/videojs/video.js/issues/7183)) ([0e46624](https://github.com/videojs/video.js/commit/0e46624)) -* Don't hide menus with one item and a title ([#7215](https://github.com/videojs/video.js/issues/7215)) ([d4a08de](https://github.com/videojs/video.js/commit/d4a08de)) -* exit full window mode with Esc key ([#7224](https://github.com/videojs/video.js/issues/7224)) ([e9953e5](https://github.com/videojs/video.js/commit/e9953e5)) -* incorrect focus styles on selected MenuItem ([#7202](https://github.com/videojs/video.js/issues/7202)) ([06cdb6f](https://github.com/videojs/video.js/commit/06cdb6f)), closes [#7200](https://github.com/videojs/video.js/issues/7200) -* make Playback Rate control work better with screen readers ([#7193](https://github.com/videojs/video.js/issues/7193)) ([17919ce](https://github.com/videojs/video.js/commit/17919ce)), closes [#7121](https://github.com/videojs/video.js/issues/7121) -* silence play promise in the play toggle. ([#7189](https://github.com/videojs/video.js/issues/7189)) ([2c6e439](https://github.com/videojs/video.js/commit/2c6e439)), closes [#6998](https://github.com/videojs/video.js/issues/6998) -* user and programmatic seeks with live streams ([#7210](https://github.com/videojs/video.js/issues/7210)) ([39485fc](https://github.com/videojs/video.js/commit/39485fc)) - -### Chores - -* update 'global' package in dependencies ([#7213](https://github.com/videojs/video.js/issues/7213)) ([cb1d29b](https://github.com/videojs/video.js/commit/cb1d29b)) -* update node/nvmrc and various dependencies ([#7221](https://github.com/videojs/video.js/issues/7221)) ([90f3e39](https://github.com/videojs/video.js/commit/90f3e39)), closes [#7216](https://github.com/videojs/video.js/issues/7216) [#6933](https://github.com/videojs/video.js/issues/6933) [#6924](https://github.com/videojs/video.js/issues/6924) [#7179](https://github.com/videojs/video.js/issues/7179) - - -## [7.12.1](https://github.com/videojs/video.js/compare/v7.12.0...v7.12.1) (2021-04-13) - -### Bug Fixes - -* **package:** remove remove ([#7177](https://github.com/videojs/video.js/issues/7177)) ([9abba58](https://github.com/videojs/video.js/commit/9abba58)), closes [#7176](https://github.com/videojs/video.js/issues/7176) -* **package:** update vtt.js to allow server-side-rendering ([#7178](https://github.com/videojs/video.js/issues/7178)) ([a3bfeb7](https://github.com/videojs/video.js/commit/a3bfeb7)) -* **package:** upgrade VHS to 2.7.1 ([#7174](https://github.com/videojs/video.js/issues/7174)) ([f0d69cd](https://github.com/videojs/video.js/commit/f0d69cd)) - - -# [7.12.0](https://github.com/videojs/video.js/compare/v7.11.8...v7.12.0) (2021-04-07) - -### Features - -* **package:** update VHS to 2.7.0 ([#7164](https://github.com/videojs/video.js/issues/7164)) ([0d47306](https://github.com/videojs/video.js/commit/0d47306)) -* Add a mouse volume tooltip ([#6824](https://github.com/videojs/video.js/issues/6824)) ([b2edfd2](https://github.com/videojs/video.js/commit/b2edfd2)) -* Add a player option `noUITitleAttributes` to prevent title attributes in the UI ([#7134](https://github.com/videojs/video.js/issues/7134)) ([5f59391](https://github.com/videojs/video.js/commit/5f59391)), closes [#6767](https://github.com/videojs/video.js/issues/6767) -* enable responsive controls on fullscreen ([#7098](https://github.com/videojs/video.js/issues/7098)) ([239c9a1](https://github.com/videojs/video.js/commit/239c9a1)) -* retry on error ([#7038](https://github.com/videojs/video.js/issues/7038)) ([22e9843](https://github.com/videojs/video.js/commit/22e9843)), closes [#1805](https://github.com/videojs/video.js/issues/1805) - -### Bug Fixes - -* always have an enabled audio track when switching ([#7163](https://github.com/videojs/video.js/issues/7163)) ([4707ce8](https://github.com/videojs/video.js/commit/4707ce8)) - -### Chores - -* never skip github actions workflows in main ([#7169](https://github.com/videojs/video.js/issues/7169)) ([b6412a3](https://github.com/videojs/video.js/commit/b6412a3)) - -### Performance Improvements - -* wrap prototype methods in handlers in an arrow function ([#7060](https://github.com/videojs/video.js/issues/7060)) ([17a6147](https://github.com/videojs/video.js/commit/17a6147)) - - -## [7.11.8](https://github.com/videojs/video.js/compare/v7.11.7...v7.11.8) (2021-03-23) - -### Bug Fixes - -* remove extra timeupdate event when progress controls is disabled ([#7142](https://github.com/videojs/video.js/issues/7142)) ([b2336aa](https://github.com/videojs/video.js/commit/b2336aa)) - -### Documentation - -* update note about accessing tech ([#7141](https://github.com/videojs/video.js/issues/7141)) ([7d46f44](https://github.com/videojs/video.js/commit/7d46f44)) - - -## [7.11.7](https://github.com/videojs/video.js/compare/v7.11.6...v7.11.7) (2021-03-12) - -### Bug Fixes - -* **package:** update to Video.js HTTP Streaming 2.6.4 ([#7136](https://github.com/videojs/video.js/issues/7136)) ([5f765ad](https://github.com/videojs/video.js/commit/5f765ad)) - - -## [7.11.6](https://github.com/videojs/video.js/compare/v7.11.5...v7.11.6) (2021-03-09) - -### Bug Fixes - -* add display block to all buttons icon placeholder ([#7094](https://github.com/videojs/video.js/issues/7094)) ([45eef66](https://github.com/videojs/video.js/commit/45eef66)), closes [#6989](https://github.com/videojs/video.js/issues/6989) -* clear progress control related rAFs when tab is hidden ([#7099](https://github.com/videojs/video.js/issues/7099)) ([134f039](https://github.com/videojs/video.js/commit/134f039)), closes [#7086](https://github.com/videojs/video.js/issues/7086) -* do not preload default text track if preloadTextTracks is false ([#7021](https://github.com/videojs/video.js/issues/7021)) ([b76e816](https://github.com/videojs/video.js/commit/b76e816)), closes [#7019](https://github.com/videojs/video.js/issues/7019) -* focus-visible shouldn't change background styles ([#7113](https://github.com/videojs/video.js/issues/7113)) ([1b52e7b](https://github.com/videojs/video.js/commit/1b52e7b)) -* **package:** update to videojs/http-streaming 2.6.3 ([#7129](https://github.com/videojs/video.js/issues/7129)) ([8d0c601](https://github.com/videojs/video.js/commit/8d0c601)) -* try enabling liveui on canplay ([#7114](https://github.com/videojs/video.js/issues/7114)) ([3d676d6](https://github.com/videojs/video.js/commit/3d676d6)), closes [#7034](https://github.com/videojs/video.js/issues/7034) - -### Chores - -* update rollup for upcoming vhs changes ([#7075](https://github.com/videojs/video.js/issues/7075)) ([0b46704](https://github.com/videojs/video.js/commit/0b46704)) -* video.js debug build ([#7082](https://github.com/videojs/video.js/issues/7082)) ([ba47953](https://github.com/videojs/video.js/commit/ba47953)) - -### Documentation - -* Add liveTracker options to options guide ([#7097](https://github.com/videojs/video.js/issues/7097)) ([6336e57](https://github.com/videojs/video.js/commit/6336e57)) -* fix broken blogpost urls ([#7106](https://github.com/videojs/video.js/issues/7106)) ([dd0c675](https://github.com/videojs/video.js/commit/dd0c675)) - -### Tests - -* a couple of minor fixes, tweak CI config, swap rollup replace plugin ([#7128](https://github.com/videojs/video.js/issues/7128)) ([fbf34e3](https://github.com/videojs/video.js/commit/fbf34e3)) - - -## [7.11.5](https://github.com/videojs/video.js/compare/v7.11.4...v7.11.5) (2021-02-04) - -### Bug Fixes - -* **dom:** account for translated parent in pointer position on iOS ([#7079](https://github.com/videojs/video.js/issues/7079)) ([542cead](https://github.com/videojs/video.js/commit/542cead)) -* **dom:** stop findPosition at a fullscreenElement ([#7074](https://github.com/videojs/video.js/issues/7074)) ([541f2e5](https://github.com/videojs/video.js/commit/541f2e5)) - - -## [7.11.4](https://github.com/videojs/video.js/compare/v7.11.3...v7.11.4) (2021-01-26) - -### Bug Fixes - -* **evented:** log an error on invalid type ([#7067](https://github.com/videojs/video.js/issues/7067)) ([85575db](https://github.com/videojs/video.js/commit/85575db)), closes [#6982](https://github.com/videojs/video.js/issues/6982) - - -## [7.11.3](https://github.com/videojs/video.js/compare/v7.11.2...v7.11.3) (2021-01-25) - -### Bug Fixes - -* **lang:** Update nn.json ([#7054](https://github.com/videojs/video.js/issues/7054)) ([4a9e1ab](https://github.com/videojs/video.js/commit/4a9e1ab)) -* only preventDefault if event is cancelable ([#7063](https://github.com/videojs/video.js/issues/7063)) ([b13cb07](https://github.com/videojs/video.js/commit/b13cb07)) -* **fs:** make sure handlers are unique per player ([#7035](https://github.com/videojs/video.js/issues/7035)) ([dceedb6](https://github.com/videojs/video.js/commit/dceedb6)), closes [#7013](https://github.com/videojs/video.js/issues/7013) -* **time-display:** fix IE11 appending times instead of replacing ([#7059](https://github.com/videojs/video.js/issues/7059)) ([ed3c54d](https://github.com/videojs/video.js/commit/ed3c54d)) -* better evented validation and error messages ([#6982](https://github.com/videojs/video.js/issues/6982)) ([ffb690a](https://github.com/videojs/video.js/commit/ffb690a)) -* prevent dispose error and text track duplicate listeners ([#6984](https://github.com/videojs/video.js/issues/6984)) ([db46578](https://github.com/videojs/video.js/commit/db46578)) - -### Chores - -* netlify ci demo and docs ([#7045](https://github.com/videojs/video.js/issues/7045)) ([9574bb4](https://github.com/videojs/video.js/commit/9574bb4)) - -### Documentation - -* change master to main ([#7050](https://github.com/videojs/video.js/issues/7050)) ([e240396](https://github.com/videojs/video.js/commit/e240396)) - - -## [7.11.2](https://github.com/videojs/video.js/compare/v7.11.1...v7.11.2) (2021-01-14) - -### Bug Fixes - -* set liveWindow to 0 liveCurrentTime is Infinity ([#7034](https://github.com/videojs/video.js/issues/7034)) ([330c82c](https://github.com/videojs/video.js/commit/330c82c)) -* **player:** Ensure fluid works when dimensions not initially known ([#7023](https://github.com/videojs/video.js/issues/7023)) ([661962c](https://github.com/videojs/video.js/commit/661962c)), closes [#6939](https://github.com/videojs/video.js/issues/6939) - -### Chores - -* **package:** update to [@videojs](https://github.com/videojs)/http-streaming[@2](https://github.com/2).4.2 ([#7042](https://github.com/videojs/video.js/issues/7042)) ([f672af8](https://github.com/videojs/video.js/commit/f672af8)) - -### Documentation - -* Add note to legacy notes ([#7022](https://github.com/videojs/video.js/issues/7022)) ([f87297b](https://github.com/videojs/video.js/commit/f87297b)) -* **faq:** fixup autoplay blogpost url ([#7027](https://github.com/videojs/video.js/issues/7027)) ([a000fed](https://github.com/videojs/video.js/commit/a000fed)), closes [#6905](https://github.com/videojs/video.js/issues/6905) - -### Tests - -* update ci workflow to prevent install failures ([#7041](https://github.com/videojs/video.js/issues/7041)) ([5904ec2](https://github.com/videojs/video.js/commit/5904ec2)) - - -## [7.11.1](https://github.com/videojs/video.js/compare/v7.11.0...v7.11.1) (2020-12-22) - -### Features - -* **lang:** add Slovene language translation ([#6959](https://github.com/videojs/video.js/issues/6959)) ([8476abd](https://github.com/videojs/video.js/commit/8476abd)) - -### Bug Fixes - -* **MapSham:** fix set method to use map property ([#7000](https://github.com/videojs/video.js/issues/7000)) ([a35a121](https://github.com/videojs/video.js/commit/a35a121)) -* **package:** update to [@videojs](https://github.com/videojs)/http-streaming[@2](https://github.com/2).4.1 ([#7010](https://github.com/videojs/video.js/issues/7010)) ([ead775b](https://github.com/videojs/video.js/commit/ead775b)) -* clear readyQueue with dispose ([#6967](https://github.com/videojs/video.js/issues/6967)) ([11d37e2](https://github.com/videojs/video.js/commit/11d37e2)) -* **package:** update to [@videojs](https://github.com/videojs)/http-streaming[@2](https://github.com/2).4.0 ([#6986](https://github.com/videojs/video.js/issues/6986)) ([0631f03](https://github.com/videojs/video.js/commit/0631f03)) -* **time-display:** add a null check for text node ([#6977](https://github.com/videojs/video.js/issues/6977)) ([3e30f83](https://github.com/videojs/video.js/commit/3e30f83)), closes [#6699](https://github.com/videojs/video.js/issues/6699) [#6700](https://github.com/videojs/video.js/issues/6700) -* play progress time tooltip from jittering during live ([#6968](https://github.com/videojs/video.js/issues/6968)) ([799616d](https://github.com/videojs/video.js/commit/799616d)) -* **rollup:** browser globals shouldn't be external ([#6954](https://github.com/videojs/video.js/issues/6954)) ([63752f3](https://github.com/videojs/video.js/commit/63752f3)), closes [#6443](https://github.com/videojs/video.js/issues/6443) [#6272](https://github.com/videojs/video.js/issues/6272) [#6212](https://github.com/videojs/video.js/issues/6212) [#5680](https://github.com/videojs/video.js/issues/5680) - -### Chores - -* move unit test build right below main for faster watch ([#6953](https://github.com/videojs/video.js/issues/6953)) ([5a13e90](https://github.com/videojs/video.js/commit/5a13e90)) - -### Documentation - -* Remove Flash ([#6994](https://github.com/videojs/video.js/issues/6994)) ([503141c](https://github.com/videojs/video.js/commit/503141c)) - - -# [7.11.0](https://github.com/videojs/video.js/compare/v7.10.2...v7.11.0) (2020-11-16) - -### Features - -* **lang:** add thai language translations ([#6945](https://github.com/videojs/video.js/issues/6945)) ([464b971](https://github.com/videojs/video.js/commit/464b971)) -* **tech:** add a scrubbing getter. ([#6920](https://github.com/videojs/video.js/issues/6920)) ([a803484](https://github.com/videojs/video.js/commit/a803484)) -* **track:** make label property mutable and fire a labelchange event when the label is changed ([#6928](https://github.com/videojs/video.js/issues/6928)) ([ee0637c](https://github.com/videojs/video.js/commit/ee0637c)) -* trigger languagechange event on a language change ([#6891](https://github.com/videojs/video.js/issues/6891)) ([a0d09c1](https://github.com/videojs/video.js/commit/a0d09c1)) - -### Bug Fixes - -* cast TOUCH_ENABLED to boolean ([#6943](https://github.com/videojs/video.js/issues/6943)) ([dcce0e9](https://github.com/videojs/video.js/commit/dcce0e9)) -* **css:** set seek to live button's align-items prop to center ([#6942](https://github.com/videojs/video.js/issues/6942)) ([3901ab0](https://github.com/videojs/video.js/commit/3901ab0)) -* always set tabIndex to restore keydown a11y ([#6871](https://github.com/videojs/video.js/issues/6871)) ([0140b28](https://github.com/videojs/video.js/commit/0140b28)), closes [#6145](https://github.com/videojs/video.js/issues/6145) [#6870](https://github.com/videojs/video.js/issues/6870) -* **menu:** focus correct MenuItem on keyboard open ([#6914](https://github.com/videojs/video.js/issues/6914)) ([694fe0f](https://github.com/videojs/video.js/commit/694fe0f)), closes [#6912](https://github.com/videojs/video.js/issues/6912) -* **package:** update to [@videojs](https://github.com/videojs)/http-streaming[@2](https://github.com/2).3.0 ([#6941](https://github.com/videojs/video.js/issues/6941)) ([f74e45b](https://github.com/videojs/video.js/commit/f74e45b)) - -### Chores - -* **sandbox:** switch all urls to https ([#6946](https://github.com/videojs/video.js/issues/6946)) ([ca2d78f](https://github.com/videojs/video.js/commit/ca2d78f)) -* setup Github CI ([#6940](https://github.com/videojs/video.js/issues/6940)) ([6a28562](https://github.com/videojs/video.js/commit/6a28562)) - -### Documentation - -* change blog links to most recent blog version, fix typo ([#6904](https://github.com/videojs/video.js/issues/6904)) ([8617530](https://github.com/videojs/video.js/commit/8617530)) - - -## [7.10.2](https://github.com/videojs/video.js/compare/v7.10.1...v7.10.2) (2020-11-04) - -### Bug Fixes - -* **package:** update to VHS 2.2.4 ([#6925](https://github.com/videojs/video.js/issues/6925)) ([9d9bbfe](https://github.com/videojs/video.js/commit/9d9bbfe)), closes [#6909](https://github.com/videojs/video.js/issues/6909) - - -## [7.10.1](https://github.com/videojs/video.js/compare/v7.10.0...v7.10.1) (2020-10-15) - - -# [7.10.0](https://github.com/videojs/video.js/compare/v7.9.7...v7.10.0) (2020-10-14) - -### Features - -* update to [@videojs](https://github.com/videojs)/http-streaming[@2](https://github.com/2).2.3 ([#6867](https://github.com/videojs/video.js/issues/6867)) ([4a6a46a](https://github.com/videojs/video.js/commit/4a6a46a)) - - -## [7.9.7](https://github.com/videojs/video.js/compare/v7.9.6...v7.9.7) (2020-10-06) - -### Bug Fixes - -* **text-track:** don't overlap captions when font-size changes ([#6874](https://github.com/videojs/video.js/issues/6874)) ([affc061](https://github.com/videojs/video.js/commit/affc061)), closes [/github.com/videojs/video.js/commit/4e5c28cc561487ff29394d19dce3a420675e4f9d#diff-8169d53aa7eee6cab5f85b6641ef3117R176](https://github.com//github.com/videojs/video.js/commit/4e5c28cc561487ff29394d19dce3a420675e4f9d/issues/diff-8169d53aa7eee6cab5f85b6641ef3117R176) - - -## [7.9.6](https://github.com/videojs/video.js/compare/v7.9.5...v7.9.6) (2020-10-01) - -### Bug Fixes - -* **dom:** vertical getPointerPosition value ([#6864](https://github.com/videojs/video.js/issues/6864)) ([1963086](https://github.com/videojs/video.js/commit/1963086)), closes [#5773](https://github.com/videojs/video.js/issues/5773) [#6863](https://github.com/videojs/video.js/issues/6863) - -### Documentation - -* Fix simple typo, intial -> initial ([#6851](https://github.com/videojs/video.js/issues/6851)) ([f22ead1](https://github.com/videojs/video.js/commit/f22ead1)) - - -## [7.9.5](https://github.com/videojs/video.js/compare/v7.9.4...v7.9.5) (2020-09-10) - - -## [7.9.4](https://github.com/videojs/video.js/compare/v7.9.3...v7.9.4) (2020-09-10) - -### Bug Fixes - -* Better mouse position handling ([#5773](https://github.com/videojs/video.js/issues/5773)) ([c4c8fc1](https://github.com/videojs/video.js/commit/c4c8fc1)), closes [#6726](https://github.com/videojs/video.js/issues/6726) [#1102](https://github.com/videojs/video.js/issues/1102) - -### Chores - -* **package:** Update [@videojs](https://github.com/videojs)/http-streaming to 1.13.4 ([#6839](https://github.com/videojs/video.js/issues/6839)) ([7192be6](https://github.com/videojs/video.js/commit/7192be6)), closes [#6812](https://github.com/videojs/video.js/issues/6812) - - -## [7.9.3](https://github.com/videojs/video.js/compare/v7.9.2...v7.9.3) (2020-08-17) - -### Bug Fixes - -* **lang:** Add PiP to de ([#6803](https://github.com/videojs/video.js/issues/6803)) ([88850e9](https://github.com/videojs/video.js/commit/88850e9)) -* **tech:** add abstract setScrubbing in tech.js ([#6808](https://github.com/videojs/video.js/issues/6808)) ([c91b510](https://github.com/videojs/video.js/commit/c91b510)) - -### Documentation - -* **README:** fix link to getting Video.js from npm ([#6761](https://github.com/videojs/video.js/issues/6761)) ([efa839b](https://github.com/videojs/video.js/commit/efa839b)) -* fix typo ([#6760](https://github.com/videojs/video.js/issues/6760)) ([1761fa5](https://github.com/videojs/video.js/commit/1761fa5)) - - -## [7.9.2](https://github.com/videojs/video.js/compare/v7.9.1...v7.9.2) (2020-07-20) - -### Bug Fixes - -* **tech:** add abstract crossOrigin method on Tech ([#6765](https://github.com/videojs/video.js/issues/6765)) ([245efac](https://github.com/videojs/video.js/commit/245efac)), closes [#6588](https://github.com/videojs/video.js/issues/6588) - - -## [7.9.1](https://github.com/videojs/video.js/compare/v7.9.0...v7.9.1) (2020-07-13) - -### Bug Fixes - -* limit fastSeek to Safari based browsers only ([#6752](https://github.com/videojs/video.js/issues/6752)) ([94bea35](https://github.com/videojs/video.js/commit/94bea35)), closes [#6722](https://github.com/videojs/video.js/issues/6722) - - -# [7.9.0](https://github.com/videojs/video.js/compare/v7.8.1...v7.9.0) (2020-07-10) - -### Features - -* Add a default, plugin-specific logger to advanced plugins ([#6693](https://github.com/videojs/video.js/issues/6693)) ([f6a66e6](https://github.com/videojs/video.js/commit/f6a66e6)) -* add debug mode ([#6687](https://github.com/videojs/video.js/issues/6687)) ([3d505ef](https://github.com/videojs/video.js/commit/3d505ef)) -* Add named requestAnimationFrame to prevent performance issues ([#6627](https://github.com/videojs/video.js/issues/6627)) ([6e7cc75](https://github.com/videojs/video.js/commit/6e7cc75)), closes [#5937](https://github.com/videojs/video.js/issues/5937) -* Add support for CAF, FLAC and WAV formats in known mimetypes ([#6657](https://github.com/videojs/video.js/issues/6657)) ([8d462bc](https://github.com/videojs/video.js/commit/8d462bc)), closes [#5982](https://github.com/videojs/video.js/issues/5982) -* adds disablePictureInPicture method to the player API. ([#6378](https://github.com/videojs/video.js/issues/6378)) ([dbd5203](https://github.com/videojs/video.js/commit/dbd5203)) -* support fastSeek during scrubbing if available ([#6525](https://github.com/videojs/video.js/issues/6525)) ([8c66c58](https://github.com/videojs/video.js/commit/8c66c58)) - -### Bug Fixes - -* add PiP to zh-CN.json ([#6680](https://github.com/videojs/video.js/issues/6680)) ([d90569f](https://github.com/videojs/video.js/commit/d90569f)) -* addChild with index should allow for children that are elements ([#6644](https://github.com/videojs/video.js/issues/6644)) ([0b91f74](https://github.com/videojs/video.js/commit/0b91f74)), closes [#6297](https://github.com/videojs/video.js/issues/6297) -* Disable PIP if tech doesn't support it ([#6678](https://github.com/videojs/video.js/issues/6678)) ([907d1cd](https://github.com/videojs/video.js/commit/907d1cd)), closes [#6398](https://github.com/videojs/video.js/issues/6398) -* Fullscreen broken in iOS ([#6735](https://github.com/videojs/video.js/issues/6735)) ([fdd807b](https://github.com/videojs/video.js/commit/fdd807b)), closes [#6707](https://github.com/videojs/video.js/issues/6707) [#6684](https://github.com/videojs/video.js/issues/6684) [#6645](https://github.com/videojs/video.js/issues/6645) -* Use clamp correctly in progress control ([#6625](https://github.com/videojs/video.js/issues/6625)) ([cad9114](https://github.com/videojs/video.js/commit/cad9114)) -* **fs:** don't set player element css props on native fullscreen ([#6673](https://github.com/videojs/video.js/issues/6673)) ([d6b07f0](https://github.com/videojs/video.js/commit/d6b07f0)), closes [#6640](https://github.com/videojs/video.js/issues/6640) -* **lang:** Update pt-BR.json ([#6598](https://github.com/videojs/video.js/issues/6598)) ([90e2b0f](https://github.com/videojs/video.js/commit/90e2b0f)) -* **package:** update to [@videojs](https://github.com/videojs)/http-streaming[@1](https://github.com/1).13.3 ([#6610](https://github.com/videojs/video.js/issues/6610)) ([f779bad](https://github.com/videojs/video.js/commit/f779bad)) -* **text-tracks:** set withCredentials on XHR if crossOrigin='use-credentials' ([#6588](https://github.com/videojs/video.js/issues/6588)) ([a4ea1f9](https://github.com/videojs/video.js/commit/a4ea1f9)), closes [#6587](https://github.com/videojs/video.js/issues/6587) - -### Chores - -* Remove "flash" and add "dash" in keywords about video.js ([#6692](https://github.com/videojs/video.js/issues/6692)) ([4d9e1bc](https://github.com/videojs/video.js/commit/4d9e1bc)), closes [#6603](https://github.com/videojs/video.js/issues/6603) -* update travis-ci badge ([2e61990](https://github.com/videojs/video.js/commit/2e61990)) - -### Documentation - -* **faq:** update FAQ about HLS and DASH with VHS ([#6608](https://github.com/videojs/video.js/issues/6608)) ([808d818](https://github.com/videojs/video.js/commit/808d818)), closes [#6590](https://github.com/videojs/video.js/issues/6590) -* **README:** Update CDN version urls ([#6658](https://github.com/videojs/video.js/issues/6658)) ([756fbfc](https://github.com/videojs/video.js/commit/756fbfc)) - -### Tests - -* skip requestPictureInPicture test if API isn't available ([#6719](https://github.com/videojs/video.js/issues/6719)) ([6d2e52a](https://github.com/videojs/video.js/commit/6d2e52a)) - - -## [7.8.1](https://github.com/videojs/video.js/compare/v7.8.0...v7.8.1) (2020-04-16) - -### Bug Fixes - -* update being called on seekbar during dispose ([#6576](https://github.com/videojs/video.js/issues/6576)) ([3ac11d0](https://github.com/videojs/video.js/commit/3ac11d0)) - -### Documentation - -* **angular:** fix demo for angular v8+. ([#6581](https://github.com/videojs/video.js/issues/6581)) ([8f930c5](https://github.com/videojs/video.js/commit/8f930c5)) - - -# [7.8.0](https://github.com/videojs/video.js/compare/v7.7.6...v7.8.0) (2020-04-06) - -### Features - -* **cors:** allow both crossOrigin and crossorigin method and options ([#6571](https://github.com/videojs/video.js/issues/6571)) ([f711ddc](https://github.com/videojs/video.js/commit/f711ddc)), closes [#6533](https://github.com/videojs/video.js/issues/6533) -* Add a function for getting descendants from components ([#6519](https://github.com/videojs/video.js/issues/6519)) ([47ba704](https://github.com/videojs/video.js/commit/47ba704)) -* **fs:** return a promise from requestFullscreen and exitFullscreen when we can ([#6424](https://github.com/videojs/video.js/issues/6424)) ([da37fab](https://github.com/videojs/video.js/commit/da37fab)) -* Improve currentTime to allow it to be called before player is ready ([#6507](https://github.com/videojs/video.js/issues/6507)) ([768adb1](https://github.com/videojs/video.js/commit/768adb1)) - -### Bug Fixes - -* **lang:** update zn-CH translations ([#6546](https://github.com/videojs/video.js/issues/6546)) ([a8d4d82](https://github.com/videojs/video.js/commit/a8d4d82)) -* **liveui:** tweaks to prevent jitter ([#6405](https://github.com/videojs/video.js/issues/6405)) ([668c7f4](https://github.com/videojs/video.js/commit/668c7f4)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.13.0 🚀 ([#6547](https://github.com/videojs/video.js/issues/6547)) ([8dc1e6f](https://github.com/videojs/video.js/commit/8dc1e6f)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.13.1 🚀 ([#6548](https://github.com/videojs/video.js/issues/6548)) ([1dd06a2](https://github.com/videojs/video.js/commit/1dd06a2)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.13.2 🚀 ([#6558](https://github.com/videojs/video.js/issues/6558)) ([6d18c40](https://github.com/videojs/video.js/commit/6d18c40)) - -### Chores - -* **package:** update rollup to version 2.2.0 🚀 ([#6542](https://github.com/videojs/video.js/issues/6542)) ([2997b80](https://github.com/videojs/video.js/commit/2997b80)) - - -## [7.7.6](https://github.com/videojs/video.js/compare/v7.7.5...v7.7.6) (2020-03-25) - -### Bug Fixes - -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.12.3 🚀 ([#6527](https://github.com/videojs/video.js/issues/6527)) ([0a7aba3](https://github.com/videojs/video.js/commit/0a7aba3)) -* add a threshold of 30s for the liveui to show ([#6409](https://github.com/videojs/video.js/issues/6409)) ([47349c8](https://github.com/videojs/video.js/commit/47349c8)) -* detect chromium-based Edge ([#6497](https://github.com/videojs/video.js/issues/6497)) ([749ef54](https://github.com/videojs/video.js/commit/749ef54)) -* DRM content goes black in IE/Edge when focus is placed on video element ([#6508](https://github.com/videojs/video.js/issues/6508)) ([cc2b82b](https://github.com/videojs/video.js/commit/cc2b82b)), closes [#6318](https://github.com/videojs/video.js/issues/6318) -* fix a typo in en translation file ([#6505](https://github.com/videojs/video.js/issues/6505)) ([5682f14](https://github.com/videojs/video.js/commit/5682f14)) -* trigger change events on remoteTextTrack when nativeTextTrack is set to true ([#6410](https://github.com/videojs/video.js/issues/6410)) ([52c181d](https://github.com/videojs/video.js/commit/52c181d)) -* **lang:** improve Persian translation ([#6468](https://github.com/videojs/video.js/issues/6468)) ([31ac9d7](https://github.com/videojs/video.js/commit/31ac9d7)) - -### Chores - -* **package:** upgrade to babel 7.9 and enable bugfixes ([#6541](https://github.com/videojs/video.js/issues/6541)) ([2c96875](https://github.com/videojs/video.js/commit/2c96875)) - -### Documentation - -* add an example Angular integration ([#6390](https://github.com/videojs/video.js/issues/6390)) ([fce3ad2](https://github.com/videojs/video.js/commit/fce3ad2)) -* **player:** fix addRemoteTextTrack description of manualCleanup option ([#6521](https://github.com/videojs/video.js/issues/6521)) ([d1702d5](https://github.com/videojs/video.js/commit/d1702d5)) - - -## [7.7.5](https://github.com/videojs/video.js/compare/v7.7.4...v7.7.5) (2020-02-19) - -### Bug Fixes - -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.12.2 🚀 ([#6469](https://github.com/videojs/video.js/issues/6469)) ([30d5874](https://github.com/videojs/video.js/commit/30d5874)) -* current time tooltip does not update ([#6445](https://github.com/videojs/video.js/issues/6445)) ([e6c03c7](https://github.com/videojs/video.js/commit/e6c03c7)) -* **lang:** add missing Arabic translations ([#6435](https://github.com/videojs/video.js/issues/6435)) ([3b0f0b9](https://github.com/videojs/video.js/commit/3b0f0b9)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.12.1 ([#6467](https://github.com/videojs/video.js/issues/6467)) ([e4e8837](https://github.com/videojs/video.js/commit/e4e8837)), closes [#6430](https://github.com/videojs/video.js/issues/6430) -* improves control bar hiding functionality ([#6400](https://github.com/videojs/video.js/issues/6400)) ([6f77778](https://github.com/videojs/video.js/commit/6f77778)), closes [#6391](https://github.com/videojs/video.js/issues/6391) -* slider screenreader value returning as NaN ([#6404](https://github.com/videojs/video.js/issues/6404)) ([7008777](https://github.com/videojs/video.js/commit/7008777)), closes [#5984](https://github.com/videojs/video.js/issues/5984) - -### Chores - -* **travis:** test on ubuntu 18 (bionic) ([#6399](https://github.com/videojs/video.js/issues/6399)) ([9bb7acb](https://github.com/videojs/video.js/commit/9bb7acb)) - -### Code Refactoring - -* support requestFullscreen's promise, better internal handling of events ([#6422](https://github.com/videojs/video.js/issues/6422)) ([8a205d0](https://github.com/videojs/video.js/commit/8a205d0)) -* use Fn.UPDATE_REFRESH_INTERVAL in seekBar & liveTracker ([#6407](https://github.com/videojs/video.js/issues/6407)) ([bcaa869](https://github.com/videojs/video.js/commit/bcaa869)), closes [#6142](https://github.com/videojs/video.js/issues/6142) - - -## [7.7.4](https://github.com/videojs/video.js/compare/v7.7.3...v7.7.4) (2019-12-24) - -### Bug Fixes - -* broken logo link in README and docs ([#6345](https://github.com/videojs/video.js/issues/6345)) ([274299b](https://github.com/videojs/video.js/commit/274299b)), closes [videojs/videojs.com#112](https://github.com/videojs/videojs.com/issues/112) [#6340](https://github.com/videojs/video.js/issues/6340) -* IS_IPAD should be false on iPhone ([#6371](https://github.com/videojs/video.js/issues/6371)) ([917d898](https://github.com/videojs/video.js/commit/917d898)) -* updates seekbar position after mouse up event is triggered. ([#6372](https://github.com/videojs/video.js/issues/6372)) ([cd4076a](https://github.com/videojs/video.js/commit/cd4076a)), closes [#6232](https://github.com/videojs/video.js/issues/6232) [#6234](https://github.com/videojs/video.js/issues/6234) [#6370](https://github.com/videojs/video.js/issues/6370) - -### Reverts - -* Revert "fix(iOS): pause player on suspend or stalled if extra buffer is available ([#6199](https://github.com/videojs/video.js/issues/6199))" ([#6373](https://github.com/videojs/video.js/issues/6373)) ([17d8046](https://github.com/videojs/video.js/commit/17d8046)), closes [#6330](https://github.com/videojs/video.js/issues/6330) - - -## [7.7.3](https://github.com/videojs/video.js/compare/v7.7.2...v7.7.3) (2019-12-02) - -### Chores - -* update package-lock.json ([221497f](https://github.com/videojs/video.js/commit/221497f)) - - -## [7.7.2](https://github.com/videojs/video.js/compare/v7.7.1...v7.7.2) (2019-12-02) - -### Bug Fixes - -* **sass:** import path has cwd once again ([#6326](https://github.com/videojs/video.js/issues/6326)) ([df3c14a](https://github.com/videojs/video.js/commit/df3c14a)) -* turn on strict mode again ([#6334](https://github.com/videojs/video.js/issues/6334)) ([ca84448](https://github.com/videojs/video.js/commit/ca84448)), closes [videojs/vtt.js#40](https://github.com/videojs/vtt.js/issues/40) [#6333](https://github.com/videojs/video.js/issues/6333) [videojs/vtt.js#15](https://github.com/videojs/vtt.js/issues/15) -* **package:** update videojs-vtt.js to version 0.15.2 ([#6333](https://github.com/videojs/video.js/issues/6333)) ([7bbd0ca](https://github.com/videojs/video.js/commit/7bbd0ca)), closes [#6332](https://github.com/videojs/video.js/issues/6332) - - -## [7.7.1](https://github.com/videojs/video.js/compare/v7.7.0...v7.7.1) (2019-11-22) - -### Bug Fixes - -* **extend:** super_ should be available for backwards compatibility ([#6329](https://github.com/videojs/video.js/issues/6329)) ([25d15d4](https://github.com/videojs/video.js/commit/25d15d4)), closes [#6328](https://github.com/videojs/video.js/issues/6328) - - -# [7.7.0](https://github.com/videojs/video.js/compare/v7.6.4...v7.7.0) (2019-11-19) - -### Features - -* add core ES module. ([#6287](https://github.com/videojs/video.js/issues/6287)) ([4f8c498](https://github.com/videojs/video.js/commit/4f8c498)) -* add isDisposed method to components ([#6099](https://github.com/videojs/video.js/issues/6099)) ([064fcaf](https://github.com/videojs/video.js/commit/064fcaf)) -* allow a click handler to be specified in clickable component's options ([#6140](https://github.com/videojs/video.js/issues/6140)) ([f7185ba](https://github.com/videojs/video.js/commit/f7185ba)) -* cap log history at 1000 items ([#6192](https://github.com/videojs/video.js/issues/6192)) ([5fa4257](https://github.com/videojs/video.js/commit/5fa4257)) -* option to load text tracks on demand vs preload ([#6043](https://github.com/videojs/video.js/issues/6043)) ([0e37fbf](https://github.com/videojs/video.js/commit/0e37fbf)) -* resets pastSeekEnd_ variable. ([#6249](https://github.com/videojs/video.js/issues/6249)) ([ccca846](https://github.com/videojs/video.js/commit/ccca846)) - -### Bug Fixes - -* **pkg:** update [@videojs](https://github.com/videojs)/http-streaming to 1.11.2 ([#6323](https://github.com/videojs/video.js/issues/6323)) ([b414c60](https://github.com/videojs/video.js/commit/b414c60)) -* allow player dimension method to accept 'auto' ([#6185](https://github.com/videojs/video.js/issues/6185)) ([8129f03](https://github.com/videojs/video.js/commit/8129f03)) -* bring back Android 4.x support ([#6289](https://github.com/videojs/video.js/issues/6289)) ([680e7d7](https://github.com/videojs/video.js/commit/680e7d7)) -* detect iPadOS as IS_IPAD ([#6319](https://github.com/videojs/video.js/issues/6319)) ([a11f3fa](https://github.com/videojs/video.js/commit/a11f3fa)) -* DRMed content goes black in IE/Edge when video element focused ([#6318](https://github.com/videojs/video.js/issues/6318)) ([b3c2343](https://github.com/videojs/video.js/commit/b3c2343)), closes [#6270](https://github.com/videojs/video.js/issues/6270) -* ensure components added with an index are added in the correct location ([#6297](https://github.com/videojs/video.js/issues/6297)) ([f7b3772](https://github.com/videojs/video.js/commit/f7b3772)) -* ensure the default ID of the first player is 'vjs_video_3' as some people have relied on this ([#6216](https://github.com/videojs/video.js/issues/6216)) ([29638b7](https://github.com/videojs/video.js/commit/29638b7)), closes [#6103](https://github.com/videojs/video.js/issues/6103) -* **iOS:** pause player on suspend or stalled if extra buffer is available ([#6199](https://github.com/videojs/video.js/issues/6199)) ([c791cd8](https://github.com/videojs/video.js/commit/c791cd8)) -* **lang:** Fixed typos in german translation ([#6275](https://github.com/videojs/video.js/issues/6275)) ([aeb9588](https://github.com/videojs/video.js/commit/aeb9588)) -* **lang:** Update Norwegian translations ([#6220](https://github.com/videojs/video.js/issues/6220)) ([e37996d](https://github.com/videojs/video.js/commit/e37996d)) -* Make suppressing no source error compatible with videojs-errors ([#6217](https://github.com/videojs/video.js/issues/6217)) ([260cfcd](https://github.com/videojs/video.js/commit/260cfcd)) - -### Chores - -* ignore sandbox during linting ([#6208](https://github.com/videojs/video.js/issues/6208)) ([de2daea](https://github.com/videojs/video.js/commit/de2daea)) -* include changelog from 7.6.x branch ([a615236](https://github.com/videojs/video.js/commit/a615236)) -* package json cleanup ([#5649](https://github.com/videojs/video.js/issues/5649)) ([85ad44e](https://github.com/videojs/video.js/commit/85ad44e)) - -### Documentation - -* add note about SubsCapsButton only showing up when configured with text tracks ([#6254](https://github.com/videojs/video.js/issues/6254)) ([f34d441](https://github.com/videojs/video.js/commit/f34d441)) -* update Components list ([#6253](https://github.com/videojs/video.js/issues/6253)) ([7a85e2a](https://github.com/videojs/video.js/commit/7a85e2a)), closes [#5980](https://github.com/videojs/video.js/issues/5980) - -### Performance Improvements - -* Another 5ms of startup time improvements ([#6145](https://github.com/videojs/video.js/issues/6145)) ([22782b8](https://github.com/videojs/video.js/commit/22782b8)) -* only update ui on change, wrap things in requestAnimationFrame ([#6155](https://github.com/videojs/video.js/issues/6155)) ([99b610b](https://github.com/videojs/video.js/commit/99b610b)) -* Save 3740 bytes gizpped by getting rid of xhr deps ([#6164](https://github.com/videojs/video.js/issues/6164)) ([bd58039](https://github.com/videojs/video.js/commit/bd58039)) - -### Tests - -* run tests via rollup ([#5601](https://github.com/videojs/video.js/issues/5601)) ([4134a97](https://github.com/videojs/video.js/commit/4134a97)) - - -## [7.6.6](https://github.com/videojs/video.js/compare/v7.6.5...v7.6.6) (2019-11-07) - -### Bug Fixes - -* bring back Android 4.x support ([#6289](https://github.com/videojs/video.js/issues/6289)) ([bacd2b2](https://github.com/videojs/video.js/commit/bacd2b2)) - - -## [7.6.5](https://github.com/videojs/video.js/compare/v7.6.4...v7.6.5) (2019-09-05) - -### Bug Fixes - -* ensure the default ID of the first player is 'vjs_video_3' as some people have relied on this ([#6216](https://github.com/videojs/video.js/issues/6216)) ([5ff5569](https://github.com/videojs/video.js/commit/5ff5569)), closes [#6103](https://github.com/videojs/video.js/issues/6103) - - -## [7.6.4](https://github.com/videojs/video.js/compare/v7.6.3...v7.6.4) (2019-08-28) - -### Bug Fixes - -* adds space between vjs-live-display and vjs-volume-control controls. ([#6200](https://github.com/videojs/video.js/issues/6200)) ([3c1dd8f](https://github.com/videojs/video.js/commit/3c1dd8f)), closes [#5815](https://github.com/videojs/video.js/issues/5815) -* make live UI button more consistent ([#6201](https://github.com/videojs/video.js/issues/6201)) ([714aba0](https://github.com/videojs/video.js/commit/714aba0)) - -### Chores - -* **package:** update http-streaming to 1.10.6 ([#6205](https://github.com/videojs/video.js/issues/6205)) ([f47939c](https://github.com/videojs/video.js/commit/f47939c)), closes [videojs/http-streaming#312](https://github.com/videojs/http-streaming/issues/312) - - -## [7.6.3](https://github.com/videojs/video.js/compare/v7.6.2...v7.6.3) (2019-08-22) - -### Bug Fixes - -* do not handle hotkeys in contenteditable elements ([#6182](https://github.com/videojs/video.js/issues/6182)) ([51b9861](https://github.com/videojs/video.js/commit/51b9861)) -* make 'Esc' works for a vertical volume bar and menus ([#6046](https://github.com/videojs/video.js/issues/6046)) ([62465b8](https://github.com/videojs/video.js/commit/62465b8)), closes [#6004](https://github.com/videojs/video.js/issues/6004) -* remove deprecated tsml dependency ([#6174](https://github.com/videojs/video.js/issues/6174)) ([549552e](https://github.com/videojs/video.js/commit/549552e)) - - -## [7.6.2](https://github.com/videojs/video.js/compare/v7.6.1...v7.6.2) (2019-08-07) - -### Bug Fixes - -* **lang:** Add missing strings for Chinese (Simplified) and Chinese (Traditional) ([#6149](https://github.com/videojs/video.js/issues/6149)) ([bd51e9e](https://github.com/videojs/video.js/commit/bd51e9e)) -* **lang:** update Spanish translations ([#6065](https://github.com/videojs/video.js/issues/6065)) ([1d2b206](https://github.com/videojs/video.js/commit/1d2b206)) - -### Chores - -* fix lang watch loop caused by zh-* copy ([#6147](https://github.com/videojs/video.js/issues/6147)) ([4b325ea](https://github.com/videojs/video.js/commit/4b325ea)) - -### Performance Improvements - -* Do not add/remove listeners for each timer ([#6144](https://github.com/videojs/video.js/issues/6144)) ([5ee2477](https://github.com/videojs/video.js/commit/5ee2477)) -* Improve performance of toTitleCase, register with lower and TitleCase ([#6148](https://github.com/videojs/video.js/issues/6148)) ([266cb15](https://github.com/videojs/video.js/commit/266cb15)) -* Use WeakMap for dom data ([#6103](https://github.com/videojs/video.js/issues/6103)) ([8610f99](https://github.com/videojs/video.js/commit/8610f99)) - -### Tests - -* silence test logs ([#6165](https://github.com/videojs/video.js/issues/6165)) ([9d2e5f3](https://github.com/videojs/video.js/commit/9d2e5f3)) - - -## [7.6.1](https://github.com/videojs/video.js/compare/v7.6.0...v7.6.1) (2019-07-30) - -### Bug Fixes - -* Improves isSingleLeftClick() to handle mousemove ([#6138](https://github.com/videojs/video.js/issues/6138)) ([f2aedb7](https://github.com/videojs/video.js/commit/f2aedb7)), closes [#6132](https://github.com/videojs/video.js/issues/6132) -* **component:** use safe computedStyle in currentDimension ([#6073](https://github.com/videojs/video.js/issues/6073)) ([20cae21](https://github.com/videojs/video.js/commit/20cae21)), closes [#3664](https://github.com/videojs/video.js/issues/3664) -* **pip:** hide PiP button in browsers not support the WICG spec ([#6131](https://github.com/videojs/video.js/issues/6131)) ([3afa7d1](https://github.com/videojs/video.js/commit/3afa7d1)) - -### Chores - -* switch from deprecated `jsnext`, `main` options to mainFields ([#6075](https://github.com/videojs/video.js/issues/6075)) ([2e69448](https://github.com/videojs/video.js/commit/2e69448)) -* update videojs-generate-karma-config to ~5.2.1 and remove patches ([#6104](https://github.com/videojs/video.js/issues/6104)) ([b9fbd0b](https://github.com/videojs/video.js/commit/b9fbd0b)) - -### Code Refactoring - -* use the new `any` event function ([#6080](https://github.com/videojs/video.js/issues/6080)) ([3c932c5](https://github.com/videojs/video.js/commit/3c932c5)) - -### Performance Improvements - -* save ~10ms on `player.src` call ([#6141](https://github.com/videojs/video.js/issues/6141)) ([2e495dd](https://github.com/videojs/video.js/commit/2e495dd)) -* throttle more timers and use native bind ([#6142](https://github.com/videojs/video.js/issues/6142)) ([6a93c8a](https://github.com/videojs/video.js/commit/6a93c8a)) - -### Reverts - -* "fix(play-toggle): call event.stopPropagation in the click handler ([#5803](https://github.com/videojs/video.js/issues/5803))" ([#6128](https://github.com/videojs/video.js/issues/6128)) ([15ff8f7](https://github.com/videojs/video.js/commit/15ff8f7)), closes [#5624](https://github.com/videojs/video.js/issues/5624) [#6092](https://github.com/videojs/video.js/issues/6092) - - -# [7.6.0](https://github.com/videojs/video.js/compare/v7.5.4...v7.6.0) (2019-06-20) - -### Features - -* add 'audio/mp4' mimetype for m4a files ([#5982](https://github.com/videojs/video.js/issues/5982)) ([0f501f9](https://github.com/videojs/video.js/commit/0f501f9)) -* **events:** add any function ([#5977](https://github.com/videojs/video.js/issues/5977)) ([2878c1d](https://github.com/videojs/video.js/commit/2878c1d)) -* **fs:** support FullscreenOptions ([#5856](https://github.com/videojs/video.js/issues/5856)) ([631ac3b](https://github.com/videojs/video.js/commit/631ac3b)) -* **lang:** add Scottish Gaelic (gd.json) translation ([#5972](https://github.com/videojs/video.js/issues/5972)) ([fc21475](https://github.com/videojs/video.js/commit/fc21475)) -* **middleware:** allow middleware to handle volume setter and getter ([#5906](https://github.com/videojs/video.js/issues/5906)) ([322dae4](https://github.com/videojs/video.js/commit/322dae4)) -* add built-in Picture-in-Picture button ([#6002](https://github.com/videojs/video.js/issues/6002)) ([116d84a](https://github.com/videojs/video.js/commit/116d84a)), closes [videojs/font#41](https://github.com/videojs/font/issues/41) [#5824](https://github.com/videojs/video.js/issues/5824) -* add option to suppress initial error for non-playable sources ([#6057](https://github.com/videojs/video.js/issues/6057)) ([5a538c3](https://github.com/videojs/video.js/commit/5a538c3)) -* add Picture-in-Picture API methods ([#6001](https://github.com/videojs/video.js/issues/6001)) ([83541dc](https://github.com/videojs/video.js/commit/83541dc)), closes [#5824](https://github.com/videojs/video.js/issues/5824) -* add write method to time tooltips ([#6021](https://github.com/videojs/video.js/issues/6021)) ([204ff46](https://github.com/videojs/video.js/commit/204ff46)) -* allow displaying of multiple text tracks at once ([#5817](https://github.com/videojs/video.js/issues/5817)) ([c61f3d3](https://github.com/videojs/video.js/commit/c61f3d3)), closes [#5798](https://github.com/videojs/video.js/issues/5798) - -### Bug Fixes - -* always pass event object to click handler ([#6059](https://github.com/videojs/video.js/issues/6059)) ([ca7b633](https://github.com/videojs/video.js/commit/ca7b633)) -* change 'mousedown' to the 'mouseup' event in the player ([#5992](https://github.com/videojs/video.js/issues/5992)) ([075a504](https://github.com/videojs/video.js/commit/075a504)) -* group subtitles and captions when switching tracks ([#6008](https://github.com/videojs/video.js/issues/6008)) ([5a7fe48](https://github.com/videojs/video.js/commit/5a7fe48)), closes [#5741](https://github.com/videojs/video.js/issues/5741) -* handle esc key properly inside of the CloseButton ([#6050](https://github.com/videojs/video.js/issues/6050)) ([f5fd94f](https://github.com/videojs/video.js/commit/f5fd94f)) -* make sure hotkeys are not triggered outside the player or in form fields within the player ([#5969](https://github.com/videojs/video.js/issues/5969)) ([79eadac](https://github.com/videojs/video.js/commit/79eadac)) -* undeprecate options() ([#6056](https://github.com/videojs/video.js/issues/6056)) ([9d941c0](https://github.com/videojs/video.js/commit/9d941c0)), closes [#6048](https://github.com/videojs/video.js/issues/6048) -* use performance.now() when possible ([#5870](https://github.com/videojs/video.js/issues/5870)) ([629594e](https://github.com/videojs/video.js/commit/629594e)) -* **fs:** feature detect el.matches() for IE11 ([#6007](https://github.com/videojs/video.js/issues/6007)) ([fded30f](https://github.com/videojs/video.js/commit/fded30f)) -* **lang:** update German translations ([#6058](https://github.com/videojs/video.js/issues/6058)) ([97b66a9](https://github.com/videojs/video.js/commit/97b66a9)) -* **liveui:** do not seek to live on first seek when autoplaying a live stream ([#6062](https://github.com/videojs/video.js/issues/6062)) ([70ba84e](https://github.com/videojs/video.js/commit/70ba84e)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.10.2 🚀 ([#5991](https://github.com/videojs/video.js/issues/5991)) ([d41794c](https://github.com/videojs/video.js/commit/d41794c)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.10.3 🚀 ([#6019](https://github.com/videojs/video.js/issues/6019)) ([ef49a9b](https://github.com/videojs/video.js/commit/ef49a9b)) -* **play-toggle:** call event.stopPropagation in the click handler ([#5803](https://github.com/videojs/video.js/issues/5803)) ([2c7644f](https://github.com/videojs/video.js/commit/2c7644f)), closes [#5624](https://github.com/videojs/video.js/issues/5624) -* **player:** silence rejected fullscreen promise ([#5970](https://github.com/videojs/video.js/issues/5970)) ([4585c08](https://github.com/videojs/video.js/commit/4585c08)), closes [#5918](https://github.com/videojs/video.js/issues/5918) - -### Chores - -* add a sandbox page for testing autoplay values. ([#5933](https://github.com/videojs/video.js/issues/5933)) ([1eb47f0](https://github.com/videojs/video.js/commit/1eb47f0)) -* add Affects: a11y and switch to outdated label ([#6015](https://github.com/videojs/video.js/issues/6015)) ([1cd9be7](https://github.com/videojs/video.js/commit/1cd9be7)) -* change rollup config so that npm run watch works ([#5966](https://github.com/videojs/video.js/issues/5966)) ([45d1ca9](https://github.com/videojs/video.js/commit/45d1ca9)) -* don't log karma config ([#5955](https://github.com/videojs/video.js/issues/5955)) ([4d626b0](https://github.com/videojs/video.js/commit/4d626b0)) -* **package:** update rollup to version 1.15.1 ([#6042](https://github.com/videojs/video.js/issues/6042)) ([74fde94](https://github.com/videojs/video.js/commit/74fde94)), closes [#6041](https://github.com/videojs/video.js/issues/6041) -* **package:** update videojs-generate-karma-config to version 5.2.0 🚀 ([#5935](https://github.com/videojs/video.js/issues/5935)) ([7e8c2ee](https://github.com/videojs/video.js/commit/7e8c2ee)) -* **test:** upgrade to latest sinon ([#5954](https://github.com/videojs/video.js/issues/5954)) ([c59ba5f](https://github.com/videojs/video.js/commit/c59ba5f)), closes [#5953](https://github.com/videojs/video.js/issues/5953) -* fixup merge issue with [#6001](https://github.com/videojs/video.js/issues/6001) ([#6053](https://github.com/videojs/video.js/issues/6053)) ([c2bea31](https://github.com/videojs/video.js/commit/c2bea31)) -* switch to dart-sass ([#6055](https://github.com/videojs/video.js/issues/6055)) ([3e10571](https://github.com/videojs/video.js/commit/3e10571)), closes [#5841](https://github.com/videojs/video.js/issues/5841) [#5841](https://github.com/videojs/video.js/issues/5841) [#5826](https://github.com/videojs/video.js/issues/5826) -* update dependencies ([#6036](https://github.com/videojs/video.js/issues/6036)) ([882432e](https://github.com/videojs/video.js/commit/882432e)), closes [#6033](https://github.com/videojs/video.js/issues/6033) - -### Code Refactoring - -* switch to fullscreen.options ([#6054](https://github.com/videojs/video.js/issues/6054)) ([2977d52](https://github.com/videojs/video.js/commit/2977d52)) -* **pip:** rely only on WICG spec events ([#6064](https://github.com/videojs/video.js/issues/6064)) ([10ed08a](https://github.com/videojs/video.js/commit/10ed08a)) - -### Documentation - -* emphasize src object and video-js element ([#5960](https://github.com/videojs/video.js/issues/5960)) ([e1afa3e](https://github.com/videojs/video.js/commit/e1afa3e)) -* update guides markdown ([#6063](https://github.com/videojs/video.js/issues/6063)) ([cf6e0e8](https://github.com/videojs/video.js/commit/cf6e0e8)) - -### Tests - -* restore prototype modifications and fix flaky tests ([#5964](https://github.com/videojs/video.js/issues/5964)) ([a55c51f](https://github.com/videojs/video.js/commit/a55c51f)) - - -## [7.5.6](https://github.com/videojs/video.js/compare/v7.5.5...v7.5.6) (2019-06-20) - -### Bug Fixes - -* **liveui:** do not seek to live on first seek when autoplaying a live stream ([#6062](https://github.com/videojs/video.js/issues/6062)) ([8777c89](https://github.com/videojs/video.js/commit/8777c89)) - - -## [7.5.5](https://github.com/videojs/video.js/compare/v7.5.4...v7.5.5) (2019-05-30) - -### Bug Fixes - -* **fs:** feature detect el.matches() for IE11 ([#6007](https://github.com/videojs/video.js/issues/6007)) ([9954470](https://github.com/videojs/video.js/commit/9954470)) -* group subtitles and captions when switching tracks ([#6008](https://github.com/videojs/video.js/issues/6008)) ([cd6be5b](https://github.com/videojs/video.js/commit/cd6be5b)), closes [#5741](https://github.com/videojs/video.js/issues/5741) -* **fs:** fix isFullscreen check for spec-api ([#6009](https://github.com/videojs/video.js/issues/6009)) ([47d60ae](https://github.com/videojs/video.js/commit/47d60ae)), closes [#5814](https://github.com/videojs/video.js/issues/5814) -* make sure hotkeys are not triggered outside the player or in form fields within the player ([#5969](https://github.com/videojs/video.js/issues/5969)) ([d251e97](https://github.com/videojs/video.js/commit/d251e97)) - - -## [7.5.4](https://github.com/videojs/video.js/compare/v7.5.3...v7.5.4) (2019-04-12) - -### Bug Fixes - -* always show the mute button by default in responsive mode ([#5914](https://github.com/videojs/video.js/issues/5914)) ([c85bc00](https://github.com/videojs/video.js/commit/c85bc00)) -* call reset if we are paused or no promises, otherwise wait for play promise to resolve ([#5876](https://github.com/videojs/video.js/issues/5876)) ([5973a62](https://github.com/videojs/video.js/commit/5973a62)), closes [#5875](https://github.com/videojs/video.js/issues/5875) -* correctly resolve play promise when terminated via middleware ([#5895](https://github.com/videojs/video.js/issues/5895)) ([ad53b80](https://github.com/videojs/video.js/commit/ad53b80)) -* explicitly remove all document-level listeners on player dispose ([#5929](https://github.com/videojs/video.js/issues/5929)) ([458a5ea](https://github.com/videojs/video.js/commit/458a5ea)) -* fix bug preventing control bar from hiding on mobile ([#5836](https://github.com/videojs/video.js/issues/5836)) ([1844482](https://github.com/videojs/video.js/commit/1844482)) -* fix fullscreen detection when player is nested within document fullscreen ([#5912](https://github.com/videojs/video.js/issues/5912)) ([22d0514](https://github.com/videojs/video.js/commit/22d0514)) -* hide the progress control and show the subs-caps button when using Live UI at extra small size ([#5915](https://github.com/videojs/video.js/issues/5915)) ([55b3752](https://github.com/videojs/video.js/commit/55b3752)) - -### Documentation - -* **ModalDialog:** add missing documentation for pauseOnOpen ([#5908](https://github.com/videojs/video.js/issues/5908)) ([b2eae7b](https://github.com/videojs/video.js/commit/b2eae7b)) - - -## [7.5.3](https://github.com/videojs/video.js/compare/v7.5.2...v7.5.3) (2019-03-29) - -### Chores - -* add a sandbox for HLS ([#5897](https://github.com/videojs/video.js/issues/5897)) ([8e43cff](https://github.com/videojs/video.js/commit/8e43cff)) - -### Documentation - -* **live:** minor spelling/grammar corrections ([#5894](https://github.com/videojs/video.js/issues/5894)) ([6c644fe](https://github.com/videojs/video.js/commit/6c644fe)) -* add an example Vue integration.md ([#5899](https://github.com/videojs/video.js/issues/5899)) ([4c277fd](https://github.com/videojs/video.js/commit/4c277fd)) - -### Performance Improvements - -* **live-tracker:** disable live tracker on IE11 when document is hidden ([#5896](https://github.com/videojs/video.js/issues/5896)) ([511f729](https://github.com/videojs/video.js/commit/511f729)), closes [#5879](https://github.com/videojs/video.js/issues/5879) - - -## [7.5.2](https://github.com/videojs/video.js/compare/v7.5.1...v7.5.2) (2019-03-25) - -### Bug Fixes - -* fix audio and video track selection ([#5890](https://github.com/videojs/video.js/issues/5890)) ([3dc6fbf](https://github.com/videojs/video.js/commit/3dc6fbf)), closes [#5887](https://github.com/videojs/video.js/issues/5887) - - -## [7.5.1](https://github.com/videojs/video.js/compare/v7.5.0...v7.5.1) (2019-03-22) - -### Bug Fixes - -* add inactivityTimeout to reset cache method ([#5788](https://github.com/videojs/video.js/issues/5788)) ([a72d861](https://github.com/videojs/video.js/commit/a72d861)) -* change max height of menus based on responsive classes. ([#5806](https://github.com/videojs/video.js/issues/5806)) ([d5a3234](https://github.com/videojs/video.js/commit/d5a3234)), closes [#5524](https://github.com/videojs/video.js/issues/5524) -* do a null check for tech when checking if we can toggle mute ([#5857](https://github.com/videojs/video.js/issues/5857)) ([d07f97d](https://github.com/videojs/video.js/commit/d07f97d)) -* ensure that durationDisplay and remainingTimeDisplay exist before calling their 'updateContent' method during reset() ([#5839](https://github.com/videojs/video.js/issues/5839)) ([e248286](https://github.com/videojs/video.js/commit/e248286)), closes [#5838](https://github.com/videojs/video.js/issues/5838) -* if play is delayed till loadstart, call load ([#5822](https://github.com/videojs/video.js/issues/5822)) ([f8b7dd4](https://github.com/videojs/video.js/commit/f8b7dd4)) -* update fullscreen detection when player is nested within another fullscreen element ([#5830](https://github.com/videojs/video.js/issues/5830)) ([3fbc4f5](https://github.com/videojs/video.js/commit/3fbc4f5)) -* **lang:** improve Chinese translations ([#5834](https://github.com/videojs/video.js/issues/5834)) ([8532182](https://github.com/videojs/video.js/commit/8532182)) -* **lang:** update and correct occitan translations ([#5829](https://github.com/videojs/video.js/issues/5829)) ([ea8c426](https://github.com/videojs/video.js/commit/ea8c426)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.9.1 🚀 ([#5840](https://github.com/videojs/video.js/issues/5840)) ([ae378c6](https://github.com/videojs/video.js/commit/ae378c6)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.9.2 🚀 ([#5865](https://github.com/videojs/video.js/issues/5865)) ([32a43d1](https://github.com/videojs/video.js/commit/32a43d1)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.9.3 🚀 ([#5883](https://github.com/videojs/video.js/issues/5883)) ([cd6ac9d](https://github.com/videojs/video.js/commit/cd6ac9d)), closes [#5823](https://github.com/videojs/video.js/issues/5823) -* **resize-manager:** call super.dispose() in dispose method ([#5853](https://github.com/videojs/video.js/issues/5853)) ([6eb9fd3](https://github.com/videojs/video.js/commit/6eb9fd3)) -* use ownerDocument.body.contains for IE11 ([#5872](https://github.com/videojs/video.js/issues/5872)) ([4169ddd](https://github.com/videojs/video.js/commit/4169ddd)), closes [#5831](https://github.com/videojs/video.js/issues/5831) -* warn on element not in DOM even when from another document ([#5831](https://github.com/videojs/video.js/issues/5831)) ([237b68b](https://github.com/videojs/video.js/commit/237b68b)) - -### Chores - -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.9.0 🚀 ([#5784](https://github.com/videojs/video.js/issues/5784)) ([3400dc6](https://github.com/videojs/video.js/commit/3400dc6)) -* pin to firefox 64 ([#5793](https://github.com/videojs/video.js/issues/5793)) ([b64ecde](https://github.com/videojs/video.js/commit/b64ecde)) -* **package:** update patch-package to version 6.0.2 ([#5792](https://github.com/videojs/video.js/issues/5792)) ([de9fb58](https://github.com/videojs/video.js/commit/de9fb58)), closes [#5769](https://github.com/videojs/video.js/issues/5769) -* **package:** update videojs-generate-karma-config to version 5.1.0 🚀 ([#5843](https://github.com/videojs/video.js/issues/5843)) ([d7379f0](https://github.com/videojs/video.js/commit/d7379f0)) -* **text-track:** fix it's/its typo ([#5868](https://github.com/videojs/video.js/issues/5868)) ([92c66ad](https://github.com/videojs/video.js/commit/92c66ad)) - -### Documentation - -* fixes the return value type of the loop method. ([#5789](https://github.com/videojs/video.js/issues/5789)) ([65beb5a](https://github.com/videojs/video.js/commit/65beb5a)) -* Update format information ([#5783](https://github.com/videojs/video.js/issues/5783)) ([76cc310](https://github.com/videojs/video.js/commit/76cc310)) -* **audiotracks:** correct typo ([#5816](https://github.com/videojs/video.js/issues/5816)) ([e612056](https://github.com/videojs/video.js/commit/e612056)) -* **hotkeys:** hotkeys require player focus ([#5859](https://github.com/videojs/video.js/issues/5859)) ([a271eca](https://github.com/videojs/video.js/commit/a271eca)), closes [#5832](https://github.com/videojs/video.js/issues/5832) - -### Performance Improvements - -* fix an event target memory leak ([#5855](https://github.com/videojs/video.js/issues/5855)) ([20bf42d](https://github.com/videojs/video.js/commit/20bf42d)) -* **player:** turn off all track list listeners on dispose ([#5867](https://github.com/videojs/video.js/issues/5867)) ([c632b24](https://github.com/videojs/video.js/commit/c632b24)) -* **seek-bar:** don't update play progress when document is hidden ([#5879](https://github.com/videojs/video.js/issues/5879)) ([894dd9e](https://github.com/videojs/video.js/commit/894dd9e)), closes [#5575](https://github.com/videojs/video.js/issues/5575) -* Fix memory leaks in safari, edge, and ie ([#5880](https://github.com/videojs/video.js/issues/5880)) ([142cc67](https://github.com/videojs/video.js/commit/142cc67)), closes [#5878](https://github.com/videojs/video.js/issues/5878) -* fix more memory leaks ([#5860](https://github.com/videojs/video.js/issues/5860)) ([f01d6f4](https://github.com/videojs/video.js/commit/f01d6f4)) -* Remove `playerEvent` and extra `timeupdate` handler in SeekBar ([#5852](https://github.com/videojs/video.js/issues/5852)) ([a2431ce](https://github.com/videojs/video.js/commit/a2431ce)) - -### Tests - -* check dom-data to verify we aren't leaking memory and event handlers ([#5862](https://github.com/videojs/video.js/issues/5862)) ([6e173b0](https://github.com/videojs/video.js/commit/6e173b0)) -* memory leak fixes in tests ([#5861](https://github.com/videojs/video.js/issues/5861)) ([23a36f3](https://github.com/videojs/video.js/commit/23a36f3)) - - -# [7.5.0](https://github.com/videojs/video.js/compare/v7.4.1...v7.5.0) (2019-01-25) - -### Features - -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.8.0 🚀 ([#5743](https://github.com/videojs/video.js/issues/5743)) ([a071dd8](https://github.com/videojs/video.js/commit/a071dd8)) -* add hotkeys support ("m", "f", "k", and Space) ([#5571](https://github.com/videojs/video.js/issues/5571)) ([61053bf](https://github.com/videojs/video.js/commit/61053bf)), closes [#5765](https://github.com/videojs/video.js/issues/5765) [#4048](https://github.com/videojs/video.js/issues/4048) [#3022](https://github.com/videojs/video.js/issues/3022) -* Add loadMedia and getMedia methods ([#5652](https://github.com/videojs/video.js/issues/5652)) ([874cc21](https://github.com/videojs/video.js/commit/874cc21)), closes [#4342](https://github.com/videojs/video.js/issues/4342) -* Add vjs-touch-enabled class for touch supporting devices ([#5663](https://github.com/videojs/video.js/issues/5663)) ([b02181b](https://github.com/videojs/video.js/commit/b02181b)), closes [#2999](https://github.com/videojs/video.js/issues/2999) -* reset player ui on Player#reset ([#5684](https://github.com/videojs/video.js/issues/5684)) ([175f773](https://github.com/videojs/video.js/commit/175f773)), closes [#4683](https://github.com/videojs/video.js/issues/4683) -* **player:** add option to disable or override double-click handling. ([#5611](https://github.com/videojs/video.js/issues/5611)) ([e890923](https://github.com/videojs/video.js/commit/e890923)), closes [#5604](https://github.com/videojs/video.js/issues/5604) - -### Bug Fixes - -* **fs:** fix double fullscreenchange event ([#5756](https://github.com/videojs/video.js/issues/5756)) ([1c0fa32](https://github.com/videojs/video.js/commit/1c0fa32)), closes [#5685](https://github.com/videojs/video.js/issues/5685) [#5745](https://github.com/videojs/video.js/issues/5745) -* **fs:** make sure there's only one fullscreenchange event ([#5686](https://github.com/videojs/video.js/issues/5686)) ([2f00a68](https://github.com/videojs/video.js/commit/2f00a68)), closes [#5685](https://github.com/videojs/video.js/issues/5685) -* **lang:** adds sv translation used by liveui component ([#5704](https://github.com/videojs/video.js/issues/5704)) ([f38726e](https://github.com/videojs/video.js/commit/f38726e)) -* **lang:** Galician translation update (gl.json) ([#5736](https://github.com/videojs/video.js/issues/5736)) ([1e53dfe](https://github.com/videojs/video.js/commit/1e53dfe)), closes [#5718](https://github.com/videojs/video.js/issues/5718) -* **menu-button:** make menu button title a component ([#5722](https://github.com/videojs/video.js/issues/5722)) ([2f0834f](https://github.com/videojs/video.js/commit/2f0834f)), closes [#3612](https://github.com/videojs/video.js/issues/3612) [#5759](https://github.com/videojs/video.js/issues/5759) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.6.0 🚀 ([#5705](https://github.com/videojs/video.js/issues/5705)) ([3d093ed](https://github.com/videojs/video.js/commit/3d093ed)) -* **player:** remove vjs-ended class on seeked ([#5728](https://github.com/videojs/video.js/issues/5728)) ([544ed9d](https://github.com/videojs/video.js/commit/544ed9d)), closes [#5654](https://github.com/videojs/video.js/issues/5654) -* Control-bar autohide when cursor placed over it [#5258](https://github.com/videojs/video.js/issues/5258) ([#5692](https://github.com/videojs/video.js/issues/5692)) ([6ebc772](https://github.com/videojs/video.js/commit/6ebc772)) -* css animation shorthand property order ([#5687](https://github.com/videojs/video.js/issues/5687)) ([0e69ce9](https://github.com/videojs/video.js/commit/0e69ce9)) -* make sure sources, volume, and playback rate are reset along with the player ([#5676](https://github.com/videojs/video.js/issues/5676)) ([4c9e09d](https://github.com/videojs/video.js/commit/4c9e09d)), closes [#5675](https://github.com/videojs/video.js/issues/5675) -* **remaining-time-display:** make the '-' be visual and not readable by screen readers ([#5671](https://github.com/videojs/video.js/issues/5671)) ([9a8376e](https://github.com/videojs/video.js/commit/9a8376e)), closes [#5168](https://github.com/videojs/video.js/issues/5168) -* remove child from old parent when moving to new parent via addChild ([#5702](https://github.com/videojs/video.js/issues/5702)) ([dd63cf9](https://github.com/videojs/video.js/commit/dd63cf9)) -* remove event handlers when menu item is removed ([#5748](https://github.com/videojs/video.js/issues/5748)) ([259ce71](https://github.com/videojs/video.js/commit/259ce71)) -* TextTrackMenuItem components should not disable text tracks of different kind(s). ([#5741](https://github.com/videojs/video.js/issues/5741)) ([b27f713](https://github.com/videojs/video.js/commit/b27f713)) -* **resize-manager:** Prevent tabbing into RM and hide from Screen Readers ([#5754](https://github.com/videojs/video.js/issues/5754)) ([d94771f](https://github.com/videojs/video.js/commit/d94771f)) -* **seekbar:** don't disable if live tracker's seekable is infinity ([#5721](https://github.com/videojs/video.js/issues/5721)) ([f02fb1b](https://github.com/videojs/video.js/commit/f02fb1b)) - -### Chores - -* **package:** update babel to version 7.2.2 ([#5697](https://github.com/videojs/video.js/issues/5697)) ([30d0b98](https://github.com/videojs/video.js/commit/30d0b98)), closes [#5689](https://github.com/videojs/video.js/issues/5689) -* fix xvfb in travis config, patch safari karma launchers ([#5755](https://github.com/videojs/video.js/issues/5755)) ([144907f](https://github.com/videojs/video.js/commit/144907f)) -* **package:** update filesize to version 4.0.0 🚀 ([#5746](https://github.com/videojs/video.js/issues/5746)) ([6910d39](https://github.com/videojs/video.js/commit/6910d39)) -* **package:** update karma to version 4.0.0 🚀 ([#5764](https://github.com/videojs/video.js/issues/5764)) ([9786d8a](https://github.com/videojs/video.js/commit/9786d8a)) -* **package:** update qunit to version 2.9.1 🚀 ([#5735](https://github.com/videojs/video.js/issues/5735)) ([67a437b](https://github.com/videojs/video.js/commit/67a437b)) -* **package:** update remark-validate-links to version 8.0.0 🚀 ([#5740](https://github.com/videojs/video.js/issues/5740)) ([72988d3](https://github.com/videojs/video.js/commit/72988d3)) -* **package:** update rollup to version 0.68.0 🚀 ([#5690](https://github.com/videojs/video.js/issues/5690)) ([f0ba1f5](https://github.com/videojs/video.js/commit/f0ba1f5)) -* **package:** update rollup to version 1.0.1 ([#5727](https://github.com/videojs/video.js/issues/5727)) ([3e3387f](https://github.com/videojs/video.js/commit/3e3387f)), closes [#5715](https://github.com/videojs/video.js/issues/5715) -* **package:** update rollup-plugin-progress to version 1.0.0 🚀 ([#5729](https://github.com/videojs/video.js/issues/5729)) ([513168f](https://github.com/videojs/video.js/commit/513168f)) - -### Documentation - -* **liveui:** Add a guide for the live ui and live api ([#5677](https://github.com/videojs/video.js/issues/5677)) ([c147581](https://github.com/videojs/video.js/commit/c147581)) -* use https links ([#5749](https://github.com/videojs/video.js/issues/5749)) ([4b11a4e](https://github.com/videojs/video.js/commit/4b11a4e)) - - -## [7.4.1](https://github.com/videojs/video.js/compare/v7.4.0...v7.4.1) (2018-12-11) - -### Bug Fixes - -* **a11y:** current time and duration display accessibility with VoiceOver ([#5653](https://github.com/videojs/video.js/issues/5653)) ([8932611](https://github.com/videojs/video.js/commit/8932611)), closes [/www.w3.org/TR/html-aam-1.0/#details-id-124](https://github.com//www.w3.org/TR/html-aam-1.0//issues/details-id-124) -* **a11y:** fix hidden Control Text in Progress bar (Fixes [#5251](https://github.com/videojs/video.js/issues/5251)) ([#5655](https://github.com/videojs/video.js/issues/5655)) ([70a71ae](https://github.com/videojs/video.js/commit/70a71ae)) -* **a11y:** make seek-to-live better announce itself to screen reader users ([#5651](https://github.com/videojs/video.js/issues/5651)) ([165c120](https://github.com/videojs/video.js/commit/165c120)) -* **lang:** append UKR translations and fix check translations command ([#5642](https://github.com/videojs/video.js/issues/5642)) ([b7aafdc](https://github.com/videojs/video.js/commit/b7aafdc)) -* **lang:** improves sv lang file ([#5673](https://github.com/videojs/video.js/issues/5673)) ([b9d8744](https://github.com/videojs/video.js/commit/b9d8744)) -* **lang:** Update sr.json ([#5657](https://github.com/videojs/video.js/issues/5657)) ([98b4a1c](https://github.com/videojs/video.js/commit/98b4a1c)) -* **liveui:** make edge detection less strict, add docs for option ([#5661](https://github.com/videojs/video.js/issues/5661)) ([dce4a2c](https://github.com/videojs/video.js/commit/dce4a2c)) -* **liveui:** seek to live should be immediate and other tweaks ([#5650](https://github.com/videojs/video.js/issues/5650)) ([831961b](https://github.com/videojs/video.js/commit/831961b)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.5.1 🚀 ([#5658](https://github.com/videojs/video.js/issues/5658)) ([8c9702a](https://github.com/videojs/video.js/commit/8c9702a)) - -### Chores - -* **package:** update autoprefixer to version 9.4.2 ([#5647](https://github.com/videojs/video.js/issues/5647)) ([19f3465](https://github.com/videojs/video.js/commit/19f3465)) -* **package:** update rollup-plugin-node-resolve to version 4.0.0 🚀 ([#5666](https://github.com/videojs/video.js/issues/5666)) ([d07b6c2](https://github.com/videojs/video.js/commit/d07b6c2)) - -### Documentation - -* remove grunt and update usage of build scripts ([#5656](https://github.com/videojs/video.js/issues/5656)) ([62f9e78](https://github.com/videojs/video.js/commit/62f9e78)) - -### Tests - -* verify null-checks with player and control bar children set to false ([#5670](https://github.com/videojs/video.js/issues/5670)) ([13b42ad](https://github.com/videojs/video.js/commit/13b42ad)) - - -# [7.4.0](https://github.com/videojs/video.js/compare/v7.3.0...v7.4.0) (2018-12-03) - -### Features - -* add 'replay' option to the PlayToggle component. ([#5531](https://github.com/videojs/video.js/issues/5531)) ([f178458](https://github.com/videojs/video.js/commit/f178458)), closes [#4802](https://github.com/videojs/video.js/issues/4802) -* **lang:** Add the Occitan locale ([#5578](https://github.com/videojs/video.js/issues/5578)) ([0fb637d](https://github.com/videojs/video.js/commit/0fb637d)) -* **lang:** Add Welsh/Cymraeg (cy) translations ([#5561](https://github.com/videojs/video.js/issues/5561)) ([b2c1077](https://github.com/videojs/video.js/commit/b2c1077)) -* **lang:** copy language JSON files into dist dir ([#5549](https://github.com/videojs/video.js/issues/5549)) ([eb5de19](https://github.com/videojs/video.js/commit/eb5de19)), closes [#5092](https://github.com/videojs/video.js/issues/5092) -* **player:** add playerreset event ([#5335](https://github.com/videojs/video.js/issues/5335)) ([0e5442f](https://github.com/videojs/video.js/commit/0e5442f)) -* make menu background respect :focus-visible ([#5558](https://github.com/videojs/video.js/issues/5558)) ([e5e1e29](https://github.com/videojs/video.js/commit/e5e1e29)) -* responsive caption settings ([#5534](https://github.com/videojs/video.js/issues/5534)) ([b67fe27](https://github.com/videojs/video.js/commit/b67fe27)) -* support seeking during live playback via liveui option ([#5511](https://github.com/videojs/video.js/issues/5511)) ([2974ad3](https://github.com/videojs/video.js/commit/2974ad3)) - -### Bug Fixes - -* add correct cursor pointer for the play toggle ([#5463](https://github.com/videojs/video.js/issues/5463)) ([aed337a](https://github.com/videojs/video.js/commit/aed337a)) -* default subtitles not enabled ([#5608](https://github.com/videojs/video.js/issues/5608)) ([8329e64](https://github.com/videojs/video.js/commit/8329e64)) -* **tracks:** don't select tracks based on user pref if no langauge is set ([#5556](https://github.com/videojs/video.js/issues/5556)) ([c1cbce3](https://github.com/videojs/video.js/commit/c1cbce3)), closes [#5553](https://github.com/videojs/video.js/issues/5553) -* Don't remove vjs-waiting until time changes ([#5533](https://github.com/videojs/video.js/issues/5533)) ([0060747](https://github.com/videojs/video.js/commit/0060747)) -* **lang:** add is loading ru translation ([#5630](https://github.com/videojs/video.js/issues/5630)) ([0090b75](https://github.com/videojs/video.js/commit/0090b75)) -* **lang:** Occitan: harmonisation plural/singular ([#5602](https://github.com/videojs/video.js/issues/5602)) ([4842201](https://github.com/videojs/video.js/commit/4842201)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.4.2 🚀 ([#5543](https://github.com/videojs/video.js/issues/5543)) ([dbaca33](https://github.com/videojs/video.js/commit/dbaca33)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.5.0 🚀 ([#5587](https://github.com/videojs/video.js/issues/5587)) ([d95ef6f](https://github.com/videojs/video.js/commit/d95ef6f)) -* duration reset and allow duration NaN or 0 for duration display ([#5348](https://github.com/videojs/video.js/issues/5348)) ([ab0e29a](https://github.com/videojs/video.js/commit/ab0e29a)), closes [#5347](https://github.com/videojs/video.js/issues/5347) -* not inline volume slider showing up after mouse hovering on it ([#5503](https://github.com/videojs/video.js/issues/5503)) ([7d127c8](https://github.com/videojs/video.js/commit/7d127c8)), closes [#5502](https://github.com/videojs/video.js/issues/5502) [#5505](https://github.com/videojs/video.js/issues/5505) -* vjs-lock-showing class gets removed from menu when no longer hovering on menu-button. ([#5465](https://github.com/videojs/video.js/issues/5465)) ([58f638e](https://github.com/videojs/video.js/commit/58f638e)), closes [#1690](https://github.com/videojs/video.js/issues/1690) - -### Chores - -* fix lint on pre-commit with lint-staged, use npm-merge-driver ([#5591](https://github.com/videojs/video.js/issues/5591)) ([be9e9a9](https://github.com/videojs/video.js/commit/be9e9a9)) -* fix travis build ([#5627](https://github.com/videojs/video.js/issues/5627)) ([6c1056b](https://github.com/videojs/video.js/commit/6c1056b)), closes [#5626](https://github.com/videojs/video.js/issues/5626) [#5616](https://github.com/videojs/video.js/issues/5616) -* Move a11y, lang, browserify, and webpack out of grunt ([#5589](https://github.com/videojs/video.js/issues/5589)) ([db6e376](https://github.com/videojs/video.js/commit/db6e376)) -* move copy, zip, and clean tasks to npm scripts ([#5544](https://github.com/videojs/video.js/issues/5544)) ([2d682a4](https://github.com/videojs/video.js/commit/2d682a4)) -* remove grunt move to npm scripts ([#5592](https://github.com/videojs/video.js/issues/5592)) ([d72786f](https://github.com/videojs/video.js/commit/d72786f)) -* switch from cross-var to cross-env ([#5600](https://github.com/videojs/video.js/issues/5600)) ([ab740bc](https://github.com/videojs/video.js/commit/ab740bc)) -* switch to videojs-generate-karma-config ([#5528](https://github.com/videojs/video.js/issues/5528)) ([2e70450](https://github.com/videojs/video.js/commit/2e70450)) -* update all the dev deps to their latest versions ([#5645](https://github.com/videojs/video.js/issues/5645)) ([db1369a](https://github.com/videojs/video.js/commit/db1369a)), closes [#5644](https://github.com/videojs/video.js/issues/5644) [#5643](https://github.com/videojs/video.js/issues/5643) -* update deps, remove coveralls, fix audit issues ([#5555](https://github.com/videojs/video.js/issues/5555)) ([11f1fb8](https://github.com/videojs/video.js/commit/11f1fb8)) -* use relative urls in index.html ([#5586](https://github.com/videojs/video.js/issues/5586)) ([dec31e4](https://github.com/videojs/video.js/commit/dec31e4)) -* **netlify:** make docs build properly ([#5636](https://github.com/videojs/video.js/issues/5636)) ([a8828cd](https://github.com/videojs/video.js/commit/a8828cd)) -* **package:** update conventional-changelog-cli to version 2.0.11 ([#5552](https://github.com/videojs/video.js/issues/5552)) ([f236176](https://github.com/videojs/video.js/commit/f236176)) -* **package:** update grunt-cli to version 1.3.2 ([#5550](https://github.com/videojs/video.js/issues/5550)) ([2d27b6a](https://github.com/videojs/video.js/commit/2d27b6a)) -* **package:** update husky to version 1.1.3 ([#5551](https://github.com/videojs/video.js/issues/5551)) ([937e2bf](https://github.com/videojs/video.js/commit/937e2bf)) -* **package:** update npm-run-all to 4.1.5 to remove event-stream ([#5614](https://github.com/videojs/video.js/issues/5614)) ([3e52c4f](https://github.com/videojs/video.js/commit/3e52c4f)) -* **package:** update remark-stringify to version 6.0.1 ([#5539](https://github.com/videojs/video.js/issues/5539)) ([d46828a](https://github.com/videojs/video.js/commit/d46828a)) -* **package:** update rollup to version 0.67.1 ([#5580](https://github.com/videojs/video.js/issues/5580)) ([209d9f9](https://github.com/videojs/video.js/commit/209d9f9)) -* **package:** update videojs-generate-karma-config to version 5.0.0 🚀 ([#5595](https://github.com/videojs/video.js/issues/5595)) ([2162239](https://github.com/videojs/video.js/commit/2162239)) -* **player:** fix linting for a comment ([#5588](https://github.com/videojs/video.js/issues/5588)) ([b5e6bdc](https://github.com/videojs/video.js/commit/b5e6bdc)) -* **travis:** remove unused secret variables ([#5577](https://github.com/videojs/video.js/issues/5577)) ([15beea7](https://github.com/videojs/video.js/commit/15beea7)) - -### Documentation - -* **media-error:** Correct error type documentation ([#5566](https://github.com/videojs/video.js/issues/5566)) ([441f0e1](https://github.com/videojs/video.js/commit/441f0e1)) -* update starter template ([#5570](https://github.com/videojs/video.js/issues/5570)) ([287b267](https://github.com/videojs/video.js/commit/287b267)), closes [1000#0](https://github.com/1000/issues/0) [#5562](https://github.com/videojs/video.js/issues/5562) -* Update urls in README.md to point to v7.3.0 ([#5536](https://github.com/videojs/video.js/issues/5536)) ([79edf5b](https://github.com/videojs/video.js/commit/79edf5b)) - - -# [7.3.0](https://github.com/videojs/video.js/compare/v7.2.4...v7.3.0) (2018-10-26) - -### Features - -* **fill:** make vjs-fill a player mode ([#5478](https://github.com/videojs/video.js/issues/5478)) ([ca09968](https://github.com/videojs/video.js/commit/ca09968)) -* Add breakpoints option to support toggling classes based on player width. ([#5471](https://github.com/videojs/video.js/issues/5471)) ([51bd49f](https://github.com/videojs/video.js/commit/51bd49f)), closes [videojs/video.js#4371](https://github.com/videojs/video.js/issues/4371) -* Add responsive option, which enables breakpoints support. ([#5496](https://github.com/videojs/video.js/issues/5496)) ([6df3ac7](https://github.com/videojs/video.js/commit/6df3ac7)), closes [#5471](https://github.com/videojs/video.js/issues/5471) -* createLogger for easier logging in individual modules ([#5418](https://github.com/videojs/video.js/issues/5418)) ([966eb56](https://github.com/videojs/video.js/commit/966eb56)) - -### Bug Fixes - -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.3.0 🚀 ([#5482](https://github.com/videojs/video.js/issues/5482)) ([159483e](https://github.com/videojs/video.js/commit/159483e)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.3.1 🚀 ([#5508](https://github.com/videojs/video.js/issues/5508)) ([46e3ef0](https://github.com/videojs/video.js/commit/46e3ef0)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.4.0 🚀 ([#5523](https://github.com/videojs/video.js/issues/5523)) ([0847485](https://github.com/videojs/video.js/commit/0847485)) -* add support for :focus-visible selector ([#5483](https://github.com/videojs/video.js/issues/5483)) ([b8fe624](https://github.com/videojs/video.js/commit/b8fe624)), closes [#5474](https://github.com/videojs/video.js/issues/5474) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.4.1 🚀 ([#5527](https://github.com/videojs/video.js/issues/5527)) ([ad6fc7f](https://github.com/videojs/video.js/commit/ad6fc7f)) -* **package:** update videojs-font to version 3.1.0 🚀 ([#5476](https://github.com/videojs/video.js/issues/5476)) ([29c8259](https://github.com/videojs/video.js/commit/29c8259)) -* **TextTrackSetting:** Do not use default button type. ([#5512](https://github.com/videojs/video.js/issues/5512)) ([dfcfa45](https://github.com/videojs/video.js/commit/dfcfa45)) -* **vjsstandard:** update to 8.0.2 and fixup linting ([#5413](https://github.com/videojs/video.js/issues/5413)) ([6bff3ce](https://github.com/videojs/video.js/commit/6bff3ce)) -* blob urls being ignored as valid sources ([#5525](https://github.com/videojs/video.js/issues/5525)) ([8bf4206](https://github.com/videojs/video.js/commit/8bf4206)), closes [#5504](https://github.com/videojs/video.js/issues/5504) -* Prevent ResizeManager from being clicked on safari, fix playerresize on firefox ([#5522](https://github.com/videojs/video.js/issues/5522)) ([4827110](https://github.com/videojs/video.js/commit/4827110)) - -### Chores - -* **babel:** Upgrade to Babel 7 ([#5498](https://github.com/videojs/video.js/issues/5498)) ([313036e](https://github.com/videojs/video.js/commit/313036e)) -* **lang:** update translations-needed doc ([#5459](https://github.com/videojs/video.js/issues/5459)) ([c2eb138](https://github.com/videojs/video.js/commit/c2eb138)) -* **package:** update grunt-sass to version 3.0.2 🚀 ([#5486](https://github.com/videojs/video.js/issues/5486)) ([f9fcd14](https://github.com/videojs/video.js/commit/f9fcd14)) -* **package:** update husky to version 1.0.1 🚀 ([#5448](https://github.com/videojs/video.js/issues/5448)) ([e50b193](https://github.com/videojs/video.js/commit/e50b193)) -* switch to prepublishOnly npm script to prevent build on npm ci ([#5497](https://github.com/videojs/video.js/issues/5497)) ([59adeb3](https://github.com/videojs/video.js/commit/59adeb3)) -* **package:** update klaw-sync to version 6.0.0 🚀 ([#5445](https://github.com/videojs/video.js/issues/5445)) ([55f2b15](https://github.com/videojs/video.js/commit/55f2b15)) -* move scss grunt tasks to npm scripts ([#5520](https://github.com/videojs/video.js/issues/5520)) ([5f73f76](https://github.com/videojs/video.js/commit/5f73f76)) -* remove rollup filesize plugin to double build speed ([#5518](https://github.com/videojs/video.js/issues/5518)) ([a9ae77f](https://github.com/videojs/video.js/commit/a9ae77f)) -* **package:** update remark-cli to version 6.0.0 🚀 ([#5516](https://github.com/videojs/video.js/issues/5516)) ([29005e9](https://github.com/videojs/video.js/commit/29005e9)) -* **package:** update remark-parse to version 6.0.0 🚀 ([#5514](https://github.com/videojs/video.js/issues/5514)) ([d8e88cf](https://github.com/videojs/video.js/commit/d8e88cf)) -* **package:** update remark-stringify to version 6.0.0 🚀 ([#5515](https://github.com/videojs/video.js/issues/5515)) ([8fa2f8a](https://github.com/videojs/video.js/commit/8fa2f8a)) -* **package:** update rollup to version 0.66.0 🚀 ([#5439](https://github.com/videojs/video.js/issues/5439)) ([3d72660](https://github.com/videojs/video.js/commit/3d72660)) -* **package:** upgrade rollup to 0.66.2 ([#5458](https://github.com/videojs/video.js/issues/5458)) ([426e210](https://github.com/videojs/video.js/commit/426e210)) -* **rollup:** fix watch build with globals/externals ([#5519](https://github.com/videojs/video.js/issues/5519)) ([401fa28](https://github.com/videojs/video.js/commit/401fa28)) - -### Documentation - -* Update JSDoc comments, so core API docs for the videojs function are accurate. ([#5385](https://github.com/videojs/video.js/issues/5385)) ([ebf8d66](https://github.com/videojs/video.js/commit/ebf8d66)) -* **fixup:** fixup docs ([#5489](https://github.com/videojs/video.js/issues/5489)) ([794cd71](https://github.com/videojs/video.js/commit/794cd71)) -* **layout:** document fluid and fill mode ([#5481](https://github.com/videojs/video.js/issues/5481)) ([2e72fc3](https://github.com/videojs/video.js/commit/2e72fc3)) -* **player:** make reset() method more clear ([#5501](https://github.com/videojs/video.js/issues/5501)) ([f66692e](https://github.com/videojs/video.js/commit/f66692e)) -* **README:** refer to minified JS and CSS files, improve general layout ([#5494](https://github.com/videojs/video.js/issues/5494)) ([e671bc3](https://github.com/videojs/video.js/commit/e671bc3)) -* **README:** update info about google analytics ([#5491](https://github.com/videojs/video.js/issues/5491)) ([7292253](https://github.com/videojs/video.js/commit/7292253)), closes [#5361](https://github.com/videojs/video.js/issues/5361) - - -## [7.2.4](https://github.com/videojs/video.js/compare/v7.2.3...v7.2.4) (2018-09-25) - -### Bug Fixes - -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.2.6 🚀 ([#5444](https://github.com/videojs/video.js/issues/5444)) ([b9a7cc8](https://github.com/videojs/video.js/commit/b9a7cc8)) -* **text track display:** update on playerresize and orientationchange ([#5447](https://github.com/videojs/video.js/issues/5447)) ([e69842c](https://github.com/videojs/video.js/commit/e69842c)) -* **text-tracks:** cuechange handler not triggering correctly ([#5446](https://github.com/videojs/video.js/issues/5446)) ([15df4e1](https://github.com/videojs/video.js/commit/15df4e1)), closes [#5308](https://github.com/videojs/video.js/issues/5308) - -### Chores - -* **package-lock:** update to npm 6.4.1 & node 8.12 ([565b750](https://github.com/videojs/video.js/commit/565b750)) - - -## [7.2.3](https://github.com/videojs/video.js/compare/v7.2.2...v7.2.3) (2018-09-13) - -### Bug Fixes - -* **lang:** Fixed typos in cs translation ([#5407](https://github.com/videojs/video.js/issues/5407)) ([19ee7df](https://github.com/videojs/video.js/commit/19ee7df)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.2.5 🚀 ([#5399](https://github.com/videojs/video.js/issues/5399)) ([335a0c8](https://github.com/videojs/video.js/commit/335a0c8)) -* make sure all attributes are updated before applying to tag ([#5416](https://github.com/videojs/video.js/issues/5416)) ([b25f024](https://github.com/videojs/video.js/commit/b25f024)), closes [#5309](https://github.com/videojs/video.js/issues/5309) -* use consistent id for tech, no matter how it is loaded ([#5415](https://github.com/videojs/video.js/issues/5415)) ([6d6bfd1](https://github.com/videojs/video.js/commit/6d6bfd1)), closes [#5411](https://github.com/videojs/video.js/issues/5411) -* **ResizeManager:** fixup the null check ([#5427](https://github.com/videojs/video.js/issues/5427)) ([235b188](https://github.com/videojs/video.js/commit/235b188)) - -### Chores - -* **package:** Run npm audit fix (but roll back videojs-standard version) ([#5386](https://github.com/videojs/video.js/issues/5386)) ([197d81b](https://github.com/videojs/video.js/commit/197d81b)) -* **package:** update grunt-cli to version 1.3.1 ([#5409](https://github.com/videojs/video.js/issues/5409)) ([96ae3c2](https://github.com/videojs/video.js/commit/96ae3c2)), closes [#5383](https://github.com/videojs/video.js/issues/5383) -* **package:** update grunt-contrib-clean to version 2.0.0 🚀 ([#5429](https://github.com/videojs/video.js/issues/5429)) ([8191958](https://github.com/videojs/video.js/commit/8191958)) -* **package:** update grunt-contrib-connect to version 2.0.0 🚀 ([#5428](https://github.com/videojs/video.js/issues/5428)) ([08cf1be](https://github.com/videojs/video.js/commit/08cf1be)) -* **package:** update grunt-contrib-cssmin to version 3.0.0 🚀 ([#5417](https://github.com/videojs/video.js/issues/5417)) ([cc650f7](https://github.com/videojs/video.js/commit/cc650f7)) -* **package:** update grunt-karma to version 3.0.0 🚀 ([#5421](https://github.com/videojs/video.js/issues/5421)) ([b390f2c](https://github.com/videojs/video.js/commit/b390f2c)) -* **package:** update klaw-sync to version 5.0.0 🚀 ([#5414](https://github.com/videojs/video.js/issues/5414)) ([2e83888](https://github.com/videojs/video.js/commit/2e83888)) -* **package:** update rollup to version 0.65.0 🚀 ([#5400](https://github.com/videojs/video.js/issues/5400)) ([6e6ade0](https://github.com/videojs/video.js/commit/6e6ade0)) - -### Tests - -* fix travis ci issues with resize-manager tests ([#5390](https://github.com/videojs/video.js/issues/5390)) ([3744df1](https://github.com/videojs/video.js/commit/3744df1)) - - -## [7.2.2](https://github.com/videojs/video.js/compare/v7.2.1...v7.2.2) (2018-08-14) - -### Bug Fixes - -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.2.4 🚀 ([#5377](https://github.com/videojs/video.js/issues/5377)) ([c3098ee](https://github.com/videojs/video.js/commit/c3098ee)), closes [#5044](https://github.com/videojs/video.js/issues/5044) -* add debounced.cancel and use it in ResizeManager ([#5378](https://github.com/videojs/video.js/issues/5378)) ([8e9d92c](https://github.com/videojs/video.js/commit/8e9d92c)) - - -## [7.2.1](https://github.com/videojs/video.js/compare/v7.2.0...v7.2.1) (2018-08-13) - -### Bug Fixes - -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.2.3 ([#5368](https://github.com/videojs/video.js/issues/5368)) ([db4b894](https://github.com/videojs/video.js/commit/db4b894)), closes [#5365](https://github.com/videojs/video.js/issues/5365) -* **sourceset:** ignore blob urls when updating source cache ([#5371](https://github.com/videojs/video.js/issues/5371)) ([9cb1ba5](https://github.com/videojs/video.js/commit/9cb1ba5)) -* always return a promise from play, if supported ([#5227](https://github.com/videojs/video.js/issues/5227)) ([58405fd](https://github.com/videojs/video.js/commit/58405fd)) -* call component dispose in resize manager to fix leak ([#5369](https://github.com/videojs/video.js/issues/5369)) ([6f072d8](https://github.com/videojs/video.js/commit/6f072d8)), closes [#5339](https://github.com/videojs/video.js/issues/5339) -* change time tooltips to be absolutely positioned ([#5355](https://github.com/videojs/video.js/issues/5355)) ([4b666f9](https://github.com/videojs/video.js/commit/4b666f9)), closes [#5351](https://github.com/videojs/video.js/issues/5351) - -### Chores - -* **https:** update a lot of links to be https ([#5372](https://github.com/videojs/video.js/issues/5372)) ([9c00267](https://github.com/videojs/video.js/commit/9c00267)) -* **package:** update karma to version 3.0.0 🚀 ([#5370](https://github.com/videojs/video.js/issues/5370)) ([6893091](https://github.com/videojs/video.js/commit/6893091)) -* **package:** update rollup to version 0.64.1 ([#5367](https://github.com/videojs/video.js/issues/5367)) ([16f4e92](https://github.com/videojs/video.js/commit/16f4e92)), closes [#5363](https://github.com/videojs/video.js/issues/5363) - - -# [7.2.0](https://github.com/videojs/video.js/compare/v7.1.0...v7.2.0) (2018-07-26) - -### Features - -* **player:** remove text tracks on Player#reset ([#5327](https://github.com/videojs/video.js/issues/5327)) ([fd4c6e1](https://github.com/videojs/video.js/commit/fd4c6e1)), closes [#5140](https://github.com/videojs/video.js/issues/5140) -* **plugins:** allow plugin deregistration from videojs ([#5273](https://github.com/videojs/video.js/issues/5273)) ([31a0bac](https://github.com/videojs/video.js/commit/31a0bac)) -* async `change` events in TextTrackList with EventTarget#queueTrigger ([#5332](https://github.com/videojs/video.js/issues/5332)) ([8c92cbf](https://github.com/videojs/video.js/commit/8c92cbf)), closes [#5159](https://github.com/videojs/video.js/issues/5159) - -### Bug Fixes - -* **lang:** add a missing translation in sk.json ([#5324](https://github.com/videojs/video.js/issues/5324)) ([821b46d](https://github.com/videojs/video.js/commit/821b46d)) -* **lang:** Added all missing translation for CZ_cs ([#5311](https://github.com/videojs/video.js/issues/5311)) ([e63d235](https://github.com/videojs/video.js/commit/e63d235)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.2.1 ([#5334](https://github.com/videojs/video.js/issues/5334)) ([7b6aa5c](https://github.com/videojs/video.js/commit/7b6aa5c)), closes [#5321](https://github.com/videojs/video.js/issues/5321) -* subtitles/captions freeze when using uglify ([#5346](https://github.com/videojs/video.js/issues/5346)) ([5e21ebb](https://github.com/videojs/video.js/commit/5e21ebb)), closes [#5131](https://github.com/videojs/video.js/issues/5131) - -### Chores - -* **package:** update autoprefixer to version 9.0.1 ([#5340](https://github.com/videojs/video.js/issues/5340)) ([80bae72](https://github.com/videojs/video.js/commit/80bae72)), closes [#5322](https://github.com/videojs/video.js/issues/5322) -* **package:** update postcss-cli to version 6.0.0 🚀 ([#5329](https://github.com/videojs/video.js/issues/5329)) ([f273873](https://github.com/videojs/video.js/commit/f273873)) -* **package:** update rollup to version 0.63.4 ([#5341](https://github.com/videojs/video.js/issues/5341)) ([391434d](https://github.com/videojs/video.js/commit/391434d)), closes [#5326](https://github.com/videojs/video.js/issues/5326) -* **welcome bot:** add welcome bot config ([#5313](https://github.com/videojs/video.js/issues/5313)) ([e637768](https://github.com/videojs/video.js/commit/e637768)) - -### Documentation - -* remove duplicate `[@deprecated](https://github.com/deprecated)` which throws error when minifying via google closure compiler ([#5342](https://github.com/videojs/video.js/issues/5342)) ([d773cd4](https://github.com/videojs/video.js/commit/d773cd4)) - - -# [7.1.0](https://github.com/videojs/video.js/compare/v7.0.5...v7.1.0) (2018-07-06) - -### Features - -* **autoplay:** extend autoplay option for greater good ([#5209](https://github.com/videojs/video.js/issues/5209)) ([e8e4fe2](https://github.com/videojs/video.js/commit/e8e4fe2)) -* Add an Audio Description icon to an audio track name in the track menu if it is "main-desc" kind. ([#4599](https://github.com/videojs/video.js/issues/4599)) ([53c62ac](https://github.com/videojs/video.js/commit/53c62ac)) -* **browser:** include iOS Chrome UA pattern when detecting Google Chrome ([#5262](https://github.com/videojs/video.js/issues/5262)) ([b430461](https://github.com/videojs/video.js/commit/b430461)) -* **css:** run autoprefixer on css ([#5239](https://github.com/videojs/video.js/issues/5239)) ([edce736](https://github.com/videojs/video.js/commit/edce736)) -* add double-click handler to toggle fullscreen ([#5148](https://github.com/videojs/video.js/issues/5148)) ([1b9bd42](https://github.com/videojs/video.js/commit/1b9bd42)), closes [#4948](https://github.com/videojs/video.js/issues/4948) -* show mute toggle button if the tech supports muting volume ([#5052](https://github.com/videojs/video.js/issues/5052)) ([2370416](https://github.com/videojs/video.js/commit/2370416)), closes [#4478](https://github.com/videojs/video.js/issues/4478) -* **fullscreen-toggle:** disable fs button if fullcreen is unavailable ([#5296](https://github.com/videojs/video.js/issues/5296)) ([444b271](https://github.com/videojs/video.js/commit/444b271)), closes [#5290](https://github.com/videojs/video.js/issues/5290) -* **middleware:** make setSource be optional ([#5295](https://github.com/videojs/video.js/issues/5295)) ([781a6d8](https://github.com/videojs/video.js/commit/781a6d8)) -* **text-track-display:** Extend the constructColor function to handle 6 digit hex codes ([#5238](https://github.com/videojs/video.js/issues/5238)) ([e92f177](https://github.com/videojs/video.js/commit/e92f177)) - -### Bug Fixes - -* Allow evented objects, such as components and plugins, to listen to the window object in addition to DOM objects. ([#5255](https://github.com/videojs/video.js/issues/5255)) ([7fd29b4](https://github.com/videojs/video.js/commit/7fd29b4)) -* **browser:** TOUCH_ENABLED detection with Win10 ([#5286](https://github.com/videojs/video.js/issues/5286)) ([e683891](https://github.com/videojs/video.js/commit/e683891)), closes [#3306](https://github.com/videojs/video.js/issues/3306) -* autoplay throws 'undefined promise' error on some browsers. ([#5283](https://github.com/videojs/video.js/issues/5283)) ([c9d1e8a](https://github.com/videojs/video.js/commit/c9d1e8a)) - -### Chores - -* **npmignore:** don't publish zip file to npm ([#5249](https://github.com/videojs/video.js/issues/5249)) ([5b8d373](https://github.com/videojs/video.js/commit/5b8d373)), closes [#5248](https://github.com/videojs/video.js/issues/5248) -* enable move and stale probots ([#5292](https://github.com/videojs/video.js/issues/5292)) ([00bb788](https://github.com/videojs/video.js/commit/00bb788)) -* **package:** add module field to package.json ([#5293](https://github.com/videojs/video.js/issues/5293)) ([5d75bb6](https://github.com/videojs/video.js/commit/5d75bb6)), closes [#5288](https://github.com/videojs/video.js/issues/5288) -* **package:** update rollup to version 0.61.1 ([#5268](https://github.com/videojs/video.js/issues/5268)) ([5c15d48](https://github.com/videojs/video.js/commit/5c15d48)) -* **package:** update rollup to version 0.62.0 🚀 ([#5279](https://github.com/videojs/video.js/issues/5279)) ([2d7a4d7](https://github.com/videojs/video.js/commit/2d7a4d7)) -* **package:** upgrade to VHS 1.1.0 ([#5305](https://github.com/videojs/video.js/issues/5305)) ([da5a590](https://github.com/videojs/video.js/commit/da5a590)) - -### Code Refactoring - -* removed old bug work-around code ([#5200](https://github.com/videojs/video.js/issues/5200)) ([ceed382](https://github.com/videojs/video.js/commit/ceed382)) - -### Performance Improvements - -* setTimeout and requestAnimationFrame memory leak ([#5294](https://github.com/videojs/video.js/issues/5294)) ([d7f27b7](https://github.com/videojs/video.js/commit/d7f27b7)), closes [#5199](https://github.com/videojs/video.js/issues/5199) - -### Reverts - -* "fix: Allow evented objects, such as components and plugins, to listen to the window object in addition to DOM objects. ([#5255](https://github.com/videojs/video.js/issues/5255))" ([#5301](https://github.com/videojs/video.js/issues/5301)) ([361dc76](https://github.com/videojs/video.js/commit/361dc76)), closes [#5281](https://github.com/videojs/video.js/issues/5281) - - -## [7.0.5](https://github.com/videojs/video.js/compare/v7.0.4...v7.0.5) (2018-06-11) - -### Bug Fixes - -* make sure source options are passed through ([#5241](https://github.com/videojs/video.js/issues/5241)) ([9504a93](https://github.com/videojs/video.js/commit/9504a93)), closes [#5156](https://github.com/videojs/video.js/issues/5156) -* menu sizing when using longer caption labels ([#5228](https://github.com/videojs/video.js/issues/5228)) ([002d701](https://github.com/videojs/video.js/commit/002d701)), closes [#4758](https://github.com/videojs/video.js/issues/4758) - -### Chores - -* **package:** update conventional-changelog-cli to version 2.0.1 🚀 ([#5236](https://github.com/videojs/video.js/issues/5236)) ([59ab323](https://github.com/videojs/video.js/commit/59ab323)), closes [#5225](https://github.com/videojs/video.js/issues/5225) -* **package:** update grunt-contrib-watch to version 1.1.0 🚀 ([#5170](https://github.com/videojs/video.js/issues/5170)) ([e8d00e2](https://github.com/videojs/video.js/commit/e8d00e2)) -* **package:** update rollup to version 0.60.1 🚀 ([#5235](https://github.com/videojs/video.js/issues/5235)) ([1b0ff8a](https://github.com/videojs/video.js/commit/1b0ff8a)), closes [#5232](https://github.com/videojs/video.js/issues/5232) -* **package:** update rollup-plugin-filesize to version 2.0.0 🚀 ([#5234](https://github.com/videojs/video.js/issues/5234)) ([781d9ae](https://github.com/videojs/video.js/commit/781d9ae)) - - -## [7.0.4](https://github.com/videojs/video.js/compare/v7.0.3...v7.0.4) (2018-06-05) - -### Bug Fixes - -* **menus:** change ARIA role of menu items for better screen reader support ([#5171](https://github.com/videojs/video.js/issues/5171)) ([f3d7ac2](https://github.com/videojs/video.js/commit/f3d7ac2)), closes [#5136](https://github.com/videojs/video.js/issues/5136) -* **player:** ensure that JAWS+IE announces the BPB and play button ([#5173](https://github.com/videojs/video.js/issues/5173)) ([2bc810d](https://github.com/videojs/video.js/commit/2bc810d)), closes [#4583](https://github.com/videojs/video.js/issues/4583) -* build core script files as UMD ([#5220](https://github.com/videojs/video.js/issues/5220)) ([7c5a066](https://github.com/videojs/video.js/commit/7c5a066)) -* silence play promise in a few more places ([#5213](https://github.com/videojs/video.js/issues/5213)) ([a29156c](https://github.com/videojs/video.js/commit/a29156c)) -* **slider:** suppress console warnings in Chrome for Android when scrubbing ([#5219](https://github.com/videojs/video.js/issues/5219)) ([59869b9](https://github.com/videojs/video.js/commit/59869b9)), closes [#4650](https://github.com/videojs/video.js/issues/4650) - -### Chores - -* **build:** fix rollup watch during npm start ([#5203](https://github.com/videojs/video.js/issues/5203)) ([6a94741](https://github.com/videojs/video.js/commit/6a94741)) - -### Documentation - -* **collaborator-guide:** Clarify how to Land a PR using the GitHub UI ([#5201](https://github.com/videojs/video.js/issues/5201)) ([94e54fc](https://github.com/videojs/video.js/commit/94e54fc)) -* **component:** fix typo ([#5226](https://github.com/videojs/video.js/issues/5226)) ([a3fd06a](https://github.com/videojs/video.js/commit/a3fd06a)) -* **examples:** remove IE9 text track HTML markup in the doc/examples, and update to use video.js v7.0 ([#5192](https://github.com/videojs/video.js/issues/5192)) ([f5a6e61](https://github.com/videojs/video.js/commit/f5a6e61)) - - -## [7.0.3](https://github.com/videojs/video.js/compare/v7.0.2...v7.0.3) (2018-05-23) - -### Bug Fixes - -* **player:** video-js embed missing video-js class ([#5194](https://github.com/videojs/video.js/issues/5194)) ([954f3d9](https://github.com/videojs/video.js/commit/954f3d9)), closes [#5041](https://github.com/videojs/video.js/issues/5041) [videojs/http-streaming#100](https://github.com/videojs/http-streaming/issues/100) - - -## [7.0.2](https://github.com/videojs/video.js/compare/v7.0.1...v7.0.2) (2018-05-18) - -### Chores - -* **package:** Upgrade [@videojs](https://github.com/videojs)/http-streaming to 1.0.2 ([#5189](https://github.com/videojs/video.js/issues/5189)) ([eaf1516](https://github.com/videojs/video.js/commit/eaf1516)), closes [#5186](https://github.com/videojs/video.js/issues/5186) - - -## [7.0.1](https://github.com/videojs/video.js/compare/v7.0.0...v7.0.1) (2018-05-17) - -### Bug Fixes - -* **CHANGELOG:** full 7.0.0 changelog ([09ddb98](https://github.com/videojs/video.js/commit/09ddb98)) -* check for el before resetSourceSet ([#5176](https://github.com/videojs/video.js/issues/5176)) ([59c6261](https://github.com/videojs/video.js/commit/59c6261)) - - -# [7.0.0](https://github.com/videojs/video.js/compare/v6.8.0...v7.0.0) (2018-05-11) - -### Features - -* **modal:** remove old IE box sizing ([#5113](https://github.com/videojs/video.js/issues/5113)) ([4a34dd7](https://github.com/videojs/video.js/commit/4a34dd7)) -* add 'autoSetup' option ([#5123](https://github.com/videojs/video.js/issues/5123)) ([d446828](https://github.com/videojs/video.js/commit/d446828)), closes [#5094](https://github.com/videojs/video.js/issues/5094) -* add tech method to allow override native audio and video ([#5074](https://github.com/videojs/video.js/issues/5074)) ([22bbbc9](https://github.com/videojs/video.js/commit/22bbbc9)) -* build alternate browser scripts without VHS ([#5077](https://github.com/videojs/video.js/issues/5077)) ([c98912f](https://github.com/videojs/video.js/commit/c98912f)) -* built-in HLS playback support ([#5057](https://github.com/videojs/video.js/issues/5057)) ([d1b4768](https://github.com/videojs/video.js/commit/d1b4768)) -* copy properties from to the media el ([#5039](https://github.com/videojs/video.js/issues/5039)) ([c6617b2](https://github.com/videojs/video.js/commit/c6617b2)) -* Queue playback events when the playback rate is zero and we are seeking ([#5024](https://github.com/videojs/video.js/issues/5024)) ([a2851fe](https://github.com/videojs/video.js/commit/a2851fe)) -* split overrideNative method into separate methods ([#5107](https://github.com/videojs/video.js/issues/5107)) ([083a86c](https://github.com/videojs/video.js/commit/083a86c)) -* update the players source cache on sourceset ([#5040](https://github.com/videojs/video.js/issues/5040)) ([ba2ae78](https://github.com/videojs/video.js/commit/ba2ae78)) -* upgrade video.js font to 3.0 for woff only font-icons ([#5112](https://github.com/videojs/video.js/issues/5112)) ([eeb13aa](https://github.com/videojs/video.js/commit/eeb13aa)) - -### Bug Fixes - -* **lang:** add missing strings in pt-BR ([#5122](https://github.com/videojs/video.js/issues/5122)) ([a00aa0d](https://github.com/videojs/video.js/commit/a00aa0d)), closes [#5121](https://github.com/videojs/video.js/issues/5121) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 0.9.0 🚀 ([#5064](https://github.com/videojs/video.js/issues/5064)) ([11b4d5d](https://github.com/videojs/video.js/commit/11b4d5d)) -* **package:** update [@videojs](https://github.com/videojs)/http-streaming to version 1.0.0 🚀 ([#5083](https://github.com/videojs/video.js/issues/5083)) ([12095fb](https://github.com/videojs/video.js/commit/12095fb)) -* **package:** update videojs-vtt.js to version 0.14.1 🚀 ([#5085](https://github.com/videojs/video.js/issues/5085)) ([66d7545](https://github.com/videojs/video.js/commit/66d7545)) -* **seek-bar:** ensure aria-valuenow attribute in seek-bar is not NaN ([#5164](https://github.com/videojs/video.js/issues/5164)) ([ad1bb9d](https://github.com/videojs/video.js/commit/ad1bb9d)), closes [#4960](https://github.com/videojs/video.js/issues/4960) -* options.id is now applied correctly to the player dom element ([#5090](https://github.com/videojs/video.js/issues/5090)) ([b10b9f9](https://github.com/videojs/video.js/commit/b10b9f9)), closes [#5088](https://github.com/videojs/video.js/issues/5088) -* **time-display:** restore hidden label text for screen readers. ([#5157](https://github.com/videojs/video.js/issues/5157)) ([0aa827f](https://github.com/videojs/video.js/commit/0aa827f)), closes [#5135](https://github.com/videojs/video.js/issues/5135) -* **time-display:** Use formatTime for a consistent default instead of hardcoded string ([#5055](https://github.com/videojs/video.js/issues/5055)) ([228484b](https://github.com/videojs/video.js/commit/228484b)) -* `sourceset` and browser behavior inconsistencies ([#5054](https://github.com/videojs/video.js/issues/5054)) ([6147e5f](https://github.com/videojs/video.js/commit/6147e5f)) -* fire sourceset on initial source append ([#5038](https://github.com/videojs/video.js/issues/5038)) ([9eb5de7](https://github.com/videojs/video.js/commit/9eb5de7)) -* let the tech preload auto on its own ([#4861](https://github.com/videojs/video.js/issues/4861)) ([fdcae1b](https://github.com/videojs/video.js/commit/fdcae1b)), closes [#4660](https://github.com/videojs/video.js/issues/4660) -* Reduce the multiple-announcement by screen readers of the new name of a button when its text label changes. ([#5158](https://github.com/videojs/video.js/issues/5158)) ([1c74e4f](https://github.com/videojs/video.js/commit/1c74e4f)), closes [#5023](https://github.com/videojs/video.js/issues/5023) -* Remove spaces from element IDs and ARIA attributes in the Captions Settings Dialog ([#5153](https://github.com/videojs/video.js/issues/5153)) ([dc0d2bc](https://github.com/videojs/video.js/commit/dc0d2bc)), closes [#4688](https://github.com/videojs/video.js/issues/4688) [#4884](https://github.com/videojs/video.js/issues/4884) -* Remove unnecessary ARIA role on the Control Bar. ([#5154](https://github.com/videojs/video.js/issues/5154)) ([8a08957](https://github.com/videojs/video.js/commit/8a08957)), closes [#5134](https://github.com/videojs/video.js/issues/5134) -* wait till play event to listen for user activity ([#5093](https://github.com/videojs/video.js/issues/5093)) ([d0b03a3](https://github.com/videojs/video.js/commit/d0b03a3)), closes [#5076](https://github.com/videojs/video.js/issues/5076) - -### Chores - -* update rollup and uglify and the build process ([#5096](https://github.com/videojs/video.js/issues/5096)) ([97db94e](https://github.com/videojs/video.js/commit/97db94e)) -* **CHANGELOG:** update CHANGELOG from 6.x ([bca3167](https://github.com/videojs/video.js/commit/bca3167)) -* **first-timers-bot:** add repo to bot options ([81de856](https://github.com/videojs/video.js/commit/81de856)) -* **first-timers-bot:** correct the path to template file ([9612c8f](https://github.com/videojs/video.js/commit/9612c8f)) -* **first-timers-bot:** fix slack url in template ([4e79a04](https://github.com/videojs/video.js/commit/4e79a04)) -* **first-timers-bot:** quote repository option ([edb257c](https://github.com/videojs/video.js/commit/edb257c)) -* **package:** remove npm-run dev dep as it's no longer used ([#5084](https://github.com/videojs/video.js/issues/5084)) ([c2b5ade](https://github.com/videojs/video.js/commit/c2b5ade)) -* **package:** update karma to version 2.0.2 🚀 ([#5109](https://github.com/videojs/video.js/issues/5109)) ([907c1f5](https://github.com/videojs/video.js/commit/907c1f5)) -* **package:** update klaw-sync to version 4.0.0 🚀 ([#5130](https://github.com/videojs/video.js/issues/5130)) ([a6165d9](https://github.com/videojs/video.js/commit/a6165d9)) -* **package:** update load-grunt-tasks to version 4.0.0 🚀 ([#5151](https://github.com/videojs/video.js/issues/5151)) ([83c3055](https://github.com/videojs/video.js/commit/83c3055)) -* **package:** update rollup-plugin-json to version 3.0.0 🚀 ([#5169](https://github.com/videojs/video.js/issues/5169)) ([de9c4da](https://github.com/videojs/video.js/commit/de9c4da)) -* **package:** update unified to version 7.0.0 🚀 ([#5166](https://github.com/videojs/video.js/issues/5166)) ([5407381](https://github.com/videojs/video.js/commit/5407381)) -* **test:** upgrade qunit and karma-qunit to latest ([#5051](https://github.com/videojs/video.js/issues/5051)) ([44312bc](https://github.com/videojs/video.js/commit/44312bc)) - -### Code Refactoring - -* move seekbar event handler bindings into a function ([#5097](https://github.com/videojs/video.js/issues/5097)) ([1069e7f](https://github.com/videojs/video.js/commit/1069e7f)) -* move sourceset code out of tech ([#5037](https://github.com/videojs/video.js/issues/5037)) ([1cb67ab](https://github.com/videojs/video.js/commit/1cb67ab)) -* remove IE8 specific changes ([#5041](https://github.com/videojs/video.js/issues/5041)) ([bc2da7c](https://github.com/videojs/video.js/commit/bc2da7c)) - -### Documentation - -* fix more misspellings ([#5067](https://github.com/videojs/video.js/issues/5067)) ([7da7766](https://github.com/videojs/video.js/commit/7da7766)) -* fix some misspellings ([#5082](https://github.com/videojs/video.js/issues/5082)) ([064c1be](https://github.com/videojs/video.js/commit/064c1be)) -* update readme to use the latest version of vjs ([#5073](https://github.com/videojs/video.js/issues/5073)) ([167b7d8](https://github.com/videojs/video.js/commit/167b7d8)), closes [#5066](https://github.com/videojs/video.js/issues/5066) -* **debugging:** fix markup typo ([#5086](https://github.com/videojs/video.js/issues/5086)) ([4399bdc](https://github.com/videojs/video.js/commit/4399bdc)) -* **guides:** add debugging section to index ([#5100](https://github.com/videojs/video.js/issues/5100)) ([62c1477](https://github.com/videojs/video.js/commit/62c1477)) -* **languages:** Use valid JSON in translation example ([#5080](https://github.com/videojs/video.js/issues/5080)) ([bec7f67](https://github.com/videojs/video.js/commit/bec7f67)) -* **tech:** fix misspellings ([#5059](https://github.com/videojs/video.js/issues/5059)) ([96987f8](https://github.com/videojs/video.js/commit/96987f8)) -* **text-track:** fix misspellings ([#5058](https://github.com/videojs/video.js/issues/5058)) ([4d3331e](https://github.com/videojs/video.js/commit/4d3331e)) -* **time-ranges:** fix misspellings ([#5046](https://github.com/videojs/video.js/issues/5046)) ([378d98e](https://github.com/videojs/video.js/commit/378d98e)) - -### Tests - -* no longer test on IE8, IE9, or IE10 ([#5032](https://github.com/videojs/video.js/issues/5032)) ([0a20d65](https://github.com/videojs/video.js/commit/0a20d65)) -* update karma browser OS versions ([#5050](https://github.com/videojs/video.js/issues/5050)) ([3798446](https://github.com/videojs/video.js/commit/3798446)) - - -### BREAKING CHANGES - -* remove IE8, IE9, and IE10 specific JavaScript and CSS code. Remove Android 2.3 workaround. - - -# [6.10.0](https://github.com/videojs/video.js/compare/v6.9.0...v6.10.0) (2018-05-11) - -### Features - -* add 'autoSetup' option ([#5123](https://github.com/videojs/video.js/issues/5123)) ([592c255](https://github.com/videojs/video.js/commit/592c255)), closes [#5094](https://github.com/videojs/video.js/issues/5094) -* copy properties from to the media el from ([#5039](https://github.com/videojs/video.js/issues/5039)) as ([#5163](https://github.com/videojs/video.js/issues/5163)) ([c654c7d](https://github.com/videojs/video.js/commit/c654c7d)) -* update the players source cache on sourceset from ([#5040](https://github.com/videojs/video.js/issues/5040)) as ([#5156](https://github.com/videojs/video.js/issues/5156)) ([72f84d5](https://github.com/videojs/video.js/commit/72f84d5)) - -### Bug Fixes - -* **time-display:** restore hidden label text for screen readers. ([#5157](https://github.com/videojs/video.js/issues/5157)) ([baa6b56](https://github.com/videojs/video.js/commit/baa6b56)), closes [#5135](https://github.com/videojs/video.js/issues/5135) -* `sourceset` and browser behavior inconsistencies from ([#5054](https://github.com/videojs/video.js/issues/5054)) as ([#5162](https://github.com/videojs/video.js/issues/5162)) ([e1d26d8](https://github.com/videojs/video.js/commit/e1d26d8)) -* Reduce the multiple-announcement by screen readers of the new name of a button when its text label changes. ([#5158](https://github.com/videojs/video.js/issues/5158)) ([79fed25](https://github.com/videojs/video.js/commit/79fed25)), closes [#5023](https://github.com/videojs/video.js/issues/5023) -* Remove spaces from element IDs and ARIA attributes in the Captions Settings Dialog ([#5153](https://github.com/videojs/video.js/issues/5153)) ([e076cde](https://github.com/videojs/video.js/commit/e076cde)), closes [#4688](https://github.com/videojs/video.js/issues/4688) [#4884](https://github.com/videojs/video.js/issues/4884) -* Remove unnecessary ARIA role on the Control Bar. ([#5154](https://github.com/videojs/video.js/issues/5154)) ([9607712](https://github.com/videojs/video.js/commit/9607712)), closes [#5134](https://github.com/videojs/video.js/issues/5134) - - -# [6.9.0](https://github.com/videojs/video.js/compare/v6.8.0...v6.9.0) (2018-04-20) - -### Features - -* Queue playback events when the playback rate is zero and we are seeking ([#5061](https://github.com/videojs/video.js/issues/5061)) ([eaf3c98](https://github.com/videojs/video.js/commit/eaf3c98)), closes [#5024](https://github.com/videojs/video.js/issues/5024) - -### Bug Fixes - -* fire sourceset on initial source append ([#5038](https://github.com/videojs/video.js/issues/5038)) ([#5072](https://github.com/videojs/video.js/issues/5072)) ([00e7f7b](https://github.com/videojs/video.js/commit/00e7f7b)) -* let the tech preload auto on its own ([#4861](https://github.com/videojs/video.js/issues/4861)) ([#5065](https://github.com/videojs/video.js/issues/5065)) ([c04dac4](https://github.com/videojs/video.js/commit/c04dac4)), closes [#4660](https://github.com/videojs/video.js/issues/4660) -* options.id is now applied correctly to the player dom element ([#5090](https://github.com/videojs/video.js/issues/5090)) ([dd45dc0](https://github.com/videojs/video.js/commit/dd45dc0)), closes [#5088](https://github.com/videojs/video.js/issues/5088) -* wait till play event to listen for user activity ([#5093](https://github.com/videojs/video.js/issues/5093)) ([9f8ce2d](https://github.com/videojs/video.js/commit/9f8ce2d)), closes [#5076](https://github.com/videojs/video.js/issues/5076) -* **time-display:** Use formatTime for a consistent default instead of hardcoded string ([#5055](https://github.com/videojs/video.js/issues/5055)) ([363af84](https://github.com/videojs/video.js/commit/363af84)) - -### Code Refactoring - -* move seekbar event handler bindings into a function ([#5097](https://github.com/videojs/video.js/issues/5097)) ([7c3213c](https://github.com/videojs/video.js/commit/7c3213c)) -* move sourceset code out of tech ([#5049](https://github.com/videojs/video.js/issues/5049)) ([e2b9d58](https://github.com/videojs/video.js/commit/e2b9d58)) - -### Documentation - -* **debugging:** fix markup typo ([#5086](https://github.com/videojs/video.js/issues/5086)) ([8c77aa0](https://github.com/videojs/video.js/commit/8c77aa0)) -* **guides:** add debugging section to index ([#5100](https://github.com/videojs/video.js/issues/5100)) ([20546d3](https://github.com/videojs/video.js/commit/20546d3)) - -### Tests - -* fix queue playing events test for ie8 (for real this time) ([#5110](https://github.com/videojs/video.js/issues/5110)) ([5dec1a0](https://github.com/videojs/video.js/commit/5dec1a0)) -* fix queued events test with playbackrate in IE8 ([#5105](https://github.com/videojs/video.js/issues/5105)) ([c4a05eb](https://github.com/videojs/video.js/commit/c4a05eb)) - - -# [6.8.0](https://github.com/videojs/video.js/compare/v6.7.4...v6.8.0) (2018-03-19) - -### Features - -* add mimetype type to source object when possible ([#4469](https://github.com/videojs/video.js/issues/4469)) ([#4947](https://github.com/videojs/video.js/issues/4947)) ([62ff3f6](https://github.com/videojs/video.js/commit/62ff3f6)), closes [#4851](https://github.com/videojs/video.js/issues/4851) -* Allow techs to change poster if player option `techCanOverridePoster` is set ([#4921](https://github.com/videojs/video.js/issues/4921)) ([8706941](https://github.com/videojs/video.js/commit/8706941)), closes [#4910](https://github.com/videojs/video.js/issues/4910) -* **format time:** add setFormatTime for overriding the time format ([#4962](https://github.com/videojs/video.js/issues/4962)) ([2f96914](https://github.com/videojs/video.js/commit/2f96914)), closes [#2931](https://github.com/videojs/video.js/issues/2931) -* require enableSourceset option for event ([#5031](https://github.com/videojs/video.js/issues/5031)) ([1b3c827](https://github.com/videojs/video.js/commit/1b3c827)) -* sourceset event ([#4660](https://github.com/videojs/video.js/issues/4660)) ([df96a74](https://github.com/videojs/video.js/commit/df96a74)) -* Use CSS grid for Caption Settings dialog to begin making it more responsive ([#4997](https://github.com/videojs/video.js/issues/4997)) ([d2f63ad](https://github.com/videojs/video.js/commit/d2f63ad)) - -### Bug Fixes - -* don't add captions settings menu item when TextTrackSettings is disabled ([#5002](https://github.com/videojs/video.js/issues/5002)) ([ba6a71e](https://github.com/videojs/video.js/commit/ba6a71e)), closes [#4996](https://github.com/videojs/video.js/issues/4996) -* **sourceset:** set evt.src to empty string or src attr from load ([#5016](https://github.com/videojs/video.js/issues/5016)) ([46d8b37](https://github.com/videojs/video.js/commit/46d8b37)) - -### Chores - -* make sure first-timers bot uses our template ([#5001](https://github.com/videojs/video.js/issues/5001)) ([43b5a6d](https://github.com/videojs/video.js/commit/43b5a6d)) -* **dom.js:** Fix misspellings ([#5008](https://github.com/videojs/video.js/issues/5008)) ([e833d3e](https://github.com/videojs/video.js/commit/e833d3e)) -* update package-lock.json ([9519740](https://github.com/videojs/video.js/commit/9519740)) - -### Documentation - -* **component:** fix misspellings ([#5017](https://github.com/videojs/video.js/issues/5017)) ([1532df3](https://github.com/videojs/video.js/commit/1532df3)) -* **component:** fix misspelllings ([#5019](https://github.com/videojs/video.js/issues/5019)) ([ebbe868](https://github.com/videojs/video.js/commit/ebbe868)) -* **react guide:** update guide to prevent memory leaks when components are disposed of ([#4998](https://github.com/videojs/video.js/issues/4998)) ([1fa9dfb](https://github.com/videojs/video.js/commit/1fa9dfb)) -* **time-ranges:** fix misspellings ([#5025](https://github.com/videojs/video.js/issues/5025)) ([bd6b31c](https://github.com/videojs/video.js/commit/bd6b31c)) -* **time-ranges:** fix wrong comment for getRange function ([#5026](https://github.com/videojs/video.js/issues/5026)) ([d7f45ba](https://github.com/videojs/video.js/commit/d7f45ba)) - -### Reverts - -* Revert "fix: force autoplay in Chrome ([#4804](https://github.com/videojs/video.js/issues/4804))" ([#5009](https://github.com/videojs/video.js/issues/5009)) ([8d86afd](https://github.com/videojs/video.js/commit/8d86afd)), closes [#4720](https://github.com/videojs/video.js/issues/4720) [#5005](https://github.com/videojs/video.js/issues/5005) [#4720](https://github.com/videojs/video.js/issues/4720) [#5005](https://github.com/videojs/video.js/issues/5005) - -### Tests - -* **ResizeManager:** only listen for one playerresize to make test not flaky ([#5022](https://github.com/videojs/video.js/issues/5022)) ([4e83cd3](https://github.com/videojs/video.js/commit/4e83cd3)) - - -## [6.7.4](https://github.com/videojs/video.js/compare/v6.7.3...v6.7.4) (2018-03-05) - -### Bug Fixes - -* Fix an issue where disabling the progress control would throw an error. ([#4986](https://github.com/videojs/video.js/issues/4986)) ([5b5cc50](https://github.com/videojs/video.js/commit/5b5cc50)) -* **events:** triggering with an object had incorrect target property on event object ([#4993](https://github.com/videojs/video.js/issues/4993)) ([9c4ded8](https://github.com/videojs/video.js/commit/9c4ded8)) -* **package:** update videojs-vtt.js to version 0.12.6 ([#4954](https://github.com/videojs/video.js/issues/4954)) ([2d64977](https://github.com/videojs/video.js/commit/2d64977)) -* **text-tracks:** keep showing captions even if the text track settings were disabled ([#4974](https://github.com/videojs/video.js/issues/4974)) ([7facc44](https://github.com/videojs/video.js/commit/7facc44)), closes [#4964](https://github.com/videojs/video.js/issues/4964) - -### Chores - -* **package:** update grunt-accessibility to version 6.0.0 🚀 ([#4968](https://github.com/videojs/video.js/issues/4968)) ([270a231](https://github.com/videojs/video.js/commit/270a231)) - - -## [6.7.3](https://github.com/videojs/video.js/compare/v6.7.2...v6.7.3) (2018-02-22) - -### Bug Fixes - -* **text-track-settings:** fix track settings font class name ([#4956](https://github.com/videojs/video.js/issues/4956)) ([de9069f](https://github.com/videojs/video.js/commit/de9069f)), closes [#4950](https://github.com/videojs/video.js/issues/4950) [#4879](https://github.com/videojs/video.js/issues/4879) -* Add alternate text to the loading spinner. ([#4916](https://github.com/videojs/video.js/issues/4916)) ([50831e3](https://github.com/videojs/video.js/commit/50831e3)), closes [#4902](https://github.com/videojs/video.js/issues/4902) -* regression for getting a player via the tech's id ([#4969](https://github.com/videojs/video.js/issues/4969)) ([0ace2a5](https://github.com/videojs/video.js/commit/0ace2a5)), closes [/github.com/videojs/video.js/blob/f6eaa5e2ae417ffe27251133e1d1212cd9afa8e2/src/js/video.js#L103-L107](https://github.com//github.com/videojs/video.js/blob/f6eaa5e2ae417ffe27251133e1d1212cd9afa8e2/src/js/video.js/issues/L103-L107) - -### Chores - -* add first-timers-issue-template.md ([#4958](https://github.com/videojs/video.js/issues/4958)) ([f5c7373](https://github.com/videojs/video.js/commit/f5c7373)) -* re-enable Greenkeeper 🌴 and make it update package-lock.json ([#4967](https://github.com/videojs/video.js/issues/4967)) ([aa5f3bf](https://github.com/videojs/video.js/commit/aa5f3bf)) - -### Documentation - -* **plugins guide:** changed paused to pause where appropriate ([#4957](https://github.com/videojs/video.js/issues/4957)) ([763a7f5](https://github.com/videojs/video.js/commit/763a7f5)), closes [#4951](https://github.com/videojs/video.js/issues/4951) -* **react:** Update docs for react tutorial ([#4935](https://github.com/videojs/video.js/issues/4935)) ([#4952](https://github.com/videojs/video.js/issues/4952)) ([7c30f97](https://github.com/videojs/video.js/commit/7c30f97)) - - -## [6.7.2](https://github.com/videojs/video.js/compare/v6.7.1...v6.7.2) (2018-02-13) - -### Bug Fixes - -* cache middleware instances per player ([#4939](https://github.com/videojs/video.js/issues/4939)) ([29a8ee1](https://github.com/videojs/video.js/commit/29a8ee1)), closes [#4677](https://github.com/videojs/video.js/issues/4677) -* Only select TextTrackMenuItem if unselected ([#4920](https://github.com/videojs/video.js/issues/4920)) ([6189baa](https://github.com/videojs/video.js/commit/6189baa)) -* **progress control:** Fix the video continuing to play when the user scrubs outside of seekbar ([#4918](https://github.com/videojs/video.js/issues/4918)) ([a1cef80](https://github.com/videojs/video.js/commit/a1cef80)) - -### Documentation - -* Fix the advance plugin example in documentation ([#4923](https://github.com/videojs/video.js/issues/4923)) ([4afabc2](https://github.com/videojs/video.js/commit/4afabc2)) -* **middleware:** update the middleware guide with setTech and other corrections ([#4926](https://github.com/videojs/video.js/issues/4926)) ([a434551](https://github.com/videojs/video.js/commit/a434551)) - - -## [6.7.1](https://github.com/videojs/video.js/compare/v6.7.0...v6.7.1) (2018-01-31) - - -# [6.7.0](https://github.com/videojs/video.js/compare/v6.6.3...v6.7.0) (2018-01-30) - -### Features - -* Add `getPlayer` method to Video.js. ([#4836](https://github.com/videojs/video.js/issues/4836)) ([a15e616](https://github.com/videojs/video.js/commit/a15e616)) -* Add `videojs.getAllPlayers` to get an array of players. ([#4842](https://github.com/videojs/video.js/issues/4842)) ([6a00577](https://github.com/videojs/video.js/commit/6a00577)) -* add mediator middleware type for play() ([#4868](https://github.com/videojs/video.js/issues/4868)) ([bf3eb45](https://github.com/videojs/video.js/commit/bf3eb45)) -* playerresize event in all cases ([#4864](https://github.com/videojs/video.js/issues/4864)) ([9ceb4e4](https://github.com/videojs/video.js/commit/9ceb4e4)) - -### Bug Fixes - -* do not patch canplaytype on android chrome ([#4885](https://github.com/videojs/video.js/issues/4885)) ([f03ac5e](https://github.com/videojs/video.js/commit/f03ac5e)) - -### Chores - -* generate a test example on netlify for PRs ([#4912](https://github.com/videojs/video.js/issues/4912)) ([8b54737](https://github.com/videojs/video.js/commit/8b54737)) -* **package:** update dependencies ([#4908](https://github.com/videojs/video.js/issues/4908)) ([dcab42e](https://github.com/videojs/video.js/commit/dcab42e)) - -### Documentation - -* Update COLLABORATOR_GUIDE.md and CONTRIBUTING.md to include label meanings ([#4874](https://github.com/videojs/video.js/issues/4874)) ([a345971](https://github.com/videojs/video.js/commit/a345971)) - -### Tests - -* add project and build names to browserstack ([#4903](https://github.com/videojs/video.js/issues/4903)) ([41fd5cb](https://github.com/videojs/video.js/commit/41fd5cb)) - - -## [6.6.3](https://github.com/videojs/video.js/compare/v6.6.2...v6.6.3) (2018-01-24) - -### Bug Fixes - -* hide volume slider when the slider is not active and mute toggle button is in focus ([#4866](https://github.com/videojs/video.js/issues/4866)) ([e628ccd](https://github.com/videojs/video.js/commit/e628ccd)) - -### Chores - -* **docs site:** use git commit message for netlify build ([#4900](https://github.com/videojs/video.js/issues/4900)) ([ddfaf14](https://github.com/videojs/video.js/commit/ddfaf14)) -* **package:** update remark-cli to version 5.0.0 ([#4894](https://github.com/videojs/video.js/issues/4894)) ([aee4e6b](https://github.com/videojs/video.js/commit/aee4e6b)) -* **package:** update remark-parse to version 5.0.0 ([#4892](https://github.com/videojs/video.js/issues/4892)) ([2c59476](https://github.com/videojs/video.js/commit/2c59476)) -* **package:** update remark-stringify to version 5.0.0 ([#4893](https://github.com/videojs/video.js/issues/4893)) ([5b76bb1](https://github.com/videojs/video.js/commit/5b76bb1)) -* **package:** update shelljs to version 0.8.1 ([#4899](https://github.com/videojs/video.js/issues/4899)) ([87cbd23](https://github.com/videojs/video.js/commit/87cbd23)), closes [#4875](https://github.com/videojs/video.js/issues/4875) - -### Documentation - -* add middleware guide ([#4877](https://github.com/videojs/video.js/issues/4877)) ([673c231](https://github.com/videojs/video.js/commit/673c231)) -* fix some typos ([#4880](https://github.com/videojs/video.js/issues/4880)) ([83880b0](https://github.com/videojs/video.js/commit/83880b0)) - - -## [6.6.2](https://github.com/videojs/video.js/compare/v6.6.1...v6.6.2) (2018-01-05) - -### Bug Fixes - -* progress bar time tooltips bug by adding word-break css reset ([#4859](https://github.com/videojs/video.js/issues/4859)) ([98212c4](https://github.com/videojs/video.js/commit/98212c4)), closes [#2964](https://github.com/videojs/video.js/issues/2964) -* silence unhandled promise rejection in Safari when seeking ([#4860](https://github.com/videojs/video.js/issues/4860)) ([baf0982](https://github.com/videojs/video.js/commit/baf0982)), closes [#4853](https://github.com/videojs/video.js/issues/4853) - -### Chores - -* **netlify:** add some debug info in the netlify command ([#4862](https://github.com/videojs/video.js/issues/4862)) ([8f450ea](https://github.com/videojs/video.js/commit/8f450ea)) -* **package:** update karma to version 2.0.0 ([#4834](https://github.com/videojs/video.js/issues/4834)) ([22fcd03](https://github.com/videojs/video.js/commit/22fcd03)) - -### Documentation - -* wait for text track load with addRemoteTextTrack ([#4855](https://github.com/videojs/video.js/issues/4855)) ([7c393e5](https://github.com/videojs/video.js/commit/7c393e5)) - - -## [6.6.1](https://github.com/videojs/video.js/compare/v6.6.0...v6.6.1) (2018-01-04) - -### Bug Fixes - -* **lang:** Complete the Simplified Chinese translations (zn-CN.json) ([#4827](https://github.com/videojs/video.js/issues/4827)) ([98773dd](https://github.com/videojs/video.js/commit/98773dd)) -* **lang:** Complete the Traditional Chinese translation (zh-CT.json) ([#4828](https://github.com/videojs/video.js/issues/4828)) ([eb4bd9f](https://github.com/videojs/video.js/commit/eb4bd9f)) -* Fix an issue where hookOnce failed for the 'beforesetup' hook. ([#4841](https://github.com/videojs/video.js/issues/4841)) ([a6f4444](https://github.com/videojs/video.js/commit/a6f4444)) -* replace ` ` with `\u00a0` ([#4825](https://github.com/videojs/video.js/issues/4825)) ([98fe49f](https://github.com/videojs/video.js/commit/98fe49f)), closes [#4309](https://github.com/videojs/video.js/issues/4309) -* wrap audio change handler rather than bind so a player dispose doesn't affect other players ([#4847](https://github.com/videojs/video.js/issues/4847)) ([4eb0047](https://github.com/videojs/video.js/commit/4eb0047)) - -### Chores - -* **lang:** update translations needed doc ([#4858](https://github.com/videojs/video.js/issues/4858)) ([df0d705](https://github.com/videojs/video.js/commit/df0d705)) - - -# [6.6.0](https://github.com/videojs/video.js/compare/v6.5.2...v6.6.0) (2017-12-15) - -### Features - -* add support for debug logging ([#4780](https://github.com/videojs/video.js/issues/4780)) ([ba0f20e](https://github.com/videojs/video.js/commit/ba0f20e)) -* playerresize event on Player dimension API calls ([#4800](https://github.com/videojs/video.js/issues/4800)) ([e0ed0b5](https://github.com/videojs/video.js/commit/e0ed0b5)) -* **css:** add a delay before showing loading spinner ([#4806](https://github.com/videojs/video.js/issues/4806)) ([f47a083](https://github.com/videojs/video.js/commit/f47a083)) - -### Bug Fixes - -* **package:** update videojs-font to version 2.1.0 ([#4812](https://github.com/videojs/video.js/issues/4812)) ([1117587](https://github.com/videojs/video.js/commit/1117587)) -* modify debug log tests to accomodate old IE stringification ([#4824](https://github.com/videojs/video.js/issues/4824)) ([5f89570](https://github.com/videojs/video.js/commit/5f89570)) - -### Chores - -* **package:** update remark-toc to version 5.0.0 ([#4803](https://github.com/videojs/video.js/issues/4803)) ([0fa8c84](https://github.com/videojs/video.js/commit/0fa8c84)) -* remove unused deps ([#4814](https://github.com/videojs/video.js/issues/4814)) ([dede592](https://github.com/videojs/video.js/commit/dede592)) -* switch to node 8 ([#4813](https://github.com/videojs/video.js/issues/4813)) ([f6f996d](https://github.com/videojs/video.js/commit/f6f996d)) - - -## [6.5.2](https://github.com/videojs/video.js/compare/v6.5.1...v6.5.2) (2017-12-14) - -### Bug Fixes - -* **html5:** loop video el attributes in order ([#4805](https://github.com/videojs/video.js/issues/4805)) ([409a13e](https://github.com/videojs/video.js/commit/409a13e)) -* force autoplay in Chrome ([#4804](https://github.com/videojs/video.js/issues/4804)) ([6fe7a9a](https://github.com/videojs/video.js/commit/6fe7a9a)), closes [#4720](https://github.com/videojs/video.js/issues/4720) -* Seek to 0 if attempt is made to seek to negative value ([#4799](https://github.com/videojs/video.js/issues/4799)) ([1a588f7](https://github.com/videojs/video.js/commit/1a588f7)), closes [#4501](https://github.com/videojs/video.js/issues/4501) -* use correct logic for menu focus ([#4823](https://github.com/videojs/video.js/issues/4823)) ([51ed400](https://github.com/videojs/video.js/commit/51ed400)), closes [#4821](https://github.com/videojs/video.js/issues/4821) - -### Chores - -* remove unused popup classes ([#4792](https://github.com/videojs/video.js/issues/4792)) ([295889b](https://github.com/videojs/video.js/commit/295889b)), closes [#4725](https://github.com/videojs/video.js/issues/4725) -* **lang:** Add translation for "caption settings" in zh-CN.json ([#4815](https://github.com/videojs/video.js/issues/4815)) ([15cd32e](https://github.com/videojs/video.js/commit/15cd32e)) -* **lang:** Add translation for "caption settings" in zh-TW.json ([#4816](https://github.com/videojs/video.js/issues/4816)) ([029955a](https://github.com/videojs/video.js/commit/029955a)) - - -## [6.5.1](https://github.com/videojs/video.js/compare/v6.5.0...v6.5.1) (2017-12-04) - -### Bug Fixes - -* cannot drag on progress bar in IE9 ([#4783](https://github.com/videojs/video.js/issues/4783)) ([2337c1b](https://github.com/videojs/video.js/commit/2337c1b)), closes [#4773](https://github.com/videojs/video.js/issues/4773) -* null check closest.getAttribute ([#4763](https://github.com/videojs/video.js/issues/4763)) ([0f1b260](https://github.com/videojs/video.js/commit/0f1b260)) -* off text tracks should be set based on current state ([#4775](https://github.com/videojs/video.js/issues/4775)) ([904989d](https://github.com/videojs/video.js/commit/904989d)) -* Remove listener used to test if passive listeners are supported ([#4787](https://github.com/videojs/video.js/issues/4787)) ([e582c3c](https://github.com/videojs/video.js/commit/e582c3c)) - -### Chores - -* css is not built initially on grunt dev ([#4778](https://github.com/videojs/video.js/issues/4778)) ([c5ae98b](https://github.com/videojs/video.js/commit/c5ae98b)) - -### Documentation - -* clarify text tracks are meant for any usage of Video.js, both video and audio ([#4790](https://github.com/videojs/video.js/issues/4790)) ([1672a6d](https://github.com/videojs/video.js/commit/1672a6d)) -* deploy docs using netlify ([#4774](https://github.com/videojs/video.js/issues/4774)) ([4dd000c](https://github.com/videojs/video.js/commit/4dd000c)), closes [#4609](https://github.com/videojs/video.js/issues/4609) - - -# [6.5.0](https://github.com/videojs/video.js/compare/v6.4.0...v6.5.0) (2017-11-17) - -### Features - -* add a version method to all advanced plugin instances ([#4714](https://github.com/videojs/video.js/issues/4714)) ([acf4153](https://github.com/videojs/video.js/commit/acf4153)) -* allow embeds via element ([#4640](https://github.com/videojs/video.js/issues/4640)) ([d8aadd5](https://github.com/videojs/video.js/commit/d8aadd5)) - -### Bug Fixes - -* Avoid empty but shown title attribute with menu items and clickable components ([#4746](https://github.com/videojs/video.js/issues/4746)) ([dc588dd](https://github.com/videojs/video.js/commit/dc588dd)) -* **Player#play:** Wait for loadstart in play() when changing sources instead of just ready. ([#4743](https://github.com/videojs/video.js/issues/4743)) ([26b0d2c](https://github.com/videojs/video.js/commit/26b0d2c)) -* being able to toggle playback with middle click ([#4756](https://github.com/videojs/video.js/issues/4756)) ([7a776ee](https://github.com/videojs/video.js/commit/7a776ee)), closes [#4689](https://github.com/videojs/video.js/issues/4689) -* make the progress bar progress smoothly ([#4591](https://github.com/videojs/video.js/issues/4591)) ([acc641a](https://github.com/videojs/video.js/commit/acc641a)) -* only allow left click dragging on progress bar and volume control ([#4613](https://github.com/videojs/video.js/issues/4613)) ([79b4355](https://github.com/videojs/video.js/commit/79b4355)) -* only print element not in DOM warning on player creation ([#4755](https://github.com/videojs/video.js/issues/4755)) ([bbea5cc](https://github.com/videojs/video.js/commit/bbea5cc)) -* trigger timeupdate during seek ([#4754](https://github.com/videojs/video.js/issues/4754)) ([1fcd5ae](https://github.com/videojs/video.js/commit/1fcd5ae)) - -### Chores - -* **lang:** update Persian translations ([#4741](https://github.com/videojs/video.js/issues/4741)) ([95d7832](https://github.com/videojs/video.js/commit/95d7832)) - -### Code Refactoring - -* player.controls() ([#4731](https://github.com/videojs/video.js/issues/4731)) ([d447e9f](https://github.com/videojs/video.js/commit/d447e9f)) -* player.listenForUserActivity_() ([#4719](https://github.com/videojs/video.js/issues/4719)) ([c16fedf](https://github.com/videojs/video.js/commit/c16fedf)) -* player.userActive() ([#4716](https://github.com/videojs/video.js/issues/4716)) ([6cbe3ed](https://github.com/videojs/video.js/commit/6cbe3ed)) -* player.usingNativeControls() ([#4749](https://github.com/videojs/video.js/issues/4749)) ([eb909f0](https://github.com/videojs/video.js/commit/eb909f0)) - -### Documentation - -* **readme:** fixed a typo ([#4730](https://github.com/videojs/video.js/issues/4730)) ([46a7df2](https://github.com/videojs/video.js/commit/46a7df2)) - -### Performance Improvements - -* null out els on dispose to minimize detached els ([#4745](https://github.com/videojs/video.js/issues/4745)) ([2da7af1](https://github.com/videojs/video.js/commit/2da7af1)) - -### Tests - -* clean up test warnings ([#4752](https://github.com/videojs/video.js/issues/4752)) ([3aae4b2](https://github.com/videojs/video.js/commit/3aae4b2)) -* update tests to use qunit 2 assert format ([#4753](https://github.com/videojs/video.js/issues/4753)) ([06641e8](https://github.com/videojs/video.js/commit/06641e8)) -* warning, if the element is not in the DOM ([#4723](https://github.com/videojs/video.js/issues/4723)) ([c213737](https://github.com/videojs/video.js/commit/c213737)) - - -# [6.4.0](https://github.com/videojs/video.js/compare/v6.3.3...v6.4.0) (2017-11-01) - -### Features - -* **lang:** add Hebrew translation ([#4675](https://github.com/videojs/video.js/issues/4675)) ([32caf35](https://github.com/videojs/video.js/commit/32caf35)) -* **lang:** Update for Russian translation ([#4663](https://github.com/videojs/video.js/issues/4663)) ([45e21fd](https://github.com/videojs/video.js/commit/45e21fd)) -* Add videojs.hookOnce method to allow single-run hooks. ([#4672](https://github.com/videojs/video.js/issues/4672)) ([85fe685](https://github.com/videojs/video.js/commit/85fe685)) -* add warning if the element given to Video.js is not in the DOM ([#4698](https://github.com/videojs/video.js/issues/4698)) ([6f713ca](https://github.com/videojs/video.js/commit/6f713ca)) -* allow progress controls to be disabled ([#4649](https://github.com/videojs/video.js/issues/4649)) ([a3c254e](https://github.com/videojs/video.js/commit/a3c254e)) -* set the play progress seek bar to 100% on ended ([#4648](https://github.com/videojs/video.js/issues/4648)) ([5e9655f](https://github.com/videojs/video.js/commit/5e9655f)) - -### Bug Fixes - -* **css:** update user-select none ([#4678](https://github.com/videojs/video.js/issues/4678)) ([43ddc72](https://github.com/videojs/video.js/commit/43ddc72)) -* aria-labelledby attribute has an extra space ([#4708](https://github.com/videojs/video.js/issues/4708)) ([855adf3](https://github.com/videojs/video.js/commit/855adf3)), closes [#4688](https://github.com/videojs/video.js/issues/4688) -* Don't enable player controls if they where disabled when ModalDialog closes. ([#4690](https://github.com/videojs/video.js/issues/4690)) ([afea980](https://github.com/videojs/video.js/commit/afea980)) -* don't throttle duration change updates ([#4635](https://github.com/videojs/video.js/issues/4635)) ([9cf9800](https://github.com/videojs/video.js/commit/9cf9800)) -* Events#off threw if Object.prototype had extra enumerable properties, don't remove all events if off receives a falsey value ([#4669](https://github.com/videojs/video.js/issues/4669)) ([7963913](https://github.com/videojs/video.js/commit/7963913)) -* make parseUrl helper always have a protocl ([#4673](https://github.com/videojs/video.js/issues/4673)) ([bebca9c](https://github.com/videojs/video.js/commit/bebca9c)), closes [#3100](https://github.com/videojs/video.js/issues/3100) -* Make sure we remove vjs-ended from the play toggle in all appropriate cases. ([#4661](https://github.com/videojs/video.js/issues/4661)) ([0287f6e](https://github.com/videojs/video.js/commit/0287f6e)) -* player.src() should return empty string if no source is set ([#4711](https://github.com/videojs/video.js/issues/4711)) ([9acbcd8](https://github.com/videojs/video.js/commit/9acbcd8)) - -### Chores - -* **gh-release:** no console log on success ([#4657](https://github.com/videojs/video.js/issues/4657)) ([e8511a5](https://github.com/videojs/video.js/commit/e8511a5)) -* **lang:** Update Polish ([#4686](https://github.com/videojs/video.js/issues/4686)) ([ee2a49c](https://github.com/videojs/video.js/commit/ee2a49c)) -* **package:** update babelify to version 8.0.0 ([#4684](https://github.com/videojs/video.js/issues/4684)) ([db2f14c](https://github.com/videojs/video.js/commit/db2f14c)) -* add comment about avoiding helvetica font ([#4679](https://github.com/videojs/video.js/issues/4679)) ([cb638d0](https://github.com/videojs/video.js/commit/cb638d0)) -* add GA note to primary readme ([#4481](https://github.com/videojs/video.js/issues/4481)) ([e2af322](https://github.com/videojs/video.js/commit/e2af322)) -* Add package-lock.json file. ([#4641](https://github.com/videojs/video.js/issues/4641)) ([ec5b603](https://github.com/videojs/video.js/commit/ec5b603)) - -### Code Refactoring - -* component.ready() ([#4693](https://github.com/videojs/video.js/issues/4693)) ([b40858b](https://github.com/videojs/video.js/commit/b40858b)) -* player.dimension() ([#4704](https://github.com/videojs/video.js/issues/4704)) ([ad1b47b](https://github.com/videojs/video.js/commit/ad1b47b)) -* player.hasStarted() ([#4680](https://github.com/videojs/video.js/issues/4680)) ([cde8335](https://github.com/videojs/video.js/commit/cde8335)) -* player.techGet_() ([#4687](https://github.com/videojs/video.js/issues/4687)) ([a1748aa](https://github.com/videojs/video.js/commit/a1748aa)) - -### Documentation - -* **lang:** update translations needed doc ([#4702](https://github.com/videojs/video.js/issues/4702)) ([93e7670](https://github.com/videojs/video.js/commit/93e7670)) - -### Tests - -* fix modal dialog test for showing controls ([#4707](https://github.com/videojs/video.js/issues/4707)) ([45a6b30](https://github.com/videojs/video.js/commit/45a6b30)), closes [#4706](https://github.com/videojs/video.js/issues/4706) -* get rid of redundant test logging ([#4682](https://github.com/videojs/video.js/issues/4682)) ([983a573](https://github.com/videojs/video.js/commit/983a573)) - - -## [6.3.3](https://github.com/videojs/video.js/compare/v6.3.2...v6.3.3) (2017-10-10) - -### Bug Fixes - -* a possible breaking change caused by the use of remainingTimeDisplay ([#4655](https://github.com/videojs/video.js/issues/4655)) ([b1de506](https://github.com/videojs/video.js/commit/b1de506)) - -### Documentation - -* **hooks:** Fix Typo ([#4652](https://github.com/videojs/video.js/issues/4652)) ([6738f76](https://github.com/videojs/video.js/commit/6738f76)) - - -## [6.3.2](https://github.com/videojs/video.js/compare/v6.3.1...v6.3.2) (2017-10-04) - -### Bug Fixes - -* Fix a typo in current time display component. ([#4647](https://github.com/videojs/video.js/issues/4647)) ([4658c7b](https://github.com/videojs/video.js/commit/4658c7b)) - -### Documentation - -* Document how to add a version number to a plugin ([#4642](https://github.com/videojs/video.js/issues/4642)) ([85a34d1](https://github.com/videojs/video.js/commit/85a34d1)) - - -## [6.3.1](https://github.com/videojs/video.js/compare/v6.3.0...v6.3.1) (2017-10-03) - -### Bug Fixes - -* Make sure time displays use correctly-formatted time. ([#4643](https://github.com/videojs/video.js/issues/4643)) ([20f7fe9](https://github.com/videojs/video.js/commit/20f7fe9)) - - -# [6.3.0](https://github.com/videojs/video.js/compare/v6.2.8...v6.3.0) (2017-10-03) - -### Features - -* Add remainingTimeDisplay method to Player ([#4620](https://github.com/videojs/video.js/issues/4620)) ([445eb26](https://github.com/videojs/video.js/commit/445eb26)) -* display currentTime as duration and remainingTime as 0 on ended ([#4634](https://github.com/videojs/video.js/issues/4634)) ([f51d36b](https://github.com/videojs/video.js/commit/f51d36b)) -* Do not set focus in sub-menus to prevent undesirable scrolling behavior in iOS ([#4607](https://github.com/videojs/video.js/issues/4607)) ([1ac8065](https://github.com/videojs/video.js/commit/1ac8065)) - -### Bug Fixes - -* reset to a play/pause button when seeking after ended ([#4614](https://github.com/videojs/video.js/issues/4614)) ([335bcde](https://github.com/videojs/video.js/commit/335bcde)) - -### Chores - -* alias rollup-dev to watch for development ([#4615](https://github.com/videojs/video.js/issues/4615)) ([edde614](https://github.com/videojs/video.js/commit/edde614)) -* **lang:** Update Dutch ([#4588](https://github.com/videojs/video.js/issues/4588)) ([5ca0992](https://github.com/videojs/video.js/commit/5ca0992)) -* **lang:** Update Vietnamese ([#4625](https://github.com/videojs/video.js/issues/4625)) ([ac58dbf](https://github.com/videojs/video.js/commit/ac58dbf)) -* **package:** update grunt-browserify to version 5.2.0 ([#4578](https://github.com/videojs/video.js/issues/4578)) ([6cd785a](https://github.com/videojs/video.js/commit/6cd785a)) -* **package:** update remark-validate-links to version 7.0.0 ([#4585](https://github.com/videojs/video.js/issues/4585)) ([7929677](https://github.com/videojs/video.js/commit/7929677)) - -### Code Refactoring - -* Create a base time display class, and use it ([#4633](https://github.com/videojs/video.js/issues/4633)) ([fa6f884](https://github.com/videojs/video.js/commit/fa6f884)) - -### Documentation - -* Document playbackRates ([#4602](https://github.com/videojs/video.js/issues/4602)) ([9d249bb](https://github.com/videojs/video.js/commit/9d249bb)) -* update player reference in advanced plugins doc ([#4622](https://github.com/videojs/video.js/issues/4622)) ([d8ea23e](https://github.com/videojs/video.js/commit/d8ea23e)) - - -## [6.2.8](https://github.com/videojs/video.js/compare/v6.2.7...v6.2.8) (2017-09-01) - -### Bug Fixes - -* rely on browser or tech to handle autoplay ([#4582](https://github.com/videojs/video.js/issues/4582)) ([95c4ae0](https://github.com/videojs/video.js/commit/95c4ae0)) -* **package:** remove pkg.module ([#4594](https://github.com/videojs/video.js/issues/4594)) ([5e23048](https://github.com/videojs/video.js/commit/5e23048)), closes [#4580](https://github.com/videojs/video.js/issues/4580) - -### Documentation - -* **COLLABORATOR_GUIDE:** how to release Video.js ([#4586](https://github.com/videojs/video.js/issues/4586)) ([9588602](https://github.com/videojs/video.js/commit/9588602)) -* update to width and height doc comments ([#4592](https://github.com/videojs/video.js/issues/4592)) ([006fb3b](https://github.com/videojs/video.js/commit/006fb3b)) - - -## [6.2.7](https://github.com/videojs/video.js/compare/v6.2.6...v6.2.7) (2017-08-24) - -### Bug Fixes - -* use typeof for checking preload option ([#4574](https://github.com/videojs/video.js/issues/4574)) ([fe63992](https://github.com/videojs/video.js/commit/fe63992)) - -### Chores - -* **package:** update rollup to version 0.47.5 ([#4572](https://github.com/videojs/video.js/issues/4572)) ([7b251d0](https://github.com/videojs/video.js/commit/7b251d0)) - - -## [6.2.6](https://github.com/videojs/video.js/compare/v6.2.5...v6.2.6) (2017-08-16) - -### Bug Fixes - -* make boolean attributes set and check both the associated property and the attribute ([#4562](https://github.com/videojs/video.js/issues/4562)) ([d668c49](https://github.com/videojs/video.js/commit/d668c49)), closes [#4351](https://github.com/videojs/video.js/issues/4351) -* playback rate default text ([#4558](https://github.com/videojs/video.js/issues/4558)) ([a6b8425](https://github.com/videojs/video.js/commit/a6b8425)) -* remove 'use strict' from rollup because vttjs isn't strict ([#4551](https://github.com/videojs/video.js/issues/4551)) ([db55bbd](https://github.com/videojs/video.js/commit/db55bbd)) -* set width and height for vjs-button like the SubsCaps button ([#4548](https://github.com/videojs/video.js/issues/4548)) ([cd2f510](https://github.com/videojs/video.js/commit/cd2f510)), closes [#4547](https://github.com/videojs/video.js/issues/4547) -* **lang:** typos in ar.json ([#4528](https://github.com/videojs/video.js/issues/4528)) ([3e63bf3](https://github.com/videojs/video.js/commit/3e63bf3)) - -### Chores - -* improve dev and beginner experience ([#4555](https://github.com/videojs/video.js/issues/4555)) ([19ebc0d](https://github.com/videojs/video.js/commit/19ebc0d)) -* **package:** update grunt-babel to version 7.0.0 ([#4553](https://github.com/videojs/video.js/issues/4553)) ([f6f9998](https://github.com/videojs/video.js/commit/f6f9998)) -* **package:** update grunt-browserify to version 5.1.0 ([#4565](https://github.com/videojs/video.js/issues/4565)) ([8c21f0a](https://github.com/videojs/video.js/commit/8c21f0a)) -* **package:** update klaw-sync to version 3.0.0 ([#4544](https://github.com/videojs/video.js/issues/4544)) ([6233d14](https://github.com/videojs/video.js/commit/6233d14)) -* **package:** update rollup to version 0.47.4 ([#4570](https://github.com/videojs/video.js/issues/4570)) ([d7f7e05](https://github.com/videojs/video.js/commit/d7f7e05)), closes [#4561](https://github.com/videojs/video.js/issues/4561) - -### Documentation - -* updates to faq, language guide, and minor edits ([#4556](https://github.com/videojs/video.js/issues/4556)) ([1f3375e](https://github.com/videojs/video.js/commit/1f3375e)) - - -## [6.2.5](https://github.com/videojs/video.js/compare/v6.2.4...v6.2.5) (2017-07-26) - -### Bug Fixes - -* only change focus from BPB if not a mouse click ([#4497](https://github.com/videojs/video.js/issues/4497)) ([ee014e2](https://github.com/videojs/video.js/commit/ee014e2)) - -### Chores - -* **greenkeeper:** ignore webpack and uglify ([#4518](https://github.com/videojs/video.js/issues/4518)) ([fe95a77](https://github.com/videojs/video.js/commit/fe95a77)) -* **package:** update remark-cli to version 4.0.0 ([#4508](https://github.com/videojs/video.js/issues/4508)) ([7c80e13](https://github.com/videojs/video.js/commit/7c80e13)) -* **package:** update remark-parse to version 4.0.0 ([#4507](https://github.com/videojs/video.js/issues/4507)) ([abb5d67](https://github.com/videojs/video.js/commit/abb5d67)) -* **package:** update remark-stringify to version 4.0.0 ([#4506](https://github.com/videojs/video.js/issues/4506)) ([bbd92ab](https://github.com/videojs/video.js/commit/bbd92ab)) - - -## [6.2.4](https://github.com/videojs/video.js/compare/v6.2.3...v6.2.4) (2017-07-14) - -### Chores - -* fix gh-release minimist call ([#4489](https://github.com/videojs/video.js/issues/4489)) ([07594bc](https://github.com/videojs/video.js/commit/07594bc)) - - -## [6.2.3](https://github.com/videojs/video.js/compare/v6.2.2...v6.2.3) (2017-07-14) - -### Chores - -* **gh-release:** add prerelease flag and find right zip ([#4488](https://github.com/videojs/video.js/issues/4488)) ([b1ac2e0](https://github.com/videojs/video.js/commit/b1ac2e0)) - - -## [6.2.2](https://github.com/videojs/video.js/compare/v6.2.1...v6.2.2) (2017-07-14) - -### Bug Fixes - -* **playback rate menu:** cycling rates via click ([#4486](https://github.com/videojs/video.js/issues/4486)) ([4f43616](https://github.com/videojs/video.js/commit/4f43616)) - -### Chores - -* **build:** remove unused var in build/version.js ([#4458](https://github.com/videojs/video.js/issues/4458)) ([6986dbb](https://github.com/videojs/video.js/commit/6986dbb)) -* add automatic github release ([#4466](https://github.com/videojs/video.js/issues/4466)) ([3a600d0](https://github.com/videojs/video.js/commit/3a600d0)) -* switch to using chrome for testing PRs on travis ([#4462](https://github.com/videojs/video.js/issues/4462)) ([687aae5](https://github.com/videojs/video.js/commit/687aae5)) -* **package:** update rollup to version 0.45.2 ([#4487](https://github.com/videojs/video.js/issues/4487)) ([971f633](https://github.com/videojs/video.js/commit/971f633)), closes [#4475](https://github.com/videojs/video.js/issues/4475) - -### Documentation - -* Fix Player#src API documentation. ([#4454](https://github.com/videojs/video.js/issues/4454)) ([7579fc1](https://github.com/videojs/video.js/commit/7579fc1)) -* make jsdoc generate anchor names so ToC links work ([#4471](https://github.com/videojs/video.js/issues/4471)) ([03fd402](https://github.com/videojs/video.js/commit/03fd402)) - -### Tests - -* add unit tests for player.duration() ([#4459](https://github.com/videojs/video.js/issues/4459)) ([1e80e59](https://github.com/videojs/video.js/commit/1e80e59)) - - -## [6.2.1](https://github.com/videojs/video.js/compare/v6.2.0...v6.2.1) (2017-06-28) - -### Bug Fixes - -* auto-removal remote text tracks being removed when not supposed to ([#4450](https://github.com/videojs/video.js/issues/4450)) ([82c8b80](https://github.com/videojs/video.js/commit/82c8b80)), closes [#4403](https://github.com/videojs/video.js/issues/4403) [#4315](https://github.com/videojs/video.js/issues/4315) -* IE10 issue for disableOthers when property access results in "permission denied" ([#4395](https://github.com/videojs/video.js/issues/4395)) ([7f7ea70](https://github.com/videojs/video.js/commit/7f7ea70)), closes [#4378](https://github.com/videojs/video.js/issues/4378) -* player.duration() should return NaN if duration is not known ([#4443](https://github.com/videojs/video.js/issues/4443)) ([f5cc165](https://github.com/videojs/video.js/commit/f5cc165)) -* Safari picture-in-picture triggers fullscreenchange ([#4437](https://github.com/videojs/video.js/issues/4437)) ([b636663](https://github.com/videojs/video.js/commit/b636663)) -* Update translations to match correct string ([#4383](https://github.com/videojs/video.js/issues/4383)) ([e0824c8](https://github.com/videojs/video.js/commit/e0824c8)) -* Use passive event listeners for touchstart/touchmove ([#4440](https://github.com/videojs/video.js/issues/4440)) ([b4dc4f8](https://github.com/videojs/video.js/commit/b4dc4f8)), closes [#4432](https://github.com/videojs/video.js/issues/4432) - -### Chores - -* **package:** update husky to version 0.14.1 ([#4444](https://github.com/videojs/video.js/issues/4444)) ([66a0d23](https://github.com/videojs/video.js/commit/66a0d23)), closes [#4436](https://github.com/videojs/video.js/issues/4436) -* **package:** update rollup to version 0.42.0 ([#4392](https://github.com/videojs/video.js/issues/4392)) ([f87b12c](https://github.com/videojs/video.js/commit/f87b12c)) -* **package:** update rollup-watch to version 4.0.0 ([#4396](https://github.com/videojs/video.js/issues/4396)) ([4bce4a2](https://github.com/videojs/video.js/commit/4bce4a2)) -* **sandbox:** Fix paths in sandbox files. ([#4416](https://github.com/videojs/video.js/issues/4416)) ([c4bbe5d](https://github.com/videojs/video.js/commit/c4bbe5d)) - -### Documentation - -* Fix links in API docs for several Player events. ([#4427](https://github.com/videojs/video.js/issues/4427)) ([cc6e824](https://github.com/videojs/video.js/commit/cc6e824)) -* Fixing player.remoteTextTracks jsdoc ([#4417](https://github.com/videojs/video.js/issues/4417)) ([9329e3e](https://github.com/videojs/video.js/commit/9329e3e)) -* Update name of FullscreenToggle in documentation ([#4410](https://github.com/videojs/video.js/issues/4410)) ([9702155](https://github.com/videojs/video.js/commit/9702155)) - -### Performance Improvements - -* Various small performance improvements. ([#4426](https://github.com/videojs/video.js/issues/4426)) ([77ba3d1](https://github.com/videojs/video.js/commit/77ba3d1)) - - -# [6.2.0](https://github.com/videojs/video.js/compare/v6.1.0...v6.2.0) (2017-05-30) - -### Features - -* Persist caption/description choice over source changes in emulated tracks ([#4295](https://github.com/videojs/video.js/issues/4295)) ([188ead1](https://github.com/videojs/video.js/commit/188ead1)) -* **lang:** Adding galician ([#4334](https://github.com/videojs/video.js/issues/4334)) ([2a26c7f](https://github.com/videojs/video.js/commit/2a26c7f)) -* **lang:** Create sk.json ([#4374](https://github.com/videojs/video.js/issues/4374)) ([e5e1c7f](https://github.com/videojs/video.js/commit/e5e1c7f)) -* **lang:** Update zh-CN.json ([#4370](https://github.com/videojs/video.js/issues/4370)) ([0c16c5f](https://github.com/videojs/video.js/commit/0c16c5f)) -* Use Rollup to generate dist files ([#4301](https://github.com/videojs/video.js/issues/4301)) ([c31836c](https://github.com/videojs/video.js/commit/c31836c)) - -### Chores - -* **package:** update grunt-contrib-cssmin to version 2.2.0 ([#4345](https://github.com/videojs/video.js/issues/4345)) ([d57f09f](https://github.com/videojs/video.js/commit/d57f09f)) -* **package:** update videojs-flash to version 2.0.0 ([#4375](https://github.com/videojs/video.js/issues/4375)) ([9816070](https://github.com/videojs/video.js/commit/9816070)) -* update translations needed ([#4380](https://github.com/videojs/video.js/issues/4380)) ([a5a68e8](https://github.com/videojs/video.js/commit/a5a68e8)) - -### Tests - -* **TextTrackDisplay:** Removing incorrect test techOrder ([#4379](https://github.com/videojs/video.js/issues/4379)) ([eade52e](https://github.com/videojs/video.js/commit/eade52e)) - - -# [6.1.0](https://github.com/videojs/video.js/compare/v6.0.1...v6.1.0) (2017-05-15) - -### Features - -* Add 'beforepluginsetup' event and named plugin setup events (e.g. 'pluginsetup:foo') ([#4255](https://github.com/videojs/video.js/issues/4255)) ([0a19cf0](https://github.com/videojs/video.js/commit/0a19cf0)) -* add 'playsinline' player option ([#4348](https://github.com/videojs/video.js/issues/4348)) ([8d80a58](https://github.com/videojs/video.js/commit/8d80a58)) -* Add a version class to the player ([#4320](https://github.com/videojs/video.js/issues/4320)) ([ae423df](https://github.com/videojs/video.js/commit/ae423df)) -* Add getVideoPlaybackQuality API ([#4338](https://github.com/videojs/video.js/issues/4338)) ([483e5a2](https://github.com/videojs/video.js/commit/483e5a2)) -* deprecate firstplay event ([#4353](https://github.com/videojs/video.js/issues/4353)) ([35df351](https://github.com/videojs/video.js/commit/35df351)) -* remove playbackRate blacklist for recent Android Chrome ([#4321](https://github.com/videojs/video.js/issues/4321)) ([da0f1ee](https://github.com/videojs/video.js/commit/da0f1ee)) - -### Bug Fixes - -* **package:** update global to version 4.3.2 ([#4291](https://github.com/videojs/video.js/issues/4291)) ([b5c60f3](https://github.com/videojs/video.js/commit/b5c60f3)) -* only disable user-selection on sliders ([#4354](https://github.com/videojs/video.js/issues/4354)) ([cb6005e](https://github.com/videojs/video.js/commit/cb6005e)) -* Only update text track mode if changed ([#4298](https://github.com/videojs/video.js/issues/4298)) ([3087830](https://github.com/videojs/video.js/commit/3087830)) -* prevent dupe events on enabled ClickableComponents ([#4316](https://github.com/videojs/video.js/issues/4316)) ([03bab83](https://github.com/videojs/video.js/commit/03bab83)), closes [#4312](https://github.com/videojs/video.js/issues/4312) -* TextTrackButton on Safari and iOS ([#4350](https://github.com/videojs/video.js/issues/4350)) ([3dcfa95](https://github.com/videojs/video.js/commit/3dcfa95)) - -### Chores - -* Fix examples and docs and some links ([#4279](https://github.com/videojs/video.js/issues/4279)) ([f773c47](https://github.com/videojs/video.js/commit/f773c47)) -* typo soruce -> source ([#4307](https://github.com/videojs/video.js/issues/4307)) ([da1d861](https://github.com/videojs/video.js/commit/da1d861)) - -### Documentation - -* **react-guide:** Use a React component as a VJS component ([#4287](https://github.com/videojs/video.js/issues/4287)) ([cff2e50](https://github.com/videojs/video.js/commit/cff2e50)) - - -## [6.0.1](https://github.com/videojs/video.js/compare/v6.0.0...v6.0.1) (2017-04-13) - -### Bug Fixes - -* set IE_VERSION correctly for IE11 ([#4281](https://github.com/videojs/video.js/issues/4281)) ([1ea0041](https://github.com/videojs/video.js/commit/1ea0041)), closes [#4278](https://github.com/videojs/video.js/issues/4278) -* techOrder names can be camelCased. ([#4277](https://github.com/videojs/video.js/issues/4277)) ([92e5d9f](https://github.com/videojs/video.js/commit/92e5d9f)) - -### Chores - -* **changelog:** Update CHANGELOG with v5 changes ([#4257](https://github.com/videojs/video.js/issues/4257)) ([c20ca5c](https://github.com/videojs/video.js/commit/c20ca5c)) -* add slack travis notifications ([#4282](https://github.com/videojs/video.js/issues/4282)) ([7490a49](https://github.com/videojs/video.js/commit/7490a49)) -* gitignore all npm-debug.log.* ([#4252](https://github.com/videojs/video.js/issues/4252)) ([083f643](https://github.com/videojs/video.js/commit/083f643)) - -### Documentation - -* **component:** Replace VolumeMenuButton with VolumePanel in component tree ([#4267](https://github.com/videojs/video.js/issues/4267)) ([02721c7](https://github.com/videojs/video.js/commit/02721c7)), closes [#4266](https://github.com/videojs/video.js/issues/4266) -* add a Webpack usage guide ([#4261](https://github.com/videojs/video.js/issues/4261)) ([230743e](https://github.com/videojs/video.js/commit/230743e)) -* remove mentions of bower support ([#4274](https://github.com/videojs/video.js/issues/4274)) ([39fd73f](https://github.com/videojs/video.js/commit/39fd73f)) - - -# [6.0.0](https://github.com/videojs/video.js/compare/v5.16.0...v6.0.0) (2017-04-03) - -### Features - -* `videojs.getTech` works with `TitleCase` or `camelCase` names ([#4010](https://github.com/videojs/video.js/issues/4010)) ([a8f2e43](https://github.com/videojs/video.js/commit/a8f2e43)), closes [#3986](https://github.com/videojs/video.js/issues/3986) -* add a controlText function to MenuButton ([#4125](https://github.com/videojs/video.js/issues/4125)) ([4388bea](https://github.com/videojs/video.js/commit/4388bea)) -* Advanced Class-based Plugins for 6.0 ([#3690](https://github.com/videojs/video.js/issues/3690)) ([8d1653a](https://github.com/videojs/video.js/commit/8d1653a)) -* allow seeking in full height of progress control ([#4004](https://github.com/videojs/video.js/issues/4004)) ([29c6141](https://github.com/videojs/video.js/commit/29c6141)) -* allow tokens in localize, localize progress bar time ([#4060](https://github.com/videojs/video.js/issues/4060)) ([db01120](https://github.com/videojs/video.js/commit/db01120)), closes [#4024](https://github.com/videojs/video.js/issues/4024) -* Combine captions and subtitles tracks control ([#4028](https://github.com/videojs/video.js/issues/4028)) ([74eb5d4](https://github.com/videojs/video.js/commit/74eb5d4)) -* don't throw when re-registering a plugin unless it's a player method ([#4140](https://github.com/videojs/video.js/issues/4140)) ([326398d](https://github.com/videojs/video.js/commit/326398d)) -* Expose Tech#resize event as Player#resize ([#3979](https://github.com/videojs/video.js/issues/3979)) ([e176b56](https://github.com/videojs/video.js/commit/e176b56)) -* **lang:** Update tr.json ([#3989](https://github.com/videojs/video.js/issues/3989)) ([37a6811](https://github.com/videojs/video.js/commit/37a6811)) -* fix accessibility of the captions setting dialog ([#4050](https://github.com/videojs/video.js/issues/4050)) ([0d0dea4](https://github.com/videojs/video.js/commit/0d0dea4)), closes [#2746](https://github.com/videojs/video.js/issues/2746) [#2746](https://github.com/videojs/video.js/issues/2746) -* localize all strings in captions settings ([#3974](https://github.com/videojs/video.js/issues/3974)) ([8e7d8cc](https://github.com/videojs/video.js/commit/8e7d8cc)) -* Log Levels ([#3853](https://github.com/videojs/video.js/issues/3853)) ([844e4f0](https://github.com/videojs/video.js/commit/844e4f0)) -* make `registerTech` add that tech to the default `techOrder` ([#3985](https://github.com/videojs/video.js/issues/3985)) ([c2545dd](https://github.com/videojs/video.js/commit/c2545dd)) -* Make pause on open optional for ModalDialog via options ([#4186](https://github.com/videojs/video.js/issues/4186)) ([90030d5](https://github.com/videojs/video.js/commit/90030d5)) -* **lang:** update Vietnamese lang file ([#3964](https://github.com/videojs/video.js/issues/3964)) ([1463e50](https://github.com/videojs/video.js/commit/1463e50)) -* Make text tracks settings more responsive ([#4236](https://github.com/videojs/video.js/issues/4236)) ([9274457](https://github.com/videojs/video.js/commit/9274457)) -* middleware ([#3788](https://github.com/videojs/video.js/issues/3788)) ([34aab3f](https://github.com/videojs/video.js/commit/34aab3f)) -* modal dialog accessibility updates ([#4025](https://github.com/videojs/video.js/issues/4025)) ([eddc1d7](https://github.com/videojs/video.js/commit/eddc1d7)) -* remove flash tech ([#3956](https://github.com/videojs/video.js/issues/3956)) ([b387437](https://github.com/videojs/video.js/commit/b387437)) -* Replay at ended ([#3868](https://github.com/videojs/video.js/issues/3868)) ([ce6acc8](https://github.com/videojs/video.js/commit/ce6acc8)) -* Restore all outlines for greater accessibility ([#3829](https://github.com/videojs/video.js/issues/3829)) ([29ffbfb](https://github.com/videojs/video.js/commit/29ffbfb)) -* Return the native Promise from play() ([#3907](https://github.com/videojs/video.js/issues/3907)) ([091bdf9](https://github.com/videojs/video.js/commit/091bdf9)) -* Stateful Components ([#3960](https://github.com/videojs/video.js/issues/3960)) ([d7d7cfe](https://github.com/videojs/video.js/commit/d7d7cfe)) -* Time Tooltips ([#3836](https://github.com/videojs/video.js/issues/3836)) ([1ba1f5a](https://github.com/videojs/video.js/commit/1ba1f5a)) -* time tooltips will not be added to a player on mobile devices ([#4185](https://github.com/videojs/video.js/issues/4185)) ([d79b8a7](https://github.com/videojs/video.js/commit/d79b8a7)) -* toggle playback with space when focused on seekbar ([#4005](https://github.com/videojs/video.js/issues/4005)) ([516c9f9](https://github.com/videojs/video.js/commit/516c9f9)) -* unmute goes back to previously selected volume ([#3942](https://github.com/videojs/video.js/issues/3942)) ([cb42fcf](https://github.com/videojs/video.js/commit/cb42fcf)), closes [#3909](https://github.com/videojs/video.js/issues/3909) -* Update MW to require a factory, add *-mw ([#3969](https://github.com/videojs/video.js/issues/3969)) ([0352916](https://github.com/videojs/video.js/commit/0352916)) -* update videojs-vtt.js and wrap native cues in TextTrack ([#4115](https://github.com/videojs/video.js/issues/4115)) ([96a387f](https://github.com/videojs/video.js/commit/96a387f)), closes [#4093](https://github.com/videojs/video.js/issues/4093) -* wrap menu item text in a span ([#4026](https://github.com/videojs/video.js/issues/4026)) ([5748c36](https://github.com/videojs/video.js/commit/5748c36)), closes [#4017](https://github.com/videojs/video.js/issues/4017) -* **lang:** add European Portuguese translation ([#3955](https://github.com/videojs/video.js/issues/3955)) ([8888e2b](https://github.com/videojs/video.js/commit/8888e2b)) -* **lang:** DE and FR translations of replay ([#3963](https://github.com/videojs/video.js/issues/3963)) ([a0ba8e2](https://github.com/videojs/video.js/commit/a0ba8e2)) -* **lang:** French translation update ([#4118](https://github.com/videojs/video.js/issues/4118)) ([8c1302e](https://github.com/videojs/video.js/commit/8c1302e)) -* **lang:** update es.json ([#3984](https://github.com/videojs/video.js/issues/3984)) ([70d2eb1](https://github.com/videojs/video.js/commit/70d2eb1)) -* **player:** add played(), defaultMuted(), defaultPlaybackRate() ([#3845](https://github.com/videojs/video.js/issues/3845)) ([2037e18](https://github.com/videojs/video.js/commit/2037e18)), closes [#523](https://github.com/videojs/video.js/issues/523) -* **volume panel:** accessibly volume control ([#3957](https://github.com/videojs/video.js/issues/3957)) ([524f868](https://github.com/videojs/video.js/commit/524f868)) - -### Bug Fixes - -* accessibility bugs with the VolumeBar ([#4023](https://github.com/videojs/video.js/issues/4023)) ([da2a1e0](https://github.com/videojs/video.js/commit/da2a1e0)), closes [#4021](https://github.com/videojs/video.js/issues/4021) [#4022](https://github.com/videojs/video.js/issues/4022) -* add buildWrapperCSSClass methods to all menu buttons ([#4147](https://github.com/videojs/video.js/issues/4147)) ([61d427c](https://github.com/videojs/video.js/commit/61d427c)) -* Add lang attribute to player el, so that css :lang() is correct ([#4046](https://github.com/videojs/video.js/issues/4046)) ([17143fd](https://github.com/videojs/video.js/commit/17143fd)) -* addChild instance names should be toTitleCased ([#4116](https://github.com/videojs/video.js/issues/4116)) ([576ac19](https://github.com/videojs/video.js/commit/576ac19)) -* allow changing volume in full height of volume control ([#3987](https://github.com/videojs/video.js/issues/3987)) ([f87ada1](https://github.com/videojs/video.js/commit/f87ada1)) -* copy basic plugin properties onto the wrapper ([#4100](https://github.com/videojs/video.js/issues/4100)) ([127cd78](https://github.com/videojs/video.js/commit/127cd78)) -* cues at startTime 0 do not fire ([#4152](https://github.com/videojs/video.js/issues/4152)) ([a2b1a33](https://github.com/videojs/video.js/commit/a2b1a33)) -* Disable all time tooltips in IE8, as they are broken ([#4029](https://github.com/videojs/video.js/issues/4029)) ([60bcc99](https://github.com/videojs/video.js/commit/60bcc99)) -* disable title attribute on menu items ([#4019](https://github.com/videojs/video.js/issues/4019)) ([04f23c1](https://github.com/videojs/video.js/commit/04f23c1)), closes [#3699](https://github.com/videojs/video.js/issues/3699) -* Do not create element for MediaLoader ([#4097](https://github.com/videojs/video.js/issues/4097)) ([1cb0a97](https://github.com/videojs/video.js/commit/1cb0a97)) -* early play should wait for player ready, even if source is available ([#4134](https://github.com/videojs/video.js/issues/4134)) ([3bbf019](https://github.com/videojs/video.js/commit/3bbf019)), closes [#4057](https://github.com/videojs/video.js/issues/4057) -* EventTarget is also evented ([#3990](https://github.com/videojs/video.js/issues/3990)) ([e34335b](https://github.com/videojs/video.js/commit/e34335b)) -* fix the structure of elements in menus to comply with ARIA requirements ([#4034](https://github.com/videojs/video.js/issues/4034)) ([1b1ba04](https://github.com/videojs/video.js/commit/1b1ba04)) -* focus play toggle from Big Play Btn on play ([#4018](https://github.com/videojs/video.js/issues/4018)) ([4f79e1e](https://github.com/videojs/video.js/commit/4f79e1e)), closes [#2729](https://github.com/videojs/video.js/issues/2729) -* hide font-icons from assitive technology ([#4006](https://github.com/videojs/video.js/issues/4006)) ([24d2e7b](https://github.com/videojs/video.js/commit/24d2e7b)), closes [#3982](https://github.com/videojs/video.js/issues/3982) -* improve French translation ([#4062](https://github.com/videojs/video.js/issues/4062)) ([dc4c1eb](https://github.com/videojs/video.js/commit/dc4c1eb)) -* keep minimum volume after unmuting above 0.1 ([#4227](https://github.com/videojs/video.js/issues/4227)) ([16c1e0a](https://github.com/videojs/video.js/commit/16c1e0a)), closes [#4054](https://github.com/videojs/video.js/issues/4054) -* localize aria-labels ([#4027](https://github.com/videojs/video.js/issues/4027)) ([0ac1269](https://github.com/videojs/video.js/commit/0ac1269)), closes [#2728](https://github.com/videojs/video.js/issues/2728) -* Make `Player#techCall_()` synchronous again ([#3988](https://github.com/videojs/video.js/issues/3988)) ([3585af0](https://github.com/videojs/video.js/commit/3585af0)) -* make load progress buffered regions height 100% ([#4190](https://github.com/videojs/video.js/issues/4190)) ([424fa51](https://github.com/videojs/video.js/commit/424fa51)) -* make mergeOptions behave the same across browsers ([#4088](https://github.com/videojs/video.js/issues/4088)) ([0da9324](https://github.com/videojs/video.js/commit/0da9324)) -* make sure audio track hides with one item ([#4202](https://github.com/videojs/video.js/issues/4202)) ([0fd7aad](https://github.com/videojs/video.js/commit/0fd7aad)) -* Muting with `MuteToggle` sets ARIA value of `VolumeBar` to 0 ([#4099](https://github.com/videojs/video.js/issues/4099)) ([181a19f](https://github.com/videojs/video.js/commit/181a19f)), closes [#4064](https://github.com/videojs/video.js/issues/4064) -* not showing default text tracks over video ([#4216](https://github.com/videojs/video.js/issues/4216)) ([dbfba28](https://github.com/videojs/video.js/commit/dbfba28)) -* Patch a memory leak caused by un-removed track listener(s). ([#3976](https://github.com/videojs/video.js/issues/3976)) ([4979ea7](https://github.com/videojs/video.js/commit/4979ea7)) -* Progress holder gaps cause tooltips misalignment and time tooltip outlines ([#4031](https://github.com/videojs/video.js/issues/4031)) ([be27f2a](https://github.com/videojs/video.js/commit/be27f2a)), closes [#3645](https://github.com/videojs/video.js/issues/3645) -* remaining time display width on IE8 and IE9 ([#3983](https://github.com/videojs/video.js/issues/3983)) ([866a3f3](https://github.com/videojs/video.js/commit/866a3f3)) -* **MenuButton:** Unify behavior of showing/hiding ([#4157](https://github.com/videojs/video.js/issues/4157)) ([c611f9f](https://github.com/videojs/video.js/commit/c611f9f)) -* remove focus ring from player itself ([#4237](https://github.com/videojs/video.js/issues/4237)) ([e98c65d](https://github.com/videojs/video.js/commit/e98c65d)) -* **audio-tracks-button:** add wrapper CSS builder to audio tracks menu button ([#4163](https://github.com/videojs/video.js/issues/4163)) ([d9ec7bc](https://github.com/videojs/video.js/commit/d9ec7bc)) -* **cues:** only copy cue props that don't exist ([#4145](https://github.com/videojs/video.js/issues/4145)) ([0f57341](https://github.com/videojs/video.js/commit/0f57341)) -* **dom:** getBoundingClientRect check that el is defined ([#4139](https://github.com/videojs/video.js/issues/4139)) ([fb88ae2](https://github.com/videojs/video.js/commit/fb88ae2)) -* **icon-placeholder:** align icons on ie8 properly ([#4174](https://github.com/videojs/video.js/issues/4174)) ([1770f00](https://github.com/videojs/video.js/commit/1770f00)) -* **ie8:** various minor ie8 fixes ([#4175](https://github.com/videojs/video.js/issues/4175)) ([cb890a9](https://github.com/videojs/video.js/commit/cb890a9)) -* **package:** update xhr to version 2.4.0 ([#4101](https://github.com/videojs/video.js/issues/4101)) ([5265624](https://github.com/videojs/video.js/commit/5265624)) -* **playback rate menu:** playback rate menu items should be selectable ([#4149](https://github.com/videojs/video.js/issues/4149)) ([a9f8fcb](https://github.com/videojs/video.js/commit/a9f8fcb)) -* **sass:** import path has cwd once again ([#4061](https://github.com/videojs/video.js/issues/4061)) ([caff93f](https://github.com/videojs/video.js/commit/caff93f)) -* **sass:** import path no longer has cwd ([#4001](https://github.com/videojs/video.js/issues/4001)) ([19b429b](https://github.com/videojs/video.js/commit/19b429b)), closes [#3998](https://github.com/videojs/video.js/issues/3998) -* **subs-caps-button:** add hide threshold to subs-caps button ([#4171](https://github.com/videojs/video.js/issues/4171)) ([88ee6af](https://github.com/videojs/video.js/commit/88ee6af)) -* remove redundant Html5#play() ([405b29b](https://github.com/videojs/video.js/commit/405b29b)) -* removeCue should work with native passed in cue ([#4208](https://github.com/videojs/video.js/issues/4208)) ([f2b5a05](https://github.com/videojs/video.js/commit/f2b5a05)) -* Set MuteButton controlText correctly ([#4056](https://github.com/videojs/video.js/issues/4056)) ([3c1108c](https://github.com/videojs/video.js/commit/3c1108c)) -* silence play promise error ([#4247](https://github.com/videojs/video.js/issues/4247)) ([0908d91](https://github.com/videojs/video.js/commit/0908d91)) -* Solve a typo in translation files ([#4063](https://github.com/videojs/video.js/issues/4063)) ([5540868](https://github.com/videojs/video.js/commit/5540868)) -* support empty src in `Player#src` ([#4030](https://github.com/videojs/video.js/issues/4030)) ([6541467](https://github.com/videojs/video.js/commit/6541467)) -* synchronously shim vtt.js when possible ([#4083](https://github.com/videojs/video.js/issues/4083)) ([e1b4804](https://github.com/videojs/video.js/commit/e1b4804)) -* trap tab focus in modal when hitting s-tab ([#4075](https://github.com/videojs/video.js/issues/4075)) ([1f7a842](https://github.com/videojs/video.js/commit/1f7a842)), closes [#4049](https://github.com/videojs/video.js/issues/4049) -* updating time tooltips when player not in DOM ([#3991](https://github.com/videojs/video.js/issues/3991)) ([22aade1](https://github.com/videojs/video.js/commit/22aade1)) -* **subs-caps-button:** add wrapper CSS builder to subs caps button ([#4156](https://github.com/videojs/video.js/issues/4156)) ([e5af0a5](https://github.com/videojs/video.js/commit/e5af0a5)) -* **subs-caps-button:** captions items should hide icon from SR ([#4158](https://github.com/videojs/video.js/issues/4158)) ([2ee133f](https://github.com/videojs/video.js/commit/2ee133f)) -* **text track settings:** focus subs-caps button if exists over CC button ([#4155](https://github.com/videojs/video.js/issues/4155)) ([db901c5](https://github.com/videojs/video.js/commit/db901c5)) -* **tracks:** allow forcing native text tracks on or off ([#4172](https://github.com/videojs/video.js/issues/4172)) ([67634cf](https://github.com/videojs/video.js/commit/67634cf)) -* **vttjs:** wait till tech el in DOM before loading vttjs ([#4177](https://github.com/videojs/video.js/issues/4177)) ([ddde644](https://github.com/videojs/video.js/commit/ddde644)) - -### Chores - -* 6.x build updates ([#4228](https://github.com/videojs/video.js/issues/4228)) ([6d876ee](https://github.com/videojs/video.js/commit/6d876ee)) -* Add flash as a dev dependency for testing ([#4016](https://github.com/videojs/video.js/issues/4016)) ([4949619](https://github.com/videojs/video.js/commit/4949619)) -* change accessibility test in grunt.js to remove unnecessary warning message. ([#4143](https://github.com/videojs/video.js/issues/4143)) ([dacf0ca](https://github.com/videojs/video.js/commit/dacf0ca)) -* **package:** update remark-validate-links to version 6.0.0 ([#4128](https://github.com/videojs/video.js/issues/4128)) ([1395677](https://github.com/videojs/video.js/commit/1395677)) -* ignore qunit and sinon from greenkeeper ([#4242](https://github.com/videojs/video.js/issues/4242)) ([29d733d](https://github.com/videojs/video.js/commit/29d733d)) -* increase browserstack/karma timeouts, dispose player in tests ([#4135](https://github.com/videojs/video.js/issues/4135)) ([6874fa2](https://github.com/videojs/video.js/commit/6874fa2)) -* only report errors during linting in the build process, not warnings ([#4041](https://github.com/videojs/video.js/issues/4041)) ([6208e4b](https://github.com/videojs/video.js/commit/6208e4b)) -* remove bower.json ([#4238](https://github.com/videojs/video.js/issues/4238)) ([0d19a05](https://github.com/videojs/video.js/commit/0d19a05)), closes [#4012](https://github.com/videojs/video.js/issues/4012) -* **package:** update webpack to version 2.3.0 ([#4219](https://github.com/videojs/video.js/issues/4219)) ([0223057](https://github.com/videojs/video.js/commit/0223057)) -* Remove component.json and remove references to it ([#3866](https://github.com/videojs/video.js/issues/3866)) ([0bba319](https://github.com/videojs/video.js/commit/0bba319)) -* **docs:** Use Elephants Dream video files from CDN for docs/examples/elephantsdream/ ([#4181](https://github.com/videojs/video.js/issues/4181)) ([af1c6e3](https://github.com/videojs/video.js/commit/af1c6e3)) -* **package:** pin karma to 1.3.0 ([#4002](https://github.com/videojs/video.js/issues/4002)) ([5b8b41e](https://github.com/videojs/video.js/commit/5b8b41e)) -* **package:** update remark-cli to version 3.0.0 ([#4126](https://github.com/videojs/video.js/issues/4126)) ([dc9ed1c](https://github.com/videojs/video.js/commit/dc9ed1c)) -* **package:** update remark-lint to version 6.0.0 ([#4129](https://github.com/videojs/video.js/issues/4129)) ([9ef2d07](https://github.com/videojs/video.js/commit/9ef2d07)) -* **package:** update remark-toc to version 4.0.0 ([#4127](https://github.com/videojs/video.js/issues/4127)) ([d5a619d](https://github.com/videojs/video.js/commit/d5a619d)) -* **package:** update uglify-js to version 2.8.8 ([#4170](https://github.com/videojs/video.js/issues/4170)) ([bf787bd](https://github.com/videojs/video.js/commit/bf787bd)), closes [#4138](https://github.com/videojs/video.js/issues/4138) -* **package:** update videojs-vtt.js to version 0.12.3 ([#4221](https://github.com/videojs/video.js/issues/4221)) ([7d12c9e](https://github.com/videojs/video.js/commit/7d12c9e)) -* **package:** update xhr to version 2.3.3 ([#3914](https://github.com/videojs/video.js/issues/3914)) ([924fb27](https://github.com/videojs/video.js/commit/924fb27)) -* switch from ghooks to husky ([#4074](https://github.com/videojs/video.js/issues/4074)) ([c3b1d68](https://github.com/videojs/video.js/commit/c3b1d68)) -* **sandbox:** Fix poster image to match the video in the 'combined-tracks.html' example in sandbox ([#4164](https://github.com/videojs/video.js/issues/4164)) ([5ffe1cd](https://github.com/videojs/video.js/commit/5ffe1cd)) -* **sandbox:** Use Elephants Dream video files from CDN for the sandbox/descriptions.html.example. ([#4137](https://github.com/videojs/video.js/issues/4137)) ([715f584](https://github.com/videojs/video.js/commit/715f584)) -* **test:** silence plugin warning from test ([#4173](https://github.com/videojs/video.js/issues/4173)) ([05e6494](https://github.com/videojs/video.js/commit/05e6494)) -* **tests:** make tests not print out errors ([#4141](https://github.com/videojs/video.js/issues/4141)) ([f95815b](https://github.com/videojs/video.js/commit/f95815b)) - -### Code Refactoring - -* Buttons will always use a button element ([#3828](https://github.com/videojs/video.js/issues/3828)) ([c340dbc](https://github.com/videojs/video.js/commit/c340dbc)) -* do not allow adding children with options passed in as a boolean ([#3872](https://github.com/videojs/video.js/issues/3872)) ([b07143d](https://github.com/videojs/video.js/commit/b07143d)) -* Evented Components ([#3959](https://github.com/videojs/video.js/issues/3959)) ([4c3b60c](https://github.com/videojs/video.js/commit/4c3b60c)) -* expose tech but warn without safety var ([#3916](https://github.com/videojs/video.js/issues/3916)) ([8622b26](https://github.com/videojs/video.js/commit/8622b26)) -* Make registerComponent only work with Components ([#3802](https://github.com/videojs/video.js/issues/3802)) ([57af15c](https://github.com/videojs/video.js/commit/57af15c)) -* move most volume panel functionality into css state ([#3981](https://github.com/videojs/video.js/issues/3981)) ([2e2ac6f](https://github.com/videojs/video.js/commit/2e2ac6f)) -* MuteToggle#update ([#4058](https://github.com/videojs/video.js/issues/4058)) ([a04f387](https://github.com/videojs/video.js/commit/a04f387)) -* Remove custom UMD ([#3826](https://github.com/videojs/video.js/issues/3826)) ([2014120](https://github.com/videojs/video.js/commit/2014120)) -* Remove deprecated features of extend/Component#extend ([#3825](https://github.com/videojs/video.js/issues/3825)) ([f8aed4d](https://github.com/videojs/video.js/commit/f8aed4d)) -* Remove method Chaining from videojs ([#3860](https://github.com/videojs/video.js/issues/3860)) ([8f07f5d](https://github.com/videojs/video.js/commit/8f07f5d)) -* remove special loadstart handling ([#3906](https://github.com/videojs/video.js/issues/3906)) ([73b6316](https://github.com/videojs/video.js/commit/73b6316)) -* Remove TimeRanges without an index deprecation warning ([#3827](https://github.com/videojs/video.js/issues/3827)) ([e12bedb](https://github.com/videojs/video.js/commit/e12bedb)) -* Remove unused defaultVolume option default ([#3915](https://github.com/videojs/video.js/issues/3915)) ([5377ffc](https://github.com/videojs/video.js/commit/5377ffc)) -* unify all Track and TrackList APIs ([#3783](https://github.com/videojs/video.js/issues/3783)) ([49bed07](https://github.com/videojs/video.js/commit/49bed07)) - -### Documentation - -* Add MediaLoader to components list ([#4070](https://github.com/videojs/video.js/issues/4070)) ([65dc81a](https://github.com/videojs/video.js/commit/65dc81a)) -* Expand testing info in `CONTRIBUTING.md` ([#4020](https://github.com/videojs/video.js/issues/4020)) ([2da4e76](https://github.com/videojs/video.js/commit/2da4e76)) -* fix broken links to guides in the faq ([#3973](https://github.com/videojs/video.js/issues/3973)) ([58f2349](https://github.com/videojs/video.js/commit/58f2349)) -* fix links in generated docs ([#4200](https://github.com/videojs/video.js/issues/4200)) ([61e2078](https://github.com/videojs/video.js/commit/61e2078)) -* fixup global jsdoc members ([#4015](https://github.com/videojs/video.js/issues/4015)) ([6ad1e5c](https://github.com/videojs/video.js/commit/6ad1e5c)) -* minor fix to currentTime() comment: "setting" not "getting" ([#3944](https://github.com/videojs/video.js/issues/3944)) ([6578ed9](https://github.com/videojs/video.js/commit/6578ed9)) -* **coc:** introduce CODE_OF_CONDUCT.md ([#4160](https://github.com/videojs/video.js/issues/4160)) ([312b10c](https://github.com/videojs/video.js/commit/312b10c)) -* ran `npm run docs:fix` to update TOC on guides ([#3971](https://github.com/videojs/video.js/issues/3971)) ([de3945d](https://github.com/videojs/video.js/commit/de3945d)) -* **guide:** Add a `ModalDialog` guide ([#3961](https://github.com/videojs/video.js/issues/3961)) ([7b0d738](https://github.com/videojs/video.js/commit/7b0d738)) -* **guides:** Add a basic ReactJS guide and update the FAQ ([#3972](https://github.com/videojs/video.js/issues/3972)) ([05b39fe](https://github.com/videojs/video.js/commit/05b39fe)) -* replace 'autoPlay' by 'autoplay' ([#4080](https://github.com/videojs/video.js/issues/4080)) ([7ab52d1](https://github.com/videojs/video.js/commit/7ab52d1)), closes [#3995](https://github.com/videojs/video.js/issues/3995) -* tech order will only have html5 by default ([#4188](https://github.com/videojs/video.js/issues/4188)) ([41be5dc](https://github.com/videojs/video.js/commit/41be5dc)) -* **guides:** fix typos in faq guide ([#4067](https://github.com/videojs/video.js/issues/4067)) ([2433915](https://github.com/videojs/video.js/commit/2433915)) -* **guides:** fix typos in functions guide ([#4035](https://github.com/videojs/video.js/issues/4035)) ([0fc2c1c](https://github.com/videojs/video.js/commit/0fc2c1c)) -* **jsdoc:** introduce a jsdoc template and build on publish ([#3910](https://github.com/videojs/video.js/issues/3910)) ([e642295](https://github.com/videojs/video.js/commit/e642295)) - -### Tests - -* **ie8:** only run mute toggle tests in html5 env ([#4003](https://github.com/videojs/video.js/issues/4003)) ([5bde16a](https://github.com/videojs/video.js/commit/5bde16a)) -* add tests for obj.assign util ([#4014](https://github.com/videojs/video.js/issues/4014)) ([fcb5aa8](https://github.com/videojs/video.js/commit/fcb5aa8)) -* fix IE9 rounding issue with lastvolume test ([#4230](https://github.com/videojs/video.js/issues/4230)) ([46dd0aa](https://github.com/videojs/video.js/commit/46dd0aa)) -* fix tests ([#3953](https://github.com/videojs/video.js/issues/3953)) ([7bafcc2](https://github.com/videojs/video.js/commit/7bafcc2)) - - -### BREAKING CHANGES - -* setting the source is now asynchronous. `sourceOrder` option removed and made the default. -* remove deprecated features. -* **volume panel:** remove VolumeMenuButton, introduce a new default volume control: VolumePanel. -* removal of `keepTooltipsInside` option. -* some externally accessibly functions for tracks are now private. -* player methods no longer return a player instance when called. Fixes #3704. -* removal of component.json -* remove flash tech from core. -* restoring the outlines changes the skin slightly and potentially break users. Fixes #3200. -* registerComponent now throws if no name or not a component is passed in. -* remove the double loadstart handlers that dispose the tech/source handlers if a secondary loadstart event is heard. -* remove ability to add children with options as a boolean. -* removing ability to use TimeRange methods without an index. -* button component will always use a button element. -* `play()` no longer returns the player object but instead the native Promise or nothing. - - -## [5.19.1](https://github.com/videojs/video.js/compare/v5.19.0...v5.19.1) (2017-03-27) - -### Bug Fixes - -* not showing default text tracks over video ([#4217](https://github.com/videojs/video.js/issues/4217)) ([4653922](https://github.com/videojs/video.js/commit/4653922)) -* removeCue should work with native passed in cue ([#4209](https://github.com/videojs/video.js/issues/4209)) ([3974944](https://github.com/videojs/video.js/commit/3974944)) - -### Chores - -* **package:** update videojs-vtt.js to 0.12.3 ([#4223](https://github.com/videojs/video.js/issues/4223)) ([ad770fb](https://github.com/videojs/video.js/commit/ad770fb)) - - -# [5.19.0](https://github.com/videojs/video.js/compare/v5.18.4...v5.19.0) (2017-03-15) - -### Features - -* Make pause on open optional for ModalDialog via options ([#4187](https://github.com/videojs/video.js/issues/4187)) ([4ec3b56](https://github.com/videojs/video.js/commit/4ec3b56)) - -### Bug Fixes - -* make load progress buffered regions height 100% ([#4191](https://github.com/videojs/video.js/issues/4191)) ([398c6e9](https://github.com/videojs/video.js/commit/398c6e9)) -* make sure audio track hides with one item ([#4203](https://github.com/videojs/video.js/issues/4203)) ([c069655](https://github.com/videojs/video.js/commit/c069655)) - - -## [5.18.4](https://github.com/videojs/video.js/compare/v5.18.3...v5.18.4) (2017-03-08) - -### Bug Fixes - -* **vttjs:** wait till tech el in DOM before loading vttjs ([#4176](https://github.com/videojs/video.js/issues/4176)) ([ad86eec](https://github.com/videojs/video.js/commit/ad86eec)) - - -## [5.18.3](https://github.com/videojs/video.js/compare/v5.18.2...v5.18.3) (2017-03-06) - - -## [5.18.1](https://github.com/videojs/video.js/compare/v5.18.0...v5.18.1) (2017-03-03) - -### Bug Fixes - -* **cues:** only copy cue props that don't exist ([#4146](https://github.com/videojs/video.js/issues/4146)) ([de08669](https://github.com/videojs/video.js/commit/de08669)) -* cue-points with a startTime of 0 ([#4148](https://github.com/videojs/video.js/issues/4148)) ([e7d4b47](https://github.com/videojs/video.js/commit/e7d4b47)) -* make sure that cues copy over their id ([#4154](https://github.com/videojs/video.js/issues/4154)) ([072c277](https://github.com/videojs/video.js/commit/072c277)) -* **MenuButton:** Unify behavior of showing/hiding ([#3993](https://github.com/videojs/video.js/issues/3993)) ([4367c69](https://github.com/videojs/video.js/commit/4367c69)) -* **playback rate menu:** playback rate menu items should be selectable ([#4150](https://github.com/videojs/video.js/issues/4150)) ([288edd1](https://github.com/videojs/video.js/commit/288edd1)) - -### Chores - -* **build:** lint errors only and silence webpack ([#4153](https://github.com/videojs/video.js/issues/4153)) ([b1ca344](https://github.com/videojs/video.js/commit/b1ca344)) -* **package:** update video-js-swf to 5.3.0 ([#4161](https://github.com/videojs/video.js/issues/4161)) ([2bcfe21](https://github.com/videojs/video.js/commit/2bcfe21)) - - -# [5.18.0](https://github.com/videojs/video.js/compare/v5.17.0...v5.18.0) (2017-02-27) - -### Features - -* focus play toggle from Big Play Btn on play ([#4132](https://github.com/videojs/video.js/issues/4132)) ([dcc615a](https://github.com/videojs/video.js/commit/dcc615a)), closes [#2729](https://github.com/videojs/video.js/issues/2729) -* update videojs-vtt.js and wrap native cues in TextTrack ([#4131](https://github.com/videojs/video.js/issues/4131)) ([3d4aebc](https://github.com/videojs/video.js/commit/3d4aebc)), closes [#4093](https://github.com/videojs/video.js/issues/4093) - -### Bug Fixes - -* **sass:** import path has cwd once again ([#4076](https://github.com/videojs/video.js/issues/4076)) ([c02c6c6](https://github.com/videojs/video.js/commit/c02c6c6)) -* addChild instance names should be toTitleCased ([#4117](https://github.com/videojs/video.js/issues/4117)) ([fa97309](https://github.com/videojs/video.js/commit/fa97309)) -* make mergeOptions behave the same across browsers ([#4090](https://github.com/videojs/video.js/issues/4090)) ([ce19ed5](https://github.com/videojs/video.js/commit/ce19ed5)) -* synchronously shim vtt.js when possible ([#4082](https://github.com/videojs/video.js/issues/4082)) ([b5727a6](https://github.com/videojs/video.js/commit/b5727a6)) - - -# [5.17.0](https://github.com/videojs/video.js/compare/v5.16.0...v5.17.0) (2017-02-07) - -### Bug Fixes - -* Patch a memory leak caused by un-removed track listener(s). ([#3975](https://github.com/videojs/video.js/issues/3975)) ([bca44c0](https://github.com/videojs/video.js/commit/bca44c0)) -* remove title attribute on menu items, fixes [#3699](https://github.com/videojs/video.js/issues/3699) ([#4009](https://github.com/videojs/video.js/issues/4009)) ([91874a3](https://github.com/videojs/video.js/commit/91874a3)) - -### Chores - -* change accessibility test in grunt.js to remove unnecessary warning message. ([#4008](https://github.com/videojs/video.js/issues/4008)) ([daad492](https://github.com/videojs/video.js/commit/daad492)) -* **package:** update swf to 5.2.0 ([#4040](https://github.com/videojs/video.js/issues/4040)) ([dab893b](https://github.com/videojs/video.js/commit/dab893b)) - -### Documentation - -* minor fix to currentTime() comment: "setting" not "getting" ([#3944](https://github.com/videojs/video.js/issues/3944)) ([6578ed9](https://github.com/videojs/video.js/commit/6578ed9)) - - -# [5.16.0](https://github.com/videojs/video.js/compare/v5.15.1...v5.16.0) (2017-01-12) - -### Features - -* Show big play button on pause if specified ([#3892](https://github.com/videojs/video.js/issues/3892)) ([b547214](https://github.com/videojs/video.js/commit/b547214)) - -### Bug Fixes - -* give techs a name ([#3934](https://github.com/videojs/video.js/issues/3934)) ([94fd5c1](https://github.com/videojs/video.js/commit/94fd5c1)), closes [#1786](https://github.com/videojs/video.js/issues/1786) -* Pause player before seeking in seek bar mousedown ([#3921](https://github.com/videojs/video.js/issues/3921)) ([2ceed0a](https://github.com/videojs/video.js/commit/2ceed0a)), closes [#3839](https://github.com/videojs/video.js/issues/3839) [#3886](https://github.com/videojs/video.js/issues/3886) -* player el ingest when parent doesn't have `hasAttribute` method ([#3929](https://github.com/videojs/video.js/issues/3929)) ([bbe8253](https://github.com/videojs/video.js/commit/bbe8253)) -* showing custom poster with controls disabled ([#3933](https://github.com/videojs/video.js/issues/3933)) ([305e5ea](https://github.com/videojs/video.js/commit/305e5ea)), closes [#1625](https://github.com/videojs/video.js/issues/1625) - -### Chores - -* better dev experience ([#3896](https://github.com/videojs/video.js/issues/3896)) ([9ec5587](https://github.com/videojs/video.js/commit/9ec5587)) -* don't run tests on travis if only docs were changed ([#3908](https://github.com/videojs/video.js/issues/3908)) ([c239bd5](https://github.com/videojs/video.js/commit/c239bd5)) -* **development:** fix `npm start` file watching ([#3922](https://github.com/videojs/video.js/issues/3922)) ([02da697](https://github.com/videojs/video.js/commit/02da697)) -* **release:** add es5 folder to the tagged commit ([#3913](https://github.com/videojs/video.js/issues/3913)) ([d120ea2](https://github.com/videojs/video.js/commit/d120ea2)) -* **sass:** upgrade to latest version of grunt-sass ([#3897](https://github.com/videojs/video.js/issues/3897)) ([83d453b](https://github.com/videojs/video.js/commit/83d453b)), closes [#3692](https://github.com/videojs/video.js/issues/3692) -* fix typo in collaborator guide ([#3931](https://github.com/videojs/video.js/issues/3931)) ([f35de1c](https://github.com/videojs/video.js/commit/f35de1c)) - -### Code Refactoring - -* require `videojs-vtt.js` via require rather than concat ([#3919](https://github.com/videojs/video.js/issues/3919)) ([d290db1](https://github.com/videojs/video.js/commit/d290db1)) - -### Documentation - -* **faq:** add a question about autoplay ([#3898](https://github.com/videojs/video.js/issues/3898)) ([e5a240a](https://github.com/videojs/video.js/commit/e5a240a)) -* **faq:** add FAQ question about RTMP url ([#3899](https://github.com/videojs/video.js/issues/3899)) ([9c74116](https://github.com/videojs/video.js/commit/9c74116)) -* **troubleshooting:** updates to troubleshooting doc ([#3912](https://github.com/videojs/video.js/issues/3912)) ([0ce7cd4](https://github.com/videojs/video.js/commit/0ce7cd4)) - - -## [5.15.1](https://github.com/videojs/video.js/compare/v5.15.0...v5.15.1) (2016-12-23) - -### Bug Fixes - -* extra warn logs on already initialized player references ([#3888](https://github.com/videojs/video.js/issues/3888)) ([b7c384e](https://github.com/videojs/video.js/commit/b7c384e)) -* Support require()-ing video.js ([#3889](https://github.com/videojs/video.js/issues/3889)) ([ac0b03f](https://github.com/videojs/video.js/commit/ac0b03f)), closes [#3869](https://github.com/videojs/video.js/issues/3869) - - -# [5.15.0](https://github.com/videojs/video.js/compare/v5.14.1...v5.15.0) (2016-12-22) - -### Features - -* **player:** ingest a player div for videojs ([#3856](https://github.com/videojs/video.js/issues/3856)) ([74530d8](https://github.com/videojs/video.js/commit/74530d8)) -* deprecate the use of `starttime` in player.js ([#3838](https://github.com/videojs/video.js/issues/3838)) ([22cf3dd](https://github.com/videojs/video.js/commit/22cf3dd)) - -### Bug Fixes - -* **html5:** (un)patchCanPlayType could set native canPlayType to null ([#3863](https://github.com/videojs/video.js/issues/3863)) ([559297a](https://github.com/videojs/video.js/commit/559297a)) -* **seeking:** don't always pause in mouse down ([#3886](https://github.com/videojs/video.js/issues/3886)) ([e92db4f](https://github.com/videojs/video.js/commit/e92db4f)), closes [#3839](https://github.com/videojs/video.js/issues/3839) -* don't emit tap events on tech when using native controls ([#3873](https://github.com/videojs/video.js/issues/3873)) ([42507f8](https://github.com/videojs/video.js/commit/42507f8)) -* remote text track deprecation warnings ([#3864](https://github.com/videojs/video.js/issues/3864)) ([a7ffa34](https://github.com/videojs/video.js/commit/a7ffa34)) -* remove vjs-seeking on src change ([#3846](https://github.com/videojs/video.js/issues/3846)) ([83cbeec](https://github.com/videojs/video.js/commit/83cbeec)), closes [#3765](https://github.com/videojs/video.js/issues/3765) - -### Chores - -* **docs:** Documentation Linting and TOC generation ([#3841](https://github.com/videojs/video.js/issues/3841)) ([0493f54](https://github.com/videojs/video.js/commit/0493f54)) -* **faq:** move FAQ and troubleshooting guide to docs/ ([#3883](https://github.com/videojs/video.js/issues/3883)) ([26789e7](https://github.com/videojs/video.js/commit/26789e7)) -* **package:** update dependencies (enable Greenkeeper) 🌴 ([#3777](https://github.com/videojs/video.js/issues/3777)) ([d20e9ce](https://github.com/videojs/video.js/commit/d20e9ce)) -* **videojs-standard:** update to version 6.0.1 ([#3884](https://github.com/videojs/video.js/issues/3884)) ([eb389c5](https://github.com/videojs/video.js/commit/eb389c5)) - -### Documentation - -* move examples out of code into docs ([642ad4b](https://github.com/videojs/video.js/commit/642ad4b)) - -### Tests - -* **hooks:** move vjs hooks QUnit module into separate file ([#3862](https://github.com/videojs/video.js/issues/3862)) ([87cd26d](https://github.com/videojs/video.js/commit/87cd26d)) -* **hooks:** remove errors logged in tests ([#3865](https://github.com/videojs/video.js/issues/3865)) ([3f724f9](https://github.com/videojs/video.js/commit/3f724f9)) - - -## [5.14.1](https://github.com/videojs/video.js/compare/v5.14.0...v5.14.1) (2016-12-05) - -### Bug Fixes - -* **throttle:** Fix error in Fn.throttle that broke MouseTimeDisplay ([#3833](https://github.com/videojs/video.js/issues/3833)) ([014c6b8](https://github.com/videojs/video.js/commit/014c6b8)) - -### Tests - -* add Edge to browserstack tests ([#3834](https://github.com/videojs/video.js/issues/3834)) ([5ec46b0](https://github.com/videojs/video.js/commit/5ec46b0)) -* **events:** silence error logging in tests ([#3835](https://github.com/videojs/video.js/issues/3835)) ([214e01c](https://github.com/videojs/video.js/commit/214e01c)) - - -# [5.14.0](https://github.com/videojs/video.js/compare/v5.13.2...v5.14.0) (2016-12-02) - -### Features - -* Allow to use custom Player class ([#3458](https://github.com/videojs/video.js/issues/3458)) ([de25d75](https://github.com/videojs/video.js/commit/de25d75)), closes [#3335](https://github.com/videojs/video.js/issues/3335) [#3016](https://github.com/videojs/video.js/issues/3016) -* Eliminate lodash-compat as a dependency, rewrite mergeOptions ([#3760](https://github.com/videojs/video.js/issues/3760)) ([761b877](https://github.com/videojs/video.js/commit/761b877)) -* Object Type-Detection and Replacing object.assign ([#3757](https://github.com/videojs/video.js/issues/3757)) ([8f16de2](https://github.com/videojs/video.js/commit/8f16de2)) -* Refactoring chapters button handling and fixing several issues ([#3472](https://github.com/videojs/video.js/issues/3472)) ([41bd855](https://github.com/videojs/video.js/commit/41bd855)), closes [#3447](https://github.com/videojs/video.js/issues/3447) [#3447](https://github.com/videojs/video.js/issues/3447) -* **texttracks:** always use emulated text tracks ([#3798](https://github.com/videojs/video.js/issues/3798)) ([881cfcb](https://github.com/videojs/video.js/commit/881cfcb)) -* **tracks:** Added option to disable native tracks ([#3786](https://github.com/videojs/video.js/issues/3786)) ([9b9f89e](https://github.com/videojs/video.js/commit/9b9f89e)) - -### Code Refactoring - -* **html5:** remove confusing references to player in a tech ([#3790](https://github.com/videojs/video.js/issues/3790)) ([d69551a](https://github.com/videojs/video.js/commit/d69551a)) - -### Documentation - -* **FAQ:** add an faq ([#3805](https://github.com/videojs/video.js/issues/3805)) ([1d5562d](https://github.com/videojs/video.js/commit/1d5562d)) -* **guides:** Manual Documentation Improvements ([#3703](https://github.com/videojs/video.js/issues/3703)) ([d24fe40](https://github.com/videojs/video.js/commit/d24fe40)) -* **jsdoc:** Update the jsdoc comments to modern syntax - Part 1 ([#3694](https://github.com/videojs/video.js/issues/3694)) ([1a0b281](https://github.com/videojs/video.js/commit/1a0b281)) -* **jsdoc:** Update the jsdoc comments to modern syntax - Part 2 ([#3698](https://github.com/videojs/video.js/issues/3698)) ([cfc3ed7](https://github.com/videojs/video.js/commit/cfc3ed7)) -* **jsdoc:** Update the jsdoc comments to modern syntax - Part 3 ([#3708](https://github.com/videojs/video.js/issues/3708)) ([eb2093e](https://github.com/videojs/video.js/commit/eb2093e)) -* **jsdoc:** Update the jsdoc comments to modern syntax - Part 4 ([#3756](https://github.com/videojs/video.js/issues/3756)) ([15ce37e](https://github.com/videojs/video.js/commit/15ce37e)) -* **jsdoc:** Update the jsdoc comments to modern syntax - Part 5 ([#3766](https://github.com/videojs/video.js/issues/3766)) ([ba3cf17](https://github.com/videojs/video.js/commit/ba3cf17)) -* **jsdoc:** Update the jsdoc comments to modern syntax - Part 6 ([#3771](https://github.com/videojs/video.js/issues/3771)) ([c902279](https://github.com/videojs/video.js/commit/c902279)) -* add a troubleshooting guide ([#3814](https://github.com/videojs/video.js/issues/3814)) ([54ff1f9](https://github.com/videojs/video.js/commit/54ff1f9)) -* fix typo, extends -> extend ([#3789](https://github.com/videojs/video.js/issues/3789)) ([c5d1152](https://github.com/videojs/video.js/commit/c5d1152)) - -### Tests - -* fix tests on older IE ([#3800](https://github.com/videojs/video.js/issues/3800)) ([b4ebd9b](https://github.com/videojs/video.js/commit/b4ebd9b)) - - -## [5.13.2](https://github.com/videojs/video.js/compare/v5.13.1...v5.13.2) (2016-11-14) - -### Bug Fixes - -* **html5:** exit early on emulated tracks in html5 ([#3772](https://github.com/videojs/video.js/issues/3772)) ([252bcee](https://github.com/videojs/video.js/commit/252bcee)) -* **HtmlTrackElementList:** allow to reference by index via bracket notation ([#3776](https://github.com/videojs/video.js/issues/3776)) ([430be94](https://github.com/videojs/video.js/commit/430be94)) - -### Chores - -* fix CHANGELOG 5.13.1 header ([23f0fa0](https://github.com/videojs/video.js/commit/23f0fa0)) -* fixup CHANGELOG for 5.13.1 release ([2a05633](https://github.com/videojs/video.js/commit/2a05633)) -* **package:** update karma-detect-browsers to version 2.2.3 ([#3770](https://github.com/videojs/video.js/issues/3770)) ([6b477bb](https://github.com/videojs/video.js/commit/6b477bb)) -* **pr_template:** add checkbox to verify changes in a browser ([#3775](https://github.com/videojs/video.js/issues/3775)) ([72fcb6c](https://github.com/videojs/video.js/commit/72fcb6c)) - - -# [5.13.1](https://github.com/videojs/video.js/compare/v5.12.6...v5.13.1) (2016-11-09) - -### Features - -* **clickable-component:** Disable interaction with disabled clickable components ([#3525](https://github.com/videojs/video.js/issues/3525)) ([de1b363](https://github.com/videojs/video.js/commit/de1b363)) -* **component:** attribute get/set/remove methods ([202da2d](https://github.com/videojs/video.js/commit/202da2d)) -* **fluid:** use default aspect ratio for fluid players if width unknown ([#3614](https://github.com/videojs/video.js/issues/3614)) ([2988f6a](https://github.com/videojs/video.js/commit/2988f6a)) -* add a safe computedStyle to videojs. ([#3664](https://github.com/videojs/video.js/issues/3664)) ([9702618](https://github.com/videojs/video.js/commit/9702618)) -* add ability to get current source object and all source objects ([#2678](https://github.com/videojs/video.js/issues/2678)) ([028559c](https://github.com/videojs/video.js/commit/028559c)), closes [#2443](https://github.com/videojs/video.js/issues/2443) -* Components are now accessible via `camelCase` and `UpperCamelCase` ([#3439](https://github.com/videojs/video.js/issues/3439)) ([9d77268](https://github.com/videojs/video.js/commit/9d77268)), closes [#3436](https://github.com/videojs/video.js/issues/3436) -* **lang:** update ru.json ([#3654](https://github.com/videojs/video.js/issues/3654)) ([d11fd50](https://github.com/videojs/video.js/commit/d11fd50)) -* **lang:** update uk.json ([#3675](https://github.com/videojs/video.js/issues/3675)) ([8f7eb12](https://github.com/videojs/video.js/commit/8f7eb12)) -* implement player lifecycle hooks and trigger beforesetup/setup hooks ([#3639](https://github.com/videojs/video.js/issues/3639)) ([77357b1](https://github.com/videojs/video.js/commit/77357b1)) -* option to have remoteTextTracks automatically 'garbage-collected' when sources change ([#3736](https://github.com/videojs/video.js/issues/3736)) ([f05a927](https://github.com/videojs/video.js/commit/f05a927)) - -### Bug Fixes - -* allow rounded value for fluid player ratio test ([#3739](https://github.com/videojs/video.js/issues/3739)) ([2e720af](https://github.com/videojs/video.js/commit/2e720af)) -* aria-live="assertive" only for descriptions ([685404d](https://github.com/videojs/video.js/commit/685404d)), closes [#3554](https://github.com/videojs/video.js/issues/3554) -* currentDimension can return 0 for fluid player on IE ([#3738](https://github.com/videojs/video.js/issues/3738)) ([74cddca](https://github.com/videojs/video.js/commit/74cddca)) -* Suppress Infinity duration on Android Chrome before playback ([#3476](https://github.com/videojs/video.js/issues/3476)) ([ed59531](https://github.com/videojs/video.js/commit/ed59531)), closes [#3079](https://github.com/videojs/video.js/issues/3079) - -### Chores - -* **changelog.md:** update 5.12.6 and 5.12.3 ([#3715](https://github.com/videojs/video.js/issues/3715)) ([254683b](https://github.com/videojs/video.js/commit/254683b)) -* pin karma-detect-browsers to 2.1.0 ([#3764](https://github.com/videojs/video.js/issues/3764)) ([4859bb9](https://github.com/videojs/video.js/commit/4859bb9)) -* **package:** update grunt-accessibility to version 5.0.0 ([#3747](https://github.com/videojs/video.js/issues/3747)) ([b6d521f](https://github.com/videojs/video.js/commit/b6d521f)) - -### Code Refactoring - -* **texttracksettings:** DRYer code and remove massive HTML blob ([#3679](https://github.com/videojs/video.js/issues/3679)) ([fb74c71](https://github.com/videojs/video.js/commit/fb74c71)) -* remove un-needed contructor and function overrides ([#3721](https://github.com/videojs/video.js/issues/3721)) ([6889e92](https://github.com/videojs/video.js/commit/6889e92)) - -### Documentation - -* Change registerSourceHandler param doc from first to index ([#3737](https://github.com/videojs/video.js/issues/3737)) ([b2c5b2a](https://github.com/videojs/video.js/commit/b2c5b2a)) -* **collaborator_guide:** add collaborator guide ([#3724](https://github.com/videojs/video.js/issues/3724)) ([8d51235](https://github.com/videojs/video.js/commit/8d51235)) -* **contributing.md:** update CONTRIBUTING.md with latest info ([#3722](https://github.com/videojs/video.js/issues/3722)) ([11a096d](https://github.com/videojs/video.js/commit/11a096d)) - -### Performance Improvements - -* Dispatch Flash events asynchronously ([#3700](https://github.com/videojs/video.js/pull/3700)) -* Cache currentTime and buffered from Flash ([#3705](https://github.com/videojs/video.js/issues/3705)) ([45ffa81](https://github.com/videojs/video.js/commit/45ffa81)) -* Use ES6 rest operator and allow V8 to optimize mergeOptions ([#3743](https://github.com/videojs/video.js/issues/3743)) ([5f42130](https://github.com/videojs/video.js/commit/5f42130)) - -### Tests - -* **dom:** fix removeElClass test in Safari 10. ([#3768](https://github.com/videojs/video.js/issues/3768)) ([9965077](https://github.com/videojs/video.js/commit/9965077)) -* **hooks:** fix hooks unit test in ie8 ([#3745](https://github.com/videojs/video.js/issues/3745)) ([e9e5b5f](https://github.com/videojs/video.js/commit/e9e5b5f)) - - -## [5.12.6](https://github.com/videojs/video.js/compare/v5.12.5...v5.12.6) (2016-10-25) - -### Bug Fixes - -* make sure that document.createElement exists before using ([#3706](https://github.com/videojs/video.js/issues/3706)) ([49e29ba](https://github.com/videojs/video.js/commit/49e29ba)), closes [#3665](https://github.com/videojs/video.js/issues/3665) -* remove unnecessary comments from video.min.js ([#3709](https://github.com/videojs/video.js/issues/3709)) ([fe760a4](https://github.com/videojs/video.js/commit/fe760a4)), closes [#3707](https://github.com/videojs/video.js/issues/3707) - - -## [5.12.5](https://github.com/videojs/video.js/compare/v5.12.4...v5.12.5) (2016-10-19) - -### Bug Fixes - -* move html5 source handler incantation to bottom ([#3695](https://github.com/videojs/video.js/issues/3695)) ([7b9574b](https://github.com/videojs/video.js/commit/7b9574b)) - - -## [5.12.4](https://github.com/videojs/video.js/compare/v5.12.3...v5.12.4) (2016-10-18) - -### Bug Fixes - -* logging failing on browsers that don't always have console ([#3686](https://github.com/videojs/video.js/issues/3686)) ([e932061](https://github.com/videojs/video.js/commit/e932061)) -* Restore timeupdate/loadedmetadata listeners for duration display ([#3682](https://github.com/videojs/video.js/issues/3682)) ([44ec0e4](https://github.com/videojs/video.js/commit/44ec0e4)) - -### Chores - -* **grunt:** fix getting changelog by switching to npm-run ([#3687](https://github.com/videojs/video.js/issues/3687)) ([8845bd3](https://github.com/videojs/video.js/commit/8845bd3)), closes [#3683](https://github.com/videojs/video.js/issues/3683) - -### Documentation - -* **options.md:** Remove Bad Apostrophe ([#3677](https://github.com/videojs/video.js/issues/3677)) ([16c8559](https://github.com/videojs/video.js/commit/16c8559)) -* **tech.md:** Add a note on Flash permissions in sandboxed environments ([#3684](https://github.com/videojs/video.js/issues/3684)) ([66922a8](https://github.com/videojs/video.js/commit/66922a8)) - - -## [5.12.3](https://github.com/videojs/video.js/compare/v5.12.2...v5.12.3) (2016-10-06) - -### Features - -* **lang:** add missing translations in fr.json ([280ecd4](https://github.com/videojs/video.js/commit/280ecd4)) -* **lang:** add missing translations to el.json ([eb0efd4](https://github.com/videojs/video.js/commit/eb0efd4)) - -### Bug Fixes - -* **controls:** fix load progress bar never highlighting first buffered time range ([ca02298](https://github.com/videojs/video.js/commit/ca02298)) -* **css:** remove commented out css ([5fdcd46](https://github.com/videojs/video.js/commit/5fdcd46)), closes [#3587](https://github.com/videojs/video.js/issues/3587) -* disable HLS hack on Firefox for Android ([#3586](https://github.com/videojs/video.js/issues/3586)) ([dd2aff0](https://github.com/videojs/video.js/commit/dd2aff0)) -* proxy ios webkit events into fullscreenchange ([#3644](https://github.com/videojs/video.js/issues/3644)) ([e479f8c](https://github.com/videojs/video.js/commit/e479f8c)) -* **html5:** disable manual timeupdate events on html5 tech ([#3656](https://github.com/videojs/video.js/issues/3656)) ([920c54a](https://github.com/videojs/video.js/commit/920c54a)) - -### Chores - -* move metadata to hidden folder and update references ([86f0830](https://github.com/videojs/video.js/commit/86f0830)) -* **deps:** add the bundle-collapser browserify plugin ([816291e](https://github.com/videojs/video.js/commit/816291e)) -* **package:** remove es2015-loose since it's an option for es2015 ([#3629](https://github.com/videojs/video.js/issues/3629)) ([c545acd](https://github.com/videojs/video.js/commit/c545acd)) -* **package:** update grunt-contrib-cssmin to version 1.0.2 ([#3595](https://github.com/videojs/video.js/issues/3595)) ([54e3db5](https://github.com/videojs/video.js/commit/54e3db5)) -* **package:** update grunt-shell to version 2.0.0 ([#3642](https://github.com/videojs/video.js/issues/3642)) ([2032b17](https://github.com/videojs/video.js/commit/2032b17)) -* refactor redundant code in html5 tech ([#3593](https://github.com/videojs/video.js/issues/3593)) ([6878c21](https://github.com/videojs/video.js/commit/6878c21)) -* refactor redundant or verbose code in player.js ([#3597](https://github.com/videojs/video.js/issues/3597)) ([ae3e277](https://github.com/videojs/video.js/commit/ae3e277)) -* update CHANGELOG automation to use conventional-changelog ([#3669](https://github.com/videojs/video.js/issues/3669)) ([d4e89d2](https://github.com/videojs/video.js/commit/d4e89d2)) -* update object.assign to ^4.0.4 ([08c7f4e](https://github.com/videojs/video.js/commit/08c7f4e)) - -### Documentation - -* fix broken links in docs index.md ([4063f96](https://github.com/videojs/video.js/commit/4063f96)) - -### Tests - -* **a11y:** add basic accessibility testing using grunt-accessibility ([7d85f27](https://github.com/videojs/video.js/commit/7d85f27)) - -## 5.12.2 (2016-09-28) -* Changes from 5.11.7 on the 5.12 branch - -## 5.12.1 (2016-08-25) -* Changes from 5.11.6 on the 5.12 branch - -## 5.13.0 (2016-08-25) -* Ignored release - -## 5.12.0 (2016-08-25) -* @misteroneill, @BrandonOCasey, and @pagarwal123 updates all the code to pass the linter ([view](https://github.com/videojs/video.js/pull/3459)) -* @misteroneill added ghooks to run linter on git push ([view](https://github.com/videojs/video.js/pull/3459)) -* @BrandonOCasey removed unused base-styles.js file ([view](https://github.com/videojs/video.js/pull/3486)) -* @erikyuzwa, @gkatsev updated CSS build to inlcude the IE8-specific CSS from a separate file instead of it being inside of sass ([view](https://github.com/videojs/video.js/pull/3380)) ([view2](https://github.com/erikyuzwa/video.js/pull/1)) -* @gkatsev added null checks around navigator.userAgent ([view](https://github.com/videojs/video.js/pull/3502)) -* greenkeeper updated karma dependencies ([view](https://github.com/videojs/video.js/pull/3523)) -* @BrandonOCasey updated language docs to link to IANA language registry ([view](https://github.com/videojs/video.js/pull/3493)) -* @gkatsev removed unused dependencies ([view](https://github.com/videojs/video.js/pull/3516)) -* @misteroneill enabled and updated videojs-standard and fixed an issue with linting ([view](https://github.com/videojs/video.js/pull/3508)) -* @misteroneill updated tests to qunit 2.0 ([view](https://github.com/videojs/video.js/pull/3509)) -* @gkatsev added slack badge to README ([view](https://github.com/videojs/video.js/pull/3527)) -* @gkatsev reverted back to qunitjs 1.x to unbreak IE8. Added es5-shim to tests ([view](https://github.com/videojs/video.js/pull/3533)) -* @gkatsev updated build system to open es5 folder for bundles and dist folder other users ([view](https://github.com/videojs/video.js/pull/3445)) -* greenkeeper updated uglify ([view](https://github.com/videojs/video.js/pull/3547)) -* greenkeeper updated grunt-concurrent ([view](https://github.com/videojs/video.js/pull/3532)) -* greenkeeper updated karma-chrome-launcher ([view](https://github.com/videojs/video.js/pull/3553)) -* @gkatsev added tests for webpack and browserify bundling and node.js requiring ([view](https://github.com/videojs/video.js/pull/3558)) -* @rlchung fixed tests that weren't disposing players when they finished ([view](https://github.com/videojs/video.js/pull/3524)) - -## 5.11.9 (2016-10-25) -* greenkeeper updated karma dependencies ([view](https://github.com/videojs/video.js/pull/3523)) -* update to latest uglify to fix preserve comments issue. Disable screw ie8 option. ([view](https://github.com/videojs/video.js/pull/3709)) -* remove sourcemap generation ([view](https://github.com/videojs/video.js/pull/3710)) - -## 5.11.8 (2016-10-17) -* @misteroneill restore timeupdate/loadedmetadata listeners for duration display ([view](https://github.com/videojs/video.js/pull/3682)) - -## 5.11.7 (2016-09-28) -* @gkatsev checked throwIfWhitespace first in hasElClass ([view](https://github.com/videojs/video.js/pull/3640)) -* @misteroneill pinned grunt-contrib-uglify to ~0.11 to pin uglify to ~2.6 ([view](https://github.com/videojs/video.js/pull/3634)) -* @gkatsev set playerId on new el created for movingMediaElementInDOM. Fixes #3283 ([view](https://github.com/videojs/video.js/pull/3648)) - -## 5.11.6 (2016-08-25) -* @imbcmdth Added exception handling to event dispatcher ([view](https://github.com/videojs/video.js/pull/3580)) - -## 5.11.5 (2016-08-25) -* @misteroneill fixed wrapping native and emulated MediaErrors ([view](https://github.com/videojs/video.js/pull/3562)) -* @snyderizer fixed switching between audio tracks. Fixes #3510 ([view](https://github.com/videojs/video.js/pull/3538)) -* @jbarabander added title attribute to audio button. Fixes #3528 ([view](https://github.com/videojs/video.js/pull/3565)) -* @misteroneill fixed IE8 media error test failure ([view](https://github.com/videojs/video.js/pull/3568)) - -## 5.11.4 (2016-08-16) -_(none)_ - -## 5.11.3 (2016-08-15) -* @vdeshpande fixed control text for fullscreen button ([view](https://github.com/videojs/video.js/pull/3485)) -* @mister-ben fixed android treating swipe as a tap ([view](https://github.com/videojs/video.js/pull/3514)) -* @mboles updated duration() method documentation ([view](https://github.com/videojs/video.js/pull/3515)) -* @mister-ben silenced chrome's play() request was interrupted by pause() error ([view](https://github.com/videojs/video.js/pull/3518)) - -## 5.11.2 (2016-08-09) -_(none)_ - -## 5.11.1 (2016-08-08) -* @vxsx fixed legend selector to be more specific. Fixes #3492 ([view](https://github.com/videojs/video.js/pull/3494)) - -## 5.11.0 (2016-07-22) -* @BrandonOCasey Document audio/video track usage ([view](https://github.com/videojs/video.js/pull/3295)) -* @hartman Correct documentation to refer to nativeTextTracks option ([view](https://github.com/videojs/video.js/pull/3309)) -* @nickygerritsen Also pass tech options to canHandleSource ([view](https://github.com/videojs/video.js/pull/3303)) -* @misteroneill Un-deprecate the videojs.players property ([view](https://github.com/videojs/video.js/pull/3299)) -* @nickygerritsen Add title to all clickable components ([view](https://github.com/videojs/video.js/pull/3296)) -* @nickygerritsen Update Dutch language file ([view](https://github.com/videojs/video.js/pull/3297)) -* @hartman Add descriptions and audio button to adaptive classes ([view](https://github.com/videojs/video.js/pull/3312)) -* @MattiasBuelens Retain details from tech error ([view](https://github.com/videojs/video.js/pull/3313)) -* @nickygerritsen Fix test for tooltips in IE8 ([view](https://github.com/videojs/video.js/pull/3327)) -* @mboles added loadstart event to jsdoc ([view](https://github.com/videojs/video.js/pull/3370)) -* @hartman added default print styling ([view](https://github.com/videojs/video.js/pull/3304)) -* @ldayananda updated videojs to not do anything if no src is set ([view](https://github.com/videojs/video.js/pull/3378)) -* @nickygerritsen removed unused tracks when changing sources. Fixes #3000 ([view](https://github.com/videojs/video.js/pull/3002)) -* @vit-koumar updated Flash tech to return Infinity from duration instead of -1 ([view](https://github.com/videojs/video.js/pull/3128)) -* @alex-phillips added ontextdata to Flash tech ([view](https://github.com/videojs/video.js/pull/2748)) -* @MattiasBuelens updated components to use durationchange only ([view](https://github.com/videojs/video.js/pull/3349)) -* @misteroneill improved Logging for IE < 11 ([view](https://github.com/videojs/video.js/pull/3356)) -* @vdeshpande updated control text of modal dialog ([view](https://github.com/videojs/video.js/pull/3400)) -* @ldayananda fixed mouse handling on menus by using mouseleave over mouseout ([view](https://github.com/videojs/video.js/pull/3404)) -* @mister-ben updated language to inherit correctly and respect the attribute on the player ([view](https://github.com/videojs/video.js/pull/3426)) -* @sashyro fixed nativeControlsForTouch option ([view](https://github.com/videojs/video.js/pull/3410)) -* @tbasse fixed techCall null check against tech ([view](https://github.com/videojs/video.js/pull/2676)) -* @rbran100 checked src and currentSrc in handleTechReady to work around mixed content issues in chrome ([view](https://github.com/videojs/video.js/pull/3287)) -* @OwenEdwards fixed caption settings dialog labels for accessibility ([view](https://github.com/videojs/video.js/pull/3281)) -* @OwenEdwards removed spurious head tags in the simple-embed example ([view](https://github.com/videojs/video.js/pull/3438)) -* @ntadej added a null check to errorDisplay usage ([view](https://github.com/videojs/video.js/pull/3440)) -* @misteroneill fixed logging issues on IE by separating fn.apply and stringify checks ([view](https://github.com/videojs/video.js/pull/3444)) -* @misteroneill fixed npm test from running coveralls locally ([view](https://github.com/videojs/video.js/pull/3449)) -* @gkatsev added es6-shim to tests. Fixes Flash duration test ([view](https://github.com/videojs/video.js/pull/3453)) -* @misteroneill corrects test assertions for older IEs in the log module ([view](https://github.com/videojs/video.js/pull/3454)) -* @gkatsev fixed setting lang by looping through loop element variable and not constant tag ([view](https://github.com/videojs/video.js/pull/3455)) - -## 5.10.8 (2016-08-08) -* @gkatsev re-published to make sure that the audio button has css - -## 5.10.7 (2016-06-27) -* @gkatsev pinned node-sass to 3.4 ([view](https://github.com/videojs/video.js/pull/3401)) -* @mister-ben added try catch to volume and playbackrate checks. Fixes #3315 ([view](https://github.com/videojs/video.js/pull/3320)) -* @m14t removed unused loadEvent property in ControlBar options ([view](https://github.com/videojs/video.js/pull/3363)) -* @bklava updated pt-BR language file ([view](https://github.com/videojs/video.js/pull/3373)) -* @mister-ben updated menus to use default videojs font-family ([view](https://github.com/videojs/video.js/pull/3384)) -* @vdeshpande fixed chapters getting duplicated each time a track is loaded ([view](https://github.com/videojs/video.js/pull/3354)) - -## 5.10.6 (2016-06-20) -* @gkatsev fix not fully minified video.min.js file. - -## 5.10.5 (2016-06-07) -* @gkatsev pinned dependencies to direct versions ([view](https://github.com/videojs/video.js/pull/3338)) -* @gkatsev fixed minified vjs in ie8 when initialized with id string ([view](https://github.com/videojs/video.js/pull/3357)) -* @IJsLauw fixed unhandled exception in deleting poster on ios7 ([view](https://github.com/videojs/video.js/pull/3337)) - -## 5.10.4 (2016-05-31) -* Patch release to fix dist on npm - -## 5.10.3 (2016-05-27) -* @BrandonOCasey fixed source handlers being disposed multiple times when a video is put into the video element directly ([view](https://github.com/videojs/video.js/pull/3343)) - -## 5.10.2 (2016-05-12) -* @gkatsev nulled out currentSource_ in setSource ([view](https://github.com/videojs/video.js/pull/3314)) - -## 5.10.1 (2016-05-03) -* @nickygerritsen Pass tech options to source handlers ([view](https://github.com/videojs/video.js/pull/3245)) -* @gkatsev Use fonts 2.0 that do not require wrapping codepoints ([view](https://github.com/videojs/video.js/pull/3252)) -* @chrisauclair Make controls visible for accessibility reasons ([view](https://github.com/videojs/video.js/pull/3237)) -* @gkatsev updated text track documentation and crossorigin warning. Fixes #1888, #1958, #2628, #3202 ([view](https://github.com/videojs/video.js/pull/3256)) -* @BrandonOCasey added audio and video track support ([view](https://github.com/videojs/video.js/pull/3173)) -* @OwenEdwards added language attribute in HTML files for accessibility ([view](https://github.com/videojs/video.js/pull/3257)) -* @incompl clear currentSource_ after subsequent loadstarts ([view](https://github.com/videojs/video.js/pull/3285)) -* @forbesjo add an audio track selector menu button ([view](https://github.com/videojs/video.js/pull/3223)) - -## 5.9.2 (2016-04-19) -* @gkatsev grouped text track errors in the console, if we can ([view](https://github.com/videojs/video.js/pull/3259)) - -## 5.9.1 (2016-04-19) -* @benjipott updated IS_CHROME to not be true on MS Edge ([view](https://github.com/videojs/video.js/pull/3232)) -* @mister-ben blacklisted Chrome for Android for playback rate support ([view](https://github.com/videojs/video.js/pull/3246)) -* @gkatsev made the first emulated text track enabled by default ([view](https://github.com/videojs/video.js/pull/3248)) -* @gkatsev fixed removeRemoteTextTracks not working with return value from addRemoteTextTracks ([view](https://github.com/videojs/video.js/pull/3253)) -* @forbesjo added back the background color to the poster ([view](https://github.com/videojs/video.js/pull/3267)) -* @gkatsev fixed text track tests for older IEs ([view](https://github.com/videojs/video.js/pull/3269)) - -## 5.9.0 (2016-04-05) -* @gkatsev updated vjs to not add dynamic styles when VIDEOJS_NO_DYNAMIC_STYLE is set ([view](https://github.com/videojs/video.js/pull/3093)) -* @OwenEdwards added basic descriptions track support ([view](https://github.com/videojs/video.js/pull/3098)) -* @kamilbrenk Added lang -* @arius28 added greek translation file (el.json) ([view](https://github.com/videojs/video.js/pull/3185)) -* @ricardosiri68 changed the relative sass paths ([view](https://github.com/videojs/video.js/pull/3147)) -* @gkatsev added an option to keep the tooltips inside the player bounds ([view](https://github.com/videojs/video.js/pull/3149)) -* @defli added currentWidth and currentHeight methods to the player ([view](https://github.com/videojs/video.js/pull/3144)) -* fix IE8 tests for VIDEOJS_NO_DYNAMIC_STYLE ([view](https://github.com/videojs/video.js/pull/3215)) -* @OwenEdwards fixed links adding extra tab stop with IE by removing anchor tags on videojs init ([view](https://github.com/videojs/video.js/pull/3194)) -* @scaryguy updated videojs cdn urls in the README ([view](https://github.com/videojs/video.js/pull/3195)) -* @mister-ben updated the time tooltips to use the chosen font family ([view](https://github.com/videojs/video.js/pull/3213)) -* @OwenEdwards improved handling of deprecated use of Button component ([view](https://github.com/videojs/video.js/pull/3236)) -* @forbesjo added chrome for PR tests ([view](https://github.com/videojs/video.js/pull/3235)) -* @MCGallaspy added vttjs to the self-hosting guide ([view](https://github.com/videojs/video.js/pull/3229)) -* @chrisauclair added ARIA region and label to player element ([view](https://github.com/videojs/video.js/pull/3227)) -* @andyearnshaw updated document event handlers to use el.ownerDocument ([view](https://github.com/videojs/video.js/pull/3230)) - -## 5.8.8 (2016-04-04) -* @vtytar fixed auto-setup failing if taking too long to load ([view](http://github.com/videojs/video.js/pull/3233)) -* @seescode fixed css failing on IE8 due to incorrect ie8 hack ([view](http://github.com/videojs/video.js/pull/3226)) -* @seescode fixed dragging on mute toggle changing the volume ([view](http://github.com/videojs/video.js/pull/3228)) - -## 5.8.7 (2016-03-29) -* @llun fixed menus from throwing when focused when empty ([view](https://github.com/videojs/video.js/pull/3218)) -* @mister-ben added dir=ltr to control bar and loading spinner ([view](https://github.com/videojs/video.js/pull/3221)) -* @avreg fixed notSupportedMessage saying video when meaning media ([view](https://github.com/videojs/video.js/pull/3222)) -* @mister-ben fixed missing native HTML5 tracks ([view](https://github.com/videojs/video.js/pull/3212)) -* @mister-ben updated Arabic language files ([view](https://github.com/videojs/video.js/pull/3225)) - -## 5.8.6 (2016-03-25) -* @misteroneill fixed typo and indenting in language files ([view](https://github.com/videojs/video.js/pull/3207)) - -## 5.8.5 (2016-03-17) -* @gkatsev cleared vttjs script handlers on dispose. Fixed tests ([view](https://github.com/videojs/video.js/pull/3189)) - -## 5.8.4 (2016-03-17) -* @gkatsev changed emulated tracks to in novtt to wait for vttjs to load or error before parsing ([view](https://github.com/videojs/video.js/pull/3181)) - -## 5.8.3 (2016-03-10) -* @gkatsev fixed keyboard control of menus with titles. Fixes #3164 ([view](https://github.com/videojs/video.js/pull/3165)) - -## 5.8.2 (2016-03-09) -* @gkatsev fixed chapters menu. Fixes #3062 ([view](https://github.com/videojs/video.js/pull/3163)) - -## 5.8.1 (2016-03-07) -* @gkatsev updated videojs badges in the README ([view](https://github.com/videojs/video.js/pull/3134)) -* @BrandonOCasey converted remaining text-track modules to ES6 ([view](https://github.com/videojs/video.js/pull/3130)) -* @gkatsev cleared waiting/spinner on timeupdate. Fixes #3124 ([view](https://github.com/videojs/video.js/pull/3138)) -* @BrandonOCasey updated text track unit tests to use full es6 syntax ([view](https://github.com/videojs/video.js/pull/3148)) -* @defli added missing var to sandbox index.html example ([view](https://github.com/videojs/video.js/pull/3155)) -* @defli fixed typo and updated Turkish translations ([view](https://github.com/videojs/video.js/pull/3156)) -* @OwenEdwards fixed menu closing on ios, specifically ipad ([view](https://github.com/videojs/video.js/pull/3158)) - -## 5.8.0 (2016-02-19) -* @gkatsev added issue and PR templates for github ([view](https://github.com/videojs/video.js/pull/3117)) -* @Nipoto added fa.json (farsi/persian lang file) ([view](https://github.com/videojs/video.js/pull/3116)) -* @forbesjo updated travis to use latest firefox ([view](https://github.com/videojs/video.js/pull/3112)) -* @Naouak updated time display to not change if values do not change ([view](https://github.com/videojs/video.js/pull/3101)) -* @forbesjo updated track settings to not fail restoring settings when localStorage is not available ([view](https://github.com/videojs/video.js/pull/3120)) -* @mister-ben Added en.json as localization template ([view](https://github.com/videojs/video.js/pull/3096)) -* @misteroneill added alt css as video-js-cdn.css ([view](https://github.com/videojs/video.js/pull/3118)) - -## 5.7.1 (2016-02-11) -* @alex-phillips fixed reference to videojs-vtt.js dependency ([view](https://github.com/videojs/video.js/pull/3080)) -* @gkatsev fixed minified videojs in IE8. Fixes #3064 and #3070 ([view](https://github.com/videojs/video.js/pull/3104)) - -## 5.7.0 (2016-02-04) -* @forbesjo updated emulated tracks to have listeners removed when they are removed ([view](https://github.com/videojs/video.js/pull/3046)) -* @incompl improved the UX of time tooltips ([view](https://github.com/videojs/video.js/pull/3060)) -* @gkatsev updated README to include links to plugins page and getting started and cleaner link to LICENSE ([view](https://github.com/videojs/video.js/pull/3066)) -* @hartman Corrected adaptive layout selectors to match their intent ([view](https://github.com/videojs/video.js/pull/2923)) -* @mister-ben updated Umuted to Unmute in lang files ([view](https://github.com/videojs/video.js/pull/3053)) -* @hartman updated fullscreen and time controls for more consistent widths ([view](https://github.com/videojs/video.js/pull/2893)) -* @hartman Set a min-width for the progress slider of 4em ([view](https://github.com/videojs/video.js/pull/2902)) -* @misteroneill fixed iphone useragent detection ([view](https://github.com/videojs/video.js/pull/3077)) -* @erikyuzwa added ability to add child component at specific index ([view](https://github.com/videojs/video.js/pull/2540)) - -## 5.6.0 (2016-01-26) -* @OwenEdwards added ClickableComponent. Fixed keyboard operation of buttons ([view](https://github.com/videojs/video.js/pull/3032)) -* @OwenEdwards Fixed menu keyboard access and ARIA labeling for screen readers ([view](https://github.com/videojs/video.js/pull/3033)) -* @OwenEdwards Fixed volume menu keyboard access ([view](https://github.com/videojs/video.js/pull/3034)) -* @mister-ben made $primary-foreground-color a !default sass var ([view](https://github.com/videojs/video.js/pull/3003)) -* @OwenEdwards fixed double-localization of mute toggle control text ([view](https://github.com/videojs/video.js/pull/3017)) -* @gkatsev checked muted status when updating volume bar level ([view](https://github.com/videojs/video.js/pull/3037)) -* @vitor-faiante updated the guides ([view](https://github.com/videojs/video.js/pull/2781)) -* @aril-spetalen added language support for Norwegian (nb and nn) ([view](https://github.com/videojs/video.js/pull/3021)) -* @CoWinkKeyDinkInc fixed table in Tracks guide. Replaced some single quotes with double quotes ([view](https://github.com/videojs/video.js/pull/2946)) -* @hubdotcom changed URLs in README to be protocol-relative ([view](https://github.com/videojs/video.js/pull/3040)) -* @gkatsev updated to latest videojs-ie8 shim ([view](https://github.com/videojs/video.js/pull/3042)) - -## 5.5.3 (2016-01-15) -* @gkasev updated vjs to correctly return already created player when given an element ([view](https://github.com/videojs/video.js/pull/3006)) -* @mister-ben updated CDN urls in setup guide ([view](https://github.com/videojs/video.js/pull/2984)) -* @rcrooks fixed a couple of docs link and a jsdoc comment ([view](https://github.com/videojs/video.js/pull/2987)) - -## 5.5.2 (2016-01-14) -* make sure that styleEl_ is in DOM before removing on dispose ([view](https://github.com/videojs/video.js/pull/3004)) - -## 5.5.1 (2016-01-08) -* @gkatsev fixed sass if else for icons ([view](https://github.com/videojs/video.js/pull/2988)) - -## 5.5.0 (2016-01-07) -* @hartman fixed usage of lighten in progress component. Fixes #2793 ([view](https://github.com/videojs/video.js/pull/2875)) -* @misteroneill exposed createEl on videojs ([view](https://github.com/videojs/video.js/pull/2926)) -* @huitsing updated docstrings for autoplay and loop methods ([view](https://github.com/videojs/video.js/pull/2960)) -* @rcrooks fixed some broken links in guides ([view](https://github.com/videojs/video.js/pull/2965)) -* @forbesjo fixed errorDisplay erroring on subsequent openings ([view](https://github.com/videojs/video.js/pull/2966)) -* @incompl updated build command in CONTRIBUTING.md ([view](https://github.com/videojs/video.js/pull/2967)) -* @forbesjo updated player to not autoplay if there is no source ([view](https://github.com/videojs/video.js/pull/2971)) -* @gkatsev updated css to have ascii codepoints for fonticons. Expose new scss file ([view](https://github.com/videojs/video.js/pull/2973)) - -## 5.4.6 (2015-12-22) -* @gkatsev fixed vertical slider alignment in volume menu button ([view](https://github.com/videojs/video.js/pull/2943)) - -## 5.4.5 (2015-12-15) -* @gkatsev added mouse/touch listeners to volume menu button ([view](https://github.com/videojs/video.js/pull/2638)) -* @gkatsev updated styles for inline menu and volume bar ([view](https://github.com/videojs/video.js/pull/2913)) -* @BrandonOCasey updated sandbox to to use newer CDN urls ([view](https://github.com/videojs/video.js/pull/2917)) -* @hartman updated options guide doc ([view](https://github.com/videojs/video.js/pull/2908)) -* @rcrooks fixed simple embed example ([view](https://github.com/videojs/video.js/pull/2915)) - -## 5.4.4 (2015-12-09) -* @gkatsev switched to use custom vtt.js from npm ([view](https://github.com/videojs/video.js/pull/2905)) - -## 5.4.3 (2015-12-08) -* @gkatsev updated options customizer and github-release options ([view](https://github.com/videojs/video.js/pull/2903)) - -## 5.4.2 (2015-12-08) -* @gkatsev updated grunt-release config ([view](https://github.com/videojs/video.js/pull/2900)) - -## 5.4.1 (2015-12-08) -* @misteroneill updated videojs-ie8 to 1.1.1 ([view](https://github.com/videojs/video.js/pull/2869)) -* @gkatsev added Player#tech. Fixes #2617 ([view](https://github.com/videojs/video.js/pull/2883)) -* @nick11703 changed multiline comments in sass with single-line comments ([view](https://github.com/videojs/video.js/pull/2827)) -* @gkatsev added a Player#reset method. Fixes #2852 ([view](https://github.com/videojs/video.js/pull/2880)) -* @chemoish emulated HTMLTrackElement to enable track load events ([view](https://github.com/videojs/video.js/pull/2804)) -* @gkatsev added nullcheck for cues in updateForTrack. Fixes #2870 ([view](https://github.com/videojs/video.js/pull/2896)) -* @gkatsev added ability to release next tag from master ([view](https://github.com/videojs/video.js/pull/2894)) -* @gkatsev added chg- and github- release for next releases ([view](https://github.com/videojs/video.js/pull/2899)) - -## 5.3.0 (2015-11-25) -* @forbesjo updated formatTime to not go negative ([view](https://github.com/videojs/video.js/pull/2821)) -* @imbcmdth added sourceOrder option for source-first ordering in selectSource ([view](https://github.com/videojs/video.js/pull/2847)) - -## 5.2.4 (2015-11-25) -* @gesinger checked for track changes before tech started listening ([view](https://github.com/videojs/video.js/pull/2835)) -* @gesinger fixed handler explosion for cuechange events ([view](https://github.com/videojs/video.js/pull/2849)) -* @mmcc fixed vertical volume ([view](https://github.com/videojs/video.js/pull/2859)) - -## 5.2.3 (2015-11-24) -* @gkatsev fixed clearing out errors ([view](https://github.com/videojs/video.js/pull/2850)) - -## 5.2.2 (2015-11-23) -* @DatTran fixed bower paths. Fixes #2740 ([view](https://github.com/videojs/video.js/pull/2775)) -* @nbibler ensured classes begin with alpha characters. Fixes #2828 ([view](https://github.com/videojs/video.js/pull/2829)) -* @bcvio fixed returning current source rather than blob url ([view](https://github.com/videojs/video.js/pull/2833)) -* @tomaspinho added ended event to API docs ([view](https://github.com/videojs/video.js/pull/2836)) -* @paladox updated xhr from deprecated ver to v2.2 ([view](https://github.com/videojs/video.js/pull/2837)) - -## 5.2.1 (2015-11-16) -* @dmlap Check a component is a function before new-ing ([view](https://github.com/videojs/video.js/pull/2814)) -* @ksjun corrected the registerTech export ([view](https://github.com/videojs/video.js/pull/2816)) - -## 5.2.0 (2015-11-10) -* @gkatsev made initListeners more general and added Tech.isTech. Fixes #2767 ([view](https://github.com/videojs/video.js/pull/2773)) -* @dmlap updated swf to 5.0.1 ([view](https://github.com/videojs/video.js/pull/2795)) -* @gkatsev added a tech registry. Fixes #2772 ([view](https://github.com/videojs/video.js/pull/2782)) -* @Lillemanden impoved logic for dividing RTMP paths ([view](https://github.com/videojs/video.js/pull/2787)) -* @bdeitte added a test for improved RTMP path dividing logic ([view](https://github.com/videojs/video.js/pull/2794)) -* @paladox updated grunt-cli dependency ([view](https://github.com/videojs/video.js/pull/2555)) -* @paladox updated grunt-contrib-jshint ([view](https://github.com/videojs/video.js/pull/2554)) -* @siebrand updated dutch translations ([view](https://github.com/videojs/video.js/pull/2556)) -* @misteroneill exposed DOM helpers ([view](https://github.com/videojs/video.js/pull/2754)) -* @incompl fixed broken link to reduced test cases article ([view](https://github.com/videojs/video.js/pull/2801)) -* @zjruan updated text track prototype loops to blacklist constructor for IE8 ([view](https://github.com/videojs/video.js/pull/2565)) -* @gkatsev fixed usage of textTracksToJson ([view](https://github.com/videojs/video.js/pull/2797)) -* @gkatsev updated contrib.json to use / as branch-name separator in feature-accept ([view](https://github.com/videojs/video.js/pull/2803)) -* @gkatsev updated MediaLoader to check for techs in their registry ([view](https://github.com/videojs/video.js/pull/2798)) - -## 5.1.0 (2015-11-02) -* @typcn bumped grunt-sass to ^1.0.0 to support node 4.x ([view](https://github.com/videojs/video.js/pull/2645)) -* @gkatsev removed unhelpful isCrossOrigin test ([view](https://github.com/videojs/video.js/pull/2715)) -* @forbesjo updated karma to use all installed browsers for unit tests ([view](https://github.com/videojs/video.js/pull/2708)) -* @forbesjo removed android/ios tests to increase build stability ([view](https://github.com/videojs/video.js/pull/2739)) -* @nickygerritsen added canPlayType method to player ([view](https://github.com/videojs/video.js/pull/2709)) -* @gkatsev fixes track tests and ignored empty properties in tracks converter ([view](https://github.com/videojs/video.js/pull/2744)) -* @misteroneill added a modal dialog ([view](https://github.com/videojs/video.js/pull/2668)) -* @misteroneill removed z-index from big play button ([view](https://github.com/videojs/video.js/pull/2639)) -* @DaveVoyles updated URL to player API docs ([view](https://github.com/videojs/video.js/pull/2685)) -* @ ([view](https://github.com/videojs/video.js/pull/2691)) -* @kahwee Fixed sandbox plugin example to work in Video.js 5 ([view](https://github.com/videojs/video.js/pull/2691)) -* @Soviut Fixed argument names in some API docs ([view](https://github.com/videojs/video.js/pull/2714)) -* @forbesjo Added Microsoft Caption Maker link ([view](https://github.com/videojs/video.js/pull/2618)) -* @misteroneill updated modal dialog CSS ([view](https://github.com/videojs/video.js/pull/2756)) -* @misteroneill Add browserify -* @brkattk updated emulateTextTrack to exit early if no textTracks ([view](https://github.com/videojs/video.js/pull/2426)) -* @chemoish Fix captions sticking to bottom for webkit browsers. Fixes #2193 ([view](https://github.com/videojs/video.js/pull/2702)) -* @imbcmdth Deferred the implementation of select functions in the tech to source handlers if they provide them ([view](https://github.com/videojs/video.js/pull/2760)) - -## 5.0.2 (2015-10-23) -* @imbcmdth fixed an issue with emulateTextTracks being called before the tech dom was ready ([view](https://github.com/videojs/video.js/pull/2692)) -* @gkatsev bumped obj.assign to fix uncaught SecurityError in iframes. Fixes #2703 ([view](https://github.com/videojs/video.js/pull/2721)) -* @gkatsev updated contrib update and have contrib release only update local branches ([view](https://github.com/videojs/video.js/pull/2723)) -* @gkatsev bumped chg to fix stalling issues ([view](https://github.com/videojs/video.js/pull/2732)) - -## 5.0.0 (2015-09-29) -* @carpasse infer MIME types from file extensions in the HTML5 and Flash techs ([view](https://github.com/videojs/video.js/pull/1974)) -* @mmcc updated the slider to allow for vertical orientation ([view](https://github.com/videojs/video.js/pull/1816)) -* @dmlap removed an ie6 hack for flash object embedding ([view](https://github.com/videojs/video.js/pull/1946)) -* @heff replaced Closure Compiler with Uglify for minification ([view](https://github.com/videojs/video.js/pull/1940)) -* @OleLaursen added a Danish translation ([view](https://github.com/videojs/video.js/pull/1899)) -* @dn5 Added new translations (Bosnian, Serbian, Croatian) ([view](https://github.com/videojs/video.js/pull/1897)) -* @mmcc (and others) converted the whole project to use ES6, Babel and Browserify ([view](https://github.com/videojs/video.js/pull/1976)) -* @heff converted all classes to use ES6 classes ([view](https://github.com/videojs/video.js/pull/1993)) -* @mmcc added ES6 default args and template strings ([view](https://github.com/videojs/video.js/pull/2015)) -* @dconnolly replaced JSON.parse with a safe non-eval JSON parse ([view](https://github.com/videojs/video.js/pull/2077)) -* @mmcc added a new default skin, switched to SASS, modified the html ([view](https://github.com/videojs/video.js/pull/1999)) -* @gkatsev removed event.isDefaultPrevented in favor of event.defaultPrevented ([view](https://github.com/videojs/video.js/pull/2081)) -* @heff added and `extends` function for external subclassing ([view](https://github.com/videojs/video.js/pull/2078)) -* @forbesjo added the `scrubbing` property ([view](https://github.com/videojs/video.js/pull/2080)) -* @heff switched to border-box sizing for all player elements ([view](https://github.com/videojs/video.js/pull/2082)) -* @forbesjo added a vjs-button class to button controls ([view](https://github.com/videojs/video.js/pull/2084)) -* @bc-bbay Load plugins before controls ([view](https://github.com/videojs/video.js/pull/2094)) -* @bc-bbay rename onEvent methods to handleEvent ([view](https://github.com/videojs/video.js/pull/2093)) -* @dmlap added an error message if techOrder is not in options ([view](https://github.com/videojs/video.js/pull/2097)) -* @dconnolly exported the missing videojs.plugin function ([view](https://github.com/videojs/video.js/pull/2103)) -* @mmcc added back the captions settings styles ([view](https://github.com/videojs/video.js/pull/2112)) -* @gkatsev updated the component.js styles to match the new style guide ([view](https://github.com/videojs/video.js/pull/2105)) -* @gkatsev added error logging for bad JSON formatting ([view](https://github.com/videojs/video.js/pull/2113)) -* @gkatsev added a sensible toJSON function ([view](https://github.com/videojs/video.js/pull/2114)) -* @bc-bbay fixed instance where progress bars would go passed 100% ([view](https://github.com/videojs/video.js/pull/2040)) -* @eXon began Tech 2.0 work, improved how tech events are handled by the player ([view](https://github.com/videojs/video.js/pull/2057)) -* @gkatsev added get and set global options methods ([view](https://github.com/videojs/video.js/pull/2115)) -* @heff added support for fluid widths, aspect ratios, and metadata defaults ([view](https://github.com/videojs/video.js/pull/1952)) -* @heff reorganized all utility functions in the codebase ([view](https://github.com/videojs/video.js/pull/2139)) -* @eXon made additional tech 2.0 improvements listed in #2126 ([view](https://github.com/videojs/video.js/pull/2166)) -* @heff Cleaned up and documented src/js/video.js and DOM functions ([view](https://github.com/videojs/video.js/pull/2182)) -* @mmcc Changed to pure CSS slider handles ([view](https://github.com/videojs/video.js/pull/2132)) -* @mister-ben updated language support to handle language codes with regions ([view](https://github.com/videojs/video.js/pull/2177)) -* @heff changed the 'ready' event to always be asynchronous ([view](https://github.com/videojs/video.js/pull/2188)) -* @heff fixed instances of tabIndex that did not have a capital I ([view](https://github.com/videojs/video.js/pull/2204)) -* @heff fixed a number of IE8 and Flash related issues ([view](https://github.com/videojs/video.js/pull/2206)) -* @heff Reverted .video-js inline-block style to fix Flash fullscreen ([view](https://github.com/videojs/video.js/pull/2217)) -* @mmcc switched to using button elements for button components ([view](https://github.com/videojs/video.js/pull/2209)) -* @mmcc increased the size of the progress bar and handle on hover ([view](https://github.com/videojs/video.js/pull/2216)) -* @mmcc moved the fonts into their own repo ([view](https://github.com/videojs/video.js/pull/2223)) -* @mmcc deprecated the options() function and removed internal uses ([view](https://github.com/videojs/video.js/pull/2229)) -* @carpasse enhanced events to allow passing a second data argument ([view](https://github.com/videojs/video.js/pull/2163)) -* @bc-bbay made the duration display update itself on loadedmetadata ([view](https://github.com/videojs/video.js/pull/2169)) -* @arwidt added Swedish and Finnish translations ([view](https://github.com/videojs/video.js/pull/2189)) -* @heff moved all the CDN logic into videojs/cdn ([view](https://github.com/videojs/video.js/pull/2230)) -* @mmcc fixed the progress handle transition jerkiness ([view](https://github.com/videojs/video.js/pull/2219)) -* @dmlap added support for the seekable property ([view](https://github.com/videojs/video.js/pull/2208)) -* @mmcc un-hid the current and remaining times by default ([view](https://github.com/videojs/video.js/pull/2241)) -* @pavelhoral fixed a bug with user activity that caused the control bar to flicker ([view](https://github.com/videojs/video.js/pull/2299)) -* @dmlap updated to videojs-swf@4.7.1 to fix a video dimensions issue on subsequent loads ([view](https://github.com/videojs/video.js/pull/2281)) -* @mmcc added the vjs-big-play-centered class ([view](https://github.com/videojs/video.js/pull/2293)) -* @thijstriemstra added a logged error when a plugin is missing ([view](https://github.com/videojs/video.js/pull/1931)) -* @gkatsev fixed the texttrackchange event and text track display for non-native tracks ([view](https://github.com/videojs/video.js/pull/2215)) -* @mischizzle fixed event.relatedTarget in Firefox ([view](https://github.com/videojs/video.js/pull/2025)) -* @mboles updated JSDoc comments everywhere to prepare for new docs ([view](https://github.com/videojs/video.js/pull/2270)) -* @mmcc added a currentTime tooltip to the progress handle ([view](https://github.com/videojs/video.js/pull/2255)) -* @pavelhoral fixed subclassing without a constructor ([view](https://github.com/videojs/video.js/pull/2308)) -* @dmlap fixed a vjs_getProperty error caused by a progress check before the swf was ready ([view](https://github.com/videojs/video.js/pull/2316)) -* @dmlap exported the videojs.log function ([view](https://github.com/videojs/video.js/pull/2317)) -* @gkatsev updated vttjs to fix a trailing comma JSON error ([view](https://github.com/videojs/video.js/pull/2331)) -* @gkatsev exported the videojs.bind() function ([view](https://github.com/videojs/video.js/pull/2332)) -* Insert cloned el back into DOM. Fixes #2214 ([view](https://github.com/videojs/video.js/pull/2334)) -* @heff sped up testing ([view](https://github.com/videojs/video.js/pull/2254)) -* pass fs state to player from enterFullscreen, split full-window styles into their own selector ([view](https://github.com/videojs/video.js/pull/2357)) -* Fixed vertical option for volumeMenuButton ([view](https://github.com/videojs/video.js/pull/2352)) -* @dmlap switched events to not bubble by default ([view](https://github.com/videojs/video.js/pull/2351)) -* @dmlap export videojs.createTimeRange ([view](https://github.com/videojs/video.js/pull/2361)) -* @dmlap export a basic played() on techs ([view](https://github.com/videojs/video.js/pull/2384)) -* @dmlap use seekable on source handlers when defined ([view](https://github.com/videojs/video.js/pull/2376)) -* @dmlap fire seeking in the flash tech, not the SWF ([view](https://github.com/videojs/video.js/pull/2372)) -* @dmlap expose the xhr helper utility ([view](https://github.com/videojs/video.js/pull/2321)) -* @misteroneill fixed internal extends usage and added a deprecation warning ([view](https://github.com/videojs/video.js/pull/2390)) -* @eXon added the poster to the options the tech receives ([view](https://github.com/videojs/video.js/pull/2338)) -* @eXon made sure the volume persists between tech changes ([view](https://github.com/videojs/video.js/pull/2340)) -* @eXon added the language to the options the tech receives ([view](https://github.com/videojs/video.js/pull/2338)) -* @mmcc Added "inline" option to MenuButton and updated VolumeMenuButton to be able to utilize it ([view](https://github.com/videojs/video.js/pull/2378)) -* @misteroneill restore some properties on window.videojs. ([view](https://github.com/videojs/video.js/pull/2395)) -* @misteroneill restore some 4.x utilities and remove deprecated functionality ([view](https://github.com/videojs/video.js/pull/2406)) -* @heff use a synchronous ready() internally ([view](https://github.com/videojs/video.js/pull/2392)) -* @nickygerritsen scrubbing() is a method, not a property ([view](https://github.com/videojs/video.js/pull/2411)) -* @sirlancelot change "video" to "media" in error messages ([view](https://github.com/videojs/video.js/pull/2409)) -* @nickygerritsen use the default seekable when a source handler is unset ([view](https://github.com/videojs/video.js/pull/2401)) -* @gkatsev always use emulated TextTrackLists so tracks survive tech switches ([view](https://github.com/videojs/video.js/pull/2425)) -* @misteroneill restore Html5.Events ([view](https://github.com/videojs/video.js/pull/2421)) -* @misteroneill removed the deprecated Component init method ([view](https://github.com/videojs/video.js/pull/2427)) -* @misteroneill restore videojs.formatTime ([view](https://github.com/videojs/video.js/pull/2420)) -* @misteroneill include child components with `true` in options ([view](https://github.com/videojs/video.js/pull/2424)) -* @misteroneill create video.novtt.js in dist builds ([view](https://github.com/videojs/video.js/pull/2447)) -* @misteroneill pass vtt.js option to tech ([view](https://github.com/videojs/video.js/pull/2448)) -* @forbesjo updated the sauce labs config and browser versions ([view](https://github.com/videojs/video.js/pull/2450)) -* @mmcc made sure controls respect muted attribute ([view](https://github.com/videojs/video.js/pull/2408)) -* @dmlap switched global options back to an object at videojs.options ([view](https://github.com/videojs/video.js/pull/2461)) -* @ogun fixed a typo in the Turkish translation ([view](https://github.com/videojs/video.js/pull/2460)) -* @gkatsev fixed text track errors on dispose and in cross-browser testing ([view](https://github.com/videojs/video.js/pull/2466)) -* @mmcc added type=button to button components ([view](https://github.com/videojs/video.js/pull/2471)) -* @mmcc Fixed IE by using setAttribute to set 'type' property ([view](https://github.com/videojs/video.js/pull/2487)) -* @misternoneill fixed vertical slider issues ([view](https://github.com/videojs/video.js/pull/2469)) -* @gkatsev moved default and player dimensions to style els at the top of HEAD ([view](https://github.com/videojs/video.js/pull/2482)) -* @gkatsev moved default and player dimensions to style els at the top of HEAD el ([view](https://github.com/videojs/video.js/pull/2482)) -* @gkatsev removed non-default track auto-disabling ([view](https://github.com/videojs/video.js/pull/2475)) -* @gkatsev exported event helpers on videojs object ([view](https://github.com/videojs/video.js/pull/2491)) -* @nickygerritsen fixed texttrack handling in IE10 ([view](https://github.com/videojs/video.js/pull/2481)) -* @gkatsev deep clone el for iOS to preserve tracks ([view](https://github.com/videojs/video.js/pull/2494)) -* @forbesjo switched automated testing to BrowserStack ([view](https://github.com/videojs/video.js/pull/2492)) -* @gkatsev fixed nativeControlsForTouch handling. Defaults to native controls on iphone and native android browsers. ([view](https://github.com/videojs/video.js/pull/2499)) -* @heff fixed cross-platform track tests by switching to a fake tech ([view](https://github.com/videojs/video.js/pull/2496)) -* @gkatsev improved tech controls listener handling. ([view](https://github.com/videojs/video.js/pull/2511)) -* @dmlap move seek on replay into the flash tech ([view](https://github.com/videojs/video.js/pull/2527)) -* @dmlap @gkatsev improve Flash tech error property and add an error setter to the base tech ([view](https://github.com/videojs/video.js/pull/2517)) -* @dmlap update to videojs-swf 5.0.0-rc1 ([view](https://github.com/videojs/video.js/pull/2528)) -* @dmlap expose start and end buffered times ([view](https://github.com/videojs/video.js/pull/2501)) -* @heff fixed a number of console errors after testing ([view](https://github.com/videojs/video.js/pull/2513)) -* @gkatsev made the sass files available via npm in src/css ([view](https://github.com/videojs/video.js/pull/2546)) -* @heff removed playerOptions from plugin options because it created an inconsistency in plugin inits ([view](https://github.com/videojs/video.js/pull/2532)) -* @heff added a default data attribute to fix the progress handle display in IE8 ([view](https://github.com/videojs/video.js/pull/2547)) -* @heff added back the default cdn url for the swf ([view](https://github.com/videojs/video.js/pull/2533)) -* @gkatsev fixed the default state of userActive ([view](https://github.com/videojs/video.js/pull/2557)) -* @heff fixed event bubbling in IE8 ([view](https://github.com/videojs/video.js/pull/2563)) -* @heff cleaned up internal duration handling ([view](https://github.com/videojs/video.js/pull/2552)) -* @heff fixed the UI for live streams ([view](https://github.com/videojs/video.js/pull/2557)) -* @gkatsev updated opacity of caption settings background color ([view](https://github.com/videojs/video.js/pull/2573)) -* @gkatsev made all sass variables !default ([view](https://github.com/videojs/video.js/pull/2574)) -* @heff fixed the inline volume control and made it the default ([view](https://github.com/videojs/video.js/pull/2553)) -* @forbesjo fixed webkit deprecation warnings ([view](https://github.com/videojs/video.js/pull/2558)) -* @forbesjo added Android and iOS browser testing ([view](https://github.com/videojs/video.js/pull/2538)) -* @heff improved css selector strengths ([view](https://github.com/videojs/video.js/pull/2583)) -* @heff moved scss vars to be private ([view](https://github.com/videojs/video.js/pull/2584)) -* @heff added a fancy loading spinner ([view](https://github.com/videojs/video.js/pull/2582)) -* @gkatsev added a mouse-hover time display to the progress bar ([view](https://github.com/videojs/video.js/pull/2569)) -* @heff added an attributes argument to createEl() ([view](https://github.com/videojs/video.js/pull/2589)) -* @heff made tech related functions private in the player ([view](https://github.com/videojs/video.js/pull/2590)) -* @heff removed the loadedalldata event ([view](https://github.com/videojs/video.js/pull/2591)) -* @dmlap switched to using raynos/xhr for requests ([view](https://github.com/videojs/video.js/pull/2594)) -* @heff Fixed double loadstart and ready events ([view](https://github.com/videojs/video.js/pull/2605)) -* @gkatsev fixed potential double default style elements ([view](https://github.com/videojs/video.js/pull/2619)) -* @imbcmdth extended createTimeRange to support multiple timeranges ([view](https://github.com/videojs/video.js/pull/2604)) -* @misteroneill rename "extends" to "extend" for ie8 ([view](https://github.com/videojs/video.js/pull/2624)) -* @forbesjo removed the PhantomJS dependency ([view](https://github.com/videojs/video.js/pull/2622)) -* @misteroneill re-exposed videojs.TextTrack ([view](https://github.com/videojs/video.js/pull/2625)) -* @heff removed a second copy of video.novtt.js from dist ([view](https://github.com/videojs/video.js/pull/2630)) -* @heff fixed timeranges deprecation warnings in tests ([view](https://github.com/videojs/video.js/pull/2627)) -* @misteroneill updated play control to use its state for icon ([view](https://github.com/videojs/video.js/pull/2636)) -* @gkatsev exposed isCrossOrigin and used it to enable CORS for textTrack XHRs ([view](https://github.com/videojs/video.js/pull/2633)) -* @misteroneill fixed tsml to be used as a tag for template strings ([view](https://github.com/videojs/video.js/pull/2629)) -* @eXon added support for a tech-supplied poster ([view](https://github.com/videojs/video.js/pull/2339)) -* @heff improved some skin defaults for external styling ([view](https://github.com/videojs/video.js/pull/2642)) -* @heff changed component child lists to arrays instead of objects ([view](https://github.com/videojs/video.js/pull/2477)) - -## 4.12.15 (2015-08-31) -* @dmlap update to videojs-swf 4.7.4 ([view](https://github.com/videojs/video.js/pull/2463)) -* @bc-bbay migrate seeking on replay to the flash tech ([view](https://github.com/videojs/video.js/pull/2519)) -* Updated to v4.7.5 of the swf ([view](https://github.com/videojs/video.js/pull/2531)) - -## 4.12.14 (2015-08-21) -* @gkatsev removed non-default track auto-disabling ([view](https://github.com/videojs/video.js/pull/2468)) - -## 4.12.13 (2015-08-10) -* @dmlap update to videojs-swf v4.7.3 ([view](https://github.com/videojs/video.js/pull/2457)) - -## 4.12.12 (2015-07-23) -* @imbcmdth updated source handlers to use bracket notation so they wont break when using minified videojs ([view](https://github.com/videojs/video.js/pull/2348)) -* @imbcmdth fix potential triggerReady infinite loop ([view](https://github.com/videojs/video.js/pull/2398)) - -## 4.12.11 (2015-07-09) -* @saxena-gaurav updated swf to 4.7.2 to fix flash of previous video frame ([view](https://github.com/videojs/video.js/pull/2300)) -* @gkatsev updated the vtt.js version to fix JSON issues ([view](https://github.com/videojs/video.js/pull/2327)) -* @dmlap fixed an error caused by calling vjs_getProperty on the swf too early ([view](https://github.com/videojs/video.js/pull/2289)) - -## 4.12.10 (2015-06-23) -* @dmlap update to video-js-swf 4.7.1 ([view](https://github.com/videojs/video.js/pull/2280)) -* @imbcmdth src() should not return blob URLs with MSE source handlers ([view](https://github.com/videojs/video.js/pull/2271)) - -## 4.12.9 (2015-06-15) -* @imbcmdth updated currentSrc to return src instead of blob urls in html5 tech. Fixes #2232 ([view](https://github.com/videojs/video.js/pull/2232)) -* @imbcmdth fixed async currentSrc behavior ([view](https://github.com/videojs/video.js/pull/2256)) - -## 4.12.8 (2015-06-05) -* @dmlap add the seekable property ([view](https://github.com/videojs/video.js/pull/2207)) -* @dmlap fix seekable export ([view](https://github.com/videojs/video.js/pull/2227)) - -## 4.12.7 (2015-05-19) -* @tjenkinson Added background-color to vjs-poster to remove transparent borders around scaled poster image ([view](https://github.com/videojs/video.js/pull/2138)) -* @bc-bbay fixed a bug where the player would try to autoplay when there was no source ([view](https://github.com/videojs/video.js/pull/2127)) -* @bc-bbay update time display on loadedmetadata ([view](https://github.com/videojs/video.js/pull/2151)) -* @dmlap update swf to 4.7 to pick up preload fix ([view](https://github.com/videojs/video.js/pull/2170)) - -## 4.12.6 (2015-05-07) -* @saxena-gaurav fixed a bug from disposing after changing techs ([view](https://github.com/videojs/video.js/pull/2125)) - -## 4.12.5 (2015-03-17) -* Updated to videojs-swf v4.5.4 to fix a potential security issue ([view](https://github.com/videojs/video.js/pull/1955)) - -## 4.12.4 (2015-03-05) -* Randomized the Google Analytics calls to stay under the limit ([view](https://github.com/videojs/video.js/pull/1916)) - -## 4.12.3 (2015-02-28) -* @heff fixed setting the source to an empty string ([view](https://github.com/videojs/video.js/pull/1905)) - -## 4.12.2 (2015-02-27) -* @gkatsev fixed disabling of default text tracks ([view](https://github.com/videojs/video.js/pull/1892)) - -## 4.12.1 (2015-02-19) -* @gkatsev fixed the track list reference while switching techs that use emulated tracks ([view](https://github.com/videojs/video.js/pull/1874)) -* @gkatsev fixed a Firefox error with the captions settings select menu options ([view](https://github.com/videojs/video.js/pull/1877)) - -## 4.12.0 (2015-02-17) -* @PeterDaveHello added a Traditional Chinese translation ([view](https://github.com/videojs/video.js/pull/1729)) -* @mmcc updated the hide/show functions to use a class instead of inline styles ([view](https://github.com/videojs/video.js/pull/1681)) -* @mister-ben added better handling of the additional videojs() arguments when the player is already initialized ([view](https://github.com/videojs/video.js/pull/1730)) -* @anhskohbo added a Vietnamese translation ([view](https://github.com/videojs/video.js/pull/1734)) -* @Sxmanek added a Czech translation ([view](https://github.com/videojs/video.js/pull/1739)) -* @jcaron23 added the vjs-scrubbing CSS class and prevented menus from showing while scrubbing ([view](https://github.com/videojs/video.js/pull/1741)) -* @dmlap fixed URL parsing in IE9 ([view](https://github.com/videojs/video.js/pull/1765)) -* @gkatsev Fixed issue where ManualTimeUpdatesOff was not de-registering events ([view](https://github.com/videojs/video.js/pull/1793)) -* @brycefisher Added a guide on player disposal ([view](https://github.com/videojs/video.js/pull/1803)) -* @toniher added a Catalan translation ([view](https://github.com/videojs/video.js/pull/1794)) -* @mmcc added a VERSION key to the videojs object ([view](https://github.com/videojs/video.js/pull/1798)) -* @mmcc fixed an issue with text track hiding introduced in #1681 ([view](https://github.com/videojs/video.js/pull/1804)) -* @dmlap exported video.js as a named AMD module ([view](https://github.com/videojs/video.js/pull/1844)) -* @dmlap fixed poster hiding when the loadstart event does not fire ([view](https://github.com/videojs/video.js/pull/1834)) -* @chikathreesix fixed an object delete error in Chrome ([view](https://github.com/videojs/video.js/pull/1858)) -* @steverandy fixed an issue with scrolling over the player on touch devices ([view](https://github.com/videojs/video.js/pull/1809)) -* @mmcc improved tap sensitivity ([view](https://github.com/videojs/video.js/pull/1830)) -* @mister-ben added a vjs-ended class when playback reaches the end of the timeline ([view](https://github.com/videojs/video.js/pull/1857)) -* @dmlap Add network and ready state properties ([view](https://github.com/videojs/video.js/pull/1854)) -* @woollybogger exported the hasClass function ([view](https://github.com/videojs/video.js/pull/1839)) -* @DevGavin fixed the Chinese translation ([view](https://github.com/videojs/video.js/pull/1841)) -* @iSimonWeb added font-path variable ([view](https://github.com/videojs/video.js/pull/1847)) -* @shoshomiga added a Bulgarian translation ([view](https://github.com/videojs/video.js/pull/1849)) -* @ragecub3 added a Turkish translation ([view](https://github.com/videojs/video.js/pull/1853)) -* @gkatsev greatly improved text track support and implemented vtt.js as the webvtt parser ([view](https://github.com/videojs/video.js/pull/1749)) -* @gkatsev fixed captions showing by default in Chrome and Safari ([view](https://github.com/videojs/video.js/pull/1865)) -* @mister-ben fixed a woff warning in Firefox ([view](https://github.com/videojs/video.js/pull/1870)) - -## 4.11.4 (2015-01-23) -* @heff exported missing source handler functions ([view](https://github.com/videojs/video.js/pull/1787)) -* @heff fixed type support checking for an empty src string ([view](https://github.com/videojs/video.js/pull/1797)) -* @carpasse fixed a bug in updating child indexes after removing components ([view](https://github.com/videojs/video.js/pull/1814)) -* @dmlap fixed a bug where native controls would show after switching techs ([view](https://github.com/videojs/video.js/pull/1811)) -* @H1D fixed an issue with file extension type detection ([view](https://github.com/videojs/video.js/pull/1818)) -* @bclwhitaker updated to v4.5.3 of video-js-swf ([view](https://github.com/videojs/video.js/pull/1823)) - -## 4.11.3 (2014-12-19) -* @gdkraus fixed a bug where you could no longer tab-navigate passed a menu button ([view](https://github.com/videojs/video.js/pull/1760)) -* @matteos exported the setSource functions so source handlers will work in the minified version ([view](https://github.com/videojs/video.js/pull/1753)) -* @matteos fixed RTMP playback ([view](https://github.com/videojs/video.js/pull/1755)) - -## 4.11.2 (2014-12-17) -* @mmcc fixed a bug where the playback rate menu would not open ([view](https://github.com/videojs/video.js/pull/1716)) -* @gkatsev fixed an issue with source handlers that caused subclasses of source handler classes to break ([view](https://github.com/videojs/video.js/pull/1746)) - -## 4.11.1 (2014-12-04) -* @heff fixed a code bug in track XHR requests ([view](https://github.com/videojs/video.js/pull/1715)) - -## 4.11.0 (2014-12-04) -* @rutkat updated sliders to use keydown instead of keyup for more responsive key control ([view](https://github.com/videojs/video.js/pull/1616)) -* @toloudis fixed an issue with checking for an existing source on the video element ([view](https://github.com/videojs/video.js/pull/1651)) -* @rafalwrzeszcz fixed the Flash object tag markup for strict XML ([view](https://github.com/videojs/video.js/pull/1702)) -* @thijstriemstra fixed a number of typos in the docs ([view](https://github.com/videojs/video.js/pull/1704)) -* @heff added the Source Handler interface for handling advanced formats including adaptive streaming ([view](https://github.com/videojs/video.js/pull/1560)) -* @azawawi added an Arabic translation ([view](https://github.com/videojs/video.js/pull/1692)) -* @mmcc added functions for better timeout and interval handling ([view](https://github.com/videojs/video.js/pull/1642)) -* @mmcc fixed the vdata exception when you dispose a player with tracks ([view](https://github.com/videojs/video.js/pull/1710)) -* @nemesreviz added a Hungarian translation ([view](https://github.com/videojs/video.js/pull/1711)) -* @heff updated the SWF to the latest version ([view](https://github.com/videojs/video.js/pull/1714)) - -## 4.10.2 (2014-10-30) -* @heff fixed checking for child options in the parent options to allow for 'false' ([view](https://github.com/videojs/video.js/pull/1630)) -* @heff fixed the VolumeMenuButton options to allow passing 'vertical' to the VolumeBar ([view](https://github.com/videojs/video.js/pull/1631)) -* @mmcc fixed localization of captions/subtitles menu off buttons ([view](https://github.com/videojs/video.js/pull/1632)) - -## 4.10.1 (2014-10-29) -@heff removed his own stupid error [view](https://github.com/videojs/video.js/commit/a12dd770572a7f16e436e2332eba7ffbb1f1b9b9) - -## 4.10.0 (2014-10-28) -* @aptx4869 fixed an issue where the native JSON parser wasn't used ([view](https://github.com/videojs/video.js/pull/1565)) -* @andekande improved the German translation ([view](https://github.com/videojs/video.js/pull/1555)) -* @OlehTsvirko added a Ukrainian translation ([view](https://github.com/videojs/video.js/pull/1562)) -* @OlehTsvirko added a Russian translation ([view](https://github.com/videojs/video.js/pull/1563)) -* @thijstriemstra added a Dutch translation ([view](https://github.com/videojs/video.js/pull/1566)) -* @heff updated the poster to use CSS styles to display; fixed the poster not showing if not originally set ([view](https://github.com/videojs/video.js/pull/1568)) -* @mmcc fixed an issue where errors on source tags could get missed ([view](https://github.com/videojs/video.js/pull/1575)) -* @heff enhanced the event listener API to allow for auto-cleanup of listeners on other componenets and elements ([view](https://github.com/videojs/video.js/pull/1588)) -* @mmcc fixed an issue with the VolumeButton assuming it was vertical by default ([view](https://github.com/videojs/video.js/pull/1592)) -* @DevGavin added a Simplified Chinese translation ([view](https://github.com/videojs/video.js/pull/1593)) -* @heff Added the ability to set options for child components directly in the parent options ([view](https://github.com/videojs/video.js/pull/1599)) -* @heff turned on the custom html controls for touch devices ([view](https://github.com/videojs/video.js/pull/1617)) - -## 4.9.1 (2014-10-15) -* Bumped to videojs-swf v4.5.1 to fix a data sanitization issue ([view](https://github.com/videojs/video.js/pull/1587)) - -## 4.9.0 (2014-09-30) -* @deedos added a Brazilian Portuguese translation ([view](https://github.com/videojs/video.js/pull/1520)) -* @baloneysandwiches added a hasClass method ([view](https://github.com/videojs/video.js/pull/1464)) -* @mynameisstephen fixed an issue where slider event listeners were not being cleaned up ([view](https://github.com/videojs/video.js/pull/1475)) -* @alexrqs cleaned up the Spanish translation ([view](https://github.com/videojs/video.js/pull/1494)) -* @t2y added a Japanese translation ([view](https://github.com/videojs/video.js/pull/1497)) -* @chikathreesix fixed an issue where data-setup options could be missed ([view](https://github.com/videojs/video.js/pull/1514)) -* @seniorflexdeveloper added new translations and translation updates ([view](https://github.com/videojs/video.js/pull/1530)) -* @chikathreesix exported the videojs.Flash.embed method ([view](https://github.com/videojs/video.js/pull/1533)) -* @doublex fixed an issue with IE7 backwards compatibility ([view](https://github.com/videojs/video.js/pull/1542)) -* @mmcc made it possible to override the font-size of captions and subtitles ([view](https://github.com/videojs/video.js/pull/1547)) -* @philipgiuliani added an Italian translation ([view](https://github.com/videojs/video.js/pull/1550)) -* @twentyrogersc fixed the return value when setting the poster source ([view](https://github.com/videojs/video.js/pull/1552)) -* @heff updated to swf v4.5.0 to fix event issues ([view](https://github.com/videojs/video.js/pull/1554)) -* @rpless made the VolumeMenuButton volume more accesible via tab navigation ([view](https://github.com/videojs/video.js/pull/1519)) -* @mmcc added support for audio tags (html5 audio only) ([view](https://github.com/videojs/video.js/pull/1540)) - -## 4.8.5 (2014-09-25) -* Updated to the latest version of the swf to fix HLS playback ([view](https://github.com/videojs/video.js/pull/1538)) - -## 4.8.4 (2014-09-23) -* @gkatsev fixed isFullscreen reporting on iOS devices ([view](https://github.com/videojs/video.js/pull/1511)) - -## 4.8.3 (2014-09-22) -* @heff updated to the latest version of the SWF to 4.4.4 ([view](https://github.com/videojs/video.js/pull/1526)) - -## 4.8.2 (2014-09-16) -* @gkatsev fixed an IE11 bug where pause was not fired when the video ends ([view](https://github.com/videojs/video.js/pull/1512)) - -## 4.8.1 (2014-09-05) -* @dmlap fixed an issue where an error could be fired after player disposal ([view](https://github.com/videojs/video.js/pull/1481)) -* @dmlap fixed poster error handling ([view](https://github.com/videojs/video.js/pull/1482)) -* @dmlap fixed an issue with languages and subclassing the player ([view](https://github.com/videojs/video.js/pull/1483)) -* @mmcc fixed a few CSS issues with the poster and the error 'X' ([view](https://github.com/videojs/video.js/pull/1487)) -* @MrVaykadji and @Calinou added a french translation ([view](https://github.com/videojs/video.js/pull/1467)) -* @heff fixed an internal deprecation warning and missing deprecated functions ([view](https://github.com/videojs/video.js/pull/1488)) - -## 4.8.0 (2014-09-03) -* @andekande added a German translation ([view](https://github.com/videojs/video.js/pull/1426)) -* @mattosborn fixed a bug where getting the video element src would overwrite it ([view](https://github.com/videojs/video.js/pull/1430)) -* @songpete fixed a bug where keyboard events were bubbling and causing additional actions ([view](https://github.com/videojs/video.js/pull/1455)) -* @knabar made the inactivity timeout configurable ([view](https://github.com/videojs/video.js/pull/1409)) -* @seniorflexdeveloper added language files to the distribution for including specific languages ([view](https://github.com/videojs/video.js/pull/1453)) -* @gkatsev improved handling of null and NaN dimension values ([view](https://github.com/videojs/video.js/pull/1449)) -* @gkatsev fixed an issue where the controls would break if Flash was initialized too quickly ([view](https://github.com/videojs/video.js/pull/1470)) -* @mmcc fixed an issue where if no playback tech was supported the error could not be caught ([view](https://github.com/videojs/video.js/pull/1473)) - -## 4.7.3 (2014-08-20) -* Added function for adding new language translations, updated docs, and fixed the notSupportedMessage translation ([view](https://github.com/videojs/video.js/pull/1427)) -* Exposed the player.selectSource method to allow overriding the source selection order ([view](https://github.com/videojs/video.js/pull/1424)) - -## 4.7.2 (2014-08-14) -* Fixed a case where timeupdate events were not firing, and fixed and issue with the Flash player version ([view](https://github.com/videojs/video.js/pull/1417)) - -## 4.7.1 (2014-08-06) -* Fixed the broken bower.json config ([view](https://github.com/videojs/video.js/pull/1401)) - -## 4.7.0 (2014-08-05) -* Added cross-browser isArray for cross-frame support. fixes #1195 ([view](https://github.com/videojs/video.js/pull/1218)) -* Fixed support for webvtt chapters. Fixes #676. ([view](https://github.com/videojs/video.js/pull/1221)) -* Fixed issues around webvtt cue time parsing. Fixed #877, fixed #183. ([view](https://github.com/videojs/video.js/pull/1236)) -* Fixed an IE11 issue where clicking on the video wouldn't show the controls ([view](https://github.com/videojs/video.js/pull/1291)) -* Added a composer.json for PHP packages ([view](https://github.com/videojs/video.js/pull/1241)) -* Exposed the vertical option for slider controls ([view](https://github.com/videojs/video.js/pull/1303)) -* Fixed an error when disposing a tech using manual timeupdates ([view](https://github.com/videojs/video.js/pull/1312)) -* Exported missing Player API methods (remainingTime, supportsFullScreen, enterFullWindow, exitFullWindow, preload) ([view](https://github.com/videojs/video.js/pull/1328)) -* Added a base for running saucelabs tests from grunt ([view](https://github.com/videojs/video.js/pull/1215)) -* Added additional browsers for saucelabs testing ([view](https://github.com/videojs/video.js/pull/1216)) -* Added support for listening to multiple events through a types array ([view](https://github.com/videojs/video.js/pull/1231)) -* Exported the vertical option for the volume slider ([view](https://github.com/videojs/video.js/pull/1378)) -* Fixed Component trigger function arguments and docs ([view](https://github.com/videojs/video.js/pull/1310)) -* Now copying all attributes from the original video tag to the generated video element ([view](https://github.com/videojs/video.js/pull/1321)) -* Added files to be ignored in the bower.json ([view](https://github.com/videojs/video.js/pull/1337)) -* Fixed an error that could happen if Flash was diposed before the ready callback was fired ([view](https://github.com/videojs/video.js/pull/1340)) -* The up and down arrows can now be used to control sliders in addition to left and right ([view](https://github.com/videojs/video.js/pull/1345)) -* Added a player.currentType() function to get the MIME type of the current source ([view](https://github.com/videojs/video.js/pull/1320)) -* Fixed a potential conflict with other event listener shims ([view](https://github.com/videojs/video.js/pull/1363)) -* Added support for multiple time ranges in the load progress bar ([view](https://github.com/videojs/video.js/pull/1253)) -* Added vjs-waiting and vjs-seeking css classnames and updated the spinner to use them ([view](https://github.com/videojs/video.js/pull/1351)) -* Now restoring the original video tag attributes on a tech change to support webkit-playsinline ([view](https://github.com/videojs/video.js/pull/1369)) -* Fixed an issue where the user was unable to scroll/zoom page if touching the video ([view](https://github.com/videojs/video.js/pull/1373)) -* Added "sliding" class for when slider is sliding to help with handle styling ([view](https://github.com/videojs/video.js/pull/1385)) - -## 4.6.4 (2014-07-11) -* Fixed an issue where Flash autoplay would not show the controls ([view](https://github.com/videojs/video.js/pull/1343)) - -## 4.6.3 (2014-06-12) -* Updated to version 4.4.1 of the SWF ([view](https://github.com/videojs/video.js/pull/1285)) -* Fixed a minification issue with the fullscreen event. fixes #1282 ([view](https://github.com/videojs/video.js/pull/1286)) - -## 4.6.2 (2014-06-10) -* Fixed an issue with the firstplay event not firing when autoplaying ([view](https://github.com/videojs/video.js/pull/1271)) - -## 4.6.1 (2014-05-20) -* Udpated playbackRate menu to work in minified version ([view](https://github.com/videojs/video.js/pull/1223)) - -## 4.6.0 (2014-05-20) -* Updated the UI to support live video ([view](https://github.com/videojs/video.js/pull/1121)) -* The UI now resets after a source change ([view](https://github.com/videojs/video.js/pull/1124)) -* Now assuming smart CSS defaults for sliders to prevent reflow on player init ([view](https://github.com/videojs/video.js/pull/1122)) -* Fixed the title element placement in menus [[view](https://github.com/videojs/video.js/pull/1114)] -* Fixed title support for menu buttons ([view](https://github.com/videojs/video.js/pull/1128)) -* Fixed extra mousemove events on Windows caused by certain apps, not users [[view](https://github.com/videojs/video.js/pull/1068)] -* Fixed error due to undefined tech when no source is supported [[view](https://github.com/videojs/video.js/pull/1172)] -* Fixed the progress bar not finishing when manual timeupdate events are used [[view](https://github.com/videojs/video.js/pull/1173)] -* Added a more informative and styled fallback message for non-html5 browsers [[view](https://github.com/videojs/video.js/pull/1181)] -* Added the option to provide an array of child components instead of an object [[view](https://github.com/videojs/video.js/pull/1093)] -* Fixed casing on webkitRequestFullscreen [[view](https://github.com/videojs/video.js/pull/1101)] -* Made tap events on mobile less sensitive to touch moves [[view](https://github.com/videojs/video.js/pull/1111)] -* Fixed the default flag for captions/subtitles tracks [[view](https://github.com/videojs/video.js/pull/1153)] -* Fixed compilation failures with LESS v1.7.0 and GRUNT v0.4.4 [[view](https://github.com/videojs/video.js/pull/1180)] -* Added better error handling across the library [[view](https://github.com/videojs/video.js/pull/1197)] -* Updated captions/subtiles file fetching to support cross-origin requests in older IE browsers [[view](https://github.com/videojs/video.js/pull/1095)] -* Added support for playback rate switching [[view](https://github.com/videojs/video.js/pull/1132)] -* Fixed an issue with the loadstart event order that caused the big play button to not hide [[view](https://github.com/videojs/video.js/pull/1209)] -* Modernized the fullscreen API and added support for IE11 [[view](https://github.com/videojs/video.js/pull/1205)] -* Added cross-browser testing with SauceLabs, and added Karma as the default test runner ([view](https://github.com/videojs/video.js/pull/1187)) -* Fixed saucelabs integration to run on commits in TravisCI ([view](https://github.com/videojs/video.js/pull/1214)) -* Added a clearer error message when a tech is undefined ([view](https://github.com/videojs/video.js/pull/1210)) -* Added a cog icon to the font icons ([view](https://github.com/videojs/video.js/pull/1211)) -* Added a player option to offset the subtitles/captions timing ([view](https://github.com/videojs/video.js/pull/1212)) - -## 4.5.2 (2014-04-12) -* Updated release versioning to include bower.json and component.json - -## 4.5.1 (2014-03-27) -* Fixed a bug from the last release where canPlaySource was no longer exported - -## 4.5.0 (2014-03-27) -* Added component(1) support ([view](https://github.com/videojs/video.js/pull/1032)) -* Captions now move down when controls are hidden ([view](https://github.com/videojs/video.js/pull/1053)) -* Added the .less source file to the distribution files ([view](https://github.com/videojs/video.js/pull/1056)) -* Changed src() to return the current selected source ([view](https://github.com/videojs/video.js/pull/968)) -* Added a grunt task for opening the next issue that needs addressing ([view](https://github.com/videojs/video.js/pull/1059)) -* Fixed Android 4.0+ devices' check for HLS support ([view](https://github.com/videojs/video.js/pull/1084)) - -## 4.4.3 (2014-03-06) -* Fixed bugs in IE9 Windows 7N with no Media Player ([view](https://github.com/videojs/video.js/pull/1060)) -* Fixed a bug with setPoster() in the minified version ([view](https://github.com/videojs/video.js/pull/1062)) - -## 4.4.2 (2014-02-24) -* Fixed module.exports in minified version ([view](https://github.com/videojs/video.js/pull/1038)) - -## 4.4.1 (2014-02-18) -* Added .npmignore so dist files wouldn't be ignored in packages - -## 4.4.0 (2014-02-18) -* Made the poster updateable after initialization ([view](https://github.com/videojs/video.js/pull/838)) -* Exported more textTrack functions ([view](https://github.com/videojs/video.js/pull/815)) -* Moved player ID generation to support video tags with no IDs ([view](https://github.com/videojs/video.js/pull/845)) -* Moved to using QUnit as a dependency ([view](https://github.com/videojs/video.js/pull/850)) -* Added the util namespace for public utility functions ([view](https://github.com/videojs/video.js/pull/862)) -* Fixed an issue with calling duration before Flash is loaded ([view](https://github.com/videojs/video.js/pull/861)) -* Added player methods to externs so they can be overridden ([view](https://github.com/videojs/video.js/pull/878)) -* Fixed html5 playback when switching between media techs ([view](https://github.com/videojs/video.js/pull/887)) -* Fixed Firefox+Flash mousemove events so controls don't hide permanently ([view](https://github.com/videojs/video.js/pull/899)) -* Fixed a test for touch detection ([view](https://github.com/videojs/video.js/pull/962)) -* Updated the src file list for karma tests ([view](https://github.com/videojs/video.js/pull/948)) -* Added more tests for API properties after minification ([view](https://github.com/videojs/video.js/pull/906)) -* Updated projet to use npm version of videojs-swf ([view](https://github.com/videojs/video.js/pull/930)) -* Added support for dist zipping on windows ([view](https://github.com/videojs/video.js/pull/944)) -* Fixed iOS fullscreen issue ([view](https://github.com/videojs/video.js/pull/977)) -* Fixed touch event bubbling ([view](https://github.com/videojs/video.js/pull/992)) -* Fixed ARIA role attribute for button and slider ([view](https://github.com/videojs/video.js/pull/988)) -* Fixed an issue where a component's dispose event would bubble up ([view](https://github.com/videojs/video.js/pull/981)) -* Quieted down deprecation warnings ([view](https://github.com/videojs/video.js/pull/971)) -* Updated the seek handle to contain the current time ([view](https://github.com/videojs/video.js/pull/902)) -* Added requirejs and browserify support (UMD) ([view](https://github.com/videojs/video.js/pull/998)) - -## 4.3.0 (2013-11-04) -* Added Karma for cross-browser unit testing ([view](https://github.com/videojs/video.js/pull/714)) -* Unmuting when the volume is changed ([view](https://github.com/videojs/video.js/pull/720)) -* Fixed an accessibility issue with the big play button ([view](https://github.com/videojs/video.js/pull/777)) -* Exported user activity methods ([view](https://github.com/videojs/video.js/pull/783)) -* Added a classname to center the play button and new spinner options ([view](https://github.com/videojs/video.js/pull/784)) -* Added API doc generation ([view](https://github.com/videojs/video.js/pull/801)) -* Added support for codecs in Flash mime types ([view](https://github.com/videojs/video.js/pull/805)) - -## 4.2.2 (2013-10-15) -* Fixed a race condition that would cause videos to fail in Firefox ([view](https://github.com/videojs/video.js/pull/776)) - -## 4.2.1 (2013-09-09) -* Fixed an infinite loop caused by loading the library asynchronously ([view](https://github.com/videojs/video.js/pull/727)) - -## 4.2.0 (2013-09-04) -* Added LESS as a CSS preprocessor for the default skin ([view](https://github.com/videojs/video.js/pull/644)) -* Exported MenuButtons for use in the API ([view](https://github.com/videojs/video.js/pull/648)) -* Fixed ability to remove listeners added with one() ([view](https://github.com/videojs/video.js/pull/659)) -* Updated buffered() to account for multiple loaded ranges ([view](https://github.com/videojs/video.js/pull/643)) -* Exported createItems() for custom menus ([view](https://github.com/videojs/video.js/pull/654)) -* Preventing media events from bubbling up the DOM ([view](https://github.com/videojs/video.js/pull/630)) -* Major reworking of the control bar and many issues fixed ([view](https://github.com/videojs/video.js/pull/672)) -* Fixed an issue with minifiying the code on Windows systems ([view](https://github.com/videojs/video.js/pull/683)) -* Added support for RTMP streaming through Flash ([view](https://github.com/videojs/video.js/pull/605)) -* Made tech.features available to external techs ([view](https://github.com/videojs/video.js/pull/705)) -* Minor code improvements ([view](https://github.com/videojs/video.js/pull/706)) -* Updated time formatting to support NaN and Infinity ([view](https://github.com/videojs/video.js/pull/627)) -* Fixed an `undefined` error in cases where no tech is loaded ([view](https://github.com/videojs/video.js/pull/632)) -* Exported addClass and removeClass for player components ([view](https://github.com/videojs/video.js/pull/661)) -* Made the fallback message customizable ([view](https://github.com/videojs/video.js/pull/638)) -* Fixed an issue with the loading spinner placement and rotation ([view](https://github.com/videojs/video.js/pull/694)) -* Fixed an issue with fonts being flaky in IE8 - -## 4.1.0 (2013-06-28) -* Turned on method queuing for unready playback technologies (flash) [view](https://github.com/videojs/video.js/pull/553) -* Blocking user text selection on player components [view](https://github.com/videojs/video.js/pull/524) -* Exported requestFullScreen() and cancelFullScreen() in the minified version [view](https://github.com/videojs/video.js/pull/555) -* Exported the global players reference, videojs.players [view](https://github.com/videojs/video.js/pull/560) -* Added google analytics to the CDN version ([view](https://github.com/videojs/video.js/pull/568)) -* Exported fadeIn/fadeOut for the Component API ([view](https://github.com/videojs/video.js/pull/581)) -* Fixed an IE poster error when autoplaying ([view](https://github.com/videojs/video.js/pull/593)) -* Exported bufferedPercent for the API ([view](https://github.com/videojs/video.js/pull/588)) -* Augmented user agent detection, specifically for Android versions ([view](https://github.com/videojs/video.js/pull/470)) -* Fixed IE9 canPlayType error ([view](https://github.com/videojs/video.js/pull/606)) -* Fixed various issues with captions ([view](https://github.com/videojs/video.js/pull/609)) - -## 4.0.4 (2013-06-11) -* Added google analytics to current CDN version. ([view](https://github.com/videojs/video.js/pull/571)) - -## 4.0.3 (2013-05-28) -* Fixed an bug with exiting fullscreen. [view](https://github.com/videojs/video.js/pull/546) - -## 4.0.2 (2013-05-23) -* Correct version number for CDN swf url. Minify CSS. [view](https://github.com/videojs/video.js/pull/535) - -## 4.0.1 (2013-05-22) -* Fixed old IE font loading [view](https://github.com/videojs/video.js/pull/532) - -## 4.0.0 (2013-05-09) -* Improved performance through an 18% size reduction using Google Closure Compiler in advanced mode -* Greater stability through an automated cross-browser/device test suite using TravisCI, Bunyip, and Browserstack. -* New plugin interface and plugin listing for extending Video.js -* New default skin design that uses font icons for greater customization -* Responsive design and retina display support -* Improved accessibility through better ARIA support -* Moved to Apache 2.0 license -* 100% JavaScript development tool set including Grunt -* Updated docs to use Github markdown -* Allow disabling of default components -* Duration is now setable (need ed for HLS m3u8 files) -* Event binders (on/off/one) now return the player instance -* Stopped player from going back to beginning on ended event -* Added support for percent width/height and fluid layouts -* Improved load order of elements to reduce reflow -* Changed addEvent function name to 'on' -* Removed conflicting array.indexOf function -* Added exitFullScreen to support BlackBerry devices (pull/143) - -## 3.2.0 (2012-03-20) -* Updated docs with more options. -* Overhauled HTML5 Track support. -* Fixed Flash always autoplaying when setting source. -* Fixed localStorage context -* Updated 'fullscreenchange' event to be called even if the user presses escape to exit fullscreen. -* Automatically converting URsource URL to absolute for Flash fallback. -* Created new 'loadedalldata' event for when the source is completely downloaded -* Improved player.destroy(). Now removes elements and references. -* Refactored API to be more immediately available. - -### Patches -* 3.2.1 (2012-04-06) Fixed setting width/height with javascript options -* 3.2.2 (2012-05-02) Fixed error with multiple controls fading listeners -* 3.2.3 (2012-11-12) Fixed chrome spinner continuing on seek - -## 3.1.0 (2012-01-30) -* Added CSS fix for Firefox 9 fullscreen (in the rare case that it's enabled) -* Replaced swfobject with custom embed to save file size. -* Added flash iframe-mode, an experimental method for getting around flash reloading issues. -* Fixed issue with volume knob position. Improved controls fading. -* Fixed ian issue with triggering fullscreen a second time. -* Fixed issue with getting attributes in Firefox 3.0 -* Escaping special characters in source URL for Flash -* Added a check for if Firefox is enabled which fixes a Firefox 9 issue -* Stopped spinner from showing on 'stalled' events since browsers sometimes don't show that they've recovered. -* Fixed CDN Version which was breaking dev.html -* Made full-window mode more independent -* Added rakefile for release generation - -## 3.0.0 (2012-01-10) -* Same HTML/CSS Skin for both HTML5 and Flash video -* Super lightweight Flash fallback player for browsers that don’t support HTML5 video -* Free CDN hosting - -### Patches -* 3.0.2 (2012-01-12) Started tracking changes with zenflow -* 3.0.3 (2012-01-12) Added line to docs to test zenflow -* 3.0.4 (2012-01-12) Fixing an undefined source when no sources exist on load -* 3.0.5 (2012-01-12) Removed deprecated event.layerX and layerY -* 3.0.6 (2012-01-12) Fixed wrong URL for CDN in docs -* 3.0.7 (2012-01-12) Fixed an ie8 breaking bug with the poster -* 3.0.8 (2012-01-23) Fixed issue with controls not hiding in IE due to no opacity support diff --git a/node_modules/video.js/LICENSE b/node_modules/video.js/LICENSE deleted file mode 100644 index 8a7f05f..0000000 --- a/node_modules/video.js/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright Brightcove, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/node_modules/video.js/README.md b/node_modules/video.js/README.md deleted file mode 100644 index e58d766..0000000 --- a/node_modules/video.js/README.md +++ /dev/null @@ -1,160 +0,0 @@ -![Video.js logo][logo] - -# [Video.js - HTML5 Video Player][vjs] - -[![Build Status][travis-icon]][travis-link] -[![Coverage Status][coveralls-icon]][coveralls-link] -[![Greenkeeper badge](https://badges.greenkeeper.io/videojs/video.js.svg)](https://greenkeeper.io/) -[![Slack Status][slack-icon]][slack-link] - -[![NPM][npm-icon]][npm-link] - -> Video.js is a web video player built from the ground up for an HTML5 world. It supports HTML5 video and Media Source Extensions, as well as other playback techs like YouTube and Vimeo (through [plugins][plugins]). It supports video playback on desktops and mobile devices. This project was started mid 2010, and the player is now used on over ~~50,000~~ ~~100,000~~ ~~200,000~~ ~~400,000~~ [600,000 websites][builtwith]. - -## Table of Contents - -* [Quick Start](#quick-start) -* [Contributing](#contributing) -* [Code of Conduct](#code-of-conduct) -* [License](#license) - -## Quick Start - -Thanks to the awesome folks over at [Fastly][fastly], there's a free, CDN hosted version of Video.js that anyone can use. Add these tags to your document's ``: - -```html - - -``` - -> For the latest version of video.js and URLs to use, check out the [Getting Started][getting-started] page on our website. - -Video.js version 7 (and newer) CDN builds do not send any data to Google Analytics. - -In older versions of Video.js (6 and earlier), in the `vjs.zencdn.net` CDN-hosted versions we include a [stripped down Google Analytics pixel](https://github.com/videojs/cdn/blob/master/src/analytics.js) that tracks a random sampling (currently 1%) of players loaded from the CDN. This allows us to see (roughly) what browsers are in use in the wild, along with other useful metrics such as OS and device. If you'd like to disable analytics, you can simply include the following global before including Video.js via the free CDN: - -```html - -``` - -Alternatively, you can include Video.js by getting it from [npm](https://videojs.com/getting-started/#install-via-npm), downloading from [GitHub releases](https://github.com/videojs/video.js/releases) or by including it via [unpkg](https://unpkg.com) or another JavaScript CDN like CDNjs. These releases _do not_ include Google Analytics tracking at all. - -```html - - - - - - - - - - - -``` - -Next, using Video.js is as simple as creating a `